业务场景:目前系统标准版本暂不支持【付款单自动携带当前用户为采购员】,可通过Python实现
使用方法:
1.用户关联采购员;
2.打开BOS,选择出纳模块,点击付款单;
3.在【表单插件】中注册Python脚本;
4.保存单据。
#参考代码:
import clr
clr.AddReference('System')
clr.AddReference('System.Data')
clr.AddReference('Kingdee.BOS')
clr.AddReference('Kingdee.BOS.Core')
clr.AddReference('Kingdee.BOS.App')
clr.AddReference('Kingdee.BOS.ServiceHelper')
from Kingdee.BOS import *
from Kingdee.BOS.Core import *
from Kingdee.BOS.Core.Bill import *
from Kingdee.BOS.Core.Metadata import *
from System import *
from System.Data import *
from Kingdee.BOS.App.Data import *
def AfterBindData(e):
if (this.View.OpenParameter.Status.Equals(OperationStatus.ADDNEW)):
purchaserObj = this.View.Model.GetValue("FPurchaserId")
if(str(purchaserObj)!="None"):
return
orgObj = this.View.Model.GetValue("FPurchaseOrgId")
if(str(orgObj)!="None"):
orgId = str(orgObj["Id"])
if(orgId != "0"):
sql = "SELECT t0.FENTRYID FROM T_BD_OPERATORENTRY t0 join T_BD_STAFF t1 on t0.FSTAFFID=t1.FSTAFFID JOIN T_SEC_USER t3 on t1.FPERSONID = t3.FLINKOBJECT WHERE t3.FUSERID = {0} and t0.FOPERATORTYPE = 'CGY' and t0.FBIZORGID={1} and t0.FISUSE='1'".format(str(this.Context.UserId),orgId)
purchaserId = DBUtils.ExecuteScalar(this.Context, sql, None)
this.Model.SetItemValueByID("FPurchaserId", purchaserId, 0)
推荐阅读