From daad807a255285274f3b8559b48a12536cdacfac Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期二, 21 四月 2026 16:59:42 +0800
Subject: [PATCH] 成品入库上传ERP新增销售单号字段,成品出库上传MES及外包装机新增订单出货数量字段

---
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MES/MesShipmentOrderSync.cs        |    4 +
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs  |   17 ++--
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_External/Model/ERPProInboundModel.cs   |    4 +
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesProductService.cs   |    1 
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs |  198 +++++++++++++++++++++++++------------------------
 5 files changed, 119 insertions(+), 105 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MES/MesShipmentOrderSync.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MES/MesShipmentOrderSync.cs"
index 13541e2..e56b359 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MES/MesShipmentOrderSync.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MES/MesShipmentOrderSync.cs"
@@ -54,6 +54,10 @@
         /// </summary>
         public string ProductVersion { get; set; }
         /// <summary>
+        /// 璁㈠崟鍑鸿揣鏁伴噺
+        /// </summary>
+        public float ShipmentQty { get; set; }
+        /// <summary>
         /// 鍑鸿揣鏁伴噺
         /// </summary>
         public float Qty { get; set; }
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_External/Model/ERPProInboundModel.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_External/Model/ERPProInboundModel.cs"
index 60c2be5..74b3f86 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_External/Model/ERPProInboundModel.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_External/Model/ERPProInboundModel.cs"
@@ -82,6 +82,10 @@
         /// </summary>
         public string XLocation { get; set; }
         /// <summary>
+        /// 閿�鍞崟鍙�
+        /// </summary>
+        public string ChangeSoNumber { get; set; }
+        /// <summary>
         /// 鍙夋澘鏁�
         /// </summary>
         public float Xqty { get; set; }
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs"
index c354503..f8f3665 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs"
@@ -1608,14 +1608,15 @@
                     ERPProItemsItem proItemsItem = new ERPProItemsItem()
                     {
                         PartNum = item.ProductCode,
-                        Rev=item.ProductVersion,
-                        DateCode=item.DateCode,
-                        BatchNumber= item.ProductCode,
-                        XLocation=item.XSite,
-                        Xqty=item.XQty,
-                        QtySet=item.SETQty,
-                        QtyPcs=item.OKPCSQTY,
-                        WoList=new List<ERPProListItem>()
+                        Rev = item.ProductVersion,
+                        DateCode = item.DateCode,
+                        BatchNumber = item.ProductCode,
+                        XLocation = item.XSite,
+                        ChangeSoNumber = item.SaleOrder,
+                        Xqty = item.XQty,
+                        QtySet = item.SETQty,
+                        QtyPcs = item.OKPCSQTY,
+                        WoList = new List<ERPProListItem>()
                         {
                             new ERPProListItem()
                             {
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesProductService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesProductService.cs"
index 8c5255c..d6d8d27 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesProductService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesProductService.cs"
@@ -429,6 +429,7 @@
             {
                 ProductCode = proOutOrderDetail.PCode,
                 ProductVersion = proOutOrderDetail.PVer,
+                ShipmentQty= outProStockInfo.OrderQuantity,
                 Qty = outProStockInfo.AssignQuantity,
                 DateCode = outProStockInfo.DateCode,
                 SaleOrder = proOutOrderDetail.SaleOrder,
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs"
index a40c4b3..1709c62 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs"
@@ -847,112 +847,116 @@
                 return WebResponseContent.Instance.Error(ex.Message);
             }
         }
-
+        private static object _requestZH = new object();
         public WebResponseContent RequestZHInboundTask(string agvTaskCode, string palletCode, string palletType, string materialLot)
         {
-            WebResponseContent content = new WebResponseContent();
-            try
+            lock (_requestZH)
             {
-                //鑾峰彇闃荤剨搴撳瓨淇℃伅
-                Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA154.ToString());
-                //鑾峰彇搴撳瓨璁板綍
-                List<Dt_StockInfo> stockInfos = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x =>
-                  x.WarehouseId == warehouse.WarehouseId && x.PalletCode== palletCode).Includes(x => x.Details).ToList();
-                if (stockInfos.Count > 0)
+                WebResponseContent content = new WebResponseContent();
+                try
                 {
-                    return content.Error($"杞藉叿鎵樼洏宸插瓨鍦�");
-                }
-                Dt_StockInfo? stockInfoOld = stockInfos.FirstOrDefault(x => x.Details.Any(x => x.BatchNo == materialLot));
-                if (stockInfoOld != null)
-                {
-                    return content.Error($"搴撳瓨淇℃伅宸插瓨鍦�");
-                }
+                    //鑾峰彇闃荤剨搴撳瓨淇℃伅
+                    Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA154.ToString());
+                    //鑾峰彇搴撳瓨璁板綍
+                    List<Dt_StockInfo> stockInfos = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x =>
+                      x.WarehouseId == warehouse.WarehouseId && x.PalletCode == palletCode).Includes(x => x.Details).ToList();
+                    if (stockInfos.Count > 0)
+                    {
+                        return content.Error($"杞藉叿鎵樼洏宸插瓨鍦�");
+                    }
+                    Dt_StockInfo? stockInfoOld = stockInfos.FirstOrDefault(x => x.Details.Any(x => x.BatchNo == materialLot));
+                    if (stockInfoOld != null)
+                    {
+                        return content.Error($"搴撳瓨淇℃伅宸插瓨鍦�");
+                    }
 
