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