总部老师,我有个客户物料清单分总用量要做汇总,在bos里面试了一下合计,这个功能是不能用的,后来新增了一个单据头字段,按公式值更新指定列这个也无法实现,然后看了论坛,总部老师给出了插件语言,代码如下
from System import StringComparison
from System import Boolean
def DataChanged(e):
if e.Field.Key.Equals("FNUMERATOR",StringComparison.OrdinalIgnoreCase):
sumInteger = 0
rowCount = this.Model.GetEntryRowCount("FTreeEntity")
while rowCount>0:
rowCount = rowCount -1
sumInteger = sumInteger + this.Model.GetValue("FNUMERATOR",rowCount)
this.Model.SetValue("FQty",sumInteger)
但是注册的时候报错了;
报错信息如下:
at Microsoft.Scripting.Hosting.ErrorListenerProxySink.Add(SourceUnit sourceUnit, String message, SourceSpan span, Int32 errorCode, Severity severity)
at IronPython.Compiler.Parser.ReportSyntaxError(Int32 start, Int32 end, String message, Int32 errorCode)
at IronPython.Compiler.Parser.ReportSyntaxError(Token t, IndexSpan span, Int32 errorCode, Boolean allowIncomplete)
at IronPython.Compiler.Parser.ReportSyntaxError(TokenWithSpan t, Int32 errorCode)
at IronPython.Compiler.Parser.ParseSuite()
at IronPython.Compiler.Parser.ParseClassOrFuncBody()
at IronPython.Compiler.Parser.ParseFuncDef()
at IronPython.Compiler.Parser.ParseStmt()
at IronPython.Compiler.Parser.ParseFileWorker(Boolean makeModule, Boolean returnValue)
at IronPython.Compiler.Parser.ParseFile(Boolean makeModule, Boolean returnValue)
at IronPython.Runtime.PythonContext.ParseAndBindAst(CompilerContext context)
at IronPython.Runtime.PythonContext.CompileSourceCode(SourceUnit sourceUnit, CompilerOptions options, ErrorSink errorSink)
at Microsoft.Scripting.Hosting.ScriptSource.CompileInternal(CompilerOptions compilerOptions, ErrorListener errorListener)
at Kingdee.BOS.DomainModelDesigner.PropertyEditor.frmPythonScriptEdit.GenerateCompiledPython()
at Kingdee.BOS.DomainModelDesigner.PropertyEditor.frmPythonScriptEdit.InitializeScope()
at Kingdee.BOS.DomainModelDesigner.PropertyEditor.frmPythonScriptEdit.ButtonItem_Click(Object sender, EventArgs e)
请总部老师指导!
推荐阅读