Commit 715b5c9a authored by dpawar's avatar dpawar

revert code of kunal


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@96302 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 311195c1
...@@ -3,7 +3,6 @@ package ibase.webitm.ejb.dis; ...@@ -3,7 +3,6 @@ package ibase.webitm.ejb.dis;
import java.rmi.RemoteException; import java.rmi.RemoteException;
import java.util.*; import java.util.*;
import java.sql.*; import java.sql.*;
import org.w3c.dom.*; import org.w3c.dom.*;
import javax.ejb.*; import javax.ejb.*;
...@@ -13,7 +12,6 @@ import ibase.webitm.utility.ITMException; ...@@ -13,7 +12,6 @@ import ibase.webitm.utility.ITMException;
import ibase.webitm.utility.GenericUtility; import ibase.webitm.utility.GenericUtility;
import ibase.system.config.*; import ibase.system.config.*;
import ibase.webitm.ejb.*; import ibase.webitm.ejb.*;
import javax.ejb.Stateless; // added for ejb3 import javax.ejb.Stateless; // added for ejb3
...@@ -500,42 +498,19 @@ public class DespatchPos extends ValidatorEJB implements DespatchPosLocal, Despa ...@@ -500,42 +498,19 @@ public class DespatchPos extends ValidatorEJB implements DespatchPosLocal, Despa
} }
//postSave() added by kunal on 11/07/13 FOR cross update //postSave() added by kunal on 11/07/13 FOR cross update
public String postSave(String xmlString,String editFlag,String tranId,String xtraParams,Connection conn) throws RemoteException,ITMException public String postSave(String winName,String editFlag,String tranId, String xtraParams,Connection conn) throws RemoteException,ITMException
{ {
String sql = "",saleOrder = "",lotsl="",siteCode=""; String sql = "",saleOrder = "";
int lineNo = 0; int lineNo = 0;
double grossWeight = 0,tareWeight = 0,netWeight = 0,noAart = 0,offinvAmt = 0,billbackAmt = 0,quantity=0 ; double grossWeight = 0,tareWeight = 0,netWeight = 0,noAart = 0,offinvAmt = 0,billbackAmt = 0 ;
double quantityStduom = 0 ,rateStduom = 0,offinvAmtDet = 0,taxAmtDet = 0 ,discount = 0,totAmt = 0,amount = 0; double quantityStduom = 0 ,rateStduom = 0,offinvAmtDet = 0,taxAmtDet = 0 ,discount = 0,totAmt = 0,amount = 0;
//GenericUtility genericUtility = GenericUtility.getInstance(); //GenericUtility genericUtility = GenericUtility.getInstance();
PreparedStatement pstmt = null,pstmt1 = null; PreparedStatement pstmt = null,pstmt1 = null;
ResultSet rs = null,rs1 = null; ResultSet rs = null,rs1 = null;
boolean isError=true;
Document dom = null;
//System.out.println("tranId="+tranId+" xtraParams="+xtraParams); //System.out.println("tranId="+tranId+" xtraParams="+xtraParams);
try try
{ {
tranId=tranId==null ? "" :tranId.trim();
System.out.println("xml_String333--->>["+xmlString+"]");
System.out.println("tranId555--->>["+tranId+"]");
if (xmlString != null && xmlString.trim().length() > 0)
{
dom = parseString(xmlString);
}
if(tranId.length() == 0 && dom !=null){
System.out.println("dom not null..................");
tranId = GenericUtility.getInstance().getColumnValue("desp_id",dom);
}
System.out.println("tranId777------>>["+tranId+"]");
conn=null;
if(conn == null){
System.out.println("connection is null..............");
ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false);
connDriver=null;
}
sql = " select sord_no,line_no__sord ,quantity__stduom,rate__stduom ,disc_schem_offinv_amt,tax_amt from despatchdet where desp_id = ? "; sql = " select sord_no,line_no__sord ,quantity__stduom,rate__stduom ,disc_schem_offinv_amt,tax_amt from despatchdet where desp_id = ? ";
pstmt1= conn.prepareStatement(sql); pstmt1= conn.prepareStatement(sql);
...@@ -611,92 +586,18 @@ public class DespatchPos extends ValidatorEJB implements DespatchPosLocal, Despa ...@@ -611,92 +586,18 @@ public class DespatchPos extends ValidatorEJB implements DespatchPosLocal, Despa
pstmt.executeUpdate(); pstmt.executeUpdate();
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
String itemCode="",locCode="",siteCodeL="",lotNo="",lotSl="";
//new add
sql = "select item_code,loc_code,site_code,lot_no,lot_sl"
+ " from despatchdet where desp_id = ? order by line_no";
pstmt= conn.prepareStatement(sql);
//System.out.println("Second sql ["+sql + "]");
pstmt.setString( 1, tranId );
rs = pstmt.executeQuery();
while(rs.next())
{
itemCode=rs.getString("item_code")==null ? "" : rs.getString("item_code").trim();
locCode=rs.getString("loc_code")==null ? "" : rs.getString("loc_code").trim();
siteCode=rs.getString("site_code") == null ? "" : rs.getString("site_code");
locCode=rs.getString("loc_code") == null ? "" : rs.getString("loc_code");
lotNo=rs.getString("lot_no")== null ? "" : rs.getString("lot_no").trim();
lotSl=rs.getString("lot_sl") == null ? "" : rs.getString("lot_sl").trim();
//UPDATE stock SET ALLOC_QTY = CASE WHEN ALLOC_QTY IS NULL THEN 0 ELSE ALLOC_QTY END + ? WHERE site_code = ? AND LOT_SL = ? AND LOC_CODE = ? AND QUANTITY > 0;
sql = "UPDATE STOCK SET ALLOC_QTY = CASE WHEN ALLOC_QTY IS NULL THEN 0 ELSE ALLOC_QTY END + ? "
+ "WHERE ITEM_CODE = ? AND SITE_CODE = ? AND LOC_CODE = ? AND LOT_SL = ? AND "
+ "LOT_NO = ? AND QUANTITY > 0";
pstmt1= conn.prepareStatement(sql);
//System.out.println("First sql ["+ sql + "] tranId [" + tranId + "]");
pstmt1.setDouble( 1, quantity);
pstmt1.setString( 2, itemCode);
pstmt1.setString( 3, siteCode);
pstmt1.setString( 4, locCode);
pstmt1.setString( 5, lotsl);
pstmt1.setString( 6, lotNo);
pstmt1.executeUpdate();
if(pstmt1 !=null){
pstmt1.close();
pstmt1 = null;
}
}
if(rs!=null){
rs.close();
rs = null;
}
if(pstmt!=null){
pstmt.close();
pstmt = null;
}
//new add end
} }
catch(Exception e) catch(Exception e)
{ {
e.printStackTrace(); e.printStackTrace();
try{
isError=false;
conn.rollback();
}
catch(Exception e1){
e1.printStackTrace();
}
throw new ITMException(e); throw new ITMException(e);
} }
finally finally
{ {
System.out.println("Inside Finally isError---->>["+isError+"]");
try try
{ {
if(rs!=null){ if(pstmt != null)pstmt.close();
rs.close();
rs = null;
}
if(pstmt!=null){
pstmt.close();
pstmt = null; pstmt = null;
}
if(pstmt1 !=null){
pstmt1.close();
pstmt1 = null;
}
if(isError){
conn.commit();
}
if(conn !=null){
conn.close();
conn=null;
}
}catch(Exception d) }catch(Exception d)
{ {
d.printStackTrace(); d.printStackTrace();
......
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