Commit 1ac081f8 authored by ppanigrahi's avatar ppanigrahi

Updated STATUS in PAY_3WAY_STAT and SUPPLIER_BILL table .


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98078 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 3a90a2ef
...@@ -9,6 +9,7 @@ import java.sql.Connection; ...@@ -9,6 +9,7 @@ import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Timestamp;
public class ThreeWayMatchCond { public class ThreeWayMatchCond {
public String confirm(String tranId, String empCodeAprv, String xmlDataAll, String processId, String keyFlag) throws RemoteException, ITMException { public String confirm(String tranId, String empCodeAprv, String xmlDataAll, String processId, String keyFlag) throws RemoteException, ITMException {
...@@ -25,17 +26,99 @@ public class ThreeWayMatchCond { ...@@ -25,17 +26,99 @@ public class ThreeWayMatchCond {
ResultSet rs = null; ResultSet rs = null;
String sql = ""; String sql = "";
ConnDriver connDriver = new ConnDriver(); ConnDriver connDriver = new ConnDriver();
GenericUtility genericUtility = null; Timestamp timestamp = null;
int resultCnt = 0;
try { try {
conn = connDriver.getConnectDB("DriverITM"); conn = connDriver.getConnectDB("DriverITM");
connDriver = null; connDriver = null;
conn.setAutoCommit(false); conn.setAutoCommit(false);
timestamp = new Timestamp(System.currentTimeMillis());
empCodeAprv = empCodeAprv == null ? "" : empCodeAprv.trim(); empCodeAprv = empCodeAprv == null ? "" : empCodeAprv.trim();
if("LEVEL1".equalsIgnoreCase(keyFlag) || "LEVEL2".equalsIgnoreCase(keyFlag) || "LEVEL3".equalsIgnoreCase(keyFlag) || "LEVEL_HOD".equalsIgnoreCase(keyFlag)|| "LEVEL_HHODS".equalsIgnoreCase(keyFlag)) if("UPDATEPAY3WAYSTAT".equalsIgnoreCase(keyFlag))
{
sql = "update Pay_3way_Stat set Status = '3', Status_Date = ? where Tran_Id = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, timestamp);
pstmt.setString(2, tranId);
resultCnt += pstmt.executeUpdate();
pstmt.close();
pstmt = null;
System.out.println("Pay_3way_Stat Update Successfully:"+resultCnt);
if(resultCnt > 1) {
conn.commit();
retString = "Y";
} else {
conn.rollback();
retString = "N";
}
}
else if("UPDATESUPPLIERBILL".equalsIgnoreCase(keyFlag))
{
String purcOrder = "", tranIdRcp = "", tranIdVch = "";
boolean updateFlag = false;
sql = "select tab1.cnt, coalesce(tab2.cnt,0) cnt2,tab1.purc_order, tab1.tran_id__rcp, tab1.tran_id__vch "
+ "from ( "
+ " select count(a1.status) cnt,a1.purc_order,a1.tran_id__rcp,a1.tran_id__vch "
+ " from pay_3way_stat a1 "
+ " left outer join pay_3way_stat a2 on a1.purc_order = a2.purc_order and a1.tran_id__rcp = a2.tran_id__rcp and a1.tran_id__vch = a2.tran_id__vch "
+ " where a1.tran_id = ? "
+ " group by a1.tran_id,a1.purc_order,a1.tran_id__rcp,a1.tran_id__vch "
+ ") tab1 "
+ "left outer join ( "
+ " select count(a1.status) cnt,a1.purc_order,a1.tran_id__rcp,a1.tran_id__vch "
+ " from pay_3way_stat a1 "
+ " left outer join pay_3way_stat a2 on a1.purc_order = a2.purc_order and a1.tran_id__rcp = a2.tran_id__rcp and a1.tran_id__vch = a2.tran_id__vch "
+ " where a1.tran_id = ? and a2.status = '3' "
+ " group by a1.tran_id,a1.purc_order,a1.tran_id__rcp,a1.tran_id__vch "
+ ") tab2 on tab1.purc_order = tab2.purc_order and tab1.tran_id__rcp = tab2.tran_id__rcp and tab1.tran_id__vch = tab2.tran_id__vch";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
pstmt.setString(2, tranId);
rs = pstmt.executeQuery();
if (rs.next())
{
if(rs.getInt("cnt") == rs.getInt("cnt2"))
{
updateFlag = true;
purcOrder = rs.getString("purc_order");
tranIdRcp = rs.getString("tran_id__rcp");
tranIdVch = rs.getString("tran_id__vch");
}
}
System.out.println("updateFlag["+updateFlag+"],purcOrder["+purcOrder+"],tranIdRcp["+tranIdRcp+"],tranIdVch["+tranIdVch+"]");
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(updateFlag)
{
sql = "update supplier_bill set match_status = '3' where porder_no = ? and voucher_no = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, purcOrder);
pstmt.setString(2, tranIdVch);
resultCnt += pstmt.executeUpdate();
pstmt.close();
pstmt = null;
System.out.println("Supplier_Bill Update Successfully:"+resultCnt);
if(resultCnt > 1) {
conn.commit();
retString = "Y";
} else {
conn.rollback();
retString = "N";
}
}
}
else if("LEVEL1".equalsIgnoreCase(keyFlag) || "LEVEL2".equalsIgnoreCase(keyFlag) || "LEVEL3".equalsIgnoreCase(keyFlag) || "LEVEL_HOD".equalsIgnoreCase(keyFlag)|| "LEVEL_HHODS".equalsIgnoreCase(keyFlag))
{ {
int resultCnt = 0;
String signStatus = "", userCode = "", processInfo[] = null, activityId = "", roleCode = ""; String signStatus = "", userCode = "", processInfo[] = null, activityId = "", roleCode = "";
if("LEVEL1".equalsIgnoreCase(keyFlag)) { if("LEVEL1".equalsIgnoreCase(keyFlag)) {
......
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