Commit 2f1e3e12 authored by mjadhav's avatar mjadhav

sop with commit transcation


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98383 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 58caadc1
...@@ -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 = ""; String dueDateOrgStr = "",taskCode = "",taskCodeCurr = "";
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 =""; String sqlResch ="",dateFormat = "";
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"))
{ {
taskCode = checkNull(genericUtility.getColumnValue("task_code",dom)); taskCodeCurr = checkNull(genericUtility.getColumnValue("task_code",dom));
System.out.println("taskCode--->["+taskCode+"]"); System.out.println("taskCode--->["+taskCodeCurr+"]");
} }
if(childNodeName.equalsIgnoreCase("due_date")) if(childNodeName.equalsIgnoreCase("due_date"))
...@@ -87,17 +87,23 @@ public class POrderMilestone extends ValidatorEJB { ...@@ -87,17 +87,23 @@ 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, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0"); complDateNew = Timestamp.valueOf(genericUtility.getValidDateString(complDate, dateFormat,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, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0"); dueDateOrg = Timestamp.valueOf(genericUtility.getValidDateString(dueDateOrgStr,dateFormat,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);
} }
...@@ -115,9 +121,13 @@ public class POrderMilestone extends ValidatorEJB { ...@@ -115,9 +121,13 @@ 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.
" and tran_id <> ? "; // added by cpatil on 23/07/15
pstmt = conn.prepareStatement(sql); 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() )
{ {
...@@ -152,40 +162,41 @@ public class POrderMilestone extends ValidatorEJB { ...@@ -152,40 +162,41 @@ public class POrderMilestone extends ValidatorEJB {
pstmt1 = conn.prepareStatement(sqlResch); pstmt1 = conn.prepareStatement(sqlResch);
pstmt1.setString(1,tranId); pstmt1.setString(1,tranIdPending);
pstmt1.setInt(2,lineNo); pstmt1.setInt(2,lineNo);
pstmt1.setInt(3,delayDays); pstmt1.setInt(3,delayDays);
pstmt1.setString(4,taskCode); pstmt1.setString(4,taskCodeCurr);
pstmt1.setTimestamp(5,dueDateHeader); pstmt1.setTimestamp(5,dueDateOrg);
pstmt1.setTimestamp(6,reschDate); pstmt1.setTimestamp(6,parsedReschDate);
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***//*
rs.close();
rs=null;
pstmt.close();
pstmt=null;
/*****Updating the due date for the ongoing task in header table***/
sql = "update pur_milstn set due_date = ? where tran_id = ?"; sql = "update pur_milstn set due_date = ? where tran_id = ?";
pstmt1 = conn.prepareStatement(sql); pstmt1 = conn.prepareStatement(sql);
pstmt1.setTimestamp(1,parsedReschDate); pstmt1.setTimestamp(1,reschDate);
pstmt1.setString(2,tranId); pstmt1.setString(2,tranIdPending);
count1 = pstmt1.executeUpdate(); count1 = pstmt1.executeUpdate();
pstmt1.close(); pstmt1.close();
pstmt1 = null; pstmt1 = null;
System.out.println("NO. OF RECORDS updated==== "+count1);
if(count1 > 0) if(count1 > 0)
{ {
conn.commit(); conn.commit();
} }
System.out.println("NO. OF RECORDS updated==== "+count1); }
rs.close();
rs=null;
pstmt.close();
pstmt=null;
} }
...@@ -321,6 +332,7 @@ public class POrderMilestone extends ValidatorEJB { ...@@ -321,6 +332,7 @@ public class POrderMilestone extends ValidatorEJB {
pstmt1.close(); pstmt1.close();
pstmt1 = null; pstmt1 = null;
System.out.println("count @@@@@@"+count);
if(count > 0) if(count > 0)
{ {
conn.commit(); conn.commit();
...@@ -399,4 +411,3 @@ public class POrderMilestone extends ValidatorEJB { ...@@ -399,4 +411,3 @@ public class POrderMilestone extends ValidatorEJB {
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