//配电房与设备列表 combotree public ActionResult PdrDevComboTreeMenuByPID(int pid = 0) { string strJson = "{ }"; string pdrlist = HomeController.GetPID(CurrentUser.UNITList); if (!string.IsNullOrEmpty(pdrlist) && !(pdrlist.Split(',')).Contains(pid.ToString())) { pid = -1; } //string pdrlist = CurrentUser.PDRList; //string strsql = "select * from ( select row_number() over(partition by did order by pid desc) as rownum , * from V_DeviceInfoState_PDR1 where DataTypeID!=23 and pid = " + pid + ") as T where T.rownum = 1 order by pid"; //if (!pdrlist.Equals("")) // strsql = "select * from ( select row_number() over(partition by did order by pid desc) as rownum , * from V_DeviceInfoState_PDR1 where DataTypeID!=23 and pid in (" + pdrlist + ") and pid = "+pid+") as T where T.rownum = 1 order by pid"; if (pid > 0) { string strsql = string.Format("select * from (" + "select row_number() over(partition by c.did order by c.pid desc) as rownum , a.tagID,a.CID,c.DID,c.PID,c.PName,c.DeviceName from " + " (select tagID,CID,PID from t_CM_PointsInfo where PID={0} and DataTypeID!=23) a " + " left join t_DM_CircuitInfo b on a.PID=b.PID and a.CID=b.CID " + " left join t_DM_DeviceInfo c on b.DID=c.DID and c.PID=b.PID ) as t" + " where t.rownum=1", pid); List <YWWeb.PubClass.ComboTree.V_DeviceInfoState> list = bll.ExecuteStoreQuery <YWWeb.PubClass.ComboTree.V_DeviceInfoState>(strsql).ToList(); if (list.Count > 0) { strJson = ComboTree.GetPdrDevComboTree(list); } } return(Content(strJson)); }
//配电房与设备列表 combotree public ActionResult PdrDevComboTreeMenu() { string pdrlist = HomeController.GetPID(CurrentUser.UNITList); //string pdrlist = CurrentUser.PDRList; string strsql = "select * from ( select row_number() over(partition by did order by pid desc) as rownum , * from V_DeviceInfoState_PDR1 where DataTypeID!=23) as T where T.rownum = 1 order by pid"; if (!pdrlist.Equals("")) { strsql = "select * from ( select row_number() over(partition by did order by pid desc) as rownum , * from V_DeviceInfoState_PDR1 where DataTypeID!=23 and pid in (" + pdrlist + ")) as T where T.rownum = 1 order by pid"; } List <V_DeviceInfoState_PDR1> list = bll.ExecuteStoreQuery <V_DeviceInfoState_PDR1>(strsql).ToList(); string strJson = ComboTree.GetPdrDevComboTree(list); return(Content(strJson)); }