ab464cce37315001cc340313100561f2e8a9b549..5c82c389c2aa17069e44d6f39235f02f1422dd83
7 天以前 cnf
合并完成
5c82c3 对比 | 目录
7 天以前 cnf
增加报工接口
d6070f 对比 | 目录
8 天以前 kyy
1、巡检导出2、报工
a3be1e 对比 | 目录
已修改1个文件
已添加1个文件
349 ■■■■■ 文件已修改
WebApi/Gs.Toolbox/ExcelHelper.cs 89 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebApi/Gs.Wom/BaoGong/BaoGongController.cs 260 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebApi/Gs.Toolbox/ExcelHelper.cs
@@ -738,7 +738,6 @@
        }
    }
    /// <summary>
    /// ç”Ÿæˆå·¡æ£€
    /// </summary>
@@ -751,16 +750,14 @@
        //行高
        int rowHeight = 25;
        //总列
        int maxCols = tb1.Columns.Count;
        int maxCols = 10;
        HSSFWorkbook workbook = new HSSFWorkbook();
        ISheet sheet = workbook.CreateSheet("Sheet1");
        // åˆ›å»ºå•元格样式 - å¸¦è¾¹æ¡†å’ŒæŒ‡å®šå­—体
        ICellStyle style = getStyle(workbook);
        ICellStyle styleHeader = getStyle(workbook, 20, true, true);
        ICellStyle style12 = getStyle(workbook, 11, false, true);
        // è®¾ç½®åˆ—宽(6列)
        // è®¾ç½®åˆ—宽(10列)
        sheet.SetColumnWidth(0, 3000);  // ç¬¬ä¸€åˆ—稍宽
        sheet.SetColumnWidth(1, 3000);
        sheet.SetColumnWidth(2, 3000);
