Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Master.Reset();

            this.Master.RegisterStandardScript = true;

            decimal I_chute_id      = decimal.Parse(Request.QueryString["chuteID"].ToString());
            string  I_chute_barcode = Request.QueryString["chutebarcode"].ToString();
            string  I_user          = Request.QueryString["userlogon"].ToString();
            decimal I_trolley_id    = decimal.Parse(Request.QueryString["trolleyid"].ToString());
            decimal I_chute_type    = decimal.Parse(Request.QueryString["chutetype"].ToString());
            decimal I_item          = decimal.Parse(Request.QueryString["itemid"].ToString());
            string  I_sku_barcode   = Request.QueryString["skubarcode"].ToString();
            string  I_label         = Request.QueryString["locationname"].ToString();
            decimal I_chute_area    = decimal.Parse(Request.QueryString["chutearea"] == null ? "0" : Request.QueryString["chutearea"].ToString());

            //string I_terminal = this.Master.HostName;
            string I_terminal = null;


            //this.Master.MessageBoard = "location is " + I_label;

            // on page load display this message

            // split the label string

            UserActivity   setclass = new UserActivity();
            ActivityLogDAO actlog   = new ActivityLogDAO();

            string barcodetype_sku = "SKU";

            try
            {
                string[] labels = I_label.Split('.');

                List <string> labelname = new List <string>();

                foreach (string label in labels)
                {
                    labelname.Add(label);
                }



                StringBuilder sb = new StringBuilder();

                if (!String.IsNullOrEmpty(labelname[0]))
                {
                    if (!String.IsNullOrEmpty(labelname[1]))
                    {
                        sb.Append("<div>");
                        sb.Append("<table width='100%' cellspacing='0px' cellpadding='0px' style='border-width:1px;border-collapse:collapse; border-style:solid;border-color:White;'>");
                        sb.Append("<tr>");
                        sb.Append("<td style='font-size:20px;padding-left:2px;border-width:2px;border-style:solid;border-color:White;'>" + labelname[0] + "</td>");
                        sb.Append("</tr>");
                        sb.Append("<tr>");
                        sb.Append("<td style='padding-left:2px;border-width:2px;border-style:solid;border-color:White;'>" + labelname[1] + "</td>");
                        sb.Append("</tr>");
                        sb.Append("</table>");
                        sb.Append("</div>");
                    }

                    else
                    {
                        sb.Append("<div>");
                        sb.Append("<table width='100%' cellspacing='0px' cellpadding='0px' style='border-width:1px;border-collapse:collapse; border-style:solid;border-color:White;'>");
                        sb.Append("<tr>");
                        sb.Append("<td style='font-size:24px;padding-left:2px;border-width:2px;border-style:solid;border-color:White;'>" + labelname[0] + "</td>");
                        sb.Append("</tr>");
                        sb.Append("</table>");
                        sb.Append("</div>");
                    }
                }


                this.Master.MessageBoard = sb.ToString();
            }
            catch (Exception ex)
            {
                // activity logging
                setclass.AppSystem           = (Int32)ActivityLogEnum.AppSystem.IHF;
                setclass.ApplicationId       = (Int32)ActivityLogEnum.ApplicationID.AttachAndLocate;
                setclass.ModuleId            = (Int32)ActivityLogEnum.ModuleID.AttachAndlocate;
                setclass.EventType           = (Int32)EventType.ScanItemForLocate;
                setclass.ResultCode          = (Int32)ActivityLogEnum.ResultCd.ItemvalidationFailed;
                setclass.ExpectedBarcodeType = barcodetype_sku;
                setclass.Barcode             = I_sku_barcode;
                setclass.TerminalId          = I_terminal;
                setclass.UserId     = I_user;
                setclass.ChuteId    = decimal.ToInt32(I_chute_id);
                setclass.TrolleyId  = decimal.ToInt32(I_trolley_id);
                setclass.ItemNumber = decimal.ToInt32(I_item);


                actlog.SaveUserActivity(setclass);



                this.Master.ErrorMessage   = "Error: Retrieving location name failed";
                this.Master.DisplayMessage = true;

                // redirect to scan sku ???????????
                Response.Redirect("LocateScanSku.aspx?chuteID=" + I_chute_id + "&chutebarcode=" + I_chute_barcode + "&userlogon=" + I_user + "&trolleyid=" + I_trolley_id + "&chutetype=" + I_chute_type + "&chutearea=" + I_chute_area);
            }


            if (IsPostBack)
            {
                string loc_barcode = this.Master.BarcodeValue;

                if (loc_barcode == string.Empty)
                {
                    this.Master.ErrorMessage   = "Invalid Scan. Please scan again";
                    this.Master.DisplayMessage = true;
                    this.Master.BarcodeValue   = string.Empty;
                }
                else
                {
                    if (loc_barcode.Length > 50)
                    {
                        loc_barcode = loc_barcode.Substring(0, 50);
                    }

                    LocateDAO locdao = new LocateDAO();

                    // user scans trolley location or overflow tote
                    // validate if it is a trolley location or overflow tote
                    // prevalidate the location barcode
                    string  loc_chk     = loc_barcode.Substring(0, 2).ToString();
                    string  barcode_loc = "Location";
                    decimal loc_id      = 0;

                    try
                    {
                        loc_id = locdao.PreValidateLocation(loc_barcode);
                    }
                    catch (Exception ex3)
                    {
                        // activity logging
                        setclass.AppSystem           = (Int32)ActivityLogEnum.AppSystem.IHF;
                        setclass.ApplicationId       = (Int32)ActivityLogEnum.ApplicationID.AttachAndLocate;
                        setclass.ModuleId            = (Int32)ActivityLogEnum.ModuleID.AttachAndlocate;
                        setclass.EventType           = (Int32)EventType.ScanLocation;
                        setclass.ResultCode          = (Int32)ActivityLogEnum.ResultCd.LocationValidationFailed;
                        setclass.ExpectedBarcodeType = barcode_loc;
                        setclass.Barcode             = loc_barcode;
                        setclass.TerminalId          = I_terminal;
                        setclass.UserId            = I_user;
                        setclass.ChuteId           = decimal.ToInt32(I_chute_id);
                        setclass.TrolleyId         = decimal.ToInt32(I_trolley_id);
                        setclass.TrolleyLocationId = decimal.ToInt32(loc_id);
                        setclass.ItemNumber        = decimal.ToInt32(I_item);



                        actlog.SaveUserActivity(setclass);


                        this.Master.ErrorMessage   = ex3.Message.Substring(ex3.Message.IndexOf(" ", 0), (ex3.Message.IndexOf("ORA", 1) - ex3.Message.IndexOf(" ", 0)));
                        this.Master.DisplayMessage = true;
                        this.Master.BarcodeValue   = string.Empty;
                    }



                    if (loc_chk.ToUpper() == "LC")
                    {
                        try
                        {
                            // if it is trolley location then validate using p_valid_location
                            decimal tr_loc = locdao.Validate_Location(loc_barcode, I_item, I_user, I_terminal);


                            if (tr_loc == 0)
                            {
                                // activity logging
                                setclass.AppSystem           = (Int32)ActivityLogEnum.AppSystem.IHF;
                                setclass.ApplicationId       = (Int32)ActivityLogEnum.ApplicationID.AttachAndLocate;
                                setclass.ModuleId            = (Int32)ActivityLogEnum.ModuleID.AttachAndlocate;
                                setclass.EventType           = (Int32)EventType.ScanLocation;
                                setclass.ResultCode          = (Int32)ActivityLogEnum.ResultCd.LocationValidationFailed;
                                setclass.ExpectedBarcodeType = barcode_loc;
                                setclass.Barcode             = loc_barcode;
                                setclass.TerminalId          = I_terminal;
                                setclass.UserId            = I_user;
                                setclass.ChuteId           = decimal.ToInt32(I_chute_id);
                                setclass.TrolleyId         = decimal.ToInt32(I_trolley_id);
                                setclass.TrolleyLocationId = decimal.ToInt32(loc_id);
                                setclass.ItemNumber        = decimal.ToInt32(I_item);

                                actlog.SaveUserActivity(setclass);


                                // if location is invalid then error

                                this.Master.ErrorMessage   = "Error: Location Validation Failed";
                                this.Master.DisplayMessage = true;
                            }
                            else
                            {
                                // else locate item using p_locate_item



                                string detached_ind = locdao.Locate_item(I_item, tr_loc, I_user, I_terminal);


                                if (!String.IsNullOrEmpty(detached_ind))
                                {
                                    if (detached_ind == "F")
                                    {
                                        // redirect to scan sku for scanning another sku or chute
                                        Response.Redirect("LocateScanSku.aspx?chuteID=" + I_chute_id + "&chutebarcode=" + I_chute_barcode + "&userlogon=" + I_user + "&trolleyid=" + I_trolley_id + "&chutetype=" + I_chute_type + "&chutearea=" + I_chute_area);
                                    }
                                    else if (detached_ind == "T")
                                    {
                                        // log off user
                                        //locdao.Log_off_Chute(I_chute_id, I_user);


                                        // activity logging
                                        setclass.AppSystem           = (Int32)ActivityLogEnum.AppSystem.IHF;
                                        setclass.ApplicationId       = (Int32)ActivityLogEnum.ApplicationID.AttachAndLocate;
                                        setclass.ModuleId            = (Int32)ActivityLogEnum.ModuleID.AttachAndlocate;
                                        setclass.EventType           = (Int32)EventType.LogOffChuteForLocate;
                                        setclass.ResultCode          = (Int32)ActivityLogEnum.ResultCd.Success;
                                        setclass.ExpectedBarcodeType = "Chute";
                                        setclass.Barcode             = I_chute_barcode;
                                        setclass.TerminalId          = I_terminal;
                                        setclass.UserId             = I_user;
                                        setclass.ChuteId            = decimal.ToInt32(I_chute_id);
                                        setclass.TrolleyId          = decimal.ToInt32(I_trolley_id);
                                        setclass.TrolleyLocationId  = decimal.ToInt32(loc_id);
                                        setclass.ItemNumber         = decimal.ToInt32(I_item);
                                        setclass.SessionEndDateTime = DateTime.Now;



                                        actlog.SaveUserActivity(setclass);

                                        // locate main screen
                                        Response.Redirect("Locate.aspx?message=" + "T");
                                        //this.Master.BarcodeValue = string.Empty;
                                        //this.Master.SuccessMessage = "Trolley is successfully located and detached";
                                        //this.Master.DisplayMessage = true;
                                    }
                                }
                            }
                        }
                        catch (Exception ex2)
                        {
                            // activity logging
                            setclass.AppSystem           = (Int32)ActivityLogEnum.AppSystem.IHF;
                            setclass.ApplicationId       = (Int32)ActivityLogEnum.ApplicationID.AttachAndLocate;
                            setclass.ModuleId            = (Int32)ActivityLogEnum.ModuleID.AttachAndlocate;
                            setclass.EventType           = (Int32)EventType.LocateItem;
                            setclass.ResultCode          = (Int32)ActivityLogEnum.ResultCd.FailedToLocate;
                            setclass.ExpectedBarcodeType = barcode_loc;
                            setclass.Barcode             = loc_barcode;
                            setclass.TerminalId          = I_terminal;
                            setclass.UserId            = I_user;
                            setclass.ChuteId           = decimal.ToInt32(I_chute_id);
                            setclass.TrolleyId         = decimal.ToInt32(I_trolley_id);
                            setclass.TrolleyLocationId = decimal.ToInt32(loc_id);
                            setclass.ItemNumber        = decimal.ToInt32(I_item);


                            actlog.SaveUserActivity(setclass);

                            this.Master.ErrorMessage   = ex2.Message.Substring(ex2.Message.IndexOf(" ", 0), (ex2.Message.IndexOf("ORA", 1) - ex2.Message.IndexOf(" ", 0)));
                            this.Master.DisplayMessage = true;
                            this.Master.BarcodeValue   = string.Empty;
                        }
                    }
                    else if (loc_chk.ToUpper() == "OT")
                    {
                        string barcode_ot = "Overflow Tote";
                        try
                        {
                            // if it is OT location then validate using p_valid_location
                            decimal ot_loc = locdao.Validate_Tote(loc_barcode, I_item, I_user, I_terminal);

                            if (ot_loc == 0)
                            {
                                // activity logging
                                setclass.AppSystem           = (Int32)ActivityLogEnum.AppSystem.IHF;
                                setclass.ApplicationId       = (Int32)ActivityLogEnum.ApplicationID.AttachAndLocate;
                                setclass.ModuleId            = (Int32)ActivityLogEnum.ModuleID.AttachAndlocate;
                                setclass.EventType           = (Int32)EventType.ScanOFTForAttach;
                                setclass.ResultCode          = (Int32)ActivityLogEnum.ResultCd.OFTValidationFailed;
                                setclass.ExpectedBarcodeType = barcode_ot;
                                setclass.Barcode             = loc_barcode;
                                setclass.TerminalId          = I_terminal;
                                setclass.UserId            = I_user;
                                setclass.ChuteId           = decimal.ToInt32(I_chute_id);
                                setclass.TrolleyId         = decimal.ToInt32(I_trolley_id);
                                setclass.TrolleyLocationId = decimal.ToInt32(loc_id);
                                setclass.ItemNumber        = decimal.ToInt32(I_item);



                                actlog.SaveUserActivity(setclass);

                                // if location is invalid then error

                                this.Master.ErrorMessage   = "Error: While validating Overflow Tote Location Location";
                                this.Master.DisplayMessage = true;
                            }
                            else
                            {
                                // else locate item using p_locate_item
                                // debug...........
                                //this.Master.MessageBoard = "item is:" + I_item + "ot loc is:" + ot_loc + "user is:" + I_user + "trolley id is" + I_trolley_id;

                                string detached_ind = locdao.Locate_tote_item(I_item, ot_loc, I_user, I_trolley_id, I_terminal);
                                if (!String.IsNullOrEmpty(detached_ind))
                                {
                                    if (detached_ind == "F")
                                    {
                                        // redirect to scan sku for scanning another sku or chute
                                        Response.Redirect("LocateScanSku.aspx?chuteID=" + I_chute_id + "&chutebarcode=" + I_chute_barcode + "&userlogon=" + I_user + "&trolleyid=" + I_trolley_id + "&chutetype=" + I_chute_type + "&chutearea=" + I_chute_area);
                                    }
                                    else if (detached_ind == "T")
                                    {
                                        // log off user
                                        //locdao.Log_off_Chute(I_chute_id, I_user);
                                        // activity logging
                                        setclass.AppSystem           = (Int32)ActivityLogEnum.AppSystem.IHF;
                                        setclass.ApplicationId       = (Int32)ActivityLogEnum.ApplicationID.AttachAndLocate;
                                        setclass.ModuleId            = (Int32)ActivityLogEnum.ModuleID.AttachAndlocate;
                                        setclass.EventType           = (Int32)EventType.LogOffChuteForLocate;
                                        setclass.ResultCode          = (Int32)ActivityLogEnum.ResultCd.Success;
                                        setclass.ExpectedBarcodeType = "Chute";
                                        setclass.Barcode             = I_chute_barcode;
                                        setclass.TerminalId          = I_terminal;
                                        setclass.UserId             = I_user;
                                        setclass.ChuteId            = decimal.ToInt32(I_chute_id);
                                        setclass.TrolleyId          = decimal.ToInt32(I_trolley_id);
                                        setclass.TrolleyLocationId  = decimal.ToInt32(loc_id);
                                        setclass.ItemNumber         = decimal.ToInt32(I_item);
                                        setclass.SessionEndDateTime = DateTime.Now;



                                        actlog.SaveUserActivity(setclass);

                                        // end of log off



                                        // locate main screen
                                        Response.Redirect("Locate.aspx?message=" + "T");
                                        //this.Master.BarcodeValue = string.Empty;
                                        //this.Master.SuccessMessage = "Trolley is successfully located and detached";
                                        //this.Master.DisplayMessage = true;
                                    }
                                }
                            }
                        }
                        catch (Exception ex1)
                        {
                            // activity logging
                            setclass.AppSystem           = (Int32)ActivityLogEnum.AppSystem.IHF;
                            setclass.ApplicationId       = (Int32)ActivityLogEnum.ApplicationID.AttachAndLocate;
                            setclass.ModuleId            = (Int32)ActivityLogEnum.ModuleID.AttachAndlocate;
                            setclass.EventType           = (Int32)EventType.LocateItem;
                            setclass.ResultCode          = (Int32)ActivityLogEnum.ResultCd.FailedToLocateInOT;
                            setclass.ExpectedBarcodeType = barcode_ot;
                            setclass.Barcode             = loc_barcode;
                            setclass.TerminalId          = I_terminal;
                            setclass.UserId            = I_user;
                            setclass.ChuteId           = decimal.ToInt32(I_chute_id);
                            setclass.TrolleyId         = decimal.ToInt32(I_trolley_id);
                            setclass.TrolleyLocationId = decimal.ToInt32(loc_id);
                            setclass.ItemNumber        = decimal.ToInt32(I_item);


                            actlog.SaveUserActivity(setclass);


                            this.Master.ErrorMessage   = ex1.Message.Substring(ex1.Message.IndexOf(" ", 0), (ex1.Message.IndexOf("ORA", 1) - ex1.Message.IndexOf(" ", 0)));
                            this.Master.DisplayMessage = true;
                            this.Master.BarcodeValue   = string.Empty;
                        }
                    }
                }
            }//end of postback
        }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Master.Reset();

            this.Master.RegisterStandardScript = true;

            if (!IsPostBack)
            {
                {
                    // on page load display this message
                    ShowMessage("Scan Chute", MessageType.NormalMessage);
                    this.step.Value = RemoveForPackStep.Initial.ToString();
                }
            }
            else
            {
                _barcode = (this.Master.BarcodeValue.Length > 50) ?  this.Master.BarcodeValue.Substring(0, 50) : this.Master.BarcodeValue;

                if (_barcode != string.Empty)
                {
                    _barcode = _barcode.ToUpper();

                    switch (this.step.Value)
                    {
                    // Initial - scan chute to attach to chute
                    case "Initial":
                    {
                        /* Scan Chute and attach to chute  for session */
                        try
                        {
                            validatechute(_barcode);

                            string itemsInChute = "F";

                            _removepackdao.itemsinchute(decimal.Parse(this.chuteid.Value), ref itemsInChute);

                            if (itemsInChute == "F")
                            {
                                ShowMessage("No orders for this chute, please scan another chute", MessageType.NormalMessage);
                                this.step.Value = RemoveForPackStep.Initial.ToString();
                            }
                            else
                            {
                                this.Master.MessageBoard = "Scan SKU barcode";
                                this.step.Value          = RemoveForPackStep.ScanSku.ToString();
                            }
                        }
                        catch (Exception ex)
                        {
                            string exceptionMessage = ex.Message;
                            if (isErrorMessage(ref exceptionMessage))
                            {
                                ShowMessage(exceptionMessage, MessageType.ErrorConfirm);
                            }
                            else
                            {
                                // There aren't really messages passed back for non error conditions in this back end proc
                                ShowMessage(exceptionMessage, MessageType.ErrorConfirm);
                            }
                        }

                        break;
                    }

                    case "ScanSku":
                    {
                        // If a chute bacode has been scanned
                        if (_barcode.Substring(0, 2) == "CH")
                        {
                            this.step.Value = RemoveForPackStep.Initial.ToString();
                            validatechute(_barcode);
                            string itemsInChute = "F";

                            _removepackdao.itemsinchute(decimal.Parse(this.chuteid.Value), ref itemsInChute);

                            if (itemsInChute == "F")
                            {
                                ShowMessage("No orders for this chute, please scan another chute", MessageType.NormalMessage);
                                this.step.Value = RemoveForPackStep.Initial.ToString();
                            }
                            else
                            {
                                this.Master.MessageBoard = "Scan SKU barcode";
                                this.step.Value          = RemoveForPackStep.ScanSku.ToString();
                            }
                        }
                        else
                        {
                            try
                            {
                                itemid.Value = _locatedao.Find_item(decimal.Parse(this.chuteid.Value), _barcode, User.Identity.Name, string.Empty, decimal.Parse(this.areaid.Value)).ToString();

                                if (decimal.Parse(itemid.Value) > 0)
                                {
                                    this.singleschutelabel.Value = string.Empty;
                                    this.singleschuteid.Value    = string.Empty;

                                    string IsManualSingle = "F";
                                    IsManualSingle = _locatedao.OrderForManualArea(decimal.Parse(this.areaid.Value), decimal.Parse(this.chuteid.Value), decimal.Parse(itemid.Value));

                                    if (IsManualSingle.ToUpper() != "F")
                                    {
                                        string[] singleschuteval;

                                        singleschuteval = IsManualSingle.Split('-');

                                        this.singleschuteid.Value    = singleschuteval[0];
                                        this.singleschutelabel.Value = singleschuteval[1];
                                        this.step.Value = RemoveForPackStep.ScanSinglesChute.ToString();

                                        string msg = "Scan " + singleschuteval[1];
                                        ShowMessage(msg, MessageType.NormalMessage);
                                    }
                                    else
                                    {
                                        try
                                        {
                                            string location_name = _locatedao.Find_location_name(decimal.Parse(itemid.Value));
                                            if (location_name == null)
                                            {
                                                ShowMessage("Location not found for Item", MessageType.ErrorConfirm);
                                                this.Master.MessageBoard = "Scan SKU Barcode";
                                            }

                                            try
                                            {
                                                // if last item then pre-warn user to remove the order
                                                decimal itemCount = 0;
                                                _removepackdao.itemsnotlocated(decimal.Parse(itemid.Value), ref itemCount);

                                                string removeOrderStr = "";

                                                if (itemCount < 2)
                                                {
                                                    removeOrderStr = ", then remove order";
                                                }

                                                string locstr = LocationMessage(location_name, removeOrderStr);

                                                // if (itemCount < 2) locstr += ", then remove order";

                                                this.step.Value = RemoveForPackStep.ScanLocation.ToString();
                                                ShowMessage(locstr, MessageType.NormalMessage);
                                            }
                                            catch
                                            {
                                                ShowMessage("Error getting location details", MessageType.ErrorConfirm);
                                            }
                                        }
                                        catch (Exception ex)
                                        {
                                            string exceptionMessage = ex.Message;
                                            if (isErrorMessage(ref exceptionMessage))
                                            {
                                                ShowMessage(exceptionMessage, MessageType.ErrorConfirm);
                                            }
                                            else
                                            {
                                                // There aren't really messages passed back for non error conditions in this back end proc
                                                ShowMessage(exceptionMessage, MessageType.ErrorConfirm);
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    if (itemid.Value == "0")
                                    {
                                        // if item not found
                                        ShowMessage("Item not for this chute", MessageType.ErrorConfirm);
                                        this.Master.BarcodeValue = string.Empty;
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                string exceptionMessage = ex.Message;
                                if (isErrorMessage(ref exceptionMessage))
                                {
                                    ShowMessage(exceptionMessage, MessageType.ErrorConfirm);
                                }
                                else
                                {
                                    // There aren't really messages passed back for non error conditions in this back end proc
                                    ShowMessage(exceptionMessage, MessageType.ErrorConfirm);
                                }
                            }
                        }
                        break;
                    }

                    case "ScanLocation":
                    {
                        //This could be a overflow tote or a trolley location
                        if (_barcode.Substring(0, 2) == "LC")
                        {
                            try
                            {
                                _locationid = _locatedao.Validate_Location(_barcode, decimal.Parse(itemid.Value), User.Identity.Name, null);

                                if (_locationid == 0)
                                {
                                    ShowMessage("Location Validation Failed", MessageType.ErrorConfirm);
                                }
                            }
                            catch (Exception ex)
                            {
                                string exceptionMessage = ex.Message;
                                if (isErrorMessage(ref exceptionMessage))
                                {
                                    ShowMessage(exceptionMessage, MessageType.ErrorConfirm);
                                }
                                else
                                {
                                    // There aren't really messages passed back for non error conditions in this back end proc
                                    ShowMessage(exceptionMessage, MessageType.ErrorConfirm);
                                }
                            }
                        }
                        else if (_barcode.Substring(0, 2) == "OT")
                        {
                            try
                            {
                                _overflowtoteid = _locatedao.Validate_Tote(_barcode, decimal.Parse(itemid.Value), User.Identity.Name, null);

                                if (_overflowtoteid == 0)
                                {
                                    ShowMessage("Overflow Tote Validation Failed", MessageType.ErrorConfirm);
                                }
                            }
                            catch (Exception ex)
                            {
                                string exceptionMessage = ex.Message;
                                if (isErrorMessage(ref exceptionMessage))
                                {
                                    ShowMessage(exceptionMessage, MessageType.ErrorConfirm);
                                }
                                else
                                {
                                    // There aren't really messages passed back for non error conditions in this back end proc
                                    ShowMessage(exceptionMessage, MessageType.ErrorConfirm);
                                }
                            }
                        }
                        else
                        {
                            ShowMessage("Invalid location or overflow tote barcode", MessageType.ErrorConfirm);
                            this.Master.BarcodeValue = string.Empty;
                        }

                        if (_locationid > 0 || _overflowtoteid > 0)
                        {
                            string  fullyLocatedInd   = "F";
                            decimal ordernumber       = 0;
                            decimal ordervolume       = 0;
                            string  toteService       = string.Empty;
                            string  toteBarcodePrefix = string.Empty;
                            string  toteTypeName      = string.Empty;
                            decimal currLocId         = 0;
                            string  currLocBarcode    = string.Empty;
                            string  currLocLabel      = string.Empty;
                            decimal numItems          = 0;


                            try
                            {
                                _removepackdao.locateitem(decimal.Parse(itemid.Value),
                                                          _locationid, _overflowtoteid,
                                                          decimal.Parse(this.trolleyid.Value),
                                                          User.Identity.Name, null, ref ordernumber,
                                                          ref fullyLocatedInd, ref ordervolume, ref toteService,
                                                          ref toteBarcodePrefix, ref toteTypeName, ref currLocId,
                                                          ref currLocBarcode, ref currLocLabel, ref numItems);

                                if (fullyLocatedInd == "T")
                                {
                                    this.Master.MessageBoard = "<embed id='snd' src='" + ConfigurationManager.AppSettings["SuccessSound"] + "' autostart='true' hidden='true'></embed>" +
                                                               "Remove " + numItems.ToString() + " item(s) from " + currLocLabel + " to a " + toteTypeName +
                                                               "<br />Scan location barcode";
                                    this.step.Value = RemoveForPackStep.ReScanLocation.ToString();

                                    this.locationbarcode.Value = currLocBarcode;
                                    this.totetype.Value        = toteTypeName;
                                    this.toteservice.Value     = toteService;
                                }
                                else
                                {
                                    this.step.Value = RemoveForPackStep.ScanSku.ToString();
                                    ShowMessage("Scan SKU barcode", MessageType.NormalMessage);
                                }
                            }
                            catch (Exception ex)
                            {
                                string exceptionMessage = ex.Message;
                                if (isErrorMessage(ref exceptionMessage))
                                {
                                    ShowMessage(exceptionMessage, MessageType.ErrorConfirm);
                                }
                                else
                                {
                                    // There aren't really messages passed back for non error conditions in this back end proc
                                    ShowMessage(exceptionMessage, MessageType.ErrorConfirm);
                                }
                            }
                        }

                        break;
                    }

                    case "ReScanLocation":
                    {
                        if (_barcode == this.locationbarcode.Value)
                        {
                            // log the activity - success
                            _useract.AppSystem     = (int)ActivityLogEnum.AppSystem.IHF;
                            _useract.ApplicationId = (int)ActivityLogEnum.ApplicationID.RemoveForPack;
                            _useract.ModuleId      = (int)ActivityLogEnum.ModuleID.RemoveForPack;
                            _useract.EventType     = (int)EventType.RescanLocation;
                            _useract.UserId        = Shared.CurrentUser;
                            _useract.Barcode       = _barcode;
                            _useract.Value1        = this.locationbarcode.Value;
                            _useract.ResultCode    = (Int32)ActivityLogEnum.ResultCd.Success;

                            _uadao.SaveUserActivity(_useract);

                            // set step and show message
                            this.step.Value = RemoveForPackStep.ScanTote.ToString();

                            String msgStr = "Scan " + this.toteservice.Value + " to ";
                            if (this.totelabel.Value == string.Empty)
                            {
                                msgStr += "a " + this.totetype.Value + ".";
                            }
                            else
                            {
                                msgStr += "tote " + this.totelabel.Value + ".";
                            }

                            ShowMessage(msgStr, MessageType.NormalMessage);
                        }
                        else
                        {
                            // log the activity - failure
                            _useract.AppSystem     = (int)ActivityLogEnum.AppSystem.IHF;
                            _useract.ApplicationId = (int)ActivityLogEnum.ApplicationID.RemoveForPack;
                            _useract.ModuleId      = (int)ActivityLogEnum.ModuleID.RemoveForPack;
                            _useract.EventType     = (int)EventType.RescanLocation;
                            _useract.UserId        = Shared.CurrentUser;
                            _useract.Barcode       = _barcode;
                            _useract.Value1        = this.locationbarcode.Value;
                            _useract.ResultCode    = (Int32)ActivityLogEnum.ResultCd.LocationValidationFailed;

                            _uadao.SaveUserActivity(_useract);


                            // show the error message
                            ShowMessage("Incorrect Location", MessageType.ErrorConfirm);
                        }
                        break;
                    }

                    case "ScanTote":
                    {
                        if (this.totebarcode.Value != string.Empty && this.totebarcode.Value != _barcode)
                        {
                            ShowMessage("Scan to tote: " + this.totelabel.Value, MessageType.ErrorConfirm);
                        }
                        else
                        {
                            decimal nextlocid      = 0;
                            string  nextlocbarcode = string.Empty;
                            string  nextloclabel   = string.Empty;
                            decimal itemcount      = 0;
                            string  totelabel      = string.Empty;

                            try
                            {
                                _removepackdao.movetotote(locationbarcode.Value, _barcode, User.Identity.Name, null, ref nextlocid, ref nextlocbarcode, ref nextloclabel, ref totelabel, ref itemcount);

                                if (nextlocid == 0)
                                {
                                    // no more items for this order
                                    // need to see if there are any more orders left in this chute

                                    string msg          = this.toteservice.Value + " in tote";
                                    string itemsInChute = "F";

                                    _removepackdao.itemsinchute(decimal.Parse(this.chuteid.Value), ref itemsInChute);

                                    if (itemsInChute == "F")
                                    {
                                        msg            += ". No more orders in this chute, please scan another chute";
                                        this.step.Value = RemoveForPackStep.Initial.ToString();
                                    }
                                    else
                                    {
                                        msg            += ", scan next item for locate";
                                        this.step.Value = RemoveForPackStep.ScanSku.ToString();
                                    }

                                    ShowMessage(msg, MessageType.NormalMessage);

                                    // ShowMessage(this.toteservice.Value + " in tote, scan next item for locate", MessageType.NormalMessage);
                                    this.totebarcode.Value = string.Empty;
                                    this.totelabel.Value   = string.Empty;
                                    // this.step.Value = RemoveForPackStep.ScanSku.ToString();
                                }
                                else
                                {
                                    ShowMessage("Remove " + itemcount.ToString() + " item(s) from " + nextloclabel + " to " + totelabel + "<br />Scan location barcode", MessageType.NormalMessage);
                                    this.totebarcode.Value     = _barcode;
                                    this.totelabel.Value       = totelabel;
                                    this.locationbarcode.Value = nextlocbarcode;
                                    this.step.Value            = RemoveForPackStep.ReScanLocation.ToString();
                                }
                            }
                            catch (Exception ex)
                            {
                                string exceptionMessage = ex.Message;
                                if (isErrorMessage(ref exceptionMessage))
                                {
                                    ShowMessage(exceptionMessage, MessageType.ErrorConfirm);
                                }
                                else
                                {
                                    // There aren't really messages passed back for non error conditions in this back end proc
                                    ShowMessage(exceptionMessage, MessageType.ErrorConfirm);
                                }
                            }
                        }
                        break;
                    }

                    case "ScanSinglesChute":
                    {
                        string  singleschutelabel = this.singleschutelabel.Value;
                        decimal singleschuteid    = decimal.Parse(this.singleschuteid.Value);

                        if (_barcode == string.Empty)
                        {
                            ShowMessage("Invalid scan. Please scan again.", MessageType.ErrorConfirm);
                            this.Master.MessageBoard = "Scan " + singleschutelabel;
                        }
                        else
                        {
                            LocateDAO locadao = new LocateDAO();

                            // check if scanned chute is the same as the one passed in

                            decimal scannedchuteid = 0;

                            try
                            {
                                scannedchuteid = locadao.PreValidateChute(_barcode);
                            }
                            catch (Exception ex)
                            {
                                // activity logging
                                _useract.AppSystem           = (int)ActivityLogEnum.AppSystem.IHF;
                                _useract.ApplicationId       = (int)ActivityLogEnum.ApplicationID.RemoveForPack;
                                _useract.ModuleId            = (int)ActivityLogEnum.ModuleID.RemoveForPack;
                                _useract.EventType           = (int)EventType.ScanLocation;
                                _useract.ResultCode          = (Int32)ActivityLogEnum.ResultCd.LocationValidationFailed;
                                _useract.ExpectedBarcodeType = "Chute barcode";
                                _useract.Barcode             = _barcode;
                                _useract.UserId     = Shared.CurrentUser;
                                _useract.ChuteId    = (int)singleschuteid;
                                _useract.ItemNumber = Int32.Parse(this.itemid.Value);

                                _uadao.SaveUserActivity(_useract);


                                // display error
                                string msg = ex.Message.Substring(ex.Message.IndexOf(" ", 0), ex.Message.IndexOf("ORA", 1) - ex.Message.IndexOf(" ", 0));
                                ShowMessage(msg, MessageType.ErrorConfirm);
                                this.Master.BarcodeValue = string.Empty;
                            }

                            if (scannedchuteid != 0)
                            {
                                if (scannedchuteid == singleschuteid)
                                {
                                    // chute id is correct - move on to next SKU
                                    this.step.Value = RemoveForPackStep.ScanSku.ToString();
                                    ShowMessage("Scan SKU barcode", MessageType.NormalMessage);
                                    this.singleschutelabel.Value = string.Empty;
                                    this.singleschuteid.Value    = string.Empty;
                                }
                                else
                                {
                                    ShowMessage("Invalid scan. Please scan again.", MessageType.ErrorConfirm);

                                    // activity logging
                                    _useract.AppSystem           = (int)ActivityLogEnum.AppSystem.IHF;
                                    _useract.ApplicationId       = (int)ActivityLogEnum.ApplicationID.RemoveForPack;
                                    _useract.ModuleId            = (int)ActivityLogEnum.ModuleID.RemoveForPack;
                                    _useract.EventType           = (int)EventType.LogOffChuteForLocate;
                                    _useract.ResultCode          = (Int32)ActivityLogEnum.ResultCd.InvalidChuteType;
                                    _useract.ExpectedBarcodeType = "Chute";
                                    _useract.Barcode             = _barcode;
                                    _useract.UserId             = Shared.CurrentUser;
                                    _useract.ChuteId            = (int)singleschuteid;
                                    _useract.ItemNumber         = Int32.Parse(this.itemid.Value);
                                    _useract.SessionEndDateTime = DateTime.Now;

                                    _uadao.SaveUserActivity(_useract);
                                }
                            }
                            else
                            {
                                ShowMessage("Invalid scan. Please scan again.", MessageType.ErrorConfirm);

                                // activity logging
                                _useract.AppSystem           = (int)ActivityLogEnum.AppSystem.IHF;
                                _useract.ApplicationId       = (int)ActivityLogEnum.ApplicationID.RemoveForPack;
                                _useract.ModuleId            = (int)ActivityLogEnum.ModuleID.RemoveForPack;
                                _useract.EventType           = (int)EventType.LogOffChuteForLocate;
                                _useract.ResultCode          = (Int32)ActivityLogEnum.ResultCd.InvalidChuteType;
                                _useract.ExpectedBarcodeType = "Chute";
                                _useract.Barcode             = _barcode;
                                _useract.UserId             = Shared.CurrentUser;
                                _useract.ChuteId            = (int)singleschuteid;
                                _useract.ItemNumber         = Int32.Parse(this.itemid.Value);
                                _useract.SessionEndDateTime = DateTime.Now;

                                _uadao.SaveUserActivity(_useract);
                            }
                        }
                        break;
                    }
                    }
                }
            }
            this.Master.BarcodeValue = string.Empty;
        }