Compare commits

..

2 Commits

Author SHA1 Message Date
jianghaiqing 9314ae8638 修改SITC 中转信息 2 weeks ago
jianghaiqing d67477f297 修改装货港未提箱 2 weeks ago

@ -1,6 +1,7 @@
using DocumentFormat.OpenXml.ExtendedProperties;
using Google.Protobuf.WellKnownTypes;
using Mapster.Utils;
using MathNet.Numerics.LinearAlgebra.Factorization;
using Myshipping.Application.EDI.ESL;
using MySqlX.XDevAPI.Common;
using Newtonsoft.Json;
@ -213,19 +214,90 @@ namespace Myshipping.Application.EDI.SITC
*/
if (InttrEdi.SITCExt != null && !string.IsNullOrWhiteSpace(InttrEdi.SITCExt.TransferType) && !InttrEdi.SITCExt.TransferType.Equals("DIRECT",StringComparison.OrdinalIgnoreCase))
{
//if (InttrEdi.SITCExt.TransferType.Equals("SECOND", StringComparison.OrdinalIgnoreCase))
//{
// postModel.extras.Add(new SitcApiPostModelExtra
// {
// ctype = "TRA",
// clen = 1,
// cnum = InttrEdi.SITCExt.FstShipCapacity == "MAIN" ? 1 : 0,
// vent = InttrEdi.SITCExt.FstVessel?.Trim(),
// humdity = InttrEdi.SITCExt.FstVoyno?.Trim(),
// soc = InttrEdi.SITCExt.FstLaneName?.Trim(),
// unit =
// });
//}
if (InttrEdi.SITCExt.TransferType.Equals("SECOND", StringComparison.OrdinalIgnoreCase))
{
postModel.extras.Add(new SitcApiPostModelExtra
{
ctype = "TRA",
clen = 1,
cnum = InttrEdi.SITCExt.FstShipCapacity == "MAIN" ? 1 : 0,
vent = InttrEdi.SITCExt.FstVessel?.Trim(),
humdity = InttrEdi.SITCExt.FstVoyno?.Trim(),
soc = InttrEdi.SITCExt.FstLaneName?.Trim(),
unit = InttrEdi.SITCExt.FstPortLoad,
tempSetting = InttrEdi.SITCExt.FstPortDischarge,
tempMax = InttrEdi.SITCExt.FstPortLoadCode,
tempMin = InttrEdi.SITCExt.FstPortDischargeCode,
etd = InttrEdi.SITCExt.FstETD.HasValue? InttrEdi.SITCExt.FstETD.Value.ToString("yyyy-MM-dd"):"",
cCommodity = "0"
});
postModel.extras.Add(new SitcApiPostModelExtra
{
ctype = "TRA",
clen = 2,
cnum = InttrEdi.SITCExt.SecShipCapacity == "MAIN" ? 1 : 0,
vent = InttrEdi.SITCExt.SecVessel?.Trim(),
humdity = InttrEdi.SITCExt.SecVoyno?.Trim(),
soc = InttrEdi.SITCExt.SecLaneName?.Trim(),
unit = InttrEdi.SITCExt.SecPortLoad,
tempSetting = InttrEdi.SITCExt.SecPortDischarge,
tempMax = InttrEdi.SITCExt.SecPortLoadCode,
tempMin = InttrEdi.SITCExt.SecPortDischargeCode,
etd = InttrEdi.SITCExt.SecETD.HasValue ? InttrEdi.SITCExt.SecETD.Value.ToString("yyyy-MM-dd") : "",
cCommodity = "0"
});
}
else if (InttrEdi.SITCExt.TransferType.Equals("THIRD", StringComparison.OrdinalIgnoreCase))
{
postModel.extras.Add(new SitcApiPostModelExtra
{
ctype = "TRA",
clen = 1,
cnum = InttrEdi.SITCExt.FstShipCapacity == "MAIN" ? 1 : 0,
vent = InttrEdi.SITCExt.FstVessel?.Trim(),
humdity = InttrEdi.SITCExt.FstVoyno?.Trim(),
soc = InttrEdi.SITCExt.FstLaneName?.Trim(),
unit = InttrEdi.SITCExt.FstPortLoad,
tempSetting = InttrEdi.SITCExt.FstPortDischarge,
tempMax = InttrEdi.SITCExt.FstPortLoadCode,
tempMin = InttrEdi.SITCExt.FstPortDischargeCode,
etd = InttrEdi.SITCExt.FstETD.HasValue ? InttrEdi.SITCExt.FstETD.Value.ToString("yyyy-MM-dd") : "",
cCommodity = "0"
});
postModel.extras.Add(new SitcApiPostModelExtra
{
ctype = "TRA",
clen = 2,
cnum = InttrEdi.SITCExt.SecShipCapacity == "MAIN" ? 1 : 0,
vent = InttrEdi.SITCExt.SecVessel?.Trim(),
humdity = InttrEdi.SITCExt.SecVoyno?.Trim(),
soc = InttrEdi.SITCExt.SecLaneName?.Trim(),
unit = InttrEdi.SITCExt.SecPortLoad,
tempSetting = InttrEdi.SITCExt.SecPortDischarge,
tempMax = InttrEdi.SITCExt.SecPortLoadCode,
tempMin = InttrEdi.SITCExt.SecPortDischargeCode,
etd = InttrEdi.SITCExt.SecETD.HasValue ? InttrEdi.SITCExt.SecETD.Value.ToString("yyyy-MM-dd") : "",
cCommodity = "0"
});
postModel.extras.Add(new SitcApiPostModelExtra
{
ctype = "TRA",
clen = 3,
cnum = InttrEdi.SITCExt.ThdShipCapacity == "MAIN" ? 1 : 0,
vent = InttrEdi.SITCExt.ThdVessel?.Trim(),
humdity = InttrEdi.SITCExt.ThdVoyno?.Trim(),
soc = InttrEdi.SITCExt.ThdLaneName?.Trim(),
unit = InttrEdi.SITCExt.ThdPortLoad,
tempSetting = InttrEdi.SITCExt.ThdPortDischarge,
tempMax = InttrEdi.SITCExt.ThdPortLoadCode,
tempMin = InttrEdi.SITCExt.ThdPortDischargeCode,
etd = InttrEdi.SITCExt.ThdETD.HasValue ? InttrEdi.SITCExt.ThdETD.Value.ToString("yyyy-MM-dd") : "",
cCommodity = "0"
});
}
}
string json = JsonConvert.SerializeObject(postModel, Formatting.Indented, new JsonSerializerSettings
@ -613,6 +685,16 @@ namespace Myshipping.Application.EDI.SITC
/// 航线代码
/// </summary>
public string soc { get; set; }
/// <summary>
/// 开航日
/// </summary>
public string etd { get; set; }
/// <summary>
/// 运输类型
/// </summary>
public string cCommodity { get; set; }
}
public class SitcApiPostModelDangerInfo

