private void CreateSetupKpi() { var setupDuration = _jobConfirmation.Job.RequiredCapability .ResourceCapabilityProvider.Sum(s => s.ResourceSetups.Sum(d => d.SetupTime)); ResultStreamFactory.PublishResourceSetup(Agent, setupDuration, _jobConfirmation.CapabilityProvider); }
private void ProvideArticle(Guid articleKey) { var article = _requestedArticles.GetByKey(articleKey); if (article.Quantity <= _stockManager.Current) { var providerList = _stockManager.GetProviderGuidsFor(new Quantity(article.Quantity)); var prunedProviderList = providerList.Select(x => new FStockProvider( x.ProductionArticleKey, x.ProductionAgent )).ToList(); article = article.UpdateProviderList(p: prunedProviderList); article = article.UpdateFinishedAt(providerList.Max(x => x.Time)); Agent.DebugMessage(msg: "------------->> items in STOCK: " + _stockManager.Current + " Items Requested " + article.Quantity); // Reduce Stock // Done in GetProviderGuidsFor //TODO: find better Naming or split methods // Remove from Requester List //TODO might be to early, handle headdemands different? _requestedArticles.RemoveByKey(key: article.Key); // Agent Sender can be a DispoAgent (ProvideArticleAtDue) or a ProductionAgent (ResponseFromProduction) Agent.DebugMessage(msg: $"Provide Article: {article.Article.Name} {article.Key} from {Agent.Sender}"); // Create Callback for Production Agent.Send(instruction: BasicInstruction.ProvideArticle.Create(message: new FArticleProvider(articleKey: article.Key , articleName: article.Article.Name , stockExchangeId: article.StockExchangeId , articleFinishedAt: article.FinishedAt , customerDue: article.CustomerDue , provider: article.ProviderList) , target: article.DispoRequester , logThis: false)); // Update Work Item with Provider For // TODO ResultStreamFactory.PublishUpdateArticleProvider(Agent, article); } else { Agent.DebugMessage(msg: "Item will be late.............................."); } }
private void CreateOperationResults() { ResultStreamFactory.PublishJob(agent: Agent , job: _currentOperation , duration: _currentOperation.Operation.RandomizedDuration , capabilityProvider: _jobConfirmation.CapabilityProvider); var fOperationResult = new FOperationResult(key: _currentOperation.Key , creationTime: 0 , start: Agent.CurrentTime , end: Agent.CurrentTime + _currentOperation.Operation.RandomizedDuration , originalDuration: _currentOperation.Operation.Duration , productionAgent: _currentOperation.ProductionAgent , capabilityProvider: _jobConfirmation.CapabilityProvider.Name); Agent.Send(BasicInstruction.FinishJob.Create(fOperationResult, _currentOperation.ProductionAgent)); }
private void CreateBucketKpi() { ResultStreamFactory.PublishBucketResult(Agent, _jobConfirmation, _processingStart); }
private void UpdateOperationKpi() { ResultStreamFactory.PublishJob(Agent, _currentOperation, _currentOperation.Operation.RandomizedDuration, _jobConfirmation.CapabilityProvider, _jobConfirmation.Job.Name); }