org.eevolution.model.CalloutOrder:

* organized imports
* fix indentation
This commit is contained in:
teo_sarca 2008-06-03 15:37:10 +00:00
parent 785797db9b
commit e2341b3fe2
1 changed files with 57 additions and 55 deletions

View File

@ -16,13 +16,15 @@
package org.eevolution.model; package org.eevolution.model;
import java.math.*; import java.math.BigDecimal;
import java.sql.*; import java.util.Properties;
import java.util.*;
import org.compiere.util.*; import org.compiere.model.CalloutEngine;
import org.compiere.model.*; import org.compiere.model.GridField;
import org.compiere.wf.*; import org.compiere.model.GridTab;
import org.compiere.model.MUOMConversion;
import org.compiere.util.Env;
import org.compiere.wf.MWorkflow;
/** /**
* Order CalloutOrder * Order CalloutOrder
@ -54,7 +56,7 @@ public class CalloutOrder extends CalloutEngine
int M_Product_ID = Env.getContextAsInt(ctx, WindowNo, "M_Product_ID"); int M_Product_ID = Env.getContextAsInt(ctx, WindowNo, "M_Product_ID");
if (steps) log.warning("qty - init - M_Product_ID=" + M_Product_ID + " - " ); if (steps) log.warning("qty - init - M_Product_ID=" + M_Product_ID + " - " );
BigDecimal QtyOrdered = Env.ZERO ; BigDecimal QtyOrdered = Env.ZERO ;
BigDecimal QtyEntered = Env.ZERO ; //, PriceActual, PriceEntered; BigDecimal QtyEntered = Env.ZERO ; //, PriceActual, PriceEntered;
// No Product // No Product
if (M_Product_ID == 0) if (M_Product_ID == 0)
@ -69,7 +71,7 @@ public class CalloutOrder extends CalloutEngine
int C_UOM_To_ID = ((Integer)value).intValue(); int C_UOM_To_ID = ((Integer)value).intValue();
QtyEntered = (BigDecimal)mTab.getValue("QtyEntered"); QtyEntered = (BigDecimal)mTab.getValue("QtyEntered");
QtyOrdered = MUOMConversion.convertProductFrom (ctx, M_Product_ID, QtyOrdered = MUOMConversion.convertProductFrom (ctx, M_Product_ID,
C_UOM_To_ID, QtyEntered); C_UOM_To_ID, QtyEntered);
if (QtyOrdered == null) if (QtyOrdered == null)
QtyOrdered = QtyEntered; QtyOrdered = QtyEntered;
boolean conversion = QtyEntered.compareTo(QtyOrdered) != 0; boolean conversion = QtyEntered.compareTo(QtyOrdered) != 0;
@ -82,14 +84,14 @@ public class CalloutOrder extends CalloutEngine
int C_UOM_To_ID = Env.getContextAsInt(ctx, WindowNo, "C_UOM_ID"); int C_UOM_To_ID = Env.getContextAsInt(ctx, WindowNo, "C_UOM_ID");
QtyEntered = (BigDecimal)value; QtyEntered = (BigDecimal)value;
QtyOrdered = MUOMConversion.convertProductFrom (ctx, M_Product_ID, QtyOrdered = MUOMConversion.convertProductFrom (ctx, M_Product_ID,
C_UOM_To_ID, QtyEntered); C_UOM_To_ID, QtyEntered);
if (QtyOrdered == null) if (QtyOrdered == null)
QtyOrdered = QtyEntered; QtyOrdered = QtyEntered;
boolean conversion = QtyEntered.compareTo(QtyOrdered) != 0; boolean conversion = QtyEntered.compareTo(QtyOrdered) != 0;
log.fine("qty - UOM=" + C_UOM_To_ID log.fine("qty - UOM=" + C_UOM_To_ID
+ ", QtyEntered=" + QtyEntered + ", QtyEntered=" + QtyEntered
+ " -> " + conversion + " -> " + conversion
+ " QtyOrdered=" + QtyOrdered); + " QtyOrdered=" + QtyOrdered);
Env.setContext(ctx, WindowNo, "UOMConversion", conversion ? "Y" : "N"); Env.setContext(ctx, WindowNo, "UOMConversion", conversion ? "Y" : "N");
mTab.setValue("QtyOrdered", QtyOrdered); mTab.setValue("QtyOrdered", QtyOrdered);
} }
@ -99,20 +101,20 @@ public class CalloutOrder extends CalloutEngine
int C_UOM_To_ID = Env.getContextAsInt(ctx, WindowNo, "C_UOM_ID"); int C_UOM_To_ID = Env.getContextAsInt(ctx, WindowNo, "C_UOM_ID");
QtyOrdered = (BigDecimal)value; QtyOrdered = (BigDecimal)value;
QtyEntered = MUOMConversion.convertProductTo (ctx, M_Product_ID, QtyEntered = MUOMConversion.convertProductTo (ctx, M_Product_ID,
C_UOM_To_ID, QtyOrdered); C_UOM_To_ID, QtyOrdered);
if (QtyEntered == null) if (QtyEntered == null)
QtyEntered = QtyOrdered; QtyEntered = QtyOrdered;
boolean conversion = QtyOrdered.compareTo(QtyEntered) != 0; boolean conversion = QtyOrdered.compareTo(QtyEntered) != 0;
log.fine("qty - UOM=" + C_UOM_To_ID log.fine("qty - UOM=" + C_UOM_To_ID
+ ", QtyOrdered=" + QtyOrdered + ", QtyOrdered=" + QtyOrdered
+ " -> " + conversion + " -> " + conversion
+ " QtyEntered=" + QtyEntered); + " QtyEntered=" + QtyEntered);
Env.setContext(ctx, WindowNo, "UOMConversion", conversion ? "Y" : "N"); Env.setContext(ctx, WindowNo, "UOMConversion", conversion ? "Y" : "N");
mTab.setValue("QtyEntered", QtyEntered); mTab.setValue("QtyEntered", QtyEntered);
} }
String DocStatus = (String) mTab.getValue("DocStatus"); String DocStatus = (String) mTab.getValue("DocStatus");
/*if (!DocStatus.equals(MPPOrder.STATUS_Completed)) /*if (!DocStatus.equals(MPPOrder.STATUS_Completed))
{ {
Integer PP_Order_ID = (Integer)mTab.getValue("PP_Order_ID"); Integer PP_Order_ID = (Integer)mTab.getValue("PP_Order_ID");
@ -129,37 +131,37 @@ public class CalloutOrder extends CalloutEngine
} }
}*/ }*/
return qtyBatch(ctx,WindowNo,mTab,mField,value); return qtyBatch(ctx,WindowNo,mTab,mField,value);
//return ""; //return "";
} // qty } // qty
public String qtyBatch (Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value) public String qtyBatch (Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value)
{ {
Integer AD_Workflow_ID = ((Integer)mTab.getValue("AD_Workflow_ID")); Integer AD_Workflow_ID = ((Integer)mTab.getValue("AD_Workflow_ID"));
BigDecimal p_QtyEntered = (BigDecimal)mTab.getValue("QtyEntered"); BigDecimal p_QtyEntered = (BigDecimal)mTab.getValue("QtyEntered");
if ( AD_Workflow_ID==null) if ( AD_Workflow_ID==null)
return "Data found"; return "Data found";
MWorkflow wf = new MWorkflow(ctx , AD_Workflow_ID.intValue() ,null); MWorkflow wf = new MWorkflow(ctx , AD_Workflow_ID.intValue() ,null);
BigDecimal Qty = null; BigDecimal Qty = null;
BigDecimal QtyBatchSize = ((BigDecimal)wf.get_Value("QtyBatchSize")).divide(new BigDecimal(1),0,BigDecimal.ROUND_UP); BigDecimal QtyBatchSize = ((BigDecimal)wf.get_Value("QtyBatchSize")).divide(new BigDecimal(1),0,BigDecimal.ROUND_UP);
if (p_QtyEntered.equals(Env.ZERO)) if (p_QtyEntered.equals(Env.ZERO))
return ""; return "";
if (QtyBatchSize.equals(Env.ZERO)) if (QtyBatchSize.equals(Env.ZERO))
Qty = Env.ONE; Qty = Env.ONE;
else else
Qty = p_QtyEntered.divide(QtyBatchSize , 0, BigDecimal.ROUND_UP); Qty = p_QtyEntered.divide(QtyBatchSize , 0, BigDecimal.ROUND_UP);
mTab.setValue("QtyBatchs", Qty); mTab.setValue("QtyBatchs", Qty);
mTab.setValue("QtyBatchSize", p_QtyEntered.divide(Qty , BigDecimal.ROUND_HALF_UP)); mTab.setValue("QtyBatchSize", p_QtyEntered.divide(Qty , BigDecimal.ROUND_HALF_UP));
return ""; return "";
} }
} // CalloutOrder } // CalloutOrder