Browse Source

修改bug 导入总成时,校验规格说明包含的4个物料号分别是1001,1002,1003,1004

HQ
liuyunfeng 7 months ago
parent
commit
ac9a1ada55
  1. 69
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgBaseData/AssemblyCfgs/AssemblyCfgErpAppService.cs
  2. 8
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/WY.NewJit.Application.xml

69
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<AssemblyCfgGroup> assemblyCfgGroups = new List<AssemblyCfgGroup>();
@ -835,7 +843,66 @@ SELECT top 1 v.Id
return error;
}
/// <summary>
/// 导入总成时,校验规格说明包含的4个物料号分别是1001,1002,1003,1004
/// </summary>
/// <param name="srcLst">导入总成list</param>
/// <param name="material3Lst">总成物料list</param>
/// <returns></returns>
private string CheckMaterialRepeatByAssembly(List<ImportErpAssemblyGroupDto> srcLst, List<MaterialExt> 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<string> strLst = new List<string>();
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")]

8
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/WY.NewJit.Application.xml

@ -414,6 +414,14 @@
<param name="files"></param>
<returns></returns>
</member>
<member name="M:WY.NewJit.MsgBaseData.AssemblyCfgErpAppService.CheckMaterialRepeatByAssembly(System.Collections.Generic.List{WY.NewJit.MsgBaseData.ImportErpAssemblyGroupDto},System.Collections.Generic.List{WY.NewJit.Extends.PaiGe.MaterialExt})">
<summary>
导入总成时,校验规格说明包含的4个物料号分别是1001,1002,1003,1004
</summary>
<param name="srcLst">导入总成list</param>
<param name="material3Lst">总成物料list</param>
<returns></returns>
</member>
<member name="M:WY.NewJit.MsgBaseData.AssemblyCfgErpAppService.RemoveRepeatErpAssembly(System.Int32)">
<summary>
系统初始化时使用,去掉重复的ERP总成

Loading…
Cancel
Save