InventoryValue - use executeUpdateEx instead of executeUpdate

This commit is contained in:
teo_sarca 2009-07-09 16:05:08 +00:00
parent f7067df3ab
commit 3d2693a186
1 changed files with 13 additions and 13 deletions

View File

@ -96,7 +96,7 @@ public class InventoryValue extends SvrProcess
// Delete (just to be sure)
StringBuffer sql = new StringBuffer ("DELETE T_InventoryValue WHERE AD_PInstance_ID=");
sql.append(getAD_PInstance_ID());
int no = DB.executeUpdate(sql.toString(), get_TrxName());
int no = DB.executeUpdateEx(sql.toString(), get_TrxName());
// Insert Standard Costs
sql = new StringBuffer ("INSERT INTO T_InventoryValue "
@ -111,7 +111,7 @@ public class InventoryValue extends SvrProcess
+ " INNER JOIN M_Cost c ON (acs.C_AcctSchema_ID=c.C_AcctSchema_ID AND acs.M_CostType_ID=c.M_CostType_ID AND c.AD_Org_ID IN (0, w.AD_Org_ID))"
+ " INNER JOIN M_CostElement ce ON (c.M_CostElement_ID=ce.M_CostElement_ID AND ce.CostingMethod='S' AND ce.CostElementType='M') "
+ "WHERE w.M_Warehouse_ID=").append(p_M_Warehouse_ID);
int noInsertStd = DB.executeUpdate(sql.toString(), get_TrxName());
int noInsertStd = DB.executeUpdateEx(sql.toString(), get_TrxName());
log.fine("Inserted Std=" + noInsertStd);
if (noInsertStd == 0)
return "No Standard Costs found";
@ -137,7 +137,7 @@ public class InventoryValue extends SvrProcess
.append(" AND iv.M_Warehouse_ID=w.M_Warehouse_ID"
+ " AND iv.M_Product_ID=c.M_Product_ID"
+ " AND iv.M_AttributeSetInstance_ID=c.M_AttributeSetInstance_ID)");
noInsertCost = DB.executeUpdate(sql.toString(), get_TrxName());
noInsertCost = DB.executeUpdateEx(sql.toString(), get_TrxName());
log.fine("Inserted Cost=" + noInsertCost);
// Update Std Cost Records
sql = new StringBuffer ("UPDATE T_InventoryValue iv "
@ -155,7 +155,7 @@ public class InventoryValue extends SvrProcess
+ "WHERE EXISTS (SELECT * FROM T_InventoryValue ivv "
+ "WHERE ivv.AD_PInstance_ID=" + getAD_PInstance_ID()
+ " AND ivv.M_CostElement_ID IS NULL)");
int noUpdatedCost = DB.executeUpdate(sql.toString(), get_TrxName());
int noUpdatedCost = DB.executeUpdateEx(sql.toString(), get_TrxName());
log.fine("Updated Cost=" + noUpdatedCost);
}
if ((noInsertStd+noInsertCost) == 0)
@ -170,7 +170,7 @@ public class InventoryValue extends SvrProcess
.append("M_PriceList_Version_ID=").append(p_M_PriceList_Version_ID).append(",")
.append("C_Currency_ID=").append(p_C_Currency_ID)
.append(" WHERE AD_PInstance_ID=" + getAD_PInstance_ID());
no = DB.executeUpdate(sql.toString(), get_TrxName());
no = DB.executeUpdateEx(sql.toString(), get_TrxName());
log.fine("Constants=" + no);
// Get current QtyOnHand with ASI
@ -182,7 +182,7 @@ public class InventoryValue extends SvrProcess
+ " AND iv.M_AttributeSetInstance_ID=s.M_AttributeSetInstance_ID) "
+ "WHERE AD_PInstance_ID=").append(getAD_PInstance_ID())
.append(" AND iv.M_AttributeSetInstance_ID<>0");
no = DB.executeUpdate(sql.toString(), get_TrxName());
no = DB.executeUpdateEx(sql.toString(), get_TrxName());
log.fine("QtHand with ASI=" + no);
// Get current QtyOnHand without ASI
sql = new StringBuffer ("UPDATE T_InventoryValue iv SET QtyOnHand = "
@ -192,7 +192,7 @@ public class InventoryValue extends SvrProcess
+ " AND iv.M_Warehouse_ID=l.M_Warehouse_ID) "
+ "WHERE iv.AD_PInstance_ID=").append(getAD_PInstance_ID())
.append(" AND iv.M_AttributeSetInstance_ID=0");
no = DB.executeUpdate(sql.toString(), get_TrxName());
no = DB.executeUpdateEx(sql.toString(), get_TrxName());
log.fine("QtHand w/o ASI=" + no);
// Adjust for Valuation Date
@ -207,7 +207,7 @@ public class InventoryValue extends SvrProcess
+ " AND l.M_Warehouse_ID=iv.M_Warehouse_ID) "
+ "WHERE iv.M_AttributeSetInstance_ID<>0"
+ " AND iv.AD_PInstance_ID=").append(getAD_PInstance_ID());
no = DB.executeUpdate(sql.toString(), get_TrxName());
no = DB.executeUpdateEx(sql.toString(), get_TrxName());
log.fine("Update with ASI=" + no);
//
sql = new StringBuffer("UPDATE T_InventoryValue iv "
@ -221,13 +221,13 @@ public class InventoryValue extends SvrProcess
+ "WHERE iv.M_AttributeSetInstance_ID=0 "
+ "AND iv.AD_PInstance_ID=").append(getAD_PInstance_ID());
no = DB.executeUpdate(sql.toString(), get_TrxName());
no = DB.executeUpdateEx(sql.toString(), get_TrxName());
log.fine("Update w/o ASI=" + no);
// Delete Records w/o OnHand Qty
sql = new StringBuffer("DELETE T_InventoryValue "
+ "WHERE (QtyOnHand=0 OR QtyOnHand IS NULL) AND AD_PInstance_ID=").append(getAD_PInstance_ID());
int noQty = DB.executeUpdate (sql.toString(), get_TrxName());
int noQty = DB.executeUpdateEx (sql.toString(), get_TrxName());
log.fine("NoQty Deleted=" + noQty);
// Update Prices
@ -256,7 +256,7 @@ public class InventoryValue extends SvrProcess
+ " AND plv.M_PriceList_ID=pl.M_PriceList_ID)"
+ " WHERE iv.AD_PInstance_ID=").append(getAD_PInstance_ID());
no = DB.executeUpdate (sql.toString(), get_TrxName());
no = DB.executeUpdateEx (sql.toString(), get_TrxName());
String msg = "";
if (no == 0)
msg = "No Prices";
@ -272,12 +272,12 @@ public class InventoryValue extends SvrProcess
+ "(SELECT currencyConvert(iv.Cost,acs.C_Currency_ID,iv.C_Currency_ID,iv.DateValue,null, iv.AD_Client_ID,iv.AD_Org_ID) "
+ "FROM C_AcctSchema acs WHERE acs.C_AcctSchema_ID=" + as.getC_AcctSchema_ID() + ") "
+ "WHERE iv.AD_PInstance_ID=" + getAD_PInstance_ID());
no = DB.executeUpdate (sql.toString(), get_TrxName());
no = DB.executeUpdateEx (sql.toString(), get_TrxName());
log.fine("Converted=" + no);
}
// Update Values
no = DB.executeUpdate("UPDATE T_InventoryValue SET "
no = DB.executeUpdateEx("UPDATE T_InventoryValue SET "
+ "PricePOAmt = QtyOnHand * PricePO, "
+ "PriceListAmt = QtyOnHand * PriceList, "
+ "PriceStdAmt = QtyOnHand * PriceStd, "