From 528d0370cb57f07e291fbf8fb0052718c3fe584c Mon Sep 17 00:00:00 2001
From: cnf <3200815559@qq.com>
Date: 星期六, 13 九月 2025 15:14:50 +0800
Subject: [PATCH] 合并接口

---
 MES.Service/Modes/DeliveryBarcodeInformation.cs                   |  196 ++++++
 MES.Service/service/BasicData/DeliveryBarcodeManager.cs           |  392 ++++++++++++
 MES.Service/service/BasicData/MesStaffManager.cs                  |   48 
 MESApplication/Controllers/BasicData/MesSupplierController.cs     |    5 
 MES.Service/util/ResponseResult.cs                                |   27 
 MESApplication/Controllers/BasicData/MesDepotsController.cs       |    5 
 MES.Service/service/BasicData/MesDeliveryNoteManager.cs           |   47 
 MES.Service/Dto/webApi/DeliveryBarcodeInfo.cs                     |   59 +
 MES.Service/service/BasicData/MesCustomerManager.cs               |   63 -
 MES.Service/service/BasicData/OrganizeManager.cs                  |   68 -
 MESApplication/Controllers/BasicData/MesUnitController.cs         |    5 
 MES.Service/service/BasicData/MesSupplierManager.cs               |   70 -
 MESApplication/Controllers/BasicData/MesItemsController.cs        |    5 
 MESApplication/Controllers/BasicData/MesPositionController.cs     |    5 
 MESApplication/Controllers/BasicData/MesDeliveryNoteController.cs |    5 
 MES.Service/service/BasicData/MesDepotsManager.cs                 |   80 +-
 MESApplication/Controllers/BasicData/MesStaffController.cs        |    5 
 MESApplication/Controllers/BasicData/SysDepartmentController.cs   |    5 
 MES.Service/service/BasicData/MesUnitManager.cs                   |   38 
 MES.Service/Dto/webApi/DeleteByDeliveryItemRequest.cs             |   29 
 MES.Service/service/BasicData/MesPositionManager.cs               |   71 -
 MESApplication/Controllers/BasicData/ProductionOrderController.cs |    8 
 MES.Service/service/BasicData/SysDepartmentManager.cs             |   75 -
 MESApplication/Controllers/WomcaaController.cs                    |    5 
 MESApplication/Controllers/BasicData/MesCustomerController.cs     |   10 
 MESApplication/Controllers/BasicData/DeliveryBarcodeController.cs |  379 ++++++++++++
 MES.Service/Dto/webApi/DeleteByDeliveryNoRequest.cs               |   25 
 MESApplication/Controllers/BasicData/OrganizeController.cs        |    5 
 MESApplication/Controllers/BasicData/MesItemTypeController.cs     |    5 
 MES.Service/service/BasicData/MesItemsManager.cs                  |   46 
 MES.Service/service/BasicData/MesItemTypeManager.cs               |   34 
 MESApplication/appsettings.json                                   |    2 
 32 files changed, 1,413 insertions(+), 409 deletions(-)

