コード例 #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);
            }
        }