舱位管理

master
zhangxiaofeng 6 months ago
parent 7f0a55d053
commit cf47327db8

@ -1056,7 +1056,7 @@ namespace Myshipping.Application.Entity
/// <summary>
/// 是否为舱位拆票后生成的订舱
/// </summary>
public bool? IsSplit { get; set; }
public bool IsSplit { get; set; }
/// <summary>
/// 分单操作ID

@ -150,6 +150,13 @@ namespace Myshipping.Application.Event
{
// 已使用舱位数
stockObj.USE_NUM = lstAllocKeyList.DistinctBy(x => x.BOOKING_SLOT_ID).Count();
//// 这里要判断使用的箱子与舱位原有的箱子的数量是否一致,在一致的情况下,舱位才算被使用
//foreach (var item in lstAllocKeyList)
//{
//}
//await _repAllocCtn.AsQueryable().Filter(null, true).Where(x => !x.IsDeleted)
// 订舱引用表主键列表
var lstAllocIdList = lstAllocKeyList.Select(x => x.Id).ToList();

@ -1545,7 +1545,7 @@ namespace Myshipping.Application
//陈冠宇提订舱编号不允许重复
if (!string.IsNullOrWhiteSpace(input.CUSTNO))
{
var et = await _rep.AsQueryable().Filter(null, true).AnyAsync(x => x.IsDeleted == false && x.CUSTNO == input.CUSTNO && x.TenantId == UserManager.TENANT_ID && x.ParentId == 0 && x.Id != input.Id);
var et = await _rep.AsQueryable().Filter(null, true).AnyAsync(x => x.IsDeleted == false && x.IsSplit == false && x.CUSTNO == input.CUSTNO && x.TenantId == UserManager.TENANT_ID && x.ParentId == 0 && x.Id != input.Id);
if (et)
{
throw Oops.Bah("当前订舱编号已存在,请勿重复录入!");

@ -861,7 +861,7 @@ namespace Myshipping.Application
/// <summary>
/// 是否为舱位拆票后生成的订舱
/// </summary>
public bool? IsSplit { get; set; }
public bool IsSplit { get; set; }
/// <summary>
/// 分单操作ID

@ -1971,19 +1971,20 @@ namespace Myshipping.Application
var selectNum = generateModel.CtnList.Sum(x => x.CTNNUM);
var allNum = await _repCtn.AsQueryable().Where(x => x.SLOT_ID == generateModel.SlotId).SumAsync(x => x.CTNNUM);
bkModel.IsSplit = selectNum != allNum;
if (bkModel.IsSplit == true)
if (bkModel.IsSplit)
{
var sql = _repBookingOrder.AsQueryable().Where(" MBLNO like @mblno+'_' ", new { mblno = custNo }).ToSqlString();
var currentOrder = await _repBookingOrder.AsQueryable().Where(" MBLNO like @mblno+'_' ", new { mblno = custNo })
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)
.FirstAsync();
if (currentOrder == null)
if (currentMblno == null)
{
bkModel.MBLNO = custNo + "A";
}
else
{
var lastLetter = currentOrder.MBLNO.Substring(currentOrder.MBLNO.Length - 1, 1)[0];
var lastLetter = currentMblno.Substring(currentMblno.Length - 1, 1)[0];
var newMblno = custNo + LetterIndexUtil.GetNextLetter(lastLetter);
bkModel.MBLNO = newMblno;
}

Loading…
Cancel
Save