diff --git a/MES.Service/Dto/webApi/DeleteByDeliveryItemRequest.cs b/MES.Service/Dto/webApi/DeleteByDeliveryItemRequest.cs
new file mode 100644
index 0000000..dcaf0ce
--- /dev/null
+++ b/MES.Service/Dto/webApi/DeleteByDeliveryItemRequest.cs
@@ -0,0 +1,29 @@
+锘縰sing System.ComponentModel.DataAnnotations;
+using MES.Service.Dto.webApi;
+
+namespace MES.Service.Dto.webApi;
+
+/// <summary>
+/// 鎸夐�佽揣鍗曞彿+琛屽唴鐮佸垹闄ゆ潯鐮佺殑璇锋眰妯″瀷
+/// </summary>
+public class DeleteByDeliveryItemRequest
+{
+    /// <summary>
+    /// 閫佽揣鍗曞彿锛堝繀濉紝涓嶈兘涓虹┖/绌哄瓧绗︿覆锛�
+    /// </summary>
+    [Required(ErrorMessage = "閫佽揣鍗曞彿 DeliveryNo 涓嶈兘涓虹┖")]
+    public string DeliveryNo { get; set; }
+
+    /// <summary>
+    /// 閫佽揣鍗曡鍐呯爜锛堝繀濉紝涓嶈兘涓虹┖/绌哄瓧绗︿覆锛�
+    /// </summary>
+    [Required(ErrorMessage = "閫佽揣鍗曡鍐呯爜 LineNo 涓嶈兘涓虹┖")]
+    public string LineNo { get; set; }
+}
+/// <summary>
+/// 鎵归噺鎸夐�佽揣鍗曞彿+琛屽唴鐮佸垹闄ょ殑璇锋眰妯″瀷
+/// </summary>
+public class BatchDeleteByDeliveryItemRequest : List<DeleteByDeliveryItemRequest>
+{
+    // 缁ф壙鑷狶ist<DeleteByDeliveryItemRequest>锛岀洿鎺ユ帴鏀舵暟缁勬牸寮�
+}
\ No newline at end of file
diff --git a/MES.Service/Dto/webApi/DeleteByDeliveryNoRequest.cs b/MES.Service/Dto/webApi/DeleteByDeliveryNoRequest.cs
new file mode 100644
index 0000000..7f0c985
--- /dev/null
+++ b/MES.Service/Dto/webApi/DeleteByDeliveryNoRequest.cs
@@ -0,0 +1,25 @@
+锘縰sing System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+
+namespace MES.Service.Dto.webApi;
+
+/// <summary>
+/// 鏍规嵁閫佽揣鍗曞彿鍒犻櫎鏉$爜鐨勮姹傛ā鍨嬶紙鍗曚釜锛�
+/// </summary>
+public class DeleteByDeliveryNoRequest
+{
+    /// <summary>
+    /// 閫佽揣鍗曞彿锛堝繀濉紝涓嶈兘涓虹┖/绌哄瓧绗︿覆锛�
+    /// </summary>
+    [Required(ErrorMessage = "閫佽揣鍗曞彿 DeliveryNo 涓嶈兘涓虹┖")]
+    public string DeliveryNo { get; set; }
+    
+   }
+
+/// <summary>
+/// 鎵归噺鏍规嵁閫佽揣鍗曞彿鍒犻櫎鐨勮姹傛ā鍨�
+/// </summary>
+public class BatchDeleteByDeliveryNoRequest : List<DeleteByDeliveryNoRequest>
+{
+    // 缁ф壙鑷狶ist<DeliveryNoItem>锛岀洿鎺ユ帴鏀舵暟缁勬牸寮�
+}
\ No newline at end of file
diff --git a/MES.Service/Dto/webApi/DeliveryBarcodeInfo.cs b/MES.Service/Dto/webApi/DeliveryBarcodeInfo.cs
new file mode 100644
index 0000000..852c235
--- /dev/null
+++ b/MES.Service/Dto/webApi/DeliveryBarcodeInfo.cs
@@ -0,0 +1,59 @@
+锘縩amespace MES.Service.Dto.webApi;
+
+public class DeliveryBarcodeInfo
+{
+    /// <summary>
+    /// 閫佽揣鍗曞彿
+    /// </summary>
+    public string? DeliveryNo { get; set; }
+    
+    /// <summary>
+    /// 閫佽揣鍗曡鍐呯爜
+    /// </summary>
+    public string? LineNo { get; set; }
+    
+    /// <summary>
+    /// 鐗╂枡鏉$爜
+    /// </summary>
+    public string? SmallBarcode { get; set; }
+    
+    /// <summary>
+    /// 鐗╂枡鍐呯爜
+    /// </summary>
+    public string? ProductCode { get; set; }
+    
+    /// <summary>
+    /// 鏉$爜鏁伴噺
+    /// </summary>
+    public decimal? IncludeQty { get; set; }
+    
+    /// <summary>
+    /// 绠辨潯鐮�
+    /// </summary>
+    public string? OuterBarcode { get; set; }
+    
+    /// <summary>
+    /// 鏉$爜绫诲瀷
+    /// </summary>
+    public string? BarcodeType { get; set; }
+    
+    /// <summary>
+    /// 鏄惁鍚堝苟
+    /// </summary>
+    public bool? IsMerge { get; set; }
+    
+    /// <summary>
+    /// 鎺ュ彛绫诲瀷
+    /// </summary>
+    public string? Type { get; set; }
+    
+    /// <summary>
+    /// 鏄惁灏剧
+    /// </summary>
+    public bool? IsLast { get; set; }
+    
+    /// <summary>
+    /// 绠辫鏁�
+    /// </summary>
+    public int? PackingQty { get; set; }
+}
\ No newline at end of file
diff --git a/MES.Service/Modes/DeliveryBarcodeInformation.cs b/MES.Service/Modes/DeliveryBarcodeInformation.cs
new file mode 100644
index 0000000..d76aeca
--- /dev/null
+++ b/MES.Service/Modes/DeliveryBarcodeInformation.cs
@@ -0,0 +1,196 @@
+锘縰sing SqlSugar;
+
+namespace MES.Service.Modes;
+
+/// <summary>
+///     鎼哄浜戞潯鐮佷俊鎭〃
+/// </summary>
+[SugarTable("TBL_BARCODE_INFORMATION")]
+public class BarcodeInformation
+{
+    /// <summary>
+    ///     SEQ_XKY
+    /// </summary>
+    [SugarColumn(ColumnName = "id", IsPrimaryKey = true)]
+    public Guid Id { get; set; }
+
+    /// <summary>
+    ///     浜у搧缂栫爜
+    /// </summary>
+    [SugarColumn(ColumnName = "product_code")]
+    public string? ProductCode { get; set; }
+
+    /// <summary>
+    ///     灏忓寘鏉$爜
+    /// </summary>
+    [SugarColumn(ColumnName = "small_barcode")]
+    public string? SmallBarcode { get; set; }
+
+    /// <summary>
+    ///     澶у寘鏉$爜
+    /// </summary>
+    [SugarColumn(ColumnName = "big_barcode")]
+    public string? BigBarcode { get; set; }
+
+    /// <summary>
+    ///     澶栫鏉$爜
+    /// </summary>
+    [SugarColumn(ColumnName = "outer_barcode")]
+    public string? OuterBarcode { get; set; }
+
+    /// <summary>
+    ///     褰撳墠灏忓寘鏉$爜鍖呭惈鐨勬暟閲�
+    /// </summary>
+    [SugarColumn(ColumnName = "include_qty")]
+    public decimal? IncludeQty { get; set; }
+
+    /// <summary>
+    ///     灏忓寘鏉$爜-闀�
+    /// </summary>
+    [SugarColumn(ColumnName = "small_package_length")]
+    public string? SmallPackageLength { get; set; }
+
+    /// <summary>
+    ///     灏忓寘鏉$爜-瀹�
+    /// </summary>
+    [SugarColumn(ColumnName = "small_package_width")]
+    public string? SmallPackageWidth { get; set; }
+
+    /// <summary>
+    ///     灏忓寘鏉$爜-楂�
+    /// </summary>
+    [SugarColumn(ColumnName = "small_package_height")]
+    public string? SmallPackageHeight { get; set; }
+
+    /// <summary>
+    ///     澶у寘鏉$爜-闀�
+    /// </summary>
+    [SugarColumn(ColumnName = "big_package_length")]
+    public string? BigPackageLength { get; set; }
+
+    /// <summary>
+    ///     澶у寘鏉$爜-瀹�
+    /// </summary>
+    [SugarColumn(ColumnName = "big_package_width")]
+    public string? BigPackageWidth { get; set; }
+
+    /// <summary>
+    ///     澶у寘鏉$爜-楂�
+    /// </summary>
+    [SugarColumn(ColumnName = "big_package_height")]
+    public string? BigPackageHeight { get; set; }
+
+    /// <summary>
+    ///     澶栫鏉$爜-闀�
+    /// </summary>
+    [SugarColumn(ColumnName = "outer_package_length")]
+    public string? OuterPackageLength { get; set; }
+
+    /// <summary>
+    ///     澶栫鏉$爜-瀹�
+    /// </summary>
+    [SugarColumn(ColumnName = "outer_package_width")]
+    public string? OuterPackageWidth { get; set; }
+
+    /// <summary>
+    ///     澶栫鏉$爜-楂�
+    /// </summary>
+    [SugarColumn(ColumnName = "outer_package_height")]
+    public string? OuterPackageHeight { get; set; }
+
+    /// <summary>
+    ///     褰撳墠灏忓寘鏉$爜鐨勬祦姘寸爜
+    /// </summary>
+    [SugarColumn(ColumnName = "small_package_sn")]
+    public string? SmallPackageSn { get; set; }
+
+    /// <summary>
+    ///     褰撳墠澶у寘鏉$爜鐨勬祦姘寸爜
+    /// </summary>
+    [SugarColumn(ColumnName = "big_package_sn")]
+    public string? BigPackageSn { get; set; }
+
+    /// <summary>
+    ///     褰撳墠澶栫鏉$爜鐨勬祦姘寸爜
+    /// </summary>
+    [SugarColumn(ColumnName = "out_package_sn")]
+    public string? OutPackageSn { get; set; }
+
+    /// <summary>
+    ///     鏉$爜瑙勫垯涓搴旂殑鍔ㄦ�佸瓧娈电殑鍊�
+    /// </summary>
+    [SugarColumn(ColumnName = "dynamic_data")]
+    public string? DynamicData { get; set; }
+
+    /// <summary>
+    ///     鍖呰灞傜骇
+    /// </summary>
+    [SugarColumn(ColumnName = "pack_level")]
+    public string? PackLevel { get; set; }
+
+    /// <summary>
+    ///     鍒涘缓鏃堕棿
+    /// </summary>
+    [SugarColumn(ColumnName = "create_time")]
+    public DateTime? CreateTime { get; set; }
+
+    /// <summary>
+    ///     鏇存柊鏃堕棿
+    /// </summary>
+    [SugarColumn(ColumnName = "update_time")]
+    public DateTime? UpdateTime { get; set; }
+
+    /// <summary>
+    ///     閫佽揣鍗曞彿
+    /// </summary>
+    [SugarColumn(ColumnName = "delivery_no")]
+    public string? DeliveryNo { get; set; }
+
+    /// <summary>
+    ///     閲囪喘鍗曞彿
+    /// </summary>
+    [SugarColumn(ColumnName = "po_erp_no")]
+    public string? PoErpNo { get; set; }
+
+    /// <summary>
+    ///     閫佽揣鍗曢」娆�
+    /// </summary>
+    [SugarColumn(ColumnName = "dnLines")]
+    public string? DnLines { get; set; }
+
+    /// <summary>
+    ///     璁㈠崟椤规(ERP)
+    /// </summary>
+    [SugarColumn(ColumnName = "po_line_no")]
+    public string? PoLineNo { get; set; }
+
+    /// <summary>
+    ///     渚涘簲鍟嗙紪鐮�
+    /// </summary>
+    [SugarColumn(ColumnName = "inner_vendor_code")]
+    public string? InnerVendorCode { get; set; }
+
+    /// <summary>
+    ///     X
+    /// </summary>
+    [SugarColumn(ColumnName = "customize1")]
+    public string? Customize1 { get; set; }
+
+    /// <summary>
+    ///     鍚屾鏃堕棿
+    /// </summary>
+    [SugarColumn(ColumnName = "SYNCHRONOUS_DATE")]
+    public DateTime? SynchronousDate { get; set; }
+
+    /// <summary>
+    ///     鐢熶骇鏃ユ湡
+    /// </summary>
+    [SugarColumn(ColumnName = "customize2")]
+    public string? Customize2 { get; set; }
+
+    /// <summary>
+    ///     鏈夋晥鏈�
+    /// </summary>
+    [SugarColumn(ColumnName = "customize3")]
+    public string? Customize3 { get; set; }
+}
\ No newline at end of file
diff --git a/MES.Service/service/BasicData/DeliveryBarcodeManager.cs b/MES.Service/service/BasicData/DeliveryBarcodeManager.cs
new file mode 100644
index 0000000..b4212dd
--- /dev/null
+++ b/MES.Service/service/BasicData/DeliveryBarcodeManager.cs
@@ -0,0 +1,392 @@
+锘縰sing MES.Service.DB;
+using MES.Service.Dto.webApi;
+using MES.Service.Modes;
+using System.Linq;
+using MES.Service.util;
+
+namespace MES.Service.service.BasicData;
+
+/// <summary>
+/// 閫佽揣鍗曟潯鐮佷笟鍔$鐞嗗櫒锛堝搴擳BL_BARCODE_INFORMATION琛ㄦ搷浣滐級
+/// </summary>
+public class DeliveryBarcodeManager : Repository<BarcodeInformation>
+{
+    /// <summary>
+    /// 鍗曚釜閫佽揣鍗曟潯鐮佷俊鎭繚瀛橈紙鏀寔鏂板/鍒犻櫎锛屾寜Type鍖哄垎鎿嶄綔绫诲瀷锛�
+    /// </summary>
+    /// <param name="barcodeDto">閫佽揣鍗曟潯鐮丏TO锛堝惈鎿嶄綔绫诲瀷Type锛�</param>
+    /// <returns>鎿嶄綔鏄惁鎴愬姛</returns>
+    public bool Save(DeliveryBarcodeInfo barcodeDto)
+    {
+        if (barcodeDto == null)
+            throw new ArgumentNullException(nameof(barcodeDto), "鏉$爜DTO涓嶈兘涓虹┖");
+
+        // DTO杞疄浣擄紙鏄犲皠瀛楁鍏崇郴锛�
+        var barcodeEntity = ConvertDtoToEntity(barcodeDto);
+
+        try
+        {
+            // 鎸塗ype鍖哄垎鎿嶄綔绫诲瀷锛�0=鏂板锛�1=鍒犻櫎锛�
+            switch (barcodeDto.Type)
+            {
+                case "0":
+                    return InsertBarcode(barcodeEntity);
+                case "1":
+                    return DeleteBarcode(barcodeEntity.Id);
+                default:
+                    throw new ArgumentOutOfRangeException( nameof(barcodeDto.Type), barcodeDto.Type, "鏉$爜鎿嶄綔绫诲瀷閿欒锛氫粎鏀寔 0锛堟柊澧烇級銆�1锛堝垹闄わ級");
+            }
+        }
+        catch (Exception ex)
+        {
+            throw new ApplicationException($"鍗曚釜鏉$爜鎿嶄綔澶辫触锛堥�佽揣鍗曞彿锛歿barcodeDto.DeliveryNo}锛夛細{ex.Message}", ex);
+        }
+    }
+
+    /// <summary>
+    /// 鎵归噺閫佽揣鍗曟潯鐮佷俊鎭繚瀛橈紙鎸塗ype鍒嗙粍澶勭悊锛岀粺涓�寮傚父鎹曡幏锛�
+    /// </summary>
+    /// <param name="barcodeDtoList">閫佽揣鍗曟潯鐮丏TO鍒楄〃</param>
+    /// <returns>鎵归噺鎿嶄綔鏄惁鍏ㄩ儴鎴愬姛</returns>
+    public bool SaveList(List<DeliveryBarcodeInfo> barcodeDtoList)
+    {
+        if (barcodeDtoList == null || !barcodeDtoList.Any())
+        {
+            throw new ArgumentException("鎵归噺鎿嶄綔鐨勬潯鐮佸垪琛ㄤ笉鑳戒负绌�");
+        }
+
+        try
+        {
+            // 1. 鍒涘缓寮虹被鍨嬬殑瀹炰綋涓庣被鍨嬬粍鍚堝垪琛紙瑙e喅dynamic杞崲闂锛�
+            var entityTypePairs = new List<EntityTypePair>();
+            foreach (var dto in barcodeDtoList)
+            {
+                entityTypePairs.Add(new EntityTypePair
+                {
+                    Entity = ConvertDtoToEntity(dto),
+                    Type = dto.Type
+                });
+            }
+
+            // 2. 鎸夋搷浣滅被鍨婽ype鍒嗙粍锛堜娇鐢ㄥ己绫诲瀷閬垮厤绫诲瀷鎺ㄦ柇闂锛�
+            var typeGroupDict = entityTypePairs.GroupBy(pair => pair.Type).ToDictionary(group => group.Key,group => group.Select(pair => pair.Entity).ToList());
+
+            // 3. 瀛樺偍鍚勭粍鎿嶄綔缁撴灉
+            var groupResultList = new List<bool>();
+
+            foreach (var (type, entityGroup) in typeGroupDict)
+            {
+                switch (type)
+                {
+                    case "0":
+                        groupResultList.Add(InsertBarcodeBatch(entityGroup));
+                        break;
+                    case "1":
+                        groupResultList.Add(DeleteBarcodeBatch(entityGroup.Select(e => e.Id).ToArray()));
+                        break;
+                    default:
+                        throw new ArgumentOutOfRangeException(nameof(type),type,"鎵归噺鎿嶄綔涓瓨鍦ㄩ潪娉昑ype锛氫粎鏀寔 0锛堟柊澧烇級銆�1锛堝垹闄わ級");
+                }
+            }
+
+            // 4. 鎵�鏈夊垎缁勬搷浣滃潎鎴愬姛鎵嶇畻鎵归噺鎴愬姛
+            if (groupResultList.All(result => result))
+            {
+                return true;
+            }
+
+            throw new NotImplementedException("鎵归噺鏉$爜鎿嶄綔閮ㄥ垎澶辫触锛屽叿浣撹鏌ョ湅鏃ュ織");
+        }
+        catch (Exception ex)
+        {
+            throw new ApplicationException($"鎵归噺鏉$爜鎿嶄綔澶辫触锛堟�绘潯鏁帮細{barcodeDtoList.Count}锛夛細{ex.Message}", ex);
+        }
+    }
+
+    /// <summary>
+    /// 鏍规嵁閫佽揣鍗曞彿鍒犻櫎鏉$爜鏁版嵁
+    /// </summary>
+    /// <param name="deliveryNo">閫佽揣鍗曞彿锛堜笉鑳戒负绌�/绌哄瓧绗︿覆锛�</param>
+    /// <returns>鏄惁鍒犻櫎鎴愬姛锛坱rue=鑷冲皯鍒犻櫎1鏉★紝false=鏈壘鍒板搴旀暟鎹級</returns>
+    public bool DeleteByDeliveryNo(string deliveryNo)
+    {
+        // 1. 鏍¢獙鍙傛暟锛氶�佽揣鍗曞彿涓嶈兘涓虹┖
+        if (string.IsNullOrWhiteSpace(deliveryNo))
+        {
+            throw new ArgumentException("閫佽揣鍗曞彿 DeliveryNo 涓嶈兘涓虹┖鎴栫┖鏍�", nameof(deliveryNo));
+        }
+        try
+        {
+            // 2. 鎵ц鍒犻櫎锛氭牴鎹� DeliveryNo 鍖归厤琛ㄤ腑鏁版嵁锛堝搴斿疄浣撶殑 DeliveryNo 瀛楁锛�
+            int deletedCount = Db.Deleteable<BarcodeInformation>()
+                .Where(barcode => barcode.DeliveryNo == deliveryNo) // 琛ㄥ瓧娈典笌閫佽揣鍗曞彿鍖归厤
+                .ExecuteCommand(); // 杩斿洖鍙楀奖鍝嶇殑琛屾暟
+
+            // 3. 鍒ゆ柇缁撴灉锛氳嚦灏戝垹闄�1鏉″垯瑙嗕负鎴愬姛锛屽惁鍒欐姏鍑衡�滄湭鎵惧埌鏁版嵁鈥濆紓甯�
+            if (deletedCount > 0)
+            {
+                return true;
+            }
+            throw new KeyNotFoundException($"鏈壘鍒伴�佽揣鍗曞彿涓恒�寋deliveryNo}銆嶇殑鏉$爜鏁版嵁锛屽垹闄ゆ搷浣滄湭鎵ц");
+        }
+        catch (Exception ex)
+        {
+            // 4. 鍖呰涓氬姟寮傚父锛岃ˉ鍏呬笂涓嬫枃淇℃伅
+            throw new ApplicationException($"鏍规嵁閫佽揣鍗曞彿鍒犻櫎鏉$爜鏁版嵁澶辫触锛圖eliveryNo锛歿deliveryNo}锛夛細{ex.Message}", ex);
+        }
+    }
+
+    /// <summary>
+    /// 鎵归噺鎸夐�佽揣鍗曞彿鍒犻櫎鏉$爜鏁版嵁锛堟帴鏀舵暟缁勯」鍒楄〃锛�
+    /// </summary>
+    /// <param name="deliveryNoItems">鍖呭惈DeliveryNo鐨勫璞″垪琛�</param>
+    /// <returns>鎵归噺鍒犻櫎缁撴灉</returns>
+    public BatchDeleteResult DeleteListByDeliveryNo(List<DeleteByDeliveryNoRequest> deliveryNoItems)
+    {
+        // 1. 鍙傛暟鏍¢獙涓庡鐞嗭紙浠庢帶鍒跺櫒绉昏繃鏉ョ殑閫昏緫锛�
+        if (deliveryNoItems == null || !deliveryNoItems.Any())
+        {
+            throw new ArgumentException("閫佽揣鍗曞彿鍒楄〃涓嶈兘涓虹┖", nameof(deliveryNoItems));
+        }
+        // 鎻愬彇骞堕獙璇侀�佽揣鍗曞彿鍒楄〃
+        var deliveryNoList = deliveryNoItems
+            .Select(item => item.DeliveryNo) // 浠庡璞′腑鎻愬彇DeliveryNo瀛楁
+            .Where(no => !string.IsNullOrWhiteSpace(no)) // 杩囨护绌哄��/绌烘牸
+            .Distinct() // 鍘婚噸锛岄伩鍏嶉噸澶嶅垹闄�
+            .ToList();
+
+        // 鍒ゆ柇鏄惁鏈夋湁鏁堝崟鍙�
+        if (!deliveryNoList.Any())
+        {
+            throw new ArgumentException("璇锋眰涓病鏈夋湁鏁堢殑閫佽揣鍗曞彿锛堝潎涓虹┖鎴栫┖鏍硷級");
+        }
+        try
+        {
+            // 2. 鏌ヨ鏁版嵁搴撲腑瀛樺湪鐨勯�佽揣鍗曞彿
+            var existingNos = Db.Queryable<BarcodeInformation>().Where(barcode => deliveryNoList.Contains(barcode.DeliveryNo)).Select(barcode => barcode.DeliveryNo).Distinct().ToList();
+
+            // 3. 鎵ц鎵归噺鍒犻櫎
+            int totalDeleted = Db.Deleteable<BarcodeInformation>().Where(barcode => deliveryNoList.Contains(barcode.DeliveryNo)).ExecuteCommand();
+
+            // 4. 杩斿洖缁撴灉
+            return new BatchDeleteResult
+            {
+                TotalRequested = deliveryNoList.Count,
+                TotalDeleted = totalDeleted,
+                DeletedNos = existingNos,
+                NotFoundNos = deliveryNoList.Except(existingNos).ToList()
+            };
+        }
+        catch (Exception ex)
+        {
+            throw new ApplicationException($"鎵归噺鍒犻櫎澶辫触锛堝叡{deliveryNoList.Count}涓崟鍙凤級锛歿ex.Message}",ex);
+        }
+    }
+
+    /// <summary>
+    /// 鎸夐�佽揣鍗曞彿+琛屽唴鐮佽仈鍚堝垹闄ゆ潯鐮佹暟鎹�
+    /// </summary>
+    /// <param name="deliveryNo">閫佽揣鍗曞彿</param>
+    /// <param name="lineNo">閫佽揣鍗曡鍐呯爜</param>
+    /// <returns>鏄惁鍒犻櫎鎴愬姛锛坱rue=鑷冲皯鍒犻櫎1鏉★紝false=鏈壘鍒板搴旀暟鎹級</returns>
+    public bool DeleteByDeliveryItem(string deliveryNo, string lineNo)
+    {
+        // 1. 鍙屽弬鏁版牎楠岋細閬垮厤绌哄��/绌哄瓧绗︿覆
+        if (string.IsNullOrWhiteSpace(deliveryNo))
+        {
+            throw new ArgumentException("閫佽揣鍗曞彿 DeliveryNo 涓嶈兘涓虹┖鎴栫┖鏍�", nameof(deliveryNo));
+        }
+        if (string.IsNullOrWhiteSpace(lineNo))
+        {
+            throw new ArgumentException("閫佽揣鍗曡鍐呯爜 LineNo 涓嶈兘涓虹┖鎴栫┖鏍�", nameof(lineNo));
+        }
+
+        try
+        {
+            // 2. 鑱斿悎鏉′欢鍒犻櫎锛氬尮閰� DeliveryNo锛堥�佽揣鍗曞彿锛夊拰 DnLines锛堣鍐呯爜锛屽疄浣撳瓧娈靛搴旇〃鐨� dnLines 鍒楋級
+            int deletedCount = Db.Deleteable<BarcodeInformation>().Where(barcode =>barcode.DeliveryNo == deliveryNo && barcode.DnLines == lineNo) // 鍖归厤琛屽唴鐮侊紙瀹炰綋 DnLines 瀵瑰簲琛� dnLines 瀛楁锛�
+                .ExecuteCommand(); // 杩斿洖鍙楀奖鍝嶇殑琛屾暟
+
+            // 3. 缁撴灉鍒ゆ柇锛氭湁鏁版嵁琚垹闄ゅ垯鎴愬姛锛屽惁鍒欐姏鈥滄湭鎵惧埌鏁版嵁鈥濆紓甯�
+            if (deletedCount > 0)
+            {
+                return true;
+            }
+            throw new KeyNotFoundException($"鏈壘鍒伴�佽揣鍗曞彿銆寋deliveryNo}銆嶄笖琛屽唴鐮併�寋lineNo}銆嶅搴旂殑鏉$爜鏁版嵁锛屽垹闄ゆ搷浣滄湭鎵ц");
+        }
+        catch (Exception ex)
+        {
+            // 4. 鍖呰寮傚父锛氳ˉ鍏呰仈鍚堟潯浠朵笂涓嬫枃锛屼究浜庡畾浣嶉棶棰�
+            throw new ApplicationException($"鎸夐�佽揣鍗曞彿+琛屽唴鐮佸垹闄ゆ潯鐮佹暟鎹け璐ワ紙DeliveryNo锛歿deliveryNo}锛孡ineNo锛歿lineNo}锛夛細{ex.Message}",ex);
+        }
+    }
+
+    /// <summary>
+    /// 鎵归噺鎸夐�佽揣鍗曞彿+琛屽唴鐮佸垹闄ゆ潯鐮佹暟鎹�
+    /// </summary>
+    /// <param name="deliveryItems">鍖呭惈DeliveryNo鍜孡ineNo鐨勫璞″垪琛�</param>
+    /// <returns>鎵归噺鍒犻櫎缁撴灉</returns>
+    public BatchDeleteResult DeleteListByDeliveryItem(List<DeleteByDeliveryItemRequest> deliveryItems)
+    {
+        // 1. 鍙傛暟鏍¢獙涓庡鐞�
+        if (deliveryItems == null || !deliveryItems.Any())
+        {
+            throw new ArgumentException("閫佽揣鍗曡鍒楄〃涓嶈兘涓虹┖", nameof(deliveryItems));
+        }
+        // 鎻愬彇骞堕獙璇侀�佽揣鍗曞彿+琛屽唴鐮佺粍鍚�
+        var validItems = deliveryItems.Where(item =>!string.IsNullOrWhiteSpace(item.DeliveryNo) &&!string.IsNullOrWhiteSpace(item.LineNo))
+            .Select(item => new
+            {
+                DeliveryNo = item.DeliveryNo,
+                LineNo = item.LineNo
+            }).Distinct().ToList();
+
+        if (!validItems.Any())
+        {
+            throw new ArgumentException("璇锋眰涓病鏈夋湁鏁堢殑鏁堢殑閫佽揣鍗曡鏁版嵁锛堝潎涓虹┖鎴栫┖鏍硷級");
+        }
+        try
+        {
+            // 2. 鎵ц鎵归噺鍒犻櫎锛堟寜DeliveryNo+LineNo缁勫悎鏉′欢锛�
+            int totalDeleted = 0;
+            var deletedItems = new List<string>();
+            var notFoundItems = new List<string>();
+
+            // 閬嶅巻姣忎釜缁勫悎鎵ц鍒犻櫎锛堟垨浣跨敤鎵归噺鏉′欢鍒犻櫎锛�
+            foreach (var item in validItems)
+            {
+                // 妫�鏌ュ綋鍓嶇粍鍚堟槸鍚﹀瓨鍦�
+                var exists = Db.Queryable<BarcodeInformation>().Any(b => b.DeliveryNo == item.DeliveryNo && b.DnLines == item.LineNo);
+
+                if (exists)
+                {
+                    // 鎵ц鍒犻櫎
+                    var deleted = Db.Deleteable<BarcodeInformation>().Where(b => b.DeliveryNo == item.DeliveryNo && b.DnLines == item.LineNo).ExecuteCommand();
+                    totalDeleted += deleted;
+                    deletedItems.Add($"{item.DeliveryNo}_{item.LineNo}");
+                }
+                else
+                {
+                    notFoundItems.Add($"{item.DeliveryNo}_{item.LineNo}");
+                }
+            }
+
+            // 3. 杩斿洖缁撴灉
+            return new BatchDeleteResult
+            {
+                TotalRequested = validItems.Count,
+                TotalDeleted = totalDeleted,
+                DeletedNos = deletedItems, // 瀛樺偍鏍煎紡锛�"DeliveryNo_LineNo"
+                NotFoundNos = notFoundItems // 瀛樺偍鏍煎紡锛�"DeliveryNo_LineNo"
+            };
+        }
+        catch (Exception ex)
+        {
+            throw new ApplicationException(
+                $"鎵归噺鍒犻櫎閫佽揣鍗曡澶辫触锛堝叡{validItems.Count}鏉★級锛歿ex.Message}",
+                ex);
+        }
+    }
+
+    #region 绉佹湁杈呭姪鏂规硶鍜屽唴閮ㄧ被
+
+    /// <summary>
+    /// 鍐呴儴杈呭姪绫伙細鐢ㄤ簬鍏宠仈瀹炰綋鍜屾搷浣滅被鍨嬶紙瑙e喅dynamic绫诲瀷杞崲闂锛�
+    /// </summary>
+    private class EntityTypePair
+    {
+        public BarcodeInformation Entity { get; set; }
+        public string Type { get; set; }
+    }
+
+    /// <summary>
+    /// DTO杞疄浣擄細鏄犲皠DeliveryBarcodeInfo鍒癇arcodeInformation瀛楁
+    /// </summary>
+    private BarcodeInformation ConvertDtoToEntity(DeliveryBarcodeInfo dto)
+    {
+        var entityId = dto.Type == "0" ? Guid.NewGuid() : (string.IsNullOrEmpty(dto.SmallBarcode) ? Guid.Empty : Guid.Parse(dto.SmallBarcode));
+
+        return new BarcodeInformation
+        {
+            Id = entityId,
+            ProductCode = dto.ProductCode,
+            SmallBarcode = dto.SmallBarcode,
+            OuterBarcode = dto.OuterBarcode,
+            IncludeQty = dto.IncludeQty.HasValue ? Convert.ToDecimal(dto.IncludeQty) : 0,
+            DeliveryNo = dto.DeliveryNo,
+            DnLines = dto.LineNo,
+            PackLevel = dto.BarcodeType,
+            CreateTime = dto.Type == "0" ? DateTime.Now : (DateTime?)null,
+            UpdateTime = DateTime.Now,
+            // 鎵╁睍瀛楁璧嬮粯璁ゅ��
+            BigBarcode = null,
+            SmallPackageLength = null,
+            SmallPackageWidth = null,
+            SmallPackageHeight = null,
+            BigPackageLength = null,
+            BigPackageWidth = null,
+            BigPackageHeight = null,
+            OuterPackageLength = null,
+            OuterPackageWidth = null,
+            OuterPackageHeight = null,
+            SmallPackageSn = null,
+            BigPackageSn = null,
+            OutPackageSn = null,
+            DynamicData = null,
+            PoErpNo = null,
+            PoLineNo = null,
+            InnerVendorCode = null,
+            Customize1 = null,
+            SynchronousDate = null,
+            Customize2 = null,
+            Customize3 = null
+        };
+    }
+
+    /// <summary>
+    /// 鍗曚釜鏉$爜鏂板
+    /// </summary>
+    private bool InsertBarcode(BarcodeInformation entity)
+    {
+        var isInsertSuccess = base.Insert(entity);
+        return isInsertSuccess ? true : throw new NotImplementedException("鏉$爜鏂板澶辫触锛氭暟鎹簱鎻掑叆鎿嶄綔鏈墽琛屾垚鍔�");
+    }
+    /// <summary>
+    /// 鍗曚釜鏉$爜鍒犻櫎锛堟寜涓婚敭Id锛�
+    /// </summary>
+    private bool DeleteBarcode(Guid id)
+    {
+        if (id == Guid.Empty)
+        {
+            throw new ArgumentException("鍒犻櫎鎿嶄綔鐨勬潯鐮両d涓嶈兘涓虹┖");
+        }
+        var deleteRowCount = Db.Deleteable<BarcodeInformation>().Where(entity => entity.Id == id).ExecuteCommand();
+
+        return deleteRowCount > 0 ? true : throw new NotImplementedException($"鏉$爜鍒犻櫎澶辫触锛氭湭鎵惧埌Id涓恒�寋id}銆嶇殑鏉$爜璁板綍");
+    }
+
+    /// <summary>
+    /// 鎵归噺鏉$爜鏂板
+    /// </summary>
+    private bool InsertBarcodeBatch(List<BarcodeInformation> entityList)
+    {
+        var isBatchInsertSuccess = base.InsertRange(entityList);
+        return isBatchInsertSuccess ? true : throw new NotImplementedException($"鎵归噺鏉$爜鏂板澶辫触锛氬叡{entityList.Count}鏉¤褰�");
+    }
+
+    /// <summary>
+    /// 鎵归噺鏉$爜鍒犻櫎锛堟寜涓婚敭Id鏁扮粍锛�
+    /// </summary>
+    private bool DeleteBarcodeBatch(Guid[] ids)
+    {
+        if (ids == null || ids.Length == 0)
+        {
+            throw new ArgumentException("鎵归噺鍒犻櫎鐨勬潯鐮両d鏁扮粍涓嶈兘涓虹┖");
+        }
+        var deleteRowCount = Db.Deleteable<BarcodeInformation>().Where(entity => ids.Contains(entity.Id)).ExecuteCommand();
+
+        return deleteRowCount > 0 ? true : throw new NotImplementedException($"鎵归噺鏉$爜鍒犻櫎澶辫触锛氬叡{ids.Length}涓狪d");
+    }
+
+    #endregion
+}
\ No newline at end of file
diff --git a/MES.Service/service/BasicData/MesCustomerManager.cs b/MES.Service/service/BasicData/MesCustomerManager.cs
index b67b86d..2d3564c 100644
--- a/MES.Service/service/BasicData/MesCustomerManager.cs
+++ b/MES.Service/service/BasicData/MesCustomerManager.cs
@@ -44,8 +44,7 @@
     public bool SaveList(List<ErpCustomer> customers)
     {
         var list = customers.Select(GetSysDepartment).ToList();
-        var groupBy = list.GroupBy(s => s.Type)
-            .ToDictionary(g => g.Key, g => g.ToList());
+        var groupBy = list.GroupBy(s => s.Type).ToDictionary(g => g.Key, g => g.ToList());
 
         return UseTransaction(db =>
         {
@@ -53,13 +52,11 @@
                 switch (customerGroup.Key)
                 {
                     case "0":
-                        if (!UpdateCustomerStatusBatch(db, customerGroup.Value,
-                                "A"))
+                        if (!UpdateCustomerStatusBatch(db, customerGroup.Value,"A"))
                             throw new NotImplementedException("鍚敤澶辫触");
                         break;
                     case "1":
-                        if (!UpdateCustomerStatusBatch(db, customerGroup.Value,
-                                "B"))
+                        if (!UpdateCustomerStatusBatch(db, customerGroup.Value,"B"))
                             throw new NotImplementedException("绂佺敤澶辫触");
                         break;
                     case "3":
@@ -72,23 +69,20 @@
                             throw new NotImplementedException("鍚屾澶辫触");
                         break;
                     default:
-                        throw new ArgumentNullException(
-                            $"type娌℃湁{customerGroup.Key}杩欎釜绫诲瀷鐨勫弬鏁�");
+                        throw new ArgumentNullException($"type娌℃湁{customerGroup.Key}杩欎釜绫诲瀷鐨勫弬鏁�");
                 }
-
             return 1;
         }) > 0;
     }
 
