| | |
| | | bool sendFlag = commonStackerCrane.SendCommand(stackerCraneTaskCommand); |
| | | if (sendFlag) |
| | | { |
| | | commonStackerCrane.LastTaskType = task.TaskType; |
| | | _taskService.UpdateTaskStatusToNext(task.TaskNum); |
| | | } |
| | | } |
| | |
| | | /// <param name="e"></param> |
| | | private void CommonStackerCrane_StackerCraneTaskCompletedEventHandler(object? sender, WIDESEAWCS_QuartzJob.StackerCrane.StackerCraneTaskCompletedEventArgs e) |
| | | { |
| | | Console.Out.WriteLine("TaskCompleted" + e.TaskNum); |
| | | _taskService.StackCraneTaskCompleted(e.TaskNum); |
| | | |
| | | CommonStackerCrane commonStackerCrane = sender as CommonStackerCrane; |
| | | commonStackerCrane.SetValue(StackerCraneDBName.WorkType, 5); |
| | | if (commonStackerCrane.GetValue<StackerCraneDBName,short>(StackerCraneDBName.WorkType) != 5) |
| | | { |
| | | Console.Out.WriteLine("TaskCompleted" + e.TaskNum); |
| | | _taskService.StackCraneTaskCompleted(e.TaskNum); |
| | | commonStackerCrane.SetValue(StackerCraneDBName.WorkType, 5); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | } |
| | | else |
| | | { |
| | | IEnumerable<int> taskInboundTypes = Enum.GetValues(typeof(TaskOutboundTypeEnum)).Cast<int>(); |
| | | if (Enum.TryParse(typeof(TaskOutboundTypeEnum), commonStackerCrane.LastTaskType.GetValueOrDefault().ToString(), out object? result)) |
| | | if (!int.TryParse(Enum.Parse<TaskOutboundTypeEnum>(commonStackerCrane.LastTaskType.ToString()).ToString(), out int taskType)) |
| | | { |
| | | task = _taskService.QueryStackerCraneInTask(commonStackerCrane.DeviceCode); |
| | | if(task == null) |
| | | { |
| | | task = _taskService.QueryStackerCraneOutTask(commonStackerCrane.DeviceCode); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | task = _taskService.QueryStackerCraneOutTask(commonStackerCrane.DeviceCode); |
| | | if (task != null) |
| | | } |
| | | } |
| | | |
| | | if (task != null && !int.TryParse(Enum.Parse<TaskOutboundTypeEnum>(task.TaskType.ToString()).ToString(), out int result)) |
| | | { |
| | | if (OutTaskStationIsOccupied(task) != null) |
| | | { |
| | | return task; |
| | | } |
| | | else |
| | | { |
| | | 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) |
| | | if (OutTaskStationIsOccupied(task) != null) |
| | | { |
| | | return task; |
| | | } |
| | | //else |
| | | //{ |
| | | // List<string> otherOutStaionCodes = _routerService.QueryRoutes(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; |
| | | // } |
| | | // } |
| | | // task = _taskService.QueryStackerCraneInTask(commonStackerCrane.DeviceCode); |
| | | //} |
| | | } |
| | | task = _taskService.QueryStackerCraneInTask(commonStackerCrane.DeviceCode); |
| | | } |
| | | } |
| | | |
| | | return task; |
| | | } |
| | | |
| | |
| | | if (device != null) |
| | | { |
| | | CommonConveyorLine conveyorLine = (CommonConveyorLine)device; |
| | | if (!conveyorLine.IsOccupied(router.ChildPosi))//出库站台未被占用 |
| | | if (conveyorLine.IsOccupied(router.ChildPosi))//出库站台未被占用 |
| | | { |
| | | return task; |
| | | } |