|
@ -741,6 +741,14 @@ SELECT top 1 v.Id |
|
|
ret.Status = false; |
|
|
ret.Status = false; |
|
|
return ret; |
|
|
return ret; |
|
|
} |
|
|
} |
|
|
|
|
|
var err2 = CheckMaterialRepeatByAssembly(srcLst, material3Lst); |
|
|
|
|
|
if (!string.IsNullOrEmpty(err2)) |
|
|
|
|
|
{ |
|
|
|
|
|
ret.Message = err2; |
|
|
|
|
|
ret.Status = false; |
|
|
|
|
|
return ret; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
#endregion
|
|
|
#endregion
|
|
|
#region 插入数据
|
|
|
#region 插入数据
|
|
|
List<AssemblyCfgGroup> assemblyCfgGroups = new List<AssemblyCfgGroup>(); |
|
|
List<AssemblyCfgGroup> assemblyCfgGroups = new List<AssemblyCfgGroup>(); |
|
@ -835,6 +843,65 @@ SELECT top 1 v.Id |
|
|
return error; |
|
|
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]
|
|
|
//[UnitOfWork]
|
|
|
//[HttpPost]
|
|
|
//[HttpPost]
|
|
|