Merge branch '4.80' of https://git.aycode.com/Adam/Mango.Nop.Plugins into 4.80
This commit is contained in:
commit
7f53fccc4f
|
|
@ -38,12 +38,10 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers
|
|||
}
|
||||
|
||||
#region CustomOrderSignalREndpoint
|
||||
public Task<List<OrderDto>> GetAllOrderDtos()
|
||||
=> _customOrderSignalREndpoint.GetAllOrderDtos();
|
||||
public Task<OrderDto> GetOrderDtoById(int orderId)
|
||||
=> _customOrderSignalREndpoint.GetOrderDtoById(orderId);
|
||||
public Task<List<OrderDto>> GetPendingOrderDtos()
|
||||
=> _customOrderSignalREndpoint.GetPendingOrderDtos();
|
||||
[NonAction] public Task<List<OrderDto>> GetAllOrderDtos() => _customOrderSignalREndpoint.GetAllOrderDtos();
|
||||
[NonAction]public Task<OrderDto> GetOrderDtoById(int orderId) => _customOrderSignalREndpoint.GetOrderDtoById(orderId);
|
||||
[NonAction]public Task<List<OrderDto>> GetPendingOrderDtos() => _customOrderSignalREndpoint.GetPendingOrderDtos();
|
||||
[NonAction] public Task<List<OrderDto>> GetAllByIds(int[] orderIds) => _customOrderSignalREndpoint.GetAllByIds(orderIds);
|
||||
#endregion CustomOrderSignalREndpoint
|
||||
|
||||
[CheckPermission(StandardPermission.Orders.ORDERS_VIEW)]
|
||||
|
|
@ -87,16 +85,6 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers
|
|||
return orderListModel;
|
||||
}
|
||||
|
||||
public async Task<OrderListModelExtended> GetPendingOrderListModel()
|
||||
{
|
||||
var orderSearchModel = new OrderSearchModel
|
||||
{
|
||||
OrderStatusIds = new List<int> { (int)OrderStatus.Pending }
|
||||
};
|
||||
|
||||
return await GetOrderListModelByFilter(orderSearchModel);
|
||||
}
|
||||
|
||||
public virtual IActionResult Test()
|
||||
{
|
||||
// Your custom logic here
|
||||
|
|
|
|||
|
|
@ -12,18 +12,24 @@ public class CustomOrderSignalREndpoint(FruitBankDbContext ctx) : ICustomOrderSi
|
|||
[SignalR(SignalRTags.GetAllOrderDtos)]
|
||||
public async Task<List<OrderDto>> GetAllOrderDtos()
|
||||
{
|
||||
return await ctx.OrderDtos.GetAllDtos().ToListAsync();
|
||||
return await ctx.OrderDtos.GetAll(true).ToListAsync();
|
||||
}
|
||||
|
||||
[SignalR(SignalRTags.GetOrderDtoById)]
|
||||
public async Task<OrderDto> GetOrderDtoById(int orderId)
|
||||
{
|
||||
return await ctx.OrderDtos.GetDtoByIdAsync(orderId);
|
||||
return await ctx.OrderDtos.GetByIdAsync(orderId);
|
||||
}
|
||||
|
||||
[SignalR(SignalRTags.GetPendingOrderDtos)]
|
||||
public async Task<List<OrderDto>> GetPendingOrderDtos()
|
||||
{
|
||||
return await ctx.OrderDtos.GetAllByStatusDto(OrderStatus.Pending).ToListAsync();
|
||||
return await ctx.OrderDtos.GetAllByOrderStatus(OrderStatus.Pending).ToListAsync();
|
||||
}
|
||||
|
||||
[SignalR(SignalRTags.GetAllByIdList)]
|
||||
public async Task<List<OrderDto>> GetAllByIds(int[] orderIds)
|
||||
{
|
||||
return await ctx.OrderDtos.GetAllByIds(orderIds).ToListAsync();
|
||||
}
|
||||
}
|
||||
|
|
@ -275,7 +275,7 @@ public class FruitBankDbContext : MgDbContextBase,
|
|||
|
||||
foreach (var shippingItemPallet in shippingItem.ShippingItemPallets!.Where(x => x.IsMeasured && x.IsValidMeasuringValues(shippingItem.IsMeasurable)))
|
||||
{
|
||||
shippingItem.MeasuredQuantity += shippingItemPallet.Quantity;
|
||||
shippingItem.MeasuredQuantity += shippingItemPallet.TrayQuantity;
|
||||
if (!shippingItem.IsMeasurable) continue;
|
||||
|
||||
shippingItem.MeasuredNetWeight += shippingItemPallet.NetWeight;
|
||||
|
|
|
|||
|
|
@ -19,20 +19,25 @@ public class OrderDtoDbTable : MgDbTableBase<OrderDto>
|
|||
{
|
||||
}
|
||||
|
||||
public IQueryable<OrderDto> GetAllDtos()
|
||||
public IQueryable<OrderDto> GetAll(bool loadRelations)
|
||||
{
|
||||
return GetAll()
|
||||
.LoadWith(o => o.GenericAttributes)
|
||||
.LoadWith(o => o.OrderItemDtos).ThenLoad(oi => oi.ProductDto)
|
||||
.LoadWith(o => o.OrderItemDtos).ThenLoad(oi => oi.ProductDto).ThenLoad(prod=>prod.GenericAttributes)
|
||||
.LoadWith(o => o.OrderItemDtos).ThenLoad(oi => oi.GenericAttributes)
|
||||
.LoadWith(o => o.OrderItemDtos).ThenLoad(oi => oi.OrderItemPallets);
|
||||
}
|
||||
|
||||
public Task<OrderDto> GetDtoByIdAsync(int orderId)
|
||||
public Task<OrderDto> GetByIdAsync(int orderId)
|
||||
{
|
||||
return GetAllDtos().Where(x => x.Id == orderId).FirstOrDefaultAsync(null);
|
||||
return GetAll(true).Where(x => x.Id == orderId).FirstOrDefaultAsync(null);
|
||||
}
|
||||
|
||||
public IQueryable<OrderDto> GetAllByStatusDto(OrderStatus orderStatus)
|
||||
=> GetAllDtos().Where(o => o.OrderStatusId == (int)orderStatus);
|
||||
public IQueryable<OrderDto> GetAllByOrderStatus(OrderStatus orderStatus)
|
||||
=> GetAll(true).Where(o => o.OrderStatusId == (int)orderStatus);
|
||||
|
||||
public IQueryable<OrderDto> GetAllByIds(IEnumerable<int> orderIds)
|
||||
{
|
||||
return GetAll(true).Where(o => orderIds.Contains(o.Id));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public class OrderItemPalletDbTable : MeasuringItemPalletBaseDbTable<OrderItemPa
|
|||
public IQueryable<OrderItemPallet> GetAll(bool loadRelations)
|
||||
{
|
||||
return loadRelations
|
||||
? GetAll().LoadWith(oip => oip.OrderItem)
|
||||
? GetAll().LoadWith(oip => oip.OrderItemDto).ThenLoad(oi => oi.ProductDto)
|
||||
: GetAll();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue