From c05003c73bbe527478bccc55efe25c19068b6f50 Mon Sep 17 00:00:00 2001
From: Huangxiaoqiang-03 <1247017146@qq.com>
Date: 星期三, 23 十月 2024 17:30:42 +0800
Subject: [PATCH] 1

---
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Outbound.cs |   81 +++++++++++++++++++++++++++++++++++++++-
 1 files changed, 79 insertions(+), 2 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Outbound.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Outbound.cs"
index 4bb2787..c2e9e87 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Outbound.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Outbound.cs"
@@ -148,7 +148,11 @@
             try
             {
                 _unitOfWorkManage.BeginTran();
-
+                //鍒ゆ柇绉诲簱
+                /*List<Dt_Task> RelocationTasks = */
+                RelocationTask(tasks);
+                //BaseDal.AddData(RelocationTasks);
+                
                 BaseDal.AddData(tasks);
                 if (stockInfos != null && outboundOrderDetails != null && outStockLockInfos != null && locationInfos != null)
                 {
@@ -182,6 +186,73 @@
                 return WebResponseContent.Instance.Error(ex.Message);
             }
 
+        }
+        /// <summary>
+        /// 绉诲簱浠诲姟
+        /// </summary>
+        /// <param name="task"></param>
+        /// <returns></returns>
+        public WebResponseContent RelocationTask(List<Dt_Task> task)
+        {
+            WebResponseContent content = new WebResponseContent();
+            try
+            {
+                for (int i = 0; i < task.Count; i++)
+                {
+                    Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task[i].SourceAddress && x.RoadwayNo == task[i].Roadway);
+                    if (locationInfo != null)
+                    {
+                        Dt_LocationInfo location = _basicService.LocationInfoService.isDepth(locationInfo);
+                        if (location != null)
+                        {
+                            Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.QueryFirst(x => x.LocationCode == location.LocationCode);
+                            if (stockInfo != null && location.LocationStatus == LocationStatusEnum.InStock.ObjToInt())
+                            {
+                                Dt_LocationInfo? locationInfos = _basicService.LocationInfoService.AssignLocation(location.RoadwayNo);
+                                if(locationInfos != null)
+                                {
+                                    Dt_Task tasks = new()
+                                    {
+                                        CurrentAddress = location.LocationCode,
+                                        Grade = 0,
+                                        PalletCode = stockInfo.PalletCode,
+                                        NextAddress = locationInfos.LocationCode,
+                                        Roadway = location.RoadwayNo,
+                                        SourceAddress = location.LocationCode,
+                                        TargetAddress = locationInfos.LocationCode,
+                                        TaskStatus = InTaskStatusEnum.RelocationNew.ObjToInt(),
+                                        TaskType = TaskTypeEnum.Relocation.ObjToInt(),
+                                        TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum))
+                                    };
+                                    BaseDal.AddData(tasks);
+                                    stockInfo.StockStatus = StockStatusEmun.绉诲簱閿佸畾.ObjToInt();
+                                    _stockService.StockInfoService.UpdateData(stockInfo);
+                                    _basicService.LocationInfoService.RelocationLock(location, locationInfos,tasks.TaskNum);
+                                }
+                                else
+                                {
+                                    return content = WebResponseContent.Instance.Error("鏈壘鍒板彲鍒嗛厤璐т綅");
+                                }
+                            }
+                            else
+                            {
+                                return content = WebResponseContent.Instance.Error("鏈壘鍒板簱瀛樹俊鎭�");
+                            }
+                        }
+                    }
+                    else
+                    {
+                        return content = WebResponseContent.Instance.Error("浠诲姟淇℃伅寮傚父");
+                    }
+
+                }
+            }
+            catch (Exception ex)
+            {
+                return content = WebResponseContent.Instance.Error(ex.Message);
+            }
+            
+            return content;
         }
 
         /// <summary>
@@ -270,11 +341,17 @@
                     TaskStatus = OutTaskStatusEnum.OutNew.ObjToInt(),
                     TaskType = TaskTypeEnum.PalletOutbound.ObjToInt(),
                 };
-
+                int beforeStatus = locationInfo.LocationStatus;
                 _unitOfWorkManage.BeginTran();
                 stockInfo.StockStatus = StockStatusEmun.鍑哄簱閿佸畾.ObjToInt();
                 locationInfo.LocationStatus = LocationStatusEnum.Lock.ObjToInt();
                 BaseDal.AddData(task);
+                _stockService.StockInfoService.UpdateData(stockInfo);
+
+                _basicService.LocationInfoService.UpdateLocationLock(locationInfo, task.TaskNum);
+
+                _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Relocation.ObjToInt(), "", task.TaskNum);
+
                 _unitOfWorkManage.CommitTran();
                 return WebResponseContent.Instance.OK();
             }

--
Gitblit v1.9.3