|
|
|
@ -13017,6 +13017,85 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 获取舱位拆票或者合票后新单号结果
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取舱位拆票或者合票后新单号结果
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="model">舱位拆票或者合票请求</param>
|
|
|
|
|
/// <returns>返回舱位拆票或者合票结果</returns>
|
|
|
|
|
[HttpPost("/BookingOrder/GetBookingSlotMergeOrSplitResult")]
|
|
|
|
|
public async Task<BookingSlotMergeOrSplitResultDto> GetBookingSlotMergeOrSplitResult(BookingSlotMergeOrSplitRequestDto model)
|
|
|
|
|
{
|
|
|
|
|
BookingSlotMergeOrSplitResultDto rlt = null;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
1、拆票
|
|
|
|
|
(1)是否满足拆票判断
|
|
|
|
|
(2)订舱编号写原提单号、提单号按照原提单号+(A-Z)后缀,分单号用原提单号
|
|
|
|
|
2、合票
|
|
|
|
|
(1)是否满足合票判断
|
|
|
|
|
(2)订舱编号写原提单号、提单号原提单号,分单号用原提单号
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(model.OperType))
|
|
|
|
|
throw Oops.Oh($"操作类型不能为空");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (model.OperType.Equals("split", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
var checkResult = await bookingSlotService.CheckImportSlots(model.Slots, 0);
|
|
|
|
|
|
|
|
|
|
// 如果该票订舱没有引入过舱位,判断余量是否充足
|
|
|
|
|
if (!checkResult.isEnough)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah(checkResult.message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var reqSlot = model.Slots.FirstOrDefault();
|
|
|
|
|
|
|
|
|
|
var slotInfo = await bookingSlotService.GetInfo(reqSlot.Id);
|
|
|
|
|
|
|
|
|
|
//获取所有订舱编号是舱位提单号,并且是已经拆单的订舱记录
|
|
|
|
|
var orderList = _rep.AsQueryable().Where(a => a.CUSTNO == slotInfo.SLOT_BOOKING_NO && a.SPLIT_OR_MERGE_FLAG == 1 && a.IsDeleted == false).ToList();
|
|
|
|
|
|
|
|
|
|
rlt = new BookingSlotMergeOrSplitResultDto();
|
|
|
|
|
|
|
|
|
|
if (orderList.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
rlt.NewMBlNo = $"{slotInfo.SLOT_BOOKING_NO}A";
|
|
|
|
|
rlt.BookingReferNo = slotInfo.SLOT_BOOKING_NO;
|
|
|
|
|
rlt.NewSubBlNo = slotInfo.SLOT_BOOKING_NO;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var maxChar = orderList.Select(a =>
|
|
|
|
|
{
|
|
|
|
|
var startIndx = a.CUSTNO.Length;
|
|
|
|
|
return a.MBLNO.Substring(startIndx);
|
|
|
|
|
}).Max();
|
|
|
|
|
|
|
|
|
|
if (maxChar.Length != 1 || !Regex.IsMatch(maxChar, "[A-Z]{1}"))
|
|
|
|
|
throw Oops.Oh($"获取的历史拆票后缀异常,maxChar={maxChar}");
|
|
|
|
|
|
|
|
|
|
rlt.NewMBlNo = $"{slotInfo.SLOT_BOOKING_NO}{LetterIndexUtil.GetNextLetter(maxChar[0])}";
|
|
|
|
|
rlt.BookingReferNo = slotInfo.SLOT_BOOKING_NO;
|
|
|
|
|
rlt.NewSubBlNo = slotInfo.SLOT_BOOKING_NO;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if(model.OperType.Equals("merge", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Oh($"操作类型不能识别");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return rlt;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|