From ee33d42795e69cfa259a1b0fc6ab7aa38d964f3b Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Mon, 3 Apr 2023 16:02:34 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9EDI=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=B8=AF=E5=8F=A3=E6=98=A0=E5=B0=84=E6=A3=80=E7=B4=A2?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=EF=BC=8C=E5=A6=82=E6=9E=9CEdi=20code?= =?UTF-8?q?=E5=AF=B9=E5=BA=94=E5=A4=9A=E6=9D=A1=EF=BC=8C=E5=8F=AA=E8=A6=81?= =?UTF-8?q?=E5=85=B6=E4=B8=AD=E4=B8=80=E6=9D=A1=E6=9C=89EDI=20code?= =?UTF-8?q?=E5=B0=B1=E9=BB=98=E8=AE=A4=E9=80=82=E7=94=A8=E8=BF=99=E4=B8=AA?= =?UTF-8?q?=E7=9B=AE=E7=9A=84=E6=B8=AF=E5=AF=B9=E5=BA=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BookingOrder/BookingOrderService.cs | 75 ++++++++----------- 1 file changed, 30 insertions(+), 45 deletions(-) diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index 07bad531..bb24e3fa 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -3669,26 +3669,23 @@ namespace Myshipping.Application //卸货港 if (!string.IsNullOrWhiteSpace(primaryModel.PORTDISCHARGEID)) { - var checkName = portList.Count(a => + var sameList = portList.Where(a => !string.IsNullOrWhiteSpace(a.EdiCode) - && a.EdiCode.Equals(primaryModel.PORTDISCHARGEID, StringComparison.OrdinalIgnoreCase)) > 1; + && a.EdiCode.Equals(primaryModel.PORTDISCHARGEID, StringComparison.OrdinalIgnoreCase)) + .Select(a => a.Code).ToList(); - var basePortInfo = portList.FirstOrDefault(a => !string.IsNullOrWhiteSpace(a.EdiCode) - && a.EdiCode.Equals(primaryModel.PORTDISCHARGEID, StringComparison.OrdinalIgnoreCase) - && (!checkName || a.EnName.Equals(primaryModel.PORTDISCHARGE, StringComparison.OrdinalIgnoreCase))); - - if (basePortInfo == null) + if (sameList == null || sameList.Count == 0) throw Oops.Bah($"卸货港{primaryModel.PORTDISCHARGEID}基础港口代码未找到"); var currPortInfo = ediPortList.FirstOrDefault(a => - a.Code.Equals(basePortInfo.Code?.Trim(), StringComparison.OrdinalIgnoreCase) + sameList.Contains(a.Code) && !string.IsNullOrWhiteSpace(a.CarrierCode) && a.CarrierCode.Equals(order.CARRIERID, StringComparison.OrdinalIgnoreCase)); if (currPortInfo == null) { currPortInfo = ediPortList.FirstOrDefault(a => - a.Code.Equals(basePortInfo.Code?.Trim(), StringComparison.OrdinalIgnoreCase)); + sameList.Contains(a.Code)); } if (currPortInfo == null) @@ -3700,26 +3697,23 @@ namespace Myshipping.Application //中转港 if (!string.IsNullOrWhiteSpace(primaryModel.TRANSPORTID)) { - var checkName = portList.Count(a => + var sameList = portList.Where(a => !string.IsNullOrWhiteSpace(a.EdiCode) - && a.EdiCode.Equals(primaryModel.TRANSPORTID, StringComparison.OrdinalIgnoreCase)) > 1; - - var basePortInfo = portList.FirstOrDefault(a => !string.IsNullOrWhiteSpace(a.EdiCode) - && a.EdiCode.Equals(primaryModel.TRANSPORTID, StringComparison.OrdinalIgnoreCase) - && (!checkName || a.EnName.Equals(primaryModel.TRANSPORT, StringComparison.OrdinalIgnoreCase))); + && a.EdiCode.Equals(primaryModel.TRANSPORTID, StringComparison.OrdinalIgnoreCase)) + .Select(a => a.Code).ToList(); - if (basePortInfo == null) + if (sameList == null || sameList.Count == 0) throw Oops.Bah($"中转港{primaryModel.TRANSPORTID}基础港口代码未找到"); var currPortInfo = ediPortList.FirstOrDefault(a => - a.Code.Equals(basePortInfo.Code?.Trim(), StringComparison.OrdinalIgnoreCase) + sameList.Contains(a.Code) && !string.IsNullOrWhiteSpace(a.CarrierCode) && a.CarrierCode.Equals(order.CARRIERID, StringComparison.OrdinalIgnoreCase)); if (currPortInfo == null) { currPortInfo = ediPortList.FirstOrDefault(a => - a.Code.Equals(basePortInfo.Code?.Trim(), StringComparison.OrdinalIgnoreCase)); + sameList.Contains(a.Code)); } if (currPortInfo == null) @@ -3731,26 +3725,23 @@ namespace Myshipping.Application //目的地 if (!string.IsNullOrWhiteSpace(primaryModel.DESTINATIONID)) { - var checkName = portList.Count(a => + var sameList = portList.Where(a => !string.IsNullOrWhiteSpace(a.EdiCode) - && a.EdiCode.Equals(primaryModel.DESTINATIONID, StringComparison.OrdinalIgnoreCase)) > 1; - - var basePortInfo = portList.FirstOrDefault(a => !string.IsNullOrWhiteSpace(a.EdiCode) - && a.EdiCode.Equals(primaryModel.DESTINATIONID, StringComparison.OrdinalIgnoreCase) - && (!checkName || a.EnName.Equals(primaryModel.DESTINATION, StringComparison.OrdinalIgnoreCase))); + && a.EdiCode.Equals(primaryModel.DESTINATIONID, StringComparison.OrdinalIgnoreCase)) + .Select(a => a.Code?.Trim()).ToList(); - if (basePortInfo == null) + if (sameList == null || sameList.Count == 0) throw Oops.Bah($"目的地{primaryModel.DESTINATIONID}基础港口代码未找到"); var currPortInfo = ediPortList.FirstOrDefault(a => - a.Code.Equals(basePortInfo.Code?.Trim(), StringComparison.OrdinalIgnoreCase) + sameList.Contains(a.Code) && !string.IsNullOrWhiteSpace(a.CarrierCode) && a.CarrierCode.Equals(order.CARRIERID, StringComparison.OrdinalIgnoreCase)); if (currPortInfo == null) { currPortInfo = ediPortList.FirstOrDefault(a => - a.Code.Equals(basePortInfo.Code?.Trim(), StringComparison.OrdinalIgnoreCase)); + sameList.Contains(a.Code)); } if (currPortInfo == null) @@ -3762,26 +3753,23 @@ namespace Myshipping.Application //交货地 if (!string.IsNullOrWhiteSpace(primaryModel.PLACEDELIVERYID)) { - var checkName = portList.Count(a => + var sameList = portList.Where(a => !string.IsNullOrWhiteSpace(a.EdiCode) - && a.EdiCode.Equals(primaryModel.PLACEDELIVERYID, StringComparison.OrdinalIgnoreCase)) > 1; + && a.EdiCode.Equals(primaryModel.PLACEDELIVERYID, StringComparison.OrdinalIgnoreCase)) + .Select(a => a.Code).ToList(); - var basePortInfo = portList.FirstOrDefault(a => !string.IsNullOrWhiteSpace(a.EdiCode) - && a.EdiCode.Equals(primaryModel.PLACEDELIVERYID, StringComparison.OrdinalIgnoreCase) - && (!checkName || a.EnName.Equals(primaryModel.PLACEDELIVERY, StringComparison.OrdinalIgnoreCase))); - - if (basePortInfo == null) + if (sameList == null || sameList.Count == 0) throw Oops.Bah($"交货地{primaryModel.PLACEDELIVERYID}基础港口代码未找到"); var currPortInfo = ediPortList.FirstOrDefault(a => - a.Code.Equals(basePortInfo.Code?.Trim(), StringComparison.OrdinalIgnoreCase) + sameList.Contains(a.Code) && !string.IsNullOrWhiteSpace(a.CarrierCode) && a.CarrierCode.Equals(order.CARRIERID, StringComparison.OrdinalIgnoreCase)); if (currPortInfo == null) { currPortInfo = ediPortList.FirstOrDefault(a => - a.Code.Equals(basePortInfo.Code?.Trim(), StringComparison.OrdinalIgnoreCase)); + sameList.Contains(a.Code)); } if (currPortInfo == null) @@ -3793,26 +3781,23 @@ namespace Myshipping.Application //到付地点 if (!string.IsNullOrWhiteSpace(primaryModel.PAYABLEATID)) { - var checkName = portList.Count(a => + var sameList = portList.Where(a => !string.IsNullOrWhiteSpace(a.EdiCode) - && a.EdiCode.Equals(primaryModel.PAYABLEATID, StringComparison.OrdinalIgnoreCase)) > 1; - - var basePortInfo = portList.FirstOrDefault(a => !string.IsNullOrWhiteSpace(a.EdiCode) - && a.EdiCode.Equals(primaryModel.PAYABLEATID, StringComparison.OrdinalIgnoreCase) - && (!checkName || a.EnName.Equals(primaryModel.PAYABLEAT, StringComparison.OrdinalIgnoreCase))); + && a.EdiCode.Equals(primaryModel.PAYABLEATID, StringComparison.OrdinalIgnoreCase)) + .Select(a => a.Code).ToList(); - if (basePortInfo == null) + if (sameList == null || sameList.Count == 0) throw Oops.Bah($"到付地点{primaryModel.PAYABLEATID}基础港口代码未找到"); var currPortInfo = ediPortList.FirstOrDefault(a => - a.Code.Equals(basePortInfo.Code?.Trim(), StringComparison.OrdinalIgnoreCase) + sameList.Contains(a.Code) && !string.IsNullOrWhiteSpace(a.CarrierCode) && a.CarrierCode.Equals(order.CARRIERID, StringComparison.OrdinalIgnoreCase)); if (currPortInfo == null) { currPortInfo = ediPortList.FirstOrDefault(a => - a.Code.Equals(basePortInfo.Code?.Trim(), StringComparison.OrdinalIgnoreCase)); + sameList.Contains(a.Code)); } if (currPortInfo == null) From ca23a1a4599e110eddc9c0873be4cc3f0049855e Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Mon, 3 Apr 2023 16:40:20 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9EDI=20PIL=E5=A4=AA?= =?UTF-8?q?=E5=B9=B3=E9=BB=98=E8=AE=A4=E5=AF=B9=E5=BA=94=E7=9A=84=E8=88=AA?= =?UTF-8?q?=E6=AC=A1=E5=8F=96=E8=AE=A2=E8=88=B1=E7=9A=84=E5=86=85=E9=83=A8?= =?UTF-8?q?=E8=88=AA=E6=AC=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/BookingOrder/BookingOrderService.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index bb24e3fa..a1e418bc 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -3602,6 +3602,12 @@ namespace Myshipping.Application var primaryModel = order.Adapt(); + //如果是太平应该将航次取内部航次号 2023-04-03 合川操作确认这样调整 + if (ediRouteEnum == EDIRouteEnum.PIL) + { + primaryModel.VOYNO = order.VOYNOINNER; + } + //起始港映射 var ediLoadPortList = _cache.GetAllMappingPortLoad().GetAwaiter().GetResult() .Where(t => t.Module.Equals(CONST_MAPPING_MODULE, StringComparison.OrdinalIgnoreCase) From 6695f265c42f857b3a7c07eb771e6f89d611ccb0 Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Mon, 3 Apr 2023 16:44:20 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9EDI=EF=BC=8C=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E8=88=AA=E6=AC=A1=E5=8F=B7=E7=9A=84=E5=AF=B9=E5=BA=94?= =?UTF-8?q?=EF=BC=8C=E6=89=80=E6=9C=89=E8=88=B9=E5=85=AC=E5=8F=B8=E8=88=AA?= =?UTF-8?q?=E6=AC=A1=E9=83=BD=E5=8F=96=E5=86=85=E9=83=A8=E8=88=AA=E6=AC=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/BookingOrder/BookingOrderService.cs | 7 ++----- .../Service/BookingOrder/Dto/BookingEDIMapper.cs | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index a1e418bc..d91fa22c 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -3602,11 +3602,8 @@ namespace Myshipping.Application var primaryModel = order.Adapt(); - //如果是太平应该将航次取内部航次号 2023-04-03 合川操作确认这样调整 - if (ediRouteEnum == EDIRouteEnum.PIL) - { - primaryModel.VOYNO = order.VOYNOINNER; - } + //航次取内部航次号 2023-04-03 合川操作确认这样调整 + primaryModel.VOYNO = order.VOYNOINNER; //起始港映射 var ediLoadPortList = _cache.GetAllMappingPortLoad().GetAwaiter().GetResult() diff --git a/Myshipping.Application/Service/BookingOrder/Dto/BookingEDIMapper.cs b/Myshipping.Application/Service/BookingOrder/Dto/BookingEDIMapper.cs index af7e9ead..fa777a28 100644 --- a/Myshipping.Application/Service/BookingOrder/Dto/BookingEDIMapper.cs +++ b/Myshipping.Application/Service/BookingOrder/Dto/BookingEDIMapper.cs @@ -20,7 +20,7 @@ namespace Myshipping.Application .Map(dest => dest.MBLNO, src => src.MBLNO) .Map(dest => dest.BLFRT, src => src.BLFRT) .Map(dest => dest.VESSEL, src => src.VESSEL) - .Map(dest => dest.VOYNO, src => src.VOYNO) + //.Map(dest => dest.VOYNO, src => src.VOYNO)//这里去掉映射,以后航次号都是取内部航次 .Map(dest => dest.ETD, src => src.ETD.HasValue ? src.ETD.Value.ToString("yyyy-MM-dd") : "") .Map(dest => dest.ETA, src => src.ETA.HasValue ? src.ETA.Value.ToString("yyyy-MM-dd") : "") .Map(dest => dest.CLOSINGDATE, src => src.CLOSINGDATE.HasValue ? src.CLOSINGDATE.Value.ToString("yyyy-MM-dd") : "")