通过运踪更新船舶动态:ATD ETD MDGETA MDGATA

master
zhangxiaofeng 8 months ago
parent fd06f0ff77
commit 2726dedce6

@ -12135,6 +12135,8 @@ namespace Myshipping.Application
x.VOYNO = input.VOYNO;
x.ETD = input.ETD;
x.UpdatedTime = DateTime.Now;
x.UpdatedUserId = UserManager.UserId;
x.UpdatedUserName = UserManager.Name;
});
var changeNum = await _rep.Context.Updateable(list).UpdateColumns(x => new
@ -12147,6 +12149,8 @@ namespace Myshipping.Application
x.VOYNO,
x.ETD,
x.UpdatedTime,
x.UpdatedUserId,
x.UpdatedUserName
}).ExecuteCommandAsync();
foreach (var item in list)

@ -41,6 +41,7 @@ using Myshipping.Core.Service.Dict.Dto;
using Furion.JsonSerialization;
using Microsoft.AspNetCore.SignalR;
using Furion.EventBus;
using Myshipping.Core.Const;
namespace Myshipping.Application
{
@ -2512,109 +2513,158 @@ namespace Myshipping.Application
#endregion
#endregion
#region ATD MDGETA MDGATA
if (item.Status == "ATD")
{
//2023-8-31排查单号为177GZHZHQ5711V的数据原来录入的船已开船运踪港前不再查询而因订阅港后数据会继续回推数据所以导致ATD被改
//因此暂时取消运踪回推时写入ATD还是以船期表查询为准
////变更ATD
//var o = _rep.AsQueryable().Filter(null, true).Where(x => x.Id == all[0].BookingId && x.IsDeleted == false).First();
//var oldorder = o;
//var oldatd = o == null ? null : o.ATD;
//if (oldatd != item.OpTime && item.OpTime != null)
//{
// o.ATD = item.OpTime;
// await _rep.UpdateAsync(o);
// flag = true;
// await _bookingorderservice.SaveLog(o, oldorder);
//}
/*
* 2023824ATD
*
*
*/
////批量变更相同船期
//if (!string.IsNullOrEmpty(o.VESSEL) && !string.IsNullOrEmpty(o.VOYNO) && !string.IsNullOrEmpty(o.CARRIERID))
//{
// var order = await _rep.AsQueryable().Filter(null, true).Where(x => x.VOYNO == o.VOYNO && x.VESSEL == o.VESSEL && x.CARRIERID == o.CARRIERID && x.TenantId == o.TenantId && x.IsDeleted == false && x.Id != item.BookingId).ToListAsync();
// foreach (var it in order)
// {
// var _oldorder = it;
// var _oldatd = it.ATD;
// if (_oldatd != item.OpTime)
// {
// it.ATD = item.OpTime;
// await _rep.UpdateAsync(it);
// await _bookingorderservice.SaveLog(it, _oldorder);
// await _bookingorderservice.SendBookingOrder(new long[] { it.Id });
// }
// }
//}
}
if (item.Status == "MDGETA")
#region 船舶动态ATD ETD MDGETA MDGATA
if (item.Status == "ATD" || item.Status == "ETD" || item.Status == "MDGETA" || item.Status == "MDGATA")
{
var o = _rep.AsQueryable().Filter(null, true).Where(x => x.Id == all[0].BookingId && x.IsDeleted == false).First();
var oldorder = o.Adapt<BookingOrder>();
var oldeta = o == null ? null : o.ETA;
if (oldeta != item.OpTime && item.OpTime != null)
var enableStatusToSailingDate = _cache.GetAllTenantParam().Result
.FirstOrDefault(x => x.TenantId == UserManager.TENANT_ID
&& x.ParaCode == TenantParamCode.ENABLE_STATUS_TO_SAILING_DATE)?.ItemCode;
if (enableStatusToSailingDate == "YES")
{
o.ETA = item.OpTime;
await _rep.UpdateAsync(o);
flag = true;
await _bookingorderservice.SaveLog(o, oldorder, "运踪回推");
if (item.Status == "ATD")
{
//2023-8-31排查单号为177GZHZHQ5711V的数据原来录入的船已开船运踪港前不再查询而因订阅港后数据会继续回推数据所以导致ATD被改
//因此暂时取消运踪回推时写入ATD还是以船期表查询为准
}
//if (!string.IsNullOrEmpty(o.VESSEL) && !string.IsNullOrEmpty(o.VOYNO) && !string.IsNullOrEmpty(o.CARRIERID))
//{
// var order = await _rep.AsQueryable().Filter(null, true).Where(x => x.VOYNO == o.VOYNO && x.VESSEL == o.VESSEL && x.CARRIERID == o.CARRIERID && x.TenantId == o.TenantId && x.IsDeleted == false && x.Id != item.BookingId).ToListAsync();
// foreach (var it in order)
// {
// var _oldorder = it;
// var _oldatd = it.ETA;
// if (_oldatd != item.OpTime)
// {
// it.ETA = item.OpTime;
// await _rep.UpdateAsync(it);
// await _bookingorderservice.SendBookingOrder(new long[] { it.Id });
// await _bookingorderservice.SaveLog(it, _oldorder);
// }
// }
//}
}
if (item.Status == "MDGATA")
{
var o = _rep.AsQueryable().Filter(null, true).Where(x => x.Id == all[0].BookingId && x.IsDeleted == false).First();
var oldorder = o.Adapt<BookingOrder>();
var oldata = o == null ? null : o.ATA;
if (oldata != item.OpTime && item.OpTime != null)
{
o.ATA = item.OpTime;
await _rep.UpdateAsync(o);
// 2024-4-8 因为港捷需要,重新开启,并通过租户参数判断
//变更ATD
var oldOrder = await _rep.AsQueryable().Filter(null, true).Where(x => x.Id == item.BookingId && x.IsDeleted == false).FirstAsync();
if (oldOrder != null && item.OpTime != null && oldOrder.ATD != item.OpTime)
{
var newOrder = oldOrder.Adapt<BookingOrder>();
newOrder.ATD = item.OpTime;
newOrder.UpdatedUserId = UserManager.UserId;
newOrder.UpdatedUserName = UserManager.Name;
await _rep.AsUpdateable(newOrder).UpdateColumns(x => new
{
x.ATD,
x.UpdatedTime,
x.UpdatedUserId,
x.UpdatedUserName
}).ExecuteCommandAsync();
flag = true;
await _bookingorderservice.SaveLog(newOrder, oldOrder, "运踪更新船期");
}
flag = true;
await _bookingorderservice.SaveLog(o, oldorder, "运踪回推");
/*
* 2023824ATD
*
*
*/
////批量变更相同船期
//if (!string.IsNullOrEmpty(o.VESSEL) && !string.IsNullOrEmpty(o.VOYNO) && !string.IsNullOrEmpty(o.CARRIERID))
//{
// var order = await _rep.AsQueryable().Filter(null, true).Where(x => x.VOYNO == o.VOYNO && x.VESSEL == o.VESSEL && x.CARRIERID == o.CARRIERID && x.TenantId == o.TenantId && x.IsDeleted == false && x.Id != item.BookingId).ToListAsync();
// foreach (var it in order)
// {
// var _oldorder = it;
// var _oldatd = it.ATD;
// if (_oldatd != item.OpTime)
// {
// it.ATD = item.OpTime;
// await _rep.UpdateAsync(it);
// await _bookingorderservice.SaveLog(it, _oldorder);
// await _bookingorderservice.SendBookingOrder(new long[] { it.Id });
// }
// }
//}
}
else if (item.Status == "ETD")
{
var oldOrder = await _rep.AsQueryable().Filter(null, true).Where(x => x.Id == item.BookingId && x.IsDeleted == false).FirstAsync();
if (oldOrder != null && item.OpTime != null && oldOrder.ETD != item.OpTime)
{
var newOrder = oldOrder.Adapt<BookingOrder>();
newOrder.ETD = item.OpTime;
newOrder.UpdatedUserId = UserManager.UserId;
newOrder.UpdatedUserName = UserManager.Name;
await _rep.AsUpdateable(newOrder).UpdateColumns(x => new
{
x.ETD,
x.UpdatedTime,
x.UpdatedUserId,
x.UpdatedUserName
}).ExecuteCommandAsync();
flag = true;
await _bookingorderservice.SaveLog(newOrder, oldOrder, "运踪更新船期");
}
}
else if (item.Status == "MDGETA")
{
var oldOrder = await _rep.AsQueryable().Filter(null, true).Where(x => x.Id == item.BookingId && x.IsDeleted == false).FirstAsync();
if (oldOrder != null && item.OpTime != null && oldOrder.ETA != item.OpTime)
{
var newOrder = oldOrder.Adapt<BookingOrder>();
newOrder.ETA = item.OpTime;
newOrder.UpdatedUserId = UserManager.UserId;
newOrder.UpdatedUserName = UserManager.Name;
await _rep.AsUpdateable(newOrder).UpdateColumns(x => new
{
x.ETA,
x.UpdatedTime,
x.UpdatedUserId,
x.UpdatedUserName
}).ExecuteCommandAsync();
flag = true;
await _bookingorderservice.SaveLog(newOrder, oldOrder, "运踪更新船期");
}
//if (!string.IsNullOrEmpty(o.VESSEL) && !string.IsNullOrEmpty(o.VOYNO) && !string.IsNullOrEmpty(o.CARRIERID))
//{
// var order = await _rep.AsQueryable().Filter(null, true).Where(x => x.VOYNO == o.VOYNO && x.VESSEL == o.VESSEL && x.CARRIERID == o.CARRIERID && x.TenantId == o.TenantId && x.IsDeleted == false && x.Id != item.BookingId).ToListAsync();
// foreach (var it in order)
// {
// var _oldorder = it;
// var _oldatd = it.ETA;
// if (_oldatd != item.OpTime)
// {
// it.ETA = item.OpTime;
// await _rep.UpdateAsync(it);
// await _bookingorderservice.SendBookingOrder(new long[] { it.Id });
// await _bookingorderservice.SaveLog(it, _oldorder);
// }
// }
//}
}
else if (item.Status == "MDGATA")
{
var oldOrder = await _rep.AsQueryable().Filter(null, true).Where(x => x.Id == item.BookingId && x.IsDeleted == false).FirstAsync();
if (oldOrder != null && item.OpTime != null && oldOrder.ATA != item.OpTime)
{
var newOrder = oldOrder.Adapt<BookingOrder>();
newOrder.ATA = item.OpTime;
newOrder.UpdatedUserId = UserManager.UserId;
newOrder.UpdatedUserName = UserManager.Name;
await _rep.AsUpdateable(newOrder).UpdateColumns(x => new
{
x.ATA,
x.UpdatedTime,
x.UpdatedUserId,
x.UpdatedUserName
}).ExecuteCommandAsync();
flag = true;
await _bookingorderservice.SaveLog(newOrder, oldOrder, "运踪更新船期");
}
//if (!string.IsNullOrEmpty(o.VESSEL) && !string.IsNullOrEmpty(o.VOYNO) && !string.IsNullOrEmpty(o.CARRIERID))
//{
// var order = await _rep.AsQueryable().Filter(null, true).Where(x => x.VOYNO == o.VOYNO && x.VESSEL == o.VESSEL && x.CARRIERID == o.CARRIERID && x.TenantId == o.TenantId && x.IsDeleted == false && x.Id != item.BookingId).ToListAsync();
// foreach (var it in order)
// {
// var _oldorder = it;
// var _oldatd = it.ATA;
// if (_oldatd != item.OpTime)
// {
// it.ATA = item.OpTime;
// await _rep.UpdateAsync(it);
// await _bookingorderservice.SendBookingOrder(new long[] { it.Id });
// await _bookingorderservice.SaveLog(it, _oldorder);
// }
// }
//}
}
}
//if (!string.IsNullOrEmpty(o.VESSEL) && !string.IsNullOrEmpty(o.VOYNO) && !string.IsNullOrEmpty(o.CARRIERID))
//{
// var order = await _rep.AsQueryable().Filter(null, true).Where(x => x.VOYNO == o.VOYNO && x.VESSEL == o.VESSEL && x.CARRIERID == o.CARRIERID && x.TenantId == o.TenantId && x.IsDeleted == false && x.Id != item.BookingId).ToListAsync();
// foreach (var it in order)
// {
// var _oldorder = it;
// var _oldatd = it.ATA;
// if (_oldatd != item.OpTime)
// {
// it.ATA = item.OpTime;
// await _rep.UpdateAsync(it);
// await _bookingorderservice.SendBookingOrder(new long[] { it.Id });
// await _bookingorderservice.SaveLog(it, _oldorder);
// }
// }
//}
}
#endregion

@ -19,5 +19,10 @@
/// 是否必须使用船期表录入船期参数
/// </summary>
public const string VESSEL_FROM_CONFIG_ONLY = "VESSEL_FROM_CONFIG_ONLY";
/// <summary>
/// 通过运踪更新船舶动态开关
/// </summary>
public const string ENABLE_STATUS_TO_SAILING_DATE = "EnableStatusToSailingDate";
}
}

@ -867,6 +867,11 @@
是否必须使用船期表录入船期参数
</summary>
</member>
<member name="F:Myshipping.Core.Const.TenantParamCode.ENABLE_STATUS_TO_SAILING_DATE">
<summary>
通过运踪更新船舶动态开关
</summary>
</member>
<member name="P:Myshipping.Core.Entity.CodeCarrier.Code">
<summary>
代码
@ -4470,11 +4475,6 @@
只同步BC+文件相关字段
</summary>
</member>
<member name="F:Myshipping.Core.BookingOrderSyncTypeEnum.FILE">
<summary>
只同步文件相关字段
</summary>
</member>
<member name="T:Myshipping.Core.CacheType">
<summary>
缓存类型

Loading…
Cancel
Save