use of org.compiere.model.Query in project adempiere by adempiere.
the class MWFNode method loadNext.
// setClientOrg
/**
* Load Next
*/
private void loadNext() {
m_next = new Query(getCtx(), MWFNodeNext.Table_Name, "AD_WF_Node_ID=?", get_TrxName()).setParameters(new Object[] { get_ID() }).setOnlyActiveRecords(true).setOrderBy(MWFNodeNext.COLUMNNAME_SeqNo).list();
boolean splitAnd = SPLITELEMENT_AND.equals(getSplitElement());
for (MWFNodeNext next : m_next) {
next.setFromSplitAnd(splitAnd);
}
log.fine("#" + m_next.size());
}
use of org.compiere.model.Query in project adempiere by adempiere.
the class VFactReconcile method resetReconciliation.
// zoom
private void resetReconciliation() {
log.info("");
//
miniTable.stopEditor(true);
if (miniTable.getRowCount() == 0)
return;
miniTable.setRowSelectionInterval(0, 0);
calculateSelection();
if (m_noSelected == 0)
return;
for (int r = 0; r < miniTable.getModel().getRowCount(); r++) {
if (((IDColumn) miniTable.getModel().getValueAt(r, idColIndex)).isSelected()) {
int factId = ((IDColumn) miniTable.getModel().getValueAt(r, idColIndex)).getRecord_ID();
MFactReconciliation rec = new Query(Env.getCtx(), MFactReconciliation.Table_Name, "Fact_Acct_ID = ?", null).setParameters(new Object[] { factId }).first();
if (rec == null) {
continue;
}
rec.setMatchCode(null);
rec.saveEx();
((DefaultTableModel) miniTable.getModel()).removeRow(r--);
}
}
}
use of org.compiere.model.Query in project adempiere by adempiere.
the class Browser method getAxisRecordIds.
/**
* Get record ID for axis
* @param tableName
* @param tableWhereClause
* @return
*/
private int[] getAxisRecordIds(String tableName, String tableWhereClause) {
StringBuilder whereClause = new StringBuilder();
StringBuilder orderBy = new StringBuilder();
whereClause.append("EXISTS (SELECT 1 FROM AD_Table t WHERE t.TableName=? AND t.AD_Table_ID=AD_Column.AD_Table_ID) AND ");
whereClause.append(I_AD_Column.COLUMNNAME_IsIdentifier).append("=?");
List<MColumn> columns = new Query(Env.getCtx(), I_AD_Column.Table_Name, whereClause.toString(), null).setOnlyActiveRecords(true).setParameters(tableName, true).setOrderBy(I_AD_Column.COLUMNNAME_SeqNo).list();
int count = 1;
for (MColumn column : columns) {
orderBy.append(column.getColumnName());
if (count != columns.size())
orderBy.append(",");
count++;
}
return new Query(Env.getCtx(), tableName, tableWhereClause, null).setOnlyActiveRecords(true).setOrderBy(orderBy.toString()).getIDs();
}
use of org.compiere.model.Query in project adempiere by adempiere.
the class WMRuleEngine method applyDefinition.
/**
* Apply Definition for Warehouse Strategy
* @param inOutBoundLine Order Bound Line
* @param warehouseAreaTypeId Area Type Id
* @param warehouseSectionTypeId Section Type Id
* */
private MWMStrategy applyDefinition(MWMInOutBoundLine inOutBoundLine, int warehouseAreaTypeId, int warehouseSectionTypeId) {
StringBuffer whereClause = new StringBuffer("(");
whereClause.append(MWMDefinition.COLUMNNAME_M_Product_ID + " IN (0,?) OR ");
whereClause.append(MWMDefinition.COLUMNNAME_M_Product_ID + " IS NULL");
whereClause.append(") AND ");
whereClause.append("(");
whereClause.append(MWMDefinition.COLUMNNAME_M_Product_Category_ID + " IN (0,?) OR ");
whereClause.append(MWMDefinition.COLUMNNAME_M_Product_Category_ID + " IS NULL");
whereClause.append(") AND ");
whereClause.append("(");
whereClause.append(MWMDefinition.COLUMNNAME_Group1 + " IN ('',?) OR ");
whereClause.append(MWMDefinition.COLUMNNAME_Group1 + " IS NULL");
whereClause.append(") AND ");
whereClause.append("(");
whereClause.append(MWMDefinition.COLUMNNAME_Group2 + " IN ('',?) OR ");
whereClause.append(MWMDefinition.COLUMNNAME_Group2 + " IS NULL");
whereClause.append(") AND ");
whereClause.append("(");
whereClause.append(MWMDefinition.COLUMNNAME_Classification + " IN ('',?) OR ");
whereClause.append(MWMDefinition.COLUMNNAME_Classification + " IS NULL");
whereClause.append(") AND ");
whereClause.append("(");
whereClause.append(MWMDefinition.COLUMNNAME_C_BPartner_ID + " IN (0,?) OR ");
whereClause.append(MWMDefinition.COLUMNNAME_C_BPartner_ID + " IS NULL");
whereClause.append(") AND ");
whereClause.append("(");
whereClause.append(MWMDefinition.COLUMNNAME_C_BP_Group_ID + " IN (0,?) OR ");
whereClause.append(MWMDefinition.COLUMNNAME_C_BP_Group_ID + " IS NULL");
whereClause.append(") AND ");
whereClause.append("(");
whereClause.append(MWMDefinition.COLUMNNAME_WM_Area_Type_ID + " IN (0,?) OR ");
whereClause.append(MWMDefinition.COLUMNNAME_WM_Area_Type_ID + " IS NULL");
whereClause.append(") AND ");
whereClause.append("(");
whereClause.append(MWMDefinition.COLUMNNAME_WM_Section_Type_ID + " IN (0,?) OR ");
whereClause.append(MWMDefinition.COLUMNNAME_WM_Section_Type_ID + " IS NULL");
whereClause.append(")");
whereClause.append(" AND EXISTS (SELECT 1 FROM " + MWMStrategy.Table_Name);
whereClause.append(" WHERE ");
whereClause.append(MWMStrategy.Table_Name + "." + MWMStrategy.COLUMNNAME_WM_Strategy_ID + "=");
whereClause.append(MWMDefinition.Table_Name + "." + MWMDefinition.COLUMNNAME_WM_Strategy_ID);
whereClause.append(" AND ");
whereClause.append(MWMStrategy.COLUMNNAME_InOutBoundType + "=?");
whereClause.append(")");
MProduct product = inOutBoundLine.getMProduct();
MBPartner partner = inOutBoundLine.getBPartner();
MWMDefinition definition = new Query(inOutBoundLine.getCtx(), MWMDefinition.Table_Name, whereClause.toString(), inOutBoundLine.get_TrxName()).setClient_ID().setParameters(product.getM_Product_ID(), product.getM_Product_Category_ID(), product.getGroup1(), product.getGroup2(), product.getClassification(), partner.getC_BPartner_ID(), partner.getC_BP_Group_ID(), warehouseAreaTypeId, warehouseSectionTypeId, MWMStrategy.INOUTBOUNDTYPE_OutboundOperation).first();
if (definition == null) {
throw new AdempiereException("@WM_Definition_ID@ @NotFound@");
}
return definition.getWarehouseStrategy();
}
use of org.compiere.model.Query in project adempiere by adempiere.
the class ExpressReceiptScanBar method getInOutBoundLines.
private List<MWMInOutBoundLine> getInOutBoundLines() {
StringBuilder whereClause = new StringBuilder();
whereClause.append(MWMInOutBoundLine.COLUMNNAME_WM_InOutBound_ID).append("=?");
return new Query(Env.getCtx(), MWMInOutBoundLine.Table_Name, whereClause.toString(), null).setClient_ID().setParameters(getRecord_ID()).list();
}
Aggregations