| | |
| | | |
| | | if (item.StationType == StationTypeEnum.StationType_OnlyOutbound.ObjToInt()) |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.DeviceCode == item.StackerCraneCode && x.TaskState == TaskStatusEnum.New.ObjToInt() && string.IsNullOrEmpty(x.NextAddress)); |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.DeviceCode == item.StackerCraneCode && x.TaskState == TaskStatusEnum.SC_Execute.ObjToInt() && string.IsNullOrEmpty(x.NextAddress)); |
| | | if (task != null && isCanPut && !isCanTake && !putRequest && !putFinish && !takeRequest && !takeFinish) |
| | | { |
| | | string oldAddress = task.NextAddress; |
| | |
| | | } |
| | | if (item.StationType == StationTypeEnum.StationType_OnlyInbound.ObjToInt()) |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.TargetAddress == item.StackerCraneCode && x.TaskState == TaskStatusEnum.New.ObjToInt() && string.IsNullOrEmpty(x.NextAddress)); |
| | | if (task != null && isCanPut && !isCanTake && !putRequest && !putFinish && !takeRequest && !takeFinish) |
| | | Dt_Task task = _taskRepository.QueryFirst(x => (x.TargetAddress == item.StackerCraneCode || string.IsNullOrEmpty(x.TargetAddress) || x.NextAddress == item.StackerCraneCode || string.IsNullOrEmpty(x.NextAddress)) && (x.TaskState == TaskStatusEnum.New.ObjToInt() || x.TaskState == TaskStatusEnum.SC_Execute.ObjToInt()) && x.SourceAddress == item.StationCode || x.CurrentAddress==item.AGVStationCode); |
| | | if (task != null) |
| | | { |
| | | string oldAddress = task.NextAddress; |
| | | int oldStatus = task.TaskState; |
| | | task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt(); |
| | | task.NextAddress = item.StationCode; |
| | | Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.StationCode == item.StationCode); |
| | | if (stationManger == null) |
| | | { |
| | | WriteInfo(item.StationName, $"æªæ¾å°å¯¹åºç«å°ä¿¡æ¯,设å¤ç¼å·:{item.StationCode},ä»»å¡å·:{task.TaskNum}"); |
| | | break; |
| | | } |
| | | string? locationCode = _taskService.RequestAssignLocation(task.TaskNum, stationManger.StackerCraneCode); |
| | | if (string.IsNullOrEmpty(locationCode)) |
| | | { |
| | | WriteInfo(item.StationName, $"请æ±åé
è´§ä½è¿åä¿¡æ¯é误,设å¤ç¼å·:{item.StationCode},ä»»å¡å·:{task.TaskNum}"); |
| | | break; |
| | | } |
| | | task.CurrentAddress = stationManger.StackerCraneStationCode; |
| | | task.TargetAddress = locationCode; |
| | | task.NextAddress = locationCode; |
| | | task.DeviceCode = stationManger.StackerCraneCode; |
| | | _taskRepository.UpdateData(task); |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"ç³»ç»èªå¨æµç¨,ç®æ å°åç±{oldAddress}åæ´ä¸º{task.NextAddress},ä»»å¡ç¶æç±{oldStatus}åæ´ä¸º{task.TaskState}"); |
| | | } |
| | |
| | | WriteInfo(item.StationName, $"请æ±åé
è´§ä½è¿åä¿¡æ¯é误,设å¤ç¼å·:{item.StationCode},ä»»å¡å·:{task.TaskNum}"); |
| | | break; |
| | | } |
| | | string oldAddress = task.NextAddress; |
| | | int oldStatus = task.TaskState; |
| | | task.CurrentAddress = stationManger.StackerCraneStationCode; |
| | | task.TargetAddress = locationCode; |
| | | task.NextAddress = locationCode; |
| | | task.DeviceCode = stationManger.StackerCraneCode; |
| | | task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt(); |
| | | _taskRepository.UpdateData(task); |
| | | |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"ç³»ç»èªå¨æµç¨,ç®æ å°åç±{oldAddress}åæ´ä¸º{task.NextAddress},ä»»å¡ç¶æç±{oldStatus}åæ´ä¸º{task.TaskState}"); |
| | | } |
| | | } |
| | | catch(Exception ex) |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | } |