修改VOLTA

master
jianghaiqing 4 days ago
parent 7dfb12b6ce
commit 37e83d8974

@ -96,6 +96,11 @@ namespace Myshipping.Application
/// 海丰扩展信息
/// </summary>
public SITCExtInfo SITCExt { get; set; }
/// <summary>
/// 是否VOLTA截单时不生成43行原自租户参数 VOLTA_SI_AVOID_43_LINE
/// </summary>
public bool isVoltaSIAvoid43Line { get; set; }
}
public class SITCExtInfo

@ -1033,17 +1033,21 @@ namespace Myshipping.Application.EDI.VOLTA
icount = icount + 1;
if (cargoid == "R")
//这里临时增加是否生成43行的配置
if (!(InttrEdi.isVoltaSIAvoid43Line && InttrEdi.filetype == "E"))
{
r.WriteLine("43::::::::::" + bill.REEFERF + ":C:" + bill.TEMPSET + ":" + bill.TEMPMIN + ":" + bill.TEMPMAX + ":::::'");
if (cargoid == "R")
{
r.WriteLine("43::::::::::" + bill.REEFERF + ":C:" + bill.TEMPSET + ":" + bill.TEMPMIN + ":" + bill.TEMPMAX + ":::::'");
icount = icount + 1;
}
else if (cargoid == "D")
{
r.WriteLine("43:" + bill.DCLASS + ":" + bill.DPAGE + ":" + bill.DUNNO + ":" + bill.DLABEL + "::::::::::::'");
icount = icount + 1;
}
else if (cargoid == "D")
{
r.WriteLine("43:" + bill.DCLASS + ":" + bill.DPAGE + ":" + bill.DUNNO + ":" + bill.DLABEL + "::::::::::::'");
icount = icount + 1;
icount = icount + 1;
}
}
Shipping = formatEdiStr("txt", bill.MARKS);

@ -34,7 +34,7 @@ namespace Myshipping.Application
public string CHANGE_FLAG { get; set; }
/// <summary>
/// 变更范围类型 SINGLE-单票变更,ALLSHIP-整船变更(例如截止时间变更)
/// 变更范围类型 SINGLE-单票变更,ALLSHIP-整船变更(例如截止时间变更),VGMMISS-VGM未提交
/// </summary>
[SugarColumn(ColumnName = "CHANGE_RANGE")]
[Description("变更类型标记")]
@ -68,6 +68,13 @@ namespace Myshipping.Application
[Description("箱号")]
public string CONTA_NO { get; set; }
/// <summary>
/// VGM最晚提交时间
/// </summary>
[SugarColumn(ColumnName = "VGM_SUBMISSION_DEADLINE")]
[Description("VGM最晚提交时间")]
public Nullable<DateTime> VGM_SUBMISSION_DEADLINE { get; set; }
/// <summary>
/// 订舱抬头
/// </summary>

@ -34,13 +34,27 @@ namespace Myshipping.Application
/// </summary>
[SugarColumn(ColumnName = "NotifyUserName")]
[Description("被通知人名称")]
public Nullable<long> NotifyUserName { get; set; }
public string NotifyUserName { get; set; }
/// <summary>
/// 被通知人身份 SALE-销售OPERATOR-操作OP
/// </summary>
[SugarColumn(ColumnName = "NotifyUserRole")]
[Description("被通知人身份")]
public Nullable<long> NotifyUserRole { get; set; }
public string NotifyUserRole { get; set; }
/// <summary>
/// 被通知人邮箱
/// </summary>
[SugarColumn(ColumnName = "NotifyEmail")]
[Description("被通知人邮箱")]
public string NotifyEmail { get; set; }
/// <summary>
/// 被通知人手机号
/// </summary>
[SugarColumn(ColumnName = "NotifyMobile")]
[Description("被通知人手机号")]
public string NotifyMobile { get; set; }
}
}

@ -8778,6 +8778,14 @@ namespace Myshipping.Application
ediModel.BSLIST.Add(primaryModel);
//读取租户参数
DjyTenantParamValueOutput voltaParamConfig = _djyTenantParamService.GetParaCodeWithValue(new[] { "VOLTA_SI_AVOID_43_LINE" }).GetAwaiter().GetResult().FirstOrDefault();
if (voltaParamConfig != null && voltaParamConfig.ParaValue.Equals("是", StringComparison.OrdinalIgnoreCase))
{
ediModel.isVoltaSIAvoid43Line = true;
}
var result = await InnerSendBookingOrClosingEDI(model, ediModel, ediRouteEnum);
_logger.LogInformation("批次={no} 生成EDI文件完成 结果={result}", batchNo, JSON.Serialize(result));

@ -62,5 +62,7 @@ namespace Myshipping.Application
/// 多行文本拆分记录ID(SITC-收、发、通拆分)
/// </summary>
public Nullable<long> multilineid { get; set; }
}
}

@ -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());
}
}
}

