Commit 7b612837 authored by msingh's avatar msingh

D15CKAT001, Changes for MS SQL Server.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98667 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 0113a849
...@@ -81,12 +81,12 @@ public class InvHoldRelConf extends ActionHandlerEJB implements InvHoldRelConfLo ...@@ -81,12 +81,12 @@ public class InvHoldRelConf extends ActionHandlerEJB implements InvHoldRelConfLo
public String confirm(String tranId,String xtraParams, String forcedFlag ,Connection conn,boolean isConn) throws RemoteException,ITMException public String confirm(String tranId,String xtraParams, String forcedFlag ,Connection conn,boolean isConn) throws RemoteException,ITMException
{ {
// Connection conn = null; // Connection conn = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
String sql = ""; String sql = "";
// ConnDriver connDriver = null; // ConnDriver connDriver = null;
String loginEmpCode = null; String loginEmpCode = null;
ibase.utility.E12GenericUtility genericUtility= null; ibase.utility.E12GenericUtility genericUtility= null;
...@@ -152,9 +152,9 @@ public class InvHoldRelConf extends ActionHandlerEJB implements InvHoldRelConfLo ...@@ -152,9 +152,9 @@ public class InvHoldRelConf extends ActionHandlerEJB implements InvHoldRelConfLo
itmDBAccessEJB = new ITMDBAccessEJB(); itmDBAccessEJB = new ITMDBAccessEJB();
genericUtility = new ibase.utility.E12GenericUtility(); genericUtility = new ibase.utility.E12GenericUtility();
// connDriver = new ConnDriver(); // connDriver = new ConnDriver();
// conn = connDriver.getConnectDB("DriverITM"); // conn = connDriver.getConnectDB("DriverITM");
// conn.setAutoCommit(false); // conn.setAutoCommit(false);
loginEmpCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginEmpCode"); loginEmpCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginEmpCode");
//Changed by sumit on 02/10/12 getting loginempCode in case of null start. //Changed by sumit on 02/10/12 getting loginempCode in case of null start.
...@@ -374,8 +374,23 @@ public class InvHoldRelConf extends ActionHandlerEJB implements InvHoldRelConfLo ...@@ -374,8 +374,23 @@ public class InvHoldRelConf extends ActionHandlerEJB implements InvHoldRelConfLo
else //i.e. line_sl is not found else //i.e. line_sl is not found
{ {
HashMap pkKeyValMap = new HashMap(); HashMap pkKeyValMap = new HashMap();
StringBuffer sb = new StringBuffer("SELECT ITEM_CODE,SITE_CODE,LOC_CODE,LOT_NO,LOT_SL,QUANTITY, HOLD_QTY, QTY_PER_ART FROM STOCK WHERE ");//change on 09/jun/14 compare with inv_hold_rel_trace table
// Changed by Manish on 30/09/15 for Ms Sql Server.
StringBuffer sb ;
String DB = CommonConstants.DB_NAME;
if("mssql".equalsIgnoreCase(DB))
{
sb = new StringBuffer("SELECT S.ITEM_CODE, S.SITE_CODE, S.LOC_CODE, S.LOT_NO, S.LOT_SL, S.QUANTITY, S.HOLD_QTY, S.QTY_PER_ART FROM STOCK S ");//change on 09/jun/14 compare with inv_hold_rel_trace table
sb.append(" inner join (select ITEM_CODE,SITE_CODE,LOC_CODE,LOT_NO,LOT_SL from inv_hold_rel_trace where ref_no ='"+tranIdHold+"') A on (S.ITEM_CODE = A.ITEM_CODE AND S.SITE_CODE = A.SITE_CODE AND S.LOC_CODE = A.LOC_CODE AND S.LOT_NO = A.LOT_NO AND S.LOT_SL = A.LOT_SL ) ") ;
sb.append(" where S.QUANTITY > 0 and S.HOLD_QTY > 0 and ") ;
}
else
{
sb = new StringBuffer("SELECT ITEM_CODE,SITE_CODE,LOC_CODE,LOT_NO,LOT_SL,QUANTITY, HOLD_QTY, QTY_PER_ART FROM STOCK WHERE ");//change on 09/jun/14 compare with inv_hold_rel_trace table
sb.append(" ( ITEM_CODE,SITE_CODE,LOC_CODE,LOT_NO,LOT_SL ) in (select ITEM_CODE,SITE_CODE,LOC_CODE,LOT_NO,LOT_SL from inv_hold_rel_trace where ref_no ='"+tranIdHold+"') and STOCK.QUANTITY > 0 and STOCK.HOLD_QTY > 0 and ") ;//ADDED BY KUNAL ON 27/MAY/14 add extra condition for data filter sb.append(" ( ITEM_CODE,SITE_CODE,LOC_CODE,LOT_NO,LOT_SL ) in (select ITEM_CODE,SITE_CODE,LOC_CODE,LOT_NO,LOT_SL from inv_hold_rel_trace where ref_no ='"+tranIdHold+"') and STOCK.QUANTITY > 0 and STOCK.HOLD_QTY > 0 and ") ;//ADDED BY KUNAL ON 27/MAY/14 add extra condition for data filter
}
// Changed by Manish on 30/09/15 for Ms Sql Server.
ArrayList pkList = new ArrayList(); ArrayList pkList = new ArrayList();
if ( itemCode != null && itemCode.length() > 0 ) if ( itemCode != null && itemCode.length() > 0 )
...@@ -409,6 +424,12 @@ public class InvHoldRelConf extends ActionHandlerEJB implements InvHoldRelConfLo ...@@ -409,6 +424,12 @@ public class InvHoldRelConf extends ActionHandlerEJB implements InvHoldRelConfLo
for ( int i = 0; i < pkList.size(); i++ ) for ( int i = 0; i < pkList.size(); i++ )
{ {
key = pkList.get(i).toString(); key = pkList.get(i).toString();
if("mssql".equalsIgnoreCase(DB))
{
sb.append("S."); // S added by manish for mssql
}
sb.append(key).append(" = ? and "); sb.append(key).append(" = ? and ");
} }
String stockQuery = sb.toString(); String stockQuery = sb.toString();
...@@ -601,6 +622,22 @@ public class InvHoldRelConf extends ActionHandlerEJB implements InvHoldRelConfLo ...@@ -601,6 +622,22 @@ public class InvHoldRelConf extends ActionHandlerEJB implements InvHoldRelConfLo
pstmt.executeUpdate(); pstmt.executeUpdate();
*/ */
//Changed by Manish on 16/09/2015 for Ms Sql Server.
String DB = CommonConstants.DB_NAME;
if("mssql".equalsIgnoreCase(DB))
{
sql = " update inv_hold_det set "
+" hold_status = 'R', "
+" STATUS_DATE = ? "
+" from inv_hold_det hd "
+" inner join ( select rd.tran_id__hold, rd.line_no__hold "
+" from inv_hold_rel_det rd "
+"where tran_id = ? ) A on (hd.tran_id = A.TRAN_ID__HOLD and hd.line_no = A.line_no__hold)";
}
else
{
sql = " update inv_hold_det hd set " sql = " update inv_hold_det hd set "
+" hd.hold_status = 'R', " +" hd.hold_status = 'R', "
+" hd.STATUS_DATE = ? " +" hd.STATUS_DATE = ? "
...@@ -608,6 +645,8 @@ public class InvHoldRelConf extends ActionHandlerEJB implements InvHoldRelConfLo ...@@ -608,6 +645,8 @@ public class InvHoldRelConf extends ActionHandlerEJB implements InvHoldRelConfLo
+" in ( select rd.tran_id__hold, rd.line_no__hold " +" in ( select rd.tran_id__hold, rd.line_no__hold "
+" from inv_hold_rel_det rd " +" from inv_hold_rel_det rd "
+" where tran_id = ? )"; +" where tran_id = ? )";
}
//Changed by Manish on 16/09/2015 for Ms Sql Server.
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp( 1 , new java.sql.Timestamp( System.currentTimeMillis() ) ); pstmt.setTimestamp( 1 , new java.sql.Timestamp( System.currentTimeMillis() ) );
...@@ -705,7 +744,7 @@ public class InvHoldRelConf extends ActionHandlerEJB implements InvHoldRelConfLo ...@@ -705,7 +744,7 @@ public class InvHoldRelConf extends ActionHandlerEJB implements InvHoldRelConfLo
} }
//changed by Dharmesh on 12-08-2011 [WM1ESUN004] to auto genrate Transacion Id for inv_hold_rel_trace.start //changed by Dharmesh on 12-08-2011 [WM1ESUN004] to auto genrate Transacion Id for inv_hold_rel_trace.start
// METHOD ARGS CHANGED BY RITESH ON 13/MAR/14 // METHOD ARGS CHANGED BY RITESH ON 13/MAR/14
public String generateTranId(String windowName,String siteCode,Connection conn)throws ITMException public String generateTranId(String windowName,String siteCode,Connection conn)throws ITMException
{ {
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
......
...@@ -305,7 +305,14 @@ public class StockDeAllocConf extends ActionHandlerEJB implements StockDeAllocCo ...@@ -305,7 +305,14 @@ public class StockDeAllocConf extends ActionHandlerEJB implements StockDeAllocCo
System.out.println("updateSql------->"+updateSorditem); System.out.println("updateSql------->"+updateSorditem);
st = conn.prepareStatement(updateSorditem); st = conn.prepareStatement(updateSorditem);
st.executeUpdate(updateSorditem); // Changed by Manish on 28/09/15 [start]
// The method executeUpdate() cannot take arguments on a PreparedStatement
//st.executeUpdate(updateSorditem);
st.executeUpdate();
// Changed by Manish on 28/09/15 [End]
System.out.println("UPDATE SUCCESS FOR SORDITEM....>>>>>>>>"); System.out.println("UPDATE SUCCESS FOR SORDITEM....>>>>>>>>");
st.close(); st.close();
st = null; st = null;
...@@ -319,7 +326,13 @@ public class StockDeAllocConf extends ActionHandlerEJB implements StockDeAllocCo ...@@ -319,7 +326,13 @@ public class StockDeAllocConf extends ActionHandlerEJB implements StockDeAllocCo
+ " AND LOC_CODE = '" + locCode + "' " ; + " AND LOC_CODE = '" + locCode + "' " ;
System.out.println("updateSql:::>>>>"+ updateSql); System.out.println("updateSql:::>>>>"+ updateSql);
st = conn.prepareStatement(updateSql); st = conn.prepareStatement(updateSql);
updCount=st.executeUpdate(updateSql);
// Changed by Manish on 28/09/15 [start]
// The method executeUpdate() cannot take arguments on a PreparedStatement
//updCount=st.executeUpdate(updateSql);
updCount=st.executeUpdate();
// Changed by Manish on 28/09/15 [End]
if ( updCount > 0 ) if ( updCount > 0 )
{ {
System.out.println("UPDATE SUCCESS FOR SORDITEM....>>>>>>>>"); System.out.println("UPDATE SUCCESS FOR SORDITEM....>>>>>>>>");
...@@ -337,7 +350,15 @@ public class StockDeAllocConf extends ActionHandlerEJB implements StockDeAllocCo ...@@ -337,7 +350,15 @@ public class StockDeAllocConf extends ActionHandlerEJB implements StockDeAllocCo
+ " AND LOC_CODE = '" + locCode + "' " ; + " AND LOC_CODE = '" + locCode + "' " ;
System.out.println("SqlQtyAlloc:::>>>>"+ SqlQtyAlloc); System.out.println("SqlQtyAlloc:::>>>>"+ SqlQtyAlloc);
st = conn.prepareStatement(SqlQtyAlloc); st = conn.prepareStatement(SqlQtyAlloc);
rsQtyAlloc = st.executeQuery(SqlQtyAlloc);
// Changed by Manish on 28/09/15
// The method executeUpdate() cannot take arguments on a PreparedStatement
//rsQtyAlloc = st.executeQuery(SqlQtyAlloc);
rsQtyAlloc = st.executeQuery();
// Changed by Manish on 28/09/15
if (rsQtyAlloc.next()) if (rsQtyAlloc.next())
{ {
System.out.println("Updated Allocated Qty :::"+rsQtyAlloc.getDouble(1)); System.out.println("Updated Allocated Qty :::"+rsQtyAlloc.getDouble(1));
...@@ -353,7 +374,15 @@ public class StockDeAllocConf extends ActionHandlerEJB implements StockDeAllocCo ...@@ -353,7 +374,15 @@ public class StockDeAllocConf extends ActionHandlerEJB implements StockDeAllocCo
+ " AND LOC_CODE = '" + locCode + "' " ; + " AND LOC_CODE = '" + locCode + "' " ;
System.out.println("DelQtyAlloc:::"+DelQtyAlloc); System.out.println("DelQtyAlloc:::"+DelQtyAlloc);
st1 = conn.prepareStatement(DelQtyAlloc); st1 = conn.prepareStatement(DelQtyAlloc);
st1.executeUpdate(DelQtyAlloc);
// Changed by Manish on 28/09/15
// The method executeUpdate() cannot take arguments on a PreparedStatement
//st1.executeUpdate(DelQtyAlloc);
st1.executeUpdate();
// Changed by Manish on 28/09/15
System.out.println("Delete completed "); System.out.println("Delete completed ");
st1.close(); st1.close();
st1 = null; st1 = null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment