master
wanghaomei 7 months ago
parent b019a6f5bb
commit 15a256b28c

@ -115,15 +115,22 @@ namespace Myshipping.Application.EDI
postModel.saveName = template.TemplateName; postModel.saveName = template.TemplateName;
var mapPortLoad = mappingPortLoad.FirstOrDefault(x => x.Module == "DjyCustBooking" && x.CarrierCode == "COSCO" && x.Code == custOrder.PORTLOADCODE); var mapPortLoad = mappingPortLoad.FirstOrDefault(x => x.Module == "DjyCustBooking" && x.CarrierCode == "COSCO" && x.Code == custOrder.PORTLOADCODE);
var mapPort = mappingPort.FirstOrDefault(x => x.Module == "DjyCustBooking" && x.CarrierCode == "COSCO" && x.Code == custOrder.PORTDISCHARGECODE); //var mapPort = mappingPort.FirstOrDefault(x => x.Module == "DjyCustBooking" && x.CarrierCode == "COSCO" && x.Code == custOrder.PORTDISCHARGECODE);
if (mapPortLoad == null) if (mapPortLoad == null)
{ {
return new KeyValuePair<bool, string>(false, $"未找到起运港映射信息:{custOrder.PORTLOADCODE}"); return new KeyValuePair<bool, string>(false, $"未找到起运港映射信息:{custOrder.PORTLOADCODE}");
} }
//if (mapPort == null)
//{
// return new KeyValuePair<bool, string>(false, $"未找到目的港映射信息:{custOrder.PORTDISCHARGECODE}");
//}
//2024年5月9日衣国豪改用目的地而不是卸货港
var mapPort = mappingPort.FirstOrDefault(x => x.Module == "DjyCustBooking" && x.CarrierCode == "COSCO" && x.Code == custOrder.DESTINATIONCODE);
if (mapPort == null) if (mapPort == null)
{ {
return new KeyValuePair<bool, string>(false, $"未找到目的港映射信息:{custOrder.PORTDISCHARGECODE}"); return new KeyValuePair<bool, string>(false, $"未找到目的地映射信息:{custOrder.DESTINATIONCODE}");
} }
//运输条款 //运输条款

@ -2087,6 +2087,8 @@ namespace Myshipping.Application
// throw Oops.Bah("目的港代码和名称不能为空"); // throw Oops.Bah("目的港代码和名称不能为空");
//} //}
//起运港校验
if (string.IsNullOrEmpty(input.PORTLOADCODE)) if (string.IsNullOrEmpty(input.PORTLOADCODE))
{ {
throw Oops.Bah("起运港代码不能为空"); throw Oops.Bah("起运港代码不能为空");
@ -2098,6 +2100,8 @@ namespace Myshipping.Application
throw Oops.Bah($"未找到匹配的起运港:{input.PORTLOADCODE}"); throw Oops.Bah($"未找到匹配的起运港:{input.PORTLOADCODE}");
} }
//目的港校验
if (string.IsNullOrEmpty(input.PORTDISCHARGECODE)) if (string.IsNullOrEmpty(input.PORTDISCHARGECODE))
{ {
throw Oops.Bah("目的港代码不能为空"); throw Oops.Bah("目的港代码不能为空");
@ -2109,6 +2113,19 @@ namespace Myshipping.Application
throw Oops.Bah($"未找到匹配的目的港:{input.PORTDISCHARGECODE}"); throw Oops.Bah($"未找到匹配的目的港:{input.PORTDISCHARGECODE}");
} }
//目的地校验
if (string.IsNullOrEmpty(input.DESTINATIONCODE))
{
throw Oops.Bah("目的地代码不能为空");
}
var destination = portDestList.FirstOrDefault(x => x.Code == input.DESTINATIONCODE);
if (destination == null)
{
throw Oops.Bah($"未找到匹配的目的地:{input.DESTINATIONCODE}");
}
if (string.IsNullOrEmpty(input.SERVICECODE)) if (string.IsNullOrEmpty(input.SERVICECODE))
{ {
throw Oops.Bah("运输条款代码不能为空"); throw Oops.Bah("运输条款代码不能为空");
@ -2227,7 +2244,6 @@ namespace Myshipping.Application
} }
var destination = portDestList.FirstOrDefault(x => x.Code == input.DESTINATIONCODE);
//赋值根据唯一代码匹配后的代码、名称等信息 //赋值根据唯一代码匹配后的代码、名称等信息
custOrder.CARRIER = carr.EnName; custOrder.CARRIER = carr.EnName;
@ -2236,8 +2252,8 @@ namespace Myshipping.Application
custOrder.PORTDISCHARGE = portDest.EnName; custOrder.PORTDISCHARGE = portDest.EnName;
custOrder.PORTDISCHARGEID = portDest.EdiCode; custOrder.PORTDISCHARGEID = portDest.EdiCode;
custOrder.SERVICE = service.Name; custOrder.SERVICE = service.Name;
custOrder.DESTINATION = destination?.EnName; custOrder.DESTINATION = destination.EnName;
custOrder.DESTINATIONID = destination?.EdiCode; custOrder.DESTINATIONID = destination.EdiCode;
custOrder.BLFRT = frt.EnName; custOrder.BLFRT = frt.EnName;
//2024年4月19日将分拆的收发通拼接到大文本的收发通中 //2024年4月19日将分拆的收发通拼接到大文本的收发通中

Loading…
Cancel
Save