wanshenmean
7 小时以前 96adc295cb04fd135d63d3a907f2732274f90965
Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
@@ -4,6 +4,7 @@
using SqlSugar;
using System.DirectoryServices.Protocols;
using System.Text.Json;
using WIDESEA_Common.Constants;
using WIDESEA_Common.LocationEnum;
using WIDESEA_Common.StockEnum;
using WIDESEA_Common.TaskEnum;
@@ -16,7 +17,6 @@
using WIDESEA_Core.Helper;
using WIDESEA_DTO.GradingMachine;
using WIDESEA_DTO.MES;
using WIDESEA_DTO.Stock;
using WIDESEA_DTO.Task;
using WIDESEA_IBasicService;
using WIDESEA_IRecordService;
@@ -39,6 +39,9 @@
        private readonly IStockInfo_HtyService _stockInfo_HtyService;
        private readonly IUnitOfWorkManage _unitOfWorkManage;
        private readonly IRecordService _recordService;
        private readonly IMESDeviceConfigService _mesDeviceConfigService;
        private readonly IMesLogService _mesLogService;
        private readonly IMesUploadHelper _mesUploadHelper;
        public IRepository<Dt_Task> Repository => BaseDal;
@@ -63,7 +66,10 @@
            ITask_HtyService task_HtyService,
            IStockInfo_HtyService stockInfo_HtyService,
            IUnitOfWorkManage unitOfWorkManage,
            IRecordService recordService) : base(BaseDal)
            IRecordService recordService,
            IMESDeviceConfigService mesDeviceConfigService,
            IMesLogService mesLogService,
            IMesUploadHelper mesUploadHelper) : base(BaseDal)
        {
            _mapper = mapper;
            _stockInfoService = stockInfoService;
@@ -76,6 +82,9 @@
            _stockInfo_HtyService = stockInfo_HtyService;
            _unitOfWorkManage = unitOfWorkManage;
            _recordService = recordService;
            _mesDeviceConfigService = mesDeviceConfigService;
            _mesLogService = mesLogService;
            _mesUploadHelper = mesUploadHelper;
        }
        /// <summary>
@@ -146,7 +155,7 @@
        private string DetermineTargetAddress(string roadway, Dictionary<string, List<string>> addressMap)
        {
            if (string.IsNullOrWhiteSpace(roadway))
                return "10080";
                return TaskAddressConstants.DEFAULT_ADDRESS;
            string? matchedPrefix = null;
            foreach (var kvp in addressMap)
@@ -159,10 +168,10 @@
            }
            if (matchedPrefix == null)
                return "10080";
                return TaskAddressConstants.DEFAULT_ADDRESS;
            if (!addressMap.TryGetValue(matchedPrefix, out var addresses) || addresses == null || addresses.Count == 0)
                return "10080";
                return TaskAddressConstants.DEFAULT_ADDRESS;
            if (addresses.Count == 1)
                return addresses[0];
@@ -180,9 +189,9 @@
            {
                return remark switch
                {
                    "GW_1" => _roundRobinService.GetNextAddress("GW_1", new List<string> { "11001", "11010" }),
                    "GW_2" => "CWSC1",
                    "CW_1" => "22001",
                    StockRemarkConstants.GW1 => _roundRobinService.GetNextAddress(StockRemarkConstants.GW1, TaskAddressConstants.GW1_ADDRESSES.ToList()),
                    StockRemarkConstants.GW2 => TaskAddressConstants.GW2_ADDRESS,
                    StockRemarkConstants.CW1 => TaskAddressConstants.CW1_ADDRESS,
                    _ => DetermineTargetAddress(roadway, addressMap)
                };
            }
@@ -190,5 +199,6 @@
            // Remark 为空时,回退到巷道配置
            return DetermineTargetAddress(roadway, addressMap);
        }
    }
}