diff --git a/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs b/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs index 7061ee79..7ae3ef28 100644 --- a/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs +++ b/Myshipping.Application/Service/BookingSlot/BookingSlotService.cs @@ -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; if (dto.OpType == "add") { @@ -1056,7 +1109,7 @@ namespace Myshipping.Application TimeSpan ts = eDate.Subtract(bDate); var timeDiff = ts.TotalMilliseconds; - if(compareResult != null) + if (compareResult != null) { _logger.LogInformation("批次={no} 请求完成,耗时:{timeDiff}ms. 结果{msg}", batchNo, timeDiff, compareResult.succ ? "成功" : "失败"); } @@ -1175,7 +1228,7 @@ namespace Myshipping.Application { _logger.LogInformation("推送BC比对异常,原因:{error}", ex.Message); - // throw Oops.Oh($"推送BC比对异常,原因:{ex.Message}"); + // throw Oops.Oh($"推送BC比对异常,原因:{ex.Message}"); } } @@ -1206,7 +1259,7 @@ namespace Myshipping.Application throw Oops.Oh($"获取舱位变更比对结果错误,比对内容不存在"); } - if(!string.IsNullOrWhiteSpace(compareInfo.COMPARE_RLT)) + if (!string.IsNullOrWhiteSpace(compareInfo.COMPARE_RLT)) { return JSON.Deserialize>(compareInfo.COMPARE_RLT); } @@ -1346,7 +1399,7 @@ namespace Myshipping.Application CLOSEVGMDATE = bookingSlotBase.VGM_SUBMISSION_CUT_DATE, CLOSINGDATE = bookingSlotBase.CY_CUT_DATE, CLOSEDOCDATE = bookingSlotBase.SI_CUT_DATE, - CUSTSERVICEID = generateModel.CustServiceId.HasValue? generateModel.CustServiceId.Value.ToString():null, + CUSTSERVICEID = generateModel.CustServiceId.HasValue ? generateModel.CustServiceId.Value.ToString() : null, CUSTSERVICE = generateModel.CustServiceName, ctnInputs = new List() }; @@ -1565,7 +1618,7 @@ namespace Myshipping.Application { BookingSlotWithOrderDto dto = null; - var slotInfo = await _repBase.AsQueryable().Filter(null,true).FirstAsync(a => a.SLOT_BOOKING_NO == slotBookingNo && a.TenantId == tenantId && a.IsDeleted == false); + var slotInfo = await _repBase.AsQueryable().Filter(null, true).FirstAsync(a => a.SLOT_BOOKING_NO == slotBookingNo && a.TenantId == tenantId && a.IsDeleted == false); if (slotInfo == null) {