/// <summary> /// 发送LED信息 /// </summary> /// <param name="regionCode"></param> /// <param name="content"></param> public RetMsgModel SendLEDMessage(string regionCode, int location, string content) { try { RetMsgModel retModel = new RetMsgModel(); LEDMsgModel ledMsgModel = new LEDMsgModel(); ledMsgModel.message = content; ledMsgModel.regionCode = regionCode; ledMsgModel.type = location; //确警前默认中控室,确警后默认该园区户外LED string param = CSM.Utils.JsonHelper.ObjectToString(ledMsgModel); string url = System.Configuration.ConfigurationManager.AppSettings["InterfaceUrl"] + "/api/Interface/LEDControlCommand"; string ret = Utils.HttpHelper.PostWebRequestBandError(url, param, "application/json;charset=utf-8", Encoding.UTF8); if (string.IsNullOrEmpty(ret)) { retModel.status = 1; retModel.message = "调用中间件LED接口返回值为空!"; } else { retModel = Utils.JsonHelper.StringToObject <RetMsgModel>(ret); } return(retModel); } catch (Exception ex) { throw ex; } }
/// <summary> /// 处理LED报警信息 /// </summary> /// <param name="deviceInfo"></param> /// <param name="alarmRecord"></param> public bool HandleLedItem(string message, string regionCode) { try { // message = GetAlarmText(); if (!string.IsNullOrEmpty(message)) { LEDMsgModel ledMsg = new LEDMsgModel(); ledMsg.message = message; ledMsg.type = (int)EnumClass.PlanHandleTime.确警前; ledMsg.regionCode = regionCode; string msg = JsonHelper.ObjectToString(ledMsg); string url = SubSystemRouteBLL.GetLedControlRoute(); // HttpHelper.PostJsonData(url, msg, Encoding.UTF8); sendLedCmdDele.BeginInvoke(url, msg, Encoding.UTF8, null, null); Log4NetHelp.Info("调用LED接口成功!信息:" + msg); return(true); } else { Log4NetHelp.Info("待发送至LED信息为空!"); return(false); } } catch (Exception ex) { message = ""; Log4NetHelp.Info("调用LED接口失败!" + ex.Message); return(false); } }