From 54cefea3fe69bf1d42c6114b68c9a2024c411c6f Mon Sep 17 00:00:00 2001
From: zyf <1071160500@qq.com>
Date: 星期二, 20 八月 2024 17:13:31 +0800
Subject: [PATCH] 生产订单新增字段ScrapRate 变动损耗率

---
 MES.Service/service/Warehouse/MesInvItemMovesManager.cs |   42 ++++++++++--------------------------------
 1 files changed, 10 insertions(+), 32 deletions(-)

diff --git a/MES.Service/service/Warehouse/MesInvItemMovesManager.cs b/MES.Service/service/Warehouse/MesInvItemMovesManager.cs
index 5e1cb86..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);
@@ -288,8 +268,6 @@
             throw new Exception(
                 "宸叉壂鏉$爜鏁伴噺鎴栨湰娆℃壂鐮佹暟閲忥細" + sumqty + " 澶т簬鐢宠鏁伴噺锛�" + quantity + "锛岃鏍稿锛�");
 
-        List<InventoryItem> scanOutShowDb = null;
-
         UseTransaction(db =>
         {
             SaveMesInvItemMovesCDetails(db, query, mesInvItemMoves,
@@ -314,7 +292,7 @@
                     .Where(s => s.Id == mesInvItemStocks.Id)
                     .ExecuteCommand();
 
-            scanOutShowDb = ScanOutShowDb(query);
+            var scanOutShowDb = ScanOutShowDb(query);
             if (CollectionUtil.IsNullOrEmpty(scanOutShowDb))
                 db.Updateable<MesInvItemMoves>()
                     .SetColumns(s => s.Status == 1)
@@ -326,7 +304,7 @@
         });
 
         var itemDto = new OutItemDto();
-        itemDto.SumItem = scanOutShowDb;
+        //itemDto.SumItem = scanOutShowDb;
 
         if (TransctionNo == 201) itemDto.Quantity = mesInvItemStocks.Quantity;
 

--
Gitblit v1.9.3