improvements, fixes, etc...
This commit is contained in:
parent
5f05203169
commit
8845385477
|
|
@ -15,14 +15,12 @@ namespace FruitBank.Common.Entities;
|
||||||
[System.ComponentModel.DataAnnotations.Schema.Table(FruitBankConstClient.ShippingItemDbTableName)]
|
[System.ComponentModel.DataAnnotations.Schema.Table(FruitBankConstClient.ShippingItemDbTableName)]
|
||||||
public class ShippingItem : MgEntityBase, IShippingItem
|
public class ShippingItem : MgEntityBase, IShippingItem
|
||||||
{
|
{
|
||||||
public int? ProductId { get; set; }
|
|
||||||
//[Association(ThisKey = nameof(ShippingDocumentId), OtherKey = nameof(Shipping.Id))]
|
|
||||||
//public IEnumerable<Shipping> Shippings { get; set; }
|
|
||||||
|
|
||||||
public int ShippingDocumentId { get; set; }
|
public int ShippingDocumentId { get; set; }
|
||||||
|
public int? PalletId { get; set; }
|
||||||
|
public int? ProductId { get; set; }
|
||||||
|
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
public string PalletSize { get; set; }
|
|
||||||
public int PalletsOnDocument { get; set; }
|
public int PalletsOnDocument { get; set; }
|
||||||
|
|
||||||
public int QuantityOnDocument { get; set; }
|
public int QuantityOnDocument { get; set; }
|
||||||
|
|
@ -30,6 +28,11 @@ public class ShippingItem : MgEntityBase, IShippingItem
|
||||||
[Column(DataType = DataType.DecFloat)] public double NetWeightOnDocument { get; set; }
|
[Column(DataType = DataType.DecFloat)] public double NetWeightOnDocument { get; set; }
|
||||||
[Column(DataType = DataType.DecFloat)] public double GrossWeightOnDocument { get; set; }
|
[Column(DataType = DataType.DecFloat)] public double GrossWeightOnDocument { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Általában megegyezik a PalletsOnDocument-el, de minimum 1! Ha nincs raklap, akkor is 1! Néha előfordulhat, hogy kevesebb raklap érkezik és olyankor kell tudni módosítani a mérések számát.
|
||||||
|
/// </summary>
|
||||||
|
[Range(1, 100000, ErrorMessage = "The MeasuringCount value should be a number between 1 and 100,000.")]
|
||||||
|
public int MeasuringCount { get; set; } = 1;
|
||||||
|
|
||||||
//[Nullable]
|
//[Nullable]
|
||||||
//[Column(CanBeNull = true)]
|
//[Column(CanBeNull = true)]
|
||||||
|
|
@ -64,6 +67,6 @@ public class ShippingItem : MgEntityBase, IShippingItem
|
||||||
|
|
||||||
public bool IsValidMeasuringValues()
|
public bool IsValidMeasuringValues()
|
||||||
{
|
{
|
||||||
return /*ProductId > 0 && */MeasuredQuantity > 0 && (!IsMeasurable || (MeasuredNetWeight > 0 && MeasuredGrossWeight > 0));
|
return /*ProductId > 0 && */MeasuringCount > 0 && MeasuredQuantity > 0 && (!IsMeasurable || (MeasuredNetWeight > 0 && MeasuredGrossWeight > 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -12,8 +12,7 @@ public class ShippingItemPallet : MgEntityBase, IShippingItemPallet
|
||||||
{
|
{
|
||||||
public int ShippingItemId { get; set; }
|
public int ShippingItemId { get; set; }
|
||||||
|
|
||||||
[NotColumn]
|
public double PalletWeight { get; set; }
|
||||||
public string PalletSize { get; set; }
|
|
||||||
|
|
||||||
//[Nullable]
|
//[Nullable]
|
||||||
//[Column(CanBeNull = true)]
|
//[Column(CanBeNull = true)]
|
||||||
|
|
@ -45,6 +44,6 @@ public class ShippingItemPallet : MgEntityBase, IShippingItemPallet
|
||||||
|
|
||||||
public bool IsValidMeasuringValues(bool isMeasurable)
|
public bool IsValidMeasuringValues(bool isMeasurable)
|
||||||
{
|
{
|
||||||
return ShippingItemId > 0 && Quantity > 0 && (!isMeasurable || (NetWeight > 0 && GrossWeight > 0));
|
return ShippingItemId > 0 && PalletWeight >= 0 && Quantity > 0 && (!isMeasurable || (NetWeight > 0 && GrossWeight > 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -8,17 +8,18 @@ namespace FruitBank.Common.Interfaces;
|
||||||
public interface IShippingItem : IEntityInt, ITimeStampInfo
|
public interface IShippingItem : IEntityInt, ITimeStampInfo
|
||||||
{
|
{
|
||||||
int ShippingDocumentId { get; set; }
|
int ShippingDocumentId { get; set; }
|
||||||
|
int? PalletId { get; set; }
|
||||||
int? ProductId { get; set; }
|
int? ProductId { get; set; }
|
||||||
|
|
||||||
string Name { get; set; }
|
string Name { get; set; }
|
||||||
|
|
||||||
string PalletSize { get; set; }
|
|
||||||
int PalletsOnDocument { get; set; }
|
int PalletsOnDocument { get; set; }
|
||||||
|
|
||||||
int QuantityOnDocument { get; set; }
|
int QuantityOnDocument { get; set; }
|
||||||
double NetWeightOnDocument { get; set; }
|
double NetWeightOnDocument { get; set; }
|
||||||
double GrossWeightOnDocument { get; set; }
|
double GrossWeightOnDocument { get; set; }
|
||||||
|
|
||||||
|
int MeasuringCount { get; set; }
|
||||||
int MeasuredQuantity { get; set; }
|
int MeasuredQuantity { get; set; }
|
||||||
double MeasuredNetWeight { get; set; }
|
double MeasuredNetWeight { get; set; }
|
||||||
double MeasuredGrossWeight { get; set; }
|
double MeasuredGrossWeight { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,8 @@ namespace FruitBank.Common.Interfaces;
|
||||||
public interface IShippingItemPallet : IEntityInt, IMeasuringValues, ITimeStampInfo
|
public interface IShippingItemPallet : IEntityInt, IMeasuringValues, ITimeStampInfo
|
||||||
{
|
{
|
||||||
int ShippingItemId { get; set; }
|
int ShippingItemId { get; set; }
|
||||||
public string PalletSize { get; set; }
|
|
||||||
|
public double PalletWeight { get; set; }
|
||||||
public bool IsMeasured { get; set; }
|
public bool IsMeasured { get; set; }
|
||||||
|
|
||||||
public ShippingItem? ShippingItem { get; set; }
|
public ShippingItem? ShippingItem { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -186,8 +186,10 @@ namespace FruitBankHybrid.Shared.Tests
|
||||||
|
|
||||||
[DataTestMethod]
|
[DataTestMethod]
|
||||||
[DataRow(1, -1, -2.137563300001, -3.75238200001)]
|
[DataRow(1, -1, -2.137563300001, -3.75238200001)]
|
||||||
|
[DataRow(1, 1, 2.137563300001, 3.75238200001)]
|
||||||
[DataRow(2, -1, -2.137563300001, 3.75238200001)]
|
[DataRow(2, -1, -2.137563300001, 3.75238200001)]
|
||||||
[DataRow(3, 1, 2.137563300001, -3.75238200001)]
|
[DataRow(3, 1, 2.137563300001, -3.75238200001)]
|
||||||
|
[DataRow(3, 1, 2.137563300001, 3.75238200001)]
|
||||||
[DataRow(4, -1, 2.137563300001, 3.75238200001)]
|
[DataRow(4, -1, 2.137563300001, 3.75238200001)]
|
||||||
[DataRow(5, 1, 2.137563300001, 3.75238200001)]
|
[DataRow(5, 1, 2.137563300001, 3.75238200001)]
|
||||||
public async Task UpdateShippingItemTest(int shippingItemId, int incQuantity, double incNetWeight, double incGrossWeight)
|
public async Task UpdateShippingItemTest(int shippingItemId, int incQuantity, double incNetWeight, double incGrossWeight)
|
||||||
|
|
@ -199,12 +201,28 @@ namespace FruitBankHybrid.Shared.Tests
|
||||||
|
|
||||||
var shippingItem = await GetShippingItemByIdAsync(shippingItemId);
|
var shippingItem = await GetShippingItemByIdAsync(shippingItemId);
|
||||||
|
|
||||||
shippingItem.MeasuredQuantity += incQuantity;
|
var shippingItemPallet = shippingItem.ShippingItemPallets!.FirstOrDefault();
|
||||||
shippingItem.MeasuredNetWeight += incNetWeight;
|
|
||||||
shippingItem.MeasuredGrossWeight += incGrossWeight;
|
if (shippingItemPallet == null)
|
||||||
|
{
|
||||||
|
shippingItemPallet = new ShippingItemPallet { ShippingItemId = shippingItem.Id/*, PalletSize = shippingItem.PalletSize*/ };
|
||||||
|
shippingItem.ShippingItemPallets!.Add(shippingItemPallet);
|
||||||
|
}
|
||||||
|
|
||||||
|
Assert.IsNotNull(shippingItemPallet);
|
||||||
|
|
||||||
|
shippingItemPallet.Quantity += incQuantity;
|
||||||
|
shippingItemPallet.NetWeight += incNetWeight;
|
||||||
|
shippingItemPallet.GrossWeight += incGrossWeight;
|
||||||
|
|
||||||
shippingItem = await _signalRClient.UpdateShippingItem(shippingItem);
|
shippingItem = await _signalRClient.UpdateShippingItem(shippingItem);
|
||||||
|
|
||||||
|
if (!shippingItemPallet.IsValidMeasuringValues(originalMeasuringProductDto.IsMeasurable))
|
||||||
|
{
|
||||||
|
Assert.IsNull(shippingItem);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Assert.IsNotNull(shippingItem);
|
Assert.IsNotNull(shippingItem);
|
||||||
Assert.IsNotNull(shippingItem.Product);
|
Assert.IsNotNull(shippingItem.Product);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -180,7 +180,7 @@
|
||||||
{
|
{
|
||||||
<DxFormLayoutItem ColSpanMd="12" BeginRow="true">
|
<DxFormLayoutItem ColSpanMd="12" BeginRow="true">
|
||||||
<DxButton Text="@(SelectedShippingItem.IsMeasured ? "Befejezett mérés módosítása" : "Mérés befejezése")"
|
<DxButton Text="@(SelectedShippingItem.IsMeasured ? "Befejezett mérés módosítása" : "Mérés befejezése")"
|
||||||
Enabled="BtnSaveEnabled && (SelectedShippingItem.ShippingItemPallets.All(x => ShippingitemPalletMeasuredAndValid(x, SelectedShippingItem.IsMeasurable)))"
|
Enabled="true || (BtnSaveEnabled && (SelectedShippingItem.ShippingItemPallets.All(x => ShippingitemPalletMeasuredAndValid(x, SelectedShippingItem.IsMeasurable))))"
|
||||||
SubmitFormOnClick="true" CssClass="w-100" />
|
SubmitFormOnClick="true" CssClass="w-100" />
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -152,7 +152,7 @@ namespace FruitBankHybrid.Shared.Pages
|
||||||
shippingItem.ShippingItemPallets.Add(new ShippingItemPallet
|
shippingItem.ShippingItemPallets.Add(new ShippingItemPallet
|
||||||
{
|
{
|
||||||
ShippingItemId = shippingItem.Id,
|
ShippingItemId = shippingItem.Id,
|
||||||
PalletSize = shippingItem.PalletSize
|
//PalletSize = shippingItem.PalletSize,
|
||||||
});
|
});
|
||||||
|
|
||||||
//if (shippingItem.Id == SelectedShippingItem?.Id) return;
|
//if (shippingItem.Id == SelectedShippingItem?.Id) return;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue