private void AddMpArTable(string data, string DevNum) { FireControl_MpArTable_BLL MpBll = new FireControl_MpArTable_BLL(); REG.N6.IFT.TwpFControl.Model.ResultDis <bool> Waterresult = null; FireControl_MpArTable info = new FireControl_MpArTable(); info.AccID = CommHelper.CreatePKID("acc"); info.RawData = data; info.ReportDate = DateTime.MinValue; info.DevNum = DevNum; //保存传入数据 //修改 info.CreateTime = DateTime.Now; //判断是否有这条消息 Waterresult = MpBll.AddObj(info); }
public ResponseJson OCIOTMsg([FromBody] OCIOTModel model) { //暂时去掉该注释 Utility.WriteLog("调我接口了:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "---:" + JsonConvert.SerializeObject(model)); ResponseJson json = null; try { FireControl_MpArTable_BLL MpBll = new FireControl_MpArTable_BLL(); REG.N6.IFT.TwpFControl.Model.ResultDis <bool> Waterresult = null; FireControl_MpArTable info = new FireControl_MpArTable(); info.AccID = CommHelper.CreatePKID("acc"); info.RawData = JsonConvert.SerializeObject(model); info.ReportDate = DateTime.MinValue; //保存传入数据 //修改 //判断是否有这条消息 Waterresult = MpBll.AddObj(info); if (Waterresult.ResultCode == REG.N6.IFT.TwpFControl.Model.ResultCode.Succ) { Utility.WriteLog("数据保存成功:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")); } else { Utility.WriteLog(Waterresult.ResultContent); Utility.WriteLog("传入数据系统生成时间:" + info.RawData); } OCIOTServiceData data = new OCIOTServiceData(); string alamdate = string.Empty; if (model != null) { if (model.service != null) { OCIOTService services = new OCIOTService(); services = model.service; if (services != null) { data = services.data; //事件上报时间 alamdate = services.eventTime; if (!string.IsNullOrEmpty(alamdate)) { string year = alamdate.Substring(0, 4); string month = alamdate.Substring(4, 2); string day = alamdate.Substring(6, 2); string t = alamdate.Substring(8, 1); string hour = alamdate.Substring(9, 2); string minute = alamdate.Substring(11, 2); string second = alamdate.Substring(13, 2); string z = alamdate.Substring(15, 1); alamdate = year + "-" + month + "-" + day + t + hour + ":" + minute + ":" + second + z; } } } } if (data != null) { OCIOTData ociotdata = new OCIOTData(); Utility.WriteLog("数据保存成功报文的内置时间:" + DateTime.Parse(alamdate).ToString("yyyy-MM-dd HH:mm:ss:fff")); ociotdata.GetData(data.rawData, alamdate, info.AccID); } json = new ResponseJson(ResponseCode.Nomal, "成功"); } catch (Exception ex) { Utility.WriteLog(ex.Message); json = new ResponseJson(ResponseCode.Err, "失败"); } return(json); }