This commit is contained in:
Loretta 2025-10-13 18:03:15 +02:00
parent e1f28f7fe8
commit 581c4ee0a5
14 changed files with 216 additions and 86 deletions

View File

@ -24,6 +24,23 @@ public class OrderItemDto : MgOrderItemDto<ProductDto>, IOrderItemDto
[Association(ThisKey = nameof(Id), OtherKey = nameof(OrderItemPallet.OrderItemId), CanBeNull = true)]
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]
public double NetWeight
{
@ -37,13 +54,15 @@ public class OrderItemDto : MgOrderItemDto<ProductDto>, IOrderItemDto
}
[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
public double GrossWeight
{
get => ProductDto!.IsMeasurable;
set => throw new Exception($"OrderItemDto.IsMeasurable not set");
get => CommonHelper.To<double>(GenericAttributes.SingleOrDefault(x => x.Key == nameof(IMeasuringGrossWeight.GrossWeight))?.Value ?? "0");
set
{
//Direkt legyen exception! - J.
var ga = GenericAttributes?.SingleOrDefault(x => x.Key == nameof(IMeasuringGrossWeight.GrossWeight))!;
ga.Value = value.ToString(CultureInfo.InvariantCulture);
}
}
public OrderItemDto() : base()

View File

@ -16,7 +16,7 @@ public abstract class MeasuringItemPalletBase : MgEntityBase, IMeasuringItemPall
[NotColumn]
public int ForeignKey => ForeignItemId;
public int Quantity { get; set; }
public int TrayQuantity { get; set; }
[Column(DataType = DataType.DecFloat)]
public double TareWeight
@ -51,7 +51,7 @@ public abstract class MeasuringItemPalletBase : MgEntityBase, IMeasuringItemPall
public DateTime Created { 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>
/// 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>
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>
@ -69,7 +69,7 @@ public abstract class MeasuringItemPalletBase : MgEntityBase, IMeasuringItemPall
/// <returns></returns>
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));
}
@ -80,6 +80,6 @@ public abstract class MeasuringItemPalletBase : MgEntityBase, IMeasuringItemPall
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}]";
}
}

View File

@ -1,4 +1,5 @@
using FruitBank.Common.Interfaces;
using FruitBank.Common.Dtos;
using FruitBank.Common.Interfaces;
using LinqToDB.Mapping;
using Nop.Core.Domain.Orders;
@ -14,8 +15,8 @@ public class OrderItemPallet : MeasuringItemPalletBase, IOrderItemPallet
set => ForeignItemId = value;
}
[Association(ThisKey = nameof(OrderItemId), OtherKey = nameof(OrderItem.Id), CanBeNull = true)]
public OrderItem? OrderItem { get; set; }
[Association(ThisKey = nameof(OrderItemId), OtherKey = nameof(OrderItemDto.Id), CanBeNull = true)]
public OrderItemDto? OrderItemDto { get; set; }
public override double CalculateNetWeight() => base.CalculateNetWeight();

View File

@ -25,7 +25,7 @@ public static class MeasuringValuesHelper
foreach (var shippingItemPallet in shippingItem.ShippingItemPallets)
{
totalQuantity += shippingItemPallet.Quantity;
totalQuantity += shippingItemPallet.TrayQuantity;
totalNetWeight += shippingItemPallet.NetWeight;
totalGrossWeight += shippingItemPallet.GrossWeight;
}

View File

@ -6,5 +6,5 @@ public interface IMeasuringValues : IMeasuringWeights, IMeasuringQuantity
public interface IMeasuringQuantity
{
int Quantity { get; set; }
int TrayQuantity { get; set; }
}

View File

@ -6,7 +6,7 @@ using Nop.Core.Domain.Catalog;
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 void InitializeOrderItemPallets(List<OrderItemPallet> orderItemPallets);

View File

@ -1,4 +1,5 @@
using FruitBank.Common.Entities;
using FruitBank.Common.Dtos;
using FruitBank.Common.Entities;
using Nop.Core.Domain.Orders;
namespace FruitBank.Common.Interfaces;
@ -6,5 +7,5 @@ namespace FruitBank.Common.Interfaces;
public interface IOrderItemPallet : IMeasuringItemPalletBase
{
int OrderItemId { get; set; }
public OrderItem? OrderItem { get; set; }
public OrderItemDto? OrderItemDto { get; set; }
}

View File

@ -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.IsValidSafeMeasuringValues());
originalShippingItemPallet.Quantity += incQuantity;
originalShippingItemPallet.TrayQuantity += incQuantity;
originalShippingItemPallet.GrossWeight += incGrossWeight;
originalShippingItemPallet.PalletWeight += incPalletWeight;
originalShippingItemPallet.TareWeight += incTare;
@ -264,7 +264,7 @@ namespace FruitBankHybrid.Shared.Tests
Assert.IsNotNull(shippingItemPallet);
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.PalletWeight == originalShippingItemPallet.PalletWeight);
Assert.IsTrue(shippingItemPallet.ShippingItemId == originalShippingItemPallet.ShippingItemId);
@ -420,7 +420,7 @@ namespace FruitBankHybrid.Shared.Tests
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.IsTrue(measuringProductDtos.All(x => !x.IsMeasurable || x.HasMeasuringValues()));
}
[TestMethod]

