public ActionResult Add(WellModel model) { model.CreateTime = DateTime.Now; model.CreateUserId = Operator.UserId; model.UpdateTime = DateTime.Now; model.UpdateUserId = Operator.UserId; var result = WellService.AddWell(model) ? SuccessTip("添加成功") : ErrorTip("添加失败"); return(Json(result)); }
public JsonResult Delete(int id) { if (WellOrganizeServer.DeleteByWellId(id)) { var result = WellService.DeleteById(id) ? SuccessTip("删除成功") : ErrorTip("删除失败"); return(Json(result, JsonRequestBehavior.AllowGet)); } else { var result = ErrorTip("删除失败"); return(Json(result, JsonRequestBehavior.AllowGet)); } }
public ActionResult Edit(WellModel model) { string sid = model.IO_ServerID.Split('/')[0]; string cid = model.IO_ServerID.Split('/')[1]; model.IO_ServerID = sid; model.IO_CommunicateID = cid; model.UpdateTime = DateTime.Now; model.UpdateUserId = Operator.UserId; var result = WellService.UpdateById(model) ? SuccessTip("修改成功") : ErrorTip("修改失败"); return(Json(result)); }
public ActionResult Browser(int id) { var model = WellService.GetById(id); model.IO_ServerID = model.IO_ServerID + "/" + model.IO_CommunicateID; IEnumerable <WellOrganizeModel> wos = WellOrganizeServer.GetListByWellId(id); foreach (var w in wos) { model.OrganizeId = w.OrganizeId; } return(View(model)); }
public override ActionResult Index(int?id) { WellScadaAlarmModel pageModel = new WellScadaAlarmModel(); var Wells = WellService.GetAll(null, null).ToList(); List <string> dids = new List <string>(); foreach (var item in Wells) { dids.Add(item.IO_DeviceID); } pageModel.JsonWells = string.Join(",", dids.ToArray()); base.Index(id); return(View(pageModel)); }
public JsonResult GetOrganizeWells(int OrganizeId = 0) { string oidList = OrganizeService.GetOrganizeNodeChildren(OrganizeId); IEnumerable <WellModel> Items = WellService.GetListObjectByOrganize(oidList); List <SelectOption> _select = new List <SelectOption>(); if (Items != null && Items.Count() > 0) { foreach (var item in Items) { SelectOption _option = new SelectOption { id = item.IO_DeviceID.ToString(), name = item.WellName, value = item.IO_DeviceID.ToString() }; _select.Add(_option); } } return(Json(_select, JsonRequestBehavior.AllowGet)); }
public JsonResult GetWells(int OrganizeId = 0) { IEnumerable <WellModel> Items = WellService.GetListObjectByOrganize(""); return(Json(Items.ToList(), JsonRequestBehavior.AllowGet)); }
public JsonResult QueryWellHistoryAlarm(WellScadaAlarmModel model, PageInfo pageInfo) { List <WellScadaAlarmModel> alarms = new List <WellScadaAlarmModel>(); InfluxDBHistoryResult realResult = null; if (string.IsNullOrEmpty(model.WellID)) { realResult = null; } else { WellModel well = WellService.GetById(int.Parse(model.WellID)); if (well != null) { realResult = mWebInfluxDbManager.DbQuery_Alarms(well.IO_ServerID, well.IO_CommunicateID, well.IO_DeviceID, Convert.ToDateTime(model.StartDate), Convert.ToDateTime(model.EndDate), model.IO_ALARM_TYPE, model.IO_ALARM_LEVEL, pageInfo.limit, pageInfo.page); } } if (realResult != null && realResult.Seres.Count() > 0) { var s = realResult.Seres.First(); for (int i = 0; i < s.Values.Count; i++) { WellScadaAlarmModel mymodel = new WellScadaAlarmModel(); int index = s.Columns.IndexOf("time"); object time = s.Values[i][index]; mymodel.time = time != null?time.ToString() : ""; index = -1; index = s.Columns.IndexOf("field_io_alarm_date"); if (index >= 0) { object v = s.Values[i][index]; mymodel.IO_ALARM_DATE = v != null?v.ToString() : ""; } index = -1; index = s.Columns.IndexOf("field_io_alarm_disposalidea"); if (index >= 0) { object v = s.Values[i][index]; mymodel.IO_ALARM_DISPOSALIDEA = v != null?v.ToString() : ""; } index = -1; index = s.Columns.IndexOf("field_io_alarm_disposaluser"); if (index >= 0) { object v = s.Values[i][index]; mymodel.IO_ALARM_DISPOSALUSER = v != null?v.ToString() : ""; } index = -1; index = s.Columns.IndexOf("field_io_alarm_level"); if (index >= 0) { object v = s.Values[i][index]; mymodel.IO_ALARM_LEVEL = v != null?v.ToString() : ""; } index = -1; index = s.Columns.IndexOf("field_io_alarm_type"); if (index >= 0) { object v = s.Values[i][index]; mymodel.IO_ALARM_TYPE = v != null?v.ToString() : ""; } index = -1; index = s.Columns.IndexOf("field_io_alarm_value"); if (index >= 0) { object v = s.Values[i][index]; mymodel.IO_ALARM_VALUE = v != null?v.ToString() : ""; } index = -1; index = s.Columns.IndexOf("field_io_label"); if (index >= 0) { object v = s.Values[i][index]; mymodel.IO_LABEL = v != null?v.ToString() : ""; } index = -1; index = s.Columns.IndexOf("field_io_name"); if (index >= 0) { object v = s.Values[i][index]; mymodel.IO_NAME = v != null?v.ToString() : ""; } index = -1; index = s.Columns.IndexOf("tag_did"); if (index >= 0) { object v = s.Values[i][index]; mymodel.IO_DEVICE_ID = v != null?v.ToString() : ""; } index = -1; index = s.Columns.IndexOf("tag_cid"); if (index >= 0) { object v = s.Values[i][index]; mymodel.IO_COMMUNICATE_ID = v != null?v.ToString() : ""; } index = -1; index = s.Columns.IndexOf("tag_sid"); if (index >= 0) { object v = s.Values[i][index]; mymodel.IO_SERVER_ID = v != null?v.ToString() : ""; } index = -1; index = s.Columns.IndexOf("tag_ioid"); if (index >= 0) { object v = s.Values[i][index]; mymodel.IO_ID = v != null?v.ToString() : ""; } index = -1; index = s.Columns.IndexOf("tag_device_name"); if (index >= 0) { object v = s.Values[i][index]; mymodel.DEVICE_NAME = v != null?v.ToString() : ""; } alarms.Add(mymodel); } } var result = Pager.Paging(alarms, realResult.RecordCount); //读取以下10行的实时数据,从influxDB中读取 return(Json(result, JsonRequestBehavior.AllowGet)); }
public JsonResult List(WellModel model, PageInfo pageInfo) { var result = WellService.GetListByFilter(model, pageInfo); return(Json(result, JsonRequestBehavior.AllowGet)); }