@@ -769,8 +766,10 @@
        sheet.SetColumnWidth(5, 3000);
        sheet.SetColumnWidth(6, 3000);
        sheet.SetColumnWidth(7, 3000);
        // åˆ›å»ºè¡Œ
        for (int rowIndex = 0; rowIndex <= 1; rowIndex++)
        sheet.SetColumnWidth(8, 3000);
        sheet.SetColumnWidth(9, 3000);
        // åˆ›å»ºå¤´è¡Œ
        for (int rowIndex = 0; rowIndex <= 2; rowIndex++)
        {
            IRow row = sheet.CreateRow(rowIndex);
            // è®¾ç½®è¡Œé«˜ï¼ˆæ‰€æœ‰è¡Œç›¸åŒé«˜åº¦ï¼‰
@@ -786,31 +785,70 @@
            }
        }
        //第一行列合并
        sheet.AddMergedRegion(new CellRangeAddress(0, 0, 0, 7));
        sheet.AddMergedRegion(new CellRangeAddress(0, 0, 0, 9));
        setCellVal(sheet, 0, 0, row0["title"].ToString());
        //第二行列合并
        sheet.AddMergedRegion(new CellRangeAddress(1, 1, 0, 1));
        sheet.AddMergedRegion(new CellRangeAddress(1, 1, 6, 9));
        setCellVal(sheet, 1, 0, "工单号");
        setCellVal(sheet, 1, 2, row0["daaNo"].ToString());
        setCellVal(sheet, 1, 3, "产品名称");
        setCellVal(sheet, 1, 4, row0["itemName"].ToString());
        setCellVal(sheet, 1, 5, "规格型号");
        setCellVal(sheet, 1, 6, row0["itemModel"].ToString());
        //第三行列合并
        sheet.AddMergedRegion(new CellRangeAddress(2, 2, 2, 4));
        setCellVal(sheet, 2, 0, "序号");
        setCellVal(sheet, 2, 1, "检验项目");
        setCellVal(sheet, 2, 2, "检验标准");
        setCellVal(sheet, 2, 5, row0["tm1"].ToString());
        setCellVal(sheet, 2, 6, row0["tm2"].ToString());
        setCellVal(sheet, 2, 7, row0["tm3"].ToString());
        setCellVal(sheet, 2, 8, row0["tm4"].ToString());
        setCellVal(sheet, 2, 9, row0["tm5"].ToString());
        //循环数据库
        int _idx = 1;
        IRow row6 = sheet.CreateRow(_idx);
        for (int colIndex = 0; colIndex < maxCols; colIndex++)
        {
            ICell cell6 = row6.CreateCell(colIndex);
            cell6.CellStyle = style;
            cell6.SetCellValue(tb1.Columns[colIndex].Caption.ToString().Trim());
        }
        _idx++;
        int _idx = 3;
        foreach (DataRow rrr in tb1.Rows)
        {
            IRow row7 = sheet.CreateRow(_idx);
            row7.HeightInPoints = rowHeight;
            for (int colIndex = 0; colIndex < tb1.Columns.Count; colIndex++)
            for (int colIndex = 0; colIndex < maxCols; colIndex++)
            {
                ICell cell7 = row7.CreateCell(colIndex);
                cell7.CellStyle = style;
                cell7.SetCellValue(rrr[tb1.Columns[colIndex]].ToString());
                // cell7.SetCellValue("1");
                switch (colIndex)
                {
                    case 0:
                        cell7.SetCellValue(rrr["序号"].ToString());
                        break;
                    case 1:
                        sheet.AddMergedRegion(new CellRangeAddress(_idx, _idx, 2, 4));
                        cell7.SetCellValue(rrr["检验项目"].ToString());
                        break;
                    case 2:
                        cell7.SetCellValue(rrr["检验标准"].ToString());
                        break;
                    case 5:
                        cell7.SetCellValue(rrr["tm1"].ToString());
                        break;
                    case 6:
                        cell7.SetCellValue(rrr["tm2"].ToString());
                        break;
                    case 7:
                        cell7.SetCellValue(rrr["tm3"].ToString());
                        break;
                    case 8:
                        cell7.SetCellValue(rrr["tm4"].ToString());
                        break;
                    case 9:
                        cell7.SetCellValue(rrr["tm5"].ToString());
                        break;
                }
            }
            _idx++;
        }
        //备注
        ////备注
        IRow row8 = sheet.CreateRow(_idx);
        row8.HeightInPoints = rowHeight;
        for (int colIndex = 0; colIndex < maxCols; colIndex++)
