improvements, fixes, etc
This commit is contained in:
parent
d02d4dcb09
commit
254211459f
|
|
@ -6,13 +6,14 @@ using FruitBank.Common.Interfaces;
|
||||||
using FruitBank.Common.Server.Interfaces;
|
using FruitBank.Common.Server.Interfaces;
|
||||||
using FruitBank.Common.SignalRs;
|
using FruitBank.Common.SignalRs;
|
||||||
using Mango.Nop.Core.Loggers;
|
using Mango.Nop.Core.Loggers;
|
||||||
|
using Nop.Core;
|
||||||
using Nop.Core.Domain.Orders;
|
using Nop.Core.Domain.Orders;
|
||||||
using Nop.Plugin.Misc.FruitBankPlugin.Controllers;
|
using Nop.Plugin.Misc.FruitBankPlugin.Controllers;
|
||||||
using Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer;
|
using Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer;
|
||||||
|
|
||||||
namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers;
|
namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers;
|
||||||
|
|
||||||
public class CustomOrderSignalREndpoint(FruitBankDbContext ctx, IEnumerable<IAcLogWriterBase> logWriters) : ICustomOrderSignalREndpointServer
|
public class CustomOrderSignalREndpoint(FruitBankDbContext ctx, IWorkContext workContext, IEnumerable<IAcLogWriterBase> logWriters) : ICustomOrderSignalREndpointServer
|
||||||
{
|
{
|
||||||
private readonly ILogger _logger = new Logger<CustomOrderSignalREndpoint>(logWriters.ToArray());
|
private readonly ILogger _logger = new Logger<CustomOrderSignalREndpoint>(logWriters.ToArray());
|
||||||
|
|
||||||
|
|
@ -54,7 +55,8 @@ public class CustomOrderSignalREndpoint(FruitBankDbContext ctx, IEnumerable<IAcL
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(orderItemPallet);
|
ArgumentNullException.ThrowIfNull(orderItemPallet);
|
||||||
|
|
||||||
_logger.Detail($"AddOrUpdateMeasuredOrderItemPallet invoked; {orderItemPallet}");
|
var customer = await workContext.GetCurrentCustomerAsync();
|
||||||
|
_logger.Detail($"AddOrUpdateMeasuredOrderItemPallet invoked; {orderItemPallet}; CustomerId: {customer?.Id}");
|
||||||
|
|
||||||
if (!await ctx.AddOrUpdateOrderItemPalletSafeAsync(orderItemPallet)) return null;
|
if (!await ctx.AddOrUpdateOrderItemPalletSafeAsync(orderItemPallet)) return null;
|
||||||
return await ctx.OrderItemPallets.GetByIdAsync(orderItemPallet.Id, false);
|
return await ctx.OrderItemPallets.GetByIdAsync(orderItemPallet.Id, false);
|
||||||
|
|
|
||||||
|
|
@ -438,7 +438,11 @@ public class FruitBankDbContext : MgDbContextBase,
|
||||||
|
|
||||||
private async Task<bool> SetupOrderItemPalletMeauringValues(OrderItemPallet orderItemPallet)
|
private async Task<bool> SetupOrderItemPalletMeauringValues(OrderItemPallet orderItemPallet)
|
||||||
{
|
{
|
||||||
var orderItemDto = orderItemPallet.OrderItemDto ?? await OrderItemDtos.GetByIdAsync(orderItemPallet.OrderItemId);
|
OrderItemDto orderItemDto;
|
||||||
|
|
||||||
|
if (orderItemPallet.OrderItemDto?.ProductDto == null) orderItemDto = await OrderItemDtos.GetByIdAsync(orderItemPallet.OrderItemId, true);
|
||||||
|
else orderItemDto = orderItemPallet.OrderItemDto;
|
||||||
|
|
||||||
if (orderItemDto == null || orderItemPallet.OrderItemId != orderItemDto.Id) return false;
|
if (orderItemDto == null || orderItemPallet.OrderItemId != orderItemDto.Id) return false;
|
||||||
|
|
||||||
orderItemPallet.SetupCustomItemPalletMeauringValues(orderItemDto.IsMeasurable);
|
orderItemPallet.SetupCustomItemPalletMeauringValues(orderItemDto.IsMeasurable);
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ public class OrderItemPalletDbTable : MeasuringItemPalletBaseDbTable<OrderItemPa
|
||||||
{
|
{
|
||||||
return loadRelations
|
return loadRelations
|
||||||
? GetAll()
|
? GetAll()
|
||||||
.LoadWith(oip => oip.OrderItemDto).ThenLoad(oi => oi.ProductDto)
|
.LoadWith(oip => oip.OrderItemDto).ThenLoad(oi => oi.ProductDto).ThenLoad(oip => oip.GenericAttributes)
|
||||||
: GetAll();
|
: GetAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,11 +22,11 @@ public class ShippingItemPalletDbTable : MeasuringItemPalletBaseDbTable<Shipping
|
||||||
{
|
{
|
||||||
return loadRelations
|
return loadRelations
|
||||||
? GetAll()
|
? GetAll()
|
||||||
.LoadWith(sip => sip.ShippingItem)
|
.LoadWith(sip => sip.ShippingItem).ThenLoad(si => si.ProductDto).ThenLoad(prod => prod.GenericAttributes)
|
||||||
//.LoadWith(sip => sip.ShippingItem).ThenLoad(si => si.ShippingDocument).ThenLoad(sd => sd.Shipping)
|
//.LoadWith(sip => sip.ShippingItem).ThenLoad(si => si.ShippingDocument).ThenLoad(sd => sd.Shipping)
|
||||||
//.LoadWith(sip => sip.ShippingItem).ThenLoad(si => si.ShippingDocument).ThenLoad(p => p.Partner)
|
//.LoadWith(sip => sip.ShippingItem).ThenLoad(si => si.ShippingDocument).ThenLoad(p => p.Partner)
|
||||||
//.LoadWith(sip => sip.ShippingItem).ThenLoad(si => si.ShippingDocument).ThenLoad(sd => sd.ShippingDocumentToFiles).ThenLoad(sdtof => sdtof.ShippingDocumentFile)
|
//.LoadWith(sip => sip.ShippingItem).ThenLoad(si => si.ShippingDocument).ThenLoad(sd => sd.ShippingDocumentToFiles).ThenLoad(sdtof => sdtof.ShippingDocumentFile)
|
||||||
//.LoadWith(sip => sip.ShippingItem).ThenLoad(si => si.Product)
|
//.LoadWith(sip => sip.ShippingItem).ThenLoad(si => si.Product)
|
||||||
: GetAll();
|
: GetAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue