|
|
|
@ -619,16 +619,22 @@ namespace Myshipping.Application
|
|
|
|
|
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)
|
|
|
|
|
var cachePort = await _cache.GetAllCodePort();
|
|
|
|
|
|
|
|
|
|
var portInfo = cachePort.FirstOrDefault(x => x.EnName.StartsWith(portEnName, StringComparison.OrdinalIgnoreCase));
|
|
|
|
|
if (portInfo == null)
|
|
|
|
|
{
|
|
|
|
|
dto.DataObj.PORTLOAD = portInfo.EnName;
|
|
|
|
|
dto.DataObj.PORTLOADID = portInfo.EdiCode;
|
|
|
|
|
portInfo = cachePort.FirstOrDefault(x => x.EnName.Contains(portEnName, StringComparison.OrdinalIgnoreCase));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if (portInfo == null)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation("通过收货地城市名称未匹配到港口信息,订舱编号:{SLOT_BOOKING_NO}", dto.DataObj.SLOT_BOOKING_NO);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
dto.DataObj.PORTLOAD = portInfo.EnName;
|
|
|
|
|
dto.DataObj.PORTLOADID = portInfo.EdiCode;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -646,10 +652,10 @@ namespace Myshipping.Application
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(portEnName))
|
|
|
|
|
{
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
portInfo = cachePort.FirstOrDefault(x => x.EnName.Contains(portEnName));
|
|
|
|
|
portInfo = cachePort.FirstOrDefault(x => x.EnName.Contains(portEnName, StringComparison.OrdinalIgnoreCase));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (portInfo == null)
|
|
|
|
@ -1084,7 +1090,7 @@ namespace Myshipping.Application
|
|
|
|
|
[HttpPost("/BookingSlot/refreshAllStock")]
|
|
|
|
|
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>>();
|
|
|
|
|
BookingSlotStockSubscriber subscriber = new BookingSlotStockSubscriber(logger);
|
|
|
|
@ -2641,6 +2647,16 @@ namespace Myshipping.Application
|
|
|
|
|
{
|
|
|
|
|
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)
|
|
|
|
|
throw Oops.Oh($"舱位ID不能为空");
|
|
|
|
|
|
|
|
|
@ -2706,43 +2722,56 @@ namespace Myshipping.Application
|
|
|
|
|
{
|
|
|
|
|
CUSTOMERID = generateModel.CustomerId,
|
|
|
|
|
CUSTOMERNAME = generateModel.CustomerName,
|
|
|
|
|
CARRIERID = carrierInfo.Code?.Trim(),
|
|
|
|
|
CARRIER = carrierInfo.CnName?.Trim(),
|
|
|
|
|
CARRIERID = carrierInfo?.Code?.Trim(),
|
|
|
|
|
CARRIER = carrierInfo?.CnName?.Trim(),
|
|
|
|
|
CUSTNO = custNo,
|
|
|
|
|
//MBLNO = bookingSlotBase.SLOT_BOOKING_NO.Trim(),
|
|
|
|
|
CONTRACTNO = !string.IsNullOrWhiteSpace(bookingSlotBase.CONTRACT_NO) ? bookingSlotBase.CONTRACT_NO : "",
|
|
|
|
|
VESSEL = bookingSlotBase.VESSEL.ToUpper().Trim(),
|
|
|
|
|
VOYNO = bookingSlotBase.VOYNO.ToUpper().Trim(),
|
|
|
|
|
VOYNOINNER = bookingSlotBase.VOYNO.ToUpper().Trim(),
|
|
|
|
|
VESSEL = bookingSlotBase.VESSEL?.ToUpper()?.Trim(),
|
|
|
|
|
VOYNO = bookingSlotBase.VOYNO?.ToUpper()?.Trim(),
|
|
|
|
|
VOYNOINNER = bookingSlotBase.VOYNO?.ToUpper()?.Trim(),
|
|
|
|
|
ETD = bookingSlotBase.ETD,
|
|
|
|
|
ETA = bookingSlotBase.ETA,
|
|
|
|
|
SALEID = generateModel.SaleId.ToString(),
|
|
|
|
|
SALEID = generateModel.SaleId?.ToString(),
|
|
|
|
|
SALE = generateModel.SaleName,
|
|
|
|
|
OPID = generateModel.OpId.ToString(),
|
|
|
|
|
OPID = generateModel.OpId?.ToString(),
|
|
|
|
|
OP = generateModel.OpName,
|
|
|
|
|
DOCID = generateModel.DocId.ToString(),
|
|
|
|
|
DOCID = generateModel.DocId?.ToString(),
|
|
|
|
|
DOC = generateModel.DocName,
|
|
|
|
|
ROUTEID = generateModel.RouteID.ToString(),
|
|
|
|
|
ROUTEID = generateModel.RouteID?.ToString(),
|
|
|
|
|
ROUTE = generateModel.Route,
|
|
|
|
|
CZRemark = generateModel.CZRemark,
|
|
|
|
|
ShenQingXiangShi = generateModel.ShenQingXiangShi,
|
|
|
|
|
LineManageID = generateModel.LineManageID.ToString(),
|
|
|
|
|
LineManageID = generateModel.LineManageID?.ToString(),
|
|
|
|
|
LineName = generateModel.LineManage,
|
|
|
|
|
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?.ToString(),
|
|
|
|
|
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>()
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 判断是否为拆票的舱位,如果为拆票,提单号需要加上ABCD...
|
|
|
|
|
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);
|
|
|
|
|
_logger.LogInformation("根据舱位生成订舱,allNum:{allNum}", allNum);
|
|
|
|
|
bkModel.IsSplit = selectNum != allNum;
|
|
|
|
|
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 + '_' })
|
|
|
|
|
.OrderByDescending(x => x.Id)
|
|
|
|
|
.Select(x => x.MBLNO)
|
|
|
|
@ -2758,6 +2787,11 @@ namespace Myshipping.Application
|
|
|
|
|
bkModel.MBLNO = newMblno;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bkModel.MBLNO = bookingSlotBase.SLOT_BOOKING_NO.Trim();
|
|
|
|
|
}
|
|
|
|
|
_logger.LogInformation("根据舱位生成订舱,得到MBLNO:{MBLNO}", bkModel.MBLNO);
|
|
|
|
|
|
|
|
|
|
var ctnCodeList = _cache.GetAllCodeCtn().GetAwaiter().GetResult().ToList();
|
|
|
|
|
|
|
|
|
@ -2790,7 +2824,10 @@ namespace Myshipping.Application
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var bookingOrderService = _namedBookingOrderServiceProvider.GetService<ITransient>(nameof(BookingOrderService));
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("根据舱位生成订舱,开始调用Save保存订舱");
|
|
|
|
|
var bkRlt = await bookingOrderService.Save(bkModel);
|
|
|
|
|
_logger.LogInformation("根据舱位生成订舱,调用Save保存订舱完成,id:{id}", bkRlt.Id);
|
|
|
|
|
|
|
|
|
|
id = bkRlt.Id;
|
|
|
|
|
|
|
|
|
@ -2800,6 +2837,7 @@ namespace Myshipping.Application
|
|
|
|
|
{
|
|
|
|
|
////对应订舱和舱位关系
|
|
|
|
|
var allocRlt = await ImportSlots(importSlots, id, false, generateModel);
|
|
|
|
|
_logger.LogInformation("根据舱位生成订舱,引入订舱关系完成");
|
|
|
|
|
|
|
|
|
|
//这里如果指定了委托单位的邮件联系人,则推送订舱联系人
|
|
|
|
|
if (generateModel.CustomerContactList != null && generateModel.CustomerContactList.Count > 0)
|
|
|
|
@ -3060,9 +3098,9 @@ namespace Myshipping.Application
|
|
|
|
|
if (bcSrcDto.CarrierId.Equals("MSK", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
var bookingSlotAllocList = _repBase.AsQueryable().Filter(null, true)
|
|
|
|
|
.LeftJoin<BookingSlotAllocation>((slot,alloc)=> slot.Id == alloc.BOOKING_SLOT_ID)
|
|
|
|
|
.LeftJoin<BookingSlotAllocation>((slot, alloc) => slot.Id == alloc.BOOKING_SLOT_ID)
|
|
|
|
|
.Where((slot, alloc) => slot.Id == slotId && slot.IsDeleted == false && slot.TenantId == UserManager.TENANT_ID && alloc.IsDeleted == false)
|
|
|
|
|
.Select((slot, alloc) => new { Slot = slot,Alloc = alloc }).ToList();
|
|
|
|
|
.Select((slot, alloc) => new { Slot = slot, Alloc = alloc }).ToList();
|
|
|
|
|
|
|
|
|
|
List<BookingOrder> bookingOrderList = new List<BookingOrder>();
|
|
|
|
|
List<SysUser> userList = new List<SysUser>();
|
|
|
|
@ -3115,7 +3153,7 @@ namespace Myshipping.Application
|
|
|
|
|
{
|
|
|
|
|
bookingSlotAllocList.ForEach(async ca =>
|
|
|
|
|
{
|
|
|
|
|
var bookingInfo = _repBookingOrder.AsQueryable().Filter(null, true).First(x => x.Id == ca.Alloc.BOOKING_ID && x.IsDeleted == false
|
|
|
|
|
var bookingInfo = _repBookingOrder.AsQueryable().Filter(null, true).First(x => x.Id == ca.Alloc.BOOKING_ID && x.IsDeleted == false
|
|
|
|
|
&& x.TenantId == UserManager.TENANT_ID);
|
|
|
|
|
|
|
|
|
|
var notice = new CautionNoticeTaskDto
|
|
|
|
@ -3419,7 +3457,7 @@ namespace Myshipping.Application
|
|
|
|
|
DateTime targeVGMCutDate = DateTime.Parse(targeVGMCut);
|
|
|
|
|
|
|
|
|
|
//如果新给的VGM截止时间,需要推送通知
|
|
|
|
|
if(srcVGMCutDate > targeVGMCutDate)
|
|
|
|
|
if (srcVGMCutDate > targeVGMCutDate)
|
|
|
|
|
{
|
|
|
|
|
if (bookingSlotAllocList.Count > 0)
|
|
|
|
|
{
|
|
|
|
@ -3502,7 +3540,7 @@ namespace Myshipping.Application
|
|
|
|
|
/// <param name="contactId">联系用户ID</param>
|
|
|
|
|
/// <param name="mblNo">提单号</param>
|
|
|
|
|
/// <param name="cautionNoticeType">重要通知类型</param>
|
|
|
|
|
private void CreateContact(List<CautionNoticeTaskNoitfyDto> notifyList, List<SysUser> userList,long contactId,string mblNo, CautionNoticeTaskEnum cautionNoticeType)
|
|
|
|
|
private void CreateContact(List<CautionNoticeTaskNoitfyDto> notifyList, List<SysUser> userList, long contactId, string mblNo, CautionNoticeTaskEnum cautionNoticeType)
|
|
|
|
|
{
|
|
|
|
|
if (!notifyList.Any(p => p.notifyUserId == contactId))
|
|
|
|
|
{
|
|
|
|
|