@@ -818,12 +856,13 @@
            ICell cell = row8.CreateCell(colIndex);
            cell.CellStyle = style12;
        }
        sheet.AddMergedRegion(new CellRangeAddress(_idx, _idx, 0, 2));
        sheet.AddMergedRegion(new CellRangeAddress(_idx, _idx, 0, 4));
        setCellVal(sheet, _idx, 0, "巡检人:");
        for (int colIndex = 2; colIndex < tb1.Columns.Count; colIndex++)
        {
            setCellVal(sheet, _idx, colIndex, "余吉林");
        }
        setCellVal(sheet, _idx, 5, row0["xjr1"].ToString());
        setCellVal(sheet, _idx, 6, row0["xjr2"].ToString());
        setCellVal(sheet, _idx, 7, row0["xjr3"].ToString());
        setCellVal(sheet, _idx, 8, row0["xjr4"].ToString());
        setCellVal(sheet, _idx, 9, row0["xjr5"].ToString());
        //保存
        using (var ms = new MemoryStream())
        {
WebApi/Gs.Wom/BaoGong/BaoGongController.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,260 @@
using Gs.Toolbox;
using Gs.Toolbox.ApiCore.Abstract.Mvc;
using Gs.Toolbox.ApiCore.Common.Mvc;
using Gs.Toolbox.ApiCore.Group;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System.Data;
using System.Data.SqlClient;
using System.Dynamic;
using static Gs.Toolbox.UtilityHelper;
namespace Gs.Wom.BaoGong
{
    /// <summary>
    /// æŠ¥å·¥
    /// </summary>
    [ApiGroup(ApiGroupNames.WOM)]
    public class BaoGongController : IRomteService
    {
        private readonly IHttpContextAccessor _http;
        private readonly string _userCode, _userGuid, _orgFids;
        public BaoGongController(IHttpContextAccessor httpContextAccessor)
        {
            _http = httpContextAccessor;
            (_userCode, _userGuid, _orgFids) =
                GetUserGuidAndOrgGuid(_http);
        }
        /// <summary>
        /// è¯»å–产线列表
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [RequestMethod(RequestMethods.POST)]
        public ReturnDto<List<dynamic>> GetLineList([FromBody] dynamic model)
        {
            string inCjId = model.inCjId;
            var lst = new List<dynamic>();
            var dset = new DataSet();
            SqlParameter[] parameters =
            {
                new("@inCjId", inCjId),
             };
            try
            {
                dset = DbHelperSQL.RunProcedure("bg_line_list", parameters, "0");
            }
            catch (Exception ex)
            {
                LogHelper.Debug(ToString(), ex.Message);
            }
            string strMsg = "";
            if (dset != null && dset.Tables.Count > 0 && dset.Tables[0].Rows.Count > 0)
            {
                lst = dset.Tables[0].TableToDynamicList();
                strMsg = dset.Tables[1].Rows[0]["dptName"].ToString();
            }
            return ReturnDto<List<dynamic>>.QuickReturn(lst, ReturnCode.Success,
                strMsg);
        }
        /// <summary>
        /// è¯»å–工单列表
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [RequestMethod(RequestMethods.POST)]
        public ReturnDto<List<dynamic>> GetDaaList([FromBody] dynamic model)
        {
            string inLineId = model.inLineId;
            var lst = new List<dynamic>();
            var dset = new DataSet();
            SqlParameter[] parameters =
            {
                new("@inLineId", inLineId),
             };
            try
            {
                dset = DbHelperSQL.RunProcedure("bg_daa_list", parameters, "0");
            }
            catch (Exception ex)
            {
                LogHelper.Debug(ToString(), ex.Message);
            }
            if (dset != null && dset.Tables.Count > 0 && dset.Tables[0].Rows.Count > 0)
                lst = dset.Tables[0].TableToDynamicList();
            return ReturnDto<List<dynamic>>.QuickReturn(lst, ReturnCode.Success,
                "读取成功!");
        }
        /// <summary>
        /// è¯»å–员工列表
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [RequestMethod(RequestMethods.POST)]
        public ReturnDto<List<dynamic>> GetYgList([FromBody] dynamic model)
        {
            string inCjId = model.inCjId;
            var lst = new List<dynamic>();
            var dset = new DataSet();
            SqlParameter[] parameters =
            {
                new("@inCjId", inCjId),
             };
            try
            {
                dset = DbHelperSQL.RunProcedure("bg_yg_list", parameters, "0");
            }
            catch (Exception ex)
            {
                LogHelper.Debug(ToString(), ex.Message);
            }
            if (dset != null && dset.Tables.Count > 0 && dset.Tables[0].Rows.Count > 0)
                lst = dset.Tables[0].TableToDynamicList();
            return ReturnDto<List<dynamic>>.QuickReturn(lst, ReturnCode.Success,
                "读取成功!");
        }
        /// <summary>
        ///     è¯»å–工单信息
        /// </summary>
        /// <param name="guid"></param>
        /// <returns></returns>
        [RequestMethod(RequestMethods.POST)]
        public ReturnDto<ExpandoObject> GetModel([FromBody] dynamic model)
        {
            string inDaaGuid = model.inDaaGuid.ToString();
            dynamic m = new ExpandoObject();
            m.list = new List<dynamic>();
            SqlParameter[] parameters =
            {
            new("@inDaaGuid", inDaaGuid),
            new("@inUserGuid", _userGuid)
        };
            var dset = new DataSet();
            try
            {
                dset = DbHelperSQL.RunProcedure("bg_daa_info", parameters,
                    "0");
                if (dset != null && dset.Tables.Count > 0 &&
                    dset.Tables[0].Rows.Count > 0)
                {
                    var dr = dset.Tables[0].Rows[0];
                    m = dr.RowToDynamic();
                    var _tb = dset.Tables[1].TableToDynamicList();
                    m.list = _tb;
                }
            }
            catch (Exception ex)
            {
                LogHelper.Debug(ToString(), ex.Message);
            }
            if (m != null)
                return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Success,
                    "读取成功!");
            return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Default, "读取失败!");
        }
        /// <summary>
        ///   æ‰“码报工,先调用 rpt_daa,再调用 prc_pda_scbg
        /// </summary>
        /// <param name="guid"></param>
        /// <returns></returns>
        [RequestMethod(RequestMethods.POST)]
        public ReturnDto<ExpandoObject> DaaDmbg([FromBody] dynamic model)
        {
            string _inEdtUserGuid = _userGuid;
            string _inOrderGuid = model.inDaaGuid.ToString();
            string _isDesign = "0";//100重打,1是设计
            string _in4 = "1";//扩展用,张数(打印张数)
            string _in5 = model.bzsl.ToString();//扩展用,数量(内包装数量)
            dynamic m = new ExpandoObject();
            m.outSum = -1;
            m.outMsg = "";
            SqlParameter[] parameters =
            {
            new("@inOrderGuid", _inOrderGuid),
            new("@isDesign", _isDesign),
            new("@in1", ""),
            new("@in2", ""),
            new("@in3", 0),
            new("@in4", _in4),
            new("@in5", _in5),
            new("@in6", "")
        };
            var dset = new DataSet();
            try
            {
                //1先调用 rpt_daa
                dset = DbHelperSQL.RunProcedure("rpt_daa", parameters, "0");
                if (dset != null && dset.Tables.Count > 0 &&
                    dset.Tables[0].Rows.Count > 0)
                {
                    if (dset.Tables.Count != 3)
                    {
                        m.outSum = -1;
                        m.outMsg = dset.Tables[0].Rows[0]["msgTxt"].ToString();
                        return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Default, m.outMsg);
                    }
                    #region å†è°ƒç”¨ prc_pda_scbg
                    string pi_barcode = dset.Tables[1].Rows[0]["ITEM_BARCODE"].ToString();
                    using (var conn = new SqlConnection(DbHelperSQL.strConn))
                    {
                        using (var cmd = new SqlCommand("prc_pda_scbg", conn))
                        {
                            try
                            {
                                conn.Open();
                                cmd.CommandType = CommandType.StoredProcedure;
                                SqlParameter[] parameters2 =
                                  {
                                    new("@pi_user", _userCode),
                                    new("@pi_barcode", pi_barcode),
                                    new("@pi_inp1", ""),
                                    new("@pi_inp2", ""),
                                    new("@po_outMsg", SqlDbType.NVarChar, 300),
                                    new("@po_outSum", SqlDbType.NVarChar, 300),
                                    new("@po_womInBarSum",SqlDbType.NVarChar, 300),
                                };
                                parameters2[4].Direction = ParameterDirection.Output;
                                parameters2[5].Direction = ParameterDirection.Output;
                                parameters2[6].Direction = ParameterDirection.Output;
                                foreach (var parameter in parameters2)
                                    cmd.Parameters.Add(parameter);
                                cmd.ExecuteNonQuery();
                                m.outMsg = parameters2[4].Value.ToString();
                                m.outSum = int.Parse(parameters2[5].Value.ToString());
                            }
                            catch (Exception ex)
                            {
                                LogHelper.Debug(ToString(),
                                    "prc_pda_scbg error:" + ex.Message);
                                m.outMsg = ex.Message;
                                return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Default,
                                    ex.Message);
                            }
                            finally
                            {
                                conn.Close();
                            }
                        }
                    }
                    #endregion
                }
                return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Default, "打码失败!");
            }
            catch (Exception ex)
            {
                m.outSum = -1;
                m.outMsg = ex.Message.ToString();
                LogHelper.Debug(ToString(), ex.Message);
            }
            return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Default, m.outMsg);
        }
    }
}