Commit 37935933 authored by abibave's avatar abibave

Request Id: M15GSUP001

Added Code for escalation for WOISSUE Workflow.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@103861 ce508802-f39f-4f6c-b175-0d175dae99d5
parent cfd02a51
package ibase.webitm.ejb.mfg;
import java.net.URL;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
......@@ -46,7 +41,7 @@ import org.apache.axis.encoding.XMLType;
public class WorderIssueWfJB implements Schedule
{
E12GenericUtility genericUtility=new E12GenericUtility();
ConnDriver connDriver = new ConnDriver();
ConnDriver connDriver = null;
Connection conn = null;
@Override
......@@ -56,17 +51,18 @@ public class WorderIssueWfJB implements Schedule
ResultSet rs = null;
String sql="",refId="",retString="",errString="";
String tranId="",loginSiteCode="";
ibase.utility.UserInfoBean userInfo = null;
UserInfoBean userInfo = null;
String sysDate ="";
boolean isError = false;
String xtraParams = "",siteCode=""; //The parameters from BaseApplication.xml
String xtraParams = "",siteCode="";
System.out.println("in schedule()-->>>>>>>>>");
try
{
System.out.println("in try block of schedule()>>>>>>>>>");
connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
System.out.println("********* In Scheduler Begine TRY ***************");
connDriver = null;
Document dom = null;
int noOfParam=0;
userInfo = new ibase.utility.UserInfoBean( scheduleParamXML );
......@@ -74,18 +70,15 @@ public class WorderIssueWfJB implements Schedule
xtraParams = "loginCode="+userInfo.getLoginCode()+"~~termId="+userInfo.getRemoteHost()+"~~loginSiteCode="+loginSiteCode+"~~loginEmpCode="+userInfo.getEmpCode();
System.out.println("XTRAPARAMS contain :- ["+xtraParams+"]");
System.out.println("ScheduleParamXML contains :- ["+scheduleParamXML+"]");
sql = "select iss.tran_id from workorder_iss iss " +
"where iss.tran_id not in (select ref_id from wf_prc_status where ref_ser = 'W-ISS') "
+ " and iss.iss_slip = 'A' and iss.confirmed = 'N'";
System.out.println("after sql while loop");
pStmt = conn.prepareStatement(sql);
System.out.println("after pstmt while loop");
rs = pStmt.executeQuery();
System.out.println("before while loop");
while (rs.next()) {
refId = rs.getString(1);
GenericWorkflowClass wfGenericClass = new GenericWorkflowClass();
......@@ -103,7 +96,6 @@ public class WorderIssueWfJB implements Schedule
{
System.out.println(">>>>>>>>>>>>>In catch:");
e.printStackTrace();
System.out.println(e);
}
finally
{
......@@ -138,12 +130,10 @@ public class WorderIssueWfJB implements Schedule
}
public String confirm(String tranId, String empCodeAprv, String xmlDataAll, String processId, String keyFlag) throws ITMException, Exception {
System.out.println("confirm workflow invocation");
System.out.println("Parameters ::: tranId["+tranId+"],empCodeAprv["+empCodeAprv+"],xmlDataAll["+xmlDataAll+"],processId["+processId+"],keyFlag["+keyFlag+"]");
String loginCode = "";
String loginSiteCode = "";
String loginEmpCode = "";
String xtraParams = "loginCode=" + loginCode + "~~" + "loginSiteCode=" + loginSiteCode + "~~" + "loginEmpCode=" + loginEmpCode;
String retString = "";
Boolean isError = false;
PreparedStatement pStmt = null;
......@@ -152,18 +142,132 @@ public class WorderIssueWfJB implements Schedule
String sql = "";
//GenericUtility genericUtility = null;
E12GenericUtility genericUtility = null;
conn = connDriver.getConnectDB("DriverITM");
connDriver = null;
conn.setAutoCommit(false);
//Added By Aniket on 04-07-2016 for different database datetime issue:START
SimpleDateFormat simpleDateFormat = null;
String currDate = "";
//Added By Aniket on 04-07-2016 for different database datetime issue:END
String activityId = "", roleCode = "", signStatus = "", userCode = "",processInfo[] = null;
int resultCnt = 0;
try
{
sql = "update workorder_iss set confirmed = 'Y', conf_date = sysdate where tran_id = ?";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1,tranId);
int count = pStmt.executeUpdate();
System.out.println("No of rows updated>>>>"+count);
pStmt.close();
pstmt = null;
connDriver = new ConnDriver();
genericUtility = new E12GenericUtility();
conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false);
connDriver = null;
//Changes & commented By Aniket on 04-07-2016 for different database datetime issue:START
simpleDateFormat = new SimpleDateFormat(genericUtility.getApplDateTimeFormat());
currDate = simpleDateFormat.format( Calendar.getInstance().getTime() );
currDate = genericUtility.getValidDateTimeString( currDate, genericUtility.getApplDateTimeFormat(),genericUtility.getDBDateTimeFormat() ) ;
System.out.println(" confirm :: currDate :: ["+currDate+"]");
if("E".equalsIgnoreCase(keyFlag)){
//sql = "update workorder_iss set confirmed = 'Y', conf_date = sysdate where tran_id = ?";
sql = "update workorder_iss set confirmed = 'Y', conf_date = ? where tran_id = ?";
pStmt = conn.prepareStatement(sql);
//pStmt.setString(1,tranId);
pStmt.setTimestamp(1,java.sql.Timestamp.valueOf(currDate));
pStmt.setString(2,tranId);
//Changes & commented By Aniket on 04-07-2016 for different database datetime issue:END
int count = pStmt.executeUpdate();
System.out.println("No of rows updated>>>>"+count);
pStmt.close();
pstmt = null;
}
else{
if("WOISSAPRV2".equalsIgnoreCase(keyFlag))
{
activityId = "WISSAPRV2_SIGN"; roleCode = "APRVWISS2";
}
sql = "select SIGN_STATUS from OBJ_SIGN_TRANS "
+ "WHERE ltrim(rtrim(REF_SER)) = 'W-ISS' AND ltrim(rtrim(REF_ID)) = ? AND ltrim(rtrim(ROLE_CODE__SIGN)) = ? "
+ "AND SIGN_STATUS = 'U'";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
pstmt.setString(2, roleCode);
rs = pstmt.executeQuery();
if (rs.next())
{
signStatus = rs.getString("SIGN_STATUS");
}
System.out.println("signStatus = " + signStatus);
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if("U".equalsIgnoreCase(signStatus)){
sql = "select code from users where emp_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCodeAprv);
rs = pstmt.executeQuery();
if (rs.next())
{
userCode = rs.getString("code");
}
userCode = userCode == null ? "" : userCode.trim();
rs.close();
rs = null;
pstmt.close();
pstmt = null;
sql = "UPDATE OBJ_SIGN_TRANS "
+ "SET SIGN_DATE = ?, USER_ID__SIGN = ?, SIGN_REMARKS = 'HR_SPAN is over', SIGN_STATUS = 'V', EMP_CODE = ? "
+ "WHERE ltrim(rtrim(REF_SER)) = 'W-ISS' AND ltrim(rtrim(REF_ID)) = ? AND ltrim(rtrim(ROLE_CODE__SIGN)) = ? "
+ "AND SIGN_STATUS = 'U'";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1,java.sql.Timestamp.valueOf(currDate));
pstmt.setString(2, userCode);
pstmt.setString(3, empCodeAprv);
pstmt.setString(4, tranId);
pstmt.setString(5, roleCode);
resultCnt += pstmt.executeUpdate();
pstmt.close();
pstmt = null;
System.out.println("Update Successfully:"+resultCnt);
processInfo = processId.split(":");
sql = "UPDATE WF_PRC_STATUS "
+ "SET STATUS_DATE = ?, PROCESS_STATUS = 4, ERR_STATUS = '0', "
+ "STATUS_REMARKS='Escalated -> Completing :"+processId+" Invoked :"+processId+"' "
+ "WHERE ltrim(rtrim(REF_SER)) = 'W-ISS' AND REF_ID = ? AND PROCESS_ID = ? AND INSTANCE_ID = ? AND ACTIVITY_ID = ? AND PROCESS_STATUS != 3";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1,java.sql.Timestamp.valueOf(currDate));
pstmt.setString(2, tranId);
pstmt.setString(3, processInfo[0]);
pstmt.setString(4, processInfo[1]);
pstmt.setString(5, activityId);
resultCnt += pstmt.executeUpdate();
pstmt.close();
pstmt = null;
System.out.println("Update Successfully:"+resultCnt);
if(resultCnt > 1)
{
conn.commit();
retString = "Y";
}
else
{
conn.rollback();
}
}
else
{
retString = "N";
}
}
}
catch (Exception e) {
System.out.println("Exception: confirm method ..> " + e.getMessage());
......@@ -203,5 +307,4 @@ public class WorderIssueWfJB implements Schedule
// TODO Auto-generated method stub
return 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