|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
using Furion;
|
|
|
|
|
using DocumentFormat.OpenXml.Spreadsheet;
|
|
|
|
|
using Furion;
|
|
|
|
|
using Furion.DependencyInjection;
|
|
|
|
|
using Furion.DistributedIDGenerator;
|
|
|
|
|
using Furion.DynamicApiController;
|
|
|
|
@ -935,7 +936,7 @@ namespace Myshipping.Application
|
|
|
|
|
throw Oops.Bah($"slotId={model.Id} 映射推送的舱位请求对应异常,原因:{ex.Message}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//await MeasureDiff(bcSrcDto, bcTargetDto, model.Id);
|
|
|
|
|
//await MeasureDiff(bcSrcDto, bcTargetDto, model.Id, model.CreatedUserId.Value);
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation($"slotId={model.Id} 开始处理重要提醒");
|
|
|
|
|
//执行差异重要提醒
|
|
|
|
@ -4748,9 +4749,10 @@ namespace Myshipping.Application
|
|
|
|
|
/// <param name="bcSrcDto">原舱位详情</param>
|
|
|
|
|
/// <param name="bcTargetDto">新舱位详情</param>
|
|
|
|
|
/// <param name="slotId">舱位ID</param>
|
|
|
|
|
/// <param name="slotCreateUser">舱位制单人</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[NonAction]
|
|
|
|
|
private async Task MeasureDiff(TaskBCInfoDto bcSrcDto, TaskBCInfoDto bcTargetDto, long slotId)
|
|
|
|
|
private async Task MeasureDiff(TaskBCInfoDto bcSrcDto, TaskBCInfoDto bcTargetDto, long slotId, long slotCreateUser)
|
|
|
|
|
{
|
|
|
|
|
var bookingOrderService = _namedBookingOrderServiceProvider.GetService<ITransient>(nameof(BookingOrderService));
|
|
|
|
|
|
|
|
|
@ -4758,222 +4760,369 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
bool isChange = false;
|
|
|
|
|
|
|
|
|
|
BookingSlotChangeRecord BeforeChangeRecord = new BookingSlotChangeRecord {
|
|
|
|
|
CHANGE_FLAG = "BEFORE",
|
|
|
|
|
SLOT_ID = slotId,
|
|
|
|
|
MBL_NO = bcSrcDto.MBLNo,
|
|
|
|
|
CHANGE_RANGE = "SINGLE",
|
|
|
|
|
VESSEL = bcSrcDto.Vessel,
|
|
|
|
|
VOYNO = bcSrcDto.VoyNo,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
#region 生成变更记录
|
|
|
|
|
BookingSlotChangeRecord BeforeChangeRecord = new BookingSlotChangeRecord
|
|
|
|
|
{
|
|
|
|
|
CHANGE_FLAG = "BEFORE",
|
|
|
|
|
SLOT_ID = slotId,
|
|
|
|
|
MBL_NO = bcSrcDto.MBLNo,
|
|
|
|
|
CHANGE_RANGE = "SINGLE",
|
|
|
|
|
CARRIERID = bcSrcDto.CarrierId,
|
|
|
|
|
CARRIER = bcSrcDto.Carrier,
|
|
|
|
|
VESSEL = bcSrcDto.Vessel,
|
|
|
|
|
VOYNO = bcSrcDto.VoyNo,
|
|
|
|
|
CONTRACT_NO = bcSrcDto.ContractNo,
|
|
|
|
|
PORTDISCHARGEID = bcSrcDto.PortDischargeId,
|
|
|
|
|
PORTDISCHARGE = bcSrcDto.PortDischarge,
|
|
|
|
|
PORTLOADID = bcSrcDto.PortloadId,
|
|
|
|
|
PORTLOAD = bcSrcDto.Portload,
|
|
|
|
|
PLACEDELIVERY = bcSrcDto.PlaceDelivery,
|
|
|
|
|
PLACERECEIPT = bcSrcDto.PlaceReceipt,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
BookingSlotChangeRecord CurrChangeRecord = new BookingSlotChangeRecord {
|
|
|
|
|
CHANGE_FLAG = "CURRENT",
|
|
|
|
|
SLOT_ID = slotId,
|
|
|
|
|
MBL_NO = bcSrcDto.MBLNo,
|
|
|
|
|
CHANGE_RANGE = "SINGLE",
|
|
|
|
|
VESSEL = bcSrcDto.Vessel,
|
|
|
|
|
VOYNO = bcSrcDto.VoyNo,
|
|
|
|
|
};
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(bcSrcDto.ETD))
|
|
|
|
|
{
|
|
|
|
|
DateTime mDate = DateTime.MinValue;
|
|
|
|
|
|
|
|
|
|
string srcWeek = bcSrcDto.WeekAt ?? "";
|
|
|
|
|
string targetWeek = bcTargetDto.WeekAt ?? "";
|
|
|
|
|
if (DateTime.TryParse(bcSrcDto.ETD, out mDate))
|
|
|
|
|
{
|
|
|
|
|
BeforeChangeRecord.ETD = mDate;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!srcWeek.Equals(targetWeek, StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
BeforeChangeRecord.WEEK_AT = srcWeek;
|
|
|
|
|
CurrChangeRecord.WEEK_AT = targetWeek;
|
|
|
|
|
BookingSlotChangeRecord CurrChangeRecord = new BookingSlotChangeRecord
|
|
|
|
|
{
|
|
|
|
|
CHANGE_FLAG = "CURRENT",
|
|
|
|
|
SLOT_ID = slotId,
|
|
|
|
|
MBL_NO = bcTargetDto.MBLNo,
|
|
|
|
|
CHANGE_RANGE = "SINGLE",
|
|
|
|
|
CARRIERID = bcSrcDto.CarrierId,
|
|
|
|
|
CARRIER = bcSrcDto.Carrier,
|
|
|
|
|
VESSEL = bcTargetDto.Vessel,
|
|
|
|
|
VOYNO = bcTargetDto.VoyNo,
|
|
|
|
|
CONTRACT_NO = bcTargetDto.ContractNo,
|
|
|
|
|
PORTDISCHARGEID = bcTargetDto.PortDischargeId,
|
|
|
|
|
PORTDISCHARGE = bcTargetDto.PortDischarge,
|
|
|
|
|
PORTLOADID = bcTargetDto.PortloadId,
|
|
|
|
|
PORTLOAD = bcTargetDto.Portload,
|
|
|
|
|
PLACEDELIVERY = bcTargetDto.PlaceDelivery,
|
|
|
|
|
PLACERECEIPT = bcTargetDto.PlaceReceipt,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
isChange = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrWhiteSpace(targetWeek))
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(bcTargetDto.ETD))
|
|
|
|
|
{
|
|
|
|
|
new EmailNoticeHelper().SendEmailNotice($"MBLNO={bcSrcDto.MBLNo} slotId={slotId} 没有提取到计费周", $"MBLNO={bcSrcDto.MBLNo} slotId={slotId} 没有提取到计费周 原计费周{srcWeek}", App.Configuration["EmailNoticeDefaultUser"].GetUserEmailList());
|
|
|
|
|
DateTime mDate = DateTime.MinValue;
|
|
|
|
|
|
|
|
|
|
if (DateTime.TryParse(bcTargetDto.ETD, out mDate))
|
|
|
|
|
{
|
|
|
|
|
CurrChangeRecord.ETD = mDate;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
string srcPriceDate = bcSrcDto.PriceCalculationDate.HasValue ? bcSrcDto.PriceCalculationDate.Value.ToString("yyyy-MM-dd") : "";
|
|
|
|
|
string targetPriceDate = bcTargetDto.PriceCalculationDate.HasValue ? bcTargetDto.PriceCalculationDate.Value.ToString("yyyy-MM-dd") : "";
|
|
|
|
|
string srcWeek = bcSrcDto.WeekAt ?? "";
|
|
|
|
|
string targetWeek = bcTargetDto.WeekAt ?? "";
|
|
|
|
|
|
|
|
|
|
//如果原始的没有解析计费日期,就不做提醒了
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(srcPriceDate) && !srcPriceDate.Equals(targetPriceDate, StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
BeforeChangeRecord.PRICE_CALCULATION_DATE = bcSrcDto.PriceCalculationDate;
|
|
|
|
|
CurrChangeRecord.PRICE_CALCULATION_DATE = bcTargetDto.PriceCalculationDate;
|
|
|
|
|
if (!srcWeek.Equals(targetWeek, StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
BeforeChangeRecord.WEEK_AT = srcWeek;
|
|
|
|
|
CurrChangeRecord.WEEK_AT = targetWeek;
|
|
|
|
|
|
|
|
|
|
isChange = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrWhiteSpace(targetPriceDate))
|
|
|
|
|
isChange = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
new EmailNoticeHelper().SendEmailNotice($"MBLNO={bcSrcDto.MBLNo} slotId={slotId} 没有提取到计费日期", $"MBLNO={bcSrcDto.MBLNo} slotId={slotId} 没有提取到计费日期 原计费日期{srcPriceDate}", App.Configuration["EmailNoticeDefaultUser"].GetUserEmailList());
|
|
|
|
|
if (string.IsNullOrWhiteSpace(targetWeek))
|
|
|
|
|
{
|
|
|
|
|
//new EmailNoticeHelper().SendEmailNotice($"MBLNO={bcSrcDto.MBLNo} slotId={slotId} 没有提取到计费周", $"MBLNO={bcSrcDto.MBLNo} slotId={slotId} 没有提取到计费周 原计费周{srcWeek}", App.Configuration["EmailNoticeDefaultUser"].GetUserEmailList());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
string srcVesselVoyno = $"{bcSrcDto.Vessel}/{bcSrcDto.VoyNo}";
|
|
|
|
|
string targetVesselVoyno = $"{bcTargetDto.Vessel}/{bcTargetDto.VoyNo}";
|
|
|
|
|
|
|
|
|
|
if (!srcVesselVoyno.Equals(targetVesselVoyno, StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
BeforeChangeRecord.VESSEL = bcSrcDto.Vessel;
|
|
|
|
|
BeforeChangeRecord.VOYNO = bcSrcDto.VoyNo;
|
|
|
|
|
|
|
|
|
|
CurrChangeRecord.VESSEL = bcTargetDto.Vessel;
|
|
|
|
|
CurrChangeRecord.VOYNO = bcTargetDto.VoyNo;
|
|
|
|
|
string srcPriceDate = bcSrcDto.PriceCalculationDate.HasValue ? bcSrcDto.PriceCalculationDate.Value.ToString("yyyy-MM-dd") : "";
|
|
|
|
|
string targetPriceDate = bcTargetDto.PriceCalculationDate.HasValue ? bcTargetDto.PriceCalculationDate.Value.ToString("yyyy-MM-dd") : "";
|
|
|
|
|
|
|
|
|
|
isChange = true;
|
|
|
|
|
}
|
|
|
|
|
//如果原始的没有解析计费日期,就不做提醒了
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(srcPriceDate) && !srcPriceDate.Equals(targetPriceDate, StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
BeforeChangeRecord.PRICE_CALCULATION_DATE = bcSrcDto.PriceCalculationDate;
|
|
|
|
|
CurrChangeRecord.PRICE_CALCULATION_DATE = bcTargetDto.PriceCalculationDate;
|
|
|
|
|
|
|
|
|
|
isChange = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrWhiteSpace(targetPriceDate))
|
|
|
|
|
{
|
|
|
|
|
new EmailNoticeHelper().SendEmailNotice($"MBLNO={bcSrcDto.MBLNo} slotId={slotId} 没有提取到计费日期", $"MBLNO={bcSrcDto.MBLNo} slotId={slotId} 没有提取到计费日期 原计费日期{srcPriceDate}", App.Configuration["EmailNoticeDefaultUser"].GetUserEmailList());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
string srcCarrierType = bcSrcDto.CarriageType ?? "";
|
|
|
|
|
string targetCarrierType = bcTargetDto.CarriageType ?? "";
|
|
|
|
|
string srcVesselVoyno = $"{bcSrcDto.Vessel}/{bcSrcDto.VoyNo}";
|
|
|
|
|
string targetVesselVoyno = $"{bcTargetDto.Vessel}/{bcTargetDto.VoyNo}";
|
|
|
|
|
|
|
|
|
|
//如果原来是直航现在变成了中转需要做重要提醒
|
|
|
|
|
if (!srcCarrierType.Equals(targetCarrierType, StringComparison.OrdinalIgnoreCase)
|
|
|
|
|
&& srcCarrierType.Equals("DIRECT_SHIP", StringComparison.OrdinalIgnoreCase)
|
|
|
|
|
&& targetCarrierType.Equals("TRANSFER_SHIP", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
BeforeChangeRecord.CARRIAGE_TYPE = "DIRECT_SHIP";
|
|
|
|
|
BeforeChangeRecord.CARRIAGE_TYPE_NAME = "直达";
|
|
|
|
|
if (!srcVesselVoyno.Equals(targetVesselVoyno, StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
BeforeChangeRecord.VESSEL = bcSrcDto.Vessel;
|
|
|
|
|
BeforeChangeRecord.VOYNO = bcSrcDto.VoyNo;
|
|
|
|
|
|
|
|
|
|
CurrChangeRecord.CARRIAGE_TYPE = "TRANSFER_SHIP";
|
|
|
|
|
CurrChangeRecord.CARRIAGE_TYPE_NAME = "中转";
|
|
|
|
|
CurrChangeRecord.VESSEL = bcTargetDto.Vessel;
|
|
|
|
|
CurrChangeRecord.VOYNO = bcTargetDto.VoyNo;
|
|
|
|
|
|
|
|
|
|
isChange = true;
|
|
|
|
|
}
|
|
|
|
|
isChange = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
string srcVGMCut = bcSrcDto.VGMSubmissionCutDate;
|
|
|
|
|
string targeVGMCut = bcTargetDto.VGMSubmissionCutDate;
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(srcVGMCut) && !string.IsNullOrWhiteSpace(targeVGMCut) && !srcVGMCut.Equals(targeVGMCut))
|
|
|
|
|
{
|
|
|
|
|
DateTime srcVGMCutDate = DateTime.Parse(srcVGMCut);
|
|
|
|
|
DateTime targeVGMCutDate = DateTime.Parse(targeVGMCut);
|
|
|
|
|
string srcCarrierType = bcSrcDto.CarriageType ?? "";
|
|
|
|
|
string targetCarrierType = bcTargetDto.CarriageType ?? "";
|
|
|
|
|
|
|
|
|
|
if (srcVGMCutDate > targeVGMCutDate)
|
|
|
|
|
//如果原来是直航现在变成了中转需要做重要提醒
|
|
|
|
|
if (!srcCarrierType.Equals(targetCarrierType, StringComparison.OrdinalIgnoreCase)
|
|
|
|
|
&& srcCarrierType.Equals("DIRECT_SHIP", StringComparison.OrdinalIgnoreCase)
|
|
|
|
|
&& targetCarrierType.Equals("TRANSFER_SHIP", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
BeforeChangeRecord.VGM_SUBMISSION_CUT_DATE = srcVGMCutDate;
|
|
|
|
|
CurrChangeRecord.VGM_SUBMISSION_CUT_DATE = targeVGMCutDate;
|
|
|
|
|
BeforeChangeRecord.CARRIAGE_TYPE = "DIRECT_SHIP";
|
|
|
|
|
BeforeChangeRecord.CARRIAGE_TYPE_NAME = "直达";
|
|
|
|
|
|
|
|
|
|
CurrChangeRecord.CARRIAGE_TYPE = "TRANSFER_SHIP";
|
|
|
|
|
CurrChangeRecord.CARRIAGE_TYPE_NAME = "中转";
|
|
|
|
|
|
|
|
|
|
isChange = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
string srcSICut = bcSrcDto.SICutDate;
|
|
|
|
|
string targeSICut = bcTargetDto.SICutDate;
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(srcSICut) && !string.IsNullOrWhiteSpace(targeSICut) && !srcSICut.Equals(targeSICut))
|
|
|
|
|
{
|
|
|
|
|
DateTime srcSICutDate = DateTime.Parse(srcSICut);
|
|
|
|
|
DateTime targeSICutDate = DateTime.Parse(targeSICut);
|
|
|
|
|
string srcVGMCut = bcSrcDto.VGMSubmissionCutDate;
|
|
|
|
|
string targeVGMCut = bcTargetDto.VGMSubmissionCutDate;
|
|
|
|
|
|
|
|
|
|
//如果新给的SI截止时间,需要推送通知
|
|
|
|
|
if (srcSICutDate > targeSICutDate)
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(srcVGMCut) && !string.IsNullOrWhiteSpace(targeVGMCut) && !srcVGMCut.Equals(targeVGMCut))
|
|
|
|
|
{
|
|
|
|
|
BeforeChangeRecord.SI_CUT_DATE = srcSICutDate;
|
|
|
|
|
CurrChangeRecord.SI_CUT_DATE = targeSICutDate;
|
|
|
|
|
DateTime srcVGMCutDate = DateTime.Parse(srcVGMCut);
|
|
|
|
|
DateTime targeVGMCutDate = DateTime.Parse(targeVGMCut);
|
|
|
|
|
|
|
|
|
|
isChange = true;
|
|
|
|
|
if (srcVGMCutDate > targeVGMCutDate)
|
|
|
|
|
{
|
|
|
|
|
BeforeChangeRecord.VGM_SUBMISSION_CUT_DATE = srcVGMCutDate;
|
|
|
|
|
CurrChangeRecord.VGM_SUBMISSION_CUT_DATE = targeVGMCutDate;
|
|
|
|
|
|
|
|
|
|
isChange = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isChange)
|
|
|
|
|
{
|
|
|
|
|
if (searchOrder.currOrder != null)
|
|
|
|
|
{
|
|
|
|
|
BeforeChangeRecord.BOOKING_ID = searchOrder.currOrder.Id;
|
|
|
|
|
BeforeChangeRecord.REAL_MBL_NO = searchOrder.currOrder.HBLNO;
|
|
|
|
|
BeforeChangeRecord.CONTRACT_NO = searchOrder.currOrder.CONTRACTNO;
|
|
|
|
|
BeforeChangeRecord.CARRIERID = searchOrder.currOrder.CARRIERID;
|
|
|
|
|
BeforeChangeRecord.CARRIER = searchOrder.currOrder.CARRIER;
|
|
|
|
|
BeforeChangeRecord.PLACERECEIPTID = searchOrder.currOrder.PLACERECEIPTID;
|
|
|
|
|
BeforeChangeRecord.PLACERECEIPT = searchOrder.currOrder.PLACERECEIPT;
|
|
|
|
|
BeforeChangeRecord.PORTLOADID = searchOrder.currOrder.PORTLOADID;
|
|
|
|
|
BeforeChangeRecord.PORTLOAD = searchOrder.currOrder.PORTLOAD;
|
|
|
|
|
BeforeChangeRecord.PLACEDELIVERYID = searchOrder.currOrder.PLACEDELIVERYID;
|
|
|
|
|
BeforeChangeRecord.PLACEDELIVERY = searchOrder.currOrder.PLACEDELIVERY;
|
|
|
|
|
BeforeChangeRecord.PORTDISCHARGEID = searchOrder.currOrder.PORTDISCHARGEID;
|
|
|
|
|
BeforeChangeRecord.PORTDISCHARGE = searchOrder.currOrder.PORTDISCHARGE;
|
|
|
|
|
BeforeChangeRecord.ETD = searchOrder.currOrder.ETD;
|
|
|
|
|
BeforeChangeRecord.ETA = searchOrder.currOrder.ETA;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CurrChangeRecord.BOOKING_ID = searchOrder.currOrder.Id;
|
|
|
|
|
CurrChangeRecord.REAL_MBL_NO = searchOrder.currOrder.HBLNO;
|
|
|
|
|
CurrChangeRecord.CONTRACT_NO = searchOrder.currOrder.CONTRACTNO;
|
|
|
|
|
CurrChangeRecord.CARRIERID = searchOrder.currOrder.CARRIERID;
|
|
|
|
|
CurrChangeRecord.CARRIER = searchOrder.currOrder.CARRIER;
|
|
|
|
|
CurrChangeRecord.PLACERECEIPTID = searchOrder.currOrder.PLACERECEIPTID;
|
|
|
|
|
CurrChangeRecord.PLACERECEIPT = searchOrder.currOrder.PLACERECEIPT;
|
|
|
|
|
CurrChangeRecord.PORTLOADID = searchOrder.currOrder.PORTLOADID;
|
|
|
|
|
CurrChangeRecord.PORTLOAD = searchOrder.currOrder.PORTLOAD;
|
|
|
|
|
CurrChangeRecord.PLACEDELIVERYID = searchOrder.currOrder.PLACEDELIVERYID;
|
|
|
|
|
CurrChangeRecord.PLACEDELIVERY = searchOrder.currOrder.PLACEDELIVERY;
|
|
|
|
|
CurrChangeRecord.PORTDISCHARGEID = searchOrder.currOrder.PORTDISCHARGEID;
|
|
|
|
|
CurrChangeRecord.PORTDISCHARGE = searchOrder.currOrder.PORTDISCHARGE;
|
|
|
|
|
CurrChangeRecord.ETD = searchOrder.currOrder.ETD;
|
|
|
|
|
CurrChangeRecord.ETA = searchOrder.currOrder.ETA;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await _repBookingSlotChangeRecord.InsertAsync(BeforeChangeRecord);
|
|
|
|
|
|
|
|
|
|
await _repBookingSlotChangeRecord.InsertAsync(CurrChangeRecord);
|
|
|
|
|
string srcSICut = bcSrcDto.SICutDate;
|
|
|
|
|
string targeSICut = bcTargetDto.SICutDate;
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(srcSICut) && !string.IsNullOrWhiteSpace(targeSICut) && !srcSICut.Equals(targeSICut))
|
|
|
|
|
{
|
|
|
|
|
DateTime srcSICutDate = DateTime.Parse(srcSICut);
|
|
|
|
|
DateTime targeSICutDate = DateTime.Parse(targeSICut);
|
|
|
|
|
|
|
|
|
|
//如果新给的SI截止时间,需要推送通知
|
|
|
|
|
if (srcSICutDate > targeSICutDate)
|
|
|
|
|
{
|
|
|
|
|
BeforeChangeRecord.SI_CUT_DATE = srcSICutDate;
|
|
|
|
|
CurrChangeRecord.SI_CUT_DATE = targeSICutDate;
|
|
|
|
|
|
|
|
|
|
isChange = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (searchOrder.otherOrderList != null && searchOrder.otherOrderList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
foreach (var od in searchOrder.otherOrderList)
|
|
|
|
|
{
|
|
|
|
|
var bookingInfo = _repBookingOrder.AsQueryable().Filter(null, true).First(x => x.Id == od.Id && x.IsDeleted == false
|
|
|
|
|
&& x.TenantId == UserManager.TENANT_ID);
|
|
|
|
|
|
|
|
|
|
var currBeforeChange = JSON.Deserialize<BookingSlotChangeRecord>(JSON.Serialize(BeforeChangeRecord));
|
|
|
|
|
|
|
|
|
|
currBeforeChange.BOOKING_ID = od.Id;
|
|
|
|
|
currBeforeChange.REAL_MBL_NO = od.HBLNO;
|
|
|
|
|
currBeforeChange.CONTRACT_NO = od.CONTRACTNO;
|
|
|
|
|
currBeforeChange.CARRIERID = bookingInfo.CARRIERID;
|
|
|
|
|
currBeforeChange.CARRIER = bookingInfo.CARRIER;
|
|
|
|
|
currBeforeChange.PLACERECEIPTID = bookingInfo.PLACERECEIPTID;
|
|
|
|
|
currBeforeChange.PLACERECEIPT = bookingInfo.PLACERECEIPT;
|
|
|
|
|
currBeforeChange.PORTLOADID = searchOrder.currOrder.PORTLOADID;
|
|
|
|
|
currBeforeChange.PORTLOAD = bookingInfo.PORTLOAD;
|
|
|
|
|
currBeforeChange.PLACEDELIVERYID = bookingInfo.PLACEDELIVERYID;
|
|
|
|
|
currBeforeChange.PLACEDELIVERY = bookingInfo.PLACEDELIVERY;
|
|
|
|
|
currBeforeChange.PORTDISCHARGEID = bookingInfo.PORTDISCHARGEID;
|
|
|
|
|
currBeforeChange.PORTDISCHARGE = bookingInfo.PORTDISCHARGE;
|
|
|
|
|
currBeforeChange.ETD = bookingInfo.ETD;
|
|
|
|
|
currBeforeChange.ETA = bookingInfo.ETA;
|
|
|
|
|
|
|
|
|
|
await _repBookingSlotChangeRecord.InsertAsync(currBeforeChange);
|
|
|
|
|
|
|
|
|
|
var currChange = JSON.Deserialize<BookingSlotChangeRecord>(JSON.Serialize(CurrChangeRecord));
|
|
|
|
|
|
|
|
|
|
currChange.BOOKING_ID = od.Id;
|
|
|
|
|
currChange.REAL_MBL_NO = od.HBLNO;
|
|
|
|
|
currChange.CONTRACT_NO = od.CONTRACTNO;
|
|
|
|
|
currChange.CARRIERID = bookingInfo.CARRIERID;
|
|
|
|
|
currChange.CARRIER = bookingInfo.CARRIER;
|
|
|
|
|
currChange.PLACERECEIPTID = bookingInfo.PLACERECEIPTID;
|
|
|
|
|
currChange.PLACERECEIPT = bookingInfo.PLACERECEIPT;
|
|
|
|
|
currChange.PORTLOADID = searchOrder.currOrder.PORTLOADID;
|
|
|
|
|
currChange.PORTLOAD = bookingInfo.PORTLOAD;
|
|
|
|
|
currChange.PLACEDELIVERYID = bookingInfo.PLACEDELIVERYID;
|
|
|
|
|
currChange.PLACEDELIVERY = bookingInfo.PLACEDELIVERY;
|
|
|
|
|
currChange.PORTDISCHARGEID = bookingInfo.PORTDISCHARGEID;
|
|
|
|
|
currChange.PORTDISCHARGE = bookingInfo.PORTDISCHARGE;
|
|
|
|
|
currChange.ETD = bookingInfo.ETD;
|
|
|
|
|
currChange.ETA = bookingInfo.ETA;
|
|
|
|
|
|
|
|
|
|
await _repBookingSlotChangeRecord.InsertAsync(currChange);
|
|
|
|
|
if (isChange)
|
|
|
|
|
{
|
|
|
|
|
bool isOrderNotExists = false;
|
|
|
|
|
|
|
|
|
|
if (searchOrder.currOrder != null)
|
|
|
|
|
{
|
|
|
|
|
BeforeChangeRecord.BOOKING_ID = searchOrder.currOrder.Id;
|
|
|
|
|
BeforeChangeRecord.REAL_MBL_NO = searchOrder.currOrder.HBLNO;
|
|
|
|
|
BeforeChangeRecord.CONTRACT_NO = searchOrder.currOrder.CONTRACTNO;
|
|
|
|
|
//BeforeChangeRecord.CARRIERID = searchOrder.currOrder.CARRIERID;
|
|
|
|
|
//BeforeChangeRecord.CARRIER = searchOrder.currOrder.CARRIER;
|
|
|
|
|
BeforeChangeRecord.PLACERECEIPTID = searchOrder.currOrder.PLACERECEIPTID;
|
|
|
|
|
BeforeChangeRecord.PLACERECEIPT = searchOrder.currOrder.PLACERECEIPT;
|
|
|
|
|
BeforeChangeRecord.PORTLOADID = searchOrder.currOrder.PORTLOADID;
|
|
|
|
|
BeforeChangeRecord.PORTLOAD = searchOrder.currOrder.PORTLOAD;
|
|
|
|
|
BeforeChangeRecord.PLACEDELIVERYID = searchOrder.currOrder.PLACEDELIVERYID;
|
|
|
|
|
BeforeChangeRecord.PLACEDELIVERY = searchOrder.currOrder.PLACEDELIVERY;
|
|
|
|
|
BeforeChangeRecord.PORTDISCHARGEID = searchOrder.currOrder.PORTDISCHARGEID;
|
|
|
|
|
BeforeChangeRecord.PORTDISCHARGE = searchOrder.currOrder.PORTDISCHARGE;
|
|
|
|
|
BeforeChangeRecord.ETD = searchOrder.currOrder.ETD;
|
|
|
|
|
BeforeChangeRecord.ETA = searchOrder.currOrder.ETA;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CurrChangeRecord.BOOKING_ID = searchOrder.currOrder.Id;
|
|
|
|
|
CurrChangeRecord.REAL_MBL_NO = searchOrder.currOrder.HBLNO;
|
|
|
|
|
CurrChangeRecord.CONTRACT_NO = searchOrder.currOrder.CONTRACTNO;
|
|
|
|
|
//CurrChangeRecord.CARRIERID = searchOrder.currOrder.CARRIERID;
|
|
|
|
|
//CurrChangeRecord.CARRIER = searchOrder.currOrder.CARRIER;
|
|
|
|
|
CurrChangeRecord.PLACERECEIPTID = searchOrder.currOrder.PLACERECEIPTID;
|
|
|
|
|
CurrChangeRecord.PLACERECEIPT = searchOrder.currOrder.PLACERECEIPT;
|
|
|
|
|
CurrChangeRecord.PORTLOADID = searchOrder.currOrder.PORTLOADID;
|
|
|
|
|
CurrChangeRecord.PORTLOAD = searchOrder.currOrder.PORTLOAD;
|
|
|
|
|
CurrChangeRecord.PLACEDELIVERYID = searchOrder.currOrder.PLACEDELIVERYID;
|
|
|
|
|
CurrChangeRecord.PLACEDELIVERY = searchOrder.currOrder.PLACEDELIVERY;
|
|
|
|
|
CurrChangeRecord.PORTDISCHARGEID = searchOrder.currOrder.PORTDISCHARGEID;
|
|
|
|
|
CurrChangeRecord.PORTDISCHARGE = searchOrder.currOrder.PORTDISCHARGE;
|
|
|
|
|
CurrChangeRecord.ETD = searchOrder.currOrder.ETD;
|
|
|
|
|
CurrChangeRecord.ETA = searchOrder.currOrder.ETA;
|
|
|
|
|
|
|
|
|
|
_repBookingSlotChangeRecord.InsertReturnEntity(BeforeChangeRecord);
|
|
|
|
|
|
|
|
|
|
_repBookingSlotChangeRecord.InsertReturnEntity(CurrChangeRecord);
|
|
|
|
|
|
|
|
|
|
Dictionary<string, long> userIdDict = new Dictionary<string, long>();
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(searchOrder.currOrder.OPID))
|
|
|
|
|
{
|
|
|
|
|
userIdDict.Add("操作OP", long.Parse(searchOrder.currOrder.OPID));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(searchOrder.currOrder.CUSTSERVICEID))
|
|
|
|
|
{
|
|
|
|
|
userIdDict.Add("客服OP", long.Parse(searchOrder.currOrder.CUSTSERVICEID));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var userIdList = userIdDict.Select(a => a.Value).Distinct().ToList();
|
|
|
|
|
|
|
|
|
|
var userList = _sysUserRepository.AsQueryable().Filter(null, true)
|
|
|
|
|
.Where(x => userIdList.Contains(x.Id) && x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToList();
|
|
|
|
|
|
|
|
|
|
foreach (var user in userList)
|
|
|
|
|
{
|
|
|
|
|
var currNotifyInfo = new BookingSlotChangeRecordNotify
|
|
|
|
|
{
|
|
|
|
|
P_ID = CurrChangeRecord.Id,
|
|
|
|
|
NotifyUserId = user.Id,
|
|
|
|
|
NotifyUserName = user.Name,
|
|
|
|
|
NotifyUserRole = userIdDict.FirstOrDefault(a => a.Value == user.Id).Key,
|
|
|
|
|
NotifyEmail = user.Email?.Trim(),
|
|
|
|
|
NotifyMobile = user.Phone?.Trim()
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
_repBookingSlotChangeRecordNotify.Insert(currNotifyInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
isOrderNotExists = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (searchOrder.otherOrderList != null && searchOrder.otherOrderList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
foreach (var od in searchOrder.otherOrderList)
|
|
|
|
|
{
|
|
|
|
|
var bookingInfo = _repBookingOrder.AsQueryable().Filter(null, true).First(x => x.Id == od.Id && x.IsDeleted == false
|
|
|
|
|
&& x.TenantId == UserManager.TENANT_ID);
|
|
|
|
|
|
|
|
|
|
var currBeforeChange = JSON.Deserialize<BookingSlotChangeRecord>(JSON.Serialize(BeforeChangeRecord));
|
|
|
|
|
|
|
|
|
|
currBeforeChange.BOOKING_ID = od.Id;
|
|
|
|
|
currBeforeChange.REAL_MBL_NO = od.HBLNO;
|
|
|
|
|
currBeforeChange.CONTRACT_NO = od.CONTRACTNO;
|
|
|
|
|
currBeforeChange.CARRIERID = bookingInfo.CARRIERID;
|
|
|
|
|
currBeforeChange.CARRIER = bookingInfo.CARRIER;
|
|
|
|
|
currBeforeChange.PLACERECEIPTID = bookingInfo.PLACERECEIPTID;
|
|
|
|
|
currBeforeChange.PLACERECEIPT = bookingInfo.PLACERECEIPT;
|
|
|
|
|
currBeforeChange.PORTLOADID = searchOrder.currOrder.PORTLOADID;
|
|
|
|
|
currBeforeChange.PORTLOAD = bookingInfo.PORTLOAD;
|
|
|
|
|
currBeforeChange.PLACEDELIVERYID = bookingInfo.PLACEDELIVERYID;
|
|
|
|
|
currBeforeChange.PLACEDELIVERY = bookingInfo.PLACEDELIVERY;
|
|
|
|
|
currBeforeChange.PORTDISCHARGEID = bookingInfo.PORTDISCHARGEID;
|
|
|
|
|
currBeforeChange.PORTDISCHARGE = bookingInfo.PORTDISCHARGE;
|
|
|
|
|
currBeforeChange.ETD = bookingInfo.ETD;
|
|
|
|
|
currBeforeChange.ETA = bookingInfo.ETA;
|
|
|
|
|
|
|
|
|
|
await _repBookingSlotChangeRecord.InsertAsync(currBeforeChange);
|
|
|
|
|
|
|
|
|
|
var currChange = JSON.Deserialize<BookingSlotChangeRecord>(JSON.Serialize(CurrChangeRecord));
|
|
|
|
|
|
|
|
|
|
currChange.BOOKING_ID = od.Id;
|
|
|
|
|
currChange.REAL_MBL_NO = od.HBLNO;
|
|
|
|
|
currChange.CONTRACT_NO = od.CONTRACTNO;
|
|
|
|
|
currChange.CARRIERID = bookingInfo.CARRIERID;
|
|
|
|
|
currChange.CARRIER = bookingInfo.CARRIER;
|
|
|
|
|
currChange.PLACERECEIPTID = bookingInfo.PLACERECEIPTID;
|
|
|
|
|
currChange.PLACERECEIPT = bookingInfo.PLACERECEIPT;
|
|
|
|
|
currChange.PORTLOADID = searchOrder.currOrder.PORTLOADID;
|
|
|
|
|
currChange.PORTLOAD = bookingInfo.PORTLOAD;
|
|
|
|
|
currChange.PLACEDELIVERYID = bookingInfo.PLACEDELIVERYID;
|
|
|
|
|
currChange.PLACEDELIVERY = bookingInfo.PLACEDELIVERY;
|
|
|
|
|
currChange.PORTDISCHARGEID = bookingInfo.PORTDISCHARGEID;
|
|
|
|
|
currChange.PORTDISCHARGE = bookingInfo.PORTDISCHARGE;
|
|
|
|
|
currChange.ETD = bookingInfo.ETD;
|
|
|
|
|
currChange.ETA = bookingInfo.ETA;
|
|
|
|
|
|
|
|
|
|
await _repBookingSlotChangeRecord.InsertAsync(currChange);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Dictionary<string, long> userIdDict = new Dictionary<string, long>();
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(bookingInfo.OPID))
|
|
|
|
|
{
|
|
|
|
|
userIdDict.Add("操作OP", long.Parse(bookingInfo.OPID));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(bookingInfo.CUSTSERVICEID))
|
|
|
|
|
{
|
|
|
|
|
userIdDict.Add("客服OP", long.Parse(bookingInfo.CUSTSERVICEID));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var userIdList = userIdDict.Select(a => a.Value).Distinct().ToList();
|
|
|
|
|
|
|
|
|
|
var userList = _sysUserRepository.AsQueryable().Filter(null, true)
|
|
|
|
|
.Where(x => userIdList.Contains(x.Id) && x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToList();
|
|
|
|
|
|
|
|
|
|
var beforeNotifyList = new List<BookingSlotChangeRecordNotify>();
|
|
|
|
|
|
|
|
|
|
foreach (var user in userList)
|
|
|
|
|
{
|
|
|
|
|
var currNotifyInfo = new BookingSlotChangeRecordNotify
|
|
|
|
|
{
|
|
|
|
|
P_ID = currChange.Id,
|
|
|
|
|
NotifyUserId = user.Id,
|
|
|
|
|
NotifyUserName = user.Name,
|
|
|
|
|
NotifyUserRole = userIdDict.FirstOrDefault(a => a.Value == user.Id).Key,
|
|
|
|
|
NotifyEmail = user.Email?.Trim(),
|
|
|
|
|
NotifyMobile = user.Phone?.Trim()
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
_repBookingSlotChangeRecordNotify.Insert(currNotifyInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
isOrderNotExists = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!isOrderNotExists)
|
|
|
|
|
{
|
|
|
|
|
await _repBookingSlotChangeRecord.InsertAsync(BeforeChangeRecord);
|
|
|
|
|
|
|
|
|
|
await _repBookingSlotChangeRecord.InsertAsync(CurrChangeRecord);
|
|
|
|
|
|
|
|
|
|
var user = _sysUserRepository.AsQueryable().Filter(null, true)
|
|
|
|
|
.First(x => slotCreateUser == x.Id && x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID);
|
|
|
|
|
|
|
|
|
|
var currNotifyInfo = new BookingSlotChangeRecordNotify
|
|
|
|
|
{
|
|
|
|
|
P_ID = CurrChangeRecord.Id,
|
|
|
|
|
NotifyUserId = user.Id,
|
|
|
|
|
NotifyUserName = user.Name,
|
|
|
|
|
NotifyUserRole = "舱位制单人",
|
|
|
|
|
NotifyEmail = user.Email?.Trim(),
|
|
|
|
|
NotifyMobile = user.Phone?.Trim()
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
_repBookingSlotChangeRecordNotify.Insert(currNotifyInfo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation($"MBLNO={bcSrcDto.MBLNo} 比对舱位差异,生成变更记录异常,原因:{ex.Message}");
|
|
|
|
|
|
|
|
|
|
new EmailNoticeHelper().SendEmailNotice($"MBLNO={bcSrcDto.MBLNo} slotId={slotId} 比对舱位差异,生成变更记录异常", $"MBLNO={bcSrcDto.MBLNo} slotId={slotId} 比对舱位差异,生成变更记录异常,原因:{ex.Message}",
|
|
|
|
|
App.Configuration["EmailNoticeDefaultUser"].GetUserEmailList());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|