From bfcd7f5b405e431a5c07fe3fa77d74c892d4e66b Mon Sep 17 00:00:00 2001
From: xiazhengtongxue <133085197+xiazhengtongxue@users.noreply.github.com>
Date: 星期四, 19 三月 2026 15:52:42 +0800
Subject: [PATCH] fix: 修复出入库冲突拦截,系统位置与实际位置的映射和修复

---
 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs |   46 +++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 43 insertions(+), 3 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
index 4810da6..c5d251a 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
@@ -504,6 +504,8 @@
                         MES_parameter mES_Parameter = AbnormalStorageLocation(task.PalletCode, task.SourceAddress, task.TargetAddress);
                         if (mES_Parameter.Result == "Y")
                         {
+                            Dt_Task dtOutWit=BaseDal.QueryData(x=>x.PalletCode==task.PalletCode && x.TaskStatus== (int)OutTaskStatusEnum.OutWait).FirstOrDefault();
+
                             Dt_LocationInfo OriginalLocation = _locationInfoService.Repository.QueryData(x => x.LocationCode == task.SourceAddress).FirstOrDefault();
                             Dt_LocationInfo NewLocation = _locationInfoService.Repository.QueryData(x => x.LocationCode == task.TargetAddress).FirstOrDefault();
                             Dt_StockInfo dt_StockInfo = _stockInfoService.Repository.QueryData(x => x.LocationCode == task.SourceAddress).FirstOrDefault();
@@ -511,15 +513,27 @@
                             List<Dt_LocationInfo> dt_Locations = new List<Dt_LocationInfo>();
 
                             OriginalLocation.LocationStatus = (int)LocationStatusEnum.Free;
-                            NewLocation.LocationStatus = (int)LocationStatusEnum.InStock;
+                            NewLocation.LocationStatus = dtOutWit != null? (int)LocationStatusEnum.Lock:(int)LocationStatusEnum.InStock;
                             dt_StockInfo.LocationCode = NewLocation.LocationCode;
-                            dt_StockInfo.StockStatus = (int)StockStatusEmun.宸插叆搴�;
+                            dt_StockInfo.StockStatus = dtOutWit != null? (int)StockStatusEmun.鍑哄簱涓�:(int)StockStatusEmun.宸插叆搴�;
                             task.TaskStatus = (int)RelocationTaskStatusEnum.RelocationFinish;
+
+                            if(dtOutWit != null)
+                            {
+                                dtOutWit.TaskStatus = (int)OutTaskStatusEnum.OutNew;
+                                dtOutWit.SourceAddress = NewLocation.LocationCode;
+                                dtOutWit.CurrentAddress = NewLocation.LocationCode;
+                            }
+                            
+
+
 
                             dt_Locations.Add(OriginalLocation);
                             dt_Locations.Add(NewLocation);
 
                             _unitOfWorkManage.BeginTran();
+                            if(dtOutWit!=null) BaseDal.UpdateData(dtOutWit);
+
                             _locationInfoService.UpdateData(dt_Locations);
                             _stockInfoService.UpdateData(dt_StockInfo);
                             BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.鑷姩瀹屾垚 : OperateTypeEnum.浜哄伐瀹屾垚);
@@ -741,7 +755,8 @@
                             TaskNum = t.TaskId,
                             TaskType = t.TaskType,
                             CreateDate = t.CreateDate,
-                            TaskStatus = t.TaskStatus
+                            TaskStatus = t.TaskStatus,
+                            TargetAddress = t.TargetAddress
                         })
                         .ToList();
             return WebResponseContent.Instance.OK("鎴愬姛", tasks);
@@ -754,5 +769,30 @@
             /// </summary>
             return _task_HtyService.GetWarehouseOperationStatistics();
         }
+
+        public WebResponseContent GetTaskDestination(string targetAddress)
+        {
+            WebResponseContent content = new WebResponseContent();
+            // 鍙傛暟鏍¢獙
+            if (string.IsNullOrWhiteSpace(targetAddress))
+            {
+                return content.Error("鐩爣鍦板潃涓嶈兘涓虹┖");
+            }
+            try
+            {
+                // 鏌ヨ鏁版嵁
+                var queryResult = BaseDal.QueryData(x => x.TargetAddress == targetAddress);
+                // 鍒ゆ柇鏌ヨ缁撴灉
+                if (queryResult == null || !queryResult.Any())
+                {
+                    return content.Error($"鏈壘鍒扮洰鏍囧湴鍧�涓篬{targetAddress}]鐨勪换鍔�");
+                }
+                return content.OK($"鏈夌洰鏍囧湴鍧�涓篬{targetAddress}]鐨勪换鍔★紝璇锋嫤鎴�");
+            }
+            catch (Exception ex)
+            {
+                return content.Error($"鑾峰彇浠诲姟鐩殑鍦板け璐�: {ex.Message}");
+            }
+        }
     }
 }

--
Gitblit v1.9.3