package
custom.webclient.system.beans;
import
psdi.webclient.system.beans.*;
import
java.rmi.RemoteException;
import
psdi.util.MXException;
import
java.text.ParseException;
import
psdi.app.workorder.WORemote;
import
psdi.mbo.MboSetRemote;
import
psdi.server.MXServer;
import
psdi.webclient.system.controller.Utility;
import
psdi.webclient.system.controller.WebClientEvent;
import
psdi.util.logging.FixedLoggerNames;
import
psdi.util.logging.MXLogger;
import
psdi.util.logging.MXLoggerFactory;
/**
*
* @author Emrah Sogutoglu
*/
public
class
TesisUcretBean
extends
DataBean {
MXLogger appLog = MXLoggerFactory.getLogger(FixedLoggerNames.LOGGERNAME_APP +
".TesisUcretSec"
);
private
double
getItemToolRate(String itemnum, WORemote wo)
throws
RemoteException, MXException {
MboSetRemote item = MXServer.getMXServer().getMboSet(
"ITEMORGINFO"
, wo.getUserInfo());
item.setWhere(
"ITEMNUM='"
+ itemnum +
"'"
);
item.reset();
return
item.getMbo(
0
).getDouble(
"TOOLRATE"
);
}
public
int
Q25_0_10()
throws
RemoteException, MXException, ParseException {
DataBean appBean = Utility.getDataSource(sessionContext, app.getAppHandler());
WORemote wo = (WORemote) appBean.getMbo();
System.out.println(
"WONUM: "
+ wo.getString(
"WONUM"
));
MboSetRemote bina = wo.getMboSet(
"WO2BINA"
);
bina.setWhere(
"BINA_ID='"
+ wo.getString(
"BINAKODU"
) +
"'"
);
bina.reset();
try
{
if
(bina.count() >
0
) {
bina.getMbo(
0
).setValue(
"BR_ANA_KOLON_CAPI"
,
"Q25(3/4'')"
);
bina.getMbo(
0
).setValue(
"SEBEKE_BINA_MESAFE"
,
"0-10M"
);
bina.getMbo(
0
).setValue(
"TEK_SUBE_YOL_UCRETI"
, getItemToolRate(
"T01"
, wo));
bina.save();
appBean.save();
appBean.fireStructureChangedEvent();
Utility.sendEvent(
new
WebClientEvent(
"dialogclose"
, app.getCurrentPageId(),
null
, sessionContext));
sessionContext.queueRefreshEvent();
}
}
catch
(Exception e) {
appLog.error(
"ERROR: "
+ e +
"n"
+ e.getStackTrace());
}
return
1
;
}
}