wangxinhui
2026-03-06 65a231315d1dcc35d2996106d36e9cca9aba6ce6
ÏîÄ¿´úÂë/WCS/WCSServices/WIDESEAWCS_Tasks/³ÉÆ·²Ö/ConveyorLineJob_CPA.cs
@@ -70,7 +70,7 @@
                    OtherDevice device = (OtherDevice)value;
                    List<string> deviceStations = device.DeviceProDTOs.Select(x => x.DeviceChildCode).ToList();
                    //获取有协议的输送线
                    List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData();
                    List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x=>x.StationDeviceCode==device.DeviceCode);
                    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();
@@ -80,38 +80,26 @@
                            R_ConveyorLineCPInfo conveyorLineInfoRead = device.Communicator.ReadCustomer<R_ConveyorLineCPInfo>(deviceProRead.DeviceProAddress);
                            if (conveyorLineInfoRead != null && conveyorLineInfoRead.Command == 2 && conveyorLineInfoRead.TaskNo > 0 && item.StationType == StationTypeEnum.StationType_OnlyInbound.ObjToInt()) //二楼线体入库站台->堆垛机
                            {
                                //获取入库站台是否存在入库任务
                                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)
                                {
                                    Dt_StationManger stationManger = stationMangers.FirstOrDefault(x => x.StationCode == task.SourceAddress);
                                    if (stationManger != null)
                                    //分配货位
                                    string? local = _taskService.RequestAssignLocation(task.TaskNum, task.Roadway);
                                    //分配货位
                                    if (!string.IsNullOrEmpty(local))
                                    {
                                        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}进行堆垛机入库");
                                        }
                                        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
                                {
                                    WriteError(item.StationName, $"未找到{item.StationCode}的任务{conveyorLineInfoRead.TaskNo}");
                                }
                            }
                            else if (conveyorLineInfoRead != null && conveyorLineInfoRead.Command == 4 && conveyorLineInfoRead.TaskNo <= 0 && item.StationType == StationTypeEnum.StationType_OnlyOutbound.ObjToInt()) //二楼线体出库站台
                            {