-    private bool UpdateCustomerStatus(SqlSugarScope db, decimal customerId,
-        string status)
+    private bool UpdateCustomerStatus(SqlSugarScope db, decimal customerId,string status)
     {
-        var result = db.Updateable<MesCustomer>()
-            .SetColumns(s => s.Fforbidstatus == status)
-            .Where(s => s.Id == customerId).ExecuteCommand();
+        var result = db.Updateable<MesCustomer>().SetColumns(s => s.Fforbidstatus == status).Where(s => s.Id == customerId).ExecuteCommand();
 
         if (result > 0)
+        {
             return true;
+        }
 
         throw new NotImplementedException(status == "A" ? "鍚敤澶辫触" : "绂佺敤澶辫触");
     }
@@ -104,11 +98,11 @@
 
     private bool DeleteCustomer(SqlSugarScope db, decimal customerId)
     {
-        var deleteById = db.Deleteable<MesCustomer>()
-            .Where(s => s.Id == customerId).ExecuteCommand();
+        var deleteById = db.Deleteable<MesCustomer>().Where(s => s.Id == customerId).ExecuteCommand();
         if (deleteById > 0)
+        {
             return true;
-
+        }
         throw new NotImplementedException("鍒犻櫎澶辫触");
     }
 
@@ -135,59 +129,50 @@
             Factory = "1000",
             DataType = customer.FDocumentStatus,
             Type = customer.Type,
-            //FPRIMARYGROUP = customer.FPRIMARYGROUP
-            
         };
     }
 
-    private bool UpdateCustomerStatusBatch(SqlSugarScope db,
-        List<MesCustomer> customerList, string status)
+    private bool UpdateCustomerStatusBatch(SqlSugarScope db,List<MesCustomer> customerList, string status)
     {
         var ids = customerList.Select(it => it.Id).ToArray();
-        var result = db.Updateable<MesCustomer>()
-            .SetColumns(s => s.Fforbidstatus == status)
-            .Where(s => ids.Contains(s.Id)).ExecuteCommand();
-
+        var result = db.Updateable<MesCustomer>().SetColumns(s => s.Fforbidstatus == status).Where(s => ids.Contains(s.Id)).ExecuteCommand();
         if (result > 0)
+        {
             return true;
-
+        }
         throw new NotImplementedException(status == "A" ? "鍚敤澶辫触" : "绂佺敤澶辫触");
     }
 
-    private bool InsertCustomerBatch(SqlSugarScope db,
-        List<MesCustomer> customerList)
+    private bool InsertCustomerBatch(SqlSugarScope db,List<MesCustomer> customerList)
     {
         var insertRange = db.Insertable(customerList).ExecuteCommand();
         if (insertRange > 0)
+        {
             return true;
-
+        }
         throw new NotImplementedException("鎻掑叆澶辫触");
     }
 
-    private bool DeleteCustomerBatch(SqlSugarScope db,
-        List<MesCustomer> customerList)
+    private bool DeleteCustomerBatch(SqlSugarScope db,List<MesCustomer> customerList)
     {
         var ids = customerList.Select(it => it.Id).ToArray();
-        var deleteByIds = db.Deleteable<MesCustomer>()
-            .Where(s => ids.Contains(s.Id)).ExecuteCommand();
+        var deleteByIds = db.Deleteable<MesCustomer>().Where(s => ids.Contains(s.Id)).ExecuteCommand();
         if (deleteByIds > 0)
+        {
             return true;
+        }
 
         throw new NotImplementedException("鍒犻櫎澶辫触");
     }
 
     private bool InsertOrUpdate(SqlSugarScope db, MesCustomer entity)
     {
-        db.Deleteable<MesCustomer>().Where(s => s.Id == entity.Id)
-            .ExecuteCommand();
-
+        db.Deleteable<MesCustomer>().Where(s => s.Id == entity.Id).ExecuteCommand();
         var insert = db.Insertable(entity).ExecuteCommand();
-
         return insert > 0;
     }
 
-    private bool InsertOrUpdateBatch(SqlSugarScope db,
-        List<MesCustomer> customerList)
+    private bool InsertOrUpdateBatch(SqlSugarScope db,List<MesCustomer> customerList)
     {
         return customerList.All(entity => InsertOrUpdate(db, entity));
     }
diff --git a/MES.Service/service/BasicData/MesDeliveryNoteManager.cs b/MES.Service/service/BasicData/MesDeliveryNoteManager.cs
index 54f1fe3..d100147 100644
--- a/MES.Service/service/BasicData/MesDeliveryNoteManager.cs
+++ b/MES.Service/service/BasicData/MesDeliveryNoteManager.cs
@@ -20,8 +20,7 @@
     {
         var deliveryNote = deliveryNoteWrapper.DeliveryNote;
         var mesDeliveryNote = GetMesDeliveryNote(deliveryNote);
-        var mesDeliveryNoteDetails =
-            GetMesDeliveryNoticeDetails(deliveryNoteWrapper.DeliveryNoteDetails, mesDeliveryNote.DeliveryNo);
+        var mesDeliveryNoteDetails = GetMesDeliveryNoticeDetails(deliveryNoteWrapper.DeliveryNoteDetails, mesDeliveryNote.DeliveryNo);
 
         return UseTransaction(db =>
         {
@@ -37,59 +36,50 @@
     /// <summary>
     /// 鏇存柊閫佽揣鍗曟暟鎹�
     /// </summary>
-    private bool UpdateData(SqlSugarScope db, MesDeliveryNotice mesDeliveryNote,
-        List<MesDeliveryNoticeDetail> mesDeliveryNoteDetails)
+    private bool UpdateData(SqlSugarScope db, MesDeliveryNotice mesDeliveryNote, List<MesDeliveryNoticeDetail> mesDeliveryNoteDetails)
     {
         var detailIds = mesDeliveryNoteDetails.Select(s => s.Guid).ToArray();
 
         // 鍒犻櫎涓昏〃鏁版嵁
-        var deleteMain = db.Deleteable<MesDeliveryNotice>()
-            .Where(a => a.DeliveryNo == mesDeliveryNote.DeliveryNo)
-            .ExecuteCommand() > 0;
+        var deleteMain = db.Deleteable<MesDeliveryNotice>().Where(a => a.DeliveryNo == mesDeliveryNote.DeliveryNo).ExecuteCommand() > 0;
 
         // 鍒犻櫎鏄庣粏鏁版嵁
-        var deleteDetails = db.Deleteable<MesDeliveryNoticeDetail>()
-            .Where(s => detailIds.Contains(s.Guid))
-            .ExecuteCommand() > 0;
+        var deleteDetails = db.Deleteable<MesDeliveryNoticeDetail>().Where(s => detailIds.Contains(s.Guid)).ExecuteCommand() > 0;
 
-        if (deleteMain && deleteDetails) return true;
+        if (deleteMain && deleteDetails)
+        {
+            return true;
+        }
         throw new NotImplementedException("閫佽揣鍗曟洿鏂板け璐�");
     }
 
     /// <summary>
     /// 淇濆瓨鎴栨洿鏂伴�佽揣鍗曟暟鎹�
     /// </summary>
-    private bool SaveOrUpdateData(SqlSugarScope db, MesDeliveryNotice mesDeliveryNote,
-        List<MesDeliveryNoticeDetail> mesDeliveryNoteDetails)
+    private bool SaveOrUpdateData(SqlSugarScope db, MesDeliveryNotice mesDeliveryNote, List<MesDeliveryNoticeDetail> mesDeliveryNoteDetails)
     {
         // 鑻ュ瓨鍦ㄥ垯鍏堝垹闄や富琛ㄦ暟鎹�
         if (!mesDeliveryNote.DeliveryNo.IsNullOrEmpty())
         {
-            db.Deleteable<MesDeliveryNotice>()
-                .Where(s => s.DeliveryNo == mesDeliveryNote.DeliveryNo)
-                .ExecuteCommand();
+            db.Deleteable<MesDeliveryNotice>().Where(s => s.DeliveryNo == mesDeliveryNote.DeliveryNo).ExecuteCommand();
         }
 
         // 鍒犻櫎鍏宠仈鐨勬槑缁嗘暟鎹�
         if (mesDeliveryNoteDetails.Count > 0)
         {
-            db.Deleteable<MesDeliveryNoticeDetail>()
-                .Where(s => s.DeliveryNo == mesDeliveryNote.DeliveryNo)
-                .ExecuteCommand();
+            db.Deleteable<MesDeliveryNoticeDetail>().Where(s => s.DeliveryNo == mesDeliveryNote.DeliveryNo).ExecuteCommand();
         }
 
         // 鎻掑叆涓昏〃鏁版嵁
-        var insertMain = db.Insertable(mesDeliveryNote)
-            .IgnoreColumns(true)
-            .ExecuteCommand() > 0;
+        var insertMain = db.Insertable(mesDeliveryNote).IgnoreColumns(true).ExecuteCommand() > 0;
 
         // 鎻掑叆鏄庣粏鏁版嵁
-        var insertDetails = db.Insertable(mesDeliveryNoteDetails)
-            .PageSize(1)
-            .IgnoreColumnsNull()
-            .ExecuteCommand() > 0;
+        var insertDetails = db.Insertable(mesDeliveryNoteDetails).PageSize(1).IgnoreColumnsNull().ExecuteCommand() > 0;
 
-        if (insertMain && insertDetails) return true;
+        if (insertMain && insertDetails)
+        {
+            return true;
+        }
         throw new NotImplementedException("閫佽揣鍗曚繚瀛樺け璐�");
     }
 
@@ -141,8 +131,7 @@
         return deliveryNoteDetails.Select(detail =>
         {
             // 鏌ユ壘宸叉湁鏄庣粏璁板綍
-            var existingDetail = deliveryNoteDetailManager.GetSingle(it =>
-                it.DeliveryNo == deliveryNo && it.LineNo == detail.LineNo);
+            var existingDetail = deliveryNoteDetailManager.GetSingle(it => it.DeliveryNo == deliveryNo && it.LineNo == detail.LineNo);
             var mesDetail = existingDetail ?? new MesDeliveryNoticeDetail();
 
             // 鏄庣粏瀛楁鏄犲皠
diff --git a/MES.Service/service/BasicData/MesDepotsManager.cs b/MES.Service/service/BasicData/MesDepotsManager.cs
index 0045341..ffd63f3 100644
--- a/MES.Service/service/BasicData/MesDepotsManager.cs
+++ b/MES.Service/service/BasicData/MesDepotsManager.cs
@@ -16,25 +16,24 @@
             switch (depots.Type)
             {
                 case "0":
-                    if (UpdateDepotStatus(db, entity.DepotId, "A")) return 1;
-
+                    if (UpdateDepotStatus(db, entity.DepotId, "A")) 
+                        return 1;
                     break;
                 case "1":
-                    if (UpdateDepotStatus(db, entity.DepotId, "B")) return 1;
-
+                    if (UpdateDepotStatus(db, entity.DepotId, "B")) 
+                        return 1;
                     break;
                 case "3":
-                    if (DeleteDepot(db, entity.DepotId)) return 1;
-
+                    if (DeleteDepot(db, entity.DepotId)) 
+                        return 1;
                     break;
                 case "2":
                 case "4":
-                    if (InsertOrUpdate(db, entity)) return 1;
-
+                    if (InsertOrUpdate(db, entity)) 
+                        return 1;
                     break;
                 default:
-                    throw new ArgumentNullException(
-                        $"type娌℃湁{depots.Type}杩欎釜绫诲瀷鐨勫弬鏁�");
+                    throw new ArgumentNullException($"type娌℃湁{depots.Type}杩欎釜绫诲瀷鐨勫弬鏁�");
             }
 
             throw new NotImplementedException("鎿嶄綔澶辫触");
@@ -42,16 +41,14 @@
     }
 
     // 鏇存柊浠撳簱鐘舵�佺殑鏂规硶
-    private bool UpdateDepotStatus(SqlSugarScope db, decimal depotId,
-        string status)
+    private bool UpdateDepotStatus(SqlSugarScope db, decimal depotId,string status)
     {
-        var result = db.Updateable<MesDepots>()
-            .SetColumns(s => s.IsNg == status)
-            .Where(s => s.DepotId == depotId).ExecuteCommand();
+        var result = db.Updateable<MesDepots>().SetColumns(s => s.IsNg == status).Where(s => s.DepotId == depotId).ExecuteCommand();
 
         if (result > 0)
+        {
             return true;
-
+        }
         throw new NotImplementedException(status == "A" ? "鍚敤澶辫触" : "绂佺敤澶辫触");
     }
 
@@ -68,20 +65,18 @@
     // 鍒犻櫎浠撳簱鐨勬柟娉�
     private bool DeleteDepot(SqlSugarScope db, decimal depotId)
     {
-        var deleteById = db.Deleteable<MesDepots>()
-            .Where(s => s.DepotId == depotId).ExecuteCommand();
+        var deleteById = db.Deleteable<MesDepots>().Where(s => s.DepotId == depotId).ExecuteCommand();
         if (deleteById > 0)
+        {
             return true;
-
+        }
         throw new NotImplementedException("鍙嶅鏍稿け璐�");
     }
 
     // 鎻掑叆鎴栨洿鏂颁粨搴撶殑鏂规硶
     private bool InsertOrUpdate(SqlSugarScope db, MesDepots entity)
     {
-        db.Deleteable<MesDepots>()
-            .Where(s => s.DepotId == entity.DepotId)
-            .ExecuteCommand();
+        db.Deleteable<MesDepots>().Where(s => s.DepotId == entity.DepotId).ExecuteCommand();
         var insert = db.Insertable(entity).ExecuteCommand();
         return insert > 0;
     }
@@ -129,37 +124,31 @@
             list.Add(entity);
         });
 
-        var groupBy = list.GroupBy(s => s.Type)
-            .ToDictionary(g => g.Key, g => g.ToList());
+        var groupBy = list.GroupBy(s => s.Type).ToDictionary(g => g.Key, g => g.ToList());
         return UseTransaction(db =>
         {
             foreach (var depotsGroup in groupBy)
                 switch (depotsGroup.Key)
                 {
                     case "0":
-                        if (!UpdateDepotStatusBatch(db, depotsGroup.Value,
-                                "A")) // 鎵归噺鍚敤浠撳簱
+                        if (!UpdateDepotStatusBatch(db, depotsGroup.Value,"A")) // 鎵归噺鍚敤浠撳簱
                             throw new NotImplementedException("鍚敤澶辫触");
                         break;
                     case "1":
-                        if (!UpdateDepotStatusBatch(db, depotsGroup.Value,
-                                "B")) // 鎵归噺绂佺敤浠撳簱
+                        if (!UpdateDepotStatusBatch(db, depotsGroup.Value,"B")) // 鎵归噺绂佺敤浠撳簱
                             throw new NotImplementedException("绂佺敤澶辫触");
                         break;
                     case "3":
-                        if (!DeleteDepotBatch(db,
-                                depotsGroup.Value)) // 鎵归噺鍒犻櫎浠撳簱
+                        if (!DeleteDepotBatch(db,depotsGroup.Value)) // 鎵归噺鍒犻櫎浠撳簱
                             throw new NotImplementedException("鍒犻櫎澶辫触");
                         break;
                     case "2":
                     case "4":
-                        if (!InsertOrUpdateBatch(db,
-                                depotsGroup.Value)) // 鎵归噺鎻掑叆鎴栨洿鏂颁粨搴�
+                        if (!InsertOrUpdateBatch(db,depotsGroup.Value)) // 鎵归噺鎻掑叆鎴栨洿鏂颁粨搴�
                             throw new NotImplementedException("鍚屾澶辫触");
                         break;
                     default:
-                        throw new ArgumentNullException(
-                            $"type娌℃湁{depotsGroup.Key}杩欎釜绫诲瀷鐨勫弬鏁�");
+                        throw new ArgumentNullException($"type娌℃湁{depotsGroup.Key}杩欎釜绫诲瀷鐨勫弬鏁�");
                 }
 
             return 1;
@@ -167,17 +156,15 @@
     }
 
     // 鎵归噺鏇存柊浠撳簱鐘舵�佺殑鏂规硶
-    private bool UpdateDepotStatusBatch(SqlSugarScope db,
-        List<MesDepots> depotList, string status)
+    private bool UpdateDepotStatusBatch(SqlSugarScope db,List<MesDepots> depotList, string status)
     {
         var ids = depotList.Select(it => it.DepotId).ToArray();
-        var result = db.Updateable<MesDepots>()
-            .SetColumns(s => s.IsNg == status)
-            .Where(s => ids.Contains(s.DepotId)).ExecuteCommand();
+        var result = db.Updateable<MesDepots>().SetColumns(s => s.IsNg == status).Where(s => ids.Contains(s.DepotId)).ExecuteCommand();
 
         if (result > 0)
+        {
             return true;
-
+        }
         throw new NotImplementedException(status == "A" ? "鍚敤澶辫触" : "绂佺敤澶辫触");
     }
 
@@ -193,22 +180,19 @@
     }
 
     // 鎵归噺鍒犻櫎浠撳簱鐨勬柟娉�
-    private bool DeleteDepotBatch(SqlSugarScope db,
-        List<MesDepots> depotList)
+    private bool DeleteDepotBatch(SqlSugarScope db,List<MesDepots> depotList)
     {
         var ids = depotList.Select(it => it.DepotId).ToArray();
-        var deleteByIds =
-            db.Deleteable<MesDepots>()
-                .Where(s => ids.Contains(s.DepotId)).ExecuteCommand();
+        var deleteByIds =db.Deleteable<MesDepots>().Where(s => ids.Contains(s.DepotId)).ExecuteCommand();
         if (deleteByIds > 0)
+        {
             return true;
-
+        }
         throw new NotImplementedException("鍙嶅鏍稿け璐�");
     }
 
     // 鎵归噺鎻掑叆鎴栨洿鏂颁粨搴撶殑鏂规硶
-    private bool InsertOrUpdateBatch(SqlSugarScope db,
-        List<MesDepots> depotList)
+    private bool InsertOrUpdateBatch(SqlSugarScope db,List<MesDepots> depotList)
     {
         return depotList.All(entity => InsertOrUpdate(db, entity));
     }
diff --git a/MES.Service/service/BasicData/MesItemTypeManager.cs b/MES.Service/service/BasicData/MesItemTypeManager.cs
index 00f6ce3..23020a8 100644
--- a/MES.Service/service/BasicData/MesItemTypeManager.cs
+++ b/MES.Service/service/BasicData/MesItemTypeManager.cs
@@ -20,8 +20,7 @@
                 case "1":
                     return DeleteItemType(entity.Id);
                 default:
-                    throw new ArgumentNullException(
-                        $"type娌℃湁{customer.Type}杩欎釜绫诲瀷鐨勫弬鏁�");
+                    throw new ArgumentNullException($"type娌℃湁{customer.Type}杩欎釜绫诲瀷鐨勫弬鏁�");
             }
         }
         catch (Exception ex)
