From 3bd17c41ea020861ca81a17312709c5318ccc0f9 Mon Sep 17 00:00:00 2001 From: "yidi.wu" Date: Thu, 18 Jan 2024 16:21:35 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=87=E8=B4=AD=E8=AE=A2=E5=8D=95=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=EF=BC=8C=E5=90=8C=E4=B8=80=E9=87=87=E8=B4=AD=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=EF=BC=8C=E7=9B=B8=E5=90=8C=E8=A1=8C=E5=8F=B7=E9=9B=B6?= =?UTF-8?q?=E4=BB=B6=E7=AD=89=E4=BF=A1=E6=81=AF=E5=8F=AF=E4=BB=A5=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E5=AF=BC=E5=85=A5=EF=BC=8C=E5=B9=B6=E5=90=8C=E6=97=B6?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E3=80=82=E9=9C=80=E8=A6=81=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C=EF=BC=8C=E4=B8=8D=E5=85=81=E8=AE=B8=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E5=AF=BC=E5=85=A5=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 北京北汽/Controller/SCP_PO_CONTROLLER.cs | 47 +++++++++++--------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/北京北汽/Controller/SCP_PO_CONTROLLER.cs b/北京北汽/Controller/SCP_PO_CONTROLLER.cs index 7079050..1d192da 100644 --- a/北京北汽/Controller/SCP_PO_CONTROLLER.cs +++ b/北京北汽/Controller/SCP_PO_CONTROLLER.cs @@ -3700,9 +3700,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) @@ -3711,6 +3708,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) @@ -3722,25 +3720,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) @@ -3748,6 +3745,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;