private void UpdateStartCondition(FUpdateStartCondition startCondition)
        {
            Agent.DebugMessage(msg: $"UpdateArticleProvided for article: {startCondition.OperationKey} ArticleProvided: {startCondition.ArticlesProvided} && PreCondition {startCondition.PreCondition}");

            if (_planingQueue.UpdatePreCondition(startCondition: startCondition))
            {
                UpdateProcessingQueue();
                TryToWork();
            }
        }
        internal bool UpdatePreCondition(FUpdateStartCondition startCondition)
        {
            var job = this.jobs.SingleOrDefault(x => x.Key == startCondition.OperationKey);

            if (job == null)
            {
                return(false);
            }
            job.StartConditions.ArticlesProvided = startCondition.ArticlesProvided;
            job.StartConditions.PreCondition     = startCondition.PreCondition;
            return(job.StartConditions.ArticlesProvided && job.StartConditions.PreCondition);
        }
        private void UpdateAndForwardStartConditions(FUpdateStartCondition startCondition)
        {
            var operation = _operationList.Single(predicate: x => x.Key == startCondition.OperationKey);

            operation.SetStartConditions(startCondition: startCondition);
            // if Agent has no ResourceAgent the operation is not queued so here is nothing to do
            if (operation.ResourceAgent.IsNobody())
            {
                return;
            }

            Agent.DebugMessage(msg: $"Update and forward start condition: {operation.Operation.Name} {operation.Key}" +
                               $"| ArticleProvided: {operation.StartConditions.ArticlesProvided} " +
                               $"| PreCondition: {operation.StartConditions.PreCondition} " +
                               $"to resource {operation.ResourceAgent}");

            Agent.Send(instruction: BasicInstruction.UpdateStartConditions.Create(message: startCondition, target: operation.ResourceAgent));
        }
Exemplo n.º 4
0
        public FBucket SetOperationStartCondition(Guid operationKey, FUpdateStartCondition startCondition)
        {
            var bucket = GetBucketByOperationKey(operationKey);

            if (bucket != null)
            {
                var operation = bucket.Operations.Single(x => x.Key == operationKey);
                bucket.RemoveOperation(operation);

                operation.SetStartConditions(preCondition: startCondition.PreCondition, articleProvided: startCondition.ArticlesProvided);
                operation = operation.UpdateCustomerDue(startCondition.CustomerDue);

                bucket.AddOperation(operation);
                Replace(bucket);
                return(bucket);
            }

            return(null);
        }
Exemplo n.º 5
0
        internal void UpdateAndForwardStartConditions(FUpdateStartCondition startCondition)
        {
            Agent.DebugMessage(msg: $"Received: Update and forward start condition for {startCondition.OperationKey}" +
                               $"| ArticleProvided: {startCondition.ArticlesProvided} " +
                               $"| PreCondition: {startCondition.PreCondition} ");

            var bucket = _bucketManager.SetOperationStartCondition(startCondition.OperationKey, startCondition);

            if (bucket.IsNull())
            {
                Agent.DebugMessage(msg: $"No Bucket found and should be at Work");
                return;
            }

            var jobConfirmation = _bucketManager.GetConfirmationByBucketKey(bucket.Key);

            Agent.DebugMessage(msg: $"Found Bucket Update and forward start condition: {startCondition.OperationKey} in {bucket.Name} with key  {bucket.Key}" +
                               $"| ArticleProvided: {startCondition.ArticlesProvided} " +
                               $"| PreCondition: {startCondition.PreCondition} " +
                               $"to job agent {jobConfirmation.JobAgentRef}");

            Agent.Send(instruction: BasicInstruction.UpdateJob.Create(message: bucket, target: jobConfirmation.JobAgentRef));
        }