|
|
|
@ -365,8 +365,10 @@ namespace Myshipping.Application
|
|
|
|
|
TenantId = model.TenantId
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
var inputDto = new BookingSlotBaseApiDto {
|
|
|
|
|
DataObj = new BookingSlotBaseApiSaveDto {
|
|
|
|
|
var inputDto = new BookingSlotBaseApiDto
|
|
|
|
|
{
|
|
|
|
|
DataObj = new BookingSlotBaseApiSaveDto
|
|
|
|
|
{
|
|
|
|
|
PORTDISCHARGEID = model.PORTDISCHARGEID,
|
|
|
|
|
PORTDISCHARGE = model.PORTDISCHARGE,
|
|
|
|
|
PORTLOADID = model.PORTLOADID,
|
|
|
|
@ -816,9 +818,9 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(dto.DataObj.CTN_STAT))
|
|
|
|
|
{
|
|
|
|
|
if(dto.DataObj.CtnList != null && dto.DataObj.CtnList.Count > 0)
|
|
|
|
|
if (dto.DataObj.CtnList != null && dto.DataObj.CtnList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
dto.DataObj.CTN_STAT = string.Join(",",dto.DataObj.CtnList.GroupBy(a => a.CTNALL).Select(a =>
|
|
|
|
|
dto.DataObj.CTN_STAT = string.Join(",", dto.DataObj.CtnList.GroupBy(a => a.CTNALL).Select(a =>
|
|
|
|
|
$"{a.Key}*{a.Select(b => b.CTNNUM).Sum()}").ToArray());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1047,7 +1049,7 @@ namespace Myshipping.Application
|
|
|
|
|
await PushCompareBCInfo(bcSrcDto, bcTargetDto, id, dto.BatchNo);
|
|
|
|
|
|
|
|
|
|
//触发标签自动绑定
|
|
|
|
|
await GenerateSlotLabel(dto,id);
|
|
|
|
|
await GenerateSlotLabel(dto, id);
|
|
|
|
|
}
|
|
|
|
|
else if (dto.OpType == "del")
|
|
|
|
|
{
|
|
|
|
@ -1564,31 +1566,64 @@ namespace Myshipping.Application
|
|
|
|
|
})
|
|
|
|
|
.MergeTable();
|
|
|
|
|
|
|
|
|
|
// 3. 将queryable1 左连接 queryable2,使用【总的箱量】减去【已使用的箱量】,得到【剩余的箱量】,添加【剩余的箱量】> 0 的条件,作为queryable3
|
|
|
|
|
var queryable3 = queryable1.LeftJoin(queryable2, (q1, q2) => q1.id == q2.id && q1.ctnCode == q2.ctnCode)
|
|
|
|
|
ISugarQueryable<AvailableSlotDto> tragerQueryable;
|
|
|
|
|
|
|
|
|
|
if (pageInfo == null)
|
|
|
|
|
{
|
|
|
|
|
// 3. 将queryable1 左连接 queryable2,使用【总的箱量】减去【已使用的箱量】,得到【剩余的箱量】,添加【剩余的箱量】> 0 的条件,作为queryable3
|
|
|
|
|
tragerQueryable = queryable1.LeftJoin(queryable2, (q1, q2) => q1.id == q2.id && q1.ctnCode == q2.ctnCode)
|
|
|
|
|
.Select((q1, q2) => new AvailableSlotDto
|
|
|
|
|
{
|
|
|
|
|
Id = q1.id,
|
|
|
|
|
CtnCode = q1.ctnCode,
|
|
|
|
|
CtnAll = q1.numAll,
|
|
|
|
|
NumResidue = SqlFunc.IsNull(q1.numAll - q2.numUse, q1.numAll)
|
|
|
|
|
})
|
|
|
|
|
.MergeTable()
|
|
|
|
|
.Where(r => r.NumResidue > 0);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var queryable1Clone = queryable1.Clone();
|
|
|
|
|
|
|
|
|
|
// 3. 将queryable1 左连接 queryable2,使用【总的箱量】减去【已使用的箱量】,得到【剩余的箱量】,添加【剩余的箱量】> 0 的条件,并对Id进行去重,作为queryable3
|
|
|
|
|
var queryable3 = queryable1.LeftJoin(queryable2, (q1, q2) => q1.id == q2.id && q1.ctnCode == q2.ctnCode)
|
|
|
|
|
.Select((q1, q2) => new
|
|
|
|
|
{
|
|
|
|
|
q1.id,
|
|
|
|
|
q1.ctnCode,
|
|
|
|
|
q1.numAll,
|
|
|
|
|
numResidue = SqlFunc.IsNull(q1.numAll - q2.numUse, q1.numAll)
|
|
|
|
|
})
|
|
|
|
|
.MergeTable()
|
|
|
|
|
.Where(r => r.numResidue > 0);
|
|
|
|
|
.Where(r => r.numResidue > 0)
|
|
|
|
|
.Select(r => r.id)
|
|
|
|
|
.Distinct();
|
|
|
|
|
|
|
|
|
|
// 4. 执行ToList(),得到可用的【舱位主键】、【箱型】、【箱量】列表
|
|
|
|
|
RefAsync<int> total = 0;
|
|
|
|
|
var canUselist = pageInfo == null
|
|
|
|
|
? await queryable3.ToListAsync()
|
|
|
|
|
: await queryable3.ToPageListAsync(pageInfo.PageNo, pageInfo.PageSize, total);
|
|
|
|
|
// 4. 执行queryable3,得到【可用的舱位主键列表】
|
|
|
|
|
RefAsync<int> total = 0;
|
|
|
|
|
var canUseIdList = await queryable3.ToPageListAsync(pageInfo.PageNo, pageInfo.PageSize, total);
|
|
|
|
|
|
|
|
|
|
if (pageInfo != null)
|
|
|
|
|
{
|
|
|
|
|
pageInfo.Total = total;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 5. 使用queryable1的副本queryable1Clone,左连接queryable2,添加【可用的舱位主键列表】作为条件,得到queryable4
|
|
|
|
|
tragerQueryable = queryable1Clone.LeftJoin(queryable2, (q1, q2) => q1.id == q2.id && q1.ctnCode == q2.ctnCode)
|
|
|
|
|
.Select((q1, q2) => new AvailableSlotDto()
|
|
|
|
|
{
|
|
|
|
|
Id = q1.id,
|
|
|
|
|
CtnCode = q1.ctnCode,
|
|
|
|
|
CtnAll = q1.numAll,
|
|
|
|
|
NumResidue = SqlFunc.IsNull(q1.numAll - q2.numUse, q1.numAll)
|
|
|
|
|
})
|
|
|
|
|
.MergeTable()
|
|
|
|
|
.Where(r => canUseIdList.Contains(r.Id));
|
|
|
|
|
|
|
|
|
|
if (pageInfo != null)
|
|
|
|
|
{
|
|
|
|
|
pageInfo.Total = total;
|
|
|
|
|
}
|
|
|
|
|
List<AvailableSlotDto> canUselist = await tragerQueryable.ToListAsync();
|
|
|
|
|
|
|
|
|
|
// 查询舱位列表
|
|
|
|
|
var baseIdList = canUselist.Select(c => c.id);
|
|
|
|
|
var baseIdList = canUselist.Select(c => c.Id);
|
|
|
|
|
List<BookingSlotBase> baseList = await _repBase.AsQueryable()
|
|
|
|
|
.Where(u => baseIdList.Contains(u.Id))
|
|
|
|
|
.ToListAsync();
|
|
|
|
@ -1599,15 +1634,15 @@ namespace Myshipping.Application
|
|
|
|
|
List<BookingSlotBaseWithCtnDto> result = baseList.Adapt<List<BookingSlotBaseWithCtnDto>>();
|
|
|
|
|
foreach (var item in result)
|
|
|
|
|
{
|
|
|
|
|
var ctnList = canUselist.Where(c => c.id == item.Id).ToList();
|
|
|
|
|
var ctnList = canUselist.Where(c => c.Id == item.Id).ToList();
|
|
|
|
|
if (ctnList?.Any() == true)
|
|
|
|
|
{
|
|
|
|
|
item.CtnList = ctnList.Select(c => new BookingSlotCtnDto()
|
|
|
|
|
{
|
|
|
|
|
CTNCODE = c.ctnCode,
|
|
|
|
|
CTNNUM = c.numResidue,
|
|
|
|
|
TOTALNUM = c.numAll,
|
|
|
|
|
CTNALL = ctnCodeCache.FirstOrDefault(e => e.Code == c.ctnCode)?.Name ?? throw new Exception($"舱位信息中存在未收录的箱型:{c.ctnCode},需要在箱型字典中补充"),
|
|
|
|
|
CTNCODE = c.CtnCode,
|
|
|
|
|
CTNNUM = c.NumResidue,
|
|
|
|
|
TOTALNUM = c.CtnAll,
|
|
|
|
|
CTNALL = ctnCodeCache.FirstOrDefault(e => e.Code == c.CtnCode)?.Name ?? throw new Exception($"舱位信息中存在未收录的箱型:{c.CtnCode},需要在箱型字典中补充"),
|
|
|
|
|
}).ToList();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1809,7 +1844,7 @@ namespace Myshipping.Application
|
|
|
|
|
newSlotAllocation.SELLING_PRICE = generateModel.SELLING_PRICE;
|
|
|
|
|
newSlotAllocation.SPLIT_OR_MERGE_FLAG = generateModel.SplitOrMerge;
|
|
|
|
|
|
|
|
|
|
if(generateModel.SplitOrMerge == 1 || generateModel.SplitOrMerge == 2)
|
|
|
|
|
if (generateModel.SplitOrMerge == 1 || generateModel.SplitOrMerge == 2)
|
|
|
|
|
{
|
|
|
|
|
newSlotAllocation.ALLO_BILL_NO = generateModel.NewMBlNo;
|
|
|
|
|
}
|
|
|
|
@ -3116,7 +3151,7 @@ namespace Myshipping.Application
|
|
|
|
|
/// <returns>返回订舱ID</returns>
|
|
|
|
|
private async Task<long> GenerateBookingOrder(BookingSlotBase bookingSlotBase,
|
|
|
|
|
List<BookingFile> bookingSlotFileList,
|
|
|
|
|
BookingGenerateDto generateModel,string masterBookingSlotNo)
|
|
|
|
|
BookingGenerateDto generateModel, string masterBookingSlotNo)
|
|
|
|
|
{
|
|
|
|
|
long id = 0;
|
|
|
|
|
|
|
|
|
@ -3188,7 +3223,7 @@ namespace Myshipping.Application
|
|
|
|
|
//bkModel.IsSplit = selectNum != allNum;
|
|
|
|
|
bkModel.SPLIT_OR_MERGE_FLAG = selectNum != allNum ? 1 : 0;
|
|
|
|
|
|
|
|
|
|
if(!string.IsNullOrWhiteSpace(masterBookingSlotNo))
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(masterBookingSlotNo))
|
|
|
|
|
bkModel.SPLIT_OR_MERGE_FLAG = 2;
|
|
|
|
|
|
|
|
|
|
//拆票逻辑
|
|
|
|
@ -3526,7 +3561,7 @@ namespace Myshipping.Application
|
|
|
|
|
var bkNoList = list.Select(x => x.BOOKING_ID).ToList();
|
|
|
|
|
var bkList = _repBookingOrder.AsQueryable().Filter(null, true).Where(a => bkNoList.Contains(a.Id) && a.TenantId == tenantId && a.IsDeleted == false).ToList();
|
|
|
|
|
|
|
|
|
|
if(bkList.Count > 0)
|
|
|
|
|
if (bkList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
dto.BookingOrderList = bkList.Select(x => x.Id).ToList();
|
|
|
|
|
}
|
|
|
|
@ -3623,7 +3658,7 @@ namespace Myshipping.Application
|
|
|
|
|
var bookingInfo = _repBookingOrder.AsQueryable().Filter(null, true).First(x => x.Id == ca.Alloc.BOOKING_ID && x.IsDeleted == false
|
|
|
|
|
&& x.TenantId == UserManager.TENANT_ID);
|
|
|
|
|
|
|
|
|
|
CreateTask(CautionNoticeTaskEnum.WeekAt, bcSrcDto, userList, bookingInfo, slotInfo, srcWeek, targetWeek, $"提单号:{bcSrcDto.MBLNo} \r\n计费周变更了 \r\n原:{srcWeek} \r\n新:{targetWeek}",true);
|
|
|
|
|
CreateTask(CautionNoticeTaskEnum.WeekAt, bcSrcDto, userList, bookingInfo, slotInfo, srcWeek, targetWeek, $"提单号:{bcSrcDto.MBLNo} \r\n计费周变更了 \r\n原:{srcWeek} \r\n新:{targetWeek}", true);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else if (slotInfo != null)
|
|
|
|
@ -3771,7 +3806,8 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
bool isNeedWholeShip = false;
|
|
|
|
|
|
|
|
|
|
CautionNoticeTaskWholeShipDto cautionNoticeTaskWholeShipDto = new CautionNoticeTaskWholeShipDto {
|
|
|
|
|
CautionNoticeTaskWholeShipDto cautionNoticeTaskWholeShipDto = new CautionNoticeTaskWholeShipDto
|
|
|
|
|
{
|
|
|
|
|
Carrier = slotInfo.CARRIERID,
|
|
|
|
|
MBLNo = slotInfo.SLOT_BOOKING_NO
|
|
|
|
|
};
|
|
|
|
@ -3865,7 +3901,7 @@ namespace Myshipping.Application
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if(cautionNoticeTaskWholeShipDto.IsVesselChange)
|
|
|
|
|
if (cautionNoticeTaskWholeShipDto.IsVesselChange)
|
|
|
|
|
{
|
|
|
|
|
if (bookingSlotAllocList.Count > 0)
|
|
|
|
|
{
|
|
|
|
@ -4046,7 +4082,7 @@ namespace Myshipping.Application
|
|
|
|
|
/// <param name="targetVal">变更值</param>
|
|
|
|
|
/// <param name="notifyContent">提示信息</param>
|
|
|
|
|
private void CreateTask(CautionNoticeTaskEnum cautionNoticeType, TaskBCInfoDto bcSrcDto, List<SysUser> userList, BookingOrder bookingInfo,
|
|
|
|
|
BookingSlotBase bookingSlotInfo, string srcVal, string targetVal, string notifyContent,bool isAutoSendNotice)
|
|
|
|
|
BookingSlotBase bookingSlotInfo, string srcVal, string targetVal, string notifyContent, bool isAutoSendNotice)
|
|
|
|
|
{
|
|
|
|
|
List<long> userIdList = new List<long>();
|
|
|
|
|
|
|
|
|
@ -4149,15 +4185,15 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var model =_repBase.AsQueryable().Filter(null, true)
|
|
|
|
|
var model = _repBase.AsQueryable().Filter(null, true)
|
|
|
|
|
.First(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID && x.SLOT_BOOKING_NO == slotBookingNo && x.CARRIERID == CarrierId);
|
|
|
|
|
|
|
|
|
|
if(model == null)
|
|
|
|
|
if (model == null)
|
|
|
|
|
throw Oops.Bah("舱位信息不存在");
|
|
|
|
|
|
|
|
|
|
id = model.Id;
|
|
|
|
|
}
|
|
|
|
|
catch(Exception ex)
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation($"订舱编号检索舱位信息失败,原因:{ex.Message}");
|
|
|
|
|
}
|
|
|
|
@ -4377,7 +4413,7 @@ namespace Myshipping.Application
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<Tuple<string, long, string >> rltList = new List<Tuple<string, long,string>>();
|
|
|
|
|
List<Tuple<string, long, string>> rltList = new List<Tuple<string, long, string>>();
|
|
|
|
|
|
|
|
|
|
list.ForEach(m =>
|
|
|
|
|
{
|
|
|
|
@ -4426,7 +4462,7 @@ namespace Myshipping.Application
|
|
|
|
|
/// <param name="dto">舱位详情</param>
|
|
|
|
|
/// <param name="id">舱位ID</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
private async Task GenerateSlotLabel(BookingSlotBaseApiDto dto,long id)
|
|
|
|
|
private async Task GenerateSlotLabel(BookingSlotBaseApiDto dto, long id)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
@ -4440,7 +4476,7 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
List<BookingLabelBaseDto> ruleList = new List<BookingLabelBaseDto>();
|
|
|
|
|
|
|
|
|
|
if(labelList.Count > 0)
|
|
|
|
|
if (labelList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < labelList.Count; i++)
|
|
|
|
|
{
|
|
|
|
@ -4458,11 +4494,11 @@ namespace Myshipping.Application
|
|
|
|
|
{
|
|
|
|
|
var operEnum = (LabelRegexOperEnum)System.Enum.Parse(typeof(LabelRegexOperEnum), regList[j].oper);
|
|
|
|
|
|
|
|
|
|
if (regList[j].name.Equals("PORTLOADID",StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
if (regList[j].name.Equals("PORTLOADID", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
isSucc = CheckLabel("PORTLOADID", dto.DataObj.PORTLOADID, regList[j].val, regList[j].master, operEnum);
|
|
|
|
|
|
|
|
|
|
if(isSucc)
|
|
|
|
|
if (isSucc)
|
|
|
|
|
{
|
|
|
|
|
ruleList.Add(labelList[i]);
|
|
|
|
|
break;
|
|
|
|
@ -4557,7 +4593,7 @@ namespace Myshipping.Application
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(isSucc)
|
|
|
|
|
if (isSucc)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation($"标签对应到有效规则,{labelList[i].Name}");
|
|
|
|
|
}
|
|
|
|
@ -4601,7 +4637,7 @@ namespace Myshipping.Application
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
private bool CheckLabel(string name,string val,string checkVal, bool isMaster, LabelRegexOperEnum operEnum)
|
|
|
|
|
private bool CheckLabel(string name, string val, string checkVal, bool isMaster, LabelRegexOperEnum operEnum)
|
|
|
|
|
{
|
|
|
|
|
if (operEnum == LabelRegexOperEnum.equal)
|
|
|
|
|
{
|
|
|
|
@ -4619,7 +4655,7 @@ namespace Myshipping.Application
|
|
|
|
|
}
|
|
|
|
|
else if (operEnum == LabelRegexOperEnum.like)
|
|
|
|
|
{
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(val) && val.Contains(checkVal,StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(val) && val.Contains(checkVal, StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|