/// <summary> /// 存储推焦时 相关车辆信息 /// </summary> /// <param name="actualRoomNum">推焦车炉号</param> /// <param name="index">CokeRoom.PushPlan中最接近推焦车所在炉号的计划的索引</param> /// <param name="now">实际推焦时间</param> /// <param name="job">工作车与否</param> public PushTogetherInfo(byte actualRoomNum, int index, string now, bool job) { int lstIndex = index >= 0 ? index : 0; PlanRoomNum = CokeRoom.PushPlan[lstIndex].RoomNum; ActualRoomNum = actualRoomNum; ActualPushTime = Convert.ToDateTime(now); PlanToPushTime = CokeRoom.PushPlan[lstIndex].PushTime; StokingTime = Convert.ToDateTime("2012年4月3日 13:14");//默认值 Period = CokeRoom.PushPlan[lstIndex].Period; Group = CokeRoom.PushPlan[lstIndex].Group; DwTogetherInfo tInfo = job ? OPCCommunication.Communication.JobCarTogetherInfo : OPCCommunication.Communication.NonJobCarTogetherInfo; PushLockInfo = tInfo.InfoToInt; PingLockInfo = 333; List <Vehicles.Vehicle> lst = job ? OPCCommunication.Communication.TJobCarLst : OPCCommunication.Communication.NonJobCarLst; PushCarList = lst[0].CarNum * 100 + lst[1].CarNum * 10 + lst[2].CarNum; PingCarList = 333; //推拦熄煤箭头:20170601 暂设置为固定值16;当工作推焦车出焦时,有三工作车得到箭头;非工作车时,置零 ArrowsList = 16; TAddr = lst[0].DataRead.PhysicalAddr; LAddr = lst[1].DataRead.PhysicalAddr; XAddr = lst[2].DataRead.PhysicalAddr; ZAddr = 0; Communication = 123;//20170601 通讯状态暂未处理 }
/// <summary> /// /// </summary> /// <param name="index"></param> /// <param name="pushTime"> 开始推焦时间</param> /// <param name="tjc">是否为工作车</param> public PsInfo(int index, string pushTime, Tjc tjc) { List <Vehicle> lstVehical = tjc.JobCar ? Communication.TJobCarLst : Communication.NonJobCarLst; bool valid = index >= 0 ? true : false; DateTime invalidTime = Convert.ToDateTime("2012-04-03 13:14"); TPushPlan pNull = new TPushPlan(1, 1, 1, invalidTime); TPushPlan p = new TPushPlan(); p = valid ? CokeRoom.PushPlan[index] : (CokeRoom.PushPlan.Count > 0 ? new TPushPlan(CokeRoom.PushPlan[0]) : pNull); //20170923 PushPlan.Count==0时如何处理? PlanRoom = p.RoomNum; //计划炉号 ActualRoom = (byte)tjc.RoomNum; //pInfo.实际炉号 = (byte)lst[0].RoomNum; //pInfo.实际推焦时间 = Convert.ToDateTime(now); ActualPushTime = Convert.ToDateTime(pushTime); //pInfo.预定出焦时间 = p.PushTime; PlanPushTime = p.PushTime; //pInfo.上次装煤时间 = p.StokingTime;//默认值 LastStokingTime = p.StokingTime; //pInfo.规定结焦时间 = p.standardBurnTime; StandardBurnTime = p.StandardBurnTime; //pInfo.计划结焦时间 = p.BurnTime; PlanBurnTime = p.BurnTime; //pInfo.实际结焦时间 = (int)(Convert.ToDateTime(now) - p.StokingTime).TotalMinutes; ActualBurnTime = (int)(Convert.ToDateTime(pushTime) - p.StokingTime).TotalMinutes; //pInfo.时段 = (byte)p.Period; Period = (byte)p.Period; //pInfo.班组 = (byte)p.Group; Group = (byte)p.Group; DwTogetherInfo tInfo = tjc.JobCar ? Communication.JobCarTogetherInfo : Communication.NonJobCarTogetherInfo; //pInfo.Push联锁信息 = tInfo.InfoToInt; LockInfo = tInfo.InfoToInt; //pInfo.联锁 = tInfo.PushTogether ? (byte?)1 : 0; Lock = (byte)(tInfo.PushTogether ? 1 : 0); //pInfo.Push工作车序列 = (short)(lst[0].CarNum * 100 + lst[1].CarNum * 10 + lst[2].CarNum); Cars = (short)(lstVehical[0].CarNum * 100 + lstVehical[1].CarNum * 10 + lstVehical[2].CarNum); //推拦熄煤箭头:20170601 暂设置为固定值16;当工作推焦车出焦时,有三工作车得到箭头;非工作车时,置零 //pInfo.Push对中序列 = null; CarsReady = ArrowsToInt(lstVehical[0].Arrows, lstVehical[1].Arrows, lstVehical[2].Arrows);//箭头指示:前四位bit为推焦车的箭头,接下来四位拦焦车箭头,最后四位熄焦车箭头;共占12bit //pInfo.Push推焦车地址 = lst[0].DataRead.PhysicalAddr; TAddr = lstVehical[0].DataRead.PhysicalAddr; //pInfo.Push拦焦车地址 = lst[1].DataRead.PhysicalAddr; LAddr = lstVehical[1].DataRead.PhysicalAddr; //pInfo.Push熄焦车地址 = lst[2].DataRead.PhysicalAddr; XAddr = lstVehical[2].DataRead.PhysicalAddr; //pInfo.Push推焦车炉号 = lst[0].RoomNum; TRoom = lstVehical[0].RoomNum; //pInfo.Push拦焦车炉号 = lst[1].RoomNum; LRoom = lstVehical[1].RoomNum; //pInfo.Push熄焦车炉号 = lst[2].RoomNum; XRoom = lstVehical[2].RoomNum; //pInfo.Push车辆通讯状态 = null;//20170601 通讯状态暂未处理;设备的顺序:PLC,触摸屏,无线模块,解码器,每辆车占4bit,共计8辆车, CommStatus = 0;//20170601 通讯状态暂未处理 PlanIndex = index; PlanCount = CokeRoom.PushPlan.Count; BeginTime = DateTime.Now; RecAddr(); }
private void TLockInfoToColor(TextBox txt, string path, DwTogetherInfo info) { Binding mybinding = new Binding(); mybinding.Source = info; mybinding.Path = new PropertyPath(path); BoolToColorConverter converter = new BoolToColorConverter(); converter.DefaultColor = txt.Background; converter.TrueToColor = Brushes.Red; mybinding.Converter = converter; txt.SetBinding(BackgroundProperty, mybinding); }