From 4fc31b41c205507607c91ab3afe10fbc06a9aa09 Mon Sep 17 00:00:00 2001
From: yangpeixing <yangpeixing@hnkhzn.com>
Date: 星期五, 05 十二月 2025 13:52:15 +0800
Subject: [PATCH] 1.添加启动提升机、停止提升机、复位提升机功能 2.优化初始化提升机功能

---
 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs |   53 +++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 49 insertions(+), 4 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 0f8583e..2d9ccaa 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"
@@ -17,6 +17,7 @@
 using System.Reflection;
 using System.Reflection.Metadata;
 using System.Security.Policy;
+using System.Text;
 using System.Text.RegularExpressions;
 using System.Threading.Tasks;
 using WIDESEA_Cache;
@@ -508,6 +509,7 @@
                 case 4:
                 case 5:
                 case 6:
+                case 7:
                     taskNew = InboundAGVCacheArea(taskDto, StartAddress, area);
                     break;
                 default:
@@ -519,6 +521,12 @@
 
             await _unitOfWorkManage.UseTranAsync(async () =>
             {
+                if (taskDto.AreaId == 3 || taskDto.AreaId == 7)
+                {
+                    var result2 = UpdateLocationStatus(taskNew.TargetAddress, LocationEnum.Lock, taskNew.TaskNum.Value, (int)StatusChangeTypeEnum.AutomaticInbound);
+                    await _locationStatusChangeRecordRepository.AddDataAsync(result2.Item1);
+                    await _locationRepository.UpdateDataAsync(result2.Item2);
+                }
                 await _locationStatusChangeRecordRepository.AddDataAsync(result.Item1);
                 await _locationRepository.UpdateDataAsync(result.Item2);
                 BaseDal.AddData(taskNew);
@@ -657,7 +665,7 @@
             });
 
             var taskDto = CreateListTaskDTO(taskNew);
-            var result = GetlcoationState(taskNew, StatusChangeTypeEnum.AutomaticOutbound);
+            var result = GetlcoationState(taskNew, StatusChangeTypeEnum.AutomaticOutbound, location);
             await _unitOfWorkManage.UseTranAsync(async () =>
             {
                 await BaseDal.AddDataAsync(taskNew);
@@ -732,7 +740,7 @@
             stock.StockInfoDetails = details;
 
             var taskDto = CreateListTaskDTO(taskNew);
-            var result = GetlcoationState(taskNew, StatusChangeTypeEnum.AutomaticOutbound);
+            var result = GetlcoationState(taskNew, StatusChangeTypeEnum.AutomaticOutbound, stock.LocationInfo);
             await _unitOfWorkManage.UseTranAsync(async () =>
             {
                 await BaseDal.AddDataAsync(taskNew);
@@ -815,7 +823,7 @@
             stock.StockInfoDetails = details;
 
             var taskDto = CreateListTaskDTO(taskNew);
-            var result = GetlcoationState(taskNew, StatusChangeTypeEnum.AutomaticOutbound);
+            var result = GetlcoationState(taskNew, StatusChangeTypeEnum.AutomaticOutbound, stock.LocationInfo);
             await _unitOfWorkManage.UseTranAsync(async () =>
             {
                 await BaseDal.AddDataAsync(taskNew);
@@ -832,13 +840,20 @@
         }
     }
 
-    public (List<DtLocationStatusChangeRecord>,List<DtLocationInfo>) GetlcoationState(Dt_Task task, StatusChangeTypeEnum StatusChangeTypeEnum)
+    public (List<DtLocationStatusChangeRecord>,List<DtLocationInfo>) GetlcoationState(Dt_Task task, StatusChangeTypeEnum StatusChangeTypeEnum, DtLocationInfo location)
     {
         List<DtLocationStatusChangeRecord> locationStatusChangeRecords = new List<DtLocationStatusChangeRecord>();
         List<DtLocationInfo> locations = new List<DtLocationInfo>();
         var result = UpdateLocationStatus(task.SourceAddress, LocationEnum.InStockDisable, task.TaskNum.Value, (int)StatusChangeTypeEnum);
         locationStatusChangeRecords.AddRange(result.Item1);
         locations.AddRange(result.Item2);
+
+        if(location.AreaId ==3|| location.AreaId == 7)
+        {
+            var result2 = UpdateLocationStatus(task.TargetAddress, LocationEnum.Lock, task.TaskNum.Value, (int)StatusChangeTypeEnum);
+            locationStatusChangeRecords.AddRange(result2.Item1);
+            locations.AddRange(result2.Item2);
+        }
 
         return (locationStatusChangeRecords,locations);
     }
@@ -886,6 +901,7 @@
             case 4:
             case 5:
             case 6:
+            case 7:
                 return OutboundAGVCacheArea(taskDto, StartAddress, area);
             default:
                 throw new Exception("璇烽�夋嫨姝g‘鐨勫尯鍩熶俊鎭�");
@@ -1244,6 +1260,7 @@
             switch (location.AreaId)
             {
                 case 2:
+                case 7:
                     locationInfos = _locationRepository.QueryData(x => x.Row == location.Row && x.Column > location.Column && x.Remark == location.Remark && x.AreaId == location.AreaId);
                     break;
                 case 5:
@@ -1379,6 +1396,7 @@
                 case 4:
                 case 5:
                 case 6:
+                case 7:
                     locationInfo = await GetAGVEmptyCacheLocation(areaInfo.AreaID, location);
                     break;
                 default:
@@ -1984,6 +2002,32 @@
         return (changeRecordDto, locations);
     }
 
+    public (DtLocationStatusChangeRecord, DtLocationInfo) UpdateEndLocationStatus(string locationCode, LocationEnum locationStatus, int taskNum, StatusChangeTypeEnum StatusChangeType)
+    {
+        var location = _locationRepository.QueryFirst(x => x.LocationCode == locationCode);
+
+        if (location != null && (location.AreaId == 3 || location.AreaId == 7))
+        {
+            int Beforelocation = location.LocationStatus;
+
+            location.LocationStatus = (int)locationStatus;
+
+            DtLocationStatusChangeRecord dtLocationStatusChangeRecord = new DtLocationStatusChangeRecord()
+            {
+                ChangeType = (int)StatusChangeType,
+                LocationCode = locationCode,
+                LocationId = location.Id,
+                Creater = "System",
+                TaskNum = taskNum,
+                AfterStatus = location.LocationStatus,
+                BeforeStatus = Beforelocation,
+            };
+
+            return (dtLocationStatusChangeRecord, location);
+        }
+        return (null, null);
+    }
+
     public (DtLocationStatusChangeRecord, DtLocationInfo) UpdateLocationStatus(string locationCode, LocationEnum locationStatus, int taskNum, StatusChangeTypeEnum StatusChangeType)
     {
         var location = _locationRepository.QueryFirst(x => x.LocationCode == locationCode);
@@ -2397,6 +2441,7 @@
         switch (AreaId)
         {
             case 2:
+            case 7:
                 return await FromShallowToDeep(AreaId, loc);
             case 3:
                 return await AGVLIKU(AreaId);

--
Gitblit v1.9.3