$PBExportHeader$f_oa_workremind_chkdate.srf global type f_oa_workremind_chkdate from function_object end type forward prototypes global function boolean f_oa_workremind_chkdate (string arg_parm, datetime arg_dt) end prototypes global function boolean f_oa_workremind_chkdate (string arg_parm, datetime arg_dt);//检查arg_dt是否在约定时间范围内 //类型: // 一次性 // 如果检查时间与约定时间相差 正负30秒 则视作有效 // 循环 // 如果 // // boolean rslt,hasEndDate date date_st,date_en,date_cur,date_tar time time_st,time_en,time_cur,time_tar long second string WeekList //long fit_hour=30,fit_minute=5,fit_second=1//修正值 单位:秒 s_oa_workremind_timetype los_time rslt=false los_time=f_oa_workremind_releasetime(arg_parm) date_cur=date(los_time.oncedate) time_cur=time(los_time.oncetime) date_tar=date(arg_dt) time_tar=time(arg_dt) //================================== //一次性提醒 //================================== if los_time.checktype="once"then if date_tar=date_cur then second=SecondsAfter(time_tar,time_cur) if second<=30 and second>=-30 then rslt=true end if end if goto ext end if //======================= //循环执行提醒 //======================= //日期部分比较 hasEndDate=false date_st=date(mid(los_time.startdate,1,pos(los_time.startdate,";")-1)) if mid(los_time.startdate,pos(los_time.startdate,";")+1)="noend"then else hasEndDate=true date_en=date(mid(los_time.startdate,pos(los_time.startdate,";")+1)) end if //检测是否在日期范围内 if hasEndDate then if date_tardate_en then goto ext end if else if date_tar1 then if day<>1 then goto ext end if end if elseif los_time.IntervalType="week" then if day>7 or day=0 then if date_tar<>date_st then goto ext end if end if //具体星期几 string a a=string(date_tar,"yyyy-mm-dd") date b b=date(a) string weekName weekName=DayName(b) if pos(WeekList,weekName)=0 then goto ext end if end if //时间部分比较 long baseSecond if los_time.fretype="once" then time_cur=time(los_time.fre) else baseSecond=long(mid(los_time.fre,1,pos(los_time.fre,";")-1)) string ls_time ls_time=mid(los_time.fre,pos(los_time.fre,";")+1) time_st=time(mid(ls_time,1,pos(ls_time,";")-1)) time_en=time(mid(ls_time,pos(ls_time,";")+1)) if los_time.fretype="小时" then baseSecond=baseSecond*60*60 elseif los_time.fretype="分钟" then baseSecond=baseSecond*60 elseif los_time.fretype="秒" then end if end if //确定当前时间在执行时间段内 if los_time.fretype="once" then second=SecondsAfter(time_cur,time_tar) if second>=0 and second<=5 then rslt=true end if goto ext else second=SecondsAfter(time_st,time_tar) if time_tartime_en then goto ext end if end if //判断当前时间是否在第一个单位时间内 long firstBase if los_time.fretype="小时" then firstBase=60 elseif los_time.fretype="分钟"then firstBase=5 elseif los_time.fretype="秒"then firstBase=1 end if if mod(second,basesecond)<=firstBase then if mod(second,basesecond)=0 then if firstBase<>1 then//非秒情况; goto ext elseif second<>1 then//非第一秒 goto ext end if end if rslt=true goto ext end if ext: return rslt end function