Python表单插件采购申请获取采购订单供应商

栏目:云星空知识作者:金蝶来源:金蝶云社区发布:2024-09-16浏览:1

Python表单插件采购申请获取采购订单供应商

```Python import clr clr.AddReference('Kingdee.BOS') clr.AddReference('Kingdee.BOS.Core') clr.AddReference('Kingdee.BOS.App') from Kingdee.BOS.Core import * from Kingdee.BOS.App.Data import * #def EntryButtonCellClick(e): def EntryBarItemClick(e): if e.BarItemKey=="SZXY_tbButton": rows=this.Model.GetEntryRowCount("FEntity"); for i in range(0,rows,1): FMID=str(this.Model.GetValue("FMaterialId",i)["Id"]) if (this.Model.GetValue("FMaterialId",i) <>None) else "0"; sql="/*dialect*/select a.FSUPPLIERID from t_PUR_POOrder a join t_PUR_POOrderEntry b on a.fid=b.fid where b.FMATERIALID="+FMID+" and a.fid in (SELECT MAX(l.FID) FROM t_PUR_POOrderEntry l where l.FMATERIALID ="+FMID+" GROUP BY l.FMATERIALID)"; FSsupp=DBUtils.ExecuteScalar(this.Context,sql,None); #this.View.ShowMessage(sql); this.Model.SetValue("FSuggestSupplierId",FSsupp,i); this.View.UpdateView("FEntity"); ``` ![image.webp](/download/0100ea2cdd06b3614936b89d7a7b6c5b3ab0.webp) 获取采购订单供应商的脚本语句需要根据自己的需要进行修改.

上面的代码楼主大大可能需要维护下,目前我这么改了之后可以用了

import clr

clr.AddReference('Kingdee.BOS')

clr.AddReference('Kingdee.BOS.Core')

clr.AddReference('Kingdee.BOS.App')

from Kingdee.BOS.Core import *

from Kingdee.BOS.App.Data import *


def EntryBarItemClick(e):

    if e.BarItemKey=="SXIM_tbButton":

        rows=this.Model.GetEntryRowCount("FEntity")

        for i in range(0,rows,1):

            mate = this.Model.GetValue("FMaterialId",i)

            if mate != None:

                FMID=str(mate["Id"])

                sql="/*dialect*/select a.FSUPPLIERID from t_PUR_POOrder a join t_PUR_POOrderEntry b on a.fid=b.fid  where b.FMATERIALID="+FMID+" and a.fid in (SELECT MAX(l.FID) FROM t_PUR_POOrderEntry l where l.FMATERIALID ="+FMID+" GROUP BY l.FMATERIALID)"

                FSsupp=DBUtils.ExecuteScalar(this.Context,sql,None)

                this.Model.SetValue("FSuggestSupplierId",FSsupp,i)

        this.View.UpdateView("FEntity")


能说一下具体操作步骤吗


按照如上的代码内容复制,可是不生效了。


怎么提示语法错误,按钮和字段都更换了。


从业务角度考虑,sql建议加上单据审核状态的筛选

Python表单插件采购申请获取采购订单供应商

```Pythonimport clrclr.AddReference('Kingdee.BOS')clr.AddReference('Kingdee.BOS.Core')clr.AddReference('Kingdee.BOS.App')from Ki...
点击下载文档
确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息