use of org.compiere.model.GridFieldVO in project adempiere by adempiere.
the class VOrderReceiptIssue method fillPicks.
// init
/**
* Fill Picks Column_ID from C_Order This is only run as part of the windows
* initialization process
*
* @throws Exception
* if Lookups cannot be initialized
*/
private void fillPicks() throws Exception {
Properties ctx = Env.getCtx();
// Base Language
Language language = Language.getLoginLanguage();
MLookup orderL = MLookupFactory.get(ctx, m_WindowNo, MColumn.getColumn_ID(MPPOrder.Table_Name, MPPOrder.COLUMNNAME_PP_Order_ID), DisplayType.Search, language, "PP_Order_ID", 0, false, "PP_Order.DocStatus = '" + MPPOrder.DOCACTION_Complete + "'");
orderField = new VLookup("PP_Order_ID", false, false, true, orderL);
orderField.setBackground(AdempierePLAF.getInfoBackground());
orderField.addVetoableChangeListener(this);
MLookup resourceL = MLookupFactory.get(ctx, m_WindowNo, 0, MColumn.getColumn_ID(MPPOrder.Table_Name, MPPOrder.COLUMNNAME_S_Resource_ID), DisplayType.TableDir);
resourceField = new VLookup("S_Resource_ID", false, false, false, resourceL);
MLookup warehouseL = MLookupFactory.get(ctx, m_WindowNo, 0, MColumn.getColumn_ID(MPPOrder.Table_Name, MPPOrder.COLUMNNAME_M_Warehouse_ID), DisplayType.TableDir);
warehouseField = new VLookup("M_Warehouse_ID", false, false, false, warehouseL);
MLookup productL = MLookupFactory.get(ctx, m_WindowNo, 0, MColumn.getColumn_ID(MPPOrder.Table_Name, MPPOrder.COLUMNNAME_M_Product_ID), DisplayType.TableDir);
productField = new VLookup("M_Product_ID", false, false, false, productL);
MLookup uomL = MLookupFactory.get(ctx, m_WindowNo, 0, MColumn.getColumn_ID(MPPOrder.Table_Name, MPPOrder.COLUMNNAME_C_UOM_ID), DisplayType.TableDir);
uomField = new VLookup("C_UOM_ID", false, false, false, uomL);
MLookup uomorderL = MLookupFactory.get(ctx, m_WindowNo, 0, MColumn.getColumn_ID(MPPOrder.Table_Name, MPPOrder.COLUMNNAME_C_UOM_ID), DisplayType.TableDir);
uomorderField = new VLookup("C_UOM_ID", false, false, false, uomorderL);
MLocatorLookup locatorL = new MLocatorLookup(ctx, m_WindowNo);
locatorField = new VLocator("M_Locator_ID", true, false, true, locatorL, m_WindowNo);
MPAttributeLookup attributeL = new MPAttributeLookup(ctx, m_WindowNo);
attribute = new VPAttribute(false, false, true, m_WindowNo, attributeL, false);
attribute.setValue(0);
// Tab, Window
int m_Window = MWindow.getWindow_ID("Manufacturing Order");
GridFieldVO vo = GridFieldVO.createStdField(ctx, m_WindowNo, 0, m_Window, MTab.getTab_ID(m_Window, "Order"), false, false, false);
// M_AttributeSetInstance_ID
vo.AD_Column_ID = MColumn.getColumn_ID(MPPOrder.Table_Name, MPPOrder.COLUMNNAME_M_AttributeSetInstance_ID);
GridField field = new GridField(vo);
attribute.setField(field);
// 4Layers - Further init
scrapQtyField.setValue(Env.ZERO);
rejectQty.setValue(Env.ZERO);
// 4Layers - end
pickcombo.addItem(new KeyNamePair(1, Msg.parseTranslation(Env.getCtx(), "@IsBackflush@")));
pickcombo.addItem(new KeyNamePair(2, Msg.parseTranslation(Env.getCtx(), "@OnlyIssue@")));
pickcombo.addItem(new KeyNamePair(3, Msg.parseTranslation(Env.getCtx(), "@OnlyReceiptProduct@")));
pickcombo.addActionListener(this);
Process.addActionListener(this);
toDeliverQty.addActionListener(this);
scrapQtyField.addActionListener(this);
}
use of org.compiere.model.GridFieldVO in project adempiere by adempiere.
the class Browser method getSQLWhere.
/**
* FR [ 245 ]
* FR [ 344 ] Add ColumnSQL like columns
* Get Where Clause
* @param refresh
* @return
*/
public String getSQLWhere(boolean refresh) {
if (!refresh)
return m_whereClause;
StringBuilder sql = new StringBuilder(p_whereClause);
// Valid null
LinkedHashMap<String, GridField> panelParameters = getPanelParameters();
if (panelParameters == null || panelParameters.size() == 0) {
m_whereClause = sql.toString();
return m_whereClause;
}
//
parametersValues = new ArrayList<Object>();
parameters = new ArrayList<Object>();
boolean onRange = false;
for (Entry<String, GridField> entry : panelParameters.entrySet()) {
GridField editor = (GridField) entry.getValue();
GridFieldVO field = editor.getVO();
if (!onRange) {
if (editor.getValue() != null && !editor.getValue().toString().isEmpty() && !field.IsRange) {
sql.append(" AND ");
if (DisplayType.String == field.displayType) {
if (field.ColumnName.equals("Value") || field.ColumnName.equals("DocumentNo")) {
String value = (String) editor.getValue();
if (value.contains(",")) {
value = value.replace(" ", "");
String inStr = new String(value);
StringBuffer outStr = new StringBuffer("(");
int i = inStr.indexOf(',');
while (i != -1) {
outStr.append("'" + inStr.substring(0, i) + "',");
inStr = inStr.substring(i + 1, inStr.length());
i = inStr.indexOf(',');
}
outStr.append("'" + inStr + "')");
// BR [ 342 ]
sql.append(field.ColumnSQL).append(" IN ").append(outStr);
}
} else {
sql.append(field.ColumnSQL).append(" LIKE ? ");
parameters.add(field.ColumnSQL);
parametersValues.add("%" + editor.getValue() + "%");
}
} else {
sql.append(field.ColumnSQL).append("=? ");
parameters.add(field.ColumnSQL);
parametersValues.add(editor.getValue());
}
} else if (editor.getValue() != null && !editor.getValue().toString().isEmpty() && field.IsRange) {
sql.append(" AND ");
//sql.append(field.Help).append(" BETWEEN ?");
sql.append(field.ColumnSQL).append(" >= ? ");
parameters.add(field.ColumnSQL);
parametersValues.add(editor.getValue());
onRange = true;
} else if (editor.getValue() == null && field.IsRange) {
onRange = true;
} else
continue;
} else if (editor.getValue() != null && !editor.getValue().toString().isEmpty()) {
//sql.append(" AND ? ");
sql.append(" AND ").append(field.ColumnSQL).append(" <= ? ");
parameters.add(field.ColumnSQL);
parametersValues.add(editor.getValue());
onRange = false;
} else
onRange = false;
}
m_whereClause = sql.toString();
return sql.toString();
}
Aggregations