291 lines
13 KiB
Java
291 lines
13 KiB
Java
package wenrgise.workflow.helper;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.Iterator;
|
|
import wenrgise.common.bean.LOVBean;
|
|
import wenrgise.common.exception.EnrgiseApplicationException;
|
|
import wenrgise.common.exception.EnrgiseSystemException;
|
|
import wenrgise.common.utility.EnrgiseUtil;
|
|
import wenrgise.common.vo.LovQueryVO;
|
|
import wenrgise.common.vo.LovVO;
|
|
import wenrgise.ejb.common.helper.DBObject;
|
|
import wenrgise.ejb.common.helper.QueryRow;
|
|
import wenrgise.ejb.common.utility.DBUtilitiesBean;
|
|
import wenrgise.hrms.service.HrmsService;
|
|
|
|
public class HrmsSimulator implements HrmsService {
|
|
public LovVO getEmpNameLOVData(LovQueryVO oLovQueryVO) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
String sQuery = "Select ID,Emp_No,First_Name || ' ' || Middle_Name || ' ' || Last_Name FULLNAME from hrm_emp_pers";
|
|
if (oLovQueryVO.getSearchField1() != null)
|
|
sQuery = String.valueOf(String.valueOf(String.valueOf(sQuery).concat(String.valueOf(" where Emp_No LIKE '%"))).concat(String.valueOf(oLovQueryVO.getSearchField1()))).concat(String.valueOf("%' "));
|
|
if (oLovQueryVO.getSearchField2() != null)
|
|
sQuery = String.valueOf(String.valueOf(String.valueOf(sQuery).concat(String.valueOf(" And upper(First_Name || ' ' || Middle_Name || ' ' || Last_Name) LIKE upper('%"))).concat(String.valueOf(oLovQueryVO.getSearchField2()))).concat(String.valueOf("%') "));
|
|
System.out.println(sQuery);
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
ArrayList oList = oBean.executeQuery(sQuery);
|
|
LovVO oLovVO = new LovVO();
|
|
ArrayList oHeaderList = new ArrayList();
|
|
oHeaderList.add("pm.pumMaintainPurCommonLOV.id");
|
|
oHeaderList.add("pm.pumMaintainPurCommonLOV.empNo");
|
|
oHeaderList.add("pm.pumMaintainPurCommonLOV.nameEmp");
|
|
oLovVO.setHeaderList(oHeaderList);
|
|
ArrayList arylstVisibility = new ArrayList();
|
|
arylstVisibility.add("H");
|
|
arylstVisibility.add("V");
|
|
arylstVisibility.add("V");
|
|
oLovVO.setVisibilityList(arylstVisibility);
|
|
int count = 0;
|
|
QueryRow oRow = null;
|
|
Iterator oIt = oList.iterator();
|
|
while (oIt.hasNext()) {
|
|
if (count == 0)
|
|
oList = new ArrayList();
|
|
count++;
|
|
oRow = oIt.next();
|
|
LOVBean oLOVBean = new LOVBean();
|
|
oLOVBean.setDetailField1(oRow.get("ID").getString());
|
|
oLOVBean.setDetailField2(oRow.get("Emp_No").getString());
|
|
oLOVBean.setDetailField3(oRow.get("FULLNAME").getString());
|
|
oList.add(oLOVBean);
|
|
}
|
|
oLovVO.setDetailList(oList);
|
|
return oLovVO;
|
|
}
|
|
|
|
public LovVO getRepEmpNameLOVData(LovQueryVO oLovQueryVO) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
String sEmpNo = oLovQueryVO.getProperty("EmpNo");
|
|
System.out.println(sEmpNo);
|
|
String sQuery = "Select ID,Emp_No,First_Name || ' ' || Middle_Name || ' ' || Last_Name FULLNAME from hrm_emp_pers where Emp_No <> '";
|
|
sQuery = String.valueOf(sQuery).concat(String.valueOf(sEmpNo.trim()));
|
|
sQuery = String.valueOf(sQuery).concat(String.valueOf("'"));
|
|
if (oLovQueryVO.getSearchField1() != null)
|
|
sQuery = String.valueOf(String.valueOf(String.valueOf(sQuery).concat(String.valueOf(" and Emp_No LIKE '%"))).concat(String.valueOf(oLovQueryVO.getSearchField1()))).concat(String.valueOf("%' "));
|
|
if (oLovQueryVO.getSearchField2() != null)
|
|
sQuery = String.valueOf(String.valueOf(String.valueOf(sQuery).concat(String.valueOf(" And upper(First_Name || ' ' || Middle_Name || ' ' || Last_Name) LIKE upper('%"))).concat(String.valueOf(oLovQueryVO.getSearchField2()))).concat(String.valueOf("%') "));
|
|
System.out.println(sQuery);
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
ArrayList oList = oBean.executeQuery(sQuery);
|
|
LovVO oLovVO = new LovVO();
|
|
ArrayList oHeaderList = new ArrayList();
|
|
oHeaderList.add("pm.pumMaintainPurCommonLOV.id");
|
|
oHeaderList.add("pm.pumMaintainPurCommonLOV.nameEmp");
|
|
oHeaderList.add("pm.pumMaintainPurCommonLOV.empNo");
|
|
oLovVO.setHeaderList(oHeaderList);
|
|
ArrayList arylstVisibility = new ArrayList();
|
|
arylstVisibility.add("H");
|
|
arylstVisibility.add("V");
|
|
arylstVisibility.add("V");
|
|
oLovVO.setVisibilityList(arylstVisibility);
|
|
int count = 0;
|
|
QueryRow oRow = null;
|
|
Iterator oIt = oList.iterator();
|
|
while (oIt.hasNext()) {
|
|
if (count == 0)
|
|
oList = new ArrayList();
|
|
count++;
|
|
oRow = oIt.next();
|
|
LOVBean oLOVBean = new LOVBean();
|
|
oLOVBean.setDetailField1(oRow.get("ID").getString());
|
|
oLOVBean.setDetailField2(oRow.get("FULLNAME").getString());
|
|
oLOVBean.setDetailField3(oRow.get("Emp_No").getString());
|
|
oList.add(oLOVBean);
|
|
}
|
|
oLovVO.setDetailList(oList);
|
|
return oLovVO;
|
|
}
|
|
|
|
public LovVO getLocLOVData(LovQueryVO oLovQueryVO) throws EnrgiseSystemException {
|
|
ArrayList oParameters = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
oParameters = new ArrayList();
|
|
oParameters.add(new DBObject(1, 1, 12, "200"));
|
|
oParameters.add(new DBObject(2, 1, 12, "pc"));
|
|
oParameters.add(new DBObject(3, 2, -10));
|
|
oParameters.add(new DBObject(4, 2, 12));
|
|
oParameters.add(new DBObject(5, 2, 12));
|
|
oParameters.add(new DBObject(6, 2, 4));
|
|
ArrayList oOutArray = oBean.callProc(oParameters, "Site_Info.proc_GetChildSiteid(?,?,?,?,?,?)");
|
|
DBObject oOutObject = oOutArray.get(0);
|
|
int count = 0;
|
|
ArrayList oList = (ArrayList)oOutObject.getObject();
|
|
Iterator oIt = oList.iterator();
|
|
QueryRow oRow1 = null;
|
|
String str = "(";
|
|
boolean flag = false;
|
|
while (oIt.hasNext()) {
|
|
oRow1 = oIt.next();
|
|
if (flag == true) {
|
|
str = String.valueOf(str).concat(String.valueOf(","));
|
|
count++;
|
|
}
|
|
str = String.valueOf(str).concat(String.valueOf(oRow1.get("ID").getString()));
|
|
flag = true;
|
|
}
|
|
str = String.valueOf(str).concat(String.valueOf(")"));
|
|
System.out.println(str);
|
|
String sQuery = String.valueOf(String.valueOf("Select distinct gvm.ven_location_code,gcm.city_id from GEN_VENDOR_MST gvm,gen_city_mst gcm where gvm.ven_city_id(+)=gcm.city_id and gvm.site_id in ").concat(String.valueOf(str))).concat(String.valueOf(" "));
|
|
if (oLovQueryVO.getSearchField1() != null)
|
|
sQuery = String.valueOf(String.valueOf(String.valueOf(sQuery).concat(String.valueOf(" and upper(gvm.VEN_LOCATION_CODE) LIKE upper('%"))).concat(String.valueOf(oLovQueryVO.getSearchField1()))).concat(String.valueOf("%') "));
|
|
System.out.println(sQuery);
|
|
DBUtilitiesBean oBean1 = new DBUtilitiesBean();
|
|
ArrayList oList1 = oBean1.executeQuery(sQuery);
|
|
LovVO oLovVO = new LovVO();
|
|
ArrayList oHeaderList = new ArrayList();
|
|
oHeaderList.add("pm.pumMaintainPurCommonLOV.id");
|
|
oHeaderList.add("pm.pumMaintainPurCommonLOV.venLocCode");
|
|
oLovVO.setHeaderList(oHeaderList);
|
|
ArrayList arylstVisibility = new ArrayList();
|
|
arylstVisibility.add("H");
|
|
arylstVisibility.add("V");
|
|
oLovVO.setVisibilityList(arylstVisibility);
|
|
count = 0;
|
|
QueryRow oRow = null;
|
|
Iterator oIt1 = oList1.iterator();
|
|
while (oIt1.hasNext()) {
|
|
if (count == 0)
|
|
oList1 = new ArrayList();
|
|
count++;
|
|
oRow = oIt1.next();
|
|
LOVBean oLOVBean = new LOVBean();
|
|
oLOVBean.setDetailField1(oRow.get("city_id").getString());
|
|
oLOVBean.setDetailField2(oRow.get("VEN_LOCATION_CODE").getString());
|
|
oList1.add(oLOVBean);
|
|
}
|
|
oLovVO.setDetailList(oList1);
|
|
return oLovVO;
|
|
}
|
|
|
|
public LovVO getCountryLOVData(LovQueryVO oLovQueryVO) throws EnrgiseSystemException {
|
|
ArrayList oParameters = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
oParameters = new ArrayList();
|
|
oParameters.add(new DBObject(1, 1, 12, "200"));
|
|
oParameters.add(new DBObject(2, 1, 12, "pc"));
|
|
oParameters.add(new DBObject(3, 2, -10));
|
|
oParameters.add(new DBObject(4, 2, 12));
|
|
oParameters.add(new DBObject(5, 2, 12));
|
|
oParameters.add(new DBObject(6, 2, 4));
|
|
ArrayList oOutArray = oBean.callProc(oParameters, "Site_Info.proc_GetChildSiteid(?,?,?,?,?,?)");
|
|
DBObject oOutObject = oOutArray.get(0);
|
|
int count = 0;
|
|
ArrayList oList = (ArrayList)oOutObject.getObject();
|
|
Iterator oIt = oList.iterator();
|
|
QueryRow oRow1 = null;
|
|
String str = "(";
|
|
boolean flag = false;
|
|
while (oIt.hasNext()) {
|
|
oRow1 = oIt.next();
|
|
if (flag == true) {
|
|
str = String.valueOf(str).concat(String.valueOf(","));
|
|
count++;
|
|
}
|
|
str = String.valueOf(str).concat(String.valueOf(oRow1.get("ID").getString()));
|
|
flag = true;
|
|
}
|
|
str = String.valueOf(str).concat(String.valueOf(")"));
|
|
System.out.println(str);
|
|
String sQuery = "Select gcm.country_id, gcm.country_code, gcm.name from GEN_COUNTRY_MST gcm ";
|
|
if (oLovQueryVO.getSearchField1() != null)
|
|
sQuery = String.valueOf(String.valueOf(String.valueOf(sQuery).concat(String.valueOf(" where upper(gcm.name) LIKE upper('%"))).concat(String.valueOf(oLovQueryVO.getSearchField1()))).concat(String.valueOf("%') "));
|
|
System.out.println(sQuery);
|
|
DBUtilitiesBean oBean1 = new DBUtilitiesBean();
|
|
ArrayList oList1 = oBean1.executeQuery(sQuery);
|
|
LovVO oLovVO = new LovVO();
|
|
ArrayList oHeaderList = new ArrayList();
|
|
oHeaderList.add("pm.pumMaintainPurCommonLOV.id");
|
|
oHeaderList.add("pm.pumMaintainPurCommonLOV.name");
|
|
oLovVO.setHeaderList(oHeaderList);
|
|
ArrayList arylstVisibility = new ArrayList();
|
|
arylstVisibility.add("H");
|
|
arylstVisibility.add("V");
|
|
oLovVO.setVisibilityList(arylstVisibility);
|
|
count = 0;
|
|
QueryRow oRow = null;
|
|
Iterator oIt1 = oList1.iterator();
|
|
while (oIt1.hasNext()) {
|
|
if (count == 0)
|
|
oList1 = new ArrayList();
|
|
count++;
|
|
oRow = oIt1.next();
|
|
LOVBean oLOVBean = new LOVBean();
|
|
oLOVBean.setDetailField1(oRow.get("country_id").getString());
|
|
oLOVBean.setDetailField2(oRow.get("name").getString());
|
|
oList1.add(oLOVBean);
|
|
}
|
|
oLovVO.setDetailList(oList1);
|
|
return oLovVO;
|
|
}
|
|
|
|
public LovVO getWrkGroupLOVData(LovQueryVO oLovQueryVO) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
String sQuery = " SELECT CODE,NAME,ID FROM GEN_WRKGRP_MST where 1=1";
|
|
if (EnrgiseUtil.checkString(oLovQueryVO.getSearchField1()))
|
|
sQuery = String.valueOf(String.valueOf(String.valueOf(sQuery).concat(String.valueOf(" and upper(code) LIKE upper('%"))).concat(String.valueOf(oLovQueryVO.getSearchField1()))).concat(String.valueOf("%') "));
|
|
if (EnrgiseUtil.checkString(oLovQueryVO.getSearchField2()))
|
|
sQuery = String.valueOf(String.valueOf(String.valueOf(sQuery).concat(String.valueOf(" and upper(NAME) LIKE upper('%"))).concat(String.valueOf(oLovQueryVO.getSearchField2()))).concat(String.valueOf("%') "));
|
|
sQuery = String.valueOf(sQuery).concat(String.valueOf(" ORDER BY name"));
|
|
System.out.println(sQuery);
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
ArrayList oList = oBean.executeQuery(sQuery);
|
|
LovVO oLovVO = new LovVO();
|
|
ArrayList oHeaderList = new ArrayList();
|
|
oHeaderList.add("pm.pumMaintainPurCommonLOV.id");
|
|
oHeaderList.add("pm.pumMaintainPurCommonLOV.name");
|
|
oHeaderList.add("pm.pumMaintainPurCommonLOV.code");
|
|
oLovVO.setHeaderList(oHeaderList);
|
|
ArrayList arylstVisibility = new ArrayList();
|
|
arylstVisibility.add("H");
|
|
arylstVisibility.add("V");
|
|
arylstVisibility.add("V");
|
|
oLovVO.setVisibilityList(arylstVisibility);
|
|
int count = 0;
|
|
QueryRow oRow = null;
|
|
Iterator oIt = oList.iterator();
|
|
while (oIt.hasNext()) {
|
|
if (count == 0)
|
|
oList = new ArrayList();
|
|
count++;
|
|
oRow = oIt.next();
|
|
LOVBean oLOVBean = new LOVBean();
|
|
oLOVBean.setDetailField1(oRow.get("Id").getString());
|
|
oLOVBean.setDetailField2(oRow.get("name").getString());
|
|
oLOVBean.setDetailField3(oRow.get("code").getString());
|
|
oList.add(oLOVBean);
|
|
}
|
|
oLovVO.setDetailList(oList);
|
|
return oLovVO;
|
|
}
|
|
|
|
public LovVO getClassCodeLOVData(LovQueryVO oLovQueryVO) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
String sQuery = "select hcm.id,hcm.name from hrm_class_mst hcm";
|
|
if (oLovQueryVO.getSearchField1() != null)
|
|
sQuery = String.valueOf(String.valueOf(String.valueOf(sQuery).concat(String.valueOf(" where name LIKE '%"))).concat(String.valueOf(oLovQueryVO.getSearchField1()))).concat(String.valueOf("%' "));
|
|
System.out.println(sQuery);
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
ArrayList oList = oBean.executeQuery(sQuery);
|
|
LovVO oLovVO = new LovVO();
|
|
ArrayList oHeaderList = new ArrayList();
|
|
oHeaderList.add("");
|
|
oHeaderList.add("pm.pumMaintainPurCommonLOV.classCode");
|
|
oLovVO.setHeaderList(oHeaderList);
|
|
ArrayList arylstVisibility = new ArrayList();
|
|
arylstVisibility.add("H");
|
|
arylstVisibility.add("V");
|
|
oLovVO.setVisibilityList(arylstVisibility);
|
|
int count = 0;
|
|
QueryRow oRow = null;
|
|
Iterator oIt = oList.iterator();
|
|
while (oIt.hasNext()) {
|
|
if (count == 0)
|
|
oList = new ArrayList();
|
|
count++;
|
|
oRow = oIt.next();
|
|
LOVBean oLOVBean = new LOVBean();
|
|
oLOVBean.setDetailField1(oRow.get("ID").getString());
|
|
oLOVBean.setDetailField2(oRow.get("name").getString());
|
|
oList.add(oLOVBean);
|
|
}
|
|
oLovVO.setDetailList(oList);
|
|
return oLovVO;
|
|
}
|
|
}
|