Пример #1
0
        public DataTable GetMcData(DateTime SzNameS, DateTime SzNameE, bool flag, string CurrentPointID, string CurrentDevid, string CurrentWzid,
                                   string TimeTick, ref double MaxLC2, ref double MinLC2, ref string maxValueTime, bool isQueryByPoint = false)
        {
            DataTable dtR = new DataTable();

            MaxLC2 = 0;
            MinLC2 = 0;
            //Av监测值,Bv最大值,Cv最小,Dv平均,Ev移动值
            dtR.Columns.Add("A");
            dtR.Columns.Add("B");
            dtR.Columns.Add("Timer");
            dtR.Columns.Add("state");
            dtR.Columns.Add("statetext");
            dtR.Columns.Add("type");
            dtR.Columns.Add("typetext");

            try
            {
                //Dictionary<string, DataTable> Rvalue = ServiceFactory.CreateService<IChartService>().GetMcData(SzNameS, SzNameE, flag, CurrentPointID, CurrentDevid, CurrentWzid, TimeTick);
                var req = new GetMcDataRequest
                {
                    SzNameS        = SzNameS,
                    SzNameE        = SzNameE,
                    flag           = flag,
                    CurrentPointID = CurrentPointID,
                    CurrentDevid   = CurrentDevid,
                    CurrentWzid    = CurrentWzid,
                    TimeTick       = TimeTick,
                    IsQueryByPoint = isQueryByPoint
                };
                var res = _chartService.GetMcData(req);
                if (!res.IsSuccess)
                {
                    throw new Exception(res.Message);
                }
                Dictionary <string, DataTable> Rvalue = res.Data;

                if (Rvalue.Count > 0)
                {
                    Dictionary <string, DataTable> .KeyCollection keyv = Rvalue.Keys;
                    MaxLC2       = double.Parse(keyv.ElementAt(0).Split(',')[0]);
                    MinLC2       = double.Parse(keyv.ElementAt(0).Split(',')[1]);
                    maxValueTime = keyv.ElementAt(0).Split(',')[2];

                    Dictionary <string, DataTable> .ValueCollection value = Rvalue.Values;
                    dtR = value.ElementAt(0);
                }
            }
            catch (Exception Ex)
            {
                LogHelper.Error("McLineQueryClass_GetMcData" + Ex.Message + Ex.StackTrace);
            }

            return(dtR);
        }
        public BasicResponse <Dictionary <string, DataTable> > GetMcData(GetMcDataRequest request)
        {
            Dictionary <string, DataTable> McData = new Dictionary <string, DataTable>();
            var responseStr = HttpClientHelper.Post(Webapi + "/v1/Chart/GetMcData?token=" + Token,
                                                    JSONHelper.ToJSONString(request));
            var res = JSONHelper.ParseJSONString <BasicResponse <Dictionary <string, string> > >(responseStr);

            foreach (KeyValuePair <string, string> kvp in res.Data)
            {
                McData.Add(kvp.Key, ObjectConverter.FromBase64String <DataTable>(kvp.Value));
            }
            return(new BasicResponse <Dictionary <string, DataTable> >
            {
                Data = McData
            });
        }