Commit 7a0d1d88 authored by pdas's avatar pdas

Updated emp code in stoppages conf


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@97696 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 3bb6d93a
......@@ -45,6 +45,7 @@ StoppagesConfLocal, StoppagesConfRemote
System.out.println("Stoppagesconf confirm called..............");
String confirmed = "";
String siteCode="";
String sql = "";
Connection conn = null;
PreparedStatement pstmt = null;
......@@ -79,10 +80,10 @@ StoppagesConfLocal, StoppagesConfRemote
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
if (rs.next())
while (rs.next())
{
confirmed = rs.getString(1);
siteCode=rs.getString(2);
confirmed = rs.getString(1)==null?"":rs.getString(1);
siteCode= rs.getString(2)==null?"":(rs.getString(2));
}
rs.close();
rs = null;
......@@ -93,6 +94,7 @@ StoppagesConfLocal, StoppagesConfRemote
if ("Y".equalsIgnoreCase(confirmed))
{
System.out.println("Confirmed Status" + confirmed);
errCode = "VTCONF1"; //'StoppagesConf Already Confirmed'
errString = itmDBAccessLocal.getErrorString("",errCode,"");
}
......@@ -158,30 +160,35 @@ StoppagesConfLocal, StoppagesConfRemote
private String Stoppagesconf(String tranId, int i, String xtraParams, Connection conn)
throws RemoteException, ITMException
{
PreparedStatement pstmt = null, pstmtSql = null;
ResultSet rs = null;
PreparedStatement pstmt = null, pstmtSql = null,pstmtSql1=null;
ResultSet rs = null,rs1 = null;
int cnt = 0,updCnt=0;
String sql = "", errCode = "",errString ="",sql1 ="";
String sql = "", errCode = "",errString ="",sql1 ="",sql2 ="",loginEmpCode="";
try
{
ibase.utility.E12GenericUtility genericUtility= null;
genericUtility = new ibase.utility.E12GenericUtility();
//loginEmpCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginEmpCode");
Timestamp sysDate = null;
Calendar currentDate = Calendar.getInstance();
GenericUtility genericUtility = GenericUtility.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
GenericUtility genericUtility1 = GenericUtility.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility1.getApplDateFormat());
String sysDateStr = sdf.format(currentDate.getTime());
sysDate= Timestamp.valueOf(genericUtility.getValidDateString(sysDateStr, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0");
sysDate= Timestamp.valueOf(genericUtility1.getValidDateString(sysDateStr, genericUtility1.getApplDateFormat(),genericUtility1.getDBDateFormat()) + " 00:00:00.0");
ITMDBAccessEJB itmDBAccessLocal = new ITMDBAccessEJB();
sql="select count(*) from stoppagesdet where tran_id =?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
if (rs.next())
while(rs.next())
{
cnt = rs.getInt(1);
......@@ -198,10 +205,24 @@ StoppagesConfLocal, StoppagesConfRemote
return errString;
}
sql1="update stoppages set confirmed = 'Y', conf_date = ? where tran_id = ?";
sql2="Select emp_code from stoppages where tran_id=?";
pstmtSql1=conn.prepareStatement(sql2);
pstmtSql1.setString(1, tranId);
rs1 = pstmtSql1.executeQuery();
while (rs1.next()) {
loginEmpCode = rs1.getString(1)==null?"":rs1.getString(1);
}
pstmtSql1.close();
pstmtSql1 = null;
rs1.close();
rs1 = null;
System.out.println("empcode"+loginEmpCode);
sql1="update stoppages set confirmed = 'Y', conf_date = ?,emp_code__aprv = ? where tran_id = ?";
pstmtSql = conn.prepareStatement(sql1);
pstmtSql.setTimestamp(1, sysDate);
pstmtSql.setString(2, tranId);
pstmtSql.setString(2,loginEmpCode);
pstmtSql.setString(3, tranId);
updCnt = pstmtSql.executeUpdate();
pstmtSql.close();
pstmtSql = 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