jianghaiqing 1 year ago
commit bfca49b308

@ -1436,6 +1436,12 @@ namespace Myshipping.Application
long Id = Convert.ToInt64(ar); long Id = Convert.ToInt64(ar);
var mblno = order.Where(x => x.Id == Id).Select(x => x.MBLNO).FirstOrDefault(); var mblno = order.Where(x => x.Id == Id).Select(x => x.MBLNO).FirstOrDefault();
// 将待删除的订舱单id存放到Cache中。目的使用SendBookingOrder()推送订舱单数据前通过Cache判断是否正在走删除逻辑来决定是否推送(如果是正在处理删除逻辑的数据,则不推送)
string deletingCacheKey = $"DeletingBookingOrderId_{ar}";
await _cache.SetTimeoutAsync(deletingCacheKey, null, TimeSpan.FromMinutes(1));
_logger.LogInformation("设置待删除的订舱单id到Cache中key" + deletingCacheKey);
BookingOrderDelete bookingOrderDelete = new BookingOrderDelete(); BookingOrderDelete bookingOrderDelete = new BookingOrderDelete();
List<BookingOrderDeleteDetail> deletelist = new List<BookingOrderDeleteDetail>(); List<BookingOrderDeleteDetail> deletelist = new List<BookingOrderDeleteDetail>();
deletelist.Add(new BookingOrderDeleteDetail deletelist.Add(new BookingOrderDeleteDetail
@ -1477,6 +1483,9 @@ namespace Myshipping.Application
} }
else else
{ {
await _cache.DelAsync(deletingCacheKey);
_logger.LogInformation("从Cache中移除待删除的订舱单idkey" + deletingCacheKey);
string result = re.GetStringValue("Result"); string result = re.GetStringValue("Result");
throw Oops.Bah(result); throw Oops.Bah(result);
} }
@ -1485,9 +1494,14 @@ namespace Myshipping.Application
} }
else else
{ {
await _cache.DelAsync(deletingCacheKey);
_logger.LogInformation("从Cache中移除待删除的订舱单idkey" + deletingCacheKey);
throw Oops.Bah(mblno + "删除单据失败"); throw Oops.Bah(mblno + "删除单据失败");
} }
await _cache.DelAsync(deletingCacheKey);
_logger.LogInformation("从Cache中移除待删除的订舱单idkey" + deletingCacheKey);
} }
#region 消息队列推送删除信息 #region 消息队列推送删除信息
//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();
@ -8503,6 +8517,11 @@ HLCUTA12307DPXJ3 以这票为例 6个柜
{ {
continue; continue;
} }
//2023-9-26添加校验推送前通过Cache判断一下待推送的数据是否正在走删除逻辑
if (await _cache.ExistsAsync($"DeletingBookingOrderId_{item.Id}"))
{
continue;
}
var dto = item.Adapt<SyncBookingOrderDto>(); var dto = item.Adapt<SyncBookingOrderDto>();

Loading…
Cancel
Save