From a9b773182cbae218f87bbebb0b88871180677a63 Mon Sep 17 00:00:00 2001 From: hudong <Administrator@PC-20250329JZUF> Date: 星期三, 04 六月 2025 17:27:45 +0800 Subject: [PATCH] 优化 --- api/WmsSpaHelper.cs | 45 ++++++++++++++++++++++++--------------------- 1 files changed, 24 insertions(+), 21 deletions(-) diff --git a/api/WmsSpaHelper.cs b/api/WmsSpaHelper.cs index a884e93..db48e3c 100644 --- a/api/WmsSpaHelper.cs +++ b/api/WmsSpaHelper.cs @@ -451,17 +451,6 @@ } foreach (var item in items.ITEM) { - //bool v= MaterPanduan(item.WLBM, item.SL); - // if (!v) - // { - // result.resultMsg = "澶辫触"; - // result.WLPZBH = items.HEAD.WLPZH; - // result.resultCode = 1; - // result.WLPZND = items.HEAD.WLPZND; - // result.resultMsg = $"鐗╂枡{item.WLBM}鏁伴噺瓒呰繃 搴撳瓨鎬绘暟"; - // simpleResults.Add(result); - // continue; - // } ///鍒ゆ柇鏄惁閮芥湁鍐查攢鍑瘉缂栧彿 if (string.IsNullOrEmpty(item.CXPZH)) { @@ -1224,9 +1213,10 @@ po.Details = new List<TN_Inbound_Detail>(); if (itemwlpz.ITEM.Count > 0) { - itemwlpz.ITEM.ForEach(a => + foreach (var a in itemwlpz.ITEM) + { - + po.Details.Add(new TN_Inbound_Detail { S_IO_NO = itemwlpz.HEAD.WLPZH, @@ -1248,7 +1238,7 @@ }); //} - }); + } db.Insertable<TN_Inbound_Order>(po).ExecuteCommand(); db.Insertable<TN_Inbound_Detail>(po.Details).ExecuteCommand(); db.CommitTran(); @@ -1262,7 +1252,7 @@ var Details = new List<TN_Inbound_Detail>(); if (itemwlpz.ITEM.Count > 0) { - itemwlpz.ITEM.ForEach(a => + foreach (var a in itemwlpz.ITEM) { if (po.Details.Where(s => s.S_ITEM_CODE == a.WLBM).Count() > 0) { @@ -1292,7 +1282,7 @@ }); } - }); + } db.Insertable<TN_Inbound_Detail>(Details).ExecuteCommand(); db.CommitTran(); @@ -1371,8 +1361,10 @@ po.Details = new List<TN_Inbound_Detail>(); if (itemwlpz.ITEM.Count > 0) { - itemwlpz.ITEM.ForEach(a => + foreach (var a in itemwlpz.ITEM) + { + #region 涓嶉渶瑕� //if (a.ITEM1.Select(s => s.XLH).Count() > 0)//鍒ゆ柇搴忓垪鍙锋槸鍚︿负澶氫釜 //{ @@ -1424,7 +1416,7 @@ }); //} - }); + } db.Insertable<TN_Inbound_Order>(po).ExecuteCommand(); db.Insertable<TN_Inbound_Detail>(po.Details).ExecuteCommand(); db.CommitTran(); @@ -1436,7 +1428,8 @@ var Details = new List<TN_Inbound_Detail>(); if (itemwlpz.ITEM.Count > 0) { - itemwlpz.ITEM.ForEach(a => + foreach (var a in itemwlpz.ITEM) + { if (po.Details.Where(s => s.S_ITEM_CODE == a.WLBH).Count() > 0) { @@ -1471,7 +1464,7 @@ }); } - }); + } db.Insertable<TN_Inbound_Detail>(Details).ExecuteCommand(); db.CommitTran(); @@ -1771,6 +1764,15 @@ internal static SimpleResult InboundOrderSorting(MPSorting model) { var result = new SimpleResult(); + foreach (var a in model.MaterList) + { + bool v = MaterPanduan(a.item_code, a.qty); + if (v) + { + result.resultMsg = $"鐗╂枡{a.item_code}鏁伴噺瓒呰繃 搴撳瓨鎬绘暟"; + return result; + } + } //鍒ゆ柇璧峰搴撲綅鏄惁閿佸畾 // var db = new SqlHelper<object>().GetInstance(); using (var db = new SqlHelper<object>().GetInstance()) @@ -1931,6 +1933,7 @@ .LeftJoin<CntrItemRel>((lcr, cir) => lcr.S_CNTR_CODE == cir.S_CNTR_CODE&&cir.S_CNTR_TYPE=="鍗婃墭") .Where((lcr, cir) => cir.S_CNTR_CODE != null) .LeftJoin<Location>((lcr, cir, loc) => lcr.S_LOC_CODE == loc.S_CODE && loc.S_AREA_CODE == "HJQ") + .OrderBy((lcr, cir) => cir.T_CREATE) .Select((lcr, cir, loc) => loc).ToList() // 杩斿洖 Location 瀵硅薄 .FirstOrDefault(); // 鎴栬� Take(1).ToList()[0] } @@ -3141,7 +3144,7 @@ [ApiExplorerSettings(IgnoreApi = true)] public static SimpleResult AddInboundOrder(List<Mater> MaterList, string cntr_code,string S_CNTR_TYPE) { - var result = new SimpleResult(); + var result = new SimpleResult(); // var db = new SqlHelper<object>().GetInstance(); using (var db = new SqlHelper<object>().GetInstance()) { -- Gitblit v1.9.1