123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- using InABox.Core;
- using System;
- using System.Collections.Generic;
- using System.Linq.Expressions;
- using System.Text;
- namespace Comal.Classes
- {
- public class ProductInstanceFreeStockAggregate : CoreAggregate<ProductInstance, StockMovement, double>
- {
- public override Expression<Func<StockMovement, double>> Aggregate => x => x.Qty;
- public override Filter<StockMovement> Filter => new Filter<StockMovement>(x => x.Job).NotLinkValid();
- public override Dictionary<Expression<Func<StockMovement, object>>, Expression<Func<ProductInstance, object>>>
- Links =>
- new Dictionary<Expression<Func<StockMovement, object>>, Expression<Func<ProductInstance, object>>>()
- {
- { StockMovement => StockMovement.Product.ID, Instance => Instance.Product.ID },
- { StockMovement => StockMovement.Style.ID, Instance => Instance.Style.ID },
- { StockMovement => StockMovement.Dimensions.UnitSize, Instance => Instance.Dimensions.UnitSize },
- };
- public override AggregateCalculation Calculation => AggregateCalculation.Sum;
- }
- public class ProductInstance : DimensionedEntity<StockDimensions>, IRemotable, IPersistent, IProductInstance,
- ISequenceable, ILicense<ProductManagementLicense>
- {
- [NullEditor] public long Sequence { get; set; }
- [NullEditor] public ProductLink Product { get; set; }
- [EditorSequence(1)]
- public ProductStyleLink Style { get; set; }
- [EditorSequence(2)]
- [RequiredColumn]
- [DimensionsEditor(typeof(StockDimensions), AllowEditingUnit = false)]
- public override StockDimensions Dimensions { get; set; }
- [IntegerEditor]
- [EditorSequence(3)]
- [LoggableProperty]
- public int MinimumStockLevel { get; set; }
- [Aggregate(typeof(ProductInstanceFreeStockAggregate))]
- [DoubleEditor(Editable = Editable.Hidden)]
- public double FreeStock { get; set; }
- [CurrencyEditor(Visible = Visible.Optional)]
- [EditorSequence(5)]
- [LoggableProperty]
- public double NettCost { get; set; }
- [CurrencyEditor(Visible = Visible.Optional)]
- [EditorSequence(4)]
- [LoggableProperty]
- public double AverageCost { get; set; }
- [CurrencyEditor(Visible = Visible.Optional, Editable = Editable.Disabled)]
- [EditorSequence(5)]
- [LoggableProperty]
- public double LastCost { get; set; }
- }
- }
|