Пример #1
0
        private void FinishJob(IJobResult jobResult)
        {
            var nextOperation = OperationManager.GetNextOperation(key: jobResult.Key);

            if (nextOperation != null)
            {
                nextOperation.StartConditions.PreCondition = true;
                Agent.DebugMessage(msg: $"PreCondition for operation {nextOperation.Operation.Name} at {_articleToProduce.Article.Name} was set true.");
                Agent.Send(instruction: BasicInstruction.UpdateStartConditions.Create(message: nextOperation.GetStartCondition(), target: nextOperation.HubAgent));
                return;
            }

            Agent.DebugMessage(msg: $"All operations for article {_articleToProduce.Article.Name} {_articleToProduce.Key} finished.");

            //TODO add production amount to productionresult, currently static 1
            var productionResponse = new FProductionResult(key: _articleToProduce.Key
                                                           , trackingId: _articleToProduce.StockExchangeId
                                                           , creationTime: 0
                                                           , amount: 1);

            Agent.Send(instruction: Storage.Instruction.ResponseFromProduction.Create(message: productionResponse, target: _articleToProduce.StorageAgent));

            if (_articleToProduce.IsHeadDemand)
            {
                var pub = new FThroughPutTime(articleKey: _articleToProduce.Key
                                              , articleName: _articleToProduce.Article.Name
                                              , start: _articleToProduce.CreationTime
                                              , end: Agent.CurrentTime);
                Agent.Context.System.EventStream.Publish(@event: pub);
            }
            Agent.TryToFinish();
        }
Пример #2
0
 private void UpdateThroughputTimes(FThroughPutTime m)
 {
     _ThroughPutTimes.Add(m);
 }