BF [ 1874419 ] JDBC Statement not close in a finally block
organize imports
This commit is contained in:
parent
f6e16856c9
commit
01a63d62dc
|
@ -13,13 +13,17 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.compiere.FA;
|
package org.compiere.FA;
|
||||||
|
|
||||||
import java.sql.*;
|
|
||||||
import org.compiere.process.*;
|
|
||||||
//import org.compiere.model.X_C_Period;
|
|
||||||
import org.compiere.model.*;
|
|
||||||
import org.compiere.util.DB;
|
|
||||||
//import java.math.*;
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
|
||||||
|
import org.compiere.model.MAssetChange;
|
||||||
|
import org.compiere.model.MRefList_Ext;
|
||||||
|
import org.compiere.model.X_A_Asset_Transfer;
|
||||||
|
import org.compiere.model.X_A_Depreciation_Exp;
|
||||||
|
import org.compiere.process.ProcessInfoParameter;
|
||||||
|
import org.compiere.process.SvrProcess;
|
||||||
|
import org.compiere.util.DB;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Asset Transfer
|
* Asset Transfer
|
||||||
|
@ -86,7 +90,7 @@ public class AssetTransfer extends SvrProcess
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
pstmt = DB.prepareStatement (sql,null);
|
pstmt = DB.prepareStatement (sql,null);
|
||||||
log.info("doIt - SQL=" + sql);
|
log.info("doIt - SQL=" + sql);
|
||||||
|
ResultSet rs = null;
|
||||||
//X_A_Depreciation_Exp depexp = new X_A_Depreciation_Exp (getCtx(), 0, null);
|
//X_A_Depreciation_Exp depexp = new X_A_Depreciation_Exp (getCtx(), 0, null);
|
||||||
|
|
||||||
String clientCheck = " AND AD_Client_ID=" + AssetTransfer.getAD_Client_ID();
|
String clientCheck = " AND AD_Client_ID=" + AssetTransfer.getAD_Client_ID();
|
||||||
|
@ -102,7 +106,7 @@ public class AssetTransfer extends SvrProcess
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (AssetTransfer.isA_Transfer_Balance_IS()==true)
|
if (AssetTransfer.isA_Transfer_Balance_IS()==true)
|
||||||
{
|
{
|
||||||
while (rs.next());
|
while (rs.next());
|
||||||
|
@ -132,25 +136,16 @@ public class AssetTransfer extends SvrProcess
|
||||||
depexp1.setA_Period(AssetTransfer.getC_Period_ID());
|
depexp1.setA_Period(AssetTransfer.getC_Period_ID());
|
||||||
depexp1.setA_Entry_Type("TRN");
|
depexp1.setA_Entry_Type("TRN");
|
||||||
depexp1.save();
|
depexp1.save();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.info("getDeliveries"+ e);
|
log.info("getDeliveries"+ e);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
try
|
DB.close(rs, pstmt);
|
||||||
{
|
rs = null; pstmt = null;
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{}
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sql = null;
|
sql = null;
|
||||||
|
@ -166,7 +161,7 @@ public class AssetTransfer extends SvrProcess
|
||||||
pstmt = DB.prepareStatement (sql,ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE,null);
|
pstmt = DB.prepareStatement (sql,ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE,null);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
rs.first();
|
rs.first();
|
||||||
|
|
||||||
X_A_Depreciation_Exp depexp2 = new X_A_Depreciation_Exp (getCtx(), 0, null);
|
X_A_Depreciation_Exp depexp2 = new X_A_Depreciation_Exp (getCtx(), 0, null);
|
||||||
|
@ -263,25 +258,15 @@ public class AssetTransfer extends SvrProcess
|
||||||
|
|
||||||
// Remove Entry from Processing file
|
// Remove Entry from Processing file
|
||||||
|
|
||||||
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.info("TransferAssets"+ e);
|
log.info("TransferAssets"+ e);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
try
|
DB.close(rs, pstmt);
|
||||||
{
|
rs = null; pstmt = null;
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{}
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
} // doIt
|
} // doIt
|
||||||
|
|
|
@ -13,12 +13,12 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.compiere.FA;
|
package org.compiere.FA;
|
||||||
|
|
||||||
import java.sql.*;
|
import java.sql.PreparedStatement;
|
||||||
//import java.text.SimpleDateFormat;
|
import java.sql.ResultSet;
|
||||||
//import java.util.Date;
|
|
||||||
import java.util.GregorianCalendar;
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import org.compiere.util.*;
|
import java.util.GregorianCalendar;
|
||||||
|
|
||||||
|
import org.compiere.util.DB;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fixed Asset Conventions
|
* Fixed Asset Conventions
|
||||||
|
@ -77,8 +77,9 @@ public class Conventions {
|
||||||
|
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
pstmt = DB.prepareStatement (sqlB.toString(),null);
|
pstmt = DB.prepareStatement (sqlB.toString(),null);
|
||||||
|
ResultSet rs = null;
|
||||||
try {
|
try {
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next()){
|
while (rs.next()){
|
||||||
Calendar calendar = new GregorianCalendar();
|
Calendar calendar = new GregorianCalendar();
|
||||||
calendar.setTime(rs.getDate("ASSETSERVICEDATE"));
|
calendar.setTime(rs.getDate("ASSETSERVICEDATE"));
|
||||||
|
@ -111,16 +112,9 @@ public class Conventions {
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
try
|
DB.close(rs, pstmt);
|
||||||
{
|
rs = null; pstmt = null;
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{}
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return v_adj;
|
return v_adj;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,12 +13,21 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.compiere.FA;
|
package org.compiere.FA;
|
||||||
|
|
||||||
import java.sql.*;
|
|
||||||
|
|
||||||
import org.compiere.model.*;
|
|
||||||
import org.compiere.process.*;
|
|
||||||
import org.compiere.util.DB;
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
|
||||||
|
import org.compiere.model.MAssetAcct;
|
||||||
|
import org.compiere.model.MAssetChange;
|
||||||
|
import org.compiere.model.MRefList_Ext;
|
||||||
|
import org.compiere.model.X_A_Asset;
|
||||||
|
import org.compiere.model.X_A_Asset_Addition;
|
||||||
|
import org.compiere.model.X_A_Asset_Group_Acct;
|
||||||
|
import org.compiere.model.X_A_Depreciation_Workfile;
|
||||||
|
import org.compiere.model.X_GL_JournalLine;
|
||||||
|
import org.compiere.process.ProcessInfoParameter;
|
||||||
|
import org.compiere.process.SvrProcess;
|
||||||
|
import org.compiere.util.DB;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create Asset from FA GL Process
|
* Create Asset from FA GL Process
|
||||||
|
@ -59,17 +68,18 @@ public class CreateGLAsset extends SvrProcess
|
||||||
protected String doIt() throws java.lang.Exception
|
protected String doIt() throws java.lang.Exception
|
||||||
{
|
{
|
||||||
log.info("Starting inbound invoice process");
|
log.info("Starting inbound invoice process");
|
||||||
int uselifemonths = 0;
|
// int uselifemonths = 0;
|
||||||
int uselifeyears = 0;
|
// int uselifeyears = 0;
|
||||||
|
|
||||||
String sql =" SELECT * FROM GL_JOURNALLINE WHERE A_Processed <> 'Y' and AD_Client_ID = ?"
|
String sql =" SELECT * FROM GL_JOURNALLINE WHERE A_Processed <> 'Y' and AD_Client_ID = ?"
|
||||||
+ " and A_CreateAsset = 'Y' and Processed = 'Y'";
|
+ " and A_CreateAsset = 'Y' and Processed = 'Y'";
|
||||||
log.info(sql);
|
log.info(sql);
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
pstmt = DB.prepareStatement(sql,get_TrxName());
|
pstmt = DB.prepareStatement(sql,get_TrxName());
|
||||||
|
ResultSet rs = null;
|
||||||
try {
|
try {
|
||||||
pstmt.setInt(1, p_client);
|
pstmt.setInt(1, p_client);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
|
|
||||||
while (rs.next()){
|
while (rs.next()){
|
||||||
|
|
||||||
|
@ -137,8 +147,8 @@ public class CreateGLAsset extends SvrProcess
|
||||||
asset.setIsDepreciated(true);
|
asset.setIsDepreciated(true);
|
||||||
asset.setIsOwned(true);
|
asset.setIsOwned(true);
|
||||||
asset.save();
|
asset.save();
|
||||||
uselifemonths = assetgrpacct.getUseLifeMonths();
|
// uselifemonths = assetgrpacct.getUseLifeMonths();
|
||||||
uselifeyears = assetgrpacct.getUseLifeYears();
|
// uselifeyears = assetgrpacct.getUseLifeYears();
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(asset.getUseLifeMonths() == 0){
|
else if(asset.getUseLifeMonths() == 0){
|
||||||
|
@ -147,13 +157,14 @@ public class CreateGLAsset extends SvrProcess
|
||||||
asset.setIsDepreciated(true);
|
asset.setIsDepreciated(true);
|
||||||
asset.setIsOwned(true);
|
asset.setIsOwned(true);
|
||||||
asset.save();
|
asset.save();
|
||||||
uselifemonths = asset.getUseLifeYears()*12;
|
// uselifemonths = asset.getUseLifeYears()*12;
|
||||||
uselifeyears = asset.getUseLifeYears();
|
// uselifeyears = asset.getUseLifeYears();
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
assetacct.setA_Period_End(asset.getUseLifeMonths());
|
assetacct.setA_Period_End(asset.getUseLifeMonths());
|
||||||
uselifemonths = asset.getUseLifeMonths();
|
// uselifemonths = asset.getUseLifeMonths();
|
||||||
uselifeyears = asset.getUseLifeYears();}
|
// uselifeyears = asset.getUseLifeYears();
|
||||||
|
}
|
||||||
|
|
||||||
assetacct.setA_Depreciation_Method_ID(assetgrpacct.getA_Depreciation_Calc_Type());
|
assetacct.setA_Depreciation_Method_ID(assetgrpacct.getA_Depreciation_Calc_Type());
|
||||||
assetacct.setA_Asset_Acct(assetgrpacct.getA_Asset_Acct());
|
assetacct.setA_Asset_Acct(assetgrpacct.getA_Asset_Acct());
|
||||||
|
@ -267,11 +278,12 @@ public class CreateGLAsset extends SvrProcess
|
||||||
sql2 ="SELECT * FROM A_Depreciation_Workfile WHERE A_Asset_ID = ? and PostingType = ?";
|
sql2 ="SELECT * FROM A_Depreciation_Workfile WHERE A_Asset_ID = ? and PostingType = ?";
|
||||||
PreparedStatement pstmt2 = null;
|
PreparedStatement pstmt2 = null;
|
||||||
pstmt2 = DB.prepareStatement(sql2,get_TrxName());
|
pstmt2 = DB.prepareStatement(sql2,get_TrxName());
|
||||||
|
ResultSet rs3 = null;
|
||||||
log.info("no");
|
log.info("no");
|
||||||
try {
|
try {
|
||||||
pstmt2.setInt(1, asset.getA_Asset_ID());
|
pstmt2.setInt(1, asset.getA_Asset_ID());
|
||||||
pstmt2.setString(2, assetgrpacct.getPostingType());
|
pstmt2.setString(2, assetgrpacct.getPostingType());
|
||||||
ResultSet rs3 = pstmt2.executeQuery();
|
rs3 = pstmt2.executeQuery();
|
||||||
while (rs3.next()){
|
while (rs3.next()){
|
||||||
X_A_Depreciation_Workfile assetwk = new X_A_Depreciation_Workfile (getCtx(), rs3, get_TrxName());
|
X_A_Depreciation_Workfile assetwk = new X_A_Depreciation_Workfile (getCtx(), rs3, get_TrxName());
|
||||||
assetwk.setA_Asset_ID(asset.getA_Asset_ID());
|
assetwk.setA_Asset_ID(asset.getA_Asset_ID());
|
||||||
|
@ -311,26 +323,17 @@ public class CreateGLAsset extends SvrProcess
|
||||||
change.save();
|
change.save();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rs3.close();
|
|
||||||
pstmt2.close();
|
|
||||||
pstmt2 = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.info("getAssets "+ e);
|
log.info("getAssets "+ e);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
try
|
DB.close(rs3, pstmt2);
|
||||||
{
|
rs3 = null; pstmt2 = null;
|
||||||
if (pstmt2 != null)
|
}
|
||||||
pstmt2.close ();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{}
|
|
||||||
pstmt2 = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -374,17 +377,10 @@ public class CreateGLAsset extends SvrProcess
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
try
|
DB.close(rs, pstmt);
|
||||||
{
|
rs = null; pstmt = null;
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{}
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
|
return "";
|
||||||
return "";
|
|
||||||
} // doIt
|
} // doIt
|
||||||
|
|
||||||
} // CreateGLAsset
|
} // CreateGLAsset
|
||||||
|
|
|
@ -13,16 +13,25 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.compiere.FA;
|
package org.compiere.FA;
|
||||||
|
|
||||||
import java.sql.*;
|
import java.math.BigDecimal;
|
||||||
import java.math.*;
|
import java.sql.CallableStatement;
|
||||||
import org.compiere.process.*;
|
import java.sql.PreparedStatement;
|
||||||
import org.compiere.model.X_AD_Sequence;
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
|
||||||
|
import org.compiere.model.MAccount;
|
||||||
import org.compiere.model.MJournal;
|
import org.compiere.model.MJournal;
|
||||||
import org.compiere.model.MJournalBatch;
|
import org.compiere.model.MJournalBatch;
|
||||||
import org.compiere.model.MJournalLine;
|
import org.compiere.model.MJournalLine;
|
||||||
import org.compiere.model.MAccount;
|
import org.compiere.model.MXIFAJournal;
|
||||||
import org.compiere.model.*;
|
import org.compiere.model.X_AD_Sequence;
|
||||||
import org.compiere.util.*;
|
import org.compiere.model.X_I_FAJournal;
|
||||||
|
import org.compiere.process.ProcessInfoParameter;
|
||||||
|
import org.compiere.process.SvrProcess;
|
||||||
|
import org.compiere.util.DB;
|
||||||
|
import org.compiere.util.Env;
|
||||||
|
import org.compiere.util.TimeUtil;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -157,14 +166,14 @@ public class ImportFAJournal2 extends SvrProcess
|
||||||
|
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
pstmt = DB.prepareStatement (sqlst, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE,get_TrxName());
|
pstmt = DB.prepareStatement (sqlst, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE,get_TrxName());
|
||||||
|
ResultSet rs = null;
|
||||||
try {
|
try {
|
||||||
int v_FirstTime = 0;
|
int v_FirstTime = 0;
|
||||||
String v_C_BatchNo = "";
|
String v_C_BatchNo = "";
|
||||||
BigDecimal v_AMTSOURCEDR ;
|
BigDecimal v_AMTSOURCEDR ;
|
||||||
BigDecimal v_AMTSOURCECR ;
|
BigDecimal v_AMTSOURCECR ;
|
||||||
int v_ID_START = 10;
|
int v_ID_START = 10;
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -237,24 +246,15 @@ public class ImportFAJournal2 extends SvrProcess
|
||||||
+ " WHERE A_DEPRECIATION_ENTRY_ID = " + rs.getInt("A_DEPRECIATION_ENTRY_ID"));
|
+ " WHERE A_DEPRECIATION_ENTRY_ID = " + rs.getInt("A_DEPRECIATION_ENTRY_ID"));
|
||||||
no = DB.executeUpdate (sql4,get_TrxName());
|
no = DB.executeUpdate (sql4,get_TrxName());
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}catch (Exception e)
|
}catch (Exception e)
|
||||||
{
|
{
|
||||||
log.info("ImportFAJournal2"+ e);
|
log.info("ImportFAJournal2"+ e);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
try
|
DB.close(rs, pstmt);
|
||||||
{
|
rs = null; pstmt = null;
|
||||||
if (pstmt != null)
|
}
|
||||||
pstmt.close ();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{}
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Set IsActive, Created/Updated
|
// Set IsActive, Created/Updated
|
||||||
|
@ -674,7 +674,7 @@ public class ImportFAJournal2 extends SvrProcess
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql.toString(),get_TrxName());
|
pstmt = DB.prepareStatement (sql.toString(),get_TrxName());
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
if (rs.next ())
|
if (rs.next ())
|
||||||
{
|
{
|
||||||
BigDecimal source = rs.getBigDecimal(1);
|
BigDecimal source = rs.getBigDecimal(1);
|
||||||
|
@ -689,23 +689,16 @@ public class ImportFAJournal2 extends SvrProcess
|
||||||
if (acct != null)
|
if (acct != null)
|
||||||
addLog (0, null, acct, "@AmtAcctDr@- @AmtAcctCr@");
|
addLog (0, null, acct, "@AmtAcctDr@- @AmtAcctCr@");
|
||||||
}
|
}
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (SQLException ex)
|
catch (SQLException ex)
|
||||||
{
|
{
|
||||||
log.info ("doIt - get balance"+ ex);
|
log.info ("doIt - get balance"+ ex);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
{
|
||||||
if (pstmt != null)
|
DB.close(rs, pstmt);
|
||||||
pstmt.close ();
|
rs = null; pstmt = null;
|
||||||
}
|
}
|
||||||
catch (SQLException ex1)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
pstmt = null;
|
|
||||||
|
|
||||||
// Count Errors
|
// Count Errors
|
||||||
int errors = DB.getSQLValue(get_TrxName(), "SELECT COUNT(*) FROM I_FAJournal WHERE I_IsImported NOT IN ('Y','N')" + clientCheck);
|
int errors = DB.getSQLValue(get_TrxName(), "SELECT COUNT(*) FROM I_FAJournal WHERE I_IsImported NOT IN ('Y','N')" + clientCheck);
|
||||||
|
@ -740,7 +733,7 @@ public class ImportFAJournal2 extends SvrProcess
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql.toString (),get_TrxName());
|
pstmt = DB.prepareStatement (sql.toString (),get_TrxName());
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
//
|
//
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
|
@ -963,24 +956,17 @@ public class ImportFAJournal2 extends SvrProcess
|
||||||
noInsertLine++;
|
noInsertLine++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.info("doIt"+ e);
|
log.info("doIt"+ e);
|
||||||
}
|
}
|
||||||
// clean up
|
// clean up
|
||||||
try
|
finally
|
||||||
{
|
{
|
||||||
if (pstmt != null)
|
DB.close(rs, pstmt);
|
||||||
pstmt.close ();
|
rs = null; pstmt = null;
|
||||||
}
|
}
|
||||||
catch (SQLException ex1)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
pstmt = null;
|
|
||||||
|
|
||||||
// Set Error to indicator to not imported
|
// Set Error to indicator to not imported
|
||||||
sql = new StringBuffer ("UPDATE I_FAJournal "
|
sql = new StringBuffer ("UPDATE I_FAJournal "
|
||||||
|
@ -1003,36 +989,25 @@ public class ImportFAJournal2 extends SvrProcess
|
||||||
+ "WHERE A_ASSET.A_ASSET_ID = A_DEPRECIATION_WORKFILE.A_ASSET_ID "
|
+ "WHERE A_ASSET.A_ASSET_ID = A_DEPRECIATION_WORKFILE.A_ASSET_ID "
|
||||||
+ "AND A_DEPRECIATION_WORKFILE.A_PERIOD_POSTED = A_DEPRECIATION_WORKFILE.A_LIFE_PERIOD ";
|
+ "AND A_DEPRECIATION_WORKFILE.A_PERIOD_POSTED = A_DEPRECIATION_WORKFILE.A_LIFE_PERIOD ";
|
||||||
|
|
||||||
pstmt = null;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement(sql3,get_TrxName());
|
pstmt = DB.prepareStatement(sql3,get_TrxName());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next()){
|
while (rs.next()){
|
||||||
|
|
||||||
String sql4 = "UPDATE A_ASSET SET ISFULLYDEPRECIATED = 'Y' WHERE A_Asset_ID = " + rs.getInt("A_ASSET_ID");
|
String sql4 = "UPDATE A_ASSET SET ISFULLYDEPRECIATED = 'Y' WHERE A_Asset_ID = " + rs.getInt("A_ASSET_ID");
|
||||||
no = DB.executeUpdate (sql4,get_TrxName());
|
no = DB.executeUpdate (sql4,get_TrxName());
|
||||||
}
|
}
|
||||||
rs.close();
|
}
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.info("Post Depreciation"+ e);
|
log.info("Post Depreciation"+ e);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
try
|
DB.close(rs, pstmt);
|
||||||
{
|
rs = null; pstmt = null;
|
||||||
if (pstmt != null)
|
}
|
||||||
pstmt.close ();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{}
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
} // doIt
|
} // doIt
|
||||||
|
|
||||||
|
|
|
@ -16,11 +16,17 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.compiere.process;
|
package org.compiere.process;
|
||||||
|
|
||||||
import java.sql.*;
|
import java.sql.PreparedStatement;
|
||||||
import java.util.*;
|
import java.sql.ResultSet;
|
||||||
import java.util.logging.*;
|
import java.util.ArrayList;
|
||||||
import org.compiere.model.*;
|
import java.util.logging.Level;
|
||||||
import org.compiere.util.*;
|
|
||||||
|
import org.compiere.model.MBOM;
|
||||||
|
import org.compiere.model.MBOMProduct;
|
||||||
|
import org.compiere.model.MProduct;
|
||||||
|
import org.compiere.model.MProductBOM;
|
||||||
|
import org.compiere.util.DB;
|
||||||
|
import org.compiere.util.Env;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate BOM
|
* Validate BOM
|
||||||
|
@ -90,6 +96,7 @@ public class BOMValidate extends SvrProcess
|
||||||
sql += "AND IsVerified<>'Y' ";
|
sql += "AND IsVerified<>'Y' ";
|
||||||
sql += "ORDER BY Name";
|
sql += "ORDER BY Name";
|
||||||
int AD_Client_ID = Env.getAD_Client_ID(getCtx());
|
int AD_Client_ID = Env.getAD_Client_ID(getCtx());
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, null);
|
pstmt = DB.prepareStatement (sql, null);
|
||||||
|
@ -97,30 +104,22 @@ public class BOMValidate extends SvrProcess
|
||||||
pstmt.setInt (1, AD_Client_ID);
|
pstmt.setInt (1, AD_Client_ID);
|
||||||
else
|
else
|
||||||
pstmt.setInt(1, p_M_Product_Category_ID);
|
pstmt.setInt(1, p_M_Product_Category_ID);
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
{
|
{
|
||||||
String info = validateProduct(new MProduct(getCtx(), p_M_Product_ID, get_TrxName()));
|
String info = validateProduct(new MProduct(getCtx(), p_M_Product_ID, get_TrxName()));
|
||||||
addLog(0, null, null, info);
|
addLog(0, null, null, info);
|
||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log (Level.SEVERE, sql, e);
|
log.log (Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
{
|
||||||
if (pstmt != null)
|
DB.close(rs, pstmt);
|
||||||
pstmt.close ();
|
rs = null; pstmt = null;
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
return "#" + counter;
|
return "#" + counter;
|
||||||
} // doIt
|
} // doIt
|
||||||
|
|
Loading…
Reference in New Issue