/// <summary> /// Banner数据更新函数 /// </summary> /// <param name="flag"></param> /// <param name="index"></param> private void BannerMessageSet(machineFlag flag, int index) { //开机数量 GlobalVars.executing[index] = flag.getMachineStart(); GlobalVars.bannerMessages.Executing = GlobalVars.executing.Sum().ToString(); //停机数量 GlobalVars.bannerMessages.NoExecuting = (31 - GlobalVars.executing.Sum()).ToString(); //开炉做管数量 GlobalVars.executingAndMaking[index] = flag.getMaking(); GlobalVars.bannerMessages.ExecutingAndMaking = GlobalVars.executingAndMaking.Sum().ToString(); //开炉空转数量 GlobalVars.executingAndStartFurnace[index] = flag.getIdling(); GlobalVars.bannerMessages.ExecutingAndStartFurnace = GlobalVars.executingAndStartFurnace.Sum().ToString(); //不开炉空转数量 GlobalVars.executingAndStopFurnace[index] = flag.getIdlingAndFurnaceStop(); GlobalVars.bannerMessages.ExecutingAndStopFurnace = GlobalVars.executingAndStopFurnace.Sum().ToString(); //报警数量 GlobalVars.alarming[index] = flag.getAlarm(); GlobalVars.bannerMessages.Alarming = GlobalVars.alarming.Sum().ToString(); //开机率 if (GlobalVars.executing.Sum() > 0) { GlobalVars.bannerMessages.UtilizationRatio = (int)Math.Round((double)(GlobalVars.executing.Sum()) * 100.0 / 31.0, 0); GlobalVars.bannerMessages.UtilizationRatioStr = ((int)Math.Round((double)(GlobalVars.executing.Sum()) * 100.0 / 31.0, 0)).ToString() + "%"; } //做管率 if (GlobalVars.executingAndMaking.Sum() > 0) { GlobalVars.bannerMessages.MakingRatio = (int)Math.Round((double)(GlobalVars.executingAndMaking.Sum()) * 100.0 / 31.0, 1); GlobalVars.bannerMessages.MakingRatioStr = ((int)Math.Round((double)(GlobalVars.executingAndMaking.Sum()) * 100.0 / 31.0, 1)) + "%"; } }
/// <summary> /// 机器状态数据更新函数 /// </summary> /// <param name="flag"></param> /// <param name="model"></param> /// <param name="index"></param> private void MachineFlagSet(machineFlag flag, OPCChangeModel model, int index) { switch (index % 100) { //MachineFlagSet(machinesFlags.SR01Flag, model); case 1: //机器开机状态位 flag.MachineStartusQuality = model.Quality; flag.IsMachineStart = Convert.ToBoolean(model.Value); break; case 2: //机器炉子状态位 flag.FurnaceStartusQuality = model.Quality; flag.IsFurnaceStart = Convert.ToBoolean(model.Value); break; case 3: //机器升料机状态位 flag.LiterStartusQuality = model.Quality; flag.IsLiterStart = Convert.ToBoolean(model.Value); break; case 4: //机器报警状态位 flag.AlarmStatusQuality = model.Quality; flag.IsAlarm = Convert.ToBoolean(model.Value); break; case 5: //烤模时间设定 flag.FlareMoldTimeSetting = Convert.ToInt32(model.Value); break; case 6: //浸料时间设定 flag.DipingMaterialTimeSetting = Convert.ToInt32(model.Value); break; case 7: //烤料时间设定 flag.FlareMaterialTimeSetting = Convert.ToInt32(model.Value); break; case 8: //冷却时间设定 flag.CoolingTimeSetting = Convert.ToInt32(model.Value); break; } BannerMessageSet(flag, index / 100); }