diff --git a/北京北汽/Controller/SCP_PO_CONTROLLER.cs b/北京北汽/Controller/SCP_PO_CONTROLLER.cs index ca9c26e..a6bc9e4 100644 --- a/北京北汽/Controller/SCP_PO_CONTROLLER.cs +++ b/北京北汽/Controller/SCP_PO_CONTROLLER.cs @@ -3703,9 +3703,6 @@ namespace CK.SCP.Controller List lineError = new List(); List ErrorList = new List(); - - - //var _cl = p_order_list.GroupBy(p => new { p.订单编号, p.供应商编号, p.订单创建时间, p.要求到货日期 }).ToList(); //var _ctl = p_order_list.GroupBy(p => p.订单编号).ToList(); //if (_cl.Count != _ctl.Count) @@ -3714,6 +3711,7 @@ namespace CK.SCP.Controller // ErrorList = lineError; //} //注释结束 + var _lst = p_order_list; var PoList = _lst.Select(itm => itm.订单编号).Distinct().ToList(); foreach (var po in PoList) @@ -3725,25 +3723,24 @@ namespace CK.SCP.Controller ErrorList = lineError; } } + + //p_order_list.ForEach(p => + //{ + // var _count1 = _lst.Count(itm => itm.订单编号 == p.订单编号 && itm.行号 == p.行号); + // var _count2 = _lst.Count(itm => itm.订单编号 == p.订单编号 && itm.零件号.Trim() == p.零件号.Trim()); + // if (_count1 > 1 && p_modtype == BillModType.Contract) + // { + // lineError.Add(string.Format("导入订单编号【{0}】行号【{1}】有重复", p.订单编号, p.行号)); + // ErrorList = lineError; + // } + // if (_count2 > 1) + // { + // lineError.Add(string.Format("导入订单编号【{0}】零件编码【{1}】有重复", p.订单编号, p.零件号)); + // ErrorList = lineError; + // } + //}); + p_order_list.ForEach(p => - { - var _count1 = _lst.Count(itm => itm.订单编号 == p.订单编号 && itm.行号 == p.行号); - var _count2 = _lst.Count(itm => itm.订单编号 == p.订单编号 && itm.零件号.Trim() == p.零件号.Trim()); - if (_count1 > 1 && p_modtype == BillModType.Contract) - { - lineError.Add(string.Format("导入订单编号【{0}】行号【{1}】有重复", p.订单编号, p.行号)); - ErrorList = lineError; - } - if (_count2 > 1) - { - lineError.Add(string.Format("导入订单编号【{0}】零件编码【{1}】有重复", p.订单编号, p.零件号)); - ErrorList = lineError; - } - - - }); - p_order_list.ForEach - (p => { var _ls = CheckExcelMode_Po(db, p, p_modtype, site, subsite); if (_ls.Count > 0) @@ -3751,6 +3748,14 @@ namespace CK.SCP.Controller ErrorList.Add(string.Join("
", _ls.ToArray())); } }); + + var groupList = _lst.GroupBy(g => new { g.订单编号, g.行号, g.零件号 }).Where(g => g.Count() > 1).ToList(); + foreach (var gl in groupList) + { + lineError.Add(string.Format("模板中【{0}】相同订单号,相同行号零件号不能重复!", gl.Key)); + ErrorList = lineError; + } + if (ErrorList.Count > 0) { _ret.State = ReturnStatus.Failed;