wet 2 years ago
commit 99da78f02e

@ -3602,6 +3602,9 @@ namespace Myshipping.Application
var primaryModel = order.Adapt<MsOpSeaeEDIBaseModel>(); var primaryModel = order.Adapt<MsOpSeaeEDIBaseModel>();
//航次取内部航次号 2023-04-03 合川操作确认这样调整
primaryModel.VOYNO = order.VOYNOINNER;
//起始港映射 //起始港映射
var ediLoadPortList = _cache.GetAllMappingPortLoad().GetAwaiter().GetResult() var ediLoadPortList = _cache.GetAllMappingPortLoad().GetAwaiter().GetResult()
.Where(t => t.Module.Equals(CONST_MAPPING_MODULE, StringComparison.OrdinalIgnoreCase) .Where(t => t.Module.Equals(CONST_MAPPING_MODULE, StringComparison.OrdinalIgnoreCase)
@ -3669,26 +3672,23 @@ namespace Myshipping.Application
//卸货港 //卸货港
if (!string.IsNullOrWhiteSpace(primaryModel.PORTDISCHARGEID)) if (!string.IsNullOrWhiteSpace(primaryModel.PORTDISCHARGEID))
{ {
var checkName = portList.Count(a => var sameList = portList.Where(a =>
!string.IsNullOrWhiteSpace(a.EdiCode) !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}基础港口代码未找到"); throw Oops.Bah($"卸货港{primaryModel.PORTDISCHARGEID}基础港口代码未找到");
var currPortInfo = ediPortList.FirstOrDefault(a => var currPortInfo = ediPortList.FirstOrDefault(a =>
a.Code.Equals(basePortInfo.Code?.Trim(), StringComparison.OrdinalIgnoreCase) sameList.Contains(a.Code)
&& !string.IsNullOrWhiteSpace(a.CarrierCode) && !string.IsNullOrWhiteSpace(a.CarrierCode)
&& a.CarrierCode.Equals(order.CARRIERID, StringComparison.OrdinalIgnoreCase)); && a.CarrierCode.Equals(order.CARRIERID, StringComparison.OrdinalIgnoreCase));
if (currPortInfo == null) if (currPortInfo == null)
{ {
currPortInfo = ediPortList.FirstOrDefault(a => currPortInfo = ediPortList.FirstOrDefault(a =>
a.Code.Equals(basePortInfo.Code?.Trim(), StringComparison.OrdinalIgnoreCase)); sameList.Contains(a.Code));
} }
if (currPortInfo == null) if (currPortInfo == null)
@ -3700,26 +3700,23 @@ namespace Myshipping.Application
//中转港 //中转港
if (!string.IsNullOrWhiteSpace(primaryModel.TRANSPORTID)) if (!string.IsNullOrWhiteSpace(primaryModel.TRANSPORTID))
{ {
var checkName = portList.Count(a => var sameList = portList.Where(a =>
!string.IsNullOrWhiteSpace(a.EdiCode) !string.IsNullOrWhiteSpace(a.EdiCode)
&& a.EdiCode.Equals(primaryModel.TRANSPORTID, StringComparison.OrdinalIgnoreCase)) > 1; && a.EdiCode.Equals(primaryModel.TRANSPORTID, StringComparison.OrdinalIgnoreCase))
.Select(a => a.Code).ToList();
var basePortInfo = portList.FirstOrDefault(a => !string.IsNullOrWhiteSpace(a.EdiCode)
&& a.EdiCode.Equals(primaryModel.TRANSPORTID, StringComparison.OrdinalIgnoreCase)
&& (!checkName || a.EnName.Equals(primaryModel.TRANSPORT, StringComparison.OrdinalIgnoreCase)));
if (basePortInfo == null) if (sameList == null || sameList.Count == 0)
throw Oops.Bah($"中转港{primaryModel.TRANSPORTID}基础港口代码未找到"); throw Oops.Bah($"中转港{primaryModel.TRANSPORTID}基础港口代码未找到");
var currPortInfo = ediPortList.FirstOrDefault(a => var currPortInfo = ediPortList.FirstOrDefault(a =>
a.Code.Equals(basePortInfo.Code?.Trim(), StringComparison.OrdinalIgnoreCase) sameList.Contains(a.Code)
&& !string.IsNullOrWhiteSpace(a.CarrierCode) && !string.IsNullOrWhiteSpace(a.CarrierCode)
&& a.CarrierCode.Equals(order.CARRIERID, StringComparison.OrdinalIgnoreCase)); && a.CarrierCode.Equals(order.CARRIERID, StringComparison.OrdinalIgnoreCase));
if (currPortInfo == null) if (currPortInfo == null)
{ {
currPortInfo = ediPortList.FirstOrDefault(a => currPortInfo = ediPortList.FirstOrDefault(a =>
a.Code.Equals(basePortInfo.Code?.Trim(), StringComparison.OrdinalIgnoreCase)); sameList.Contains(a.Code));
} }
if (currPortInfo == null) if (currPortInfo == null)
@ -3731,26 +3728,23 @@ namespace Myshipping.Application
//目的地 //目的地
if (!string.IsNullOrWhiteSpace(primaryModel.DESTINATIONID)) if (!string.IsNullOrWhiteSpace(primaryModel.DESTINATIONID))
{ {
var checkName = portList.Count(a => var sameList = portList.Where(a =>
!string.IsNullOrWhiteSpace(a.EdiCode) !string.IsNullOrWhiteSpace(a.EdiCode)
&& a.EdiCode.Equals(primaryModel.DESTINATIONID, StringComparison.OrdinalIgnoreCase)) > 1; && a.EdiCode.Equals(primaryModel.DESTINATIONID, StringComparison.OrdinalIgnoreCase))
.Select(a => a.Code?.Trim()).ToList();
var basePortInfo = portList.FirstOrDefault(a => !string.IsNullOrWhiteSpace(a.EdiCode) if (sameList == null || sameList.Count == 0)
&& a.EdiCode.Equals(primaryModel.DESTINATIONID, StringComparison.OrdinalIgnoreCase)
&& (!checkName || a.EnName.Equals(primaryModel.DESTINATION, StringComparison.OrdinalIgnoreCase)));
if (basePortInfo == null)
throw Oops.Bah($"目的地{primaryModel.DESTINATIONID}基础港口代码未找到"); throw Oops.Bah($"目的地{primaryModel.DESTINATIONID}基础港口代码未找到");
var currPortInfo = ediPortList.FirstOrDefault(a => var currPortInfo = ediPortList.FirstOrDefault(a =>
a.Code.Equals(basePortInfo.Code?.Trim(), StringComparison.OrdinalIgnoreCase) sameList.Contains(a.Code)
&& !string.IsNullOrWhiteSpace(a.CarrierCode) && !string.IsNullOrWhiteSpace(a.CarrierCode)
&& a.CarrierCode.Equals(order.CARRIERID, StringComparison.OrdinalIgnoreCase)); && a.CarrierCode.Equals(order.CARRIERID, StringComparison.OrdinalIgnoreCase));
if (currPortInfo == null) if (currPortInfo == null)
{ {
currPortInfo = ediPortList.FirstOrDefault(a => currPortInfo = ediPortList.FirstOrDefault(a =>
a.Code.Equals(basePortInfo.Code?.Trim(), StringComparison.OrdinalIgnoreCase)); sameList.Contains(a.Code));
} }
if (currPortInfo == null) if (currPortInfo == null)
@ -3762,26 +3756,23 @@ namespace Myshipping.Application
//交货地 //交货地
if (!string.IsNullOrWhiteSpace(primaryModel.PLACEDELIVERYID)) if (!string.IsNullOrWhiteSpace(primaryModel.PLACEDELIVERYID))
{ {
var checkName = portList.Count(a => var sameList = portList.Where(a =>
!string.IsNullOrWhiteSpace(a.EdiCode) !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}基础港口代码未找到"); throw Oops.Bah($"交货地{primaryModel.PLACEDELIVERYID}基础港口代码未找到");
var currPortInfo = ediPortList.FirstOrDefault(a => var currPortInfo = ediPortList.FirstOrDefault(a =>
a.Code.Equals(basePortInfo.Code?.Trim(), StringComparison.OrdinalIgnoreCase) sameList.Contains(a.Code)
&& !string.IsNullOrWhiteSpace(a.CarrierCode) && !string.IsNullOrWhiteSpace(a.CarrierCode)
&& a.CarrierCode.Equals(order.CARRIERID, StringComparison.OrdinalIgnoreCase)); && a.CarrierCode.Equals(order.CARRIERID, StringComparison.OrdinalIgnoreCase));
if (currPortInfo == null) if (currPortInfo == null)
{ {
currPortInfo = ediPortList.FirstOrDefault(a => currPortInfo = ediPortList.FirstOrDefault(a =>
a.Code.Equals(basePortInfo.Code?.Trim(), StringComparison.OrdinalIgnoreCase)); sameList.Contains(a.Code));
} }
if (currPortInfo == null) if (currPortInfo == null)
@ -3793,26 +3784,23 @@ namespace Myshipping.Application
//到付地点 //到付地点
if (!string.IsNullOrWhiteSpace(primaryModel.PAYABLEATID)) if (!string.IsNullOrWhiteSpace(primaryModel.PAYABLEATID))
{ {
var checkName = portList.Count(a => var sameList = portList.Where(a =>
!string.IsNullOrWhiteSpace(a.EdiCode) !string.IsNullOrWhiteSpace(a.EdiCode)
&& a.EdiCode.Equals(primaryModel.PAYABLEATID, StringComparison.OrdinalIgnoreCase)) > 1; && a.EdiCode.Equals(primaryModel.PAYABLEATID, StringComparison.OrdinalIgnoreCase))
.Select(a => a.Code).ToList();
var basePortInfo = portList.FirstOrDefault(a => !string.IsNullOrWhiteSpace(a.EdiCode)
&& a.EdiCode.Equals(primaryModel.PAYABLEATID, StringComparison.OrdinalIgnoreCase)
&& (!checkName || a.EnName.Equals(primaryModel.PAYABLEAT, StringComparison.OrdinalIgnoreCase)));
if (basePortInfo == null) if (sameList == null || sameList.Count == 0)
throw Oops.Bah($"到付地点{primaryModel.PAYABLEATID}基础港口代码未找到"); throw Oops.Bah($"到付地点{primaryModel.PAYABLEATID}基础港口代码未找到");
var currPortInfo = ediPortList.FirstOrDefault(a => var currPortInfo = ediPortList.FirstOrDefault(a =>
a.Code.Equals(basePortInfo.Code?.Trim(), StringComparison.OrdinalIgnoreCase) sameList.Contains(a.Code)
&& !string.IsNullOrWhiteSpace(a.CarrierCode) && !string.IsNullOrWhiteSpace(a.CarrierCode)
&& a.CarrierCode.Equals(order.CARRIERID, StringComparison.OrdinalIgnoreCase)); && a.CarrierCode.Equals(order.CARRIERID, StringComparison.OrdinalIgnoreCase));
if (currPortInfo == null) if (currPortInfo == null)
{ {
currPortInfo = ediPortList.FirstOrDefault(a => currPortInfo = ediPortList.FirstOrDefault(a =>
a.Code.Equals(basePortInfo.Code?.Trim(), StringComparison.OrdinalIgnoreCase)); sameList.Contains(a.Code));
} }
if (currPortInfo == null) if (currPortInfo == null)

@ -20,7 +20,7 @@ namespace Myshipping.Application
.Map(dest => dest.MBLNO, src => src.MBLNO) .Map(dest => dest.MBLNO, src => src.MBLNO)
.Map(dest => dest.BLFRT, src => src.BLFRT) .Map(dest => dest.BLFRT, src => src.BLFRT)
.Map(dest => dest.VESSEL, src => src.VESSEL) .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.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.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") : "") .Map(dest => dest.CLOSINGDATE, src => src.CLOSINGDATE.HasValue ? src.CLOSINGDATE.Value.ToString("yyyy-MM-dd") : "")

Loading…
Cancel
Save