VTreeBOM:
* improved product and BOM description as discussed here: https://sourceforge.net/forum/message.php?msg_id=5178629 * automatically reload BOM if product or implosion fields changed
This commit is contained in:
parent
562e87a0bc
commit
dd2f287011
|
@ -181,8 +181,15 @@ public class VTreeBOM extends CPanel implements FormPanel, ActionListener,
|
||||||
MColumn.getColumn_ID(MProduct.Table_Name, "M_Product_ID"),
|
MColumn.getColumn_ID(MProduct.Table_Name, "M_Product_ID"),
|
||||||
DisplayType.Search, language, MProduct.COLUMNNAME_M_Product_ID, 0, false,
|
DisplayType.Search, language, MProduct.COLUMNNAME_M_Product_ID, 0, false,
|
||||||
" M_Product.IsSummary = 'N'");
|
" M_Product.IsSummary = 'N'");
|
||||||
fieldProduct = new VLookup ("M_Product_ID", false, false, true, m_fieldProduct);
|
fieldProduct = new VLookup ("M_Product_ID", false, false, true, m_fieldProduct) {
|
||||||
fieldProduct.addActionListener(this);
|
private static final long serialVersionUID = 1L;
|
||||||
|
public void setValue(Object value) {
|
||||||
|
super.setValue(value);
|
||||||
|
action_loadBOM();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
implosion.addActionListener(this);
|
||||||
|
|
||||||
loadTableBOM();
|
loadTableBOM();
|
||||||
splitPane.add (new JScrollPane(dataPane), JSplitPane.RIGHT);
|
splitPane.add (new JScrollPane(dataPane), JSplitPane.RIGHT);
|
||||||
|
@ -368,13 +375,10 @@ public class VTreeBOM extends CPanel implements FormPanel, ActionListener,
|
||||||
*/
|
*/
|
||||||
public void actionPerformed (ActionEvent e)
|
public void actionPerformed (ActionEvent e)
|
||||||
{
|
{
|
||||||
//System.out.println("Event " + e.getSource());
|
if (e.getSource() == implosion)
|
||||||
//System.out.println("Source Event" + e.getSource());
|
{
|
||||||
if (e.getSource().equals(fieldProduct))
|
|
||||||
{
|
|
||||||
action_loadBOM();
|
action_loadBOM();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.getActionCommand().equals(ConfirmPanel.A_OK))
|
if (e.getActionCommand().equals(ConfirmPanel.A_OK))
|
||||||
{
|
{
|
||||||
action_loadBOM();
|
action_loadBOM();
|
||||||
|
@ -729,30 +733,24 @@ public class VTreeBOM extends CPanel implements FormPanel, ActionListener,
|
||||||
|
|
||||||
private String productSummary(MProduct product, boolean isLeaf) {
|
private String productSummary(MProduct product, boolean isLeaf) {
|
||||||
MUOM uom = MUOM.get(getCtx(), product.getC_UOM_ID());
|
MUOM uom = MUOM.get(getCtx(), product.getC_UOM_ID());
|
||||||
|
String value = product.getValue();
|
||||||
|
String name = product.get_Translation(MProduct.COLUMNNAME_Name);
|
||||||
//
|
//
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer(value);
|
||||||
if (!isLeaf) {
|
if (name != null && !value.equals(name))
|
||||||
sb.append(Msg.getElement(getCtx(), "M_Product_ID"));
|
sb.append("_").append(product.getName());
|
||||||
}
|
sb.append(" [").append(uom.get_Translation(MUOM.COLUMNNAME_UOMSymbol)).append("]");
|
||||||
//
|
//
|
||||||
// Product Value
|
return sb.toString();
|
||||||
sb.append(" ");
|
}
|
||||||
sb.append(Msg.getElement(getCtx(), "Value")).append(": ").append(product.getValue());
|
|
||||||
|
private String productSummary(MPPProductBOM bom) {
|
||||||
|
String value = bom.getValue();
|
||||||
|
String name = bom.get_Translation(MPPProductBOM.COLUMNNAME_Name);
|
||||||
//
|
//
|
||||||
// Product Name
|
StringBuffer sb = new StringBuffer(value);
|
||||||
sb.append(" ");
|
if (name != null && !name.equals(value))
|
||||||
sb.append(Msg.getElement(getCtx(), "Name"))
|
sb.append("_").append(name);
|
||||||
.append(": ")
|
|
||||||
.append(product.get_Translation(MProduct.COLUMNNAME_Name));
|
|
||||||
;
|
|
||||||
//
|
|
||||||
// UOM
|
|
||||||
if (uom != null) {
|
|
||||||
sb.append(" ")
|
|
||||||
.append(Msg.getElement(getCtx(), "C_UOM_ID"))
|
|
||||||
.append(": ")
|
|
||||||
.append(uom.get_Translation(MUOM.COLUMNNAME_Name));
|
|
||||||
}
|
|
||||||
//
|
//
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
@ -768,15 +766,6 @@ public class VTreeBOM extends CPanel implements FormPanel, ActionListener,
|
||||||
return Product.intValue();
|
return Product.intValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String productSummary(MPPProductBOM bom) {
|
|
||||||
return ""
|
|
||||||
+ Msg.getElement(getCtx(), "PP_Product_BOM_ID")
|
|
||||||
+ " " + Msg.getElement(getCtx(), "Value") + ":" + bom.getValue()
|
|
||||||
+ " " + Msg.getElement(getCtx(), "Name") + ": "
|
|
||||||
+ bom.get_Translation(MPPProductBOM.COLUMNNAME_Name)
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<MPPProductBOM> getBOMs(String productValue)
|
private List<MPPProductBOM> getBOMs(String productValue)
|
||||||
{
|
{
|
||||||
int ad_client_id = Env.getAD_Client_ID(getCtx());
|
int ad_client_id = Env.getAD_Client_ID(getCtx());
|
||||||
|
|
Loading…
Reference in New Issue