View File

@ -61,7 +61,7 @@ public sealed class OrderClientTests
}
[TestMethod]
[DataRow(new int[] {1,2,4,7})]
[DataRow(new[] {1,2,4,7})]
public async Task GetOrderDtoById(int[] orderIds)
{
var orderDtoList = await _signalRClient.GetAllByIds(orderIds);

View File

@ -163,10 +163,10 @@
<DxFormLayoutItem CaptionCssClass="@(GetShippingPalletsCssClassNames(nameof(ShippingItemPallet.TareWeight), currentShippingItemPallet))"
Field="@nameof(ShippingItemPallet.TareWeight)"
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))"
Field="@nameof(ShippingItemPallet.Quantity)"
<DxFormLayoutItem CaptionCssClass="@(GetShippingPalletsCssClassNames(nameof(ShippingItemPallet.TrayQuantity), currentShippingItemPallet))"
Field="@nameof(ShippingItemPallet.TrayQuantity)"
Enabled="@(SelectedShippingItem.ProductId.GetValueOrDefault(0) > 0)"
Caption="Rekesz/csomag" ColSpanMd="2"/>

View File

@ -219,8 +219,8 @@ namespace FruitBankHybrid.Shared.Pages
shippingItemPallet.TareWeight = (double)newValue;
break;
case nameof(ShippingItemPallet.Quantity):
shippingItemPallet.Quantity = (int)newValue;
case nameof(ShippingItemPallet.TrayQuantity):
shippingItemPallet.TrayQuantity = (int)newValue;
break;
case nameof(ShippingItemPallet.GrossWeight):

View File

