即时库存自动显示python脚本原创
金蝶云社区-Lang图腾
Lang图腾
4人赞赏了该文章 1,078次浏览 未经作者许可,禁止转载编辑于2021年04月21日 09:07:12

from clr import AddReference

AddReference('Kingdee.BOS.App')

from Kingdee.BOS.App.Data import DBUtils


def DataChanged(e):

    if e.Key == 'FMaterialId':


    row = e.Row

    fnumber = this.Model.GetValue('FMaterialId').Number

    org_num = this.Model.GetValue('FSaleOrgId').Number


    sql = """

    select FBASEQTY from T_STK_INVENTORY 

    where FMATERIALID=(select FMASTERID from T_BD_MATERIAL where FNUMBER='%s' 

    and FUSEORGID=(select FORGID from T_ORG_ORGANIZATIONS where FNUMBER='%s'))

    and FSTOCKORGID=(select FORGID from T_ORG_ORGANIZATIONS where FNUMBER='%s')

    """ % (fnumber, org_num, org_num)


    return_data = DBUtils.ExecuteEnumerable(this.Context, sql)


    for data in return_data:

        this.Model.SetValue('F_TANG_STOCKQTY', data['FBASEQTY'], row)


图标赞 4
4人点赞
还没有人点赞,快来当第一个点赞的人吧!
图标打赏
0人打赏
还没有人打赏,快来当第一个打赏的人吧!