Commit 3835562e authored by pshinde's avatar pshinde

Source Code for Sale Order open button(D15BSUN005)


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98060 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 8f6dce6e
/********************************************************
Title : SaleOrderOpenAct[D15BSUN005]
Date : 02/06/15
Developer: Priyanka Shinde
********************************************************/
package ibase.webitm.ejb.dis.adv;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import javax.ejb.Stateless;
import ibase.system.config.ConnDriver;
import ibase.utility.CommonConstants;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ActionHandlerEJB;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.dis.DistCommon;
import ibase.webitm.ejb.fin.CreatePoRcpVoucher;
import ibase.webitm.ejb.fin.FinCommon;
import ibase.webitm.utility.ITMException;
@Stateless
public class SaleOrderOpenAct extends ActionHandlerEJB implements SaleOrderOpenActLocal,SaleOrderOpenActRemote
{
public String actionHandler(String tranId, String xtraParams, String forcedFlag) throws RemoteException, ITMException
{
String returnString=null;
System.out.println(".......tranId......."+tranId);
System.out.println(".......xtraParams..."+xtraParams);
System.out.println(".......forcedFlag..."+forcedFlag);
if(tranId!=null && tranId.trim().length()>0)
{
returnString = openSaleOrder(tranId,xtraParams,forcedFlag);
}
return returnString;
}
public String openSaleOrder(String saleOrder,String xtraParams,String forcedFlag) throws RemoteException,ITMException
{
System.out.println("openSaleOrder called........");
String sql = "",sql1="";
String errString = "" ;
Connection conn = null;
ConnDriver connDriver = null;
PreparedStatement pstmt = null,pstmt1=null;
ResultSet rs = null;
ITMDBAccessEJB itmDBAccessLocal = new ITMDBAccessEJB();
ibase.utility.E12GenericUtility genericUtility= null;
Timestamp sysdate = null;
String chgTerm = "", chgUser = "";
int upCount=0;
String saleOrd="",lineNo="",status="";
double qty=0,qtydesp=0;
boolean flag=false;
try
{
connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
connDriver = null;
conn.setAutoCommit(false);
genericUtility =new ibase.utility.E12GenericUtility();
java.util.Date dt = new java.util.Date();
SimpleDateFormat sdf1= new SimpleDateFormat(genericUtility.getDBDateFormat());
sysdate = java.sql.Timestamp.valueOf(sdf1.format(dt)+" 00:00:00.0");
chgTerm = genericUtility.getValueFromXTRA_PARAMS( xtraParams, "CHG_TERM" );
chgUser = genericUtility.getValueFromXTRA_PARAMS( xtraParams, "CHG_USER" );
System.out.println("SALES ORDER==========="+saleOrder);
sql = "select status,qty_desp,quantity,sale_order,line_no from sorditem where sale_order= ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, saleOrder);
rs = pstmt.executeQuery();
while (rs.next())
{
saleOrd=rs.getString("sale_order");
lineNo=rs.getString("line_no");
status=rs.getString("status");
qty = rs.getDouble("quantity");
qtydesp = rs.getDouble("qty_desp");
System.out.println("Sale Order======"+saleOrd);
System.out.println("lineNo======" + lineNo);
System.out.println("status=========" + status);
System.out.println("qty=====" + qty);
System.out.println("qtydesp======="+qtydesp);
if(qtydesp!=qty)
{
sql1=" update sorditem set status = 'P' where line_no= ? and sale_order=?";
pstmt1 = conn.prepareStatement(sql1);
pstmt1.setString(1, lineNo);
pstmt1.setString(2, saleOrd);
upCount = pstmt1.executeUpdate();
pstmt1.close();
pstmt1= null;
flag=true;
System.out.println("Update Count===="+upCount);
}
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(flag==false)
{
System.out.println("Sale Order is Fully Despatch!!!!!!!!!!!!");
errString = itmDBAccessLocal.getErrorString("","VTFULDESP","");
}
if(upCount>0)
{
errString = itmDBAccessLocal.getErrorString("","VTSORDOP","");
}
}
catch( Exception e)
{
System.out.println("SaleOrderOpenAct..."+e.getMessage());
e.printStackTrace();
try
{
conn.rollback();
}
catch(Exception e1)
{
System.out.println("SaleOrderOpenAct..."+e1.getMessage());
e1.printStackTrace();
}
}
finally
{
try
{
if (errString != null && errString.trim().length() > 0)
{
System.out.println("--going to commit tranaction--");
if (errString.indexOf("VTSORDOP") > -1)
{
conn.commit();
System.out.println("--transaction commited--");
}
else
{
conn.rollback();
System.out.println("--transaction rollback--");
}
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(conn != null)
{
conn.close();
conn = null;
}
}
catch(Exception e)
{
System.out.println("Exception : "+e);
e.printStackTrace();
throw new ITMException(e);
}
}
return errString;
} //end of method
}
/******************************************************** Title : SaleOrderOpenActLocal[D15BSUN005] Date : 02/06/15 Developer: Priyanka Shinde ********************************************************/ package ibase.webitm.ejb.dis.adv; import ibase.webitm.utility.ITMException;import ibase.webitm.ejb.*; import java.sql.Connection;import java.rmi.RemoteException; import javax.ejb.Local; @Localpublic interface SaleOrderOpenActLocal extends ActionHandlerLocal{ public String actionHandler(String tranId,String xtraParams,String forcedFlag)throws RemoteException, ITMException;}
\ No newline at end of file
/******************************************************** Title : SaleOrderOpenActRemote[D15BSUN005] Date : 02/06/15 Developer: Priyanka Shinde ********************************************************/ package ibase.webitm.ejb.dis.adv; import ibase.webitm.utility.ITMException;import ibase.webitm.ejb.*; import java.sql.Connection;import java.rmi.RemoteException;import javax.ejb.Remote; @Remotepublic interface SaleOrderOpenActRemote extends ActionHandlerRemote { public String actionHandler(String tranId,String xtraParams, String forcedFlag)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