// *** Generated Source File ***
// Portions Copyright (c) 1996-2000, SilverStream Software, Inc., All Rights Reserved
/**
* Known Issues:
* - Old database allowed 12-digit barcodes. fFindExactMatch will not find 12-digit barcodes.
* - Exact match search can be run with an incomplete barcode entry. Is it OK to allow user to try to Add
* when they haven't entered a complete barcode? If not, the search objects somehow prevent the Message
* Manager from displaying a message. How do we get around that?
**/
/***********
* Things todo still
*
* clear fields when a search is initiated
* fix all checkboxes to use selectedValue rather than setValue
* replace all grabFocus calls with requestFocus
* disable fields when no barcode is in barcode field
*
*
*************/
package com.sssw.gen.forms; // generated by SilverStream: do not edit
import java.awt.*;
import java.util.*;
import java.math.*;
import com.sssw.rt.gui.*;
import com.sssw.rt.util.*;
import com.sssw.rt.event.*;
import java.awt.event.*;
import com.sssw.rt.expr.*;
import javax.swing.*;
import javax.swing.event.*;
import java.io.*;
import com.sssw.rt.tview.*;
import com.sssw.rt.jform.*;
import com.sssw.rt.form.*;
//TAMS imports
import com.gpc.backofficecommon.constants.schema.*;
import com.gpc.backofficecommon.util.SilverStreamExceptionHelper;
import com.gpc.client.backoffice.util.FwoUnsupportedObjectException;
import com.gpc.backofficecommon.util.TamsMisc;
import com.gpc.tams.app.*;
import com.gpc.client.backoffice.app.TamsFormMaster;
import com.gpc.client.backoffice.FwoFormMaster;
import com.gpc.backofficecommon.app.TamsCacheMgr;
import com.gpc.frame.*;
import com.gpc.client.backoffice.FwoFormMaster;
import com.gpc.client.backoffice.FwoBufferedData;
import com.gpc.client.backoffice.FwoNavigationMgr;
import com.gpc.client.backoffice.FwoToolBarDirector;
import com.gpc.backofficecommon.FwoSessionMgr;
import com.gpc.client.backoffice.search.FwoSearchBase;
import com.gpc.client.backoffice.search.TsoSearchBarcode;
import com.gpc.client.backoffice.input.document.*;
import com.gpc.client.common.input.verifier.*;
import com.gpc.client.common.input.document.*;
import com.gpc.tams.dso.TsoGenericBandDescriptor;
import com.gpc.client.common.ClientApplicationContext;
import com.gpc.client.common.input.document.TsoValidatedIMPartNumberDocument;
import com.gpc.client.common.input.document.TsoValidatedLineAbbrevDocument;
import com.gpc.client.common.input.verifier.TsoIMPartNumberVerifier;
import com.gpc.client.common.input.verifier.TsoLineAbbreviationVerifier;
import com.gpc.client.common.focusmanager.FocusDecider;
import com.gpc.client.common.focusmanager.DefaultFocusDecider;
import com.gpc.common.TsoConstant;
import com.gpc.common.TsoCurrentUser;
import com.gpc.common.FwiConstant;
import com.gpc.common.exception.ApplicationException;
import com.gpc.common.pattern.FwoDatePattern;
import com.gpc.common.pattern.FwoPattern;
import com.gpc.common.pattern.DatePatternFormatException;
import org.apache.log4j.Logger;
import com.gpc.common.Profile;
public class FrmIM_BarCodeMaint extends AgfForm // generated by SilverStream: do not edit
implements
ActionListener,
com.gpc.client.backoffice.search.FwiFormSearch,
com.gpc.frame.FwiFormEdit,
com.gpc.frame.FwiFormProcess {
public com.sssw.rt.jform.AgcJLabel Label2;
public com.sssw.rt.jform.AgcJLabel Label1;
private static final Logger logger = Logger.getLogger(FrmIM_BarCodeMaint.class);
public com.sssw.rt.jform.AgcJLabel lblBarCodeInfo;
public com.sssw.rt.jform.AgcJTextField fldBarcode;
public com.sssw.rt.jform.AgcJLabel lblBarcode;
public com.sssw.rt.jform.AgcJLabel lblLine;
public com.sssw.rt.jform.AgcJLabel lblPartNumber;
public com.sssw.rt.jform.AgcJLabel lblQty;
public com.sssw.rt.jform.AgcJLabel lblDVD;
public com.sssw.rt.jform.AgcJTextField fldPartNumber;
public javax.swing.ButtonGroup DefaultJButtonGroup = new javax.swing.ButtonGroup();
public com.sssw.rt.jform.AgcJCheckBox ckDVD;
public com.sssw.rt.jform.AgcJLabel lblDescr;
public com.sssw.rt.jform.AgcJTextField fldLine_Abbr;
public com.sssw.rt.jform.AgcJTextField fldQty;
public com.sssw.rt.jform.AgcJLabel lblBinLabel;
public com.sssw.rt.jform.AgcJCheckBox ckUseBinLabel;
public com.sssw.rt.jform.AgcJLabel lblPlanogram;
public com.sssw.rt.jform.AgcJCheckBox ckUsePlanogram;
public com.sssw.rt.form.AgcRectangle rctPartInformation;
public com.sssw.rt.jform.AgcJLabel barcode_detail14_12_gif;
public com.sssw.rt.form.AgcData agcBarCodeUse;
public com.sssw.rt.jform.AgcJLabel lbl14DigitCode;
public com.sssw.rt.jform.AgcJLabel lbl12DigitCode;
public com.sssw.rt.form.AgcData dsoData;
public com.sssw.rt.form.AgcData agcBarCode;
public com.sssw.rt.jform.AgcJTextField fldPartNumber2;
public com.sssw.rt.jform.AgcJTextField fldPartNfldPartNumber;
public com.sssw.rt.jform.AgcJTextField fldPartNumber0;
public com.sssw.rt.jform.AgcJLabel barcode_detail12_10_gif;
public com.sssw.rt.jform.AgcJButton btnSearch;
public com.sssw.rt.jform.AgcJTextField Field6;
public com.sssw.rt.jform.AgcJLabel lblTitle;
public com.sssw.rt.jform.AgcJLabel lblModify;
public com.sssw.rt.form.AgcRectangle rctBarCodeFormat;
public AgfForm thisForm;
private TamsFormMaster FM; //Instance of Form Master
private FwoSessionMgr m_SessionMgr = FwoSessionMgr.getInstance();; // Ref to Framework Session Manager Object
private String m_FormName = TsoConstant.FRM_IM_BARCODE; // Display Form Name
private FwoBufferedData m_NavData; //Navigation data used by the Form Master instance */
private FwoNavigationMgr m_NavMgr;
private FwoDatePattern m_DP = (FwoDatePattern) FwoPattern.getDatePatternInstance(ClientApplicationContext.getClientApplicationContext().getCurrentLocale(),
new Integer(ClientApplicationContext.getClientApplicationContext().getProfile(
Profile.BACKOFFICE_CLIENT, ClientApplicationContext.getClientApplicationContext().getLocation()
).getStoreProfile().getRefDateFormatId().intValue() ) );
/** advanced search object */
private TsoSearchBarcode advancedSearchObject = null;
private boolean fromNewSearch = false;
private boolean m_NeedsUpdate = false; // flag for tracking whether record needs to be saved.
private String usePlanogram="N";
private String useBinLabel="N";
private boolean m_addingNew = false;
public FrmIM_BarCodeMaint()
{
//==== Warning: SilverStream-generated method: do not edit. All changes will be lost ===
}
public void init() throws Exception
{
//==== Warning: SilverStream-generated method: do not edit. All changes will be lost ===
// Initialize form and data
this.setTransparent(false);
this.setBackground(Color.white);
this.setBackgroundImageMode(2);
agData.setDataMode(AgoData.DATA_MODE_NORMAL);
this.setName("FrmIM_BarCodeMaint");
this.setBounds(10,10,1016,663);
// Initialize Label2
Label2 = new com.sssw.rt.jform.AgcJLabel();
Label2.setName("Label2");
Label2.setBounds(805,305,163,120);
Label2.setText("barcode_detail14_12_gif");
Label2.setIcon(new ImageIcon(getImage("barcode_detail13.gif")));
Label2.setOpaque(false);
Label2.setTextStyle(0);
Label2.setForeground(Color.black);
Label2.setTextShadowColor(Color.darkGray);
Label2.setTextHighlightColor(Color.gray);
Label2.setBackground(Color.lightGray);
Label2.setHorizontalAlignment(SwingConstants.LEFT);
Label2.setVerticalAlignment(SwingConstants.CENTER);
Label2.setHorizontalTextPosition(SwingConstants.RIGHT);
Label2.setVerticalTextPosition(SwingConstants.CENTER);
Label2.setWordWrap(false);
Label2.setFont(new Font("SansSerif", 0, 12));
// Initialize Label1
Label1 = new com.sssw.rt.jform.AgcJLabel();
Label1.setName("Label1");
Label1.setBounds(548,305,242,20);
Label1.setText("UPC - 13 Code");
Label1.setOpaque(false);
Label1.setTextStyle(0);
Label1.setForeground(AgoColorManager.getColor(79, 79, 79));
Label1.setTextShadowColor(Color.darkGray);
Label1.setTextHighlightColor(Color.gray);
Label1.setBackground(Color.lightGray);
Label1.setHorizontalAlignment(SwingConstants.RIGHT);
Label1.setVerticalAlignment(SwingConstants.CENTER);
Label1.setHorizontalTextPosition(SwingConstants.RIGHT);
Label1.setVerticalTextPosition(SwingConstants.CENTER);
Label1.setWordWrap(false);
Label1.setFont(new Font("SansSerif", 3, 15));
// Initialize lblBarCodeInfo
lblBarCodeInfo = new com.sssw.rt.jform.AgcJLabel();
lblBarCodeInfo.setName("lblBarCodeInfo");
lblBarCodeInfo.setBounds(550,110,438,52);
lblBarCodeInfo.setText("The barcode will be one of the following formats. All digits must be entered.");
lblBarCodeInfo.setOpaque(false);
lblBarCodeInfo.setTextStyle(0);
lblBarCodeInfo.setForeground(Color.black);
lblBarCodeInfo.setTextShadowColor(Color.darkGray);
lblBarCodeInfo.setTextHighlightColor(Color.gray);
lblBarCodeInfo.setBackground(Color.lightGray);
lblBarCodeInfo.setHorizontalAlignment(SwingConstants.LEFT);
lblBarCodeInfo.setVerticalAlignment(SwingConstants.TOP);
lblBarCodeInfo.setHorizontalTextPosition(SwingConstants.RIGHT);
lblBarCodeInfo.setVerticalTextPosition(SwingConstants.CENTER);
lblBarCodeInfo.setWordWrap(true);
lblBarCodeInfo.setFont(new Font("SansSerif", 1, 12));
// Initialize fldBarcode
fldBarcode = new com.sssw.rt.jform.AgcJTextField();
fldBarcode.setName("fldBarcode");
fldBarcode.setBounds(127,42,155,20);
fldBarcode.setFont(new Font("SansSerif", 0, 12));
fldBarcode.setHorizontalAlignment(2);
fldBarcode.setMargin(new Insets(1, 1, 1, 1));
fldBarcode.setEditable(true);
fldBarcode.setForeground(Color.black);
fldBarcode.setBackground(Color.white);
fldBarcode.setMaxLength(AgcJTextField.NO_LIMIT);
fldBarcode.setMinLength(AgcJTextField.NO_LIMIT);
// Initialize lblBarcode
lblBarcode = new com.sssw.rt.jform.AgcJLabel();
lblBarcode.setName("lblBarcode");
lblBarcode.setBounds(19,42,96,20);
lblBarcode.setText("Barcode");
lblBarcode.setOpaque(false);
lblBarcode.setTextStyle(0);
lblBarcode.setForeground(Color.black);
lblBarcode.setTextShadowColor(Color.darkGray);
lblBarcode.setTextHighlightColor(Color.gray);
lblBarcode.setBackground(Color.lightGray);
lblBarcode.setHorizontalAlignment(SwingConstants.RIGHT);
lblBarcode.setVerticalAlignment(SwingConstants.CENTER);
lblBarcode.setHorizontalTextPosition(SwingConstants.RIGHT);
lblBarcode.setVerticalTextPosition(SwingConstants.CENTER);
lblBarcode.setWordWrap(false);
lblBarcode.setFont(new Font("SansSerif", 1, 12));
// Initialize lblLine
lblLine = new com.sssw.rt.jform.AgcJLabel();
lblLine.setName("lblLine");
lblLine.setBounds(68,156,177,20);
lblLine.setText("Line");
lblLine.setOpaque(false);
lblLine.setTextStyle(0);
lblLine.setForeground(Color.black);
lblLine.setTextShadowColor(Color.darkGray);
lblLine.setTextHighlightColor(Color.gray);
lblLine.setBackground(Color.lightGray);
lblLine.setHorizontalAlignment(SwingConstants.RIGHT);
lblLine.setVerticalAlignment(SwingConstants.CENTER);
lblLine.setHorizontalTextPosition(SwingConstants.RIGHT);
lblLine.setVerticalTextPosition(SwingConstants.CENTER);
lblLine.setWordWrap(false);
lblLine.setFont(new Font("SansSerif", 1, 12));
// Initialize lblPartNumber
lblPartNumber = new com.sssw.rt.jform.AgcJLabel();
lblPartNumber.setName("lblPartNumber");
lblPartNumber.setBounds(56,200,189,20);
lblPartNumber.setText("Part Number");
lblPartNumber.setOpaque(false);
lblPartNumber.setTextStyle(0);
lblPartNumber.setForeground(Color.black);
lblPartNumber.setTextShadowColor(Color.darkGray);
lblPartNumber.setTextHighlightColor(Color.gray);
lblPartNumber.setBackground(Color.lightGray);
lblPartNumber.setHorizontalAlignment(SwingConstants.RIGHT);
lblPartNumber.setVerticalAlignment(SwingConstants.CENTER);
lblPartNumber.setHorizontalTextPosition(SwingConstants.RIGHT);
lblPartNumber.setVerticalTextPosition(SwingConstants.CENTER);
lblPartNumber.setWordWrap(false);
lblPartNumber.setFont(new Font("SansSerif", 1, 12));
// Initialize lblQty
lblQty = new com.sssw.rt.jform.AgcJLabel();
lblQty.setName("lblQty");
lblQty.setBounds(57,264,188,20);
lblQty.setText("Package Quantity");
lblQty.setOpaque(false);
lblQty.setTextStyle(0);
lblQty.setForeground(Color.black);
lblQty.setTextShadowColor(Color.darkGray);
lblQty.setTextHighlightColor(Color.gray);
lblQty.setBackground(Color.lightGray);
lblQty.setHorizontalAlignment(SwingConstants.RIGHT);
lblQty.setVerticalAlignment(SwingConstants.CENTER);
lblQty.setHorizontalTextPosition(SwingConstants.RIGHT);
lblQty.setVerticalTextPosition(SwingConstants.CENTER);
lblQty.setWordWrap(false);
lblQty.setFont(new Font("SansSerif", 1, 12));
// Initialize lblDVD
lblDVD = new com.sssw.rt.jform.AgcJLabel();
lblDVD.setName("lblDVD");
lblDVD.setBounds(56,317,189,20);
lblDVD.setText("Allow Updates from DVD");
lblDVD.setOpaque(false);
lblDVD.setTextStyle(0);
lblDVD.setForeground(Color.black);
lblDVD.setTextShadowColor(Color.darkGray);
lblDVD.setTextHighlightColor(Color.gray);
lblDVD.setBackground(Color.lightGray);
lblDVD.setHorizontalAlignment(SwingConstants.RIGHT);
lblDVD.setVerticalAlignment(SwingConstants.CENTER);
lblDVD.setHorizontalTextPosition(SwingConstants.RIGHT);
lblDVD.setVerticalTextPosition(SwingConstants.CENTER);
lblDVD.setWordWrap(false);
lblDVD.setFont(new Font("SansSerif", 1, 12));
// Initialize fldPartNumber
fldPartNumber = new com.sssw.rt.jform.AgcJTextField();
fldPartNumber.setName("fldPartNumber");
fldPartNumber.setBounds(260,200,255,20);
fldPartNumber.setEnabled(false);
fldPartNumber.setFont(new Font("SansSerif", 0, 12));
fldPartNumber.setHorizontalAlignment(2);
fldPartNumber.setMargin(new Insets(1, 1, 1, 1));
fldPartNumber.setEditable(true);
fldPartNumber.setForeground(Color.black);
fldPartNumber.setBackground(Color.white);
fldPartNumber.setMaxLength(AgcJTextField.NO_LIMIT);
fldPartNumber.setMinLength(AgcJTextField.NO_LIMIT);
// Initialize ckDVD
ckDVD = new com.sssw.rt.jform.AgcJCheckBox();
ckDVD.setName("ckDVD");
ckDVD.setBounds(260,317,36,20);
ckDVD.setEnabled(false);
ckDVD.setContentAreaFilled(false);
ckDVD.setBorderPainted(false);
ckDVD.setText(" ");
ckDVD.setCheckedValue("Y");
ckDVD.setUncheckedValue("N");
ckDVD.setFont(new Font("SansSerif", 0, 12));
ckDVD.setForeground(Color.black);
ckDVD.setBackground(AgoColorManager.getColor(194, 191, 165));
// Initialize lblDescr
lblDescr = new com.sssw.rt.jform.AgcJLabel();
lblDescr.setName("lblDescr");
lblDescr.setBounds(260,229,255,20);
lblDescr.setText("Description ");
lblDescr.setOpaque(false);
lblDescr.setTextStyle(0);
lblDescr.setForeground(Color.black);
lblDescr.setTextShadowColor(Color.darkGray);
lblDescr.setTextHighlightColor(Color.gray);
lblDescr.setBackground(Color.lightGray);
lblDescr.setHorizontalAlignment(SwingConstants.LEFT);
lblDescr.setVerticalAlignment(SwingConstants.CENTER);
lblDescr.setHorizontalTextPosition(SwingConstants.RIGHT);
lblDescr.setVerticalTextPosition(SwingConstants.CENTER);
lblDescr.setWordWrap(false);
lblDescr.setFont(new Font("SansSerif", 1, 12));
// Initialize fldLine_Abbr
fldLine_Abbr = new com.sssw.rt.jform.AgcJTextField();
fldLine_Abbr.setName("fldLine_Abbr");
fldLine_Abbr.setBounds(260,156,46,20);
fldLine_Abbr.setEnabled(false);
fldLine_Abbr.setFont(new Font("SansSerif", 0, 12));
fldLine_Abbr.setHorizontalAlignment(2);
fldLine_Abbr.setMargin(new Insets(1, 1, 1, 1));
fldLine_Abbr.setEditable(true);
fldLine_Abbr.setForeground(Color.black);
fldLine_Abbr.setBackground(Color.white);
fldLine_Abbr.setMaxLength(AgcJTextField.NO_LIMIT);
fldLine_Abbr.setMinLength(AgcJTextField.NO_LIMIT);
// Initialize fldQty
fldQty = new com.sssw.rt.jform.AgcJTextField();
fldQty.setName("fldQty");
fldQty.setBounds(260,264,70,20);
fldQty.setEnabled(false);
fldQty.setFont(new Font("SansSerif", 0, 12));
fldQty.setHorizontalAlignment(2);
fldQty.setMargin(new Insets(1, 1, 1, 1));
fldQty.setEditable(true);
fldQty.setForeground(Color.black);
fldQty.setBackground(Color.white);
fldQty.setMaxLength(AgcJTextField.NO_LIMIT);
fldQty.setMinLength(AgcJTextField.NO_LIMIT);
// Initialize lblBinLabel
lblBinLabel = new com.sssw.rt.jform.AgcJLabel();
lblBinLabel.setName("lblBinLabel");
lblBinLabel.setBounds(58,425,187,20);
lblBinLabel.setText("Use for Bin Label");
lblBinLabel.setOpaque(false);
lblBinLabel.setTextStyle(0);
lblBinLabel.setForeground(Color.black);
lblBinLabel.setTextShadowColor(Color.darkGray);
lblBinLabel.setTextHighlightColor(Color.gray);
lblBinLabel.setBackground(Color.lightGray);
lblBinLabel.setHorizontalAlignment(SwingConstants.RIGHT);
lblBinLabel.setVerticalAlignment(SwingConstants.CENTER);
lblBinLabel.setHorizontalTextPosition(SwingConstants.RIGHT);
lblBinLabel.setVerticalTextPosition(SwingConstants.CENTER);
lblBinLabel.setWordWrap(false);
lblBinLabel.setFont(new Font("SansSerif", 1, 12));
// Initialize ckUseBinLabel
ckUseBinLabel = new com.sssw.rt.jform.AgcJCheckBox();
ckUseBinLabel.setName("ckUseBinLabel");
ckUseBinLabel.setBounds(260,425,36,20);
ckUseBinLabel.setEnabled(false);
ckUseBinLabel.setContentAreaFilled(false);
ckUseBinLabel.setBorderPainted(false);
ckUseBinLabel.setText(" ");
ckUseBinLabel.setCheckedValue("Y");
ckUseBinLabel.setUncheckedValue("N");
ckUseBinLabel.setFont(new Font("SansSerif", 0, 12));
ckUseBinLabel.setForeground(Color.black);
ckUseBinLabel.setBackground(AgoColorManager.getColor(194, 191, 165));
// Initialize lblPlanogram
lblPlanogram = new com.sssw.rt.jform.AgcJLabel();
lblPlanogram.setName("lblPlanogram");
lblPlanogram.setBounds(57,371,188,20);
lblPlanogram.setText("Use for Planogram");
lblPlanogram.setOpaque(false);
lblPlanogram.setTextStyle(0);
lblPlanogram.setForeground(Color.black);
lblPlanogram.setTextShadowColor(Color.darkGray);
lblPlanogram.setTextHighlightColor(Color.gray);
lblPlanogram.setBackground(Color.lightGray);
lblPlanogram.setHorizontalAlignment(SwingConstants.RIGHT);
lblPlanogram.setVerticalAlignment(SwingConstants.CENTER);
lblPlanogram.setHorizontalTextPosition(SwingConstants.RIGHT);
lblPlanogram.setVerticalTextPosition(SwingConstants.CENTER);
lblPlanogram.setWordWrap(false);
lblPlanogram.setFont(new Font("SansSerif", 1, 12));
// Initialize ckUsePlanogram
ckUsePlanogram = new com.sssw.rt.jform.AgcJCheckBox();
ckUsePlanogram.setName("ckUsePlanogram");
ckUsePlanogram.setBounds(260,371,36,20);
ckUsePlanogram.setEnabled(false);
ckUsePlanogram.setContentAreaFilled(false);
ckUsePlanogram.setBorderPainted(false);
ckUsePlanogram.setText(" ");
ckUsePlanogram.setCheckedValue("Y");
ckUsePlanogram.setUncheckedValue("N");
ckUsePlanogram.setFont(new Font("SansSerif", 0, 12));
ckUsePlanogram.setForeground(Color.black);
ckUsePlanogram.setBackground(AgoColorManager.getColor(194, 191, 165));
// Initialize agcBarCodeUse
agcBarCodeUse = new com.sssw.rt.form.AgcData();
agcBarCodeUse.setName("agcBarCodeUse");
agcBarCodeUse.setBounds(1045,95,71,58);
agcBarCodeUse.setExpressionCount(6);
agcBarCodeUse.setExpression(0, 0, "BARCODE_ID", 0);
agcBarCodeUse.setExpression(1, 1, "LOC", 1);
agcBarCodeUse.setExpression(2, 2, "USE_FOR_BIN_LABEL", 2);
agcBarCodeUse.setExpression(3, 3, "USE_FOR_PLANOGRAM", 3);
agcBarCodeUse.setExpression(4, 4, "LAST_MODIFIED_DATE", 4);
agcBarCodeUse.setExpression(5, 5, "MODIFIED_BY_EMPLOYEE_ID", 5);
// Initialize lbl14DigitCode
lbl14DigitCode = new com.sssw.rt.jform.AgcJLabel();
lbl14DigitCode.setName("lbl14DigitCode");
lbl14DigitCode.setBounds(548,440,242,20);
lbl14DigitCode.setText("SCC-14 Code");
lbl14DigitCode.setOpaque(false);
lbl14DigitCode.setTextStyle(0);
lbl14DigitCode.setForeground(AgoColorManager.getColor(79, 79, 79));
lbl14DigitCode.setTextShadowColor(Color.darkGray);
lbl14DigitCode.setTextHighlightColor(Color.gray);
lbl14DigitCode.setBackground(Color.lightGray);
lbl14DigitCode.setHorizontalAlignment(SwingConstants.RIGHT);
lbl14DigitCode.setVerticalAlignment(SwingConstants.CENTER);
lbl14DigitCode.setHorizontalTextPosition(SwingConstants.RIGHT);
lbl14DigitCode.setVerticalTextPosition(SwingConstants.CENTER);
lbl14DigitCode.setWordWrap(false);
lbl14DigitCode.setFont(new Font("SansSerif", 3, 15));
// Initialize lbl12DigitCode
lbl12DigitCode = new com.sssw.rt.jform.AgcJLabel();
lbl12DigitCode.setName("lbl12DigitCode");
lbl12DigitCode.setBounds(549,175,239,20);
lbl12DigitCode.setText("12-digit UPC Code");
lbl12DigitCode.setOpaque(false);
lbl12DigitCode.setTextStyle(0);
lbl12DigitCode.setForeground(AgoColorManager.getColor(79, 79, 79));
lbl12DigitCode.setTextShadowColor(Color.darkGray);
lbl12DigitCode.setTextHighlightColor(Color.gray);
lbl12DigitCode.setBackground(Color.lightGray);
lbl12DigitCode.setHorizontalAlignment(SwingConstants.RIGHT);
lbl12DigitCode.setVerticalAlignment(SwingConstants.CENTER);
lbl12DigitCode.setHorizontalTextPosition(SwingConstants.RIGHT);
lbl12DigitCode.setVerticalTextPosition(SwingConstants.CENTER);
lbl12DigitCode.setWordWrap(false);
lbl12DigitCode.setFont(new Font("SansSerif", 3, 15));
// Initialize dsoData
dsoData = new com.sssw.rt.form.AgcData();
dsoData.setName("dsoData");
dsoData.setBounds(1055,175,47,58);
dsoData.setDataSource("com.gpc.tams.dso.dsoGeneric");
// Initialize agcBarCode
agcBarCode = new com.sssw.rt.form.AgcData();
agcBarCode.setName("agcBarCode");
agcBarCode.setBounds(1040,15,69,58);
agcBarCode.setExpressionCount(9);
agcBarCode.setExpression(0, 6, "ID", 0);
agcBarCode.setExpression(1, 7, "BARCODE", 1);
agcBarCode.setExpression(2, 8, "LINE_ABBREV", 2);
agcBarCode.setExpression(3, 9, "PART_NUMBER", 3);
agcBarCode.setExpression(4, 10, "PKG_QTY", 4);
agcBarCode.setExpression(5, 11, "ALLOW_DVD_UPDATE", 5);
agcBarCode.setExpression(6, 12, "LAST_MODIFIED_DATE", 6);
agcBarCode.setExpression(7, 13, "MODIFIED_BY_EMPLOYEE_ID", 7);
agcBarCode.setExpression(8, 14, "MODIFIED_BY_EMPLOYEE_LOC", 8);
// Initialize btnSearch
btnSearch = new com.sssw.rt.jform.AgcJButton();
btnSearch.setName("btnSearch");
btnSearch.setBounds(295,40,80,25);
btnSearch.setContentAreaFilled(true);
btnSearch.setBorderPainted(true);
btnSearch.setMargin(new Insets(1, 1, 1, 1));
btnSearch.setHorizontalAlignment(SwingConstants.CENTER);
btnSearch.setVerticalAlignment(SwingConstants.CENTER);
btnSearch.setHorizontalTextPosition(SwingConstants.RIGHT);
btnSearch.setVerticalTextPosition(SwingConstants.CENTER);
btnSearch.setText("Search");
btnSearch.setFont(new Font("SansSerif", 1, 12));
btnSearch.setForeground(Color.black);
btnSearch.setBackground(Color.lightGray);
// Initialize lblTitle
lblTitle = new com.sssw.rt.jform.AgcJLabel();
lblTitle.setName("lblTitle");
lblTitle.setBounds(277,5,700,27);
lblTitle.setText("Bar Code Maintenance");
lblTitle.setOpaque(false);
lblTitle.setTextStyle(0);
lblTitle.setForeground(AgoColorManager.getColor(18, 45, 173));
lblTitle.setTextShadowColor(Color.darkGray);
lblTitle.setTextHighlightColor(Color.gray);
lblTitle.setBackground(Color.lightGray);
lblTitle.setHorizontalAlignment(SwingConstants.RIGHT);
lblTitle.setVerticalAlignment(SwingConstants.CENTER);
lblTitle.setHorizontalTextPosition(SwingConstants.RIGHT);
lblTitle.setVerticalTextPosition(SwingConstants.CENTER);
lblTitle.setWordWrap(false);
lblTitle.setFont(new Font("SansSerif", 3, 24));
// Initialize lblModify
lblModify = new com.sssw.rt.jform.AgcJLabel();
lblModify.setName("lblModify");
lblModify.setBounds(15,625,409,20);
lblModify.setText("Modified by");
lblModify.setOpaque(false);
lblModify.setTextStyle(0);
lblModify.setForeground(Color.black);
lblModify.setTextShadowColor(Color.darkGray);
lblModify.setTextHighlightColor(Color.gray);
lblModify.setBackground(Color.lightGray);
lblModify.setHorizontalAlignment(SwingConstants.LEFT);
lblModify.setVerticalAlignment(SwingConstants.CENTER);
lblModify.setHorizontalTextPosition(SwingConstants.RIGHT);
lblModify.setVerticalTextPosition(SwingConstants.CENTER);
lblModify.setWordWrap(false);
lblModify.setFont(new Font("SansSerif", 1, 12));
// Initialize barcode_detail12_10_gif
barcode_detail12_10_gif = new com.sssw.rt.jform.AgcJLabel();
barcode_detail12_10_gif.setName("barcode_detail12_10_gif");
barcode_detail12_10_gif.setBounds(805,175,158,118);
barcode_detail12_10_gif.setText("barcode_detail12_10_gif");
barcode_detail12_10_gif.setIcon(new ImageIcon(getImage("barcode_detail12-10.gif")));
barcode_detail12_10_gif.setOpaque(false);
barcode_detail12_10_gif.setTextStyle(0);
barcode_detail12_10_gif.setForeground(Color.black);
barcode_detail12_10_gif.setTextShadowColor(Color.darkGray);
barcode_detail12_10_gif.setTextHighlightColor(Color.gray);
barcode_detail12_10_gif.setBackground(Color.lightGray);
barcode_detail12_10_gif.setHorizontalAlignment(SwingConstants.LEFT);
barcode_detail12_10_gif.setVerticalAlignment(SwingConstants.CENTER);
barcode_detail12_10_gif.setHorizontalTextPosition(SwingConstants.RIGHT);
barcode_detail12_10_gif.setVerticalTextPosition(SwingConstants.CENTER);
barcode_detail12_10_gif.setWordWrap(false);
barcode_detail12_10_gif.setFont(new Font("SansSerif", 0, 12));
// Initialize barcode_detail14_12_gif
barcode_detail14_12_gif = new com.sssw.rt.jform.AgcJLabel();
barcode_detail14_12_gif.setName("barcode_detail14_12_gif");
barcode_detail14_12_gif.setBounds(805,440,163,120);
barcode_detail14_12_gif.setText("barcode_detail14_12_gif");
barcode_detail14_12_gif.setIcon(new ImageIcon(getImage("barcode_detail14-12.gif")));
barcode_detail14_12_gif.setOpaque(false);
barcode_detail14_12_gif.setTextStyle(0);
barcode_detail14_12_gif.setForeground(Color.black);
barcode_detail14_12_gif.setTextShadowColor(Color.darkGray);
barcode_detail14_12_gif.setTextHighlightColor(Color.gray);
barcode_detail14_12_gif.setBackground(Color.lightGray);
barcode_detail14_12_gif.setHorizontalAlignment(SwingConstants.LEFT);
barcode_detail14_12_gif.setVerticalAlignment(SwingConstants.CENTER);
barcode_detail14_12_gif.setHorizontalTextPosition(SwingConstants.RIGHT);
barcode_detail14_12_gif.setVerticalTextPosition(SwingConstants.CENTER);
barcode_detail14_12_gif.setWordWrap(false);
barcode_detail14_12_gif.setFont(new Font("SansSerif", 0, 12));
// Initialize rctPartInformation
rctPartInformation = new com.sssw.rt.form.AgcRectangle();
rctPartInformation.setName("rctPartInformation");
rctPartInformation.setBounds(14,85,512,520);
rctPartInformation.setColor(AgoColorManager.getColor(178, 178, 178));
rctPartInformation.setBorderStyle(4);
rctPartInformation.setText("Part Information");
rctPartInformation.setFont(new Font("SansSerif", 1, 12));
rctPartInformation.setForeground(Color.black);
rctPartInformation.setTransparent(true);
// Initialize rctBarCodeFormat
rctBarCodeFormat = new com.sssw.rt.form.AgcRectangle();
rctBarCodeFormat.setName("rctBarCodeFormat");
rctBarCodeFormat.setBounds(539,85,456,520);
rctBarCodeFormat.setColor(AgoColorManager.getColor(178, 178, 178));
rctBarCodeFormat.setBorderStyle(4);
rctBarCodeFormat.setText("Bar Code Format");
rctBarCodeFormat.setFont(new Font("SansSerif", 1, 12));
rctBarCodeFormat.setForeground(Color.black);
rctBarCodeFormat.setTransparent(true);
addControls();
addBindings();
// Setup tab order
Component[] tabOrder = {
fldBarcode,
btnSearch,
fldLine_Abbr,
fldPartNumber,
fldQty,
ckDVD,
ckUsePlanogram,
ckUseBinLabel,
};
setUserDefinedTabOrder(tabOrder);
return;
}
protected void addAllFormControls()
{
//==== Warning: SilverStream-generated method: do not edit. All changes will be lost ===
this.add(Label2);
this.add(Label1);
this.add(lblBarCodeInfo);
this.add(fldBarcode);
this.add(lblBarcode);
this.add(lblLine);
this.add(lblPartNumber);
this.add(lblQty);
this.add(lblDVD);
this.add(fldPartNumber);
this.add(ckDVD);
this.add(lblDescr);
this.add(fldLine_Abbr);
this.add(fldQty);
this.add(lblBinLabel);
this.add(ckUseBinLabel);
this.add(lblPlanogram);
this.add(ckUsePlanogram);
this.add(agcBarCodeUse);
this.add(lbl14DigitCode);
this.add(lbl12DigitCode);
this.add(dsoData);
this.add(agcBarCode);
this.add(btnSearch);
btnSearch.addActionListener(this);
this.add(lblTitle);
this.add(lblModify);
this.add(barcode_detail12_10_gif);
this.add(barcode_detail14_12_gif);
this.add(rctPartInformation);
this.add(rctBarCodeFormat);
}
protected void addBindings()
{
//==== Warning: SilverStream-generated method: do not edit. All changes will be lost ===
agDataMgr.bind(ckDVD, "Value", "getValue", "setValue", agcBarCode, "ALLOW_DVD_UPDATE");
agDataMgr.bind(fldQty, "Text", "getText", "setText", agcBarCode, "PKG_QTY");
addExpDependencies();
}
public void fCheckAccess() {
}
protected void addBind() {
agDataMgr.bind(ckUsePlanogram, "Value", "getValue", "setValue", agcBarCodeUse, "USE_FOR_PLANOGRAM");
agDataMgr.bind(ckUseBinLabel, "Value", "getValue", "setValue", agcBarCodeUse, "USE_FOR_BIN_LABEL");
usePlanogram = (String) ckUsePlanogram.getValue();
useBinLabel = (String) ckUseBinLabel.getValue();
}
public void fCheckLogin() {
}
/**
* Creates a title for this form.
* @return String - title value
**/
public String fCreateTitle() {
return null;
}
public String fGetFormName() {
return TsoConstant.FRM_IM_BARCODE;
}
/**
* Re-Localizes this form . Method is called
* When the language gets changed on the toolbar.
**/
public void fLocalize() {
logger.debug("fLocalize");
FwoSessionMgr.getInstance().getLocalizationMgr().localize(this);
invalidate();
validate();
}
public void fRetrieve(java.util.Hashtable hashtable1) {
logger.debug("fRetrieve()");
}
public void fStylize() {
}
public boolean fStopLogout() {
return false;
}
public void fSetToolBar(java.awt.Component component1) {
}
/**
* Method returns com.gpc.backofficecommon.FwoSessionMgr.
**/
public com.gpc.client.backoffice.FwoFormMaster fGetFormMaster() {
return FM;
}
/**
* Deletes a row in the database .
* Refreshes the navigation data on the form master, and goes to the next record.
* @return boolean Return true if delete passes, false if delete fails
**/
public boolean fDelete() {
logger.debug("fDelete()");
if(!fldLine_Abbr.isEnabled()){
ClientApplicationContext.getClientApplicationContext().getMessageMgr().showMessage(this, "487");
fldLine_Abbr.requestFocus();
return false;
}
try{
Integer barCodeID = (Integer) agcBarCode.getProperty(Sch_Barcode.ID);
//Calling the FwoFormMaster's setTransactionColumns() method to set the Last Modified By field to be updated in the Employee table
// to create a file_activity_transaction record
if(agcBarCodeUse.gotoFirst()){
FM.setTransactionColumns(agcBarCodeUse);
agcBarCodeUse.updateRows();
do {
agcBarCodeUse.delete();
} while (agcBarCodeUse.gotoFirst());
agcBarCodeUse.updateRows();
}
//if all BARCODE_USE recs have been deleted, delete BARCODE
agcBarCodeUse.query("BARCODE_USE.BARCODE_ID = " + barCodeID);
if (!agcBarCodeUse.gotoFirst()) {
agcBarCode.query("BARCODE.ID = " + barCodeID);
if (agcBarCode.gotoFirst()) {
agcBarCode.delete();
agcBarCode.updateRows();
}
}
if (FM.fNext() || FM.fPrevious()) {
// Refresh and re-synch the nav data since we deleted a row
m_NavData.refreshRows();
navigateToBarCode((String)agcBarCode.getProperty(Sch_Barcode.BARCODE));
loadBarCodeUse((Integer) agcBarCode.getProperty(Sch_Barcode.ID));
}
return true;
}catch (AgoDataConcurrencyException e){
logger.debug(e.toString(), e);
ClientApplicationContext.getClientApplicationContext().getMessageMgr().showUpdateErrors(this, e, null);
return false;
}catch (AgoApiException e){
logger.error(e.toString() , e);
ClientApplicationContext.getClientApplicationContext().getMessageMgr().showUpdateErrors(this, e, null);
return false;
}
}
/**
* Not in use in this form.
**/
public boolean fEdit() {
return false;
}
public boolean fFindExec() {
return false;
}
/**
* Puts the form in Find Mode.
* @return boolean - true = find mode succeeded; false = find mode failed
**/
public boolean fFindMode() {
return false;
}
/**
* Navigates the primary data to the first row
* @return boolean Return true if retrieveBarCode passes, false if retrievBarCode fails
**/
public boolean fFirst() {
//navigate the first row cursor.
return retrieveBarCode((String)m_NavData.getProperty(Sch_Tables.BARCODE + "." + Sch_Barcode.BARCODE), false);
}
/**
* Navigates the primary data to the last row
* @return boolean Return true if retrieveBarCode passes, false if retrievBarCode fails
**/
public boolean fLast() {
//navigate the last row cursor.
return retrieveBarCode((String)m_NavData.getProperty(Sch_Tables.BARCODE + "." + Sch_Barcode.BARCODE), false);
}
/**
* Inserts a new record into the database, sets the default values.
* @return boolean Return true if insert passes, false if insert fails.
**/
public boolean fNew() {
logger.debug("fNew()");
agcBarCode.insertAfter();
ckDVD.setValue("Y");
ckUseBinLabel.setValue("N");
ckUsePlanogram.setValue("N");
fldQty.setText("1");
m_addingNew = true;
return true;
}
/**
* Clear-out all fields
**/
private void clearAll() {
logger.debug("clearAll()");
fldBarcode.setText("");
fldLine_Abbr.setText("");
fldPartNumber.setText("");
fldQty.setText("1");
ckDVD.setSelected(true);
ckDVD.setValue("Y");
ckUsePlanogram.setSelected(false);
ckUsePlanogram.setValue("N");
ckUseBinLabel.setSelected(false);
ckUseBinLabel.setValue("N");
lblDescr.setText("");
lblModify.setText("");
fldLine_Abbr.setText("");
fldPartNumber.setText("");
}
/**
* Get next ID for barcode table
**/
private Integer getNextId(){
Integer id = (Integer)TamsMisc.getNextTableID(Sch_Tables.BARCODE, FM.m_loc, agGeneral);
return id;
}
/**
* Navigates the primary data to the next row
* @return boolean Return true if retrieveBarCode passes, false if retrievBarCode fails
**/
public boolean fNext() {
logger.debug("fNext()");
//navigate the next row cursor.
return retrieveBarCode((String)m_NavData.getProperty(Sch_Tables.BARCODE+"."+Sch_Barcode.BARCODE),false);
}
/**
* Navigates the primary data to the previous row
* @return boolean Return true if retrieveBarCode passes, false if retrieveBarCode fails
**/
public boolean fPrevious() {
logger.debug("fPrevious()");
//navigate the previous row cursor.
return retrieveBarCode((String)m_NavData.getProperty(Sch_Tables.BARCODE+"."+Sch_Barcode.BARCODE),false);
}
//Bug 24084 fixed the Bar Code text to strip out control characters @
private String getBarcodeText() {
String barcode=fldBarcode.getText();
logger.debug(">>>>getBarcodeText() initial barcode = ("+barcode+")");
//Bug #24838, Altered below 'if' condition to check for null and length of barcode to avoid StringIndexOutOfBoundsException.
if (barcode != null && barcode.length() > 2 && barcode.charAt(0) == ('@')) {
barcode = barcode.substring(2);
}
logger.debug(">>>>getBarcodeText() corrected barcode = ("+barcode.trim()+")");
return barcode.trim();
}
/**
* Saves any changes made to the data and refreshes the navigation data.
* Also updates the "modified by" database and display values.
* @return boolean Return true if update passes, false if update fails
**/
public boolean fSave() {
logger.debug("fSave()");
try {
// Update the last modified date and employee for the current barcode record
String barcode = getBarcodeText();
//STEL-243 Changes for Numeric Barcode 1
int len = barcode.length();
for (int i = 0; i < len; i++) {
// Check if character is not a digit between 0-9
if (barcode.charAt(i) < '0' || barcode.charAt(i) > '9') {
ClientApplicationContext.getClientApplicationContext().getMessageMgr().showMessage(this, "13002");
FM.setComponentFocus(fldBarcode);
fldBarcode.selectAll();
return false;
}
}
//Bug #25520, Added the following 'if' statement to check if bar code length is 12, 13, or 14 and display the warning message accordingly.
if(barcode.length() > 11 && barcode.length() < 15) {
if (FM.getMode()==FwoFormMaster.NEW_MODE) {
logger.debug("fSave setting NEW barcode: " + barcode);
/*if (barcode.charAt(0) == ('@') && barcode.length() > 2) {
barcode = barcode.substring(2);
} */
agcBarCode.setProperty(Sch_Barcode.BARCODE, barcode);
}
// Search for the part in INVENTORY.
// Changes for STEL - 2756
String enteredPartNumber = fldPartNumber.getText().trim();
if (!enteredPartNumber.equals("") && !findInventory()){
ClientApplicationContext.getClientApplicationContext().getMessageMgr().showMessage(this, "607");
return false;
}
else {
agcBarCode.setProperty("PART_NUMBER", enteredPartNumber);
}
if(m_NeedsUpdate || agcBarCode.haveRowsChanged()){
FM.setTransactionColumns(agcBarCode);
TsoCurrentUser m_user = ClientApplicationContext.getClientApplicationContext().getCurrentUser();
Integer loc = (Integer) m_user.getEmployeeLoc();
agcBarCode.setProperty(Sch_Barcode.MODIFIED_BY_EMPLOYEE_LOC, loc);
agcBarCode.updateRows();
}
if ( FM.getMode()==FwoFormMaster.NEW_MODE || !agcBarCodeUse.gotoFirst() ) {
String label = (String) ckUseBinLabel.getValue();
String planogram = (String) ckUsePlanogram.getValue();
agcBarCodeUse.insertAfter();
Integer id = (Integer) agcBarCode.getProperty(Sch_Barcode.ID);
agcBarCodeUse.setProperty(Sch_BarcodeUse.BARCODE_ID, id);
agcBarCodeUse.setProperty(Sch_BarcodeUse.LOC, FM.m_loc);
agcBarCodeUse.setProperty(Sch_BarcodeUse.USE_FOR_BIN_LABEL,label);
agcBarCodeUse.setProperty(Sch_BarcodeUse.USE_FOR_PLANOGRAM,planogram);
FM.setTransactionColumns(agcBarCodeUse);
agcBarCodeUse.updateRows();
} else {
agcBarCodeUse.setProperty(Sch_BarcodeUse.USE_FOR_BIN_LABEL,ckUseBinLabel.getValue());
agcBarCodeUse.setProperty(Sch_BarcodeUse.USE_FOR_PLANOGRAM,ckUsePlanogram.getValue());
FM.setTransactionColumns(agcBarCodeUse);
agcBarCodeUse.updateRows();
}
usePlanogram = (String) ckUsePlanogram.getValue();
useBinLabel = (String) ckUseBinLabel.getValue();
// Refresh and re-synch the nav data to include new record
if (FM.getMode()==FwoFormMaster.NEW_MODE) {
m_NavData.refreshRows();
String dbBarcode = (String)agcBarCode.getProperty(Sch_Barcode.BARCODE);
navigateToBarCode(dbBarcode);
loadBarCode(dbBarcode);
loadBarCodeUse((Integer) agcBarCode.getProperty(Sch_Barcode.ID));
}
setModifyLabel();
m_addingNew = false;
return true;
} else {
ClientApplicationContext.getClientApplicationContext().getMessageMgr().showMessage(this,"1227");
FM.setComponentFocus(fldBarcode);
fldBarcode.selectAll();
return false;
}
}catch (AgoDataConcurrencyException e){
logger.debug(e.toString(), e);
if(m_SessionMgr == null)
m_SessionMgr = FwoSessionMgr.getInstance();
ClientApplicationContext.getClientApplicationContext().getMessageMgr().showUpdateErrors(this, e, null);
return false;
}catch (AgoApiException e){
logger.error(e.toString() , e);
if(m_SessionMgr == null)
m_SessionMgr = FwoSessionMgr.getInstance();
ClientApplicationContext.getClientApplicationContext().getMessageMgr().showUpdateErrors(this, e, null);
return false;
}
}
/**
* Validates data.
* @return boolean - true = all data is valid; false = some data is not valid
**/
public boolean fValidate() {
logger.debug("fValidate()");
int qty = Integer.parseInt(fldQty.getText());
if(FM.getMode()==FwoFormMaster.NEW_MODE){
String barcode = getBarcodeText();
if(getDuplCode(barcode)){
return false;
}
}
return true;
}
/**
* Refreshes the current row of data to clear out any changes, and re-loads the current form.
**/
public void fCancel(){
logger.debug("fCancel()");
m_addingNew = false;
try {
//Refresh the data only if we've navigated data before
if (m_NavData.getProperty(Sch_Tables.BARCODE+"."+Sch_Barcode.BARCODE)==null){
agcBarCode.clearRows();
clearAll();
enableFields(false);
}
else {
agcBarCode.refreshRows();
retrieveBarCode((String)m_NavData.getProperty(Sch_Tables.BARCODE+"."+Sch_Barcode.BARCODE),false);
}
}catch (AgoSecurityException e) {
logger.error("AgoSecurityException: " + e);
}catch (AgoUnrecoverableSystemException e) {
logger.error("AgoUnrecoverableSystemException: " + e);
}catch (AgoTransientSystemException e) {
logger.error("AgoTransientSystemException: " + e);
}
}
/**
* Sets the required fields, sets the initial mode to FIND,
* initializes all fields.
**/
protected void formActivate() {
logger.debug("formActivate()");
//Set the initial mode
FM.setMode(FwoFormMaster.FIND_MODE);
// initialize specific advanced search object if not done yet.
// Set all the end bar code text fields to have key listeners.
if (advancedSearchObject == null) {
advancedSearchObject = new TsoSearchBarcode(this);
int iLocations[] = new int[0];
advancedSearchObject.setLocations(iLocations);
// THE FIND EXACT MATCH MUST BE TRIGGERED A KEY STROKE INSTEAD OF THE ENTER KEY
//advancedSearchObject.addSearchListener(fld4);
//advancedSearchObject.addSearchListener(fld8);
// THE SEARCH BUTTON MUST ALWAYS BRING UP THE ADVANCED SEARCH
//advancedSearchObject.addSearchListener(pbSearch);
}
// set the required field Hashtable
Hashtable htReqFields = new Hashtable();
htReqFields.put(lblLine, fldLine_Abbr);
htReqFields.put(lblPartNumber, fldPartNumber);
htReqFields.put(lblQty, fldQty);
FM.setRequiredFields(htReqFields);
Vector vecExceptions = new Vector();
FM.setEnabledViewModeComps(vecExceptions);
m_NavMgr = FM.m_SessionMgr.getNavigationMgr();
enableFields(false);
}
/**
* Sets the "modified by" labels to the current "modified by" column values.
* If formats the "modified by" date using m_DP (instance of FwoDatePattern), and it uses the
* TamsCacheMgr to get the first and last name of the "modified by" employee.
**/
private void setModifyLabel() {
logger.debug("setModifyLabel()");
// Set modified by date and employee labels
Integer iModifiedById = (Integer) agcBarCode.getProperty(Sch_Barcode.MODIFIED_BY_EMPLOYEE_ID);
String sDate = "";
try {
sDate = m_DP.formatDateSpecial(agcBarCode.getProperty(Sch_Barcode.LAST_MODIFIED_DATE), FM.getLocale(), FwoDatePattern.DATE_TIME);
}catch(DatePatternFormatException e) {
logger.error(e.getMessage(), e);
logger.error("DatePatternFormatException in setModifyLabel(): " + e);
}
String sModifiedBy = ((com.gpc.backofficecommon.app.TamsCacheMgr) FM.m_SessionMgr.getCacheMgr()).getEmployeeData(iModifiedById,FM.m_loc);
lblModify.setText(sDate + " " + sModifiedBy);
}
private void clearInfoFields() {
logger.debug("clearInfoFields()");
this.fldLine_Abbr.setText("");
this.fldPartNumber.setText("");
this.lblDescr.setText("");
this.fldQty.setText("1");
this.ckDVD.setSelected(true);
ckDVD.setValue("Y");
this.ckUseBinLabel.setSelected(false);
ckUseBinLabel.setValue("N");
this.ckUsePlanogram.setSelected(false);
ckUsePlanogram.setValue("N");
}
private void barcodeEntered() {
String barcode = getBarcodeText();
//Bug #25520, Added the following 'if' block to check if bar code length is 12, 13, or 14 and display the warning message accordingly.
if (barcode != null && (barcode.length() < 12 || barcode.length() > 14)) {
ClientApplicationContext.getClientApplicationContext().getMessageMgr().showMessage(this,"1227");
FM.setComponentFocus(fldBarcode);
fldBarcode.selectAll();
return;
}
if (FM.getMode() == FwoFormMaster.NEW_MODE) {
if(getDuplCode(barcode)) {
clearInfoFields();
enableFields(false);
//bug 24084 barcode field is filled with an empty string to prevent appending bar code number to the
//previous bar code
fldBarcode.setText("");
fldBarcode.requestFocus();
return;
} else {
clearInfoFields();
enableFields(true);
fldLine_Abbr.requestFocus();
return;
}
} else {
advancedSearchObject.findExactMatch(false);
return;
}
}
/** This method sets Max length of JTextFields and event listeners
**/
private void initializeFields(){
logger.debug("initializeFields()");
try {
fldBarcode.putClientProperty(FocusDecider.NAME, DefaultFocusDecider.getInstance());
((JTextField)fldBarcode).addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(KeyEvent evt) {
//Bug No. 31300 commented the below if condition and modified the if condition to validate bar code on the press of enter key.
//if(evt.getKeyCode() == KeyEvent.VK_ENTER || evt.getKeyCode() == KeyEvent.VK_TAB) {
if(evt.getKeyCode() == KeyEvent.VK_ENTER) {
validateBarcode();
}
}
});
FM.addValidatedTextComponent(this.fldBarcode, FwiConstant.ANY, 16, false, true);
FM.addValidatedWholeNumberComponent(fldQty, new Short("0"),FwiConstant.SHORT_MAX_VALUE, false); // Quantity
TsoValidatedIMPartNumberDocument partNumDoc = new TsoValidatedIMPartNumberDocument(fldPartNumber, 22);
FwoBaseInputVerifier verifier = new FwoBaseInputVerifier(this);
verifier.setAdditionalValidationOnClient(true);
FM.addValidatedComponent(fldPartNumber, partNumDoc, verifier, true);
FwoValidatedTextDocument capsDoc = new FwoValidatedTextDocument(fldLine_Abbr,3,FwiConstant.ANY,null,true,false);
FM.addValidatedComponent(fldLine_Abbr, capsDoc, verifier, true);
}catch(FwoUnsupportedObjectException e){
logger.error("FwoUnsupportedObjectException in initializeFields() " + e);
logger.error(e.getMessage(), e);
}
lblModify.setText("");
}
/**
* Initializes the TamsFormMaster object, including its toolbar and navigation data
**/
protected void formLoaded() {
logger.debug("formLoaded()");
thisForm = this;
Hashtable permissions = new Hashtable();
permissions.put(FwoToolBarDirector.NEW_OK, new Boolean(true));
permissions.put(FwoToolBarDirector.NAV_OK, new Boolean(true));
permissions.put(FwoToolBarDirector.DELETE_OK, new Boolean(true));
permissions.put(FwoToolBarDirector.SAVE_OK, new Boolean(true));
permissions.put(FwoToolBarDirector.EDIT_OK, new Boolean(true));
FwoToolBarDirector toolBarDirector = new FwoToolBarDirector(permissions);
// create a navigation data object
String[] selectColumns = {
Sch_Tables.BARCODE + "." + Sch_Barcode.BARCODE
};
String[] tableNames = {Sch_Tables.BARCODE};
String[] bufferColumns = {Sch_Tables.BARCODE+"."+Sch_Barcode.BARCODE};
// Build Band Descriptor for Navigation Data
TsoGenericBandDescriptor descriptor = new TsoGenericBandDescriptor(Sch_Tables.BARCODE, Sch_Tables.BARCODE);
descriptor.addColumn(Sch_Barcode.BARCODE, DatatypeCodes.TYPE_STRING, true);
// use a constructor with a bandDescriptor:
m_NavData = new FwoBufferedData(this, selectColumns, tableNames, null, bufferColumns, 100, descriptor);
//Create default form master
FM = new TamsFormMaster(this, (FwiFormProcess) this.getParentForm(), m_NavData, toolBarDirector);
initializeFields();
Vector comps = new Vector();
comps.add(fldBarcode);
comps.add(btnSearch);
FM.setEnabledViewModeComps(comps);
comps = new Vector();
comps.add(fldLine_Abbr);
comps.add(fldPartNumber);
comps.add(fldQty);
comps.add(ckDVD);
comps.add(ckUsePlanogram);
comps.add(ckUseBinLabel);
FM.setFormEnabledDisabledComps(comps);
btnSearch.setDefaultCapable(false);
btnSearch.setRequestFocusEnabled(false);
ckUseBinLabel.setValue("N");
ckUsePlanogram.setValue("N");
}
/**
* Search for a duplicate record in the database that matches Barcode.
**/
private boolean getDuplCode(String barcode){
logger.debug("getDuplCode()");
try {
Hashtable hsh = new Hashtable();
lblDescr.setText("");
String query = getQueryString(barcode,true);
//reset data source
dsoData.setDataSource("com.gpc.tams.dso.dsoGeneric");
//setup band descriptor
TsoGenericBandDescriptor bd = new TsoGenericBandDescriptor(Sch_Tables.BARCODE, Sch_Tables.BARCODE);
bd.addColumn("ID", DatatypeCodes.TYPE_INT, true);
hsh.put(com.gpc.tams.dso.dsoGeneric.SQL, query);
hsh.put(com.gpc.tams.dso.dsoGeneric.BAND_DESCRIPTOR, bd);
SilverStreamExceptionHelper.invokeQuery(dsoData, hsh);
if (dsoData.gotoFirst()) {
ClientApplicationContext.getClientApplicationContext().getMessageMgr().showMessage(this, "159");
return true;
}
}catch(ApplicationException e) {
//Error occurred retreiving search results
logger.error("Error invoke DSO object "+e.toString());
}catch(AgoUnrecoverableSystemException e) {
logger.error("AgoUnrecoverableSystemException: "+e);
}catch(AgoSecurityException e) {
logger.error("AgoSecurityException: "+e.toString());
}catch(AgoTransientSystemException e) {
logger.error("AgoTransientSystemException: "+e.toString());
}
return false;
}
/**
* Builds Query.
**/
private String getQueryString(String barcode, boolean check_dupl){
logger.debug("getQueryString()");
StringBuffer sbWhere = new StringBuffer(64);
if(check_dupl)
sbWhere.append("select ID from ").append(Sch_Tables.BARCODE).append(" where ");
sbWhere.append(Sch_Tables.BARCODE).append(".").append(Sch_Barcode.BARCODE).append(" = '");
sbWhere.append(barcode).append("'");
logger.debug(sbWhere.toString());
return sbWhere.toString();
}
/**
* Retrieves the data for the Barcode table that matches the passed in bar code area.
* Loades the form with the new data.
* @return boolean - false = retrieval failed; true = retrieval succeeded
**/
private boolean retrieveBarCode(String barcode, boolean fromSearch){
logger.debug("retrieveBarCode()");
try {
String query = getQueryString(barcode,false);
String tempBarcode=null;
agcBarCode.query(query);
if (agcBarCode.gotoFirst() ) {
if (FM.getMode()!=FwoFormMaster.EDIT_MODE_EDITING)
FM.setMode(FwoFormMaster.EDIT_MODE_EDITING);
fldLine_Abbr.setText((String)agcBarCode.getProperty("LINE_ABBREV"));
fldPartNumber.setText(""+agcBarCode.getProperty("PART_NUMBER"));
loadBarCode(barcode);
loadBarCodeUse((Integer) agcBarCode.getProperty("ID"));
loadData();
final boolean fFromSearch = fromSearch;
//Run this on a separate thread due to a Focus issue that crops up whenever
//the Search Dialog comes up. See TR# 21709 for more details (04/23/2002)
Runnable runnable = new Runnable() {
public void run() {
if(!fFromSearch && fldLine_Abbr.isEnabled()) {
fGetFormMaster().setComponentFocus(fldLine_Abbr);
}
}
};
javax.swing.SwingUtilities.invokeLater(runnable);
return true;
} else{
if (barcode.length() == 12) {
tempBarcode = "00" + barcode;
}
if (tempBarcode != null && retrieveBarCode(tempBarcode, fromSearch)) {
return true;
}
else{
// fldPartNumber is not bound, so clear it if no exact match is found.
fldPartNumber.setText("");
fldLine_Abbr.setText("");
lblDescr.setText("");
}
}
}
catch (AgoSecurityException e) {
logger.error("Error in retrieveBarCode Record, AgoSecurityException\n");
logger.error(e.getMessage(), e);
String sParams[] = new String[1];
sParams[0] = "";
if(m_SessionMgr == null)
m_SessionMgr = FwoSessionMgr.getInstance();
ClientApplicationContext.getClientApplicationContext().getMessageMgr().showUpdateErrors(this, e, sParams);
}catch (AgoTransientSystemException e) {
logger.error("Error in retrieveBarCode Record, AgoTransientSystemException\n");
logger.error(e.getMessage(), e);
String sParams[] = new String[1];
sParams[0] = "";
if(m_SessionMgr == null)
m_SessionMgr = FwoSessionMgr.getInstance();
ClientApplicationContext.getClientApplicationContext().getMessageMgr().showUpdateErrors(this, e, sParams);
}catch (AgoUnrecoverableSystemException e) {
logger.error("Error in retrieveBarCode Record, AgoUnrecoverableSystemException\n");
logger.error(e.getMessage(), e);
String sParams[] = new String[1];
sParams[0] = "";
if(m_SessionMgr == null)
m_SessionMgr = FwoSessionMgr.getInstance();
ClientApplicationContext.getClientApplicationContext().getMessageMgr().showUpdateErrors(this, e, sParams);
}
return false;
}
/**
* Loades Bar Code format.
* If first two digits are zero's - loads 12-digits UPC Code
* otherwise - SCC-14 Code
**/
private void loadBarCode(String barcode) {
logger.debug("loadBarCode(" + barcode + ")");
this.fldBarcode.setText(barcode);
}
private void loadBarCodeUse(Integer barcodeId) {
logger.debug("loadBarCodeUse(" + barcodeId.toString() + ")");
StringBuffer sbWhere = new StringBuffer(64);
sbWhere.append(Sch_Tables.BARCODE_USE).append(".").append(Sch_BarcodeUse.LOC).append(" = ").append(FM.m_loc);
sbWhere.append(" AND ").append(Sch_Tables.BARCODE_USE).append(".").append(Sch_BarcodeUse.BARCODE_ID).append(" = ");
sbWhere.append(barcodeId);
try {
agcBarCodeUse.query(sbWhere.toString());
if (agcBarCodeUse.gotoFirst() ) {
addBind();
}
else{
ckUseBinLabel.setValue("N");
ckUsePlanogram.setValue("N");
usePlanogram = "N";
useBinLabel = "N";
}
}
catch (AgoTransientSystemException e) {
logger.error("Error in retrieveBarCodeUse Record, AgoTransientSystemException:\n");
logger.error(e.getMessage(), e);
String sParams[] = new String[1];
sParams[0] = "";
if(m_SessionMgr == null)
m_SessionMgr = FwoSessionMgr.getInstance();
ClientApplicationContext.getClientApplicationContext().getMessageMgr().showUpdateErrors(this, e, sParams);
}catch (AgoUnrecoverableSystemException e) {
logger.error("Error in retrieveBarCodeUse Record, AgoUnrecoverableSystemException:\n");
logger.error(e.getMessage(), e);
String sParams[] = new String[1];
sParams[0] = "";
if(m_SessionMgr == null)
m_SessionMgr = FwoSessionMgr.getInstance();
ClientApplicationContext.getClientApplicationContext().getMessageMgr().showUpdateErrors(this, e, sParams);
}catch (AgoSecurityException e) {
logger.error("Error in retrieveBarCodeUse Record, AgoSecurityException:\n");
logger.error(e.getMessage(), e);
String sParams[] = new String[1];
sParams[0] = "";
if(m_SessionMgr == null)
m_SessionMgr = FwoSessionMgr.getInstance();
ClientApplicationContext.getClientApplicationContext().getMessageMgr().showUpdateErrors(this, e, sParams);
}
}
/**
* Loads BarCodes data.
**/
private void loadData(){
logger.debug("loadData()");
findInventory();
enableFields(true);
setModifyLabel();
}
/**
* Finds Inventory record based on LineAbbr + PartNumber.
* If record is available - displays INVENTORY.DESCRIPTION
* and INVENTORY.EXPANDED_PART_NUMBER.
*
* BARCODE table allows null for LINE_ABBREV and PART_NUMBER,
* so results are not guaranteed. If no INVENTORY record is found,
* displays BARCODE.PART_NUMBER
**/
private boolean findInventory(){
logger.debug("findInventory()");
boolean result = false;
Hashtable hsh = new Hashtable();
lblDescr.setText("");
StringBuffer sbWhere = new StringBuffer(190);
sbWhere.append("Select ");
sbWhere.append(Sch_Tables.INVENTORY).append(".").append("DESCRIPTION, ");
sbWhere.append(Sch_Tables.INVENTORY).append(".").append("EXPANDED_PART_NUMBER");
sbWhere.append(" from ").append(Sch_Tables.INVENTORY).append(" where ");
sbWhere.append(Sch_Tables.INVENTORY).append(".").append("LOC").append(" = ").append(FM.m_loc);
sbWhere.append(" AND ").append(Sch_Tables.INVENTORY).append(".").append("LINE_ABBREV").append(" = ");
sbWhere.append("'").append(fldLine_Abbr.getText()).append("'");
sbWhere.append(" AND ").append(Sch_Tables.INVENTORY).append(".").append("PART_NUMBER").append(" = ");
sbWhere.append("'").append(fldPartNumber.getText().trim()).append("'");
//reset data source
dsoData.setDataSource("com.gpc.tams.dso.dsoGeneric");
//setup band descriptor
TsoGenericBandDescriptor bd = new TsoGenericBandDescriptor(Sch_Tables.INVENTORY, Sch_Tables.INVENTORY);
bd.addColumn("DESCRIPTION", DatatypeCodes.TYPE_STRING, true);
bd.addColumn("EXPANDED_PART_NUMBER", DatatypeCodes.TYPE_STRING, true);
hsh.put(com.gpc.tams.dso.dsoGeneric.SQL, sbWhere.toString());
hsh.put(com.gpc.tams.dso.dsoGeneric.BAND_DESCRIPTOR, bd);
try {
SilverStreamExceptionHelper.invokeQuery(dsoData, hsh);
if(dsoData.gotoFirst()){
lblDescr.setText((String) dsoData.getProperty("DESCRIPTION"));
fldPartNumber.setText((String)dsoData.getProperty("EXPANDED_PART_NUMBER"));
result = true;
}
}
catch(ApplicationException e) {
//Error occurred retreiving search results
logger.error("Error invoke object "+e.toString());
}catch(AgoSecurityException e) {
logger.error("AgoSecurityException: "+e.toString());
}catch(AgoTransientSystemException e) {
logger.error("AgoTransientSystemException: "+e.toString());
}catch(AgoUnrecoverableSystemException e) {
logger.error("AgoUnrecoverableSystemException: "+e.toString());
}
return result;
}
public Object ag_getValue(DataCursor cursor, int valueID, Object param1, Object param2)
{
//==== Warning: SilverStream-generated method: do not edit. All changes will be lost ===
try
{
switch (valueID)
{
case 0:
/* BARCODE_ID () BARCODE_USE.BARCODE_ID*/
return ((Integer) cursor.getProperty(0));
case 1:
/* LOC () BARCODE_USE.LOC*/
return ((Integer) cursor.getProperty(1));
case 2:
/* USE_FOR_BIN_LABEL () BARCODE_USE.USE_FOR_BIN_LABEL*/
return ((String) cursor.getProperty(2));
case 3:
/* USE_FOR_PLANOGRAM () BARCODE_USE.USE_FOR_PLANOGRAM*/
return ((String) cursor.getProperty(3));
case 4:
/* LAST_MODIFIED_DATE () BARCODE_USE.LAST_MODIFIED_DATE*/
return ((java.sql.Timestamp) cursor.getProperty(4));
case 5:
/* MODIFIED_BY_EMPLOYEE_ID () BARCODE_USE.MODIFIED_BY_EMPLOYEE_ID*/
return ((Integer) cursor.getProperty(5));
case 6:
/* ID () BARCODE.ID*/
return ((Integer) cursor.getProperty(0));
case 7:
/* BARCODE () BARCODE.BARCODE*/
return ((String) cursor.getProperty(1));
case 8:
/* LINE_ABBREV () BARCODE.LINE_ABBREV*/
return ((String) cursor.getProperty(2));
case 9:
/* PART_NUMBER () BARCODE.PART_NUMBER*/
return ((String) cursor.getProperty(3));
case 10:
/* PKG_QTY () BARCODE.PKG_QTY*/
return ((Short) cursor.getProperty(4));
case 11:
/* ALLOW_DVD_UPDATE () BARCODE.ALLOW_DVD_UPDATE*/
return ((String) cursor.getProperty(5));
case 12:
/* LAST_MODIFIED_DATE () BARCODE.LAST_MODIFIED_DATE*/
return ((java.sql.Timestamp) cursor.getProperty(6));
case 13:
/* MODIFIED_BY_EMPLOYEE_ID () BARCODE.MODIFIED_BY_EMPLOYEE_ID*/
return ((Integer) cursor.getProperty(7));
case 14:
/* MODIFIED_BY_EMPLOYEE_LOC () BARCODE.MODIFIED_BY_EMPLOYEE_LOC*/
return ((Integer) cursor.getProperty(8));
default:
return null;
}
}
catch (Throwable e)
{
return null;
}
}
/**
* Re-synch the navigation data to the current row
* @param barcode - Bar Codes record to navigate to
**/
public void navigateToBarCode(String barcode) {
logger.debug("navigateToBarCode()");
Object[] rowValues = {barcode};
this.fGetFormMaster().setCurrentNavRow(rowValues);
}
public void fSort() {
}
public boolean fValidateJTableCell(com.gpc.client.common.table.FwoJTableMgr fwoJTableMgr1, int row, int column) {
return true;
}
public boolean fValidateJTableRow(com.gpc.client.common.table.FwoJTableMgr fwoJTableMgr1, int row) {
return true;
}
/**
* Converts entered Bar Codes digits to a string.
* Search for a record that matches Barcode.
* Populates the navigation data with the matching record and the next buffered set of records.
* Goes to that record in the navigation data and retrieves that records data.
* If "Add" and record found - displays a message about existance barcode record in a database.
* Return boolean - true = if exact match is found, or is redirected to the advanced search immediately;
* false = if no match is found, or an error occurs.
* NB: will not find 12-digit barcodes. All codes need to be converted to 14-digit.
**/
public boolean fFindExactMatch() {
logger.debug("fFindExactMatch() 1");
try {
String barcode = getBarcodeText();
if (barcode == null || barcode.trim().equals("")) {
return true;
}
/*if (barcode.charAt(0) == ('@') && barcode.length() > 2) {
barcode = barcode.substring(2);
}*/
/* if empty or contains wildcard, automatically call the advanced search */
if (barcode.equals("") || barcode.indexOf("*") > -1) {
fRunAdvancedSearch();
return true;
}
// not empty, so if 12, 13, 14 digits, find the barcode and display
// if less not 12, 13 14 digits, show invalid barcode message
// query
boolean res = retrieveBarCode(barcode, false);
if(res) {
StringBuffer sbWhere = new StringBuffer();
//sbWhere.append(Sch_Tables.BARCODE).append(".").append(Sch_Barcode.LOC).append(" = ").append(FM.m_loc);
logger.debug("fFindExactMatch(): \n navigation query = " + sbWhere);
m_NavData.getQueryBuffer().setTableNames(new String[]{Sch_Tables.BARCODE});
m_NavData.query("0=0");
navigateToBarCode(barcode);
return true;
}
} catch (AgoSecurityException e) {
logger.error("AgoSecurityException in findBarCode: " + e);
String sParams[] = new String[1];
sParams[0] = "";
if(m_SessionMgr == null)
m_SessionMgr = FwoSessionMgr.getInstance();
ClientApplicationContext.getClientApplicationContext().getMessageMgr().showUpdateErrors(this, e, sParams);
}catch (AgoUnrecoverableSystemException e) {
logger.error("AgoUnrecoverableSystemException in findBarCode: " + e);
String sParams[] = new String[1];
sParams[0] = "";
if(m_SessionMgr == null)
m_SessionMgr = FwoSessionMgr.getInstance();
ClientApplicationContext.getClientApplicationContext().getMessageMgr().showUpdateErrors(this, e, sParams);
}catch (AgoTransientSystemException e) {
logger.error("AgoTransientSystemException in findBarCode: " + e);
String sParams[] = new String[1];
sParams[0] = "";
if(m_SessionMgr == null)
m_SessionMgr = FwoSessionMgr.getInstance();
ClientApplicationContext.getClientApplicationContext().getMessageMgr().showUpdateErrors(this, e, sParams);
}
return false;
}
/**
* This method is called if an exact match is not found,
* and user wants to add a new barcode record .
**/
public boolean fNewFromSearch() {
logger.debug("fNewFromSearch()");
fromNewSearch = true;
/* call FM's fNew so the toolbar will be in-synch with the current action */
boolean bNew = FM.fNew();
logger.debug(" fNewFromSearch m_NeedsUpdate = " +m_NeedsUpdate) ;
if (bNew) {
// default barcode to search value
fldLine_Abbr.requestFocus();
m_addingNew = true;
return true;
} else {
fromNewSearch = false;
return false;
}
}
/**
* Method is used to run the advanced search object, retrieve the selected search value,
* and update the navigation data to use the search results.
**/
public void fRunAdvancedSearch() {
logger.debug("fRunAdvancedSearch()");
final AgfForm thisForm = this;
SwingUtilities.invokeLater(new Runnable() {
public void run() {
try {
advancedSearchObject.runAdvancedSearch(Sch_Tables.BARCODE + "." + Sch_Barcode.PART_NUMBER, "");
String sBarcode = (String) advancedSearchObject.getSelectedValue();
if(sBarcode!=null){
if(retrieveBarCode(sBarcode,true)){
// set the navigation data query
logger.debug("\n querying navData with:\n" + advancedSearchObject.getWhereClause() + "\n");
m_NavData.getQueryBuffer().setTableNames(new String[]{Sch_Tables.BARCODE,Sch_Tables.INVENTORY});
m_NavData.query(advancedSearchObject.getWhereClause());
navigateToBarCode(sBarcode);
fldLine_Abbr.requestFocus();
}
} else {
if (!(fldLine_Abbr.getText()).equals("")) {
fldLine_Abbr.requestFocus();
}
}
}catch (AgoSecurityException e) {
logger.error("AgoSecurityException: " + e);
String sParams[] = new String[1];
sParams[0] = "";
if(m_SessionMgr == null)
m_SessionMgr = FwoSessionMgr.getInstance();
ClientApplicationContext.getClientApplicationContext().getMessageMgr().showUpdateErrors(thisForm, e, sParams);
}catch (AgoUnrecoverableSystemException e) {
logger.error("AgoUnrecoverableSystemException: " + e);
String sParams[] = new String[1];
sParams[0] = "";
if(m_SessionMgr == null)
m_SessionMgr = FwoSessionMgr.getInstance();
ClientApplicationContext.getClientApplicationContext().getMessageMgr().showUpdateErrors(thisForm, e, sParams);
}catch (IOException e) {
logger.error("IOException: " + e);
String sParams[] = new String[1];
sParams[0] = "";
if(m_SessionMgr == null)
m_SessionMgr = FwoSessionMgr.getInstance();
ClientApplicationContext.getClientApplicationContext().getMessageMgr().showUpdateErrors(thisForm, e, sParams);
}catch (AgoTransientSystemException e) {
logger.error("AgoTransientSystemException: " + e);
String sParams[] = new String[1];
sParams[0] = "";
if(m_SessionMgr == null)
m_SessionMgr = FwoSessionMgr.getInstance();
ClientApplicationContext.getClientApplicationContext().getMessageMgr().showUpdateErrors(thisForm, e, sParams);
}
}
});
}
private void enableFields(boolean enabled) {
logger.debug("enableFields(" + enabled + ")");
if (!FM.canEdit() && enabled) {
return;
}
fldLine_Abbr.setEnabled(enabled);
fldPartNumber.setEnabled(enabled);
fldQty.setEnabled(enabled);
ckDVD.setEnabled(enabled);
ckUsePlanogram.setEnabled(enabled);
ckUseBinLabel.setEnabled(enabled);
}
public java.util.Locale fGetCurrentRecordLocale(javax.swing.JComponent jComponent1) {
return (java.util.Locale)null;
}
public Integer fGetFunctionId() {
return TsoConstant.IM_MAINT_BAR_CODES;
}
public boolean fNeedsUpdate() {
logger.debug("fNeedsUpdate()");
if(FM.getMode() == FwoFormMaster.FIND_MODE || FM.getMode() == FwoFormMaster.VIEW_MODE || FM.getMode() == FwoFormMaster.EDIT_MODE_NOT_EDITING) {
return false;
}
if(FM.getMode() == FwoFormMaster.NEW_MODE && !m_addingNew) {
return false;
}
boolean barcodeuse_chg=false;
logger.debug("fNeedsUpdate: m_NeedsUpdate=" +
m_NeedsUpdate + " agcBarCode.haveRowsChanged() = " + agcBarCode.haveRowsChanged());
if((ckUseBinLabel.getValue()!=null && ckUsePlanogram.getValue()!=null)
&& (!useBinLabel.equals(ckUseBinLabel.getValue()) ||
!usePlanogram.equals(ckUsePlanogram.getValue())) ) {
barcodeuse_chg=true;
}
return (m_NeedsUpdate || agcBarCode.haveRowsChanged() || barcodeuse_chg);
}
public void fPostCancel() {
logger.debug("fPostCancel()");
//no id, no record
if(agcBarCode.getProperty(Sch_Barcode.ID) == null) {
FM.setDelete(false);
FM.setEdit(false);
}
m_NeedsUpdate = false;
}
public void fPostDelete() {
logger.debug("fPostDelete()");
//no id, no record
if(agcBarCode.getProperty(Sch_Barcode.ID) == null) {
FM.setDelete(false);
FM.setEdit(false);
}
m_NeedsUpdate = false;
}
public void fPostEdit() {
logger.debug("fPostEdit()");
}
public void fPostNew() {
logger.debug("fPostNew()");
Integer id = getNextId();
if (id != null) {
agcBarCode.setProperty(Sch_Barcode.ID, id);
}
enableFields(true);
if(!fromNewSearch){
clearAll();
}
else{
//clearAll();
fromNewSearch = false;
}
m_NeedsUpdate = true;
fldBarcode.requestFocus();
}
public void fPostSave() {
logger.debug("fPostSave()");
m_NeedsUpdate = false;
}
public boolean fValidateComponent(javax.swing.JComponent jComponent1) {
logger.debug("fValidateComponent(" + jComponent1.getName() + ")");
if(jComponent1 == fldLine_Abbr && fldLine_Abbr.isEnabled()){
boolean valid = true;
String line = fldLine_Abbr.getText();
// can't start with a number -- can too.
if( line.length() > 1 && line.startsWith(" ")) {
valid = false;
}
// See if the line exists in PRODUCT_LINE.
// Allow an empty line.
if(valid && !fldLine_Abbr.getText().trim().equals("")) {
StringBuffer query = new StringBuffer("select LINE_ABBREV from product_line where line_abbrev = '" + line + "'");
Hashtable params = new Hashtable();
// reset data source
dsoData.setDataSource("com.gpc.tams.dso.dsoGeneric");
//setup band descriptor
TsoGenericBandDescriptor bd = new TsoGenericBandDescriptor("PRODUCT_LINE", "PRODUCT_LINE");
bd.addColumn("LINE_ABBREV", DatatypeCodes.TYPE_STRING, true);
params.put(com.gpc.tams.dso.dsoGeneric.SQL, query.toString());
params.put(com.gpc.tams.dso.dsoGeneric.BAND_DESCRIPTOR, bd);
try{
SilverStreamExceptionHelper.invokeQuery(dsoData, params);
if(!dsoData.gotoFirst())
valid = false;
}catch(ApplicationException e){
logger.error("ApplicationException in fValidateComponent(): " + e);
valid = false;
}catch(AgoSecurityException e){
logger.error("AgoSecurityException in fValidateComponent(): " + e);
valid = false;
}catch(AgoUnrecoverableSystemException e){
logger.error("AgoUnrecoverableSystemException in fValidateComponent(): " + e);
valid = false;
}catch(AgoTransientSystemException e){
logger.error("AgoTransientSystemException in fValidateComponent(): " + e);
valid = false;
}
}
if(!valid){
ClientApplicationContext.getClientApplicationContext().getMessageMgr().showMessage(this,"591");
} else {
agcBarCode.setProperty("LINE_ABBREV", line);
}
return valid;
}
if(jComponent1 == fldPartNumber && fldLine_Abbr.isEnabled()) {
// Search for the part in INVENTORY.
// Allow an empty part.
String enteredPartNumber = fldPartNumber.getText().trim();
if (!enteredPartNumber.equals("") && !findInventory()){
ClientApplicationContext.getClientApplicationContext().getMessageMgr().showMessage(this, "607");
return false;
}
else
agcBarCode.setProperty("PART_NUMBER", enteredPartNumber);
}
return true;
}
private boolean validateBarcode() {
checkForChanges();
barcodeEntered();
return true;
}
private void checkForChanges() {
logger.debug("checkForChanges");
boolean keepcurrent = false;
// if we already have a barcode entered in edit mode or new mode, we want to check for changes, and prompt to save
// otherwise, let it go
String barcode = getBarcodeText();
//get unformatted barcode
final String currentBarcode = fldBarcode.getText();
if(FM.getMode() == FwoFormMaster.EDIT_MODE_EDITING) {
// there is a barcode, so see if we need to update
if(fNeedsUpdate()) {
// yup, need to update
Boolean saveme = ClientApplicationContext.getClientApplicationContext().getMessageMgr().showMessageYesNoCancel(thisForm, "120");
if(saveme == null) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
fldBarcode.setText(currentBarcode);
}
});
return;
} else if(saveme.equals(Boolean.TRUE)) {
String newText = fldBarcode.getText();
fldBarcode.setText(currentBarcode);
fSave();
fldBarcode.setText(newText);
} else if(saveme.equals(Boolean.FALSE)) {
m_addingNew = false;
// do nothing;
}
}
}
clearInfoFields();
enableFields(false);
if(FM.getMode() == FwoFormMaster.EDIT_MODE_EDITING) {
FM.setMode(FwoFormMaster.FIND_MODE);
}
}
private void handle_btnSearch_actionPerformed(ActionEvent evt) {
logger.debug("handle_btnSearch_actionPerformed()");
if(FM.getMode() == FwoFormMaster.EDIT_MODE_EDITING || FM.getMode() == FwoFormMaster.NEW_MODE) {
if(fNeedsUpdate()) {
Boolean saveme = ClientApplicationContext.getClientApplicationContext().getMessageMgr().showMessageYesNoCancel(this, "120");
if(saveme == null) {
return;
} else if(saveme.equals(Boolean.TRUE)) {
fSave();
} else if(saveme.equals(Boolean.FALSE)) {
// do nothing;
}
}
}
fRunAdvancedSearch();
}
public void actionPerformed(ActionEvent evt)
{
//==== Warning: SilverStream-generated method: do not edit. All changes will be lost ===
Object src = evt.getSource();
if (src == btnSearch)
{
handle_btnSearch_actionPerformed(evt);
return;
}
super.actionPerformed(evt);
}
public void finalize()
throws Throwable
{
logger.debug("Memory being released: " + this);
super.finalize();
}
}