Example #1
0
        /// <summary>
        /// 料道异常的时候发送短信
        /// </summary>
        /// <param name="mechineID"></param>
        public static void sendMsgWhenLDError(string mechineID, string ldNO)
        {
            string    sqlT3 = "select * from asm_mechine where id=" + mechineID;
            DataTable dt3   = DbHelperSQL.Query(sqlT3).Tables[0];

            if (dt3.Rows.Count > 0)
            {
                for (int i = 0; i < dt3.Rows.Count; i++)
                {
                    try
                    {
                        string    sql21 = "select linkphone from asm_opera where id='" + dt3.Rows[i]["operaID"].ToString() + "'";
                        string    sql22 = "select linkphone from asm_company where id='" + dt3.Rows[i]["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.sendMessage4(d21.Rows[0]["linkphone"].ToString(), dt3.Rows[0]["mechineName"].ToString(), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss").Substring(11, 5), ldNO);
                        }
                        if (d22.Rows.Count > 0 && d22.Rows[0]["linkphone"].ToString() != "")
                        {
                            OperUtil.sendMessage4(d22.Rows[0]["linkphone"].ToString(), dt3.Rows[0]["mechineName"].ToString(), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss").Substring(11, 5), ldNO);
                        }
                    }
                    catch (Exception ex)
                    {
                        OperUtil.Debuglog("cuowu=" + ex.Message, "料道异常短信_.txt");
                    }
                }
            }
        }
Example #2
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");
                }
            }
        }
Example #3
0
        //之前用的减料道库存的方法
        public static string update_addLDKC(string mechineID, string ldNO)
        {
            string    sql = "select * from asm_ldinfo where ldNO='" + ldNO + "' and mechineID=" + mechineID;
            DataTable dt  = DbHelperSQL.Query(sql).Tables[0];

            if (dt.Rows.Count > 0 && int.Parse(dt.Rows[0]["ld_productNum"].ToString()) > 0)
            {
                string sql1 = "update asm_ldInfo set ld_productNum=ld_productNum+1,lastUpTime='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' where ldNO='" + ldNO + "' and mechineID=" + mechineID;
                OperUtil.Debuglog("sql1=" + sql1, "更新料道库存_.txt");
                int a = DbHelperSQL.ExecuteSql(sql1);
                if (a > 0)
                {
                    return("1");
                }
                else
                {
                    return("0");
                }
            }
            return("0");
        }