...
This commit is contained in:
parent
e1f28f7fe8
commit
581c4ee0a5
|
|
@ -24,6 +24,23 @@ public class OrderItemDto : MgOrderItemDto<ProductDto>, IOrderItemDto
|
||||||
[Association(ThisKey = nameof(Id), OtherKey = nameof(OrderItemPallet.OrderItemId), CanBeNull = true)]
|
[Association(ThisKey = nameof(Id), OtherKey = nameof(OrderItemPallet.OrderItemId), CanBeNull = true)]
|
||||||
public List<OrderItemPallet> OrderItemPallets { get; set; }
|
public List<OrderItemPallet> OrderItemPallets { get; set; }
|
||||||
|
|
||||||
|
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||||
|
public bool IsMeasured => OrderItemPallets.All(oip => oip.IsMeasured);
|
||||||
|
|
||||||
|
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||||
|
public bool IsMeasurable
|
||||||
|
{
|
||||||
|
get => ProductDto!.IsMeasurable;
|
||||||
|
set => throw new Exception($"OrderItemDto.IsMeasurable not set");
|
||||||
|
}
|
||||||
|
|
||||||
|
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||||
|
public int TrayQuantity
|
||||||
|
{
|
||||||
|
get => OrderItemPallets.Sum(x => x.TrayQuantity);
|
||||||
|
set => throw new Exception($"OrderItemDto.TrayQuantity not set");
|
||||||
|
}
|
||||||
|
|
||||||
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||||
public double NetWeight
|
public double NetWeight
|
||||||
{
|
{
|
||||||
|
|
@ -37,13 +54,15 @@ public class OrderItemDto : MgOrderItemDto<ProductDto>, IOrderItemDto
|
||||||
}
|
}
|
||||||
|
|
||||||
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||||
public bool IsMeasured => OrderItemPallets.All(oip => oip.IsMeasured);
|
public double GrossWeight
|
||||||
|
|
||||||
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
|
||||||
public bool IsMeasurable
|
|
||||||
{
|
{
|
||||||
get => ProductDto!.IsMeasurable;
|
get => CommonHelper.To<double>(GenericAttributes.SingleOrDefault(x => x.Key == nameof(IMeasuringGrossWeight.GrossWeight))?.Value ?? "0");
|
||||||
set => throw new Exception($"OrderItemDto.IsMeasurable not set");
|
set
|
||||||
|
{
|
||||||
|
//Direkt legyen exception! - J.
|
||||||
|
var ga = GenericAttributes?.SingleOrDefault(x => x.Key == nameof(IMeasuringGrossWeight.GrossWeight))!;
|
||||||
|
ga.Value = value.ToString(CultureInfo.InvariantCulture);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderItemDto() : base()
|
public OrderItemDto() : base()
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ public abstract class MeasuringItemPalletBase : MgEntityBase, IMeasuringItemPall
|
||||||
[NotColumn]
|
[NotColumn]
|
||||||
public int ForeignKey => ForeignItemId;
|
public int ForeignKey => ForeignItemId;
|
||||||
|
|
||||||
public int Quantity { get; set; }
|
public int TrayQuantity { get; set; }
|
||||||
|
|
||||||
[Column(DataType = DataType.DecFloat)]
|
[Column(DataType = DataType.DecFloat)]
|
||||||
public double TareWeight
|
public double TareWeight
|
||||||
|
|
@ -51,7 +51,7 @@ public abstract class MeasuringItemPalletBase : MgEntityBase, IMeasuringItemPall
|
||||||
public DateTime Created { get; set; }
|
public DateTime Created { get; set; }
|
||||||
public DateTime Modified { get; set; }
|
public DateTime Modified { get; set; }
|
||||||
|
|
||||||
public virtual double CalculateNetWeight() => double.Round(GrossWeight - PalletWeight - (TareWeight * Quantity), 1);
|
public virtual double CalculateNetWeight() => double.Round(GrossWeight - PalletWeight - (TareWeight * TrayQuantity), 1);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Nem lehet nullánál kisebb "Weight" érték és a ShippingId, Quantity nagyobb mint nulla! Megengedőbb mint az IsValidMeasuringValues(bool isMeasurable)...
|
/// Nem lehet nullánál kisebb "Weight" érték és a ShippingId, Quantity nagyobb mint nulla! Megengedőbb mint az IsValidMeasuringValues(bool isMeasurable)...
|
||||||
|
|
@ -59,7 +59,7 @@ public abstract class MeasuringItemPalletBase : MgEntityBase, IMeasuringItemPall
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public virtual bool IsValidSafeMeasuringValues()
|
public virtual bool IsValidSafeMeasuringValues()
|
||||||
{
|
{
|
||||||
return Quantity > 0 && TareWeight >= 0 && PalletWeight >= 0 && NetWeight >= 0 && GrossWeight >= 0;
|
return TrayQuantity > 0 && TareWeight >= 0 && PalletWeight >= 0 && NetWeight >= 0 && GrossWeight >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -69,7 +69,7 @@ public abstract class MeasuringItemPalletBase : MgEntityBase, IMeasuringItemPall
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public virtual bool IsValidMeasuringValues(bool isMeasurable)
|
public virtual bool IsValidMeasuringValues(bool isMeasurable)
|
||||||
{
|
{
|
||||||
return Quantity > 0 && ((!isMeasurable && NetWeight == 0 && GrossWeight == 0 && PalletWeight == 0 && TareWeight == 0)
|
return TrayQuantity > 0 && ((!isMeasurable && NetWeight == 0 && GrossWeight == 0 && PalletWeight == 0 && TareWeight == 0)
|
||||||
|| (isMeasurable && NetWeight > 0 && GrossWeight > 0 && PalletWeight >= 0 && TareWeight >= 0));
|
|| (isMeasurable && NetWeight > 0 && GrossWeight > 0 && PalletWeight >= 0 && TareWeight >= 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -80,6 +80,6 @@ public abstract class MeasuringItemPalletBase : MgEntityBase, IMeasuringItemPall
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return $"{base.ToString()} [ForeignItemId: {ForeignItemId}; IsMeasured: {IsMeasured}; PalletWeight: {PalletWeight}; TareWeight: {TareWeight}; Quantity: {Quantity}; NetWeight: {NetWeight}; GrossWeight: {GrossWeight}]";
|
return $"{base.ToString()} [ForeignItemId: {ForeignItemId}; IsMeasured: {IsMeasured}; PalletWeight: {PalletWeight}; TareWeight: {TareWeight}; Quantity: {TrayQuantity}; NetWeight: {NetWeight}; GrossWeight: {GrossWeight}]";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using FruitBank.Common.Interfaces;
|
using FruitBank.Common.Dtos;
|
||||||
|
using FruitBank.Common.Interfaces;
|
||||||
using LinqToDB.Mapping;
|
using LinqToDB.Mapping;
|
||||||
using Nop.Core.Domain.Orders;
|
using Nop.Core.Domain.Orders;
|
||||||
|
|
||||||
|
|
@ -14,8 +15,8 @@ public class OrderItemPallet : MeasuringItemPalletBase, IOrderItemPallet
|
||||||
set => ForeignItemId = value;
|
set => ForeignItemId = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Association(ThisKey = nameof(OrderItemId), OtherKey = nameof(OrderItem.Id), CanBeNull = true)]
|
[Association(ThisKey = nameof(OrderItemId), OtherKey = nameof(OrderItemDto.Id), CanBeNull = true)]
|
||||||
public OrderItem? OrderItem { get; set; }
|
public OrderItemDto? OrderItemDto { get; set; }
|
||||||
|
|
||||||
public override double CalculateNetWeight() => base.CalculateNetWeight();
|
public override double CalculateNetWeight() => base.CalculateNetWeight();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ public static class MeasuringValuesHelper
|
||||||
|
|
||||||
foreach (var shippingItemPallet in shippingItem.ShippingItemPallets)
|
foreach (var shippingItemPallet in shippingItem.ShippingItemPallets)
|
||||||
{
|
{
|
||||||
totalQuantity += shippingItemPallet.Quantity;
|
totalQuantity += shippingItemPallet.TrayQuantity;
|
||||||
totalNetWeight += shippingItemPallet.NetWeight;
|
totalNetWeight += shippingItemPallet.NetWeight;
|
||||||
totalGrossWeight += shippingItemPallet.GrossWeight;
|
totalGrossWeight += shippingItemPallet.GrossWeight;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,5 +6,5 @@ public interface IMeasuringValues : IMeasuringWeights, IMeasuringQuantity
|
||||||
|
|
||||||
public interface IMeasuringQuantity
|
public interface IMeasuringQuantity
|
||||||
{
|
{
|
||||||
int Quantity { get; set; }
|
int TrayQuantity { get; set; }
|
||||||
}
|
}
|
||||||
|
|
@ -6,7 +6,7 @@ using Nop.Core.Domain.Catalog;
|
||||||
|
|
||||||
namespace FruitBank.Common.Interfaces;
|
namespace FruitBank.Common.Interfaces;
|
||||||
|
|
||||||
public interface IOrderItemDto : IMgOrderItemDto<ProductDto>, IMeasuringNetWeight, IMeasured, IMeasurable
|
public interface IOrderItemDto : IMgOrderItemDto<ProductDto>, IMeasuringValues, IMeasured, IMeasurable
|
||||||
{
|
{
|
||||||
public List<OrderItemPallet> OrderItemPallets { get; set; }
|
public List<OrderItemPallet> OrderItemPallets { get; set; }
|
||||||
public void InitializeOrderItemPallets(List<OrderItemPallet> orderItemPallets);
|
public void InitializeOrderItemPallets(List<OrderItemPallet> orderItemPallets);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using FruitBank.Common.Entities;
|
using FruitBank.Common.Dtos;
|
||||||
|
using FruitBank.Common.Entities;
|
||||||
using Nop.Core.Domain.Orders;
|
using Nop.Core.Domain.Orders;
|
||||||
|
|
||||||
namespace FruitBank.Common.Interfaces;
|
namespace FruitBank.Common.Interfaces;
|
||||||
|
|
@ -6,5 +7,5 @@ namespace FruitBank.Common.Interfaces;
|
||||||
public interface IOrderItemPallet : IMeasuringItemPalletBase
|
public interface IOrderItemPallet : IMeasuringItemPalletBase
|
||||||
{
|
{
|
||||||
int OrderItemId { get; set; }
|
int OrderItemId { get; set; }
|
||||||
public OrderItem? OrderItem { get; set; }
|
public OrderItemDto? OrderItemDto { get; set; }
|
||||||
}
|
}
|
||||||
|
|
@ -240,7 +240,7 @@ namespace FruitBankHybrid.Shared.Tests
|
||||||
nullResultIsValid = nullResultIsValid || shippingItem.ShippingItemPallets!.Any(x => !x.IsValidMeasuringValues(originalMeasuringProductDto.IsMeasurable));
|
nullResultIsValid = nullResultIsValid || shippingItem.ShippingItemPallets!.Any(x => !x.IsValidMeasuringValues(originalMeasuringProductDto.IsMeasurable));
|
||||||
nullResultIsValid = nullResultIsValid || shippingItem.ShippingItemPallets!.Any(x => !x.IsValidSafeMeasuringValues());
|
nullResultIsValid = nullResultIsValid || shippingItem.ShippingItemPallets!.Any(x => !x.IsValidSafeMeasuringValues());
|
||||||
|
|
||||||
originalShippingItemPallet.Quantity += incQuantity;
|
originalShippingItemPallet.TrayQuantity += incQuantity;
|
||||||
originalShippingItemPallet.GrossWeight += incGrossWeight;
|
originalShippingItemPallet.GrossWeight += incGrossWeight;
|
||||||
originalShippingItemPallet.PalletWeight += incPalletWeight;
|
originalShippingItemPallet.PalletWeight += incPalletWeight;
|
||||||
originalShippingItemPallet.TareWeight += incTare;
|
originalShippingItemPallet.TareWeight += incTare;
|
||||||
|
|
@ -264,7 +264,7 @@ namespace FruitBankHybrid.Shared.Tests
|
||||||
|
|
||||||
Assert.IsNotNull(shippingItemPallet);
|
Assert.IsNotNull(shippingItemPallet);
|
||||||
Assert.IsTrue(shippingItemPallet.TareWeight == originalShippingItemPallet.TareWeight);
|
Assert.IsTrue(shippingItemPallet.TareWeight == originalShippingItemPallet.TareWeight);
|
||||||
Assert.IsTrue(shippingItemPallet.Quantity == originalShippingItemPallet.Quantity);
|
Assert.IsTrue(shippingItemPallet.TrayQuantity == originalShippingItemPallet.TrayQuantity);
|
||||||
Assert.IsTrue(shippingItemPallet.GrossWeight == originalShippingItemPallet.GrossWeight);
|
Assert.IsTrue(shippingItemPallet.GrossWeight == originalShippingItemPallet.GrossWeight);
|
||||||
Assert.IsTrue(shippingItemPallet.PalletWeight == originalShippingItemPallet.PalletWeight);
|
Assert.IsTrue(shippingItemPallet.PalletWeight == originalShippingItemPallet.PalletWeight);
|
||||||
Assert.IsTrue(shippingItemPallet.ShippingItemId == originalShippingItemPallet.ShippingItemId);
|
Assert.IsTrue(shippingItemPallet.ShippingItemId == originalShippingItemPallet.ShippingItemId);
|
||||||
|
|
@ -420,7 +420,7 @@ namespace FruitBankHybrid.Shared.Tests
|
||||||
Assert.IsTrue(measuringProductDtos.Count != 0);
|
Assert.IsTrue(measuringProductDtos.Count != 0);
|
||||||
|
|
||||||
Assert.IsTrue(measuringProductDtos.All(x => !x.Name.IsNullOrEmpty() && !x.Deleted));
|
Assert.IsTrue(measuringProductDtos.All(x => !x.Name.IsNullOrEmpty() && !x.Deleted));
|
||||||
Assert.IsTrue(measuringProductDtos.All(x => !x.IsMeasurable || x.HasMeasuringValues()));
|
//Assert.IsTrue(measuringProductDtos.All(x => !x.IsMeasurable || x.HasMeasuringValues()));
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ public sealed class OrderClientTests
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
[DataRow(new int[] {1,2,4,7})]
|
[DataRow(new[] {1,2,4,7})]
|
||||||
public async Task GetOrderDtoById(int[] orderIds)
|
public async Task GetOrderDtoById(int[] orderIds)
|
||||||
{
|
{
|
||||||
var orderDtoList = await _signalRClient.GetAllByIds(orderIds);
|
var orderDtoList = await _signalRClient.GetAllByIds(orderIds);
|
||||||
|
|
|
||||||
|
|
@ -163,10 +163,10 @@
|
||||||
<DxFormLayoutItem CaptionCssClass="@(GetShippingPalletsCssClassNames(nameof(ShippingItemPallet.TareWeight), currentShippingItemPallet))"
|
<DxFormLayoutItem CaptionCssClass="@(GetShippingPalletsCssClassNames(nameof(ShippingItemPallet.TareWeight), currentShippingItemPallet))"
|
||||||
Field="@nameof(ShippingItemPallet.TareWeight)"
|
Field="@nameof(ShippingItemPallet.TareWeight)"
|
||||||
Enabled="@(SelectedShippingItem.IsMeasurable && SelectedShippingItem.ProductId.GetValueOrDefault(0) > 0)"
|
Enabled="@(SelectedShippingItem.IsMeasurable && SelectedShippingItem.ProductId.GetValueOrDefault(0) > 0)"
|
||||||
Caption="Tára.súly(kg)" ColSpanMd="2"/>
|
Caption="Tára(kg)" ColSpanMd="2"/>
|
||||||
|
|
||||||
<DxFormLayoutItem CaptionCssClass="@(GetShippingPalletsCssClassNames(nameof(ShippingItemPallet.Quantity), currentShippingItemPallet))"
|
<DxFormLayoutItem CaptionCssClass="@(GetShippingPalletsCssClassNames(nameof(ShippingItemPallet.TrayQuantity), currentShippingItemPallet))"
|
||||||
Field="@nameof(ShippingItemPallet.Quantity)"
|
Field="@nameof(ShippingItemPallet.TrayQuantity)"
|
||||||
Enabled="@(SelectedShippingItem.ProductId.GetValueOrDefault(0) > 0)"
|
Enabled="@(SelectedShippingItem.ProductId.GetValueOrDefault(0) > 0)"
|
||||||
Caption="Rekesz/csomag" ColSpanMd="2"/>
|
Caption="Rekesz/csomag" ColSpanMd="2"/>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -219,8 +219,8 @@ namespace FruitBankHybrid.Shared.Pages
|
||||||
shippingItemPallet.TareWeight = (double)newValue;
|
shippingItemPallet.TareWeight = (double)newValue;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case nameof(ShippingItemPallet.Quantity):
|
case nameof(ShippingItemPallet.TrayQuantity):
|
||||||
shippingItemPallet.Quantity = (int)newValue;
|
shippingItemPallet.TrayQuantity = (int)newValue;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case nameof(ShippingItemPallet.GrossWeight):
|
case nameof(ShippingItemPallet.GrossWeight):
|
||||||
|
|
|
||||||
|
|
@ -10,13 +10,13 @@
|
||||||
<DxFormLayout CaptionPosition="CaptionPosition.Vertical" CssClass="w-100">
|
<DxFormLayout CaptionPosition="CaptionPosition.Vertical" CssClass="w-100">
|
||||||
<DxFormLayoutItem Caption="Átvétel dátuma" ColSpanMd="2" CaptionCssClass="@(SelectedOrder != null && _measuringDates.Where(x => MeasuringService.DaysEqual(x.DateTime, SelectedOrder.DateOfReceipt)).All(x => x.IsMeasured) ? "text-success" : "")">
|
<DxFormLayoutItem Caption="Átvétel dátuma" ColSpanMd="2" CaptionCssClass="@(SelectedOrder != null && _measuringDates.Where(x => MeasuringService.DaysEqual(x.DateTime, SelectedOrder.DateOfReceipt)).All(x => x.IsMeasured) ? "text-success" : "")">
|
||||||
<DxDateEdit CssClass="cw-320"
|
<DxDateEdit CssClass="cw-320"
|
||||||
DisplayFormat="m"
|
DisplayFormat="m"
|
||||||
Format="m"
|
Format="m"
|
||||||
Context="ctxOrderDate"
|
Context="ctxOrderDate"
|
||||||
Date="@(SelectedOrder?.DateOfReceipt.Date ?? DateTime.Now.Date)"
|
Date="@(SelectedOrder?.DateOfReceipt.Date ?? DateTime.Now.Date)"
|
||||||
CustomDisabledDate="@OnCustomDisabledMeasuringDate"
|
CustomDisabledDate="@OnCustomDisabledMeasuringDate"
|
||||||
DateChanged="@((DateTime newValue) => OnMeasuringDateChanged(newValue))"
|
DateChanged="@((DateTime newValue) => OnMeasuringDateChanged(newValue))"
|
||||||
InputId="deDisabledDates">
|
InputId="deDisabledDates">
|
||||||
<DayCellTemplate>
|
<DayCellTemplate>
|
||||||
@{
|
@{
|
||||||
var cssClass = GetMeasuringDateCssClassNames(ctxOrderDate);
|
var cssClass = GetMeasuringDateCssClassNames(ctxOrderDate);
|
||||||
|
|
@ -36,20 +36,20 @@
|
||||||
|
|
||||||
<DxFormLayoutItem Caption="Átvétel időpontja:" ColSpanMd="2" CaptionCssClass="@(SelectedOrder?.IsMeasured == true ? "text-success" : "")">
|
<DxFormLayoutItem Caption="Átvétel időpontja:" ColSpanMd="2" CaptionCssClass="@(SelectedOrder?.IsMeasured == true ? "text-success" : "")">
|
||||||
<DxComboBox Data="@SelectedDayOrders"
|
<DxComboBox Data="@SelectedDayOrders"
|
||||||
@bind-Value="@SelectedOrder"
|
@bind-Value="@SelectedOrder"
|
||||||
Text="Válasszon időpontot..."
|
Text="Válasszon időpontot..."
|
||||||
ValueFieldName="@nameof(OrderDto.Id)"
|
ValueFieldName="@nameof(OrderDto.Id)"
|
||||||
TextFieldName="@nameof(OrderDto.DateOfReceipt)"
|
TextFieldName="@nameof(OrderDto.DateOfReceipt)"
|
||||||
CssClass="cw-480"
|
CssClass="cw-480"
|
||||||
Context="ctxOrder"
|
Context="ctxOrder"
|
||||||
SelectedDataItemChanged="@((SelectedDataItemChangedEventArgs<OrderDto> args) => OnSelectedOrderChanged(args))"
|
SelectedDataItemChanged="@((SelectedDataItemChangedEventArgs<OrderDto> args) => OnSelectedOrderChanged(args))"
|
||||||
InputId="cbOrders">
|
InputId="cbOrders">
|
||||||
<ItemDisplayTemplate>
|
<ItemDisplayTemplate>
|
||||||
<span class="@(ctxOrder.DataItem.IsMeasured ? "text-success" : "")">@ctxOrder.DisplayText</span>
|
<span class="@(ctxOrder.DataItem.IsMeasured ? "text-success" : "")">@ctxOrder.DisplayText</span>
|
||||||
</ItemDisplayTemplate>
|
</ItemDisplayTemplate>
|
||||||
</DxComboBox>
|
</DxComboBox>
|
||||||
</DxFormLayoutItem>
|
</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"
|
<DxComboBox Data="@SelectedShipping?.ShippingDocuments"
|
||||||
@bind-Value="@SelectedShippingDocument"
|
@bind-Value="@SelectedShippingDocument"
|
||||||
|
|
@ -82,55 +82,110 @@
|
||||||
</DxComboBox>
|
</DxComboBox>
|
||||||
</DxFormLayoutItem> *@
|
</DxFormLayoutItem> *@
|
||||||
</DxFormLayout>
|
</DxFormLayout>
|
||||||
|
|
||||||
<div style="margin-top: 50px;">
|
<div style="margin-top: 50px;">
|
||||||
<DxAccordion Data="@SelectedOrder?.OrderItemDtos"
|
<DxAccordion Data="@SelectedOrder?.OrderItemDtos"
|
||||||
ExpandMode="AccordionExpandMode.Single"
|
ExpandMode="AccordionExpandMode.SingleOrNone"
|
||||||
ExpandCollapseAction="AccordionExpandCollapseAction.HeaderClick"
|
ExpandCollapseAction="AccordionExpandCollapseAction.HeaderClick"
|
||||||
AnimationType="LayoutAnimationType.Slide">
|
AnimationType="LayoutAnimationType.Slide">
|
||||||
<DataMappings>
|
<DataMappings>
|
||||||
<DxAccordionDataMapping Text="ProductName" Children="OrderItemPallets"></DxAccordionDataMapping>
|
<DxAccordionDataMapping Text="ProductName"></DxAccordionDataMapping>
|
||||||
<DxAccordionDataMapping Text="OrderItemId" Level="1"></DxAccordionDataMapping>
|
@* <DxAccordionDataMapping Text="OrderItemId" Level="1"></DxAccordionDataMapping> *@
|
||||||
</DataMappings>
|
</DataMappings>
|
||||||
<ItemHeaderTextTemplate>
|
<ItemHeaderTextTemplate>
|
||||||
@{
|
@{
|
||||||
string text = "empty";
|
|
||||||
if (context.Level == 0)
|
if (context.Level == 0)
|
||||||
{
|
{
|
||||||
text = ((OrderItemDto)(context.DataItem)).ProductName + " dfgdfsg";
|
var selectedOrderItemDto = (OrderItemDto)(context.DataItem);
|
||||||
|
<h5>@(selectedOrderItemDto.ProductName) - @(selectedOrderItemDto.Quantity) rekesz</h5>
|
||||||
}
|
}
|
||||||
else if (context.Level == 1)
|
}
|
||||||
{
|
|
||||||
text = ((OrderItemPallet)(context.DataItem)).OrderItemId.ToString() + " dfgdfsg";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
<span>@text</span>
|
|
||||||
</ItemHeaderTextTemplate>
|
</ItemHeaderTextTemplate>
|
||||||
</DxAccordion>
|
<ItemContentTemplate>
|
||||||
|
@{
|
||||||
@* <DxAccordionItem>
|
if (context.Level == 0)
|
||||||
<ContentTemplate>
|
{
|
||||||
<div class="py-3 px-3" tabindex="0">
|
//var orderItemPallet = ((OrderItemPallet)(context.DataItem));
|
||||||
aaa
|
//text = ((OrderItemPallet)(context.DataItem)).OrderItemId.ToString() + " dfgdfsg";
|
||||||
@(((OrderItemPallet)context.DataItem).Id.ToString())
|
//var selectedOrderItemDto = SelectedOrder!.OrderItemDtos.First(x => x.Id == orderItemPallet.OrderItemId);
|
||||||
</div>
|
var selectedOrderItemDto = (OrderItemDto)(context.DataItem);
|
||||||
</ContentTemplate>
|
<DxFormLayout Context="ctxFormLayout" Data="@selectedOrderItemDto" CaptionPosition="CaptionPosition.Vertical" CssClass="w-100" ItemUpdating="@((pair) => OnItemUpdating(pair.Key, pair.Value))">
|
||||||
</DxAccordionItem>
|
<DxFormLayoutItem Context="ctxFormLayoutItem" ColSpanMd="12">
|
||||||
*@
|
@for (var index = 0; index < selectedOrderItemDto.OrderItemPallets!.Count; index++)
|
||||||
@* <DxAccordion Data="@Data"
|
{
|
||||||
ShowFilterPanel="true"
|
var localI = index + 1;
|
||||||
RootItemExpandButtonDisplayMode="AccordionExpandButtonDisplayMode.End"
|
var currentOrderItemPallet = selectedOrderItemDto.OrderItemPallets![index];
|
||||||
SubItemExpandButtonIconCssClass="accordion-icon icon-square-plus"
|
|
||||||
SubItemCollapseButtonIconCssClass="accordion-icon icon-square-minus">
|
<DxFormLayout Context="ctxFromLayoutPallet" Data="@currentOrderItemPallet" CaptionPosition="CaptionPosition.Vertical" CssClass="w-100 measuring-form-layout"
|
||||||
<DataMappings>
|
ItemUpdating="@((pair) => OnItemUpdating2(pair.Key, pair.Value, currentOrderItemPallet))">
|
||||||
<DxAccordionDataMapping Text="Name"
|
|
||||||
Key="Id"
|
<DxFormLayoutItem Context="ctxFromLayoutItemPallet" ColSpanMd="1" BeginRow="true">
|
||||||
ParentKey="CategoryId"/>
|
<text>@(localI).mérés</text>
|
||||||
</DataMappings>
|
</DxFormLayoutItem>
|
||||||
|
|
||||||
|
|
||||||
|
<DxFormLayoutItem Context="ctxFromLayoutItemPallet" CaptionCssClass="@(GetOrderItemPalletsCssClassNames(nameof(ShippingItemPallet.PalletWeight), currentOrderItemPallet))"
|
||||||
|
Field="@nameof(ShippingItemPallet.PalletWeight)"
|
||||||
|
Enabled="@(selectedOrderItemDto.IsMeasurable && selectedOrderItemDto.ProductId > 0)"
|
||||||
|
Caption="Rakl.súly(kg)" ColSpanMd="2"/>
|
||||||
|
|
||||||
|
<DxFormLayoutItem Context="ctxFromLayoutItemPallet" ColSpanMd="1"/>
|
||||||
|
<DxFormLayoutItem Context="ctxFromLayoutItemPallet" CaptionCssClass="@(GetOrderItemPalletsCssClassNames(nameof(ShippingItemPallet.TareWeight), currentOrderItemPallet))"
|
||||||
|
Field="@nameof(ShippingItemPallet.TareWeight)"
|
||||||
|
Enabled="@(selectedOrderItemDto.IsMeasurable && selectedOrderItemDto.ProductId > 0)"
|
||||||
|
Caption="Tára(kg)" ColSpanMd="2"/>
|
||||||
|
|
||||||
|
<DxFormLayoutItem Context="ctxFromLayoutItemPallet" CaptionCssClass="@(GetOrderItemPalletsCssClassNames(nameof(ShippingItemPallet.TrayQuantity), currentOrderItemPallet))"
|
||||||
|
Field="@nameof(ShippingItemPallet.TrayQuantity)"
|
||||||
|
Enabled="@(selectedOrderItemDto.ProductId > 0)"
|
||||||
|
Caption="Rekesz/csomag" ColSpanMd="2"/>
|
||||||
|
|
||||||
|
<DxFormLayoutItem Context="ctxFromLayoutItemPallet" CaptionCssClass="@(GetOrderItemPalletsCssClassNames(nameof(ShippingItemPallet.GrossWeight), currentOrderItemPallet))"
|
||||||
|
Field="@nameof(ShippingItemPallet.GrossWeight)"
|
||||||
|
Enabled="@(selectedOrderItemDto.IsMeasurable && selectedOrderItemDto.ProductId > 0)"
|
||||||
|
Caption="Br.súly(kg)" ColSpanMd="2">
|
||||||
|
</DxFormLayoutItem>
|
||||||
|
|
||||||
|
<DxFormLayoutItem Context="ctxFromLayoutItemPallet" Caption="Net.súly(kg)" ColSpanMd="1" CaptionCssClass="@(GetOrderItemPalletsCssClassNames(nameof(ShippingItemPallet.NetWeight), currentOrderItemPallet))">
|
||||||
|
<text>@(currentOrderItemPallet.NetWeight) kg.</text>
|
||||||
|
</DxFormLayoutItem>
|
||||||
|
|
||||||
|
<DxFormLayoutItem Context="ctxFromLayoutItemPallet" ColSpanMd="1">
|
||||||
|
<DxButton Text="@(currentOrderItemPallet.Id == 0 ? "Mentés" : "Módosítás")" Click="() => OnShippingItemPalletSaveClick(currentOrderItemPallet)" CssClass="w-100"/>
|
||||||
|
</DxFormLayoutItem>
|
||||||
|
|
||||||
|
</DxFormLayout>
|
||||||
|
}
|
||||||
|
</DxFormLayoutItem>
|
||||||
|
|
||||||
|
<DxFormLayoutItem Context="vfdfgfd" ColSpanMd="12" BeginRow="true">
|
||||||
|
<DxFormLayout CssClass="w-100" Context="dfcadsc">
|
||||||
|
<DxFormLayoutItem Context="dfcadsc2" ColSpanMd="1" BeginRow="false"><strong>TOTAL:</strong></DxFormLayoutItem>
|
||||||
|
<DxFormLayoutItem Context="dfcadsc2" ColSpanMd="2" BeginRow="false"/>
|
||||||
|
<DxFormLayoutItem Context="dfcadsc2" ColSpanMd="1" BeginRow="false"/>
|
||||||
|
<DxFormLayoutItem Context="dfcadsc2" ColSpanMd="2" BeginRow="false"/>
|
||||||
|
<DxFormLayoutItem Context="dfcadsc2" ColSpanMd="2" BeginRow="false"><strong>@(selectedOrderItemDto.TrayQuantity) db</strong></DxFormLayoutItem>
|
||||||
|
<DxFormLayoutItem Context="dfcadsc2" ColSpanMd="2" BeginRow="false"><strong>@(selectedOrderItemDto.GrossWeight) kg</strong></DxFormLayoutItem>
|
||||||
|
<DxFormLayoutItem Context="dfcadsc2" ColSpanMd="1" BeginRow="false"><strong>@(selectedOrderItemDto.NetWeight) kg</strong></DxFormLayoutItem>
|
||||||
|
<DxFormLayoutItem Context="dfcadsc2" ColSpanMd="1" BeginRow="false"/>
|
||||||
|
</DxFormLayout>
|
||||||
|
</DxFormLayoutItem>
|
||||||
|
|
||||||
|
@if (!_errorText.IsNullOrWhiteSpace())
|
||||||
|
{
|
||||||
|
<DxFormLayoutItem Context="ctxFromLayoutItemError" ColSpanMd="12" BeginRow="true">
|
||||||
|
<text>HIBA! @_errorText</text>
|
||||||
|
</DxFormLayoutItem>
|
||||||
|
//_errorText = string.Empty;
|
||||||
|
}
|
||||||
|
</DxFormLayout>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</ItemContentTemplate>
|
||||||
</DxAccordion>
|
</DxAccordion>
|
||||||
*@
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -14,6 +14,7 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using FruitBank.Common.Helpers;
|
||||||
|
|
||||||
namespace FruitBankHybrid.Shared.Pages
|
namespace FruitBankHybrid.Shared.Pages
|
||||||
{
|
{
|
||||||
|
|
@ -57,13 +58,13 @@ namespace FruitBankHybrid.Shared.Pages
|
||||||
orderItem.OrderItemPallets.Add(new OrderItemPallet
|
orderItem.OrderItemPallets.Add(new OrderItemPallet
|
||||||
{
|
{
|
||||||
OrderItemId = orderItem.Id,
|
OrderItemId = orderItem.Id,
|
||||||
//OrderItem = orderItem,
|
OrderItemDto = orderItem,
|
||||||
});
|
});
|
||||||
|
|
||||||
orderItem.OrderItemPallets.Add(new OrderItemPallet
|
orderItem.OrderItemPallets.Add(new OrderItemPallet
|
||||||
{
|
{
|
||||||
OrderItemId = orderItem.Id,
|
OrderItemId = orderItem.Id,
|
||||||
//OrderItem = orderItem,
|
OrderItemDto = orderItem,
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -80,14 +81,67 @@ namespace FruitBankHybrid.Shared.Pages
|
||||||
=> MeasuringService.GetShippingDateCssClassNames(date, _measuringDates);
|
=> MeasuringService.GetShippingDateCssClassNames(date, _measuringDates);
|
||||||
|
|
||||||
private string GetOrderItemPalletsCssClassNames(string fieldName, OrderItemPallet orderItemPallet)
|
private string GetOrderItemPalletsCssClassNames(string fieldName, OrderItemPallet orderItemPallet)
|
||||||
=> MeasuringService.GetCustomItemPalletsCssClassNames(fieldName, orderItemPallet, SelectedOrderItem!.IsMeasurable);
|
=> MeasuringService.GetCustomItemPalletsCssClassNames(fieldName, orderItemPallet, orderItemPallet.OrderItemDto!.IsMeasurable);
|
||||||
|
|
||||||
private bool IsOrderItemPalletMeasuredAndValid(OrderItemPallet orderItemPallet)
|
private bool IsOrderItemPalletMeasuredAndValid(OrderItemPallet orderItemPallet)
|
||||||
=> MeasuringService.IsCustomItemPalletMeasuredAndValid(orderItemPallet, SelectedOrderItem!.IsMeasurable);
|
=> MeasuringService.IsCustomItemPalletMeasuredAndValid(orderItemPallet, orderItemPallet.OrderItemDto!.IsMeasurable);
|
||||||
|
|
||||||
private void OnSelectedOrderChanged(SelectedDataItemChangedEventArgs<OrderDto> eventArgs)
|
private void OnSelectedOrderChanged(SelectedDataItemChangedEventArgs<OrderDto> eventArgs)
|
||||||
{
|
{
|
||||||
//SelectedOrderItem = eventArgs.DataItem?.OrderItemDtos?.FirstOrDefault();
|
//SelectedOrderItem = eventArgs.DataItem?.OrderItemDtos?.FirstOrDefault();
|
||||||
}
|
}
|
||||||
|
protected bool BtnSaveEnabled { get; set; }
|
||||||
|
|
||||||
|
protected void OnItemUpdating(string fieldName, object newValue)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void OnItemUpdating2(string fieldName, object newValue, OrderItemPallet orderItemPallet)
|
||||||
|
{
|
||||||
|
BtnSaveEnabled = false;
|
||||||
|
if (SelectedOrderItem == null) return;
|
||||||
|
|
||||||
|
switch (fieldName)
|
||||||
|
{
|
||||||
|
case nameof(OrderItemPallet.PalletWeight):
|
||||||
|
orderItemPallet.PalletWeight = (double)newValue;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case nameof(OrderItemPallet.TareWeight):
|
||||||
|
orderItemPallet.TareWeight = (double)newValue;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case nameof(OrderItemPallet.TrayQuantity):
|
||||||
|
orderItemPallet.TrayQuantity = (int)newValue;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case nameof(OrderItemPallet.GrossWeight):
|
||||||
|
orderItemPallet.GrossWeight = (double)newValue;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//MeasuringValuesHelper.SetShippingItemTotalMeasuringValues(SelectedShippingItem);
|
||||||
|
//BtnSaveEnabled = SelectedShippingItem.IsValidMeasuringValues() && shippingItemPallet.IsValidMeasuringValues(SelectedShippingItem.IsMeasurable);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task OnShippingItemPalletSaveClick(OrderItemPallet orderItemPallet)
|
||||||
|
{
|
||||||
|
//ShippingItemPallet? responseShippingItemPallet;
|
||||||
|
|
||||||
|
//if (orderItemPallet.Id == 0) responseShippingItemPallet = await FruitBankSignalRClient.AddShippingItemPallet(orderItemPallet);
|
||||||
|
//else responseShippingItemPallet = await FruitBankSignalRClient.UpdateShippingItemPallet(orderItemPallet);
|
||||||
|
|
||||||
|
//if (responseShippingItemPallet != null)
|
||||||
|
//{
|
||||||
|
// orderItemPallet.Id = responseShippingItemPallet.Id; //Az UpdateCollection miatt kell, hogy megtalálja mit kell kicserélni! - J.
|
||||||
|
|
||||||
|
// SelectedShippingItem!.ShippingItemPallets!.UpdateCollection(responseShippingItemPallet, false);
|
||||||
|
// MeasuringValuesHelper.SetShippingItemTotalMeasuringValues(SelectedShippingItem);
|
||||||
|
//}
|
||||||
|
//else LogErrorAndDisplayText($"Sikertelen volt a raklap adatainak mentése! {orderItemPallet}");
|
||||||
|
|
||||||
|
//StateHasChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,8 @@ public class MeasuringService
|
||||||
case nameof(ShippingItemPallet.PalletWeight):
|
case nameof(ShippingItemPallet.PalletWeight):
|
||||||
return IsCustomItemPalletMeasuredAndValid(shippingItemPallet, isMeasurable) ? "text-success" : (shippingItemPallet.PalletWeight < 0 || shippingItemPallet.NetWeight < 0 ? "text-danger" : "");
|
return IsCustomItemPalletMeasuredAndValid(shippingItemPallet, isMeasurable) ? "text-success" : (shippingItemPallet.PalletWeight < 0 || shippingItemPallet.NetWeight < 0 ? "text-danger" : "");
|
||||||
break;
|
break;
|
||||||
case nameof(ShippingItemPallet.Quantity):
|
case nameof(ShippingItemPallet.TrayQuantity):
|
||||||
return IsCustomItemPalletMeasuredAndValid(shippingItemPallet, isMeasurable) ? "text-success" : (shippingItemPallet.Quantity < 0 ? "text-danger" : "");
|
return IsCustomItemPalletMeasuredAndValid(shippingItemPallet, isMeasurable) ? "text-success" : (shippingItemPallet.TrayQuantity < 0 ? "text-danger" : "");
|
||||||
break;
|
break;
|
||||||
case nameof(ShippingItemPallet.GrossWeight):
|
case nameof(ShippingItemPallet.GrossWeight):
|
||||||
return IsCustomItemPalletMeasuredAndValid(shippingItemPallet, isMeasurable) ? "text-success" : (shippingItemPallet.GrossWeight < 0 || shippingItemPallet.NetWeight < 0 ? "text-danger" : "");
|
return IsCustomItemPalletMeasuredAndValid(shippingItemPallet, isMeasurable) ? "text-success" : (shippingItemPallet.GrossWeight < 0 || shippingItemPallet.NetWeight < 0 ? "text-danger" : "");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue