From 234bec78dd54ca0e2952b8d31d0c17ee1dc89ba9 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期六, 18 四月 2026 15:51:32 +0800
Subject: [PATCH] feat: 添加MES设备动态凭证支持
---
Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs | 38 +++++++++++++++++++++++++++++++++-----
1 files changed, 33 insertions(+), 5 deletions(-)
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
index fe278a6..0b7d8e4 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
+++ b/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;
@@ -19,6 +20,7 @@
using WIDESEA_DTO.Stock;
using WIDESEA_DTO.Task;
using WIDESEA_IBasicService;
+using WIDESEA_IRecordService;
using WIDESEA_IStockService;
using WIDESEA_ITaskInfoService;
using WIDESEA_Model.Models;
@@ -37,6 +39,8 @@
private readonly ITask_HtyService _task_HtyService;
private readonly IStockInfo_HtyService _stockInfo_HtyService;
private readonly IUnitOfWorkManage _unitOfWorkManage;
+ private readonly IRecordService _recordService;
+ private readonly IMESDeviceConfigService _mesDeviceConfigService;
public IRepository<Dt_Task> Repository => BaseDal;
@@ -60,7 +64,9 @@
IMesService mesService,
ITask_HtyService task_HtyService,
IStockInfo_HtyService stockInfo_HtyService,
- IUnitOfWorkManage unitOfWorkManage) : base(BaseDal)
+ IUnitOfWorkManage unitOfWorkManage,
+ IRecordService recordService,
+ IMESDeviceConfigService mesDeviceConfigService) : base(BaseDal)
{
_mapper = mapper;
_stockInfoService = stockInfoService;
@@ -72,6 +78,8 @@
_task_HtyService = task_HtyService;
_stockInfo_HtyService = stockInfo_HtyService;
_unitOfWorkManage = unitOfWorkManage;
+ _recordService = recordService;
+ _mesDeviceConfigService = mesDeviceConfigService;
}
/// <summary>
@@ -142,7 +150,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)
@@ -155,10 +163,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];
@@ -166,5 +174,25 @@
return _roundRobinService.GetNextAddress(matchedPrefix, addresses);
}
+ /// <summary>
+ /// 鏍规嵁搴撳瓨 Remark 纭畾鐩爣鍦板潃锛圙W_1鈫抂11001,11010]杞锛孏W_2鈫扖WSC1锛孋W_1鈫�22001锛夈��
+ /// </summary>
+ private string DetermineTargetAddressByRemark(string remark, string roadway, Dictionary<string, List<string>> addressMap)
+ {
+ // 鏍规嵁 Remark 纭畾鐩爣鍦板潃
+ if (!string.IsNullOrWhiteSpace(remark))
+ {
+ return remark switch
+ {
+ StockRemarkConstants.GW1 => _roundRobinService.GetNextAddress(StockRemarkConstants.GW1, TaskAddressConstants.GW1_ADDRESSES.ToList()),
+ StockRemarkConstants.GW2 => TaskAddressConstants.GW2_ADDRESS,
+ StockRemarkConstants.CW1 => TaskAddressConstants.CW1_ADDRESS,
+ _ => DetermineTargetAddress(roadway, addressMap)
+ };
+ }
+
+ // Remark 涓虹┖鏃讹紝鍥為��鍒板贩閬撻厤缃�
+ return DetermineTargetAddress(roadway, addressMap);
+ }
}
-}
+}
\ No newline at end of file
--
Gitblit v1.9.3