From 86fa3f392710550048a15244a4a2323f24daf4fb Mon Sep 17 00:00:00 2001 From: wet <1034391973@qq.com> Date: Fri, 19 May 2023 11:45:56 +0800 Subject: [PATCH] 1 --- .../Service/DataSync/DataSyncService.cs | 73 ++++++++++++++----- 1 file changed, 55 insertions(+), 18 deletions(-) diff --git a/Myshipping.Application/Service/DataSync/DataSyncService.cs b/Myshipping.Application/Service/DataSync/DataSyncService.cs index f334cd98..66ffe17d 100644 --- a/Myshipping.Application/Service/DataSync/DataSyncService.cs +++ b/Myshipping.Application/Service/DataSync/DataSyncService.cs @@ -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 list = new List(); - 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 list = new List(); + 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()); + } } + } } }