@ -43,7 +43,9 @@ namespace Myshipping.Application
.Map(dest => dest.Portload, src => src.PORTLOAD)
.Map(dest => dest.TransferPort1, src => src.TRANSFER_PORT_1)
.Map(dest => dest.TransferPort2, src => src.TRANSFER_PORT_2)
.Map(dest => dest.PriceCalculationDate, src => src.PRICE_CALCULATION_DATE);
.Map(dest => dest.PriceCalculationDate, src => src.PRICE_CALCULATION_DATE)
.Map(dest => dest.PortDischargeId, src => src.PORTDISCHARGEID)
.Map(dest => dest.PortloadId, src => src.PORTLOADID);
config.ForType<BookingSlotBaseApiSaveDto, TaskBCInfoDto>()
.Map(dest => dest.CarrierId, src => src.CARRIERID)
@ -75,7 +77,9 @@ namespace Myshipping.Application
.Map(dest => dest.Portload, src => src.PORTLOAD)
.Map(dest => dest.TransferPort1, src => src.TRANSFER_PORT_1)
.Map(dest => dest.TransferPort2, src => src.TRANSFER_PORT_2)
.Map(dest => dest.PriceCalculationDate, src => src.PRICE_CALCULATION_DATE);
.Map(dest => dest.PriceCalculationDate, src => src.PRICE_CALCULATION_DATE)
.Map(dest => dest.PortDischargeId, src => src.PORTDISCHARGEID)
.Map(dest => dest.PortloadId, src => src.PORTLOADID);
config.ForType<TaskBCInfoReadDto, TaskBCInfoDto>()
.Map(dest => dest.CarrierId, src => src.CarrierId)

@ -381,5 +381,15 @@ namespace Myshipping.Application
/// 计费日期
/// </summary>
public Nullable<DateTime> PriceCalculationDate { get; set; }
/// <summary>
/// 卸货港代码
/// </summary>
public string PortDischargeId { get; set; }
/// <summary>
/// 装货港代码
/// </summary>
public string PortloadId { get; set; }
}
}

