optimize
wet 2 years ago
parent ff766a0052
commit 86fa3f3927

@ -1679,14 +1679,16 @@ namespace Myshipping.Application
await _vesselinfo.AsUpdateable(model).IgnoreColumns().ExecuteCommandAsync();
}
var order = await _rep.AsQueryable().Filter(null, true).Where(x => x.VESSEL == item.Vessel && x.VOYNO == item.Voyno && x.TenantId == UserManager.TENANT_ID&&x.IsDeleted==false).ToListAsync();
var order = await _rep.AsQueryable().Filter(null, true).Where(x => x.VESSEL == item.Vessel && x.VOYNO == item.Voyno && x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToListAsync();
bool issend = false;
if (order != null)
{
foreach (var it in order)
{
bool flag = false;
if (it.StartETA != item.ETA)
{
flag = true;
////添加booking日志
var bid = await _bookinglog.InsertReturnSnowflakeIdAsync(new BookingLog
{
@ -1708,6 +1710,7 @@ namespace Myshipping.Application
}
if (it.YgtETD != item.ETD)
{
flag = true;
////添加booking日志
var bid = await _bookinglog.InsertReturnSnowflakeIdAsync(new BookingLog
{
@ -1729,6 +1732,7 @@ namespace Myshipping.Application
}
if (it.ATD != item.ATD)
{
flag = true;
////添加booking日志
var bid = await _bookinglog.InsertReturnSnowflakeIdAsync(new BookingLog
{
@ -1750,6 +1754,7 @@ namespace Myshipping.Application
}
if (it.StartATA != item.ATA)
{
flag = true;
////添加booking日志
var bid = await _bookinglog.InsertReturnSnowflakeIdAsync(new BookingLog
{
@ -1769,21 +1774,34 @@ namespace Myshipping.Application
});
it.StartATA = item.ATA;
}
await _rep.AsUpdateable(it).IgnoreColumns().ExecuteCommandAsync();
if (flag)
{
issend = true;
await _rep.AsUpdateable(it).IgnoreColumns().ExecuteCommandAsync();
}
}
var itemcode = _cache.GetAllTenantParam().Result.Where(x => x.ParaCode == "BOOKING_DATA_PUSH" && x.TenantId == UserManager.TENANT_ID).Select(x => x.ItemCode).FirstOrDefault();
if (!string.IsNullOrEmpty(itemcode))
if (issend)
{
if (itemcode == "true") {
List<long> list = new List<long>();
list = order.Where(x=>x.ParentId==0).Select(x => x.Id).ToList();
if (list!=null&&list.Count>0) {
await _bookingorderservice.SendBookingOrder(list.ToArray());
var itemcode = _cache.GetAllTenantParam().Result.Where(x => x.ParaCode == "BOOKING_DATA_PUSH" && x.TenantId == UserManager.TENANT_ID).Select(x => x.ItemCode).FirstOrDefault();
if (!string.IsNullOrEmpty(itemcode))
{
if (itemcode == "true")
{
List<long> list = new List<long>();
list = order.Where(x => x.ParentId == 0).Select(x => x.Id).ToList();
if (list != null && list.Count > 0)
{
await _bookingorderservice.SendBookingOrder(list.ToArray());
}
}
}
}
}
}
}
}
@ -1806,14 +1824,18 @@ namespace Myshipping.Application
//model.ETD = item.ETD;
//model.ATD = item.ATD;
//await _vesselinfo.AsUpdateable(model).IgnoreColumns().ExecuteCommandAsync();
var order = await _rep.AsQueryable().Filter(null, true).Where(x => x.VESSEL == item.Vessel && x.VOYNO == item.Voyno && x.TenantId == UserManager.TENANT_ID&&x.IsDeleted==false).ToListAsync();
var order = await _rep.AsQueryable().Filter(null, true).Where(x => x.VESSEL == item.Vessel && x.VOYNO == item.Voyno && x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToListAsync();
bool issend = false;
if (order != null)
{
foreach (var it in order)
{
bool flag = false;
if (it.ETA != item.ETA)
{
flag = true;
////添加booking日志
var bid = await _bookinglog.InsertReturnSnowflakeIdAsync(new BookingLog
{
@ -1835,6 +1857,7 @@ namespace Myshipping.Application
}
if (it.MiddleETA != item.MiddleETA)
{
flag = true;
////添加booking日志
var bid = await _bookinglog.InsertReturnSnowflakeIdAsync(new BookingLog
{
@ -1856,6 +1879,7 @@ namespace Myshipping.Application
}
if (it.MiddleETD != item.MiddleETD)
{
flag = true;
////添加booking日志
var bid = await _bookinglog.InsertReturnSnowflakeIdAsync(new BookingLog
{
@ -1877,6 +1901,7 @@ namespace Myshipping.Application
}
if (item.MiddleATA != it.MiddleATA)
{
flag = true;
////添加booking日志
var bid = await _bookinglog.InsertReturnSnowflakeIdAsync(new BookingLog
{
@ -1899,6 +1924,7 @@ namespace Myshipping.Application
if (item.MiddleATD != it.MiddleATD)
{
flag = true;
////添加booking日志
var bid = await _bookinglog.InsertReturnSnowflakeIdAsync(new BookingLog
{
@ -1921,6 +1947,7 @@ namespace Myshipping.Application
if (item.ATA != it.ATA)
{
flag = true;
////添加booking日志
var bid = await _bookinglog.InsertReturnSnowflakeIdAsync(new BookingLog
{
@ -1941,15 +1968,25 @@ namespace Myshipping.Application
it.ATA = item.ATA;
}
await _rep.AsUpdateable(it).IgnoreColumns().ExecuteCommandAsync();
if (flag)
{
issend = true;
await _rep.AsUpdateable(it).IgnoreColumns().ExecuteCommandAsync();
}
}
var itemcode = _cache.GetAllTenantParam().Result.Where(x => x.ParaCode == "BOOKING_DATA_PUSH" && x.TenantId == UserManager.TENANT_ID).Select(x => x.ItemCode).FirstOrDefault();
if (!string.IsNullOrEmpty(itemcode))
if (issend)
{
if (itemcode == "true")
await _bookingorderservice.SendBookingOrder(order.Where(x => x.ParentId == 0).Select(x => x.Id).ToArray());
var itemcode = _cache.GetAllTenantParam().Result.Where(x => x.ParaCode == "BOOKING_DATA_PUSH" && x.TenantId == UserManager.TENANT_ID).Select(x => x.ItemCode).FirstOrDefault();
if (!string.IsNullOrEmpty(itemcode))
{
if (itemcode == "true")
await _bookingorderservice.SendBookingOrder(order.Where(x => x.ParentId == 0).Select(x => x.Id).ToArray());
}
}
}
}
}

Loading…
Cancel
Save