public override void Run() { string strsql = "exec usp_rims_sms_notifypat @cxlb=0"; DataTable dt = GlobalInstanceManager <GlobalSqlManager> .Intance.GetDataTable(this.Cur_Job.dbtype, this.Cur_Job.dbstring, strsql); if (dt == null || dt.Rows.Count <= 0) { return; } var list = dt.AsEnumerable().GroupBy(a => new { lxdh = a["lxdh"].ToString() }). Select(a => new { lxdh = a.Key.lxdh, list = a.ToList() }); foreach (var item in list) { HaSmsMessage msg = new HaSmsMessage(); SendPara para = new SendPara(); para.recive = new List <string>(); para.contentMap.content = "请合理安排到院治疗时间,厦门弘爱康复医院关心您! 注意:因疫情防控需要,厦门弘爱康复医院治疗中心(综合楼3楼)实行封闭管理,长期门诊康复治疗患者持15天内核酸报告进入治疗。家属陪护谢绝入内,感谢您的支持和理解,祝您早日康复!"; para.recive.Add(item.lxdh); msg.alermMsgInfo.Add(para); string result = this.PostRequest(JsonConvert.SerializeObject(msg)); Log4netUtil.Info("作业【" + this.Cur_Job.name + "】返回值" + result); HaResult r = JsonConvert.DeserializeObject <HaResult>(result); if (r != null && r.code == "0") { strsql = "exec usp_rims_sms_notifypat @cxlb=1,@txxh='" + string.Join(",", item.list.Select(a => a["xh"].ToString())) + "'"; DataTable redt = GlobalInstanceManager <GlobalSqlManager> .Intance.GetDataTable(this.Cur_Job.dbtype, this.Cur_Job.dbstring, strsql); } } }
private void SendDatasThread() { int i, j; SendPara send = send_que.Dequeue(); for (i = 0; i < send.times; i++) { Send(send.buf, send.len); for (j = 0; j < send.to / 2; j++) { Thread.Sleep(2); //超时时间. if (send.cmd == rec_cmd.rec || send.cmd == rec_cmd.store || send.times == 1) //如果已经接收到相应的命令回应,则退出重发. { return; } } } }
public void SendCommand(byte cmd, byte[] buf, byte len, int to, int times) { SendPara send = new SendPara(); CmdPack(cmd, buf, len, ref send.buf); send.cmd = cmd; send.len = (byte)(len + 6); send.to = to; send.times = times; send_que.Enqueue(send); if (send.cmd == rec_cmd.rec) //重置rec_cmd. { rec_cmd.rec = 0; } if (send.cmd == rec_cmd.store) { rec_cmd.store = 0; } tSend = new Thread(SendDatasThread); tSend.Start(); }