-                Dt_Task task = BaseDal.QueryFirst(x => x.PalletCode == palletCode);
-                if(task != null)
-                {
-                    return content.Error($"鎵樼洏{palletCode}宸茬粡瀛樺湪浠诲姟锛岃鍕块噸澶嶄笅杈�");
+                    Dt_Task task = BaseDal.QueryFirst(x => x.PalletCode == palletCode);
+                    if (task != null)
+                    {
+                        return content.Error($"鎵樼洏{palletCode}宸茬粡瀛樺湪浠诲姟锛岃鍕块噸澶嶄笅杈�");
+                    }
+                    Dt_PalletTypeInfo palletTypeInfo = _palletTypeInfoRepository.QueryFirst(x => x.CodeStartStr == palletType);
+                    if (palletTypeInfo == null)
+                    {
+                        return content.Error($"鎵樼洏绫诲瀷淇℃伅涓嶅瓨鍦�");
+                    }
+                    //鑾峰彇闃荤剨鎵规
+                    WebResponseContent requestLotInfo = GetZHMesMaterialLot(materialLot);
+                    if (!requestLotInfo.Status)
+                    {
+                        return content.Error($"璇锋眰闃荤剨鎵规淇℃伅澶辫触,{requestLotInfo.Message}");
+                    }
+                    MesLotInfoModel mesLotInfo = JsonConvert.DeserializeObject<MesLotInfoModel>(requestLotInfo.Data.ToString());
+                    //MesLotInfoModel mesLotInfo = new MesLotInfoModel()
+                    //{
+                    //    Product="FH001",
+                    //    ProductVersion="A1",
+                    //    Qty=20,
+                    //    LotNo= materialLot,
+                    //    IsFullNumber=true
+                    //};
+                    Dt_StockInfoDetail stockInfoDetail = new Dt_StockInfoDetail()
+                    {
+                        MaterielSpec = mesLotInfo.ProductVersion,
+                        BatchNo = materialLot,
+                        EffectiveDate = mesLotInfo.DateCode ?? " ",
+                        MaterielCode = mesLotInfo.Product,
+                        InboundOrderRowNo = 0,
+                        MaterielName = mesLotInfo.Product,
+                        ProductionDate = mesLotInfo.DateCode ?? " ",
+                        OrderNo = "",
+                        OutboundQuantity = 0,
+                        SerialNumber = materialLot,
+                        StockQuantity = (float)mesLotInfo.Qty,
+                        Status = StockStatusEmun.鍏ュ簱纭.ObjToInt(),
+                        Unit = "Lot",
+                        Remark = mesLotInfo.IsFullNumber ? "婊ot" : "涓嶆弧Lot"
+                    };
+                    Dt_StockInfo stockInfo = new Dt_StockInfo()
+                    {
+                        PalletCode = palletCode,
+                        PalletType = palletTypeInfo.PalletType,
+                        WarehouseId = warehouse.WarehouseId,
+                        StockStatus = StockStatusEmun.鍏ュ簱纭.ObjToInt(),
+                        Details = new List<Dt_StockInfoDetail> { stockInfoDetail }
+                    };
+
+                    //鐢熸垚閫�搴撲换鍔�
+                    Dt_Task taskIn = new()
+                    {
+                        CurrentAddress = "AGV_ZH",
+                        Grade = 0,
+                        PalletCode = palletCode,
+                        NextAddress = "",
+                        Roadway = "SC01_ZH",
+                        SourceAddress = "AGV_ZH",
+                        TargetAddress = "",
+                        TaskStatus = (int)TaskStatusEnum.New,
+                        TaskType = palletTypeInfo.LocaitonCount == 2 ? (int)TaskTypeEnum.InZHProductLarge : (int)TaskTypeEnum.InZHProductSmall,
+                        TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
+                        PalletType = palletTypeInfo.PalletType,
+                        WarehouseId = warehouse.WarehouseId,
+                        MaterielCode = mesLotInfo.Product,
+                        Quantity = (float)mesLotInfo.Qty,
+                        BatchNo = mesLotInfo.LotNo
+                    };
+                    _unitOfWorkManage.BeginTran();
+                    Db.InsertNav(stockInfo).Include(x => x.Details).ExecuteCommand();
+                    BaseDal.AddData(taskIn);
+                    //BaseDal.AddData(task);
+                    _unitOfWorkManage.CommitTran();
+                    //灏嗕换鍔℃帹閫佸埌WCS
+                    PushTasksToWCS(new List<Dt_Task>() { taskIn }, "AGV_ZH", agvTaskCode);
+                    content.OK(data: taskIn);
                 }
