Refactor - indentation - improve readability - translate comments - organize imports - fix warnings
This commit is contained in:
parent
d75cc47746
commit
d7648d34cf
|
@ -16,103 +16,109 @@
|
|||
|
||||
package org.eevolution.model;
|
||||
|
||||
import java.lang.reflect.*;
|
||||
import java.util.*;
|
||||
import java.sql.*;
|
||||
import java.math.*;
|
||||
import java.util.logging.*;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
import org.compiere.util.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Victor Perez www.e-evolution.com
|
||||
*/
|
||||
public class QueryDB {
|
||||
|
||||
private String classname;
|
||||
private String trxName;
|
||||
private static CLogger log = CLogger.getCLogger (QueryDB.class);
|
||||
/** Creates a new instance of POQuery */
|
||||
|
||||
public QueryDB(String classname)
|
||||
{
|
||||
this.classname = classname;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static Object newInstance(String classname, int id, String trxName )
|
||||
{
|
||||
Object result = null;
|
||||
Class args;
|
||||
int begin = classname.indexOf("X_") + 2 ;
|
||||
String table = classname.substring(begin);
|
||||
Class[] intArgsClass = new Class[] {Properties.class , int.class, String.class};
|
||||
//Integer height = new Integer(12);
|
||||
Integer ID = new Integer(id);
|
||||
Object[] intArgs = new Object[] {Env.getCtx(), ID,table};
|
||||
Constructor intArgsConstructor;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
args = Class.forName(classname);
|
||||
intArgsConstructor =
|
||||
args.getConstructor(intArgsClass);
|
||||
result = createObject(intArgsConstructor, intArgs);
|
||||
return result;
|
||||
}
|
||||
catch (ClassNotFoundException e)
|
||||
{
|
||||
System.out.println(e);
|
||||
return result;
|
||||
}
|
||||
catch (NoSuchMethodException e)
|
||||
{
|
||||
System.out.println(e);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
private String classname;
|
||||
private static CLogger log = CLogger.getCLogger (QueryDB.class);
|
||||
/** Creates a new instance of POQuery */
|
||||
|
||||
public static Object createObject(Constructor constructor,
|
||||
Object[] arguments) {
|
||||
public QueryDB(String classname)
|
||||
{
|
||||
this.classname = classname;
|
||||
}
|
||||
|
||||
//System.out.println ("Constructor: " + constructor.toString());
|
||||
Object object = null;
|
||||
|
||||
try {
|
||||
object = constructor.newInstance(arguments);
|
||||
//System.out.println ("Object: " + object.toString());
|
||||
return object;
|
||||
} catch (InstantiationException e) {
|
||||
log.log(Level.SEVERE,"InstantiationException:" + e);
|
||||
} catch (IllegalAccessException e) {
|
||||
log.log(Level.SEVERE,"IllegalAccessException:" + e);
|
||||
} catch (IllegalArgumentException e) {
|
||||
log.log(Level.SEVERE,"IllegalArgumentExceptio:" + e);
|
||||
} catch (InvocationTargetException e) {
|
||||
log.log(Level.SEVERE,"InvocationTargetException:" + e);
|
||||
}
|
||||
return object;
|
||||
}
|
||||
|
||||
public List execute(String filter) {
|
||||
|
||||
//String tablename = POClass.getName();
|
||||
//System.out.print(classname.indexOf("X_"));
|
||||
int begin = classname.indexOf("X_") + 2 ;
|
||||
String table = classname.substring(begin);
|
||||
StringBuffer sql = new StringBuffer("SELECT ").append(table).append("_ID FROM " + table);
|
||||
if (filter.equals(""))
|
||||
System.out.println("not exist filter");
|
||||
else
|
||||
sql.append(" WHERE ").append(filter);
|
||||
|
||||
//System.out.println("Query " + sql.toString());
|
||||
|
||||
List results = new ArrayList();
|
||||
|
||||
|
||||
public static Object newInstance(String classname, int id, String trxName )
|
||||
{
|
||||
Object result = null;
|
||||
Class args;
|
||||
int begin = classname.indexOf("X_") + 2 ;
|
||||
String table = classname.substring(begin);
|
||||
Class[] intArgsClass = new Class[] {Properties.class , int.class, String.class};
|
||||
//Integer height = new Integer(12);
|
||||
Integer ID = new Integer(id);
|
||||
Object[] intArgs = new Object[] {Env.getCtx(), ID,table};
|
||||
Constructor intArgsConstructor;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
args = Class.forName(classname);
|
||||
intArgsConstructor =
|
||||
args.getConstructor(intArgsClass);
|
||||
result = createObject(intArgsConstructor, intArgs);
|
||||
return result;
|
||||
}
|
||||
catch (ClassNotFoundException e)
|
||||
{
|
||||
System.out.println(e);
|
||||
return result;
|
||||
}
|
||||
catch (NoSuchMethodException e)
|
||||
{
|
||||
System.out.println(e);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public static Object createObject(Constructor constructor,
|
||||
Object[] arguments) {
|
||||
|
||||
//System.out.println ("Constructor: " + constructor.toString());
|
||||
Object object = null;
|
||||
|
||||
try {
|
||||
object = constructor.newInstance(arguments);
|
||||
//System.out.println ("Object: " + object.toString());
|
||||
return object;
|
||||
} catch (InstantiationException e) {
|
||||
log.log(Level.SEVERE,"InstantiationException:" + e);
|
||||
} catch (IllegalAccessException e) {
|
||||
log.log(Level.SEVERE,"IllegalAccessException:" + e);
|
||||
} catch (IllegalArgumentException e) {
|
||||
log.log(Level.SEVERE,"IllegalArgumentExceptio:" + e);
|
||||
} catch (InvocationTargetException e) {
|
||||
log.log(Level.SEVERE,"InvocationTargetException:" + e);
|
||||
}
|
||||
return object;
|
||||
}
|
||||
|
||||
public List<Object> execute(String filter) {
|
||||
|
||||
//String tablename = POClass.getName();
|
||||
//System.out.print(classname.indexOf("X_"));
|
||||
int begin = classname.indexOf("X_") + 2 ;
|
||||
String table = classname.substring(begin);
|
||||
StringBuffer sql = new StringBuffer("SELECT ").append(table).append("_ID FROM " + table);
|
||||
if (filter.equals(""))
|
||||
System.out.println("not exist filter");
|
||||
else
|
||||
sql.append(" WHERE ").append(filter);
|
||||
|
||||
//System.out.println("Query " + sql.toString());
|
||||
|
||||
List<Object> results = new ArrayList<Object>();
|
||||
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), null);
|
||||
|
@ -121,8 +127,8 @@ public class QueryDB {
|
|||
while (rs.next())
|
||||
{
|
||||
int id = rs.getInt(1);
|
||||
Object element = newInstance(classname , id, table);
|
||||
results.add(element);
|
||||
Object element = newInstance(classname , id, table);
|
||||
results.add(element);
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
|
@ -131,27 +137,27 @@ public class QueryDB {
|
|||
{
|
||||
log.log(Level.SEVERE,"VCreateFrom.initIOS - Order\nSQL=" + sql.toString(), e);
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
|
||||
public List execute() {
|
||||
|
||||
//String tablename = POClass.getName();
|
||||
//System.out.print(classname.indexOf("X_"));
|
||||
int begin = classname.indexOf("X_") + 2 ;
|
||||
String table = classname.substring(begin);
|
||||
StringBuffer sql = new StringBuffer("SELECT ").append(table).append("_ID FROM " + table);
|
||||
//if (filter.equals(""))
|
||||
//System.out.println("not exist filter");
|
||||
//else
|
||||
//sql.append(" WHERE ").append(filter);
|
||||
|
||||
//System.out.println("Query " + sql.toString());
|
||||
|
||||
List results = new ArrayList();
|
||||
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
|
||||
public List<Object> execute() {
|
||||
|
||||
//String tablename = POClass.getName();
|
||||
//System.out.print(classname.indexOf("X_"));
|
||||
int begin = classname.indexOf("X_") + 2 ;
|
||||
String table = classname.substring(begin);
|
||||
StringBuffer sql = new StringBuffer("SELECT ").append(table).append("_ID FROM " + table);
|
||||
//if (filter.equals(""))
|
||||
//System.out.println("not exist filter");
|
||||
//else
|
||||
//sql.append(" WHERE ").append(filter);
|
||||
|
||||
//System.out.println("Query " + sql.toString());
|
||||
|
||||
List<Object> results = new ArrayList<Object>();
|
||||
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), null);
|
||||
|
@ -160,8 +166,8 @@ public class QueryDB {
|
|||
while (rs.next())
|
||||
{
|
||||
int id = rs.getInt(1);
|
||||
Object element = newInstance(classname , id, table);
|
||||
results.add(element);
|
||||
Object element = newInstance(classname , id, table);
|
||||
results.add(element);
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
|
@ -170,10 +176,8 @@ public class QueryDB {
|
|||
{
|
||||
log.log(Level.SEVERE,"VCreateFrom.initIOS - Order\nSQL=" + sql.toString(), e);
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
|
@ -30,10 +30,8 @@ import org.compiere.minigrid.MiniTable;
|
|||
import org.compiere.model.MLookup;
|
||||
import org.compiere.model.MLookupFactory;
|
||||
import org.compiere.model.MProduct;
|
||||
import org.compiere.model.MUOM;
|
||||
import org.compiere.model.MColumn;
|
||||
import org.compiere.model.X_C_UOM;
|
||||
import org.eevolution.model.MPPOrder;
|
||||
import org.eevolution.model.X_PP_Product_BOM;
|
||||
import org.eevolution.model.X_PP_Product_BOMLine;
|
||||
import org.compiere.model.X_M_Product;
|
||||
|
@ -64,8 +62,10 @@ import java.math.BigDecimal;
|
|||
import java.sql.Timestamp;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.Vector;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JSplitPane;
|
||||
|
@ -78,7 +78,6 @@ import javax.swing.event.TreeSelectionEvent;
|
|||
import javax.swing.event.TreeSelectionListener;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
import java.util.logging.*;
|
||||
|
||||
/**
|
||||
* Tree Maintenance
|
||||
|
@ -87,12 +86,12 @@ import java.util.logging.*;
|
|||
* @version $Id: VTreeMaintenance.java,v 1.1 2004/03/20 04:35:51 jjanke Exp $
|
||||
*
|
||||
* 4Layers - MODIFICATIONS --------------------------------------------------------
|
||||
* 2005/04/12 Vorious improvements to the standard form (Sergio Ramazzina)
|
||||
* 2005/04/12 Various improvements to the standard form (Sergio Ramazzina)
|
||||
* 4Layers -------------------------------------------------------------------- end
|
||||
*/
|
||||
public class VTreeBOM extends CPanel
|
||||
implements FormPanel, ActionListener, ListSelectionListener, PropertyChangeListener , VetoableChangeListener, TreeSelectionListener , TableModelListener
|
||||
{
|
||||
public class VTreeBOM extends CPanel implements FormPanel, ActionListener,
|
||||
ListSelectionListener, PropertyChangeListener, VetoableChangeListener,
|
||||
TreeSelectionListener, TableModelListener {
|
||||
/**
|
||||
* Tree Maintenance
|
||||
*/
|
||||
|
@ -106,50 +105,49 @@ public class VTreeBOM extends CPanel
|
|||
private FormFrame m_frame;
|
||||
/** Active Tree */
|
||||
private JTree m_tree;
|
||||
|
||||
private static CLogger log = CLogger.getCLogger(VTreeBOM.class);
|
||||
|
||||
|
||||
private static CLogger log = CLogger.getCLogger(VTreeBOM.class);
|
||||
|
||||
private BorderLayout mainLayout = new BorderLayout ();
|
||||
private CPanel northPanel = new CPanel ();
|
||||
|
||||
|
||||
private FlowLayout northLayout = new FlowLayout ();
|
||||
private CLabel labelProduct = new CLabel ();
|
||||
private VLookup fieldProduct;
|
||||
private VLookup fieldProduct;
|
||||
//private CButton bAddAll = new CButton (Env.getImageIcon("FastBack24.gif"));
|
||||
//private CButton bAdd = new CButton (Env.getImageIcon("StepBack24.gif"));
|
||||
//private CButton bDelete = new CButton (Env.getImageIcon("StepForward24.gif"));
|
||||
//private CButton bDeleteAll = new CButton (Env.getImageIcon("FastForward24.gif"));
|
||||
private CCheckBox implotion = new CCheckBox ();
|
||||
private CCheckBox implosion = new CCheckBox ();
|
||||
private CLabel treeInfo = new CLabel ();
|
||||
//
|
||||
private JSplitPane splitPane = new JSplitPane ();
|
||||
//private VTreePanel centerTree;
|
||||
//private JList centerList = new JList ();
|
||||
private JScrollPane dataPane = new JScrollPane();
|
||||
//private CLabel labelUOM = new CLabel();
|
||||
//private CTextField fieldUOM = new CTextField(10);
|
||||
//private CLabel labelDocument = new CLabel();
|
||||
//private CTextField fieldDocument = new CTextField(10);
|
||||
//private CLabel labelRevision = new CLabel();
|
||||
//private CTextField fieldRevision = new CTextField(8);
|
||||
//private CLabel labelECN = new CLabel();
|
||||
//private CTextField fieldECN = new CTextField(10);
|
||||
//private VDate dateFrom = new VDate ("DateFrom", false, false, true, DisplayType.Date, Msg.translate(Env.getCtx(), "DateFrom"));
|
||||
//private VDate dateTo = new VDate ("DateTo", false, false, true, DisplayType.Date, Msg.translate(Env.getCtx(), "DateTo"));
|
||||
private CPanel southPanel = new CPanel();
|
||||
private JScrollPane dataPane = new JScrollPane();
|
||||
//private CLabel labelUOM = new CLabel();
|
||||
//private CTextField fieldUOM = new CTextField(10);
|
||||
//private CLabel labelDocument = new CLabel();
|
||||
//private CTextField fieldDocument = new CTextField(10);
|
||||
//private CLabel labelRevision = new CLabel();
|
||||
//private CTextField fieldRevision = new CTextField(8);
|
||||
//private CLabel labelECN = new CLabel();
|
||||
//private CTextField fieldECN = new CTextField(10);
|
||||
//private VDate dateFrom = new VDate ("DateFrom", false, false, true, DisplayType.Date, Msg.translate(Env.getCtx(), "DateFrom"));
|
||||
//private VDate dateTo = new VDate ("DateTo", false, false, true, DisplayType.Date, Msg.translate(Env.getCtx(), "DateTo"));
|
||||
private CPanel southPanel = new CPanel();
|
||||
private BorderLayout southLayout = new BorderLayout();
|
||||
private ConfirmPanel confirmPanel = new ConfirmPanel(true);
|
||||
protected StatusBar statusBar = new StatusBar();
|
||||
|
||||
private MiniTable tableBOM = new MiniTable();
|
||||
private Vector dataBOM = new Vector();
|
||||
private Vector layout = new Vector();
|
||||
private Vector columnNames;
|
||||
//private VDate fieldGuaranteeDate =
|
||||
//4Layers - Set diveder location variable
|
||||
private final int DIVIDER_LOCATION = 240;
|
||||
// 4Layers - end
|
||||
|
||||
|
||||
private MiniTable tableBOM = new MiniTable();
|
||||
private Vector<Vector<Object>> dataBOM = new Vector<Vector<Object>>();
|
||||
private Vector<String> columnNames;
|
||||
//private VDate fieldGuaranteeDate =
|
||||
//4Layers - Set divider location variable
|
||||
private final int DIVIDER_LOCATION = 240;
|
||||
// 4Layers - end
|
||||
|
||||
/**
|
||||
* Initialize Panel
|
||||
* @param WindowNo window
|
||||
|
@ -164,9 +162,9 @@ public class VTreeBOM extends CPanel
|
|||
{
|
||||
preInit();
|
||||
jbInit ();
|
||||
|
||||
|
||||
frame.getContentPane().add(this, BorderLayout.CENTER);
|
||||
// frame.getContentPane().add(statusBar, BorderLayout.SOUTH);
|
||||
// frame.getContentPane().add(statusBar, BorderLayout.SOUTH);
|
||||
//action_loadBOM();
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -174,7 +172,7 @@ public class VTreeBOM extends CPanel
|
|||
log.log(Level.SEVERE,"VTreeMaintenance.init", ex);
|
||||
}
|
||||
} // init
|
||||
|
||||
|
||||
/**
|
||||
* Fill Tree Combo
|
||||
*/
|
||||
|
@ -197,11 +195,9 @@ public class VTreeBOM extends CPanel
|
|||
m_tree = new JTree(parent);
|
||||
splitPane.add (m_tree, JSplitPane.LEFT);
|
||||
|
||||
|
||||
} // preInit
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Static Init.
|
||||
* <pre>
|
||||
* mainPanel
|
||||
|
@ -214,70 +210,66 @@ public class VTreeBOM extends CPanel
|
|||
* </pre>
|
||||
* @throws Exception
|
||||
*/
|
||||
private void loadTableBOM()
|
||||
private void loadTableBOM()
|
||||
{
|
||||
// Header Info
|
||||
columnNames = new Vector(18);
|
||||
|
||||
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "Select")); // 0
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "IsActive")); // 1
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "Line")); // 2
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "ValidFrom")); // 3
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "ValidTo")); // 4
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "M_Product_ID")); // 5
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "C_UOM_ID")); // 6
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "IsQtyPercentage")); // 7
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "QtyBatch")); // 8
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "QtyBOM")); // 9
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "IsCritical")); // 10
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "LeadTimeOffset")); // 11
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "Assay")); // 12
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "Scrap")); // 13
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "IssueMethod")); // 14
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "BackflushGroup")); // 15
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "Forecast")); // 16
|
||||
|
||||
// Remove previous listeners
|
||||
tableBOM.getModel().removeTableModelListener(this);
|
||||
// Remove previous listeners
|
||||
tableBOM.getModel().removeTableModelListener(this);
|
||||
// Set Model
|
||||
DefaultTableModel model = new DefaultTableModel(dataBOM, columnNames);
|
||||
model.addTableModelListener(this);
|
||||
tableBOM.setModel(model);
|
||||
|
||||
tableBOM.setColumnClass( 0, Boolean.class, false); // 0 Select
|
||||
tableBOM.setColumnClass( 1, Boolean.class, false); // 1 IsActive
|
||||
tableBOM.setColumnClass( 2, Integer.class,false); // 2 Line
|
||||
tableBOM.setColumnClass( 3, Timestamp.class,false); // 3 ValidFrom
|
||||
tableBOM.setColumnClass( 4, Timestamp.class,false); // 4 ValidTo
|
||||
tableBOM.setColumnClass( 5, KeyNamePair.class,false); // 5 M_Product_ID
|
||||
tableBOM.setColumnClass( 6, KeyNamePair.class,false); // 6 C_UOM_ID
|
||||
tableBOM.setColumnClass( 7, Boolean.class,false); // 7 QtyPorcentage
|
||||
tableBOM.setColumnClass( 8, BigDecimal.class,false); // 8 BatchPercent
|
||||
tableBOM.setColumnClass( 9, BigDecimal.class,false); // 9 QtyBOM
|
||||
tableBOM.setColumnClass( 10, Boolean.class,false); // 10 IsCritical
|
||||
tableBOM.setColumnClass( 11, BigDecimal.class,false); // 11 LTOffSet
|
||||
tableBOM.setColumnClass( 12, BigDecimal.class,false); // 12 Assay
|
||||
tableBOM.setColumnClass( 13, Integer.class,false); // 13 Scrap
|
||||
tableBOM.setColumnClass( 14, String.class,false); // 14 IssueMethod
|
||||
tableBOM.setColumnClass( 15, String.class,false); // 15 BackflushGroup
|
||||
tableBOM.setColumnClass( 16, BigDecimal.class,false); // 16 Forecast
|
||||
tableBOM.autoSize();
|
||||
|
||||
|
||||
|
||||
// Header Info
|
||||
columnNames = new Vector<String>(18);
|
||||
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "Select")); // 0
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "IsActive")); // 1
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "Line")); // 2
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "ValidFrom")); // 3
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "ValidTo")); // 4
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "M_Product_ID")); // 5
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "C_UOM_ID")); // 6
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "IsQtyPercentage")); // 7
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "QtyBatch")); // 8
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "QtyBOM")); // 9
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "IsCritical")); // 10
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "LeadTimeOffset")); // 11
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "Assay")); // 12
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "Scrap")); // 13
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "IssueMethod")); // 14
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "BackflushGroup")); // 15
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "Forecast")); // 16
|
||||
|
||||
// Remove previous listeners
|
||||
tableBOM.getModel().removeTableModelListener(this);
|
||||
// Remove previous listeners
|
||||
tableBOM.getModel().removeTableModelListener(this);
|
||||
// Set Model
|
||||
DefaultTableModel model = new DefaultTableModel(dataBOM, columnNames);
|
||||
model.addTableModelListener(this);
|
||||
tableBOM.setModel(model);
|
||||
|
||||
tableBOM.setColumnClass( 0, Boolean.class, false); // 0 Select
|
||||
tableBOM.setColumnClass( 1, Boolean.class, false); // 1 IsActive
|
||||
tableBOM.setColumnClass( 2, Integer.class,false); // 2 Line
|
||||
tableBOM.setColumnClass( 3, Timestamp.class,false); // 3 ValidFrom
|
||||
tableBOM.setColumnClass( 4, Timestamp.class,false); // 4 ValidTo
|
||||
tableBOM.setColumnClass( 5, KeyNamePair.class,false); // 5 M_Product_ID
|
||||
tableBOM.setColumnClass( 6, KeyNamePair.class,false); // 6 C_UOM_ID
|
||||
tableBOM.setColumnClass( 7, Boolean.class,false); // 7 QtyPorcentage
|
||||
tableBOM.setColumnClass( 8, BigDecimal.class,false); // 8 BatchPercent
|
||||
tableBOM.setColumnClass( 9, BigDecimal.class,false); // 9 QtyBOM
|
||||
tableBOM.setColumnClass( 10, Boolean.class,false); // 10 IsCritical
|
||||
tableBOM.setColumnClass( 11, BigDecimal.class,false); // 11 LTOffSet
|
||||
tableBOM.setColumnClass( 12, BigDecimal.class,false); // 12 Assay
|
||||
tableBOM.setColumnClass( 13, Integer.class,false); // 13 Scrap
|
||||
tableBOM.setColumnClass( 14, String.class,false); // 14 IssueMethod
|
||||
tableBOM.setColumnClass( 15, String.class,false); // 15 BackflushGroup
|
||||
tableBOM.setColumnClass( 16, BigDecimal.class,false); // 16 Forecast
|
||||
tableBOM.autoSize();
|
||||
|
||||
//tableBOM.prepareTable(layout, "", "", false, "");
|
||||
|
||||
// Visual
|
||||
//CompiereColor.setBackground (this);
|
||||
|
||||
|
||||
//tableBOM.getSelectionModel().addListSelectionListener(this);
|
||||
} // dynInit
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Static init
|
||||
* @throws Exception
|
||||
|
@ -285,19 +277,19 @@ public class VTreeBOM extends CPanel
|
|||
private void jbInit ()
|
||||
{
|
||||
this.setLayout (mainLayout);
|
||||
|
||||
// 4Layers - Set initial window dimension
|
||||
this.setPreferredSize(new Dimension(640, 480));
|
||||
|
||||
|
||||
// 4Layers - Set initial window dimension
|
||||
this.setPreferredSize(new Dimension(640, 480));
|
||||
|
||||
//labelUOM.setText (Msg.translate(Env.getCtx(), "C_UOM_ID"));
|
||||
//fieldUOM.setEditable(false);
|
||||
//labelDocument.setText (Msg.translate(Env.getCtx(), "Document"));
|
||||
//labelRevision.setText (Msg.translate(Env.getCtx(), "Revision"));
|
||||
//fieldUOM.setEditable(false);
|
||||
//labelDocument.setText (Msg.translate(Env.getCtx(), "Document"));
|
||||
//labelRevision.setText (Msg.translate(Env.getCtx(), "Revision"));
|
||||
//labelECN.setText (Msg.translate(Env.getCtx(), "ECN"));
|
||||
|
||||
|
||||
labelProduct.setText (Msg.translate(Env.getCtx(), "M_Product_ID"));
|
||||
//implotion.setEnabled (false);
|
||||
implotion.setText (Msg.translate(Env.getCtx(), "Implosion"));
|
||||
//implosion.setEnabled (false);
|
||||
implosion.setText (Msg.translate(Env.getCtx(), "Implosion"));
|
||||
//treeInfo.setText (" ");
|
||||
//bAdd.setToolTipText("Add to Tree");
|
||||
//bAddAll.setToolTipText("Add ALL to Tree");
|
||||
|
@ -311,45 +303,40 @@ public class VTreeBOM extends CPanel
|
|||
northLayout.setAlignment (FlowLayout.LEFT);
|
||||
//
|
||||
this.add (northPanel, BorderLayout.NORTH);
|
||||
|
||||
|
||||
|
||||
northPanel.add (labelProduct, null);
|
||||
northPanel.add (fieldProduct, null);
|
||||
northPanel.add (implotion, null);
|
||||
//northPanel.add (cbAllNodes, null);
|
||||
northPanel.add (implosion, null);
|
||||
//northPanel.add (cbAllNodes, null);
|
||||
northPanel.add (treeInfo, null);
|
||||
|
||||
//northPanel.add (labelUOM, null);
|
||||
//northPanel.add (fieldUOM, null);
|
||||
//northPanel.add (labelDocument, null);
|
||||
//northPanel.add (fieldDocument, null);
|
||||
//northPanel.add (labelRevision, null);
|
||||
//northPanel.add (fieldRevision, null);
|
||||
//northPanel.add (fieldECN, null);
|
||||
|
||||
|
||||
//northPanel.add (labelUOM, null);
|
||||
//northPanel.add (fieldUOM, null);
|
||||
//northPanel.add (labelDocument, null);
|
||||
//northPanel.add (fieldDocument, null);
|
||||
//northPanel.add (labelRevision, null);
|
||||
//northPanel.add (fieldRevision, null);
|
||||
//northPanel.add (fieldECN, null);
|
||||
|
||||
//northPanel.add (bAddAll, null);
|
||||
//northPanel.add (bAdd, null);
|
||||
//northPanel.add (bDelete, null);
|
||||
//northPanel.add (bDeleteAll, null);
|
||||
//
|
||||
|
||||
this.add(southPanel, BorderLayout.SOUTH);
|
||||
|
||||
this.add(southPanel, BorderLayout.SOUTH);
|
||||
southPanel.setLayout(southLayout);
|
||||
confirmPanel.addActionListener(this);
|
||||
confirmPanel.addActionListener(this);
|
||||
southPanel.add(confirmPanel, BorderLayout.SOUTH);
|
||||
//southPanel.add(statusBar, BorderLayout.SOUTH);
|
||||
this.add (splitPane, BorderLayout.CENTER);
|
||||
|
||||
// 4Layers - Set divider location
|
||||
splitPane.setDividerLocation(DIVIDER_LOCATION);
|
||||
|
||||
|
||||
|
||||
|
||||
// 4Layers - Set divider location
|
||||
splitPane.setDividerLocation(DIVIDER_LOCATION);
|
||||
|
||||
//centerList.setSelectionMode (ListSelectionModel.SINGLE_SELECTION);
|
||||
//centerList.addListSelectionListener(this);
|
||||
|
||||
|
||||
} // jbInit
|
||||
|
||||
/**
|
||||
|
@ -361,8 +348,8 @@ public class VTreeBOM extends CPanel
|
|||
m_frame.dispose();
|
||||
m_frame = null;
|
||||
} // dispose
|
||||
|
||||
public void vetoableChange (PropertyChangeEvent e)
|
||||
|
||||
public void vetoableChange (PropertyChangeEvent e)
|
||||
{
|
||||
String name = e.getPropertyName();
|
||||
Object value = e.getNewValue();
|
||||
|
@ -373,8 +360,8 @@ public class VTreeBOM extends CPanel
|
|||
// BPartner
|
||||
if (name.equals("M_Product_ID"))
|
||||
{
|
||||
if (fieldProduct != null)
|
||||
action_loadBOM();
|
||||
if (fieldProduct != null)
|
||||
action_loadBOM();
|
||||
}
|
||||
} // vetoableChange
|
||||
|
||||
|
@ -384,24 +371,24 @@ public class VTreeBOM extends CPanel
|
|||
*/
|
||||
public void actionPerformed (ActionEvent e)
|
||||
{
|
||||
//System.out.println("Evento " + e.getSource());
|
||||
//System.out.println("Source Event" + e.getSource());
|
||||
//System.out.println("Event " + e.getSource());
|
||||
//System.out.println("Source Event" + e.getSource());
|
||||
if (e.getSource().equals(fieldProduct))
|
||||
{
|
||||
{
|
||||
action_loadBOM();
|
||||
}
|
||||
|
||||
if (e.getActionCommand().equals(ConfirmPanel.A_OK))
|
||||
}
|
||||
|
||||
if (e.getActionCommand().equals(ConfirmPanel.A_OK))
|
||||
{
|
||||
action_loadBOM();
|
||||
}
|
||||
// 4Layers - Close window when cancel is pressed
|
||||
if (e.getActionCommand().equals(ConfirmPanel.A_CANCEL))
|
||||
{
|
||||
dispose();
|
||||
}
|
||||
// 4Layers - End
|
||||
|
||||
// 4Layers - Close window when cancel is pressed
|
||||
if (e.getActionCommand().equals(ConfirmPanel.A_CANCEL))
|
||||
{
|
||||
dispose();
|
||||
}
|
||||
// 4Layers - End
|
||||
|
||||
/*else if (e.getSource() == bAddAll)
|
||||
action_treeAddAll();
|
||||
else if (e.getSource() == bAdd)
|
||||
|
@ -410,237 +397,227 @@ public class VTreeBOM extends CPanel
|
|||
action_treeDelete((ListItem)centerList.getSelectedValue());
|
||||
else if (e.getSource() == bDeleteAll)
|
||||
action_treeDeleteAll();*/
|
||||
//super.actionPerformed(e);
|
||||
//super.actionPerformed(e);
|
||||
} // actionPerformed
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: Fill Tree with all nodes
|
||||
*/
|
||||
private void action_loadBOM()
|
||||
{
|
||||
|
||||
Integer Product = (Integer)fieldProduct.getValue();
|
||||
if (Product == null)
|
||||
return;
|
||||
|
||||
|
||||
int M_Product_ID = Product.intValue();
|
||||
|
||||
Integer Product = (Integer)fieldProduct.getValue();
|
||||
if (Product == null)
|
||||
return;
|
||||
|
||||
int M_Product_ID = Product.intValue();
|
||||
|
||||
if (M_Product_ID == 0)
|
||||
return;
|
||||
//System.out.println("Product ID" + Product);
|
||||
X_M_Product M_Product = new X_M_Product(Env.getCtx(), M_Product_ID,"M_Product");
|
||||
X_C_UOM C_UOM = new X_C_UOM(Env.getCtx() , M_Product.getC_UOM_ID(), "C_UOM");
|
||||
DefaultMutableTreeNode parent = new DefaultMutableTreeNode(Msg.translate(Env.getCtx(), "M_Product_ID") + Msg.translate(Env.getCtx(), "Value") + ": " + M_Product.getValue() + " " + Msg.translate(Env.getCtx(), "Name") + ": " +M_Product.getName() + " " + Msg.translate(Env.getCtx(), "C_UOM_ID") + ": " + C_UOM.getName());
|
||||
|
||||
dataBOM.clear();
|
||||
|
||||
if (implosion.isSelected())
|
||||
{
|
||||
QueryDB query = new QueryDB("org.eevolution.model.X_PP_Product_BOMLine");
|
||||
String filter = "M_Product_ID=" + M_Product_ID;
|
||||
List<Object> results = query.execute(filter);
|
||||
Iterator<Object> select = results.iterator();
|
||||
while (select.hasNext())
|
||||
{
|
||||
X_PP_Product_BOMLine bomline = (X_PP_Product_BOMLine) select.next();
|
||||
parent.add(parent(bomline));
|
||||
}
|
||||
m_tree = new JTree(parent);
|
||||
}
|
||||
else
|
||||
{
|
||||
QueryDB query = new QueryDB("org.eevolution.model.X_PP_Product_BOM");
|
||||
String filter = " IsActive='Y' AND M_Product_ID =" + M_Product_ID;
|
||||
List<Object> results = query.execute(filter);
|
||||
Iterator<Object> select = results.iterator();
|
||||
while (select.hasNext())
|
||||
{
|
||||
X_PP_Product_BOM bom = (X_PP_Product_BOM) select.next();
|
||||
parent.add(parent(bom));
|
||||
}
|
||||
|
||||
m_tree = new JTree(parent);
|
||||
}
|
||||
|
||||
m_tree.addTreeSelectionListener(this);
|
||||
//System.out.println("number of children:" + m_tree.getRowCount());
|
||||
|
||||
splitPane.add (m_tree, JSplitPane.LEFT);
|
||||
|
||||
//System.out.println("Table size " + dataBOM.size());
|
||||
|
||||
loadTableBOM();
|
||||
splitPane.add (new JScrollPane(dataPane), JSplitPane.RIGHT);
|
||||
// 4Layers - Set divider location
|
||||
splitPane.setDividerLocation(DIVIDER_LOCATION);
|
||||
// 4Layers - end
|
||||
dataPane.getViewport().add(tableBOM , null);
|
||||
|
||||
if (M_Product_ID == 0)
|
||||
return;
|
||||
//System.out.println("Product ID" + Product);
|
||||
X_M_Product M_Product = new X_M_Product(Env.getCtx(), M_Product_ID,"M_Product");
|
||||
X_C_UOM C_UOM = new X_C_UOM(Env.getCtx() , M_Product.getC_UOM_ID(), "C_UOM");
|
||||
DefaultMutableTreeNode parent = new DefaultMutableTreeNode(Msg.translate(Env.getCtx(), "M_Product_ID") + Msg.translate(Env.getCtx(), "Value") + ": " + M_Product.getValue() + " " + Msg.translate(Env.getCtx(), "Name") + ": " +M_Product.getName() + " " + Msg.translate(Env.getCtx(), "C_UOM_ID") + ": " + C_UOM.getName());
|
||||
|
||||
|
||||
dataBOM.clear();
|
||||
|
||||
if (implotion.isSelected())
|
||||
{
|
||||
QueryDB query = new QueryDB("org.eevolution.model.X_PP_Product_BOMLine");
|
||||
String filter = "M_Product_ID=" + M_Product_ID;
|
||||
java.util.List results = query.execute(filter);
|
||||
Iterator select = results.iterator();
|
||||
while (select.hasNext())
|
||||
{
|
||||
X_PP_Product_BOMLine bomline = (X_PP_Product_BOMLine) select.next();
|
||||
parent.add(parent(bomline));
|
||||
}
|
||||
m_tree = new JTree(parent);
|
||||
}
|
||||
else
|
||||
{
|
||||
QueryDB query = new QueryDB("org.eevolution.model.X_PP_Product_BOM");
|
||||
String filter = " IsActive='Y' AND M_Product_ID =" + M_Product_ID;
|
||||
java.util.List results = query.execute(filter);
|
||||
Iterator select = results.iterator();
|
||||
while (select.hasNext())
|
||||
{
|
||||
X_PP_Product_BOM bom = (X_PP_Product_BOM) select.next();
|
||||
parent.add(parent(bom));
|
||||
}
|
||||
|
||||
m_tree = new JTree(parent);
|
||||
}
|
||||
|
||||
m_tree.addTreeSelectionListener(this);
|
||||
//System.out.println("numero de hijos:" + m_tree.getRowCount());
|
||||
|
||||
splitPane.add (m_tree, JSplitPane.LEFT);
|
||||
|
||||
//System.out.println("Tama<EFBFBD>o de la tabla " + dataBOM.size());
|
||||
|
||||
loadTableBOM();
|
||||
splitPane.add (new JScrollPane(dataPane), JSplitPane.RIGHT);
|
||||
// 4Layers - Set divider location
|
||||
splitPane.setDividerLocation(DIVIDER_LOCATION);
|
||||
// 4Layers - end
|
||||
dataPane.getViewport().add(tableBOM , null);
|
||||
|
||||
} // action_fillTree
|
||||
|
||||
public DefaultMutableTreeNode parent(X_PP_Product_BOMLine bomline)
|
||||
{
|
||||
|
||||
//System.out.println("-------------------------Padre:" + bom.getName());
|
||||
X_M_Product M_Product = new X_M_Product(Env.getCtx(), bomline.getM_Product_ID(),"M_Product");
|
||||
X_C_UOM C_UOM = new X_C_UOM(Env.getCtx() , M_Product.getC_UOM_ID(),"C_UOM");
|
||||
|
||||
X_PP_Product_BOM bomproduct = new X_PP_Product_BOM(Env.getCtx(),bomline.getPP_Product_BOM_ID(),"PP_Product_BOM");
|
||||
DefaultMutableTreeNode parent = new DefaultMutableTreeNode(Msg.translate(Env.getCtx(), "M_Product_ID") + Msg.translate(Env.getCtx(), "key") + ": " + M_Product.getValue() + " " + Msg.translate(Env.getCtx(), "Name") + ": " +M_Product.getName() + " " + Msg.translate(Env.getCtx(), "C_UOM_ID") + ": " + C_UOM.getName());
|
||||
|
||||
|
||||
Vector line = new Vector(17);
|
||||
line.add( new Boolean(false)); // 0 Select
|
||||
line.add( new Boolean(true)); // 1 IsActive
|
||||
line.add( new Integer(bomline.getLine())); // 2 Line
|
||||
line.add( (Timestamp) bomline.getValidFrom()); // 3 ValidDrom
|
||||
line.add( (Timestamp) bomline.getValidTo()); // 4 ValidTo
|
||||
KeyNamePair pp = new KeyNamePair(M_Product.getM_Product_ID(),M_Product.getName());
|
||||
line.add(pp); // 5 M_Product_ID
|
||||
KeyNamePair uom = new KeyNamePair(bomline.getC_UOM_ID(),"");
|
||||
line.add(uom); // 6 C_UOM_ID
|
||||
line.add(new Boolean(bomline.isQtyPercentage())); // 7 IsQtyPorcentage
|
||||
line.add((BigDecimal) bomline.getQtyBatch()); // 8 BatchPercent
|
||||
line.add((BigDecimal) ((bomline.getQtyBOM()!=null) ? bomline.getQtyBOM() : new BigDecimal(0))); // 9 QtyBOM
|
||||
line.add(new Boolean(bomline.isCritical())); // 10 IsCritical
|
||||
line.add( (Integer) bomline.getLeadTimeOffset()); // 11 LTOffSet
|
||||
line.add( (BigDecimal) bomline.getAssay()); // 12 Assay
|
||||
line.add( (BigDecimal) (bomline.getScrap())); // 13 Scrap
|
||||
line.add( (String) bomline.getIssueMethod()); // 14 IssueMethod
|
||||
line.add( (String) bomline.getBackflushGroup()); // 15 BackflushGroup
|
||||
line.add( (BigDecimal) bomline.getForecast()); // 16 Forecast
|
||||
dataBOM.add(line);
|
||||
public DefaultMutableTreeNode parent(X_PP_Product_BOMLine bomline)
|
||||
{
|
||||
|
||||
QueryDB query = new QueryDB("org.eevolution.model.X_PP_Product_BOM");
|
||||
String filter = "M_Product_ID = " + bomproduct.getM_Product_ID();
|
||||
java.util.List results = query.execute(filter);
|
||||
Iterator select = results.iterator();
|
||||
while (select.hasNext())
|
||||
{
|
||||
X_PP_Product_BOM bom = (X_PP_Product_BOM) select.next();
|
||||
X_M_Product component = new X_M_Product(Env.getCtx(), bom.getM_Product_ID(),"M_Product");
|
||||
return component(component);
|
||||
}
|
||||
return parent;
|
||||
}
|
||||
|
||||
public DefaultMutableTreeNode parent(X_PP_Product_BOM bom)
|
||||
{
|
||||
//System.out.println("-------------------------Parent:" + bom.getName());
|
||||
X_M_Product M_Product = new X_M_Product(Env.getCtx(), bomline.getM_Product_ID(),"M_Product");
|
||||
X_C_UOM C_UOM = new X_C_UOM(Env.getCtx() , M_Product.getC_UOM_ID(),"C_UOM");
|
||||
|
||||
X_PP_Product_BOM bomproduct = new X_PP_Product_BOM(Env.getCtx(),bomline.getPP_Product_BOM_ID(),"PP_Product_BOM");
|
||||
DefaultMutableTreeNode parent = new DefaultMutableTreeNode(Msg.translate(Env.getCtx(), "M_Product_ID") + Msg.translate(Env.getCtx(), "key") + ": " + M_Product.getValue() + " " + Msg.translate(Env.getCtx(), "Name") + ": " +M_Product.getName() + " " + Msg.translate(Env.getCtx(), "C_UOM_ID") + ": " + C_UOM.getName());
|
||||
|
||||
Vector<Object> line = new Vector<Object>(17);
|
||||
line.add( new Boolean(false)); // 0 Select
|
||||
line.add( new Boolean(true)); // 1 IsActive
|
||||
line.add( new Integer(bomline.getLine())); // 2 Line
|
||||
line.add( (Timestamp) bomline.getValidFrom()); // 3 ValidDrom
|
||||
line.add( (Timestamp) bomline.getValidTo()); // 4 ValidTo
|
||||
KeyNamePair pp = new KeyNamePair(M_Product.getM_Product_ID(),M_Product.getName());
|
||||
line.add(pp); // 5 M_Product_ID
|
||||
KeyNamePair uom = new KeyNamePair(bomline.getC_UOM_ID(),"");
|
||||
line.add(uom); // 6 C_UOM_ID
|
||||
line.add(new Boolean(bomline.isQtyPercentage())); // 7 IsQtyPorcentage
|
||||
line.add((BigDecimal) bomline.getQtyBatch()); // 8 BatchPercent
|
||||
line.add((BigDecimal) ((bomline.getQtyBOM()!=null) ? bomline.getQtyBOM() : new BigDecimal(0))); // 9 QtyBOM
|
||||
line.add(new Boolean(bomline.isCritical())); // 10 IsCritical
|
||||
line.add( (Integer) bomline.getLeadTimeOffset()); // 11 LTOffSet
|
||||
line.add( (BigDecimal) bomline.getAssay()); // 12 Assay
|
||||
line.add( (BigDecimal) (bomline.getScrap())); // 13 Scrap
|
||||
line.add( (String) bomline.getIssueMethod()); // 14 IssueMethod
|
||||
line.add( (String) bomline.getBackflushGroup()); // 15 BackflushGroup
|
||||
line.add( (BigDecimal) bomline.getForecast()); // 16 Forecast
|
||||
dataBOM.add(line);
|
||||
|
||||
QueryDB query = new QueryDB("org.eevolution.model.X_PP_Product_BOM");
|
||||
String filter = "M_Product_ID = " + bomproduct.getM_Product_ID();
|
||||
List<Object> results = query.execute(filter);
|
||||
Iterator<Object> select = results.iterator();
|
||||
while (select.hasNext())
|
||||
{
|
||||
X_PP_Product_BOM bom = (X_PP_Product_BOM) select.next();
|
||||
X_M_Product component = new X_M_Product(Env.getCtx(), bom.getM_Product_ID(),"M_Product");
|
||||
return component(component);
|
||||
}
|
||||
return parent;
|
||||
}
|
||||
|
||||
public DefaultMutableTreeNode parent(X_PP_Product_BOM bom)
|
||||
{
|
||||
|
||||
// System.out.println("Parent:" + bom.getName());
|
||||
// X_M_Product product = new X_M_Product(Env.getCtx(), bom.getM_Product_ID(),"M_Product");
|
||||
|
||||
//vparent.setValue(m_product_id);
|
||||
String data = Msg.translate(Env.getCtx(), "PP_Product_BOM_ID") + " " + Msg.translate(Env.getCtx(), "Value") + ":"+ bom.getValue()+ " " + Msg.translate(Env.getCtx(), "Name") + ": " + bom.getName();
|
||||
DefaultMutableTreeNode parent = new DefaultMutableTreeNode(data);
|
||||
|
||||
QueryDB query = new QueryDB("org.eevolution.model.X_PP_Product_BOMLine");
|
||||
String filter = "PP_Product_BOM_ID=" + bom.getPP_Product_BOM_ID();
|
||||
List<Object> results = query.execute(filter);
|
||||
Iterator<Object> select = results.iterator();
|
||||
while (select.hasNext())
|
||||
{
|
||||
X_PP_Product_BOMLine bomline = (X_PP_Product_BOMLine) select.next();
|
||||
X_M_Product component = new X_M_Product(Env.getCtx(), bomline.getM_Product_ID(),"M_Product");
|
||||
//System.out.println("Componente :" + component.getValue() + "[" + component.getName() + "]");
|
||||
//component(component);
|
||||
Vector<Object> line = new Vector<Object>(17);
|
||||
line.add( new Boolean(false)); // 0 Select
|
||||
line.add( new Boolean(true)); // 1 IsActive
|
||||
line.add( new Integer(bomline.getLine())); // 2 Line
|
||||
line.add( (Timestamp) bomline.getValidFrom()); // 3 ValidDrom
|
||||
line.add( (Timestamp) bomline.getValidTo()); // 4 ValidTo
|
||||
KeyNamePair pp = new KeyNamePair(component.getM_Product_ID(),component.getName());
|
||||
line.add(pp); // 5 M_Product_ID
|
||||
KeyNamePair uom = new KeyNamePair(bomline.getC_UOM_ID(),"");
|
||||
line.add(uom); // 6 C_UOM_ID
|
||||
line.add(new Boolean(bomline.isQtyPercentage())); // 7 IsQtyPercentage
|
||||
line.add((BigDecimal) bomline.getQtyBatch()); // 8 BatchPercent
|
||||
line.add((BigDecimal) bomline.getQtyBOM()); // 9 QtyBom
|
||||
line.add(new Boolean(bomline.isCritical())); // 10 IsCritical
|
||||
line.add( (Integer) bomline.getLeadTimeOffset()); // 11 LTOffSet
|
||||
line.add( (BigDecimal) bomline.getAssay()); // 12 Assay
|
||||
line.add( (BigDecimal) (bomline.getScrap())); // 13 Scrap
|
||||
line.add( (String) bomline.getIssueMethod()); // 14 IssueMethod
|
||||
line.add( (String) bomline.getBackflushGroup()); // 15 BackflushGroup
|
||||
line.add( (BigDecimal) bomline.getForecast()); // 16 Forecast
|
||||
//line.add(this.);
|
||||
dataBOM.add(line);
|
||||
parent.add(component(component));
|
||||
|
||||
}
|
||||
return parent;
|
||||
}
|
||||
|
||||
public DefaultMutableTreeNode component(X_M_Product M_Product)
|
||||
{
|
||||
|
||||
if (implosion.isSelected())
|
||||
{
|
||||
//vparent.setValue(m_product_id);
|
||||
//String data = Msg.translate(Env.getCtx(), "PP_ProductBOM_ID") + ":" + Msg.translate(Env.getCtx(), "Search Key") + ":"+ bom.getValue()+ " " + Msg.translate(Env.getCtx(), "Name") + ": " + bom.getName();
|
||||
X_C_UOM C_UOM = new X_C_UOM(Env.getCtx(), M_Product.getC_UOM_ID(), "C_UOM");
|
||||
DefaultMutableTreeNode parent = new DefaultMutableTreeNode(Msg.translate(Env.getCtx(), "M_Product_ID") + Msg.translate(Env.getCtx(), "Value") + ": " + M_Product.getValue() + " " + Msg.translate(Env.getCtx(), "Name") + ": " +M_Product.getName() + " " + Msg.translate(Env.getCtx(), "C_UOM_ID") + ": " + C_UOM.getName());
|
||||
|
||||
//System.out.print("Componet Product:" + M_Product.getName());
|
||||
QueryDB query = new QueryDB("org.eevolution.model.X_PP_Product_BOMLine");
|
||||
String filter = "M_Product_ID=" + M_Product.getM_Product_ID();
|
||||
List<Object> results = query.execute(filter);
|
||||
Iterator<Object> select = results.iterator();
|
||||
while (select.hasNext())
|
||||
{
|
||||
X_PP_Product_BOMLine bomline = (X_PP_Product_BOMLine) select.next();
|
||||
//System.out.print("--------------------------------------Componet BOM:" + bom.getName());
|
||||
parent.add(parent(bomline));
|
||||
}
|
||||
|
||||
return parent;
|
||||
}
|
||||
else
|
||||
{
|
||||
//System.out.print("--------------------------------------Component Product:" + M_Product.getName());
|
||||
QueryDB query = new QueryDB("org.eevolution.model.X_PP_Product_BOM");
|
||||
String filter = "Value='" + M_Product.getValue() + "'";
|
||||
X_C_UOM C_UOM = new X_C_UOM(Env.getCtx() , M_Product.getC_UOM_ID(),"C_UOM");
|
||||
List<Object> results = query.execute(filter);
|
||||
Iterator<Object> select = results.iterator();
|
||||
while (select.hasNext())
|
||||
{
|
||||
X_PP_Product_BOM bom = (X_PP_Product_BOM) select.next();
|
||||
//System.out.print("--------------------------------------Component BOM:" + bom.getName());
|
||||
return parent(bom);
|
||||
}
|
||||
|
||||
return new DefaultMutableTreeNode(Msg.translate(Env.getCtx(), "Value") + ": " + M_Product.getValue() + " " + Msg.translate(Env.getCtx(), "Name") + ": " +M_Product.getName() + " " + Msg.translate(Env.getCtx(), "C_UOM_ID") + ": " + C_UOM.getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void valueChanged(TreeSelectionEvent event)
|
||||
{
|
||||
//currentSelectionField.setText("Current Selection: " + tree.getLastSelectedPathComponent().toString());
|
||||
}
|
||||
|
||||
//System.out.println("Padre:" + bom.getName());
|
||||
X_M_Product product = new X_M_Product(Env.getCtx(), bom.getM_Product_ID(),"M_Product");
|
||||
|
||||
//vparent.setValue(m_product_id);
|
||||
String data = Msg.translate(Env.getCtx(), "PP_Product_BOM_ID") + " " + Msg.translate(Env.getCtx(), "Value") + ":"+ bom.getValue()+ " " + Msg.translate(Env.getCtx(), "Name") + ": " + bom.getName();
|
||||
DefaultMutableTreeNode parent = new DefaultMutableTreeNode(data);
|
||||
|
||||
QueryDB query = new QueryDB("org.eevolution.model.X_PP_Product_BOMLine");
|
||||
String filter = "PP_Product_BOM_ID=" + bom.getPP_Product_BOM_ID();
|
||||
java.util.List results = query.execute(filter);
|
||||
Iterator select = results.iterator();
|
||||
while (select.hasNext())
|
||||
{
|
||||
X_PP_Product_BOMLine bomline = (X_PP_Product_BOMLine) select.next();
|
||||
X_M_Product component = new X_M_Product(Env.getCtx(), bomline.getM_Product_ID(),"M_Product");
|
||||
//System.out.println("Componente :" + component.getValue() + "[" + component.getName() + "]");
|
||||
//component(component);
|
||||
Vector line = new Vector(17);
|
||||
line.add( new Boolean(false)); // 0 Select
|
||||
line.add( new Boolean(true)); // 1 IsActive
|
||||
line.add( new Integer(bomline.getLine())); // 2 Line
|
||||
line.add( (Timestamp) bomline.getValidFrom()); // 3 ValidDrom
|
||||
line.add( (Timestamp) bomline.getValidTo()); // 4 ValidTo
|
||||
KeyNamePair pp = new KeyNamePair(component.getM_Product_ID(),component.getName());
|
||||
line.add(pp); // 5 M_Product_ID
|
||||
KeyNamePair uom = new KeyNamePair(bomline.getC_UOM_ID(),"");
|
||||
line.add(uom); // 6 C_UOM_ID
|
||||
line.add(new Boolean(bomline.isQtyPercentage())); // 7 IsQtyPercentage
|
||||
line.add((BigDecimal) bomline.getQtyBatch()); // 8 BatchPercent
|
||||
line.add((BigDecimal) bomline.getQtyBOM()); // 9 QtyBom
|
||||
line.add(new Boolean(bomline.isCritical())); // 10 IsCritical
|
||||
line.add( (Integer) bomline.getLeadTimeOffset()); // 11 LTOffSet
|
||||
line.add( (BigDecimal) bomline.getAssay()); // 12 Assay
|
||||
line.add( (BigDecimal) (bomline.getScrap())); // 13 Scrap
|
||||
line.add( (String) bomline.getIssueMethod()); // 14 IssueMethod
|
||||
line.add( (String) bomline.getBackflushGroup()); // 15 BackflushGroup
|
||||
line.add( (BigDecimal) bomline.getForecast()); // 16 Forecast
|
||||
//line.add(this.);
|
||||
dataBOM.add(line);
|
||||
parent.add(component(component));
|
||||
|
||||
}
|
||||
return parent;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public DefaultMutableTreeNode component(X_M_Product M_Product)
|
||||
{
|
||||
|
||||
if (implotion.isSelected())
|
||||
{
|
||||
//vparent.setValue(m_product_id);
|
||||
//String data = Msg.translate(Env.getCtx(), "PP_ProductBOM_ID") + ":" + Msg.translate(Env.getCtx(), "Search Key") + ":"+ bom.getValue()+ " " + Msg.translate(Env.getCtx(), "Name") + ": " + bom.getName();
|
||||
X_C_UOM C_UOM = new X_C_UOM(Env.getCtx() , M_Product.getC_UOM_ID(),"C_UOM");
|
||||
DefaultMutableTreeNode parent = new DefaultMutableTreeNode(Msg.translate(Env.getCtx(), "M_Product_ID") + Msg.translate(Env.getCtx(), "Value") + ": " + M_Product.getValue() + " " + Msg.translate(Env.getCtx(), "Name") + ": " +M_Product.getName() + " " + Msg.translate(Env.getCtx(), "C_UOM_ID") + ": " + C_UOM.getName());
|
||||
|
||||
//System.out.print("Componet Product:" + M_Product.getName());
|
||||
QueryDB query = new QueryDB("org.eevolution.model.X_PP_Product_BOMLine");
|
||||
String filter = "M_Product_ID=" + M_Product.getM_Product_ID();
|
||||
java.util.List results = query.execute(filter);
|
||||
Iterator select = results.iterator();
|
||||
while (select.hasNext())
|
||||
{
|
||||
X_PP_Product_BOMLine bomline = (X_PP_Product_BOMLine) select.next();
|
||||
//System.out.print("--------------------------------------Componet BOM:" + bom.getName());
|
||||
parent.add(parent(bomline));
|
||||
}
|
||||
|
||||
return parent;
|
||||
}
|
||||
else
|
||||
{
|
||||
//System.out.print("--------------------------------------Componet Product:" + M_Product.getName());
|
||||
QueryDB query = new QueryDB("org.eevolution.model.X_PP_Product_BOM");
|
||||
String filter = "Value='" + M_Product.getValue() + "'";
|
||||
X_C_UOM C_UOM = new X_C_UOM(Env.getCtx() , M_Product.getC_UOM_ID(),"C_UOM");
|
||||
java.util.List results = query.execute(filter);
|
||||
Iterator select = results.iterator();
|
||||
while (select.hasNext())
|
||||
{
|
||||
X_PP_Product_BOM bom = (X_PP_Product_BOM) select.next();
|
||||
//System.out.print("--------------------------------------Componet BOM:" + bom.getName());
|
||||
return parent(bom);
|
||||
}
|
||||
|
||||
return new DefaultMutableTreeNode(Msg.translate(Env.getCtx(), "Value") + ": " + M_Product.getValue() + " " + Msg.translate(Env.getCtx(), "Name") + ": " +M_Product.getName() + " " + Msg.translate(Env.getCtx(), "C_UOM_ID") + ": " + C_UOM.getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void valueChanged(TreeSelectionEvent event)
|
||||
{
|
||||
//currentSelectionField.setText("Current Selection: " + tree.getLastSelectedPathComponent().toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* List Selection Listener
|
||||
* @param e event
|
||||
*/
|
||||
public void valueChanged (ListSelectionEvent e)
|
||||
{
|
||||
|
||||
|
||||
|
||||
if (e.getValueIsAdjusting())
|
||||
if (e.getValueIsAdjusting())
|
||||
return;
|
||||
|
||||
} // valueChanged
|
||||
|
||||
|
||||
/**
|
||||
* VTreePanel Changed
|
||||
* @param e event
|
||||
|
@ -665,7 +642,7 @@ public class VTreeBOM extends CPanel
|
|||
|
||||
/**
|
||||
* Action: Add Node to Tree
|
||||
*/
|
||||
*/
|
||||
private void action_treeAdd(ListItem item)
|
||||
{
|
||||
log.info( "VTreeMaintenance.action_treeAdd " + item);
|
||||
|
@ -673,7 +650,7 @@ public class VTreeBOM extends CPanel
|
|||
{
|
||||
//centerTree.nodeChanged(true, item.id, item.name,
|
||||
// item.description, item.isSummary, item.imageIndicator);
|
||||
/* if (m_tree.isProduct())
|
||||
/* if (m_tree.isProduct())
|
||||
{
|
||||
MTree_NodePR node = new MTree_NodePR (m_tree, item.id);
|
||||
node.save();
|
||||
|
@ -695,7 +672,7 @@ public class VTreeBOM extends CPanel
|
|||
}*/
|
||||
}
|
||||
} // action_treeAdd
|
||||
|
||||
|
||||
/**
|
||||
* Action: Delete Node from Tree
|
||||
*/
|
||||
|
@ -732,11 +709,11 @@ public class VTreeBOM extends CPanel
|
|||
}*/
|
||||
}
|
||||
} // action_treeDelete
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: Add All Nodes to Tree
|
||||
*/
|
||||
*/
|
||||
private void action_treeAddAll()
|
||||
{
|
||||
log.info( "VTreeMaintenance.action_treeAddAll");
|
||||
|
@ -749,10 +726,10 @@ public class VTreeBOM extends CPanel
|
|||
action_treeAdd(item);
|
||||
}*/
|
||||
} // action_treeAddAll
|
||||
|
||||
|
||||
/**
|
||||
* Action: Delete All Nodes from Tree
|
||||
*/
|
||||
*/
|
||||
private void action_treeDeleteAll()
|
||||
{
|
||||
log.info( "VTreeMaintenance.action_treeDeleteAll");
|
||||
|
@ -765,13 +742,13 @@ public class VTreeBOM extends CPanel
|
|||
action_treeDelete(item);
|
||||
}*/
|
||||
}
|
||||
|
||||
public void tableChanged(TableModelEvent e) {
|
||||
}
|
||||
|
||||
|
||||
public void tableChanged(TableModelEvent e) {
|
||||
}
|
||||
|
||||
|
||||
// action_treeDeleteAll
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Tree Maintenance List Item
|
||||
*/
|
||||
|
@ -785,13 +762,13 @@ public class VTreeBOM extends CPanel
|
|||
this.isSummary = isSummary;
|
||||
this.imageIndicator = imageIndicator;
|
||||
} // ListItem
|
||||
|
||||
|
||||
public int id;
|
||||
public String name;
|
||||
public String description;
|
||||
public boolean isSummary;
|
||||
public String imageIndicator; // Menu - Action
|
||||
|
||||
|
||||
/**
|
||||
* To String
|
||||
* @return String Representation
|
||||
|
@ -803,7 +780,7 @@ public class VTreeBOM extends CPanel
|
|||
retValue += " (" + description + ")";
|
||||
return retValue;
|
||||
} // toString
|
||||
|
||||
|
||||
} // ListItem
|
||||
|
||||
} // VTreeMaintenance
|
||||
|
||||
} // VTreeMaintenance
|
Loading…
Reference in New Issue