wangxinhui
2025-10-26 733c975cd8647f6d006736f1863bad731e32e6fb
ÏîÄ¿´úÂë/WCS/WCSServices/WIDESEAWCS_Tasks/³ÉÆ·²Ö/ConveyorLineJob_CPA.cs
@@ -67,7 +67,8 @@
            {
                OtherDevice device = (OtherDevice)value;
                List<string> deviceStations = device.DeviceProDTOs.Select(x => x.DeviceChildCode).ToList();
                List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x => x.StationDeviceCode == device.DeviceCode);
                //获取有协议的输送线
                List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData();
                foreach (var item in stationMangers.Where(x => deviceStations.Contains(x.StationCode)))
                {
                    DeviceProDTO? deviceProRead = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.StationCode && x.DeviceProParamType == nameof(R_ConveyorLineCPDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault();
@@ -81,29 +82,33 @@
                            Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == conveyorLineInfoRead.TaskNo && x.NextAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.Line_Executing.ObjToInt() && x.DeviceCode == device.DeviceCode);
                            if (task != null)
                            {
                                string local = "";
                                //分配货位
                                if (task.HeightType==1)
                                Dt_StationManger stationManger = stationMangers.FirstOrDefault(x => x.StationCode == task.SourceAddress);
                                if (stationManger != null)
                                {
                                    local = "SC02_CP-001-064-001-01";
                                    string? local = "";
                                    switch (stationManger.AGVStationCode.ObjToInt() % 2)
                                    {
                                        case 1:
                                            local = task.Roadway + "-001-062-001-01";
                                            break;
                                        case 0:
                                            local = task.Roadway + "-002-062-001-01";
                                            break;
                                        default:
                                            WriteError(item.StationName, $"未找到可分配巷道{task.TaskNum}");
                                            break;
                                    }
                                    //分配货位
                                    if (!string.IsNullOrEmpty(local))
                                    {
                                        task.CurrentAddress = item.StackerCraneStationCode;
                                        task.TargetAddress = local;
                                        task.NextAddress = local;
                                        task.DeviceCode = item.StackerCraneCode;
                                        _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute);
                                        WriteInfo(item.StationName, $"任务号:{task.TaskNum}进行堆垛机入库");
                                    }
                                }
                                else if (task.HeightType == 2)
                                {
                                    local = "SC02_CP-001-063-001-01";
                                }
                                task.CurrentAddress = item.StackerCraneStationCode;
                                task.TargetAddress= local;
                                task.NextAddress = local;
                                task.DeviceCode = item.StackerCraneCode;
                                _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute);
                                WriteError(item.StationName, $"任务号:{task.TaskNum}进行堆垛机入库");
                                //string? locationCode = _taskService.RequestAssignLocation(task.TaskNum, "AGV_CP");
                                //if (string.IsNullOrEmpty(locationCode) && task.TaskType != TaskTypeEnum.EmptyProductBack.ObjToInt())
                                //{
                                //    WriteError(item.StationName, $"请求分配货位返回信息错误,设备编号:{item.StationCode},任务号:{task.TaskNum}");
                                //    continue;
                                //}
                            }
                        }
                        else if (conveyorLineInfoRead != null && conveyorLineInfoRead.Command == 4 && conveyorLineInfoRead.TaskNo <= 0 && item.StationType == StationTypeEnum.StationType_OnlyOutbound.ObjToInt()) //二楼线体出库站台
@@ -128,7 +133,7 @@
                                //更新设备
                                task.DeviceCode = router.ChildPosiDeviceCode;
                                _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing);
                                WriteError(item.StationName, $"任务号:{task.TaskNum}进行线体出库");
                                WriteInfo(item.StationName, $"任务号:{task.TaskNum}进行线体出库");
                            }
                        }
                    }