wangxinhui
4 天以前 a0a0df2e824b6fe7e5a3c0afce78127fecf84fc9
ÏîÄ¿´úÂë/WCS/WCSServices/WIDESEAWCS_Tasks/Ô­ÁÏ¿â/StackerCraneJob_YLSC2.cs
@@ -121,7 +121,7 @@
                {
                    if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
                    {
                        Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.StackerCraneStationCode == task.NextAddress && x.StackerCraneCode == deviceCode);
                        Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == task.NextAddress && x.StackerCraneCode == deviceCode);
                        if (stationManger == null)
                        {
                            _taskExecuteDetailService.AddTaskExecuteDetail(taskNum, $"输送线出库站点未配置,{task.NextAddress}");
@@ -136,26 +136,42 @@
                            return WebResponseContent.Instance.Error($"未找到路由信息,{task.NextAddress}");
                        }
                        int oldStatus = task.TaskState;
                        IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode);
                        if (device != null)
                        {
                            OtherDevice otherDevice = (OtherDevice)device;
                            otherDevice.SetValue(WR_CLineYLDB.WR_Task, taskNum, stationManger.StationCode);
                        // å †åž›æœºå®Œæˆ
                        _taskService.UpdateTask(task, TaskStatusEnum.Line_Execute, deviceCode: stationManger.StationDeviceCode, currentAddress: stationManger.StationCode, nextAddress: router.NextPosi);
                        }
                        else
                        {
                            WriteError(deviceCode, $"未找到出库站台【{stationManger.StationDeviceCode}】对应的通讯对象,无法发送输送线出库信号");
                            _taskService.UpdateTaskExceptionMessage(taskNum, $"未找到出库站台【{stationManger.StationDeviceCode}】对应的通讯对象,无法发送输送线出库信号");
                            return WebResponseContent.Instance.Error($"未找到出库站台【{stationManger.StationDeviceCode}】对应的通讯对象,无法发送输送线出库信号");
                        }
                        _taskExecuteDetailService.AddTaskExecuteDetail(taskNum, $"系统自动流程,任务状态从【{oldStatus}】转到【{task.TaskState}】");
                        WriteInfo(deviceCode, $"堆垛机出库任务完成,任务号:{taskNum}");
                    }
                    else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup || task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup)
                    {
                        WriteInfo(deviceCode, $"堆垛机任务完成,任务号:{taskNum}");
                        _taskService.TaskCompleted(taskNum);
                        WebResponseContent responseContent = _taskService.TaskCompleted(taskNum);
                        if (!responseContent.Status)
                        {
                            _taskService.UpdateTaskExceptionMessage(taskNum, $"{responseContent.Message}");
                        }
                        WriteInfo(deviceCode, $"堆垛机入库任务完成,任务号:{taskNum}");
                    }
                    else
                    {
                        WriteInfo(deviceCode, $"未找到该任务类型回调WMS任务完成接口,{task.TaskType}");
                        WriteError(deviceCode, $"未找到该任务类型回调WMS任务完成接口,{task.TaskType}");
                        _taskExecuteDetailService.AddTaskExecuteDetail(taskNum, $"未找到该任务类型回调WMS任务完成接口,{task.TaskType}");
                        _taskService.UpdateTaskExceptionMessage(taskNum, $"未找到该任务类型回调WMS任务完成接口,{task.TaskType}");
                    }
                }
                else
                {
                    WriteInfo(deviceCode, $"未找到任务信息,任务号:{taskNum}");
                    WriteError(deviceCode, $"未找到任务信息,任务号:{taskNum}");
                    return WebResponseContent.Instance.Error($"未找到任务信息,任务号:{taskNum}");
                }
@@ -249,8 +265,8 @@
                    OtherDevice client = (OtherDevice)device;
                    if (client.GetValue<WR_CLineYLDB, short>(WR_CLineYLDB.WR_Request, stationManger.StationCode) != 99)//出库站台未被占用
                    {
                        task.NextAddress = stationManger.StackerCraneStationCode;
                        _taskRepository.UpdateData(task);
                        //task.NextAddress = stationManger.StackerCraneStationCode;
                        //_taskRepository.UpdateData(task);
                        return task;
                    }
                    else
@@ -316,7 +332,8 @@
            }
            else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)//判断是否是出库任务
            {
                string[] targetCodes = task.NextAddress.Split("-");
                Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == task.NextAddress && x.StackerCraneCode == task.DeviceCode);
                string[] targetCodes = stationManger.StackerCraneStationCode.Split("-");
                if (targetCodes.Length == 3)
                {
                    stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[0]);