Exemple #1
0
        /*
        Any piece whether it is a first time piece or has been through the system multiple times should go into the next day bin when the due date is the next day from the current day with the exception being Friday and Saturday.  Next day for Friday is Monday.  Next day for Saturday is Monday as well.  The next day rules per day are as follows:

	        On Mon, Tue is the Next Day
	        On Tue, Wed is the Next Day
	        On Wed, Thur is the Next Day
	        On Thur, Friday is the Next Day 
	        On Fri, Mon is the Next Day 
	        On Sat, Mon is the Next Day
         
        */
        public bool getNextdayBin( AutoSortInfo autoSort)
        {

            //0:sun;1:mon;2:tues:3:wed;4:thurs;5:fri;6:sat
            bool ret = false;
            if (((DateTime)autoSort.Duedate).Date <= DateTime.Now.Date)
            {
                ret = true;
            }
            else
            {
                int dueday = (int)((DateTime)autoSort.Duedate).DayOfWeek;
                int currentdayofweek = (int)DateTime.Now.DayOfWeek;
                if (currentdayofweek < 5)
                {
                    if ((dueday - currentdayofweek) == 1)
                        ret = true;

                }
                else
                {
                    if (dueday == 1)
                        ret = true; 

                }
            }
            return ret;

        }
Exemple #2
0
        /*
         * 2. System will check the "Due Date" of the item by looking in the DueDate column of the Table dbo.AutoSort of the assembly database.
         * Software is looking for a "current or future due date".  In other words On Monday July 22nd any pieces scanned must be due 
         * Monday July 22nd or later ( Tue the 23rd....etc.....).  The DueDate column of the table dbo.AutoSort has date, 
         * BUT NOT day of week information.  Any piece that has a prior due date to the current date will be treated as a
         * same day or current day order.  
         */
        public Bin getBinGSS(Category cat, AutoSortInfo autoSort)
        {

            int dayofweek = -1;
            int bin = -1;
            if (autoSort.Duedate < DateTime.Now)
                dayofweek = (int)DateTime.Now.DayOfWeek;
            else
            {
                dayofweek = (int)((DateTime)autoSort.Duedate).DayOfWeek;
            }
            bin = dayofweek;
            int RFIDlen = autoSort.rfid.Length;
            bool route = false;
            for (int i = 0; i < autoSort.rfid.Length; i++)
            {
                if (autoSort.rfid[i] != ' ')
                {
                    route = true;
                    break;
                }

            }
            if (route)
            {
                if (dayofweek == 3 || dayofweek == 5)
                    bin = 6;
                else if (dayofweek == 1 || dayofweek == 4)
                    bin = 7;

            }
            return CleaningBins.Where(i => i.PhidgetSlot == bin - 1).SingleOrDefault();
        }
Exemple #3
0
        /*
         * Any piece whether it is a first time piece or has been through the system multiple times should go into the next day bin when the due date is the next day from the current day with the exception being Friday and Saturday.  Next day for Friday is Monday.  Next day for Saturday is Monday as well.  The next day rules per day are as follows:
         *
         *      On Mon, Tue is the Next Day
         *      On Tue, Wed is the Next Day
         *      On Wed, Thur is the Next Day
         *      On Thur, Friday is the Next Day
         *      On Fri, Mon is the Next Day
         *      On Sat, Mon is the Next Day
         *
         */
        public bool getNextdayBin(AutoSortInfo autoSort)
        {
            //0:sun;1:mon;2:tues:3:wed;4:thurs;5:fri;6:sat
            bool ret = false;

            if (((DateTime)autoSort.Duedate).Date <= DateTime.Now.Date)
            {
                ret = true;
            }
            else
            {
                int dueday           = (int)((DateTime)autoSort.Duedate).DayOfWeek;
                int currentdayofweek = (int)DateTime.Now.DayOfWeek;
                if (currentdayofweek < 5)
                {
                    if ((dueday - currentdayofweek) == 1)
                    {
                        ret = true;
                    }
                }
                else
                {
                    if (dueday == 1)
                    {
                        ret = true;
                    }
                }
            }
            return(ret);
        }
