public void AddAllFrom(EntityCollector otherEntityCollector) { if (otherEntityCollector.GetDemands().Any()) { DemandsAddAll(otherEntityCollector.GetDemands()); } if (otherEntityCollector.GetProviders().Any()) { ProvidersAddAll(otherEntityCollector.GetProviders()); } if (otherEntityCollector.GetDemandToProviderTable().Any()) { _demandToProviderTable.AddAll(otherEntityCollector.GetDemandToProviderTable()); } if (otherEntityCollector.GetLinkDemandAndProviderTable().Any()) { _providerToDemandTable.AddAll(otherEntityCollector.GetLinkDemandAndProviderTable()); } }
public void StartMrp1() { // init int MAX_DEMANDS_IN_QUEUE = 100000; FastPriorityQueue <DemandQueueNode> demandQueue = new FastPriorityQueue <DemandQueueNode>(MAX_DEMANDS_IN_QUEUE); IProviderManager providerManager = new ProviderManager(); foreach (var demand in dbDemands) { demandQueue.Enqueue(new DemandQueueNode(demand), demand.GetStartTimeBackward().GetValue()); } EntityCollector allCreatedEntities = new EntityCollector(); while (demandQueue.Count != 0) { DemandQueueNode firstDemandInQueue = demandQueue.Dequeue(); EntityCollector response = MaterialRequirementsPlanningForOneDemand(firstDemandInQueue.GetDemand(), providerManager); allCreatedEntities.AddAll(response); foreach (var demand in response.GetDemands()) { demandQueue.Enqueue(new DemandQueueNode(demand), demand.GetStartTimeBackward().GetValue()); } } // write data to _dbTransactionData IDbTransactionData dbTransactionData = ZppConfiguration.CacheManager.GetDbTransactionData(); dbTransactionData.AddAllFrom(allCreatedEntities); // End of MaterialRequirementsPlanning }