From 963aa00ec6b120d05dc702129b176c327213653b Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期一, 09 三月 2026 09:32:32 +0800
Subject: [PATCH] feat: 支持多出库口轮询选择
---
Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs | 32 ++++++++++++++++++++++++++------
1 files changed, 26 insertions(+), 6 deletions(-)
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
index b0cbc13..28564a1 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
@@ -24,6 +24,7 @@
private readonly ILocationInfoService _locationInfoService;
private readonly HttpClientHelper _httpClientHelper;
private readonly IConfiguration _configuration;
+ private readonly RoundRobinService _roundRobinService;
public IRepository<Dt_Task> Repository => BaseDal;
@@ -42,13 +43,15 @@
IStockInfoService stockInfoService,
ILocationInfoService locationInfoService,
HttpClientHelper httpClientHelper,
- IConfiguration configuration) : base(BaseDal)
+ IConfiguration configuration,
+ RoundRobinService roundRobinService) : base(BaseDal)
{
_mapper = mapper;
_stockInfoService = stockInfoService;
_locationInfoService = locationInfoService;
_httpClientHelper = httpClientHelper;
_configuration = configuration;
+ _roundRobinService = roundRobinService;
}
#region WCS閫昏緫澶勭悊
@@ -380,20 +383,37 @@
}
/// <summary>
- /// 鏍规嵁宸烽亾纭畾鐩爣鍦板潃
+ /// 鏍规嵁宸烽亾纭畾鐩爣鍦板潃锛堟敮鎸佸鍑哄簱鍙h疆璇級
/// </summary>
- private string DetermineTargetAddress(string roadway, Dictionary<string, string> addressMap)
+ private string DetermineTargetAddress(string roadway, Dictionary<string, List<string>> addressMap)
{
if (string.IsNullOrWhiteSpace(roadway))
- return "10080"; // 榛樿鍦板潃
+ return "10080";
+ // 鏌ユ壘鍖归厤鐨勫贩閬撳墠缂�
+ string matchedPrefix = null;
foreach (var kvp in addressMap)
{
if (roadway.Contains(kvp.Key))
- return kvp.Value;
+ {
+ matchedPrefix = kvp.Key;
+ break;
+ }
}
- return "10080"; // 榛樿鍦板潃
+ if (matchedPrefix == null)
+ return "10080";
+
+ var addresses = addressMap[matchedPrefix];
+ if (addresses == null || addresses.Count == 0)
+ return "10080";
+
+ // 鍗曚釜鍦板潃锛岀洿鎺ヨ繑鍥�
+ if (addresses.Count == 1)
+ return addresses[0];
+
+ // 澶氫釜鍦板潃锛屼娇鐢ㄨ疆璇㈡湇鍔�
+ return _roundRobinService.GetNextAddress(matchedPrefix, addresses);
}
/// <summary>
--
Gitblit v1.9.3