Ejemplo n.º 1
0
        private List <IDemandToProvider> UpdateDemandStates()
        {
            var changedDemands = new List <IDemandToProvider>();

            changedDemands.AddRange(UpdateStateDemandProviderProductionOrders());
            changedDemands.AddRange(_context.UpdateStateDemandProviderPurchaseParts());
            changedDemands.AddRange(UpdateDemandProviderStock());

            return(!changedDemands.Any() ? null : _context.UpdateStateDemandRequester(changedDemands));
        }
Ejemplo n.º 2
0
        public Task <bool> DoAtEnd <T>(List <TimeTable <T> .MachineStatus> listMachineStatus, int time) where T : ISimulationItem
        {
            var purchasePart = _context.PurchaseParts.Single(a => a.Id == PurchasePartId);
            var stock        = _context.Stocks.Single(a => a.ArticleForeignKey == purchasePart.ArticleId);

            stock.Current += purchasePart.Quantity;
            _context.StockExchanges.Add(new StockExchange()
            {
                ExchangeType   = ExchangeType.Insert,
                Quantity       = purchasePart.Quantity,
                StockId        = stock.Id,
                RequiredOnTime = purchasePart.Purchase.DueTime,
                Time           = time
            });
            purchasePart.State = State.Finished;
            _context.SaveChanges();
            var provider = _context.UpdateStateDemandProviderPurchaseParts();

            _context.UpdateStateDemandRequester(provider);
            return(null);
        }