| | |
| | | using Microsoft.Extensions.Logging; |
| | | using System; |
| | | using System.Diagnostics.CodeAnalysis; |
| | | using WIDESEAWCS_Common.Constants; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Core.LogHelper; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | |
| | | /// <returns>堆垛机命令对象,转换失败返回 null</returns> |
| | | public object? ConvertToStackerCraneTaskCommand([NotNull] Dt_Task task) |
| | | { |
| | | return BuildCommand(task, CreateStandardCommand(task)); |
| | | // 根据巷道获取命令类型 |
| | | string commandType = GetCommandType(task.Roadway); |
| | | //string commandType = GetCommandType(task.Roadway); |
| | | |
| | | _logger.LogInformation("ConvertToStackerCraneTaskCommand:构建命令,任务号: {TaskNum},巷道: {Roadway},命令类型: {CommandType}", task.TaskNum, task.Roadway, commandType); |
| | | QuartzLogger.Info($"构建命令,任务号: {task.TaskNum},巷道: {task.Roadway},命令类型: {commandType}", task.Roadway); |
| | | //_logger.LogInformation("ConvertToStackerCraneTaskCommand:构建命令,任务号: {TaskNum},巷道: {Roadway},命令类型: {CommandType}", task.TaskNum, task.Roadway, commandType); |
| | | //QuartzLogger.Info($"构建命令,任务号: {task.TaskNum},巷道: {task.Roadway},命令类型: {commandType}", task.Roadway); |
| | | |
| | | // 根据命令类型调用相应的构建方法 |
| | | return commandType switch |
| | | { |
| | | "Formation" => BuildCommand(task, CreateFormationCommand(task)), // 成型命令 |
| | | _ => BuildCommand(task, CreateStandardCommand(task)) // 标准命令 |
| | | }; |
| | | //// 根据命令类型调用相应的构建方法 |
| | | //return commandType switch |
| | | //{ |
| | | // "Formation" => BuildCommand(task, CreateFormationCommand(task)), // 成型命令 |
| | | // _ => BuildCommand(task, CreateStandardCommand(task)) // 标准命令 |
| | | //}; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | return new StackerCraneTaskCommand |
| | | { |
| | | TaskNum = task.TaskNum, // 任务号 |
| | | WorkType = 1, // 作业类型 |
| | | WorkAction = 1 // 作业指令:开始执行 |
| | | WorkType = StackerCraneConst.WorkTypeInbound, // 作业类型:入库 |
| | | //WorkAction = StackerCraneWorkActionEnum.StartTask // 作业指令:开始执行 |
| | | }; |
| | | } |
| | | |
| | |
| | | { |
| | | Barcode = task.PalletCode, // 托盘条码 |
| | | TaskNum = task.TaskNum, // 任务号 |
| | | WorkType = 1, // 作业类型 |
| | | WorkAction = 1, // 作业指令:开始执行 |
| | | FireAlarm = 0, // 火警:正常 |
| | | HeartBeat = 0, // 心跳 |
| | | WorkType = StackerCraneConst.WorkTypeInbound, // 作业类型:入库 |
| | | WorkAction = (short)StackerCraneWorkActionEnum.StartTask, // 作业指令:开始执行 |
| | | FireAlarm = StackerCraneConst.FireAlarmNormal, // 火警:正常 |
| | | HeartBeat = StackerCraneConst.HeartBeatInitial, // 心跳 |
| | | FieldName = string.Empty // 保留字段 |
| | | }; |
| | | } |
| | |
| | | _logger.LogInformation("BuildInboundCommand:构建入库命令,任务号: {TaskNum}", task.TaskNum); |
| | | QuartzLogger.Info($"BuildInboundCommand:构建入库命令,任务号: {task.TaskNum}", task.Roadway); |
| | | |
| | | // 确定任务类型(空托盘用特殊类型 100) |
| | | // 确定任务类型(空托盘用特殊类型) |
| | | int taskType = 0; |
| | | if (task.TaskType == (int)TaskOutboundTypeEnum.OutEmpty) |
| | | { |
| | | taskType = 100; |
| | | taskType = StackerCraneConst.EmptyPalletTaskType; |
| | | } |
| | | else |
| | | taskType = task.TaskType; |
| | |
| | | int taskType = 0; |
| | | if (task.TaskType == (int)TaskOutboundTypeEnum.OutEmpty) |
| | | { |
| | | taskType = 100; |
| | | taskType = StackerCraneConst.EmptyPalletTaskType; |
| | | } |
| | | else |
| | | taskType = task.TaskType; |