@ -8247,9 +8247,181 @@ namespace Myshipping.Application
primaryModel.FEETYPE = multiline.FEETYPE;
primaryModel.PAYABLEEXT = multiline.PAYABLE;
ediModel.SITCExt = multiline.Adapt<SITCExtInfo>();
//这里做个检查
#region 映射港口
//一程装货港
if (!string.IsNullOrWhiteSpace(multiline.FstPortLoadCode))
{
var sameList = portList.Where(a =>
!string.IsNullOrWhiteSpace(a.EdiCode)
&& a.EdiCode.Equals(multiline.FstPortLoadCode, StringComparison.OrdinalIgnoreCase))
.Select(a => a.Code).ToList();
if (sameList == null || sameList.Count == 0)
throw Oops.Bah($"一程装货港{multiline.FstPortLoadCode}基础港口代码未找到");
var currPortInfo = ediPortList.FirstOrDefault(a =>
sameList.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 (currPortInfo == null)
throw Oops.Bah($"一程装货港{multiline.FstPortLoadCode}的映射EDI代码未找到");
multiline.FstPortLoadCode = currPortInfo.MapCode?.Trim();
multiline.FstPortLoad = currPortInfo.MapName?.Trim();
}
//一程卸货港
if (!string.IsNullOrWhiteSpace(multiline.FstPortDischargeCode))
{
var sameList = 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 (currPortInfo == null)
{
currPortInfo = ediPortList.FirstOrDefault(a =>
sameList.Contains(a.Code));
}
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 sameList = portList.Where(a =>
!string.IsNullOrWhiteSpace(a.EdiCode)
&& a.EdiCode.Equals(multiline.SecPortLoadCode, StringComparison.OrdinalIgnoreCase))
.Select(a => a.Code).ToList();
if (sameList == null || sameList.Count == 0)
throw Oops.Bah($"二程装货港{multiline.SecPortLoadCode}基础港口代码未找到");
var currPortInfo = ediPortList.FirstOrDefault(a =>
sameList.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 (currPortInfo == null)
throw Oops.Bah($"二程装货港{multiline.SecPortLoadCode}的映射EDI代码未找到");
multiline.SecPortLoadCode = currPortInfo.MapCode?.Trim();
multiline.SecPortLoad = currPortInfo.MapName?.Trim();
}
//二程卸货港
if (!string.IsNullOrWhiteSpace(multiline.SecPortDischargeCode))
{
var sameList = 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 (currPortInfo == null)
{
currPortInfo = ediPortList.FirstOrDefault(a =>
sameList.Contains(a.Code));
}
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 sameList = portList.Where(a =>
!string.IsNullOrWhiteSpace(a.EdiCode)
&& a.EdiCode.Equals(multiline.FstPortLoadCode, StringComparison.OrdinalIgnoreCase))
.Select(a => a.Code).ToList();
if (sameList == null || sameList.Count == 0)
throw Oops.Bah($"三程装货港{multiline.ThdPortLoadCode}基础港口代码未找到");
var currPortInfo = ediPortList.FirstOrDefault(a =>
sameList.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 (currPortInfo == null)
throw Oops.Bah($"三程装货港{multiline.ThdPortLoadCode}的映射EDI代码未找到");
multiline.ThdPortLoadCode = currPortInfo.MapCode?.Trim();
multiline.ThdPortLoad = currPortInfo.MapName?.Trim();
}
//三程卸货港
if (!string.IsNullOrWhiteSpace(multiline.ThdPortDischargeCode))
{
var sameList = 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 (currPortInfo == null)
{
currPortInfo = ediPortList.FirstOrDefault(a =>
sameList.Contains(a.Code));
}
if (currPortInfo == null)
throw Oops.Bah($"三程卸货港{multiline.ThdPortDischargeCode}的映射EDI代码未找到");
multiline.ThdPortDischargeCode = currPortInfo.MapCode?.Trim();
multiline.ThdPortDischarge = currPortInfo.MapName?.Trim();
}
#endregion
ediModel.SITCExt = multiline.Adapt<SITCExtInfo>();
}
}

@ -378,7 +378,16 @@ namespace Myshipping.Application
var fstOrder = bookingOrderList.FirstOrDefault();
string emailTitle = $"{model.MBL_NO}-{fstOrder.VESSEL}/{fstOrder.VOYNO}/ 未提箱订舱取消确认";
string emailTitle = string.Empty;
if (fstOrder != null && !string.IsNullOrWhiteSpace(fstOrder.VESSEL))
{
emailTitle = $"{model.MBL_NO}-{fstOrder.VESSEL}/{fstOrder.VOYNO}/ 未提箱订舱取消确认";
}
else
{
emailTitle = $"{model.MBL_NO}-{model.VESSEL}/{model.VOYNO}/ 未提箱订舱取消确认";
}
//提取当前公共邮箱的配置
DjyUserMailAccount publicMailAccount = _djyUserMailAccount.AsQueryable().Filter(null, true).First(x => x.TenantId == UserManager.TENANT_ID && x.ShowName == "PublicSend"
@ -539,6 +548,11 @@ namespace Myshipping.Application
string s = $"{fstOrderInfo.VESSEL}/{fstOrderInfo.VOYNO}";
baseHtml = baseHtml.Replace("#VesselVoyno#", s);
}
else if (!string.IsNullOrWhiteSpace(model.VESSEL))
{
string s = $"{model.VESSEL}/{model.VOYNO}";
baseHtml = baseHtml.Replace("#VesselVoyno#", s);
}
else
{
baseHtml = baseHtml.Replace("#VesselVoyno#", "");

Loading…
Cancel
Save