From 93e6a8bf1c1d3586528978f614b17c9aa1f9734e Mon Sep 17 00:00:00 2001
From: hao <1836460075@qq.com>
Date: 星期五, 13 六月 2025 16:04:41 +0800
Subject: [PATCH] Merge branch 'master' of http://43.142.96.171:8080/r/~yhj/HM_JK

---
 StandardInterface/MES.Service/Dto/webApi/SRM/DeliveryNoteDetail.cs                   |    2 
 StandardInterface/MES.Service/service/SRM/MesDeliveryNoteBarcodeManager.cs           |   26 ++++++++
 StandardInterface/MES.Service/Modes/SRM/MesDeliveryNoteDetails.cs                    |    4 +
 StandardInterface/MES.Service/service/SRM/MesDeliveryNoteManager.cs                  |    3 
 StandardInterface/MESApplication/Controllers/SRM/MesDeliveryNoteBarcodeController.cs |   89 +++++++++++++++++++++++++++++
 StandardInterface/MES.Service/Dto/webApi/SRM/DeliveryItem.cs                         |    7 ++
 StandardInterface/MES.Service/MES.Service.csproj                                     |    1 
 7 files changed, 130 insertions(+), 2 deletions(-)

diff --git a/StandardInterface/MES.Service/Dto/webApi/SRM/DeliveryItem.cs b/StandardInterface/MES.Service/Dto/webApi/SRM/DeliveryItem.cs
new file mode 100644
index 0000000..d4707c4
--- /dev/null
+++ b/StandardInterface/MES.Service/Dto/webApi/SRM/DeliveryItem.cs
@@ -0,0 +1,7 @@
+锘縩amespace MES.Service.Dto.webApi.SRM;
+
+public class DeliveryItem
+{
+    public string? DeliveryNo { get; set; }
+    public string? ItemNo { get; set; }
+}
diff --git a/StandardInterface/MES.Service/Dto/webApi/SRM/DeliveryNoteDetail.cs b/StandardInterface/MES.Service/Dto/webApi/SRM/DeliveryNoteDetail.cs
index 9d3494b..468fd91 100644
--- a/StandardInterface/MES.Service/Dto/webApi/SRM/DeliveryNoteDetail.cs
+++ b/StandardInterface/MES.Service/Dto/webApi/SRM/DeliveryNoteDetail.cs
@@ -14,4 +14,6 @@
     public string? FBillNo { get; set; }
     public string? OrderlineId { get; set; }
     public string? DepotNo { get; set; }
+
+    public string? IsGift { get; set; }
 }
diff --git a/StandardInterface/MES.Service/MES.Service.csproj b/StandardInterface/MES.Service/MES.Service.csproj
index 9efe6e5..24fb568 100644
--- a/StandardInterface/MES.Service/MES.Service.csproj
+++ b/StandardInterface/MES.Service/MES.Service.csproj
@@ -24,7 +24,6 @@
     </ItemGroup>
 
     <ItemGroup>
-      <Folder Include="Dto\webApi\SRM\" />
       <Folder Include="Modes\SRM\" />
       <Folder Include="service\SRM\" />
     </ItemGroup>
diff --git a/StandardInterface/MES.Service/Modes/SRM/MesDeliveryNoteDetails.cs b/StandardInterface/MES.Service/Modes/SRM/MesDeliveryNoteDetails.cs
index 2de9451..5d77177 100644
--- a/StandardInterface/MES.Service/Modes/SRM/MesDeliveryNoteDetails.cs
+++ b/StandardInterface/MES.Service/Modes/SRM/MesDeliveryNoteDetails.cs
@@ -63,4 +63,8 @@
     //鏀惰揣浠撳簱
     [SugarColumn(ColumnName = "DEPOT_CODE")]
     public string? DepotCode { get; set; }
+
+    //鏄惁璧犲搧
+    [SugarColumn(ColumnName = "IS_GIFT")]
+    public string? IsGift { get; set; }
 }
diff --git a/StandardInterface/MES.Service/service/SRM/MesDeliveryNoteBarcodeManager.cs b/StandardInterface/MES.Service/service/SRM/MesDeliveryNoteBarcodeManager.cs
index 6e7305a..38ae75e 100644
--- a/StandardInterface/MES.Service/service/SRM/MesDeliveryNoteBarcodeManager.cs
+++ b/StandardInterface/MES.Service/service/SRM/MesDeliveryNoteBarcodeManager.cs
@@ -50,6 +50,32 @@
         return result.All(b => b);
     }
 
