From f4e84a98facb28bbfc63343c81095a9787812e27 Mon Sep 17 00:00:00 2001 From: 南骏 池 <chiffly@163.com> Date: 星期六, 30 八月 2025 16:25:51 +0800 Subject: [PATCH] 1.PDA分组织 --- service/Warehouse/MesItemQtManager.cs | 53 ++++++++++++++++++++++++++++++++++------------------- 1 files changed, 34 insertions(+), 19 deletions(-) diff --git a/service/Warehouse/MesItemQtManager.cs b/service/Warehouse/MesItemQtManager.cs index 44a6db3..c2507f1 100644 --- a/service/Warehouse/MesItemQtManager.cs +++ b/service/Warehouse/MesItemQtManager.cs @@ -16,13 +16,14 @@ /// <returns>閫�鏂欏崟鍙峰垪琛�</returns> public List<string> GetPendingQtList() { - const string sql = @"SELECT qtck - FROM MES_ITEM_QT - WHERE qt015 = 1 - AND qt026 = 1 - AND QT029 = 1 - AND qt032 = 1 - AND QT014 = 0 "; + const string sql = @"SELECT qtck +FROM MES_ITEM_QT +WHERE qt015 = 1 + AND qt026 = 1 + AND QT029 = 1 + AND qt032 = 1 + AND QT014 = 0 +ORDER BY qt002"; return Db.Ado.SqlQuery<string>(sql); } @@ -51,11 +52,12 @@ // throw new Exception($"鍏朵粬鍑哄簱鐢宠鍗� {p_bill_no} 鏈鏍革紝璇风‘璁わ紒"); // 妫�鏌ラ��鏂欏崟鐨勫畬缁撶姸鎬�(Qt014)锛屽凡瀹岀粨鍒欐姏鍑哄紓甯� - if (mesItemQt.Qt014 == true) - throw new Exception($"鍏朵粬鍑哄簱鐢宠鍗� {p_bill_no} 宸插畬缁擄紝璇风‘璁わ紒"); + //if (mesItemQt.Qt014 == true) + // throw new Exception($"鍏朵粬鍑哄簱鐢宠鍗� {p_bill_no} 宸插畬缁擄紝璇风‘璁わ紒"); var sql = @"SELECT c.item_no ItemNo,c.item_name ItemName,c.item_model ItemModel, - ISNULL(A.qd007,0) FQty,ISNULL(A.qd008,0) SQty,ISNULL(A.qd007,0) - ISNULL(A.qd008,0) DSQty + ISNULL(A.qd007,0) FQty,ISNULL(A.qd008,0) SQty,ISNULL(A.qd007,0) - ISNULL(A.qd008,0) DSQty, + dbo.F_QX_GETRECODEPOTSE(A.itemId,'','','') as RecoKw FROM MES_ITEM_QT_DATALL A LEFT JOIN MES_ITEM_QT B ON A.qtGuid = B.guid LEFT JOIN MES_ITEMS C ON A.itemId = C.item_id @@ -115,6 +117,9 @@ if (barcode == null) throw new Exception($"mes涓笉瀛樺湪姝ゆ潯鐮�,璇锋牳瀵癸紒{p_item_barcode}"); + + + // 鑾峰彇搴撳瓨淇℃伅 var stock = Db.Queryable<MesInvItemStocks>() .Where(it => it.ItemBarcode == p_item_barcode && it.Quantity > 0) @@ -148,11 +153,6 @@ if (mesItemQt == null) throw new Exception($"鍏朵粬鍑哄簱鐢宠鍗� {p_bill_no} 涓嶅瓨鍦紝璇风‘璁わ紒"); - // 妫�鏌ヤ粨搴撴槸鍚︿竴鑷� - if (Convert.ToInt32(mesItemQt.Qt008) != stock.DepotId) - throw new Exception( - $"鎵爜鍑鸿揣浠撳簱id{mesItemQt.Qt008}涓庡叾浠栧嚭搴撶敵璇蜂粨搴搟stock.DepotId}涓嶄竴鑷达紝璇锋牳瀵癸紒"); - // 鑾峰彇鍑哄簱鍗曟槑缁� var qtDetail = Db.Queryable<MesItemQtDatall>() .Where(it => @@ -161,6 +161,19 @@ .First(); if (qtDetail == null) throw new Exception("鎵爜鐗╂枡闈炴湰娆″嚭搴撶敵璇风墿鏂欙紝璇锋牳瀵癸紒"); + + + if (mesItemQt.Qt014 == true) + throw new Exception($"鍏朵粬鍑哄簱鐢宠鍗� {p_bill_no} 宸插畬缁擄紝璇风‘璁わ紒"); + + // 妫�鏌ヤ粨搴撴槸鍚︿竴鑷� + if (qtDetail.DepotId != stock.DepotId) + throw new Exception( + $"鎵爜鍑鸿揣浠撳簱id{qtDetail.DepotId}涓庡叾浠栧嚭搴撶敵璇蜂粨搴搟stock.DepotId}涓嶄竴鑷达紝璇锋牳瀵癸紒"); + + + + // 妫�鏌ュ墿浣欐暟閲� var remainingQty = (qtDetail.Qd007 ?? 0) - (qtDetail.Qd008 ?? 0); @@ -190,6 +203,8 @@ var message = $"璇风‘璁ゅ彂鏂欐暟閲忥紒锛佸凡甯﹀嚭婊¤冻鍏朵粬鍑哄簱鍗曠殑鍙戞枡鏁伴噺 {remainingQty} 纭鍚庤鐐瑰嚮鏉$爜鎷嗗垎"; + + throw new Exception($"鏉$爜鏁伴噺瓒呭嚭鍙戞枡鏁伴噺锛岃鎷嗗垎鍚庡啀鎵弿锛�"); query.itemNo = stock.ItemNo; query.Num = stock.Quantity; @@ -242,8 +257,8 @@ BillTypeId = p_bill_type_id, TransactionNo = p_transaction_no, DepotCode = stock.DepotsCode, - DepotId = stock.DepotsId.HasValue - ? (int)stock.DepotsId + DepotId = stock.DepotId.HasValue + ? (int)stock.DepotId : null, OutPart = mesItemQt.Qt012, FType = 0, @@ -337,8 +352,8 @@ LastupdateBy = c_user, LastupdateDate = DateTime.Now, DepotCode = stock.DepotsCode, - DepotId = stock.DepotsId.HasValue - ? (int)stock.DepotsId + DepotId = stock.DepotId.HasValue + ? (int)stock.DepotId : null, // DepotsCode = stock.DepotsCode, // DepotSectionsCode = stock.DepotSectionsCode, -- Gitblit v1.9.3