This commit is contained in:
Adam 2025-10-19 15:13:39 +02:00
commit e2aabb3bb9
21 changed files with 492 additions and 262 deletions

View File

@ -10,10 +10,10 @@
<ItemGroup>
<PackageReference Include="MessagePack" Version="3.1.4" />
<PackageReference Include="MessagePack.Annotations" Version="3.1.4" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="9.0.9" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Common" Version="9.0.9" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="9.0.9" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.9" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="9.0.10" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Common" Version="9.0.10" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="9.0.10" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.10" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
</ItemGroup>

View File

@ -1,6 +1,6 @@
namespace FruitBank.Common;
public enum DocumentType : byte
public enum DocumentType : int
{
NotSet = 0,
Unknown = 5,

View File

@ -4,50 +4,50 @@ using Nop.Core.Domain.Catalog;
namespace FruitBank.Common.Dtos;
public class MeasuringProductDto : ProductDto, IMeasuringProductDto
{
/// <summary>
/// Reference to StockQuantity, always equals!
/// </summary>
public int Quantity
{
get => StockQuantity;
set => StockQuantity = value;
}
//public class MeasuringProductDto : ProductDto, IMeasuringProductDto
//{
// /// <summary>
// /// Reference to StockQuantity, always equals!
// /// </summary>
// public int Quantity
// {
// get => StockQuantity;
// set => StockQuantity = value;
// }
public double NetWeight { get; set; }
public bool IsMeasurable { get; set; }
// public double NetWeight { get; set; }
// public bool IsMeasurable { get; set; }
public MeasuringProductDto() :base()
{ }
public MeasuringProductDto(int productId) : base(productId)
{ }
public MeasuringProductDto(Product product, IMeasuringAttributeValues? measuringAttributeValues)
{
CopyEntityValuesToDto(product, measuringAttributeValues);
}
// public MeasuringProductDto() :base()
// { }
// public MeasuringProductDto(int productId) : base(productId)
// { }
// public MeasuringProductDto(Product product, IMeasuringAttributeValues? measuringAttributeValues)
// {
// CopyEntityValuesToDto(product, measuringAttributeValues);
// }
public void CopyDtoValuesToEntity(Product entity, IMeasuringAttributeValues measuringAttributeValues)
{
base.CopyDtoValuesToEntity(entity);
// public void CopyDtoValuesToEntity(Product entity, IMeasuringAttributeValues measuringAttributeValues)
// {
// base.CopyDtoValuesToEntity(entity);
measuringAttributeValues.Id = Id;
measuringAttributeValues.NetWeight = NetWeight;
measuringAttributeValues.IsMeasurable = IsMeasurable;
}
// measuringAttributeValues.Id = Id;
// measuringAttributeValues.NetWeight = NetWeight;
// measuringAttributeValues.IsMeasurable = IsMeasurable;
// }
public void CopyEntityValuesToDto(Product entity, IMeasuringAttributeValues? measuringAttributeValues)
{
if (measuringAttributeValues != null && entity.Id != measuringAttributeValues.Id)
throw new Exception($"MeasuringProductDto->CopyEntityValuesToDto(Product entity, IMeasuringAttributeValues measuringAttributeValues); entity.Id != measuringAttributeValues.Id; entityId: {entity.Id}; measuringAttributeValues.Id: {measuringAttributeValues.Id}");
// public void CopyEntityValuesToDto(Product entity, IMeasuringAttributeValues? measuringAttributeValues)
// {
// if (measuringAttributeValues != null && entity.Id != measuringAttributeValues.Id)
// throw new Exception($"MeasuringProductDto->CopyEntityValuesToDto(Product entity, IMeasuringAttributeValues measuringAttributeValues); entity.Id != measuringAttributeValues.Id; entityId: {entity.Id}; measuringAttributeValues.Id: {measuringAttributeValues.Id}");
base.CopyEntityValuesToDto(entity);
// base.CopyEntityValuesToDto(entity);
if (measuringAttributeValues == null) return;
// if (measuringAttributeValues == null) return;
NetWeight = measuringAttributeValues.NetWeight;
IsMeasurable = measuringAttributeValues.IsMeasurable;
}
// NetWeight = measuringAttributeValues.NetWeight;
// IsMeasurable = measuringAttributeValues.IsMeasurable;
// }
public bool HasMeasuringValues() => Id > 0 && NetWeight > 0 && IsMeasurable;
}
// public bool HasMeasuringValues() => Id > 0 && NetWeight > 0 && IsMeasurable;
//}

View File

@ -66,4 +66,6 @@ public class ProductDto : MgProductDto, IProductDto
//get => CommonHelper.To<int>(GenericAttributes.SingleOrDefault(x => x.Key == nameof(IIncomingQuantity.IncomingQuantity))?.Value ?? "0");
set => throw new Exception($"ProductDto.IncomingQuantity not set");
}
public bool HasMeasuringValues() => Id > 0 && NetWeight > 0 && IsMeasurable;
}

View File

@ -17,6 +17,8 @@ public class ShippingDocument : MgEntityBase, IShippingDocument
public int TotalPallets { get; set; }
public bool IsAllMeasured { get; set; }
public string Comment { get; set; }
[Association(ThisKey = nameof(ShippingId), OtherKey = nameof(Shipping.Id), CanBeNull = true)]
public Shipping? Shipping{ get; set; }

View File

