//merge JOB_ASSIGN to db
EntDbFltJobAssign resultJobAssign = clsDlFltJobAssignLocal.merge(jobAssign);
if(resultJobAssign != null)
LOG.debug("Assigned job has been updated for Staff <{}>", resultJobAssign.getStaffNumber());
ShiftDetailsType _inputShiftDetailsType = _inputStaffDetail.getShiftDetails();
/** UPDATE shift **/
if(isNullOrEmptyStr(jobAssign.getIdStaffShift())){
LOG.debug("No input shift to update for staff <{}>", jobAssign.getStaffNumber());
}else{
EntDbStaffShift dbStaffShift = clsDlStaffShiftLocal.findById(jobAssign.getIdStaffShift());
if(dbStaffShift != null){//is existing..
dbStaffShift.setUpdatedDate(HpUfisCalendar.getCurrentUTCTime());
dbStaffShift.setUpdatedUser(HpEKConstants.RMS_RTC_SOURCE);
}
else{
dbStaffShift = new EntDbStaffShift();
dbStaffShift.setCreatedDate(HpUfisCalendar.getCurrentUTCTime());
dbStaffShift.setCreatedUser(HpEKConstants.RMS_RTC_SOURCE);
}
dbStaffShift.setMsgSendDate(msgSendDate);
dbStaffShift.setRecStatus(rec_status);
dbStaffShift.setStaffType(HpEKConstants.RMS_STAFF_TYPE_ROP);
if(_inputStaffDetail.getID() != null)//Conditional case
dbStaffShift.setStaffNumber(_inputStaffDetail.getID());
if(_inputStaffDetail.getName() != null)
dbStaffShift.setStaffName(_inputStaffDetail.getName());
if(_inputStaffDetail.getMobile() != null)
dbStaffShift.setStaffMobileNo(_inputStaffDetail.getMobile());
if(_inputStaffDetail.getWalkie() != null)
dbStaffShift.setStaffWalkieNo(_inputStaffDetail.getWalkie());
if(_inputStaffDetail.getHDD() != null)
dbStaffShift.setStaffHhdNo(_inputStaffDetail.getHDD());
if(_inputStaffDetail.getQualification() != null)
dbStaffShift.setStaffQualification(_inputStaffDetail.getQualification());
// ShiftDetails
if(_inputShiftDetailsType != null){
if(_inputShiftDetailsType.getFunction()!= null)
dbStaffShift.setShiftFunctionDate(convertDateToUTC(_inputShiftDetailsType.getFunction()));
if(_inputShiftDetailsType.getRemarks() != null)
dbStaffShift.setShiftRemarks(_inputShiftDetailsType.getRemarks());
String mutCode = null;
//if (isNullOrEmptyStr(_inputShiftDetailsType.getMutationCode())) {// check in MD table
if (_inputShiftDetailsType.getMutationCode() != null) {// check in MD table
for (EntDbMdRmsMutateCode mutateCode : clsEntStartUpInitSingleton.getMdRmsMutateCodeList()) {
if (_inputShiftDetailsType.getMutationCode().equalsIgnoreCase(mutateCode.getMutationId())) {
mutCode = _inputStaffDetail.getShiftDetails().getMutationCode(); break;
}
}
if(mutCode == null)
LOG.debug("Mutation Code <{}> is not found in MdRmsMutateCode table.", _inputShiftDetailsType.getMutationCode());
dbStaffShift.setMutateCode(_inputShiftDetailsType.getMutationCode());
}
if(_inputShiftDetailsType.getSchStartTime() != null)
dbStaffShift.setShiftScheStartDate(convertDateToUTC(_inputShiftDetailsType.getSchStartTime()));
if(_inputShiftDetailsType.getSchEndTime() != null)
dbStaffShift.setShiftScheEndDate(convertDateToUTC(_inputShiftDetailsType.getSchEndTime()));
if(_inputShiftDetailsType.getEstStartTime() != null)
dbStaffShift.setShiftEstStartDate(convertDateToUTC(_inputShiftDetailsType.getEstStartTime()));
if(_inputShiftDetailsType.getEstEndTime() != null)
dbStaffShift.setShiftEstEndDate(convertDateToUTC(_inputShiftDetailsType.getEstEndTime()));
if(_inputShiftDetailsType.getActStartTime() != null)
dbStaffShift.setShiftActualStartDate(convertDateToUTC(_inputShiftDetailsType.getActStartTime()));
if(_inputShiftDetailsType.getActEndTime() != null)
dbStaffShift.setShiftActualEndDate(convertDateToUTC(_inputShiftDetailsType.getActEndTime()));
}
EntDbStaffShift resultShift = clsDlStaffShiftLocal.merge(dbStaffShift);
if(resultShift != null)
LOG.debug("Assigned shift has been updated for Staff <{}>.", resultShift.getStaffNumber());