Exemplo n.º 1
0
        internal int GetSetupDurationByTool(M_ResourceTool resourceTool)
        {
            //TODO Take care if 1 Skill can be done by multiply tools
            var setupTime = _resourceSetups.SingleOrDefault(x => x.ResourceToolId == resourceTool.Id).SetupTime;

            return(setupTime);
        }
Exemplo n.º 2
0
 internal void Mount(M_ResourceTool requiredResourceTool)
 {
     if (!AlreadyEquipped(requiredResourceTool))
     {
         _equippedResourceTool.Mount(requiredResourceTool);
     }
 }
Exemplo n.º 3
0
        internal M_ResourceSetup GetSetupByTool(M_ResourceTool resourceTool)
        {
            //TODO Take care if 1 Skill can be done by multiply tools
            var resourceSetup = _resourceSetups.SingleOrDefault(x => x.ResourceToolId == resourceTool.Id);

            return(resourceSetup);
        }
Exemplo n.º 4
0
 public bool IsSet(M_ResourceTool resourceTool)
 {
     if (ResourceTool == null || ResourceTool.Id != resourceTool.Id)
     {
         return(false);
     }
     return(true);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Start the SetupPhase with the tool and make a flag for currently in setupPhase
 /// </summary>
 /// <param name="resourceTool"></param>
 /// <returns></returns>
 public bool Mount(M_ResourceTool resourceTool)
 {
     if (SetupPhase != false)
     {
         return(false);
     }
     SetupPhase   = true;
     ResourceTool = resourceTool;
     return(true);
 }
        public List <IActorRef> GetResourceByTool(M_ResourceTool resourceTool)
        {
            var resourceAgents = new List <IActorRef>();

            foreach (var resource in _resources)
            {
                if (resource.HasTool(resourceTool))
                {
                    resourceAgents.Add(resource.GetActorRef());
                }
            }
            return(resourceAgents);
        }
        internal M_ResourceTool[] Init(MasterDBContext context)
        {
            var resourceTools = new M_ResourceTool[]
            {
                SAW_BLADE_BIG,
                SAW_BLADE_SMALL,
                DRILL_HEAD_M6,
                DRILL_HEAD_M4,
                ASSEMBLY_SCREWDRIVER
            };

            context.ResourceTools.AddRange(entities: resourceTools);
            context.SaveChanges();
            return(resourceTools);
        }
 internal MasterTableResourceTool()
 {
     SAW_BLADE_BIG = new M_ResourceTool {
         Name = "Saw blade big"
     };
     SAW_BLADE_SMALL = new M_ResourceTool {
         Name = "Saw blade small"
     };
     DRILL_HEAD_M6 = new M_ResourceTool {
         Name = "Drill head M6"
     };
     DRILL_HEAD_M4 = new M_ResourceTool {
         Name = "Drill head M4"
     };
     ASSEMBLY_SCREWDRIVER = new M_ResourceTool {
         Name = "Screwdriver universal"
     };
 }
        private static M_ResourceTool[] CreateResourceTools()
        {
            var resourceTools = new M_ResourceTool[]
            {
                new M_ResourceTool {
                    Name = RESCOURCETOOL_SAWBIG, ResourceSetups = new List <M_ResourceSetup>()
                },
                new M_ResourceTool {
                    Name = RESCOURCETOOL_SAWSMALL, ResourceSetups = new List <M_ResourceSetup>()
                },
                new M_ResourceTool {
                    Name = RESCOURCETOOL_M6, ResourceSetups = new List <M_ResourceSetup>()
                },
                new M_ResourceTool {
                    Name = RESCOURCETOOL_M4, ResourceSetups = new List <M_ResourceSetup>()
                },
                new M_ResourceTool {
                    Name = RESCOURCETOOL_SCREWDRIVERCROSS2, ResourceSetups = new List <M_ResourceSetup>()
                },
            };

            return(resourceTools);
        }
        private static M_Operation[] CreateOperations(M_ResourceTool[] resourceTools,
                                                      M_Article[] articles, M_ResourceSkill[] resourceSkills)
        {
            // Tool has no meaning yet, ignore it and use always the same
            M_ResourceTool resourceTool = resourceTools.Single(a => a.Name == RESOURCE_TOOL_WELDER);

            return(new M_Operation[]
            {
                new M_Operation
                {
                    ArticleId = articles.Single(a => a.Name == ARTICLE_DESK).Id,
                    Name = OPERATION_DESK, Duration = 11,
                    ResourceSkillId = resourceSkills.Single(x => x.Name.Equals(RESOURCE_SKILL_PACKING))
                                      .Id,
                    HierarchyNumber = 10,
                    ResourceToolId = resourceTool.Id
                },
                new M_Operation
                {
                    ArticleId = articles.Single(a => a.Name == ARTICLE_DESK_LEG).Id,
                    Name = OPERATION_DESK_LEG_1, Duration = 20,
                    ResourceSkillId = resourceSkills.Single(x => x.Name.Equals(RESOURCE_SKILL_WELDING))
                                      .Id,
                    HierarchyNumber = 10,
                    ResourceToolId = resourceTool.Id
                },
                new M_Operation
                {
                    ArticleId = articles.Single(a => a.Name == ARTICLE_DESK_LEG).Id,
                    Name = OPERATION_DESK_LEG_2, Duration = 3,
                    ResourceSkillId = resourceSkills
                                      .Single(x => x.Name.Equals(RESOURCE_SKILL_ASSEMBLING)).Id,
                    HierarchyNumber = 20,
                    ResourceToolId = resourceTool.Id
                }
            });
        }
Exemplo n.º 11
0
 internal bool AlreadyEquipped(M_ResourceTool requiredResourceTool)
 {
     return(_equippedResourceTool.IsSet(resourceTool: requiredResourceTool));
 }
        public bool HasTool(M_ResourceTool resourceTool)
        {
            var value = _resourceSetups.Any(x => x.ResourceTool.Id == resourceTool.Id);

            return(value);
        }