IronPython 插件 - 单据转换插件原创
金蝶云社区-汽修工
汽修工
7人赞赏了该文章 778次浏览 未经作者许可,禁止转载编辑于2022年08月16日 13:52:50

import clr

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

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

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

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

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

clr.AddReference('Kingdee.BOS')

clr.AddReference('System.Data')

clr.AddReference('System')




from System import *

from System.Data import *

from System.Text import *

from System.Collections import *

from System.Collections.Generic import *

from Kingdee.BOS.App.Data import *

from Kingdee.BOS.Orm.Metadata.DataEntity import * 

from Kingdee.BOS.Orm.DataEntity import *

from Kingdee.BOS.Core.Metadata.ConvertElement.PlugIn import * 

from Kingdee.BOS.Core.Metadata.ConvertElement.PlugIn.Args import * 

from Kingdee.BOS.Core.DynamicForm.PlugIn import *

from Kingdee.BOS.ServiceHelper import * 

def AfterConvert(e):

    targetEntity = e.Result.FindByEntityKey("FBillHead")

    for targetInfo in targetEntity:

        targetObj = targetInfo.DataEntity

        PAYBILLsrcRow = targetObj["PAYBILLSRCENTRY"]

        PAYBILLENTRY = targetObj["PAYBILLENTRY"]

        PAYBILLENTRY.Clear()

        for srcRow in PAYBILLsrcRow:

            doNew = DynamicObject(PAYBILLENTRY.DynamicCollectionItemPropertyType)

            doNew["F_SFWD_WL_SRC_E_Id"] = srcRow["F_SFWD_WL_SRC_Id"]#费用物料编码

            doNew["F_SFWD_WL_SRC_E"] = srcRow["F_SFWD_WL_SRC"]#费用物料编码

            srcRow["FSRCLINKROWID"]  = Guid.NewGuid().ToString()

            doNew["FLINKROWID"] = srcRow["FSRCLINKROWID"]#行关联关系

            doNew["ContractView_E"] = srcRow["ContractView"] #合同号视图

            doNew["ContractView_E_Id"] = srcRow["ContractView_Id"] #合同号视图

            doNew["MContractView_E"] = srcRow["MContractView"]

            doNew["MContractView_E_Id"] = srcRow["MContractView_Id"]

            doNew["FPrepaidexpenses"] = srcRow["FPrepaidexpensesR"]#预付费用

            doNew["InvoiceView_E"] = srcRow["InvoiceView"]#发票号视图

            doNew["InvoiceView_E_Id"] = srcRow["InvoiceView_Id"]

            doNew["MInvoiceView_E"] = srcRow["MInvoiceView"]#关联发票号视图

            doNew["MInvoiceView_E_Id"] = srcRow["MInvoiceView_Id"]

            doNew["FMATERIALID_Id"] = srcRow["FSRCMATERIALID_Id"]#物料编码

            doNew["FMATERIALID"] = srcRow["FSRCMATERIALID"]#物料编码


         


            doNew["FT_ZHTH_HX"] = srcRow["MContractView"]

            doNew["FT_ZHTH_HX_Id"] = srcRow["MContractView_Id"]

            doNew["FT_HTH_HX"] = srcRow["ContractView"]

            doNew["FT_HTH_HX_Id"] = srcRow["ContractView_Id"]


            doNew["FT_GLFPH_HX"] = srcRow["MInvoiceView"]

            doNew["FT_GLFPH_HX_Id"] = srcRow["MInvoiceView_Id"]


            doNew["FT_FPH_HX"] = srcRow["InvoiceView"]

            doNew["FT_FPH_HX_Id"] = srcRow["InvoiceView_Id"]


            doNew["OPPOSITEBANKACCOUNT"] = srcRow["FEACHBANKACCOUNT"]#对方银行账号

            doNew["OPPOSITECCOUNTNAME"] = srcRow["FOPPOSITECCOUNTNAME_S"]#对方账户名称

            doNew["OPPOSITEBANKNAME"] = srcRow["FOPPOSITEBANKNAME_S"]#对方银行开户行

            

            doNew["FCOSTID"] = srcRow["SRCCOSTID"]#費用項目

            doNew["FCOSTID_Id"] = srcRow["SRCCOSTID_Id"]#費用項目

            

            doNew["FEXPENSEDEPTID_E"] = srcRow["FEXPENSEDEPTID"]#費用承擔部門

            doNew["FEXPENSEDEPTID_E_Id"] = srcRow["FEXPENSEDEPTID_Id"]#費用承擔部門

            

            doNew["SETTLETYPEID"] = srcRow["SRCSETTLETYPEID"]#結算方式

            doNew["SETTLETYPEID_Id"] = srcRow["SRCSETTLETYPEID_Id"]#結算方式

            

            doNew["PAYTOTALAMOUNTFOR"] = srcRow["AFTTAXTOTALAMOUNT"]#應付金額

          

            

            doNew["Seq"] = PAYBILLENTRY.Count + 1

            PAYBILLENTRY.Add(doNew)


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