public void myTimer_ElapsedT(object source, ElapsedEventArgs e) { //发送温度异常短信 // string sqlT3 = "select * from asm_mechine where sendT=1 and lastReqTime is not null and id not in (68,69)"; 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.sendMessage3(d21.Rows[0]["linkphone"].ToString(), dt3.Rows[i]["mechineName"].ToString(), dt3.Rows[i]["lastReqTime"].ToString().Substring(11, 5), dt3.Rows[i]["temperture"].ToString()); } if (d22.Rows.Count > 0 && d22.Rows[0]["linkphone"].ToString() != "") { OperUtil.sendMessage3(d22.Rows[0]["linkphone"].ToString(), dt3.Rows[i]["mechineName"].ToString(), dt3.Rows[i]["lastReqTime"].ToString().Substring(11, 5), dt3.Rows[i]["temperture"].ToString()); } string sqlupdate = "update asm_mechine set sendT=0 where id=" + dt3.Rows[i]["id"].ToString(); DbHelperSQL.ExecuteSql(sqlupdate); } catch (Exception ex) { OperUtil.Debuglog("cuowu=" + ex.Message, "短信_.txt"); } } } //更新活动有效期 是否启用 string update1 = "update asm_activity set statu=0 where startTime is not null and endTime is not null and endTime<GETDATE()"; string update2 = "update asm_activity set statu=1 where startTime is not null and endTime is not null and GETDATE()>startTime and GETDATE()<endTime"; string update3 = "update asm_pay_activity set statu=0 where startTime is not null and endTime is not null and endTime<GETDATE()"; string update4 = "update asm_pay_activity set statu=1 where startTime is not null and endTime is not null and GETDATE()>startTime and GETDATE()<endTime"; string update5 = "update asm_zfbhb set status=0 where startTime is not null and endTime is not null and endTime<GETDATE()"; string update6 = "update asm_zfbhb set status=1 where startTime is not null and endTime is not null and GETDATE()>startTime and GETDATE()<endTime"; List <string> list = new List <string>(); list.Add(update1); list.Add(update2); list.Add(update3); list.Add(update4); list.Add(update5); list.Add(update6); DbHelperSQL.ExecuteSqlTran(list); string start = DateTime.Now.ToString("yyyy-MM-dd 00:00:00"); string end = DateTime.Now.ToString("yyyy-MM-dd 23:59:59"); calInComeTJ(start, end); }
public void myTimer_Elapsed(object source, ElapsedEventArgs e) { checkSellDetail(); checkOrderDetail(); //发送离线短信 string sql2 = "select *,DATEDIFF(MI,convert(datetime,lastReqTime),getdate()) last from asm_mechine where DATEDIFF(MI,convert(datetime,lastReqTime),getdate())>5 and statu=0 and sendF!=1"; DataTable d2 = DbHelperSQL.Query(sql2).Tables[0]; string sql1 = "update asm_mechine set statu=1,brokenTime='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' where DATEDIFF(MI,convert(datetime,lastReqTime),getdate())>5 and statu=0"; DbHelperSQL.ExecuteSql(sql1); if (d2.Rows.Count > 0) { for (int i = 0; i < d2.Rows.Count; i++) { string sql3 = "insert into asm_mechine_statu (mechineID,breakID,time,statu) values(" + d2.Rows[i]["id"].ToString() + ",2,'" + DateTime.Now + "',0)"; DbHelperSQL.ExecuteSql(sql3); //发短信 try { string sql21 = "select linkphone from asm_opera where id='" + d2.Rows[i]["dls"].ToString() + "'"; string sql22 = "select linkphone from asm_company where id='" + d2.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.Debuglog("d21.Rows.Count=" + d21.Rows.Count + ";phone=" + d21.Rows[0]["linkphone"].ToString(), "短信_.txt"); OperUtil.sendMessage1(d21.Rows[0]["linkphone"].ToString(), d2.Rows[i]["mechineName"].ToString(), d2.Rows[i]["last"].ToString()); } if (d22.Rows.Count > 0 && d22.Rows[0]["linkphone"].ToString() != "") { OperUtil.sendMessage1(d22.Rows[0]["linkphone"].ToString(), d2.Rows[i]["mechineName"].ToString(), d2.Rows[i]["last"].ToString()); } string sqlupdate = "update asm_mechine set sendF=1 where id=" + d2.Rows[i]["id"].ToString(); DbHelperSQL.ExecuteSql(sqlupdate); } catch (Exception ex) { OperUtil.Debuglog("cuowu=" + ex.Message, "短信_.txt"); } } } }
/// <summary> /// 2019-09-04发送会员公众号通知 /// </summary> public void getProductbg() { string sqlc = "select * from asm_company"; DataTable dc1 = DbHelperSQL.Query(sqlc).Tables[0]; if (dc1.Rows.Count > 0) { String time1 = DateTime.Now.ToString("HH:mm"); for (int k = 0; k < dc1.Rows.Count; k++) { if (time1 == dc1.Rows[k]["p3"].ToString()) { string sql6 = "select b.mechineName,a.* from asm_orderlistDetail a left join asm_mechine b on a.mechineid = b.id where a.createTime = '" + DateTime.Now.ToString("yyyy-MM-dd") + "' and a.zt = 4 and a.companyID = " + dc1.Rows[k]["id"].ToString(); OperUtil.Debuglog("定时执行正在执行" + sql6, "_tongzhi.txt"); DataTable dd6 = DbHelperSQL.Query(sql6).Tables[0]; if (dd6.Rows.Count > 0) { for (int i = 0; i < dd6.Rows.Count; i++) { string sqlM = "select * from asm_member where id=" + dd6.Rows[i]["memberID"].ToString(); OperUtil.Debuglog("定时执行正在执行" + sqlM, "_tongzhi.txt"); DataTable dm = DbHelperSQL.Query(sqlM).Tables[0]; if (dm.Rows.Count > 0) { wxHelper wx = new wxHelper(dd6.Rows[i]["companyID"].ToString()); string data = TemplateMessage.getProduct(dm.Rows[0]["openID"].ToString(), OperUtil.getMessageID(dd6.Rows[i]["companyID"].ToString(), "OPENTM407685552"), "亲爱的会员,您今日订购的商品还未取货", "" + dd6.Rows[i]["code"].ToString() + "", "" + dd6.Rows[i]["mechineName"].ToString() + "", "请及时取件,否则第二天会自动失效处理"); TemplateMessage.SendTemplateMsg(wx.IsExistAccess_Token(dd6.Rows[i]["companyID"].ToString()), data); OperUtil.insertNotice(dm.Rows[0]["id"].ToString(), "待取货通知", "您今日订购的商品还未取货,请您及时取货否则第二天作失效处理,请前往指定的售卖机取货,取货码:" + dd6.Rows[i]["code"].ToString()); } } } } //定时检测限时特价 // clearXSTJ(dc1.Rows[k]["id"].ToString()); } } }