import clr
clr.AddReference("System")
clr.AddReference("System.Web.Extensions")
clr.AddReference("Kingdee.BOS.Core")
clr.AddReference("Kingdee.BOS")
clr.AddReference('mscorlib')
clr.AddReference("System.Core")
clr.AddReference("Kingdee.BOS.DataEntity")
clr.AddReference("Kingdee.BOS.ServiceHelper")
from Kingdee.BOS.Core.Log import *
from Kingdee.BOS.Core import *
from Kingdee.BOS.Core.DynamicForm import *
from Kingdee.BOS.KDThread import *
from Kingdee.BOS.DataEntity import *
from Kingdee.BOS.Orm.DataEntity import *
from Kingdee.BOS.ServiceHelper import *
from Kingdee.BOS.Core.Metadata import SelectorItemInfo ##字段选择实体类
from Kingdee.BOS.Core.SqlBuilder import QueryBuilderParemeter ##查询参数实体类
from Kingdee.BOS.Core.Bill.PlugIn import *
from Kingdee.BOS.Core.Bill.PlugIn.Args import *
from Kingdee.BOS.Core.DynamicForm.PlugIn.Args import *
from System import *
from Kingdee.BOS import *
def FormatCellValue(e):
#F_JET_TEXT4,F_JET_NUMBER都是字段名
if e.Header.FieldName=="F_JET_TEXT4":
F_JET_NUMBER=e.DataRow["F_JET_NUMBER"]
sql="select top 1 fmaterialid from t_BD_MAterial where fnumber like '"+str(F_JET_NUMBER)+"'"
result = DBServiceHelper.ExecuteDynamicObject(this.Context, sql)
if len(result)>0:
e.FormateValue = str(result[0][0])
推荐阅读