舱位管理

master
zhangxiaofeng 6 months ago
parent eb26986d55
commit c0ef9090e8

@ -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))
{ {
@ -12772,7 +12787,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 +12795,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()

@ -2732,11 +2732,13 @@ namespace Myshipping.Application
// 判断是否为拆票的舱位如果为拆票提单号需要加上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)
@ -2752,6 +2754,7 @@ namespace Myshipping.Application
bkModel.MBLNO = newMblno; bkModel.MBLNO = newMblno;
} }
} }
_logger.LogInformation("根据舱位生成订舱得到MBLNO:{MBLNO}", bkModel.MBLNO);
var ctnCodeList = _cache.GetAllCodeCtn().GetAwaiter().GetResult().ToList(); var ctnCodeList = _cache.GetAllCodeCtn().GetAwaiter().GetResult().ToList();
@ -2784,7 +2787,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;
@ -2794,6 +2800,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)

Loading…
Cancel
Save