|
|
@ -1655,8 +1655,8 @@ namespace Myshipping.Application
|
|
|
|
[SqlSugarUnitOfWork]
|
|
|
|
[SqlSugarUnitOfWork]
|
|
|
|
public async Task SaveSyncVesselDate(List<DjyVesselDto> dto)
|
|
|
|
public async Task SaveSyncVesselDate(List<DjyVesselDto> dto)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var infolist = _vesselinfo.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToList();
|
|
|
|
//var infolist = _vesselinfo.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToList();
|
|
|
|
var orderlist = await _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToListAsync();
|
|
|
|
//var orderlist = await _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToListAsync();
|
|
|
|
foreach (var item in dto)
|
|
|
|
foreach (var item in dto)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//var model = infolist.Where(x => x.Vessel == item.Vessel && x.Voyno == item.Voyno).FirstOrDefault();
|
|
|
|
//var model = infolist.Where(x => x.Vessel == item.Vessel && x.Voyno == item.Voyno).FirstOrDefault();
|
|
|
@ -1669,49 +1669,65 @@ namespace Myshipping.Application
|
|
|
|
// await _vesselinfo.AsUpdateable(model).IgnoreColumns().ExecuteCommandAsync();
|
|
|
|
// await _vesselinfo.AsUpdateable(model).IgnoreColumns().ExecuteCommandAsync();
|
|
|
|
//}
|
|
|
|
//}
|
|
|
|
//变更船期
|
|
|
|
//变更船期
|
|
|
|
await _vesselinfo.UpdateAsync(x => x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false &&
|
|
|
|
await _vesselinfo.UpdateAsync(x => x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false && x.Vessel == item.Vessel && x.Voyno == item.Voyno,
|
|
|
|
x.Vessel == item.Vessel && x.Voyno == item.Voyno, x => new DjyVesselInfo { ETA = item.ETA, YgtETD = item.ETD, ATD = item.ATD, UpdatedTime = DateTime.Now });
|
|
|
|
x => new DjyVesselInfo
|
|
|
|
var order = orderlist.Where(x => x.VESSEL == item.Vessel && x.VOYNO == item.Voyno).ToList();
|
|
|
|
{
|
|
|
|
|
|
|
|
ETA = item.ETA,
|
|
|
|
|
|
|
|
YgtETD = item.ETD,
|
|
|
|
|
|
|
|
ATD = item.ATD,
|
|
|
|
|
|
|
|
UpdatedTime = DateTime.Now
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var orderList = await _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID
|
|
|
|
|
|
|
|
&& x.IsDeleted == false
|
|
|
|
|
|
|
|
&& x.VESSEL == item.Vessel
|
|
|
|
|
|
|
|
&& x.VOYNO == item.Voyno).ToListAsync();
|
|
|
|
bool issend = false;
|
|
|
|
bool issend = false;
|
|
|
|
//批量变更业务数据
|
|
|
|
//批量变更业务数据
|
|
|
|
if (order != null)
|
|
|
|
if (orderList != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
foreach (var it in order)
|
|
|
|
foreach (var order in orderList)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var old = it;
|
|
|
|
bool isupdate = false;
|
|
|
|
bool flag = false;
|
|
|
|
Lazy<IUpdateable<BookingOrder>> update = new(() => _rep.Context.Updateable<BookingOrder>());
|
|
|
|
if (it.StartETA != item.ETA)
|
|
|
|
Lazy<BookingOrder> newOrder = new(() => order.Adapt<BookingOrder>());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (order.StartETA != item.ETA)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
flag = true;
|
|
|
|
isupdate = true;
|
|
|
|
it.StartETA = item.ETA;
|
|
|
|
newOrder.Value.StartETA = item.ETA;
|
|
|
|
|
|
|
|
update.Value.SetColumns(b => b.StartETA == item.ETA);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (it.YgtETD != item.ETD)
|
|
|
|
if (order.YgtETD != item.ETD)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
flag = true;
|
|
|
|
isupdate = true;
|
|
|
|
it.YgtETD = item.ETD;
|
|
|
|
newOrder.Value.YgtETD = item.ETD;
|
|
|
|
|
|
|
|
update.Value.SetColumns(b => b.YgtETD == item.ETD);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (it.ATD != item.ATD && it.ATD == null)
|
|
|
|
if (order.ATD != item.ATD && order.ATD == null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
flag = true;
|
|
|
|
isupdate = true;
|
|
|
|
it.ATD = item.ATD;
|
|
|
|
newOrder.Value.ATD = item.ATD;
|
|
|
|
|
|
|
|
update.Value.SetColumns(b => b.ATD == item.ATD);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (it.StartATA != item.ATA)
|
|
|
|
if (order.StartATA != item.ATA)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
flag = true;
|
|
|
|
isupdate = true;
|
|
|
|
it.StartATA = item.ATA;
|
|
|
|
newOrder.Value.StartATA = item.ATA;
|
|
|
|
|
|
|
|
update.Value.SetColumns(b => b.StartATA == item.ATA);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (flag)
|
|
|
|
if (isupdate)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
issend = true;
|
|
|
|
issend = true;
|
|
|
|
await _rep.AsUpdateable(it).IgnoreColumns().ExecuteCommandAsync();
|
|
|
|
await update.Value.Where(b => b.Id == order.Id).ExecuteCommandAsync();
|
|
|
|
await _bookingorderservice.SaveLog(it, old);
|
|
|
|
await _bookingorderservice.SaveLog(newOrder.Value, order);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (issend)
|
|
|
|
if (issend)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var ids = order.Where(x => x.ParentId == 0).Select(x => x.Id).ToArray();
|
|
|
|
var ids = orderList.Where(x => x.ParentId == 0).Select(x => x.Id).ToArray();
|
|
|
|
if (ids.Count() > 0)
|
|
|
|
if (ids.Count() > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//同步东胜
|
|
|
|
//同步东胜
|
|
|
|