public void SetEndTimeBackward(DueTime endTime) { if (_productionOrderOperation.IsReadOnly) { throw new MrpRunException("A readOnly entity cannot be changed anymore."); } // endBackwards _productionOrderOperation.EndBackward = endTime.GetValue(); // startBackwards DueTime startTimeOfOperation = endTime.Minus(GetDuration().ToDueTime()); _productionOrderOperation.StartBackward = startTimeOfOperation.GetValue(); }
public DueTime GetStartTimeBackward() { if (_productionOrderOperation.StartBackward == null) { return(null); } DueTime transitionTime = new DueTime(TransitionTimer.CalculateTransitionTime(GetDuration())); DueTime startTimeOfOperation = new DueTime(_productionOrderOperation.StartBackward.GetValueOrDefault()); DueTime startTime = startTimeOfOperation.Minus(transitionTime); return(startTime); }
private Priority GetPriorityOfProductionOrderOperation(DueTime now, ProductionOrderOperation givenProductionOrderOperation, DueTime minStartNextOfParentProvider) { IAggregator aggregator = ZppConfiguration.CacheManager.GetAggregator(); Dictionary <HierarchyNumber, DueTime> alreadySummedHierarchyNumbers = new Dictionary <HierarchyNumber, DueTime>(); DueTime sumDurationsOfOperations = DueTime.Zero(); // O(1) List <ProductionOrderOperation> productionOrderOperations = aggregator.GetProductionOrderOperationsOfProductionOrder(givenProductionOrderOperation .GetProductionOrderId()); foreach (var productionOrderOperation in productionOrderOperations) { // only later operations, which have a smaller hierarchyNumber, have to be considered if (productionOrderOperation.GetHierarchyNumber() .IsSmallerThan(givenProductionOrderOperation.GetHierarchyNumber())) { continue; } if (alreadySummedHierarchyNumbers.ContainsKey(productionOrderOperation .GetHierarchyNumber())) { DueTime alreadySummedHierarchyNumber = alreadySummedHierarchyNumbers[ productionOrderOperation.GetHierarchyNumber()]; if (productionOrderOperation.GetDuration().ToDueTime() .IsGreaterThan(alreadySummedHierarchyNumber)) { sumDurationsOfOperations.IncrementBy(productionOrderOperation.GetDuration() .ToDueTime().Minus(alreadySummedHierarchyNumber)); } } else { alreadySummedHierarchyNumbers.Add(productionOrderOperation.GetHierarchyNumber(), productionOrderOperation.GetDuration().ToDueTime()); } } return(new Priority(minStartNextOfParentProvider.Minus(now) .Minus(sumDurationsOfOperations).GetValue())); }
public OperationBackwardsSchedule(DueTime dueTime, Duration duration, HierarchyNumber hierarchyNumber) { if (dueTime == null || duration == null || hierarchyNumber == null) { throw new MrpRunException("Every parameter must NOT be null."); } _duration = duration; _hierarchyNumber = hierarchyNumber; // add transition time aka timeBetweenOperations _timeBetweenOperations = new DueTime(CalculateTransitionTime(_duration)); _endBackwards = dueTime; _startBackwards = _endBackwards.Minus(new DueTime(duration.GetValue())); _startOfOperation = _startBackwards.Minus(_timeBetweenOperations); _endOfOperation = _endBackwards; }