From 21d72e7e8765511977efc0b034d474148e385efa Mon Sep 17 00:00:00 2001 From: 啊鑫 <t2856754968@163.com> Date: 星期五, 16 八月 2024 18:04:48 +0800 Subject: [PATCH] 格式化代码 --- MES.Service/service/Warehouse/MesInvItemMovesManager.cs | 38 +++++++++----------------------------- 1 files changed, 9 insertions(+), 29 deletions(-) diff --git a/MES.Service/service/Warehouse/MesInvItemMovesManager.cs b/MES.Service/service/Warehouse/MesInvItemMovesManager.cs index eeb48e6..ce0d8ce 100644 --- a/MES.Service/service/Warehouse/MesInvItemMovesManager.cs +++ b/MES.Service/service/Warehouse/MesInvItemMovesManager.cs @@ -15,12 +15,10 @@ public MovesDto ScanInBarcode(WarehouseQuery query) { if (string.IsNullOrEmpty(query.sectionCode)) - { throw new Exception("璇锋壂搴撲綅鏉$爜锛�"); - } - int pBillTypeId = 300; - int pTransctionNo = 301; + var pBillTypeId = 300; + var pTransctionNo = 301; var depotQuery = Db.Queryable<MesDepotSections, MesDepots>((a, b) => new JoinQueryInfos( @@ -30,9 +28,7 @@ .First(); if (depotQuery == null) - { throw new Exception($"002[搴撲綅缂栫爜 {query.sectionCode} 涓嶅瓨鍦紝璇风‘璁わ紒"); - } var cDepotCode = depotQuery.DepotCode; @@ -48,10 +44,7 @@ .Select((a, b) => new { a.Id, a.BillNo, a.InvDepotsCode }) .First(); - if (itemMoveQuery == null) - { - throw new Exception("鏉$爜鏈仛璋冩嫈鍑哄簱鎵爜锛岃鏍稿锛�"); - } + if (itemMoveQuery == null) throw new Exception("鏉$爜鏈仛璋冩嫈鍑哄簱鎵爜锛岃鏍稿锛�"); var cBillNo = itemMoveQuery.BillNo; var iDepotCode = itemMoveQuery.InvDepotsCode; @@ -66,14 +59,10 @@ .First(); if (depotValidationQuery == null) - { throw new Exception($"002[搴撲綅缂栫爜 {query.sectionCode} 涓嶅瓨鍦紝璇风‘璁わ紒"); - } if (iDepotCode != depotValidationQuery.DepotCode) - { throw new Exception("瀹為檯浠撳簱涓庣敵璇疯皟鍏ヤ粨搴撲笉绗︼紝璇锋牳瀵癸紒"); - } var barcodeCount = Db.Queryable<MesInvItemMovesCDetails>() .Where(b => @@ -81,19 +70,13 @@ b.ItemMoveId == itemMoveQuery.Id && b.MoveOk == 1) .Count(); - if (barcodeCount > 0) - { - throw new Exception("鏉$爜璋冩嫈宸插畬鎴愶紝璇锋牳瀵癸紒"); - } + if (barcodeCount > 0) throw new Exception("鏉$爜璋冩嫈宸插畬鎴愶紝璇锋牳瀵癸紒"); var barcodeInfo = Db.Queryable<MesInvItemBarcodes>() .Where(t => t.ItemBarcode == query.barcode) .First(); - if (barcodeInfo == null) - { - throw new Exception("鏉$爜涓嶅瓨鍦紝璇锋牳瀵癸紒"); - } + if (barcodeInfo == null) throw new Exception("鏉$爜涓嶅瓨鍦紝璇锋牳瀵癸紒"); var isAudit = UseTransaction(db => { @@ -140,15 +123,12 @@ .Where(a => a.ItemMoveId == itemMoveQuery.Id && a.MoveOk == 1) .Sum(a => SqlFunc.IsNull(a.Quantity, 0)); - if (totalQuantity == scannedQuantity) - { - return 1; - } + if (totalQuantity == scannedQuantity) return 1; return 0; }); - MovesDto dto = new MovesDto(); + var dto = new MovesDto(); dto.InAudit = isAudit == 1; dto.BarcodesInfo = barcodeInfo; return dto; @@ -180,7 +160,7 @@ public MovesDto GetItems(WarehouseQuery query) { - MovesDto dto = new MovesDto(); + var dto = new MovesDto(); dto.BarcodeList = GetItemMovesCDetails(query); dto.OutItems = GetItemOutItems(query); @@ -287,7 +267,7 @@ if (sumqty > quantity) throw new Exception( "宸叉壂鏉$爜鏁伴噺鎴栨湰娆℃壂鐮佹暟閲忥細" + sumqty + " 澶т簬鐢宠鏁伴噺锛�" + quantity + "锛岃鏍稿锛�"); - + UseTransaction(db => { SaveMesInvItemMovesCDetails(db, query, mesInvItemMoves, -- Gitblit v1.9.3