Commit 30072b5a authored by dsawant's avatar dsawant

updated for campaign


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@95191 ce508802-f39f-4f6c-b175-0d175dae99d5
parent d24a4834
package ibase.webitm.ejb.mfg;
import java.sql.*;
import java.rmi.RemoteException;
import java.util.*;
import org.w3c.dom.*;
import javax.ejb.*;
import javax.naming.InitialContext;
import ibase.webitm.utility.ITMException;
import ibase.utility.CommonConstants;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.GenericUtility;
import ibase.system.config.*;
import ibase.webitm.utility.*;
import ibase.utility.*;
import ibase.webitm.ejb.*;
import java.text.*;
import javax.ejb.Stateless; // added for ejb3
import ibase.webitm.utility.ITMException;
import ibase.webitm.utility.TransIDGenerator;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import javax.ejb.Stateless;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
// added for ejb3
@Stateless // added for ejb3
......@@ -60,10 +66,11 @@ public class WoPostSave extends ValidatorEJB implements WoPostSaveLocal, WoPos
private String executepostSaveRec(Document dom, String domID, String ObjContext, String editFlag, String xtraParams, Connection conn) throws RemoteException, ITMException
{
String ordertype = "", workorder = "", itemcode = "", sitecode = "" ,lotno = "";
String ordertypeT = "",genlotnoT = "", sql = "",sql1 = "",keyT = "";
String ordertypeT = "",genlotnoT = "", sql = "",sql1 = "",keyT = "",wostatus="",campno="";
NodeList hdrDom = null;
Node currDetail = null;
Statement stmt = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String ls_fglotnoon = "",ls_setfg = "";
String ls_win = "fg_lotno";
......@@ -72,7 +79,7 @@ public class WoPostSave extends ValidatorEJB implements WoPostSaveLocal, WoPos
String errCode = "";
String userId = "";
boolean lb_nositeitem = false;
int updCnt = 0;
int updCnt = 0,count=0;
GenericUtility genericUtility = GenericUtility.getInstance();
try
......@@ -98,6 +105,59 @@ public class WoPostSave extends ValidatorEJB implements WoPostSaveLocal, WoPos
stmt = conn.createStatement();
try
{
sql = "select status from workorder where work_order = ?";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1,workorder);
rs = pstmt.executeQuery();
if(rs.next())
{
wostatus = rs.getString(1) == null ? "":rs.getString(1);
}
pstmt.close();
rs.close();
pstmt = null;
rs = null;
System.out.println("wostatusWEWEWEE chkk >>>>>>>>>>>>>>>>>>."+wostatus);
sql = "select campgn_no from workorder where work_order = ?";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1,workorder);
rs = pstmt.executeQuery();
if(rs.next())
{
campno = rs.getString(1) == null ? "":rs.getString(1);
}
pstmt.close();
rs.close();
pstmt = null;
rs = null;
if(wostatus.equalsIgnoreCase("P") || wostatus.equalsIgnoreCase("M") || wostatus.equalsIgnoreCase("U"))
{
System.out.println("ENTER IN STATUS CHECK >>>>>");
sql = "UPDATE WORDER_CAMPAIGN SET CAMPGN_NO = ? WHERE WORK_ORDER = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,campno);
pstmt.setString(2,workorder);
count = pstmt.executeUpdate();
if(count < 1)
{
System.out.println("updation of record is failed");
}
else
{
conn.commit();
}
pstmt.close();
pstmt = null;
System.out.println("NO. OF RECORDS UPDATED FOR CURRENT PERIODE.. "+count);
}
sql1 = "SELECT CASE WHEN generate_lot_no IS NULL THEN '0' ELSE generate_lot_no END "
+" from siteitem where site_code = '"+sitecode+"' and item_code = '"+itemcode+"' ";
System.out.println("sql1 ....:"+sql1);
......
package ibase.webitm.ejb.mfg;
import ibase.system.config.ConnDriver;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Timestamp;
import javax.ejb.Stateless;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@Stateless
public class WordCampVal extends ValidatorEJB implements WordCampValLocal,WordCampValRemote
{
GenericUtility genericUtility = GenericUtility.getInstance();
public String wfValData(String xmlString, String xmlString1, String xmlString2,String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
{
System.out.println("------------@ wfvalData method called-----------------");
System.out.println("Xml String : ["+xmlString+"]");
String errString = null;
Document dom = null;
Document dom1 = null;
Document dom2 = null;
GenericUtility genericUtility = GenericUtility.getInstance();
System.out.println("below genericUtility--------------->>>>>>>>>");
try
{
if(xmlString != null && xmlString.trim().length()!=0)
{
dom = genericUtility.parseString(xmlString);
System.out.println("xmlString d" + xmlString);
}
if(xmlString1 != null && xmlString1.trim().length()!=0)
{
dom1 = genericUtility.parseString(xmlString1);
System.out.println("xmlString1 f" + xmlString1);
}
if(xmlString2 != null && xmlString2.trim().length()!=0)
{
dom2 = genericUtility.parseString(xmlString2);
System.out.println("xmlString2 f" + xmlString2);
}
errString = wfValData(dom,dom1,dom2,objContext,editFlag,xtraParams);
}
catch(Exception e)
{
System.out.println("Exception : budgetgroup.java : wfValData(String xmlString) : ==>\n"+e.getMessage());
throw new ITMException(e);
}
return errString;
} //end of wfValData
public String wfValData(Document dom, Document dom1, Document dom2,String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
{
NodeList parentNodeList = null;
NodeList childNodeList = null;
Node parentNode = null;
Node childNode = null;
int ctr=0;
String childNodeName = null;
String errString = "";
Connection conn = null;
PreparedStatement pstmt = null ;
ResultSet rs = null;
int currentFormNo=0;
int childNodeListLength;
ConnDriver connDriver = new ConnDriver();
String fromDateStr = null;
String toDateStr = null;
Timestamp fromDate = null;
Timestamp toDate = null;
String userId="",errCode="",locgrp ="";
GenericUtility genericUtility = GenericUtility.getInstance();
try
{
conn = connDriver.getConnectDB("DriverITM");
connDriver = null;
userId = getValueFromXTRA_PARAMS(xtraParams,"loginCode");
System.out.println("user ID form XtraParam : "+userId);
if(objContext != null && objContext.trim().length()>0)
{
currentFormNo = Integer.parseInt(objContext);
}
switch(currentFormNo)
{
case 1 :
parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength();
for(ctr = 0; ctr < childNodeListLength; ctr++)
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if (childNodeName.equalsIgnoreCase("date_from"))
{
fromDateStr = genericUtility.getColumnValue( "date_from", dom );
System.out.println("dfhfhfghfgvfvb hjkddfgrrg"+fromDateStr);
toDateStr = genericUtility.getColumnValue( "date_to", dom );
System.out.println("dfhfhfghfgvfvb hdssdswererjkddfgrrg"+toDateStr);
//order_date__fr = genericUtility.getColumnValue("order_date__fr",dom);
System.out.println("dates here"+fromDate+""+toDate);
System.out.println("in date validation");
if (fromDateStr == null || fromDateStr.trim().length() == 0 )
{
errCode = "VTWOCPRCFR";
errString = getErrorString("date_from",errCode,userId);
break;
}else{
if (fromDateStr != null || fromDateStr.trim().length() > 0 )
{
if (toDateStr != null)
{
fromDateStr = genericUtility.getValidDateString( fromDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat() );
fromDate = java.sql.Timestamp.valueOf( fromDateStr + " 00:00:00.0" );
toDateStr = genericUtility.getValidDateString( toDateStr, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat());
toDate =java.sql.Timestamp.valueOf( toDateStr + " 00:00:00.0");
System.out.println("fromDate is after toDate");
if(fromDate.compareTo(toDate)>0)
{
System.out.println("order_date__fr main validation fire");
errCode = "VTWOCPRCFN";
errString = getErrorString("date_from",errCode,userId);
break;
}
}
}
}
}
else if (childNodeName.equalsIgnoreCase("date_to"))
{
toDateStr = genericUtility.getColumnValue( "date_to", dom );
System.out.println("dfhfhfghfgvfvdvfvb hjk"+toDateStr);
if (toDateStr == null || toDateStr.trim().length() == 0 )
{
errCode = "VTWOCPRCTO";
errString = getErrorString("date_to",errCode,userId);
break;
}
}
}
break;
default:
} //end switch
} //end try
catch(Exception e)
{
System.out.println("Exception ::"+e);
e.printStackTrace();
errString=e.getMessage();
throw new ITMException(e);
}
finally
{
try
{
if(conn!=null)
{
if(rs != null )
{
rs.close();
rs = null;
}
if(pstmt != null )pstmt.close();
pstmt =null;
conn.close();
}
conn = null;
}
catch(Exception d)
{
d.printStackTrace();
}
}
System.out.println("ErrString ::[ "+errString+" ]");
return errString;
}
}
package ibase.webitm.ejb.mfg;
import java.rmi.RemoteException;
import org.w3c.dom.*;
import ibase.webitm.ejb.ValidatorLocal;
import ibase.webitm.utility.ITMException;
import javax.ejb.Local;
@Local
public interface WordCampValLocal extends ValidatorLocal
{
public String wfValData(String xmlString, String xmlString1, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String wfValData(Document dom, Document dom1, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
}
package ibase.webitm.ejb.mfg;
import java.rmi.RemoteException;
import org.w3c.dom.*;
import ibase.webitm.ejb.ValidatorRemote;
import ibase.webitm.utility.ITMException;
import javax.ejb.Remote;
@Remote
public interface WordCampValRemote extends ValidatorRemote
{
public String wfValData(String xmlString, String xmlString1, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String wfValData(Document dom, Document dom1, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
}
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