From fdf7bb595ee00e5fef7b4e110fbe32f637c069f6 Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期一, 18 八月 2025 08:38:46 +0800
Subject: [PATCH] 1

---
 项目代码/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Reloaction.cs |   82 +++++++++++++++++++++++++---------------
 1 files changed, 51 insertions(+), 31 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Reloaction.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Reloaction.cs"
index 6bbdb17..10f4bb0 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Reloaction.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Reloaction.cs"
@@ -8,8 +8,10 @@
 using WIDESEA_Common.OtherEnum;
 using WIDESEA_Common.StockEnum;
 using WIDESEA_Common.TaskEnum;
+using WIDESEA_Common.WareHouseEnum;
 using WIDESEA_Core;
 using WIDESEA_Core.Helper;
+using WIDESEA_DTO.Basic;
 using WIDESEA_DTO.Task;
 using WIDESEA_Model.Models;
 
@@ -126,37 +128,6 @@
                 return WebResponseContent.Instance.Error(ex.Message);
             }
         }
-        public WebResponseContent InboundTaskCompleted(Dt_Task task)
-        {
-            try
-            {
-                Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.QueryFirst(x => x.PalletCode == task.PalletCode);
-                if (stockInfo == null)
-                {
-                    return WebResponseContent.Instance.Error($"鏈壘鍒板搴斿簱瀛樹俊鎭�");
-                }
-                Dt_LocationInfo locationInfoEnd = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.TargetAddress);
-                if (locationInfoEnd == null)
-                {
-                    return WebResponseContent.Instance.Error($"鏈壘鍒板搴旂殑缁堢偣璐т綅淇℃伅");
-                }
-                task.TaskStatus = TaskStatusEnum.Finish.ObjToInt();
-                FeedBackWCSTaskCompleted(task.TaskNum);
-                _unitOfWorkManage.BeginTran();
-                stockInfo.LocationCode = locationInfoEnd.LocationCode;
-                stockInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
-                _stockService.StockInfoService.Repository.UpdateData(stockInfo);
-                _basicService.LocationInfoService.UpdateLocationStatus(locationInfoEnd, stockInfo.PalletType, LocationStatusEnum.InStock, stockInfo.WarehouseId);
-                BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId > 0 ? WIDESEA_Core.Enums.OperateTypeEnum.浜哄伐瀹屾垚 : WIDESEA_Core.Enums.OperateTypeEnum.鑷姩瀹屾垚);
-                _unitOfWorkManage.CommitTran();
-                return WebResponseContent.Instance.OK();
-            }
-            catch (Exception ex)
-            {
-                _unitOfWorkManage.RollbackTran();
-                return WebResponseContent.Instance.Error(ex.Message);
-            }
-        }
         public WebResponseContent RelocationTaskCompleted(Dt_Task task)
         {
             try
@@ -196,5 +167,54 @@
                 return WebResponseContent.Instance.Error(ex.Message);
             }
         }
+        public WebResponseContent IsRelocation(string startAddress,string endAddress,string roadWay)
+        {
+            WebResponseContent content = new WebResponseContent();
+            try
+            {
+                //鑾峰彇璐т綅
+                Dt_LocationInfo startLocationInfo = _basicRepository.LocationInfoRepository.QueryFirst(x => x.LocationCode == startAddress);
+                Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.QueryFirst(x => x.LocationCode == startAddress);
+                Dt_LocationInfo endLocationInfo = _basicRepository.LocationInfoRepository.QueryFirst(x => x.LocationCode == endAddress);
+                if (startLocationInfo != null && startLocationInfo.LocationStatus==LocationStatusEnum.InStock.ObjToInt() && endLocationInfo != null && endLocationInfo.LocationStatus==LocationStatusEnum.Free.ObjToInt() && endLocationInfo.EnableStatus==EnableStatusEnum.Normal.ObjToInt() && stockInfo!=null)
+                {
+                    Dt_Task newTask = new Dt_Task()
+                    {
+                        Roadway = roadWay,
+                        WarehouseId = stockInfo.WarehouseId,
+                        CurrentAddress = startLocationInfo.LocationCode,
+                        Grade = 99,
+                        NextAddress = endLocationInfo.LocationCode,
+                        OrderNo = "",
+                        PalletCode = stockInfo.PalletCode,
+                        PalletType = stockInfo.PalletType,
+                        SourceAddress = startLocationInfo.LocationCode,
+                        TargetAddress = endLocationInfo.LocationCode,
+                        TaskNum = Repository.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
+                        TaskStatus = 0,
+                        TaskType = TaskTypeEnum.Relocation.ObjToInt()
+                    };
+                    stockInfo.StockStatus = StockStatusEmun.绉诲簱閿佸畾.ObjToInt();
+                    _unitOfWorkManage.BeginTran();
+                    Repository.AddData(newTask);
+                    _basicService.LocationInfoService.UpdateLocationStatus(startLocationInfo, stockInfo.PalletType, LocationStatusEnum.Lock, stockInfo.WarehouseId);
+                    _basicService.LocationInfoService.UpdateLocationStatus(endLocationInfo, stockInfo.PalletType, LocationStatusEnum.Lock, stockInfo.WarehouseId);
+                    _stockService.StockInfoService.Repository.UpdateData(stockInfo);
+                    _unitOfWorkManage.CommitTran();
+                    PushTasksToWCS(new List<Dt_Task> { newTask });
+                    content.OK("鎴愬姛");
+                }
+                else
+                {
+                    content.Error("搴撳瓨璐т綅淇℃伅涓虹┖");
+                }
+            }
+            catch (Exception ex)
+            {
+                _unitOfWorkManage.RollbackTran();
+                content.Error(ex.Message);
+            }
+            return content;
+        }
     }
 }

--
Gitblit v1.9.3