From d0c510aa971aa891429adde2547018bc04235aa4 Mon Sep 17 00:00:00 2001
From: 啊鑫 <t2856754968@163.com>
Date: 星期三, 21 八月 2024 11:44:38 +0800
Subject: [PATCH] 修正

---
 MES.Service/service/Warehouse/OpeningReceiptServer.cs |   50 +++++++++++++++-----------------------------------
 1 files changed, 15 insertions(+), 35 deletions(-)

diff --git a/MES.Service/service/Warehouse/OpeningReceiptServer.cs b/MES.Service/service/Warehouse/OpeningReceiptServer.cs
index 74dc31e..f39711d 100644
--- a/MES.Service/service/Warehouse/OpeningReceiptServer.cs
+++ b/MES.Service/service/Warehouse/OpeningReceiptServer.cs
@@ -18,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 =>
         {
@@ -71,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 =
@@ -91,13 +77,13 @@
         return entity;
     }
 
-    public MesInvItemIns GetMesInvItemIns(decimal id)
+    public MesInvItemIns GetMesInvItemIns(decimal? id)
     {
         return Db.Queryable<MesInvItemIns>()
             .Where(s => s.Id == id).Single();
     }
 
-    public List<MesInvItemInCDetails> GetMesInvItemInCDetailsList(decimal id)
+    public List<MesInvItemInCDetails> GetMesInvItemInCDetailsList(decimal? id)
     {
         return Db.Queryable<MesInvItemInCDetails, MesUnit>((a, b) =>
                 new JoinQueryInfos(JoinType.Inner, a.Unit == b.Id.ToString()))
@@ -150,13 +136,11 @@
             CbillNo = barcodeInfo.BillNo,
             UrgentFlag = barcodeInfo.UrgentFlag,
             BoardStyle = barcodeInfo.BoardStyle,
-            TaskNo = barcodeInfo.TaskNo
+            TaskNo = barcodeInfo.TaskNo,
+            ItemId = barcodeInfo.ItemId,
         }).ExecuteCommand();
 
-        if (executeCommand <= 0)
-        {
-            throw new Exception("鍐欏叆澶辫触");
-        }
+        if (executeCommand <= 0) throw new Exception("鍐欏叆澶辫触");
     }
 
     private decimal GetOrCreateInventoryItemInId(MesInvItemBarcodes barcodeInfo,
@@ -261,13 +245,11 @@
             BoardStyle = barcodeInfo.BoardStyle,
             WorkNo = barcodeInfo.WorkNo,
             WorkLine = barcodeInfo.WorkLine,
-            SuppNo = barcodeInfo.SuppNo
+            SuppNo = barcodeInfo.SuppNo,
+            ItemId = barcodeInfo.ItemId,
         }).ExecuteCommand();
 
-        if (executeCommand <= 0)
-        {
-            throw new Exception("鍐欏叆澶辫触");
-        }
+        if (executeCommand <= 0) throw new Exception("鍐欏叆澶辫触");
     }
 
     private void InsertBusinessRecord(MesInvItemBarcodes barcodeInfo,
@@ -297,12 +279,10 @@
             BillNo = billNo,
             WorkNo = barcodeInfo.WorkNo,
             WorkLine = barcodeInfo.WorkLine,
-            SuppNo = barcodeInfo.SuppNo
+            SuppNo = barcodeInfo.SuppNo,
+            ItemId = barcodeInfo.ItemId,
         }).ExecuteCommand();
 
-        if (executeCommand <= 0)
-        {
-            throw new Exception("鍐欏叆澶辫触");
-        }
+        if (executeCommand <= 0) throw new Exception("鍐欏叆澶辫触");
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3