@ -10,13 +10,13 @@
<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" : "")">
<DxDateEdit CssClass="cw-320"
DisplayFormat="m"
Format="m"
Context="ctxOrderDate"
Date="@(SelectedOrder?.DateOfReceipt.Date ?? DateTime.Now.Date)"
CustomDisabledDate="@OnCustomDisabledMeasuringDate"
DateChanged="@((DateTime newValue) => OnMeasuringDateChanged(newValue))"
InputId="deDisabledDates">
DisplayFormat="m"
Format="m"
Context="ctxOrderDate"
Date="@(SelectedOrder?.DateOfReceipt.Date ?? DateTime.Now.Date)"
CustomDisabledDate="@OnCustomDisabledMeasuringDate"
DateChanged="@((DateTime newValue) => OnMeasuringDateChanged(newValue))"
InputId="deDisabledDates">
<DayCellTemplate>
@{
var cssClass = GetMeasuringDateCssClassNames(ctxOrderDate);
@ -36,20 +36,20 @@
<DxFormLayoutItem Caption="Átvétel időpontja:" ColSpanMd="2" CaptionCssClass="@(SelectedOrder?.IsMeasured == true ? "text-success" : "")">
<DxComboBox Data="@SelectedDayOrders"
@bind-Value="@SelectedOrder"
Text="Válasszon időpontot..."
ValueFieldName="@nameof(OrderDto.Id)"
TextFieldName="@nameof(OrderDto.DateOfReceipt)"
CssClass="cw-480"
Context="ctxOrder"
SelectedDataItemChanged="@((SelectedDataItemChangedEventArgs<OrderDto> args) => OnSelectedOrderChanged(args))"
InputId="cbOrders">
@bind-Value="@SelectedOrder"
Text="Válasszon időpontot..."
ValueFieldName="@nameof(OrderDto.Id)"
TextFieldName="@nameof(OrderDto.DateOfReceipt)"
CssClass="cw-480"
Context="ctxOrder"
SelectedDataItemChanged="@((SelectedDataItemChangedEventArgs<OrderDto> args) => OnSelectedOrderChanged(args))"
InputId="cbOrders">
<ItemDisplayTemplate>
<span class="@(ctxOrder.DataItem.IsMeasured ? "text-success" : "")">@ctxOrder.DisplayText</span>
</ItemDisplayTemplate>
</DxComboBox>
</DxFormLayoutItem>
@*<DxFormLayoutItem Caption="Partner:" ColSpanMd="3" CaptionCssClass="@(SelectedShippingDocument?.IsAllMeasured == true ? "text-success" : "")">
<DxComboBox Data="@SelectedShipping?.ShippingDocuments"
@bind-Value="@SelectedShippingDocument"
@ -82,55 +82,110 @@
</DxComboBox>
</DxFormLayoutItem> *@
</DxFormLayout>
<div style="margin-top: 50px;">
<DxAccordion Data="@SelectedOrder?.OrderItemDtos"
ExpandMode="AccordionExpandMode.Single"
ExpandMode="AccordionExpandMode.SingleOrNone"
ExpandCollapseAction="AccordionExpandCollapseAction.HeaderClick"
AnimationType="LayoutAnimationType.Slide">
AnimationType="LayoutAnimationType.Slide">
<DataMappings>
<DxAccordionDataMapping Text="ProductName" Children="OrderItemPallets"></DxAccordionDataMapping>
<DxAccordionDataMapping Text="OrderItemId" Level="1"></DxAccordionDataMapping>
<DxAccordionDataMapping Text="ProductName"></DxAccordionDataMapping>
@* <DxAccordionDataMapping Text="OrderItemId" Level="1"></DxAccordionDataMapping> *@
</DataMappings>
<ItemHeaderTextTemplate>
@{
string text = "empty";
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>
</DxAccordion>
@* <DxAccordionItem>
<ContentTemplate>
<div class="py-3 px-3" tabindex="0">
aaa
@(((OrderItemPallet)context.DataItem).Id.ToString())
</div>
</ContentTemplate>
</DxAccordionItem>
*@
@* <DxAccordion Data="@Data"
ShowFilterPanel="true"
RootItemExpandButtonDisplayMode="AccordionExpandButtonDisplayMode.End"
SubItemExpandButtonIconCssClass="accordion-icon icon-square-plus"
SubItemCollapseButtonIconCssClass="accordion-icon icon-square-minus">
<DataMappings>
<DxAccordionDataMapping Text="Name"
Key="Id"
ParentKey="CategoryId"/>
</DataMappings>
<ItemContentTemplate>
@{
if (context.Level == 0)
{
//var orderItemPallet = ((OrderItemPallet)(context.DataItem));
//text = ((OrderItemPallet)(context.DataItem)).OrderItemId.ToString() + " dfgdfsg";
//var selectedOrderItemDto = SelectedOrder!.OrderItemDtos.First(x => x.Id == orderItemPallet.OrderItemId);
var selectedOrderItemDto = (OrderItemDto)(context.DataItem);
<DxFormLayout Context="ctxFormLayout" Data="@selectedOrderItemDto" CaptionPosition="CaptionPosition.Vertical" CssClass="w-100" ItemUpdating="@((pair) => OnItemUpdating(pair.Key, pair.Value))">
<DxFormLayoutItem Context="ctxFormLayoutItem" ColSpanMd="12">
@for (var index = 0; index < selectedOrderItemDto.OrderItemPallets!.Count; index++)
{
var localI = index + 1;
var currentOrderItemPallet = selectedOrderItemDto.OrderItemPallets![index];
<DxFormLayout Context="ctxFromLayoutPallet" Data="@currentOrderItemPallet" CaptionPosition="CaptionPosition.Vertical" CssClass="w-100 measuring-form-layout"
ItemUpdating="@((pair) => OnItemUpdating2(pair.Key, pair.Value, currentOrderItemPallet))">
<DxFormLayoutItem Context="ctxFromLayoutItemPallet" ColSpanMd="1" BeginRow="true">
<text>@(localI).mérés</text>
</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>
*@
</div>
</div>
@code {
}

View File

@ -14,6 +14,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FruitBank.Common.Helpers;
namespace FruitBankHybrid.Shared.Pages
{
@ -57,13 +58,13 @@ namespace FruitBankHybrid.Shared.Pages
orderItem.OrderItemPallets.Add(new OrderItemPallet
{
OrderItemId = orderItem.Id,
//OrderItem = orderItem,
OrderItemDto = orderItem,
});
orderItem.OrderItemPallets.Add(new OrderItemPallet
{
OrderItemId = orderItem.Id,
//OrderItem = orderItem,
OrderItemDto = orderItem,
});
}
@ -80,14 +81,67 @@ namespace FruitBankHybrid.Shared.Pages
=> MeasuringService.GetShippingDateCssClassNames(date, _measuringDates);
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)
=> MeasuringService.IsCustomItemPalletMeasuredAndValid(orderItemPallet, SelectedOrderItem!.IsMeasurable);
=> MeasuringService.IsCustomItemPalletMeasuredAndValid(orderItemPallet, orderItemPallet.OrderItemDto!.IsMeasurable);
private void OnSelectedOrderChanged(SelectedDataItemChangedEventArgs<OrderDto> eventArgs)
{
//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();
}
}
}

View File

@ -38,8 +38,8 @@ public class MeasuringService
case nameof(ShippingItemPallet.PalletWeight):
return IsCustomItemPalletMeasuredAndValid(shippingItemPallet, isMeasurable) ? "text-success" : (shippingItemPallet.PalletWeight < 0 || shippingItemPallet.NetWeight < 0 ? "text-danger" : "");
break;
case nameof(ShippingItemPallet.Quantity):
return IsCustomItemPalletMeasuredAndValid(shippingItemPallet, isMeasurable) ? "text-success" : (shippingItemPallet.Quantity < 0 ? "text-danger" : "");
case nameof(ShippingItemPallet.TrayQuantity):
return IsCustomItemPalletMeasuredAndValid(shippingItemPallet, isMeasurable) ? "text-success" : (shippingItemPallet.TrayQuantity < 0 ? "text-danger" : "");
break;
case nameof(ShippingItemPallet.GrossWeight):
return IsCustomItemPalletMeasuredAndValid(shippingItemPallet, isMeasurable) ? "text-success" : (shippingItemPallet.GrossWeight < 0 || shippingItemPallet.NetWeight < 0 ? "text-danger" : "");