Exemplo n.º 1
0
        /// <summary>
        /// 获取支路包含的所有参数
        /// </summary>
        /// <param name="buildId"></param>
        /// <param name="energyCode"></param>
        /// <param name="circuitID"></param>
        /// <returns></returns>
        public HistoryParamViewModel GetViewModel(string buildId, string circuitID)
        {
            List <MeterParam> meterParamList = context.GetMeterParam(buildId, circuitID);
            string            startTime      = DateTime.Now.ToString("yyyy-MM-dd");

            //获取仪表参数ID,并传入GetParamValue中获取其数据
            List <string> paramIDs = new List <string>();;

            foreach (var pID in meterParamList)
            {
                paramIDs.Add(pID.ParamID);
            }

            List <HistoryParameterValue> parameterValue = context.GetParamValue(circuitID, paramIDs.ToArray(), startTime, 5);

            HistoryParamViewModel viewMode = new HistoryParamViewModel();

            //viewMode.MeterParam = meterParamList;
            viewMode.Data = parameterValue;

            return(viewMode);
        }
Exemplo n.º 2
0
        public void TestGetHistoryPramaValue()
        {
            HistoryParamDbContext context = new HistoryParamDbContext();

            DateTime today = DateTime.Now;
            string circuitIDs = "000001G0010001,000001G0010002,000001G0010003,000001G0010004,000001G0010005";
            string circuitID = "000001G0010001";
            string[] ids = circuitIDs.Split(',');

            string circuitPrame = "31000000000711,31000000000700,31000000000701,31000000000702";
            string[] prame = circuitPrame.Split(',');

            List<HistoryParameterValue> historyParameterValueList = context.GetParamValue(circuitID, prame,today.ToString("yyyy-MM-dd"),60);

            Console.WriteLine(UtilTest.GetJson(historyParameterValueList));
        }
Exemplo n.º 3
0
        /// <summary>
        /// 获取单个支路中的多个参数的值
        /// </summary>
        /// <param name="circuitID"></param>
        /// <param name="meterParamIDs"></param>
        /// <param name="startTime"></param>
        /// <param name="step"></param>
        /// <returns></returns>
        public HistoryParamViewModel GetViewModel(string circuitID, string[] meterParamIDs, string startTime, int step)
        {
            switch (step)
            {
            case 5:
                step = 5;
                break;

            case 10:
                step = 10;
                break;

            case 15:
                step = 15;
                break;

            case 30:
                step = 30;
                break;

            case 60:
                step = 60;
                break;

            default:
                step = 5;
                break;
            }

            List <HistoryParameterValue> parameterValue = context.GetParamValue(circuitID, meterParamIDs, startTime, step);

            HistoryParamViewModel viewMode = new HistoryParamViewModel();

            viewMode.Data = parameterValue;

            return(viewMode);
        }