关于直接调拨单携带客户物料编码的实现案例

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

关于直接调拨单携带客户物料编码的实现案例

一、【业务需求】

接调拨单上加了客户字段,需要根据填写客户、物料编码后自动带出客户物料编码、客户物料名称


二、【分析实现】

标准产品直接调拨单的表单插件实现了携带客户物料编码和客户物料名称的逻辑,但是该逻辑取数依赖的是调入保管者类型和调入保管者,不满足业务需求。这里通过二开表单插件,由表头客户资料触发客户物料编码的取数赋值。


参考:【关于客户物料对应表在自定义单据中的使用说明


import clr 
clr.AddReference("System")
clr.AddReference("Kingdee.BOS.Core")
clr.AddReference("Kingdee.BOS.DataEntity")
clr.AddReference("Kingdee.K3.SCM.ServiceHelper")
clr.AddReference("Kingdee.K3.SCM.Stock.Business.PlugIn")
clr.AddReference("Kingdee.K3.BD.Business.PlugIn")

from System import *
from System import StringComparison
from System.Collections.Generic import *
from Kingdee.BOS.Core.Bill.PlugIn import *
from Kingdee.BOS.Core.DynamicForm.PlugIn.Args import *
from Kingdee.BOS.Core.Metadata.EntityElement import *
from Kingdee.K3.SCM.ServiceHelper import *
from Kingdee.K3.SCM.Stock.Business.PlugIn import *
from Kingdee.K3.BD.Business.PlugIn.Common import *

para_UseCustMatMapping = False

def GetUseCustMatMappingParam():
    global para_UseCustMatMapping
    return para_UseCustMatMapping

def DataChanged(e):
    useCustMatMappingParam = GetUseCustMatMappingParam()
    if e.Key.Equals("FCUSTID", StringComparison.OrdinalIgnoreCase):
        #global para_UseCustMatMapping
        if useCustMatMappingParam == True:
            # FBillEntry 直接调拨单单据体标识、 FStockOutOrgId: 调出库存组织、 FCUSTID:表头客户标识、 FCUSTMATID: 单据体客户物料编码、FCustMatName:单据体客户物料名称
            Common.SetCustMatWhenCustChange(this, "FBillEntry", "FStockOutOrgId", "FCUSTID", "FCUSTMATID", "FCustMatName");
        dyCustId = this.View.Model.GetValue("FCUSTID")
        if dyCustId == None:
            count = this.View.Model.GetEntryRowCount("FBillEntry")
            for index in range(0,count):
                this.View.Model.SetValue("FCustMatId", 0, index)

    if e.Key.Equals("FMATERIALID", StringComparison.OrdinalIgnoreCase):
        #global para_UseCustMatMapping
        if useCustMatMappingParam == True:
            dyCustId = this.View.Model.GetValue("FCUSTID")
            dySaleOrgId = this.View.Model.GetValue("FStockOutOrgId")
            dyMaterialId = this.View.Model.GetValue("FMaterialId", e.Row)
            customerId = 0
            materialId = 0
            if dyCustId != None:
                customerId = Convert.ToInt64(dyCustId["Id"])
            if dyMaterialId != None:
                materialId = Convert.ToInt64(dyMaterialId["Id"])

            CustMatMapping.SetRelativeCodeByMaterialId(this, "FCustMatId", materialId, customerId, Convert.ToInt64(dySaleOrgId["Id"]), e.Row)
            
def AfterBindData(e):
    global para_UseCustMatMapping
    mainOrg = this.View.Model.GetValue("FStockOutOrgId") # 调出库存组织
    if mainOrg != None:
        mainOrgId = Convert.ToInt64(mainOrg["Id"])
        objUseCustMatMapping = CommonServiceHelper.GetSystemProfile(this.Context, mainOrgId, "SAL_SystemParameter", "UseCustMatMapping", False);
        if objUseCustMatMapping != None:
            para_UseCustMatMapping = Convert.ToBoolean(objUseCustMatMapping)
        else:
            para_UseCustMatMapping = False

            


关于直接调拨单携带客户物料编码的实现案例

一、【业务需求】接调拨单上加了客户字段,需要根据填写客户、物料编码后自动带出客户物料编码、客户物料名称二、【分析实现】标准产品直接...
点击下载文档
确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息