647556386
2025-03-14 c5cf76657ef4bda557a445b56466a85db0b2662d
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/°å²Ä²Ö/StackerCraneJob_BC.cs
@@ -194,8 +194,15 @@
                                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
                        {
                            _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)
                    {
@@ -232,11 +239,11 @@
        {
            try
            {
                Dt_Task oldTask = _taskRepository.QueryFirst(x => x.DeviceCode == commonStackerCrane.DeviceCode && x.TaskState == TaskStatusEnum.SC_Executing.ObjToInt());
                if (oldTask != null)
                {
                    StackerCraneTaskCompleted(oldTask.TaskNum, commonStackerCrane.DeviceCode);
                }
                //Dt_Task oldTask = _taskRepository.QueryFirst(x => x.DeviceCode == commonStackerCrane.DeviceCode && x.TaskState == TaskStatusEnum.SC_Executing.ObjToInt());
                //if (oldTask != null)
                //{
                //    StackerCraneTaskCompleted(oldTask.TaskNum, commonStackerCrane.DeviceCode);
                //}
            }
            catch { }
@@ -329,13 +336,22 @@
                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)
                    {
                        return existTask;
                    }
                    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;
                }