Exemple #1
0
        //30分钟查询是否有温度异常没发短信的,有则发短信
        private void minTimer_30_ElapsedT(object source, ElapsedEventArgs e)
        {
            //发送温度异常短信 //
            string    sqlT3 = "select * from asm_mechine where sendT=1 and lastReqTime is not null and  id =" + id;
            DataTable dt3   = DbHelperSQL.Query(sqlT3).Tables[0];

            if (dt3.Rows.Count > 0)
            {
                try
                {
                    string    sql21 = "select linkphone from asm_opera where id='" + dt3.Rows[0]["operaID"].ToString() + "'";
                    string    sql22 = "select linkphone from asm_company where id='" + dt3.Rows[0]["companyID"].ToString() + "'";
                    DataTable d21   = DbHelperSQL.Query(sql21).Tables[0];
                    DataTable d22   = DbHelperSQL.Query(sql22).Tables[0];
                    if (d21.Rows.Count > 0 && d21.Rows[0]["linkphone"].ToString() != "")
                    {
                        OperUtil.sendMessage3(d21.Rows[0]["linkphone"].ToString(), dt3.Rows[0]["mechineName"].ToString(), dt3.Rows[0]["lastReqTime"].ToString().Substring(11, 5), dt3.Rows[0]["temperture"].ToString());
                    }
                    if (d22.Rows.Count > 0 && d22.Rows[0]["linkphone"].ToString() != "")
                    {
                        OperUtil.sendMessage3(d22.Rows[0]["linkphone"].ToString(), dt3.Rows[0]["mechineName"].ToString(), dt3.Rows[0]["lastReqTime"].ToString().Substring(11, 5), dt3.Rows[0]["temperture"].ToString());
                    }
                    string sqlupdate = "update asm_mechine set sendT=0 where id=" + dt3.Rows[0]["id"].ToString();
                    DbHelperSQL.ExecuteSql(sqlupdate);
                }
                catch (Exception ex)
                {
                    OperUtil.Debuglog("cuowu=" + ex.Message, "短信_.txt");
                }
            }
        }