using InABox.Core; using System; namespace Comal.Classes { [UserTracking(typeof(ManufacturingPacket))] [Caption("Components")] public class ManufacturingPacketComponent : DimensionedEntity, IRemotable, IPersistent, IOneToMany, ILicense, ISequenceable { // Used to be Cascade, but now must be delete, because you might delete a packet when on the staging screen, and not want to get rid of the components, obviously. [EntityRelationship(DeleteAction.SetNull)] public ManufacturingPacketLink Packet { get; set; } [NullEditor] [EntityRelationship(DeleteAction.Cascade)] public SetoutLink Setout { get; set; } [EntityRelationship(DeleteAction.SetNull)] [EditorSequence(1)] public ProductLink Product { get; set; } [TextBoxEditor] [EditorSequence(2)] public string Description { get; set; } [DimensionsEditor(typeof(ProductDimensions))] [EditorSequence(4)] public override ProductDimensions Dimensions { get; set; } [EditorSequence(5)] public int Quantity { get; set; } [NullEditor] public int Consumed { get; set; } /// /// When a picking list is creating for a , we save a link to the requisition, /// so that we don't require the same component twice. /// [NullEditor] public PickingListLink PickingList { get; set; } [Obsolete("Replaced by Requisition")] public RequisitionLink Requisition { get; set; } [NullEditor] public long Sequence { get; set; } static ManufacturingPacketComponent() { LinkedProperties.Register(x => x.Product, x => x.Name, x => x.Description); LinkedProperties.Register(x => x.Product.UnitOfMeasure, x => x.ID, x => x.Dimensions.Unit.ID); LinkedProperties.Register(x => x.Product.UnitOfMeasure, x => x.Code, x => x.Dimensions.Unit.Code); LinkedProperties.Register(x => x.Product.UnitOfMeasure, x => x.Description, x => x.Dimensions.Unit.Description); LinkedProperties.Register(x => x.Product.UnitOfMeasure, x => x.HasLength, x => x.Dimensions.Unit.HasLength); LinkedProperties.Register(x => x.Product.UnitOfMeasure, x => x.HasHeight, x => x.Dimensions.Unit.HasHeight); LinkedProperties.Register(x => x.Product.UnitOfMeasure, x => x.HasQuantity, x => x.Dimensions.Unit.HasQuantity); LinkedProperties.Register(x => x.Product.UnitOfMeasure, x => x.HasWeight, x => x.Dimensions.Unit.HasWeight); LinkedProperties.Register(x => x.Product.UnitOfMeasure, x => x.HasWidth, x => x.Dimensions.Unit.HasWidth); LinkedProperties.Register(x => x.Product.UnitOfMeasure, x => x.Formula, x => x.Dimensions.Unit.Formula); LinkedProperties.Register(x => x.Product.UnitOfMeasure, x => x.Format, x => x.Dimensions.Unit.Format); LinkedProperties.Register(x => x.Product.DefaultInstance.Dimensions, x => x.Height, x => x.Dimensions.Height); LinkedProperties.Register(x => x.Product.DefaultInstance.Dimensions, x => x.Length, x => x.Dimensions.Length); LinkedProperties.Register(x => x.Product.DefaultInstance.Dimensions, x => x.Quantity, x => x.Dimensions.Quantity); LinkedProperties.Register(x => x.Product.DefaultInstance.Dimensions, x => x.Weight, x => x.Dimensions.Weight); LinkedProperties.Register(x => x.Product.DefaultInstance.Dimensions, x => x.Width, x => x.Dimensions.Width); LinkedProperties.Register(x => x.Product.DefaultInstance.Dimensions, x => x.Value, x => x.Dimensions.Value); LinkedProperties.Register(x => x.Product.DefaultInstance.Dimensions, x => x.UnitSize, x => x.Dimensions.UnitSize); } } }