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; }
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_chute_area = Request.QueryString["chutearea"].ToString(); string I_T_chute_label = Request.QueryString["tchutelabel"].ToString(); decimal I_T_chute_id = decimal.Parse(Request.QueryString["tchuteid"].ToString()); UserActivity setclass = new UserActivity(); ActivityLogDAO actlog = new ActivityLogDAO(); string barcodetype_sku = "Chute"; try { StringBuilder sb = new StringBuilder(); if (!String.IsNullOrEmpty(I_T_chute_label)) { 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;'>" + I_T_chute_label + "</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.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 Chute label"; this.Master.DisplayMessage = true; 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(); // Check if the scan chute id similar to target chute id. decimal chute_id = 0; try { chute_id = locdao.PreValidateChute(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 = "Chute barcode"; setclass.Barcode = loc_barcode; 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 = 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 (chute_id != 0) { if (chute_id == I_T_chute_id) { // 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 { this.Master.ErrorMessage = "Invalid Chute. Please scan again"; this.Master.DisplayMessage = true; this.Master.BarcodeValue = string.Empty; // 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.InvalidChuteType; setclass.ExpectedBarcodeType = "Chute"; setclass.Barcode = I_chute_barcode; setclass.UserId = I_user; setclass.ChuteId = decimal.ToInt32(I_chute_id); setclass.TrolleyId = decimal.ToInt32(I_trolley_id); setclass.ItemNumber = decimal.ToInt32(I_item); setclass.SessionEndDateTime = DateTime.Now; actlog.SaveUserActivity(setclass); } } else { this.Master.ErrorMessage = "Invalid Chute. Please scan again"; this.Master.DisplayMessage = true; this.Master.BarcodeValue = string.Empty; // 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.InvalidChuteType; setclass.ExpectedBarcodeType = "Chute"; setclass.Barcode = I_chute_barcode; setclass.UserId = I_user; setclass.ChuteId = decimal.ToInt32(I_chute_id); setclass.TrolleyId = decimal.ToInt32(I_trolley_id); setclass.ItemNumber = decimal.ToInt32(I_item); setclass.SessionEndDateTime = DateTime.Now; actlog.SaveUserActivity(setclass); } } } }