Commit 16110886 authored by ysawant's avatar ysawant

*Updated ShiftPattern component

w_shift_pattern.sql
ShiftPattern.java
ShiftPatternRemote.java
shift-pattern.png
shift-patternwht.png


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@205850 ce508802-f39f-4f6c-b175-0d175dae99d5
parent eb894e40
......@@ -74,7 +74,7 @@ update pophelp set sql_str = 'select shift_pattern from shift_pattern', default_
Insert into MESSAGES (MSG_NO,MSG_STR,MSG_DESCR,MSG_TYPE,MSG_OPT,MSG_TIME,ALARM,ERR_SOURCE,CHG_DATE,CHG_USER,CHG_TERM,OVERRIDE_INPUT,MAIL_OPTION) values ('VTSPCANT ','shift Can''t null','Shift Pattern can not insert null.','E','Y',null,null,null,to_date('2006-03-23','RRRR-MM-DD'),'BASE ','01BASE215 ',null,null);
Insert into MESSAGES (MSG_NO,MSG_STR,MSG_DESCR,MSG_TYPE,MSG_OPT,MSG_TIME,ALARM,ERR_SOURCE,CHG_DATE,CHG_USER,CHG_TERM,OVERRIDE_INPUT,MAIL_OPTION) values ('VTWSNOTM ','Invalid Workshift','Work shift code not matching work site of employee.','E','Y',null,null,null,to_date('2006-03-23','RRRR-MM-DD'),'BASE ','01BASE215 ',null,null);
--------------------------------------------------Yashwant 22-08-2019[Start]
--------------------------------------------------Added on Yashwant 22-08-2019[Start]
delete from obj_actions where obj_name = 'shift_pattern' and line_no in (3,8,39,41,42,43);
......@@ -82,4 +82,10 @@ update obj_actions set image = 'ibase/resource/objaction/edit.svg' where obj_nam
update obj_actions set image = 'ibase/resource/objaction/Audit-trail.svg' where obj_name = 'shift_pattern' and line_no = '21';
update obj_actions set image = 'ibase/resource/objaction/exprtExl.svg' where obj_name = 'shift_pattern' and line_no = '22';
--------------------------------------------------Yashwant 22-08-2019[End]
--------------------------------------------------Added on Yashwant 22-08-2019[End]
--------------------------------------------------Added on Yashwant 22-08-2019[Start]
update itm2menu set icon_path = 'shift-pattern.png', CLOSE_ICON = 'shift-patternwht.png' where win_name = 'w_shift_pattern';
--------------------------------------------------Added on Yashwant 22-08-2019[End]
......@@ -4,7 +4,6 @@ import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
// Changed by Dhiraj 07/10/10 [AD01SUN008]
import java.text.SimpleDateFormat;
import java.util.ArrayList;
......@@ -13,10 +12,8 @@ import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import ibase.system.config.ConnDriver;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ITMDBAccessLocal;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.ITMException;
......@@ -25,12 +22,12 @@ import ibase.webitm.utility.ITMException;
public class ShiftPattern extends ValidatorEJB implements ShiftPatternLocal,ShiftPatternRemote //SessionBean
{
String returnValue12 = "";
public String wfValData() throws RemoteException,ITMException
public String wfValData() throws RemoteException,ITMException
{
return "";
}
public String wfValData(String xmlString, String xmlString1,String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
{
Document dom = null;
......@@ -73,21 +70,21 @@ public String wfValData() throws RemoteException,ITMException
}
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
{
boolean checkNextCol = true;
//boolean checkNextCol = true;
//String count = "";
String dayslist2 = "";
ArrayList dayslist = new ArrayList();
String columnName = "";
String columnValue = "";
String columnValue1 = "";
//String columnName = "";
//String columnValue = "";
//String columnValue1 = "";
String userId = "";
String sql = "";
String errString = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
String returnValue = "";
String returnValue2 = "";
java.util.Date returnDate = null;
//String returnValue = "";
//String returnValue2 = "";
//java.util.Date returnDate = null;
//Date columnDate = null;
//SimpleDateFormat columnDate1 = null;
NodeList parentList = null;
......@@ -96,8 +93,9 @@ public String wfValData() throws RemoteException,ITMException
Node childNode = null;
String childNodeName = null;
String shiftPattern = null;
String patternCode= "";
//String dayslist = null;
Statement st = null;
//Statement st = null;
Connection conn = null;
String site_code = "";
int ctr ;
......@@ -105,12 +103,12 @@ public String wfValData() throws RemoteException,ITMException
int count = 0;
int noOfChilds = 0;
int currentFormNo = 0;
//GenericUtility genericUtility = GenericUtility.getInstance();
E12GenericUtility e12GenericUtility = new E12GenericUtility();
//ConnDriver connDriver = new ConnDriver();
ITMDBAccessLocal itmDBAccessLocal = null;
//ConnDriver connDriver = new ConnDriver();
//ITMDBAccessLocal itmDBAccessLocal = null;
//ITMDBAccess itmDBAccess = null;//commented for ejb3
ITMDBAccessEJB itmDBAccess = null; // added for ejb3
itmDBAccess = new ITMDBAccessEJB();
......@@ -120,20 +118,20 @@ public String wfValData() throws RemoteException,ITMException
//conn = connDriver.getConnectDB("DriverITM");
conn=getConnection();
//Modified by Yashwant on 09/07/2019[End]
// Changed by Dhiraj 07/10/10 [AD01SUN008]. start
/*AppConnectParm appConnect = new AppConnectParm();
Properties p = appConnect.getProperty();
InitialContext ctx = new InitialContext(p);
itmDBAccessLocal = (ITMDBAccessLocal)ctx.lookup("ITMDBAccess");
*/
*/
// Changed by Dhiraj 07/10/10 [AD01SUN008]. end
//itmDBAccess = itmDBAccessHome.create();
// Changed by Dhiraj 07/10/10 [AD01SUN008] start
/*connectionObject = itmDBAccessLocal.getConnection(); //added for ejb3
stmt = connectionObject.createStatement();
*/
*/
//stmt = conn.createStatement();
// Changed by Dhiraj 07/10/10 [AD01SUN008] end
userId = e12GenericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode");
......@@ -145,16 +143,26 @@ public String wfValData() throws RemoteException,ITMException
parentNode = parentList.item(0);
childList = parentNode.getChildNodes();
noOfChilds = childList.getLength();
for(ctr = 0; ctr < noOfChilds; ctr++)
{
childNode = childList.item(ctr);
childNodeName = childNode.getNodeName();
//Added by Yashwant on 23/08/19 [Start]
if (childNodeName.equals("pattern_code"))
{
patternCode=checkNull(e12GenericUtility.getColumnValue("pattern_code", dom2));
if(patternCode == null || patternCode.trim().length() == 0)
{
errString=itmDBAccess.getErrorString("shift_pattern", "VTPCCANT", userId,"", conn);
}
}
//Added by Yashwant on 23/08/19 [End]
if (childNodeName.equals("shift_pattern"))
{
shiftPattern=e12GenericUtility.getColumnValue("shift_pattern", dom2);
shiftPattern = checkNull(e12GenericUtility.getColumnValue("shift_pattern", dom2));
//if(childNode.getFirstChild() == null)
if(shiftPattern==null || shiftPattern.trim().length()==0)
if(shiftPattern == null || shiftPattern.trim().length() == 0)
{
//Changed by Dhiraj 07/10/10 [AD01SUN008]
//errString = itmDBAccess.getErrorString("shift_pattern","VTSPCANT",userId,errString,connectionObject);
......@@ -165,7 +173,7 @@ public String wfValData() throws RemoteException,ITMException
{
//shiftPattern = childNode.getFirstChild().getNodeValue();
System.out.println("shiftPattern :---------------------"+shiftPattern);
dayslist = e12GenericUtility.getTokenList(shiftPattern, ";");
System.out.println("--------------------dayslist="+dayslist.size());
for(int ctr1 = 0; ctr1 < dayslist.size(); ctr1++)
......@@ -178,12 +186,12 @@ public String wfValData() throws RemoteException,ITMException
site_code = checkNull(getColumnValue("site_code",dom));
//Modified by Yashwant on 09/07/2019[End]
System.out.println(site_code);
//Modified by Yashwant on 09/07/2019[Start]
/*sql = "select count(*) from workshft "
+"where shift = '"+dayslist2+"' "
+"And site_code = '"+site_code+"' " ;*/
sql="select count(*) from workshft where shift = ? And site_code =? ";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, dayslist2);
......@@ -193,10 +201,10 @@ public String wfValData() throws RemoteException,ITMException
//st = conn.createStatement();
//rs = st.executeQuery(sql);
//Modified by Yashwant on 09/07/2019[End]
if(rs.next())
{
count = rs.getInt(1);
count = rs.getInt(1);
}
//Modified by Yashwant to close the PreparedStatements/resultsets in finally block on 09/07/2019[Start]
if (rs != null)
......@@ -215,7 +223,7 @@ public String wfValData() throws RemoteException,ITMException
{
//Changed by Dhiraj 07/10/10 [AD01SUN008]
//errString = itmDBAccess.getErrorString("shift_pattern","VTWSNOTM",userId,errString,connectionObject);
errString = getErrorString("shift_pattern","VTWSNOTM",userId);
//errString = getErrorString("shift_pattern","VTWSNOTM",userId);
errString=itmDBAccess.getErrorString("shift_pattern", "VTWSNOTM", userId,"", conn);
}
}
......@@ -262,7 +270,7 @@ public String wfValData() throws RemoteException,ITMException
System.out.println("error :"+errString);
return (errString);
}
//item change logic
//item change logic
public String itemChanged() throws RemoteException,ITMException
{
return "";
......@@ -306,42 +314,42 @@ public String wfValData() throws RemoteException,ITMException
}
public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException
{
char days ;
//char days ;
int shift_no = 0;
String dayslist1 = "";
int total_days = 0;
ArrayList dayslist = new ArrayList();
String columnValue = "";
String site_code = "";
String sql = "";
//String sql = "";
Connection conn = null;
PreparedStatement pstmt=null;
ResultSet rs = null;
// Changed by Dhiraj 07/10/10 [AD01SUN008].start
String loginSite = "";
String siteCodeDescr = "";
//String loginSite = "";
//String siteCodeDescr = "";
// Changed by Dhiraj 07/10/10 [AD01SUN008] .end
StringBuffer valueXmlString = new StringBuffer();
ConnDriver connDriver = new ConnDriver();
//ConnDriver connDriver = new ConnDriver();
//GenericUtility genericUtility = GenericUtility.getInstance();
E12GenericUtility e12GenericUtility = new E12GenericUtility();
E12GenericUtility e12GenericUtility = new E12GenericUtility();
try
{
//conn = connDriver.getConnectDB("DriverITM");
conn=getConnection();
columnValue = e12GenericUtility.getColumnValue(currentColumn,dom);
columnValue = checkNull(e12GenericUtility.getColumnValue(currentColumn,dom));
System.out.println("columnValue :"+columnValue);
valueXmlString = new StringBuffer("<?xml version=\"1.0\"?><Root><Header><editFlag>");
valueXmlString.append(editFlag).append("</editFlag></Header>");
valueXmlString.append("<Detail1>");
if (currentColumn.trim().equals("itm_default"))
{
System.out.println("xtraParamsitemchange:---------------"+xtraParams);
site_code = e12GenericUtility.getValueFromXTRA_PARAMS(xtraParams,"site_code");
valueXmlString.append("<site_code>").append(site_code).append("</site_code>\r\n");
//Changed by Dhiraj 07/10/10 [AD01SUN008]. start
//java.sql.Date toDay =new java.sql.Date(System.currentTimeMillis());
java.util.Date toDay = new java.util.Date();
......@@ -349,36 +357,47 @@ public String wfValData() throws RemoteException,ITMException
String dbDtStr = sdf.format(toDay);
// Changed by Dhiraj 07/10/10 [AD01SUN008]. end
//valueXmlString.append("<start_date>").append(toDay).append("</start_date>\r\n");
valueXmlString.append("<start_date>").append(dbDtStr).append("</start_date>\r\n");
valueXmlString.append("<start_date>").append(dbDtStr).append("</start_date>\r\n");
System.out.println("Start_date:-------------------------"+toDay);
}
else if (currentColumn.trim().equals("shift_pattern"))
{
dayslist = e12GenericUtility.getTokenList(columnValue, ";");
System.out.println("--------------------dayslist="+dayslist.size());
for(int ctr = 0; ctr < dayslist.size(); ctr++)
{
String strDaysList =dayslist.get(ctr).toString();
System.out.println("strDaysList:"+strDaysList);
int index = strDaysList.indexOf('-');
System.out.println("index:"+index);
dayslist1 = strDaysList.substring(0,index);
System.out.println("dayslist:-------------------------"+dayslist1);
shift_no = Integer.parseInt(dayslist1.toString());
if(columnValue.trim() != null && columnValue.trim().length() > 0)
{
dayslist = e12GenericUtility.getTokenList(columnValue, ";");
//System.out.println("--------------------dayslist="+dayslist.size());
System.out.println("dayslist = "+dayslist);
for(int ctr = 0; ctr < dayslist.size(); ctr++)
{
String strDaysList =dayslist.get(ctr).toString();
System.out.println("strDaysList:"+strDaysList);
int index = strDaysList.indexOf('-');
System.out.println("index:"+index);
if(index >= 0)
{
dayslist1 = strDaysList.substring(0,index);
System.out.println("dayslist:-------------------------"+dayslist1);
shift_no = Integer.parseInt(dayslist1.toString());
//days = dayslist.get(ctr).toString().charAt(0);
//shift_no = Integer.parseInt((new Character(days)).toString());
//shift_no = Integer.parseInt((new Character(days));
System.out.println("--------------------shift_no="+shift_no);
total_days = total_days + shift_no;
System.out.println("--------------------dayslist="+total_days);
}
//days = dayslist.get(ctr).toString().charAt(0);
//shift_no = Integer.parseInt((new Character(days)).toString());
//shift_no = Integer.parseInt((new Character(days));
System.out.println("--------------------shift_no="+shift_no);
total_days = total_days + shift_no;
System.out.println("--------------------dayslist="+total_days);
}
System.out.println("-----------------------------total_days ="+total_days);
valueXmlString.append("<no_of_days>").append(total_days).append("</no_of_days>\r\n");
}
System.out.println("-----------------------------total_days ="+total_days);
valueXmlString.append("<no_of_days>").append(total_days).append("</no_of_days>\r\n");
//GenericUtility.getInstance();
}
valueXmlString.append("</Detail1>\r\n");
......@@ -401,7 +420,7 @@ public String wfValData() throws RemoteException,ITMException
System.out.println("Closing Connection.......");
conn.close();
conn = null;
*/
*/
if (rs != null)
{
rs.close();
......@@ -418,7 +437,8 @@ public String wfValData() throws RemoteException,ITMException
conn = null;
}
// Modified by Piyush on 08/12/2011 to close the connection/statements/resultsets in finally block .Start
}catch(Exception e)
}
catch(Exception e)
{
//Modified by Yashwant-throw the Excecption on 09/07/2019[Start]
e.printStackTrace();
......@@ -428,7 +448,7 @@ public String wfValData() throws RemoteException,ITMException
System.out.println("Return XML" + valueXmlString.toString() );
return valueXmlString.toString();
}
//Modified by Yashwant-checkNull method added on 09/07/2019[Start]
private String checkNull(String input)
{
......
package ibase.webitm.ejb.adm;
import java.rmi.RemoteException;
import org.w3c.dom.Document;
import ibase.webitm.ejb.ValidatorRemote;
import ibase.webitm.utility.ITMException; public interface ShiftPatternRemote extends ValidatorRemote
{
public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException; public String itemChanged(Document dom, Document dom1,Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String wfValData(String xmlString, String xmlString1,String xmlString2, String objContext, String editFlag,String xtraParams) throws RemoteException,ITMException ;
public String wfValData(Document dom, Document dom1, Document dom2,String objContext, String editFlag, String xtraParams)throws RemoteException, ITMException;
}
package ibase.webitm.ejb.adm;import java.rmi.RemoteException;//import javax.ejb.EJBObject; import org.w3c.dom.*; import ibase.webitm.utility.ITMException; import ibase.webitm.ejb.*; import javax.ejb.Remote; // added for ejb3 @Remote // added for ejb3 public interface ShiftPatternRemote extends ValidatorRemote //,EJBObject { public String itemChanged() throws RemoteException,ITMException; public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException; public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) 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