在列表使用Python插件格式化字段显示值

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

在列表使用Python插件格式化字段显示值

#原需求:在列表使用单价FPrice*汇率FDECIMAL_PLC字段去计算二开字段FDECIMAL_PLC

import clr

clr.AddReference('System')

clr.AddReference('Kingdee.BOS')

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

from Kingdee.BOS import *

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

from Kingdee.BOS.Core.Metadata import *

from System import *


#获取列表是否显示FExchangeRate、FPrice、FDECIMAL_PLC字段

isShow_FExchangeRate = False;

isShow_FPrice = False;

isShow_FDECIMAL_PLC = False;

def PrepareFilterParameter(e):

     global isShow_FExchangeRate

     global isShow_FPrice

     global isShow_FDECIMAL_PLC

     for item in e.ColumnFields:

         if item.Key=="FExchangeRate":

              isShow_FExchangeRate=True

    

     for item in e.ColumnFields:

         if item.Key=="FPrice":

             isShow_FPrice=True


     for item in e.ColumnFields:

         if item.Key=="FDECIMAL_PLC":

              isShow_FDECIMAL_PLC=True

def FormatCellValue(e):

     if (isShow_FExchangeRate and isShow_FPrice and isShow_FDECIMAL_PLC):

         if (e.Header.Key == "FDECIMAL_PLC"):

              e.FormateValue = str(MathUtil.Round(e.DataRow["FPrice"] * e.DataRow["FExchangeRate"], 2))



FormatCellValue方法中少了global

在列表使用Python插件格式化字段显示值

#原需求:在列表使用单价FPrice*汇率FDECIMAL_PLC字段去计算二开字段FDECIMAL_PLCimport clrclr.AddReference('System')clr.AddReference(...
点击下载文档
确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息