|
|
@ -1755,6 +1755,10 @@ namespace Myshipping.Application
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var mlist = await _rep.AsQueryable().Filter(null, true).Where(x => x.Id == input.Id).FirstAsync();
|
|
|
|
var mlist = await _rep.AsQueryable().Filter(null, true).Where(x => x.Id == input.Id).FirstAsync();
|
|
|
|
|
|
|
|
if (mlist.IsDeleted)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw Oops.Bah("当前单据为【已删除】状态,无法修改");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(reqId))
|
|
|
|
if (!string.IsNullOrEmpty(reqId))
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -2287,6 +2291,9 @@ namespace Myshipping.Application
|
|
|
|
// 要取消订阅运踪的列表
|
|
|
|
// 要取消订阅运踪的列表
|
|
|
|
List<BillTraceUnsubscribeList> waitUnsubscribeBilltrace = new(arr.Count());
|
|
|
|
List<BillTraceUnsubscribeList> waitUnsubscribeBilltrace = new(arr.Count());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var tenantParamList = await _cache.GetAllTenantParam();
|
|
|
|
|
|
|
|
var isAskDs = tenantParamList.FirstOrDefault(x => x.TenantId == UserManager.TENANT_ID && x.ParaCode == TenantParamCode.ASK_DS_BEFORE_DELETE_BOOKING_ORDER);
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var ar in arr)
|
|
|
|
foreach (var ar in arr)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
long Id = Convert.ToInt64(ar);
|
|
|
|
long Id = Convert.ToInt64(ar);
|
|
|
@ -2300,16 +2307,24 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
|
|
// 将待删除的订舱单id存放到Cache中。目的:使用SendBookingOrder()推送订舱单数据前通过Cache判断是否正在走删除逻辑,来决定是否推送(如果是正在处理删除逻辑的数据,则不推送)
|
|
|
|
// 将待删除的订舱单id存放到Cache中。目的:使用SendBookingOrder()推送订舱单数据前通过Cache判断是否正在走删除逻辑,来决定是否推送(如果是正在处理删除逻辑的数据,则不推送)
|
|
|
|
string deletingCacheKey = $"DeletingBookingOrderId_{ar}";
|
|
|
|
string deletingCacheKey = $"DeletingBookingOrderId_{ar}";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
await _cache.SetTimeoutAsync(deletingCacheKey, null, TimeSpan.FromMinutes(1));
|
|
|
|
await _cache.SetTimeoutAsync(deletingCacheKey, null, TimeSpan.FromMinutes(1));
|
|
|
|
_logger.LogInformation("设置待删除的订舱单id到Cache中,key:" + deletingCacheKey);
|
|
|
|
_logger.LogInformation("设置待删除的订舱单id到Cache中,key:" + deletingCacheKey);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var deleteTime = DateTime.Now;
|
|
|
|
|
|
|
|
if (isAskDs?.ItemCode == "YES")
|
|
|
|
|
|
|
|
{
|
|
|
|
BookingOrderDelete bookingOrderDelete = new BookingOrderDelete();
|
|
|
|
BookingOrderDelete bookingOrderDelete = new BookingOrderDelete();
|
|
|
|
List<BookingOrderDeleteDetail> deletelist = new List<BookingOrderDeleteDetail>();
|
|
|
|
List<BookingOrderDeleteDetail> deletelist = new List<BookingOrderDeleteDetail>
|
|
|
|
deletelist.Add(new BookingOrderDeleteDetail
|
|
|
|
{
|
|
|
|
|
|
|
|
new BookingOrderDeleteDetail
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Id = Id,
|
|
|
|
Id = Id,
|
|
|
|
MBLNO = mblno
|
|
|
|
MBLNO = mblno
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
bookingOrderDelete.Delete = deletelist;
|
|
|
|
bookingOrderDelete.Delete = deletelist;
|
|
|
|
|
|
|
|
|
|
|
|
var stn = await url.SetBody(bookingOrderDelete).PostAsStringAsync();
|
|
|
|
var stn = await url.SetBody(bookingOrderDelete).PostAsStringAsync();
|
|
|
@ -2319,8 +2334,7 @@ namespace Myshipping.Application
|
|
|
|
{
|
|
|
|
{
|
|
|
|
JObject data = jobj.GetValue("Data") as JObject;
|
|
|
|
JObject data = jobj.GetValue("Data") as JObject;
|
|
|
|
JArray NoDeleted = data.GetValue("NoDeleted") as JArray;
|
|
|
|
JArray NoDeleted = data.GetValue("NoDeleted") as JArray;
|
|
|
|
var deleteTime = DateTime.Now;
|
|
|
|
if (NoDeleted == null || NoDeleted.Count() == 0 || (NoDeleted[0] is JObject re2 && re2.GetIntValue("Code") == 201))
|
|
|
|
if (NoDeleted == null || NoDeleted.Count() == 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var ctnlist = await _repCtn.AsQueryable().Where(x => x.BILLID == Id).Select(x => x.Id).ToListAsync();
|
|
|
|
var ctnlist = await _repCtn.AsQueryable().Where(x => x.BILLID == Id).Select(x => x.Id).ToListAsync();
|
|
|
|
await _repCtn.UpdateAsync(x => x.BILLID == Id, x => new BookingCtn { IsDeleted = true });
|
|
|
|
await _repCtn.UpdateAsync(x => x.BILLID == Id, x => new BookingCtn { IsDeleted = true });
|
|
|
@ -2341,7 +2355,16 @@ namespace Myshipping.Application
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var re = NoDeleted[0] as JObject;
|
|
|
|
var re = NoDeleted[0] as JObject;
|
|
|
|
if (re.GetIntValue("Code") == 201)
|
|
|
|
string result = re.GetStringValue("Result");
|
|
|
|
|
|
|
|
throw Oops.Bah(result);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw Oops.Bah(mblno + "删除单据失败");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var ctnlist = await _repCtn.AsQueryable().Where(x => x.BILLID == Id).Select(x => x.Id).ToListAsync();
|
|
|
|
var ctnlist = await _repCtn.AsQueryable().Where(x => x.BILLID == Id).Select(x => x.Id).ToListAsync();
|
|
|
|
await _repCtn.UpdateAsync(x => x.BILLID == Id, x => new BookingCtn { IsDeleted = true });
|
|
|
|
await _repCtn.UpdateAsync(x => x.BILLID == Id, x => new BookingCtn { IsDeleted = true });
|
|
|
@ -2359,27 +2382,19 @@ namespace Myshipping.Application
|
|
|
|
newOrder.DeleteTime = deleteTime;
|
|
|
|
newOrder.DeleteTime = deleteTime;
|
|
|
|
await SaveLog(newOrder, order, "删除");
|
|
|
|
await SaveLog(newOrder, order, "删除");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
await _cache.DelAsync(deletingCacheKey);
|
|
|
|
await _cache.DelAsync(deletingCacheKey);
|
|
|
|
_logger.LogInformation("从Cache中移除待删除的订舱单id,key:" + deletingCacheKey);
|
|
|
|
_logger.LogInformation("从Cache中移除待删除的订舱单id,key:" + deletingCacheKey);
|
|
|
|
|
|
|
|
|
|
|
|
string result = re.GetStringValue("Result");
|
|
|
|
throw;
|
|
|
|
throw Oops.Bah(result);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
finally
|
|
|
|
{
|
|
|
|
{
|
|
|
|
await _cache.DelAsync(deletingCacheKey);
|
|
|
|
await _cache.DelAsync(deletingCacheKey);
|
|
|
|
_logger.LogInformation("从Cache中移除待删除的订舱单id,key:" + deletingCacheKey);
|
|
|
|
_logger.LogInformation("从Cache中移除待删除的订舱单id,key:" + deletingCacheKey);
|
|
|
|
|
|
|
|
|
|
|
|
throw Oops.Bah(mblno + "删除单据失败");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
await _cache.DelAsync(deletingCacheKey);
|
|
|
|
|
|
|
|
_logger.LogInformation("从Cache中移除待删除的订舱单id,key:" + deletingCacheKey);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 取消订阅运踪
|
|
|
|
// 取消订阅运踪
|
|
|
|