EAS 7.5当中动态扩展平台执行update语句
var easImporter = JavaImporter();
easImporter.importPackage(Packages.com.kingdee.bos.util);
easImporter.importPackage(Packages.com.kingdee.eas.util);
easImporter.importPackage(Packages.com.kingdee.eas.util.app);
easImporter.importPackage(Packages.com.kingdee.bos);
easImporter.importPackage(Packages.com.kingdee.eas.scm.common.util);
with(easImporter){
var ctx = pluginCtx.getUIContext();
var sql= "update T_IM_SaleIssueEntry t set t.cfhandwittenoffqty = (select sum(a.fquantity) from T_AR_OtherBillentry a where a.fsourcebillentryid = t.fid group by a.fsourcebillentryid) where t.t.FStorageOrgUnitID = 'mNoAAAAAAS/M567U'";
com.kingdee.eas.util.app.DbUtil.execute(ctx, sql);
com.kingdee.eas.util.client.MsgBox.showInfo("已更新完成!!");
}
发生错误如下:
错误信息:Plugin script execute error, please check whether script is right.
方案Salescustomer中的脚本存在问题。脚本如下:
var easImporter = JavaImporter();
easImporter.importPackage(Packages.com.kingdee.bos.util);
easImporter.importPackage(Packages.com.kingdee.eas.util);
easImporter.importPackage(Packages.com.kingdee.eas.util.app);
easImporter.importPackage(Packages.com.kingdee.bos);
easImporter.importPackage(Packages.com.kingdee.eas.scm.common.util);
with(easImporter){
var ctx = pluginCtx.getUIContext();
var sql= "update T_IM_SaleIssueEntry t set t.cfhandwittenoffqty = (select sum(a.fquantity) from T_AR_OtherBillentry a where a.fsourcebillentryid = t.fid group by a.fsourcebillentryid) where t.t.FStorageOrgUnitID = 'mNoAAAAAAS/M567U'";
DbUtil.execute(ctx, sql);
com.kingdee.eas.util.client.MsgBox.showInfo("已更新完成!!");
}
Caused exception message is: ReferenceError: "DbUtil" is not defined. (unnamed script#9)
错误详细堆栈信息:com.kingdee.eas.ep.plugin.ScriptExecuteException: Plugin script execute error, please check whether script is right.
方案Salescustomer中的脚本存在问题。脚本如下:
var easImporter = JavaImporter();
easImporter.importPackage(Packages.com.kingdee.bos.util);
easImporter.importPackage(Packages.com.kingdee.eas.util);
easImporter.importPackage(Packages.com.kingdee.eas.util.app);
easImporter.importPackage(Packages.com.kingdee.bos);
easImporter.importPackage(Packages.com.kingdee.eas.scm.common.util);
with(easImporter){
var ctx = pluginCtx.getUIContext();
var sql= "update T_IM_SaleIssueEntry t set t.cfhandwittenoffqty = (select sum(a.fquantity) from T_AR_OtherBillentry a where a.fsourcebillentryid = t.fid group by a.fsourcebillentryid) where t.t.FStorageOrgUnitID = 'mNoAAAAAAS/M567U'";
DbUtil.execute(ctx, sql);
com.kingdee.eas.util.client.MsgBox.showInfo("已更新完成!!");
}
Caused exception message is: ReferenceError: "DbUtil" is not defined. (unnamed script#9)
at com.kingdee.eas.ep.plugin.PluginUtils.getScriptExecuteException(PluginUtils.java:104)
at com.kingdee.eas.ep.plugin.PluginUtils.handleScriptException(PluginUtils.java:69)
at com.kingdee.eas.ep.client.ScriptExecutor.execute(ScriptExecutor.java:52)
at com.kingdee.eas.ep.client.PluginService.executeScript(PluginService.java:189)
at com.kingdee.eas.ep.client.PluginService.afterActionPerformed(PluginService.java:178)
at com.kingdee.bos.appframework.client.servicebinding.ActionProxy.afterAction(ActionProxy.java:245)
at com.kingdee.bos.appframework.client.servicebinding.ActionProxy.actionPerformedInvoke(ActionProxy.java:183)
at com.kingdee.bos.appframework.client.servicebinding.ActionProxy.actionPerformed(ActionProxy.java:102)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at com.kingdee.bos.ctrl.swing.KDWorkButton.fireActionPerformed(KDWorkButton.java:567)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
at javax.swing.AbstractButton.doClick(AbstractButton.java:337)
at com.kingdee.bos.ctrl.swing.LittleArrowButton$DefaultSelfPopup$LittleArrowButtonItem$LittleArrowButtonItemMouseListener.mouseClicked(LittleArrowButton.java:1160)
at java.awt.Component.processMouseEvent(Component.java:6291)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6053)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4651)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4481)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4247)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4481)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:643)
at java.awt.EventQueue.access$000(EventQueue.java:84)
at java.awt.EventQueue$1.run(EventQueue.java:602)
at java.awt.EventQueue$1.run(EventQueue.java:600)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
at java.awt.EventQueue$2.run(EventQueue.java:616)
at java.awt.EventQueue$2.run(EventQueue.java:614)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:613)
at com.kingdee.bos.invokecounter.RPCLogEventQueue.dispatchEvent(RPCLogEventQueue.java:176)
at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.kingdee.eas.client.recorder.UserInputEventQueue.myDispatchEvent(UserInputEventQueue.java:126)
at com.kingdee.eas.client.recorder.UserInputEventQueue.dispatchEvent(UserInputEventQueue.java:59)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: org.mozilla.javascript.EcmaError: ReferenceError: "DbUtil" is not defined. (unnamed script#9)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3753)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3731)
at org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3816)
at org.mozilla.javascript.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1826)
at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1765)
at org.mozilla.javascript.gen.unnamed_script_1._c_script_0(unnamed script:9)
at org.mozilla.javascript.gen.unnamed_script_1.call(unnamed script)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:426)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3157)
at org.mozilla.javascript.gen.unnamed_script_1.call(unnamed script)
at org.mozilla.javascript.gen.unnamed_script_1.exec(unnamed script)
at org.mozilla.javascript.Context.evaluateString(Context.java:1111)
at com.kingdee.eas.ep.client.ScriptExecutor.execute(ScriptExecutor.java:50)
... 50 more
Caused by: org.mozilla.javascript.EcmaError
org.mozilla.javascript.EcmaError: ReferenceError: "DbUtil" is not defined. (unnamed script#9)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3753)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3731)
at org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3816)
at org.mozilla.javascript.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1826)
at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1765)
at org.mozilla.javascript.gen.unnamed_script_1._c_script_0(unnamed script:9)
at org.mozilla.javascript.gen.unnamed_script_1.call(unnamed script)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:426)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3157)
at org.mozilla.javascript.gen.unnamed_script_1.call(unnamed script)
at org.mozilla.javascript.gen.unnamed_script_1.exec(unnamed script)
at org.mozilla.javascript.Context.evaluateString(Context.java:1111)
at com.kingdee.eas.ep.client.ScriptExecutor.execute(ScriptExecutor.java:50)
at com.kingdee.eas.ep.client.PluginService.executeScript(PluginService.java:189)
at com.kingdee.eas.ep.client.PluginService.afterActionPerformed(PluginService.java:178)
at com.kingdee.bos.appframework.client.servicebinding.ActionProxy.afterAction(ActionProxy.java:245)
at com.kingdee.bos.appframework.client.servicebinding.ActionProxy.actionPerformedInvoke(ActionProxy.java:183)
at com.kingdee.bos.appframework.client.servicebinding.ActionProxy.actionPerformed(ActionProxy.java:102)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at com.kingdee.bos.ctrl.swing.KDWorkButton.fireActionPerformed(KDWorkButton.java:567)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
at javax.swing.AbstractButton.doClick(AbstractButton.java:337)
at com.kingdee.bos.ctrl.swing.LittleArrowButton$DefaultSelfPopup$LittleArrowButtonItem$LittleArrowButtonItemMouseListener.mouseClicked(LittleArrowButton.java:1160)
at java.awt.Component.processMouseEvent(Component.java:6291)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6053)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4651)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4481)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4247)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4481)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:643)
at java.awt.EventQueue.access$000(EventQueue.java:84)
at java.awt.EventQueue$1.run(EventQueue.java:602)
at java.awt.EventQueue$1.run(EventQueue.java:600)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
at java.awt.EventQueue$2.run(EventQueue.java:616)
at java.awt.EventQueue$2.run(EventQueue.java:614)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:613)
at com.kingdee.bos.invokecounter.RPCLogEventQueue.dispatchEvent(RPCLogEventQueue.java:176)
at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.kingdee.eas.client.recorder.UserInputEventQueue.myDispatchEvent(UserInputEventQueue.java:126)
at com.kingdee.eas.client.recorder.UserInputEventQueue.dispatchEvent(UserInputEventQueue.java:59)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
推荐阅读