Commit a175defb authored by sanashaikh's avatar sanashaikh

Sana S: Modified on 26/02/20

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@217126 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 7050e3c5
......@@ -43,12 +43,13 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
java.util.Date toPrdDate = null;
AdmCommon admCommon = new AdmCommon();
ITMDBAccessEJB itmDBAccess = null;
//Modified by Azhar on [06-Sep-2019][As per new framework][Start]
//GenericUtility genericUtility = GenericUtility.getInstance();
E12GenericUtility genericUtility = new E12GenericUtility();
//Modified by Azhar on [06-Sep-2019][As per new framework][End]
ITMDBAccessEJB itmDBAccessEJB=new ITMDBAccessEJB();
CommonConstants commonConstants = new CommonConstants();
......@@ -98,7 +99,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
//Modified by Azhar on[06-Sep-2019][Conn created to invoke process method from Events Affecting Confirmation][Start]
Connection conn = null;
//Modified by Azhar on[06-Sep-2019][Conn created to invoke process method from Events Affecting Confirmation][End]
itmDBAccess = new ITMDBAccessEJB();
try
{
//Modified by Azhar on[06-Sep-2019][Conn created to invoke process method from Events Affecting Confirmation][Start]
......@@ -129,11 +130,16 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
}
//Modified by Azhar on[06-Sep-2019][To invoke process method from Events Affecting Confirmation][Start]
//rtrStr = process(headerDom, detailDom, windowName, xtraParams);
rtrStr = process(headerDom, detailDom, windowName, xtraParams,conn);
//rtrStr = process(headerDom, detailDom, windowName, xtraParams,conn);//Commented by Sana S on 20/12/19
//Modified by Sana S on 20/12/19[start]
rtrStr = process(headerDom, detailDom, windowName, xtraParams,conn,2);
//Modified by Sana S on 20/12/19[end]
System.out.println("rtrStr :"+rtrStr);
if(rtrStr == null || rtrStr.trim().length() == 0)
{
conn.commit();
rtrStr = itmDBAccess.getErrorString("","VTPCOMPT","","",conn);// Added by sana s on 25/02/2020
}
else
{
......@@ -185,7 +191,10 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
//Modified by Azhar on[06-Sep-2019][To invoke process method from Events Affecting Confirmation][Start]
//public String process(Document headerDom, Document detailDom, String windowName, String xtraParams) throws RemoteException,ITMException
public String process(Document headerDom, Document detailDom, String windowName, String xtraParams,Connection conn) throws RemoteException,ITMException
//Modified by Sana S on 20/12/19 [start]
//public String process(Document headerDom, Document detailDom, String windowName, String xtraParams,Connection conn) throws RemoteException,ITMException
public String process(Document headerDom, Document detailDom, String windowName, String xtraParams,Connection conn,int commitOpt) throws RemoteException,ITMException
//Modified by Sana S on 20/12/19 [end]
//Modified by Azhar on[06-Sep-2019][To invoke process method from Events Affecting Confirmation][End]
{
//Commented by Azhar on[06-Sep-2019][Connection created in above method][Start]
......@@ -203,8 +212,8 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
String holTblno = "";
String fromDate = "";
String toDate = "";
String dateFr = "";
String dateTo = "";
//String dateFr = "";
//String dateTo = "";
String lastProcDate = null;
String tmpDate = null;
String tmpFr = null;
......@@ -260,8 +269,8 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
int selectedLineNo = 0;
//added by Sana S on [18/09/2019]
SimpleDateFormat sdf1= new SimpleDateFormat("dd-MM-yy");
//SimpleDateFormat sdf1= new SimpleDateFormat("dd-MM-yy");
ArrayList<EmpInfo> empList = new ArrayList<EmpInfo>();
HashMap empEventsMap = new HashMap();
int shiftIndexFr = 0;//Added by jaimin on 16/06/2008 (AD89SUN014)
......@@ -269,10 +278,10 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
//Changed by Dhiraj 06/10/10 [AD01SUN008]
//Commented and added by Varsha V on 20-Jul-18 for removing lookup
//ITMDBAccessLocal itmdbAccessLocal = null;
ITMDBAccessEJB itmDBAccess = null;
try
{
SimpleDateFormat sdf1 = new SimpleDateFormat( genericUtility.getApplDateFormat() );//added by Sana S on 25/02/20
//Changed by Dhiraj 06/10/10 [AD01SUN008].start
//Commented and added by Varsha V on 20-Jul-18 for removing lookup
//AppConnectParm appConnect = new AppConnectParm();
......@@ -285,7 +294,6 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
//connDriver = new ConnDriver();
//Commented by Azhar on[06-Sep-2019][Connection created in above method][End]
//SimpleDateFormat simpleDateFormat = new SimpleDateFormat(genericUtility.getDBDateFormat());
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd-MM-yy");//modified by Sana S on [18/09/2019]
//Commented by Azhar on[06-Sep-2019][Shifted in above method][Start]
//conn = connDriver.getConnectDB("DriverITM");
//Commented by Azhar on[06-Sep-2019][Shifted in above method][End]
......@@ -363,6 +371,8 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
patternCodeFilt = genericUtility.getColumnValue("pattern_code",headerDom);
fromDate = genericUtility.getColumnValue("date__fr",headerDom);
System.out.println(" patternCodeFilt :::[" +patternCodeFilt+"]");
System.out.println(" From Date [" +fromDate+"]");
//Changed by Pawan on 5/11/2011 [AD01SUN008].start
if ( fromDate == null || fromDate.length() <= 0 )
......@@ -423,19 +433,25 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
java.sql.Date frSqlDate = new java.sql.Date(frDate.getTime());
System.out.println("java.sql.Date From :["+frSqlDate+"]");
SimpleDateFormat sdt = new SimpleDateFormat(genericUtility.getApplDateFormat());
//SimpleDateFormat sdt = new SimpleDateFormat("dd-MM-yy");//Modified by Sana s on 18/09/2019
java.util.Date tDate = sdt.parse(strToDate);
toPrdDate = tDate;
System.out.println("To date Object :"+tDate);
java.sql.Date toSqlDate = new java.sql.Date(tDate.getTime());
System.out.println(""
+ ""+toSqlDate+"]");
// added by sana s on 25/02/2020 [start]
sDateFr=sdf1.format(frSqlDate);
dateFr=java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sDateFr,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()));
sDateTo=sdf1.format(toSqlDate);
dateTo=java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sDateFr,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()));
//added by sana s on 25/02/2020 [end]
//end getting dates in sqldate and dbdate format
if (siteCodeFr != null )
{
//query changed by msalam on 170308 as it was unnecessary to call the query repeteadly
//Modified by Sana on 18/09/2019 [Start]
/*getDataSql = " SELECT e.EMP_CODE, e.EMP_FNAME, e.EMP_LNAME, e.WORK_SHIFT, e.SHIFT_ROT, e.HOL_TBLNO, "
getDataSql = " SELECT e.EMP_CODE, e.EMP_FNAME, e.EMP_LNAME, e.WORK_SHIFT, e.SHIFT_ROT, e.HOL_TBLNO, "
+" e.cadre, e.grade, e.shift_Index, e.date_Join, e.PATTERN_CODE, e.WORK_SITE, ws.FROM_DT ,"
//Modified by Rupesh on [26/10/2012][CCF No.:COR10/C252 -AD01SUN037 & COR11/C025-AD1ASUN002] [Fetching relieve date of employee][Start]
+"e.RELIEVE_DATE "
......@@ -455,34 +471,25 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
+" AND SHIFT_ROT = 'Y' "
// Modified by Piyush on 31/10/2012 for not to fetch those employee whose joining date is beyound shift to date specified in argument
//+" AND nvl( status, ' ') <> 'S'";
+" AND nvl( status, ' ') <> 'S' AND e.date_Join <= ?";*/
getDataSql = " SELECT e.EMP_CODE, e.EMP_FNAME, e.EMP_LNAME, e.WORK_SHIFT, e.SHIFT_ROT, e.HOL_TBLNO, "
+" e.cadre, e.grade, e.shift_Index, e.date_Join, e.PATTERN_CODE, e.WORK_SITE, ws.FROM_DT ,"
+"e.RELIEVE_DATE FROM EMPLOYEE e, ( SELECT t.emp_code, t.FROM_DT FROM WORK_SHIFT t WHERE t.EMP_CODE >= '" + empCodeFr + "' "
+ "AND t.EMP_CODE <= '" + empCodeFr + "'and ? BETWEEN FROM_DT AND TO_DT ) ws "
+" WHERE e.emp_code = ws.emp_code( + ) and e.EMP_CODE = '" + empCodeFr + "' AND DEPT_CODE = '" + deptCodeFr + "' AND DEPT_CODE = '" + deptCodeTo + "'"
+" AND WORK_SITE = '" + siteCodeFr + "' AND WORK_SITE = '" + siteCodeTo + "'"
+" AND SHIFT_ROT = 'Y' AND nvl( status, ' ') <> 'S' AND e.date_Join <= ?";
//Modified by Sana S on 18/09/2019[end]
+" AND nvl( status, ' ') <> 'S' AND e.date_Join <= ?";
PreparedStatement pStmt = null;
System.out.println("\n\n getDataSql :"+getDataSql);
pStmt = conn.prepareStatement( getDataSql );
System.out.print("Parameters 1:: [" + frSqlDate+"]");
//pStmt.setDate( 1, frSqlDate );
pStmt.setString( 1, sdf1.format(frSqlDate));//Modified by Sana S on 18/09/2019
//Modified by Sana S on 25/02/2020 [start]
pStmt.setTimestamp( 1, dateFr);
//Modified by Sana S on 25/02/2020 [end]
// Modified by Piyush on 31/10/2012 [for not to fetch those employee whose joining date is beyound shift to date specified in argument].Start
System.out.print("Parameters 1-1:: [" + toSqlDate+"]");
//pStmt.setDate( 2, toSqlDate );
pStmt.setString( 2, sdf1.format(toSqlDate)); //Modified by Sana S on 18/09/2019
//Modified by Sana S on 25/02/2020 [start]
pStmt.setTimestamp( 2, dateTo);
//Modified by Sana S on 25/02/2020 [end]
// Modified by Piyush on 31/10/2012 [for not to fetch those employee whose joining date is beyound shift to date specified in argument].End
rsn1 = pStmt.executeQuery( );
......@@ -562,6 +569,8 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
java.sql.Date reliDate = null;
reliDate = empInfo.relieveDate;
System.out.print("reliDate:"+reliDate);
System.out.print("Compare date result>>>>>"+reliDate.compareTo(toSqlDate));
if(reliDate != null && reliDate.compareTo(toSqlDate) < 0)
{
toSqlDate = (java.sql.Date)reliDate;
......@@ -574,8 +583,8 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
//Modified By Sana S on 18/09/2019 [start]
/*pstmtTemp.setDate( 1, toSqlDate );
pstmtTemp.setDate( 2, toSqlDate );*/
pstmtTemp.setString( 1, sdf1.format(toSqlDate) );
pstmtTemp.setString( 2, sdf1.format(toSqlDate ));
pstmtTemp.setTimestamp( 1, dateTo );
pstmtTemp.setTimestamp( 2, dateTo);
//Modified By Sana S on 18/09/2019 [end]
updCnt = pstmtTemp.executeUpdate();
pstmtTemp.clearParameters();
......@@ -589,8 +598,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
"AND FROM_DT > ? ";
pstmtTemp = conn.prepareStatement(updateSql);
//pstmtTemp.setDate( 1, toSqlDate );
pstmtTemp.setString( 1, sdf1.format(toSqlDate) ); //Modified By Sana S on 18/09/2019
pstmtTemp.setTimestamp( 1, dateTo); //Modified By Sana S on 18/09/2019
updCnt = pstmtTemp.executeUpdate();
pstmtTemp.clearParameters();
if ( updCnt > 0 )
......@@ -603,7 +611,6 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
{
continue;
}
}
//Modified by Rupesh on [26/10/2012][CCF No.:COR10/C252 -AD01SUN037 & COR11/C025-AD1ASUN002][Not to generate shift beyond relieve date of employee][End]
......@@ -636,11 +643,11 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
"AND ? BETWEEN FROM_DT AND TO_DT AND FROM_DT <> ? ";
pstmtTemp = conn.prepareStatement(updateSql);
//pstmtTemp.setDate( 1, prevFrDate );
pstmtTemp.setString( 1, sdf1.format(prevFrDate) );// Modified By Sana S on 18/09/2019
pstmtTemp.setTimestamp( 1, java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf1.format(prevFrDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())) );// Modified By Sana S on 18/09/2019
//pstmtTemp.setDate( 2, frSqlDate );
pstmtTemp.setString( 2, sdf1.format(frSqlDate));// Modified By Sana S on 18/09/2019
pstmtTemp.setTimestamp( 2, java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf1.format(frSqlDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())) );// Modified By Sana S on 18/09/2019
//pstmtTemp.setDate( 3, frSqlDate );
pstmtTemp.setString( 3, sdf1.format(frSqlDate ));// Modified By Sana S on 18/09/2019
pstmtTemp.setTimestamp( 3, java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf1.format(frSqlDate ),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));// Modified By Sana S on 18/09/2019
updCnt = pstmtTemp.executeUpdate();
pstmtTemp.clearParameters();
if ( updCnt > 0 )
......@@ -660,9 +667,9 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
pstmtTemp.setDate( 2, toSqlDate );
pstmtTemp.setDate( 3, toSqlDate );*/
pstmtTemp.setString( 1, sdf1.format(nextToDate));
pstmtTemp.setString( 2, sdf1.format(toSqlDate));
pstmtTemp.setString( 3, sdf1.format(toSqlDate));
pstmtTemp.setTimestamp( 1, java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf1.format(nextToDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));
pstmtTemp.setTimestamp( 2, java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf1.format(toSqlDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));
pstmtTemp.setTimestamp( 3, java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf1.format(toSqlDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));
//Modified By Sana S on 18/09/2019[end]
updCnt = pstmtTemp.executeUpdate();
pstmtTemp.clearParameters();
......@@ -683,15 +690,15 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
pstmtn2 = conn.prepareStatement(sql);
pstmtn2.setString(1,emp);
//pstmtn2.setDate(2,frSqlDate);
pstmtn2.setString(2,sdf1.format(frSqlDate));// Modified by Sana S on 18/9/2019
pstmtn2.setTimestamp(2,java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf1.format(frSqlDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));// Modified by Sana S on 18/9/2019
System.out.println("frSqlDate :-"+frSqlDate);
//pstmtn2.setDate(3,toSqlDate);
pstmtn2.setString(3,sdf1.format(toSqlDate));// Modified by Sana S on 18/9/2019
pstmtn2.setTimestamp(3,java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf1.format(toSqlDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));// Modified by Sana S on 18/9/2019
System.out.println("toSqlDate :-"+toSqlDate);
//pstmtn2.setDate(4,frSqlDate);
pstmtn2.setString(4,sdf1.format(frSqlDate));// Modified by Sana S on 18/9/2019
pstmtn2.setTimestamp(4,java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf1.format(frSqlDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));// Modified by Sana S on 18/9/2019
//pstmtn2.setDate(5,toSqlDate);
pstmtn2.setString(5,sdf1.format(toSqlDate));// Modified by Sana S on 18/9/2019
pstmtn2.setTimestamp(5,java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf1.format(toSqlDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));// Modified by Sana S on 18/9/2019
upd = pstmtn2.executeUpdate();
System.out.println("No Of record deleted from WORK_SHIFT ["+upd+"]");
pstmtn2.close();
......@@ -769,7 +776,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
patternPStmt = conn.prepareStatement( sql );
//patternPStmt.setDate(1,frSqlDate);
patternPStmt.setString(1,sdf1.format(frSqlDate));//Modified by Sana S on 18/09/2019
patternPStmt.setTimestamp(1,java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf1.format(frSqlDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));//Modified by Sana S on 18/09/2019
patternRs = patternPStmt.executeQuery();
edShiftDate = null;
shiftIndexTo = 0;
......@@ -825,7 +832,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
"AND EFF_DATE = ? and nvl(PATTERN_CODE__TO, ' ') = '" + patternCodeFilt + "' AND NVL(CONFIRMED , 'N') = 'N'";
patternPStmt = conn.prepareStatement( sql );
//patternPStmt.setDate(1,frSqlDate);
patternPStmt.setString(1,sdf1.format(frSqlDate));//Modified by Sana S on 18/09/2019
patternPStmt.setTimestamp(1,java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf1.format(frSqlDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));//Modified by Sana S on 18/09/2019
patternRs = patternPStmt.executeQuery();
edShiftDate = null;
shiftIndexTo = 0;
......@@ -885,7 +892,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
patternPStmt = conn.prepareStatement( sql );
// patternPStmt.setDate(1,frSqlDate);
patternPStmt.setString(1,sdf1.format(frSqlDate));//Modified by Sana S on 18/09/2019
patternPStmt.setTimestamp(1,java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf1.format(frSqlDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));//Modified by Sana S on 18/09/2019
patternRs = patternPStmt.executeQuery();
edShiftDate = null;
shiftIndexTo = 0;
......@@ -998,7 +1005,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
edShiftDate = frSqlDate;
System.out.print("edShiftDate 1::::: [" + edShiftDate+"]");
// System.out.print("edShiftDate 1::::: [" + edShiftDate+"]");
System.out.print("effDateList.size() 1::::: [" + effDateList.size()+"]");
//NEED TO TAKE TILL LAST DATE SO = MUST [(edShiftDate.compareTo(toSqlDate) <= 0)]
......@@ -1077,10 +1084,18 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
else
{
System.out.println("Process complete");
//Added by Sana S on 20/12/19[start] for commit transection for inter process call of process method
if(commitOpt == 2)
{
conn.commit();
}
//Added by Sana S on 20/12/19[end] for commit transection for inter process call of process method
//Commented by Azhar on [06-Sep-2019][Shifted in above method][Start]
//conn.commit();
//Commented by Azhar on [06-Sep-2019][Shifted in above method][End]
//Added by Santosh on [19/12/11][to solve the issue when called on Employee Event Confirmation][Start] -->
if(patternCodeFilt != null && patternCodeFilt.length() > 0)
{
errString = "";
......@@ -1089,16 +1104,21 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
{
// Modified by Piyush on 31/12/2012 to avoid error in ITM
//errString = itmdbAccessLocal.getErrorString("","VTPCOMPT","","",conn);
if ( xtraParams.indexOf("user_lang=") <= 0 )
//Modified by Sana S on 20/12/19 [start]
//if ( xtraParams.indexOf("user_lang=") <= 0)
if ( xtraParams.indexOf("user_lang=") <= 0 || commitOpt == 1)
//Modified by Sana S on 20/12/19 [end]
{
errString = "";
}
else
//commented by Sana S on 25/02/2020[start]
/*else
{
//Commented and added by Varsha V on 20-Jul-18 for calling connection method
//errString = itmdbAccessLocal.getErrorString("","VTPCOMPT","","",conn);
errString = itmDBAccess.getErrorString("","VTPCOMPT","","",conn);
}
}*/
//commented by Sana S on 25/02/2020[end]
}
return errString;
}
......@@ -1174,7 +1194,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
//private String insertUpdateWorkShift(EmpInfo empInfo, String empCode, java.sql.Date shiftStDate, java.sql.Date shiftEndDate, String frpatternCode, java.sql.Date patternEffDate, String holiTblNo,int shiftIndexNew, Connection conn, ITMDBAccessLocal itmdbAccessLocal ) throws Exception
private String insertUpdateWorkShift(EmpInfo empInfo, String empCode, java.sql.Date shiftStDate, java.sql.Date shiftEndDate, String frpatternCode, java.sql.Date patternEffDate, String holiTblNo,int shiftIndexNew, Connection conn, ITMDBAccessEJB itmdbAccess ) throws Exception
{
SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yy");//added by Sana s on 18/09/2019
SimpleDateFormat sdf = new SimpleDateFormat( genericUtility.getApplDateFormat() );//added by Sana S on 25/02/20
System.out.println("insertUpdateWorkShift is called...............");
String insertSql ="",updateSql = "",errString = "";
PreparedStatement pstmtn5 = null,pstmtn6=null,pstmtInsert = null,pstmtUpdate = null;
......@@ -1198,7 +1218,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
try
{
SimpleDateFormat sdf1 = new SimpleDateFormat( genericUtility.getApplDateFormat() );// added by Sana S on 25/02/20
stmt = conn.createStatement();
sql = "SELECT SHIFT_PATTERN, START_DATE, NO_OF_DAYS, GEN_SHIFT_HOL FROM SHIFT_PATTERN WHERE PATTERN_CODE = '"+frpatternCode+"'";
//changed by satya on 07/06/10 [AD90SUN028].start
......@@ -1277,7 +1297,6 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
}
}
//uncommented and changed by satya on 07/06/10 [AD90SUN028].end
if( ! (shiftStDate2.compareTo(shiftEndDate) < 0 ))
{
......@@ -1314,7 +1333,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
pstmtn6 = conn.prepareStatement(sql);
//pstmtn6.setDate(1, shiftStDate);
pstmtn6.setString(1, sdf.format(shiftStDate));//Moldified by Sana S on 18/09/2019
pstmtn6.setTimestamp(1,java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf.format(shiftStDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));//Moldified by Sana S on 18/09/2019
System.out.println("Sql At 1444 :: " + sql);
System.out.println("PARAMETER IN UPDATE QUERY SHIFT START DATE(FROM_DT) =["+shiftStDate+"]");
System.out.println("PARAMETER IN UPDATE QUERY SHIFT =["+tempShift+"]");
......@@ -1338,8 +1357,8 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
System.out.println("In insert at 668 insertSql "+insertSql);
shiftStDate = shiftStDate2;
pstmtInsert.setString(1,empCode);
pstmtInsert.setString(2,sdf.format(shiftStDate));//Modified By Sana S on 18/09/2019
pstmtInsert.setString(3,sdf.format(shiftStDate2));//Modified By Sana S on 18/09/2019
pstmtInsert.setTimestamp(2,java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf.format(shiftStDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));//Modified By Sana S on 18/09/2019
pstmtInsert.setTimestamp(3,java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf.format(shiftStDate2),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));//Modified By Sana S on 18/09/2019
pstmtInsert.setString(4,shift);
pstmtInsert.setString(5,chgUser);
pstmtInsert.setString(6,chgTerm);
......@@ -1359,9 +1378,9 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
System.out.println("In update at 686 updateSql "+updateSql);
pstmtUpdate.setString(1,sdf.format(shiftStDate2));//Modified by Sana S on 18/09/2019
pstmtUpdate.setTimestamp(1,java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf.format(shiftStDate2),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));//Modified by Sana S on 18/09/2019
pstmtUpdate.setString(2,empCode);
pstmtUpdate.setString(3,sdf.format(shiftStDate));//Modified by Sana S on 18/09/2019
pstmtUpdate.setTimestamp(3,java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf.format(shiftStDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));//Modified by Sana S on 18/09/2019
pstmtUpdate.executeUpdate();
pstmtUpdate.clearParameters();
pstmtUpdate.close();
......@@ -1464,9 +1483,12 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
System.out.println("\n\n shiftIndex "+shiftIndex);
try{
//Modified by Azhar on [06-Sep-2019][Changes as per new framework][Start]
//patternList = GenericUtility.getInstance().getTokenList(shiftPattern,";");
patternList = genericUtility.getTokenList(shiftPattern,";");
System.out.println("patternList>>"+patternList.size());
//Modified by Azhar on [06-Sep-2019][Changes as per new framework][End]
System.out.println("noOfDays :"+noOfDays+"noDays :"+noDays);
if (shiftIndex > noOfDays )
......@@ -1478,18 +1500,22 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
for(int j = 0 ; j < patternList.size() ; j++)
{
patString = patternList.get(j).toString();
System.out.println("patString>>"+patString);
if (patString == null || patString.trim().length() == 0)
{
continue;
}
day = patString.substring(0,patString.indexOf('-'));
System.out.println("day>>"+day);
shift = patString.substring(patString.indexOf('-')+1);
System.out.println("shift>>"+shift);
for(int k = 0; k < Integer.parseInt(day); k++)
{
shiftTime.add(shift);
}
}
System.out.println("shiftTime>>"+shiftTime.size());
int n1 = 0;
for( int i = shiftIndex-1 ; i<shiftTime.size(); i++ )
......@@ -1507,6 +1533,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
while(noDays >= noOfDays)
{
noDays = noDays%noOfDays ;
System.out.println("shiftTime noDays>>"+noDays);
}
shift = (String)shiftTime1.get(noDays).toString();
}catch(Exception e){
......@@ -1572,7 +1599,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
String sql = null;
String insertSql = null;
String updateSql = null;
int cnt = 0;
int cnt = 0,insertcnt=0,updatecnt=0;
SimpleDateFormat sdf = null;
......@@ -1580,7 +1607,6 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
{
sdf = new SimpleDateFormat( genericUtility.getApplDateFormat() );
//sdf = new SimpleDateFormat("dd-MM-yy");//Modified By Sana S on 18/09/2019
insertSql = "INSERT INTO WORK_SHIFT (EMP_CODE,FROM_DT,TO_DT,SHIFT,CHG_USER,CHG_TERM,CHG_DATE,REAL_SHIFT,PATTERN_CODE) "
//Modified by Rupesh on [26/10/2012][CCF No.:COR10/C252 -AD01SUN037 & COR11/C025-AD1ASUN002][To insert CHG_DATE with time][Start]
//+" Values (?,?,?,?,?,?,?,?,?)";
......@@ -1592,7 +1618,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
pstmtn6 = conn.prepareStatement(sql);
//next line added by msalam on 28/02/07 and modified line added.
//pstmtn6.setDate( 1, shiftStDate );
pstmtn6.setString( 1, sdf.format(shiftStDate));//Modified by sana s on 18/09/2019
pstmtn6.setTimestamp( 1, java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf.format(shiftStDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));//Modified by sana s on 18/09/2019
//end next line added by msalam on 28/02/07 and modified line added.
//pstmtn6.setDate(2, shiftStDate2);//ADDED EXTRA PARAMETER LINE BY DURGA 02/04/07
System.out.println("Sql At 1365 :: " + sql);
......@@ -1626,8 +1652,8 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
//Modified by sana s on 18/09/2019
/*pstmtInsert.setString( 2, shiftStDate );
pstmtInsert.setString( 3, shiftStDate2 );*/
pstmtInsert.setString( 2, sdf.format(shiftStDate));
pstmtInsert.setString( 3, sdf.format(shiftStDate2));
pstmtInsert.setTimestamp( 2, java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf.format(shiftStDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));
pstmtInsert.setTimestamp( 3, java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf.format(shiftStDate2),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));
//Modified by sana s on 18/09/2019
pstmtInsert.setString( 4, shift );
pstmtInsert.setString( 5, chgUser );
......@@ -1646,10 +1672,18 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
pstmtInsert.setString( 7, shift);
pstmtInsert.setString( 8, frpatternCode );
//Modified by Rupesh on [26/10/2012][CCF No.:COR10/C252 -AD01SUN037 & COR11/C025-AD1ASUN002][To insert CHG_DATE with time][End]
pstmtInsert.executeUpdate();
insertcnt=pstmtInsert.executeUpdate();
System.out.print("insert count:::"+insertcnt);
pstmtInsert.clearParameters();
pstmtInsert.close();
pstmtInsert=null;
//commented by Sana S on 25/02/20
/*if(insertcnt>0)
{
conn.commit();
}*/
}
//else if( cnt > 0 && shiftStDate2.compareTo( shiftStDate ) != 0 )
else if( cnt > 0 )
......@@ -1661,15 +1695,21 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
System.out.println( "In update at 686 updateSql " + updateSql );
pstmtUpdate = conn.prepareStatement(updateSql);
//pstmtUpdate.setDate(1,shiftStDate2);
pstmtUpdate.setString(1,sdf.format(shiftStDate2));// Modified By Sana S on 18/09/2019
pstmtUpdate.setTimestamp(1,java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf.format(shiftStDate2),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));// Modified By Sana S on 18/09/2019
pstmtUpdate.setString(2,empCode);
//pstmtUpdate.setDate(3,shiftStDate);
pstmtUpdate.setString(3,sdf.format(shiftStDate));// Modified By Sana S on 18/09/2019
pstmtUpdate.executeUpdate();
pstmtUpdate.setTimestamp(3,java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(sdf.format(shiftStDate),genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())));// Modified By Sana S on 18/09/2019
updatecnt=pstmtUpdate.executeUpdate();
System.out.print("update count:::"+updatecnt);
//pstmtUpdate.clearParameters();
pstmtUpdate.close();
pstmtUpdate=null;
}
//commented by Sana S on 25/02/20
/*if(updatecnt>0)
{
conn.commit();
}*/
if(pstmtInsert!=null)
{
pstmtInsert.close();
......@@ -1689,7 +1729,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
//ADDED BY MSALAM ON 250208 TO GET HOLIDAY DAY TYPE
private String getHolidayTypeForDate( java.util.Date shiftDate, String holiTblNo, Connection conn)
{
SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yy");
//SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yy");
Timestamp ts = new Timestamp(shiftDate.getTime()) ;
String sqlStr = null;
PreparedStatement stmt = null;
......@@ -1698,11 +1738,11 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
System.out.println("Holiday type for date :: " + shiftDate);
try{
SimpleDateFormat sdf = new SimpleDateFormat( genericUtility.getApplDateFormat() );//added by Sana S on 25/02/20
//sqlStr = "select Hol_Type from holiday where Hol_Date = ? and HOL_TBLNO ='" + holiTblNo + "'";//Commentd by jaimin on 17/06/2008 (AD89SUN016)
sqlStr = "select Hol_Type from holiday where Hol_Date = ? and HOL_TBLNO ='" + holiTblNo + "' and HOL_TYPE <> 'W' "; //Added by jaimin on 17/06/2008 (AD89SUN016)
stmt = conn.prepareStatement( sqlStr );
// stmt.setTimestamp(1, ts);
stmt.setString(1, sdf.format(ts));//Modified by Sana S on 18/09/2019
stmt.setTimestamp(1, ts);
System.out.println("Holiday Type Setting Timestamp:["+ts+"]");
System.out.println("Sql Str for Holiday Holiday Type :: " + sqlStr);
rs = stmt.executeQuery();
......@@ -1807,7 +1847,6 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
public int daysDiff( java.util.Date dateFrom, java.util.Date dateTo , Connection conn)
{
SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yy");//added by Sana s on 18/09/2019
String dbDateFormat = "";
SimpleDateFormat simpledateformat = null;
String fromDate = "";
......@@ -1819,8 +1858,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
try
{
dbDateFormat = genericUtility.getDBDateFormat();
//simpledateformat = new SimpleDateFormat(dbDateFormat);
simpledateformat = new SimpleDateFormat("dd-MM-yy");//Modified by Sana S on 18/09/2019
simpledateformat = new SimpleDateFormat(dbDateFormat);
fromDate = simpledateformat.format(dateFrom);
toDate = simpledateformat.format(dateTo);
String sql = "SELECT TO_DATE(?,?) - TO_DATE(?,?) FROM DUAL";
......
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