optimize
wet 1 year ago
parent a7b966b721
commit 54542b668a

@ -400,9 +400,9 @@ namespace Myshipping.Application
#endregion
var entities = await query.ToPagedListAsync(input.PageNo, input.PageSize);
var list = entities.Adapt<SqlSugarPagedList<PageBookingOrder>>();
var bookingidlist = list.Items.Select(x => x.Id).ToList();
var itgoodsStatus = _goodsStatus.AsQueryable().LeftJoin(_goodsStatusConfig.AsQueryable(),
(goods, config) => config.Id == goods.ConfigId).
(goods, config) => config.Id == goods.ConfigId && bookingidlist.Contains((long)goods.bookingId)).
OrderBy((goods, config) => config.Sort).
Select((goods, config) => new
{
@ -416,8 +416,9 @@ namespace Myshipping.Application
CreatedUserId = config.CreatedUserId,
Sort = config.Sort
}).ToList();
var configID = itgoodsStatus.Select(x => x.ConfigId).ToList();
var itconfigs = _goodsStatusConfig.AsQueryable().Select(config => new
var itconfigs = _goodsStatusConfig.AsQueryable().Where(x => configID.Contains(x.Id)).Select(config => new
{
bookingid = "",
ConfigId = config.Id,
@ -429,10 +430,13 @@ namespace Myshipping.Application
CreatedUserId = config.CreatedUserId,
Sort = config.Sort
}).ToList();
var statusloglist = _repStatuslog.AsQueryable().Filter(null, true).Where(x => (x.Status == "提箱" || x.Status == "返场") && x.IsDeleted == false).ToList();
var statuslogdetaillist = _statuslogdetail.AsQueryable().ToList();
var BookingStatusList= _repBookingStatus.AsQueryable().Filter(null, true).ToList();
var bookingremarkList = _bookingremark.AsQueryable().Filter(null, true).ToList();
var statusloglist = _repStatuslog.AsQueryable().Filter(null, true).Where(x => bookingidlist.Contains((long)x.BookingId) && (x.Status == "提箱" || x.Status == "返场") && x.IsDeleted == false).ToList();
var statuslogId = statusloglist.Select(x => x.Id).ToList();
var statuslogdetaillist = _statuslogdetail.AsQueryable().Where(x => statuslogId.Contains(x.PId)).ToList();
var BookingStatusList = _repBookingStatus.AsQueryable().Where(x => bookingidlist.Contains((long)x.BookingId)).Filter(null, true).ToList();
var bookingremarkList = _bookingremark.AsQueryable().Filter(null, true).Where(x => bookingidlist.Contains(x.PId)).ToList();
foreach (var item in list.Items)
{
var sta = BookingStatusList.Where(x => x.BookingId == item.Id).ToList();
@ -729,12 +733,8 @@ namespace Myshipping.Application
var mlist = await _rep.AsQueryable().Filter(null, true).Where(x => x.Id == input.Id).FirstAsync();
if (!(mlist.OPID == UserManager.UserId.ToString() || mlist.DOCID == UserManager.UserId.ToString() || mlist.CUSTSERVICEID == UserManager.UserId.ToString() || mlist.ROUTEID == UserManager.UserId.ToString() || mlist.CreatedUserId.ToString() == UserManager.UserId.ToString() || UserManager.DjyUserId == "d85fd590-d9f6-4410-93a1-f6fac77b606e"))
{
throw Oops.Bah("您没有当前单据的操作权限!");
}
if (string.IsNullOrEmpty(entity.VOYNO))
{
entity.VOYNO = entity.VOYNOINNER;
@ -923,10 +923,12 @@ namespace Myshipping.Application
ordOut = main.Adapt<BookingOrderOutput>();
var ctnlist = await _repCtn.AsQueryable().Where(x => x.BILLID == Id).ToListAsync();
var ctninput = ctnlist.Adapt<List<BookingCtnDto>>();
var ctnIdlist = ctnlist.Select(x => x.Id).ToList();
var ctndetaillist= await _ctndetailrep.AsQueryable().Where(x => ctnIdlist.Contains((long)x.CTNID)).ToListAsync();
foreach (var item in ctninput)
{
var ctndetaillist = await _ctndetailrep.AsQueryable().Where(x => x.CTNID == item.Id).ToListAsync();
item.ctnDetailInputs = ctndetaillist.Adapt<List<BookingCtnDetailDto>>();
var _ctndetaillist = ctndetaillist.Where(x => x.CTNID == item.Id).ToList();
item.ctnDetailInputs = _ctndetaillist.Adapt<List<BookingCtnDetailDto>>();
}
ordOut.ctnInputs = ctninput;
@ -950,10 +952,12 @@ namespace Myshipping.Application
{
var ctnlist = await _repCtn.AsQueryable().Where(x => x.BILLID == item.Id).ToListAsync();
var ctninput = ctnlist.Adapt<List<BookingCtnDto>>();
var ctnIdlist = ctnlist.Select(x => x.Id).ToList();
var ctndetaillist = await _ctndetailrep.AsQueryable().Where(x => ctnIdlist.Contains((long)x.CTNID)).ToListAsync();
foreach (var it in ctninput)
{
var ctndetaillist = await _ctndetailrep.AsQueryable().Where(x => x.CTNID == it.Id).ToListAsync();
it.ctnDetailInputs = ctndetaillist.Adapt<List<BookingCtnDetailDto>>();
var _ctndetaillist = ctndetaillist.Where(x => x.CTNID == item.Id).ToList();
it.ctnDetailInputs = _ctndetaillist.Adapt<List<BookingCtnDetailDto>>();
}
item.ctnInputs = ctninput;
//检索EDI扩展
@ -1200,10 +1204,12 @@ namespace Myshipping.Application
ordOut = main.Adapt<BookingOrderOutput>();
var ctnlist = await _repCtn.AsQueryable().Where(x => x.BILLID == Id).ToListAsync();
var ctninput = ctnlist.Adapt<List<BookingCtnDto>>();
var ctnIdlist = ctnlist.Select(x => x.Id).ToList();
var ctndetaillist = await _ctndetailrep.AsQueryable().Where(x => ctnIdlist.Contains((long)x.CTNID)).ToListAsync();
foreach (var item in ctninput)
{
var ctndetaillist = await _ctndetailrep.AsQueryable().Where(x => x.CTNID == item.Id).ToListAsync();
item.ctnDetailInputs = ctndetaillist.Adapt<List<BookingCtnDetailDto>>();
var _ctndetaillist = ctndetaillist.Where(x => x.CTNID == item.Id).ToList();
item.ctnDetailInputs = _ctndetaillist.Adapt<List<BookingCtnDetailDto>>();
}
ordOut.ctnInputs = ctninput;
@ -1227,10 +1233,12 @@ namespace Myshipping.Application
{
var ctnlist = await _repCtn.AsQueryable().Where(x => x.BILLID == item.Id).ToListAsync();
var ctninput = ctnlist.Adapt<List<BookingCtnDto>>();
var ctnIdlist = ctnlist.Select(x => x.Id).ToList();
var ctndetaillist = await _ctndetailrep.AsQueryable().Where(x => ctnIdlist.Contains((long)x.CTNID)).ToListAsync();
foreach (var it in ctninput)
{
var ctndetaillist = await _ctndetailrep.AsQueryable().Where(x => x.CTNID == it.Id).ToListAsync();
it.ctnDetailInputs = ctndetaillist.Adapt<List<BookingCtnDetailDto>>();
var _ctndetaillist = ctndetaillist.Where(x => x.CTNID == item.Id).ToList();
it.ctnDetailInputs = _ctndetaillist.Adapt<List<BookingCtnDetailDto>>();
}
item.ctnInputs = ctninput;
//检索EDI扩展
@ -1278,6 +1286,7 @@ namespace Myshipping.Application
CLOSINGDATE = dto.CLOSINGDATE,
CLOSEDOCDATE = dto.CLOSEDOCDATE
});
await SendBookingOrder(dto.Id.ToArray());
}
#endregion

@ -50,10 +50,7 @@ public class CommonConst
/// </summary>
public const string CACHE_KEY_USERDATASCOPEZDY = "userdatascopezdy";
/// <summary>
/// 新 用户数据权限缓存(自定义)
/// </summary>
public const string CACHE_KEY_USERDATASCOPEZDY = "userdatascopezdy";
#region 公共数据库
/// <summary>

Loading…
Cancel
Save