解析收货地,得到装货港名称及代码;解析交货地,得到为卸货港名称及代码

master
zhangxiaofeng 7 months ago
parent 9b9a45d176
commit a7abfa2dfd

@ -323,6 +323,59 @@ namespace Myshipping.Application
}); });
} }
// 解析收货地,得到装货港名称及代码
if (!string.IsNullOrWhiteSpace(dto.DataObj.PLACERECEIPT))
{
var portEnName = dto.DataObj.PLACERECEIPT.Split(',')[0]?.Trim();
if (!string.IsNullOrWhiteSpace(portEnName))
{
var portInfo = (await _cache.GetAllCodePortLoad()).FirstOrDefault(x => x.EnName.Equals(portEnName, StringComparison.OrdinalIgnoreCase));
if (portInfo!= null)
{
dto.DataObj.PORTLOAD = portInfo.EnName;
dto.DataObj.PORTLOADID = portInfo.EdiCode;
}
else
{
_logger.LogInformation("通过收货地城市名称未匹配到港口信息,订舱编号:{SLOT_BOOKING_NO}", dto.DataObj.SLOT_BOOKING_NO);
}
}
else
{
_logger.LogInformation("收货地分割后得到的城市名称为空,订舱编号:{SLOT_BOOKING_NO}", dto.DataObj.SLOT_BOOKING_NO);
}
}
else
{
_logger.LogInformation("收货地为空,订舱编号:{SLOT_BOOKING_NO}", dto.DataObj.SLOT_BOOKING_NO);
}
// 解析交货地,得到为卸货港名称及代码
if (!string.IsNullOrWhiteSpace(dto.DataObj.PLACEDELIVERY))
{
var portEnName = dto.DataObj.PLACEDELIVERY.Split(',')[0]?.Trim();
if (!string.IsNullOrWhiteSpace(portEnName))
{
var portInfo = (await _cache.GetAllCodePort()).FirstOrDefault(x => x.EnName.Equals(portEnName, StringComparison.OrdinalIgnoreCase));
if (portInfo != null)
{
dto.DataObj.PORTDISCHARGE = portInfo.EnName;
dto.DataObj.PORTDISCHARGEID = portInfo.EdiCode;
}
else
{
_logger.LogInformation("通过交货地城市名称未匹配到港口信息,订舱编号:{SLOT_BOOKING_NO}", dto.DataObj.SLOT_BOOKING_NO);
}
}
else
{
_logger.LogInformation("交货地分割后得到的城市名称为空,订舱编号:{SLOT_BOOKING_NO}", dto.DataObj.SLOT_BOOKING_NO);
}
}
else
{
_logger.LogInformation("交货地为空,订舱编号:{SLOT_BOOKING_NO}", dto.DataObj.SLOT_BOOKING_NO);
}
BookingSlotBase model = null; BookingSlotBase model = null;
if (dto.OpType == "add") if (dto.OpType == "add")
{ {

Loading…
Cancel
Save