在页面操作完成,后台transaction完成返回后,本应该显示最新更改的东东,但由于webdynpro jco 存在缓存问题,造成不一致。解决这个问题:
try {
Zjxeppm_I02_T01_Input input = wdContext.currentZjxeppm_I02_T01_InputElement().modelObject();
input.execute();
wdContext.nodeOutput().invalidate();
if(MessageUtils.checkReturn(input.getOutput().getReturn(), reporter)){
IOrdoper_ListNode Onode = wdContext.nodeOrdoper_List();
IC_Ordoper_ListNode Cnode= wdContext.nodeC_Ordoper_List();
for (int i = 0; i < Onode.size(); i++){
IC_Ordoper_ListElement item = Cnode.createC_Ordoper_ListElement();
WDCopyService.copyCorresponding(Onode.getOrdoper_ListElementAt(i),item);
item.setS_Status(ChangeStatus.replaceStatus(Onode.getOrdoper_ListElementAt(i).getS_Status()));
item.setPname_txt( valuehelp.getPername(item.getPerson_No()) );
Cnode.addElement(item);
}
}
[color=red]IWDDynamicRFCModel myModel = (IWDDynamicRFCModel) WDModelFactory.getModelInstance(
input.modelInstance().getClass(),WDModelScopeType.APPLICATION_SCOPE,input.modelInstance().getModelInstanceId());
myModel.getCurrentlyUsedJcoClient().reset();[/color]
[color=green]//或者 input.modelInstance().disconnectIfAlive();[/color]
return MessageUtils.checkReturn(input.getOutput().getReturn(), reporter);
} catch (Exception e) {
// TODO Auto-generated catch block
reporter.error(e.getMessage());
}
try {
Zjxeppm_I02_T01_Input input = wdContext.currentZjxeppm_I02_T01_InputElement().modelObject();
input.execute();
wdContext.nodeOutput().invalidate();
if(MessageUtils.checkReturn(input.getOutput().getReturn(), reporter)){
IOrdoper_ListNode Onode = wdContext.nodeOrdoper_List();
IC_Ordoper_ListNode Cnode= wdContext.nodeC_Ordoper_List();
for (int i = 0; i < Onode.size(); i++){
IC_Ordoper_ListElement item = Cnode.createC_Ordoper_ListElement();
WDCopyService.copyCorresponding(Onode.getOrdoper_ListElementAt(i),item);
item.setS_Status(ChangeStatus.replaceStatus(Onode.getOrdoper_ListElementAt(i).getS_Status()));
item.setPname_txt( valuehelp.getPername(item.getPerson_No()) );
Cnode.addElement(item);
}
}
[color=red]IWDDynamicRFCModel myModel = (IWDDynamicRFCModel) WDModelFactory.getModelInstance(
input.modelInstance().getClass(),WDModelScopeType.APPLICATION_SCOPE,input.modelInstance().getModelInstanceId());
myModel.getCurrentlyUsedJcoClient().reset();[/color]
[color=green]//或者 input.modelInstance().disconnectIfAlive();[/color]
return MessageUtils.checkReturn(input.getOutput().getReturn(), reporter);
} catch (Exception e) {
// TODO Auto-generated catch block
reporter.error(e.getMessage());
}