IDEMPIERE-385 Resolve M_Storage locking and data consistency / integration with iDempiere

This commit is contained in:
Carlos Ruiz 2012-11-13 20:51:04 -05:00
parent 80e81f4c86
commit 26c2059c7d
2 changed files with 5 additions and 5 deletions

View File

@ -822,7 +822,7 @@ public class CalloutOrder extends CalloutEngine
int M_Warehouse_ID = Env.getContextAsInt(ctx, WindowNo, "M_Warehouse_ID"); int M_Warehouse_ID = Env.getContextAsInt(ctx, WindowNo, "M_Warehouse_ID");
int M_AttributeSetInstance_ID = Env.getContextAsInt(ctx, WindowNo, "M_AttributeSetInstance_ID"); int M_AttributeSetInstance_ID = Env.getContextAsInt(ctx, WindowNo, "M_AttributeSetInstance_ID");
BigDecimal available = MStorageReservation.getQtyAvailable BigDecimal available = MStorageReservation.getQtyAvailable
(M_Warehouse_ID, 0, M_Product_ID.intValue(), M_AttributeSetInstance_ID, null); (M_Warehouse_ID, M_Product_ID.intValue(), M_AttributeSetInstance_ID, null);
if (available == null) if (available == null)
available = Env.ZERO; available = Env.ZERO;
if (available.signum() == 0) if (available.signum() == 0)
@ -1297,7 +1297,7 @@ public class CalloutOrder extends CalloutEngine
int M_Warehouse_ID = Env.getContextAsInt(ctx, WindowNo, "M_Warehouse_ID"); int M_Warehouse_ID = Env.getContextAsInt(ctx, WindowNo, "M_Warehouse_ID");
int M_AttributeSetInstance_ID = Env.getContextAsInt(ctx, WindowNo, "M_AttributeSetInstance_ID"); int M_AttributeSetInstance_ID = Env.getContextAsInt(ctx, WindowNo, "M_AttributeSetInstance_ID");
BigDecimal available = MStorageReservation.getQtyAvailable BigDecimal available = MStorageReservation.getQtyAvailable
(M_Warehouse_ID, 0, M_Product_ID, M_AttributeSetInstance_ID, null); (M_Warehouse_ID, M_Product_ID, M_AttributeSetInstance_ID, null);
if (available == null) if (available == null)
available = Env.ZERO; available = Env.ZERO;
if (available.signum() == 0) if (available.signum() == 0)

View File

@ -719,15 +719,15 @@ public class MProduct extends X_M_Product
// Check Storage // Check Storage
if (isStocked() || PRODUCTTYPE_Item.equals(getProductType())) if (isStocked() || PRODUCTTYPE_Item.equals(getProductType()))
{ {
MStorageOnHand[] onHandStorages = MStorageOnHand.getOfProduct(getCtx(), get_ID(), get_TrxName()); MStorageOnHand[] storages = MStorageOnHand.getOfProduct(getCtx(), get_ID(), get_TrxName());
MStorageReservation[] reserves = MStorageReservation.getOfProduct(getCtx(), get_ID(), get_TrxName()); MStorageReservation[] reserves = MStorageReservation.getOfProduct(getCtx(), get_ID(), get_TrxName());
BigDecimal OnHand = Env.ZERO; BigDecimal OnHand = Env.ZERO;
BigDecimal Ordered = Env.ZERO; BigDecimal Ordered = Env.ZERO;
BigDecimal Reserved = Env.ZERO; BigDecimal Reserved = Env.ZERO;
for (int i = 0; i < onHandStorages.length; i++) for (int i = 0; i < storages.length; i++)
{ {
OnHand = OnHand.add(onHandStorages[i].getQtyOnHand()); OnHand = OnHand.add(storages[i].getQtyOnHand());
} }
for (int i = 0; i < reserves.length; i++) for (int i = 0; i < reserves.length; i++)