|
|
|
@ -8255,121 +8255,245 @@ namespace Myshipping.Application
|
|
|
|
|
var currPortInfo = ediLoadPortList.FirstOrDefault(a =>
|
|
|
|
|
a.Code.Equals(multiline.FstPortLoadCode, StringComparison.OrdinalIgnoreCase));
|
|
|
|
|
|
|
|
|
|
if (currPortInfo == null)
|
|
|
|
|
throw Oops.Bah($"一程装货港{multiline.FstPortLoadCode}的EDI代码未找到");
|
|
|
|
|
if (currPortInfo != null)
|
|
|
|
|
{
|
|
|
|
|
multiline.FstPortLoadCode = currPortInfo.MapCode?.Trim();
|
|
|
|
|
multiline.FstPortLoad = currPortInfo.MapName?.Trim();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var codePortList = portList.Where(a =>
|
|
|
|
|
!string.IsNullOrWhiteSpace(a.EdiCode)
|
|
|
|
|
&& a.EdiCode.Equals(multiline.FstPortLoadCode, StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
.Select(a => a.Code).ToList();
|
|
|
|
|
|
|
|
|
|
if (codePortList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
var currTPortInfo = ediPortList.FirstOrDefault(a =>
|
|
|
|
|
codePortList.Contains(a.Code)
|
|
|
|
|
&& !string.IsNullOrWhiteSpace(a.CarrierCode)
|
|
|
|
|
&& a.CarrierCode.Equals(order.CARRIERID, StringComparison.OrdinalIgnoreCase));
|
|
|
|
|
|
|
|
|
|
multiline.FstPortLoadCode = currPortInfo.MapCode?.Trim();
|
|
|
|
|
multiline.FstPortLoad = currPortInfo.MapName?.Trim();
|
|
|
|
|
if (currTPortInfo != null)
|
|
|
|
|
{
|
|
|
|
|
multiline.FstPortLoadCode = currTPortInfo.MapCode?.Trim();
|
|
|
|
|
multiline.FstPortLoad = currTPortInfo.MapName?.Trim();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah($"一程装货港{multiline.FstPortLoadCode}的映射EDI代码未找到");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah($"一程装货港{multiline.FstPortLoadCode}基础港口代码未找到");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//一程卸货港
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(multiline.FstPortDischargeCode))
|
|
|
|
|
{
|
|
|
|
|
var sameList = portList.Where(a =>
|
|
|
|
|
var currPortInfo = ediLoadPortList.FirstOrDefault(a =>
|
|
|
|
|
a.Code.Equals(multiline.FstPortDischargeCode, StringComparison.OrdinalIgnoreCase));
|
|
|
|
|
|
|
|
|
|
if (currPortInfo != null)
|
|
|
|
|
{
|
|
|
|
|
multiline.FstPortDischargeCode = currPortInfo.MapCode?.Trim();
|
|
|
|
|
multiline.FstPortDischarge = currPortInfo.MapName?.Trim();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var codePortList = portList.Where(a =>
|
|
|
|
|
!string.IsNullOrWhiteSpace(a.EdiCode)
|
|
|
|
|
&& a.EdiCode.Equals(multiline.FstPortDischargeCode, StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
.Select(a => a.Code).ToList();
|
|
|
|
|
|
|
|
|
|
if (sameList == null || sameList.Count == 0)
|
|
|
|
|
throw Oops.Bah($"一程卸货港{multiline.FstPortDischargeCode}基础港口代码未找到");
|
|
|
|
|
|
|
|
|
|
var currPortInfo = ediPortList.FirstOrDefault(a =>
|
|
|
|
|
sameList.Contains(a.Code)
|
|
|
|
|
&& !string.IsNullOrWhiteSpace(a.CarrierCode)
|
|
|
|
|
&& a.CarrierCode.Equals(order.CARRIERID, StringComparison.OrdinalIgnoreCase));
|
|
|
|
|
if (codePortList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
var currTPortInfo = ediPortList.FirstOrDefault(a =>
|
|
|
|
|
codePortList.Contains(a.Code)
|
|
|
|
|
&& !string.IsNullOrWhiteSpace(a.CarrierCode)
|
|
|
|
|
&& a.CarrierCode.Equals(order.CARRIERID, StringComparison.OrdinalIgnoreCase));
|
|
|
|
|
|
|
|
|
|
if (currPortInfo == null)
|
|
|
|
|
{
|
|
|
|
|
currPortInfo = ediPortList.FirstOrDefault(a =>
|
|
|
|
|
sameList.Contains(a.Code));
|
|
|
|
|
if (currTPortInfo != null)
|
|
|
|
|
{
|
|
|
|
|
multiline.FstPortDischargeCode = currTPortInfo.MapCode?.Trim();
|
|
|
|
|
multiline.FstPortDischarge = currTPortInfo.MapName?.Trim();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah($"一程卸货港{multiline.FstPortDischargeCode}的映射EDI代码未找到");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah($"一程卸货港{multiline.FstPortDischargeCode}基础港口代码未找到");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (currPortInfo == null)
|
|
|
|
|
throw Oops.Bah($"一程卸货港{multiline.FstPortDischargeCode}的映射EDI代码未找到");
|
|
|
|
|
|
|
|
|
|
multiline.FstPortDischargeCode = currPortInfo.MapCode?.Trim();
|
|
|
|
|
multiline.FstPortDischarge = currPortInfo.MapName?.Trim();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//二程装货港
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(multiline.SecPortLoadCode))
|
|
|
|
|
{
|
|
|
|
|
var currPortInfo = ediLoadPortList.FirstOrDefault(a =>
|
|
|
|
|
a.Code.Equals(multiline.SecPortLoadCode, StringComparison.OrdinalIgnoreCase));
|
|
|
|
|
|
|
|
|
|
if (currPortInfo == null)
|
|
|
|
|
throw Oops.Bah($"二程装货港{multiline.SecPortLoadCode}的EDI代码未找到");
|
|
|
|
|
if (currPortInfo != null)
|
|
|
|
|
{
|
|
|
|
|
multiline.SecPortLoadCode = currPortInfo.MapCode?.Trim();
|
|
|
|
|
multiline.SecPortLoad = currPortInfo.MapName?.Trim();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var codePortList = portList.Where(a =>
|
|
|
|
|
!string.IsNullOrWhiteSpace(a.EdiCode)
|
|
|
|
|
&& a.EdiCode.Equals(multiline.SecPortLoadCode, StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
.Select(a => a.Code).ToList();
|
|
|
|
|
|
|
|
|
|
if (codePortList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
var currTPortInfo = ediPortList.FirstOrDefault(a =>
|
|
|
|
|
codePortList.Contains(a.Code)
|
|
|
|
|
&& !string.IsNullOrWhiteSpace(a.CarrierCode)
|
|
|
|
|
&& a.CarrierCode.Equals(order.CARRIERID, StringComparison.OrdinalIgnoreCase));
|
|
|
|
|
|
|
|
|
|
multiline.SecPortLoadCode = currPortInfo.MapCode?.Trim();
|
|
|
|
|
multiline.SecPortLoad = currPortInfo.MapName?.Trim();
|
|
|
|
|
if (currTPortInfo != null)
|
|
|
|
|
{
|
|
|
|
|
multiline.SecPortLoadCode = currTPortInfo.MapCode?.Trim();
|
|
|
|
|
multiline.SecPortLoad = currTPortInfo.MapName?.Trim();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah($"二程装货港{multiline.FstPortDischargeCode}的映射EDI代码未找到");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah($"二程装货港{multiline.FstPortDischargeCode}基础港口代码未找到");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//二程卸货港
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(multiline.SecPortDischargeCode))
|
|
|
|
|
{
|
|
|
|
|
var sameList = portList.Where(a =>
|
|
|
|
|
var currPortInfo = ediLoadPortList.FirstOrDefault(a =>
|
|
|
|
|
a.Code.Equals(multiline.SecPortDischargeCode, StringComparison.OrdinalIgnoreCase));
|
|
|
|
|
|
|
|
|
|
if (currPortInfo != null)
|
|
|
|
|
{
|
|
|
|
|
multiline.SecPortDischargeCode = currPortInfo.MapCode?.Trim();
|
|
|
|
|
multiline.SecPortDischarge = currPortInfo.MapName?.Trim();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var codePortList = portList.Where(a =>
|
|
|
|
|
!string.IsNullOrWhiteSpace(a.EdiCode)
|
|
|
|
|
&& a.EdiCode.Equals(multiline.SecPortDischargeCode, StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
.Select(a => a.Code).ToList();
|
|
|
|
|
|
|
|
|
|
if (sameList == null || sameList.Count == 0)
|
|
|
|
|
throw Oops.Bah($"二程卸货港{multiline.SecPortDischargeCode}基础港口代码未找到");
|
|
|
|
|
|
|
|
|
|
var currPortInfo = ediPortList.FirstOrDefault(a =>
|
|
|
|
|
sameList.Contains(a.Code)
|
|
|
|
|
&& !string.IsNullOrWhiteSpace(a.CarrierCode)
|
|
|
|
|
&& a.CarrierCode.Equals(order.CARRIERID, StringComparison.OrdinalIgnoreCase));
|
|
|
|
|
if (codePortList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
var currTPortInfo = ediPortList.FirstOrDefault(a =>
|
|
|
|
|
codePortList.Contains(a.Code)
|
|
|
|
|
&& !string.IsNullOrWhiteSpace(a.CarrierCode)
|
|
|
|
|
&& a.CarrierCode.Equals(order.CARRIERID, StringComparison.OrdinalIgnoreCase));
|
|
|
|
|
|
|
|
|
|
if (currPortInfo == null)
|
|
|
|
|
{
|
|
|
|
|
currPortInfo = ediPortList.FirstOrDefault(a =>
|
|
|
|
|
sameList.Contains(a.Code));
|
|
|
|
|
if (currTPortInfo != null)
|
|
|
|
|
{
|
|
|
|
|
multiline.SecPortDischargeCode = currTPortInfo.MapCode?.Trim();
|
|
|
|
|
multiline.SecPortDischarge = currTPortInfo.MapName?.Trim();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah($"二程卸货港{multiline.FstPortDischargeCode}的映射EDI代码未找到");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah($"二程卸货港{multiline.FstPortDischargeCode}基础港口代码未找到");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (currPortInfo == null)
|
|
|
|
|
throw Oops.Bah($"二程卸货港{multiline.SecPortDischargeCode}的映射EDI代码未找到");
|
|
|
|
|
|
|
|
|
|
multiline.SecPortDischargeCode = currPortInfo.MapCode?.Trim();
|
|
|
|
|
multiline.SecPortDischarge = currPortInfo.MapName?.Trim();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//三程装货港
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(multiline.ThdPortLoadCode))
|
|
|
|
|
{
|
|
|
|
|
var currPortInfo = ediLoadPortList.FirstOrDefault(a =>
|
|
|
|
|
a.Code.Equals(multiline.ThdPortLoadCode, StringComparison.OrdinalIgnoreCase));
|
|
|
|
|
|
|
|
|
|
if (currPortInfo == null)
|
|
|
|
|
throw Oops.Bah($"三程装货港{multiline.ThdPortLoadCode}的EDI代码未找到");
|
|
|
|
|
if (currPortInfo != null)
|
|
|
|
|
{
|
|
|
|
|
multiline.ThdPortLoadCode = currPortInfo.MapCode?.Trim();
|
|
|
|
|
multiline.ThdPortLoad = currPortInfo.MapName?.Trim();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var codePortList = portList.Where(a =>
|
|
|
|
|
!string.IsNullOrWhiteSpace(a.EdiCode)
|
|
|
|
|
&& a.EdiCode.Equals(multiline.ThdPortLoadCode, StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
.Select(a => a.Code).ToList();
|
|
|
|
|
|
|
|
|
|
if (codePortList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
var currTPortInfo = ediPortList.FirstOrDefault(a =>
|
|
|
|
|
codePortList.Contains(a.Code)
|
|
|
|
|
&& !string.IsNullOrWhiteSpace(a.CarrierCode)
|
|
|
|
|
&& a.CarrierCode.Equals(order.CARRIERID, StringComparison.OrdinalIgnoreCase));
|
|
|
|
|
|
|
|
|
|
multiline.ThdPortLoadCode = currPortInfo.MapCode?.Trim();
|
|
|
|
|
multiline.ThdPortLoad = currPortInfo.MapName?.Trim();
|
|
|
|
|
if (currTPortInfo != null)
|
|
|
|
|
{
|
|
|
|
|
multiline.ThdPortLoadCode = currTPortInfo.MapCode?.Trim();
|
|
|
|
|
multiline.ThdPortLoad = currTPortInfo.MapName?.Trim();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah($"三程装货港{multiline.FstPortDischargeCode}的映射EDI代码未找到");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah($"三程装货港{multiline.FstPortDischargeCode}基础港口代码未找到");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//三程卸货港
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(multiline.ThdPortDischargeCode))
|
|
|
|
|
{
|
|
|
|
|
var sameList = portList.Where(a =>
|
|
|
|
|
var currPortInfo = ediLoadPortList.FirstOrDefault(a =>
|
|
|
|
|
a.Code.Equals(multiline.ThdPortDischargeCode, StringComparison.OrdinalIgnoreCase));
|
|
|
|
|
|
|
|
|
|
if (currPortInfo != null)
|
|
|
|
|
{
|
|
|
|
|
multiline.ThdPortDischargeCode = currPortInfo.MapCode?.Trim();
|
|
|
|
|
multiline.ThdPortDischarge = currPortInfo.MapName?.Trim();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var codePortList = portList.Where(a =>
|
|
|
|
|
!string.IsNullOrWhiteSpace(a.EdiCode)
|
|
|
|
|
&& a.EdiCode.Equals(multiline.ThdPortDischargeCode, StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
.Select(a => a.Code).ToList();
|
|
|
|
|
|
|
|
|
|
if (sameList == null || sameList.Count == 0)
|
|
|
|
|
throw Oops.Bah($"三程卸货港{multiline.ThdPortDischargeCode}基础港口代码未找到");
|
|
|
|
|
|
|
|
|
|
var currPortInfo = ediPortList.FirstOrDefault(a =>
|
|
|
|
|
sameList.Contains(a.Code)
|
|
|
|
|
&& !string.IsNullOrWhiteSpace(a.CarrierCode)
|
|
|
|
|
&& a.CarrierCode.Equals(order.CARRIERID, StringComparison.OrdinalIgnoreCase));
|
|
|
|
|
if (codePortList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
var currTPortInfo = ediPortList.FirstOrDefault(a =>
|
|
|
|
|
codePortList.Contains(a.Code)
|
|
|
|
|
&& !string.IsNullOrWhiteSpace(a.CarrierCode)
|
|
|
|
|
&& a.CarrierCode.Equals(order.CARRIERID, StringComparison.OrdinalIgnoreCase));
|
|
|
|
|
|
|
|
|
|
if (currPortInfo == null)
|
|
|
|
|
{
|
|
|
|
|
currPortInfo = ediPortList.FirstOrDefault(a =>
|
|
|
|
|
sameList.Contains(a.Code));
|
|
|
|
|
if (currTPortInfo != null)
|
|
|
|
|
{
|
|
|
|
|
multiline.ThdPortDischargeCode = currTPortInfo.MapCode?.Trim();
|
|
|
|
|
multiline.ThdPortDischarge = currTPortInfo.MapName?.Trim();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah($"三程卸货港{multiline.FstPortDischargeCode}的映射EDI代码未找到");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah($"三程卸货港{multiline.FstPortDischargeCode}基础港口代码未找到");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (currPortInfo == null)
|
|
|
|
|
throw Oops.Bah($"三程卸货港{multiline.ThdPortDischargeCode}的映射EDI代码未找到");
|
|
|
|
|
|
|
|
|
|
multiline.ThdPortDischargeCode = currPortInfo.MapCode?.Trim();
|
|
|
|
|
multiline.ThdPortDischarge = currPortInfo.MapName?.Trim();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
@ -12527,6 +12651,37 @@ namespace Myshipping.Application
|
|
|
|
|
{
|
|
|
|
|
result.extra2 = record;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
record = new BookingMultiLineSplitRecord();
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(order.PORTLOADID))
|
|
|
|
|
{
|
|
|
|
|
record.FstPortLoadCode = order.PORTLOADID;
|
|
|
|
|
record.FstPortLoad = order.PORTLOAD;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(order.PORTDISCHARGEID))
|
|
|
|
|
{
|
|
|
|
|
record.FstPortDischargeCode = order.PORTDISCHARGEID;
|
|
|
|
|
record.FstPortDischarge = order.PORTDISCHARGE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(order.VESSEL))
|
|
|
|
|
{
|
|
|
|
|
record.FstVessel = order.VESSEL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(order.VOYNO))
|
|
|
|
|
{
|
|
|
|
|
record.FstVoyno = order.VOYNO;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (order.ETD.HasValue)
|
|
|
|
|
{
|
|
|
|
|
record.FstETD = order.ETD.Value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|