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

@ -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)

@ -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