IDEMPIERE-2472 CalloutInOut/CalloutMovement

This commit is contained in:
Carlos Ruiz 2015-02-25 14:41:58 -05:00
parent 8af991da51
commit be17f8a145
2 changed files with 10 additions and 10 deletions

View File

@ -570,7 +570,7 @@ public class CalloutInOut extends CalloutEngine
if (isCalloutActive() || value == null) if (isCalloutActive() || value == null)
return ""; return "";
int M_Product_ID = Env.getContextAsInt(ctx, WindowNo, "M_Product_ID"); int M_Product_ID = Env.getContextAsInt(ctx, WindowNo, mTab.getTabNo(), "M_Product_ID");
// log.log(Level.WARNING,"qty - init - M_Product_ID=" + M_Product_ID); // log.log(Level.WARNING,"qty - init - M_Product_ID=" + M_Product_ID);
BigDecimal MovementQty, QtyEntered; BigDecimal MovementQty, QtyEntered;
@ -606,7 +606,7 @@ public class CalloutInOut extends CalloutEngine
mTab.setValue("MovementQty", MovementQty); mTab.setValue("MovementQty", MovementQty);
} }
// No UOM defined // No UOM defined
else if (Env.getContextAsInt(ctx, WindowNo, "C_UOM_ID") == 0) else if (Env.getContextAsInt(ctx, WindowNo, mTab.getTabNo(), "C_UOM_ID") == 0)
{ {
QtyEntered = (BigDecimal)mTab.getValue("QtyEntered"); QtyEntered = (BigDecimal)mTab.getValue("QtyEntered");
mTab.setValue("MovementQty", QtyEntered); mTab.setValue("MovementQty", QtyEntered);
@ -614,7 +614,7 @@ public class CalloutInOut extends CalloutEngine
// QtyEntered changed - calculate MovementQty // QtyEntered changed - calculate MovementQty
else if (mField.getColumnName().equals("QtyEntered")) else if (mField.getColumnName().equals("QtyEntered"))
{ {
int C_UOM_To_ID = Env.getContextAsInt(ctx, WindowNo, "C_UOM_ID"); int C_UOM_To_ID = Env.getContextAsInt(ctx, WindowNo, mTab.getTabNo(), "C_UOM_ID");
QtyEntered = (BigDecimal)value; QtyEntered = (BigDecimal)value;
BigDecimal QtyEntered1 = QtyEntered.setScale(MUOM.getPrecision(ctx, C_UOM_To_ID), BigDecimal.ROUND_HALF_UP); BigDecimal QtyEntered1 = QtyEntered.setScale(MUOM.getPrecision(ctx, C_UOM_To_ID), BigDecimal.ROUND_HALF_UP);
if (QtyEntered.compareTo(QtyEntered1) != 0) if (QtyEntered.compareTo(QtyEntered1) != 0)
@ -639,7 +639,7 @@ public class CalloutInOut extends CalloutEngine
// MovementQty changed - calculate QtyEntered (should not happen) // MovementQty changed - calculate QtyEntered (should not happen)
else if (mField.getColumnName().equals("MovementQty")) else if (mField.getColumnName().equals("MovementQty"))
{ {
int C_UOM_To_ID = Env.getContextAsInt(ctx, WindowNo, "C_UOM_ID"); int C_UOM_To_ID = Env.getContextAsInt(ctx, WindowNo, mTab.getTabNo(), "C_UOM_ID");
MovementQty = (BigDecimal)value; MovementQty = (BigDecimal)value;
int precision = MProduct.get(ctx, M_Product_ID).getUOMPrecision(); int precision = MProduct.get(ctx, M_Product_ID).getUOMPrecision();
BigDecimal MovementQty1 = MovementQty.setScale(precision, BigDecimal.ROUND_HALF_UP); BigDecimal MovementQty1 = MovementQty.setScale(precision, BigDecimal.ROUND_HALF_UP);
@ -683,9 +683,9 @@ public class CalloutInOut extends CalloutEngine
if (M_ASI_ID == null || M_ASI_ID.intValue() == 0) if (M_ASI_ID == null || M_ASI_ID.intValue() == 0)
return ""; return "";
// //
int M_Product_ID = Env.getContextAsInt(ctx, WindowNo, "M_Product_ID"); int M_Product_ID = Env.getContextAsInt(ctx, WindowNo, mTab.getTabNo(), "M_Product_ID");
int M_Warehouse_ID = Env.getContextAsInt(ctx, WindowNo, "M_Warehouse_ID"); int M_Warehouse_ID = Env.getContextAsInt(ctx, WindowNo, "M_Warehouse_ID");
int M_Locator_ID = Env.getContextAsInt(ctx, WindowNo, "M_Locator_ID"); int M_Locator_ID = Env.getContextAsInt(ctx, WindowNo, mTab.getTabNo(), "M_Locator_ID");
if (log.isLoggable(Level.FINE)) log.fine("M_Product_ID=" + M_Product_ID if (log.isLoggable(Level.FINE)) log.fine("M_Product_ID=" + M_Product_ID
+ ", M_ASI_ID=" + M_ASI_ID + ", M_ASI_ID=" + M_ASI_ID
+ " - M_Warehouse_ID=" + M_Warehouse_ID + " - M_Warehouse_ID=" + M_Warehouse_ID

View File

@ -76,7 +76,7 @@ public class CalloutMovement extends CalloutEngine
if (isCalloutActive() || value == null) if (isCalloutActive() || value == null)
return ""; return "";
int M_Product_ID = Env.getContextAsInt(ctx, WindowNo, "M_Product_ID"); int M_Product_ID = Env.getContextAsInt(ctx, WindowNo, mTab.getTabNo(), "M_Product_ID");
checkQtyAvailable(ctx, mTab, WindowNo, M_Product_ID, (BigDecimal)value); checkQtyAvailable(ctx, mTab, WindowNo, M_Product_ID, (BigDecimal)value);
// //
return ""; return "";
@ -95,7 +95,7 @@ public class CalloutMovement extends CalloutEngine
public String locator(Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value) { public String locator(Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value) {
if (value == null) if (value == null)
return ""; return "";
int M_Product_ID = Env.getContextAsInt(ctx, WindowNo, "M_Product_ID"); int M_Product_ID = Env.getContextAsInt(ctx, WindowNo, mTab.getTabNo(), "M_Product_ID");
checkQtyAvailable(ctx, mTab, WindowNo, M_Product_ID, null); checkQtyAvailable(ctx, mTab, WindowNo, M_Product_ID, null);
return ""; return "";
} }
@ -116,11 +116,11 @@ public class CalloutMovement extends CalloutEngine
if (product.isStocked()) { if (product.isStocked()) {
if (MovementQty == null) if (MovementQty == null)
MovementQty = (BigDecimal) mTab.getValue("MovementQty"); MovementQty = (BigDecimal) mTab.getValue("MovementQty");
int M_Locator_ID = Env.getContextAsInt(ctx, WindowNo, "M_Locator_ID"); int M_Locator_ID = Env.getContextAsInt(ctx, WindowNo, mTab.getTabNo(), "M_Locator_ID");
// If no locator, don't check anything and assume is ok // If no locator, don't check anything and assume is ok
if (M_Locator_ID <= 0) if (M_Locator_ID <= 0)
return; return;
int M_AttributeSetInstance_ID = Env.getContextAsInt(ctx, WindowNo, "M_AttributeSetInstance_ID"); int M_AttributeSetInstance_ID = Env.getContextAsInt(ctx, WindowNo, mTab.getTabNo(), "M_AttributeSetInstance_ID");
BigDecimal available = MStorageOnHand.getQtyOnHandForLocator(M_Product_ID, M_Locator_ID, M_AttributeSetInstance_ID, null); BigDecimal available = MStorageOnHand.getQtyOnHandForLocator(M_Product_ID, M_Locator_ID, M_AttributeSetInstance_ID, null);
if (available == null) if (available == null)