BF1999688 - OrderReceipt&Issue - NullPointerException
and begin some clean-up
This commit is contained in:
parent
29058f7f83
commit
08a1ba7636
|
@ -97,7 +97,6 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
+ (processed ? "Y" : "N")
|
+ (processed ? "Y" : "N")
|
||||||
+ "' WHERE PP_Cost_Collector_ID =" + getPP_Cost_Collector_ID();
|
+ "' WHERE PP_Cost_Collector_ID =" + getPP_Cost_Collector_ID();
|
||||||
int noLine = DB.executeUpdate(sql, get_TrxName());
|
int noLine = DB.executeUpdate(sql, get_TrxName());
|
||||||
//m_lines = null;
|
|
||||||
log.fine("setProcessed - " + processed + " - Lines=" + noLine);
|
log.fine("setProcessed - " + processed + " - Lines=" + noLine);
|
||||||
} // setProcessed
|
} // setProcessed
|
||||||
|
|
||||||
|
@ -157,9 +156,6 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
m_processMsg = "@PeriodClosed@";
|
m_processMsg = "@PeriodClosed@";
|
||||||
return DocAction.STATUS_Invalid;
|
return DocAction.STATUS_Invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
m_justPrepared = true;
|
m_justPrepared = true;
|
||||||
if (!DOCACTION_Complete.equals(getDocAction()))
|
if (!DOCACTION_Complete.equals(getDocAction()))
|
||||||
setDocAction(DOCACTION_Complete);
|
setDocAction(DOCACTION_Complete);
|
||||||
|
@ -204,7 +200,6 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MProduct product = new MProduct (getCtx(),getM_Product_ID(),get_TrxName());
|
MProduct product = new MProduct (getCtx(),getM_Product_ID(),get_TrxName());
|
||||||
|
|
||||||
// Qty & Type
|
// Qty & Type
|
||||||
|
@ -212,7 +207,6 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
|
|
||||||
BigDecimal QtyIssue = Env.ZERO;
|
BigDecimal QtyIssue = Env.ZERO;
|
||||||
BigDecimal QtyReceipt = Env.ZERO;
|
BigDecimal QtyReceipt = Env.ZERO;
|
||||||
|
|
||||||
BigDecimal Qty = getMovementQty();
|
BigDecimal Qty = getMovementQty();
|
||||||
if (MovementType.charAt(1) == '-')
|
if (MovementType.charAt(1) == '-')
|
||||||
{
|
{
|
||||||
|
@ -237,11 +231,11 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
if(!doctype.equals(MDocType.DOCBASETYPE_ManufacturingOperationActivity))
|
if(!doctype.equals(MDocType.DOCBASETYPE_ManufacturingOperationActivity))
|
||||||
{
|
{
|
||||||
// Stock Movement
|
// Stock Movement
|
||||||
if (product != null
|
if (product != null && product.isStocked() )
|
||||||
&& product.isStocked() )
|
|
||||||
{
|
{
|
||||||
//Ignore the Material Policy when is Reverse Correction
|
// Only for Production Issue records
|
||||||
checkMaterialPolicy( obomline, getMovementQty());
|
if (MovementType.charAt(1) == '-')
|
||||||
|
checkMaterialPolicy( obomline, getMovementQty());
|
||||||
|
|
||||||
log.fine("Material Transaction");
|
log.fine("Material Transaction");
|
||||||
MTransaction mtrx = null;
|
MTransaction mtrx = null;
|
||||||
|
@ -289,7 +283,6 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
m_processMsg = "Could not create Material Transaction (MA)";
|
m_processMsg = "Could not create Material Transaction (MA)";
|
||||||
return DocAction.STATUS_Invalid;
|
return DocAction.STATUS_Invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// sLine.getM_AttributeSetInstance_ID() != 0
|
// sLine.getM_AttributeSetInstance_ID() != 0
|
||||||
|
@ -314,9 +307,7 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
m_processMsg = "Could not create Material Transaction";
|
m_processMsg = "Could not create Material Transaction";
|
||||||
return DocAction.STATUS_Invalid;
|
return DocAction.STATUS_Invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // stock movement
|
} // stock movement
|
||||||
|
|
||||||
if (MovementType.charAt(1) == '-')
|
if (MovementType.charAt(1) == '-')
|
||||||
|
@ -324,7 +315,6 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
// Update Order Line
|
// Update Order Line
|
||||||
if (getPP_Order_BOMLine_ID()!= 0)
|
if (getPP_Order_BOMLine_ID()!= 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
obomline = new MPPOrderBOMLine(getCtx(),getPP_Order_BOMLine_ID(),get_TrxName());
|
obomline = new MPPOrderBOMLine(getCtx(),getPP_Order_BOMLine_ID(),get_TrxName());
|
||||||
obomline.setQtyDelivered(obomline.getQtyDelivered().add(getMovementQty()));
|
obomline.setQtyDelivered(obomline.getQtyDelivered().add(getMovementQty()));
|
||||||
obomline.setQtyScrap(obomline.getQtyScrap().add(getScrappedQty()));
|
obomline.setQtyScrap(obomline.getQtyScrap().add(getScrappedQty()));
|
||||||
|
@ -381,28 +371,26 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
{
|
{
|
||||||
StringBuffer sql=new StringBuffer("SELECT PP_Order_Node_ID FROM PP_Order_Node WHERE IsActive='Y' AND PP_Order_ID=? Order By Value");
|
StringBuffer sql=new StringBuffer("SELECT PP_Order_Node_ID FROM PP_Order_Node WHERE IsActive='Y' AND PP_Order_ID=? Order By Value");
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql.toString(),null);
|
PreparedStatement pstmt = DB.prepareStatement(sql.toString(),null);
|
||||||
// pstmt.setInt(1, AD_Client_ID);
|
|
||||||
pstmt.setInt(1, getPP_Order_ID());
|
pstmt.setInt(1, getPP_Order_ID());
|
||||||
//pstmt.setInt(2, m_M_PriceList_ID);
|
|
||||||
ResultSet rs = pstmt.executeQuery();
|
ResultSet rs = pstmt.executeQuery();
|
||||||
//while (!m_calculated && rsplv.next())
|
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
|
Integer nodeid = new Integer(rs.getInt(1));
|
||||||
|
list.add(count,nodeid.toString());
|
||||||
|
|
||||||
Integer nodeid = new Integer(rs.getInt(1));
|
count++;
|
||||||
list.add(count,nodeid.toString());
|
|
||||||
|
|
||||||
count++;
|
}
|
||||||
|
rs.close();
|
||||||
}
|
pstmt.close();
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException enode)
|
catch (SQLException enode)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
boolean ultimonodo = false;
|
|
||||||
|
|
||||||
|
boolean ultimonodo = false;
|
||||||
|
|
||||||
for (int v =0 ; v < list.size(); v++)
|
for (int v =0 ; v < list.size(); v++)
|
||||||
{
|
{
|
||||||
if (list.get(v).equals(new Integer(getPP_Order_Node_ID()).toString()))
|
if (list.get(v).equals(new Integer(getPP_Order_Node_ID()).toString()))
|
||||||
|
@ -412,19 +400,13 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
{
|
{
|
||||||
StringBuffer sqlnn=new StringBuffer("SELECT PP_Order_Node_ID FROM PP_Order_NodeNext WHERE IsActive='Y' AND PP_Order_ID=? and PP_Order_Node_ID=?");
|
StringBuffer sqlnn=new StringBuffer("SELECT PP_Order_Node_ID FROM PP_Order_NodeNext WHERE IsActive='Y' AND PP_Order_ID=? and PP_Order_Node_ID=?");
|
||||||
PreparedStatement pstmtnn = DB.prepareStatement(sqlnn.toString(),null);
|
PreparedStatement pstmtnn = DB.prepareStatement(sqlnn.toString(),null);
|
||||||
// pstmt.setInt(1, AD_Client_ID);
|
|
||||||
pstmtnn.setInt(1, getPP_Order_ID());
|
pstmtnn.setInt(1, getPP_Order_ID());
|
||||||
pstmtnn.setInt(2, getPP_Order_Node_ID());
|
pstmtnn.setInt(2, getPP_Order_Node_ID());
|
||||||
ResultSet rsnn = pstmtnn.executeQuery();
|
ResultSet rsnn = pstmtnn.executeQuery();
|
||||||
//while (!m_calculated && rsplv.next())
|
log.fine("***** SQL ultm nodo " + sqlnn.toString());
|
||||||
System.out.println("***** SQL ultm nodo " +sqlnn.toString());
|
|
||||||
if (rsnn.next())
|
if (rsnn.next())
|
||||||
{
|
{
|
||||||
|
|
||||||
ultimonodo=false;
|
ultimonodo=false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -438,44 +420,32 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
}
|
}
|
||||||
if (!ultimonodo)
|
if (!ultimonodo)
|
||||||
{
|
{
|
||||||
//System.out.println("***** No ES EL ULTIMO NODO");
|
log.fine("***** No ES EL ULTIMO NODO");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
StringBuffer sql1=new StringBuffer("SELECT DocStatus,PP_Order_Node_ID,DurationRequiered FROM PP_Order_Node WHERE IsActive='Y' AND PP_Order_ID=? and PP_Order_Node_ID!=?");
|
StringBuffer sql1=new StringBuffer("SELECT DocStatus,PP_Order_Node_ID,DurationRequiered " +
|
||||||
|
"FROM PP_Order_Node WHERE IsActive='Y' AND PP_Order_ID=? and PP_Order_Node_ID!=?");
|
||||||
PreparedStatement pstmt1 = DB.prepareStatement(sql1.toString(),null);
|
PreparedStatement pstmt1 = DB.prepareStatement(sql1.toString(),null);
|
||||||
// pstmt.setInt(1, AD_Client_ID);
|
|
||||||
pstmt1.setInt(1, getPP_Order_ID());
|
pstmt1.setInt(1, getPP_Order_ID());
|
||||||
pstmt1.setInt(2, getPP_Order_Node_ID());
|
pstmt1.setInt(2, getPP_Order_Node_ID());
|
||||||
ResultSet rs1 = pstmt1.executeQuery();
|
ResultSet rs1 = pstmt1.executeQuery();
|
||||||
//while (!m_calculated && rsplv.next())
|
|
||||||
// System.out.println("***** SQL1 " +sql1 + " variable " +getPP_Order_ID());
|
log.fine("***** SQL1 " + sql1 + " variable " +getPP_Order_ID());
|
||||||
while (rs1.next())
|
while (rs1.next())
|
||||||
{
|
{
|
||||||
// System.out.println("***** Nodo " +rs1.getInt(2) +" status " +rs1.getString(1));
|
|
||||||
// if(!rs1.getString(1).equals("CL"))
|
|
||||||
// {
|
|
||||||
|
|
||||||
// MPPOrderNode onodenext =new MPPOrderNode(Env.getCtx(),rs1.getInt(2),get_TrxName());
|
|
||||||
// onodenext.setDocStatus("CL");
|
|
||||||
// onodenext.save();
|
|
||||||
// }
|
|
||||||
createnewnode(rs1.getInt(2),rs1.getBigDecimal(3));
|
createnewnode(rs1.getInt(2),rs1.getBigDecimal(3));
|
||||||
|
|
||||||
}
|
}
|
||||||
rs1.close();
|
rs1.close();
|
||||||
pstmt1.close();
|
pstmt1.close();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (SQLException enode)
|
catch (SQLException enode)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// crear orden de compra al cmpletar
|
// crear orden de compra al cmpletar
|
||||||
|
@ -488,9 +458,7 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql.toString(),null);
|
PreparedStatement pstmt = DB.prepareStatement(sql.toString(),null);
|
||||||
pstmt.setInt(1, getAD_Client_ID());
|
pstmt.setInt(1, getAD_Client_ID());
|
||||||
pstmt.setInt(2, getPP_Cost_Collector_ID());
|
pstmt.setInt(2, getPP_Cost_Collector_ID());
|
||||||
//pstmt.setInt(2, m_M_PriceList_ID);
|
|
||||||
ResultSet rs = pstmt.executeQuery();
|
ResultSet rs = pstmt.executeQuery();
|
||||||
//while (!m_calculated && rsplv.next())
|
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
p_PP_Order_Node_ID= rs.getInt(1);
|
p_PP_Order_Node_ID= rs.getInt(1);
|
||||||
|
@ -503,10 +471,8 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if(isSubcontracting())
|
||||||
|
|
||||||
// if(isSubcontracting())
|
|
||||||
// {
|
|
||||||
int M_Product_ID =0;
|
int M_Product_ID =0;
|
||||||
String salvado="";
|
String salvado="";
|
||||||
BigDecimal DeliveryTime=Env.ZERO;
|
BigDecimal DeliveryTime=Env.ZERO;
|
||||||
|
@ -515,9 +481,7 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
StringBuffer plv=new StringBuffer("SELECT M_Product_ID FROM PP_Order_Node WHERE IsActive='Y' AND PP_Order_Node_ID=? ");
|
StringBuffer plv=new StringBuffer("SELECT M_Product_ID FROM PP_Order_Node WHERE IsActive='Y' AND PP_Order_Node_ID=? ");
|
||||||
PreparedStatement pstmtplv = DB.prepareStatement(plv.toString(),null);
|
PreparedStatement pstmtplv = DB.prepareStatement(plv.toString(),null);
|
||||||
pstmtplv.setInt(1, p_PP_Order_Node_ID);
|
pstmtplv.setInt(1, p_PP_Order_Node_ID);
|
||||||
//pstmt.setInt(2, m_M_PriceList_ID);
|
|
||||||
ResultSet rsplv = pstmtplv.executeQuery();
|
ResultSet rsplv = pstmtplv.executeQuery();
|
||||||
//while (!m_calculated && rsplv.next())
|
|
||||||
if (rsplv.next())
|
if (rsplv.next())
|
||||||
{
|
{
|
||||||
M_Product_ID= rsplv.getInt(1);
|
M_Product_ID= rsplv.getInt(1);
|
||||||
|
@ -541,9 +505,7 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
StringBuffer pp=new StringBuffer("SELECT DeliveryTime_Promised FROM PP_Product_Planning WHERE IsActive='Y' AND M_Product_ID=? ");
|
StringBuffer pp=new StringBuffer("SELECT DeliveryTime_Promised FROM PP_Product_Planning WHERE IsActive='Y' AND M_Product_ID=? ");
|
||||||
PreparedStatement pstmtpp = DB.prepareStatement(pp.toString(),null);
|
PreparedStatement pstmtpp = DB.prepareStatement(pp.toString(),null);
|
||||||
pstmtpp.setInt(1, M_Product_ID);
|
pstmtpp.setInt(1, M_Product_ID);
|
||||||
//pstmt.setInt(2, m_M_PriceList_ID);
|
|
||||||
ResultSet rspp = pstmtpp.executeQuery();
|
ResultSet rspp = pstmtpp.executeQuery();
|
||||||
//while (!m_calculated && rsplv.next())
|
|
||||||
if (rspp.next())
|
if (rspp.next())
|
||||||
{
|
{
|
||||||
DeliveryTime= rspp.getBigDecimal(1);
|
DeliveryTime= rspp.getBigDecimal(1);
|
||||||
|
@ -565,9 +527,7 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
StringBuffer sqlpo=new StringBuffer("SELECT C_BPartner_ID FROM M_Product_PO WHERE IsActive='Y' AND M_Product_ID=? ");
|
StringBuffer sqlpo=new StringBuffer("SELECT C_BPartner_ID FROM M_Product_PO WHERE IsActive='Y' AND M_Product_ID=? ");
|
||||||
PreparedStatement pstmtpo = DB.prepareStatement(sqlpo.toString(),null);
|
PreparedStatement pstmtpo = DB.prepareStatement(sqlpo.toString(),null);
|
||||||
pstmtpo.setInt(1, M_Product_ID);
|
pstmtpo.setInt(1, M_Product_ID);
|
||||||
//pstmt.setInt(2, m_M_PriceList_ID);
|
|
||||||
ResultSet rspo = pstmtpo.executeQuery();
|
ResultSet rspo = pstmtpo.executeQuery();
|
||||||
//while (!m_calculated && rsplv.next())
|
|
||||||
while (rspo.next())
|
while (rspo.next())
|
||||||
{
|
{
|
||||||
C_BPartner_ID= rspo.getInt(1);
|
C_BPartner_ID= rspo.getInt(1);
|
||||||
|
@ -620,9 +580,7 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
return DocAction.STATUS_Invalid;
|
return DocAction.STATUS_Invalid;
|
||||||
}
|
}
|
||||||
//fjv e-evolution Operation Activity Report end
|
//fjv e-evolution Operation Activity Report end
|
||||||
// }
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// for all lines
|
// for all lines
|
||||||
setProcessed(true);
|
setProcessed(true);
|
||||||
|
@ -661,31 +619,26 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
|
|
||||||
// Close Not delivered Qty
|
// Close Not delivered Qty
|
||||||
// fjviejo e-evolution operation activity
|
// fjviejo e-evolution operation activity
|
||||||
|
// ultimo nodo translates to => I complete node
|
||||||
boolean ultimonodo=false;
|
boolean ultimonodo=false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
StringBuffer sqlnn=new StringBuffer("SELECT PP_Order_Node_ID FROM PP_Order_NodeNext WHERE IsActive='Y' AND PP_Order_ID=? and PP_Order_Node_ID=?");
|
StringBuffer sqlnn=new StringBuffer("SELECT PP_Order_Node_ID FROM PP_Order_NodeNext WHERE IsActive='Y' AND PP_Order_ID=? and PP_Order_Node_ID=?");
|
||||||
PreparedStatement pstmtnn = DB.prepareStatement(sqlnn.toString(),null);
|
PreparedStatement pstmtnn = DB.prepareStatement(sqlnn.toString(),null);
|
||||||
// pstmt.setInt(1, AD_Client_ID);
|
|
||||||
pstmtnn.setInt(1, getPP_Order_ID());
|
pstmtnn.setInt(1, getPP_Order_ID());
|
||||||
pstmtnn.setInt(2, getPP_Order_Node_ID());
|
pstmtnn.setInt(2, getPP_Order_Node_ID());
|
||||||
ResultSet rsnn = pstmtnn.executeQuery();
|
ResultSet rsnn = pstmtnn.executeQuery();
|
||||||
//while (!m_calculated && rsplv.next())
|
log.fine("***** SQL ultm nodo " + sqlnn.toString());
|
||||||
System.out.println("***** SQL ultm nodo " +sqlnn.toString());
|
if (rsnn.next())
|
||||||
if (rsnn.next())
|
{
|
||||||
{
|
ultimonodo=false;
|
||||||
|
}
|
||||||
ultimonodo=false;
|
else
|
||||||
|
{
|
||||||
|
ultimonodo=true;
|
||||||
|
}
|
||||||
}
|
rsnn.close();
|
||||||
else
|
pstmtnn.close();
|
||||||
{
|
|
||||||
ultimonodo=true;
|
|
||||||
}
|
|
||||||
rsnn.close();
|
|
||||||
pstmtnn.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException enodenn)
|
catch (SQLException enodenn)
|
||||||
{
|
{
|
||||||
|
@ -693,7 +646,6 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
|
|
||||||
if(!ultimonodo)
|
if(!ultimonodo)
|
||||||
{
|
{
|
||||||
|
|
||||||
MPPOrderNode onodeact =new MPPOrderNode(Env.getCtx(),getPP_Order_Node_ID(),null);
|
MPPOrderNode onodeact =new MPPOrderNode(Env.getCtx(),getPP_Order_Node_ID(),null);
|
||||||
onodeact.setDocStatus("CL");
|
onodeact.setDocStatus("CL");
|
||||||
// onodeact.setAction(DOCACTION_None);
|
// onodeact.setAction(DOCACTION_None);
|
||||||
|
@ -702,24 +654,19 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
{
|
{
|
||||||
StringBuffer sql1=new StringBuffer("SELECT PP_Cost_Collector_ID FROM PP_Cost_Collector WHERE IsActive='Y' AND PP_Order_ID=? AND PP_Order_Node_ID=?");
|
StringBuffer sql1=new StringBuffer("SELECT PP_Cost_Collector_ID FROM PP_Cost_Collector WHERE IsActive='Y' AND PP_Order_ID=? AND PP_Order_Node_ID=?");
|
||||||
PreparedStatement pstmt1 = DB.prepareStatement(sql1.toString(),null);
|
PreparedStatement pstmt1 = DB.prepareStatement(sql1.toString(),null);
|
||||||
// pstmt.setInt(1, AD_Client_ID);
|
|
||||||
pstmt1.setInt(1, getPP_Order_ID());
|
pstmt1.setInt(1, getPP_Order_ID());
|
||||||
pstmt1.setInt(2, getPP_Order_Node_ID());
|
pstmt1.setInt(2, getPP_Order_Node_ID());
|
||||||
ResultSet rs1 = pstmt1.executeQuery();
|
ResultSet rs1 = pstmt1.executeQuery();
|
||||||
//while (!m_calculated && rsplv.next())
|
log.fine("***** SQL1 " + sql1 + " variable " +getPP_Order_ID());
|
||||||
//System.out.println("***** SQL1 " +sql1 + " variable " +getPP_Order_ID());
|
|
||||||
while (rs1.next())
|
while (rs1.next())
|
||||||
{
|
{
|
||||||
MPPCostCollector costcoll = new MPPCostCollector(Env.getCtx(),rs1.getInt(1),get_TrxName());
|
MPPCostCollector costcoll = new MPPCostCollector(Env.getCtx(),rs1.getInt(1),get_TrxName());
|
||||||
costcoll.setDocStatus("CL");
|
costcoll.setDocStatus("CL");
|
||||||
costcoll.setDocAction(DOCACTION_None);
|
costcoll.setDocAction(DOCACTION_None);
|
||||||
costcoll.save();
|
costcoll.save();
|
||||||
|
|
||||||
}
|
}
|
||||||
rs1.close();
|
rs1.close();
|
||||||
pstmt1.close();
|
pstmt1.close();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (SQLException enode1)
|
catch (SQLException enode1)
|
||||||
{
|
{
|
||||||
|
@ -731,31 +678,21 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
{
|
{
|
||||||
StringBuffer sql1=new StringBuffer("SELECT DocStatus,PP_Order_Node_ID,DurationRequiered FROM PP_Order_Node WHERE IsActive='Y' AND PP_Order_ID=?");
|
StringBuffer sql1=new StringBuffer("SELECT DocStatus,PP_Order_Node_ID,DurationRequiered FROM PP_Order_Node WHERE IsActive='Y' AND PP_Order_ID=?");
|
||||||
PreparedStatement pstmt1 = DB.prepareStatement(sql1.toString(),null);
|
PreparedStatement pstmt1 = DB.prepareStatement(sql1.toString(),null);
|
||||||
// pstmt.setInt(1, AD_Client_ID);
|
|
||||||
pstmt1.setInt(1, getPP_Order_ID());
|
pstmt1.setInt(1, getPP_Order_ID());
|
||||||
//pstmt1.setInt(2, getPP_Order_Node_ID());
|
|
||||||
ResultSet rs1 = pstmt1.executeQuery();
|
ResultSet rs1 = pstmt1.executeQuery();
|
||||||
//while (!m_calculated && rsplv.next())
|
log.fine("***** SQL1 " + sql1 + " variable " +getPP_Order_ID());
|
||||||
//System.out.println("***** SQL1 " +sql1 + " variable " +getPP_Order_ID());
|
|
||||||
while (rs1.next())
|
while (rs1.next())
|
||||||
{
|
{
|
||||||
System.out.println("***** Nodo " +rs1.getInt(2) +" status " +rs1.getString(1));
|
System.out.println("***** Nodo " +rs1.getInt(2) +" status " +rs1.getString(1));
|
||||||
if(!rs1.getString(1).equals("CL"))
|
if(!rs1.getString(1).equals("CL"))
|
||||||
{
|
{
|
||||||
|
|
||||||
MPPOrderNode onodenext =new MPPOrderNode(Env.getCtx(),rs1.getInt(2),get_TrxName());
|
MPPOrderNode onodenext =new MPPOrderNode(Env.getCtx(),rs1.getInt(2),get_TrxName());
|
||||||
onodenext.setDocStatus("CL");
|
onodenext.setDocStatus("CL");
|
||||||
onodenext.save();
|
onodenext.save();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
rs1.close();
|
rs1.close();
|
||||||
pstmt1.close();
|
pstmt1.close();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (SQLException enode)
|
catch (SQLException enode)
|
||||||
{
|
{
|
||||||
|
@ -907,22 +844,19 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
//fjv e-evolution Operation Activity Report begin
|
//fjv e-evolution Operation Activity Report begin
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
String sqlar="SELECT PP_Cost_Collector_ID FROM PP_Cost_Collector WHERE IsActive='Y' AND PP_Order_ID="+getPP_Order_ID() +" and PP_Order_Node_ID="+node;
|
String sqlar="SELECT PP_Cost_Collector_ID FROM PP_Cost_Collector WHERE IsActive='Y' AND PP_Order_ID="
|
||||||
|
+getPP_Order_ID() +" and PP_Order_Node_ID="+node;
|
||||||
PreparedStatement pstmtar = DB.prepareStatement(sqlar,null);
|
PreparedStatement pstmtar = DB.prepareStatement(sqlar,null);
|
||||||
// pstmt.setInt(1, AD_Client_ID);
|
log.fine("***** SQLar " +sqlar + " variables " +getPP_Order_ID() +" nodo "+node);
|
||||||
// pstmtar.setInt(1, getPP_Order_ID());
|
|
||||||
//pstmtar.setInt(2, rs1.getInt(2));
|
|
||||||
// System.out.println("***** SQLar " +sqlar + " variables " +getPP_Order_ID() +" nodo "+node);
|
|
||||||
ResultSet rsar = pstmtar.executeQuery();
|
ResultSet rsar = pstmtar.executeQuery();
|
||||||
|
|
||||||
//while (!m_calculated && rsplv.next())
|
|
||||||
if(rsar.next())
|
if(rsar.next())
|
||||||
{
|
{
|
||||||
// System.out.println("***** NODO Ya Existe");
|
log.warning("***** NODO Ya Existe");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// System.out.println("***** ENTRA AL eLSE ");
|
// System.out.println("***** ENTRA AL eLSE ");
|
||||||
|
log.fine("***** ENTRA AL eLSE ");
|
||||||
MPPCostCollector costnew = new MPPCostCollector(Env.getCtx(),0,get_TrxName());
|
MPPCostCollector costnew = new MPPCostCollector(Env.getCtx(),0,get_TrxName());
|
||||||
costnew.setPP_Order_ID(getPP_Order_ID());
|
costnew.setPP_Order_ID(getPP_Order_ID());
|
||||||
costnew.setC_DocTypeTarget_ID(getC_DocTypeTarget_ID());
|
costnew.setC_DocTypeTarget_ID(getC_DocTypeTarget_ID());
|
||||||
|
@ -943,26 +877,19 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
costnew.setMovementType(getMovementType());
|
costnew.setMovementType(getMovementType());
|
||||||
costnew.save();
|
costnew.save();
|
||||||
// costnew.completeIt();
|
// costnew.completeIt();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rsar.close();
|
rsar.close();
|
||||||
pstmtar.close();
|
pstmtar.close();
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (SQLException exnode)
|
catch (SQLException exnode)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
//completenew(getPP_Order_ID(),node);
|
//completenew(getPP_Order_ID(),node);
|
||||||
//fjv e-evolution Operation Activity Report end
|
//fjv e-evolution Operation Activity Report end
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean beforeSave(boolean newRecord) {
|
protected boolean beforeSave(boolean newRecord) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//fjv e-evolution Operation Activity Report begin
|
//fjv e-evolution Operation Activity Report begin
|
||||||
// MPPOrderNode onodeact =new MPPOrderNode(Env.getCtx(),getPP_Order_Node_ID(),null);
|
// MPPOrderNode onodeact =new MPPOrderNode(Env.getCtx(),getPP_Order_Node_ID(),null);
|
||||||
// onodeact.setDocStatus("IP");
|
// onodeact.setDocStatus("IP");
|
||||||
|
@ -979,7 +906,7 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
|
|
||||||
if (!newRecord)
|
if (!newRecord)
|
||||||
return success;
|
return success;
|
||||||
|
/****** tspc: Cannot see any need for the following code, commenting out for now
|
||||||
//fjv e-evolution Operation Activity Report begin
|
//fjv e-evolution Operation Activity Report begin
|
||||||
MPPOrderNode onodeact =new MPPOrderNode(Env.getCtx(),getPP_Order_Node_ID(),null);
|
MPPOrderNode onodeact =new MPPOrderNode(Env.getCtx(),getPP_Order_Node_ID(),null);
|
||||||
onodeact.setDocStatus("IP");
|
onodeact.setDocStatus("IP");
|
||||||
|
@ -989,7 +916,7 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
// setDocStatus("IP");
|
// setDocStatus("IP");
|
||||||
|
|
||||||
//fjv e-evolution Operation Activity Report end
|
//fjv e-evolution Operation Activity Report end
|
||||||
|
********/
|
||||||
return true;
|
return true;
|
||||||
} //aftersave
|
} //aftersave
|
||||||
protected void closenew(int order, int node)
|
protected void closenew(int order, int node)
|
||||||
|
@ -998,10 +925,8 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
{
|
{
|
||||||
String sqlcom="SELECT PP_Cost_Collector_ID FROM PP_Cost_Collector WHERE IsActive='Y' AND PP_Order_ID="+order;
|
String sqlcom="SELECT PP_Cost_Collector_ID FROM PP_Cost_Collector WHERE IsActive='Y' AND PP_Order_ID="+order;
|
||||||
PreparedStatement pstmtcom = DB.prepareStatement(sqlcom,null);
|
PreparedStatement pstmtcom = DB.prepareStatement(sqlcom,null);
|
||||||
// pstmt.setInt(1, AD_Client_ID);
|
//System.out.println("***** SQLar " +sqlcom + " variables " +order +" nodo "+node);
|
||||||
// pstmtar.setInt(1, getPP_Order_ID());
|
|
||||||
//pstmtar.setInt(2, rs1.getInt(2));
|
|
||||||
System.out.println("***** SQLar " +sqlcom + " variables " +order +" nodo "+node);
|
|
||||||
ResultSet rscom = pstmtcom.executeQuery();
|
ResultSet rscom = pstmtcom.executeQuery();
|
||||||
while(rscom.next())
|
while(rscom.next())
|
||||||
{
|
{
|
||||||
|
@ -1028,10 +953,7 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
{
|
{
|
||||||
String sqlcom="SELECT PP_Cost_Collector_ID,DocStatus FROM PP_Cost_Collector WHERE IsActive='Y' AND PP_Order_ID="+order;
|
String sqlcom="SELECT PP_Cost_Collector_ID,DocStatus FROM PP_Cost_Collector WHERE IsActive='Y' AND PP_Order_ID="+order;
|
||||||
PreparedStatement pstmtcom = DB.prepareStatement(sqlcom,null);
|
PreparedStatement pstmtcom = DB.prepareStatement(sqlcom,null);
|
||||||
// pstmt.setInt(1, AD_Client_ID);
|
//System.out.println("***** SQLar " +sqlcom + " variables " +order +" nodo "+node);
|
||||||
// pstmtar.setInt(1, getPP_Order_ID());
|
|
||||||
//pstmtar.setInt(2, rs1.getInt(2));
|
|
||||||
System.out.println("***** SQLar " +sqlcom + " variables " +order +" nodo "+node);
|
|
||||||
ResultSet rscom = pstmtcom.executeQuery();
|
ResultSet rscom = pstmtcom.executeQuery();
|
||||||
while(rscom.next())
|
while(rscom.next())
|
||||||
{
|
{
|
||||||
|
@ -1064,7 +986,6 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
if (no > 0)
|
if (no > 0)
|
||||||
log.config("Delete old #" + no);
|
log.config("Delete old #" + no);
|
||||||
|
|
||||||
|
|
||||||
// Check Line
|
// Check Line
|
||||||
boolean needSave = false;
|
boolean needSave = false;
|
||||||
BigDecimal qtyASI = Env.ZERO ;
|
BigDecimal qtyASI = Env.ZERO ;
|
||||||
|
@ -1094,7 +1015,6 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
MClient.MMPOLICY_FiFo.equals(MMPolicy), get_TrxName());
|
MClient.MMPOLICY_FiFo.equals(MMPolicy), get_TrxName());
|
||||||
BigDecimal qtyToDeliver = qty.negate();
|
BigDecimal qtyToDeliver = qty.negate();
|
||||||
|
|
||||||
|
|
||||||
for (MStorage storage: storages)
|
for (MStorage storage: storages)
|
||||||
{
|
{
|
||||||
//consume ASI Zero
|
//consume ASI Zero
|
||||||
|
|
Loading…
Reference in New Issue