Exemple #4
0
        public AutoSortInfo GetCustomerInfoFromAssembly(string itemID)
        {
            AutoSortInfo AssemblyStuff = (from auto in assemblyEnties.AutoSorts
                                          where auto.ArticleCode == itemID
                                          join inv in assemblyEnties.Invoices on auto.InvoiceID equals inv.InvoiceID
                                          select new AutoSortInfo()
            {
                CustomerID = auto.CustomerID, InvoiceNumber = inv.InvoiceID, dept = inv.Department, Duedate = auto.DueDate, rfid = auto.RFID, storeid = auto.StoreID
            }).SingleOrDefault();


            return(AssemblyStuff);
        }
Exemple #5
0
        public AutoSortInfo getItemInAssemblyDB(string code)
        {
            List <string> storeNames = new List <string>()
            {
                "Haille", "Millhopper", "Westgate", "HuntersCrossing"
            };
            AutoSortInfo info = AssemblyDB.GetCustomerInfoFromAssembly(code);

            if (info != null)
            {
                info.storeName = storeNames[info.storeid - 1];
            }
            return(info);
        }
Exemple #6
0
        /*
         * 2. System will check the "Due Date" of the item by looking in the DueDate column of the Table dbo.AutoSort of the assembly database.
         * Software is looking for a "current or future due date".  In other words On Monday July 22nd any pieces scanned must be due
         * Monday July 22nd or later ( Tue the 23rd....etc.....).  The DueDate column of the table dbo.AutoSort has date,
         * BUT NOT day of week information.  Any piece that has a prior due date to the current date will be treated as a
         * same day or current day order.
         */
        public Bin getBinGSS(Category cat, AutoSortInfo autoSort)
        {
            int dayofweek = -1;
            int bin       = -1;

            if (autoSort.Duedate < DateTime.Now)
            {
                dayofweek = (int)DateTime.Now.DayOfWeek;
            }
            else
            {
                dayofweek = (int)((DateTime)autoSort.Duedate).DayOfWeek;
            }
            bin = dayofweek;
            int  RFIDlen = autoSort.rfid.Length;
            bool route   = false;

            for (int i = 0; i < autoSort.rfid.Length; i++)
            {
                if (autoSort.rfid[i] != ' ')
                {
                    route = true;
                    break;
                }
            }
            if (route)
            {
                if (dayofweek == 3 || dayofweek == 5)
                {
                    bin = 6;
                }
                else if (dayofweek == 1 || dayofweek == 4)
                {
                    bin = 7;
                }
            }
            return(CleaningBins.Where(i => i.PhidgetSlot == bin - 1).SingleOrDefault());
        }
Exemple #7
0
        public Bin getBin(Category cat, AutoSortInfo auto)
        {
            return CleaningBins.Where(i => i.Category.ID == cat.ID).SingleOrDefault();

        }
Exemple #8
0
 public Bin getBin(Category cat, AutoSortInfo auto)
 {
     return(CleaningBins.Where(i => i.Category.ID == cat.ID).SingleOrDefault());
 }
