| | |
| | | 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; |
| | |
| | | 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) |
| | |
| | | } |
| | | |
| | | 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]; |
| | |
| | | { |
| | | 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) |
| | | }; |
| | | } |