py模仿销售订单实现自定义单据增加客户物料字段

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

py模仿销售订单实现自定义单据增加客户物料字段

import clr

clr.AddReference('System')

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

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

from System import*

from Kingdee.BOS.Core.DynamicForm import *

from Kingdee.BOS.App.Data import *



def DataChanged(e):

    #明细中增加销售客户字段(基本资料):F_MarketClient;物料编码:FMaterialId;明细中增加客户物料字段(基本资料):FMapId

     if e.Key == "F_MarketClient" or e.Key =="FMaterialId" or e.Key == "FMapId": 

        hh=this.View.Model.GetEntryCurrentRowIndex("FEntity");#获取单据体当前焦点行号

        if hh >= 0 :   

            khObj = this.Model.GetValue("F_MarketClient",hh);


            if khObj is not None: 

                KHnumber = khObj["Number"];

                if  e.Key == "FMaterialId":

                    baseObj=this.Model.GetValue("FMaterialId",hh);


                    if baseObj is  not None: 

                        cc = baseObj["Number"]

                        sql1 = "select a.FNUMBER  from V_SAL_CUSTMATMAPPING a left join T_BD_CUSTOMER c on a.FCUSTOMERID = c.FCUSTID inner join T_BD_MATERIAL d on a.FMaterialId  = d.FMaterialId where  d.FNUMBER = '"+str(cc)+"' and c.fnumber = '"  + str(KHnumber)+"'"

                        KHnumbers = DBUtils.ExecuteScalar(this.Context,sql1,None); 


                        this.View.Model.SetItemValueByNumber("FMapId",KHnumbers,hh); 


                elif e.Key == "FMapId": 

                    fmapObj=this.Model.GetValue("FMapId",hh);

                    if fmapObj is  not None: 

                        mm = fmapObj["Number"]

                        sql2 = "select d.FNUMBER  from V_SAL_CUSTMATMAPPING a left join T_BD_CUSTOMER c on a.FCUSTOMERID = c.FCUSTID inner join T_BD_MATERIAL d on a.FMaterialId  = d.FMaterialId  where  a.fnumber = '"+str(mm)+"' and c.fnumber = '"  + str(KHnumber)  +"'"

                        FMaterials = DBUtils.ExecuteScalar(this.Context,sql2,None);

                        this.View.Model.SetItemValueByNumber("FMaterialId",FMaterials,hh);  

1718617242674.webp

                1718617363311.webp


拓展:当选好销售客户字段后,希望客户物料编码字段只显示此客户下的客户物料编码;在BOS中设置客户物料编码--编辑属性面板中的过滤属性为 fcustomerid in (SELECT t2.fcustomerid FROM (SELECT FMASTERID FROM T_BD_CUSTOMER t1 where t1.FCUSTID = GetValue(F_MarketClient)) as t0 left join V_SAL_CUSTMATMAPPING as t2   on t2.fcustomerid  = t0.FMASTERID)

py模仿销售订单实现自定义单据增加客户物料字段

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