libero:
* use new Query API * minor refactoring * organized imports
This commit is contained in:
parent
c8afc0d1e2
commit
5917b4f9c7
|
@ -13,30 +13,25 @@
|
|||
* For the text or an alternative of this public license, you may reach us *
|
||||
* Copyright (C) 2003-2008 e-Evolution,SC. All Rights Reserved. *
|
||||
* Contributor(s): Victor Perez www.e-evolution.com *
|
||||
* Teo Sarca, SC ARHIPAC SERVICE SRL *
|
||||
*****************************************************************************/
|
||||
/** Generated Model - DO NOT CHANGE */
|
||||
package org.eevolution.model;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
import org.compiere.model.*;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.KeyNamePair;
|
||||
|
||||
/**Network Distribution
|
||||
import org.compiere.model.Query;
|
||||
|
||||
/**
|
||||
* Network Distribution
|
||||
* @author Victor Perez, e-Evolution,SC
|
||||
* @version $Id: MDDNetworkDistribution.java,v
|
||||
* @author Teo Sarca, SC ARHIPAC SERVICE SRL
|
||||
*/
|
||||
public class MDDNetworkDistribution extends X_DD_NetworkDistribution
|
||||
{
|
||||
/** Logger */
|
||||
private static CLogger s_log = CLogger.getCLogger(MDDNetworkDistribution.class);
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** Standard Constructor */
|
||||
public MDDNetworkDistribution (Properties ctx, int DD_NetworkDistribution_ID, String trxName)
|
||||
|
@ -44,9 +39,6 @@ public class MDDNetworkDistribution extends X_DD_NetworkDistribution
|
|||
super (ctx, DD_NetworkDistribution_ID, trxName);
|
||||
if (DD_NetworkDistribution_ID == 0)
|
||||
{
|
||||
setDD_NetworkDistribution_ID (0);
|
||||
/*setName (null);
|
||||
setValue (null);*/
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,7 +47,8 @@ public class MDDNetworkDistribution extends X_DD_NetworkDistribution
|
|||
{
|
||||
super (ctx, rs, trxName);
|
||||
}
|
||||
/** Lines */
|
||||
|
||||
/** Network Lines */
|
||||
private MDDNetworkDistributionLine[] m_lines = null;
|
||||
|
||||
/**
|
||||
|
@ -67,36 +60,12 @@ public class MDDNetworkDistribution extends X_DD_NetworkDistribution
|
|||
if (m_lines != null)
|
||||
return m_lines;
|
||||
|
||||
ArrayList<MDDNetworkDistributionLine> list = new ArrayList<MDDNetworkDistributionLine>();
|
||||
String sql = "SELECT * FROM DD_NetworkDistributionLine WHERE DD_NetworkDistribution_ID=? ORDER BY PriorityNo";
|
||||
PreparedStatement pstmt = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, get_TrxName());
|
||||
pstmt.setInt (1, getDD_NetworkDistribution_ID());
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
list.add (new MDDNetworkDistributionLine (getCtx(), rs, get_TrxName()));
|
||||
rs.close ();
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, "getLines", e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
pstmt = null;
|
||||
}
|
||||
m_lines = new MDDNetworkDistributionLine[list.size ()];
|
||||
list.toArray (m_lines);
|
||||
List<MDDNetworkDistributionLine>
|
||||
list = new Query(getCtx(), MDDNetworkDistributionLine.Table_Name, "DD_NetworkDistribution_ID=?", get_TrxName())
|
||||
.setParameters(new Object[]{get_ID()})
|
||||
.setOrderBy("PriorityNo, M_Shipper_ID")
|
||||
.list();
|
||||
m_lines = list.toArray (new MDDNetworkDistributionLine[list.size()]);
|
||||
return m_lines;
|
||||
} // getLines
|
||||
|
||||
|
@ -108,40 +77,12 @@ public class MDDNetworkDistribution extends X_DD_NetworkDistribution
|
|||
*/
|
||||
public MDDNetworkDistributionLine[] getLines(int M_Warehouse_ID)
|
||||
{
|
||||
if (m_lines != null)
|
||||
return m_lines;
|
||||
|
||||
ArrayList<MDDNetworkDistributionLine> list = new ArrayList<MDDNetworkDistributionLine>();
|
||||
String sql = "SELECT * FROM DD_NetworkDistributionLine WHERE DD_NetworkDistribution_ID=? and M_Warehouse_ID=? ORDER BY PriorityNo, M_Shipper_ID";
|
||||
PreparedStatement pstmt = null;
|
||||
try
|
||||
List<MDDNetworkDistributionLine> list = new ArrayList<MDDNetworkDistributionLine>();
|
||||
for (MDDNetworkDistributionLine line : getLines())
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, get_TrxName());
|
||||
pstmt.setInt (1, getDD_NetworkDistribution_ID());
|
||||
pstmt.setInt (2, M_Warehouse_ID);
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
list.add (new MDDNetworkDistributionLine (getCtx(), rs, get_TrxName()));
|
||||
rs.close ();
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
if (line.getM_Warehouse_ID() == M_Warehouse_ID)
|
||||
list.add(line);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, "getLines", e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
pstmt = null;
|
||||
}
|
||||
m_lines = new MDDNetworkDistributionLine[list.size ()];
|
||||
list.toArray (m_lines);
|
||||
return m_lines;
|
||||
return list.toArray(new MDDNetworkDistributionLine[list.size()]);
|
||||
} // getLines
|
||||
}
|
|
@ -14,25 +14,18 @@
|
|||
* Copyright (C) 2003-2008 e-Evolution,SC. All Rights Reserved. *
|
||||
* Contributor(s): Victor Perez www.e-evolution.com *
|
||||
*****************************************************************************/
|
||||
/** Generated Model - DO NOT CHANGE */
|
||||
package org.eevolution.model;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
import org.compiere.model.*;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
/**Network Distribution
|
||||
/**
|
||||
* Network Distribution
|
||||
* @author Victor Perez,e-Evolution,SC
|
||||
* @version $Id: MDDNetworkDistributionLine.java,v
|
||||
*/
|
||||
public class MDDNetworkDistributionLine extends X_DD_NetworkDistributionLine
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** Standard Constructor */
|
||||
public MDDNetworkDistributionLine (Properties ctx, int DD_NetworkDistributionLine_ID, String trxName)
|
||||
|
@ -40,10 +33,6 @@ public class MDDNetworkDistributionLine extends X_DD_NetworkDistributionLine
|
|||
super (ctx, DD_NetworkDistributionLine_ID, trxName);
|
||||
if (DD_NetworkDistributionLine_ID == 0)
|
||||
{
|
||||
/*setDD_NetworkDistributionLine_ID (0);
|
||||
setDD_NetworkDistribution_ID (0);
|
||||
setM_WarehouseSource_ID (0);
|
||||
setM_Warehouse_ID (0);*/
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,17 +16,39 @@
|
|||
|
||||
package org.eevolution.model;
|
||||
|
||||
import java.io.*;
|
||||
import java.math.*;
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import java.util.logging.*;
|
||||
import java.io.File;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.adempiere.exceptions.AdempiereException;
|
||||
import org.compiere.model.*;
|
||||
import org.compiere.print.*;
|
||||
import org.compiere.process.*;
|
||||
import org.compiere.util.*;
|
||||
import org.compiere.model.MBPartner;
|
||||
import org.compiere.model.MBPartnerLocation;
|
||||
import org.compiere.model.MDocType;
|
||||
import org.compiere.model.MLocator;
|
||||
import org.compiere.model.MMovement;
|
||||
import org.compiere.model.MPeriod;
|
||||
import org.compiere.model.MProduct;
|
||||
import org.compiere.model.MProject;
|
||||
import org.compiere.model.MRefList;
|
||||
import org.compiere.model.MStorage;
|
||||
import org.compiere.model.MUser;
|
||||
import org.compiere.model.ModelValidationEngine;
|
||||
import org.compiere.model.ModelValidator;
|
||||
import org.compiere.model.PO;
|
||||
import org.compiere.model.Query;
|
||||
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.Msg;
|
||||
import org.compiere.util.Util;
|
||||
|
||||
/**
|
||||
* Order Distribution Model.
|
||||
|
@ -35,10 +57,11 @@ import org.compiere.util.*;
|
|||
* Use DocAction and C_DocTypeTarget_ID instead.
|
||||
*
|
||||
* @author Victor Perez,e-Evolution,SC
|
||||
* @version $Id: MDDOrder.java,v
|
||||
*/
|
||||
public class MDDOrder extends X_DD_Order implements DocAction
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Create new Order by copying
|
||||
* @param from order
|
||||
|
@ -185,17 +208,6 @@ public class MDDOrder extends X_DD_Order implements DocAction
|
|||
/** Force Creation of order */
|
||||
private boolean m_forceCreation = false;
|
||||
|
||||
/**
|
||||
* Overwrite Client/Org if required
|
||||
* @param AD_Client_ID client
|
||||
* @param AD_Org_ID org
|
||||
*/
|
||||
public void setClientOrg (int AD_Client_ID, int AD_Org_ID)
|
||||
{
|
||||
super.setClientOrg(AD_Client_ID, AD_Org_ID);
|
||||
} // setClientOrg
|
||||
|
||||
|
||||
/**
|
||||
* Add to Description
|
||||
* @param description text
|
||||
|
@ -209,33 +221,6 @@ public class MDDOrder extends X_DD_Order implements DocAction
|
|||
setDescription(desc + " | " + description);
|
||||
} // addDescription
|
||||
|
||||
/**
|
||||
* Set Business Partner (Ship+Bill)
|
||||
* @param C_BPartner_ID bpartner
|
||||
*/
|
||||
public void setC_BPartner_ID (int C_BPartner_ID)
|
||||
{
|
||||
super.setC_BPartner_ID (C_BPartner_ID);
|
||||
} // setC_BPartner_ID
|
||||
|
||||
/**
|
||||
* Set Business Partner Location (Ship+Bill)
|
||||
* @param C_BPartner_Location_ID bp location
|
||||
*/
|
||||
public void setC_BPartner_Location_ID (int C_BPartner_Location_ID)
|
||||
{
|
||||
super.setC_BPartner_Location_ID (C_BPartner_Location_ID);
|
||||
} // setC_BPartner_Location_ID
|
||||
|
||||
/**
|
||||
* Set Business Partner Contact (Ship+Bill)
|
||||
* @param AD_User_ID user
|
||||
*/
|
||||
public void setAD_User_ID (int AD_User_ID)
|
||||
{
|
||||
super.setAD_User_ID (AD_User_ID);
|
||||
} // setAD_User_ID
|
||||
|
||||
/**
|
||||
* Set Ship Business Partner
|
||||
* @param C_BPartner_ID bpartner
|
||||
|
@ -263,26 +248,6 @@ public class MDDOrder extends X_DD_Order implements DocAction
|
|||
super.setAD_User_ID (AD_User_ID);
|
||||
} // setShip_User_ID
|
||||
|
||||
|
||||
/**
|
||||
* Set Warehouse
|
||||
* @param M_Warehouse_ID warehouse
|
||||
*/
|
||||
public void setM_Warehouse_ID (int M_Warehouse_ID)
|
||||
{
|
||||
super.setM_Warehouse_ID (M_Warehouse_ID);
|
||||
} // setM_Warehouse_ID
|
||||
|
||||
/**
|
||||
* Set Drop Ship
|
||||
* @param IsDropShip drop ship
|
||||
*/
|
||||
public void setIsDropShip (boolean IsDropShip)
|
||||
{
|
||||
super.setIsDropShip (IsDropShip);
|
||||
} // setIsDropShip
|
||||
|
||||
|
||||
/**
|
||||
* Set Business Partner Defaults & Details.
|
||||
* SOTrx should be set.
|
||||
|
@ -318,12 +283,11 @@ public class MDDOrder extends X_DD_Order implements DocAction
|
|||
|
||||
if (getSalesRep_ID() == 0)
|
||||
{
|
||||
ii = Env.getContextAsInt(getCtx(), "#AD_User_ID");
|
||||
ii = Env.getAD_User_ID(getCtx());
|
||||
if (ii != 0)
|
||||
setSalesRep_ID (ii);
|
||||
}
|
||||
|
||||
|
||||
// Set Locations
|
||||
MBPartnerLocation[] locs = bp.getLocations(false);
|
||||
if (locs != null)
|
||||
|
@ -331,22 +295,27 @@ public class MDDOrder extends X_DD_Order implements DocAction
|
|||
for (int i = 0; i < locs.length; i++)
|
||||
{
|
||||
if (locs[i].isShipTo())
|
||||
{
|
||||
super.setC_BPartner_Location_ID(locs[i].getC_BPartner_Location_ID());
|
||||
|
||||
}
|
||||
}
|
||||
// set to first
|
||||
if (getC_BPartner_Location_ID() == 0 && locs.length > 0)
|
||||
{
|
||||
super.setC_BPartner_Location_ID(locs[0].getC_BPartner_Location_ID());
|
||||
|
||||
}
|
||||
}
|
||||
if (getC_BPartner_Location_ID() == 0)
|
||||
{
|
||||
log.log(Level.SEVERE, "MDDOrder.setBPartner - Has no Ship To Address: " + bp);
|
||||
|
||||
}
|
||||
|
||||
// Set Contact
|
||||
MUser[] contacts = bp.getContacts(false);
|
||||
if (contacts != null && contacts.length == 1)
|
||||
{
|
||||
setAD_User_ID(contacts[0].getAD_User_ID());
|
||||
}
|
||||
} // setBPartner
|
||||
|
||||
|
||||
|
@ -354,7 +323,7 @@ public class MDDOrder extends X_DD_Order implements DocAction
|
|||
* Copy Lines From other Order
|
||||
* @param otherOrder order
|
||||
* @param counter set counter info
|
||||
* @param copyASI copy line attributes Attribute Set Instance, Resaouce Assignment
|
||||
* @param copyASI copy line attributes Attribute Set Instance, Resource Assignment
|
||||
* @return number of lines copied
|
||||
*/
|
||||
public int copyLinesFrom (MDDOrder otherOrder, boolean counter, boolean copyASI)
|
||||
|
|
|
@ -145,8 +145,6 @@ public class MPPOrderNode extends X_PP_Order_Node
|
|||
setS_Resource_ID(wfNode.getS_Resource_ID());
|
||||
setSetupTime(wfNode.getSetupTime());
|
||||
setSetupTimeRequiered(wfNode.getSetupTime());
|
||||
BigDecimal time = new BigDecimal(wfNode.getDuration()).multiply(qtyOrdered);
|
||||
setDurationRequiered(time.intValue());
|
||||
setMovingTime(wfNode.getMovingTime());
|
||||
setWaitingTime(wfNode.getWaitingTime());
|
||||
setWorkingTime(wfNode.getWorkingTime());
|
||||
|
@ -166,6 +164,8 @@ public class MPPOrderNode extends X_PP_Order_Node
|
|||
setFinishMode(wfNode.getFinishMode());
|
||||
setValidFrom(wfNode.getValidFrom());
|
||||
setValidTo(wfNode.getValidTo());
|
||||
//
|
||||
setQtyOrdered(qtyOrdered);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -190,16 +190,6 @@ public class MPPOrderNode extends X_PP_Order_Node
|
|||
/** Duration Base MS */
|
||||
private long m_durationBaseMS = -1;
|
||||
|
||||
/**
|
||||
* Set Client Org
|
||||
* @param AD_Client_ID client
|
||||
* @param AD_Org_ID org
|
||||
*/
|
||||
public void setClientOrg (int AD_Client_ID, int AD_Org_ID)
|
||||
{
|
||||
super.setClientOrg (AD_Client_ID, AD_Org_ID);
|
||||
} // setClientOrg
|
||||
|
||||
/**
|
||||
* Load Next
|
||||
*/
|
||||
|
@ -217,6 +207,12 @@ public class MPPOrderNode extends X_PP_Order_Node
|
|||
log.fine("#" + m_next.size());
|
||||
} // loadNext
|
||||
|
||||
public void setQtyOrdered(BigDecimal qtyOrdered)
|
||||
{
|
||||
BigDecimal time = new BigDecimal(getDuration()).multiply(qtyOrdered);
|
||||
setDurationRequiered(time.intValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Number of Next Nodes
|
||||
* @return number of next nodes
|
||||
|
@ -457,7 +453,9 @@ public class MPPOrderNode extends X_PP_Order_Node
|
|||
{
|
||||
String action = getAction();
|
||||
if (action.equals(ACTION_WaitSleep))
|
||||
{
|
||||
;
|
||||
}
|
||||
else if (action.equals(ACTION_AppsProcess) || action.equals(ACTION_AppsReport))
|
||||
{
|
||||
if (getAD_Process_ID() == 0)
|
||||
|
|
Loading…
Reference in New Issue