1.生产入库信息查询接口增加是否源单查询字段
2.报表增加MES入库记录删除接口
3.增加存货档案关联工艺查询多存货
4.增加存货档案关联工艺提交多存货
4.通用基础资料中:仓库基础资料接口增加noid(erp中的仓库id)
已添加1个文件
已修改10个文件
561 ■■■■■ 文件已修改
VueWebCoreApi/Controllers/ProductModelController.cs 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/Controllers/ReportManagerController.cs 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/Controllers/WorkOrderController.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/DLL/BLL/ProductModelBLL.cs 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/DLL/BLL/ReportManagerBLL.cs 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/DLL/BLL/WorkOrderBLL.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/DLL/DAL/GeneralBasicDataDAL.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/DLL/DAL/ProductModelDAL.cs 342 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/DLL/DAL/ReportManagerDAL.cs 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/DLL/DAL/WorkOrderDAL.cs 67 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/Models/MaterialRoutList.cs 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/Controllers/ProductModelController.cs
@@ -277,6 +277,23 @@
        }
        #endregion
        #region[存货档案关联工艺(工艺路线/工序)查询多存货]
        /// <summary>
        /// å­˜è´§æ¡£æ¡ˆå…³è”工艺(工艺路线/工序)查询多存货
        /// </summary>
        /// <param name="partcode">物料编码</param>
        /// <returns></returns>
        [Route(template: "TMaterielFileAssociationRouteList")]
        [HttpPost]
        public JsonResult TMaterielFileAssociationRouteList(List<string> partcode)
        {
            var token = HttpContext.Request.Headers["Token"].ToString();
            User us = JwtTools.Denocode(token.ToString());
            mes = ProductModelBLL.TMaterielFileAssociationRouteList(partcode, us);
            return Json(mes);
        }
        #endregion
        #region[存货档案关联工艺(工艺路线或工序)提交]
        /// <summary>
        /// å­˜è´§æ¡£æ¡ˆå…³è”工艺(工艺路线或工序)提交
@@ -294,6 +311,23 @@
        }
        #endregion
        #region[存货档案关联工艺(工艺路线或工序)提交多存货]
        /// <summary>
        /// å­˜è´§æ¡£æ¡ˆå…³è”工艺(工艺路线或工序)提交多存货
        /// </summary>
        /// <param name="json">提交数据对象</param>
        /// <returns></returns>
        [Route(template: "SaveTMaterielFileList")]
        [HttpPost]
        public JsonResult SaveTMaterielFileList(List<MaterialCraftsSave> json)
        {
            var token = HttpContext.Request.Headers["Token"].ToString();
            User us = JwtTools.Denocode(token.ToString());
            mes = ProductModelBLL.SaveTMaterielFileList(us, json);
            return Json(mes);
        }
        #endregion
        #region[工单产品信息下拉框查询]
VueWebCoreApi/Controllers/ReportManagerController.cs
@@ -722,6 +722,23 @@
        }
        #endregion
        #region[MES入库记录删除]
        /// <summary>
        /// MES入库记录删除
        /// </summary>
        /// <param name="dt">提交数据</param>
        /// <returns></returns>
        [Route(template: "DeleteMesInStorageRecord")]
        [HttpPost]
        public JsonResult DeleteMesInStorageRecord(DataTable dt)
        {
            var token = HttpContext.Request.Headers["Token"].ToString();
            User us = JwtTools.Denocode(token.ToString());
            mes = ReportManagerBLL.DeleteMesInStorageRecord(dt, us);
            return Json(mes);
        }
        #endregion
        #region[T+入库记录删除]
        /// <summary>
        /// T+入库记录删除