@ -1,16 +1,25 @@
using FruitBank.Common.Interfaces;
using System.ComponentModel.DataAnnotations.Schema;
using FruitBank.Common.Interfaces;
using LinqToDB.Mapping;
using Mango.Nop.Core.Entities;
namespace FruitBank.Common.Entities;
[Table(Name = FruitBankConstClient.ShippingDocumentToFilesDbTableName)]
[LinqToDB.Mapping.Table(Name = FruitBankConstClient.ShippingDocumentToFilesDbTableName)]
[System.ComponentModel.DataAnnotations.Schema.Table(FruitBankConstClient.ShippingDocumentToFilesDbTableName)]
public class ShippingDocumentToFiles : MgEntityBase, IShippingDocumentToFiles
{
public int FilesId { get; set; }
public int ShippingDocumentId { get; set; }
public DocumentType DocumentType { get; set; }
public int DocumentTypeId { get; set; }
[NotColumn, NotMapped]
public DocumentType DocumentType
{
get => (DocumentType)DocumentTypeId;
set => DocumentTypeId = (int)value;
}
[Association(ThisKey = nameof(FilesId), OtherKey = nameof(Files.Id), CanBeNull = true)]

View File

@ -11,7 +11,7 @@
<PackageReference Include="linq2db.EntityFrameworkCore" Version="9.0.0" />
<PackageReference Include="MessagePack" Version="3.1.4" />
<PackageReference Include="MessagePack.Annotations" Version="3.1.4" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.9" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.10" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
</ItemGroup>

View File

@ -51,8 +51,8 @@ public interface IFruitBankDataControllerCommon
#region Product
public Task<List<ProductDto>?> GetProductDtos();
public Task<List<MeasuringProductDto>?> GetAllMeasuringProductDtos();
public Task<MeasuringProductDto?> GetMeasuringProductDtoById(int productId);
//public Task<List<MeasuringProductDto>?> GetAllMeasuringProductDtos();
public Task<ProductDto?> GetProductDtoById(int productId);
#endregion Product

View File

@ -2,6 +2,6 @@
namespace FruitBank.Common.Interfaces;
public interface IMeasuringProductDto : IProductDto, IMeasuringAttributeValues
{
}
//public interface IMeasuringProductDto : IProductDto, IMeasuringAttributeValues
//{
//}

View File

@ -2,6 +2,6 @@
namespace FruitBank.Common.Interfaces;
public interface IProductDto : IMgProductDto, IMeasurable, ITare, IIncomingQuantity, IMeasuringNetWeight
public interface IProductDto : IMgProductDto, ITare, IIncomingQuantity, IMeasuringAttributeValues
{
}

View File

@ -18,6 +18,7 @@ public interface IShippingDocument: IEntityInt, ITimeStampInfo//, IMeasured
public bool IsAllMeasured { get; set; }
public string Comment { get; set; }
public Partner? Partner { get; set; }
public Shipping? Shipping{ get; set; }
public List<ShippingItem>? ShippingItems { get; set; }

View File

@ -152,21 +152,41 @@ namespace FruitBankHybrid.Shared.Tests
Assert.IsTrue(shippingItems.All(si => si.ProductDto?.Id == si.ProductId), "shippingItem.Product == null");
Assert.IsTrue(shippingItems.All(x => x.ShippingItemPallets!.Where(sp => sp.IsMeasured).Sum(sp => sp.GrossWeight) == x.MeasuredGrossWeight));
Assert.IsTrue(shippingItems.All(x => x.ShippingItemPallets!.Where(sp => sp.IsMeasured).Sum(sp => sp.NetWeight) == x.MeasuredNetWeight));
Assert.IsTrue(shippingItems.All(x => double.Round(x.ShippingItemPallets!.Where(sp => sp.IsMeasured).Sum(sp => sp.GrossWeight), 1) == x.MeasuredGrossWeight));
Assert.IsTrue(shippingItems.All(x => double.Round(x.ShippingItemPallets!.Where(sp => sp.IsMeasured).Sum(sp => sp.NetWeight), 1) == x.MeasuredNetWeight));
foreach (var shippingItem in shippingItems.ToList())
await ValidateProductValues(shippingItems.Where(si => si.ProductId.GetValueOrDefault(0) > 0).GroupBy(x => x.ProductId!.Value, si => si).ToDictionary(k => k.Key, v => v.ToList()));
var rnd = new Random();
foreach (var shippingItem in shippingItems)
{
var measuringProductDto = await _signalRClient.GetMeasuringProductDtoById(shippingItem.ProductId!.Value);
await UpdateShippingItemAsync(shippingItem.Id, rnd.Next(-10, 10), rnd.NextDouble() + rnd.Next(-3, 3), rnd.NextDouble() + rnd.Next(-5, 5), rnd.NextDouble() + rnd.Next(-1, 1));
}
Assert.IsTrue(measuringProductDto!.Quantity == shippingItem.ProductDto!.StockQuantity);
var shippingItemSumQnty = shippingItems.Where(x => x.IsMeasured && x.Id == shippingItem.Id).Sum(x => x.MeasuredQuantity);
Assert.IsTrue(shippingItemSumQnty == measuringProductDto.Quantity, $"{shippingItem}; shippingItemSum Quantity: {shippingItemSumQnty} == {measuringProductDto.Quantity}");
shippingItems = await _signalRClient.GetShippingItems();
Assert.IsNotNull(shippingItems);
var shippingItemSumWeight = shippingItems.Where(x => x.IsMeasured && x.Id == shippingItem.Id).Sum(x => x.MeasuredNetWeight);
Assert.IsTrue(shippingItemSumWeight == measuringProductDto!.NetWeight, $"{shippingItem}; shippingItemSum NetWeight: {shippingItemSumWeight} == {measuringProductDto.NetWeight}");
await ValidateProductValues(shippingItems.Where(si => si.ProductId.GetValueOrDefault(0) > 0).GroupBy(x => x.ProductId!.Value, si => si).ToDictionary(k => k.Key, v => v.ToList()));
}
shippingItemSumWeight = shippingItems.Where(x => x.IsMeasured && x.Id == shippingItem.Id).Sum(x => x.MeasuredGrossWeight);
private async Task ValidateProductValues(Dictionary<int, List<ShippingItem>> shippingItemsByProductId)
{
foreach (var (key, shippingItems) in shippingItemsByProductId)
{
var productDto = await _signalRClient.GetProductDtoById(key);
Assert.IsNotNull(productDto);
Assert.IsTrue(shippingItems.Where(si => si.ProductId == productDto.Id).All(si => si.ProductDto!.StockQuantity == productDto.StockQuantity));
var shippingItemSumQnty = shippingItems.Where(x => x.IsMeasured && x.ProductId == productDto.Id).Sum(x => x.MeasuredQuantity);
Assert.IsTrue(shippingItemSumQnty == productDto.StockQuantity, $"{productDto}; shippingItemSum Quantity: {shippingItemSumQnty} == {productDto.StockQuantity}");
if (!productDto.IsMeasurable) continue;
var shippingItemSumWeight = double.Round(shippingItems.Where(x => x.IsMeasured && x.ProductId == productDto.Id).Sum(x => x.MeasuredNetWeight), 1);
Assert.IsTrue(shippingItemSumWeight == productDto!.NetWeight, $"{productDto}; shippingItemSum NetWeight: {shippingItemSumWeight} == {productDto.NetWeight}");
shippingItemSumWeight = double.Round(shippingItems.Where(x => x.IsMeasured && x.ProductId == productDto.Id).Sum(x => x.MeasuredGrossWeight), 1);
}
}
@ -195,6 +215,7 @@ namespace FruitBankHybrid.Shared.Tests
Assert.IsNotNull(shippingItem, $"shippingItemId: {shippingItemId}");
if (shippingItem.IsMeasurable) Assert.IsNotNull(shippingItem.Pallet, $"shippingItem.Pallet == null; shippingItem.PalletId: {shippingItem.PalletId}");
Assert.IsNotNull(shippingItem.ProductDto, $"shippingItem.Product == null; shippingItem.ProductId: {shippingItem.ProductId}");
Assert.IsTrue(shippingItem.Id == shippingItemId);
@ -206,8 +227,9 @@ namespace FruitBankHybrid.Shared.Tests
}
[DataTestMethod]
[DataRow(1, -1, -2.137563300001, -333.75238200001, 2.12545)]
[DataRow(1, 1, 2.137563300001, 3.75238200001, 2.12545)]
[DataRow(1, 1, 0, 1, 0)]
[DataRow(1, -1, -2.137563300001, -33.75238200001, 2.12545)]
[DataRow(1, 1, 2.137563300001, 390.75238200001, 2.12545)]
[DataRow(1, 1, 20.137563300001, 3.75238200001, 2.12545)]
[DataRow(2, -1, -20.137563300001, 3.75238200001, 2.12545)]
[DataRow(2, -1, 20.137563300001, 3.75238200001, 2.12545)]
@ -218,74 +240,99 @@ namespace FruitBankHybrid.Shared.Tests
[DataRow(5, -1, 2.137563300001, 3.75238200001, 2.12545)]
public async Task UpdateShippingItemTest(int shippingItemId, int incQuantity, double incPalletWeight, double incGrossWeight, double incTare)
{
Assert.IsTrue(true);
return;
await UpdateShippingItemAsync(shippingItemId, incQuantity, incPalletWeight, incGrossWeight, incTare);
}
public async Task UpdateShippingItemAsync(int shippingItemId, int incQuantity, double incPalletWeight, double incGrossWeight, double incTare)
{
Console.WriteLine($"params: {shippingItemId}; {incQuantity}; {incPalletWeight}; {incGrossWeight}; {incTare}");
var originalShippingItem = await GetShippingItemByIdAsync(shippingItemId);
var originalMeasuringProductDto = await GetMeasuringProductDtoByIdAsync(originalShippingItem.ProductId!.Value, originalShippingItem.IsMeasurable);
Console.WriteLine($"{originalShippingItem}");
Assert.IsTrue(originalShippingItem.IsMeasurable == originalMeasuringProductDto.IsMeasurable);
var productDto = await GetProductDtoByIdAsync(originalShippingItem.ProductId!.Value, originalShippingItem.IsMeasurable);
Assert.IsTrue(originalShippingItem.IsMeasurable == productDto.IsMeasurable);
Console.WriteLine($"{productDto}; NetWeight: {productDto.NetWeight}");
var shippingItem = await GetShippingItemByIdAsync(shippingItemId);
var shippingItemPallet = originalShippingItem.ShippingItemPallets!.FirstOrDefault();
var originalShippingItemPallet = shippingItem.ShippingItemPallets!.FirstOrDefault();
if (originalShippingItemPallet == null)
if (shippingItemPallet == null)
{
originalShippingItemPallet = new ShippingItemPallet { ShippingItemId = shippingItem.Id, PalletWeight = shippingItem.Pallet?.Weight ?? 0 };
shippingItem.ShippingItemPallets!.Add(originalShippingItemPallet);
}
Assert.IsNotNull(originalShippingItemPallet);
var nullResultIsValid = shippingItem.IsMeasured && !shippingItem.IsValidMeasuringValues();
nullResultIsValid = nullResultIsValid || shippingItem.ShippingItemPallets!.Any(x => !x.IsValidMeasuringValues(originalMeasuringProductDto.IsMeasurable));
nullResultIsValid = nullResultIsValid || shippingItem.ShippingItemPallets!.Any(x => !x.IsValidSafeMeasuringValues());
originalShippingItemPallet.TrayQuantity += incQuantity;
originalShippingItemPallet.GrossWeight += incGrossWeight;
originalShippingItemPallet.PalletWeight += incPalletWeight;
originalShippingItemPallet.TareWeight += incTare;
//shippingItem = await _signalRClient.UpdateShippingItem(shippingItem);
var shippingItemPallet = await _signalRClient.UpdateShippingItemPallet(originalShippingItemPallet);
//A szerver oldal 0-ra állítja a shippingItemPallet weight-eket, ha nem mérhető! - J.
if (!originalMeasuringProductDto.IsMeasurable)
{
originalShippingItemPallet.GrossWeight = 0;
originalShippingItemPallet.PalletWeight = 0;
originalShippingItemPallet.TareWeight = 0;
}
if (nullResultIsValid || !originalShippingItemPallet.IsValidSafeMeasuringValues())
{
Assert.IsNull(shippingItemPallet);
return;
shippingItemPallet = new ShippingItemPallet { ShippingItemId = originalShippingItem.Id, PalletWeight = originalShippingItem.Pallet?.Weight ?? 0 };
originalShippingItem.ShippingItemPallets!.Add(shippingItemPallet);
}
Assert.IsNotNull(shippingItemPallet);
Assert.IsTrue(shippingItemPallet.TareWeight == originalShippingItemPallet.TareWeight);
Assert.IsTrue(shippingItemPallet.TrayQuantity == originalShippingItemPallet.TrayQuantity);
Assert.IsTrue(shippingItemPallet.GrossWeight == originalShippingItemPallet.GrossWeight);
Assert.IsTrue(shippingItemPallet.PalletWeight == originalShippingItemPallet.PalletWeight);
Assert.IsTrue(shippingItemPallet.ShippingItemId == originalShippingItemPallet.ShippingItemId);
shippingItem = await _signalRClient.GetShippingItemById(shippingItemPallet.ShippingItemId);
var nullResultIsValid = originalShippingItem.IsMeasured && !originalShippingItem.IsValidMeasuringValues();
nullResultIsValid = nullResultIsValid || originalShippingItem.ShippingItemPallets!.Any(x => !x.IsValidMeasuringValues(productDto.IsMeasurable));
nullResultIsValid = nullResultIsValid || originalShippingItem.ShippingItemPallets!.Any(x => !x.IsValidSafeMeasuringValues());
var originalPalletNetWeight = shippingItemPallet.NetWeight;
shippingItemPallet.TrayQuantity += incQuantity;
shippingItemPallet.GrossWeight += incGrossWeight;
shippingItemPallet.PalletWeight += incPalletWeight;
shippingItemPallet.TareWeight += incTare;
var incNetWeight = productDto.IsMeasurable ? double.Round(shippingItemPallet.NetWeight - originalPalletNetWeight, 1) : 0;
//shippingItem = await _signalRClient.UpdateShippingItem(shippingItem);
var dbShippingItemPallet = await _signalRClient.UpdateShippingItemPallet(shippingItemPallet);
//A szerver oldal 0-ra állítja a shippingItemPallet weight-eket, ha nem mérhető! - J.
if (!productDto.IsMeasurable)
{
shippingItemPallet.GrossWeight = 0;
shippingItemPallet.PalletWeight = 0;
shippingItemPallet.TareWeight = 0;
}
if (nullResultIsValid || !shippingItemPallet.IsValidSafeMeasuringValues())
{
Assert.IsNull(dbShippingItemPallet);
return;
}
Assert.IsNotNull(dbShippingItemPallet);
Assert.IsTrue(dbShippingItemPallet.TareWeight == shippingItemPallet.TareWeight);
Assert.IsTrue(dbShippingItemPallet.TrayQuantity == shippingItemPallet.TrayQuantity);
Assert.IsTrue(dbShippingItemPallet.GrossWeight == shippingItemPallet.GrossWeight);
Assert.IsTrue(dbShippingItemPallet.PalletWeight == shippingItemPallet.PalletWeight);
Assert.IsTrue(dbShippingItemPallet.ShippingItemId == shippingItemPallet.ShippingItemId);
Assert.IsTrue(dbShippingItemPallet.NetWeight == double.Round(originalPalletNetWeight + incNetWeight, 1));
var shippingItem = await _signalRClient.GetShippingItemById(dbShippingItemPallet.ShippingItemId);
Assert.IsNotNull(shippingItem);
Assert.IsNotNull(shippingItem.ProductDto);
Assert.IsNotNull(shippingItem.ShippingItemPallets);
Assert.IsTrue(shippingItem.IsMeasurable == originalMeasuringProductDto.IsMeasurable);
incGrossWeight = originalMeasuringProductDto.IsMeasurable ? double.Round(incGrossWeight, 1) : 0;
var incNetWeight = originalMeasuringProductDto.IsMeasurable ? double.Round((incGrossWeight - incPalletWeight) - (incQuantity * incTare), 1) : 0;
Assert.IsTrue(shippingItem.IsMeasurable == productDto.IsMeasurable);
//var incNetWeight = productDto.IsMeasurable ? double.Round(dbShippingItemPallet.NetWeight - originalPalletNetWeight, 1) : 0;
incGrossWeight = productDto.IsMeasurable ? double.Round(incGrossWeight, 1) : 0;
var isMeasuredPalletsCount = shippingItem.ShippingItemPallets!.Count(x => x.IsMeasured);
Assert.IsTrue(shippingItem.MeasuredNetWeight == double.Round(originalShippingItem.MeasuredNetWeight + incNetWeight, 1));
Assert.IsTrue(shippingItem.IsMeasured == (shippingItem.ShippingItemPallets!.All(x => x.IsMeasured) && shippingItem.MeasuringCount == isMeasuredPalletsCount));
if (shippingItem.IsMeasured)
{
Assert.IsTrue(shippingItem.IsValidMeasuringValues());
Assert.IsTrue(shippingItem.MeasuringCount == isMeasuredPalletsCount);
Assert.IsTrue(shippingItem.ProductDto.StockQuantity == originalShippingItem.ProductDto!.StockQuantity + incQuantity);
Assert.IsTrue(shippingItem.ProductDto.IncomingQuantity == productDto.IncomingQuantity - incQuantity);
var dbProductDto = await GetProductDtoByIdAsync(originalShippingItem.ProductId!.Value, shippingItem.IsMeasurable);
Assert.IsTrue(dbProductDto.StockQuantity == productDto.StockQuantity + incQuantity);
Assert.IsTrue(dbProductDto.IncomingQuantity == productDto.IncomingQuantity - incQuantity);
Assert.IsTrue(dbProductDto.NetWeight == double.Round(productDto.NetWeight + (shippingItem.IsMeasurable ? incNetWeight : 0), 1));
}
else
{
@ -297,13 +344,7 @@ namespace FruitBankHybrid.Shared.Tests
}
Assert.IsTrue(shippingItem.MeasuredQuantity == originalShippingItem.MeasuredQuantity + incQuantity);
Assert.IsTrue(shippingItem.ProductDto.StockQuantity == originalShippingItem.ProductDto!.StockQuantity + incQuantity);
var measuringProductDto = await GetMeasuringProductDtoByIdAsync(originalShippingItem.ProductId!.Value, shippingItem.IsMeasurable);
Assert.IsTrue(measuringProductDto.StockQuantity == originalMeasuringProductDto.StockQuantity + incQuantity);
Assert.IsTrue(measuringProductDto.NetWeight == double.Round(originalMeasuringProductDto.NetWeight + (shippingItem.IsMeasurable ? incNetWeight : 0), 1));
Assert.IsTrue(shippingItem.ShippingItemPallets!.All(x => x.IsValidSafeMeasuringValues()));
Assert.IsTrue(shippingItem.ShippingItemPallets!.All(x => x.IsValidMeasuringValues(shippingItem.IsMeasurable)));
@ -402,23 +443,11 @@ namespace FruitBankHybrid.Shared.Tests
[TestMethod]
public async Task GetProductDtosTest()
{
var productDto = await _signalRClient.GetProductDtos();
var productDtos = await _signalRClient.GetProductDtos();
Assert.IsNotNull(productDto);
Assert.IsTrue(productDto.Count != 0);
Assert.IsTrue(productDto.All(x => !x.Name.IsNullOrEmpty() && !x.Deleted));
}
[TestMethod]
public async Task GetAllMeasuringProductDtosTest()
{
var measuringProductDtos = await _signalRClient.GetAllMeasuringProductDtos();
Assert.IsNotNull(measuringProductDtos);
Assert.IsTrue(measuringProductDtos.Count != 0);
Assert.IsTrue(measuringProductDtos.All(x => !x.Name.IsNullOrEmpty() && !x.Deleted));
//Assert.IsTrue(measuringProductDtos.All(x => !x.IsMeasurable || x.HasMeasuringValues()));
Assert.IsNotNull(productDtos);
Assert.IsTrue(productDtos.Count != 0);
Assert.IsTrue(productDtos.All(x => !x.Name.IsNullOrEmpty() && !x.Deleted));
}
[TestMethod]
@ -428,32 +457,169 @@ namespace FruitBankHybrid.Shared.Tests
[DataRow(33, true)]
[DataRow(64, false)]
[DataRow(7, false)]
public async Task GetMeasuringProductDtoByIdTest(int productId, bool isMeasurableExcepted)
public async Task GetProductDtoByIdTest(int productId, bool isMeasurableExcepted)
{
await GetMeasuringProductDtoByIdAsync(productId, isMeasurableExcepted);
await GetProductDtoByIdAsync(productId, isMeasurableExcepted);
}
public async Task<MeasuringProductDto> GetMeasuringProductDtoByIdAsync(int productId, bool isMeasurableExcepted)
public async Task<ProductDto> GetProductDtoByIdAsync(int productId, bool isMeasurableExcepted)
{
var measuringProductDto = await _signalRClient.GetMeasuringProductDtoById(productId);
var productDto = await _signalRClient.GetProductDtoById(productId);
Assert.IsNotNull(measuringProductDto);
Assert.IsNotNull(productDto);
if (isMeasurableExcepted) Assert.IsTrue(measuringProductDto.HasMeasuringValues(), $"{measuringProductDto.IsMeasurable}, {measuringProductDto.NetWeight}");
if (isMeasurableExcepted) Assert.IsTrue(productDto.HasMeasuringValues(), $"{productDto.IsMeasurable}, {productDto.NetWeight}");
else
{
Assert.IsTrue(measuringProductDto.Id > 0);
Assert.IsTrue(measuringProductDto.StockQuantity >= 0);
Assert.IsTrue(measuringProductDto.NetWeight == 0);
Assert.IsTrue(productDto.Id > 0);
Assert.IsTrue(productDto.StockQuantity >= 0);
Assert.IsTrue(productDto.NetWeight == 0);
Assert.IsFalse(measuringProductDto.IsMeasurable);
Assert.IsFalse(productDto.IsMeasurable);
}
return measuringProductDto;
return productDto;
}
#endregion Product
#region OrderItem
//[return: NotNull]
//public async Task<ShippingItem> GetOrderDtoByIdAsync(int orderId)
//{
// var orderDto = await _signalRClient.GetOrderDtoById(orderId);
// Assert.IsNotNull(orderDto, $"orderDto: {orderId}");
// if (orderDto.IsMeasurable) Assert.IsNotNull(orderDto.Pallet, $"orderDto.Pallet == null; orderDto.PalletId: {orderDto.PalletId}");
// Assert.IsNotNull(orderDto.ProductDto, $"orderDto.Product == null; orderDto.ProductId: {orderDto.ProductId}");
// Assert.IsTrue(orderDto.Id == orderId);
// Assert.IsTrue(orderDto.QuantityOnDocument > 0, "QuantityOnDocument == 0");
// Assert.IsTrue(orderDto.NetWeightOnDocument > 0, "NetWeightOnDocument == 0");
// Assert.IsTrue(orderDto.GrossWeightOnDocument > 0, "GrossWeightOnDocument == 0");
// return orderDto;
//}
//[DataTestMethod]
//[DataRow(1, -1, -2.137563300001, -333.75238200001, 2.12545)]
//[DataRow(1, 1, 2.137563300001, 3.75238200001, 2.12545)]
//[DataRow(1, 1, 20.137563300001, 3.75238200001, 2.12545)]
//[DataRow(2, -1, -20.137563300001, 3.75238200001, 2.12545)]
//[DataRow(2, -1, 20.137563300001, 3.75238200001, 2.12545)]
//[DataRow(3, 1, 2.137563300001, 1.75238200001, 2.12545)]
//[DataRow(3, 1, 2.137563300001, 3.75238200001, 2.12545)]
//[DataRow(4, 13, 2.137563300001, 3.75238200001, 2.12545)]
//[DataRow(5, 1, 2.137563300001, 3.75238200001, 2.12545)]
//[DataRow(5, -1, 2.137563300001, 3.75238200001, 2.12545)]
//public async Task UpdateOrderItemTest(int shippingItemId, int incQuantity, double incPalletWeight, double incGrossWeight, double incTare)
//{
// Assert.IsTrue(true);
// return;
// await UpdateOrderItemAsync(shippingItemId, incQuantity, incPalletWeight, incGrossWeight, incTare);
//}
//public async Task UpdateOrderItemAsync(int shippingItemId, int incQuantity, double incPalletWeight, double incGrossWeight, double incTare)
//{
//var originalShippingItem = await GetShippingItemByIdAsync(shippingItemId);
// var productDto = await GetProductDtoByIdAsync(originalShippingItem.ProductId!.Value, originalShippingItem.IsMeasurable);
// Assert.IsTrue(originalShippingItem.IsMeasurable == productDto.IsMeasurable);
// var shippingItem = await GetShippingItemByIdAsync(shippingItemId);
// var shippingItemPallet = shippingItem.ShippingItemPallets!.FirstOrDefault();
// if (shippingItemPallet == null)
// {
// shippingItemPallet = new ShippingItemPallet { ShippingItemId = shippingItem.Id, PalletWeight = shippingItem.Pallet?.Weight ?? 0 };
// shippingItem.ShippingItemPallets!.Add(shippingItemPallet);
// }
// Assert.IsNotNull(shippingItemPallet);
// var nullResultIsValid = shippingItem.IsMeasured && !shippingItem.IsValidMeasuringValues();
// nullResultIsValid = nullResultIsValid || shippingItem.ShippingItemPallets!.Any(x => !x.IsValidMeasuringValues(productDto.IsMeasurable));
// nullResultIsValid = nullResultIsValid || shippingItem.ShippingItemPallets!.Any(x => !x.IsValidSafeMeasuringValues());
// shippingItemPallet.TrayQuantity += incQuantity;
// shippingItemPallet.GrossWeight += incGrossWeight;
// shippingItemPallet.PalletWeight += incPalletWeight;
// shippingItemPallet.TareWeight += incTare;
// //shippingItem = await _signalRClient.UpdateShippingItem(shippingItem);
// var dbShippingItemPallet = await _signalRClient.UpdateShippingItemPallet(shippingItemPallet);
// //A szerver oldal 0-ra állítja a shippingItemPallet weight-eket, ha nem mérhető! - J.
// if (!productDto.IsMeasurable)
// {
// shippingItemPallet.GrossWeight = 0;
// shippingItemPallet.PalletWeight = 0;
// shippingItemPallet.TareWeight = 0;
// }
// if (nullResultIsValid || !shippingItemPallet.IsValidSafeMeasuringValues())
// {
// Assert.IsNull(dbShippingItemPallet);
// return;
// }
// Assert.IsNotNull(dbShippingItemPallet);
// Assert.IsTrue(dbShippingItemPallet.TareWeight == shippingItemPallet.TareWeight);
// Assert.IsTrue(dbShippingItemPallet.TrayQuantity == shippingItemPallet.TrayQuantity);
// Assert.IsTrue(dbShippingItemPallet.GrossWeight == shippingItemPallet.GrossWeight);
// Assert.IsTrue(dbShippingItemPallet.PalletWeight == shippingItemPallet.PalletWeight);
// Assert.IsTrue(dbShippingItemPallet.ShippingItemId == shippingItemPallet.ShippingItemId);
// shippingItem = await _signalRClient.GetShippingItemById(dbShippingItemPallet.ShippingItemId);
// Assert.IsNotNull(shippingItem);
// Assert.IsNotNull(shippingItem.ProductDto);
// Assert.IsNotNull(shippingItem.ShippingItemPallets);
// Assert.IsTrue(shippingItem.IsMeasurable == productDto.IsMeasurable);
// incGrossWeight = productDto.IsMeasurable ? double.Round(incGrossWeight, 1) : 0;
// var incNetWeight = productDto.IsMeasurable ? double.Round((incGrossWeight - incPalletWeight) - (incQuantity * incTare), 1) : 0;
// var isMeasuredPalletsCount = shippingItem.ShippingItemPallets!.Count(x => x.IsMeasured);
// Assert.IsTrue(shippingItem.IsMeasured == (shippingItem.ShippingItemPallets!.All(x => x.IsMeasured) && shippingItem.MeasuringCount == isMeasuredPalletsCount));
// if (shippingItem.IsMeasured)
// {
// Assert.IsTrue(shippingItem.IsValidMeasuringValues());
// Assert.IsTrue(shippingItem.MeasuringCount == isMeasuredPalletsCount);
// Assert.IsTrue(shippingItem.ProductDto.StockQuantity == originalShippingItem.ProductDto!.StockQuantity + incQuantity);
// Assert.IsTrue(shippingItem.ProductDto.IncomingQuantity == productDto.IncomingQuantity - incQuantity);
// var dbProductDto = await GetProductDtoByIdAsync(originalShippingItem.ProductId!.Value, shippingItem.IsMeasurable);
// Assert.IsTrue(dbProductDto.StockQuantity == productDto.StockQuantity + incQuantity);
// Assert.IsTrue(dbProductDto.IncomingQuantity == productDto.IncomingQuantity - incQuantity);
// Assert.IsTrue(dbProductDto.NetWeight == double.Round(productDto.NetWeight + (shippingItem.IsMeasurable ? incNetWeight : 0), 1));
// }
// else
// {
// incQuantity = 0;
// incNetWeight = 0;
// incGrossWeight = 0;
// Assert.IsTrue(shippingItem.MeasuringCount > isMeasuredPalletsCount);
// }
// Assert.IsTrue(shippingItem.MeasuredQuantity == originalShippingItem.MeasuredQuantity + incQuantity);
// Assert.IsTrue(shippingItem.ShippingItemPallets!.All(x => x.IsValidSafeMeasuringValues()));
// Assert.IsTrue(shippingItem.ShippingItemPallets!.All(x => x.IsValidMeasuringValues(shippingItem.IsMeasurable)));
// Assert.IsTrue(shippingItem.MeasuredNetWeight == double.Round(originalShippingItem.MeasuredNetWeight + (shippingItem.IsMeasurable ? incNetWeight : 0), 1));
// Assert.IsTrue(shippingItem.MeasuredGrossWeight == double.Round(originalShippingItem.MeasuredGrossWeight + (shippingItem.IsMeasurable ? incGrossWeight : 0), 1));
//}
#endregion OrderItem
#region Login
[TestMethod]
[DataRow("aasd@dsserver.com", "Asdasd123456")]

View File

@ -46,30 +46,30 @@
</ItemGroup>
<ItemGroup>
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="17.14.1" />
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="18.0.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Update="Microsoft.Testing.Extensions.CodeCoverage" Version="17.14.2" />
<PackageReference Update="Microsoft.Testing.Extensions.CodeCoverage" Version="18.1.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Update="Microsoft.Testing.Extensions.TrxReport" Version="1.8.4" />
<PackageReference Update="Microsoft.Testing.Extensions.TrxReport" Version="2.0.1" />
</ItemGroup>
<ItemGroup>
<PackageReference Update="MSTest.Analyzers" Version="3.10.4">
<PackageReference Update="MSTest.Analyzers" Version="4.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<PackageReference Update="MSTest.TestAdapter" Version="3.10.4" />
<PackageReference Update="MSTest.TestAdapter" Version="4.0.1" />
</ItemGroup>
<ItemGroup>
<PackageReference Update="MSTest.TestFramework" Version="3.10.4" />
<PackageReference Update="MSTest.TestFramework" Version="4.0.1" />
</ItemGroup>
</Project>

View File

@ -19,12 +19,12 @@
<DxFormLayoutItem Context="ctxFromLayoutItemPallet" CaptionCssClass="@(GetOrderItemPalletsCssClassNames(nameof(IMeasuringItemPalletBase.PalletWeight)))"
Field="@nameof(ShippingItemPallet.PalletWeight)"
Enabled="@(IsMeasurable && ProductId > 0)"
Caption="Rakl.súly(kg)" ColSpanMd="2" />
Caption="Rakl.súly(kg)" ColSpanMd="2"@ref="_weightFormLayoutItem" />
<DxFormLayoutItem Context="ctxFromLayoutItemPallet" CaptionCssClass="@(GetOrderItemPalletsCssClassNames(nameof(IMeasuringItemPalletBase.TareWeight)))"
Field="@nameof(ShippingItemPallet.TareWeight)"
Enabled="@(IsMeasurable && ProductId > 0)"
Caption="Tára(kg)" ColSpanMd="2" />
Caption="Tára(kg)" ColSpanMd="2" />
<DxFormLayoutItem Context="ctxFromLayoutItemPallet" ColSpanMd="1" />
<DxFormLayoutItem Context="ctxFromLayoutItemPallet" CaptionCssClass="@(GetOrderItemPalletsCssClassNames(nameof(IMeasuringItemPalletBase.TrayQuantity)))"
@ -63,11 +63,14 @@
[Inject] public required FruitBankSignalRClient FruitBankSignalRClient { get; set; }
[Inject] public required LoggedInModel LoggedInModel { get; set; }
private DxFormLayoutItem _weightFormLayoutItem;
public bool _btnSaveEnabled { get; set; }
protected override async Task OnInitializedAsync()
{
_btnSaveEnabled = PalletItem.IsValidMeasuringValues(IsMeasurable) && !PalletItem.IsMeasured;
//((DxSpinEdit<double>)_weightFormLayoutItem.Template.Target).DisplayFormat = "N3";
await base.OnInitializedAsync();
}

View File

@ -14,8 +14,8 @@
<PackageReference Include="DevExpress.Blazor" Version="25.1.3" />
<PackageReference Include="MessagePack" Version="3.1.4" />
<PackageReference Include="MessagePack.Annotations" Version="3.1.4" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="9.0.9" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="9.0.9" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="9.0.10" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="9.0.10" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
</ItemGroup>

View File

@ -54,8 +54,8 @@
</ItemDisplayTemplate>
</DxComboBox>
</DxFormLayoutItem>
<DxFormLayoutItem Caption="Partner:" ColSpanMd="3" CaptionCssClass="@(SelectedShippingDocument?.IsAllMeasured == true ? "text-success" : "")">
@* <DxFormLayoutItem Caption="Partner:" ColSpanMd="3" CaptionCssClass="@(SelectedShippingDocument?.IsAllMeasured == true ? "text-success" : "")">
<DxComboBox Data="@SelectedShipping?.ShippingDocuments"
@bind-Value="@SelectedShippingDocument"
Text="Select partner"
@ -71,14 +71,21 @@
</ItemDisplayTemplate>
</DxComboBox>
</DxFormLayoutItem>
*@
<DxFormLayoutItem Caption="Termék:" ColSpanMd="5" CaptionCssClass="@(SelectedShippingItem?.IsMeasured == true ? "text-success" : "")">
<DxComboBox Data="@SelectedShippingDocument?.ShippingItems"
<DxComboBox Data="@_shippingItemsDataSource"
@bind-Value="@SelectedShippingItem"
Text="Select item"
ValueFieldName="@nameof(ShippingItem.Id)"
TextFieldName="@(nameof(ShippingItem.Name))"
CssClass="cw-480"
SearchMode="ListSearchMode.AutoSearch"
SearchFilterCondition="ListSearchFilterCondition.Contains"
SearchTextParseMode="ListSearchTextParseMode.GroupWordsByAnd"
ClearButtonDisplayMode="DataEditorClearButtonDisplayMode.Auto"
DropDownTriggerMode="DropDownTriggerMode.Click"
ListRenderMode="ListRenderMode.Entire"
ShowDropDownButton="false"
DropDownBodyCssClass="dd-body-class"
Context="ctxShippingitem"
SelectedDataItemChanged="@((SelectedDataItemChangedEventArgs<ShippingItem> args) => OnSelectedShippingItemChanged(args))"
@ -96,11 +103,26 @@
</ItemDisplayTemplate>
</DxComboBox>
</DxFormLayoutItem>
<DxFormLayoutItem Caption="Partner:" ColSpanMd="3" CaptionCssClass="@(SelectedShippingItem?.ShippingDocument?.IsAllMeasured == true ? "text-success" : "")">
@{
var sd = SelectedShippingItem?.ShippingDocument;
if (sd != null)
{
var partnerName = sd.Partner?.Name;
<span class="@(sd.IsAllMeasured == true ? " text-success" : "")">
@($"{partnerName}, {sd.ShippingItems?.Count(si => si.IsMeasured) ?? 0}/{sd.ShippingItems?.Count ?? 0} kész.")
</span>
}
}
</DxFormLayoutItem>
</DxFormLayout>
</div>
<div style="margin-top: 50px;">
@if (SelectedShippingItem != null && SelectedShippingItem.ProductId.GetValueOrDefault(0) > 0)
@if (SelectedShippingItem is { ProductId: > 0 })
{
<h3 style="margin-bottom: 30px;" class="@(SelectedShippingItem.IsMeasured && SelectedShippingItem.ShippingItemPallets!.All(x => x.IsMeasuredAndValid(SelectedShippingItem.IsMeasurable)) ? "text-success" : "")">
@SelectedShippingItem.Name

View File

@ -26,11 +26,12 @@ namespace FruitBankHybrid.Shared.Pages
private List<Shipping> NotMeasuredShippings { get; set; } = null!;
private Shipping? SelectedShipping { get; set; }
private ShippingDocument? SelectedShippingDocument { get; set; }
//private ShippingDocument? SelectedShippingDocument { get; set; }
private ShippingItem? SelectedShippingItem { get; set; }
protected bool BtnSaveEnabled { get; set; }
private List<ShippingItem>? _shippingItemsDataSource;
private List<MeasuringDateSelectorModel> _measuringDates = null!;
protected override async Task OnInitializedAsync()
@ -52,6 +53,9 @@ namespace FruitBankHybrid.Shared.Pages
SelectedShipping = NotMeasuredShippings.FirstOrDefault();
}
private static List<ShippingItem>? GetShippingItemsDataSource(Shipping? shipping)
=> shipping?.ShippingDocuments?.SelectMany(sd => sd.ShippingItems!).OrderBy(si => si.Name).ToList() ?? null;
private async Task OnMeasuringDateChanged(DateTime selectedDateTime)
=> await RefreshShippingsFromDb(selectedDateTime);
@ -67,12 +71,12 @@ namespace FruitBankHybrid.Shared.Pages
private void OnSelectedShippingChanged(SelectedDataItemChangedEventArgs<Shipping> eventArgs)
{
SelectedShippingDocument = eventArgs.DataItem?.ShippingDocuments?.FirstOrDefault();
}
var shipping = eventArgs.DataItem;
private void OnSelectedShippingDocumentChanged(SelectedDataItemChangedEventArgs<ShippingDocument> eventArgs)
{
SelectedShippingItem = eventArgs.DataItem?.ShippingItems?.FirstOrDefault();
PrepareShippingItems(shipping);
_shippingItemsDataSource = GetShippingItemsDataSource(shipping);
SelectedShippingItem = _shippingItemsDataSource?.FirstOrDefault();
}
private void OnSelectedShippingItemChanged(SelectedDataItemChangedEventArgs<ShippingItem> eventArgs)
@ -86,31 +90,14 @@ namespace FruitBankHybrid.Shared.Pages
return;
}
SelectedShippingDocument!.IsAllMeasured = SelectedShippingDocument.ShippingItems?.All(si => si.IsMeasured) ?? false;
//SelectedShippingDocument!.IsAllMeasured = SelectedShippingDocument.ShippingItems?.All(si => si.IsMeasured) ?? false;
shippingItem.ShippingDocument!.IsAllMeasured = shippingItem.ShippingDocument.ShippingItems?.All(si => si.IsMeasured) ?? false;
SelectedShipping!.IsAllMeasured = SelectedShipping.ShippingDocuments?.All(sd => sd.IsAllMeasured) ?? false;
var shippingDate = _measuringDates.FirstOrDefault(shipping => shipping.ShippingId == SelectedShipping.Id);
if (shippingDate != null) shippingDate.IsMeasured = SelectedShipping.IsAllMeasured;
MeasuringValuesHelper.SetShippingItemTotalMeasuringValues(shippingItem);
//_logger.Info($"{shippingItem.ProductDto?.Tare}");
shippingItem.ShippingItemPallets ??= new List<ShippingItemPallet>(shippingItem.PalletsOnDocument);
//if (shippingItem.ShippingItemPallets.Count >= shippingItem.PalletsOnDocument) return;
for (var i = shippingItem.ShippingItemPallets.Count; i < shippingItem.PalletsOnDocument; i++)
shippingItem.ShippingItemPallets.Add(new ShippingItemPallet
{
ShippingItemId = shippingItem.Id,
PalletWeight = shippingItem.Pallet?.Weight ?? 0,
TareWeight = shippingItem.ProductDto?.Tare?? 0,
CreatorId = LoggedInModel.CustomerDto?.Id,
ModifierId = LoggedInModel.CustomerDto?.Id
});
//if (shippingItem.Id == SelectedShippingItem?.Id) return;
//await RefreshSelectedShippingItemMeasuredValuesFromDb(shippingItem.Id);
//PrepareShippingItems(SelectedShipping);
}
private async Task RefreshSelectedShippingItemMeasuredValuesFromDb(int shippingItemId)
@ -120,7 +107,7 @@ namespace FruitBankHybrid.Shared.Pages
private void RefreshSelectedShippingItemMeasuredValuesFromDb(ShippingItem? shippingItemFromDb)
{
if (SelectedShipping == null || SelectedShippingDocument == null || shippingItemFromDb == null) return;
if (SelectedShipping == null || SelectedShippingItem?.ShippingDocument == null || shippingItemFromDb == null) return;
//SelectedShippingItem.MeasuredQuantity = shippingItemFromDb.MeasuredQuantity;
//SelectedShippingItem.MeasuredNetWeight = shippingItemFromDb.MeasuredNetWeight;
@ -128,7 +115,9 @@ namespace FruitBankHybrid.Shared.Pages
//SelectedShippingItem.IsMeasurable = shippingItemFromDb.IsMeasurable;
//SelectedShippingItem.IsMeasured = shippingItemFromDb.IsMeasured;
SelectedShippingDocument.ShippingItems!.UpdateCollection(shippingItemFromDb, false);
SelectedShippingItem.ShippingDocument.ShippingItems?.UpdateCollection(shippingItemFromDb, false);
_shippingItemsDataSource?.UpdateCollection(shippingItemFromDb, false);
SelectedShippingItem = shippingItemFromDb;
StateHasChanged();
@ -171,5 +160,36 @@ namespace FruitBankHybrid.Shared.Pages
//Nem végezhető el a mérés, nincs megadva a ProductId! Jelezze a vezetőségnek...
}
private void PrepareShippingItems(Shipping? shipping)
{
if (shipping?.ShippingDocuments == null) return;
foreach (var shippingShippingDocument in shipping.ShippingDocuments)
{
shippingShippingDocument.Shipping = shipping;
if (shippingShippingDocument.ShippingItems == null) continue;
foreach (var shippingItem in shippingShippingDocument.ShippingItems)
{
shippingItem.ShippingDocument = shippingShippingDocument;
MeasuringValuesHelper.SetShippingItemTotalMeasuringValues(shippingItem);
shippingItem.ShippingItemPallets ??= new List<ShippingItemPallet>(shippingItem.MeasuringCount);
for (var i = shippingItem.ShippingItemPallets.Count; i < shippingItem.MeasuringCount; i++)
{
shippingItem.ShippingItemPallets.Add(new ShippingItemPallet
{
ShippingItemId = shippingItem.Id,
PalletWeight = shippingItem.Pallet?.Weight ?? 0,
TareWeight = shippingItem.ProductDto?.Tare ?? 0,
CreatorId = LoggedInModel.CustomerDto?.Id,
ModifierId = LoggedInModel.CustomerDto?.Id
});
}
}
}
}
}
}

