#引入clr运行库
import clr
#添加对cloud插件开发的常用组件的引用
clr.AddReference('System')
clr.AddReference('System.Data')
clr.AddReference('Kingdee.BOS')
clr.AddReference('Kingdee.BOS.Core')
clr.AddReference('Kingdee.BOS.App')
clr.AddReference('Kingdee.BOS.ServiceHelper')
#导入cloud基础库中的常用实体对象(分命名空间导入,不会递归导入)
from Kingdee.BOS import *
from Kingdee.BOS.Core import *
from Kingdee.BOS.Core.Bill import *
from Kingdee.BOS.Core.DynamicForm.PlugIn import *
from Kingdee.BOS.Core.DynamicForm.PlugIn.ControlModel import *
from System import *
from System.Data import *
from Kingdee.BOS.App.Data import *
from System.Collections.Generic import List
from Kingdee.BOS.ServiceHelper import *
def OnFormatRowConditions(args):
if(args.DataRow.DynamicObject.DynamicObjectType.Properties.ContainsKey("FDELIVERYDATE")):
#这里是普通字段作为判断,需要判断列表是否显示了该字段,否则没显示该字段时会报错
#而且只有显示了这个字段才能判断设置颜色
FDELIVERYDATE=str(args.DataRow["FDELIVERYDATE"]);#要货日期
F_Rz_Date=str(args.DataRow["F_Rz_Date"]);#出库日期
t1=DateTime.Parse(FDELIVERYDATE);
current =DateTime.Now.Date.ToString();
t2=DateTime.Parse(str(current));
ts=t1-t2;
sub=ts.Days;
ck=len(str(F_Rz_Date));
if(sub<= 0 and ck==4):
fc=FormatCondition();
#fc.ForeColor="#FFFF9B98";#前景色
fc.BackColor="#FE2C2C";#背景色 红色
#fc.BackColor="#FEB82C";#背景色 黄色
args.FormatConditions.Add(fc);
推荐阅读