improvements, fixes, etc

This commit is contained in:
Loretta 2025-10-19 06:14:40 +02:00
parent d02d4dcb09
commit 254211459f
4 changed files with 15 additions and 9 deletions

View File

@ -6,13 +6,14 @@ using FruitBank.Common.Interfaces;
using FruitBank.Common.Server.Interfaces;
using FruitBank.Common.SignalRs;
using Mango.Nop.Core.Loggers;
using Nop.Core;
using Nop.Core.Domain.Orders;
using Nop.Plugin.Misc.FruitBankPlugin.Controllers;
using Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer;
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());
@ -54,7 +55,8 @@ public class CustomOrderSignalREndpoint(FruitBankDbContext ctx, IEnumerable<IAcL
{
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;
return await ctx.OrderItemPallets.GetByIdAsync(orderItemPallet.Id, false);

View File

@ -438,7 +438,11 @@ public class FruitBankDbContext : MgDbContextBase,
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;
orderItemPallet.SetupCustomItemPalletMeauringValues(orderItemDto.IsMeasurable);

View File

@ -21,7 +21,7 @@ public class OrderItemPalletDbTable : MeasuringItemPalletBaseDbTable<OrderItemPa
{
return loadRelations
? GetAll()
.LoadWith(oip => oip.OrderItemDto).ThenLoad(oi => oi.ProductDto)
.LoadWith(oip => oip.OrderItemDto).ThenLoad(oi => oi.ProductDto).ThenLoad(oip => oip.GenericAttributes)
: GetAll();
}

View File

@ -22,11 +22,11 @@ public class ShippingItemPalletDbTable : MeasuringItemPalletBaseDbTable<Shipping
{
return loadRelations
? GetAll()
.LoadWith(sip => sip.ShippingItem)
//.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(sd => sd.ShippingDocumentToFiles).ThenLoad(sdtof => sdtof.ShippingDocumentFile)
//.LoadWith(sip => sip.ShippingItem).ThenLoad(si => si.Product)
.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(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.Product)
: GetAll();
}