|
|
@ -144,8 +144,36 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
|
|
input.Adapt(model);
|
|
|
|
input.Adapt(model);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 1.判断新的舱位信息的7个库存统计维度是否发生变化
|
|
|
|
|
|
|
|
// 2.如果有变化,则需要更新旧的库存信息
|
|
|
|
|
|
|
|
bool isNeedUpdateOldStock = false;
|
|
|
|
|
|
|
|
if (oldObj.VESSEL != model.VESSEL
|
|
|
|
|
|
|
|
|| oldObj.VOYNO != model.VOYNO
|
|
|
|
|
|
|
|
|| oldObj.BOOKING_SLOT_TYPE != model.BOOKING_SLOT_TYPE
|
|
|
|
|
|
|
|
|| oldObj.CARRIERID != model.CARRIERID
|
|
|
|
|
|
|
|
|| oldObj.PLACERECEIPT != model.PLACERECEIPT
|
|
|
|
|
|
|
|
|| oldObj.PLACEDELIVERY != model.PLACEDELIVERY)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
isNeedUpdateOldStock = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
await _repBase.UpdateAsync(model);
|
|
|
|
await _repBase.UpdateAsync(model);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isNeedUpdateOldStock)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//更新库存
|
|
|
|
|
|
|
|
await _publisher.PublishAsync(new ChannelEventSource("BookingSlotStock:Update", new BookingSlotStockUpdateModel
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
BOOKING_SLOT_TYPE = oldObj.BOOKING_SLOT_TYPE,
|
|
|
|
|
|
|
|
CARRIERID = oldObj.CARRIERID,
|
|
|
|
|
|
|
|
CONTRACT_NO = oldObj.CONTRACT_NO,
|
|
|
|
|
|
|
|
VESSEL = oldObj.VESSEL,
|
|
|
|
|
|
|
|
VOYNO = oldObj.VOYNO,
|
|
|
|
|
|
|
|
PLACERECEIPT = oldObj.PLACERECEIPT,
|
|
|
|
|
|
|
|
PLACEDELIVERY = oldObj.PLACEDELIVERY,
|
|
|
|
|
|
|
|
TenantId = model.TenantId
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
}
|
|
|
|
await _repCtn.DeleteAsync(x => x.SLOT_ID == model.Id);
|
|
|
|
await _repCtn.DeleteAsync(x => x.SLOT_ID == model.Id);
|
|
|
|
foreach (var ctn in input.CtnList)
|
|
|
|
foreach (var ctn in input.CtnList)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -185,7 +213,8 @@ namespace Myshipping.Application
|
|
|
|
VESSEL = model.VESSEL,
|
|
|
|
VESSEL = model.VESSEL,
|
|
|
|
VOYNO = model.VOYNO,
|
|
|
|
VOYNO = model.VOYNO,
|
|
|
|
PLACERECEIPT = model.PLACERECEIPT,
|
|
|
|
PLACERECEIPT = model.PLACERECEIPT,
|
|
|
|
PLACEDELIVERY = model.PLACEDELIVERY
|
|
|
|
PLACEDELIVERY = model.PLACEDELIVERY,
|
|
|
|
|
|
|
|
TenantId = model.TenantId
|
|
|
|
}));
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
return await Detail(model.Id);
|
|
|
|
return await Detail(model.Id);
|
|
|
@ -323,6 +352,59 @@ namespace Myshipping.Application
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 解析收货地,得到装货港名称及代码
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(dto.DataObj.PLACERECEIPT))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var portEnName = dto.DataObj.PLACERECEIPT.Split(',')[0]?.Trim();
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(portEnName))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var portInfo = (await _cache.GetAllCodePortLoad()).FirstOrDefault(x => x.EnName.Equals(portEnName, StringComparison.OrdinalIgnoreCase));
|
|
|
|
|
|
|
|
if (portInfo != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
dto.DataObj.PORTLOAD = portInfo.EnName;
|
|
|
|
|
|
|
|
dto.DataObj.PORTLOADID = portInfo.EdiCode;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.LogInformation("通过收货地城市名称未匹配到港口信息,订舱编号:{SLOT_BOOKING_NO}", dto.DataObj.SLOT_BOOKING_NO);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.LogInformation("收货地分割后得到的城市名称为空,订舱编号:{SLOT_BOOKING_NO}", dto.DataObj.SLOT_BOOKING_NO);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.LogInformation("收货地为空,订舱编号:{SLOT_BOOKING_NO}", dto.DataObj.SLOT_BOOKING_NO);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// 解析交货地,得到为卸货港名称及代码
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(dto.DataObj.PLACEDELIVERY))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var portEnName = dto.DataObj.PLACEDELIVERY.Split(',')[0]?.Trim();
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(portEnName))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var portInfo = (await _cache.GetAllCodePort()).FirstOrDefault(x => x.EnName.Equals(portEnName, StringComparison.OrdinalIgnoreCase));
|
|
|
|
|
|
|
|
if (portInfo != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
dto.DataObj.PORTDISCHARGE = portInfo.EnName;
|
|
|
|
|
|
|
|
dto.DataObj.PORTDISCHARGEID = portInfo.EdiCode;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.LogInformation("通过交货地城市名称未匹配到港口信息,订舱编号:{SLOT_BOOKING_NO}", dto.DataObj.SLOT_BOOKING_NO);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.LogInformation("交货地分割后得到的城市名称为空,订舱编号:{SLOT_BOOKING_NO}", dto.DataObj.SLOT_BOOKING_NO);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.LogInformation("交货地为空,订舱编号:{SLOT_BOOKING_NO}", dto.DataObj.SLOT_BOOKING_NO);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BookingSlotBase model = null;
|
|
|
|
BookingSlotBase model = null;
|
|
|
|
if (dto.OpType == "add")
|
|
|
|
if (dto.OpType == "add")
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -431,7 +513,37 @@ namespace Myshipping.Application
|
|
|
|
var oldObj = model.Adapt<BookingSlotBaseApiSaveDto>();
|
|
|
|
var oldObj = model.Adapt<BookingSlotBaseApiSaveDto>();
|
|
|
|
|
|
|
|
|
|
|
|
dto.DataObj.Adapt(model);
|
|
|
|
dto.DataObj.Adapt(model);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 1.判断新的舱位信息的7个库存统计维度是否发生变化
|
|
|
|
|
|
|
|
// 2.如果有变化,则需要更新旧的库存信息
|
|
|
|
|
|
|
|
bool isNeedUpdateOldStock = false;
|
|
|
|
|
|
|
|
if (oldObj.VESSEL != model.VESSEL
|
|
|
|
|
|
|
|
|| oldObj.VOYNO != model.VOYNO
|
|
|
|
|
|
|
|
|| oldObj.BOOKING_SLOT_TYPE != model.BOOKING_SLOT_TYPE
|
|
|
|
|
|
|
|
|| oldObj.CARRIERID != model.CARRIERID
|
|
|
|
|
|
|
|
|| oldObj.PLACERECEIPT != model.PLACERECEIPT
|
|
|
|
|
|
|
|
|| oldObj.PLACEDELIVERY != model.PLACEDELIVERY)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
isNeedUpdateOldStock = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
await _repBase.UpdateAsync(model);
|
|
|
|
await _repBase.UpdateAsync(model);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isNeedUpdateOldStock)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//更新库存
|
|
|
|
|
|
|
|
await _publisher.PublishAsync(new ChannelEventSource("BookingSlotStock:Update", new BookingSlotStockUpdateModel
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
BOOKING_SLOT_TYPE = oldObj.BOOKING_SLOT_TYPE,
|
|
|
|
|
|
|
|
CARRIERID = oldObj.CARRIERID,
|
|
|
|
|
|
|
|
CONTRACT_NO = oldObj.CONTRACT_NO,
|
|
|
|
|
|
|
|
VESSEL = oldObj.VESSEL,
|
|
|
|
|
|
|
|
VOYNO = oldObj.VOYNO,
|
|
|
|
|
|
|
|
PLACERECEIPT = oldObj.PLACERECEIPT,
|
|
|
|
|
|
|
|
PLACEDELIVERY = oldObj.PLACEDELIVERY,
|
|
|
|
|
|
|
|
TenantId = model.TenantId
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
await _repCtn.DeleteAsync(x => x.SLOT_ID == model.Id);
|
|
|
|
await _repCtn.DeleteAsync(x => x.SLOT_ID == model.Id);
|
|
|
|
foreach (var ctn in dto.DataObj.CtnList)
|
|
|
|
foreach (var ctn in dto.DataObj.CtnList)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -550,7 +662,8 @@ namespace Myshipping.Application
|
|
|
|
VESSEL = model.VESSEL,
|
|
|
|
VESSEL = model.VESSEL,
|
|
|
|
VOYNO = model.VOYNO,
|
|
|
|
VOYNO = model.VOYNO,
|
|
|
|
PLACERECEIPT = model.PLACERECEIPT,
|
|
|
|
PLACERECEIPT = model.PLACERECEIPT,
|
|
|
|
PLACEDELIVERY = model.PLACEDELIVERY
|
|
|
|
PLACEDELIVERY = model.PLACEDELIVERY,
|
|
|
|
|
|
|
|
TenantId = model.TenantId
|
|
|
|
}));
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -935,7 +1048,8 @@ namespace Myshipping.Application
|
|
|
|
VESSEL = latestSlot.VESSEL,
|
|
|
|
VESSEL = latestSlot.VESSEL,
|
|
|
|
VOYNO = latestSlot.VOYNO,
|
|
|
|
VOYNO = latestSlot.VOYNO,
|
|
|
|
PLACERECEIPT = latestSlot.PLACERECEIPT,
|
|
|
|
PLACERECEIPT = latestSlot.PLACERECEIPT,
|
|
|
|
PLACEDELIVERY = latestSlot.PLACEDELIVERY
|
|
|
|
PLACEDELIVERY = latestSlot.PLACEDELIVERY,
|
|
|
|
|
|
|
|
TenantId = latestSlot.TenantId,
|
|
|
|
}));
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -994,6 +1108,35 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
|
|
var result = entities.Adapt<SqlSugarPagedList<BookingSlotBaseListOutput>>();
|
|
|
|
var result = entities.Adapt<SqlSugarPagedList<BookingSlotBaseListOutput>>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 查询舱位绑定的销售信息,赋值到舱位对象中
|
|
|
|
|
|
|
|
var slotIds = result.Items.Select(x => x.Id);
|
|
|
|
|
|
|
|
if (slotIds.Any())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
List<BookingSlotSaleInfoDto> allocationInfoList = await _repAllocation.AsQueryable()
|
|
|
|
|
|
|
|
.Where(x => slotIds.Contains(x.BOOKING_SLOT_ID))
|
|
|
|
|
|
|
|
.Select(x => new BookingSlotSaleInfoDto
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
BOOKING_SLOT_ID = x.BOOKING_SLOT_ID,
|
|
|
|
|
|
|
|
CUSTOMERNAME = x.CUSTOMERNAME,
|
|
|
|
|
|
|
|
CUSTSERVICE = x.CUSTSERVICE,
|
|
|
|
|
|
|
|
SALE = x.SALE,
|
|
|
|
|
|
|
|
SALE_TIME = x.SALE_TIME,
|
|
|
|
|
|
|
|
SHIPPER = x.SHIPPER,
|
|
|
|
|
|
|
|
GOODSNAME = x.GOODSNAME,
|
|
|
|
|
|
|
|
SELLING_PRICE = x.SELLING_PRICE
|
|
|
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var group = allocationInfoList.GroupBy(x => x.BOOKING_SLOT_ID);
|
|
|
|
|
|
|
|
foreach (var item in group)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var slot = result.Items.FirstOrDefault(x => x.Id == item.Key);
|
|
|
|
|
|
|
|
if (slot != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
slot.BookingSlotSaleInfoList = item.ToList();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return result.XnPagedResult();
|
|
|
|
return result.XnPagedResult();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
@ -1056,7 +1199,7 @@ namespace Myshipping.Application
|
|
|
|
TimeSpan ts = eDate.Subtract(bDate);
|
|
|
|
TimeSpan ts = eDate.Subtract(bDate);
|
|
|
|
var timeDiff = ts.TotalMilliseconds;
|
|
|
|
var timeDiff = ts.TotalMilliseconds;
|
|
|
|
|
|
|
|
|
|
|
|
if(compareResult != null)
|
|
|
|
if (compareResult != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_logger.LogInformation("批次={no} 请求完成,耗时:{timeDiff}ms. 结果{msg}", batchNo, timeDiff, compareResult.succ ? "成功" : "失败");
|
|
|
|
_logger.LogInformation("批次={no} 请求完成,耗时:{timeDiff}ms. 结果{msg}", batchNo, timeDiff, compareResult.succ ? "成功" : "失败");
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1208,7 +1351,7 @@ namespace Myshipping.Application
|
|
|
|
throw Oops.Oh($"获取舱位变更比对结果错误,比对内容不存在");
|
|
|
|
throw Oops.Oh($"获取舱位变更比对结果错误,比对内容不存在");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(!string.IsNullOrWhiteSpace(compareInfo.COMPARE_RLT))
|
|
|
|
if (!string.IsNullOrWhiteSpace(compareInfo.COMPARE_RLT))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return JSON.Deserialize<List<CompareResultDetailInfo>>(compareInfo.COMPARE_RLT);
|
|
|
|
return JSON.Deserialize<List<CompareResultDetailInfo>>(compareInfo.COMPARE_RLT);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1348,7 +1491,7 @@ namespace Myshipping.Application
|
|
|
|
CLOSEVGMDATE = bookingSlotBase.VGM_SUBMISSION_CUT_DATE,
|
|
|
|
CLOSEVGMDATE = bookingSlotBase.VGM_SUBMISSION_CUT_DATE,
|
|
|
|
CLOSINGDATE = bookingSlotBase.CY_CUT_DATE,
|
|
|
|
CLOSINGDATE = bookingSlotBase.CY_CUT_DATE,
|
|
|
|
CLOSEDOCDATE = bookingSlotBase.SI_CUT_DATE,
|
|
|
|
CLOSEDOCDATE = bookingSlotBase.SI_CUT_DATE,
|
|
|
|
CUSTSERVICEID = generateModel.CustServiceId.HasValue? generateModel.CustServiceId.Value.ToString():null,
|
|
|
|
CUSTSERVICEID = generateModel.CustServiceId.HasValue ? generateModel.CustServiceId.Value.ToString() : null,
|
|
|
|
CUSTSERVICE = generateModel.CustServiceName,
|
|
|
|
CUSTSERVICE = generateModel.CustServiceName,
|
|
|
|
ctnInputs = new List<BookingCtnDto>()
|
|
|
|
ctnInputs = new List<BookingCtnDto>()
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -1567,7 +1710,7 @@ namespace Myshipping.Application
|
|
|
|
{
|
|
|
|
{
|
|
|
|
BookingSlotWithOrderDto dto = null;
|
|
|
|
BookingSlotWithOrderDto dto = null;
|
|
|
|
|
|
|
|
|
|
|
|
var slotInfo = await _repBase.AsQueryable().Filter(null,true).FirstAsync(a => a.SLOT_BOOKING_NO == slotBookingNo && a.TenantId == tenantId && a.IsDeleted == false);
|
|
|
|
var slotInfo = await _repBase.AsQueryable().Filter(null, true).FirstAsync(a => a.SLOT_BOOKING_NO == slotBookingNo && a.TenantId == tenantId && a.IsDeleted == false);
|
|
|
|
|
|
|
|
|
|
|
|
if (slotInfo == null)
|
|
|
|
if (slotInfo == null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|