wanshenmean
3 天以前 7278264f027d62664a0209699d0f66a22fd06a8e
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneCommandBuilder.cs
@@ -1,6 +1,7 @@
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;
@@ -74,18 +75,19 @@
        /// <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>
@@ -127,8 +129,8 @@
            return new StackerCraneTaskCommand
            {
                TaskNum = task.TaskNum,   // 任务号
                WorkType = 1,             // 作业类型
                WorkAction = 1            // 作业指令:开始执行
                WorkType = StackerCraneConst.WorkTypeInbound,  // 作业类型:入库
                //WorkAction = StackerCraneWorkActionEnum.StartTask  // 作业指令:开始执行
            };
        }
@@ -147,10 +149,10 @@
            {
                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     // 保留字段
            };
        }
@@ -201,11 +203,11 @@
            _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;
@@ -269,7 +271,7 @@
            int taskType = 0;
            if (task.TaskType == (int)TaskOutboundTypeEnum.OutEmpty)
            {
                taskType = 100;
                taskType = StackerCraneConst.EmptyPalletTaskType;
            }
            else
                taskType = task.TaskType;