StockTaking in progress...
This commit is contained in:
parent
e13e32dc57
commit
1b6aae83f1
|
|
@ -13,6 +13,7 @@ using Nop.Core;
|
|||
//using Nop.Core.Domain.Catalog;
|
||||
using Nop.Core.Domain.Common;
|
||||
using Nop.Core.Domain.Orders;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Globalization;
|
||||
using System.Linq.Expressions;
|
||||
|
|
@ -21,7 +22,7 @@ namespace FruitBank.Common.Dtos;
|
|||
|
||||
public class OrderDto : MgOrderDto<OrderItemDto, ProductDto>, IOrderDto
|
||||
{
|
||||
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
private static Expression<Func<OrderDto, GenericAttributeDto, bool>> RelationWithGenericAttribute => (orderDto, genericAttributeDto) =>
|
||||
orderDto.Id == genericAttributeDto.EntityId && genericAttributeDto.KeyGroup == nameof(Order);
|
||||
|
||||
|
|
@ -29,21 +30,21 @@ public class OrderDto : MgOrderDto<OrderItemDto, ProductDto>, IOrderDto
|
|||
[Association(ThisKey = nameof(Id), OtherKey = nameof(GenericAttribute.EntityId), ExpressionPredicate = nameof(RelationWithGenericAttribute), CanBeNull = true)]
|
||||
public List<GenericAttributeDto> GenericAttributes { get; set; }
|
||||
|
||||
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
public bool IsMeasured
|
||||
{
|
||||
get => IsMeasuredAndValid();
|
||||
set => throw new Exception($"OrderDto.IsMeasured not set");
|
||||
}
|
||||
|
||||
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
public bool IsMeasurable
|
||||
{
|
||||
get => OrderItemDtos.Any(oi => oi.IsMeasurable);
|
||||
set => throw new Exception($"OrderDto.IsMeasurable not set");
|
||||
}
|
||||
|
||||
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
public string TimeOfReceiptText
|
||||
{
|
||||
get
|
||||
|
|
@ -60,25 +61,25 @@ public class OrderDto : MgOrderDto<OrderItemDto, ProductDto>, IOrderDto
|
|||
}
|
||||
}
|
||||
|
||||
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
public DateTime DateOfReceiptOrCreated => DateOfReceipt ?? CreatedOnUtc;
|
||||
|
||||
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
public DateTime? DateOfReceipt => GenericAttributes.GetValueOrNull<DateTime>(nameof(IOrderDto.DateOfReceipt));
|
||||
|
||||
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
public int RevisorId => GenericAttributes.GetValueOrDefault(nameof(IOrderDto.RevisorId), 0);
|
||||
|
||||
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
public int MeasurementOwnerId => GenericAttributes.GetValueOrDefault(nameof(IOrderDto.MeasurementOwnerId), 0);
|
||||
|
||||
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
public bool IsAllOrderItemAudited => OrderItemDtos.Count > 0 && OrderItemDtos.All(oi => oi.IsAudited);
|
||||
|
||||
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
public bool IsAllOrderItemAvgWeightValid => OrderItemDtos.All(oi => oi.AverageWeightIsValid);
|
||||
|
||||
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
public MeasuringStatus MeasuringStatus
|
||||
{
|
||||
get
|
||||
|
|
@ -99,7 +100,7 @@ public class OrderDto : MgOrderDto<OrderItemDto, ProductDto>, IOrderDto
|
|||
public OrderDto(Order order) : base(order)
|
||||
{ }
|
||||
|
||||
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
public bool IsComplete => OrderStatus == OrderStatus.Complete;
|
||||
|
||||
public bool HasMeasuringAccess(int? customerId, bool isRevisorUser = false)
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ using Newtonsoft.Json;
|
|||
using Nop.Core;
|
||||
using Nop.Core.Domain.Common;
|
||||
using Nop.Core.Domain.Orders;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
|
|
@ -15,7 +16,7 @@ namespace FruitBank.Common.Dtos;
|
|||
|
||||
public class OrderItemDto : MgOrderItemDto<ProductDto>, IOrderItemDto
|
||||
{
|
||||
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
private static Expression<Func<OrderItemDto, GenericAttributeDto, bool>> RelationWithGenericAttribute => (orderItemDto, genericAttributeDto) =>
|
||||
orderItemDto.Id == genericAttributeDto.EntityId && genericAttributeDto.KeyGroup == nameof(OrderItem);
|
||||
|
||||
|
|
@ -29,28 +30,28 @@ public class OrderItemDto : MgOrderItemDto<ProductDto>, IOrderItemDto
|
|||
[Association(ThisKey = nameof(OrderId), OtherKey = nameof(OrderDto.Id), CanBeNull = false)]
|
||||
public OrderDto OrderDto { get; set; }
|
||||
|
||||
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
public bool IsMeasured
|
||||
{
|
||||
get => IsMeasuredAndValid();
|
||||
set => throw new Exception($"OrderItemDto.IsMeasured not set");
|
||||
}
|
||||
|
||||
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
[NotColumn, NotMapped, 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]
|
||||
[NotColumn, NotMapped, 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, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
public double NetWeight
|
||||
{
|
||||
get
|
||||
|
|
@ -67,7 +68,7 @@ public class OrderItemDto : MgOrderItemDto<ProductDto>, IOrderItemDto
|
|||
}
|
||||
}
|
||||
|
||||
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
public double GrossWeight
|
||||
{
|
||||
get
|
||||
|
|
@ -84,20 +85,20 @@ public class OrderItemDto : MgOrderItemDto<ProductDto>, IOrderItemDto
|
|||
}
|
||||
}
|
||||
|
||||
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
public double AverageWeight => IsMeasurable && OrderItemPallets.Count > 0 ? double.Round(OrderItemPallets.Sum(oip => oip.AverageWeight) / OrderItemPallets.Count, 1) : 0d;
|
||||
|
||||
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
public double AverageWeightDifference => IsMeasurable ? double.Round(ProductDto!.AverageWeight - AverageWeight, 1) : 0;
|
||||
|
||||
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
public bool AverageWeightIsValid => !IsMeasurable ||
|
||||
(ProductDto!.AverageWeight > 0 && ((AverageWeightDifference / ProductDto!.AverageWeight) * 100) < ProductDto!.AverageWeightTreshold);
|
||||
|
||||
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
public bool IsAudited => OrderItemPallets.Count > 0 && OrderItemPallets.All(oip => oip.IsAudited);
|
||||
|
||||
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
public MeasuringStatus MeasuringStatus
|
||||
{
|
||||
get
|
||||
|
|
|
|||
|
|
@ -2,17 +2,18 @@
|
|||
using LinqToDB.Mapping;
|
||||
using Mango.Nop.Core.Dtos;
|
||||
using Mango.Nop.Core.Extensions;
|
||||
using Mango.Nop.Core.Interfaces.ForeignKeys;
|
||||
using Newtonsoft.Json;
|
||||
//using Nop.Core.Domain.Catalog;
|
||||
using Nop.Core.Domain.Common;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq.Expressions;
|
||||
using Mango.Nop.Core.Interfaces.ForeignKeys;
|
||||
|
||||
namespace FruitBank.Common.Dtos;
|
||||
|
||||
public class ProductDto : MgProductDto, IProductDto
|
||||
{
|
||||
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
private static Expression<Func<ProductDto, GenericAttributeDto, bool>> RelationWithGenericAttribute => (orderItemDto, genericAttributeDto) =>
|
||||
orderItemDto.Id == genericAttributeDto.EntityId && genericAttributeDto.KeyGroup == "Product";// nameof(Product);
|
||||
|
||||
|
|
@ -27,7 +28,7 @@ public class ProductDto : MgProductDto, IProductDto
|
|||
//public ProductDto(Product product) : base(product)
|
||||
//{ }
|
||||
|
||||
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
public bool IsMeasurable
|
||||
{
|
||||
get => GenericAttributes.GetValueOrDefault<bool>(nameof(IMeasurable.IsMeasurable));
|
||||
|
|
@ -41,7 +42,7 @@ public class ProductDto : MgProductDto, IProductDto
|
|||
}
|
||||
}
|
||||
|
||||
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
public double Tare
|
||||
{
|
||||
get => GenericAttributes.GetValueOrDefault<double>(nameof(ITare.Tare));
|
||||
|
|
@ -49,14 +50,14 @@ public class ProductDto : MgProductDto, IProductDto
|
|||
set => throw new Exception($"ProductDto.Tare not set");
|
||||
}
|
||||
|
||||
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
public double NetWeight
|
||||
{
|
||||
get => GenericAttributes.GetValueOrDefault<double>(nameof(IMeasuringNetWeight.NetWeight));
|
||||
set => throw new Exception($"ProductDto.NetWeight not set");
|
||||
}
|
||||
|
||||
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
public int IncomingQuantity
|
||||
{
|
||||
get => GenericAttributes.GetValueOrDefault<int>(nameof(IIncomingQuantity.IncomingQuantity));
|
||||
|
|
@ -70,13 +71,13 @@ public class ProductDto : MgProductDto, IProductDto
|
|||
//}
|
||||
}
|
||||
|
||||
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
public int AvailableQuantity => StockQuantity + IncomingQuantity;
|
||||
|
||||
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
public double AverageWeight => GenericAttributes.GetValueOrDefault<double>(nameof(IProductDto.AverageWeight));
|
||||
|
||||
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
public double AverageWeightTreshold => GenericAttributes.GetValueOrDefault<double>(nameof(IProductDto.AverageWeightTreshold));
|
||||
|
||||
public bool HasMeasuringValues() => Id > 0 && NetWeight != 0 && IsMeasurable;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ using Newtonsoft.Json;
|
|||
using Nop.Core.Domain.Catalog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
|
@ -15,28 +16,28 @@ namespace FruitBank.Common.Dtos
|
|||
{
|
||||
public class StockQuantityHistoryDto : MgStockQuantityHistoryDto<ProductDto>, IStockQuantityHistoryDto
|
||||
{
|
||||
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
public int? StockQuantityHistoryId
|
||||
{
|
||||
get => StockQuantityHistoryExt?.StockQuantityHistoryId;
|
||||
set => StockQuantityHistoryExt!.StockQuantityHistoryId = value!.Value;
|
||||
}
|
||||
|
||||
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
public double? NetWeightAdjustment
|
||||
{
|
||||
get => StockQuantityHistoryExt?.NetWeightAdjustment;
|
||||
set => StockQuantityHistoryExt!.NetWeightAdjustment = value;
|
||||
}
|
||||
|
||||
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
public double? NetWeight
|
||||
{
|
||||
get => StockQuantityHistoryExt?.NetWeight;
|
||||
set => StockQuantityHistoryExt!.NetWeight = value;
|
||||
}
|
||||
|
||||
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
public bool IsInconsistent
|
||||
{
|
||||
get => StockQuantityHistoryExt?.IsInconsistent ?? false;
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public abstract class MeasuringItemPalletBase : MgEntityBase, IMeasuringItemPall
|
|||
set => _palletWeight = double.Round(value, 0);
|
||||
}
|
||||
|
||||
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
[NotColumn, System.ComponentModel.DataAnnotations.Schema.NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
public double NetWeight
|
||||
{
|
||||
get => CalculateNetWeight();
|
||||
|
|
@ -59,6 +59,7 @@ public abstract class MeasuringItemPalletBase : MgEntityBase, IMeasuringItemPall
|
|||
public DateTime Created { get; set; }
|
||||
public DateTime Modified { get; set; }
|
||||
|
||||
[NotColumn, System.ComponentModel.DataAnnotations.Schema.NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
public virtual MeasuringStatus MeasuringStatus => IsMeasured ? MeasuringStatus.Finnished : Id > 0 ? MeasuringStatus.Started : MeasuringStatus.NotStarted;
|
||||
|
||||
public void SetForeignKey(int foreignKey) => ForeignItemId = foreignKey;
|
||||
|
|
|
|||
|
|
@ -4,10 +4,11 @@ using FruitBank.Common.Interfaces;
|
|||
using LinqToDB.Mapping;
|
||||
using Newtonsoft.Json;
|
||||
using Nop.Core.Domain.Orders;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace FruitBank.Common.Entities;
|
||||
|
||||
[Table(Name = FruitBankConstClient.OrderItemPalletDbTableName)]
|
||||
[LinqToDB.Mapping.Table(Name = FruitBankConstClient.OrderItemPalletDbTableName)]
|
||||
[System.ComponentModel.DataAnnotations.Schema.Table(FruitBankConstClient.OrderItemPalletDbTableName)]
|
||||
public class OrderItemPallet : MeasuringItemPalletBase, IOrderItemPallet
|
||||
{
|
||||
|
|
@ -23,6 +24,7 @@ public class OrderItemPallet : MeasuringItemPalletBase, IOrderItemPallet
|
|||
[Association(ThisKey = nameof(OrderItemId), OtherKey = nameof(OrderItemDto.Id), CanBeNull = true)]
|
||||
public OrderItemDto? OrderItemDto { get; set; }
|
||||
|
||||
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
public override MeasuringStatus MeasuringStatus => IsAudited ? MeasuringStatus.Audited : base.MeasuringStatus;
|
||||
public override double CalculateNetWeight() => base.CalculateNetWeight();
|
||||
|
||||
|
|
@ -31,7 +33,7 @@ public class OrderItemPallet : MeasuringItemPalletBase, IOrderItemPallet
|
|||
return OrderItemId > 0 && base.IsValidSafeMeasuringValues();
|
||||
}
|
||||
|
||||
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
public double AverageWeight => double.Round(NetWeight / TrayQuantity, 1);
|
||||
/// <summary>
|
||||
/// "Szigorúbb" mint az IsValidSafeMeasuringValues()
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
using FruitBank.Common.Interfaces;
|
||||
using LinqToDB.Mapping;
|
||||
using Mango.Nop.Core.Entities;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace FruitBank.Common.Entities;
|
||||
|
||||
|
|
@ -14,7 +15,7 @@ public class ShippingDocumentToFiles : MgEntityBase, IShippingDocumentToFiles
|
|||
|
||||
public int DocumentTypeId { get; set; }
|
||||
|
||||
[NotColumn, NotMapped]
|
||||
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
public DocumentType DocumentType
|
||||
{
|
||||
get => (DocumentType)DocumentTypeId;
|
||||
|
|
|
|||
|
|
@ -1,16 +1,19 @@
|
|||
using AyCode.Core.Interfaces;
|
||||
using FruitBank.Common.Dtos;
|
||||
using FruitBank.Common.Enums;
|
||||
using FruitBank.Common.Interfaces;
|
||||
using LinqToDB;
|
||||
using LinqToDB.Mapping;
|
||||
using Mango.Nop.Core.Entities;
|
||||
using Newtonsoft.Json;
|
||||
using Nop.Core.Domain.Customers;
|
||||
using Nop.Core.Domain.Orders;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
//using Nop.Core.Domain.Catalog;
|
||||
using DataType = LinqToDB.DataType;
|
||||
using FruitBank.Common.Dtos;
|
||||
using FruitBank.Common.Enums;
|
||||
using Newtonsoft.Json;
|
||||
using Column = LinqToDB.Mapping.ColumnAttribute;
|
||||
using Table = LinqToDB.Mapping.TableAttribute;
|
||||
|
||||
namespace FruitBank.Common.Entities;
|
||||
|
||||
|
|
@ -29,7 +32,7 @@ public class ShippingItem : MgEntityBase, IShippingItem
|
|||
/// <summary>
|
||||
/// get => ProductDto?.Name ?? Name
|
||||
/// </summary>
|
||||
[NotColumn, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
public string ProductName => ProductDto?.Name ?? Name;
|
||||
|
||||
public int PalletsOnDocument { get; set; }
|
||||
|
|
@ -79,6 +82,7 @@ public class ShippingItem : MgEntityBase, IShippingItem
|
|||
[SkipValuesOnUpdate] public DateTime Created { get; set; }
|
||||
public DateTime Modified { get; set; }
|
||||
|
||||
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
public MeasuringStatus MeasuringStatus
|
||||
{
|
||||
get
|
||||
|
|
|
|||
|
|
@ -2,6 +2,10 @@
|
|||
using LinqToDB;
|
||||
using LinqToDB.Mapping;
|
||||
using Mango.Nop.Core.Entities;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Newtonsoft.Json;
|
||||
using Column = LinqToDB.Mapping.ColumnAttribute;
|
||||
using Table = LinqToDB.Mapping.TableAttribute;
|
||||
|
||||
namespace FruitBank.Common.Entities;
|
||||
|
||||
|
|
@ -9,21 +13,40 @@ namespace FruitBank.Common.Entities;
|
|||
[System.ComponentModel.DataAnnotations.Schema.Table(FruitBankConstClient.StockTakingItemDbTableName)]
|
||||
public class StockTakingItem : MgStockTakingItem<StockTaking, ProductDto>
|
||||
{
|
||||
public bool IsMeasurable { get; set; }
|
||||
|
||||
[Column(DataType = DataType.DecFloat, CanBeNull = false)]
|
||||
public double OriginalNetWeight { get; set; }
|
||||
|
||||
[Column(DataType = DataType.DecFloat, CanBeNull = false)]
|
||||
public double MeasuredNetWeight { get; set; }
|
||||
|
||||
public int InProcessOrdersQuantity { get; set; }
|
||||
|
||||
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
public int TotalOriginalQuantity => OriginalStockQuantity + InProcessOrdersQuantity;
|
||||
|
||||
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
public int QuantityDiff => IsMeasured ? MeasuredStockQuantity - TotalOriginalQuantity : 0;
|
||||
|
||||
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
public double NetWeightDiff => IsMeasurable && IsMeasured ? double.Round(MeasuredNetWeight - OriginalNetWeight, 1) : 0d;
|
||||
|
||||
[Association(ThisKey = nameof(Id), OtherKey = nameof(StockTakingItemPallet.StockTakingItemId), CanBeNull = true)]
|
||||
public List<StockTakingItemPallet>? StockTakingItemPallets { get; set; }
|
||||
|
||||
public bool IsRequiredForMeasuring => OriginalStockQuantity != 0 || OriginalNetWeight != 0;
|
||||
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
public bool IsRequiredForMeasuring => !IsInvalid && (TotalOriginalQuantity != 0 || OriginalNetWeight != 0);
|
||||
|
||||
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
public bool IsInvalid => TotalOriginalQuantity < 0;
|
||||
|
||||
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||||
public string DisplayText
|
||||
{
|
||||
get
|
||||
{
|
||||
if (IsInvalid) return $"[HIBA] {Product!.Name}";
|
||||
if (IsMeasured) return $"[KÉSZ] {Product!.Name}";
|
||||
|
||||
return IsRequiredForMeasuring ? $"[KÖT] {Product!.Name}" : $"{Product!.Name}";
|
||||
|
|
|
|||
|
|
@ -28,16 +28,12 @@ public class StockTakingItemPallet : MeasuringItemPalletBase, IStockTakingItemPa
|
|||
|
||||
public override bool IsValidSafeMeasuringValues()
|
||||
{
|
||||
return StockTakingItemId > 0 && base.IsValidSafeMeasuringValues();
|
||||
return StockTakingItemId > 0 && TrayQuantity >= 0 && TareWeight >= 0 && PalletWeight >= 0 && NetWeight >= 0 && GrossWeight >= 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// "Szigorúbb" mint az IsValidSafeMeasuringValues()
|
||||
/// </summary>
|
||||
/// <param name="isMeasurable"></param>
|
||||
/// <returns></returns>
|
||||
public override bool IsValidMeasuringValues(bool isMeasurable)
|
||||
{
|
||||
return StockTakingItemId > 0 && base.IsValidMeasuringValues(isMeasurable);
|
||||
return StockTakingItemId > 0 && TrayQuantity >= 0 && ((!isMeasurable && NetWeight == 0 && GrossWeight == 0 && PalletWeight == 0 && TareWeight == 0)
|
||||
|| (isMeasurable && NetWeight >= 0 && GrossWeight >= 0 && PalletWeight >= 0 && TareWeight >= 0));
|
||||
}
|
||||
}
|
||||
|
|
@ -5,7 +5,7 @@ namespace FruitBank.Common.Interfaces;
|
|||
|
||||
public interface IStockSignalREndpointCommon
|
||||
{
|
||||
public Task<List<StockTaking>?> GetStockTakings();
|
||||
public Task<List<StockTaking>?> GetStockTakings(bool loadRelations);
|
||||
public Task<List<StockTaking>?> GetStockTakingsByProductId(int productId);
|
||||
public Task<StockTaking?> AddStockTaking(StockTaking stockTaking);
|
||||
public Task<StockTaking?> UpdateStockTaking(StockTaking stockTaking);
|
||||
|
|
|
|||
|
|
@ -91,9 +91,14 @@ public class SignalRTags : AcSignalRTags
|
|||
public const int UpdateGenericAttributeDto = 169;
|
||||
|
||||
public const int GetStockTakings = 170;
|
||||
public const int AddStockTaking = 171;
|
||||
public const int UpdateStockTaking = 172;
|
||||
public const int GetStockTakingItems = 173;
|
||||
public const int GetStockTakingItemsById = 174;
|
||||
public const int AddStockTaking = 175;
|
||||
public const int GetStockTakingItemsByProductId = 175;
|
||||
public const int GetStockTakingItemsByStockTakingId = 176;
|
||||
public const int AddOrUpdateMeasuredStockTakingItemPallet = 177;
|
||||
|
||||
|
||||
public const int AuthenticateUser = 195;
|
||||
public const int RefreshToken = 200;
|
||||
|
|
|
|||
|
|
@ -14,21 +14,33 @@
|
|||
@inject FruitBankSignalRClient FruitBankSignalRClient
|
||||
|
||||
<GridStockTakingItemBase @ref="Grid" AutoSaveLayoutName="GridStockTakingItem" SignalRClient="FruitBankSignalRClient" Logger="_logger"
|
||||
CssClass="@GridCss" ValidationEnabled="false"
|
||||
FocusedRowChanged="Grid_FocusedRowChanged">
|
||||
CssClass="@GridCss" ValidationEnabled="false" FocusedRowChanged="Grid_FocusedRowChanged">
|
||||
<Columns>
|
||||
<DxGridDataColumn FieldName="Id" SortIndex="0" SortOrder="GridColumnSortOrder.Descending" ReadOnly="true" />
|
||||
|
||||
<DxGridDataColumn FieldName="StockTaking.StartDateTime" />
|
||||
|
||||
<DxGridDataColumn FieldName="@nameof(StockTakingItem.StockTakingId)" TextAlignment="GridTextAlignment.Left" Caption="Leltár időpontja">
|
||||
<CellDisplayTemplate>
|
||||
<span>@(((StockTakingItem)context.DataItem)?.StockTaking?.StartDateTime.ToString("g") ?? "")</span>
|
||||
</CellDisplayTemplate>
|
||||
</DxGridDataColumn>
|
||||
<DxGridDataColumn FieldName="Product.Name" />
|
||||
<DxGridDataColumn FieldName="IsMeasured" />
|
||||
<DxGridDataColumn FieldName="OriginalStockQuantity" />
|
||||
<DxGridDataColumn FieldName="@nameof(StockTakingItem.InProcessOrdersQuantity)" />
|
||||
<DxGridDataColumn FieldName="@nameof(StockTakingItem.TotalOriginalQuantity)" />
|
||||
<DxGridDataColumn FieldName="MeasuredStockQuantity" />
|
||||
|
||||
<DxGridDataColumn FieldName="OriginalNetWeight" />
|
||||
<DxGridDataColumn FieldName="MeasuredNetWeight" />
|
||||
|
||||
<DxGridDataColumn FieldName="Created" ReadOnly="true" />
|
||||
<DxGridDataColumn FieldName="Modified" ReadOnly="true" />
|
||||
<DxGridDataColumn FieldName="@nameof(StockTakingItem.QuantityDiff)" />
|
||||
<DxGridDataColumn FieldName="@nameof(StockTakingItem.NetWeightDiff)" />
|
||||
|
||||
<DxGridDataColumn FieldName="@nameof(StockTakingItem.IsMeasurable)" />
|
||||
<DxGridDataColumn FieldName="@nameof(StockTakingItem.IsMeasured)" />
|
||||
<DxGridDataColumn FieldName="@nameof(StockTakingItem.IsInvalid)" />
|
||||
|
||||
<DxGridDataColumn FieldName="Created" ReadOnly="true" Visible="false" DisplayFormat="g" />
|
||||
<DxGridDataColumn FieldName="Modified" ReadOnly="true" DisplayFormat="g" />
|
||||
<DxGridCommandColumn Visible="!IsMasterGrid" Width="120"></DxGridCommandColumn>
|
||||
</Columns>
|
||||
<ToolbarTemplate>
|
||||
|
|
@ -40,6 +52,7 @@
|
|||
</GridStockTakingItemBase>
|
||||
|
||||
@code {
|
||||
|
||||
//[Inject] public required ObjectLock ObjectLock { get; set; }
|
||||
[Inject] public required DatabaseClient Database { get; set; }
|
||||
|
||||
|
|
@ -70,7 +83,7 @@
|
|||
if (Grid == null) return;
|
||||
|
||||
//using (await ObjectLock.GetSemaphore<StockTakingItem>().UseWaitAsync())
|
||||
//if (forceReload) await Grid.ReloadDataSourceAsync();
|
||||
//if (forceReload) await Grid.ReloadDataSourceAsync();
|
||||
|
||||
if (forceReload) Grid.Reload();
|
||||
}
|
||||
|
|
@ -85,5 +98,24 @@
|
|||
FocusedRowVisibleIndex = args.VisibleIndex;
|
||||
EditItemsEnabled = true;
|
||||
}
|
||||
|
||||
// void Grid_CustomGroup(GridCustomGroupEventArgs e)
|
||||
// {
|
||||
// if (e.FieldName != "StockTaking.StartDateTime") return;
|
||||
|
||||
// e.SameGroup = ((StockTakingItem)e.DataItem1).StockTakingId == ((StockTakingItem)e.DataItem2).StockTakingId;
|
||||
// e.Handled = true;
|
||||
// }
|
||||
|
||||
// void Grid_CustomizeGroupValueDisplayText(GridCustomizeGroupValueDisplayTextEventArgs e)
|
||||
// {
|
||||
// return;
|
||||
|
||||
// if (e.FieldName != "StockTaking.StartDateTime") return;
|
||||
|
||||
// var startDate = (DateTime)e.Value;
|
||||
// e.DisplayText = startDate.ToString("g");
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
@using FruitBankHybrid.Shared.Extensions
|
||||
@using FruitBankHybrid.Shared.Services
|
||||
@using FruitBankHybrid.Shared.Services.SignalRs
|
||||
|
||||
@typeparam TPalletItem where TPalletItem : class, IMeasuringItemPalletBase
|
||||
|
||||
<DxFormLayout Context="ctxFromLayoutPallet" Data="@PalletItem" CaptionPosition="CaptionPosition.Vertical" CssClass="w-100 measuring-form-layout"
|
||||
|
|
|
|||
|
|
@ -1,8 +1,13 @@
|
|||
@using AyCode.Utils.Extensions
|
||||
@using AyCode.Core.Extensions
|
||||
@using AyCode.Utils.Extensions
|
||||
@using FruitBank.Common.Dtos
|
||||
@using FruitBank.Common.Entities
|
||||
@using FruitBank.Common.Helpers
|
||||
@using FruitBank.Common.Models
|
||||
@using FruitBank.Common.SignalRs
|
||||
@using FruitBankHybrid.Shared.Databases
|
||||
@using FruitBankHybrid.Shared.Extensions
|
||||
@using FruitBankHybrid.Shared.Services
|
||||
@using FruitBankHybrid.Shared.Services.SignalRs
|
||||
@using Mango.Nop.Core.Entities
|
||||
|
||||
|
|
@ -16,7 +21,7 @@
|
|||
Context="ctxProduct"
|
||||
InputId="cbProduct"
|
||||
Value="@SelectedStockTaking"
|
||||
ValueChanged="@((StockTaking stockTaking) => ValueChanged(stockTaking))">
|
||||
ValueChanged="@(async (StockTaking stockTaking) => await StockTakingComboValueChanged(stockTaking))">
|
||||
</DxComboBox>
|
||||
</DxFormLayoutItem>
|
||||
<DxFormLayoutItem ColSpanMd="4">
|
||||
|
|
@ -31,21 +36,70 @@
|
|||
</DxFormLayoutItem>
|
||||
@* TextFieldName="StockTakingItem.Product.Name" *@
|
||||
<DxFormLayoutItem ColSpanMd="1">
|
||||
<DxButton Text="Új" Enabled="@(_stockTakings.All(x => x.IsClosed))" Click="() => Callback()"></DxButton>
|
||||
<DxButton Text="Új" Enabled="@(_stockTakings.All(x => x.IsClosed))" Click="() => NewStockTakingClick()"></DxButton>
|
||||
</DxFormLayoutItem>
|
||||
<DxFormLayoutItem ColSpanMd="1">
|
||||
<DxButton Text="Módosít" Enabled="@(SelectedStockTaking?.IsClosed ?? false)" Click="() => Callback2()"></DxButton>
|
||||
<DxButton Text="Módosít" Enabled="@(SelectedStockTaking?.IsClosed ?? false)" Click="() => UpdateStockTakingClick()"></DxButton>
|
||||
</DxFormLayoutItem>
|
||||
<DxFormLayoutItem ColSpanMd="1">
|
||||
<DxButton Text="Lezárás" Enabled="@(SelectedStockTaking?.StockTakingItems?.Where(x=>x.IsRequiredForMeasuring).All(x=>x.IsMeasured) ?? false)" Click="() => Callback3()"></DxButton>
|
||||
<DxButton Text="Lezárás" Enabled="@(SelectedStockTaking?.StockTakingItems?.Where(x => x.IsRequiredForMeasuring).All(x => x.IsMeasured) ?? false)"
|
||||
Click="() => StockTakingCloseClick()"></DxButton>
|
||||
</DxFormLayoutItem>
|
||||
|
||||
</DxFormLayout>
|
||||
|
||||
<div style="margin-top: 50px;">
|
||||
@if (SelectedStockTakingItem is { ProductId: > 0 })
|
||||
{
|
||||
<h3 style="margin-bottom: 30px;" class="@(SelectedStockTakingItem.IsMeasured && SelectedStockTakingItem.StockTakingItemPallets!.All(x => x.IsMeasuredAndValid(SelectedStockTakingItem.IsMeasurable)) ? "text-success" : "")">
|
||||
#@(SelectedStockTakingItem.ProductId). @(SelectedStockTakingItem.Product!.Name)
|
||||
</h3>
|
||||
|
||||
<div>
|
||||
@{
|
||||
var a = $"Várható rekesz: {SelectedStockTakingItem.TotalOriginalQuantity} ({SelectedStockTakingItem.OriginalStockQuantity} + {SelectedStockTakingItem.InProcessOrdersQuantity}), Várható net.súly: {SelectedStockTakingItem.OriginalNetWeight} kg.";
|
||||
<span>@a</span>
|
||||
}
|
||||
</div>
|
||||
<DxFormLayout Data="@SelectedStockTakingItem" CaptionPosition="CaptionPosition.Vertical" CssClass="w-100">
|
||||
<DxFormLayoutItem Context="ctxShippingItemFromLayoutItem" ColSpanMd="12">
|
||||
@for (var index = 0; index < (SelectedStockTakingItem?.StockTakingItemPallets?.Count ?? 0); index++)
|
||||
{
|
||||
var localI = index + 1;
|
||||
var currentShippingItemPallet = SelectedStockTakingItem!.StockTakingItemPallets![index];
|
||||
|
||||
<PalletItemComponent IsMeasurable="@SelectedStockTakingItem!.IsMeasurable"
|
||||
MeasuringIndex="@localI"
|
||||
PalletItem="@currentShippingItemPallet"
|
||||
ProductId="@SelectedStockTakingItem.Product!.Id"
|
||||
AddOrUpdateSignalRTag="SignalRTags.AddOrUpdateMeasuredStockTakingItemPallet"
|
||||
OnPalletItemSaved="pallet => OnStockTakingItemPalletSaved(pallet)"
|
||||
OnPalletItemValueChanged="pallet => OnStockTakingItemPalletValueChanged(pallet, SelectedStockTakingItem)">
|
||||
</PalletItemComponent>
|
||||
}
|
||||
</DxFormLayoutItem>
|
||||
|
||||
@* <DxFormLayoutItem Context="vfdfgfd" ColSpanMd="12" BeginRow="true">
|
||||
<DxFormLayout CssClass="w-100">
|
||||
<DxFormLayoutItem ColSpanMd="1" BeginRow="false"><strong>TOTAL:</strong></DxFormLayoutItem>
|
||||
<DxFormLayoutItem ColSpanMd="2" BeginRow="false" Visible="@(SelectedStockTakingItem.IsMeasurable)" />
|
||||
<DxFormLayoutItem ColSpanMd="2" BeginRow="false" Visible="@(SelectedStockTakingItem.IsMeasurable)" />
|
||||
<DxFormLayoutItem ColSpanMd="2" BeginRow="false"><strong>Rekesz: @(SelectedStockTakingItem.MeasuredStockQuantity) db</strong></DxFormLayoutItem>
|
||||
<DxFormLayoutItem ColSpanMd="2" BeginRow="false" Visible="@(SelectedStockTakingItem.IsMeasurable)"><strong>Br: @(SelectedStockTakingItem.MeasuredGrossWeight) kg</strong></DxFormLayoutItem>
|
||||
<DxFormLayoutItem ColSpanMd="1" BeginRow="false" Visible="@(SelectedStockTakingItem.IsMeasurable)"><strong>Net: @(SelectedStockTakingItem.MeasuredNetWeight) kg</strong></DxFormLayoutItem>
|
||||
<DxFormLayoutItem ColSpanMd="1" BeginRow="false" />
|
||||
</DxFormLayout>
|
||||
</DxFormLayoutItem>
|
||||
*@
|
||||
</DxFormLayout>
|
||||
}
|
||||
</div>
|
||||
|
||||
@code
|
||||
{
|
||||
[Inject] public required DatabaseClient Database { get; set; }
|
||||
[Inject] public required LoggedInModel LoggedInModel { get; set; }
|
||||
[Inject] public required IDialogService DialogService { get; set; } = null!;
|
||||
[Inject] public required FruitBankSignalRClient FruitBankSignalRClient { get; set; }
|
||||
|
||||
List<StockTaking> _stockTakings { get; set; } = [];
|
||||
|
|
@ -63,26 +117,26 @@
|
|||
{
|
||||
LoadingPanelVisibility.Visible = true;
|
||||
|
||||
_stockTakings = await FruitBankSignalRClient.GetStockTakings() ?? [];
|
||||
ValueChanged(_stockTakings.FirstOrDefault());
|
||||
_stockTakings = await FruitBankSignalRClient.GetStockTakings(false) ?? [];
|
||||
await StockTakingComboValueChanged(_stockTakings.FirstOrDefault());
|
||||
|
||||
LoadingPanelVisibility.Visible = false;
|
||||
}
|
||||
|
||||
private async Task Callback()
|
||||
private async Task NewStockTakingClick()
|
||||
{
|
||||
var stockTaking = new StockTaking();
|
||||
stockTaking.StartDateTime = DateTime.Now;
|
||||
stockTaking.Creator = LoggedInModel.CustomerDto!.Id;
|
||||
|
||||
var resultStockTaking = await FruitBankSignalRClient.AddStockTaking(stockTaking);
|
||||
if (resultStockTaking == null) return;
|
||||
var resultStockTakings = await FruitBankSignalRClient.AddStockTaking(stockTaking);
|
||||
if (resultStockTakings == null) return;
|
||||
|
||||
_stockTakings.Add(resultStockTaking);
|
||||
StateHasChanged();
|
||||
_stockTakings.UpdateCollection(resultStockTakings, false);
|
||||
await StockTakingComboValueChanged(_stockTakings.FirstOrDefault(x => x.Id == stockTaking.Id));
|
||||
}
|
||||
|
||||
private async Task Callback2()
|
||||
private async Task UpdateStockTakingClick()
|
||||
{
|
||||
// var resultStockTaking = await FruitBankSignalRClient.AddStockTaking(stockTaking);
|
||||
// if (resultStockTaking == null) return;
|
||||
|
|
@ -91,7 +145,7 @@
|
|||
StateHasChanged();
|
||||
}
|
||||
|
||||
private async Task Callback3()
|
||||
private async Task StockTakingCloseClick()
|
||||
{
|
||||
// var resultStockTaking = await FruitBankSignalRClient.AddStockTaking(stockTaking);
|
||||
// if (resultStockTaking == null) return;
|
||||
|
|
@ -100,11 +154,58 @@
|
|||
StateHasChanged();
|
||||
}
|
||||
|
||||
private void ValueChanged(StockTaking? newValue)
|
||||
private async Task StockTakingComboValueChanged(StockTaking? newValue)
|
||||
{
|
||||
SelectedStockTaking = newValue;
|
||||
_stockTakingItems = SelectedStockTaking?.StockTakingItems?.OrderByDescending(x => x.IsMeasured).ThenByDescending(x => x.OriginalStockQuantity != 0 || x.OriginalNetWeight != 0).ThenBy(x => x.Product?.Name).ToList() ?? [];
|
||||
|
||||
SelectedStockTaking?.StockTakingItems = await FruitBankSignalRClient.GetStockTakingItemsByStockTakingId(SelectedStockTaking.Id);
|
||||
_stockTakingItems = SelectedStockTaking?.StockTakingItems?
|
||||
.OrderByDescending(x => x.IsInvalid)
|
||||
.ThenByDescending(x => x.IsRequiredForMeasuring)
|
||||
.ThenBy(x => x.Product?.Name)
|
||||
.ToList() ?? [];
|
||||
|
||||
foreach (var stockTakingItem in _stockTakingItems)
|
||||
{
|
||||
stockTakingItem.StockTakingItemPallets ??= [];
|
||||
stockTakingItem.StockTaking = SelectedStockTaking;
|
||||
|
||||
if (!stockTakingItem.IsInvalid && stockTakingItem.StockTakingItemPallets.Count == 0)
|
||||
{
|
||||
stockTakingItem.StockTakingItemPallets.Add(MeasurementService.CreateNewStockTakingItemPallet(stockTakingItem, LoggedInModel.CustomerDto));
|
||||
}
|
||||
}
|
||||
|
||||
SelectedStockTakingItem = _stockTakingItems.FirstOrDefault();
|
||||
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private Task OnStockTakingItemPalletValueChanged(StockTakingItemPallet stockTakingItemPallet, StockTakingItem stockTakingItem)
|
||||
{
|
||||
// MeasuringValuesHelper.SetShippingItemTotalMeasuringValues(stockTakingItem);
|
||||
// BtnSaveEnabled = stockTakingItem.IsValidMeasuringValues() && stockTakingItemPallet.IsValidMeasuringValues(stockTakingItem.IsMeasurable);
|
||||
|
||||
StateHasChanged();
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private async Task OnStockTakingItemPalletSaved(StockTakingItemPallet? responseStockTakingItemPallet)
|
||||
{
|
||||
if (responseStockTakingItemPallet != null)
|
||||
{
|
||||
SelectedStockTakingItem!.MeasuredStockQuantity = responseStockTakingItemPallet.TrayQuantity;
|
||||
|
||||
if (SelectedStockTakingItem.IsMeasurable) SelectedStockTakingItem.MeasuredNetWeight = responseStockTakingItemPallet.NetWeight;
|
||||
|
||||
SelectedStockTakingItem.StockTakingItemPallets!.UpdateCollection(responseStockTakingItemPallet, false);
|
||||
SelectedStockTakingItem.IsMeasured = SelectedStockTakingItem.StockTakingItemPallets!.All(sip => sip.IsMeasuredAndValid(SelectedStockTakingItem.IsMeasurable));
|
||||
|
||||
// MeasuringValuesHelper.SetShippingItemTotalMeasuringValues(SelectedShippingItem);
|
||||
}
|
||||
else await DialogService.ShowMessageBoxAsync("Hiba", "Adatok mentése sikertelen volt, ellenőrizze a mérés adatait!", MessageBoxRenderStyle.Danger);
|
||||
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ public class MeasurementService(IEnumerable<IAcLogWriterClientBase> logWriters)
|
|||
|
||||
public static ShippingItemPallet CreateNewShippingItemPallet(ShippingItem shippingItem, CustomerDto? customerDto)
|
||||
{
|
||||
var shippingItemPallet = CreatePalletItem<ShippingItemPallet>(shippingItem.Id, shippingItem.ProductDto?.Tare, shippingItem.IsMeasurable, customerDto);
|
||||
var shippingItemPallet = CreatePalletItemBase<ShippingItemPallet>(shippingItem.Id, shippingItem.ProductDto?.Tare, shippingItem.IsMeasurable, customerDto);
|
||||
|
||||
shippingItemPallet.ShippingItem = shippingItem;
|
||||
shippingItemPallet.PalletWeight = shippingItem.IsMeasurable ? shippingItem.Pallet?.Weight ?? 0 : 0;
|
||||
|
|
@ -75,13 +75,24 @@ public class MeasurementService(IEnumerable<IAcLogWriterClientBase> logWriters)
|
|||
|
||||
public static OrderItemPallet CreateNewOrderItemPallet(OrderItemDto orderItemDto, CustomerDto? customerDto)
|
||||
{
|
||||
var orderItemPallet = CreatePalletItem<OrderItemPallet>(orderItemDto.Id, orderItemDto.ProductDto?.Tare, orderItemDto.IsMeasurable, customerDto);
|
||||
var orderItemPallet = CreatePalletItemBase<OrderItemPallet>(orderItemDto.Id, orderItemDto.ProductDto?.Tare, orderItemDto.IsMeasurable, customerDto);
|
||||
|
||||
orderItemPallet.OrderItemDto = orderItemDto;
|
||||
return orderItemPallet;
|
||||
}
|
||||
|
||||
private static TPalletItem CreatePalletItem<TPalletItem>(int foreignKey, double? tare, bool isMeasurable, CustomerDto? customerDto) where TPalletItem : MeasuringItemPalletBase
|
||||
public static StockTakingItemPallet CreateNewStockTakingItemPallet(StockTakingItem stockTakingItem, CustomerDto? customerDto)
|
||||
{
|
||||
var stockTakingItemPallet = CreatePalletItemBase<StockTakingItemPallet>(stockTakingItem.Id, stockTakingItem.Product?.Tare, stockTakingItem.IsMeasurable, customerDto);
|
||||
|
||||
stockTakingItemPallet.GrossWeight = stockTakingItem.IsMeasurable ? -1 : 0;
|
||||
stockTakingItemPallet.TrayQuantity = -1;
|
||||
|
||||
stockTakingItemPallet.StockTakingItem = stockTakingItem;
|
||||
return stockTakingItemPallet;
|
||||
}
|
||||
|
||||
private static TPalletItem CreatePalletItemBase<TPalletItem>(int foreignKey, double? tare, bool isMeasurable, CustomerDto? customerDto) where TPalletItem : MeasuringItemPalletBase
|
||||
{
|
||||
var palletItem = Activator.CreateInstance<TPalletItem>();
|
||||
|
||||
|
|
|
|||
|
|
@ -281,7 +281,7 @@ namespace FruitBankHybrid.Shared.Services.SignalRs
|
|||
}
|
||||
|
||||
|
||||
public Task<List<StockTaking>?> GetStockTakings() => GetAllAsync<List<StockTaking>>(SignalRTags.GetStockTakings);
|
||||
public Task<List<StockTaking>?> GetStockTakings(bool loadRelations) => GetAllAsync<List<StockTaking>>(SignalRTags.GetStockTakings, [loadRelations]);
|
||||
|
||||
public async Task<List<StockTaking>?> GetStockTakingsByProductId(int productId)
|
||||
{
|
||||
|
|
@ -290,25 +290,18 @@ namespace FruitBankHybrid.Shared.Services.SignalRs
|
|||
|
||||
public Task<StockTaking?> AddStockTaking(StockTaking stockTaking) => PostDataAsync(SignalRTags.AddStockTaking, stockTaking);
|
||||
|
||||
public async Task<StockTaking?> UpdateStockTaking(StockTaking stockTaking)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public Task<StockTaking?> UpdateStockTaking(StockTaking stockTaking) => PostDataAsync(SignalRTags.UpdateStockTaking, stockTaking);
|
||||
|
||||
public Task<List<StockTakingItem>?> GetStockTakingItems() => GetAllAsync<List<StockTakingItem>>(SignalRTags.GetStockTakingItems);
|
||||
|
||||
public Task<StockTakingItem?> GetStockTakingItemsById(int stockTakingItemId)
|
||||
=> GetByIdAsync<StockTakingItem>(SignalRTags.GetStockTakingItemsById, [stockTakingItemId]);
|
||||
|
||||
public async Task<List<StockTakingItem>?> GetStockTakingItemsByProductId(int productId)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public Task<List<StockTakingItem>?> GetStockTakingItemsByProductId(int productId)
|
||||
=> GetAllAsync<List<StockTakingItem>>(SignalRTags.GetStockTakingItemsByProductId, [productId]);
|
||||
|
||||
public async Task<List<StockTakingItem>?> GetStockTakingItemsByStockTakingId(int stockTakingId)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public Task<List<StockTakingItem>?> GetStockTakingItemsByStockTakingId(int stockTakingId)
|
||||
=> GetAllAsync<List<StockTakingItem>>(SignalRTags.GetStockTakingItemsByStockTakingId, [stockTakingId]);
|
||||
|
||||
public async Task<StockTakingItem?> AddStockTakingItem(StockTakingItem stockTakingItem)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue