From 51a581414b4fb3896d82d9d1e768b3ff4946bf8c Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Tue, 25 Apr 2023 16:09:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=A2=E8=88=B1=E7=9A=84ED?= =?UTF-8?q?I=EF=BC=8C=E5=A2=9E=E5=8A=A0=E7=AD=BE=E5=8D=95=E6=96=B9?= =?UTF-8?q?=E5=BC=8F=E6=98=A0=E5=B0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BookingOrder/BookingOrderService.cs | 32 +++++++++++++++++++ .../Entity/CommonDB/CodeIssueType.cs | 5 ++- Myshipping.Core/Myshipping.Core.xml | 5 +++ 3 files changed, 41 insertions(+), 1 deletion(-) 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 @@ 备注 + + + 船司代码 + + 航线代码