@@ -34,18 +33,19 @@
     {
         var insert = base.Insert(entity);
         if (insert)
+        {
             return true;
-
+        }
         throw new NotImplementedException("鎻掑叆澶辫触");
     }
 
     private bool DeleteItemType(decimal id)
     {
-        var deleteById = Db.Deleteable<MesItemType>()
-            .Where(it => it.Id == id).ExecuteCommand();
+        var deleteById = Db.Deleteable<MesItemType>().Where(it => it.Id == id).ExecuteCommand();
         if (deleteById > 0)
+        {
             return true;
-
+        }
         throw new NotImplementedException("鍒犻櫎澶辫触");
     }
 
@@ -58,8 +58,6 @@
             Tcode = department.FNumber,
             Tname = department.FName,
             Description = department.FDescription,
-            //FSubsidiary = department.FSubsidiary,
-            //Fumbrella = department.Fumbrella,
             CreateDate = DateTime.Now,
             LastupdateDate = DateTime.Now,
             Company = "1000",
@@ -76,11 +74,8 @@
             entity.Type = s.Type;
             list.Add(entity);
         });
-
-        var groupBy = list.GroupBy(s => s.Type)
-            .ToDictionary(g => g.Key, g => g.ToList());
+        var groupBy = list.GroupBy(s => s.Type).ToDictionary(g => g.Key, g => g.ToList());
         var result = new List<bool>();
-
         foreach (var itemTypeGroup in groupBy)
             try
             {
@@ -93,8 +88,7 @@
                         result.Add(DeleteItemTypeBatch(itemTypeGroup.Value));
                         break;
                     default:
-                        throw new ArgumentNullException(
-                            $"type娌℃湁{itemTypeGroup.Key}杩欎釜绫诲瀷鐨勫弬鏁�");
+                        throw new ArgumentNullException($"type娌℃湁{itemTypeGroup.Key}杩欎釜绫诲瀷鐨勫弬鏁�");
                 }
             }
             catch (Exception ex)
@@ -103,8 +97,9 @@
             }
 
         if (result.All(b => b))
+        {
             return true;
-
+        }
         throw new NotImplementedException("鎺ュ彛鎵ц澶辫触");
     }
 
@@ -112,8 +107,9 @@
     {
         var insertRange = base.InsertRange(itemTypeList);
         if (insertRange)
+        {
             return true;
-
+        }
         throw new NotImplementedException("鎻掑叆澶辫触");
     }
 
@@ -121,12 +117,12 @@
     {
         var ids = itemTypeList.Select(it => it.Id).ToArray();
 
-        var deleteByIds = Db.Deleteable<MesItemType>()
-            .Where(s => ids.Contains(s.Id)).ExecuteCommand();
+        var deleteByIds = Db.Deleteable<MesItemType>().Where(s => ids.Contains(s.Id)).ExecuteCommand();
 
         if (deleteByIds > 0)
+        {
             return true;
-
+        }
         throw new NotImplementedException("鍒犻櫎澶辫触");
     }
 }
\ No newline at end of file
diff --git a/MES.Service/service/BasicData/MesItemsManager.cs b/MES.Service/service/BasicData/MesItemsManager.cs
index fa098ea..cbc7d18 100644
--- a/MES.Service/service/BasicData/MesItemsManager.cs
+++ b/MES.Service/service/BasicData/MesItemsManager.cs
@@ -34,8 +34,7 @@
                         return 1;
                     break;
                 default:
-                    throw new ArgumentNullException(
-                        $"type娌℃湁{item.Type}杩欎釜绫诲瀷鐨勫弬鏁�");
+                    throw new ArgumentNullException($"type娌℃湁{item.Type}杩欎釜绫诲瀷鐨勫弬鏁�");
             }
 
             throw new NotImplementedException("鎿嶄綔澶辫触");
@@ -45,8 +44,7 @@
     public bool SaveList(List<ErpItems> items)
     {
         var list = items.Select(GetMesItems).ToList();
-        var groupBy = list.GroupBy(s => s.Type)
-            .ToDictionary(g => g.Key, g => g.ToList());
+        var groupBy = list.GroupBy(s => s.Type).ToDictionary(g => g.Key, g => g.ToList());
 
         return UseTransaction(db =>
         {
@@ -71,24 +69,21 @@
                             throw new NotImplementedException("鍚屾澶辫触");
                         break;
                     default:
-                        throw new ArgumentNullException(
-                            $"type娌℃湁{itemGroup.Key}杩欎釜绫诲瀷鐨勫弬鏁�");
+                        throw new ArgumentNullException($"type娌℃湁{itemGroup.Key}杩欎釜绫诲瀷鐨勫弬鏁�");
                 }
 
             return 1;
         }) > 0;
     }
 
-    private bool UpdateItemStatus(SqlSugarScope db, decimal itemId,
-        string status)
+    private bool UpdateItemStatus(SqlSugarScope db, decimal itemId,string status)
     {
-        var result = db.Updateable<MesItems>()
-            .SetColumns(s => s.Fforbidstatus == status)
-            .Where(s => s.Id == itemId).ExecuteCommand();
+        var result = db.Updateable<MesItems>().SetColumns(s => s.Fforbidstatus == status).Where(s => s.Id == itemId).ExecuteCommand();
 
         if (result > 0)
+        {
             return true;
-
+        }
         throw new NotImplementedException(status == "A" ? "鍚敤澶辫触" : "绂佺敤澶辫触");
     }
 
@@ -103,10 +98,11 @@
 
     private bool DeleteItem(SqlSugarScope db, decimal itemId)
     {
-        var deleteById = db.Deleteable<MesItems>()
-            .Where(s => s.Id == itemId).ExecuteCommand();
+        var deleteById = db.Deleteable<MesItems>().Where(s => s.Id == itemId).ExecuteCommand();
         if (deleteById > 0)
+        {
             return true;
+        }
 
         throw new NotImplementedException("鍒犻櫎澶辫触");
     }
@@ -129,8 +125,7 @@
             DepotCode = item.FStockId,
             Fmaterialgroup = item.FMaterialGroup,
             Remarks = item.FDescription,
-            Ffinishreceiptoverrate =
-                Convert.ToDecimal(item.FFinishReceiptOverRate),
+            Ffinishreceiptoverrate = Convert.ToDecimal(item.FFinishReceiptOverRate),
             Fissuetype = item.FIssueType,
             Fisbatchmanage = Convert.ToInt32(item.FIsBatchManage),
             Fpurchaserid = item.FPurchaserId,
@@ -173,17 +168,15 @@
         };
     }
 
-    private bool UpdateItemStatusBatch(SqlSugarScope db,
-        List<MesItems> itemList, string status)
+    private bool UpdateItemStatusBatch(SqlSugarScope db,List<MesItems> itemList, string status)
     {
         var ids = itemList.Select(it => it.Id).ToArray();
-        var result = db.Updateable<MesItems>()
-            .SetColumns(s => s.Fforbidstatus == status)
-            .Where(s => ids.Contains(s.Id)).ExecuteCommand();
+        var result = db.Updateable<MesItems>().SetColumns(s => s.Fforbidstatus == status).Where(s => ids.Contains(s.Id)).ExecuteCommand();
 
         if (result > 0)
+        {
             return true;
-
+        }
         throw new NotImplementedException(status == "A" ? "鍚敤澶辫触" : "绂佺敤澶辫触");
     }
 
@@ -199,18 +192,17 @@
     private bool DeleteItemBatch(SqlSugarScope db, List<MesItems> itemList)
     {
         var ids = itemList.Select(it => it.Id).ToArray();
-        var deleteByIds = db.Deleteable<MesItems>()
-            .Where(s => ids.Contains(s.Id)).ExecuteCommand();
+        var deleteByIds = db.Deleteable<MesItems>().Where(s => ids.Contains(s.Id)).ExecuteCommand();
         if (deleteByIds > 0)
+        {
             return true;
-
+        }
         throw new NotImplementedException("鍒犻櫎澶辫触");
     }
 
     private bool InsertOrUpdate(SqlSugarScope db, MesItems entity)
     {
-        db.Deleteable<MesItems>().Where(s => s.Id == entity.Id)
-            .ExecuteCommand();
+        db.Deleteable<MesItems>().Where(s => s.Id == entity.Id).ExecuteCommand();
 
         var insert = db.Insertable(entity).ExecuteCommand();
         return insert > 0;
diff --git a/MES.Service/service/BasicData/MesPositionManager.cs b/MES.Service/service/BasicData/MesPositionManager.cs
index 03a25e3..8b1950d 100644
--- a/MES.Service/service/BasicData/MesPositionManager.cs
+++ b/MES.Service/service/BasicData/MesPositionManager.cs
@@ -35,8 +35,7 @@
                         return 1;
                     break;
                 default:
-                    throw new ArgumentNullException(
-                        $"type娌℃湁{unit.Type}杩欎釜绫诲瀷鐨勫弬鏁�");
+                    throw new ArgumentNullException($"type娌℃湁{unit.Type}杩欎釜绫诲瀷鐨勫弬鏁�");
             }
 
             throw new NotImplementedException("鎿嶄綔澶辫触");
@@ -44,24 +43,21 @@
     }
 
     // 鏇存柊宀椾綅鐘舵�佺殑鏂规硶
-    private bool UpdatePositionStatus(SqlSugarScope db, decimal positionId,
-        string status)
+    private bool UpdatePositionStatus(SqlSugarScope db, decimal positionId,string status)
     {
-        var result = db.Updateable<MesPosition>()
-            .SetColumns(s => s.Fforbidstatus == status)
-            .Where(s => s.Id == positionId).ExecuteCommand();
+        var result = db.Updateable<MesPosition>().SetColumns(s => s.Fforbidstatus == status).Where(s => s.Id == positionId).ExecuteCommand();
 
         if (result > 0)
+        {
             return true;
-
+        }
         throw new NotImplementedException(status == "A" ? "鍚敤澶辫触" : "绂佺敤澶辫触");
     }
 
     // 鎻掑叆鎴栨洿鏂板矖浣嶇殑鏂规硶
     private bool InsertOrUpdatePosition(SqlSugarScope db, MesPosition entity)
     {
-        db.Deleteable<MesPosition>()
-            .Where(s => s.Id == entity.Id).ExecuteCommand();
+        db.Deleteable<MesPosition>().Where(s => s.Id == entity.Id).ExecuteCommand();
         var insert = db.Insertable(entity).ExecuteCommand();
         return insert > 0;
     }
@@ -69,11 +65,11 @@
     // 鍒犻櫎宀椾綅鐨勬柟娉�
     private bool DeletePosition(SqlSugarScope db, decimal positionId)
     {
-        var deleteById = db.Deleteable<MesPosition>()
-            .Where(s => s.Id == positionId).ExecuteCommand();
+        var deleteById = db.Deleteable<MesPosition>().Where(s => s.Id == positionId).ExecuteCommand();
         if (deleteById > 0)
+        {
             return true;
-
+        }
         throw new NotImplementedException("鍒犻櫎澶辫触");
     }
 
@@ -90,15 +86,9 @@
             Fforbidstatus = position.FForbidStatus,
             FUseOrgId = position.FUseOrgId,
             FCreateOrgId = position.FCreateOrgId,
-            CreationDate = position.FCreateDate != null
-                ? DateTime.ParseExact(position.FCreateDate,
-                    "yyyy-MM-dd HH:mm:ss", null)
-                : null,
+            CreationDate = position.FCreateDate != null ? DateTime.ParseExact(position.FCreateDate, "yyyy-MM-dd HH:mm:ss", null) : null,
             DisabledBy = position.FForbidderId,
-            DisabledDate = position.FForbidDate != null
-                ? DateTime.ParseExact(position.FForbidDate,
-                    "yyyy-MM-dd HH:mm:ss", null)
-                : null,
+            DisabledDate = position.FForbidDate != null ? DateTime.ParseExact(position.FForbidDate, "yyyy-MM-dd HH:mm:ss", null) : null,
             FDocumentStatus =  position.FDocumentStatus
         };
     }