View File

@ -111,11 +111,11 @@ namespace FruitBankHybrid.Shared.Services.SignalRs
public Task<List<ProductDto>?> GetProductDtos()
=> GetAllAsync<List<ProductDto>>(SignalRTags.GetProductDtos);
public Task<List<MeasuringProductDto>?> GetAllMeasuringProductDtos()
=> GetAllAsync<List<MeasuringProductDto>>(SignalRTags.GetAllMeasuringProductDtos);
//public Task<List<MeasuringProductDto>?> GetAllMeasuringProductDtos()
// => GetAllAsync<List<MeasuringProductDto>>(SignalRTags.GetAllMeasuringProductDtos);
public Task<MeasuringProductDto?> GetMeasuringProductDtoById(int productId)
=> GetByIdAsync<MeasuringProductDto?>(SignalRTags.GetMeasuringProductDtoById, productId);
public Task<ProductDto?> GetProductDtoById(int productId)
=> GetByIdAsync<ProductDto?>(SignalRTags.GetMeasuringProductDtoById, productId);
#endregion Product

View File

@ -12,7 +12,7 @@
<PackageReference Include="DevExpress.Blazor" Version="25.1.*" />
<PackageReference Include="MessagePack" Version="3.1.4" />
<PackageReference Include="MessagePack.Annotations" Version="3.1.4" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.9" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.10" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
</ItemGroup>

