|
|
|
@ -264,7 +264,7 @@ namespace Myshipping.Application
|
|
|
|
|
result.msg = "成功";
|
|
|
|
|
result.ext = id;
|
|
|
|
|
}
|
|
|
|
|
catch(Exception ex)
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
result.succ = false;
|
|
|
|
|
result.msg = $"失败,原因:{ex.Message}";
|
|
|
|
@ -297,7 +297,7 @@ namespace Myshipping.Application
|
|
|
|
|
|| t.EnName.Equals(dto.DataObj.CARRIERID, StringComparison.OrdinalIgnoreCase)
|
|
|
|
|
|| t.CnName.Equals(dto.DataObj.CARRIERID, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
|
|
|
|
|
|
|
|
|
|
if(carrierInfo != null)
|
|
|
|
|
if (carrierInfo != null)
|
|
|
|
|
{
|
|
|
|
|
dto.DataObj.CARRIER = carrierInfo.CnName?.Trim();
|
|
|
|
|
}
|
|
|
|
@ -311,7 +311,7 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
dto.DataObj.CtnList.ForEach(t =>
|
|
|
|
|
{
|
|
|
|
|
if(!string.IsNullOrWhiteSpace(t.CTNALL) && string.IsNullOrWhiteSpace(t.CTNCODE))
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(t.CTNALL) && string.IsNullOrWhiteSpace(t.CTNCODE))
|
|
|
|
|
{
|
|
|
|
|
var ctnCode = ctnCodeList.FirstOrDefault(a => !string.IsNullOrWhiteSpace(a.Name) &&
|
|
|
|
|
a.Name.Equals(t.CTNALL, StringComparison.OrdinalIgnoreCase));
|
|
|
|
@ -399,13 +399,17 @@ namespace Myshipping.Application
|
|
|
|
|
.Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID
|
|
|
|
|
&& x.SLOT_ID == model.Id).ToList();
|
|
|
|
|
|
|
|
|
|
if(ctnList != null)
|
|
|
|
|
if (ctnList != null)
|
|
|
|
|
{
|
|
|
|
|
bcSrcDto.CtnList = ctnList.GroupBy(x => x.CTNALL)
|
|
|
|
|
.Select(x =>
|
|
|
|
|
{
|
|
|
|
|
return new TaskBCCTNInfoDto { CtnALL = x.Key, CTNNUM = x.ToList()
|
|
|
|
|
.Sum(a => a.CTNNUM) };
|
|
|
|
|
return new TaskBCCTNInfoDto
|
|
|
|
|
{
|
|
|
|
|
CtnALL = x.Key,
|
|
|
|
|
CTNNUM = x.ToList()
|
|
|
|
|
.Sum(a => a.CTNNUM)
|
|
|
|
|
};
|
|
|
|
|
}).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -473,7 +477,7 @@ namespace Myshipping.Application
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//一般更新数据指的是Booking Amendment,需要与舱位进行数据比对
|
|
|
|
|
await PushCompareBCInfo(bcSrcDto, bcTargetDto,id, dto.BatchNo);
|
|
|
|
|
await PushCompareBCInfo(bcSrcDto, bcTargetDto, id, dto.BatchNo);
|
|
|
|
|
}
|
|
|
|
|
else if (dto.OpType == "del")
|
|
|
|
|
{
|
|
|
|
@ -500,7 +504,40 @@ namespace Myshipping.Application
|
|
|
|
|
}
|
|
|
|
|
else if (dto.OpType == "cancellation")
|
|
|
|
|
{
|
|
|
|
|
// 更新标志
|
|
|
|
|
var slotNO = dto.DataObj.SLOT_BOOKING_NO;
|
|
|
|
|
model = await _repBase.AsQueryable().Filter(null, true).FirstAsync(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID && x.SLOT_BOOKING_NO == slotNO);
|
|
|
|
|
if (model == null)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah($"未找到订舱编号为 {slotNO} 的数据");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
id = model.Id;
|
|
|
|
|
model.IS_CANCELLATION = true;
|
|
|
|
|
model.CANCELLATION_DATE = DateTime.Now;
|
|
|
|
|
await _repBase.UpdateAsync(model);
|
|
|
|
|
|
|
|
|
|
// 删除该舱位相关的订舱关联关系
|
|
|
|
|
var slotList = await _repAllocation.AsQueryable().Where(a => a.BOOKING_SLOT_ID == id).ToListAsync();
|
|
|
|
|
var slotIdList = slotList.Select(s => s.Id);
|
|
|
|
|
|
|
|
|
|
await _repAllocation.Context.Updateable<BookingSlotAllocation>()
|
|
|
|
|
.SetColumns(a => a.IsDeleted == true)
|
|
|
|
|
.SetColumns(a => a.UpdatedTime == DateTime.Now)
|
|
|
|
|
.SetColumns(a => a.UpdatedUserId == UserManager.UserId)
|
|
|
|
|
.SetColumns(a => a.UpdatedUserName == UserManager.Name)
|
|
|
|
|
.Where(a => slotIdList.Contains(a.Id))
|
|
|
|
|
.ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
await _repAllocationCtn.Context.Updateable<BookingSlotAllocationCtn>()
|
|
|
|
|
.SetColumns(a => a.IsDeleted == true)
|
|
|
|
|
.SetColumns(a => a.UpdatedTime == DateTime.Now)
|
|
|
|
|
.SetColumns(a => a.UpdatedUserId == UserManager.UserId)
|
|
|
|
|
.SetColumns(a => a.UpdatedUserName == UserManager.Name)
|
|
|
|
|
.Where(a => slotIdList.Contains(a.SLOT_ALLOC_ID))
|
|
|
|
|
.ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
await InsLog("Cancellation", model.Id, "取消舱位");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//更新库存
|
|
|
|
@ -703,6 +740,7 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
// 1. 【舱位基础表】与【箱子表】做关联,并根据【舱位主键】、【箱型】做分组,统计出【总的箱量】,作为queryable1
|
|
|
|
|
var queryable1 = _repBase.Context.Queryable<BookingSlotBase, BookingSlotCtn>((bas, ctn) => bas.Id == ctn.SLOT_ID)
|
|
|
|
|
.Where(bas => bas.IS_CANCELLATION == false)
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(slotInput.PORTLOAD), bas => bas.PORTLOAD.Contains(slotInput.PORTLOAD))
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(slotInput.PORTDISCHARGE), bas => bas.PORTLOAD.Contains(slotInput.PORTLOAD))
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(slotInput.VESSEL), bas => bas.VESSEL.Contains(slotInput.VESSEL))
|
|
|
|
@ -1004,7 +1042,7 @@ namespace Myshipping.Application
|
|
|
|
|
/// <param name="slotId">舱位主键</param>
|
|
|
|
|
/// <param name="reqBatchNo">请求批次号用来区分对应的哪个批次任务</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
private async Task PushCompareBCInfo(TaskBCInfoDto bcSrcDto, TaskBCInfoDto bcTargetDto,long slotId,string reqBatchNo)
|
|
|
|
|
private async Task PushCompareBCInfo(TaskBCInfoDto bcSrcDto, TaskBCInfoDto bcTargetDto, long slotId, string reqBatchNo)
|
|
|
|
|
{
|
|
|
|
|
string batchNo = IDGen.NextID().ToString();
|
|
|
|
|
|
|
|
|
@ -1027,7 +1065,7 @@ namespace Myshipping.Application
|
|
|
|
|
{
|
|
|
|
|
SLOT_ID = slotId,
|
|
|
|
|
COMPARE_BATCHNO = reqBatchNo,
|
|
|
|
|
COMPARE_DIFF_NUM = compareResult.extra.IsExistsDiff? compareResult.extra.ShowDetailList.Count : 0,
|
|
|
|
|
COMPARE_DIFF_NUM = compareResult.extra.IsExistsDiff ? compareResult.extra.ShowDetailList.Count : 0,
|
|
|
|
|
CreatedTime = nowDate,
|
|
|
|
|
UpdatedTime = nowDate,
|
|
|
|
|
CreatedUserId = UserManager.UserId,
|
|
|
|
@ -1154,7 +1192,7 @@ namespace Myshipping.Application
|
|
|
|
|
result.succ = true;
|
|
|
|
|
result.msg = "导入成功";
|
|
|
|
|
}
|
|
|
|
|
catch(Exception ex)
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogError($"导入舱位异常,原因:{ex.Message}");
|
|
|
|
|
|
|
|
|
|