public override void AddControlToTop(ICoatingScheduleLogic newLogic)
 {
     if (newLogic.GetType() == typeof(CoatingScheduleDay))  // if child type, add to list
     {
         AddControlToTop(newLogic);
     }
     else if (ChildrenLogic.Count > 0) // if not child type, but this logic has children, try to have them add
     {
         ChildrenLogic.Last().AddControlToTop(newLogic);
     }
     else // if no children, create one and add new control to bottom
     {
         AddLogic();
         ChildrenLogic[0].AddControlToTop(newLogic);
     }
     UpdateDateText();
 }
예제 #2
0
        /// <summary>
        /// Fills the shift with the item by using the config passed.
        /// </summary>
        /// <param name="machine"></param>
        /// <param name="config"></param>
        /// <param name="item"></param>
        /// <returns></returns>
        public double ScheduleItem(Machine machine, Configuration config, ProductMasterItem item)
        {
            double made = 0;

            CoatingScheduleProduct product = new CoatingScheduleProduct(item);

            AddLogic(product);

            Shift  shift = ((CoatingScheduleLine)ParentLogic).Shift;
            double hours = shift.Duration.TotalHours;

            var productController = ChildrenLogic.Last() as CoatingScheduleProduct;

            // find the maximum units that can be scheduled.
            made = config.UnitsToMakeInHours(item, hours);
            made = Math.Ceiling(made);

            productController.Machine = machine;
            productController.Config  = config;
            productController.SetUnits(made.ToString());

            return(made);
        }