I thought I'd give back to the community by sharing the tool that we use for this. The team that we worked with built a custom Java tool…it seems to work well enough. If anyone needs to build something similar, this might be helpful...
(There are probably a few different ways this could have been solved. The team we worked with chose Java. I wasn't involved, so I couldn't say if that was the best/easiest approach or not.)
cust.webclient.beans.workorder.CGQuickRepAppBean
import createch.webclient.beans.workorder.CGQuickRepAppBean;
import java.rmi.RemoteException;
import psdi.app.labor.LabTransSet;
import psdi.app.labor.LaborRemote;
import psdi.app.signature.SignatureServiceRemote;
import psdi.app.workorder.WORemote;
import psdi.mbo.MboRemote;
import psdi.mbo.MboSetRemote;
import psdi.security.UserInfo;
import psdi.server.MXServer;
import psdi.util.MXApplicationException;
import psdi.util.MXException;
import psdi.webclient.beans.workorder.QuickRepAppBean;
import psdi.webclient.system.beans.DataBean;
import psdi.webclient.system.controller.Utility;
public class CGQuickRepAppBean extends QuickRepAppBean {
public static WORemote woRemote = null;
public int STARTTIMER() throws MXException, RemoteException {
DataBean appBean = Utility.getDataSource(this.sessionContext, this.app.getAppHandler());
woRemote = (WORemote)this.app.getAppBean().getMbo(0);
LabTransSet labTransSet = null;
String laborOrg = null;
String laborCode = null;
UserInfo userinfo = woRemote.getUserInfo();
laborOrg = woRemote.getString("orgid");
SignatureServiceRemote sigService = (SignatureServiceRemote)MXServer.getMXServer().lookup("SIGNATURE");
LaborRemote laborRemote = sigService.getLaborForUserAndOrg(userinfo.getUserName(), laborOrg, userinfo);
if (laborRemote != null)
laborCode = laborRemote.getString("laborcode");
MboSetRemote woMboSet = woRemote.getMboSet("CHILDTASK");
if (!woMboSet.isEmpty()) {
MboRemote mbo = null;
int i = 0;
while ((mbo = woMboSet.getMbo(i)) != null) {
labTransSet = (LabTransSet)mbo.getMboSet("LABTRANS");
labTransSet.setWhere("timerstatus='ACTIVE' and laborcode='" + laborCode + "'");
labTransSet.reset();
if (!labTransSet.isEmpty())
throw new MXApplicationException("labor", "TimerAlreadyStarted");
i++;
}
}
return super.STARTTIMER();
}
}
cust.webclient.beans.workorder.CGQuickRepTasksBean
import createch.webclient.beans.workorder.CGQuickRepTasksBean;
import java.rmi.RemoteException;
import psdi.app.labor.LabTransSet;
import psdi.app.labor.LaborRemote;
import psdi.app.signature.SignatureServiceRemote;
import psdi.app.workorder.WORemote;
import psdi.mbo.MboRemote;
import psdi.mbo.MboSetRemote;
import psdi.security.UserInfo;
import psdi.server.MXServer;
import psdi.util.MXApplicationException;
import psdi.util.MXException;
import psdi.webclient.beans.workorder.QuickRepTasksBean;
import psdi.webclient.system.beans.DataBean;
import psdi.webclient.system.controller.RequestHandler;
import psdi.webclient.system.controller.Utility;
import psdi.webclient.system.controller.WebClientEvent;
public class CGQuickRepTasksBean extends QuickRepTasksBean {
public static WORemote woRemote = null;
public int STARTTIMER() throws MXException, RemoteException {
DataBean appBean = Utility.getDataSource(this.sessionContext, this.app.getAppHandler());
woRemote = (WORemote)this.app.getAppBean().getMbo(0);
LabTransSet labTransSet = null;
String laborOrg = null;
String laborCode = null;
UserInfo userinfo = woRemote.getUserInfo();
laborOrg = woRemote.getString("orgid");
SignatureServiceRemote sigService = (SignatureServiceRemote)MXServer.getMXServer().lookup("SIGNATURE");
LaborRemote laborRemote = sigService.getLaborForUserAndOrg(userinfo.getUserName(), laborOrg, userinfo);
if (laborRemote != null)
laborCode = laborRemote.getString("laborcode");
MboSetRemote woMboSet = woRemote.getMboSet("CHILDTASK");
if (!woMboSet.isEmpty()) {
MboRemote mbo = null;
int i = 0;
while ((mbo = woMboSet.getMbo(i)) != null) {
labTransSet = (LabTransSet)mbo.getMboSet("LABTRANS");
labTransSet.setWhere("timerstatus='ACTIVE' and laborcode='" + laborCode + "'");
labTransSet.reset();
if (!labTransSet.isEmpty())
throw new MXApplicationException("labor", "TimerAlreadyStarted");
i++;
}
labTransSet = (LabTransSet)woRemote.getMboSet("LABTRANS");
labTransSet.setWhere("timerstatus='ACTIVE' and laborcode='" + laborCode + "'");
labTransSet.reset();
if (!labTransSet.isEmpty())
throw new MXApplicationException("labor", "TimerAlreadyStarted");
}
WebClientEvent event = this.sessionContext.getCurrentEvent();
int row = getRowIndexFromEvent(event);
woRemote = (WORemote)woRemote.getMboSet("CHILDREN").getMbo(row);
try {
if (this.app.isMobile())
woRemote.setFromMobile(true);
woRemote.startTimer();
appBean.save();
} catch (MXException mxe) {
Utility.showMessageBox(this.sessionContext.getCurrentEvent(), mxe);
structureChangedEvent((DataBean)this);
dataChangedEvent((DataBean)this);
}
this.sessionContext.queueRefreshEvent();
return 1;
}
public int STOPTIMER() throws MXException, RemoteException {
DataBean appBean = Utility.getDataSource(this.sessionContext, this.app.getAppHandler());
try {
woRemote = (WORemote)this.app.getAppBean().getMbo(0);
WebClientEvent event = this.sessionContext.getCurrentEvent();
int row = getRowIndexFromEvent(event);
woRemote = (WORemote)woRemote.getMboSet("CHILDREN").getMbo(row);
MboRemote labtrans = woRemote.stopTimer(null, false);
if (woRemote.needPopupOnStopTimer()) {
RequestHandler.showDialog(this.sessionContext, "confirmlabtrans");
return 1;
}
woRemote.stopTimer();
appBean.save();
} catch (MXException mxe) {
Utility.showMessageBox(this.sessionContext.getCurrentEvent(), mxe);
}
this.sessionContext.queueRefreshEvent();
return 1;
}
}
cust.webclient.beans.workorder.CGWOTasksBean
import createch.webclient.beans.workorder.CGWOTasksBean;
import java.rmi.RemoteException;
import psdi.app.labor.LabTransSet;
import psdi.app.labor.LaborRemote;
import psdi.app.signature.SignatureServiceRemote;
import psdi.app.workorder.WORemote;
import psdi.mbo.MboRemote;
import psdi.mbo.MboSetRemote;
import psdi.security.UserInfo;
import psdi.server.MXServer;
import psdi.util.MXApplicationException;
import psdi.util.MXException;
import psdi.webclient.beans.workorder.WOTasksBean;
import psdi.webclient.system.beans.DataBean;
import psdi.webclient.system.controller.RequestHandler;
import psdi.webclient.system.controller.Utility;
import psdi.webclient.system.controller.WebClientEvent;
public class CGWOTasksBean extends WOTasksBean {
public static WORemote woRemote = null;
public int STARTTIMER() throws MXException, RemoteException {
DataBean appBean = Utility.getDataSource(this.sessionContext, this.app.getAppHandler());
woRemote = (WORemote)this.app.getAppBean().getMbo(0);
LabTransSet labTransSet = null;
String laborOrg = null;
String laborCode = null;
UserInfo userinfo = woRemote.getUserInfo();
laborOrg = woRemote.getString("orgid");
SignatureServiceRemote sigService = (SignatureServiceRemote)MXServer.getMXServer().lookup("SIGNATURE");
LaborRemote laborRemote = sigService.getLaborForUserAndOrg(userinfo.getUserName(), laborOrg, userinfo);
if (laborRemote != null)
laborCode = laborRemote.getString("laborcode");
MboSetRemote woMboSet = woRemote.getMboSet("CHILDTASK");
if (!woMboSet.isEmpty()) {
MboRemote mbo = null;
int i = 0;
while ((mbo = woMboSet.getMbo(i)) != null) {
labTransSet = (LabTransSet)mbo.getMboSet("LABTRANS");
labTransSet.setWhere("timerstatus='ACTIVE' and laborcode='" + laborCode + "'");
labTransSet.reset();
if (!labTransSet.isEmpty())
throw new MXApplicationException("labor", "TimerAlreadyStarted");
i++;
}
labTransSet = (LabTransSet)woRemote.getMboSet("LABTRANS");
labTransSet.setWhere("timerstatus='ACTIVE' and laborcode='" + laborCode + "'");
labTransSet.reset();
if (!labTransSet.isEmpty())
throw new MXApplicationException("labor", "TimerAlreadyStarted");
}
WebClientEvent event = this.sessionContext.getCurrentEvent();
int row = getRowIndexFromEvent(event);
woRemote = (WORemote)woRemote.getMboSet("CHILDREN").getMbo(row);
try {
if (this.app.isMobile())
woRemote.setFromMobile(true);
woRemote.startTimer();
appBean.save();
} catch (MXException mxe) {
Utility.showMessageBox(this.sessionContext.getCurrentEvent(), mxe);
structureChangedEvent((DataBean)this);
dataChangedEvent((DataBean)this);
}
this.sessionContext.queueRefreshEvent();
return 1;
}
public int STOPTIMER() throws MXException, RemoteException {
DataBean appBean = Utility.getDataSource(this.sessionContext, this.app.getAppHandler());
try {
woRemote = (WORemote)this.app.getAppBean().getMbo(0);
WebClientEvent event = this.sessionContext.getCurrentEvent();
int row = getRowIndexFromEvent(event);
woRemote = (WORemote)woRemote.getMboSet("CHILDREN").getMbo(row);
MboRemote labtrans = woRemote.stopTimer(null, false);
if (woRemote.needPopupOnStopTimer()) {
RequestHandler.showDialog(this.sessionContext, "confirmlabtrans");
return 1;
}
woRemote.stopTimer();
appBean.save();
} catch (MXException mxe) {
Utility.showMessageBox(this.sessionContext.getCurrentEvent(), mxe);
}
this.sessionContext.queueRefreshEvent();
return 1;
}
}
cust.webclient.beans.workorder.CGWorkorderAppBean
import createch.webclient.beans.workorder.CGWorkorderAppBean;
import java.rmi.RemoteException;
import psdi.app.labor.LabTransSet;
import psdi.app.labor.LaborRemote;
import psdi.app.signature.SignatureServiceRemote;
import psdi.app.workorder.WORemote;
import psdi.mbo.MboRemote;
import psdi.mbo.MboSetRemote;
import psdi.security.UserInfo;
import psdi.server.MXServer;
import psdi.util.MXApplicationException;
import psdi.util.MXException;
import psdi.webclient.beans.workorder.WorkorderAppBean;
import psdi.webclient.system.beans.DataBean;
import psdi.webclient.system.controller.Utility;
public class CGWorkorderAppBean extends WorkorderAppBean {
public static WORemote woRemote = null;
public int STARTTIMER() throws MXException, RemoteException {
DataBean appBean = Utility.getDataSource(this.sessionContext, this.app.getAppHandler());
woRemote = (WORemote)this.app.getAppBean().getMbo(0);
LabTransSet labTransSet = null;
String laborOrg = null;
String laborCode = null;
UserInfo userinfo = woRemote.getUserInfo();
laborOrg = woRemote.getString("orgid");
SignatureServiceRemote sigService = (SignatureServiceRemote)MXServer.getMXServer().lookup("SIGNATURE");
LaborRemote laborRemote = sigService.getLaborForUserAndOrg(userinfo.getUserName(), laborOrg, userinfo);
if (laborRemote != null)
laborCode = laborRemote.getString("laborcode");
MboSetRemote woMboSet = woRemote.getMboSet("CHILDTASK");
if (!woMboSet.isEmpty()) {
MboRemote mbo = null;
int i = 0;
while ((mbo = woMboSet.getMbo(i)) != null) {
labTransSet = (LabTransSet)mbo.getMboSet("LABTRANS");
labTransSet.setWhere("timerstatus='ACTIVE' and laborcode='" + laborCode + "'");
labTransSet.reset();
if (!labTransSet.isEmpty())
throw new MXApplicationException("labor", "TimerAlreadyStarted");
i++;
}
}
return super.STARTTIMER();
}
}
#Maximo#AssetandFacilitiesManagement