获取最近采购订单供应商原创
4人赞赏了该文章
548次浏览
未经作者许可,禁止转载编辑于2022年11月03日 09:39:06
获取已审核最近采购订单供应商,写入采购申请单。(非按业务日期排序,按制单顺序)
需要在单据体增加按钮触发表单插件。
脚本语言为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_POOrder m join t_PUR_POOrderEntry l on m.fid=l.fid where m.FDOCUMENTSTATUS='C' and 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");
需要在单据体增加按钮触发表单插件。
脚本语言为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_POOrder m join t_PUR_POOrderEntry l on m.fid=l.fid where m.FDOCUMENTSTATUS='C' and 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");
赞 4
4人点赞
还没有人点赞,快来当第一个点赞的人吧!
打赏
0人打赏
还没有人打赏,快来当第一个打赏的人吧!
推荐阅读