|  |  | 
 |  |  | using Microsoft.AspNetCore.Components.Routing; | 
 |  |  | using Newtonsoft.Json; | 
 |  |  | using Quartz; | 
 |  |  | using System; | 
 |  |  | using System.Collections.Generic; | 
 |  |  | using System.Diagnostics.CodeAnalysis; | 
 |  |  | using System.Linq; | 
 |  |  | using System.Reflection; | 
 |  |  | using System.Text; | 
 |  |  | using System.Threading.Tasks; | 
 |  |  | using WIDESEAWCS_Common.APIEnum; | 
 |  |  | using WIDESEAWCS_Common.TaskEnum; | 
 |  |  | using WIDESEAWCS_Core; | 
 |  |  | using WIDESEAWCS_Core.Caches; | 
 |  |  | using WIDESEAWCS_Core.Enums; | 
 |  |  | using WIDESEAWCS_Core.Helper; | 
 |  |  | using WIDESEAWCS_IBasicInfoRepository; | 
 |  |  | using WIDESEAWCS_ITaskInfoRepository; | 
 |  |  | using WIDESEAWCS_ITaskInfoService; | 
 |  |  | 
 |  |  | using WIDESEAWCS_QuartzJob.StackerCrane.Enum; | 
 |  |  | using WIDESEAWCS_Tasks.HoisterJob; | 
 |  |  | using WIDESEAWCS_Tasks.StackerCraneJob; | 
 |  |  | using WIDESEAWCS_Tasks.é»çä»; | 
 |  |  |  | 
 |  |  | namespace WIDESEAWCS_Tasks | 
 |  |  | { | 
 |  |  |     [DisallowConcurrentExecution] | 
 |  |  |     public class StackerCraneJob_CSJ : JobBase, IJob | 
 |  |  |     { | 
 |  |  |         private readonly ICacheService _cacheService; | 
 |  |  |         private readonly ITaskService _taskService; | 
 |  |  |         private readonly ITaskExecuteDetailService _taskExecuteDetailService; | 
 |  |  |         private readonly ITaskRepository _taskRepository; | 
 |  |  |         private readonly IRouterService _routerService; | 
 |  |  |         private readonly IStationMangerRepository _stationMangerRepository; | 
 |  |  |         private List<Dt_ApiInfo> apiInfos; | 
 |  |  |  | 
 |  |  |         public StackerCraneJob_CSJ(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IRouterService routerService, IStationMangerRepository stationMangerRepository) | 
 |  |  |         public StackerCraneJob_CSJ(ITaskService taskService, ICacheService cacheService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IRouterService routerService, IStationMangerRepository stationMangerRepository) | 
 |  |  |         { | 
 |  |  |             _taskService = taskService; | 
 |  |  |             _taskExecuteDetailService = taskExecuteDetailService; | 
 |  |  |             _taskRepository = taskRepository; | 
 |  |  |             _routerService = routerService; | 
 |  |  |             _stationMangerRepository = stationMangerRepository; | 
 |  |  |             _cacheService = cacheService; | 
 |  |  |  | 
 |  |  |             string? apiInfoStr = _cacheService.Get("apiInfos"); | 
 |  |  |             if (!string.IsNullOrEmpty(apiInfoStr)) | 
 |  |  |             { | 
 |  |  |                 List<Dt_ApiInfo>? infos = JsonConvert.DeserializeObject<List<Dt_ApiInfo>>(apiInfoStr); | 
 |  |  |                 if (infos == null || infos.Count == 0) | 
 |  |  |                 { | 
 |  |  |                     apiInfos = new List<Dt_ApiInfo>(); | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     apiInfos = infos; | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         public Task Execute(IJobExecutionContext context) | 
 |  |  | 
 |  |  |                     { | 
 |  |  |                         commonStackerCrane.StackerCraneTaskCompletedEventHandler += CommonStackerCrane_StackerCraneTaskCompletedEventHandler;//订é
ä»»å¡å®æäºä»¶ | 
 |  |  |                     } | 
 |  |  |  | 
 |  |  |                     if (commonStackerCrane.StackerCraneAutoStatusValue == StackerCraneAutoStatus.Automatic && commonStackerCrane.StackerCraneStatusValue == StackerCraneStatus.Normal) | 
 |  |  |                     commonStackerCrane.CheckStackerCraneTaskCompleted();//鲿¢ä»»å¡å®æäºä»¶çæµè¶
æ¶ï¼åæå¨è§¦å䏿¬¡ | 
 |  |  |                     if (commonStackerCrane.StackerCraneAutoStatusValue == StackerCraneAutoStatus.Automatic && commonStackerCrane.StackerCraneStatusValue == StackerCraneStatus.Normal && commonStackerCrane.StackerCraneWorkStatusValue == StackerCraneWorkStatus.Standby) | 
 |  |  |                     { | 
 |  |  |                         commonStackerCrane.CheckStackerCraneTaskCompleted();//鲿¢ä»»å¡å®æäºä»¶çæµè¶
æ¶ï¼åæå¨è§¦å䏿¬¡ | 
 |  |  |  | 
 |  |  |                         if (commonStackerCrane.StackerCraneWorkStatusValue == StackerCraneWorkStatus.Standby) | 
 |  |  |                         Dt_Task? task = GetTask(commonStackerCrane); | 
 |  |  |                         if (task != null) | 
 |  |  |                         { | 
 |  |  |                             Dt_Task? task = GetTask(commonStackerCrane); | 
 |  |  |                             if (task != null) | 
 |  |  |                             StackerCraneTaskCommand? stackerCraneTaskCommand = ConvertToStackerCraneTaskCommand(task); | 
 |  |  |                             if (stackerCraneTaskCommand != null) | 
 |  |  |                             { | 
 |  |  |                                 StackerCraneTaskCommand? stackerCraneTaskCommand = ConvertToStackerCraneTaskCommand(task); | 
 |  |  |                                 if (stackerCraneTaskCommand != null) | 
 |  |  |                                 bool sendFlag = commonStackerCrane.SendCommand(stackerCraneTaskCommand); | 
 |  |  |                                 if (sendFlag) | 
 |  |  |                                 { | 
 |  |  |                                     bool sendFlag = commonStackerCrane.SendCommand(stackerCraneTaskCommand); | 
 |  |  |                                     if (sendFlag) | 
 |  |  |                                     { | 
 |  |  |                                         commonStackerCrane.LastTaskType = task.TaskType; | 
 |  |  |                                        // _taskService.UpdateTaskStatusToNext(task.TaskNum); | 
 |  |  |                                     } | 
 |  |  |                                     commonStackerCrane.LastTaskType = task.TaskType; | 
 |  |  |                                     int oldState = task.TaskState; | 
 |  |  |                                     task.TaskState = TaskStatusEnum.SC_Executing.ObjToInt(); | 
 |  |  |                                     task.Dispatchertime = DateTime.Now; | 
 |  |  |                                     task.ExceptionMessage = ""; | 
 |  |  |                                     _taskRepository.UpdateData(task); | 
 |  |  |                                     _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"ç³»ç»èªå¨æµç¨ï¼ä»»å¡ç¶æä»ã{oldState}ã转å°ã{task.TaskState}ã"); | 
 |  |  |                                 } | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  | 
 |  |  |             { | 
 |  |  |                 if (commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.WorkType) != 5) | 
 |  |  |                 { | 
 |  |  |                     Console.Out.WriteLine("TaskCompleted" + e.TaskNum); | 
 |  |  |                    // _taskService.StackCraneTaskCompleted(e.TaskNum); | 
 |  |  |                     StackerCraneTaskCompleted(e.TaskNum, commonStackerCrane.DeviceCode); | 
 |  |  |                     commonStackerCrane.SetValue(StackerCraneDBName.WorkType, 5); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         public WebResponseContent StackerCraneTaskCompleted(int taskNum, string deviceCode) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == taskNum); | 
 |  |  |                 if (task != null) | 
 |  |  |                 { | 
 |  |  |                     if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) | 
 |  |  |                     { | 
 |  |  |                         Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.StackerCraneStationCode == task.NextAddress); | 
 |  |  |                         if(stationManger == null) | 
 |  |  |                         { | 
 |  |  |                             _taskExecuteDetailService.AddTaskExecuteDetail(taskNum, $"AGVç«ç¹æªé
ç½®,{task.NextAddress}"); | 
 |  |  |                             _taskService.UpdateTaskExceptionMessage(taskNum, $"AGVç«ç¹æªé
ç½®,{task.NextAddress}"); | 
 |  |  |                             return WebResponseContent.Instance.Error($"AGVç«ç¹æªé
ç½®,{task.NextAddress}"); | 
 |  |  |                         } | 
 |  |  |                         int oldStatus = task.TaskState; | 
 |  |  |                         task.DeviceCode = "AGV_CSJ"; | 
 |  |  |                         task.TaskState = TaskStatusEnum.AGV_Execute.ObjToInt(); | 
 |  |  |                         task.CurrentAddress = stationManger.AGVStationCode; | 
 |  |  |                         task.NextAddress = task.TargetAddress; | 
 |  |  |                         _taskRepository.UpdateData(task); | 
 |  |  |                         _taskExecuteDetailService.AddTaskExecuteDetail(taskNum, $"ç³»ç»èªå¨æµç¨,ï¼ä»»å¡ç¶æä»ã{oldStatus}ã转å°ã{task.TaskState}ã"); | 
 |  |  |                     } | 
 |  |  |                     else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup || task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup) | 
 |  |  |                     { | 
 |  |  |                         _taskService.TaskCompleted(taskNum); | 
 |  |  |                     } | 
 |  |  |                     else | 
 |  |  |                     { | 
 |  |  |                         WriteInfo(deviceCode, $"æªæ¾å°è¯¥ä»»å¡ç±»ååè°WMSä»»å¡å®ææ¥å£,{task.TaskType}"); | 
 |  |  |                         _taskExecuteDetailService.AddTaskExecuteDetail(taskNum, $"æªæ¾å°è¯¥ä»»å¡ç±»ååè°WMSä»»å¡å®ææ¥å£,{task.TaskType}"); | 
 |  |  |                         _taskService.UpdateTaskExceptionMessage(taskNum, $"æªæ¾å°è¯¥ä»»å¡ç±»ååè°WMSä»»å¡å®ææ¥å£,{task.TaskType}"); | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     WriteInfo(deviceCode, $"æªæ¾å°ä»»å¡ä¿¡æ¯,ä»»å¡å·:{taskNum}"); | 
 |  |  |                     return WebResponseContent.Instance.Error($"æªæ¾å°ä»»å¡ä¿¡æ¯,ä»»å¡å·:{taskNum}"); | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 return WebResponseContent.Instance.OK(); | 
 |  |  |             } | 
 |  |  |             catch (Exception ex) | 
 |  |  |             { | 
 |  |  |                 WriteError(deviceCode, $"ä»»å¡å®æé误", ex); | 
 |  |  |                 return WebResponseContent.Instance.Error(ex.Message); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  | 
 |  |  |  | 
 |  |  |             if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) | 
 |  |  |             { | 
 |  |  |                 if (OutTaskStationIsOccupied(task) != null || true) | 
 |  |  |                 if (OutTaskStationIsOccupied(task) == null) | 
 |  |  |                 { | 
 |  |  |                     return task; | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     bool flag = false; | 
 |  |  |                     List<string> otherOutStaionCodes = _routerService.QueryNextRoutes(commonStackerCrane.DeviceCode, task.NextAddress).Select(x => x.ChildPosi).ToList(); | 
 |  |  |                     List<Dt_Task> tasks = _taskService.QueryStackerCraneOutTasks(commonStackerCrane.DeviceCode, otherOutStaionCodes); | 
 |  |  |                     foreach (var item in tasks) | 
 |  |  |                     { | 
 |  |  |                         if (OutTaskStationIsOccupied(task) != null) | 
 |  |  |                         { | 
 |  |  |                             return task; | 
 |  |  |                             flag = true; | 
 |  |  |                             break; | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                     task = _taskService.QueryStackerCraneInTask(commonStackerCrane.DeviceCode); | 
 |  |  |                     if (!flag) | 
 |  |  |                     { | 
 |  |  |                         task = _taskService.QueryStackerCraneInTask(commonStackerCrane.DeviceCode); | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) | 
 |  |  |             { | 
 |  |  |                 string? url = apiInfos.FirstOrDefault(x => x.ApiCode == APIEnum.FeedBackWMSTaskCompleted.ToString())?.ApiAddress; | 
 |  |  |                 if (string.IsNullOrEmpty(url)) | 
 |  |  |                 { | 
 |  |  |                     _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"æªæ¾å°WMSç§»åºå¤ææ¥å£"); | 
 |  |  |                     WriteInfo(commonStackerCrane.DeviceCode, $"æªæ¾å°WMSç§»åºå¤ææ¥å£"); | 
 |  |  |                     _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"æªæ¾å°WMSç§»åºå¤ææ¥å£"); | 
 |  |  |                     return null; | 
 |  |  |                 } | 
 |  |  |                 HttpHelper.Post($"{url}?taskNum={task.TaskNum}&locationCode={task.NextAddress}", "");//todo è°ç¨WMSä»»å¡å®ææ¹æ³ | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             return task; | 
 |  |  | 
 |  |  |         /// <returns>妿æªè¢«å ç¨ï¼è¿åä¼ å
¥çä»»å¡ä¿¡æ¯ï¼å¦åï¼è¿ånull</returns> | 
 |  |  |         private Dt_Task? OutTaskStationIsOccupied([NotNull] Dt_Task task) | 
 |  |  |         { | 
 |  |  |             Dt_StationManger? stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == task.TargetAddress && x.StackerCraneCode == task.Roadway); | 
 |  |  |             Dt_StationManger? stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == task.NextAddress && x.StackerCraneCode == task.DeviceCode); | 
 |  |  |             if (stationManger != null) | 
 |  |  |             { | 
 |  |  |                 IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); | 
 |  |  | 
 |  |  |                     OtherDevice client = (OtherDevice)device; | 
 |  |  |                     if (client.GetValue<GroundStationDBName, bool>(GroundStationDBName.R_IsCanPut, stationManger.StationCode))//åºåºç«å°æªè¢«å ç¨ | 
 |  |  |                     { | 
 |  |  |                         task.TargetAddress = stationManger.StackerCraneStationCode; | 
 |  |  |                         task.NextAddress = stationManger.StackerCraneStationCode; | 
 |  |  |                         _taskRepository.UpdateData(task); | 
 |  |  |                         client.SetValue(GroundStationDBName.R_IsCanPut, true, stationManger.StationCode); | 
 |  |  |                         return task; | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     WriteInfo(task.DeviceCode, $"æªæ¾å°åºåºç«å°ã{stationManger.StationDeviceCode}ã对åºçéè®¯å¯¹è±¡ï¼æ æ³å¤æåºåºç«å°æ¯å¦è¢«å ç¨"); | 
 |  |  |                     _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"æªæ¾å°åºåºç«å°ã{stationManger.StationDeviceCode}ã对åºçéè®¯å¯¹è±¡ï¼æ æ³å¤æåºåºç«å°æ¯å¦è¢«å ç¨"); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |             else | 
 |  |  |             { | 
 |  |  |                 WriteInfo(task.DeviceCode, $"æªæ¾å°ç«å°ã{task.NextAddress}ãä¿¡æ¯ï¼æ æ³æ ¡éªç«å°"); | 
 |  |  |                 _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"æªæ¾å°ç«å°ã{task.NextAddress}ãä¿¡æ¯ï¼æ æ³æ ¡éªç«å°"); | 
 |  |  |             } | 
 |  |  |             return null; | 
 |  |  | 
 |  |  |             stackerCraneTaskCommand.Barcode = task.PalletCode; | 
 |  |  |             stackerCraneTaskCommand.TaskNum = task.TaskNum; | 
 |  |  |             stackerCraneTaskCommand.WorkType = 1; | 
 |  |  |             stackerCraneTaskCommand.TrayType = 1; | 
 |  |  |             stackerCraneTaskCommand.TrayType = (Int16)task.PalletType; | 
 |  |  |             if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)//夿æ¯å¦æ¯å
¥åºä»»å¡ | 
 |  |  |             { | 
 |  |  |                 string[] startCodes = task.CurrentAddress.Split("-"); | 
 |  |  |  | 
 |  |  |                 stackerCraneTaskCommand.StartRow = Convert.ToInt16(startCodes[0]); | 
 |  |  |                 stackerCraneTaskCommand.StartColumn = Convert.ToInt16(startCodes[1]); | 
 |  |  |                 stackerCraneTaskCommand.StartLayer = Convert.ToInt16(startCodes[2]); | 
 |  |  |                 if (startCodes.Length == 3) | 
 |  |  |                 { | 
 |  |  |                     stackerCraneTaskCommand.StartRow = Convert.ToInt16(startCodes[0]); | 
 |  |  |                     stackerCraneTaskCommand.StartColumn = Convert.ToInt16(startCodes[1]); | 
 |  |  |                     stackerCraneTaskCommand.StartLayer = Convert.ToInt16(startCodes[2]); | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"å
¥åºä»»å¡èµ·ç¹é误ï¼èµ·ç¹ï¼ã{task.CurrentAddress}ã"); | 
 |  |  |                     WriteInfo(task.DeviceCode, $"å
¥åºä»»å¡èµ·ç¹é误ï¼èµ·ç¹ï¼ã{task.CurrentAddress}ã"); | 
 |  |  |                     return null; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 string[] targetCodes = task.NextAddress.Split("-"); | 
 |  |  |                 if (targetCodes.Length == 3) | 
 |  |  |                 if (targetCodes.Length == 5) | 
 |  |  |                 { | 
 |  |  |                     stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[0]); | 
 |  |  |                     stackerCraneTaskCommand.EndColumn = Convert.ToInt16(targetCodes[1]); | 
 |  |  |                     stackerCraneTaskCommand.EndLayer = Convert.ToInt16(targetCodes[2]); | 
 |  |  |                     stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[1]); | 
 |  |  |                     stackerCraneTaskCommand.EndColumn = Convert.ToInt16(targetCodes[2]); | 
 |  |  |                     stackerCraneTaskCommand.EndLayer = Convert.ToInt16(targetCodes[3]); | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     //æ°æ®é
ç½®é误 | 
 |  |  |                     _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"å
¥åºä»»å¡ç»ç¹é误ï¼èµ·ç¹ï¼ã{task.NextAddress}ã"); | 
 |  |  |                     _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"å
¥åºä»»å¡ç»ç¹é误ï¼ç»ç¹ï¼ã{task.NextAddress}ã"); | 
 |  |  |                     WriteInfo(task.DeviceCode, $"å
¥åºä»»å¡ç»ç¹é误ï¼ç»ç¹ï¼ã{task.NextAddress}ã"); | 
 |  |  |                     return null; | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  | 
 |  |  |             { | 
 |  |  |                 string[] targetCodes = task.NextAddress.Split("-"); | 
 |  |  |  | 
 |  |  |                 stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[0]); | 
 |  |  |                 stackerCraneTaskCommand.EndColumn = Convert.ToInt16(targetCodes[1]); | 
 |  |  |                 stackerCraneTaskCommand.EndLayer = Convert.ToInt16(targetCodes[2]); | 
 |  |  |  | 
 |  |  |                 string[] sourceCodes = task.CurrentAddress.Split("-"); | 
 |  |  |                 if (sourceCodes.Length == 3) | 
 |  |  |                 { | 
 |  |  |                     stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[0]); | 
 |  |  |                     stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[1]); | 
 |  |  |                     stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[2]); | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     //æ°æ®é
ç½®é误 | 
 |  |  |                     _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"åºåºä»»å¡èµ·ç¹é误ï¼èµ·ç¹ï¼ã{task.CurrentAddress}ã"); | 
 |  |  |                     return null; | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |             else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup) | 
 |  |  |             { | 
 |  |  |                 string[] targetCodes = task.NextAddress.Split("-"); | 
 |  |  |                 if (targetCodes.Length == 3) | 
 |  |  |                 { | 
 |  |  |                     stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[0]); | 
 |  |  | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     //æ°æ®é
ç½®é误 | 
 |  |  |                     _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"ç§»åºä»»å¡ç»ç¹é误ï¼èµ·ç¹ï¼ã{task.NextAddress}ã"); | 
 |  |  |                     _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"åºåºä»»å¡ç»ç¹é误ï¼ç»ç¹ï¼ã{task.NextAddress}ã"); | 
 |  |  |                     WriteInfo(task.DeviceCode, $"åºåºä»»å¡ç»ç¹é误ï¼ç»ç¹ï¼ã{task.NextAddress}ã"); | 
 |  |  |                     return null; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 string[] sourceCodes = task.CurrentAddress.Split("-"); | 
 |  |  |                 if (sourceCodes.Length == 5) | 
 |  |  |                 { | 
 |  |  |                     stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[1]); | 
 |  |  |                     stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[2]); | 
 |  |  |                     stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[3]); | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     //æ°æ®é
ç½®é误 | 
 |  |  |                     _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"åºåºä»»å¡èµ·ç¹é误ï¼èµ·ç¹ï¼ã{task.CurrentAddress}ã"); | 
 |  |  |                     WriteInfo(task.DeviceCode, $"åºåºä»»å¡èµ·ç¹é误ï¼èµ·ç¹ï¼ã{task.CurrentAddress}ã"); | 
 |  |  |                     return null; | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |             else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup) | 
 |  |  |             { | 
 |  |  |                 string[] targetCodes = task.NextAddress.Split("-"); | 
 |  |  |                 if (targetCodes.Length == 5) | 
 |  |  |                 { | 
 |  |  |                     stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[1]); | 
 |  |  |                     stackerCraneTaskCommand.EndColumn = Convert.ToInt16(targetCodes[2]); | 
 |  |  |                     stackerCraneTaskCommand.EndLayer = Convert.ToInt16(targetCodes[3]); | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     //æ°æ®é
ç½®é误 | 
 |  |  |                     _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"ç§»åºä»»å¡ç»ç¹é误ï¼ç»ç¹ï¼ã{task.NextAddress}ã"); | 
 |  |  |                     WriteInfo(task.DeviceCode, $"ç§»åºä»»å¡ç»ç¹é误ï¼ç»ç¹ï¼ã{task.NextAddress}ã"); | 
 |  |  |                     return null; | 
 |  |  |                 } | 
 |  |  |                 string[] sourceCodes = task.CurrentAddress.Split("-"); | 
 |  |  |                 if (sourceCodes.Length == 3) | 
 |  |  |                 if (sourceCodes.Length == 5) | 
 |  |  |                 { | 
 |  |  |                     stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[0]); | 
 |  |  |                     stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[1]); | 
 |  |  |                     stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[2]); | 
 |  |  |                     stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[1]); | 
 |  |  |                     stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[2]); | 
 |  |  |                     stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[3]); | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     //æ°æ®é
ç½®é误 | 
 |  |  |                     _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"ç§»åºä»»å¡èµ·ç¹é误ï¼èµ·ç¹ï¼ã{task.CurrentAddress}ã"); | 
 |  |  |                     WriteInfo(task.DeviceCode, $"ç§»åºä»»å¡èµ·ç¹é误ï¼èµ·ç¹ï¼ã{task.CurrentAddress}ã"); | 
 |  |  |                     return null; | 
 |  |  |                 } | 
 |  |  |             } |