Exemple #9
0
        //only this timer is operation now
        void timer2_Tick(object sender, EventArgs e)
        {
            timer2.Stop();
            if (!ProcessBarcode())
            {
                return;
            }
            string barcode = Barcode.Text;

            //check that the item is in the Assembly database if not then show message and allow more items
            //to be scanned
            try
            {
                assemblyInfo = vm.getItemInAssemblyDB(barcode);
                if (assemblyInfo == null)
                {
                    ClearInput();
                    Errormsg.Text       = string.Format(string.Format("Item has not been marked in {0}", barcode));
                    ErrorTxt.Background = new SolidColorBrush(Colors.Red);
                    ErrorTxt.Visibility = Visibility.Visible;
                    if (vm.BatchButtonText == "Batch Off")
                    {
                        vm.errorcodes.Add(barcode);
                        ErrorCodes.Visibility = Visibility.Visible;
                    }
                    return;
                }
                vm.GetCustomer(assemblyInfo.CustomerID);
                CustomerName.Text = vm.activeCustomer.FirstName + " " + vm.activeCustomer.LastName;
                if (vm.BCSMode)
                {
                    //check if the item is in BCS Codes
                    item = vm.GetItemInDB(barcode);
                    //if we are in batch mode then it must be already in BCS
                    if (item == null && vm.BatchButtonText == "Batch Off")
                    {
                        vm.errorcodes.Add(barcode);
                        ErrorCodes.Visibility = Visibility.Visible;
                        ErrorTxt.Background   = new SolidColorBrush(Colors.Red);
                        Errormsg.Text         = string.Format(string.Format("item {0} not in BCS", barcode));
                        ErrorTxt.Visibility   = Visibility.Visible;
                        ClearInput();
                        return;
                    }
                }
            }
            catch (Exception e1)
            {
                BarcodeChars        = 0;
                Errormsg.Text       = string.Format(string.Format("Database logic error {0} {1}", barcode, e1.Message));
                ErrorTxt.Visibility = Visibility.Visible;
                return;
            }
            logger.Info(string.Format("all data obtained for {0} ", barcode));
            if (vm.BatchButtonText == "Batch Off")
            {
                vm.scancodes.Add(barcode);
                Codes.Visibility    = Visibility.Visible;
                Errormsg.Text       = string.Format("Scan {0} items and hit Batch off when finished", catForBatch.Name);
                ErrorTxt.Background = new SolidColorBrush(Colors.Gray);
                ClearInput();
                return;
            }
            if (!vm.BCSMode)
            {
                SetupActions();
                return;
            }

            bool route = false;

            for (int i = 0; i < assemblyInfo.rfid.Length; i++)
            {
                if (assemblyInfo.rfid[i] != ' ')
                {
                    route = true;
                    break;
                }
            }
            if (!route)     //only look for next day if this is not a routed customer
            {
                bNextDay = vm.getNextdayBin(assemblyInfo);
            }

            if (bNextDay)
            {
                ButRow1.Children.Clear();
                ButRow1.Visibility = Visibility.Visible;
                logger.Info("new item");
                item = new Item()
                {
                    BarCode = barcode, CustID = 0, ID = -1, CreationDate = DateTime.Now
                };
                Button but = new Button()
                {
                    Content = "Next Day Work", Height = ButtonHeight, Width = ButtonWidth, Visibility = Visibility.Visible
                };
                but.Margin = new Thickness(0, 5, 5, 5);
                //             but.Click += new RoutedEventHandler(but_Click);
                item.Category = vm.CleaningCats.Where(c => c.ID == 11).Single();
                ButRow1.Children.Add(but);
                SetupActions();
                return;
            }
            //a new item set the category to Unclassified or laundry
            if (item == null)
            {
                ButRow1.Children.Clear();
                ButRow1.Visibility = Visibility.Visible;
                logger.Info("new item");
                item = new Item()
                {
                    BarCode = barcode, CustID = 0, ID = -1, CreationDate = DateTime.Now
                };
                Button but = new Button()
                {
                    Content = "Unclassified Work", Height = ButtonHeight, Width = ButtonWidth, Visibility = Visibility.Visible
                };
                but.Margin = new Thickness(0, 5, 5, 5);
                but.Click += new RoutedEventHandler(but_Click);
                if (assemblyInfo.dept != "Laundry")     //must be unclassifield dry cleaning
                {
                    logger.Info("dry cleaning");
                    item.Category = vm.CleaningCats.Where(c => c.Name.StartsWith("Unclassified")).Single();
                }
                else
                {
                    logger.Info("laundry");
                    if (vm.activeCustomer.Starch == "H" || vm.activeCustomer.Starch == "M")
                    {
                        but.Content = "Starched Shirts";
                    }
                    else
                    {
                        but.Content = "No Starch Shirts";
                    }
                    //get category so we can place in the right bin
                    item.Category = vm.CleaningCats.Where(c => c.Name == but.Content.ToString()).Single();
                }
                ButRow1.Children.Add(but);
                SetupActions();
            }
            else
            {
                //known item but first check if it is unknown as it needs to be categorized before proceeding
                ButRow1.Children.Clear();
                ButRow2.Children.Clear();
                ButRow1.Visibility = Visibility.Visible;
                if (item.Category.ID == vm.unknownCat.ID || vm.ReClassifyButtonText == "ReClassify Off" || vm.QuickReClassifyButtonText == "Quick Reclassify Off")
                {
                    logger.Info("Classify");

                    vm.ReClassifyButtonText = "ReClassify On";    //this is a one time deal


                    if (!vm.bLoggedIn)
                    {
                        Errormsg.Text       = "Classify is a adminstrator action";
                        ErrorTxt.Visibility = Visibility.Visible;
                        Barcode.Text        = string.Empty;
                        BarcodeChars        = 0;
                        return;
                    }
                    ButRow2.Visibility = Visibility.Visible;
                    int ii = 0;
                    foreach (Category cat in vm.CleaningCats)
                    {
                        if (cat.ID == vm.unknownCat.ID)
                        {
                            continue;
                        }
                        ii++;
                        Button but = new Button()
                        {
                            Content = cat.Name, Height = ButtonHeight, Width = ButtonWidth, Visibility = Visibility.Visible
                        };
                        but.Margin = new Thickness(0, 5, 5, 5);

                        but.Click += new RoutedEventHandler(but_Click);
                        if (ii < 5)
                        {
                            ButRow1.Children.Add(but);
                        }
                        else
                        {
                            ButRow2.Children.Add(but);
                        }
                    }
                }
                else    //allow the garment to be placed in a bin
                {
                    Button but = new Button()
                    {
                        Height = ButtonHeight, Width = ButtonWidth, Visibility = Visibility.Visible, IsEnabled = false
                    };
                    if (assemblyInfo.dept != "Laundry")     //if this is  dry cleaning
                    {
                        Category cat = vm.CleaningCats.Where(c => c.ID == item.Category.ID).SingleOrDefault();
                        but.Content = cat.Name;
                    }
                    else    //laundry then get the starch from the customer info as they might have changed in fabricare
                    {
                        if (vm.activeCustomer.Starch == "H" || vm.activeCustomer.Starch == "M")
                        {
                            but.Content = "Starched Shirts";
                        }

                        else
                        {
                            but.Content = "No Starch Shirts";
                        }
                        //set category so we can place in the right bin in fabricare setting
                        item.Category = vm.CleaningCats.Where(c => c.Name == but.Content.ToString()).Single();
                    }
                    ButRow1.Children.Add(but);
                    SetupActions();
                }
            }
        }
        //only this timer is operation now
        void timer2_Tick(object sender, EventArgs e)
        {

            timer2.Stop();
            if (!ProcessBarcode())
                return;
            string barcode = Barcode.Text;
           
            //check that the item is in the Assembly database if not then show message and allow more items
            //to be scanned
            try
            {
                assemblyInfo = vm.getItemInAssemblyDB(barcode);
                if (assemblyInfo == null)        
                {
                    BarcodeChars = 0;
                    Errormsg.Text = string.Format(string.Format("Item has not been marked in {0}", barcode));
                    ErrorTxt.Visibility = Visibility.Visible;
                    return;
                }
                vm.GetCustomer(assemblyInfo.CustomerID);
                CustomerName.Text = vm.activeCustomer.FirstName + " " + vm.activeCustomer.LastName;
                if (vm.BCSMode)
                {
                    //check if the item is in BCS database
                    item = vm.GetItemInDB(barcode);
                }
               
               
            }
            catch (Exception e1)
            {
                BarcodeChars = 0;
                Errormsg.Text = string.Format(string.Format("Database logic error {0} {1}", barcode, e1.Message));
                ErrorTxt.Visibility = Visibility.Visible;
                return;
            }
            logger.Info(string.Format("all data obtained for {0} ", barcode));
            if (!vm.BCSMode)
            {
                SetupActions();
                return;
            }
            
            bool route = false;
            for (int i = 0; i < assemblyInfo.rfid.Length; i++)
            {
                if (assemblyInfo.rfid[i] != ' ')
                {
                    route = true;
                    break;
                }

            }
            if (!route)     //only look for next day if this is not a routed customer
                bNextDay = vm.getNextdayBin(assemblyInfo);

            if (bNextDay)
            {
                ButRow1.Children.Clear();
                ButRow1.Visibility = Visibility.Visible;
                logger.Info("new item");
                item = new Item() { BarCode = barcode, CustID = 0, ID = -1, CreationDate = DateTime.Now };
                Button but = new Button() { Content = "Next Day Work", Height = ButtonHeight, Width = ButtonWidth, Visibility = Visibility.Visible };
                but.Margin = new Thickness(0, 5, 5, 5);
   //             but.Click += new RoutedEventHandler(but_Click);
                item.Category = vm.CleaningCats.Where(c => c.ID == 11).Single();
                ButRow1.Children.Add(but);
                SetupActions();
                return;
            }
            //a new item set the category to Unclassified or laundry
            if (item == null)     
            {
                
                ButRow1.Children.Clear();
                ButRow1.Visibility = Visibility.Visible;
                logger.Info("new item");
                item = new Item() { BarCode = barcode,  CustID = 0, ID = -1, CreationDate = DateTime.Now  };
                Button but = new Button() { Content = "Unclassified Work", Height = ButtonHeight, Width = ButtonWidth, Visibility = Visibility.Visible };
                but.Margin = new Thickness(0, 5, 5, 5);
                but.Click += new RoutedEventHandler(but_Click);
                if (assemblyInfo.dept != "Laundry")     //must be unclassifield dry cleaning
                {
                    logger.Info("dry cleaning");
                    item.Category = vm.CleaningCats.Where(c => c.Name.StartsWith("Unclassified")).Single();
                }
                else
                {
                    logger.Info("laundry");
                    if (vm.activeCustomer.Starch == "H" || vm.activeCustomer.Starch == "M")
                    {
                        but.Content = "Starched Shirts";

                    }
                    else
                    {
                        but.Content = "No Starch Shirts";

                    }
                    //get category so we can place in the right bin
                    item.Category = vm.CleaningCats.Where(c => c.Name == but.Content.ToString()).Single();
                }
                ButRow1.Children.Add(but);
                SetupActions();
           
            }
            else
            {
                //known item but first check if it is unknown as it needs to be categorized before proceeding
                ButRow1.Children.Clear();
                ButRow2.Children.Clear();
                ButRow1.Visibility = Visibility.Visible;
                if (item.Category.ID == vm.unknownCat.ID || vm.ReClassifyButtonText == "ReClassify Off" || vm.QuickReClassifyButtonText == "Quick Reclassify Off")
                {
                    logger.Info("Classify");

                    vm.ReClassifyButtonText = "ReClassify On";    //this is a one time deal
                   
                    
                    if (!vm.bLoggedIn)
                    {
                        Errormsg.Text = "Classify is a adminstrator action";
                        ErrorTxt.Visibility = Visibility.Visible;
                        Barcode.Text = string.Empty;
                        BarcodeChars = 0;
                        return;
                    }
                    ButRow2.Visibility = Visibility.Visible;
                    int ii = 0;
                    foreach (Category cat in vm.CleaningCats)
                    {
                        if (cat.ID == vm.unknownCat.ID)
                            continue;
                        ii++;
                        Button but = new Button() { Content = cat.Name, Height = ButtonHeight, Width = ButtonWidth, Visibility = Visibility.Visible };
                        but.Margin = new Thickness(0, 5, 5, 5);

                        but.Click += new RoutedEventHandler(but_Click);
                        if (ii < 5)
                            ButRow1.Children.Add(but);
                        else
                            ButRow2.Children.Add(but);
                    }
                }
                else    //allow the garment to be placed in a bin
                {
                    Button but = new Button() {  Height = ButtonHeight, Width = ButtonWidth, Visibility = Visibility.Visible, IsEnabled = false };
                    if (assemblyInfo.dept != "Laundry")     //if this is  dry cleaning
                    {
                        Category cat = vm.CleaningCats.Where(c => c.ID == item.Category.ID).SingleOrDefault();
                        but.Content = cat.Name;
                    }
                    else    //laundry then get the starch from the customer info as they might have changed in fabricare
                    {
                        if (vm.activeCustomer.Starch == "H" || vm.activeCustomer.Starch == "M")
                           but.Content = "Starched Shirts";

                        else
                           but.Content = "No Starch Shirts";
                        //set category so we can place in the right bin in fabricare setting
                        item.Category = vm.CleaningCats.Where(c => c.Name == but.Content.ToString()).Single();
                    }
                    ButRow1.Children.Add(but);
                    SetupActions();
                   
                   
                }
            }

            

        }