View File

@ -17,8 +17,8 @@
<PackageReference Include="DevExpress.Blazor" Version="25.1.3" />
<PackageReference Include="MessagePack" Version="3.1.4" />
<PackageReference Include="MessagePack.Annotations" Version="3.1.4" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="9.0.9" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="9.0.9" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="9.0.10" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="9.0.10" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
</ItemGroup>

View File

@ -1,89 +1,94 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<TargetFrameworks>net9.0-android;net9.0-ios</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net9.0-windows10.0.19041.0</TargetFrameworks>
<PropertyGroup>
<TargetFrameworks>net9.0-android;net9.0-ios</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net9.0-windows10.0.19041.0</TargetFrameworks>
<OutputType>Exe</OutputType>
<RootNamespace>FruitBankHybrid</RootNamespace>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>
<EnableDefaultCssItems>false</EnableDefaultCssItems>
<Nullable>enable</Nullable>
<OutputType>Exe</OutputType>
<RootNamespace>FruitBankHybrid</RootNamespace>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>
<EnableDefaultCssItems>false</EnableDefaultCssItems>
<Nullable>enable</Nullable>
<!-- Display name -->
<ApplicationTitle>FruitBank Measuring</ApplicationTitle>
<!-- Display name -->
<ApplicationTitle>FruitBank Measuring</ApplicationTitle>
<!-- App Identifier -->
<ApplicationId>com.companyname.blazorapp.1</ApplicationId>
<!-- App Identifier -->
<ApplicationId>com.companyname.blazorapp.1</ApplicationId>
<!-- Versions -->
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion>
<!-- Versions -->
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion>
<!-- To develop, package, and publish an app to the Microsoft Store, see: https://aka.ms/MauiTemplateUnpackaged -->
<WindowsPackageType>None</WindowsPackageType>
<!-- To develop, package, and publish an app to the Microsoft Store, see: https://aka.ms/MauiTemplateUnpackaged -->
<WindowsPackageType>None</WindowsPackageType>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">15.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">15.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">24.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.Contains('-ios')) and '$(Configuration)' == 'Release'">
<UseInterpreter>true</UseInterpreter>
</PropertyGroup>
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'maccatalyst-arm64' and '$(Configuration)' == 'Release'">
<UseInterpreter>true</UseInterpreter>
</PropertyGroup>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">15.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">15.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">33.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
</PropertyGroup>
<ItemGroup>
<!-- App Icon -->
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
<!-- Splash Screen -->
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />
<PropertyGroup Condition="$(TargetFramework.Contains('-android'))">
<RunAOTCompilation>false</RunAOTCompilation>
</PropertyGroup>
<!-- Images -->
<MauiImage Include="Resources\Images\*" />
<MauiImage Update="Resources\Images\dotnet_bot.svg" BaseSize="168,208" />
<PropertyGroup Condition="$(TargetFramework.Contains('-ios')) and '$(Configuration)' == 'Release'">
<UseInterpreter>true</UseInterpreter>
</PropertyGroup>
<!-- Custom Fonts -->
<MauiFont Include="Resources\Fonts\*" />
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'maccatalyst-arm64' and '$(Configuration)' == 'Release'">
<UseInterpreter>true</UseInterpreter>
</PropertyGroup>
<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>
<ItemGroup>
<!-- App Icon -->
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
<ItemGroup>
<PackageReference Include="DevExpress.Data" Version="25.1.3" />
<!--<PackageReference Include="DevExpress.Maui.Controls" Version="25.1.3" />
<!-- Splash Screen -->
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />
<!-- Images -->
<MauiImage Include="Resources\Images\*" />
<MauiImage Update="Resources\Images\dotnet_bot.svg" BaseSize="168,208" />
<!-- Custom Fonts -->
<MauiFont Include="Resources\Fonts\*" />
<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="DevExpress.Data" Version="25.1.3" />
<!--<PackageReference Include="DevExpress.Maui.Controls" Version="25.1.3" />
<PackageReference Include="DevExpress.Maui.Editors" Version="25.1.3" />
<PackageReference Include="DevExpress.Maui.CollectionView" Version="25.1.3" />-->
<PackageReference Include="Microsoft.Maui.Controls" Version="9.0.110" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebView.Maui" Version="9.0.110" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.9" />
</ItemGroup>
<PackageReference Include="Microsoft.Maui.Controls" Version="9.0.120" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebView.Maui" Version="9.0.120" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.10" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\FruitBank.Common\FruitBank.Common.csproj" />
<ProjectReference Include="..\FruitBankHybrid.Shared\FruitBankHybrid.Shared.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\FruitBank.Common\FruitBank.Common.csproj" />
<ProjectReference Include="..\FruitBankHybrid.Shared\FruitBankHybrid.Shared.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="AyCode.Core">
<HintPath>..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Core.dll</HintPath>
</Reference>
<Reference Include="AyCode.Services">
<HintPath>..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Services.dll</HintPath>
</Reference>
<Reference Include="AyCode.Entities">
<HintPath>..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Entities.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Reference Include="AyCode.Core">
<HintPath>..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Core.dll</HintPath>
</Reference>
<Reference Include="AyCode.Services">
<HintPath>..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Services.dll</HintPath>
</Reference>
<Reference Include="AyCode.Entities">
<HintPath>..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\Debug\net9.0\AyCode.Entities.dll</HintPath>
</Reference>
</ItemGroup>
</Project>