jianghaiqing 6 months ago
commit 48388b60e1

@ -2038,15 +2038,30 @@ namespace Myshipping.Application
_logger.LogWarning($"保存请求[{reqId}]{(input.Id == 0 ? "" : "")}数据完成"); _logger.LogWarning($"保存请求[{reqId}]{(input.Id == 0 ? "" : "")}数据完成");
} }
var Id = entity.Id;
BookingOrderOutput ordOut = new BookingOrderOutput();
var main = await _rep.AsQueryable().Filter(null, true).FirstAsync(u => u.Id == Id);
// 【引入舱位】:保存引用信息 // 【引入舱位】:保存引用信息
if (input.Slots?.Any() == true) if (input.Slots?.Any() == true)
{ {
await bookingSlotService.ImportSlots(input.Slots, entity.Id, false); var generateDto = new BookingGenerateDto()
{
CustomerId = main.CUSTOMERID,
CustomerName = main.CUSTOMERNAME,
//CustServiceId = main.CUSTSERVICEID,
CustServiceName = main.CUSTSERVICE,
//SaleId = main.SALEID,
SaleName = main.SALE,
GOODSNAME = main.GOODSNAME,
};
if (long.TryParse(main.CUSTSERVICEID, out long t1)) generateDto.CustServiceId = t1;
if (long.TryParse(main.SALEID, out long t2)) generateDto.SaleId = t2;
await bookingSlotService.ImportSlots(input.Slots, entity.Id, false, generateDto);
} }
var Id = entity.Id;
BookingOrderOutput ordOut = new BookingOrderOutput();
var main = await _rep.AsQueryable().Filter(null, true).FirstAsync(u => u.Id == Id);
if (!string.IsNullOrEmpty(entity.MBLNO) || !string.IsNullOrEmpty(entity.CUSTNO)) if (!string.IsNullOrEmpty(entity.MBLNO) || !string.IsNullOrEmpty(entity.CUSTNO))
{ {
@ -10728,6 +10743,7 @@ namespace Myshipping.Application
extModel.TxxpEndTime = date; extModel.TxxpEndTime = date;
await _repextendstate.InsertAsync(extModel); await _repextendstate.InsertAsync(extModel);
} }
await SendBookingOrder(new long[] { bookId });
} }
#endregion #endregion
@ -12772,7 +12788,7 @@ namespace Myshipping.Application
throw Oops.Bah("请求参数不能为空"); throw Oops.Bah("请求参数不能为空");
} }
if(dto.Id.Count == 0) if (dto.Id.Count == 0)
throw Oops.Bah("未选中需要更新的订舱数据,请重新选择"); throw Oops.Bah("未选中需要更新的订舱数据,请重新选择");
string version = Guid.NewGuid().ToString(); string version = Guid.NewGuid().ToString();
@ -12780,7 +12796,7 @@ namespace Myshipping.Application
// 记录日志 // 记录日志
var oldOrderList = await _rep.AsQueryable().Filter(null, true).Where(x => dto.Id.Contains(x.Id) && x.IsDeleted == false).ToListAsync(); var oldOrderList = await _rep.AsQueryable().Filter(null, true).Where(x => dto.Id.Contains(x.Id) && x.IsDeleted == false).ToListAsync();
if(dto.Id.Count != oldOrderList.Count) if (dto.Id.Count != oldOrderList.Count)
throw Oops.Bah("订舱数据获取失败,部分订舱数据未获取到,订舱数据为空或已作废"); throw Oops.Bah("订舱数据获取失败,部分订舱数据未获取到,订舱数据为空或已作废");
//oldOrderList.ForEach() //oldOrderList.ForEach()

@ -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)
@ -3060,9 +3098,9 @@ namespace Myshipping.Application
if (bcSrcDto.CarrierId.Equals("MSK", StringComparison.OrdinalIgnoreCase)) if (bcSrcDto.CarrierId.Equals("MSK", StringComparison.OrdinalIgnoreCase))
{ {
var bookingSlotAllocList = _repBase.AsQueryable().Filter(null, true) 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) .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<BookingOrder> bookingOrderList = new List<BookingOrder>();
List<SysUser> userList = new List<SysUser>(); List<SysUser> userList = new List<SysUser>();
@ -3115,7 +3153,7 @@ namespace Myshipping.Application
{ {
bookingSlotAllocList.ForEach(async ca => 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); && x.TenantId == UserManager.TENANT_ID);
var notice = new CautionNoticeTaskDto var notice = new CautionNoticeTaskDto
@ -3419,7 +3457,7 @@ namespace Myshipping.Application
DateTime targeVGMCutDate = DateTime.Parse(targeVGMCut); DateTime targeVGMCutDate = DateTime.Parse(targeVGMCut);
//如果新给的VGM截止时间需要推送通知 //如果新给的VGM截止时间需要推送通知
if(srcVGMCutDate > targeVGMCutDate) if (srcVGMCutDate > targeVGMCutDate)
{ {
if (bookingSlotAllocList.Count > 0) if (bookingSlotAllocList.Count > 0)
{ {
@ -3502,7 +3540,7 @@ namespace Myshipping.Application
/// <param name="contactId">联系用户ID</param> /// <param name="contactId">联系用户ID</param>
/// <param name="mblNo">提单号</param> /// <param name="mblNo">提单号</param>
/// <param name="cautionNoticeType">重要通知类型</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)) if (!notifyList.Any(p => p.notifyUserId == contactId))
{ {

@ -476,10 +476,16 @@ public class AuthService : IAuthService, IDynamicApiController, ITransient
/// <param name="input"></param> /// <param name="input"></param>
/// <remarks>默认用户名/密码admin/admin</remarks> /// <remarks>默认用户名/密码admin/admin</remarks>
/// <returns></returns> /// <returns></returns>
[HttpPost("/GetAuthorizationKye")] [HttpPost("/GetAuthorizationKey")]
[AllowAnonymous] [AllowAnonymous,ApiUser(ApiCode = "GetAuthorizationKey")]
public async Task<string> GetAuthorizationKey([Required] GetAuthorizationKeyInput input) public async Task<string> GetAuthorizationKey([Required] GetAuthorizationKeyInput input)
{ {
//验证用户ID有效性
var user= _sysUserRep.AsQueryable().Filter(null, true).First(u => u.DjyUserId == _cache.Get(input.UserId));
if (user is null)
{
throw Oops.Bah("用户Id不存在");
}
//将key写入到redis 并指定五秒过期 //将key写入到redis 并指定五秒过期
string key = Guid.NewGuid().ToString(); string key = Guid.NewGuid().ToString();
await _cache.SetTimeoutAsync( key, input.UserId, TimeSpan.FromSeconds(5)); await _cache.SetTimeoutAsync( key, input.UserId, TimeSpan.FromSeconds(5));

Loading…
Cancel
Save