求工作流脚本的示例教程
金蝶云社区-黄嘉豪
黄嘉豪
0人赞赏了该文章 827次浏览 未经作者许可,禁止转载编辑于2016年08月16日 14:29:30

如图,需要在工作流完成和终止的节点添加操作,更改数据库某张表的某个字段,然后上论坛找了以下资料并没有发现关于工作流脚本的示例,尝试了一下自己写:
[code]import clr
clr.AddReference("Kingdee.BOS.ServiceHelper")

from Kingdee.BOS.ServiceHelper import DBServiceHelper

sql = 'UPDATE KDY_REG_T_SHIFT SET FDOCUMENTSTATUS = \'C\' WHERE FID = {0}'.format(FOLDSHIFTID)

DBServiceHelper.Execute(this.Context,sql)[/code]然后报了这样的错:
[code]DBServiceHelper.Execute(this.Context,sql) ( key ) ---> System.Collections.Generic.KeyNotFoundException: key
在 Kingdee.BOS.Core.DependencyRules.BOSDynamicRow.SetFieldValue(String key, Object value)
在 Kingdee.BOS.Workflow.Engine.ProcessContext.TrySetValue(String key, Object value)
在 Kingdee.BOS.Workflow.Kernel.MapStateContext.TrySetMember(String key, Object value)
在 Kingdee.BOS.Scripting.ExpressionContext.TrySetValue(String key, Object newValue)
在 Kingdee.BOS.Scripting.PyDynamicMetaObject.TrySetMember(SetMemberBinder binder, Object value)
在 CallSite.Target(Closure , CallSite , Object , Object )
在 IronPython.Runtime.PythonContext.SetAttr(CodeContext context, Object o, String name, Object value)
在 IronPython.Runtime.Operations.PythonOps.SetAttr(CodeContext context, Object o, String name, Object value)
在 Microsoft.Scripting.Interpreter.ActionCallInstruction`3.Run(InterpretedFrame frame)
在 Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
在 Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1)
在 IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx)
在 IronPython.Compiler.RuntimeScriptCode.InvokeTarget(Scope scope)
在 Kingdee.BOS.Scripting.PyExpressionEvaluator.Run(Expression expression, ExpressionContext context)
--- 内部异常堆栈跟踪的结尾 ---
在 Kingdee.BOS.Scripting.PyExpressionEvaluator.Run(Expression expression, ExpressionContext context)
在 Kingdee.BOS.Workflow.Elements.ActionEvent.ExecuteActionEvent(ActionEventContext ctx)
在 Kingdee.BOS.Workflow.Kernel.Runtime.MapStateExecutor.ExecuteActionEvents()
在 Kingdee.BOS.Workflow.Kernel.Runtime.MapStateExecutor.ExecuteMapState()
在 Kingdee.BOS.Workflow.Kernel.Runtime.MapSchedular.ExecuteMapStateInstance(IMapStateInstance instance)
在 Kingdee.BOS.Workflow.Kernel.Runtime.MapSchedular.Run()[/code]想问一下有没有具体一点的示例教程,或者说有没有不用空操作的方法可以实现我这个简单的需求不