Commit ee9d85b5 authored by mjadhav's avatar mjadhav

add commit in insert details for every transction


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98381 ce508802-f39f-4f6c-b175-0d175dae99d5
parent c7c211ca
...@@ -41,7 +41,7 @@ public class POrderMilestone extends ValidatorEJB { ...@@ -41,7 +41,7 @@ public class POrderMilestone extends ValidatorEJB {
Timestamp parsedReschDate = null; Timestamp parsedReschDate = null;
int lineNo = 0; int lineNo = 0;
String complDate=""; String complDate="";
String dueDateOrgStr = "",taskCode = "",taskCodeCurr = ""; String dueDateOrgStr = "",taskCode = "";
Document dom = null; Document dom = null;
PreparedStatement pstmt = null,pstmt1 = null,pstmt2 = null; PreparedStatement pstmt = null,pstmt1 = null,pstmt2 = null;
ResultSet rs=null,rs2=null; ResultSet rs=null,rs2=null;
...@@ -51,7 +51,7 @@ public class POrderMilestone extends ValidatorEJB { ...@@ -51,7 +51,7 @@ public class POrderMilestone extends ValidatorEJB {
Timestamp dueDateHeader = null,reschDate = null; Timestamp dueDateHeader = null,reschDate = null;
Timestamp complDateNew = null,dueDateOrg = null; Timestamp complDateNew = null,dueDateOrg = null;
String retString = "SUCCESS"; String retString = "SUCCESS";
String sqlResch ="",dateFormat = ""; String sqlResch ="";
System.out.println("xmlString DOM-->>["+xmlDataAll+"]"); System.out.println("xmlString DOM-->>["+xmlDataAll+"]");
try try
{ {
...@@ -77,8 +77,8 @@ public class POrderMilestone extends ValidatorEJB { ...@@ -77,8 +77,8 @@ public class POrderMilestone extends ValidatorEJB {
} }
if(childNodeName.equalsIgnoreCase("task_code")) if(childNodeName.equalsIgnoreCase("task_code"))
{ {
taskCodeCurr = checkNull(genericUtility.getColumnValue("task_code",dom)); taskCode = checkNull(genericUtility.getColumnValue("task_code",dom));
System.out.println("taskCode--->["+taskCodeCurr+"]"); System.out.println("taskCode--->["+taskCode+"]");
} }
if(childNodeName.equalsIgnoreCase("due_date")) if(childNodeName.equalsIgnoreCase("due_date"))
...@@ -87,23 +87,17 @@ public class POrderMilestone extends ValidatorEJB { ...@@ -87,23 +87,17 @@ public class POrderMilestone extends ValidatorEJB {
System.out.println("dueDateOrgStr--->["+dueDateOrgStr+"]"); System.out.println("dueDateOrgStr--->["+dueDateOrgStr+"]");
} }
if(childNodeName.equalsIgnoreCase("date_format"))
{
dateFormat = checkNull(genericUtility.getColumnValue("date_format",dom));
System.out.println("dateFormat--->["+dateFormat+"]");
}
} }
if(complDate.length() > 0)//completion date is not null if(complDate.length() > 0)//completion date is not null
{ {
complDateNew = Timestamp.valueOf(genericUtility.getValidDateString(complDate, dateFormat,genericUtility.getDBDateFormat()) + " 00:00:00.0"); complDateNew = Timestamp.valueOf(genericUtility.getValidDateString(complDate, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0");
System.out.println("completionDate ====parsed into sql format:::::"+complDateNew); System.out.println("completionDate ====parsed into sql format:::::"+complDateNew);
} }
if(dueDateOrgStr.length() > 0) if(dueDateOrgStr.length() > 0)
{ {
dueDateOrg = Timestamp.valueOf(genericUtility.getValidDateString(dueDateOrgStr,dateFormat,genericUtility.getDBDateFormat()) + " 00:00:00.0"); dueDateOrg = Timestamp.valueOf(genericUtility.getValidDateString(dueDateOrgStr, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0");
System.out.println("Due Date Original ====parsed into sql format:::==="+dueDateOrg); System.out.println("Due Date Original ====parsed into sql format:::==="+dueDateOrg);
} }
...@@ -121,13 +115,9 @@ public class POrderMilestone extends ValidatorEJB { ...@@ -121,13 +115,9 @@ public class POrderMilestone extends ValidatorEJB {
/**selecting pending tasks from header table **inserting records after rescheduling due dates in detail table***/ /**selecting pending tasks from header table **inserting records after rescheduling due dates in detail table***/
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,tran_id from pur_milstn where purc_order in(select purc_order from pur_milstn where tran_id = ?) and wf_status <> 'C' " + 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 wf_status <> 'C'";
" and tran_type <> 'D' " + // added by cpatil for at the time debit note creation it should not be run. pstmt = conn.prepareStatement(sql);
" and tran_id <> ? "; // added by cpatil on 23/07/15
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,tranId); pstmt.setString(1,tranId);
pstmt.setString(2,tranId);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while ( rs.next() ) while ( rs.next() )
{ {
...@@ -162,29 +152,17 @@ public class POrderMilestone extends ValidatorEJB { ...@@ -162,29 +152,17 @@ public class POrderMilestone extends ValidatorEJB {
pstmt1 = conn.prepareStatement(sqlResch); pstmt1 = conn.prepareStatement(sqlResch);
pstmt1.setString(1,tranIdPending); pstmt1.setString(1,tranId);
pstmt1.setInt(2,lineNo); pstmt1.setInt(2,lineNo);
pstmt1.setInt(3,delayDays); pstmt1.setInt(3,delayDays);
pstmt1.setString(4,taskCodeCurr); pstmt1.setString(4,taskCode);
pstmt1.setTimestamp(5,dueDateOrg); pstmt1.setTimestamp(5,dueDateHeader);
pstmt1.setTimestamp(6,parsedReschDate); pstmt1.setTimestamp(6,reschDate);
count = pstmt1.executeUpdate(); count = pstmt1.executeUpdate();
pstmt1.close(); pstmt1.close();
pstmt1 = null; pstmt1 = null;
System.out.println("NO. OF RECORDS INSERTED==== "+count); System.out.println("NO. OF RECORDS INSERTED==== "+count);
//*****Updating the due date for the ongoing task in header table***//*
sql = "update pur_milstn set due_date = ? where tran_id = ?";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setTimestamp(1,reschDate);
pstmt1.setString(2,tranIdPending);
count1 = pstmt1.executeUpdate();
pstmt1.close();
pstmt1 = null;
System.out.println("NO. OF RECORDS updated==== "+count1);
} }
rs.close(); rs.close();
rs=null; rs=null;
...@@ -192,7 +170,17 @@ public class POrderMilestone extends ValidatorEJB { ...@@ -192,7 +170,17 @@ public class POrderMilestone extends ValidatorEJB {
pstmt=null; pstmt=null;
/*****Updating the due date for the ongoing task in header table***/
sql = "update pur_milstn set due_date = ? where tran_id = ?";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setTimestamp(1,parsedReschDate);
pstmt1.setString(2,tranId);
count1 = pstmt1.executeUpdate();
pstmt1.close();
pstmt1 = null;
System.out.println("NO. OF RECORDS updated==== "+count1);
} }
...@@ -327,6 +315,11 @@ public class POrderMilestone extends ValidatorEJB { ...@@ -327,6 +315,11 @@ public class POrderMilestone extends ValidatorEJB {
count = pstmt1.executeUpdate(); count = pstmt1.executeUpdate();
pstmt1.close(); pstmt1.close();
pstmt1 = null; pstmt1 = null;
if(count > 0)
{
conn.commit();
}
} }
......
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