Exemple #11
0
        //only this timer is operation now
        void timer2_Tick(object sender, EventArgs e)
        {
            timer2.Stop();
            Item item;

            if (!ProcessBarcode())
            {
                return;
            }
            vm.barcode = Barcode.Text;
            AutoSortInfo assemblyInfo = null;

            //check that the item is in the Assembly database if not then show message and allow more items
            //to be scanned
            try
            {
                assemblyInfo = vm.getItemInAssemblyDB(Barcode.Text);
                if (assemblyInfo == null)
                {
                    BarcodeChars        = 0;
                    Errormsg.Text       = string.Format(string.Format("Item has not been marked in {0}", Barcode.Text));
                    ErrorTxt.Visibility = Visibility.Visible;
                    return;
                }
                vm.GetCustomer(assemblyInfo.CustomerID);
                item = vm.GetItemInDB(Barcode.Text);
                if (item == null)
                {
                    Errormsg.Text       = string.Format(string.Format("item is not in BCS  {0} .. do not QA ", Barcode.Text));
                    ErrorTxt.Visibility = Visibility.Visible;
                    return;
                }
                NoteBox.Visibility = System.Windows.Visibility.Collapsed;
                if (item.Note != null && item.Note != string.Empty)
                {
                    NoteText.Text      = item.Note;
                    NoteBox.Visibility = Visibility.Visible;
                }
                DateTime date   = (DateTime)assemblyInfo.Duedate;
                DateTime future = DateTime.Now.AddDays(2);
                if (date < future)
                {
                    duedate.Foreground = new SolidColorBrush(Colors.Red);
                    duedate.FontSize   = 36;
                }
                if (date.Date <= DateTime.Now.Date)
                {
                    duedate.Text = "TODAY";
                }
                else
                {
                    duedate.Text = date.ToShortDateString();
                }
                vm.Duedate        = duedate.Text;
                CustomerName.Text = vm.activeCustomer.FirstName + " " + vm.activeCustomer.LastName;
                //check if this is in Route
                int  RFIDlen = assemblyInfo.rfid.Length;
                bool route   = false;
                for (int i = 0; i < assemblyInfo.rfid.Length; i++)
                {
                    if (assemblyInfo.rfid[i] != ' ')
                    {
                        route = true;
                        break;
                    }
                }
                if (route)
                {
                    store.Text = vm.store = "Route";
                }
                else
                {
                    store.Text = vm.store = assemblyInfo.storeName;
                }
            }
            catch (Exception e1)
            {
                BarcodeChars        = 0;
                Errormsg.Text       = string.Format(string.Format("Database logic error {0} {1}", Barcode.Text, e1.Message));
                ErrorTxt.Visibility = Visibility.Visible;
                return;
            }
            logger.Info(string.Format("all data obtained for {0} ", Barcode.Text));
            //if there is a picture then display it
            if (item.picture == null)
            {
                return;
            }
            picture.Visibility = Visibility.Visible;
            byte [] binaryData = Convert.FromBase64String(item.picture);
            bi = new BitmapImage();
            bi.BeginInit();
            bi.StreamSource = new MemoryStream(binaryData);
            bi.EndInit();
            img.Source = bi;
        }