Commit c6a1b445 authored by vdhoble's avatar vdhoble

changes for max line no


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98207 ce508802-f39f-4f6c-b175-0d175dae99d5
parent b60c4a09
......@@ -37,23 +37,23 @@ public class POrderMilestone extends ValidatorEJB {
Node parentNode = null;
Node childNode = null;
String sql = "";
int delayDays=0,cnt = 1,count1 = 0;
int delayDays=0,count = 0,count1 = 0;
Timestamp parsedReschDate = null;
int lineNo = 0;
String complDate="";
String dueDateOrgStr = "",taskCode = "";
Document dom = null;
PreparedStatement pstmt = null,pstmt1 = null;
ResultSet rs=null;
PreparedStatement pstmt = null,pstmt1 = null,pstmt2 = null;
ResultSet rs=null,rs2=null;
int ctr=0;
int currentFormNo=0;
int childNodeListLength;
String childNodeName = null;
String childNodeName = null,sqlMax = "",tranIdPending = "";
Timestamp dueDateHeader = null,reschDate = null;
ConnDriver connDriver = new ConnDriver();
Timestamp complDateNew = null,dueDateOrg = null;
String retString = "SUCCESS";
String sqlResch ="";
System.out.println("xmlString DOM-->>["+xmlDataAll+"]");
try
{
......@@ -111,32 +111,37 @@ public class POrderMilestone extends ValidatorEJB {
parsedReschDate = utilmethod.RelativeDate(dueDateOrg, delayDays);//addDays(dueDateOrg, delayDays);
System.out.println("completionDate ====parsed into sql format:::::"+parsedReschDate);
//added code for finding the max line no of detail
sql = "select max(line_no) as lineNoTot from pur_milstn_resch where tran_id = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,tranId);
rs = pstmt.executeQuery();
if ( rs.next() )
{
lineNo = rs.getInt("lineNoTot");
}
rs.close();
rs=null;
pstmt.close();
pstmt=null;
/**selecting pending tasks from header table **inserting records after rescheduling due dates in detail table***/
String sqlResch = "Insert into pur_milstn_resch (TRAN_ID,LINE_NO,DELAY_DAYS,TASK_CODE__DELAY,DUE_DATE_ORG,DUE_DATE_RESCH) values (?,?,?,?,?,?)";
sqlResch = "Insert into pur_milstn_resch (TRAN_ID,LINE_NO,DELAY_DAYS,TASK_CODE__DELAY,DUE_DATE_ORG,DUE_DATE_RESCH) values (?,?,?,?,?,?)";
sql = "select task_code,due_date from pur_milstn where purc_order in(select purc_order from pur_milstn where tran_id = ?) and task_status = 'P'";
sql = "select task_code,due_date,tran_id from pur_milstn where purc_order in(select purc_order from pur_milstn where tran_id = ?) and task_status = 'P'";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,tranId);
rs = pstmt.executeQuery();
while ( rs.next() )
{
lineNo = lineNo ++;
taskCode = rs.getString("task_code");
dueDateHeader = rs.getTimestamp("due_date");
tranIdPending = rs.getString("tran_id");//tran id of pending records
//added code for finding the max line no of detail
sqlMax = "select max(line_no) as lineNoTot from pur_milstn_resch where tran_id = ?";
pstmt2 = conn.prepareStatement(sqlMax);
pstmt2.setString(1,tranIdPending);
rs2 = pstmt2.executeQuery();
if ( rs2.next() )
{
lineNo = rs2.getInt("lineNoTot");
}
rs2.close();
rs2=null;
pstmt2.close();
pstmt2=null;
lineNo = lineNo ++;
System.out.println("Inserting into detail table for Task Codes in Header Tables which are pending");
System.out.println("delayed days-----"+delayDays);
......@@ -152,16 +157,12 @@ public class POrderMilestone extends ValidatorEJB {
pstmt1.setString(4,taskCode);
pstmt1.setTimestamp(5,dueDateHeader);
pstmt1.setTimestamp(6,reschDate);
pstmt1.addBatch();
pstmt1.clearParameters();
count = pstmt1.executeUpdate();
pstmt1.close();
pstmt1 = null;
System.out.println("NO. OF RECORDS INSERTED==== "+count);
}
pstmt1.executeBatch();//added out of the loop for batch update
pstmt1.clearBatch();
pstmt1.close();
pstmt1=null;
rs.close();
rs=null;
pstmt.close();
......@@ -211,14 +212,19 @@ public class POrderMilestone extends ValidatorEJB {
pstmt1.close();
pstmt1 = null;
}
if(conn!=null)
if(pstmt2 != null)
{
pstmt2.close();
pstmt2 = null;
}
/* if(conn!=null)
{
conn.close();
conn = null;
}
if(connDriver!=null){
connDriver = null;
}
} */
if(rs !=null)
{
rs.close();
......
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