Ejemplo n.º 1
0
        //find starttime from parent and set the endtime of the workschedule to it
        private int SetBackwardTimeFromParent(ProductionOrderWorkSchedule productionOrderWorkSchedule, State state)
        {
            var parents = _context.GetBomParents(productionOrderWorkSchedule);
            int end;

            if (parents == null || !parents.Any())
            {
                end = state == State.ForwardScheduleExists ? productionOrderWorkSchedule.EndForward : productionOrderWorkSchedule.ProductionOrder.Duetime;
            }
            else if (state != State.ForwardScheduleExists)
            {
                end = parents.Min(a => a.StartBackward);
                productionOrderWorkSchedule.EndBackward = end;
            }
            else
            {
                end = parents.Min(a => a.StartForward);
                productionOrderWorkSchedule.EndForward = end;
            }
            return(end);
        }