예제 #1
0
        public int OrderFromSupplier(int missingStock, int?id)
        {
            RawMaterialStock rawMaterialStock = db.RawMaterialStocks.Find(id);

            int rawMaterialNeeded = missingStock + ReorderingLevel + rawMaterialStock.Quantity;

            return(rawMaterialNeeded);
        }
예제 #2
0
        public void UpdateStock(int?id)
        {
            RawMaterialStock rawMaterialStock = db.RawMaterialStocks.Find(id);

            if (rawMaterialStock != null)
            {
                if (rawMaterialStock.Quantity <= MinimumStock)
                {
                    int missingStock = MinimumStock - rawMaterialStock.Quantity;

                    rawMaterialStock.Quantity = OrderFromSupplier(missingStock, id);
                }
            }
        }
예제 #3
0
        public int SendToProduction(int orderAmount, int?id)
        {
            RawMaterialStock rawMaterialStock = db.RawMaterialStocks.Find(id);

            if (orderAmount > rawMaterialStock.Quantity)
            {
                int sentQuantity = rawMaterialStock.Quantity;
                UpdateStock(id);
                return(sentQuantity);
            }
            else
            {
                rawMaterialStock.Quantity = rawMaterialStock.Quantity - orderAmount;
                if (rawMaterialStock.Quantity <= MinimumStock)
                {
                    UpdateStock(id);
                }
                return(rawMaterialStock.Quantity);
            }
        }