1
wangxinhui
2025-07-03 eb7892b61b050646ad11e7a36942c2a2a16a24f2
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/°å²Ä²Ö/StackerCraneJob_BC.cs
@@ -107,6 +107,7 @@
                    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)
                        {
@@ -196,11 +197,15 @@
                                return WebResponseContent.Instance.Error($"未找到路由信息,{task.NextAddress}");
                            }
                        }
                        if (task.TargetAddress.Contains("SCUTL-001"))
                        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
                        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");
                        }
@@ -248,7 +253,12 @@
                //}
            }
            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)
            {
@@ -279,7 +289,7 @@
                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)
                    {
@@ -340,10 +350,14 @@
                    Dt_Task reloTask = _mapper.Map<Dt_Task>(taskDTO);
                    //判断移库货位任务是否已存在,如存在先执行
                    Dt_Task existTask = _taskService.QueryStackerExistTask(reloTask.PalletCode, reloTask.SourceAddress);
                    if (existTask != null)
                    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();