xiazhengtongxue
16 小时以前 0aed9c9ee65bd8a17837d83ec05e756d11fab297
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneCommandBuilder.cs
@@ -1,9 +1,7 @@
using Microsoft.Extensions.Logging;
using System;
using Serilog;
using System.Diagnostics.CodeAnalysis;
using WIDESEAWCS_Common.Constants;
using WIDESEAWCS_Common.TaskEnum;
using WIDESEAWCS_Core.LogHelper;
using WIDESEAWCS_ITaskInfoService;
using WIDESEAWCS_Model.Models;
using WIDESEAWCS_QuartzJob.Models;
@@ -37,11 +35,6 @@
        private readonly IRouterService _routerService;
        /// <summary>
        /// 堆垛机命令配置
        /// </summary>
        private readonly StackerCraneCommandConfig _config;
        /// <summary>
        /// 日志记录器
        /// </summary>
        private readonly ILogger _logger;
@@ -56,12 +49,10 @@
        public StackerCraneCommandBuilder(
            ITaskService taskService,
            IRouterService routerService,
            StackerCraneCommandConfig config,
            ILogger logger)
        {
            _taskService = taskService;
            _routerService = routerService;
            _config = config;
            _logger = logger;
        }
@@ -75,7 +66,7 @@
        /// <returns>堆垛机命令对象,转换失败返回 null</returns>
        public object? ConvertToStackerCraneTaskCommand([NotNull] Dt_Task task)
        {
            return  BuildCommand(task, CreateStandardCommand(task));
            return BuildCommand(task, CreateStandardCommand(task));
            // 根据巷道获取命令类型
            //string commandType = GetCommandType(task.Roadway);
@@ -99,20 +90,20 @@
        /// </remarks>
        /// <param name="roadway">巷道编码</param>
        /// <returns>命令类型(Standard 或 Formation)</returns>
        private string GetCommandType(string roadway)
        {
            foreach (var mapping in _config.RoadwayCommandMapping)
            {
                if (roadway.Contains(mapping.Key))
                {
                    QuartzLogHelper.LogDebug(_logger, "GetCommandType:匹配巷道 {Roadway},命令类型: {CommandType}", $"GetCommandType:匹配巷道 {roadway},命令类型: {mapping.Value}", roadway, roadway, mapping.Value);
                    return mapping.Value;
                }
            }
        //private string GetCommandType(string roadway)
        //{
        //    foreach (var mapping in _config.RoadwayCommandMapping)
        //    {
        //        if (roadway.Contains(mapping.Key))
        //        {
        //            QuartzLogHelper.LogDebug(_logger, "GetCommandType:匹配巷道 {Roadway},命令类型: {CommandType}", $"GetCommandType:匹配巷道 {roadway},命令类型: {mapping.Value}", roadway, roadway, mapping.Value);
        //            return mapping.Value;
        //        }
        //    }
            QuartzLogHelper.LogDebug(_logger, "GetCommandType:巷道 {Roadway} 未匹配,使用默认命令类型: {DefaultType}", $"GetCommandType:巷道 {roadway} 未匹配,使用默认命令类型: {_config.DefaultCommandType}", roadway, roadway, _config.DefaultCommandType);
            return _config.DefaultCommandType;
        }
        //    QuartzLogHelper.LogDebug(_logger, "GetCommandType:巷道 {Roadway} 未匹配,使用默认命令类型: {DefaultType}", $"GetCommandType:巷道 {roadway} 未匹配,使用默认命令类型: {_config.DefaultCommandType}", roadway, roadway, _config.DefaultCommandType);
        //    return _config.DefaultCommandType;
        //}
        /// <summary>
        /// 创建标准命令
@@ -205,7 +196,7 @@
            {
                taskType = StackerCraneConst.EmptyPalletTaskType;
            }
            else if(task.TaskType == (int)TaskInboundTypeEnum.InEmpty)
            else if (task.TaskType == (int)TaskInboundTypeEnum.InEmpty)
            {
                taskType = StackerCraneConst.EmptyInPalletTaskType;
            }
@@ -395,4 +386,4 @@
                && short.TryParse(parts[2], out layer);
        }
    }
}
}