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