use of org.compiere.util.KeyNamePair in project adempiere by adempiere.
the class VPAttributeDialog method actionPerformed.
// dispose
/**
* ActionListener
* @param e event
*/
public void actionPerformed(ActionEvent e) {
// Select Instance
if (e.getSource() == bSelect) {
if (cmd_select())
dispose();
} else // New/Edit
if (e.getSource() == cbNewEdit) {
cmd_newEdit();
} else // Select Lot from existing
if (e.getSource() == fieldLot) {
KeyNamePair pp = (KeyNamePair) fieldLot.getSelectedItem();
if (pp != null && pp.getKey() != -1) {
fieldLotString.setText(pp.getName());
fieldLotString.setEditable(false);
m_masi.setM_Lot_ID(pp.getKey());
} else {
fieldLotString.setEditable(true);
m_masi.setM_Lot_ID(0);
}
} else // Create New Lot
if (e.getSource() == bLot) {
KeyNamePair pp = m_masi.createLot(m_M_Product_ID);
if (pp != null) {
fieldLot.addItem(pp);
fieldLot.setSelectedItem(pp);
fieldLotString.setText(m_masi.getLot());
fieldLotString.setEditable(false);
}
} else // Create New SerNo
if (e.getSource() == bSerNo) {
fieldSerNo.setText(m_masi.getSerNo(true));
} else // OK
if (e.getActionCommand().equals(ConfirmPanel.A_OK)) {
if (saveSelection())
dispose();
} else // Cancel
if (e.getActionCommand().equals(ConfirmPanel.A_CANCEL)) {
if (m_productWindow || !m_productASI) {
m_changed = m_M_AttributeSetInstance_ID != 0;
m_M_AttributeSetInstance_ID = 0;
m_M_Locator_ID = 0;
}
dispose();
} else // Zoom M_Lot
if (e.getSource() == mZoom) {
cmd_zoom();
} else
log.log(Level.SEVERE, "not found - " + e);
}
use of org.compiere.util.KeyNamePair in project adempiere by adempiere.
the class WTreeBOM method parent.
public DefaultTreeNode parent(MPPProductBOM bom) {
DefaultTreeNode parent = new DefaultTreeNode(productSummary(bom), new ArrayList());
for (MPPProductBOMLine bomline : bom.getLines()) {
MProduct component = MProduct.get(getCtx(), bomline.getM_Product_ID());
Vector<Object> line = new Vector<Object>(17);
// 0 Select
line.add(new Boolean(false));
// 1 IsActive
line.add(new Boolean(true));
// 2 Line
line.add(new Integer(bomline.getLine()));
// 3 ValidDrom
line.add((Timestamp) bomline.getValidFrom());
// 4 ValidTo
line.add((Timestamp) bomline.getValidTo());
KeyNamePair pp = new KeyNamePair(component.getM_Product_ID(), component.getName());
// 5 M_Product_ID
line.add(pp);
KeyNamePair uom = new KeyNamePair(bomline.getC_UOM_ID(), bomline.getC_UOM().getUOMSymbol());
// 6 C_UOM_ID
line.add(uom);
// 7 IsQtyPercentage
line.add(new Boolean(bomline.isQtyPercentage()));
// 8 BatchPercent
line.add((BigDecimal) bomline.getQtyBatch());
// 9 QtyBom
line.add((BigDecimal) bomline.getQtyBOM());
// 10 IsCritical
line.add(new Boolean(bomline.isCritical()));
// 11 LTOffSet
line.add((Integer) bomline.getLeadTimeOffset());
// 12 Assay
line.add((BigDecimal) bomline.getAssay());
// 13 Scrap
line.add((BigDecimal) (bomline.getScrap()));
// 14 IssueMethod
line.add((String) bomline.getIssueMethod());
// 15 BackflushGroup
line.add((String) bomline.getBackflushGroup());
// 16 Forecast
line.add((BigDecimal) bomline.getForecast());
dataBOM.add(line);
parent.getChildren().add(component(component));
}
return parent;
}
use of org.compiere.util.KeyNamePair in project adempiere by adempiere.
the class WMRPDetailed method setMRP.
private void setMRP() {
int M_Product_ID = getM_Product_ID();
int M_AttributeSetInstance_ID = getM_AttributeSetInstance_ID();
int M_Warehouse_ID = getM_Warehouse_ID();
// Check Product (mandatory):
if (M_Product_ID <= 0)
return;
//
// Set Quantities
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
StringBuffer sql = new StringBuffer("SELECT ").append("BOMQtyOnHandASI(M_Product_ID,?,?,?) as qtyonhand, ").append("BOMQtyReservedASI(M_Product_ID,?,?,?) as qtyreserved, ").append("BOMQtyAvailableASI(M_Product_ID,?,?,?) as qtyavailable, ").append("BOMQtyOrderedASI(M_Product_ID,?,?,?) as qtyordered").append(" FROM M_Product WHERE M_Product_ID=?");
pstmt = DB.prepareStatement(sql.toString(), null);
DB.setParameters(pstmt, new Object[] { getM_AttributeSetInstance_ID(), getM_Warehouse_ID(), 0, getM_AttributeSetInstance_ID(), getM_Warehouse_ID(), 0, getM_AttributeSetInstance_ID(), getM_Warehouse_ID(), 0, getM_AttributeSetInstance_ID(), getM_Warehouse_ID(), 0, getM_Product_ID() });
rs = pstmt.executeQuery();
while (rs.next()) {
fOnhand.setValue(rs.getBigDecimal(1));
fReserved.setValue(rs.getBigDecimal(2));
fAvailable.setValue(rs.getBigDecimal(3));
fOrdered.setValue(rs.getBigDecimal(4));
}
} catch (SQLException ex) {
throw new DBException(ex);
} finally {
DB.close(rs, pstmt);
rs = null;
pstmt = null;
}
//
// Set UOM:
int uom_id = MProduct.get(getCtx(), M_Product_ID).getC_UOM_ID();
MUOM um = MUOM.get(getCtx(), uom_id);
KeyNamePair kum = new KeyNamePair(um.getC_UOM_ID(), um.get_Translation(MUOM.COLUMNNAME_Name));
fUOM.setText(kum.toString());
//
// Set Replenish Min Level:
BigDecimal replenishLevelMin = Env.ZERO;
if (getM_Warehouse_ID() > 0) {
String sql = "SELECT Level_Min FROM M_Replenish" + " WHERE AD_Client_ID=? AND M_Product_ID=? AND M_Warehouse_ID=?";
replenishLevelMin = DB.getSQLValueBD(null, sql, AD_Client_ID, M_Product_ID, M_Warehouse_ID);
}
fReplenishMin.setValue(replenishLevelMin);
}
use of org.compiere.util.KeyNamePair in project adempiere by adempiere.
the class RadioButtonTreeCellRenderer method parent.
public DefaultMutableTreeNode parent(MPPProductBOM bom) {
log.fine("Parent:" + bom.getName());
MProduct product = MProduct.get(Env.getCtx(), bom.getM_Product_ID());
//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(new nodeUserObject(data, product, bom, null));
String whereClause = "PP_Product_BOM_ID=?";
List<MPPProductBOMLine> bomlines = new Query(Env.getCtx(), MPPProductBOMLine.Table_Name, whereClause, null).setParameters(new Object[] { bom.getPP_Product_BOM_ID() }).list();
for (MPPProductBOMLine bomline : bomlines) {
MProduct component = MProduct.get(Env.getCtx(), bomline.getM_Product_ID());
//System.out.println("Componente :" + component.getValue() + "[" + component.getName() + "]");
//component(component);
Vector<Comparable<?>> line = new Vector<Comparable<?>>(17);
// 0 Select
line.add(new Boolean(false));
// 1 IsActive
line.add(new Boolean(true));
// 2 Line
line.add(new Integer(bomline.getLine()));
// 3 ValidDrom
line.add((Timestamp) bomline.getValidFrom());
// 4 ValidTo
line.add((Timestamp) bomline.getValidTo());
KeyNamePair pp = new KeyNamePair(component.getM_Product_ID(), component.getName());
// 5 M_Product_ID
line.add(pp);
KeyNamePair uom = new KeyNamePair(bomline.getC_UOM_ID(), "");
// 6 C_UOM_ID
line.add(uom);
// 7 IsQtyPercentage
line.add(new Boolean(bomline.isQtyPercentage()));
// 8 BatchPercent
line.add((BigDecimal) bomline.getQtyBatch());
// 9 QtyBom
line.add((BigDecimal) bomline.getQtyBOM());
// 10 IsCritical
line.add(new Boolean(bomline.isCritical()));
// 11 LTOffSet
line.add((Integer) bomline.getLeadTimeOffset());
// 12 Assay
line.add((BigDecimal) bomline.getAssay());
// 13 Scrap
line.add((BigDecimal) (bomline.getScrap()));
// 14 IssueMethod
line.add((String) bomline.getIssueMethod());
// 15 BackflushGroup
line.add((String) bomline.getBackflushGroup());
// 16 Forecast
line.add((BigDecimal) bomline.getForecast());
//line.add(this.);
dataBOM.add(line);
parent.add(component(component, bom, bomline));
}
return parent;
}
use of org.compiere.util.KeyNamePair in project adempiere by adempiere.
the class WFEditor method initForm.
@Override
protected void initForm() {
this.setHeight("100%");
Borderlayout layout = new Borderlayout();
layout.setStyle("width: 100%; height: 100%; position: absolute;");
appendChild(layout);
String sql = MRole.getDefault().addAccessSQL("SELECT AD_Workflow_ID, Name FROM AD_Workflow ORDER BY 2", "AD_Workflow", MRole.SQL_NOTQUALIFIED, // all
MRole.SQL_RO);
KeyNamePair[] pp = DB.getKeyNamePairs(sql, true);
workflowList = ListboxFactory.newDropdownListbox();
for (KeyNamePair knp : pp) {
workflowList.addItem(knp);
}
workflowList.addEventListener(Events.ON_SELECT, this);
North north = new North();
layout.appendChild(north);
north.appendChild(workflowList);
workflowList.setStyle("margin-left: 10px; margin-top: 5px;");
north.setHeight("30px");
imageMap = new Imagemap();
Center center = new Center();
layout.appendChild(center);
center.setAutoscroll(true);
// center.setHflex("true");
center.setVflex("true");
center.appendChild(imageMap);
ConfirmPanel confirmPanel = new ConfirmPanel(true);
confirmPanel.addActionListener(this);
South south = new South();
layout.appendChild(south);
south.appendChild(confirmPanel);
south.setHeight("36px");
}
Aggregations