public ActionResult DataTypeParamsByCircuit(int pid, int did, int cid, int DataType = 0) { string sqlstr = ""; if (cid > 0) { sqlstr = " and cid = " + cid; } if (DataType > 0) { sqlstr += " and DataTypeID = " + DataType; } //string strsql = "select CID,Cname,DTID,DID,TagID,TagName,CateName,TypeName,PID,PName,DeviceName,PV,Position,cast(REPLACE(DataTypeID,24,1) as int) " //+"DataTypeID,AlarmStatus,Units,Remarks,DeviceTypeName,ABCID,OrderBy,RecTime,中文描述 from V_DeviceInfoState_PDR1 where pid=" + pid + " and did=" + did + sqlstr + " and DataTypeID!=23 order by DataTypeID"; string strsql = string.Format("select TagID,TagName,PName,a.CID,b.CName,c.DID,c.PID,c.PName,c.DeviceName,a.DataTypeID,CateName" + ",c.OrderBy,ABCID,a.Remarks,a.Position,d.Name as TypeName, d.OrderNo,c.DTID,e.Name AS DeviceTypeName" + ",CAST(-9999.0 as float) as PV,'固定描述' as 中文描述,'--' as Units,'正常' as AlarmStatus,cast('1999-01-01' as datetime) as RecTime from (" + "(select tagID,TagName,CID,PID,cast(REPLACE(DataTypeID,24,1) as int) DataTypeID,ABCID,Remarks,Position from t_CM_PointsInfo where PID={0} and DataTypeID!=23 {1} ) 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 " + " left join t_CM_ValueType d on d.DataTypeID=a.DataTypeID " + " left join t_CM_DeviceType e on c.DTID=e.DTID ) order by a.DataTypeID", pid, sqlstr); List <V_DeviceInfoState_PDR1> list = bll.ExecuteStoreQuery <V_DeviceInfoState_PDR1>(strsql).ToList(); string strJson = ""; if (list.Count > 0) { strJson = ComboTree.GetDataTypeComboTree(list); } //strJson = "[{\"id\":2,\"text\":\"yundong\",\"children\":[{\"id\":3,\"text\":\"zuqiu\"},{\"id\":4,\"text\":\"lanqiu\"}]},{\"id\":7,\"text\":\"xueli\",\"children\":[{\"id\":8,\"text\":\"dazhuan\"},{\"id\":9,\"text\":\"benke\"}]}]"; return(Content(strJson)); }
public ActionResult DataTypeParams(int pid, int did, int DataType = 0) { string sqlstr = ""; if (DataType > 0) { sqlstr = " and DataTypeID = " + DataType; } string strsql = "select CID,Cname,DTID,DID,TagID,TagName,CateName,TypeName,PID,PName,DeviceName,PV,Position,cast(REPLACE(DataTypeID,24,1) as int) DataTypeID,AlarmStatus,Units,Remarks,DeviceTypeName,ABCID,OrderBy,RecTime,中文描述 from V_DeviceInfoState_PDR1 where pid=" + pid + " and did=" + did + sqlstr + " and DataTypeID!=23 order by DataTypeID"; List <V_DeviceInfoState_PDR1> list = bll.ExecuteStoreQuery <V_DeviceInfoState_PDR1>(strsql).ToList(); string strJson = ComboTree.GetDataTypeComboTree(list); //strJson = "[{\"id\":2,\"text\":\"yundong\",\"children\":[{\"id\":3,\"text\":\"zuqiu\"},{\"id\":4,\"text\":\"lanqiu\"}]},{\"id\":7,\"text\":\"xueli\",\"children\":[{\"id\":8,\"text\":\"dazhuan\"},{\"id\":9,\"text\":\"benke\"}]}]"; return(Content(strJson)); }