org.eevolution.model.CalloutOrder:
* organized imports * fix indentation
This commit is contained in:
parent
785797db9b
commit
e2341b3fe2
|
@ -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,8 +56,8 @@ 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)
|
||||
{
|
||||
|
@ -65,11 +67,11 @@ public class CalloutOrder extends CalloutEngine
|
|||
// UOM Changed - convert from Entered -> Product
|
||||
else if (mField.getColumnName().equals("C_UOM_ID"))
|
||||
{
|
||||
|
||||
|
||||
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,26 +101,26 @@ 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");
|
||||
if (PP_Order_ID==null)
|
||||
return "";
|
||||
|
||||
|
||||
QtyOrdered = ((BigDecimal)mTab.getValue("QtyOrdered"));
|
||||
MPPOrder order = new MPPOrder(ctx, PP_Order_ID,null);
|
||||
MPPOrderBOMLine[] obl = MPPOrder.getLines(PP_Order_ID);
|
||||
|
@ -128,38 +130,38 @@ public class CalloutOrder extends CalloutEngine
|
|||
obl[i].save(null);
|
||||
}
|
||||
}*/
|
||||
|
||||
return qtyBatch(ctx,WindowNo,mTab,mField,value);
|
||||
//return "";
|
||||
} // qty
|
||||
|
||||
public String qtyBatch (Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value)
|
||||
{
|
||||
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";
|
||||
|
||||
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);
|
||||
|
||||
|
||||
|
||||
|
||||
mTab.setValue("QtyBatchs", Qty);
|
||||
mTab.setValue("QtyBatchSize", p_QtyEntered.divide(Qty , BigDecimal.ROUND_HALF_UP));
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
return qtyBatch(ctx,WindowNo,mTab,mField,value);
|
||||
//return "";
|
||||
} // qty
|
||||
|
||||
public String qtyBatch (Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value)
|
||||
{
|
||||
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";
|
||||
|
||||
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);
|
||||
|
||||
|
||||
|
||||
|
||||
mTab.setValue("QtyBatchs", Qty);
|
||||
mTab.setValue("QtyBatchSize", p_QtyEntered.divide(Qty , BigDecimal.ROUND_HALF_UP));
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
} // CalloutOrder
|
||||
|
||||
|
|
Loading…
Reference in New Issue