@@ -114,37 +104,31 @@
             list.Add(entity);
         });
 
-        var groupBy = list.GroupBy(s => s.Type)
-            .ToDictionary(g => g.Key, g => g.ToList());
+        var groupBy = list.GroupBy(s => s.Type).ToDictionary(g => g.Key, g => g.ToList());
         return UseTransaction(db =>
         {
             foreach (var positionGroup in groupBy)
                 switch (positionGroup.Key)
                 {
                     case "0":
-                        if (!UpdatePositionStatusBatch(db, positionGroup.Value,
-                                "A")) // 鎵归噺鍚敤宀椾綅
+                        if (!UpdatePositionStatusBatch(db, positionGroup.Value, "A")) // 鎵归噺鍚敤宀椾綅
                             throw new NotImplementedException("鍚敤澶辫触");
                         break;
                     case "1":
-                        if (!UpdatePositionStatusBatch(db, positionGroup.Value,
-                                "B")) // 鎵归噺绂佺敤宀椾綅
+                        if (!UpdatePositionStatusBatch(db, positionGroup.Value, "B")) // 鎵归噺绂佺敤宀椾綅
                             throw new NotImplementedException("绂佺敤澶辫触");
                         break;
                     case "3":
-                        if (!DeletePositionBatch(db,
-                                positionGroup.Value)) // 鎵归噺鍒犻櫎宀椾綅
+                        if (!DeletePositionBatch(db, positionGroup.Value)) // 鎵归噺鍒犻櫎宀椾綅
                             throw new NotImplementedException("鍒犻櫎澶辫触");
                         break;
                     case "2":
                     case "4":
-                        if (!InsertOrUpdatePositionBatch(db,
-                                positionGroup.Value)) // 鎵归噺鎻掑叆鎴栨洿鏂板矖浣�
+                        if (!InsertOrUpdatePositionBatch(db, positionGroup.Value)) // 鎵归噺鎻掑叆鎴栨洿鏂板矖浣�
                             throw new NotImplementedException("鍚屾澶辫触");
                         break;
                     default:
-                        throw new ArgumentNullException(
-                            $"type娌℃湁{positionGroup.Key}杩欎釜绫诲瀷鐨勫弬鏁�");
+                        throw new ArgumentNullException( $"type娌℃湁{positionGroup.Key}杩欎釜绫诲瀷鐨勫弬鏁�");
                 }
 
             return 1;
@@ -152,17 +136,15 @@
     }
 
     // 鎵归噺鏇存柊宀椾綅鐘舵�佺殑鏂规硶
-    private bool UpdatePositionStatusBatch(SqlSugarScope db,
-        List<MesPosition> positionList, string status)
+    private bool UpdatePositionStatusBatch(SqlSugarScope db, List<MesPosition> positionList, string status)
     {
         var ids = positionList.Select(it => it.Id).ToArray();
-        var result = db.Updateable<MesPosition>()
-            .SetColumns(s => s.Fforbidstatus == status)
-            .Where(s => ids.Contains(s.Id)).ExecuteCommand();
+        var result = db.Updateable<MesPosition>().SetColumns(s => s.Fforbidstatus == status).Where(s => ids.Contains(s.Id)).ExecuteCommand();
 
         if (result > 0)
+        {
             return true;
-
+        }
         throw new NotImplementedException(status == "A" ? "鍚敤澶辫触" : "绂佺敤澶辫触");
     }
 
@@ -178,23 +160,22 @@
     }
 
     // 鎵归噺鍒犻櫎宀椾綅鐨勬柟娉�
-    private bool DeletePositionBatch(SqlSugarScope db,
-        List<MesPosition> positionList)
+    private bool DeletePositionBatch(SqlSugarScope db,List<MesPosition> positionList)
     {
         var ids = positionList.Select(it => it.Id).ToArray();
 
-        var deleteByIds = db.Deleteable<MesPosition>()
-            .Where(s => ids.Contains(s.Id)).ExecuteCommand();
+        var deleteByIds = db.Deleteable<MesPosition>().Where(s => ids.Contains(s.Id)).ExecuteCommand();
 
         if (deleteByIds > 0)
+        {
             return true;
+        }
 
         throw new NotImplementedException("鍒犻櫎澶辫触");
     }
 
     // 鎵归噺鎻掑叆鎴栨洿鏂板矖浣嶇殑鏂规硶
-    private bool InsertOrUpdatePositionBatch(SqlSugarScope db,
-        List<MesPosition> positionList)
+    private bool InsertOrUpdatePositionBatch(SqlSugarScope db,List<MesPosition> positionList)
     {
         return positionList.All(entity => InsertOrUpdatePosition(db, entity));
     }
diff --git a/MES.Service/service/BasicData/MesStaffManager.cs b/MES.Service/service/BasicData/MesStaffManager.cs
index e54dd91..ac077c6 100644
--- a/MES.Service/service/BasicData/MesStaffManager.cs
+++ b/MES.Service/service/BasicData/MesStaffManager.cs
@@ -328,7 +328,7 @@
 }
  */
  
- namespace MES.Service.service.BasicData;
+namespace MES.Service.service.BasicData;
 
 using MES.Service.DB;
 using MES.Service.Dto.webApi;
@@ -353,12 +353,17 @@
         {
             switch (unit.Type)
             {
-                case "0": return UpdateStaffStatus(db, entity.Id, "A") ? 1 : 0;
-                case "1": return UpdateStaffStatus(db, entity.Id, "B") ? 1 : 0;
+                case "0": 
+                    return UpdateStaffStatus(db, entity.Id, "A") ? 1 : 0;
+                case "1": 
+                    return UpdateStaffStatus(db, entity.Id, "B") ? 1 : 0;
                 case "2":
-                case "4": return InsertOrUpdateStaff(db, new List<SysUser> { sysUser }, new List<MesStaff> { entity }, mesStaffPositionLink) ? 1 : 0;
-                case "3": return DeleteStaff(db, new List<SysUser> { sysUser }, new List<MesStaff> { entity }) ? 1 : 0;
-                default: throw new ArgumentException($"涓嶆敮鎸佺殑绫诲瀷: {unit.Type}");
+                case "4": 
+                    return InsertOrUpdateStaff(db, new List<SysUser> { sysUser }, new List<MesStaff> { entity }, mesStaffPositionLink) ? 1 : 0;
+                case "3": 
+                    return DeleteStaff(db, new List<SysUser> { sysUser }, new List<MesStaff> { entity }) ? 1 : 0;
+                default: 
+                    throw new ArgumentException($"涓嶆敮鎸佺殑绫诲瀷: {unit.Type}");
             }
         }) > 0;
     }
@@ -429,9 +434,7 @@
         try
         {
             // 1. 鎵归噺鎻掑叆 SysUser锛堜粎鏂板锛�
-            var newSysUsers = sysUsers
-                .Where(u => !db.Queryable<SysUser>().Any(e => e.Sid == u.Sid))
-                .ToList();
+            var newSysUsers = sysUsers.Where(u => !db.Queryable<SysUser>().Any(e => e.Sid == u.Sid)).ToList();
 
             if (newSysUsers.Any())
             {
@@ -505,10 +508,7 @@
         }
         
         var ids = staffList.Select(s => s.Id).ToList();
-        var updateCount = db.Updateable<MesStaff>()
-            .SetColumns(s => s.FforbidStatus == status)
-            .Where(s => ids.Contains(s.Id))
-            .ExecuteCommand();
+        var updateCount = db.Updateable<MesStaff>().SetColumns(s => s.FforbidStatus == status).Where(s => ids.Contains(s.Id)).ExecuteCommand();
             
         if (updateCount <= 0)
         {
@@ -539,9 +539,7 @@
             var staffDeleteCount = db.Deleteable<MesStaff>().Where(s => staffIds.Contains(s.Id)).ExecuteCommand();
             
             // 3. 鍒犻櫎宀椾綅鍏宠仈 锛氫娇鐢ˋny鏂规硶锛堟帹鑽愶級
-            db.Deleteable<MesStaffPositionLink>()
-                .Where(p => staffIds.Any(id => id == p.StaffId))
-                .ExecuteCommand();
+            db.Deleteable<MesStaffPositionLink>().Where(p => staffIds.Any(id => id == p.StaffId)).ExecuteCommand();
 
             Console.WriteLine($"鎴愬姛鍒犻櫎 {userDeleteCount} 涓猄ysUser鍜� {staffDeleteCount} 涓狹esStaff");
             return userDeleteCount > 0 && staffDeleteCount > 0;
@@ -557,10 +555,7 @@
     // 鏇存柊鍛樺伐鐘舵��
     private bool UpdateStaffStatus(SqlSugarScope db, decimal staffId, string status)
     {
-        var result = db.Updateable<MesStaff>()
-            .SetColumns(s => s.FforbidStatus == status)
-            .Where(s => s.Id == staffId)
-            .ExecuteCommand();
+        var result = db.Updateable<MesStaff>().SetColumns(s => s.FforbidStatus == status).Where(s => s.Id == staffId).ExecuteCommand();
 
         if (result <= 0)
         {
@@ -657,18 +652,11 @@
                     new MesStaffPositionLink
                     {
                         StaffId = Convert.ToDecimal(staff.Id),
-                        PositionId = string.IsNullOrEmpty(staffDetail.fPostId?.ToString()) 
-                            ? null 
-                            : Convert.ToDecimal(staffDetail.fPostId),
-                        FPostDeptId = string.IsNullOrEmpty(staffDetail.fPostDeptid?.ToString()) 
-                            ? null 
-                            : Convert.ToDecimal(staffDetail.fPostDeptid),
-                        FStaffStartDate = string.IsNullOrEmpty(staffDetail.fStaffStartDate?.ToString()) 
-                            ? null 
-                            : DateTime.ParseExact(staffDetail.fStaffStartDate, "yyyy-MM-dd HH:mm:ss", null)
+                        PositionId = string.IsNullOrEmpty(staffDetail.fPostId?.ToString()) ? null : Convert.ToDecimal(staffDetail.fPostId),
+                        FPostDeptId = string.IsNullOrEmpty(staffDetail.fPostDeptid?.ToString()) ? null : Convert.ToDecimal(staffDetail.fPostDeptid),
+                        FStaffStartDate = string.IsNullOrEmpty(staffDetail.fStaffStartDate?.ToString()) ? null : DateTime.ParseExact(staffDetail.fStaffStartDate, "yyyy-MM-dd HH:mm:ss", null)
                     }).ToList();
             }
-
             return staffDetails;
         }
         catch (Exception ex)
diff --git a/MES.Service/service/BasicData/MesSupplierManager.cs b/MES.Service/service/BasicData/MesSupplierManager.cs
index 5c2cf59..2408d79 100644
--- a/MES.Service/service/BasicData/MesSupplierManager.cs
+++ b/MES.Service/service/BasicData/MesSupplierManager.cs
@@ -33,8 +33,7 @@
                         return 1;
                     break;
                 default:
-                    throw new ArgumentNullException(
-                        $"type娌℃湁{unit.Type}杩欎釜绫诲瀷鐨勫弬鏁�");
+                    throw new ArgumentNullException($"type娌℃湁{unit.Type}杩欎釜绫诲瀷鐨勫弬鏁�");
             }
 
             throw new NotImplementedException("鎿嶄綔澶辫触");
@@ -44,8 +43,7 @@
     public bool SaveList(List<ErpSupplier> suppliers)
     {
         var list = suppliers.Select(GetMesSupplier).ToList();
-        var groupBy = list.GroupBy(s => s.Type)
-            .ToDictionary(g => g.Key, g => g.ToList());
+        var groupBy = list.GroupBy(s => s.Type).ToDictionary(g => g.Key, g => g.ToList());
 
         return UseTransaction(db =>
         {
@@ -53,13 +51,11 @@
                 switch (supplierGroup.Key)
                 {
                     case "0":
-                        if (!UpdateSupplierStatusBatch(db, supplierGroup.Value,
-                                "A"))
+                        if (!UpdateSupplierStatusBatch(db, supplierGroup.Value,"A"))
                             throw new NotImplementedException("鍚敤澶辫触");
                         break;
                     case "1":
-                        if (!UpdateSupplierStatusBatch(db, supplierGroup.Value,
-                                "B"))
+                        if (!UpdateSupplierStatusBatch(db, supplierGroup.Value,"B"))
                             throw new NotImplementedException("绂佺敤澶辫触");
                         break;
                     case "3":
@@ -72,24 +68,21 @@
                             throw new NotImplementedException("鍚屾澶辫触");
                         break;
                     default:
-                        throw new ArgumentNullException(
-                            $"type娌℃湁{supplierGroup.Key}杩欎釜绫诲瀷鐨勫弬鏁�");
+                        throw new ArgumentNullException($"type娌℃湁{supplierGroup.Key}杩欎釜绫诲瀷鐨勫弬鏁�");
                 }
 
             return 1;
         }) > 0;
     }
 
-    private bool UpdateSupplierStatus(SqlSugarScope db, decimal supplierId,
-        string status)
+    private bool UpdateSupplierStatus(SqlSugarScope db, decimal supplierId,string status)
     {
-        var result = db.Updateable<MesSupplier>()
-            .SetColumns(s => s.Fforbidstatus == status)
-            .Where(s => s.Id == supplierId).ExecuteCommand();
+        var result = db.Updateable<MesSupplier>().SetColumns(s => s.Fforbidstatus == status).Where(s => s.Id == supplierId).ExecuteCommand();
 
         if (result > 0)
+        {
             return true;
-
+        }
         throw new NotImplementedException(status == "A" ? "鍚敤澶辫触" : "绂佺敤澶辫触");
     }
 
@@ -97,18 +90,19 @@
     {
         var insert = db.Insertable(entity).ExecuteCommand();
         if (insert > 0)
+        {
             return true;
-
+        }
         throw new NotImplementedException("鎻掑叆澶辫触");
     }
 
     private bool DeleteSupplier(decimal supplierId)
     {
-        var deleteById = Db.Deleteable<MesSupplier>()
-            .Where(s => s.Id == supplierId).ExecuteCommand();
+        var deleteById = Db.Deleteable<MesSupplier>().Where(s => s.Id == supplierId).ExecuteCommand();
         if (deleteById > 0)
+        {
             return true;
-
+        }
         throw new NotImplementedException("鍒犻櫎澶辫触");
     }
 
@@ -136,56 +130,50 @@
         };
     }
 
-    private bool UpdateSupplierStatusBatch(SqlSugarScope db,
-        List<MesSupplier> supplierList, string status)
+    private bool UpdateSupplierStatusBatch(SqlSugarScope db,List<MesSupplier> supplierList, string status)
     {
         var ids = supplierList.Select(it => it.Id).ToArray();
-        var result = db.Updateable<MesSupplier>()
-            .SetColumns(s => s.Fforbidstatus == status)
-            .Where(s => ids.Contains(s.Id)).ExecuteCommand();
-
+        var result = db.Updateable<MesSupplier>().SetColumns(s => s.Fforbidstatus == status).Where(s => ids.Contains(s.Id)).ExecuteCommand();
         if (result > 0)
+        {
             return true;
-
+        }
         throw new NotImplementedException(status == "A" ? "鍚敤澶辫触" : "绂佺敤澶辫触");
     }
 
-    private bool InsertSupplierBatch(SqlSugarScope db,
-        List<MesSupplier> supplierList)
+    private bool InsertSupplierBatch(SqlSugarScope db,List<MesSupplier> supplierList)
     {
         var insertRange = db.Insertable(supplierList).ExecuteCommand();
         if (insertRange > 0)
+        {
             return true;
-
+        }
         throw new NotImplementedException("鎻掑叆澶辫触");
     }
 
-    private bool DeleteSupplierBatch(SqlSugarScope db,
-        List<MesSupplier> supplierList)
+    private bool DeleteSupplierBatch(SqlSugarScope db,List<MesSupplier> supplierList)
     {
         var ids = supplierList.Select(it => it.Id).ToArray();
-        var deleteByIds = db.Deleteable<MesSupplier>()
-            .Where(s => ids.Contains(s.Id)).ExecuteCommand();
+        var deleteByIds = db.Deleteable<MesSupplier>().Where(s => ids.Contains(s.Id)).ExecuteCommand();
         if (deleteByIds > 0)
+        {
             return true;
-
+        }
         throw new NotImplementedException("鍒犻櫎澶辫触");
     }
 
     private bool InsertOrUpdate(SqlSugarScope db, MesSupplier entity)
     {
-        db.Deleteable<MesSupplier>().Where(s => s.Id == entity.Id)
-            .ExecuteCommand();
-
+        db.Deleteable<MesSupplier>().Where(s => s.Id == entity.Id).ExecuteCommand();
         var insert = db.Insertable(entity).ExecuteCommand();
         if (insert > 0)
+        {
             return true;
-
+        }
         return false;
     }
 
-    private bool InsertOrUpdateBatch(SqlSugarScope db,
-        List<MesSupplier> supplierList)
+    private bool InsertOrUpdateBatch(SqlSugarScope db,List<MesSupplier> supplierList)
     {
         return supplierList.All(entity => InsertOrUpdate(db, entity));
     }
diff --git a/MES.Service/service/BasicData/MesUnitManager.cs b/MES.Service/service/BasicData/MesUnitManager.cs
index 4157420..ebc1787 100644
--- a/MES.Service/service/BasicData/MesUnitManager.cs
+++ b/MES.Service/service/BasicData/MesUnitManager.cs
@@ -33,8 +33,7 @@
                         return 1;
                     break;
                 default:
-                    throw new ArgumentNullException(
-                        $"type娌℃湁{unit.Type}杩欎釜绫诲瀷鐨勫弬鏁�");
+                    throw new ArgumentNullException($"type娌℃湁{unit.Type}杩欎釜绫诲瀷鐨勫弬鏁�");
             }
 
             throw new NotImplementedException("鎿嶄綔澶辫触");