@@ -733,7 +750,6 @@
        public JsonResult DeleteInStorageRecord(DataTable dt)
        {
            var token = HttpContext.Request.Headers["Token"].ToString();
            //var token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyY29kZSI6Ijk5OTkiLCJ1c2VybmFtZSI6Iuezu-e7n-euoeeQhuWRmCIsInN0b3JnX2NvZGUiOiIiLCJzdG9yZ19uYW1lIjoiIiwiaXNfc3lzdGVtX2FkbWluIjoiWSIsInJvbGVfY29kZSI6IiIsInJvbGVfZGF0YXBlcm1pc3Npb25zIjoiIiwidXNlcnR5cGUiOiJQQyIsInJlZGlza2V5IjoiTmV3TUVTTG9naW5Vc2VySURQQzk5OTkiLCJtZXNTZXR0aW5nIjoie1wicm91dGVcIjp0cnVlLFwiaXNPcmRlclwiOnRydWUsXCJkZXZpY2VcIjp0cnVlLFwidGVjaFwiOnRydWUsXCJ3b3JrT3JkZXJcIjp0cnVlLFwiZXZlcnlcIjpmYWxzZSxcImxhc3RcIjpmYWxzZX0iLCJ0aW1lb3V0IjoiMjAyNC0xMC0yNFQxMjozNTo1MC4zNDI1NzE2KzA4OjAwIn0.Nbc-1sXd4QLLsnj8wH9XC7iWEmP0wDG82gwLxIh94e4";
            User us = JwtTools.Denocode(token.ToString());
            mes = ReportManagerBLL.DeleteInStorageRecord(dt, us);
            return Json(mes);
VueWebCoreApi/Controllers/WorkOrderController.cs
@@ -890,6 +890,7 @@
        /// <summary>
        /// ç”Ÿäº§å…¥åº“信息查询
        /// </summary>
        /// <param name="issouceorder">是否源单(Y/N)</param>
        /// <param name="deptno">部门编码(T8使用)</param>
        /// <param name="saleordercode">销售单号</param>
        /// <param name="wkshopcode">车间编码</param>
@@ -901,9 +902,9 @@
        /// <returns></returns>
        [Route(template: "ProductInHouseOrderSearch")]
        [HttpGet]
        public JsonResult ProductInHouseOrderSearch(string deptno, string saleordercode, string wkshopcode, string erpordercode = null, string mesordercode = null, string partcode = null, string partname = null, string partspec = null)
        public JsonResult ProductInHouseOrderSearch(string issouceorder, string deptno, string saleordercode, string wkshopcode, string erpordercode = null, string mesordercode = null, string partcode = null, string partname = null, string partspec = null)
        {
            mes = WorkOrderBLL.ProductInHouseOrderSearch(deptno, saleordercode, wkshopcode, erpordercode, mesordercode, partcode, partname, partspec);
            mes = WorkOrderBLL.ProductInHouseOrderSearch(issouceorder,deptno, saleordercode, wkshopcode, erpordercode, mesordercode, partcode, partname, partspec);
            return Json(mes);
        }
        #endregion
VueWebCoreApi/DLL/BLL/ProductModelBLL.cs
@@ -99,6 +99,13 @@
        }
        #endregion
        #region[存货档案关联工艺(工艺路线或工序)查询多存货]
        public static ToMessage TMaterielFileAssociationRouteList(List<string> partcode, User us)
        {
            return ProductModelDAL.TMaterielFileAssociationRouteList(partcode, us);
        }
        #endregion
        #region[存货档案关联工艺(工艺路线或工序)提交]
        public static ToMessage SaveTMaterielFile(User us, List<MaterialCraftsSave> json)
        {
@@ -106,6 +113,13 @@
        }
        #endregion
        #region[存货档案关联工艺(工艺路线或工序)提交多存货]
        public static ToMessage SaveTMaterielFileList(User us, List<MaterialCraftsSave> json)
        {
            return ProductModelDAL.SaveTMaterielFileList(us, json);
        }
        #endregion
        #region[工单产品信息下拉框查询]
