From 5336bfc54525253a30f1f8238806d3a67f388e14 Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期五, 21 十一月 2025 15:12:03 +0800
Subject: [PATCH] 优化接口,增加字段等

---
 项目代码/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Outbound.cs |   52 ++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 50 insertions(+), 2 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Outbound.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Outbound.cs"
index d06a1c4..bc8997a 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Outbound.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Outbound.cs"
@@ -25,6 +25,7 @@
 using WIDESEA_DTO.MES;
 using WIDESEA_DTO.Outbound;
 using Microsoft.IdentityModel.Tokens;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup;
 
 namespace WIDESEA_TaskInfoService
 {
@@ -189,7 +190,22 @@
                                 x.Status=OutLockStockStatusEnum.鍑哄簱瀹屾垚.ObjToInt();
                             });
                             _outboundRepository.OutStockLockInfoRepository.UpdateData(outStockLockInfos);
-                            _outboundService.OutLineViewService.SaveLineView(outStockLockInfos);
+                            List<Dt_OutStockLockInfo> outStockLockInfosSG = outStockLockInfos.Where(x => x.OrderType == OutOrderTypeEnum.OutSGPick.ObjToInt()).ToList();
+                            List<Dt_OutStockLockInfo> outStockLockInfosMES = outStockLockInfos.Where(x => x.OrderType == OutOrderTypeEnum.OutMESPick.ObjToInt()).ToList();
+                            if (outStockLockInfosSG !=null && outStockLockInfosSG.Count()>0)
+                            {
+                                _outboundService.OutLineViewService.SaveLineView(outStockLockInfosSG);
+                            }
+                            if (outStockLockInfosMES != null && outStockLockInfosMES.Count() > 0)
+                            {
+                                Dt_AGVStationInfo aGVStationInfo = _basicRepository.AGVStationInfoRepository.QueryFirst(x=>x.AGVStationCode==task.TargetAddress);
+                                MESDeliveryModel mESDeliveryModel = MESDeliveryUp(outStockLockInfosMES, aGVStationInfo.MESPointCode);
+                                MESResponse response = _invokeMESService.MESDelivery(mESDeliveryModel).DeserializeObject<MESResponse>() ?? throw new Exception("鏈幏鍙栧埌杩斿洖淇℃伅");
+                                if (!response.Result)
+                                {
+                                    throw new Exception($"MES閰嶉�佸嚭鍙戞帴鍙h皟鐢ㄦ姤閿�,MES杩斿洖淇℃伅{DecodeUnicode(response.Msg)}");
+                                }
+                            }
                         }
                         _basicService.LocationInfoService.UpdateLocationStatus(locationInfoStart, stockInfo.PalletType, LocationStatusEnum.Free, stockInfo.WarehouseId);
                         BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId > 0 ? OperateTypeEnum.浜哄伐瀹屾垚 : OperateTypeEnum.鑷姩瀹屾垚);
@@ -207,6 +223,34 @@
                 _unitOfWorkManage.RollbackTran();
                 return content.Error(ex.Message);
             }
+        }
+        /// <summary>
+        /// 閰嶉�侀�佽揪淇℃伅
+        /// </summary>
+        /// <returns></returns>
+        public MESDeliveryModel MESDeliveryUp(List<Dt_OutStockLockInfo> outStockLockInfos,string address)
+        {
+            MESDeliveryModel mESDeliveryModel = new MESDeliveryModel()
+            {
+                PRO_DispatchPlanMaterialsInfoNew= new List<MESDeliveryInfo>()
+            };
+            foreach (var item in outStockLockInfos)
+            {
+                MESDeliveryInfo mESDeliveryInfo = new MESDeliveryInfo()
+                {
+                    InvItemCode=item.MaterielCode,
+                    DispatchPlanMaterialId=item.OrderDetailId,
+                    UnitCode=item.Unit,
+                    GradeCode="001",
+                    MainQuantity=item.AssignQuantity,
+                    AssistUnitCode=item.AssistUnit,
+                    LocationCode= address,
+                    LotNumber=item.BatchNo,
+                    MaterialBarCode=item.PalletCode
+                };
+                mESDeliveryModel.PRO_DispatchPlanMaterialsInfoNew.Add(mESDeliveryInfo);
+            }
+            return mESDeliveryModel;
         }
         /// <summary>
         /// 搴撳瓨鏁版嵁杞嚭搴撲换鍔�(鍘熸枡/鍗婃垚鍝�)
@@ -294,7 +338,9 @@
                             MaterielCode = stockInfo.MaterielCode,
                             RfidCode = stockInfo.RfidCode,
                             Quantity = stockInfo.StockLength,
-                            OrderNo= outStockLockInfo.OrderNo
+                            OrderNo= outStockLockInfo.OrderNo,
+                            DispatchPlanId=outStockLockInfo.OrderDetailId,
+                            WorkCentreCode=outStockLockInfo.MakeCode
                         };
                         if (stockInfo.MaterielWide > 0)
                         {
@@ -842,6 +888,8 @@
                     Dt_MakeCenterInfo makeCenterInfo=makeCenterInfos.FirstOrDefault(x => x.MakeCode == item.MakeCode);
                     item.MakeArea = makeCenterInfo.MakeArea;
                     item.WarehouseId = materielInfo.WarehouseId;
+                    item.MaterielUnit = materielInfo.MaterielUnit;
+                    item.AssistUnitCode = materielInfo.AssistUnitCode;
                 }
                 
                 _unitOfWorkManage.BeginTran();

--
Gitblit v1.9.3