1
dengjunjie
2025-01-10 96e6dc957aee5d20218ac8127a28db6a7e6ba6de
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/²âÊԼܲÖ/GroundStationJob_CSJ.cs
@@ -43,7 +43,7 @@
            {
                if (device == null)
                {
                    WriteInfo(nameof(GroundStationJob_CSJ), "调度错误,设备对象传值为null");
                    WriteError(nameof(GroundStationJob_CSJ), "调度错误,设备对象传值为null");
                    return Task.CompletedTask;
                }
                List<string> deviceStations = device.DeviceProDTOs.Select(x => x.DeviceChildCode).ToList();
@@ -64,12 +64,7 @@
                            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;
                                int oldStatus = task.TaskState;
                                task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt();
                                task.NextAddress = item.StationCode;
                                _taskRepository.UpdateData(task);
                                _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"系统自动流程,目标地址由{oldAddress}变更为{task.NextAddress},任务状态由{oldStatus}变更为{task.TaskState}");
                                _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute, nextAddress: item.StationCode);
                            }
                        }
                        if (item.StationType == StationTypeEnum.StationType_OnlyInbound.ObjToInt())
@@ -82,22 +77,16 @@
                                Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.StationCode == item.StationCode);
                                if (stationManger == null)
                                {
                                    WriteInfo(item.StationName, $"未找到对应站台信息,设备编号:{item.StationCode},任务号:{task.TaskNum}");
                                    WriteError(item.StationName, $"未找到对应站台信息,设备编号:{item.StationCode},任务号:{task.TaskNum}");
                                    continue;
                                }
                                string? locationCode = _taskService.RequestAssignLocation(task.TaskNum, stationManger.StackerCraneCode);
                                if (string.IsNullOrEmpty(locationCode))
                                {
                                    WriteInfo(item.StationName, $"请求分配货位返回信息错误,设备编号:{item.StationCode},任务号:{task.TaskNum}");
                                    WriteError(item.StationName, $"请求分配货位返回信息错误,设备编号:{item.StationCode},任务号:{task.TaskNum}");
                                    continue;
                                }
                                task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt();
                                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}");
                                _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute, currentAddress: stationManger.StackerCraneStationCode, targetAddress: locationCode, nextAddress: locationCode, deviceCode: stationManger.StackerCraneCode);
                            }
                        }
                    }
@@ -117,25 +106,16 @@
                            Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.StationCode == item.StationCode);
                            if (stationManger == null)
                            {
                                WriteInfo(item.StationName, $"未找到对应站台信息,设备编号:{item.StationCode},任务号:{task.TaskNum}");
                                WriteError(item.StationName, $"未找到对应站台信息,设备编号:{item.StationCode},任务号:{task.TaskNum}");
                                continue;
                            }
                            string? locationCode = _taskService.RequestAssignLocation(task.TaskNum, stationManger.StackerCraneCode);
                            if (string.IsNullOrEmpty(locationCode))
                            {
                                WriteInfo(item.StationName, $"请求分配货位返回信息错误,设备编号:{item.StationCode},任务号:{task.TaskNum}");
                                WriteError(item.StationName, $"请求分配货位返回信息错误,设备编号:{item.StationCode},任务号:{task.TaskNum}");
                                continue;
                            }
                            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}");
                            _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute, currentAddress: stationManger.StackerCraneStationCode, targetAddress: locationCode, nextAddress: locationCode, deviceCode: stationManger.StackerCraneCode);
                        }
                    }
                    catch (Exception ex)