/// <summary> /// 获取电压表的值和范围 /// </summary> /// <param name="ztype">桩类型</param> /// <param name="itemsList">接口数据项</param> /// <returns></returns> public static Voltage GetVoltage(string ztype, List <Items> itemsList) { var gatItemBll = new GatItemBll(); var pointCfgBll = new PointCfgBll(); var voltage = new Voltage(); DataTable dtVoltage; foreach (var itemse in itemsList) { dtVoltage = gatItemBll.FindByCurrentAndVoltage("电压", itemse.DataItemId); if (dtVoltage.Rows.Count <= 0) { continue; } if (itemse.Value == null) { continue; } voltage.ItemNo = itemse.DataItemId; voltage.VoltagePointer = itemse.Value; voltage.VoltageTime = itemse.GatDt; break;//只要查到一个有值就可以了 } dtVoltage = pointCfgBll.FindByEffectiveAndThreshold(voltage.ItemNo, ztype); if (dtVoltage.Rows.Count <= 0) { return(voltage); } try { if (!string.IsNullOrEmpty(dtVoltage.Rows[0]["Eff_Max"].ToString())) { voltage.VoltageEffectiveMax = decimal.Parse(dtVoltage.Rows[0]["Eff_Max"].ToString()); } if (!string.IsNullOrEmpty(dtVoltage.Rows[0]["Eff_Min"].ToString())) { voltage.VoltageEffectiveMin = decimal.Parse(dtVoltage.Rows[0]["Eff_Min"].ToString()); } if (!string.IsNullOrEmpty(dtVoltage.Rows[0]["LimitMax"].ToString())) { voltage.VoltageThresholdMax = decimal.Parse(dtVoltage.Rows[0]["LimitMax"].ToString()); } if (!string.IsNullOrEmpty(dtVoltage.Rows[0]["LimitMin"].ToString())) { voltage.VoltageThresholdMin = decimal.Parse(dtVoltage.Rows[0]["LimitMin"].ToString()); } } catch (Exception) { throw; } return(voltage); }
/// <summary> /// 获取电流的值和范围 /// </summary> /// <param name="ztype">桩类型</param> /// <param name="itemsList">接口数据项</param> /// <returns></returns> public static Current GetCurrent(string ztype, List <Items> itemsList) { var gatItemBll = new GatItemBll(); var pointCfgBll = new PointCfgBll(); var current = new Current(); DataTable dtCurrent; foreach (var itemse in itemsList) { dtCurrent = gatItemBll.FindByCurrentAndVoltage("电流", itemse.DataItemId); if (dtCurrent.Rows.Count <= 0) { continue; } if (itemse.Value == null) { continue; } current.ItemNo = itemse.DataItemId; current.CurrentPointer = itemse.Value; current.CurrentTime = itemse.GatDt; break;//只要查到一个有值就可以了(值为空就继续查,不为空就跳出) } dtCurrent = pointCfgBll.FindByEffectiveAndThreshold(current.ItemNo, ztype); if (dtCurrent.Rows.Count <= 0) { return(current); } try { if (!string.IsNullOrEmpty(dtCurrent.Rows[0]["Eff_Max"].ToString())) { current.CurrentEffectiveMax = decimal.Parse(dtCurrent.Rows[0]["Eff_Max"].ToString()); } if (!string.IsNullOrEmpty(dtCurrent.Rows[0]["Eff_Min"].ToString())) { current.CurrentEffectiveMin = decimal.Parse(dtCurrent.Rows[0]["Eff_Min"].ToString()); } if (!string.IsNullOrEmpty(dtCurrent.Rows[0]["LimitMax"].ToString())) { current.CurrentThresholdMax = decimal.Parse(dtCurrent.Rows[0]["LimitMax"].ToString()); } if (!string.IsNullOrEmpty(dtCurrent.Rows[0]["LimitMin"].ToString())) { current.CurrentThresholdMin = decimal.Parse(dtCurrent.Rows[0]["LimitMin"].ToString()); } } catch (Exception) { throw; } return(current); }