package com.power.data;
|
|
import java.util.Date;
|
|
import com.power.mysql.MysqlConnPool;
|
import com.power.mysql.Sql_Mysql;
|
|
public class PowerData_RT {
|
|
public int PowerDevDeviceId = 0;
|
public String PowerDevDeviceIp = " ";
|
public String PowerDevDeviceName = " ";
|
public String PowerDevProtocolName = " ";
|
|
private MysqlConnPool m_ConPool;
|
|
public PowerDev_acData m_acData = new PowerDev_acData();
|
public PowerDev_acdcData m_acdcData = new PowerDev_acdcData();
|
public PowerDev_dcData m_dcData = new PowerDev_dcData();
|
|
public EnvmDev_Data m_EnvData = new EnvmDev_Data();
|
|
private boolean pwrDevice_CommErr = false; //true = comm err
|
|
public Date commRecordTime = new Date();
|
|
public int CommTxCount = 0; //ͨÐÅ´ÎÊý
|
public int CommSuccessCount = 0; //ͨÐųɹ¦´ÎÊý
|
|
|
public PowerData_RT(MysqlConnPool pool) {
|
m_ConPool = pool;
|
}
|
|
public boolean GetPwrDeviceCommErrState() {
|
return pwrDevice_CommErr;
|
}
|
|
public void SetPwrDeviceCommErrState(boolean st) {
|
|
if(false==st) {
|
commRecordTime.setTime(new Date().getTime());
|
}
|
|
pwrDevice_CommErr = st;
|
}
|
|
public void setCommCountInc()
|
{
|
CommTxCount += 1;
|
//System.out.println("CommTxCount:"+CommTxCount);
|
if(CommTxCount >= 90000000) {
|
CommTxCount = 1;
|
}
|
}
|
|
public void setCommSuccessCountInc()
|
{
|
CommSuccessCount += 1;
|
//System.out.println("CommSuccessCount:"+CommSuccessCount);
|
if(CommSuccessCount >= 90000000) {
|
CommSuccessCount = 1;
|
}
|
}
|
|
public void UpdatePower_ACDC_Data_ToTable() {
|
PowerData_RT_SQL.updatePower_ACDC_Data_RT_Table(m_ConPool, this);
|
}
|
|
public void UpdatePower_AC_Data_ToTable() {
|
PowerData_RT_SQL.updatePower_AC_Data_RT_Table(m_ConPool, this);
|
}
|
|
public void UpdatePower_DC_Data_ToTable() {
|
PowerData_RT_SQL.updatePower_DC_Data_RT_Table(m_ConPool, this);
|
}
|
|
public void UpdatePower_RT_Info_ToTable() {
|
PowerData_RT_SQL.updatePower_INFO_RT_Table(m_ConPool, this);
|
}
|
|
public void InsertPower_ACDC_Data_ToTable() {
|
PowerData_RT_SQL.insertPower_Data_RT_Table(m_ConPool, PowerDevDeviceId, Sql_Mysql.PWRDEV_ACDCDATA_TABLE);
|
}
|
|
public void InsertPower_AC_Data_ToTable() {
|
PowerData_RT_SQL.insertPower_Data_RT_Table(m_ConPool, PowerDevDeviceId, Sql_Mysql.PWRDEV_ACDATA_TABLE);
|
}
|
|
public void InsertPower_DC_Data_ToTable() {
|
PowerData_RT_SQL.insertPower_Data_RT_Table(m_ConPool, PowerDevDeviceId, Sql_Mysql.PWRDEV_DCDATA_TABLE);
|
}
|
|
public void InsertPower_RT_INFO_ToTable() {
|
PowerData_RT_SQL.insertPower_Data_RT_Table(m_ConPool, PowerDevDeviceId, Sql_Mysql.PWRDEV_RT_INFO_TABLE);
|
}
|
|
public void InsertPower_Input_INFO_ToTable() {
|
PowerData_RT_SQL.insertPower_StaInfo_Table(m_ConPool, PowerDevDeviceId);
|
PowerData_RT_SQL.insertPower_acmInfo_Table(m_ConPool, PowerDevDeviceId);
|
PowerData_RT_SQL.insertPower_acdcmInfo_Table(m_ConPool, PowerDevDeviceId);
|
PowerData_RT_SQL.insertPower_dcmInfo_Table(m_ConPool, PowerDevDeviceId);
|
}
|
|
//ͨ¹ý°æ±¾ÅжÏÊÇ·ñÓÐÉý¼¶Ðת£¬Èç¹ûûÉý¼¶£¬Ã»ÓÐENVM½Úµã£¬»á²»Í£´òÓ¡´íÎó
|
public boolean checkIfEnvmExists()
|
{
|
boolean exists = false;
|
|
int ver = PowerData_RT_SQL.getVersionFromTable(m_ConPool, PowerDevDeviceIp);
|
|
if(ver>1002) { //V1.003¿ªÊ¼¼ÓÈëÁËÈýÏàµçµÆENVM
|
exists = true;
|
}
|
|
return exists;
|
}
|
|
}
|