@@ -44,8 +43,7 @@
     public bool SaveList(List<ErpUnit> units)
     {
         var list = units.Select(GetMesUnit).ToList();
-        var groupBy = list.GroupBy(s => s.Type)
-            .ToDictionary(g => g.Key, g => g.ToList());
+        var groupBy = list.GroupBy(s => s.Type).ToDictionary(g => g.Key, g => g.ToList());
 
         return UseTransaction(db =>
         {
@@ -70,8 +68,7 @@
                             throw new NotImplementedException("鍚屾澶辫触");
                         break;
                     default:
-                        throw new ArgumentNullException(
-                            $"type娌℃湁{unitGroup.Key}杩欎釜绫诲瀷鐨勫弬鏁�");
+                        throw new ArgumentNullException($"type娌℃湁{unitGroup.Key}杩欎釜绫诲瀷鐨勫弬鏁�");
                 }
 
             return 1;
@@ -81,13 +78,12 @@
     private bool UpdateUnitStatus(SqlSugarScope db, decimal unitId,
         string status)
     {
-        var result = db.Updateable<MesUnit>()
-            .SetColumns(s => s.Fforbidstatus == status)
-            .Where(s => s.Id == unitId).ExecuteCommand();
+        var result = db.Updateable<MesUnit>().SetColumns(s => s.Fforbidstatus == status).Where(s => s.Id == unitId).ExecuteCommand();
 
         if (result > 0)
+        {
             return true;
-
+        }
         throw new NotImplementedException(status == "A" ? "鍚敤澶辫触" : "绂佺敤澶辫触");
     }
 
@@ -102,11 +98,11 @@
 
     private bool DeleteUnit(SqlSugarScope db, decimal unitId)
     {
-        var deleteById = db.Deleteable<MesUnit>()
-            .Where(s => s.Id == unitId).ExecuteCommand();
+        var deleteById = db.Deleteable<MesUnit>().Where(s => s.Id == unitId).ExecuteCommand();
         if (deleteById > 0)
+        {
             return true;
-
+        }
         throw new NotImplementedException("鍒犻櫎澶辫触");
     }
 
@@ -135,17 +131,15 @@
         };
     }
 
-    private bool UpdateUnitStatusBatch(SqlSugarScope db, List<MesUnit> unitList,
-        string status)
+    private bool UpdateUnitStatusBatch(SqlSugarScope db, List<MesUnit> unitList,string status)
     {
         var ids = unitList.Select(it => it.Id).ToArray();
-        var result = db.Updateable<MesUnit>()
-            .SetColumns(s => s.Fforbidstatus == status)
-            .Where(s => ids.Contains(s.Id)).ExecuteCommand();
+        var result = db.Updateable<MesUnit>().SetColumns(s => s.Fforbidstatus == status).Where(s => ids.Contains(s.Id)).ExecuteCommand();
 
         if (result > 0)
+        {
             return true;
-
+        }
         throw new NotImplementedException(status == "A" ? "鍚敤澶辫触" : "绂佺敤澶辫触");
     }
 
@@ -161,15 +155,13 @@
     private bool DeleteUnitBatch(SqlSugarScope db, List<MesUnit> unitList)
     {
         var ids = unitList.Select(it => it.Id).ToArray();
-        var deleteByIds = db.Deleteable<MesUnit>()
-            .Where(s => ids.Contains(s.Id)).ExecuteCommand();
+        var deleteByIds = db.Deleteable<MesUnit>().Where(s => ids.Contains(s.Id)).ExecuteCommand();
         return deleteByIds > 0;
     }
 
     private bool InsertOrUpdate(SqlSugarScope db, MesUnit entity)
     {
-        db.Deleteable<MesUnit>()
-            .Where(s => s.Id == entity.Id).ExecuteCommand();
+        db.Deleteable<MesUnit>().Where(s => s.Id == entity.Id).ExecuteCommand();
         var insert = db.Insertable(entity).ExecuteCommand();
         return insert > 0;
     }
diff --git a/MES.Service/service/BasicData/OrganizeManager.cs b/MES.Service/service/BasicData/OrganizeManager.cs
index 621cfe2..a1157ca 100644
--- a/MES.Service/service/BasicData/OrganizeManager.cs
+++ b/MES.Service/service/BasicData/OrganizeManager.cs
@@ -34,8 +34,7 @@
                         return 1;
                     break;
                 default:
-                    throw new ArgumentNullException(
-                        $"type娌℃湁{item.Type}杩欎釜绫诲瀷鐨勫弬鏁�");
+                    throw new ArgumentNullException($"type娌℃湁{item.Type}杩欎釜绫诲瀷鐨勫弬鏁�");
             }
 
             throw new NotImplementedException("鎿嶄綔澶辫触");
@@ -45,8 +44,7 @@
     public bool SaveList(List<ErpOrganize> Organize)
     {
         var list = Organize.Select(GetOrganize).ToList();
-        var groupBy = list.GroupBy(s => s.Type)
-            .ToDictionary(g => g.Key, g => g.ToList());
+        var groupBy = list.GroupBy(s => s.Type).ToDictionary(g => g.Key, g => g.ToList());
 
         return UseTransaction(db =>
         {
@@ -71,26 +69,21 @@
                             throw new NotImplementedException("鍚屾澶辫触");
                         break;
                     default:
-                        throw new ArgumentNullException(
-                            $"type娌℃湁{itemGroup.Key}杩欎釜绫诲瀷鐨勫弬鏁�");
+                        throw new ArgumentNullException($"type娌℃湁{itemGroup.Key}杩欎釜绫诲瀷鐨勫弬鏁�");
                 }
-
             return 1;
         }) > 0;
     }
 
-    private bool UpdateOrganizetatus(SqlSugarScope db, string number,
-        string status)
+    private bool UpdateOrganizetatus(SqlSugarScope db, string number, string status)
     {
         var equals = status.Equals("A");
-        var result = db.Updateable<SysOrganization>()
-           .SetColumns(s => s.Fforbidstatus == equals)
-         //  .SetColumns(s => s.Fforbidstatus == status)
-            .Where(s => s.Fnumber == number).ExecuteCommand();
-
+        var result = db.Updateable<SysOrganization>().SetColumns(s => s.Fforbidstatus == equals)//.SetColumns(s => s.Fforbidstatus == status)
+                     .Where(s => s.Fnumber == number).ExecuteCommand();
         if (result > 0)
+        {
             return true;
-
+        }
         throw new NotImplementedException(status == "A" ? "鍚敤澶辫触" : "绂佺敤澶辫触");
     }
 
