客户要求根据当前时间来显示进度,如机器一天工作从8:00—5:00,
8:00—10:00进度为0;
10:00—12:00进度为1;
12:00—12:59
01:00—03:00进度为2;
比如当前时间是8:30,那就是进度为0;
进度条的使用。两个shape重叠;设置属性;
然后方法需要 这么连接
方法里面完整代码
//var dateValue = new Date();
//var strdateValue = dateFormat(dateValue,"hh:mm");
var nowDate = new Date();
var strdateValue = dateFormat(nowDate,"hh:mm");
var date2 = new Date("5/21/2018 08:00:00");
var date3 = new Date("5/21/2018 10:40:00");//1
var date4 = new Date("5/21/2018 12:59:00");//1
var date5 = new Date("5/21/2018 01:00:00");//1
var date6 = new Date("5/21/2018 02:20:00");//2
var date7 = new Date("5/21/2018 05:00:00");//2
var strdate2 = dateFormat(date2,"hh:mm");
var strdate3 = dateFormat(date3,"hh:mm");
var strdate4 = dateFormat(date4,"hh:mm");
var strdate5 = dateFormat(date5,"hh:mm");
var strdate6 = dateFormat(date6,"hh:mm");
var strdate7 = dateFormat(date7,"hh:mm");
var End=0;
var All = 3;
if(strdateValue>=strdate2 && strdateValue<strdate3){
End = 0;
}else if((strdateValue>=strdate3 && strdateValue<=strdate4) || (strdateValue>=strdate5 && strdateValue<strdate6)){
End = 1;
}else if(strdateValue>=strdate6 && strdateValue<strdate7){
End = 2;
}else if(strdateValue>=strdate7){
End = 3;
}
var str = End+"/"+All;
var params = {
infoTableName : "Infotable",
dataShapeName : "BPLEAD.ProducePlanDS"
};
// CreateInfoTableFromDataShape(infoTableName:STRING("InfoTable"), dataShapeName:STRING):INFOTABLE(BPLEAD.TaiWeiErrorDS)
var result = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params);
result.AddRow({"all":All,"end":End,"jindu":str});