From 644cbe3e4eba765affa25454d69fee6286bb6094 Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com>
Date: 星期四, 30 十月 2025 13:06:35 +0800
Subject: [PATCH] 1

---
 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs |   56 ++++++++++++++++++++++++++++++++++----------------------
 1 files changed, 34 insertions(+), 22 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs"
index be50ff1..472a077 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs"
@@ -110,8 +110,15 @@
             var result1 = UpdateLocationStatus(locationStart, LocationEnum.Free, task.TaskNum.Value, (int)StatusChangeTypeEnum.AutomaticOutbound);
             var result2 = UpdateLocationStatus(locationEnd, LocationEnum.InStock, task.TaskNum.Value, (int)StatusChangeTypeEnum.AutomaticOutbound);
             DtStockInfo_Hty stockInfo_Hty = stock.Adapt<DtStockInfo_Hty>();
-            //鐩樼偣鍑哄簱
             var orderDetails = _orderOutDetailsRepository.QueryData(x => x.PalletCode == task.PalletCode);
+            List<Dt_OrderOutDetails_Hty> orderdetailshtys = new List<Dt_OrderOutDetails_Hty>();
+
+            orderDetails.ForEach(item =>
+            {
+                orderdetailshtys.Add(item.Adapt<Dt_OrderOutDetails_Hty>());
+            });
+            //鐩樼偣鍑哄簱
+            
             if (task.TaskType == (int)TaskOutboundTypeEnum.Outbound || task.TaskType == (int)TaskOutboundTypeEnum.OutAllocate)
             {
                 if (orderDetails.Count > 0)
@@ -138,7 +145,11 @@
                 await _locationStatusChangeRecordRepository.AddDataAsync(result2.Item1);
                 await _locationRepository.UpdateDataAsync(result1.Item2);
                 await _locationRepository.UpdateDataAsync(result2.Item2);
+                await _orderOutDetailsRepository.DeleteDataAsync(orderDetails);
+                await SqlSugarHelper.DbWMS.Insertable(orderdetailshtys).ExecuteCommandAsync();
+
                 //_orderOutDetailsRepository.DeleteAndMoveIntoHty(orderDetails,OperateTypeEnum.鑷姩鍒犻櫎);
+
                 await DeleteTaskAsync(task.TaskId);
                 await AddTaskHtyAsync(taskHty);
             });
@@ -169,7 +180,7 @@
             var locationStart = await _locationRepository.QueryFirstAsync(x => x.LocationCode == task.SourceAddress);
             var locationEnd = await _locationRepository.QueryFirstAsync(x => x.LocationCode == task.TargetAddress);
 
-            task.TaskState = (int)TaskOutStatusEnum.OutFinish;
+            task.TaskState = (int)TaskRelocationStatusEnum.AGV_RelocationFinish;
             var taskHty = task.Adapt<Dt_Task_Hty>();
             taskHty.FinishTime = DateTime.Now;
             taskHty.OperateType = App.User.UserName != null ? (int)OperateTypeEnum.浜哄伐瀹屾垚 : (int)OperateTypeEnum.鑷姩瀹屾垚;
@@ -180,7 +191,6 @@
             var result = UpdateLocationStatus(locationEnd, LocationEnum.InStock, task.TaskNum.Value, (int)StatusChangeTypeEnum.AutomaticRelocation);
             await _unitOfWorkManage.UseTranAsync(async () =>
             {
-                //UpdateLocationStatus(locationStart, LocationEnum.Free, task.TaskNum.Value, (int)StatusChangeTypeEnum.AutomaticInbound);
                 await _locationStatusChangeRecordRepository.AddDataAsync(result.Item1);
                 await _locationRepository.UpdateDataAsync(result.Item2);
                 _stockInfoRepository.UpdateData(stock);
@@ -687,8 +697,8 @@
                     MaterielName = x.MaterielName,
                     AllocateWarehouse = "WMS鍑哄簱缂撳瓨鍖�",
                     Warehouse = "鏅鸿兘绔嬪簱",
-                    WareHouseId = "1001708040006492",
-                    AllocateWarehouseId = "1002008120000270",
+                    WareHouseId = "107",
+                    AllocateWarehouseId = "205",
                     OutboundQuantity = x.Quantity,
                 });
             });
@@ -1043,7 +1053,7 @@
                     MaterialNo = "",
                     NextAddress = TargetAddress.LocationCode,
                     OrderNo = null,
-                    PalletCode = taskDto.PalletCode + "001",
+                    PalletCode = stock.PalletCode,
                     SourceAddress = locationLateral.LocationCode,
                     CurrentAddress = locationLateral.LocationCode,
                     TaskState = (int)TaskRelocationStatusEnum.RelocationNew,
@@ -1331,15 +1341,13 @@
                     //鐗╂枡缂栫爜
                     ItemCode = item.MaterielCode,
                     //璋冨叆浠撳簱鍦板潃
-                    TransInWHCode = "1001708040006492",
+                    TransInWHCode = "107",
                     //璋冨叆鏁伴噺
-                    TransInQty = item.OutboundQuantity,
+                    TransInQty = item.Quantity,
                     // 璋冨嚭浠撳簱缂栫爜
                     TransOutWHCode = item.WareHouseId,
                 }).ToList()
             };
-            //var inputJson = Masuit.Tools.ObjectExtensions.ToDictionary(allocate);
-
             var Allocate = GetERPIPAddress(SysConfigConst.ERPIPAddress, SysConfigConst.Allocate);
             // 鍙戦�佽姹傚苟绛夊緟鍝嶅簲
             var result = await HttpsClient.PostAsync(Allocate, allocate.ToJsonString());
@@ -1363,6 +1371,21 @@
         WebResponseContent content = new WebResponseContent();
         try
         {
+            List<transferInList> transferInList=new List<transferInList>();
+            orderOutDetails.ForEach(x =>
+            {
+                transferInList.Add(new transferInList
+                {
+                    //鐗╂枡缂栫爜
+                    ItemCode = x.MaterielCode,
+                    //璋冨叆浠撳簱鍦板潃
+                    TransInWHCode = x.AllocateWarehouseId,
+                    //璋冨叆鏁伴噺
+                    TransInQty = x.OutboundQuantity,
+                    // 璋冨嚭浠撳簱缂栫爜
+                    TransOutWHCode = x.WareHouseId,
+                });
+            });
             Allocate allocate = new Allocate
             {
                 context = new Context
@@ -1375,18 +1398,7 @@
                 documentTypeCode = "TransIn002",
                 businessDate = DateTime.Now.ToString("yyyy-MM-dd"),
                 isApproved = true,
-
-                transferInList = orderOutDetails.Select(item => new transferInList
-                {
-                    //鐗╂枡缂栫爜
-                    ItemCode = item.MaterielCode,
-                    //璋冨叆浠撳簱鍦板潃
-                    TransInWHCode = item.AllocateWarehouseId,
-                    //璋冨叆鏁伴噺
-                    TransInQty = item.OutboundQuantity,
-                    // 璋冨嚭浠撳簱缂栫爜
-                    TransOutWHCode = item.WareHouseId,
-                }).ToList()
+                transferInList = transferInList,
             };
             var Allocate = GetERPIPAddress(SysConfigConst.ERPIPAddress, SysConfigConst.Allocate);
             // 鍙戦�佽姹傚苟绛夊緟鍝嶅簲

--
Gitblit v1.9.3