Ejemplo n.º 1
0
        internal new void Finished(InstructionSet instructionSet)
        {
            // any Not Finished do noting
            if (ChildAgents.Any(x => x.Status != Status.Finished))
            {
                return;
            }

            // Return from Production as WorkItemStatus
            var status = instructionSet.ObjectToProcess as WorkItemStatus;

            if (status != null)
            {
                var workItem = WorkItems.First(x => x.Id == status.WorkItemId);
                workItem.Status = status.Status;
            }

            // TODO Anything ?
            if (RequestItem.Article.WorkSchedules != null && WorkItems.All(x => x.Status == Status.Finished))
            {
                this.Status = Status.Finished;
                CreateAndEnqueueInstuction(methodName: StorageAgent.InstuctionsMethods.ResponseFromProduction.ToString(),
                                           objectToProcess: this,
                                           targetAgent: this.Creator); // Has been injected by Dispo and is Storage


                DebugMessage("All Workschedules have been Finished");
                return;
            }
            // else
            DebugMessage("Im Ready To get Enqued");
            Status = (Status == Status.Processed)? Status.Processed : Status.Ready;
            WorkItems.ForEach(item => item.MaterialsProvided = true);
            SetWorkItemReady();
        }
Ejemplo n.º 2
0
        internal new void Finished(InstructionSet instructionSet)
        {
            if (ChildAgents.Any(x => x.Status != Status.Finished))
            {
                return;
            }
            // else
            // Call Finish
            var intime = false;

            if (Context.TimePeriod <= requestItem.DueTime)
            {
                intime = true;
            }
            Debug.WriteLine("Order Finished at:" + Context.TimePeriod + " InTime: " + intime);
            CreateAndEnqueueInstuction(methodName: SystemAgent.InstuctionsMethods.OrderProvided.ToString(),
                                       objectToProcess: requestItem,
                                       targetAgent: this.Creator);
        }