|
|
|
@ -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);
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* 2023年8月24日改,取消运踪回推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.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, "运踪回推");
|
|
|
|
|
/*
|
|
|
|
|
* 2023年8月24日改,取消运踪回推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.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
|
|
|
|
|
|
|
|
|
|