+    public dynamic DeleteByItem(DeliveryItem dt)
+    {
+        return UseTransaction(db =>
+        {
+            return DeleteDataByItem(db, dt) ? 1 : 0;
+        }) > 0;
+    }
+
+    public dynamic DeleteListByItem(List<DeliveryItem> dts)
+    {
+        var result = dts.Select(DeleteByItem).ToList();
+        return result.All(b => b);
+    }
+
+    // 鍒犻櫎鏁版嵁鐨勬柟娉�
+    private bool DeleteDataByItem(SqlSugarScope db, DeliveryItem dt)
+    {
+        var del = db.Deleteable<MesDeliveryNoteBarcode>().Where(s => s.DeliveryNo == dt.DeliveryNo && s.ProductCode==dt.ItemNo).ExecuteCommand() > 0;
+
+        if (del)
+        {
+            return true;
+        }
+        throw new NotImplementedException("鍒犻櫎澶辫触");
+    }
+
     // 鍒犻櫎鏁版嵁鐨勬柟娉�
     private bool DeleteData(SqlSugarScope db, ErpBarcode barcode)
     {
diff --git a/StandardInterface/MES.Service/service/SRM/MesDeliveryNoteManager.cs b/StandardInterface/MES.Service/service/SRM/MesDeliveryNoteManager.cs
index 79c9578..951992b 100644
--- a/StandardInterface/MES.Service/service/SRM/MesDeliveryNoteManager.cs
+++ b/StandardInterface/MES.Service/service/SRM/MesDeliveryNoteManager.cs
@@ -112,7 +112,8 @@
                 CreateDate = DateTime.Now,
                 PurchaseQty = Convert.ToDecimal(s.PurchaseQty),
                 IncludeQty = Convert.ToDecimal(s.IncludeQty),
-                DepotCode = s.DepotNo
+                DepotCode = s.DepotNo,
+                IsGift = s.IsGift
             };
             return entity;
         }).ToList();
diff --git a/StandardInterface/MESApplication/Controllers/SRM/MesDeliveryNoteBarcodeController.cs b/StandardInterface/MESApplication/Controllers/SRM/MesDeliveryNoteBarcodeController.cs
index 7713f50..0f423b8 100644
--- a/StandardInterface/MESApplication/Controllers/SRM/MesDeliveryNoteBarcodeController.cs
+++ b/StandardInterface/MESApplication/Controllers/SRM/MesDeliveryNoteBarcodeController.cs
@@ -286,5 +286,94 @@
         }
     }
 
+    [HttpPost("DeleteByItem")]
+    public ResponseResult DeleteByItem(DeliveryItem dt)
+    {
+        var entity = new MessageCenter();
+        entity.TableName = TableName;
+        entity.Url = URL + "DeleteByItem";
+        entity.Method = METHOD;
+        entity.Data = JsonConvert.SerializeObject(dt);
+        entity.Status = 1;
+        entity.CreateBy = "PL017";
+        try
+        {
+            dynamic resultInfos = new ExpandoObject();
+            var save = m.DeleteByItem(dt);
+            resultInfos = save;
+
+            entity.Result = 0;
+            if (save) entity.Result = 1;
+
+            entity.DealWith = 1;
+            _manager.save(entity);
+
+            return new ResponseResult
+            {
+                status = 0,
+                message = "OK",
+                data = resultInfos
+            };
+        }
+        catch (Exception ex)
+        {
+            entity.Result = 0;
+
+            entity.DealWith = 0;
+
+            entity.ResultData = ex.Message;
+
+            _manager.save(entity);
+
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+
+    [HttpPost("DeleteListByItem")]
+    public ResponseResult DeleteListByItem(List<DeliveryItem> dts)
+    {
+        var entity = new MessageCenter();
+        entity.TableName = TableName;
+        entity.Url = URL + "DeleteListByItem";
+        entity.Method = METHOD;
+        entity.Data = JsonConvert.SerializeObject(dts);
+        entity.Status = 1;
+        entity.CreateBy = "PL017";
+        try
+        {
+            dynamic resultInfos = new ExpandoObject();
+            var save = m.DeleteListByItem(dts);
+            resultInfos = save;
+
+            entity.Result = 0;
+            if (save) entity.Result = 1;
+
+            entity.DealWith = 1;
+            _manager.save(entity);
+
+            return new ResponseResult
+            {
+                status = 0,
+                message = "OK",
+                data = resultInfos
+            };
+        }
+        catch (Exception ex)
+        {
+            entity.Result = 0;
+
+            entity.DealWith = 0;
+
+            entity.ResultData = ex.Message;
+
+            _manager.save(entity);
+
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+
+
+
+
 }
 

--
Gitblit v1.9.3