@ -1,4 +1,6 @@
using Furion;
using DocumentFormat.OpenXml.Drawing.Charts;
using DocumentFormat.OpenXml.Wordprocessing;
using Furion;
using Furion.DependencyInjection;
using Furion.DynamicApiController;
using Furion.FriendlyException;
@ -36,6 +38,9 @@ namespace Myshipping.Application
private readonly SqlSugarRepository<BookingOrder> _bookingOrderRepository;
private readonly SqlSugarRepository<BookingCtn> _bookingOrderContaRepository;
private readonly SqlSugarRepository<SysUser> _sysUserRepository;
private readonly SqlSugarRepository<BookingSlotChangeRecord> _repBookingSlotChangeRecord;
private readonly SqlSugarRepository<BookingSlotChangeRecordNotify> _repBookingSlotChangeRecordNotify;
private readonly SqlSugarRepository<BookingSlotBase> _repBase;
public TaskManageVGMService(SqlSugarRepository<TaskVGMInfo> taskVGMInfoRepository,
SqlSugarRepository<TaskVGMCtnInfo> taskVGMCtnInfoRepository,
@ -43,6 +48,9 @@ namespace Myshipping.Application
SqlSugarRepository<BookingOrder> bookingOrderRepository,
SqlSugarRepository<BookingCtn> bookingOrderContaRepository,
SqlSugarRepository<SysUser> sysUserRepository,
SqlSugarRepository<BookingSlotChangeRecord> repBookingSlotChangeRecord,
SqlSugarRepository<BookingSlotChangeRecordNotify> repBookingSlotChangeRecordNotify,
SqlSugarRepository<BookingSlotBase> repBase,
ILogger<TaskManageVGMService> logger)
{
_taskVGMInfoRepository = taskVGMInfoRepository;
@ -52,6 +60,10 @@ namespace Myshipping.Application
_bookingOrderRepository = bookingOrderRepository;
_bookingOrderContaRepository = bookingOrderContaRepository;
_sysUserRepository = sysUserRepository;
_repBookingSlotChangeRecord = repBookingSlotChangeRecord;
_repBookingSlotChangeRecordNotify = repBookingSlotChangeRecordNotify;
_repBase = repBase;
}
#region 获取VGM成功回执详情
@ -258,6 +270,11 @@ namespace Myshipping.Application
return result;
}
//这里写入变更表
await SaveChange(vgmTaskList.FirstOrDefault());
return null;
//关联提单号
var bookList = _bookingOrderRepository.AsQueryable().Filter(null, true)
.Where(a => (blnoList.Contains(a.MBLNO) || a.SPLIT_OR_MERGE_FLAG != null && a.SPLIT_OR_MERGE_FLAG.Value == 1
@ -379,6 +396,161 @@ namespace Myshipping.Application
}
}
/// <summary>
/// 生成变更记录
/// </summary>
/// <param name="vgmTaskInfo">VGM未提交主信息</param>
/// <returns></returns>
private async Task SaveChange(TaskVGMInfo vgmTaskInfo)
{
/*
1
2
*/
try
{
//单票、拆票、或合票
var orderList = await _bookingOrderRepository.AsQueryable().Filter(null, true)
.Where(a => (vgmTaskInfo.MBL_NO == a.MBLNO || vgmTaskInfo.MBL_NO == a.CUSTNO || vgmTaskInfo.MBL_NO == a.HBLNO) && a.IsDeleted == false
&& (a.ParentId == null || a.ParentId == 0)
&& a.TenantId == UserManager.TENANT_ID).ToListAsync();
var vgmCtnList = _taskVGMCtnInfoRepository.AsQueryable().Filter(null, true).Where(a => vgmTaskInfo.PK_ID == a.P_ID).ToList();
foreach (var ctn in vgmCtnList)
{
if (orderList.Count > 0)
{
foreach (var order in orderList)
{
BookingSlotChangeRecord CurrChangeRecord = new BookingSlotChangeRecord
{
CHANGE_FLAG = "CURRENT",
MBL_NO = order.MBLNO,
BOOKING_ID = order.Id,
CHANGE_RANGE = "VGMMISS",
CARRIERID = order.CARRIERID,
CARRIER = order.CARRIER,
VESSEL = order.VESSEL,
VOYNO = order.VOYNO,
CONTRACT_NO = order.CONTRACTNO,
PORTDISCHARGEID = order.PORTDISCHARGEID,
PORTDISCHARGE = order.PORTDISCHARGE,
PORTLOADID = order.PORTLOADID,
PORTLOAD = order.PORTLOAD,
PLACEDELIVERY = order.PLACEDELIVERY,
PLACERECEIPT = order.PLACERECEIPT,
ETD = order.ETD,
CONTA_NO = ctn.CNTRNO,
VGM_SUBMISSION_DEADLINE = vgmTaskInfo.VGM_SUBMISSION_DEADLINE,
};
_repBookingSlotChangeRecord.InsertReturnEntity(CurrChangeRecord);
Dictionary<string, long> userIdDict = new Dictionary<string, long>();
if (!string.IsNullOrWhiteSpace(order.OPID))
{
userIdDict.Add("操作OP", long.Parse(order.OPID));
}
if (!string.IsNullOrWhiteSpace(order.CUSTSERVICEID))
{
userIdDict.Add("客服OP", long.Parse(order.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);
}
}
}
else
{
var slotInfo = _repBase.AsQueryable().Filter(null, true).First(a => vgmTaskInfo.MBL_NO == a.SLOT_BOOKING_NO && a.IsDeleted == false);
if(slotInfo != null)
{
BookingSlotChangeRecord CurrChangeRecord = new BookingSlotChangeRecord
{
CHANGE_FLAG = "CURRENT",
MBL_NO = slotInfo.SLOT_BOOKING_NO,
SLOT_ID = slotInfo.Id,
CHANGE_RANGE = "VGMMISS",
CARRIERID = slotInfo.CARRIERID,
CARRIER = slotInfo.CARRIER,
VESSEL = slotInfo.VESSEL,
VOYNO = slotInfo.VOYNO,
CONTRACT_NO = slotInfo.CONTRACT_NO,
PORTDISCHARGEID = slotInfo.PORTDISCHARGEID,
PORTDISCHARGE = slotInfo.PORTDISCHARGE,
PORTLOADID = slotInfo.PORTLOADID,
PORTLOAD = slotInfo.PORTLOAD,
PLACEDELIVERY = slotInfo.PLACEDELIVERY,
PLACERECEIPT = slotInfo.PLACERECEIPT,
ETD = slotInfo.ETD,
CONTA_NO = ctn.CNTRNO,
VGM_SUBMISSION_DEADLINE = vgmTaskInfo.VGM_SUBMISSION_DEADLINE,
};
_repBookingSlotChangeRecord.InsertReturnEntity(CurrChangeRecord);
Dictionary<string, long> userIdDict = new Dictionary<string, long>();
userIdDict.Add("舱位制单人", vgmTaskInfo.CreatedUserId);
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);
}
}
else
{
_logger.LogInformation($"MBLNO={vgmTaskInfo.MBL_NO} VGM Miss提醒没有匹配到舱位信息不做提醒");
}
}
}
}
catch (Exception ex)
{
_logger.LogInformation($"MBLNO={vgmTaskInfo.MBL_NO} VGM Miss提醒生成变更记录异常原因{ex.Message}");
new EmailNoticeHelper().SendEmailNotice($"MBLNO={vgmTaskInfo.MBL_NO} VGM Miss提醒生成变更记录异常", $"{vgmTaskInfo.MBL_NO} VGM Miss提醒生成变更记录异常原因{ex.Message}",
App.Configuration["EmailNoticeDefaultUser"].GetUserEmailList());
}
}
public async Task<TaskManageOrderResultDto> SyncBookingOrder()
{

Loading…
Cancel
Save