//获取光纤实时数据--生成暂态曲线 public ActionResult Getrtmdatatemp(int did, DateTime rectime) { try { string tabname = "t_dts_sm_hisdata_tempdata_" + did.ToString("0000"); string strsql = " select channelsinfoid id,pv text from " + tabname + " where rectime<='" + rectime + "' order by rectime desc LIMIT 0,1"; List <DDLValue> list = SQLtoDataSet.GetMySqlList(strsql); string strTemp = "", strJson = ""; if (list.Count > 0) { strTemp = list[0].text; //strTemp = GZipCompressHelper.Decompress(strTemp).TrimEnd(','); } if (!strTemp.Equals("")) { //点数 strJson = strTemp.Substring(0, strTemp.IndexOf(',')); //点数+通道+时间 strTemp = strTemp.Substring(27); } return(Content(strJson + "|" + strTemp)); } catch (Exception ex) { return(Content("error")); } }
//获取光纤设备 public ActionResult GetDevicesinfo() { //string pdrlist = CurrentUser.PDRList; string pdrlist = HomeController.GetPID(CurrentUser.UNITList); string query = "1=1";// devicesinfoid in (" + pdrlist + ")"; string strsql = " select devicesinfoid id,dname text from t_dts_bi_devicesinfo where " + query; List <DDLValue> list = SQLtoDataSet.GetMySqlList(strsql); string strJson = Common.ComboboxToJson(list); return(Content(strJson)); }
//获取光纤设备名称 public ActionResult GetDeviceName(int pid) { string strsql = " select devicesinfoid id,dname text from t_dts_bi_devicesinfo where devicesinfoid=" + pid; List <DDLValue> list = SQLtoDataSet.GetMySqlList(strsql); string dname = ""; if (list.Count > 0) { dname = list[0].text; } return(Content(dname)); }
//获取光纤通道分区 public ActionResult Getchannelzone(int pid = 1, int did = 1, int showall = 0) { string strsql = " select zoneno id,zonename text from t_dts_bi_channelzone where channelsinfoid=" + did + " and devicesinfoid=" + pid; List <DDLValue> list = SQLtoDataSet.GetMySqlList(strsql); string strJson = Common.ComboboxToJson(list); if (showall > 0) { strJson = AddShowAll(list.Count, strJson, "id", "text"); } return(Content(strJson)); }
//保存测点对照表 public ActionResult SavePointmapdts(t_cm_pointmapdts model) { string result = "OK", strsql = ""; //新增 try { List <t_cm_pointmapdts> list2 = bll.t_cm_pointmapdts.Where(p => p.devicesinfoid == model.devicesinfoid && p.channelsinfoid == model.channelsinfoid && p.zoneno == model.zoneno && p.parentid == 0).ToList(); if (list2.Count == 0 || list2[0].tagid == model.tagid)//判断纤分区已分配是否已经分配 { List <t_cm_pointmapdts> list = bll.t_cm_pointmapdts.Where(p => p.tagid == model.tagid).ToList(); if (list.Count > 0)//修改 { strsql = " select beginIndex id,endIndex text from t_dts_bi_channelzone where zoneno=" + model.zoneno + " and channelsinfoid=" + model.channelsinfoid + " and devicesinfoid=" + model.devicesinfoid; List <DDLValue> listzone = SQLtoDataSet.GetMySqlList(strsql); int startPt = 0, endPt = 0; if (listzone.Count > 0) { startPt = listzone[0].id; endPt = Convert.ToInt32(listzone[0].text); } strsql = "update t_cm_pointmapdts set startPt=" + startPt + ",endPt=" + endPt + ",devicesinfoid=" + model.devicesinfoid + ", dname='" + model.dname + "',channelsinfoid=" + model.channelsinfoid + ",cname='" + model.cname + "',zonename='" + model.zonename + "',zoneno=" + model.zoneno + " where tagid=" + model.tagid; bll.ExecuteStoreCommand(strsql, null); Common.InsertLog("光纤分区对照管理", CurrentUser.UserName, "修改光纤分区对照[测点ID:" + model.tagid + "]"); } else { strsql = "insert into t_cm_pointmapdts values(" + model.pid + "," + model.did + "," + model.tagid + "," + model.devicesinfoid + ",'" + model.dname + "'," + model.channelsinfoid + ",'" + model.cname + "'," + model.zoneno + ",'" + model.zonename + "')"; bll.ExecuteStoreCommand(strsql, null); Common.InsertLog("光纤分区对照管理", CurrentUser.UserName, "新增光纤分区对照[定位点ID:" + model.tagid + "]"); } } else { result = "该光纤分区已分配,请从新分配!"; } } catch (Exception ex) { result = strsql; } return(Content(result)); }