From eb744ecfecc0f1b6d9c0999c65bc740d93e30eda Mon Sep 17 00:00:00 2001
From: 啊鑫 <t2856754968@163.com>
Date: 星期三, 22 一月 2025 13:38:52 +0800
Subject: [PATCH] 新增接口

---
 StandardPda/MES.Service/service/BasicData/MesDeliveryNoteBarcodeManager.cs |  107 +++++++++++++++++++++++++++--------------------------
 1 files changed, 55 insertions(+), 52 deletions(-)

diff --git a/StandardPda/MES.Service/service/BasicData/MesDeliveryNoteBarcodeManager.cs b/StandardPda/MES.Service/service/BasicData/MesDeliveryNoteBarcodeManager.cs
index 3c64061..4270cb1 100644
--- a/StandardPda/MES.Service/service/BasicData/MesDeliveryNoteBarcodeManager.cs
+++ b/StandardPda/MES.Service/service/BasicData/MesDeliveryNoteBarcodeManager.cs
@@ -1,5 +1,4 @@
-锘縰sing AngleSharp.Dom;
-using MES.Service.DB;
+锘縰sing MES.Service.DB;
 using MES.Service.Dto.webApi;
 using MES.Service.Modes;
 using SqlSugar;
@@ -23,7 +22,7 @@
                     return SaveOrUpdateData(db, mesDeliveryNoteBarcode) ? 1 : 0;
                 case "3":
                 case "6":
-                    return DeleteData(db, mesDeliveryNoteBarcode) ? 1: 0;
+                    return DeleteData(db, mesDeliveryNoteBarcode) ? 1 : 0;
                 default:
                     throw new ArgumentNullException(
                         $"type娌℃湁{barcode.Type}杩欎釜绫诲瀷鐨勫弬鏁�");
@@ -34,10 +33,11 @@
     }
 
     // 鎻掑叆鏁版嵁鐨勬柟娉�
-    private bool InsertData(SqlSugarScope db, MesDeliveryNoteBarcode mesDeliveryNoteBarcode)
+    private bool InsertData(SqlSugarScope db,
+        MesDeliveryNoteBarcode mesDeliveryNoteBarcode)
     {
-
-        if (mesDeliveryNoteBarcode.Id != null) base.DeleteById(mesDeliveryNoteBarcode.Id);
+        if (mesDeliveryNoteBarcode.Id != null)
+            base.DeleteById(mesDeliveryNoteBarcode.Id);
 
         var insert = base.Insert(mesDeliveryNoteBarcode);
 
@@ -46,7 +46,8 @@
     }
 
     // 鏇存柊鏁版嵁鐨勬柟娉�
-    private bool DeleteData(SqlSugarScope db, MesDeliveryNoteBarcode mesDeliveryNoteBarcode)
+    private bool DeleteData(SqlSugarScope db,
+        MesDeliveryNoteBarcode mesDeliveryNoteBarcode)
     {
         var detect = base.DeleteById(mesDeliveryNoteBarcode.Id);
 
@@ -55,9 +56,11 @@
     }
 
     // 鎻掑叆鎴栨洿鏂版暟鎹殑鏂规硶
-    private bool SaveOrUpdateData(SqlSugarScope db, MesDeliveryNoteBarcode mesDeliveryNoteBarcode)
+    private bool SaveOrUpdateData(SqlSugarScope db,
+        MesDeliveryNoteBarcode mesDeliveryNoteBarcode)
     {
-        if (mesDeliveryNoteBarcode.Id != null) base.DeleteById(mesDeliveryNoteBarcode.Id);
+        if (mesDeliveryNoteBarcode.Id != null)
+            base.DeleteById(mesDeliveryNoteBarcode.Id);
 
         var orUpdate = base.Insert(mesDeliveryNoteBarcode);
         if (orUpdate) return true;
@@ -70,69 +73,69 @@
     {
         var result = barcodes.Select(Save).ToList();
         return result.All(b => b);
-    /*    var list = barcodes.Select(GetMesDeliveryNoteBarcode).ToList();
-        var groupBy = list.GroupBy(s => s.Type)
-            .ToDictionary(g => g.Key, g => g.ToList());
+        /*    var list = barcodes.Select(GetMesDeliveryNoteBarcode).ToList();
+            var groupBy = list.GroupBy(s => s.Type)
+                .ToDictionary(g => g.Key, g => g.ToList());
 
-        return UseTransaction(db =>
-        {
-            foreach (var barcodeGroup in groupBy)
-                switch (barcodeGroup.Key)
-                {
-                    case "1":
-                        if (!UpdateItemStatusBatch(db, barcodeGroup.Value, "B"))
-                            throw new NotImplementedException("绂佺敤澶辫触");
-                        break;
-                    case "2":
-                        if (!InsertItemBatch(db, barcodeGroup.Value))
-                            throw new NotImplementedException("鎻掑叆澶辫触");
-                        break;
-                    default:
-                        throw new ArgumentNullException(
-                            $"type娌℃湁{barcodeGroup.Key}杩欎釜绫诲瀷鐨勫弬鏁�");
-                }
+            return UseTransaction(db =>
+            {
+                foreach (var barcodeGroup in groupBy)
+                    switch (barcodeGroup.Key)
+                    {
+                        case "1":
+                            if (!UpdateItemStatusBatch(db, barcodeGroup.Value, "B"))
+                                throw new NotImplementedException("绂佺敤澶辫触");
+                            break;
+                        case "2":
+                            if (!InsertItemBatch(db, barcodeGroup.Value))
+                                throw new NotImplementedException("鎻掑叆澶辫触");
+                            break;
+                        default:
+                            throw new ArgumentNullException(
+                                $"type娌℃湁{barcodeGroup.Key}杩欎釜绫诲瀷鐨勫弬鏁�");
+                    }
 
-            return 1;
-        }) > 0; */
+                return 1;
+            }) > 0; */
     }
 
