From f1deb7b024e17cba204de5fcb0dac15801436b90 Mon Sep 17 00:00:00 2001 From: sjz <1240968267@qq.com> Date: 星期一, 28 七月 2025 20:56:41 +0800 Subject: [PATCH] 多组织修改 --- MES.Service/service/Warehouse/OpeningReceiptServer.cs | 43 ++++++++++--------------------------------- 1 files changed, 10 insertions(+), 33 deletions(-) diff --git a/MES.Service/service/Warehouse/OpeningReceiptServer.cs b/MES.Service/service/Warehouse/OpeningReceiptServer.cs index c4d73b7..161307e 100644 --- a/MES.Service/service/Warehouse/OpeningReceiptServer.cs +++ b/MES.Service/service/Warehouse/OpeningReceiptServer.cs @@ -1,7 +1,6 @@ 锘縰sing MES.Service.DB; using MES.Service.Dto.service; using MES.Service.Modes; -using MES.Service.util; using SqlSugar; namespace MES.Service.service.Warehouse; @@ -19,37 +18,26 @@ public MesInvItemBarcodes ScanInBarcodeQC(WarehouseQuery query) { if (string.IsNullOrWhiteSpace(query.sectionCode)) - { throw new Exception("璇锋壂搴撲綅鏉$爜锛�"); - } var depotCode = GetDepotCode(query.sectionCode); if (depotCode == null) - { throw new Exception($"002[搴撲綅缂栫爜 {query.sectionCode} 涓嶅瓨鍦紝璇风‘璁わ紒"); - } var checkBarcodeAlreadyReceived = CheckBarcodeAlreadyReceived(query.barcode); - if (checkBarcodeAlreadyReceived > 0) - { - throw new Exception("鏉$爜閲嶅鎵弿锛岃鏍稿锛�"); - } + if (checkBarcodeAlreadyReceived > 0) throw new Exception("鏉$爜閲嶅鎵弿锛岃鏍稿锛�"); if (CheckBarcodeInStock(query.barcode) > 0) - { throw new Exception("鏉$爜宸插湪搴撳瓨涓紝璇锋牳瀵癸紒"); - } var barcodeInfo = GetBarcodeInfo(query.barcode); if (barcodeInfo == null || barcodeInfo.ComeFlg != 0) - { throw new Exception("鏉$爜涓嶆槸鏈熷垵鏉$爜锛屾棤娉曠敤鏈熷垵鍏ュ簱锛�"); - } var inventoryItemInId = GetOrCreateInventoryItemInId(barcodeInfo, - depotCode, query.userName, out string billNo); + depotCode, query.userName, out var billNo); UseTransaction(db => { @@ -72,15 +60,12 @@ var mesInvItemBarcodes = Db.Queryable<MesInvItemBarcodes>() .Where(s => s.ItemBarcode == query.barcode).Count(); - if (mesInvItemBarcodes <= 0) - { - throw new Exception("鏉$爜涓嶅瓨鍦�"); - } + if (mesInvItemBarcodes <= 0) throw new Exception("鏉$爜涓嶅瓨鍦�"); var mesInvItemInCDetails = Db.Queryable<MesInvItemInCDetails>() .Where(s => s.ItemBarcode == query.barcode).Single(); - PurchaseInventory entity = new PurchaseInventory + var entity = new PurchaseInventory { ItemIns = GetMesInvItemIns(mesInvItemInCDetails.ItemInId), InvItemInCDetails = @@ -154,10 +139,7 @@ TaskNo = barcodeInfo.TaskNo }).ExecuteCommand(); - if (executeCommand <= 0) - { - throw new Exception("鍐欏叆澶辫触"); - } + if (executeCommand <= 0) throw new Exception("鍐欏叆澶辫触"); } private decimal GetOrCreateInventoryItemInId(MesInvItemBarcodes barcodeInfo, @@ -223,8 +205,9 @@ private int CheckBarcodeAlreadyReceived(string itemBarcode) { // Check if the barcode is already received - return Db.Queryable<MesInvItemIns, MesInvItemInCDetails>( - (ins, details) => new JoinQueryInfos(JoinType.Inner, + return Db + .Queryable<MesInvItemIns, MesInvItemInCDetails>((ins, details) => + new JoinQueryInfos(JoinType.Inner, ins.Id == details.ItemInId)) .Where((ins, details) => details.ItemBarcode == itemBarcode) .Count(); @@ -265,10 +248,7 @@ SuppNo = barcodeInfo.SuppNo }).ExecuteCommand(); - if (executeCommand <= 0) - { - throw new Exception("鍐欏叆澶辫触"); - } + if (executeCommand <= 0) throw new Exception("鍐欏叆澶辫触"); } private void InsertBusinessRecord(MesInvItemBarcodes barcodeInfo, @@ -301,9 +281,6 @@ SuppNo = barcodeInfo.SuppNo }).ExecuteCommand(); - if (executeCommand <= 0) - { - throw new Exception("鍐欏叆澶辫触"); - } + if (executeCommand <= 0) throw new Exception("鍐欏叆澶辫触"); } } \ No newline at end of file -- Gitblit v1.9.3