implement AvailableQuantity
This commit is contained in:
parent
1e0e2146ca
commit
29a15fe8ac
|
|
@ -67,5 +67,8 @@ public class ProductDto : MgProductDto, IProductDto
|
||||||
set => throw new Exception($"ProductDto.IncomingQuantity not set");
|
set => throw new Exception($"ProductDto.IncomingQuantity not set");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||||
|
public int AvailableQuantity => StockQuantity + IncomingQuantity;
|
||||||
|
|
||||||
public bool HasMeasuringValues() => Id > 0 && NetWeight != 0 && IsMeasurable;
|
public bool HasMeasuringValues() => Id > 0 && NetWeight != 0 && IsMeasurable;
|
||||||
}
|
}
|
||||||
|
|
@ -9,6 +9,7 @@ using System.ComponentModel.DataAnnotations;
|
||||||
using Nop.Core.Domain.Catalog;
|
using Nop.Core.Domain.Catalog;
|
||||||
using DataType = LinqToDB.DataType;
|
using DataType = LinqToDB.DataType;
|
||||||
using FruitBank.Common.Dtos;
|
using FruitBank.Common.Dtos;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace FruitBank.Common.Entities;
|
namespace FruitBank.Common.Entities;
|
||||||
|
|
||||||
|
|
@ -21,6 +22,12 @@ public class ShippingItem : MgEntityBase, IShippingItem
|
||||||
public int? ProductId { get; set; }
|
public int? ProductId { get; set; }
|
||||||
|
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// get => ProductDto?.Name ?? Name
|
||||||
|
/// </summary>
|
||||||
|
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||||
|
public string ProductName => ProductDto?.Name ?? Name;
|
||||||
|
|
||||||
public int PalletsOnDocument { get; set; }
|
public int PalletsOnDocument { get; set; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
namespace FruitBank.Common.Interfaces;
|
||||||
|
|
||||||
|
public interface IAvailableQuantity
|
||||||
|
{
|
||||||
|
int AvailableQuantity { get; }
|
||||||
|
}
|
||||||
|
|
@ -2,6 +2,6 @@
|
||||||
|
|
||||||
namespace FruitBank.Common.Interfaces;
|
namespace FruitBank.Common.Interfaces;
|
||||||
|
|
||||||
public interface IProductDto : IMgProductDto, ITare, IIncomingQuantity, IMeasuringAttributeValues
|
public interface IProductDto : IMgProductDto, ITare, IIncomingQuantity, IAvailableQuantity, IMeasuringAttributeValues
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
@ -86,7 +86,7 @@
|
||||||
@bind-Value="@SelectedShippingItem"
|
@bind-Value="@SelectedShippingItem"
|
||||||
Text="Select item"
|
Text="Select item"
|
||||||
ValueFieldName="@nameof(ShippingItem.Id)"
|
ValueFieldName="@nameof(ShippingItem.Id)"
|
||||||
TextFieldName="@(nameof(ShippingItem.Name))"
|
TextFieldName="@(nameof(ShippingItem.ProductName))"
|
||||||
CssClass="cw-480"
|
CssClass="cw-480"
|
||||||
SearchMode="ListSearchMode.AutoSearch"
|
SearchMode="ListSearchMode.AutoSearch"
|
||||||
SearchFilterCondition="ListSearchFilterCondition.Contains"
|
SearchFilterCondition="ListSearchFilterCondition.Contains"
|
||||||
|
|
@ -133,7 +133,7 @@
|
||||||
@if (SelectedShippingItem is { ProductId: > 0 })
|
@if (SelectedShippingItem is { ProductId: > 0 })
|
||||||
{
|
{
|
||||||
<h3 style="margin-bottom: 30px;" class="@(SelectedShippingItem.IsMeasured && SelectedShippingItem.ShippingItemPallets!.All(x => x.IsMeasuredAndValid(SelectedShippingItem.IsMeasurable)) ? "text-success" : "")">
|
<h3 style="margin-bottom: 30px;" class="@(SelectedShippingItem.IsMeasured && SelectedShippingItem.ShippingItemPallets!.All(x => x.IsMeasuredAndValid(SelectedShippingItem.IsMeasurable)) ? "text-success" : "")">
|
||||||
@SelectedShippingItem.Name
|
@SelectedShippingItem.ProductName
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<DxFormLayout Data="@SelectedShippingItem" CaptionPosition="CaptionPosition.Vertical" CssClass="w-100">
|
<DxFormLayout Data="@SelectedShippingItem" CaptionPosition="CaptionPosition.Vertical" CssClass="w-100">
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ namespace FruitBankHybrid.Shared.Pages
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<ShippingItem>? GetShippingItemsDataSource(Shipping? shipping)
|
private static List<ShippingItem>? GetShippingItemsDataSource(Shipping? shipping)
|
||||||
=> shipping?.ShippingDocuments?.SelectMany(sd => sd.ShippingItems!).OrderBy(si => si.Name).ToList() ?? null;
|
=> shipping?.ShippingDocuments?.SelectMany(sd => sd.ShippingItems!).OrderBy(si => si.ProductName).ToList() ?? null;
|
||||||
|
|
||||||
private async Task OnMeasuringDateChanged(DateTime selectedDateTime)
|
private async Task OnMeasuringDateChanged(DateTime selectedDateTime)
|
||||||
=> await RefreshShippingsFromDb(selectedDateTime);
|
=> await RefreshShippingsFromDb(selectedDateTime);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue