421 lines
20 KiB
Java
421 lines
20 KiB
Java
package wenrgise.hrms.ejb.business;
|
|
|
|
import java.sql.Timestamp;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.ArrayList;
|
|
import java.util.Date;
|
|
import java.util.HashMap;
|
|
import java.util.Iterator;
|
|
import java.util.StringTokenizer;
|
|
import wenrgise.common.bean.BaseHeaderBean;
|
|
import wenrgise.common.bean.LOVBean;
|
|
import wenrgise.common.ejb.business.HrmCommonBO;
|
|
import wenrgise.common.exception.EnrgiseApplicationException;
|
|
import wenrgise.common.exception.EnrgiseMessageKeyException;
|
|
import wenrgise.common.exception.EnrgiseSystemException;
|
|
import wenrgise.common.utility.DateUtility;
|
|
import wenrgise.common.utility.EnrgiseUtil;
|
|
import wenrgise.common.utility.MessageKey;
|
|
import wenrgise.common.utility.UserInfo;
|
|
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.helper.QueryValue;
|
|
import wenrgise.ejb.common.utility.DBUtilitiesBean;
|
|
import wenrgise.hrms.bean.HrmAttShiftRosterGenHdrBean;
|
|
|
|
public class HrmAttShiftRosterGenBO extends HrmBaseBO {
|
|
public HrmAttShiftRosterGenBO() {}
|
|
|
|
public HrmAttShiftRosterGenBO(UserInfo oUserInfo) {
|
|
super(oUserInfo);
|
|
}
|
|
|
|
public void generateRoster(ArrayList arylstWrkgrp, String sSiteId, String sFromDate, String sToDate, UserInfo oUsr) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
HrmCommonBO oBO = new HrmCommonBO();
|
|
DateUtility oDateUtil = new DateUtility();
|
|
DBUtilitiesBean oBean = null;
|
|
String sHdrPK = null;
|
|
String sNextDt = sFromDate;
|
|
boolean bOffHolFlag = false;
|
|
int iDateDiff = oDateUtil.dateDiff(oBO.getddmmyyyyDateFormat(sFromDate), oBO.getddmmyyyyDateFormat(sToDate));
|
|
if (sFromDate.equals(sToDate))
|
|
iDateDiff = 0;
|
|
if (EnrgiseUtil.compareDates(new SimpleDateFormat("dd-MMM-yyyy"), sToDate, sFromDate) < 0) {
|
|
ArrayList arylstParams = new ArrayList();
|
|
ArrayList arylstErrorList = new ArrayList();
|
|
arylstParams.add(new MessageKey("hrm.HrmAttShiftRosterGen.fromDate"));
|
|
arylstParams.add(new MessageKey("hrm.HrmAttShiftRosterGen.toDate"));
|
|
arylstErrorList.add(new EnrgiseMessageKeyException("hrm.HrmAttAbsentListGen.error.invalidDate", arylstParams, "E"));
|
|
reportError(arylstErrorList);
|
|
}
|
|
Iterator itrWrkgrp = arylstWrkgrp.iterator();
|
|
while (itrWrkgrp.hasNext()) {
|
|
String sWrkgrpId = itrWrkgrp.next();
|
|
while (iDateDiff-- >= 0) {
|
|
bOffHolFlag = false;
|
|
if (isCalendarHoliday(sSiteId, sNextDt)) {
|
|
sHdrPK = insertHeader(sSiteId, sWrkgrpId, sNextDt, "H", oUsr.getUserId(), oUsr.getSiteId());
|
|
continue;
|
|
}
|
|
int iWrkFlag = isWorkgroupHoliday(sWrkgrpId, sSiteId, sNextDt);
|
|
if (iWrkFlag != 3) {
|
|
sHdrPK = insertHeader(sSiteId, sWrkgrpId, sNextDt, "W", oUsr.getUserId(), oUsr.getSiteId());
|
|
} else {
|
|
bOffHolFlag = true;
|
|
sHdrPK = insertHeader(sSiteId, sWrkgrpId, sNextDt, "H", oUsr.getUserId(), oUsr.getSiteId());
|
|
}
|
|
oBean = new DBUtilitiesBean();
|
|
oBean.createBatch("HRMATTSHIFTROSTERGEN.proc_InsertDetail(?,?,?,?,?,?,?)");
|
|
ArrayList arylstEmp = getEmpList(sSiteId, sWrkgrpId, sNextDt);
|
|
Iterator itrEmp = arylstEmp.iterator();
|
|
while (itrEmp.hasNext()) {
|
|
String sEmpId = itrEmp.next();
|
|
String sShiftMstId = getEmpShift(sSiteId, sWrkgrpId, sEmpId, sNextDt);
|
|
if (sShiftMstId.equals("0"));
|
|
int iEmpLv = isEmpLeaveDay(sEmpId, sNextDt);
|
|
if (iEmpLv != 3) {
|
|
if (isEmpDayOffPresent(sEmpId, sNextDt)) {
|
|
int iEmpHol = isEmployeeHoliday(sEmpId, sNextDt);
|
|
if (iEmpHol != 3)
|
|
appendToBatch(oBean, sHdrPK, sEmpId, Integer.toString(iEmpHol), sShiftMstId, "", oUsr.getUserId(), oUsr.getSiteId());
|
|
continue;
|
|
}
|
|
if (!bOffHolFlag)
|
|
appendToBatch(oBean, sHdrPK, sEmpId, Integer.toString(iWrkFlag), sShiftMstId, "", oUsr.getUserId(), oUsr.getSiteId());
|
|
}
|
|
}
|
|
oBean.executeBatch();
|
|
Date dDate = oBO.getNextDay(sNextDt, 1);
|
|
sNextDt = EnrgiseUtil.convertToString(dDate);
|
|
}
|
|
}
|
|
}
|
|
|
|
private int isHoliday(String sEmpId, String sWrkgrpId, String sSiteId, String sDate) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
if (isCalendarHoliday(sSiteId, sDate))
|
|
return 3;
|
|
int iEmpHolType = isEmployeeHoliday(sEmpId, sDate);
|
|
if (iEmpHolType == 0)
|
|
return isWorkgroupHoliday(sWrkgrpId, sSiteId, sDate);
|
|
return iEmpHolType;
|
|
}
|
|
|
|
private boolean isCalendarHoliday(String sSiteId, String sDate) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
ArrayList arylstParam = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 1, 12, sSiteId));
|
|
arylstParam.add(new DBObject(2, 1, 93, EnrgiseUtil.convertToSqlDate(sDate)));
|
|
arylstParam.add(new DBObject(3, 2, 4));
|
|
arylstParam.add(new DBObject(4, 2, 12));
|
|
arylstParam.add(new DBObject(5, 2, 12));
|
|
arylstParam.add(new DBObject(6, 2, 4));
|
|
ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMATTSHIFTROSTERGEN.proc_GetCalHol(?,?,?,?,?,?)");
|
|
DBObject oOutObject = arylstOutArray.get(0);
|
|
int iCount = ((Integer)oOutObject.getObject()).intValue();
|
|
boolean sReturnValue = !(iCount == 0);
|
|
return sReturnValue;
|
|
}
|
|
|
|
private int isEmployeeHoliday(String sEmpId, String sDate) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
ArrayList arylstParam = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 1, 12, sEmpId));
|
|
arylstParam.add(new DBObject(2, 1, 93, EnrgiseUtil.convertToSqlDate(sDate)));
|
|
arylstParam.add(new DBObject(3, 2, -10));
|
|
arylstParam.add(new DBObject(4, 2, 12));
|
|
arylstParam.add(new DBObject(5, 2, 12));
|
|
arylstParam.add(new DBObject(6, 2, 4));
|
|
ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMATTSHIFTROSTERGEN.proc_GetEmpHol(?,?,?,?,?,?)");
|
|
DBObject oOutObject = arylstOutArray.get(0);
|
|
ArrayList arylstList = (ArrayList)oOutObject.getObject();
|
|
if (arylstList == null);
|
|
QueryRow oRow = null;
|
|
QueryValue oValue = null;
|
|
HashMap oColumns = null;
|
|
Iterator itrBean = arylstList.iterator();
|
|
HrmCommonBO oComBO = new HrmCommonBO();
|
|
int iDayOfWeek = oComBO.getDayOfWeek(sDate);
|
|
int iWeekOfMonth = oComBO.getWeekOfMonth(sDate);
|
|
System.out.println(iDayOfWeek);
|
|
while (itrBean.hasNext()) {
|
|
oRow = itrBean.next();
|
|
System.out.println(oRow.get("rest_day1").getString());
|
|
if (iDayOfWeek == Integer.parseInt(oRow.get("rest_day1").getString()))
|
|
return 3;
|
|
if (iDayOfWeek == Integer.parseInt(oRow.get("rest_day2").getString()))
|
|
return 3;
|
|
if (iDayOfWeek == Integer.parseInt(oRow.get("half_day1").getString()))
|
|
return 1;
|
|
if (iDayOfWeek == Integer.parseInt(oRow.get("half_day2").getString()))
|
|
return 1;
|
|
if (iDayOfWeek == Integer.parseInt(oRow.get("rest_week_day1").getString()) && iWeekOfMonth == Integer.parseInt(oRow.get("rest_week1").getString()))
|
|
return 3;
|
|
if (iDayOfWeek == Integer.parseInt(oRow.get("rest_week_day2").getString()) && iWeekOfMonth == Integer.parseInt(oRow.get("rest_week2").getString()))
|
|
return 3;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
private int isWorkgroupHoliday(String sWrkgrpId, String sSiteId, String sDate) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
ArrayList arylstParam = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 1, 12, sWrkgrpId));
|
|
arylstParam.add(new DBObject(2, 1, 12, sSiteId));
|
|
arylstParam.add(new DBObject(3, 1, 93, EnrgiseUtil.convertToSqlDate(sDate)));
|
|
arylstParam.add(new DBObject(4, 2, -10));
|
|
arylstParam.add(new DBObject(5, 2, 12));
|
|
arylstParam.add(new DBObject(6, 2, 12));
|
|
arylstParam.add(new DBObject(7, 2, 4));
|
|
ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMATTSHIFTROSTERGEN.proc_GetWrkgrpHol(?,?,?,?,?,?,?)");
|
|
DBObject oOutObject = arylstOutArray.get(0);
|
|
ArrayList arylstList = (ArrayList)oOutObject.getObject();
|
|
if (arylstList == null);
|
|
QueryRow oRow = null;
|
|
QueryValue oValue = null;
|
|
HashMap oColumns = null;
|
|
Iterator itrBean = arylstList.iterator();
|
|
HrmCommonBO oComBO = new HrmCommonBO();
|
|
int iDayOfWeek = oComBO.getDayOfWeek(sDate);
|
|
int iWeekOfMonth = oComBO.getWeekOfMonth(sDate);
|
|
while (itrBean.hasNext()) {
|
|
oRow = itrBean.next();
|
|
if (iDayOfWeek == Integer.parseInt(oRow.get("rest_day1").getString()))
|
|
return 3;
|
|
if (iDayOfWeek == Integer.parseInt(oRow.get("rest_day2").getString()))
|
|
return 3;
|
|
if (iDayOfWeek == Integer.parseInt(oRow.get("half_day1").getString()))
|
|
return 1;
|
|
if (iDayOfWeek == Integer.parseInt(oRow.get("half_day2").getString()))
|
|
return 1;
|
|
if (iDayOfWeek == Integer.parseInt(oRow.get("rest_week_day1").getString()) && iWeekOfMonth == Integer.parseInt(oRow.get("rest_week1").getString()))
|
|
return 3;
|
|
if (iDayOfWeek == Integer.parseInt(oRow.get("rest_week_day2").getString()) && iWeekOfMonth == Integer.parseInt(oRow.get("rest_week2").getString()))
|
|
return 3;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
private int isEmpLeaveDay(String sEmpId, String sDate) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
ArrayList arylstParam = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 1, 12, sEmpId));
|
|
arylstParam.add(new DBObject(2, 1, 93, EnrgiseUtil.convertToSqlDate(sDate)));
|
|
arylstParam.add(new DBObject(3, 2, 4));
|
|
arylstParam.add(new DBObject(4, 2, 12));
|
|
arylstParam.add(new DBObject(5, 2, 12));
|
|
arylstParam.add(new DBObject(6, 2, 4));
|
|
ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMATTSHIFTROSTERGEN.proc_GetEmpLeave(?,?,?,?,?,?)");
|
|
DBObject oOutObject = arylstOutArray.get(0);
|
|
int iVal = ((Integer)oOutObject.getObject()).intValue();
|
|
return iVal;
|
|
}
|
|
|
|
private ArrayList getEmpList(String sSiteId, String sWrkgrpId, String sDate) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
ArrayList arylstParam = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 1, 12, sSiteId));
|
|
arylstParam.add(new DBObject(2, 1, 12, sWrkgrpId));
|
|
arylstParam.add(new DBObject(3, 1, 93, EnrgiseUtil.convertToSqlDate(sDate)));
|
|
arylstParam.add(new DBObject(4, 2, -10));
|
|
arylstParam.add(new DBObject(5, 2, 12));
|
|
arylstParam.add(new DBObject(6, 2, 12));
|
|
arylstParam.add(new DBObject(7, 2, 4));
|
|
ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMATTSHIFTROSTERGEN.proc_GetWrkgrpEmps(?,?,?,?,?,?,?)");
|
|
DBObject oOutObject = arylstOutArray.get(0);
|
|
ArrayList arylstList = (ArrayList)oOutObject.getObject();
|
|
if (arylstList == null);
|
|
QueryRow oRow = null;
|
|
QueryValue oValue = null;
|
|
HashMap oColumns = null;
|
|
Iterator itrBean = arylstList.iterator();
|
|
ArrayList arylstEmp = new ArrayList();
|
|
while (itrBean.hasNext()) {
|
|
oRow = itrBean.next();
|
|
arylstEmp.add(oRow.get("e_per_dtl_id").getString());
|
|
}
|
|
return arylstEmp;
|
|
}
|
|
|
|
private void appendToBatch(DBUtilitiesBean oBean, String sHdrPK, String sEmpId, String iWrk, String sShiftMstId, String sSpecialInst, String sUserId, String sUserSiteId) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList arylstParam = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 1, 12, sHdrPK));
|
|
arylstParam.add(new DBObject(2, 1, 12, sEmpId));
|
|
arylstParam.add(new DBObject(3, 1, 12, iWrk));
|
|
arylstParam.add(new DBObject(4, 1, 12, sShiftMstId));
|
|
arylstParam.add(new DBObject(5, 1, 12, sSpecialInst));
|
|
arylstParam.add(new DBObject(6, 1, 12, sUserId));
|
|
arylstParam.add(new DBObject(7, 1, 12, sUserSiteId));
|
|
oBean.addToBatch(arylstParam);
|
|
}
|
|
|
|
private String insertHeader(String sSiteId, String sWrkgrpId, String sDate, String sHolFlag, String sUserId, String sUserSiteId) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
ArrayList arylstParam = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 1, 12, sSiteId));
|
|
arylstParam.add(new DBObject(2, 1, 12, sWrkgrpId));
|
|
arylstParam.add(new DBObject(3, 1, 93, EnrgiseUtil.convertToSqlDate(sDate)));
|
|
arylstParam.add(new DBObject(4, 1, 12, sHolFlag));
|
|
arylstParam.add(new DBObject(5, 1, 12, sUserId));
|
|
arylstParam.add(new DBObject(6, 1, 12, sUserSiteId));
|
|
arylstParam.add(new DBObject(7, 2, 12));
|
|
arylstParam.add(new DBObject(8, 2, 12));
|
|
arylstParam.add(new DBObject(9, 2, 12));
|
|
arylstParam.add(new DBObject(10, 2, 4));
|
|
ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMATTSHIFTROSTERGEN.proc_InsertHeader(?,?,?,?,?,?,?,?,?,?)");
|
|
DBObject oOutObject = arylstOutArray.get(0);
|
|
String sPK = ((String)oOutObject.getObject()).toString();
|
|
return sPK;
|
|
}
|
|
|
|
private String getEmpShift(String sSiteId, String sWrkgrpId, String sEmpId, String sDate) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
ArrayList arylstParam = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 1, 12, sSiteId));
|
|
arylstParam.add(new DBObject(2, 1, 12, sWrkgrpId));
|
|
arylstParam.add(new DBObject(3, 1, 12, sEmpId));
|
|
arylstParam.add(new DBObject(4, 1, 93, EnrgiseUtil.convertToSqlDate(sDate)));
|
|
arylstParam.add(new DBObject(5, 2, 12));
|
|
arylstParam.add(new DBObject(6, 2, 12));
|
|
arylstParam.add(new DBObject(7, 2, 12));
|
|
arylstParam.add(new DBObject(8, 2, 4));
|
|
ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMATTSHIFTROSTERGEN.proc_GetEmpShift(?,?,?,?,?,?,?,?)");
|
|
DBObject oOutObject = arylstOutArray.get(0);
|
|
String sEmpShift = ((String)oOutObject.getObject()).toString();
|
|
return sEmpShift;
|
|
}
|
|
|
|
private boolean isEmpDayOffPresent(String sEmpId, String sDate) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
ArrayList arylstParam = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 1, 12, sEmpId));
|
|
arylstParam.add(new DBObject(2, 1, 93, EnrgiseUtil.convertToSqlDate(sDate)));
|
|
arylstParam.add(new DBObject(3, 2, 4));
|
|
arylstParam.add(new DBObject(4, 2, 12));
|
|
arylstParam.add(new DBObject(5, 2, 12));
|
|
arylstParam.add(new DBObject(6, 2, 4));
|
|
ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMATTSHIFTROSTERGEN.proc_GetEmpDayOffPresent(?,?,?,?,?,?)");
|
|
DBObject oOutObject = arylstOutArray.get(0);
|
|
int iCount = ((Integer)oOutObject.getObject()).intValue();
|
|
boolean bCount = !(iCount == 0);
|
|
return bCount;
|
|
}
|
|
|
|
public void initializeBOImpl() {
|
|
this.headerTable = "HRM_EMP_DAY_OFFS";
|
|
}
|
|
|
|
public void saveDetailImpl(String sHeaderPrimaryKey, String sScreenName, ArrayList oDetailBeanArray) throws EnrgiseSystemException {}
|
|
|
|
public void updateHeaderImpl(BaseHeaderBean oBaseHeaderBean) throws EnrgiseSystemException {}
|
|
|
|
public String saveNewHeaderImpl(BaseHeaderBean oBaseHeaderBean) throws EnrgiseSystemException {
|
|
return null;
|
|
}
|
|
|
|
public void additionalFieldValidationImpl(BaseHeaderBean param1, Timestamp param2, String param3, String param4, boolean param5, ArrayList param6, boolean param7, Timestamp param8) {}
|
|
|
|
public String saveHeaderImpl(BaseHeaderBean oBaseHeaderBean, String sScreenMode) throws EnrgiseSystemException {
|
|
HrmAttShiftRosterGenHdrBean oHrmAttShiftRosterGenHdrBean = (HrmAttShiftRosterGenHdrBean)oBaseHeaderBean;
|
|
String generate = saveRosterGeneartor((BaseHeaderBean)oHrmAttShiftRosterGenHdrBean);
|
|
return generate;
|
|
}
|
|
|
|
public void additionalTimestampValidationImpl(BaseHeaderBean param1, Timestamp param2, String param3, String param4, boolean param5, ArrayList param6, boolean param7, Timestamp param8) {}
|
|
|
|
public void additionalBusinessValidationImpl(BaseHeaderBean param1, Timestamp param2, String param3, String param4, boolean param5, ArrayList param6, boolean param7, Timestamp param8) {}
|
|
|
|
private ArrayList getSiteWrkgrps(String sSiteId) throws EnrgiseSystemException {
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
ArrayList arylstParam = new ArrayList();
|
|
ArrayList oList = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 1, 12, sSiteId));
|
|
arylstParam.add(new DBObject(2, 2, -10));
|
|
arylstParam.add(new DBObject(3, 2, 12));
|
|
arylstParam.add(new DBObject(4, 2, 12));
|
|
arylstParam.add(new DBObject(5, 2, 4));
|
|
ArrayList oOutArray = oBean.callProc(arylstParam, "HRMATTSHIFTROSTERGEN.proc_GetSiteWrkgrps(?,?,?,?,?)");
|
|
DBObject oOutObject = oOutArray.get(0);
|
|
ArrayList arylstList = (ArrayList)oOutObject.getObject();
|
|
if (arylstList == null);
|
|
QueryRow oRow = null;
|
|
QueryValue oValue = null;
|
|
HashMap oColumns = null;
|
|
Iterator itrBean = arylstList.iterator();
|
|
ArrayList arylstEmp = new ArrayList();
|
|
while (itrBean.hasNext()) {
|
|
oRow = itrBean.next();
|
|
arylstEmp.add(oRow.get("WRKGRP_ID").getString());
|
|
}
|
|
return arylstEmp;
|
|
}
|
|
|
|
public String saveRosterGeneartor(BaseHeaderBean oBaseHeaderBean) throws EnrgiseSystemException {
|
|
String returnString = null;
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
ArrayList oParameters = new ArrayList();
|
|
HrmAttShiftRosterGenHdrBean oHrmAttShiftRosterGenHdrBean = (HrmAttShiftRosterGenHdrBean)oBaseHeaderBean;
|
|
ArrayList arylstWrkgrp = new ArrayList();
|
|
StringTokenizer stWrkgrp = new StringTokenizer(oHrmAttShiftRosterGenHdrBean.getWorkGroupId(), ",");
|
|
while (stWrkgrp.hasMoreTokens()) {
|
|
String sWrkgrpId = stWrkgrp.nextToken();
|
|
arylstWrkgrp.add(sWrkgrpId);
|
|
}
|
|
try {
|
|
generateRoster(arylstWrkgrp, oHrmAttShiftRosterGenHdrBean.getSiteId(), oHrmAttShiftRosterGenHdrBean.getFromDate(), oHrmAttShiftRosterGenHdrBean.getToDate(), this.oUserInfo);
|
|
} catch (EnrgiseApplicationException oApp) {
|
|
throw new EnrgiseSystemException(oApp);
|
|
}
|
|
return returnString;
|
|
}
|
|
|
|
public LovVO getShiftRosterGenWorkGrpLOVData(LovQueryVO oLovQueryVO) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
LovVO oLovVO = new LovVO();
|
|
ArrayList arylstHeaderNames = new ArrayList();
|
|
arylstHeaderNames.add("workGroupId");
|
|
arylstHeaderNames.add("hrm.HrmAttShiftRosterGen.wrkGrpName");
|
|
arylstHeaderNames.add("hrm.HrmAttShiftRosterGen.wrkGrpCode");
|
|
oLovVO.setHeaderList(arylstHeaderNames);
|
|
ArrayList arylstVisibility = new ArrayList();
|
|
arylstVisibility.add("H");
|
|
arylstVisibility.add("V");
|
|
arylstVisibility.add("V");
|
|
oLovVO.setVisibilityList(arylstVisibility);
|
|
int count = 0;
|
|
String siteId = null;
|
|
if (oLovQueryVO.getProperty("site") != null) {
|
|
siteId = oLovQueryVO.getProperty("site");
|
|
System.out.println(siteId);
|
|
}
|
|
ArrayList oParameters = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
oParameters = new ArrayList();
|
|
oParameters.add(new DBObject(1, 1, 12, siteId));
|
|
oParameters.add(new DBObject(2, 1, 12, oLovQueryVO.getSearchField1()));
|
|
oParameters.add(new DBObject(3, 1, 12, oLovQueryVO.getSearchField2()));
|
|
oParameters.add(new DBObject(4, 2, -10));
|
|
oParameters.add(new DBObject(5, 2, 12));
|
|
oParameters.add(new DBObject(6, 2, 12));
|
|
oParameters.add(new DBObject(7, 2, 4));
|
|
ArrayList oOutArray = oBean.callProc(oParameters, "HRMATTSHIFTROSTERGEN.proc_GetWorkGroupCodeLOV(?,?,?,?,?,?,?)");
|
|
DBObject oOutObject = oOutArray.get(0);
|
|
ArrayList oList = (ArrayList)oOutObject.getObject();
|
|
QueryRow oRow = null;
|
|
Iterator iter = oList.iterator();
|
|
while (iter.hasNext()) {
|
|
if (count == 0)
|
|
oList = new ArrayList();
|
|
count++;
|
|
oRow = iter.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;
|
|
}
|
|
}
|