Browse Source

Added requisition link to manufacturingpacketcomponent; added description to StagingManufacturingPacketComponent

Kenric Nugteren 1 year ago
parent
commit
97d5ff0b49

+ 8 - 0
prs.classes/Entities/Manufacturing/ManufacturingPacket/ManufacturingPacketComponent.cs

@@ -20,12 +20,20 @@ namespace Comal.Classes
 
         public override ProductDimensions Dimensions { get; set; }
 
+        /// <summary>
+        /// When a picking list is creating for a <see cref="ManufacturingPacketComponent"/>, we save a link to the requisition,
+        /// so that we don't require the same component twice.
+        /// </summary>
+        [NullEditor]
+        public RequisitionLink Requisition { get; set; }
+
         protected override void Init()
         {
             base.Init();
             Packet = new ManufacturingPacketLink();
             Product = new ProductLink(() => this);
             Dimensions = new ProductDimensions(() => this);
+            Requisition = new RequisitionLink();
         }
 
         static ManufacturingPacketComponent()

+ 11 - 2
prs.classes/Entities/Staging/Manufacturing/Packet/StagingManufacturingPacketComponent.cs

@@ -11,9 +11,12 @@ namespace Comal.Classes
         public StagingManufacturingPacketLink Packet { get; set; }
 
         [EditorSequence(1)]
-        public ProductLink Product { get; set; }
+        public string Description { get; set; }
 
         [EditorSequence(2)]
+        public ProductLink Product { get; set; }
+
+        [EditorSequence(3)]
         public int Quantity { get; set; }
 
         [DimensionsEditor(typeof(ProductDimensions))]
@@ -31,12 +34,18 @@ namespace Comal.Classes
         public ManufacturingPacketComponent CreateComponent(Guid packetID) 
         {
             var component = new ManufacturingPacketComponent();
+            component.Description = Description;
             component.Packet.ID = packetID;
             component.Product.ID = Product.ID;
             component.Quantity = Quantity;
             component.Dimensions.CopyFrom(Dimensions);
             return component;
         }
-        
+
+        static StagingManufacturingPacketComponent()
+        {
+            LinkedProperties.Register<StagingManufacturingPacketComponent, ProductLink, string>(x => x.Product, x => x.Name, x => x.Description);
+        }
+
     }
 }