|
|
@ -619,16 +619,22 @@ namespace Myshipping.Application
|
|
|
|
var portEnName = dto.DataObj.PLACERECEIPT.Split(',')[0]?.Trim();
|
|
|
|
var portEnName = dto.DataObj.PLACERECEIPT.Split(',')[0]?.Trim();
|
|
|
|
if (!string.IsNullOrWhiteSpace(portEnName))
|
|
|
|
if (!string.IsNullOrWhiteSpace(portEnName))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var portInfo = (await _cache.GetAllCodePortLoad()).FirstOrDefault(x => x.EnName.Equals(portEnName, StringComparison.OrdinalIgnoreCase));
|
|
|
|
var cachePort = await _cache.GetAllCodePort();
|
|
|
|
if (portInfo != null)
|
|
|
|
|
|
|
|
|
|
|
|
var portInfo = cachePort.FirstOrDefault(x => x.EnName.StartsWith(portEnName, StringComparison.OrdinalIgnoreCase));
|
|
|
|
|
|
|
|
if (portInfo == null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
dto.DataObj.PORTLOAD = portInfo.EnName;
|
|
|
|
portInfo = cachePort.FirstOrDefault(x => x.EnName.Contains(portEnName, StringComparison.OrdinalIgnoreCase));
|
|
|
|
dto.DataObj.PORTLOADID = portInfo.EdiCode;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (portInfo == null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_logger.LogInformation("通过收货地城市名称未匹配到港口信息,订舱编号:{SLOT_BOOKING_NO}", dto.DataObj.SLOT_BOOKING_NO);
|
|
|
|
_logger.LogInformation("通过收货地城市名称未匹配到港口信息,订舱编号:{SLOT_BOOKING_NO}", dto.DataObj.SLOT_BOOKING_NO);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
dto.DataObj.PORTLOAD = portInfo.EnName;
|
|
|
|
|
|
|
|
dto.DataObj.PORTLOADID = portInfo.EdiCode;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -646,10 +652,10 @@ namespace Myshipping.Application
|
|
|
|
if (!string.IsNullOrWhiteSpace(portEnName))
|
|
|
|
if (!string.IsNullOrWhiteSpace(portEnName))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var cachePort = await _cache.GetAllCodePort();
|
|
|
|
var cachePort = await _cache.GetAllCodePort();
|
|
|
|
var portInfo = cachePort.FirstOrDefault(x => x.EnName.StartsWith(portEnName + ','));
|
|
|
|
var portInfo = cachePort.FirstOrDefault(x => x.EnName.StartsWith(portEnName + ',', StringComparison.OrdinalIgnoreCase));
|
|
|
|
if (portInfo == null)
|
|
|
|
if (portInfo == null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
portInfo = cachePort.FirstOrDefault(x => x.EnName.Contains(portEnName));
|
|
|
|
portInfo = cachePort.FirstOrDefault(x => x.EnName.Contains(portEnName, StringComparison.OrdinalIgnoreCase));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (portInfo == null)
|
|
|
|
if (portInfo == null)
|
|
|
@ -1084,7 +1090,7 @@ namespace Myshipping.Application
|
|
|
|
[HttpPost("/BookingSlot/refreshAllStock")]
|
|
|
|
[HttpPost("/BookingSlot/refreshAllStock")]
|
|
|
|
public async Task RefreshAllStock([FromBody] long telentId)
|
|
|
|
public async Task RefreshAllStock([FromBody] long telentId)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
await _repBase.DeleteAsync(x => x.TenantId == UserManager.TENANT_ID);
|
|
|
|
await _repStock.DeleteAsync(x => x.TenantId == telentId);
|
|
|
|
|
|
|
|
|
|
|
|
var logger = App.GetService<ILogger<BookingSlotStockSubscriber>>();
|
|
|
|
var logger = App.GetService<ILogger<BookingSlotStockSubscriber>>();
|
|
|
|
BookingSlotStockSubscriber subscriber = new BookingSlotStockSubscriber(logger);
|
|
|
|
BookingSlotStockSubscriber subscriber = new BookingSlotStockSubscriber(logger);
|
|
|
@ -2641,6 +2647,16 @@ namespace Myshipping.Application
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
|
|
|
|
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (model.CustomerId == null || string.IsNullOrWhiteSpace(model.CustomerName))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw Oops.Oh($"请选择委托单位");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (model.CtnList == null || !model.CtnList.Any())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw Oops.Oh($"请选择要使用的箱信息");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!model.SlotId.HasValue || model.SlotId.Value < 1)
|
|
|
|
if (!model.SlotId.HasValue || model.SlotId.Value < 1)
|
|
|
|
throw Oops.Oh($"舱位ID不能为空");
|
|
|
|
throw Oops.Oh($"舱位ID不能为空");
|
|
|
|
|
|
|
|
|
|
|
@ -2706,43 +2722,56 @@ namespace Myshipping.Application
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CUSTOMERID = generateModel.CustomerId,
|
|
|
|
CUSTOMERID = generateModel.CustomerId,
|
|
|
|
CUSTOMERNAME = generateModel.CustomerName,
|
|
|
|
CUSTOMERNAME = generateModel.CustomerName,
|
|
|
|
CARRIERID = carrierInfo.Code?.Trim(),
|
|
|
|
CARRIERID = carrierInfo?.Code?.Trim(),
|
|
|
|
CARRIER = carrierInfo.CnName?.Trim(),
|
|
|
|
CARRIER = carrierInfo?.CnName?.Trim(),
|
|
|
|
CUSTNO = custNo,
|
|
|
|
CUSTNO = custNo,
|
|
|
|
//MBLNO = bookingSlotBase.SLOT_BOOKING_NO.Trim(),
|
|
|
|
//MBLNO = bookingSlotBase.SLOT_BOOKING_NO.Trim(),
|
|
|
|
CONTRACTNO = !string.IsNullOrWhiteSpace(bookingSlotBase.CONTRACT_NO) ? bookingSlotBase.CONTRACT_NO : "",
|
|
|
|
CONTRACTNO = !string.IsNullOrWhiteSpace(bookingSlotBase.CONTRACT_NO) ? bookingSlotBase.CONTRACT_NO : "",
|
|
|
|
VESSEL = bookingSlotBase.VESSEL.ToUpper().Trim(),
|
|
|
|
VESSEL = bookingSlotBase.VESSEL?.ToUpper()?.Trim(),
|
|
|
|
VOYNO = bookingSlotBase.VOYNO.ToUpper().Trim(),
|
|
|
|
VOYNO = bookingSlotBase.VOYNO?.ToUpper()?.Trim(),
|
|
|
|
VOYNOINNER = bookingSlotBase.VOYNO.ToUpper().Trim(),
|
|
|
|
VOYNOINNER = bookingSlotBase.VOYNO?.ToUpper()?.Trim(),
|
|
|
|
ETD = bookingSlotBase.ETD,
|
|
|
|
ETD = bookingSlotBase.ETD,
|
|
|
|
ETA = bookingSlotBase.ETA,
|
|
|
|
ETA = bookingSlotBase.ETA,
|
|
|
|
SALEID = generateModel.SaleId.ToString(),
|
|
|
|
SALEID = generateModel.SaleId?.ToString(),
|
|
|
|
SALE = generateModel.SaleName,
|
|
|
|
SALE = generateModel.SaleName,
|
|
|
|
OPID = generateModel.OpId.ToString(),
|
|
|
|
OPID = generateModel.OpId?.ToString(),
|
|
|
|
OP = generateModel.OpName,
|
|
|
|
OP = generateModel.OpName,
|
|
|
|
DOCID = generateModel.DocId.ToString(),
|
|
|
|
DOCID = generateModel.DocId?.ToString(),
|
|
|
|
DOC = generateModel.DocName,
|
|
|
|
DOC = generateModel.DocName,
|
|
|
|
ROUTEID = generateModel.RouteID.ToString(),
|
|
|
|
ROUTEID = generateModel.RouteID?.ToString(),
|
|
|
|
ROUTE = generateModel.Route,
|
|
|
|
ROUTE = generateModel.Route,
|
|
|
|
CZRemark = generateModel.CZRemark,
|
|
|
|
CZRemark = generateModel.CZRemark,
|
|
|
|
ShenQingXiangShi = generateModel.ShenQingXiangShi,
|
|
|
|
ShenQingXiangShi = generateModel.ShenQingXiangShi,
|
|
|
|
LineManageID = generateModel.LineManageID.ToString(),
|
|
|
|
LineManageID = generateModel.LineManageID?.ToString(),
|
|
|
|
LineName = generateModel.LineManage,
|
|
|
|
LineName = generateModel.LineManage,
|
|
|
|
CLOSEVGMDATE = bookingSlotBase.VGM_SUBMISSION_CUT_DATE,
|
|
|
|
CLOSEVGMDATE = bookingSlotBase.VGM_SUBMISSION_CUT_DATE,
|
|
|
|
CLOSINGDATE = bookingSlotBase.CY_CUT_DATE,
|
|
|
|
CLOSINGDATE = bookingSlotBase.CY_CUT_DATE,
|
|
|
|
CLOSEDOCDATE = bookingSlotBase.SI_CUT_DATE,
|
|
|
|
CLOSEDOCDATE = bookingSlotBase.SI_CUT_DATE,
|
|
|
|
CUSTSERVICEID = generateModel.CustServiceId.HasValue ? generateModel.CustServiceId.Value.ToString() : null,
|
|
|
|
CUSTSERVICEID = generateModel.CustServiceId?.ToString(),
|
|
|
|
CUSTSERVICE = generateModel.CustServiceName,
|
|
|
|
CUSTSERVICE = generateModel.CustServiceName,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PORTLOAD = bookingSlotBase.PORTLOAD,
|
|
|
|
|
|
|
|
PORTLOADID = bookingSlotBase.PORTLOADID,
|
|
|
|
|
|
|
|
PORTDISCHARGE = bookingSlotBase.PORTDISCHARGE,
|
|
|
|
|
|
|
|
PORTDISCHARGEID = bookingSlotBase.PORTDISCHARGEID,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PLACEDELIVERY = bookingSlotBase.PLACEDELIVERY,
|
|
|
|
|
|
|
|
PLACEDELIVERYID = bookingSlotBase.PLACEDELIVERYID,
|
|
|
|
|
|
|
|
PLACERECEIPT = bookingSlotBase.PLACERECEIPT,
|
|
|
|
|
|
|
|
PLACERECEIPTID = bookingSlotBase.PLACERECEIPTID,
|
|
|
|
|
|
|
|
|
|
|
|
ctnInputs = new List<BookingCtnDto>()
|
|
|
|
ctnInputs = new List<BookingCtnDto>()
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// 判断是否为拆票的舱位,如果为拆票,提单号需要加上ABCD...
|
|
|
|
// 判断是否为拆票的舱位,如果为拆票,提单号需要加上ABCD...
|
|
|
|
var selectNum = generateModel.CtnList.Sum(x => x.CTNNUM);
|
|
|
|
var selectNum = generateModel.CtnList.Sum(x => x.CTNNUM);
|
|
|
|
|
|
|
|
_logger.LogInformation("根据舱位生成订舱,selectNum:{selectNum}", selectNum);
|
|
|
|
var allNum = await _repCtn.AsQueryable().Where(x => x.SLOT_ID == generateModel.SlotId).SumAsync(x => x.CTNNUM);
|
|
|
|
var allNum = await _repCtn.AsQueryable().Where(x => x.SLOT_ID == generateModel.SlotId).SumAsync(x => x.CTNNUM);
|
|
|
|
|
|
|
|
_logger.LogInformation("根据舱位生成订舱,allNum:{allNum}", allNum);
|
|
|
|
bkModel.IsSplit = selectNum != allNum;
|
|
|
|
bkModel.IsSplit = selectNum != allNum;
|
|
|
|
if (bkModel.IsSplit)
|
|
|
|
if (bkModel.IsSplit)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var sql = _repBookingOrder.AsQueryable().Where(" MBLNO like @mblno ", new { mblno = custNo + '_' }).OrderByDescending(x => x.Id).Select(x => x.MBLNO).ToSqlString();
|
|
|
|
//var sql = _repBookingOrder.AsQueryable().Where(" MBLNO like @mblno ", new { mblno = custNo + '_' }).OrderByDescending(x => x.Id).Select(x => x.MBLNO).ToSqlString();
|
|
|
|
var currentMblno = await _repBookingOrder.AsQueryable().Where(" MBLNO like @mblno ", new { mblno = custNo + '_' })
|
|
|
|
var currentMblno = await _repBookingOrder.AsQueryable().Where(" MBLNO like @mblno ", new { mblno = custNo + '_' })
|
|
|
|
.OrderByDescending(x => x.Id)
|
|
|
|
.OrderByDescending(x => x.Id)
|
|
|
|
.Select(x => x.MBLNO)
|
|
|
|
.Select(x => x.MBLNO)
|
|
|
@ -2758,6 +2787,11 @@ namespace Myshipping.Application
|
|
|
|
bkModel.MBLNO = newMblno;
|
|
|
|
bkModel.MBLNO = newMblno;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
bkModel.MBLNO = bookingSlotBase.SLOT_BOOKING_NO.Trim();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
_logger.LogInformation("根据舱位生成订舱,得到MBLNO:{MBLNO}", bkModel.MBLNO);
|
|
|
|
|
|
|
|
|
|
|
|
var ctnCodeList = _cache.GetAllCodeCtn().GetAwaiter().GetResult().ToList();
|
|
|
|
var ctnCodeList = _cache.GetAllCodeCtn().GetAwaiter().GetResult().ToList();
|
|
|
|
|
|
|
|
|
|
|
@ -2790,7 +2824,10 @@ namespace Myshipping.Application
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var bookingOrderService = _namedBookingOrderServiceProvider.GetService<ITransient>(nameof(BookingOrderService));
|
|
|
|
var bookingOrderService = _namedBookingOrderServiceProvider.GetService<ITransient>(nameof(BookingOrderService));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("根据舱位生成订舱,开始调用Save保存订舱");
|
|
|
|
var bkRlt = await bookingOrderService.Save(bkModel);
|
|
|
|
var bkRlt = await bookingOrderService.Save(bkModel);
|
|
|
|
|
|
|
|
_logger.LogInformation("根据舱位生成订舱,调用Save保存订舱完成,id:{id}", bkRlt.Id);
|
|
|
|
|
|
|
|
|
|
|
|
id = bkRlt.Id;
|
|
|
|
id = bkRlt.Id;
|
|
|
|
|
|
|
|
|
|
|
@ -2800,6 +2837,7 @@ namespace Myshipping.Application
|
|
|
|
{
|
|
|
|
{
|
|
|
|
////对应订舱和舱位关系
|
|
|
|
////对应订舱和舱位关系
|
|
|
|
var allocRlt = await ImportSlots(importSlots, id, false, generateModel);
|
|
|
|
var allocRlt = await ImportSlots(importSlots, id, false, generateModel);
|
|
|
|
|
|
|
|
_logger.LogInformation("根据舱位生成订舱,引入订舱关系完成");
|
|
|
|
|
|
|
|
|
|
|
|
//这里如果指定了委托单位的邮件联系人,则推送订舱联系人
|
|
|
|
//这里如果指定了委托单位的邮件联系人,则推送订舱联系人
|
|
|
|
if (generateModel.CustomerContactList != null && generateModel.CustomerContactList.Count > 0)
|
|
|
|
if (generateModel.CustomerContactList != null && generateModel.CustomerContactList.Count > 0)
|
|
|
|