コード例 #1
0
        public void AddAllFrom(EntityCollector otherEntityCollector)
        {
            if (otherEntityCollector.GetDemands().Any())
            {
                DemandsAddAll(otherEntityCollector.GetDemands());
            }

            if (otherEntityCollector.GetProviders().Any())
            {
                ProvidersAddAll(otherEntityCollector.GetProviders());
            }

            if (otherEntityCollector.GetDemandToProviderTable().Any())
            {
                _demandToProviderTable.AddAll(otherEntityCollector.GetDemandToProviderTable());
            }

            if (otherEntityCollector.GetLinkDemandAndProviderTable().Any())
            {
                _providerToDemandTable.AddAll(otherEntityCollector.GetLinkDemandAndProviderTable());
            }
        }
コード例 #2
0
        private EntityCollector MaterialRequirementsPlanningForOneDemand(Demand demand,
                                                                         IProviderManager providerManager)
        {
            EntityCollector entityCollector = new EntityCollector();

            EntityCollector response = providerManager.Satisfy(demand, demand.GetQuantity());

            entityCollector.AddAll(response);
            response = providerManager.CreateDependingDemands(entityCollector.GetProviders());
            entityCollector.AddAll(response);

            if (entityCollector.IsSatisfied(demand) == false)
            {
                throw new MrpRunException($"'{demand}' was NOT satisfied: remaining is " +
                                          $"{entityCollector.GetRemainingQuantity(demand)}");
            }

            return(entityCollector);
        }
        /**
         * SE:I --> satisfy by orders PrOBom
         */
        public EntityCollector Satisfy(Demand demand, Quantity demandedQuantity)
        {
            if (demand.GetArticle().ToBuild == false)
            {
                throw new MrpRunException("Must be a build article.");
            }

            EntityCollector entityCollector = CreateProductionOrder(demand, demandedQuantity);

            foreach (var provider in entityCollector.GetProviders())
            {
                T_DemandToProvider demandToProvider = new T_DemandToProvider()
                {
                    DemandId   = demand.GetId().GetValue(),
                    ProviderId = provider.GetId().GetValue(),
                    Quantity   = provider.GetQuantity().GetValue()
                };
                entityCollector.Add(demandToProvider);
            }


            return(entityCollector);
        }