huangxiaoqiang
2025-09-11 ca529041b8113b3684c387ba71471d47aa59cdef
ÏîÄ¿´úÂë/WCS/WCSServices/WIDESEAWCS_Tasks/Ô­ÁÏ¿â/StackerCraneJob_YLSC3.cs
@@ -77,6 +77,7 @@
                                        task.Dispatchertime = DateTime.Now;
                                        task.ExceptionMessage = "";
                                        _taskService.UpdateTask(task, TaskStatusEnum.SC_Executing);
                                        //_taskService.UpdateTaskStatusToNext(task);
                                        commonStackerCrane.Communicator.Write("DB1000.20.0", true);
                                        //延时1s
                                        Thread.Sleep(1000);
@@ -137,8 +138,33 @@
                            return WebResponseContent.Instance.Error($"未找到路由信息,{task.NextAddress}");
                        }
                        int oldStatus = task.TaskState;
                        // å †åž›æœºå®Œæˆ
                        _taskService.UpdateTask(task, TaskStatusEnum.Line_Execute, deviceCode: stationManger.StationDeviceCode, currentAddress: stationManger.StationCode, nextAddress: router.NextPosi);
                        //原料一楼出库下发线体逻辑
                        if (stationManger.StationDeviceCode == "CL1_YL")
                        {
                            // å †åž›æœºå®Œæˆ
                            _taskService.UpdateTask(task, TaskStatusEnum.Line_Execute, deviceCode: stationManger.StationDeviceCode, currentAddress: stationManger.StationCode, nextAddress: router.NextPosi);
                        }
                        else//原料二楼出库下发线体逻辑
                        {
                            IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode);
                            if (device != null)
                            {
                                CommonConveyorLine conveyorLine = (CommonConveyorLine)device;
                                conveyorLine.SetValue(ConveyorLineDBName.TaskNum, taskNum, stationManger.StationCode);
                                conveyorLine.SetValue(ConveyorLineDBName.TargetAddress, router.NextPosi, stationManger.StationCode);
                                conveyorLine.SetValue(ConveyorLineDBName.Width, task.TaskLength, stationManger.StationCode);
                                conveyorLine.SetValue(ConveyorLineDBName.Barcode, task.PalletCode, stationManger.StationCode);
                                conveyorLine.SetValue(ConveyorLineDBName.ResponState, 86, stationManger.StationCode);
                                _taskService.UpdateTaskStatusToNext(task);
                            }
                            else
                            {
                                WriteInfo(deviceCode, $"未找到出库站台【{stationManger.StationDeviceCode}】对应的通讯对象,无法发送输送线出库信号");
                                _taskService.UpdateTaskExceptionMessage(taskNum, $"未找到出库站台【{stationManger.StationDeviceCode}】对应的通讯对象,无法发送输送线出库信号");
                                return WebResponseContent.Instance.Error($"未找到出库站台【{stationManger.StationDeviceCode}】对应的通讯对象,无法发送输送线出库信号");
                            }
                        }
                        _taskExecuteDetailService.AddTaskExecuteDetail(taskNum, $"系统自动流程,任务状态从【{oldStatus}】转到【{task.TaskState}】");
                        WriteInfo(deviceCode, $"堆垛机出库任务完成,任务号:{taskNum}");
                    }
@@ -244,21 +270,43 @@
            Dt_StationManger? stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == task.NextAddress && x.StackerCraneCode == task.DeviceCode);
            if (stationManger != null)
            {
                IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode);
                if (device != null)
                if (stationManger.StationDeviceCode == "CL1_YL")
                {
                    OtherDevice client = (OtherDevice)device;
                    if (client.GetValue<WR_CLineYLDB, short>(WR_CLineYLDB.WR_Request, stationManger.StationCode) != 99)//出库站台未被占用
                    IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode);
                    if (device != null)
                    {
                        task.NextAddress = stationManger.StackerCraneStationCode;
                        _taskRepository.UpdateData(task);
                        return task;
                        OtherDevice client = (OtherDevice)device;
                        if (client.GetValue<WR_CLineYLDB, short>(WR_CLineYLDB.WR_Request, stationManger.StationCode) != 99)//出库站台未被占用
                        {
                            task.NextAddress = stationManger.StackerCraneStationCode;
                            _taskRepository.UpdateData(task);
                            return task;
                        }
                    }
                    else
                    {
                        WriteInfo(task.DeviceCode, $"未找到出库站台【{stationManger.StationDeviceCode}】对应的通讯对象,无法判断出库站台是否被占用");
                        _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"未找到出库站台【{stationManger.StationDeviceCode}】对应的通讯对象,无法判断出库站台是否被占用");
                    }
                }
                else
                {
                    WriteInfo(task.DeviceCode, $"未找到出库站台【{stationManger.StationDeviceCode}】对应的通讯对象,无法判断出库站台是否被占用");
                    _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"未找到出库站台【{stationManger.StationDeviceCode}】对应的通讯对象,无法判断出库站台是否被占用");
                    IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode);
                    if (device != null)
                    {
                        CommonConveyorLine client = (CommonConveyorLine)device;
                        if (client.GetValue<ConveyorLineDBName, short>(ConveyorLineDBName.InteractiveSignal, stationManger.StationCode) != 99)//出库站台未被占用
                        {
                            task.NextAddress = stationManger.StackerCraneStationCode;
                            _taskRepository.UpdateData(task);
                            return task;
                        }
                    }
                    else
                    {
                        WriteInfo(task.DeviceCode, $"未找到出库站台【{stationManger.StationDeviceCode}】对应的通讯对象,无法判断出库站台是否被占用");
                        _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"未找到出库站台【{stationManger.StationDeviceCode}】对应的通讯对象,无法判断出库站台是否被占用");
                    }
                }
            }
            else