コード例 #1
0
        /// <summary>
        /// 查询 DC_WRITE_DATA
        /// </summary>
        /// <returns></returns>
        public List <DC_WRITE_DATA> GetWriteDatasUpdated()
        {
            string               sql    = $@"SELECT * FROM DC.DC_WRITE_DATA WHERE UPDATED=1";
            OracleDataReader     reader = OracleDataHelper.ExecuteReader(sql);
            List <DC_WRITE_DATA> lst    = new List <DC_WRITE_DATA>();

            while (reader.Read())
            {
                DC_WRITE_DATA data = new DC_WRITE_DATA()
                {
                    ID             = Convert.ToInt32(reader["ID"]),
                    DATA_CONFIG_ID = GetValue(reader, "DATA_CONFIG_ID"),
                    VALUE          = GetValue(reader, "VALUE"),
                    UPDATED        = GetValue(reader, "UPDATED"),
                    WRITE_TIME     = GetValue(reader, "WRITE_TIME"),
                    UPDATE_TIME    = GetValue(reader, "UPDATE_TIME"),
                    FIELD1         = reader["FIELD1"].ToString(),
                    FIELD2         = reader["FIELD2"].ToString(),
                    FIELD3         = reader["FIELD3"].ToString(),
                };
                lst.Add(data);
            }
            reader.Close();
            return(lst);
        }
コード例 #2
0
        /// <summary>
        /// 获取服务器
        /// </summary>
        /// <param name="serverNum"></param>
        /// <returns></returns>
        public List <DC_SERVER> GetDCServers()
        {
            string           sql    = $"SELECT * FROM DC.DC_SERVER";
            OracleDataReader reader = OracleDataHelper.ExecuteReader(sql);
            List <DC_SERVER> lst    = new List <DC_SERVER>();

            while (reader.Read())
            {
                DC_SERVER server = new DC_SERVER()
                {
                    DESCRIPTION = reader["DESCRIPTION"].ToString(),
                    ENABLE      = GetValue(reader, "ENABLE"),
                    ID          = Convert.ToInt32(reader["ID"]),
                    IP_ADDRESS  = reader["IP_ADDRESS"].ToString(),
                    NAME        = reader["NAME"].ToString(),
                    NUM         = reader["NUM"].ToString(),
                    FIELD1      = reader["FIELD1"].ToString(),
                    FIELD2      = reader["FIELD2"].ToString(),
                    FIELD3      = reader["FIELD3"].ToString(),
                };
                lst.Add(server);
            }
            reader.Close();
            return(lst);
        }
コード例 #3
0
        /// <summary>
        /// 获取设备集合
        /// </summary>
        /// <param name="server"></param>
        /// <returns></returns>
        private List <DC_DEVICE> GetDCDevices(string whereSql)
        {
            string           sql    = $"SELECT * FROM DC.DC_DEVICE WHERE 1=1 {whereSql}";
            OracleDataReader reader = OracleDataHelper.ExecuteReader(sql);
            List <DC_DEVICE> lst    = new List <DC_DEVICE>();

            while (reader.Read())
            {
                DC_DEVICE device = new DC_DEVICE()
                {
                    CHANNEL      = reader["CHANNEL"].ToString(),
                    DESCRIPTION  = reader["DESCRIPTION"].ToString(),
                    ENABLE       = GetValue(reader, "ENABLE"),
                    ID           = Convert.ToInt32(reader["ID"]),
                    IP_ADDRESS   = reader["IP_ADDRESS"].ToString(),
                    MAC_ADDRESS  = reader["MAC_ADDRESS"].ToString(),
                    NAME         = reader["NAME"].ToString(),
                    NUM          = reader["NUM"].ToString(),
                    S7CONNECTION = reader["S7CONNECTION"].ToString(),
                    SERVER_ID    = GetValue(reader, "SERVER_ID"),
                    CRA_ID       = GetValue(reader, "CRA_ID"),
                    FIELD1       = reader["FIELD1"].ToString(),
                    FIELD2       = reader["FIELD2"].ToString(),
                    FIELD3       = reader["FIELD3"].ToString(),
                };
                lst.Add(device);
            }
            reader.Close();
            return(lst);
        }