@@ -105,11 +98,11 @@
 
     private bool DeleteItem(SqlSugarScope db, string number)
     {
-        var deleteById = db.Deleteable<SysOrganization>()
-            .Where(s => s.Fnumber == number).ExecuteCommand();
+        var deleteById = db.Deleteable<SysOrganization>().Where(s => s.Fnumber == number).ExecuteCommand();
         if (deleteById > 0)
+        {
             return true;
-
+        }
         throw new NotImplementedException("鍒犻櫎澶辫触");
     }
 /*
@@ -140,23 +133,14 @@
     private SysOrganization GetOrganize(ErpOrganize organize)
     {
         DateTime? createDate = null;
-        if (!string.IsNullOrEmpty(organize.FCreateDate) &&
-            DateTime.TryParseExact(organize.FCreateDate, 
-                "yyyy-MM-dd HH:mm:ss", 
-                CultureInfo.InvariantCulture, 
-                DateTimeStyles.None, 
-                out DateTime parsedCreateDate))
+        if (!string.IsNullOrEmpty(organize.FCreateDate) && DateTime.TryParseExact(organize.FCreateDate,"yyyy-MM-dd HH:mm:ss",CultureInfo.InvariantCulture,DateTimeStyles.None,out DateTime parsedCreateDate))
         {
             createDate = parsedCreateDate;
         }
     
         DateTime? forbidDate = null;
-        if (!string.IsNullOrEmpty(organize.FFORBIDDATE) &&
-            DateTime.TryParseExact(organize.FFORBIDDATE, 
-                "yyyy-MM-dd HH:mm:ss", 
-                CultureInfo.InvariantCulture, 
-                DateTimeStyles.None, 
-                out DateTime parsedForbidDate))
+
+        if (!string.IsNullOrEmpty(organize.FFORBIDDATE) && DateTime.TryParseExact(organize.FFORBIDDATE, "yyyy-MM-dd HH:mm:ss",CultureInfo.InvariantCulture,DateTimeStyles.None,out DateTime parsedForbidDate))
         {
             forbidDate = parsedForbidDate;
         }
@@ -174,19 +158,18 @@
             FFORBIDDATE = forbidDate
         };
     }
-    private bool UpdateOrganizetatusBatch(SqlSugarScope db,
-        List<SysOrganization> itemList, string status)
+    private bool UpdateOrganizetatusBatch(SqlSugarScope db,List<SysOrganization> itemList, string status)
     {
         var numbers = itemList.Select(it => it.Fnumber).ToArray();
         var equals = status.Equals("A");
-        var result = db.Updateable<SysOrganization>()
-            .SetColumns(s => s.Fforbidstatus == equals)
+        var result = db.Updateable<SysOrganization>().SetColumns(s => s.Fforbidstatus == equals)
          //   .SetColumns(s => s.Fforbidstatus == status)
             .Where(s => numbers.Contains(s.Fnumber)).ExecuteCommand();
 
         if (result > 0)
+        {
             return true;
-
+        }
         throw new NotImplementedException(status == "A" ? "鍚敤澶辫触" : "绂佺敤澶辫触");
     }
 
@@ -200,30 +183,27 @@
         throw new NotImplementedException("鎻掑叆澶辫触");
     }
 
-    private bool DeleteItemBatch(SqlSugarScope db,
-        List<SysOrganization> itemList)
+    private bool DeleteItemBatch(SqlSugarScope db,List<SysOrganization> itemList)
     {
         var numbers = itemList.Select(it => it.Fnumber).ToArray();
-        var deleteByIds = db.Deleteable<SysOrganization>()
-            .Where(s => numbers.Contains(s.Fnumber)).ExecuteCommand();
+        var deleteByIds = db.Deleteable<SysOrganization>().Where(s => numbers.Contains(s.Fnumber)).ExecuteCommand();
         if (deleteByIds > 0)
+        {
             return true;
-
+        }
         throw new NotImplementedException("鍒犻櫎澶辫触");
     }
 
     private bool InsertOrUpdate(SqlSugarScope db, SysOrganization entity)
     {
-        db.Deleteable<SysOrganization>()
-            .Where(s => s.Fnumber == entity.Fnumber).ExecuteCommand();
+        db.Deleteable<SysOrganization>().Where(s => s.Fnumber == entity.Fnumber).ExecuteCommand();
 
         var insert = db.Insertable(entity).ExecuteCommand();
 
         return insert > 0;
     }
 
-    private bool InsertOrUpdateBatch(SqlSugarScope db,
-        List<SysOrganization> itemList)
+    private bool InsertOrUpdateBatch(SqlSugarScope db,List<SysOrganization> itemList)
     {
         return itemList.All(entity => InsertOrUpdate(db, entity));
     }
diff --git a/MES.Service/service/BasicData/SysDepartmentManager.cs b/MES.Service/service/BasicData/SysDepartmentManager.cs
index 4537867..e249b8a 100644
--- a/MES.Service/service/BasicData/SysDepartmentManager.cs
+++ b/MES.Service/service/BasicData/SysDepartmentManager.cs
@@ -12,8 +12,7 @@
     // Save 鏂规硶鐢ㄤ簬淇濆瓨鍗曚釜閮ㄩ棬璁板綍锛屾牴鎹被鍨嬫墽琛屼笉鍚岀殑鎿嶄綔
     public bool Save(ErpDepartment department)
     {
-        var entity =
-            GetSysDepartment(department); // 灏� ErpDepartment 杞崲涓� SysDepartment
+        var entity = GetSysDepartment(department); // 灏� ErpDepartment 杞崲涓� SysDepartment
 
         return UseTransaction(db =>
         {
@@ -37,8 +36,7 @@
                         return 1;
                     break;
                 default:
-                    throw new ArgumentNullException(
-                        $"type娌℃湁{department.Type}杩欎釜绫诲瀷鐨勫弬鏁�");
+                    throw new ArgumentNullException($"type娌℃湁{department.Type}杩欎釜绫诲瀷鐨勫弬鏁�");
             }
 
             throw new NotImplementedException("鎿嶄綔澶辫触");
@@ -46,16 +44,14 @@
     }
 
     // 鏇存柊閮ㄩ棬鐘舵�佺殑鏂规硶
-    private bool UpdateDepartmentStatus(SqlSugarScope db, decimal departmentId,
-        string status)
+    private bool UpdateDepartmentStatus(SqlSugarScope db, decimal departmentId,string status)
     {
-        var result = db.Updateable<SysDepartment>()
-            .SetColumns(s => s.Depextr4 == status)
-            .Where(s => s.Id == departmentId).ExecuteCommand();
+        var result = db.Updateable<SysDepartment>().SetColumns(s => s.Depextr4 == status).Where(s => s.Id == departmentId).ExecuteCommand();
 
         if (result > 0)
+        {
             return true;
-
+        }
         throw new NotImplementedException(status == "A" ? "鍚敤澶辫触" : "绂佺敤澶辫触");
     }
 
@@ -72,20 +68,18 @@
     // 鍒犻櫎閮ㄩ棬鐨勬柟娉�
     private bool DeleteDepartment(SqlSugarScope db, decimal departmentId)
     {
-        var deleteById = db.Deleteable<SysDepartment>()
-            .Where(s => s.Id == departmentId).ExecuteCommand();
+        var deleteById = db.Deleteable<SysDepartment>().Where(s => s.Id == departmentId).ExecuteCommand();
         if (deleteById > 0)
+        {
             return true;
-
+        }
         throw new NotImplementedException("鍒犻櫎澶辫触");
     }
 
     // 鎻掑叆鎴栨洿鏂伴儴闂ㄧ殑鏂规硶
-    private bool InsertOrUpdateDepartment(SqlSugarScope db,
-        SysDepartment entity)
+    private bool InsertOrUpdateDepartment(SqlSugarScope db,SysDepartment entity)
     {
-        db.Deleteable<SysDepartment>()
-            .Where(s => s.Id == entity.Id).ExecuteCommand();
+        db.Deleteable<SysDepartment>().Where(s => s.Id == entity.Id).ExecuteCommand();
 
         var insert = db.Insertable(entity).ExecuteCommand();
         return insert > 0;
@@ -121,43 +115,36 @@
         var list = new List<SysDepartment>();
         departments.ForEach(s =>
         {
-            var entity =
-                GetSysDepartment(s); // 灏� ErpDepartment 杞崲涓� SysDepartment
+            var entity = GetSysDepartment(s); // 灏� ErpDepartment 杞崲涓� SysDepartment
             entity.Type = s.Type;
             list.Add(entity);
         });
 
-        var groupBy = list.GroupBy(s => s.Type)
-            .ToDictionary(g => g.Key, g => g.ToList());
+        var groupBy = list.GroupBy(s => s.Type).ToDictionary(g => g.Key, g => g.ToList());
         return UseTransaction(db =>
         {
             foreach (var departmentGroup in groupBy)
                 switch (departmentGroup.Key)
                 {
                     case "0":
-                        if (!UpdateDepartmentStatusBatch(db,
-                                departmentGroup.Value, "A")) // 鎵归噺鍚敤閮ㄩ棬
+                        if (!UpdateDepartmentStatusBatch(db,departmentGroup.Value, "A")) // 鎵归噺鍚敤閮ㄩ棬
                             throw new NotImplementedException("鍚敤澶辫触");
                         break;
                     case "1":
-                        if (!UpdateDepartmentStatusBatch(db,
-                                departmentGroup.Value, "B")) // 鎵归噺绂佺敤閮ㄩ棬
+                        if (!UpdateDepartmentStatusBatch(db,departmentGroup.Value, "B")) // 鎵归噺绂佺敤閮ㄩ棬
                             throw new NotImplementedException("绂佺敤澶辫触");
                         break;
                     case "3":
-                        if (!DeleteDepartmentBatch(db,
-                                departmentGroup.Value)) // 鎵归噺鍒犻櫎閮ㄩ棬
+                        if (!DeleteDepartmentBatch(db,departmentGroup.Value)) // 鎵归噺鍒犻櫎閮ㄩ棬
                             throw new NotImplementedException("鍒犻櫎澶辫触");
                         break;
                     case "2":
                     case "4":
-                        if (!InsertOrUpdateDepartmentBatch(db,
-                                departmentGroup.Value)) // 鎵归噺鎻掑叆鎴栨洿鏂伴儴闂�
+                        if (!InsertOrUpdateDepartmentBatch(db,departmentGroup.Value)) // 鎵归噺鎻掑叆鎴栨洿鏂伴儴闂�
                             throw new NotImplementedException("鍚屾澶辫触");
                         break;
                     default:
-                        throw new ArgumentNullException(
-                            $"type娌℃湁{departmentGroup.Key}杩欎釜绫诲瀷鐨勫弬鏁�");
+                        throw new ArgumentNullException($"type娌℃湁{departmentGroup.Key}杩欎釜绫诲瀷鐨勫弬鏁�");
                 }
 
             return 1;
@@ -165,17 +152,15 @@
     }
 
     // 鎵归噺鏇存柊閮ㄩ棬鐘舵�佺殑鏂规硶
-    private bool UpdateDepartmentStatusBatch(SqlSugarScope db,
-        List<SysDepartment> departmentList, string status)
+    private bool UpdateDepartmentStatusBatch(SqlSugarScope db,List<SysDepartment> departmentList, string status)
     {
         var ids = departmentList.Select(it => it.Id).ToArray();
-        var result = db.Updateable<SysDepartment>()
-            .SetColumns(s => s.Depextr4 == status)
-            .Where(s => ids.Contains(s.Id)).ExecuteCommand();
+        var result = db.Updateable<SysDepartment>().SetColumns(s => s.Depextr4 == status).Where(s => ids.Contains(s.Id)).ExecuteCommand();
 
         if (result > 0)
+        {
             return true;
-
+        }
         throw new NotImplementedException(status == "A" ? "鍚敤澶辫触" : "绂佺敤澶辫触");
     }
 
@@ -191,25 +176,21 @@
     }
 
     // 鎵归噺鍒犻櫎閮ㄩ棬鐨勬柟娉�
-    private bool DeleteDepartmentBatch(SqlSugarScope db,
-        List<SysDepartment> departmentList)
+    private bool DeleteDepartmentBatch(SqlSugarScope db, List<SysDepartment> departmentList)
     {
         var ids = departmentList.Select(it => it.Id).ToArray();
-        var deleteByIds =
-            db.Deleteable<SysDepartment>()
-                .Where(s => ids.Contains(s.Id)).ExecuteCommand();
+        var deleteByIds = db.Deleteable<SysDepartment>().Where(s => ids.Contains(s.Id)).ExecuteCommand();
 
         if (deleteByIds > 0)
+        {
             return true;
-
+        }
         throw new NotImplementedException("鍒犻櫎澶辫触");
     }
 
     // 鎵归噺鎻掑叆鎴栨洿鏂伴儴闂ㄧ殑鏂规硶
-    private bool InsertOrUpdateDepartmentBatch(SqlSugarScope db,
-        List<SysDepartment> departmentList)
+    private bool InsertOrUpdateDepartmentBatch(SqlSugarScope db,List<SysDepartment> departmentList)
     {
-        return departmentList.All(
-            entity => InsertOrUpdateDepartment(db, entity));
+        return departmentList.All(entity => InsertOrUpdateDepartment(db, entity));
     }
 }
\ No newline at end of file
diff --git a/MES.Service/util/ResponseResult.cs b/MES.Service/util/ResponseResult.cs
index 830da6b..4d3ef07 100644
--- a/MES.Service/util/ResponseResult.cs
+++ b/MES.Service/util/ResponseResult.cs
@@ -25,4 +25,31 @@
             data = e.Message
         };
     }
+}
+
+/// <summary>
+/// 鎵归噺鍒犻櫎鎿嶄綔鐨勭粨鏋滀俊鎭�
+/// 鐢ㄤ簬杩斿洖鎵归噺鍒犻櫎鐨勮缁嗙粺璁℃暟鎹�
+/// </summary>
+public class BatchDeleteResult
+{
+    /// <summary>
+    /// 璇锋眰鍒犻櫎鐨勯�佽揣鍗曞彿鎬绘暟锛堝幓閲嶅悗锛�
+    /// </summary>
+    public int TotalRequested { get; set; }
+
+    /// <summary>
+    /// 瀹為檯鍒犻櫎鐨勮褰曟�绘暟
+    /// </summary>
+    public int TotalDeleted { get; set; }
+
+    /// <summary>
+    /// 鎴愬姛鍒犻櫎鐨勯�佽揣鍗曞彿鍒楄〃
+    /// </summary>
+    public List<string> DeletedNos { get; set; } = new List<string>();
+
+    /// <summary>
+    /// 鏈壘鍒扮殑閫佽揣鍗曞彿鍒楄〃
+    /// </summary>
+    public List<string> NotFoundNos { get; set; } = new List<string>();
 }
\ No newline at end of file
diff --git a/MESApplication/Controllers/BasicData/DeliveryBarcodeController.cs b/MESApplication/Controllers/BasicData/DeliveryBarcodeController.cs
new file mode 100644
index 0000000..d6b35e3
--- /dev/null
+++ b/MESApplication/Controllers/BasicData/DeliveryBarcodeController.cs
@@ -0,0 +1,379 @@
+锘縰sing System.Dynamic;
+using MES.Service.Dto.webApi;
+using MES.Service.Modes;
+using MES.Service.service;
+using MES.Service.service.BasicData; // 鍋囪DeliveryBarcodeManager鍦ㄨ鍛藉悕绌洪棿涓嬶紝鍙牴鎹疄闄呰皟鏁�
+using MES.Service.util;
+using Microsoft.AspNetCore.Mvc;
+using Newtonsoft.Json;
+
+namespace MESApplication.Controllers.BasicData;
+
+/// <summary>
+/// 閫佽揣鍗曟潯鐮佹帶鍒跺櫒锛堝搴旀惡瀹簯鏉$爜淇℃伅琛ㄦ搷浣滐級
+/// </summary>
+[ApiController]
+[Route("api/[controller]")]
+public class DeliveryBarcodeController : ControllerBase
+{
+    // 娑堟伅涓績绠$悊鍣紙澶嶇敤鍘熼�昏緫锛�
+    private readonly MessageCenterManager _messageCenterManager = new();
+
+    // 閫佽揣鍗曟潯鐮佷笟鍔¢�昏緫绠$悊鍣紙瀵瑰簲涓氬姟灞傦紝闇�纭繚瀹為檯椤圭洰涓瓨鍦ㄨ绫伙級
+    private readonly DeliveryBarcodeManager _deliveryBarcodeManager = new();
+
+    // 鎺ュ彛璇锋眰鏂规硶锛堝浐瀹歅OST锛屼笌鍘熸帶鍒跺櫒涓�鑷达級
+    private readonly string REQUEST_METHOD = "POST";
+
+    // 瀵瑰簲鏁版嵁搴撹〃鍚嶏紙鎼哄浜戞潯鐮佷俊鎭〃锛屼笌涔嬪墠瀹氫箟鐨勫疄浣撶被琛ㄥ悕涓�鑷达級
+    private readonly string TARGET_TABLE = "TBL_BARCODE_INFORMATION";
+
+    // 鍩虹鎺ュ彛URL锛堟牴鎹帶鍒跺櫒鍚嶅畾涔夛紝淇濇寔REST椋庢牸锛�
+    private readonly string BASE_API_URL = "http://localhost:10054/api/DeliveryBarcode/";
+
+    /// <summary>
+    /// 鍗曚釜閫佽揣鍗曟潯鐮佷俊鎭繚瀛樻帴鍙�
+    /// </summary>
+    /// <param name="barcodeInfo">閫佽揣鍗曟潯鐮丏TO锛堝崟涓級</param>
+    /// <returns>缁熶竴鍝嶅簲缁撴灉</returns>
+    [HttpPost("Save")]
+    public ResponseResult Save(DeliveryBarcodeInfo barcodeInfo)
+    {
+        // 1. 鍒濆鍖栨秷鎭腑蹇冨疄浣擄紙鐢ㄤ簬鏃ュ織/娑堟伅璁板綍锛�
+        var messageEntity = new MessageCenter
+        {
+            TableName = TARGET_TABLE,
+            Url = BASE_API_URL + "Save", // 鎷兼帴瀹屾暣鎺ュ彛URL
+            Method = REQUEST_METHOD,
+            Data = JsonConvert.SerializeObject(barcodeInfo), // 搴忓垪鍖朌TO涓篔SON
+            Status = 1, // 鐘舵�佹爣璇嗭紙1=寰呭鐞�/澶勭悊涓紝涓庡師閫昏緫涓�鑷达級
+            CreateBy = "PL017", // 鍒涘缓浜猴紙澶嶇敤鍘熼厤缃紝鍙牴鎹疄闄呰皟鏁翠负鍔ㄦ�佽幏鍙栵級
+            Route = barcodeInfo.DeliveryNo ?? "鏈煡閫佽揣鍗曞彿", // 璺敱鏍囪瘑锛堢敤閫佽揣鍗曞彿鍖哄垎锛屾棤鍒欏~榛樿鍊硷級
+            DealWith = 0 // 鍒濆澶勭悊鐘舵�侊紙0=鏈鐞嗭級
+        };
+
+        try
+        {
+            // 2. 涓氬姟閫昏緫澶勭悊锛氳皟鐢ㄤ笟鍔″眰淇濆瓨鍗曚釜鏉$爜淇℃伅
+            dynamic resultData = new ExpandoObject();
+            bool saveSuccess = _deliveryBarcodeManager.Save(barcodeInfo);
+            resultData.tbBillList = saveSuccess; // 瀛樺偍淇濆瓨缁撴灉锛堜笌鍘熻繑鍥炴牸寮忎竴鑷达級
+
+            // 3. 鏇存柊娑堟伅涓績瀹炰綋鐘舵��
+            messageEntity.Result = saveSuccess ? 1 : 0; // 1=鎴愬姛锛�0=澶辫触
+            messageEntity.DealWith = 1; // 1=宸插鐞�
+            _messageCenterManager.save(messageEntity); // 淇濆瓨娑堟伅璁板綍
+
+            // 4. 杩斿洖鎴愬姛鍝嶅簲锛堢粺涓�鍝嶅簲鏍煎紡锛�
+            return new ResponseResult
+            {
+                status = 0, // 0=鎴愬姛鐘舵�佺爜锛堜笌鍘熼�昏緫涓�鑷达級
+                message = "鍗曚釜閫佽揣鍗曟潯鐮佷俊鎭繚瀛樻垚鍔�",
+                data = resultData
+            };
+        }
+        catch (Exception ex)
+        {
+            // 5. 寮傚父澶勭悊锛氭崟鑾峰紓甯稿苟鏇存柊娑堟伅涓績
+            messageEntity.Result = 0; // 澶辫触鏍囪瘑
+            messageEntity.DealWith = 0; // 鏈鐞嗘爣璇�
+            messageEntity.ResultData = ex.Message; // 寮傚父淇℃伅璁板綍
+            _messageCenterManager.save(messageEntity); // 淇濆瓨寮傚父娑堟伅
+
+            // 6. 杩斿洖寮傚父鍝嶅簲锛堝鐢ㄥ伐鍏风被鐨勭粺涓�寮傚父鍝嶅簲鏂规硶锛�
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+
+    /// <summary>
+    /// 鎵归噺閫佽揣鍗曟潯鐮佷俊鎭繚瀛樻帴鍙�
+    /// </summary>
+    /// <param name="barcodeInfoList">閫佽揣鍗曟潯鐮丏TO鍒楄〃锛堟壒閲忥級</param>
+    /// <returns>缁熶竴鍝嶅簲缁撴灉</returns>
+    [HttpPost("SaveList")]
+    public ResponseResult SaveList(List<DeliveryBarcodeInfo> barcodeInfoList)
+    {
+        // 1. 鍒濆鍖栨秷鎭腑蹇冨疄浣擄紙鎵归噺鍦烘櫙涓撶敤锛�
+        var messageEntity = new MessageCenter
+        {
+            TableName = TARGET_TABLE,
+            Url = BASE_API_URL + "SaveList", // 鎷兼帴鎵归噺鎺ュ彛URL
+            Method = REQUEST_METHOD,
+            Data = JsonConvert.SerializeObject(barcodeInfoList), // 搴忓垪鍖朌TO鍒楄〃涓篔SON
+            Status = 1,
+            CreateBy = "PL017",
+            Route = barcodeInfoList.Any() ? $"鎵归噺_{barcodeInfoList.First().DeliveryNo ?? "鏈煡"}" : "绌烘壒閲忚姹�",
+            DealWith = 0
+        };
+
+        try
+        {
+            // 2. 涓氬姟閫昏緫澶勭悊锛氳皟鐢ㄤ笟鍔″眰鎵归噺淇濆瓨
+            dynamic resultData = new ExpandoObject();
+            bool batchSaveSuccess = _deliveryBarcodeManager.SaveList(barcodeInfoList);
+            resultData.tbBillList = batchSaveSuccess; // 淇濇寔涓庡崟涓繚瀛樹竴鑷寸殑杩斿洖瀛楁
+
+            // 3. 鏇存柊娑堟伅涓績鐘舵��
+            messageEntity.Result = batchSaveSuccess ? 1 : 0;
+            messageEntity.DealWith = 1;
+            _messageCenterManager.save(messageEntity);
+
+            // 4. 杩斿洖鎴愬姛鍝嶅簲
+            return new ResponseResult
+            {
+                status = 0,
+                message = $"鎵归噺淇濆瓨鎴愬姛锛屽叡澶勭悊{barcodeInfoList.Count}鏉℃潯鐮佷俊鎭�",
+                data = resultData
+            };
+        }
+        catch (Exception ex)
+        {
+            // 5. 寮傚父澶勭悊锛氳褰曞紓甯稿苟杩斿洖閿欒
+            messageEntity.Result = 0;
+            messageEntity.DealWith = 0;
+            messageEntity.ResultData = $"鎵归噺淇濆瓨寮傚父锛歿ex.Message}";
+            _messageCenterManager.save(messageEntity);
+
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+
+    /// <summary>
+    /// 鏍规嵁閫佽揣鍗曞彿鍒犻櫎鏉$爜鏁版嵁
+    /// </summary>
+    /// <param name="request">鍖呭惈閫佽揣鍗曞彿鐨勮姹傛ā鍨�</param>
+    /// <returns>缁熶竴鍝嶅簲缁撴灉</returns>
+    [HttpPost("DeleteByNo")] // 鑻ラ」鐩敮鎸� RESTful锛屽彲鏀逛负 [HttpDelete("DeleteByNo")]
+    public ResponseResult DeleteByNo([FromBody] DeleteByDeliveryNoRequest request)
+    {
+        // 1. 鍒濆鍖栨秷鎭腑蹇冨疄浣擄紙璁板綍鍒犻櫎鎿嶄綔鏃ュ織锛�
+        var messageEntity = new MessageCenter
+        {
+            TableName = TARGET_TABLE,
+            Url = BASE_API_URL + "DeleteByNo", // 鎺ュ彛URL
+            Method = REQUEST_METHOD,
+            Data = JsonConvert.SerializeObject(request), // 搴忓垪鍖栬姹傚弬鏁�
+            Status = 1, // 1=澶勭悊涓�
+            CreateBy = "PL017", // 涓庡師鏈夋帴鍙d竴鑷寸殑鍒涘缓浜�
+            Route = request.DeliveryNo, // 璺敱鏍囪瘑=閫佽揣鍗曞彿锛屼究浜庡畾浣嶆棩蹇�
+            DealWith = 0 // 鍒濆=鏈鐞�
+        };
+
+        try
+        {
+            // 2. 璋冪敤涓氬姟灞傛柟娉曟墽琛屽垹闄�
+            dynamic resultData = new ExpandoObject();
+            bool deleteSuccess = _deliveryBarcodeManager.DeleteByDeliveryNo(request.DeliveryNo);
+            resultData.deletedDeliveryNo = request.DeliveryNo; // 杩斿洖鍒犻櫎鐨勯�佽揣鍗曞彿
+            resultData.isSuccess = deleteSuccess;
+
+            // 3. 鏇存柊娑堟伅涓績鐘舵�侊紙鎴愬姛锛�
+            messageEntity.Result = 1; // 1=鎴愬姛
+            messageEntity.DealWith = 1; // 1=宸插鐞�
+            _messageCenterManager.save(messageEntity);
+
+            // 4. 杩斿洖鎴愬姛鍝嶅簲
+            return new ResponseResult
+            {
+                status = 0,
+                message = $"鎴愬姛鍒犻櫎閫佽揣鍗曞彿銆寋request.DeliveryNo}銆嶅搴旂殑鏉$爜鏁版嵁",
+                data = resultData
+            };
+        }
+        catch (Exception ex)
+        {
+            // 5. 寮傚父澶勭悊锛氭洿鏂版秷鎭腑蹇冩棩蹇楋紙澶辫触锛�
+            messageEntity.Result = 0; // 0=澶辫触
+            messageEntity.DealWith = 0; // 0=鏈鐞�
+            messageEntity.ResultData = ex.Message; // 璁板綍寮傚父淇℃伅
+            _messageCenterManager.save(messageEntity);
+
+            // 6. 杩斿洖缁熶竴寮傚父鍝嶅簲
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+    
+    /// <summary>
+    /// 鎵归噺鏍规嵁閫佽揣鍗曞彿鍒犻櫎鏉$爜鏁版嵁
+    /// </summary>
+    /// <param name="request">鍖呭惈鎵归噺閫佽揣鍗曞彿鐨勮姹傛ā鍨嬶紙鏁扮粍鏍煎紡锛�</param>
+    /// <returns>缁熶竴鍝嶅簲缁撴灉</returns>
+    [HttpPost("DeleteListByNo")]
+    public ResponseResult DeleteListByNo([FromBody] BatchDeleteByDeliveryNoRequest request)
+    {
+        // 1. 鍒濆鍖栨秷鎭腑蹇冨疄浣�
+        var messageEntity = new MessageCenter
+        {
+            TableName = TARGET_TABLE,
+            Url = BASE_API_URL + "DeleteListByNo",
+            Method = REQUEST_METHOD,
+            Data = JsonConvert.SerializeObject(request),
+            Status = 1, // 澶勭悊涓�
+            CreateBy = "PL017",
+            // 璺敱鏍囪瘑锛氭樉绀哄墠3涓崟鍙�
+            Route =
+                $"Batch_{string.Join(",", request.Take(3).Select(item => item.DeliveryNo))}{(request.Count > 3 ? "..." : "")}",
+            DealWith = 0 // 鏈鐞�
+        };
+
+        try
+        {
+            // 2. 鐩存帴璋冪敤涓氬姟灞傦紙涓嶅啀鍦ㄦ帶鍒跺櫒澶勭悊鍒楄〃锛岄�昏緫绉昏嚦涓氬姟灞傦級
+            dynamic resultData = new ExpandoObject();
+            BatchDeleteResult deleteResult = _deliveryBarcodeManager.DeleteListByDeliveryNo(request);
+
+            // 3. 缁勮杩斿洖鏁版嵁
+            resultData.totalRequested = deleteResult.TotalRequested;
+            resultData.totalDeleted = deleteResult.TotalDeleted;
+            resultData.deletedNos = deleteResult.DeletedNos;
+            resultData.notFoundNos = deleteResult.NotFoundNos;
+            resultData.isSuccess = deleteResult.TotalDeleted > 0;
+
+            // 4. 鏇存柊娑堟伅涓績鐘舵�侊紙鎴愬姛锛�
+            messageEntity.Result = 1;
+            messageEntity.DealWith = 1;
+            messageEntity.ResultData = $"鎵归噺鍒犻櫎瀹屾垚锛屽叡澶勭悊{deleteResult.TotalRequested}涓崟鍙�";
+            _messageCenterManager.save(messageEntity);
+
+            // 5. 杩斿洖鎴愬姛鍝嶅簲
+            return new ResponseResult
+            {
+                status = 0,
+                message = $"鎴愬姛鍒犻櫎{deleteResult.DeletedNos.Count}涓�佽揣鍗曞彿瀵瑰簲鐨勬潯鐮佹暟鎹紝鍏眥deleteResult.TotalDeleted}鏉¤褰�",
+                data = resultData
+            };
+        }
+        catch (Exception ex)
+        {
+            // 6. 寮傚父澶勭悊
+            messageEntity.Result = 0;
+            messageEntity.DealWith = 0;
+            messageEntity.ResultData = ex.Message;
+            _messageCenterManager.save(messageEntity);
+
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+
+    /// <summary>
+    /// 鎸夐�佽揣鍗曞彿+琛屽唴鐮佽仈鍚堝垹闄ゆ潯鐮佹暟鎹�
+    /// </summary>
+    /// <param name="request">鍖呭惈閫佽揣鍗曞彿鍜岃鍐呯爜鐨勮姹傛ā鍨�</param>
+    /// <returns>缁熶竴鍝嶅簲缁撴灉</returns>
+    [HttpPost("DeleteByItem")] // 鑻ョ敤 RESTful 瑙勮寖锛屽彲鏀逛负 [HttpDelete("DeleteByItem")]
+    public ResponseResult DeleteByItem([FromBody] DeleteByDeliveryItemRequest request)
+    {
+        // 1. 鍒濆鍖栨秷鎭腑蹇冨疄浣擄細璁板綍鍒犻櫎鎿嶄綔鏃ュ織
+        var messageEntity = new MessageCenter
+        {
+            TableName = TARGET_TABLE,
+            Url = BASE_API_URL + "DeleteByItem", // 鎺ュ彛URL
+            Method = REQUEST_METHOD,
+            Data = JsonConvert.SerializeObject(request), // 搴忓垪鍖栬姹傚弬鏁帮紙鍚弻鏉′欢锛�
+            Status = 1, // 1=澶勭悊涓�
+            CreateBy = "PL017", // 涓庡師鏈夋帴鍙d竴鑷寸殑鍒涘缓浜�
+            Route = $"{request.DeliveryNo}_{request.LineNo}", // 璺敱鏍囪瘑=鈥滃崟鍙穇琛屽唴鐮佲�濓紝渚夸簬鏃ュ織瀹氫綅
+            DealWith = 0 // 鍒濆=鏈鐞�
+        };
+
+        try
+        {
+            // 2. 璋冪敤涓氬姟灞傝仈鍚堝垹闄ゆ柟娉�
+            dynamic resultData = new ExpandoObject();
+            bool deleteSuccess = _deliveryBarcodeManager.DeleteByDeliveryItem(
+                request.DeliveryNo,
+                request.LineNo
+            );
+            // 鍝嶅簲涓繑鍥炲叧閿潯浠讹紝渚夸簬鍓嶇纭鍒犻櫎鑼冨洿
+            resultData.deletedDeliveryNo = request.DeliveryNo;
+            resultData.deletedLineNo = request.LineNo;
+            resultData.isSuccess = deleteSuccess;
+
+            // 3. 鏇存柊娑堟伅涓績鐘舵�侊紙鎴愬姛锛�
+            messageEntity.Result = 1; // 1=鎴愬姛
+            messageEntity.DealWith = 1; // 1=宸插鐞�
+            _messageCenterManager.save(messageEntity);
+
+            // 4. 杩斿洖鎴愬姛鍝嶅簲
+            return new ResponseResult
+            {
+                status = 0,
+                message = $"鎴愬姛鍒犻櫎閫佽揣鍗曞彿銆寋request.DeliveryNo}銆�-琛屽唴鐮併�寋request.LineNo}銆嶅搴旂殑鏉$爜鏁版嵁",
+                data = resultData
+            };
+        }
+        catch (Exception ex)
+        {
+            // 5. 寮傚父澶勭悊锛氳褰曟秷鎭腑蹇冩棩蹇楋紙澶辫触锛�
+            messageEntity.Result = 0; // 0=澶辫触
+            messageEntity.DealWith = 0; // 0=鏈鐞�
+            messageEntity.ResultData = ex.Message; // 瀛樺偍寮傚父淇℃伅
+            _messageCenterManager.save(messageEntity);
+
+            // 6. 杩斿洖缁熶竴寮傚父鍝嶅簲
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+
+    /// <summary>
+    /// 鎵归噺鎸夐�佽揣鍗曞彿+琛屽唴鐮佸垹闄ゆ潯鐮佹暟鎹�
+    /// </summary>
+    /// <param name="request">鍖呭惈鎵归噺閫佽揣鍗曡鐨勮姹傛ā鍨嬶紙鏁扮粍鏍煎紡锛�</param>
+    /// <returns>缁熶竴鍝嶅簲缁撴灉</returns>
+    [HttpPost("DeleteListByItem")]
+    public ResponseResult DeleteListByItem([FromBody] BatchDeleteByDeliveryItemRequest request)
+    {
+        // 1. 鍒濆鍖栨秷鎭腑蹇冨疄浣�
+        var messageEntity = new MessageCenter
+        {
+            TableName = TARGET_TABLE,
+            Url = BASE_API_URL + "DeleteListByItem",
+            Method = REQUEST_METHOD,
+            Data = JsonConvert.SerializeObject(request),
+            Status = 1, // 澶勭悊涓�
+            CreateBy = "PL017",
+            // 璺敱鏍囪瘑锛氭樉绀哄墠3涓�"DeliveryNo_LineNo"缁勫悎
+            Route =
+                $"BatchItem_{string.Join(",", request.Take(3).Select(item => $"{item.DeliveryNo}_{item.LineNo}"))}{(request.Count > 3 ? "..." : "")}",
+            DealWith = 0 // 鏈鐞�
+        };
+
+        try
+        {
+            // 2. 璋冪敤涓氬姟灞傛墽琛屾壒閲忓垹闄�
+            dynamic resultData = new ExpandoObject();
+            BatchDeleteResult deleteResult = _deliveryBarcodeManager.DeleteListByDeliveryItem(request);
+
+            // 3. 缁勮杩斿洖鏁版嵁
+            resultData.totalRequested = deleteResult.TotalRequested;
+            resultData.totalDeleted = deleteResult.TotalDeleted;
+            resultData.deletedItems = deleteResult.DeletedNos; // 鏍煎紡锛歔"DN1_1", "DN1_2"]
+            resultData.notFoundItems = deleteResult.NotFoundNos;
+            resultData.isSuccess = deleteResult.TotalDeleted > 0;
+
+            // 4. 鏇存柊娑堟伅涓績鐘舵�侊紙鎴愬姛锛�
+            messageEntity.Result = 1;
+            messageEntity.DealWith = 1;
+            messageEntity.ResultData = $"鎵归噺鍒犻櫎瀹屾垚锛屽叡澶勭悊{deleteResult.TotalRequested}鏉¢�佽揣鍗曡";
+            _messageCenterManager.save(messageEntity);
+
+            // 5. 杩斿洖鎴愬姛鍝嶅簲
+            return new ResponseResult
+            {
+                status = 0,
+                message = $"鎴愬姛鍒犻櫎{deleteResult.DeletedNos.Count}鏉¢�佽揣鍗曡鏁版嵁锛屽叡{deleteResult.TotalDeleted}鏉¤褰�",
+                data = resultData
+            };
+        }
+        catch (Exception ex)
+        {
+            // 6. 寮傚父澶勭悊
+            messageEntity.Result = 0;
+            messageEntity.DealWith = 0;
+            messageEntity.ResultData = ex.Message;
+            _messageCenterManager.save(messageEntity);
+
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+}
\ No newline at end of file
diff --git a/MESApplication/Controllers/BasicData/MesCustomerController.cs b/MESApplication/Controllers/BasicData/MesCustomerController.cs
index 904e03b..98646c8 100644
--- a/MESApplication/Controllers/BasicData/MesCustomerController.cs
+++ b/MESApplication/Controllers/BasicData/MesCustomerController.cs
@@ -40,7 +40,10 @@
             resultInfos.tbBillList = save;
 
             entity.Result = 0;
-            if (save) entity.Result = 1;
+            if (save)
+            {
+                entity.Result = 1;
+            }
 
             entity.DealWith = 1;
             _manager.save(entity);
@@ -83,7 +86,10 @@
             resultInfos.tbBillList = save;
 
             entity.Result = 0;
-            if (save) entity.Result = 1;
+            if (save)
+            {
+                entity.Result = 1;
+            }
 
             entity.DealWith = 1;
             _manager.save(entity);
diff --git a/MESApplication/Controllers/BasicData/MesDeliveryNoteController.cs b/MESApplication/Controllers/BasicData/MesDeliveryNoteController.cs
index c7db727..6b32072 100644
--- a/MESApplication/Controllers/BasicData/MesDeliveryNoteController.cs
+++ b/MESApplication/Controllers/BasicData/MesDeliveryNoteController.cs
@@ -42,7 +42,10 @@
             resultInfos.tbBillList = save;
 
             entity.Result = 0;
-            if (save) entity.Result = 1;
+            if (save)
+            {
+                entity.Result = 1;
+            }
 
             entity.DealWith = 1;
             _manager.save(entity);
diff --git a/MESApplication/Controllers/BasicData/MesDepotsController.cs b/MESApplication/Controllers/BasicData/MesDepotsController.cs
index f3f0ae6..4c1fc80 100644
--- a/MESApplication/Controllers/BasicData/MesDepotsController.cs
+++ b/MESApplication/Controllers/BasicData/MesDepotsController.cs
@@ -40,7 +40,10 @@
             resultInfos.tbBillList = save;
 
             entity.Result = 0;
-            if (save) entity.Result = 1;
+            if (save)
+            {
+                entity.Result = 1;
+            }
 
             entity.DealWith = 1;
             _manager.save(entity);
diff --git a/MESApplication/Controllers/BasicData/MesItemTypeController.cs b/MESApplication/Controllers/BasicData/MesItemTypeController.cs
index bdb5583..22bf3d8 100644
--- a/MESApplication/Controllers/BasicData/MesItemTypeController.cs
+++ b/MESApplication/Controllers/BasicData/MesItemTypeController.cs
@@ -41,7 +41,10 @@
             resultInfos.tbBillList = save;
 
             entity.Result = 0;
-            if (save) entity.Result = 1;
+            if (save)
+            {
+                entity.Result = 1;
+            }
 
             entity.DealWith = 1;
             _manager.save(entity);
diff --git a/MESApplication/Controllers/BasicData/MesItemsController.cs b/MESApplication/Controllers/BasicData/MesItemsController.cs
index 503a9eb..8e3e459 100644
--- a/MESApplication/Controllers/BasicData/MesItemsController.cs
+++ b/MESApplication/Controllers/BasicData/MesItemsController.cs
@@ -41,7 +41,10 @@
             resultInfos.tbBillList = save;
 
             entity.Result = 0;
-            if (save) entity.Result = 1;
+            if (save)
+            {
+                entity.Result = 1;
+            }
 
             entity.DealWith = 1;
             _manager.save(entity);
diff --git a/MESApplication/Controllers/BasicData/MesPositionController.cs b/MESApplication/Controllers/BasicData/MesPositionController.cs
index 0769cd3..5311c61 100644
--- a/MESApplication/Controllers/BasicData/MesPositionController.cs
+++ b/MESApplication/Controllers/BasicData/MesPositionController.cs
@@ -41,7 +41,10 @@
             resultInfos.tbBillList = save;
 
             entity.Result = 0;
-            if (save) entity.Result = 1;
+            if (save)
+            {
+                entity.Result = 1;
+            }
 
             entity.DealWith = 1;
             _manager.save(entity);
diff --git a/MESApplication/Controllers/BasicData/MesStaffController.cs b/MESApplication/Controllers/BasicData/MesStaffController.cs
index 3390062..cae9f28 100644
--- a/MESApplication/Controllers/BasicData/MesStaffController.cs
+++ b/MESApplication/Controllers/BasicData/MesStaffController.cs
@@ -40,7 +40,10 @@
             resultInfos.tbBillList = save;
 
             entity.Result = 0;
-            if (save) entity.Result = 1;
+            if (save)
+            {
+                entity.Result = 1;
+            }
 
             entity.DealWith = 1;
             _manager.save(entity);
diff --git a/MESApplication/Controllers/BasicData/MesSupplierController.cs b/MESApplication/Controllers/BasicData/MesSupplierController.cs
index c612c64..e213f33 100644
--- a/MESApplication/Controllers/BasicData/MesSupplierController.cs
+++ b/MESApplication/Controllers/BasicData/MesSupplierController.cs
@@ -40,7 +40,10 @@
             resultInfos.tbBillList = save;
 
             entity.Result = 0;
-            if (save) entity.Result = 1;
+            if (save)
+            {
+                entity.Result = 1;
+            }
 
             entity.DealWith = 1;
             _manager.save(entity);
diff --git a/MESApplication/Controllers/BasicData/MesUnitController.cs b/MESApplication/Controllers/BasicData/MesUnitController.cs
index 508c644..3081398 100644
--- a/MESApplication/Controllers/BasicData/MesUnitController.cs
+++ b/MESApplication/Controllers/BasicData/MesUnitController.cs
@@ -40,7 +40,10 @@
             resultInfos.tbBillList = save;
 
             entity.Result = 0;
-            if (save) entity.Result = 1;
+            if (save)
+            {
+                entity.Result = 1;
+            }
 
             entity.DealWith = 1;
             _manager.save(entity);
diff --git a/MESApplication/Controllers/BasicData/OrganizeController.cs b/MESApplication/Controllers/BasicData/OrganizeController.cs
index f08a11c..e7250fb 100644
--- a/MESApplication/Controllers/BasicData/OrganizeController.cs
+++ b/MESApplication/Controllers/BasicData/OrganizeController.cs
@@ -41,7 +41,10 @@
             resultInfos.tbBillList = save;
 
             entity.Result = 0;
-            if (save) entity.Result = 1;
+            if (save)
+            {
+                entity.Result = 1;
+            }
 
             entity.DealWith = 1;
             _manager.save(entity);
diff --git a/MESApplication/Controllers/BasicData/ProductionOrderController.cs b/MESApplication/Controllers/BasicData/ProductionOrderController.cs
index 6fc08e4..18fbea9 100644
--- a/MESApplication/Controllers/BasicData/ProductionOrderController.cs
+++ b/MESApplication/Controllers/BasicData/ProductionOrderController.cs
@@ -21,8 +21,7 @@
 
     private readonly string TableName = "PRODUCTION_ORDER";
 
-    private readonly string URL =
-        "http://localhost:10054/api/ProductionOrder/";
+    private readonly string URL = "http://localhost:10054/api/ProductionOrder/";
 
     //
     [HttpPost("Save")]
@@ -44,7 +43,10 @@
             resultInfos.tbBillList = save;
 
             entity.Result = 0;
-            if (save) entity.Result = 1;
+            if (save)
+            {
+                entity.Result = 1;
+            }
 
             entity.DealWith = 1;
             _manager.save(entity);
diff --git a/MESApplication/Controllers/BasicData/SysDepartmentController.cs b/MESApplication/Controllers/BasicData/SysDepartmentController.cs
index 366444f..e514e5b 100644
--- a/MESApplication/Controllers/BasicData/SysDepartmentController.cs
+++ b/MESApplication/Controllers/BasicData/SysDepartmentController.cs
@@ -40,7 +40,10 @@
             resultInfos.tbBillList = save;
 
             entity.Result = 0;
-            if (save) entity.Result = 1;
+            if (save)
+            {
+                entity.Result = 1;
+            }
 
             entity.DealWith = 1;
             _manager.save(entity);
diff --git a/MESApplication/Controllers/WomcaaController.cs b/MESApplication/Controllers/WomcaaController.cs
index 398bb75..17ba197 100644
--- a/MESApplication/Controllers/WomcaaController.cs
+++ b/MESApplication/Controllers/WomcaaController.cs
@@ -88,7 +88,10 @@
             resultInfos.tbBillList = save;
 
             entity.Result = 0;
-            if (save) entity.Result = 1;
+            if (save)
+            {
+                entity.Result = 1;
+            }
 
             entity.DealWith = 1;
             _manager.save(entity);
diff --git a/MESApplication/appsettings.json b/MESApplication/appsettings.json
index 4f3cec2..ee81482 100644
--- a/MESApplication/appsettings.json
+++ b/MESApplication/appsettings.json
@@ -11,7 +11,7 @@
     "TestErpUrl": "http://192.168.0.208:8066/WebService1.asmx/MesToErpinfoTest",
     "ProductionErpUrl": "http://192.168.0.208:8066/WebService1.asmx/MesToErpinfoTest",
     // "DataBaseConn": "Data Source=192.168.1.187;Initial Catalog=TEST_MES;User ID=sa;Password =LongWei@2025;Encrypt=True;TrustServerCertificate=True;"
-    "DataBaseConn": "Data Source=192.168.8.8;Initial Catalog=TEST_MES;User ID=sa;Password =JianHui@2025;Encrypt=True;TrustServerCertificate=True;"
+    "DataBaseConn": "Data Source=192.168.8.8;Initial Catalog=YS_MES;User ID=sa;Password =JianHui@2025;Encrypt=True;TrustServerCertificate=True;"
 
   }
 }

--
Gitblit v1.9.3