Refactoring
- imports - comments - translating spanish messages and variables - Use trxname properly - Avoid hardcoding of docstatus and doctype
This commit is contained in:
parent
efc23da628
commit
b2b73f772a
|
@ -13,28 +13,38 @@
|
||||||
* Copyright (C) 2003-2007 e-Evolution,SC. All Rights Reserved. *
|
* Copyright (C) 2003-2007 e-Evolution,SC. All Rights Reserved. *
|
||||||
* Contributor(s): Victor Perez www.e-evolution.com *
|
* Contributor(s): Victor Perez www.e-evolution.com *
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
//package org.compiere.mfg.model;
|
|
||||||
package org.eevolution.model;
|
package org.eevolution.model;
|
||||||
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.io.File;
|
||||||
import java.sql.*;
|
import java.math.BigDecimal;
|
||||||
import java.math.*;
|
import java.sql.PreparedStatement;
|
||||||
import java.util.logging.*;
|
import java.sql.ResultSet;
|
||||||
import java.io.*;
|
import java.sql.SQLException;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.compiere.process.*;
|
import org.compiere.model.MAttributeSetInstance;
|
||||||
import org.compiere.util.*;
|
import org.compiere.model.MClient;
|
||||||
import org.compiere.model.*;
|
import org.compiere.model.MDocType;
|
||||||
import org.compiere.wf.*;
|
import org.compiere.model.MOrder;
|
||||||
import org.compiere.print.*;
|
import org.compiere.model.MOrderLine;
|
||||||
import org.compiere.process.*;
|
import org.compiere.model.MPeriod;
|
||||||
import org.compiere.util.*;
|
import org.compiere.model.MProduct;
|
||||||
|
import org.compiere.model.MStorage;
|
||||||
|
import org.compiere.model.MTransaction;
|
||||||
|
import org.compiere.print.ReportEngine;
|
||||||
|
import org.compiere.process.DocAction;
|
||||||
|
import org.compiere.process.DocumentEngine;
|
||||||
|
import org.compiere.util.DB;
|
||||||
|
import org.compiere.util.Env;
|
||||||
|
import org.compiere.util.TimeUtil;
|
||||||
/**
|
/**
|
||||||
* Inventory Movement Model
|
* Inventory Movement Model
|
||||||
*
|
*
|
||||||
* @author Victor Perez www.e-evolution.com
|
* @author Victor Perez www.e-evolution.com
|
||||||
* @version $Id: MMovement.java,v 1.1 2004/06/19 02:10:34 vpj-cd Exp $
|
* @version $Id: MPPCostCollector.java,v 1.1 2004/06/19 02:10:34 vpj-cd Exp $
|
||||||
*/
|
*/
|
||||||
public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
{
|
{
|
||||||
|
@ -57,7 +67,7 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
setPosted (false);
|
setPosted (false);
|
||||||
super.setProcessed (false);
|
super.setProcessed (false);
|
||||||
}
|
}
|
||||||
} // MMovement
|
} // MPPCostCollector
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load Constructor
|
* Load Constructor
|
||||||
|
@ -67,7 +77,7 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
public MPPCostCollector(Properties ctx, ResultSet rs,String trxName)
|
public MPPCostCollector(Properties ctx, ResultSet rs,String trxName)
|
||||||
{
|
{
|
||||||
super (ctx, rs,trxName);
|
super (ctx, rs,trxName);
|
||||||
} // MMovement
|
} // MPPCostCollector
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -356,8 +366,8 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
// I need refactory this code because can be improve Victor perez
|
// I need refactory this code because can be improve Victor perez
|
||||||
if(doctype.equals(MDocType.DOCBASETYPE_ManufacturingOperationActivity))
|
if(doctype.equals(MDocType.DOCBASETYPE_ManufacturingOperationActivity))
|
||||||
{
|
{
|
||||||
MPPOrderNode onodeact =new MPPOrderNode(Env.getCtx(),getPP_Order_Node_ID(),null);
|
MPPOrderNode onodeact =new MPPOrderNode(Env.getCtx(),getPP_Order_Node_ID(),get_TrxName());
|
||||||
onodeact.setDocStatus("CO");
|
onodeact.setDocStatus(DOCSTATUS_Completed);
|
||||||
onodeact.setQtyScrap(onodeact.getQtyScrap().add(getScrappedQty()));
|
onodeact.setQtyScrap(onodeact.getQtyScrap().add(getScrappedQty()));
|
||||||
onodeact.setQtyReject(onodeact.getQtyReject().add(getQtyReject()));
|
onodeact.setQtyReject(onodeact.getQtyReject().add(getQtyReject()));
|
||||||
onodeact.setQtyDelivered(onodeact.getQtyDelivered().add(getMovementQty()));
|
onodeact.setQtyDelivered(onodeact.getQtyDelivered().add(getMovementQty()));
|
||||||
|
@ -365,12 +375,12 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
onodeact.setSetupTimeReal(onodeact.getSetupTimeReal()+getSetupTimeReal().intValue());
|
onodeact.setSetupTimeReal(onodeact.getSetupTimeReal()+getSetupTimeReal().intValue());
|
||||||
onodeact.save();
|
onodeact.save();
|
||||||
|
|
||||||
ArrayList list = new ArrayList();
|
ArrayList<String> list = new ArrayList<String>();
|
||||||
int count =0;
|
int count =0;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
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(),get_TrxName());
|
||||||
pstmt.setInt(1, getPP_Order_ID());
|
pstmt.setInt(1, getPP_Order_ID());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
ResultSet rs = pstmt.executeQuery();
|
||||||
|
|
||||||
|
@ -389,7 +399,7 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean ultimonodo = false;
|
boolean lastnode = false;
|
||||||
|
|
||||||
for (int v =0 ; v < list.size(); v++)
|
for (int v =0 ; v < list.size(); v++)
|
||||||
{
|
{
|
||||||
|
@ -399,18 +409,18 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
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(),get_TrxName());
|
||||||
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();
|
||||||
log.fine("***** SQL ultm nodo " + sqlnn.toString());
|
log.fine("***** SQL last node " + sqlnn.toString());
|
||||||
if (rsnn.next())
|
if (rsnn.next())
|
||||||
{
|
{
|
||||||
ultimonodo=false;
|
lastnode=false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ultimonodo=true;
|
lastnode=true;
|
||||||
}
|
}
|
||||||
rsnn.close();
|
rsnn.close();
|
||||||
pstmtnn.close();
|
pstmtnn.close();
|
||||||
|
@ -418,9 +428,9 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
catch (SQLException enodenn)
|
catch (SQLException enodenn)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
if (!ultimonodo)
|
if (!lastnode)
|
||||||
{
|
{
|
||||||
log.fine("***** No ES EL ULTIMO NODO");
|
log.fine("***** It's not last node");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -428,7 +438,7 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
{
|
{
|
||||||
StringBuffer sql1=new StringBuffer("SELECT DocStatus,PP_Order_Node_ID,DurationRequiered " +
|
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!=?");
|
"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(),get_TrxName());
|
||||||
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();
|
||||||
|
@ -448,14 +458,14 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// crear orden de compra al cmpletar
|
// create purchase order on complete
|
||||||
int p_PP_Order_Node_ID=0;
|
int p_PP_Order_Node_ID=0;
|
||||||
BigDecimal m_MovementQty=Env.ZERO;
|
BigDecimal m_MovementQty=Env.ZERO;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
StringBuffer sql=new StringBuffer("SELECT PP_Order_Node_ID,MovementQty FROM PP_Cost_Collector WHERE IsActive='Y' AND AD_Client_ID=? and PP_Cost_Collector_ID=? ");
|
StringBuffer sql=new StringBuffer("SELECT PP_Order_Node_ID,MovementQty FROM PP_Cost_Collector WHERE IsActive='Y' AND AD_Client_ID=? and PP_Cost_Collector_ID=? ");
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql.toString(),null);
|
PreparedStatement pstmt = DB.prepareStatement(sql.toString(),get_TrxName());
|
||||||
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());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
ResultSet rs = pstmt.executeQuery();
|
||||||
|
@ -474,12 +484,12 @@ 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 message="";
|
||||||
BigDecimal DeliveryTime=Env.ZERO;
|
BigDecimal DeliveryTime=Env.ZERO;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
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(),get_TrxName());
|
||||||
pstmtplv.setInt(1, p_PP_Order_Node_ID);
|
pstmtplv.setInt(1, p_PP_Order_Node_ID);
|
||||||
ResultSet rsplv = pstmtplv.executeQuery();
|
ResultSet rsplv = pstmtplv.executeQuery();
|
||||||
if (rsplv.next())
|
if (rsplv.next())
|
||||||
|
@ -495,15 +505,15 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
|
|
||||||
if (M_Product_ID==0)
|
if (M_Product_ID==0)
|
||||||
{
|
{
|
||||||
salvado="No hay un servicio asociado a este subcontrato";
|
message="There is no service associated to this subcontract";
|
||||||
return salvado;
|
return message;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
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(),get_TrxName());
|
||||||
pstmtpp.setInt(1, M_Product_ID);
|
pstmtpp.setInt(1, M_Product_ID);
|
||||||
ResultSet rspp = pstmtpp.executeQuery();
|
ResultSet rspp = pstmtpp.executeQuery();
|
||||||
if (rspp.next())
|
if (rspp.next())
|
||||||
|
@ -518,14 +528,14 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// MPPProfileBOM profileorder = new MPPProfileBOM(Env.getCtx(),m_PP_ProfileBOM_ID);
|
// MPPProfileBOM profileorder = new MPPProfileBOM(Env.getCtx(),m_PP_ProfileBOM_ID);
|
||||||
int m_Client_ID = Integer.parseInt(Env.getContext(Env.getCtx(), "#AD_Client_ID"));
|
// int m_Client_ID = Integer.parseInt(Env.getContext(Env.getCtx(), "#AD_Client_ID"));
|
||||||
int m_AD_Org_ID = Integer.parseInt(Env.getContext(Env.getCtx(), "#AD_Org_ID"));
|
// int m_AD_Org_ID = Integer.parseInt(Env.getContext(Env.getCtx(), "#AD_Org_ID"));
|
||||||
|
|
||||||
int C_BPartner_ID=0;
|
int C_BPartner_ID=0;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
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(),get_TrxName());
|
||||||
pstmtpo.setInt(1, M_Product_ID);
|
pstmtpo.setInt(1, M_Product_ID);
|
||||||
ResultSet rspo = pstmtpo.executeQuery();
|
ResultSet rspo = pstmtpo.executeQuery();
|
||||||
while (rspo.next())
|
while (rspo.next())
|
||||||
|
@ -541,8 +551,8 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
|
|
||||||
if (C_BPartner_ID==0)
|
if (C_BPartner_ID==0)
|
||||||
{
|
{
|
||||||
salvado="No hay un proveedor asociado a este servicio de subcontrato";
|
message="There is no vendor associated with this subcontract";
|
||||||
return salvado;
|
return message;
|
||||||
}
|
}
|
||||||
MPPOrder mpcorder = new MPPOrder(Env.getCtx(),getPP_Order_ID(),get_TrxName());
|
MPPOrder mpcorder = new MPPOrder(Env.getCtx(),getPP_Order_ID(),get_TrxName());
|
||||||
String documentno = mpcorder.getDocumentNo();
|
String documentno = mpcorder.getDocumentNo();
|
||||||
|
@ -619,23 +629,23 @@ 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
|
// last node translates to => I complete node
|
||||||
boolean ultimonodo=false;
|
boolean lastnode=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(),get_TrxName());
|
||||||
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();
|
||||||
log.fine("***** SQL ultm nodo " + sqlnn.toString());
|
log.fine("***** SQL last node " + sqlnn.toString());
|
||||||
if (rsnn.next())
|
if (rsnn.next())
|
||||||
{
|
{
|
||||||
ultimonodo=false;
|
lastnode=false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ultimonodo=true;
|
lastnode=true;
|
||||||
}
|
}
|
||||||
rsnn.close();
|
rsnn.close();
|
||||||
pstmtnn.close();
|
pstmtnn.close();
|
||||||
|
@ -644,16 +654,16 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!ultimonodo)
|
if(!lastnode)
|
||||||
{
|
{
|
||||||
MPPOrderNode onodeact =new MPPOrderNode(Env.getCtx(),getPP_Order_Node_ID(),null);
|
MPPOrderNode onodeact =new MPPOrderNode(Env.getCtx(),getPP_Order_Node_ID(),get_TrxName());
|
||||||
onodeact.setDocStatus("CL");
|
onodeact.setDocStatus(DOCSTATUS_Closed);
|
||||||
// onodeact.setAction(DOCACTION_None);
|
// onodeact.setAction(DOCACTION_None);
|
||||||
onodeact.save();
|
onodeact.save();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
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(),get_TrxName());
|
||||||
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();
|
||||||
|
@ -661,7 +671,7 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
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(DOCSTATUS_Closed);
|
||||||
costcoll.setDocAction(DOCACTION_None);
|
costcoll.setDocAction(DOCACTION_None);
|
||||||
costcoll.save();
|
costcoll.save();
|
||||||
}
|
}
|
||||||
|
@ -677,7 +687,7 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
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(), get_TrxName());
|
||||||
pstmt1.setInt(1, getPP_Order_ID());
|
pstmt1.setInt(1, getPP_Order_ID());
|
||||||
ResultSet rs1 = pstmt1.executeQuery();
|
ResultSet rs1 = pstmt1.executeQuery();
|
||||||
log.finest("***** SQL1 =[" + sql1 + "]; variable =[" +getPP_Order_ID() + "]");
|
log.finest("***** SQL1 =[" + sql1 + "]; variable =[" +getPP_Order_ID() + "]");
|
||||||
|
@ -687,10 +697,10 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
log.finest("***** PP_Order_Node_ID = [" +rs1.getInt(2) +"]; status =[" +docStatus + "]");
|
log.finest("***** PP_Order_Node_ID = [" +rs1.getInt(2) +"]; status =[" +docStatus + "]");
|
||||||
|
|
||||||
|
|
||||||
if(docStatus == null || !docStatus.equals("CL"))
|
if(docStatus == null || !docStatus.equals(DOCSTATUS_Closed))
|
||||||
{
|
{
|
||||||
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(DOCSTATUS_Closed);
|
||||||
onodenext.save();
|
onodenext.save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -849,17 +859,16 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
{
|
{
|
||||||
String sqlar="SELECT PP_Cost_Collector_ID FROM PP_Cost_Collector WHERE IsActive='Y' AND PP_Order_ID="
|
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;
|
+getPP_Order_ID() +" and PP_Order_Node_ID="+node;
|
||||||
PreparedStatement pstmtar = DB.prepareStatement(sqlar,null);
|
PreparedStatement pstmtar = DB.prepareStatement(sqlar,get_TrxName());
|
||||||
log.fine("***** SQLar " +sqlar + " variables " +getPP_Order_ID() +" nodo "+node);
|
log.fine("***** SQLar " +sqlar + " variables " +getPP_Order_ID() +" node "+node);
|
||||||
ResultSet rsar = pstmtar.executeQuery();
|
ResultSet rsar = pstmtar.executeQuery();
|
||||||
if(rsar.next())
|
if(rsar.next())
|
||||||
{
|
{
|
||||||
log.warning("***** NODO Ya Existe");
|
log.warning("***** NODE already exists");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// System.out.println("***** ENTRA AL eLSE ");
|
log.fine("***** Entering 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());
|
||||||
|
@ -894,11 +903,11 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
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(),get_TrxName());
|
||||||
// onodeact.setDocStatus("IP");
|
// onodeact.setDocStatus(DOCSTATUS_InProgress);
|
||||||
// onodeact.save();
|
// onodeact.save();
|
||||||
if (newRecord)
|
if (newRecord)
|
||||||
setDocStatus("IP");
|
setDocStatus(DOCSTATUS_InProgress);
|
||||||
|
|
||||||
//fjv e-evolution Operation Activity Report end
|
//fjv e-evolution Operation Activity Report end
|
||||||
|
|
||||||
|
@ -911,12 +920,12 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
return success;
|
return success;
|
||||||
/****** tspc: Cannot see any need for the following code, commenting out for now
|
/****** 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(),get_TrxName());
|
||||||
onodeact.setDocStatus("IP");
|
onodeact.setDocStatus(DOCSTATUS_InProgress);
|
||||||
//onodeact.setAD_WF_Node_ID(getPP_Order_Workflow_ID());
|
//onodeact.setAD_WF_Node_ID(getPP_Order_Workflow_ID());
|
||||||
onodeact.save();
|
onodeact.save();
|
||||||
|
|
||||||
// setDocStatus("IP");
|
// setDocStatus(DOCSTATUS_InProgress);
|
||||||
|
|
||||||
//fjv e-evolution Operation Activity Report end
|
//fjv e-evolution Operation Activity Report end
|
||||||
********/
|
********/
|
||||||
|
@ -927,7 +936,7 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
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,get_TrxName());
|
||||||
//System.out.println("***** SQLar " +sqlcom + " variables " +order +" nodo "+node);
|
//System.out.println("***** SQLar " +sqlcom + " variables " +order +" nodo "+node);
|
||||||
|
|
||||||
ResultSet rscom = pstmtcom.executeQuery();
|
ResultSet rscom = pstmtcom.executeQuery();
|
||||||
|
@ -936,10 +945,10 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
MDocType doc = new MDocType(Env.getCtx(),getC_DocType_ID(),get_TrxName());
|
MDocType doc = new MDocType(Env.getCtx(),getC_DocType_ID(),get_TrxName());
|
||||||
String doct ="";
|
String doct ="";
|
||||||
doct=doc.getDocBaseType();
|
doct=doc.getDocBaseType();
|
||||||
if(doct.equals("MOA"))
|
if(doct.equals(MDocType.DOCBASETYPE_ManufacturingOperationActivity))
|
||||||
{
|
{
|
||||||
MPPCostCollector costcoll = new MPPCostCollector(Env.getCtx(),rscom.getInt(1),get_TrxName());
|
MPPCostCollector costcoll = new MPPCostCollector(Env.getCtx(),rscom.getInt(1),get_TrxName());
|
||||||
costcoll.setDocStatus("CL");
|
costcoll.setDocStatus(DOCSTATUS_Closed);
|
||||||
costcoll.setDocAction(DOCACTION_None);
|
costcoll.setDocAction(DOCACTION_None);
|
||||||
costcoll.save();
|
costcoll.save();
|
||||||
}
|
}
|
||||||
|
@ -955,7 +964,7 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
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,get_TrxName());
|
||||||
//System.out.println("***** SQLar " +sqlcom + " variables " +order +" nodo "+node);
|
//System.out.println("***** SQLar " +sqlcom + " variables " +order +" nodo "+node);
|
||||||
ResultSet rscom = pstmtcom.executeQuery();
|
ResultSet rscom = pstmtcom.executeQuery();
|
||||||
while(rscom.next())
|
while(rscom.next())
|
||||||
|
@ -963,9 +972,9 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
MDocType doc = new MDocType(Env.getCtx(),getC_DocType_ID(),get_TrxName());
|
MDocType doc = new MDocType(Env.getCtx(),getC_DocType_ID(),get_TrxName());
|
||||||
String doct ="";
|
String doct ="";
|
||||||
doct=doc.getDocBaseType();
|
doct=doc.getDocBaseType();
|
||||||
if(doct.equals("MOA"))
|
if(doct.equals(MDocType.DOCBASETYPE_ManufacturingOperationActivity))
|
||||||
{
|
{
|
||||||
if(!rscom.getString(2).equals("C0") && !rscom.getString(2).equals("CL"))
|
if(!rscom.getString(2).equals(DOCSTATUS_Completed) && !rscom.getString(2).equals(DOCSTATUS_Closed))
|
||||||
{
|
{
|
||||||
MPPCostCollector costcoll = new MPPCostCollector(Env.getCtx(),rscom.getInt(1),get_TrxName());
|
MPPCostCollector costcoll = new MPPCostCollector(Env.getCtx(),rscom.getInt(1),get_TrxName());
|
||||||
costcoll.completeIt();
|
costcoll.completeIt();
|
||||||
|
@ -1072,5 +1081,4 @@ public class MPPCostCollector extends X_PP_Cost_Collector implements DocAction
|
||||||
|
|
||||||
} // checkMaterialPolicy
|
} // checkMaterialPolicy
|
||||||
|
|
||||||
} // MMovement
|
} // MPPCostCollector
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue