From ac9a1ada5538d5fefe5f3666265bf0255d113182 Mon Sep 17 00:00:00 2001 From: liuyunfeng Date: Tue, 16 Apr 2024 15:39:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug=20=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E6=80=BB=E6=88=90=E6=97=B6=EF=BC=8C=E6=A0=A1=E9=AA=8C=E8=A7=84?= =?UTF-8?q?=E6=A0=BC=E8=AF=B4=E6=98=8E=E5=8C=85=E5=90=AB=E7=9A=844?= =?UTF-8?q?=E4=B8=AA=E7=89=A9=E6=96=99=E5=8F=B7=E5=88=86=E5=88=AB=E6=98=AF?= =?UTF-8?q?1001,1002,1003,1004?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AssemblyCfgs/AssemblyCfgErpAppService.cs | 69 ++++++++++++++++++- .../WY.NewJit.Application.xml | 8 +++ 2 files changed, 76 insertions(+), 1 deletion(-) diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgBaseData/AssemblyCfgs/AssemblyCfgErpAppService.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgBaseData/AssemblyCfgs/AssemblyCfgErpAppService.cs index b2c88c0..bef0c11 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgBaseData/AssemblyCfgs/AssemblyCfgErpAppService.cs +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgBaseData/AssemblyCfgs/AssemblyCfgErpAppService.cs @@ -741,6 +741,14 @@ SELECT top 1 v.Id ret.Status = false; return ret; } + var err2 = CheckMaterialRepeatByAssembly(srcLst, material3Lst); + if (!string.IsNullOrEmpty(err2)) + { + ret.Message = err2; + ret.Status = false; + return ret; + } + #endregion #region 插入数据 List assemblyCfgGroups = new List(); @@ -835,7 +843,66 @@ SELECT top 1 v.Id return error; } - + /// + /// 导入总成时,校验规格说明包含的4个物料号分别是1001,1002,1003,1004 + /// + /// 导入总成list + /// 总成物料list + /// + private string CheckMaterialRepeatByAssembly(List srcLst, List material3Lst) + { + StringBuilder strBuild = new StringBuilder(); + string[] arr = new string[4] { "1001", "1002", "1003", "1004" }; + string arrStr = string.Join(',', arr); + + var qry = from item in srcLst + group item by item.SpecExplain into g + select new + { + SpecExplain = g.Key, + ColorExplain = g.ElementAt(0).ColorExplain, + Details = g.Select(itm => itm.MaterialNum).ToList() + }; + foreach (var item in qry) + { + if (item.Details.Count != 4) + { + strBuild.AppendLine($"规格说明{item.SpecExplain}包含的物料号不是4个"); + } + //遍历物料号 + List strLst = new List(); + foreach (string materialNum in item.Details) + { + var materialObj = material3Lst.FirstOrDefault(itm => itm.RelationKey == materialNum); + if (materialObj == null) + { + strBuild.AppendLine($"规格说明{item.SpecExplain}:物料号{materialNum}在物料表不存在!"); + } + else + { + if (arr.Contains(materialObj.MaterialType2) == true) + { + strLst.Add(materialObj.MaterialType2); + } + else + { + strBuild.AppendLine($"规格说明{item.SpecExplain}:物料号{materialNum}的MaterialType2不是【{arrStr}】其中之一!"); + } + } + } + if (string.IsNullOrEmpty(strBuild.ToString())) + { + if (strLst.Count != strLst.Distinct().Count()) + { + string repeatLst = string.Join(',', strLst); + strBuild.AppendLine($"规格说明{item.SpecExplain}包含的配置号重复{repeatLst}"); + } + } + } + return strBuild.ToString(); + } + + //[UnitOfWork] //[HttpPost] //[Route("check")] diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/WY.NewJit.Application.xml b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/WY.NewJit.Application.xml index fcee04f..86da4d8 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/WY.NewJit.Application.xml +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/WY.NewJit.Application.xml @@ -414,6 +414,14 @@ + + + 导入总成时,校验规格说明包含的4个物料号分别是1001,1002,1003,1004 + + 导入总成list + 总成物料list + + 系统初始化时使用,去掉重复的ERP总成