|  |  |  | 
|---|
|  |  |  | commonStackerCrane.CheckStackerCraneTaskCompleted();//鲿¢ä»»å¡å®æäºä»¶çæµè¶
æ¶ï¼åæå¨è§¦å䏿¬¡ | 
|---|
|  |  |  | if (commonStackerCrane.StackerCraneAutoStatusValue == StackerCraneAutoStatus.Automatic && commonStackerCrane.StackerCraneStatusValue == StackerCraneStatus.Normal && commonStackerCrane.StackerCraneWorkStatusValue == StackerCraneWorkStatus.Standby) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | Thread.Sleep(1000); | 
|---|
|  |  |  | Dt_Task? task = GetTask(commonStackerCrane); | 
|---|
|  |  |  | if (task != null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | task.Dispatchertime = DateTime.Now; | 
|---|
|  |  |  | task.ExceptionMessage = ""; | 
|---|
|  |  |  | _taskService.UpdateTask(task, TaskStatusEnum.SC_Executing); | 
|---|
|  |  |  | //å»¶æ¶1s | 
|---|
|  |  |  | Thread.Sleep(1000); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | return WebResponseContent.Instance.Error($"æªæ¾å°è·¯ç±ä¿¡æ¯,{task.NextAddress}"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | _taskService.UpdateTask(task, TaskStatusEnum.Line_Execute, deviceCode: stationManger.StationDeviceCode, currentAddress: stationManger.StationCode, nextAddress: router.NextPosi, targetAddress: router.NextPosi); | 
|---|
|  |  |  | if (task.TargetAddress.Contains("SCUTL-001")) //èªå¨ä¸çº¿ | 
|---|
|  |  |  | { | 
|---|
|  |  |  | _taskService.UpdateTask(task, TaskStatusEnum.Line_Execute, deviceCode: stationManger.StationDeviceCode, currentAddress: stationManger.StationCode, nextAddress: router.NextPosi, targetAddress: router.NextPosi); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else if (task.TargetAddress.Contains("SCUTL-002")) //èªå¨äºçº¿ | 
|---|
|  |  |  | { | 
|---|
|  |  |  | _taskService.UpdateTask(task, TaskStatusEnum.Line_Execute, deviceCode: stationManger.StationDeviceCode, currentAddress: stationManger.StationCode, nextAddress: "1103", targetAddress: "1103"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else //æå¨çº¿ | 
|---|
|  |  |  | { | 
|---|
|  |  |  | _taskService.UpdateTask(task, TaskStatusEnum.Line_Execute, deviceCode: stationManger.StationDeviceCode, currentAddress: stationManger.StationCode, nextAddress: "1102", targetAddress: "1102"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup || task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | //} | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch { } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (_taskRepository.QueryFirst(x => x.DeviceCode == commonStackerCrane.DeviceCode && x.TaskState==TaskStatusEnum.SC_Executing.ObjToInt())!=null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | WriteDebug(commonStackerCrane.DeviceCode, $"读åå°å½åä»»å¡å·:{commonStackerCrane.CurrentTaskNum}"); | 
|---|
|  |  |  | Dt_Task task; | 
|---|
|  |  |  | if (commonStackerCrane.LastTaskType == null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | if (OutTaskStationIsOccupied(task) == null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | bool flag = false; | 
|---|
|  |  |  | List<string> otherOutStaionCodes = _routerService.QueryNextRoutes(commonStackerCrane.DeviceCode, task.NextAddress).Select(x => x.ChildPosi).ToList(); | 
|---|
|  |  |  | List<string> otherOutStaionCodes = _routerService.QueryNextRoutes(commonStackerCrane.DeviceCode, task.NextAddress,task.TaskType).Select(x => x.ChildPosi).ToList(); | 
|---|
|  |  |  | List<Dt_Task> tasks = _taskService.QueryStackerCraneOutTasks(commonStackerCrane.DeviceCode, otherOutStaionCodes); | 
|---|
|  |  |  | foreach (var item in tasks) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | Dt_Task reloTask = _mapper.Map<Dt_Task>(taskDTO); | 
|---|
|  |  |  | reloTask.TaskState = TaskStatusEnum.SC_Execute.ObjToInt(); | 
|---|
|  |  |  | reloTask.CurrentAddress = taskDTO.SourceAddress; | 
|---|
|  |  |  | reloTask.NextAddress = taskDTO.TargetAddress; | 
|---|
|  |  |  | reloTask.DeviceCode = task.DeviceCode; | 
|---|
|  |  |  | reloTask.TaskType = TaskTypeEnum.Relocation.ObjToInt(); | 
|---|
|  |  |  | int taskId = _taskRepository.AddData(reloTask); | 
|---|
|  |  |  | reloTask.TaskId = taskId; | 
|---|
|  |  |  | //å¤æç§»åºè´§ä½ä»»å¡æ¯å¦å·²åå¨ï¼å¦åå¨å
æ§è¡ | 
|---|
|  |  |  | Dt_Task existTask = _taskService.QueryStackerExistTask(reloTask.PalletCode, reloTask.SourceAddress); | 
|---|
|  |  |  | if (existTask != null && existTask.TaskState == (int)TaskStatusEnum.SC_Execute) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | return existTask; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else if (existTask != null && existTask.TaskState != (int)TaskStatusEnum.SC_Execute) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | reloTask.TaskState = TaskStatusEnum.SC_Execute.ObjToInt(); | 
|---|
|  |  |  | reloTask.CurrentAddress = taskDTO.SourceAddress; | 
|---|
|  |  |  | reloTask.NextAddress = taskDTO.TargetAddress; | 
|---|
|  |  |  | reloTask.DeviceCode = task.DeviceCode; | 
|---|
|  |  |  | reloTask.TaskType = TaskTypeEnum.Relocation.ObjToInt(); | 
|---|
|  |  |  | int taskId = _taskRepository.AddData(reloTask); | 
|---|
|  |  |  | reloTask.TaskId = taskId; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return reloTask; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|