optimize
wet 2 years ago
parent ff766a0052
commit 86fa3f3927

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

Loading…
Cancel
Save