-                Dt_PalletTypeInfo palletTypeInfo = _palletTypeInfoRepository.QueryFirst(x=>x.CodeStartStr== palletType);
-                if (palletTypeInfo == null)
+                catch (Exception ex)
                 {
-                    return content.Error($"鎵樼洏绫诲瀷淇℃伅涓嶅瓨鍦�");
+                    _unitOfWorkManage.RollbackTran();
+                    content.Error(ex.Message);
                 }
-                //鑾峰彇闃荤剨鎵规
-                WebResponseContent requestLotInfo = GetZHMesMaterialLot(materialLot);
-                if (!requestLotInfo.Status)
-                {
-                    return content.Error($"璇锋眰闃荤剨鎵规淇℃伅澶辫触,{requestLotInfo.Message}");
-                }
-                MesLotInfoModel mesLotInfo = JsonConvert.DeserializeObject<MesLotInfoModel>(requestLotInfo.Data.ToString());
-                //MesLotInfoModel mesLotInfo = new MesLotInfoModel()
-                //{
-                //    Product="FH001",
-                //    ProductVersion="A1",
-                //    Qty=20,
-                //    LotNo= materialLot,
-                //    IsFullNumber=true
-                //};
-                Dt_StockInfoDetail stockInfoDetail = new Dt_StockInfoDetail()
-                {
-                    MaterielSpec = mesLotInfo.ProductVersion,
-                    BatchNo = materialLot,
-                    EffectiveDate = mesLotInfo.DateCode ?? " ",
-                    MaterielCode = mesLotInfo.Product,
-                    InboundOrderRowNo =  0,
-                    MaterielName = mesLotInfo.Product,
-                    ProductionDate = mesLotInfo.DateCode ?? " ",
-                    OrderNo = "",
-                    OutboundQuantity = 0,
-                    SerialNumber = materialLot,
-                    StockQuantity = (float)mesLotInfo.Qty,
-                    Status = StockStatusEmun.鍏ュ簱纭.ObjToInt(),
-                    Unit = "Lot",
-                    Remark= mesLotInfo.IsFullNumber?"婊ot":"涓嶆弧Lot"
-                };
-                Dt_StockInfo stockInfo = new Dt_StockInfo()
-                {
-                    PalletCode = palletCode,
-                    PalletType = palletTypeInfo.PalletType,
-                    WarehouseId = warehouse.WarehouseId,
-                    StockStatus = StockStatusEmun.鍏ュ簱纭.ObjToInt(),
-                    Details = new List<Dt_StockInfoDetail> { stockInfoDetail }
-                };
-                
-                //鐢熸垚閫�搴撲换鍔�
-                Dt_Task taskIn = new()
-                {
-                    CurrentAddress = "AGV_ZH",
-                    Grade = 0,
-                    PalletCode = palletCode,
-                    NextAddress = "",
-                    Roadway = "SC01_ZH",
-                    SourceAddress = "AGV_ZH",
-                    TargetAddress = "",
-                    TaskStatus = (int)TaskStatusEnum.New,
-                    TaskType = palletTypeInfo.LocaitonCount==2? (int)TaskTypeEnum.InZHProductLarge : (int)TaskTypeEnum.InZHProductSmall,
-                    TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
-                    PalletType = palletTypeInfo.PalletType,
-                    WarehouseId = warehouse.WarehouseId,
-                    MaterielCode = mesLotInfo.Product,
-                    Quantity = (float)mesLotInfo.Qty,
-                    BatchNo = mesLotInfo.LotNo
-                };
-                _unitOfWorkManage.BeginTran();
-                Db.InsertNav(stockInfo).Include(x => x.Details).ExecuteCommand();
-                BaseDal.AddData(taskIn);
-                //BaseDal.AddData(task);
-                _unitOfWorkManage.CommitTran();
-                //灏嗕换鍔℃帹閫佸埌WCS
-                PushTasksToWCS(new List<Dt_Task>() { taskIn }, "AGV_ZH", agvTaskCode);
-                content.OK(data: taskIn);
+                return content;
             }
-            catch (Exception ex)
-            {
-                _unitOfWorkManage.RollbackTran();
-                content.Error(ex.Message);
-            }
-            return content;
+            
         }
 
         public readonly string[] OutStartPonits = { "5230", "5237", "5244" };

--
Gitblit v1.9.3