use of org.compiere.util.AdempiereUserError in project adempiere by adempiere.
the class MovementGenerate method doIt.
// prepare
/**
* Generate Movements
* @return info
* @throws Exception
*/
protected String doIt() throws Exception {
log.info("Selection=" + p_Selection + ", M_Warehouse_ID=" + p_M_Warehouse_ID + ", C_BPartner_ID=" + p_C_BPartner_ID + ", Consolidate=" + p_ConsolidateDocument + ", IsUnconfirmed=" + p_IsUnconfirmedInOut + ", Movement=" + m_movementDate);
if (p_M_Warehouse_ID == 0)
throw new AdempiereUserError("@NotFound@ @M_Warehouse_ID@");
if (p_Selection) {
m_sql = "SELECT DD_Order.* FROM DD_Order, T_Selection " + "WHERE DD_Order.DocStatus='CO' AND DD_Order.AD_Client_ID=? " + "AND DD_Order.DD_Order_ID = T_Selection.T_Selection_ID " + "AND T_Selection.AD_PInstance_ID=? ";
} else {
m_sql = "SELECT * FROM DD_Order o " + "WHERE DocStatus='CO' " + // No Offer,POS
" AND o.C_DocType_ID IN (SELECT C_DocType_ID FROM C_DocType " + "WHERE DocBaseType='DOO')" + " AND o.IsDropShip='N'" + // No Manual
" AND o.DeliveryRule<>'M'" + // Open Order Lines with Warehouse
" AND EXISTS (SELECT 1 FROM DD_OrderLine ol " + " WHERE ? IN (SELECT l.M_Warehouse_ID FROM M_Locator l WHERE l.M_Locator_ID=ol.M_Locator_ID) ";
if (p_DatePromised != null)
// #2
m_sql += " AND TRUNC(ol.DatePromised)<=?";
m_sql += " AND o.DD_Order_ID=ol.DD_Order_ID AND ol.QtyOrdered<>ol.QtyIntransit)";
//
if (p_C_BPartner_ID != 0)
// #3
m_sql += " AND o.C_BPartner_ID=?";
m_sql += " ORDER BY M_Warehouse_ID, PriorityRule, M_Shipper_ID, C_BPartner_ID, C_BPartner_Location_ID, DD_Order_ID";
}
// m_sql += " FOR UPDATE";
PreparedStatement pstmt = null;
try {
pstmt = DB.prepareStatement(m_sql, get_TrxName());
int index = 1;
if (p_Selection) {
pstmt.setInt(index++, Env.getAD_Client_ID(getCtx()));
pstmt.setInt(index++, getAD_PInstance_ID());
} else {
pstmt.setInt(index++, p_M_Warehouse_ID);
if (p_DatePromised != null)
pstmt.setTimestamp(index++, p_DatePromised);
if (p_C_BPartner_ID != 0)
pstmt.setInt(index++, p_C_BPartner_ID);
}
} catch (Exception e) {
log.log(Level.SEVERE, m_sql, e);
}
return generate(pstmt);
}
use of org.compiere.util.AdempiereUserError in project adempiere by adempiere.
the class PP_Product_BOM_Check method raiseError.
// doIt
private void raiseError(String string, String hint) throws Exception {
DB.rollback(false, get_TrxName());
// parent
MProduct xp = new MProduct(getCtx(), p_Record_ID, null);
// set BOM not verified
xp.setIsVerified(false);
xp.saveEx();
String msg = string;
ValueNamePair pp = CLogger.retrieveError();
if (pp != null)
msg = pp.getName() + " - ";
msg += hint;
throw new AdempiereUserError(msg);
}
Aggregations