diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index be34e181..7795a2dd 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -4312,23 +4312,23 @@ namespace Myshipping.Application } } - //运输条款EDI - var baseServiceList = _cache.GetAllCodeService().GetAwaiter().GetResult(); + if (!string.IsNullOrWhiteSpace(order.SERVICE)) + { + //运输条款EDI + var baseServiceList = _cache.GetAllCodeService().GetAwaiter().GetResult(); - var baseServiceInfo = baseServiceList.FirstOrDefault(t => - t.Name.Equals(order.SERVICE, StringComparison.OrdinalIgnoreCase)); + var baseServiceInfo = baseServiceList.FirstOrDefault(t => + t.Name.Equals(order.SERVICE, StringComparison.OrdinalIgnoreCase)); - if (baseServiceInfo == null) - throw Oops.Bah($"运输条款{order.SERVICE}的基础代码未找到"); + if (baseServiceInfo == null) + throw Oops.Bah($"运输条款{order.SERVICE}的基础代码未找到"); - //运输条款映射 - var ediServiceList = _cache.GetAllMappingService().GetAwaiter().GetResult() - .Where(t => t.Module.Equals(CONST_MAPPING_MODULE, StringComparison.OrdinalIgnoreCase) - && !string.IsNullOrWhiteSpace(t.CarrierCode) && t.CarrierCode.Equals(order.CARRIERID, StringComparison.OrdinalIgnoreCase) - ).ToList(); + //运输条款映射 + var ediServiceList = _cache.GetAllMappingService().GetAwaiter().GetResult() + .Where(t => t.Module.Equals(CONST_MAPPING_MODULE, StringComparison.OrdinalIgnoreCase) + && !string.IsNullOrWhiteSpace(t.CarrierCode) && t.CarrierCode.Equals(order.CARRIERID, StringComparison.OrdinalIgnoreCase) + ).ToList(); - if (!string.IsNullOrWhiteSpace(order.SERVICE)) - { var currServiceInfo = ediServiceList.FirstOrDefault(t => t.Code.Equals(baseServiceInfo.Code, StringComparison.OrdinalIgnoreCase)); if (currServiceInfo == null) @@ -4337,22 +4337,23 @@ 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 (!string.IsNullOrWhiteSpace(order.ISSUETYPE)) + { + //签单方式EDI + var baseIssueTypeList = _cache.GetAllCodeIssueType().GetAwaiter().GetResult(); - if (baseIssueTypeInfo == null) - throw Oops.Bah($"签单方式{order.ISSUETYPE}的基础代码未找到"); + var baseIssueTypeInfo = baseIssueTypeList.FirstOrDefault(t => + t.EnName.Equals(order.ISSUETYPE, StringComparison.OrdinalIgnoreCase)); - //签单方式映射 - var ediIssueTypeList = _cache.GetAllMappingIssueType().GetAwaiter().GetResult() - .Where(t => t.Module.Equals(CONST_MAPPING_MODULE, StringComparison.OrdinalIgnoreCase) - ).ToList(); + if (baseIssueTypeInfo == 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(baseIssueTypeInfo.Code, StringComparison.OrdinalIgnoreCase));