-  /*  private bool InsertItemBatch(SqlSugarScope db, List<MesDeliveryNoteBarcode> barcodeList)
-    {
-        var insertRange = db.Insertable(barcodeList).ExecuteCommand();
-        if (insertRange > 0)
-            return true;
+    /*  private bool InsertItemBatch(SqlSugarScope db, List<MesDeliveryNoteBarcode> barcodeList)
+      {
+          var insertRange = db.Insertable(barcodeList).ExecuteCommand();
+          if (insertRange > 0)
+              return true;
 
-        throw new NotImplementedException("鎻掑叆澶辫触");
-    }
+          throw new NotImplementedException("鎻掑叆澶辫触");
+      }
 
-    private bool DeleteItemBatch(SqlSugarScope db, List<MesDeliveryNoteBarcode> barcodeList)
-    {
-        var ids = barcodeList.Select(it => it.Id).ToArray();
-        var deleteByIds = db.Deleteable<MesItems>().In(ids).ExecuteCommand();
-        if (deleteByIds > 0)
-            return true;
+      private bool DeleteItemBatch(SqlSugarScope db, List<MesDeliveryNoteBarcode> barcodeList)
+      {
+          var ids = barcodeList.Select(it => it.Id).ToArray();
+          var deleteByIds = db.Deleteable<MesItems>().In(ids).ExecuteCommand();
+          if (deleteByIds > 0)
+              return true;
 
-        throw new NotImplementedException("鍒犻櫎澶辫触");
-    } */
+          throw new NotImplementedException("鍒犻櫎澶辫触");
+      } */
 
 
     public MesDeliveryNoteBarcode GetMesDeliveryNoteBarcode(ErpBarcode barcode)
     {
         var mesDeliveryNoteBarcode = new MesDeliveryNoteBarcode();
-        var single = base.GetSingle(it => it.SmallBarcode == barcode.SmallBarcode);
+        var single =
+            base.GetSingle(it => it.SmallBarcode == barcode.SmallBarcode);
         if (single != null) mesDeliveryNoteBarcode.Id = single.Id;
 
 
         mesDeliveryNoteBarcode.DeliveryNo = barcode.DeliveryNo;
         mesDeliveryNoteBarcode.ProductCode = barcode.ProductCode;
-        mesDeliveryNoteBarcode.SmallBarcode= barcode.SmallBarcode;
-        mesDeliveryNoteBarcode.IncludeQty= Convert.ToDecimal(barcode.IncludeQty);
-        mesDeliveryNoteBarcode.LineNo=Convert.ToDecimal(barcode.LineNo);
+        mesDeliveryNoteBarcode.SmallBarcode = barcode.SmallBarcode;
+        mesDeliveryNoteBarcode.IncludeQty =
+            Convert.ToDecimal(barcode.IncludeQty);
+        mesDeliveryNoteBarcode.LineNo = Convert.ToDecimal(barcode.LineNo);
         mesDeliveryNoteBarcode.CreateDate = DateTime.Now;
         mesDeliveryNoteBarcode.SuppNo = barcode.SupplierId;
 
         return mesDeliveryNoteBarcode;
     }
-
-
 }
\ No newline at end of file

--
Gitblit v1.9.3