Commit fb5c7c69 authored by dsawant's avatar dsawant

updated


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@96351 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 6fa38806
...@@ -13,6 +13,8 @@ import ibase.webitm.utility.ITMException; ...@@ -13,6 +13,8 @@ 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 ibase.webitm.ejb.dis.DistStkUpdLocal;
import ibase.webitm.ejb.dis.InvAllocTraceBean;
import javax.ejb.Stateless; // added for ejb3 import javax.ejb.Stateless; // added for ejb3
...@@ -764,7 +766,186 @@ public class DespatchPos extends ValidatorEJB implements DespatchPosLocal, Despa ...@@ -764,7 +766,186 @@ public class DespatchPos extends ValidatorEJB implements DespatchPosLocal, Despa
} }
public String postSaveCall(String xmlString,String editFlag,String tranId, String xtraParams,Connection conn) throws RemoteException,ITMException
{
System.out.println("----------postSaveWiz method called......................."+tranId);
System.out.println("xmlString------>>["+xmlString+"]");
String sql = "",saleOrder = "";
int lineNo = 0;
Document dom = null;
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;
//GenericUtility genericUtility = GenericUtility.getInstance();
PreparedStatement pstmt = null,pstmt1 = null;
ResultSet rs = null,rs1 = null;
boolean isError=false;
GenericUtility genericUtility = GenericUtility.getInstance();
//System.out.println("tranId="+tranId+" xtraParams="+xtraParams);
try
{
/*tranId=tranId==null ? "" :tranId.trim();
if (xmlString != null && xmlString.trim().length() > 0)
{
dom = parseString(xmlString);
}
if(dom!=null && tranId.length() == 0){
System.out.println("dom not null.........");
tranId = GenericUtility.getInstance().getColumnValue("desp_id",dom);
}
System.out.println("tranId----->>["+tranId+"]");*/
try
{
if(xmlString != null && xmlString.trim().length()!=0)
{
dom = genericUtility.parseString(xmlString);
System.out.println("xmlString d" + xmlString);
}
tranId = GenericUtility.getInstance().getColumnValue("tran_id",dom);
System.out.println("------------ chk val postSave method called-----------------tranId from dom: "+ tranId);
}
catch(Exception e)
{
System.out.println("Exception : WorkOrdRcpPostSave : postSave : ==>\n"+e.getMessage());
throw new ITMException(e);
}
conn=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 = ? ";
pstmt1= conn.prepareStatement(sql);
pstmt1.setString( 1, tranId );
rs1 = pstmt1.executeQuery();
while (rs1.next())
{
saleOrder = rs1.getString("sord_no");
lineNo = rs1.getInt("line_no__sord");
quantityStduom = rs1.getDouble("quantity__stduom");
rateStduom = rs1.getDouble("rate__stduom");
offinvAmtDet = rs1.getDouble("disc_schem_offinv_amt");
taxAmtDet = rs1.getDouble("tax_amt");
sql = " select discount from sorddet where sale_order = ? and line_no = ? ";
pstmt= conn.prepareStatement(sql);
pstmt.setString( 1, saleOrder );
pstmt.setInt( 2, lineNo );
rs = pstmt.executeQuery();
if (rs.next())
{
discount = rs.getDouble("discount");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
//[(quantity__stduom*rate__stduom)-((quantity__stduom*rate__stduom*discount)/100)-disc_schem_offinv_amt+tax_amt]
amount = (quantityStduom*rateStduom) - ((quantityStduom*rateStduom*discount)/100) - offinvAmtDet + taxAmtDet;
System.out.println("amount="+amount);
totAmt = totAmt + amount;
}
rs1.close();
rs1 = null;
pstmt1.close();
pstmt1 = null;
System.out.println("tot amt = "+totAmt);
sql = "select sum(gross_weight),sum(tare_weight) ,sum(nett_weight) ,sum(no_art) ,sum(disc_schem_offinv_amt) ,sum(disc_schem_billback_amt) "
+" from despatchdet where desp_id = ? ";
pstmt= conn.prepareStatement(sql);
pstmt.setString( 1, tranId );
rs = pstmt.executeQuery();
if (rs.next())
{
grossWeight = rs.getDouble(1);
tareWeight = rs.getDouble(2);
netWeight = rs.getDouble(3);
noAart = rs.getDouble(4);
offinvAmt = rs.getDouble(5);
billbackAmt = rs.getDouble(6);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("sum ="+grossWeight+" "+tareWeight+" "+netWeight+" "+noAart+" "+offinvAmt+" "+billbackAmt);
sql = " update despatch set gross_weight = ? , tare_weight = ?,nett_weight = ?,no_art = ?, "
+" disc_offinv_amt_det = ?, disc_billback_amt_det = ? ,tot_value = ? where desp_id = ? " ;
pstmt= conn.prepareStatement( sql );
pstmt.setDouble( 1, grossWeight );
pstmt.setDouble( 2, tareWeight );
pstmt.setDouble( 3, netWeight );
pstmt.setDouble( 4, noAart );
pstmt.setDouble( 5, offinvAmt );
pstmt.setDouble( 6, billbackAmt );
pstmt.setDouble( 7, totAmt );
pstmt.setString( 8, tranId );
pstmt.executeUpdate();
pstmt.close();
pstmt = null;
}
catch(Exception e)
{
isError=true;
e.printStackTrace();
try
{
conn.rollback();
}catch(Exception d){
d.printStackTrace();
}
throw new ITMException(e);
}
finally
{
System.out.println("in Finally------>>["+isError+"]");
try
{
if(pstmt != null)pstmt.close();
pstmt = null;
}catch(Exception d)
{
d.printStackTrace();
throw new ITMException(d);
}
if(!isError){
try
{
conn.commit();
}
catch(Exception d){
d.printStackTrace();
}
}
if(conn!=null){
try
{
conn.close();
conn=null;
}
catch(Exception e){
e.printStackTrace();
}
}
}
return "";
}
private Node getCurrentDetailFromDom(Document dom,String domId) private Node getCurrentDetailFromDom(Document dom,String domId)
{ {
NodeList detailList = null; NodeList detailList = null;
......
...@@ -7,6 +7,7 @@ import java.rmi.RemoteException; ...@@ -7,6 +7,7 @@ import java.rmi.RemoteException;
import java.sql.Connection; import java.sql.Connection;
import ibase.webitm.utility.ITMException; import ibase.webitm.utility.ITMException;
import javax.ejb.Local; // added for ejb3 import javax.ejb.Local; // added for ejb3
...@@ -19,4 +20,5 @@ public interface DespatchPosLocal extends ValidatorLocal ...@@ -19,4 +20,5 @@ public interface DespatchPosLocal extends ValidatorLocal
//added by kunal on 09/007/13 //added by kunal on 09/007/13
public String postSave(String winName,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;
public String postSaveWiz(String winName,String editFlag,String tranId, String xtraParams,Connection conn) throws RemoteException,ITMException; public String postSaveWiz(String winName,String editFlag,String tranId, String xtraParams,Connection conn) throws RemoteException,ITMException;
public String postSaveCall(String xmlString,String editFlag,String tranId, String xtraParams,Connection conn) throws RemoteException,ITMException;
} }
\ No newline at end of file
...@@ -19,4 +19,5 @@ public interface DespatchPosRemote extends ValidatorRemote ...@@ -19,4 +19,5 @@ public interface DespatchPosRemote extends ValidatorRemote
//added by kunal on 09/007/13 //added by kunal on 09/007/13
public String postSave(String winName,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;
public String postSaveWiz(String winName,String editFlag,String tranId, String xtraParams,Connection conn) throws RemoteException,ITMException; public String postSaveWiz(String winName,String editFlag,String tranId, String xtraParams,Connection conn) throws RemoteException,ITMException;
public String postSaveCall(String xmlString,String editFlag,String tranId, String xtraParams,Connection conn) throws RemoteException,ITMException;
} }
\ No newline at end of file
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