|
|
|
@ -83,12 +83,27 @@ namespace Myshipping.Application.Event
|
|
|
|
|
stockObj.TOTAL_ORDERS = baseList.Count; //总舱位数
|
|
|
|
|
|
|
|
|
|
var lstBaseId = baseList.Select(x => x.Id).ToList();
|
|
|
|
|
stockObj.TOTAL_CTNS = _repCtn.Where(x => lstBaseId.Contains(x.SLOT_ID)).Count(); //总箱数
|
|
|
|
|
stockObj.TOTAL_CTNS = _repCtn.AsQueryable()
|
|
|
|
|
.Filter(null, true)
|
|
|
|
|
.Where(x => !x.IsDeleted && lstBaseId.Contains(x.SLOT_ID))
|
|
|
|
|
.Sum(x => x.CTNNUM); //总箱数
|
|
|
|
|
|
|
|
|
|
var lstAllocIdList = await _repAlloc.Where(x => lstBaseId.Contains(x.BOOKING_SLOT_ID)).Select(x => x.Id).ToListAsync();
|
|
|
|
|
stockObj.USE_NUM = lstAllocIdList.Count; //使用舱位数
|
|
|
|
|
var lstAllocKeyList = await _repAlloc.AsQueryable()
|
|
|
|
|
.Filter(null, true)
|
|
|
|
|
.Where(x => !x.IsDeleted && lstBaseId.Contains(x.BOOKING_SLOT_ID))
|
|
|
|
|
.Select(x => new { x.Id, x.BOOKING_SLOT_ID })
|
|
|
|
|
.ToListAsync();
|
|
|
|
|
|
|
|
|
|
stockObj.USE_CTNS_NUM = _repAllocCtn.Where(x => lstAllocIdList.Contains(x.SLOT_ALLOC_ID)).Count(); //使用箱数
|
|
|
|
|
stockObj.USE_NUM = lstAllocKeyList.DistinctBy(x => x.BOOKING_SLOT_ID).Count(); //使用舱位数
|
|
|
|
|
|
|
|
|
|
var lstAllocIdList = lstAllocKeyList.Select(x => x.Id).ToList();
|
|
|
|
|
|
|
|
|
|
stockObj.USE_CTNS_NUM = _repAllocCtn.AsQueryable()
|
|
|
|
|
.Filter(null, true)
|
|
|
|
|
.Where(x => !x.IsDeleted && lstAllocIdList.Contains(x.SLOT_ALLOC_ID))
|
|
|
|
|
.Sum(x => x.CTNNUM); //使用箱数
|
|
|
|
|
|
|
|
|
|
stockObj.REMAIN_CTNS_NUM = stockObj.TOTAL_CTNS - stockObj.USE_CTNS_NUM; //剩余箱数
|
|
|
|
|
|
|
|
|
|
await _repStock.UpdateAsync(stockObj);
|
|
|
|
|
|
|
|
|
|