diff --git a/Myshipping.Application/Service/BookingYunZong/BookingYunZong.cs b/Myshipping.Application/Service/BookingYunZong/BookingYunZong.cs index 731aa120..7cdf6ab3 100644 --- a/Myshipping.Application/Service/BookingYunZong/BookingYunZong.cs +++ b/Myshipping.Application/Service/BookingYunZong/BookingYunZong.cs @@ -54,7 +54,11 @@ namespace Myshipping.Application [HttpPost("/BookingYunZong/RefreshYunZong")] public async Task RefreshYunZong(long[] Ids) { - var order = await _rep.AsQueryable().Filter(null, true).Where(x => Ids.Contains(x.Id)).ToListAsync(); + var order = await _rep.AsQueryable().Filter(null, true).Where(x => Ids.Contains(x.Id)&&x.IsDeleted==false&&x.ParentId==0&&x.IsBookingYZ!="0").ToListAsync(); + if (order==null|| order.Count==0) { + throw Oops.Bah("存在未订阅单据"); + + } var key = _cache.GetAllSysConfig().Result.Where(x => x.Code == "billTraceNewUserKey").Select(x => x.Value).FirstOrDefault(); if (string.IsNullOrEmpty(key)) { @@ -160,7 +164,7 @@ namespace Myshipping.Application var mblno = item.GetValue("bno").ToString(); - var bookingId = await _rep.AsQueryable().Filter(null, true).Where(x => x.MBLNO == mblno).Select(x => x.Id).FirstAsync(); + var bookingId = await _rep.AsQueryable().Filter(null, true).Where(x => x.MBLNO == mblno&&x.IsDeleted==false&&x.ParentId==0).Select(x => x.Id).FirstAsync(); var jarrInnerData = item.GetValue("data") as JArray; List yarddto = new List(); @@ -262,7 +266,7 @@ namespace Myshipping.Application var mblno = item.GetValue("bno").ToString(); - var bookingId = await _rep.AsQueryable().Filter(null, true).Where(x => x.MBLNO == mblno).Select(x => x.Id).FirstAsync(); + var bookingId = await _rep.AsQueryable().Filter(null, true).Where(x => x.MBLNO == mblno && x.IsDeleted == false && x.ParentId == 0).Select(x => x.Id).FirstAsync(); var list = await _repBookingStatus.AsQueryable().Filter(null, true).InnerJoin((d, t) => d.StaCode == t.Code && d.StaCate == "book_sta_cate_billtrace" && d.BookingId == bookingId).Select((d, t) => new { BookingId = d.BookingId, @@ -357,7 +361,7 @@ namespace Myshipping.Application //每票 货物 var mblno = item.GetValue("bno").ToString(); - var bookingOrder = await _rep.AsQueryable().Filter(null, true).Where(x => x.MBLNO == mblno && x.IsDeleted == false).FirstAsync(); + var bookingOrder = await _rep.AsQueryable().Filter(null, true).Where(x => x.MBLNO == mblno && x.IsDeleted == false && x.ParentId == 0).FirstAsync(); var list = await _repBookingStatus.AsQueryable().Filter(null, true).InnerJoin((d, t) => d.StaCode == t.Code && d.StaCate == "book_sta_cate_billtrace" && d.BookingId == bookingOrder.Id).Select((d, t) => new { BookingId = d.BookingId,