public BasicResponse <DataTable> GetAllGraphPoint(GetAllGraphPointRequest graphicsbaseinfrequest)
        {
            var responsestr = HttpClientHelper.Post(Webapi + "/v1/graphicsbaseinf/getallgraphpoint?token=" + Token, JSONHelper.ToJSONString(graphicsbaseinfrequest));

            return(JSONHelper.ParseJSONString <BasicResponse <DataTable> >(responsestr));
        }
        /// <summary>
        /// 获取图形中的所有测点列表
        /// </summary>
        /// <param name="graphicsbaseinfrequest"></param>
        /// <returns></returns>
        public BasicResponse <DataTable> GetAllGraphPoint(GetAllGraphPointRequest graphicsbaseinfrequest)
        {
            var response = new BasicResponse <DataTable>();

            if (string.IsNullOrWhiteSpace(graphicsbaseinfrequest.GraphId) || string.IsNullOrWhiteSpace(graphicsbaseinfrequest.Type))
            {
                response.Code    = -100;
                response.Message = "参数错误!";
                return(response);
            }
            try
            {
                var graphicsrouteinfData = _Repository.GetAllGraphPoint(graphicsbaseinfrequest.GraphId);

                DataTable dtRvalue = new DataTable();
                dtRvalue.TableName = "getAllGraphPoint";
                dtRvalue           = graphicsrouteinfData.Clone();
                DataRow[] drRval;
                switch (graphicsbaseinfrequest.Type)
                {
                case "0":    //所有测点
                    dtRvalue = graphicsrouteinfData.Copy();
                    break;

                case "1":    //分站
                    drRval = graphicsrouteinfData.Select("type='0'", "Point asc");
                    foreach (DataRow dr in drRval)
                    {
                        dtRvalue.Rows.Add(dr.ItemArray);
                    }
                    break;

                case "2":    //所有传感器
                    drRval = graphicsrouteinfData.Select("type>0 and type<10", "Point asc");
                    foreach (DataRow dr in drRval)
                    {
                        dtRvalue.Rows.Add(dr.ItemArray);
                    }
                    break;

                case "3":    //交换机
                    drRval = graphicsrouteinfData.Select("type='10'", "Point asc");
                    foreach (DataRow dr in drRval)
                    {
                        if (dr["Point"].ToString().Contains(".") || dr["Point"].ToString().ToLower().Contains("com"))
                        {
                            dtRvalue.Rows.Add(dr.ItemArray);
                        }
                    }
                    break;

                case "4":    //开关量
                    drRval = graphicsrouteinfData.Select("type='2'", "Point asc");
                    foreach (DataRow dr in drRval)
                    {
                        dtRvalue.Rows.Add(dr.ItemArray);
                    }
                    break;

                case "5":    //模拟量
                    drRval = graphicsrouteinfData.Select("type='1'", "Point asc");
                    foreach (DataRow dr in drRval)
                    {
                        dtRvalue.Rows.Add(dr.ItemArray);
                    }
                    break;

                case "6":    //控制量
                    drRval = graphicsrouteinfData.Select("type='3'", "Point asc");
                    foreach (DataRow dr in drRval)
                    {
                        dtRvalue.Rows.Add(dr.ItemArray);
                    }
                    break;

                case "7":    //开关量及控制量
                    drRval = graphicsrouteinfData.Select("type='3' or type='2'", "Point asc");
                    foreach (DataRow dr in drRval)
                    {
                        dtRvalue.Rows.Add(dr.ItemArray);
                    }
                    break;

                default:
                    break;
                }
                response.Data = dtRvalue;
            }
            catch (Exception ex)
            {
                response.Code    = -100;
                response.Message = ex.Message;
                this.ThrowException("GetMapPointsInfo-获取图形对应测点绑定信息", ex);
            }

            return(response);
        }
Ejemplo n.º 3
0
 public BasicResponse <DataTable> GetAllGraphPoint(GetAllGraphPointRequest graphicsbaseinfrequest)
 {
     return(graphicsbaseinfService.GetAllGraphPoint(graphicsbaseinfrequest));
 }