Commit 9117b5af authored by dhirajchavan's avatar dhirajchavan

Req#_D16ASUN006 for if Distribution order is not Issue or partially Issue then open the DO.,

added bitton in header dw of distribution order


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@101173 ce508802-f39f-4f6c-b175-0d175dae99d5
parent ed594358
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.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.ejb.Stateless;
import org.w3c.dom.Document;
import ibase.system.config.ConnDriver;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ActionHandlerEJB;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.utility.ITMException;
@Stateless
public class DistOpenPrc extends ActionHandlerEJB
implements DistOpenPrcLocal, DistOpenPrcRemote
{
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 = opendistOrder(tranId, xtraParams, forcedFlag);
}
return returnString;
}
public String opendistOrder(String distOrder, String xtraParams, String forcedFlag) throws RemoteException, ITMException
{
System.out.println("openSaleOrder called........");
String sql = "";
String errString = "";
Connection conn = null;
ConnDriver connDriver = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
ITMDBAccessEJB itmDBAccessLocal = new ITMDBAccessEJB();
E12GenericUtility genericUtility = null;
Timestamp sysdate = null;
String chgTerm = ""; String chgUser = "";
int upCount = 0;
String status = ""; String status1 = ""; String confirm = ""; String dorder = "";
String disConfirm = ""; String disOrder = "";
double qty = 0.0D; double qtydesp = 0.0D;
boolean flag = false;
try
{
connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
connDriver = null;
conn.setAutoCommit(false);
genericUtility = new E12GenericUtility();
Date dt = new Date();
SimpleDateFormat sdf1 = new SimpleDateFormat(genericUtility.getDBDateFormat());
sysdate = 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("distOrder @@@@@@@@@@@ORDER===========" + distOrder);
sql = "select confirmed,dist_order from distorder where dist_order= ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, distOrder);
rs = pstmt.executeQuery();
if (rs.next())
{
confirm = rs.getString("confirmed");
dorder = rs.getString("dist_order");
}
System.out.println("Confirmed is : " + confirm);
String str1;
if (confirm.equals("N"))
{
errString = itmDBAccessLocal.getErrorString("", "VTDLONTCFM", "");
str1 = errString;
return str1;
}
System.out.println("Confirmed is : " + dorder);
rs.close();
rs = null;
pstmt.close();
pstmt = null;
sql = "select dist_order,status,confirmed from distorder where dist_order=?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, dorder);
rs = pstmt.executeQuery();
System.out.println("sql@@" + sql + "resultset@@@" + rs);
if (rs.next())
{
status = rs.getString("status");
disOrder = rs.getString("dist_order");
disConfirm = rs.getString("confirmed");
System.out.println("status=========" + status);
System.out.println("qty=====" + disOrder);
System.out.println("qtydesp=======" + disConfirm);
if (status.equals("P"))
{
System.out.println("Not closed yet......@@@@@@@@@@@@@@@");
}
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (status.equals("X"))
{
sql = " update distorder set status='P' where dist_order=?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, disOrder);
upCount = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
System.out.println("Update Count====" + upCount);
System.out.println("Flag is distorder true@@@@");
}
else
{
errString = itmDBAccessLocal.getErrorString("", "VTDONO", "");
str1 = errString;
return str1;
}
if (upCount > 0)
{
errString = itmDBAccessLocal.getErrorString("", "VTDORDOP", "");
str1 = errString;
return str1;
}
}
catch (Exception e)
{
System.out.println("distorder..." + e.getMessage());
e.printStackTrace();
try
{
conn.rollback();
}
catch (Exception e1)
{
System.out.println("distorder..." + e1.getMessage());
e1.printStackTrace();
}
}
finally
{
try
{
if ((errString != null) && (errString.trim().length() > 0))
{
System.out.println("--going to commit tranaction--");
if (errString.indexOf("VTDORDOP") > -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;
}
}
\ No newline at end of file
package ibase.webitm.ejb.dis.adv;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import javax.ejb.Local;
@Local
public abstract interface DistOpenPrcLocal
{
public abstract String actionHandler(String paramString1, String paramString2, String paramString3)
throws RemoteException, ITMException;
}
\ No newline at end of file
package ibase.webitm.ejb.dis.adv;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import javax.ejb.Remote;
@Remote
public abstract interface DistOpenPrcRemote
{
public abstract String actionHandler(String paramString1, String paramString2, String paramString3)
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