コード例 #1
0
        // Setting a proportional level for buffer stock
        public static void SetProportionalBFS(string itemID, int propValue)
        {
            using (SA45Team12AD context = new SA45Team12AD())
            {
                // Finding the week no for the year (aka our period currently)
                DateTimeFormatInfo dfi = DateTimeFormatInfo.CurrentInfo;
                Calendar           cal = dfi.Calendar;
                int currentPeriod      = cal.GetWeekOfYear(DateTime.Now, dfi.CalendarWeekRule, dfi.FirstDayOfWeek);

                // Creating our obj from DB
                ForecastedData     f = context.ForecastedDatas.Where(x => x.ItemID.Equals(itemID)).Where(y => y.Season == DateTime.Now.Year).Where(z => z.Period == currentPeriod + 1).First(); // +1 to capture the next period
                InventoryCatalogue i = context.InventoryCatalogues.Where(x => x.ItemID.Equals(itemID)).First();

                // Changing our values
                i.BFSProportion    = propValue;
                i.BufferStockLevel = Convert.ToInt32(Math.Ceiling((Convert.ToDouble(propValue) * Convert.ToDouble(f.ForecastedDemand)) / 100));

                context.SaveChanges();
            }
        }
コード例 #2
0
        // Setting automated buffer stock handling  --- Auto is set to 10%
        public static void SetAutomatedlBFS(string itemID)
        {
            using (SA45Team12AD context = new SA45Team12AD())
            {
                // Finding the week no for the year (aka our period currently)
                DateTimeFormatInfo dfi = DateTimeFormatInfo.CurrentInfo;
                Calendar           cal = dfi.Calendar;
                int currentPeriod      = cal.GetWeekOfYear(DateTime.Now, dfi.CalendarWeekRule, dfi.FirstDayOfWeek);

                // Creating our obj from DB
                ForecastedData     f = context.ForecastedDatas.Where(x => x.ItemID.Equals(itemID)).Where(y => y.Season == DateTime.Now.Year).Where(z => z.Period == currentPeriod + 1).First();
                InventoryCatalogue i = context.InventoryCatalogues.Where(x => x.ItemID.Equals(itemID)).First();

                // Changing our values
                i.BFSProportion    = 10;
                i.BufferStockLevel = Convert.ToInt32(Math.Ceiling((10.0 * Convert.ToDouble(f.High95)) / 100));   // We take high95 cos it possesses the expected Dd with the highest confidence interval determinable (just to be safe)

                context.SaveChanges();
            }
        }