コード例 #4
0
        /// <summary>
        /// 获取数据点配置集合
        /// </summary>
        /// <param name="device"></param>
        /// <returns></returns>
        public List <DC_DATA_CONFIG> GetDCDataConfigs(string whereSql)
        {
            string                sql    = $"SELECT * FROM DC.DC_DATA_CONFIG WHERE 1=1 {whereSql}";
            OracleDataReader      reader = OracleDataHelper.ExecuteReader(sql);
            List <DC_DATA_CONFIG> lst    = new List <DC_DATA_CONFIG>();

            while (reader.Read())
            {
                DC_DATA_CONFIG config = new DC_DATA_CONFIG()
                {
                    DESCRIPTION          = reader["DESCRIPTION"].ToString(),
                    ENABLE               = GetValue(reader, "ENABLE"),
                    ID                   = Convert.ToInt32(reader["ID"]),
                    NAME                 = reader["NAME"].ToString(),
                    NUM                  = reader["NUM"].ToString(),
                    DEVICE_ID            = GetValue(reader, "DEVICE_ID"),
                    CONVERTER            = GetValue(reader, "CONVERTER"),
                    FIELD_DATA_LENGTH    = GetValue(reader, "FIELD_DATA_LENGTH"),
                    FIELD_DATA_PRECISION = GetValue(reader, "FIELD_DATA_PRECISION"),
                    FIELD_DATA_SCALE     = GetValue(reader, "FIELD_DATA_SCALE"),
                    FIELD_DATA_TYPE      = GetValue(reader, "FIELD_DATA_TYPE"),
                    TABLE_NAME           = GetValue(reader, "TABLE_NAME"),
                    TABLE_USER           = GetValue(reader, "TABLE_USER"),
                    IDENTITY_VALUE       = GetValue(reader, "IDENTITY_VALUE"),
                    IDENTITY_COLUMN      = GetValue(reader, "IDENTITY_COLUMN"),
                    FIELD_NAME           = GetValue(reader, "FIELD_NAME"),
                    MEMORY_ADDRESS       = reader["MEMORY_ADDRESS"].ToString(),
                    SUBSCRIPTION         = GetValue(reader, "SUBSCRIPTION"),
                    FIELD1               = reader["FIELD1"].ToString(),
                    FIELD2               = reader["FIELD2"].ToString(),
                    FIELD3               = reader["FIELD3"].ToString(),
                };
                lst.Add(config);
            }
            reader.Close();
            return(lst);
        }
コード例 #5
0
        /// <summary>
        /// 获取服务器
        /// </summary>
        /// <param name="serverNum"></param>
        /// <returns></returns>
        public DC_SERVER GetDCServer(string serverNum)
        {
            string           sql    = $"SELECT * FROM DC.DC_SERVER WHERE NUM='{serverNum}'";
            OracleDataReader reader = OracleDataHelper.ExecuteReader(sql);
            DC_SERVER        server = null;

            if (reader.Read())
            {
                server = new DC_SERVER()
                {
                    DESCRIPTION = reader["DESCRIPTION"].ToString(),
                    ENABLE      = GetValue(reader, "ENABLE"),
                    ID          = Convert.ToInt32(reader["ID"]),
                    IP_ADDRESS  = reader["IP_ADDRESS"].ToString(),
                    NAME        = reader["NAME"].ToString(),
                    NUM         = reader["NUM"].ToString(),
                    FIELD1      = reader["FIELD1"].ToString(),
                    FIELD2      = reader["FIELD2"].ToString(),
                    FIELD3      = reader["FIELD3"].ToString(),
                };
            }
            reader.Close();
            return(server);
        }