diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index 6ae579a2..a2c1b148 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -4002,6 +4002,38 @@ namespace Myshipping.Application primaryModel.SERVICEEDICODE = currServiceInfo.MapCode?.Trim(); } + //签单方式EDI + var baseIssueTypeList = _cache.GetAllCodeIssueType().GetAwaiter().GetResult(); + + var baseIssueTypeInfo = baseIssueTypeList.FirstOrDefault(t => + t.EnName.Equals(order.ISSUETYPE, StringComparison.OrdinalIgnoreCase)); + + if (baseServiceInfo == null) + throw Oops.Bah($"签单方式{order.ISSUETYPE}的基础代码未找到"); + + //付费方式映射 + var ediIssueTypeList = _cache.GetAllMappingIssueType().GetAwaiter().GetResult() + .Where(t => t.Module.Equals(CONST_MAPPING_MODULE, StringComparison.OrdinalIgnoreCase) + ).ToList(); + + if (!string.IsNullOrWhiteSpace(order.ISSUETYPE)) + { + var currIssueTypeInfo = ediIssueTypeList.FirstOrDefault(t => !string.IsNullOrWhiteSpace(t.CarrierCode) + && t.CarrierCode.Equals(order.CARRIERID, StringComparison.OrdinalIgnoreCase) + && t.Code.Equals(baseServiceInfo.Code, StringComparison.OrdinalIgnoreCase)); + + if (currIssueTypeInfo == null) + { + //如果没有对应的船司记录,则取默认的第一个代码对应的记录 + currIssueTypeInfo = ediIssueTypeList.FirstOrDefault(t => t.Code.Equals(baseServiceInfo.Code, StringComparison.OrdinalIgnoreCase)); + } + + if (currIssueTypeInfo == null) + throw Oops.Bah($"签单方式{order.ISSUETYPE}的EDI代码未找到"); + + primaryModel.ISSUETYPE = currIssueTypeInfo.MapCode?.Trim(); + } + primaryModel.CARRIEREDICODE = ediSOSICfg.MapCode; primaryModel.ORDERNO = order.BOOKINGNO; diff --git a/Myshipping.Core/Entity/CommonDB/CodeIssueType.cs b/Myshipping.Core/Entity/CommonDB/CodeIssueType.cs index f6f7bb9c..63410ff0 100644 --- a/Myshipping.Core/Entity/CommonDB/CodeIssueType.cs +++ b/Myshipping.Core/Entity/CommonDB/CodeIssueType.cs @@ -72,7 +72,10 @@ namespace Myshipping.Core.Entity.CommonDB /// public string Remark { get; set; } - + /// + /// 船司代码 + /// + public string CarrierCode { get; set; } } diff --git a/Myshipping.Core/Myshipping.Core.xml b/Myshipping.Core/Myshipping.Core.xml index a92fe94a..a66e5950 100644 --- a/Myshipping.Core/Myshipping.Core.xml +++ b/Myshipping.Core/Myshipping.Core.xml @@ -1112,6 +1112,11 @@ 备注 + + + 船司代码 + + 航线代码