VueWebCoreApi/DLL/BLL/ReportManagerBLL.cs
@@ -168,6 +168,13 @@
        }
        #endregion
        #region[MES入库记录删除]
        public static ToMessage DeleteMesInStorageRecord(DataTable dt, User us)
        {
            return ReportManagerDAL.DeleteMesInStorageRecord(dt, us);
        }
        #endregion
        #region[T+入库记录删除]
        public static ToMessage DeleteInStorageRecord(DataTable dt, User us)
        {
VueWebCoreApi/DLL/BLL/WorkOrderBLL.cs
@@ -292,9 +292,9 @@
        #endregion
        #region[生产入库信息查询]
        public static ToMessage ProductInHouseOrderSearch(string deptno, string saleordercode, string wkshopcode, string erpordercode, string mesordercode, string partcode, string partname, string partspec)
        public static ToMessage ProductInHouseOrderSearch(string issouceorder, string deptno, string saleordercode, string wkshopcode, string erpordercode, string mesordercode, string partcode, string partname, string partspec)
        {
            return WorkOrderDAL.ProductInHouseOrderSearch(deptno, saleordercode, wkshopcode, erpordercode, mesordercode, partcode, partname, partspec);
            return WorkOrderDAL.ProductInHouseOrderSearch(issouceorder, deptno, saleordercode, wkshopcode, erpordercode, mesordercode, partcode, partname, partspec);
        }
        #endregion
VueWebCoreApi/DLL/DAL/GeneralBasicDataDAL.cs
@@ -422,7 +422,7 @@
            try
            {
                //获取仓库数据
                sql = @"select code,name from TSecStck";
                sql = @"select noid,code,name from TSecStck";
                var data = DapperHelper.selecttable(sql);
                mes.code = "200";
                mes.message = "查询成功!";
VueWebCoreApi/DLL/DAL/ProductModelDAL.cs
@@ -1122,6 +1122,206 @@
        }
        #endregion
        #region[存货档案关联工艺(工艺路线或工序)查询多存货]
        public static ToMessage TMaterielFileAssociationRouteList(List<string> partcode, User us)
        {
            string sql = "";
            var dynamicParams = new DynamicParameters();
            List<MaterialRoutList> list = new List<MaterialRoutList>();
            try
            {
                dynamic dynObj = JObject.Parse(us.mesSetting);
                bool route = dynObj.route;
                if (route) //工艺路线版
                {
                    // 1. æ‰¹é‡èŽ·å–æ‰€æœ‰ç‰©æ–™çš„åŸºç¡€ä¿¡æ¯
                    var baseInfoSql = @"SELECT M.partcode, M.partname, M.default_route as default_routecode, R.name as default_routename
                     FROM TMateriel_Info M
                     LEFT JOIN TFlw_Rout R ON M.default_route = R.code
                     WHERE M.partcode IN @PartCodes";
                    var baseInfos = DapperHelper.select<dynamic>(baseInfoSql, new { PartCodes = partcode }).ToDictionary(x => (string)x.partcode, x => x);
                    if (!baseInfos.Any())
                    {
                        mes.code = "200";
                        mes.message = "未找到对应的物料信息";
                        mes.data = list;
                        return mes;
                    }
                    // 2. æ‰¹é‡èŽ·å–æ‰€æœ‰ç‰©æ–™çš„å·¥è‰ºè·¯çº¿ä¿¡æ¯
                    var routeSql = @"SELECT mi.partcode AS partcode,fr.code AS routecode,fr.name AS routename,
                                   CASE
                                       WHEN mr.materiel_code IS NOT NULL THEN 'Y'
                                       ELSE 'N'
                                   END AS flag
                                   FROM TMateriel_Info mi
                                   CROSS JOIN TFlw_Rout fr
                                   LEFT JOIN  TMateriel_Route mr ON mi.partcode = mr.materiel_code AND fr.code = mr.route_code
                                   WHERE mi.partcode IN @PartCodes AND fr.enable = 'Y'
                                   ORDER BY mi.partcode, fr.code";
                    var allRoutes = DapperHelper.select<dynamic>(routeSql, new { PartCodes = partcode }).GroupBy(x => (string)x.partcode).ToDictionary(g => g.Key, g => g.ToList());
                    // 3. æ‰¹é‡èŽ·å–æ‰€æœ‰å·¥åºä¿¡æ¯ï¼ˆä¸€æ¬¡æ€§æŸ¥è¯¢ï¼‰
                    var allRouteCodes = allRoutes.Values
                        .SelectMany(routes => routes.Select(r => (string)r.routecode))
                        .Distinct()
                        .ToList();
                    Dictionary<string, DataTable> routeSteps = new Dictionary<string, DataTable>();
                    if (allRouteCodes.Any())
                    {
                        var stepSql = @"SELECT A.rout_code as route_code, A.seq, B.stepcode, B.stepname, B.enable
                                        FROM TFlw_Rtdt A
                                        INNER JOIN TStep B ON A.step_code = B.stepcode
                                        WHERE A.rout_code IN @RouteCodes AND B.is_delete <> '1'
                                        ORDER BY A.rout_code, A.seq ASC";
                        var allSteps = DapperHelper.select<dynamic>(stepSql, new { RouteCodes = allRouteCodes });
                        // å°†å·¥åºæ•°æ®æŒ‰å·¥è‰ºè·¯çº¿ç¼–码分组
                        routeSteps = allSteps
                            .GroupBy(x => (string)x.route_code)
                            .ToDictionary(
                                g => g.Key,
                                g =>
                                {
                                    // å°†åŠ¨æ€ç±»åž‹è½¬æ¢ä¸ºDataTable(根据您原有代码的返回类型调整)
                                    var dt = new DataTable();
                                    dt.Columns.Add("seq");
                                    dt.Columns.Add("stepcode");
                                    dt.Columns.Add("stepname");
                                    dt.Columns.Add("enable");
                                    foreach (var step in g.OrderBy(s => s.seq))
                                    {
                                        dt.Rows.Add(step.seq, step.stepcode, step.stepname, step.enable);
                                    }
                                    return dt;
                                });
                    }
                    // 4. åœ¨å†…存中组合数据
                    foreach (var part in partcode)
                    {
                        if (!baseInfos.ContainsKey(part)) continue;
                        var baseInfo = baseInfos[part];
                        var routlist = new MaterialRoutList
                        {
                            partcode = baseInfo.partcode,
                            partname = baseInfo.partname,
                            defalutroutecode = baseInfo.default_routecode,
                            defalutroutename = baseInfo.default_routename,
                            children = new List<RouteList>()
                        };
                        // æ·»åŠ è¯¥ç‰©æ–™çš„å·¥è‰ºè·¯çº¿
                        if (allRoutes.ContainsKey(part))
                        {
                            foreach (var routeInfo in allRoutes[part])
                            {
                                var rout = new RouteList
                                {
                                    routecode = routeInfo.routecode,
                                    routename = routeInfo.routename,
                                    flag = routeInfo.flag
                                };
                                // æ·»åŠ å·¥åºä¿¡æ¯
                                if (routeSteps.ContainsKey(rout.routecode))
                                {
                                    rout.Data = routeSteps[rout.routecode];
                                }
                                routlist.children.Add(rout);
                            }
                        }
                        list.Add(routlist);
                    }
                    mes.data = list;
                    mes.code = "200";
                    mes.message = $"查询成功,共处理{list.Count}个物料";
                }
                else //工序版
                {
                    // 1. æ‰¹é‡èŽ·å–æ‰€æœ‰ç‰©æ–™åŸºç¡€ä¿¡æ¯
                    var baseInfoSql = @"SELECT partcode, partname FROM TMateriel_Info
                       WHERE partcode IN @PartCodes";
                    var baseInfos = DapperHelper.select<dynamic>(baseInfoSql, new { PartCodes = partcode })
                        .ToDictionary(x => (string)x.partcode, x => x);
                    if (!baseInfos.Any())
                    {
                        mes.code = "200";
                        mes.message = "未找到对应的物料信息";
                        mes.data = new List<MaterialRoutList>();
                        return mes;
                    }
                    // 2. æ‰¹é‡èŽ·å–æ‰€æœ‰ç‰©æ–™çš„å·¥åºä¿¡æ¯
                    var stepSql = @"SELECT A.materiel_code as partcode, A.step_seq, A.step_code,
                           S.stepname, A.isbott, A.isend
                    FROM TMateriel_Step A
                    INNER JOIN TStep S ON A.step_code = S.stepcode
                    WHERE A.materiel_code IN @PartCodes AND S.is_delete <> '1'
                    ORDER BY A.materiel_code, A.step_seq";
                    var allSteps = DapperHelper.select<dynamic>(stepSql, new { PartCodes = partcode })
                        .GroupBy(x => (string)x.partcode)
                        .ToDictionary(g => g.Key, g => g.ToList());
                    // 3. å†…存中组合数据
                    foreach (var part in partcode)
                    {
                        if (!baseInfos.ContainsKey(part)) continue;
                        var baseInfo = baseInfos[part];
                        var routlist = new MaterialRoutList
                        {
                            partcode = baseInfo.partcode,
                            partname = baseInfo.partname,
                            children = new List<RouteList>()
                        };
                        // æ·»åŠ å·¥åºä¿¡æ¯
                        if (allSteps.ContainsKey(part))
                        {
                            // è½¬æ¢ä¸ºDataTable(如需保持原有结构)
                            var stepData = allSteps[part];
                            var dataTable = new DataTable();
                            dataTable.Columns.Add("step_seq");
                            dataTable.Columns.Add("step_code");
                            dataTable.Columns.Add("step_name");
                            dataTable.Columns.Add("isbott");
                            dataTable.Columns.Add("isend");
                            foreach (var step in stepData.OrderBy(s => s.step_seq))
                            {
                                dataTable.Rows.Add(step.step_seq, step.step_code,
                                                 step.stepname, step.isbott, step.isend);
                            }
                            routlist.children.Add(new RouteList { Data = dataTable });
                        }
                        list.Add(routlist);
                    }
                    mes.data = list;
                    mes.code = "200";
                    mes.message = $"查询成功,共处理{list.Count}个物料";
                }
            }
            catch (Exception e)
            {
                mes.code = "300";
                mes.count = 0;
                mes.message = e.Message;
                mes.data = null;
            }
            return mes;
        }
        #endregion
        #region[存货档案关联工艺(工艺路线或工序)提交]
        public static ToMessage SaveTMaterielFile(User us, List<MaterialCraftsSave> json)
        {
@@ -1258,6 +1458,148 @@
        }
        #endregion
        #region[存货档案关联工艺(工艺路线或工序)提交多存货]
        public static ToMessage SaveTMaterielFileList(User us, List<MaterialCraftsSave> json)
        {
            var sql = "";
            List<object> list = new List<object>();
            var dynamicParams = new DynamicParameters();
            try
            {
                list.Clear();
                dynamic dynObj = JObject.Parse(us.mesSetting);
                bool route = dynObj.route;
                if (route) //工艺路线版
                {
                    for (int i = 0; i < json.Count; i++)
                    {
                        if (json[i].children == null || json[i].children.Count <= 0)
                        {
                            //清除物料关联工艺路线表数据
                            sql = @"delete TMateriel_Route where materiel_code=@partcode";
                            list.Add(new { str = sql, parm = new { partcode = json[i].partcode } });
                            //标记物料表关联工艺路线标识
                            sql = @"update TMateriel_Info set is_retdproc='N',default_route='' where partcode=@partcode";
                            list.Add(new { str = sql, parm = new { partcode = json[i].partcode } });
                            //清除节拍工价表对应数据
                            sql = @"delete TPrteEqp_Stad where materiel_code=@partcode";
                            list.Add(new { str = sql, parm = new { partcode = json[i].partcode } });
                        }
                        else
                        {
                            //清除存货关联工艺路线表数据
                            sql = @"delete TMateriel_Route where materiel_code=@partcode";
                            list.Add(new { str = sql, parm = new { partcode = json[i].partcode } });
                            //循环写入存货关联工艺路线表
                            for (int j = 0; j < json[i].children.Count; j++)
                            {
                                sql = @"insert into TMateriel_Route(materiel_code,route_code,lm_user,lm_date) values(@materiel_code,@route_code,@lm_user,@lm_date)";
                                list.Add(new
                                {
                                    str = sql,
                                    parm = new
                                    {
                                        materiel_code = json[i].partcode,
                                        route_code = json[i].children[j].code,
                                        lm_user = us.usercode,
                                        lm_date = DateTime.Now.ToString()
                                    }
                                });
                            }
                            //标记物料表关联工艺路线标识
                            sql = @"update TMateriel_Info set is_retdproc='Y',default_route=@defaultroute_code where partcode=@partcode";
                            list.Add(new { str = sql, parm = new { partcode = json[i].partcode, defaultroute_code = json[i].defaultroute_code } });
                            //清除节拍工价表当前产品对应工艺路线不包含此次设置的其它数据
                            //string分割转string[]
                            string[] routcode = Array.ConvertAll<string, string>(string.Join(",", json[i].children.Select(s => s.code)).Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString());
                            sql = @"delete TPrteEqp_Stad where materiel_code=@partcode and route_code not in @routecode";
                            list.Add(new { str = sql, parm = new { partcode = json[i].partcode, routecode = routcode } });
                        }
                    }
                }
                else //工序版
                {
                    for (int i = 0; i < json.Count; i++)
                    {
                        if (json[i].children == null || json[i].children.Count <= 0)
                        {
                            //清除物料关联工艺路线表数据
                            sql = @"delete TMateriel_Step where materiel_code=@partcode";
                            list.Add(new { str = sql, parm = new { partcode = json[i].partcode } });
                            //标记物料表关联工艺路线标识
                            sql = @"update TMateriel_Info set is_retdproc='N',default_route='' where partcode=@partcode";
                            list.Add(new { str = sql, parm = new { partcode = json[i].partcode } });
                            //清除节拍工价表对应数据
                            sql = @"delete TPrteEqp_Stad where materiel_code=@partcode";
                            list.Add(new { str = sql, parm = new { partcode = json[i].partcode } });
                        }
                        else
                        {
                            //清除存货关联工艺路线表数据
                            sql = @"delete TMateriel_Step where materiel_code=@partcode";
                            list.Add(new { str = sql, parm = new { partcode = json[i].partcode } });
                            //循环写入存货关联工艺路线表
                            for (int j = 0; j < json[i].children.Count; j++)
                            {
                                sql = @"insert into TMateriel_Step(materiel_code,step_seq,step_code,isbott,isend,lm_user,lm_date)
                                    values(@materiel_code,@step_seq,@step_code,@isbott,@isend,@lm_user,@lm_date)";
                                list.Add(new
                                {
                                    str = sql,
                                    parm = new
                                    {
                                        materiel_code = json[i].partcode,
                                        step_seq = json[i].children[j].seq,
                                        step_code = json[i].children[j].code,
                                        isbott = json[i].children[j].isbott,
                                        isend = json[i].children[j].isend,
                                        lm_user = us.usercode,
                                        lm_date = DateTime.Now.ToString()
                                    }
                                });
                            }
                            //标记物料表关联工艺路线标识
                            sql = @"update TMateriel_Info set is_retdproc='Y',default_route=@defaultroute_code where partcode=@partcode";
                            list.Add(new { str = sql, parm = new { partcode = json[i].partcode, defaultroute_code = json[i].defaultroute_code } });
                            //清除节拍工价表当前产品对应工序不包含此次设置的其它数据
                            //string分割转string[]
                            string[] stepcode = Array.ConvertAll<string, string>(string.Join(",", json[i].children.Select(s => s.code)).Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString());
                            sql = @"delete TPrteEqp_Stad where materiel_code=@partcode and step_code not in @stepcode";
                            list.Add(new { str = sql, parm = new { partcode = json[i].partcode, stepcode = stepcode } });
                        }
                    }
                }
                bool aa = DapperHelper.DoTransaction(list);
                if (aa)
                {
                    //写入操作记录表
                    LogHelper.DbOperateLog(us.usercode, "存货关联工艺", "产品:" + string.Join(",", json.Select(x => x.partcode)) + "关联了工艺:" + string.Join(",", json.SelectMany(x => x.children?.Select(c => c.code) ?? Enumerable.Empty<string>())), us.usertype);
                    mes.code = "200";
                    mes.count = 0;
                    mes.message = "操作成功!";
                    mes.data = null;
                }
                else
                {
                    mes.code = "300";
                    mes.count = 0;
                    mes.message = "操作失败!";
                    mes.data = null;
                }
            }
            catch (Exception e)
            {
                mes.code = "300";
                mes.count = 0;
                mes.message = e.Message;
                mes.data = null;
            }
            return mes;
        }
        #endregion
        #region[工单产品信息下拉框查询]
        public static ToMessage PartSelect()
VueWebCoreApi/DLL/DAL/ReportManagerDAL.cs
@@ -1877,6 +1877,49 @@
        }
        #endregion
        #region[MES入库记录删除]
        public static ToMessage DeleteMesInStorageRecord(DataTable dt, User us)
        {
            var sql = "";
            var dynamicParams = new DynamicParameters();
            try
            {
                //存储过程名
                sql = @"h_p_IFCLD_DeleteInProductOrder";
                dynamicParams.Add("@RecordSub", dbType: DbType.Object, value: dt);
                // æ·»åŠ è¾“å‡ºå‚æ•°
                dynamicParams.Add("@StatusCode", dbType: DbType.Int32, direction: ParameterDirection.Output);
                dynamicParams.Add("@Message", dbType: DbType.String, size: 255, direction: ParameterDirection.Output);
                bool a = DapperHelper.IsProcedure(sql, dynamicParams);
                // èŽ·å–è¾“å‡ºå‚æ•°çš„å€¼
                var statusCode = dynamicParams.Get<int>("@StatusCode");
                var message = dynamicParams.Get<string>("@Message");
                if (a)
                {
                    mes.code = statusCode.ToString();
                    mes.count = 0;
                    mes.message = message;
                    mes.data = null;
                }
                else
                {
                    mes.code = statusCode.ToString();
                    mes.count = 0;
                    mes.message = message;
                    mes.data = null;
                }
            }
            catch (Exception e)
            {
                mes.code = "300";
                mes.count = 0;
                mes.message = e.Message;
                mes.data = null;
            }
            return mes;
        }
        #endregion
        #region[T+入库记录删除]
        public static ToMessage DeleteInStorageRecord(DataTable dt, User us)
        {
VueWebCoreApi/DLL/DAL/WorkOrderDAL.cs
@@ -609,30 +609,47 @@
            var dynamicParams = new DynamicParameters();
            try
            {
                sql = @"select *  from TK_Wrk_Man where m_po=@erpordercode and status<> 'CLOSED'";
                sql = @"select *  from TK_Wrk_Man where m_po=@erpordercode and sourceid=@sourceid";
                dynamicParams.Add("@erpordercode", erpordercode);
                dynamicParams.Add("@sourceid", erporderid);
                var data = DapperHelper.selectdata(sql, dynamicParams);
                if (data.Rows.Count > 0)
                {
                    mes.code = "300";
                    mes.count = 0;
                    mes.message = "当前订单有下达未关闭的MES工单,订单不允许关闭,请先删除或关闭相关工单!";
                    mes.data = null;
                }
                else
                {
                    //关闭订单
                    sql = @"update  TKimp_Ewo set status='CLOSED' where wo=@wo and id=@erporderid";
                    // ä½¿ç”¨LINQ和lambda表达式来转换wo_code字段的值为逗号隔开的字符串数组
                    string[] result = data.AsEnumerable().Select(row => "" + row.Field<string>("wo_code") + "").ToArray();
                    //关闭工序任务
                    sql = @"update  TK_Wrk_Step set status='CLOSED',closebeforestatus=status where wo_code in @wocode";
                    list.Add(new
                    {
                        str = sql,
                        parm = new
                        {
                            wo = erpordercode,
                            erporderid = erporderid
                            wocode = result
                        }
                    });
                    //关闭工单
                    sql = @"update  TK_Wrk_Man set status='CLOSED',closebeforestatus=status where m_po=@erpordercode and sourceid=@sourceid";
                    list.Add(new
                    {
                        str = sql,
                        parm = new
                        {
                            erpordercode = erpordercode,
                            sourceid = erporderid
                        }
                    });
                }
                //关闭订单
                sql = @"update  TKimp_Ewo set status='CLOSED',closebeforestatus=status where wo=@wo and id=@erporderid";
                list.Add(new
                {
                    str = sql,
                    parm = new
                    {
                        wo = erpordercode,
                        erporderid = erporderid
                    }
                });
                bool aa = DapperHelper.DoTransaction(list);
                if (aa)
                {
@@ -910,7 +927,7 @@
                }
                // --------------查询指定数据--------------
                var total = 0; //总条数
                var sql = @"select A.id, A.status,A.wotype,A.wo_code,A.materiel_code as partcode,B.partname,B.partspec,A.route_code,B.default_route,R.name as route_name,A.plan_qty,A.wkshp_code,C.torg_name as wkshp_name,
                var sql = @"select A.id, A.status,A.wotype,A.wo_code,A.materiel_code as partcode,B.partname,B.partspec,A.idTopInventory,A.TopInventoryCode,A.TopInventoryName,A.route_code,B.default_route,R.name as route_name,A.plan_qty,A.wkshp_code,C.torg_name as wkshp_name,
                            A.stck_code,D.name as stck_name,A.plan_startdate,A.plan_enddate,A.piroque,A.sourceid,A.m_po,A.saleOrderDeliveryDate,W.saleOrderCode,U.username as lm_user,A.lm_date,A.data_sources,A.isstep,A.clerkuser,
                            B.priuserdefnvc1,B.priuserdefnvc2,B.priuserdefnvc3,B.priuserdefnvc4,B.priuserdefnvc5,B.priuserdefnvc6,A.printcount
                            from TK_Wrk_Man A
@@ -998,7 +1015,7 @@
                }
                // --------------查询指定数据--------------
                var total = 0; //总条数
                var sql = @"select A.id, A.status,A.wotype,A.wo_code,A.materiel_code as partcode,B.partname,B.partspec,A.plan_qty,A.wkshp_code,C.torg_name as wkshp_name,
                var sql = @"select A.id, A.status,A.wotype,A.wo_code,A.materiel_code as partcode,B.partname,B.partspec,A.idTopInventory,A.TopInventoryCode,A.TopInventoryName,A.plan_qty,A.wkshp_code,C.torg_name as wkshp_name,
                            A.stck_code,D.name as stck_name,A.plan_startdate,A.plan_enddate,A.piroque,A.sourceid,A.m_po,A.saleOrderDeliveryDate,W.saleOrderCode,U.username as lm_user,A.lm_date,S.laborbad_qty,S.materielbad_qty,
                            B.priuserdefnvc1,B.priuserdefnvc2,B.priuserdefnvc3,B.priuserdefnvc4,B.priuserdefnvc5,B.priuserdefnvc6
                            from TK_Wrk_Man A
@@ -4663,12 +4680,26 @@
        #endregion
        #region[生产入库信息查询]
        public static ToMessage ProductInHouseOrderSearch(string deptno, string saleordercode, string wkshopcode, string erpordercode, string mesordercode, string partcode, string partname, string partspec)
        public static ToMessage ProductInHouseOrderSearch(string issouceorder, string deptno, string saleordercode, string wkshopcode, string erpordercode, string mesordercode, string partcode, string partname, string partspec)
        {
            var dynamicParams = new DynamicParameters();
            string search = "";
            try
            {
                if (issouceorder != "" && issouceorder != null)
                {
                    switch (issouceorder)
                    {
                        case "Y":
                            search += " and AA.m_po<>'' ";
                            break;
                        case "N":
                            search += " and AA.m_po='' ";
                            break;
                        default:
                            break;
                    }
                }
                if (deptno != "" && deptno != null)
                {
                    search += "and AA.dept_code=@deptno ";
@@ -4714,7 +4745,8 @@
                var sql = @"select *   from(
                              select A.inbarcode,E.saleOrderid,isnull(E.saleOrderCode,'') as saleOrderCode,E.saleOrderDetailId,E.woid as mpoid,M.m_po,E.sbid,M.id as wo_id,A.wo_code,E.materiel_id,P.partcode,P.partname,P.partspec,E.unitid,E.unitcode,E.unitname,
                              A.step_code,T.stepname,M.wkshp_code,O.torg_name as wkshp_name,COALESCE(K.noid, E.stck_id) as stockid,COALESCE(K.code, E.stck_code) as stockcode,k.name as stockname,E.dept_id,E.dept_code,
                              E.saleOrderqty,E.qty,M.plan_qty,A.good_qty,isnull(A.inhouseqty,0) as inhouseqty,A.good_qty-isnull(A.inhouseqty,0) as stinhouseqty,M.lm_date,A.style,E.voucherdate
                              E.saleOrderqty,E.qty,M.plan_qty,A.good_qty,isnull(A.inhouseqty,0) as inhouseqty,A.good_qty-isnull(A.inhouseqty,0) as stinhouseqty,M.lm_date,A.style,
                              (case when E.voucherdate is null then M.lm_date else E.voucherdate end) as voucherdate
                              from  TK_Wrk_Record A
                              inner join TK_Wrk_Step S on A.wo_code=S.wo_code and A.step_code=S.step_code
                              inner join TK_Wrk_Man M on S.wo_code=M.wo_code
@@ -4727,7 +4759,8 @@
                              union all
                              select A.inbarcode,E.saleOrderid,isnull(E.saleOrderCode,'') as saleOrderCode,E.saleOrderDetailId,E.woid as mpoid,M.m_po,E.sbid,M.id as wo_id,A.wo_code,E.materiel_id,P.partcode,P.partname,P.partspec,E.unitid,E.unitcode,E.unitname,
                              A.step_code,T.stepname,M.wkshp_code,O.torg_name as wkshp_name,COALESCE(K.noid, E.stck_id) as stockid,COALESCE(K.code, E.stck_code) as stockcode,k.name as stockname,E.dept_id,E.dept_code,
                              E.saleOrderqty,E.qty,M.plan_qty,A.sqty as sqty,isnull(A.inhouseqty,0) as inhouseqty,A.sqty-isnull(A.inhouseqty,0) as stinhouseqty,M.lm_date,A.style,E.voucherdate
                              E.saleOrderqty,E.qty,M.plan_qty,A.sqty as sqty,isnull(A.inhouseqty,0) as inhouseqty,A.sqty-isnull(A.inhouseqty,0) as stinhouseqty,M.lm_date,A.style,
                              (case when E.voucherdate is null then M.lm_date else E.voucherdate end) as voucherdate
                              from  TK_Wrk_OutRecord A
                              inner join TK_Wrk_Step S on A.wo_code=S.wo_code and A.step_code=S.step_code
                              inner join TK_Wrk_Man M on S.wo_code=M.wo_code
VueWebCoreApi/Models/MaterialRoutList.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
namespace VueWebCoreApi.Models
{
    public class MaterialRoutList
    {
        public string partcode { get; set; }
        public string partname { get; set; }
        public string defalutroutecode { get; set; }
        public string defalutroutename { get; set; }
        public List<RouteList> children { get; set; }
    }
    public class RouteList
    {
        public string routecode { get; set; }
        public string routename { get; set; }
        public string flag { get; set; }
        public DataTable Data { get; set; }
    }
}