コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="partner"></param>
        /// <returns></returns>
        public ChartDTO GetTopCustomerChartData(string partner)
        {
            ChartDTO retVal = new ChartDTO();

            try
            {
                DataSet ds = new ProjectDB(Utility.ConfigurationHelper.GPD_Connection).GetTopCustomerChartData(partner);
                if (ds != null && ds.Tables.Count == 1 && ds.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        retVal.Lines.Add(new LinesDTO()
                        {
                            Name   = dr["M_NAME"].ToString(),
                            Dates  = new List <string>(new string[] { "" }),
                            Values = new List <int>(new int[] { Convert.ToInt32(dr["P_COUNT"].ToString()) })
                        });
                    }
                }
            }
            catch (Exception exc)
            {
                log.Error("Unable to get data for top application. ERROR: " + exc.ToString());
            }
            //retVal.Lines.Add(new LinesDTO()
            //{
            //    Name = "Delta",
            //    Values = new List<int>(new int[] { 560 })
            //});
            return(retVal);
        }
コード例 #2
0
        /*
         * // GET: api/values
         * [HttpGet("pdf/{grafico}")]
         *
         * public IActionResult pdf(string grafico, [FromQuery]DateTime? start, [FromQuery]DateTime? end, string filtro, int? id)
         * {
         *  PdfDocument document = null;
         *  string nome = "";
         *  switch (grafico.ToUpper())
         *  {
         *      case "VOLUNTARIODIADASEMANA":
         *          document = PfdVoluntarioDiaDaSemana();
         *              break;
         *      case "DESPESAPORITEMNOPERIODO":
         *          document = PfdDespesaPorItemNoPeriodo(start.Value, end.Value, filtro);
         *          break;
         *      case "DOACOESMENSAISNOPERIODO":
         *          document = PfdDoacoesMensaisNoPeriodo(start.Value, end.Value);
         *          break;
         *      case "DOACOESMENSAISPORDOADORNOPERIODO":
         *          document = PfdDoacoesMensaisPorDoadorNoPeriodo(start.Value, end.Value, id.Value);
         *          break;
         *
         *  }
         *
         *  if (document != null) {
         *      MemoryStream ms = new MemoryStream();
         *      document.Save(ms);
         *      //If the position is not set to '0' then the PDF will be empty.
         *      ms.Position = 0;
         *
         *      //Download the PDF document in the browser.
         *      FileStreamResult fileStreamResult = new FileStreamResult(ms, "application/pdf");
         *      fileStreamResult.FileDownloadName = nome;
         *      return fileStreamResult;
         *  }
         *  return new NoContentResult();
         *
         *
         * }
         *
         * private PdfDocument PfdDoacoesMensaisPorDoadorNoPeriodo(DateTime value1, DateTime value2, int value3)
         * {
         *  throw new NotImplementedException();
         * }
         *
         * private PdfDocument PfdDoacoesMensaisNoPeriodo(DateTime value1, DateTime value2)
         * {
         *  throw new NotImplementedException();
         * }
         *
         * private PdfDocument PfdDespesaPorItemNoPeriodo(DateTime start, DateTime end, string filtro)
         * {
         *  PdfDocument document;
         *  PdfPage page;
         *  Color gray = Color.FromArgb(255, 77, 77, 77);
         *  Color black = Color.FromArgb(255, 0, 0, 0);
         *  Color white = Color.FromArgb(255, 255, 255, 255);
         *  Color violet = Color.FromArgb(255, 151, 108, 174);
         *
         *  var query = from q in _context.Despesa
         *              where q.Tipo == filtro
         *              && q.DataDaCompra >= start && q.DataDaCompra <= end
         *              group q by q.Item into g
         *              orderby g.Key.Nome
         *              select new
         *              {
         *                  item = g.Key,
         *                  valorTotal = g.Sum(v => v.Quantidade * v.ValorUnitario)
         *              };
         *
         *  document = new PdfDocument();
         *
         *
         *  //Setting margin
         *  document.PageSettings.Margins.All = 0;
         *  //Adding a new page
         *  page = document.Pages.Add();
         *  PdfGraphics g = page.Graphics;
         *
         *  //Creating font instances
         *  PdfFont headerFont = new PdfStandardFont(PdfFontFamily.TimesRoman, 35);
         *  PdfFont subHeadingFont = new PdfStandardFont(PdfFontFamily.TimesRoman, 16);
         *
         *
         *
         *
         *
         *
         *
         *
         *
         *
         *
         *  return document;
         *
         * }
         *
         * private PdfDocument PfdVoluntarioDiaDaSemana()
         * {
         *  throw new NotImplementedException();
         * }
         */
        private ChartDTO DespesaPorItemNoPeriodo(DateTime start, DateTime end, string filtro)
        {
            ChartDTO chart = new ChartDTO();
            SerieDTO serie = new SerieDTO()
            {
                Name       = "Despesas",
                Type       = "bar",
                datapoints = new List <IDataPoint>()
            };

            chart.Data.Add(serie);

            var query = from q in _context.Despesa
                        where q.Tipo == filtro &&
                        q.DataDaCompra >= start && q.DataDaCompra <= end
                        group q by q.Item.Nome into g
                        orderby g.Key
                        select new
            {
                item       = g.Key,
                valorTotal = g.Sum(v => v.Quantidade * v.ValorUnitario)
            };

            foreach (var q in query)
            {
                serie.datapoints.Add(new DataPointString()
                {
                    x = q.item,
                    y = q.valorTotal
                });
            }
            return(chart);
        }
コード例 #3
0
        public object Get(int petId)
        {
            var Pet             = db.Pets.Find(petId);
            var Caracacteristic = Pet.Caracteristics.OrderByDescending(x => x.Date).Select(x => new CompareDTO {
                Id     = x.Id,
                Weight = x.Weight,
                Height = x.Height,
                Date   = x.Date
            }).ToList();

            var References = db.References.Where(x => x.BreedId == Pet.BreedId).Select(x => new CompareDTO {
                Id     = x.Id,
                Height = x.RefHeight,
                Weight = x.RefWeight
            }).ToList();
            var result = new ChartDTO();

            result.Caracteristics = Caracacteristic;
            result.References     = References;

            //result.Caracteristic = Caracacteristic.Height;
            //result.Caracteristic = Caracacteristic.Weight;

            //result.Reference = References.RefHeight;
            //result.Reference = References.RefWeight;

            //result.CompareHeight = (result.Caracteristic >= result.Reference && result.Caracteristic <= result.Reference);
            //result.CompareWeight = (result.Caracteristic >= result.Reference && result.Caracteristic <= result.Reference);

            //return result;

            return(result);
        }
コード例 #4
0
        public ChartDTO GetYTDSales()
        {
            var bLbs = DbContext.ADAGIOSalesStatitics.Where(x => x.Date_2.Value.Year > 2016).GroupBy(x => x.Date_2.Value.Month)
                       .Select(lg => new ChartDTO.SeriesPie.dataitem
            {
                ordering = lg.Key,
                name     = lg.Key.ToString(),
                y        = lg.Sum(w => w.GrossSalesAmt != null ? w.GrossSalesAmt.Value : 0)
            }).OrderBy(o => o.ordering).ToArray();

            var seriesData1 = new ChartDTO.SeriesPie
            {
                data  = bLbs.ToArray(),
                color = "rgba(165,170,217,1)",
                name  = "Month",
                yAxis = 0
            };



            ChartDTO.SeriesPie[] seriesarray = new ChartDTO.SeriesPie[1];
            seriesarray[0] = seriesData1;

            //seriesarray[3] = seriesData4;

            var cht = new ChartDTO();

            cht.ChartSeriesPie = seriesarray;


            return(cht);
        }
コード例 #5
0
        public ChartDTO GetAvgSellingPrice()
        {
            var bLbs = DbContext.ADAGIOSalesStatitics.Where(x => x.Date_2.Value.Year > 2016).GroupBy(x => x.Date_2.Value.Month)
                       .Select(lg => new ChartDTO.SeriesDec.dataitem
            {
                ordering = lg.Key,
                name     = lg.Key.ToString(),
                y        = lg.Sum(w => w.GrossSalesAmt != null ? w.GrossSalesAmt.Value : 0) / lg.Sum(w => w.NetQtySold != null && w.NetQtySold != 0 ? w.NetQtySold.Value : 1)
            }).OrderBy(o => o.ordering).ToArray();

            var seriesData1 = new ChartDTO.SeriesDec
            {
                data           = bLbs.ToArray(),
                color          = "rgba(165,170,217,1)",
                name           = "ASP",
                pointPadding   = 0.26M,
                pointPlacement = -0.2M,
                yAxis          = 0
            };



            ChartDTO.SeriesDec[] seriesarray = new ChartDTO.SeriesDec[1];
            seriesarray[0] = seriesData1;

            //seriesarray[3] = seriesData4;

            var cht = new ChartDTO();

            cht.ChartSeriesDec = seriesarray;


            return(cht);
        }
コード例 #6
0
        public List <ChartDTO> TrendChartInfoForDepartment(int DepartmentId, int CategoryId, int StationeryId)
        {
            List <RequisitionDetail>     RequisitionDetailsList = requisitionDetailRepo.GetRequisitionDetailsByDepartmentIdByCategoryIdByStationeryId(DepartmentId, CategoryId, StationeryId);
            IEnumerable <SupplierTender> SupplierTendersList    = supplierTenderRepo.FindBy(x => x.StationeryId == StationeryId);
            List <ChartDTO> chartDTOs = new List <ChartDTO>();

            foreach (RequisitionDetail rdl in RequisitionDetailsList)
            {
                foreach (SupplierTender st in SupplierTendersList)
                {
                    if (rdl.StationeryId == st.StationeryId && rdl.Stationery.CategoryId == CategoryId && rdl.StationeryId == StationeryId && rdl.Requisition.Employee.DepartmentId == DepartmentId)
                    {
                        ChartDTO chartDTO = new ChartDTO()
                        {
                            RequisitionDetailId               = rdl.Id,
                            RequisitionId                     = rdl.RequisitionId,
                            RequisitionStationeryId           = rdl.StationeryId,
                            RequisitionQuantityOrdered        = rdl.QuantityOrdered,
                            RequisitionQuantityDelivered      = rdl.QuantityDelivered == null ? 0 : (int)rdl.QuantityDelivered,
                            RequisitionDateTime               = rdl.Requisition.DateTime,
                            RequisitionEmployeeDepartmentId   = rdl.Requisition.Employee.DepartmentId,
                            RequisitionEmployeeDepartmentName = rdl.Requisition.Employee.Department.DepartmentName,
                            RequisitionEmployeeId             = rdl.Requisition.EmployeeId,
                            RequisitionEmployeeName           = rdl.Requisition.Employee.Name,
                            RequisitionStationeryCategoryId   = rdl.Stationery.CategoryId,
                            RequisitionStationeryCategoryType = rdl.Stationery.Category.Type,
                            RequisitionStationeryName         = rdl.Stationery.Description,
                            RequisitionStationeryItemPrice    = st.Price,
                        };
                        chartDTOs.Add(chartDTO);
                    }
                }
            }
            return(chartDTOs);
        }
コード例 #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="partner"></param>
        /// <param name="fromDate"></param>
        /// <param name="toDate"></param>
        /// <returns></returns>
        public ChartDTO GetProjectChartData(string partner, string fromDate, string toDate)
        {
            //dynamic MyDynamic = new System.Dynamic.ExpandoObject();
            ChartDTO retVal = new ChartDTO();

            try
            {
                DataSet ds = new ProjectDB(Utility.ConfigurationHelper.GPD_Connection).GetProjectChartData(partner, fromDate, toDate);
                if (ds != null && ds.Tables.Count == 1 && ds.Tables[0].Rows.Count > 0)
                {
                    string   tempAppType = "";
                    LinesDTO line        = new LinesDTO();
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        string appType = dr["APP_TYPE"].ToString();
                        if (appType.ToUpper() != tempAppType)
                        {
                            tempAppType = appType.ToUpper();
                            line        = new LinesDTO();
                            line.Name   = appType;
                            retVal.Lines.Add(line);
                        }
                        line.Dates.Add(((DateTime)dr["C_DATE"]).ToString("yyyy-MM-dd"));
                        line.Values.Add(Convert.ToInt32(dr["P_COUNT"].ToString()));
                    }
                }
            }
            catch (Exception exc)
            {
                log.Error("Unable to get data for project-chart. ERROR: " + exc.ToString());
            }
            return(retVal);
        }
コード例 #8
0
        private ChartDTO VoluntarioDiaDaSemana()
        {
            ChartDTO chart = new ChartDTO();
            SerieDTO serie = new SerieDTO()
            {
                Name       = "Dias da Semana",
                Type       = "pie",
                datapoints = new List <IDataPoint>()
            };

            chart.Data.Add(serie);
            if (_context.Voluntario.Any())
            {
                serie.datapoints.Add(new DataPointString()
                {
                    x = "Domingo",
                    y = _context.Voluntario.Where(q => q.Domingo == true && q.IsDeletado == false).Count()
                });

                serie.datapoints.Add(new DataPointString()
                {
                    x = "Segunda-feira",
                    y = _context.Voluntario.Where(q => q.SegundaFeira == true && q.IsDeletado == false).Count()
                });

                serie.datapoints.Add(new DataPointString()
                {
                    x = "Terça-feira",
                    y = _context.Voluntario.Where(q => q.TercaFeira == true && q.IsDeletado == false).Count()
                });

                serie.datapoints.Add(new DataPointString()
                {
                    x = "Quarta-feira",
                    y = _context.Voluntario.Where(q => q.QuartaFeira == true && q.IsDeletado == false).Count()
                });

                serie.datapoints.Add(new DataPointString()
                {
                    x = "Quinta-feira",
                    y = _context.Voluntario.Where(q => q.QuintaFeira == true && q.IsDeletado == false).Count()
                });

                serie.datapoints.Add(new DataPointString()
                {
                    x = "Sexta-feira",
                    y = _context.Voluntario.Where(q => q.SextaFeira == true && q.IsDeletado == false).Count()
                });

                serie.datapoints.Add(new DataPointString()
                {
                    x = "Sábado",
                    y = _context.Voluntario.Where(q => q.Sabado == true && q.IsDeletado == false).Count()
                });
            }

            return(chart);
        }
コード例 #9
0
        public void Edit(ChartDTO chart)
        {
            if (chart == null)
            {
                throw new ValidationException("Не установлено id класса", "");
            }
            var mapper = new MapperConfiguration(cfg => cfg.CreateMap <UserDataDTO, UserData>()).CreateMapper();
            var _chart = mapper.Map <ChartDTO, Chart>(chart);

            Database.Charts.Update(_chart);
            Database.Save();
        }
コード例 #10
0
        private ChartDTO GetSterilizerChartDataInc(SensorDataHeadEntity eHead, DateTime lastReceivedDate)
        {
            SeriesDTO s1 = GetSeriesInc(eHead, SystemData.MeasurementSensor1, Properties.Resource.SterilizerSeries1, lastReceivedDate);
            SeriesDTO s2 = GetSeriesInc(eHead, SystemData.MeasurementSensor2, Properties.Resource.SterilizerSeries2, lastReceivedDate);
            SeriesDTO s3 = GetSeriesInc(eHead, SystemData.MeasurementSensor4, Properties.Resource.SterilizerSeries3, lastReceivedDate);
            SeriesDTO s4 = GetSeriesInc(eHead, SystemData.MeasurementSensor5, Properties.Resource.SterilizerSeries4, lastReceivedDate);
            SeriesDTO s5 = GetSeriesInc(eHead, SystemData.MeasurementSensor6, Properties.Resource.SterilizerSeries5, lastReceivedDate);
            SeriesDTO s6 = GetSeriesInc(eHead, SystemData.MeasurementSensor7, Properties.Resource.SterilizerSeries6, lastReceivedDate);

            if (s1 == null || s1.Points == null || s1.Points.Count == 0)
            {
                return(null);
            }

            MergeSterilizerSensorData();

            Dictionary <string, SeriesDTO> dicSeriesTemp = new Dictionary <string, SeriesDTO>();

            dicSeriesTemp.Add(Properties.Resource.SterilizerSeries1, s1);
            dicSeriesTemp.Add(Properties.Resource.SterilizerSeries2, s2);
            Dictionary <string, SeriesDTO> dicSeriesPressure = new Dictionary <string, SeriesDTO>();

            dicSeriesPressure.Add(Properties.Resource.SterilizerSeries3, s3);
            dicSeriesPressure.Add(Properties.Resource.SterilizerSeries4, s4);
            dicSeriesPressure.Add(Properties.Resource.SterilizerSeries5, s5);
            dicSeriesPressure.Add(Properties.Resource.SterilizerSeries6, s6);

            ChartDTO chartData = new ChartDTO();
            string   temp      = string.Empty;

            if (s2 != null && s2.Points.Count > 0)
            {
                temp = s2.Points[s2.Points.Count - 1].Values[0].ToString("#.0");
            }
            string p2 = string.Empty;

            if (s4 != null && s4.Points.Count > 0)
            {
                p2 = s4.Points[s4.Points.Count - 1].Values[0].ToString("0");
            }

            chartData.ChartTitle   = GetChartTitle();
            chartData.RealtimeInfo = string.Format("温度:{0}\n压力:{1}", temp, p2);

            chartData.SeriesDictionary.Add(AxesName.Temperature.ToString(), dicSeriesTemp);
            chartData.SeriesDictionary.Add(AxesName.Pressure.ToString(), dicSeriesPressure);

            chartData.Comment = GetComment(eHead, s1);

            chartData.ErrorData = Utility.GetSensorErrors(eHead, mSyncLast);

            return(chartData);
        }
コード例 #11
0
        public ChartDTO GetChartDataInc(DateTime?lastReceivedDate, bool canChangeHead)
        {
            //mSyncLast = null;

            IsNew = false;

            // 刷新状态
            SensorHelper <object> helper = new SensorHelper <object>();

            mSensor = helper.SelectSingle <SensorEntity>(string.Format("SensorID = '{0}'", mSensor.SensorID.ToString().ToUpper()), string.Empty);

            SensorDataHeadBll bllHead = new SensorDataHeadBll();

            SensorDataHeadEntity eHead = bllHead.GetNewestSensorDataHeadBySensorID(Sensor.SensorID.ToString().ToUpper());

            if (eHead == null)
            {
                return(null);
            }
            else
            {
                if (eHead.IsCompressed != null && eHead.IsCompressed.HasValue && eHead.IsCompressed.Value)
                {
                    ChartDTO chartData = new ChartDTO();
                    chartData.IsAxisXCustomLabels = false;
                    chartData.ChartTitle          = GetChartTitle();
                    chartData.IsReset             = true;
                    return(chartData);
                }

                if (mHeadEntity != null && eHead.SensorDataHeadID == mHeadEntity.SensorDataHeadID && lastReceivedDate != null && lastReceivedDate.HasValue)
                {
                    return(GetChartDataInc(eHead, lastReceivedDate.Value));
                }
                else
                {
                    if (canChangeHead)
                    {
                        mSensorData = null;
                        ChartDTO dtoChart = GetChartDataByHead(eHead);
                        dtoChart.IsReset = true;
                        IsNew            = true;
                        return(dtoChart);
                    }
                    else
                    {
                        return(null);
                    }
                }
            }
        }
コード例 #12
0
        private ChartDTO GetSterilizerChartData(MonitorCollectDataEntity eHead, IList <MonitorCollectDataEntryEntity> lstDetail)
        {
            SeriesDTO s1 = GetSeries(lstDetail, "FValue1", Properties.Resource.SterilizerSeries1);
            SeriesDTO s2 = GetSeries(lstDetail, "FValue2", Properties.Resource.SterilizerSeries2);
            SeriesDTO s3 = GetSeries(lstDetail, "FValue3", Properties.Resource.SterilizerSeries3);
            SeriesDTO s4 = GetSeries(lstDetail, "FValue4", Properties.Resource.SterilizerSeries4);
            SeriesDTO s5 = GetSeries(lstDetail, "FValue5", Properties.Resource.SterilizerSeries5);
            SeriesDTO s6 = GetSeries(lstDetail, "FValue6", Properties.Resource.SterilizerSeries6);

            AxesDTO axesTemp = new AxesDTO(AxesName.Temperature.ToString());

            axesTemp.AxisYProperty.Add(AxesDTO.AxisProperty.MinValueSerializable.ToString(), Properties.Resource.TempMinValue);
            axesTemp.AxisYProperty.Add(AxesDTO.AxisProperty.MaxValueSerializable.ToString(), Properties.Resource.TempMaxValue);
            axesTemp.AxisYProperty.Add(AxesDTO.AxisProperty.EndText.ToString(), Properties.Resource.TempUnit);

            AxesDTO axesPressure = new AxesDTO(AxesName.Pressure.ToString());

            if (Properties.Resource.PressureMinValue.Equals(Properties.Resource.PressureMaxValue))
            {
                axesPressure.AxisYProperty.Add(AxesDTO.AxisProperty.MinValueSerializable.ToString(), Properties.Resource.PressureMinValue);
                axesPressure.AxisYProperty.Add(AxesDTO.AxisProperty.MaxValueSerializable.ToString(), Properties.Resource.PressureMaxValue);
            }
            axesPressure.AxisYProperty.Add(AxesDTO.AxisProperty.EndText.ToString(), Properties.Resource.PressureUnit);

            Dictionary <string, SeriesDTO> dicSeriesTemp = new Dictionary <string, SeriesDTO>();

            dicSeriesTemp.Add(Properties.Resource.SterilizerSeries1, s1);
            dicSeriesTemp.Add(Properties.Resource.SterilizerSeries2, s2);
            Dictionary <string, SeriesDTO> dicSeriesPressure = new Dictionary <string, SeriesDTO>();

            dicSeriesPressure.Add(Properties.Resource.SterilizerSeries3, s3);
            dicSeriesPressure.Add(Properties.Resource.SterilizerSeries4, s4);
            dicSeriesPressure.Add(Properties.Resource.SterilizerSeries5, s5);
            dicSeriesPressure.Add(Properties.Resource.SterilizerSeries6, s6);

            ChartDTO chartData = new ChartDTO();

            chartData.ChartTitle = GetChartTitle(eHead);
            chartData.AxesDictionary.Add(AxesName.Temperature.ToString(), axesTemp);
            chartData.AxesDictionary.Add(AxesName.Pressure.ToString(), axesPressure);
            chartData.SeriesDictionary.Add(AxesName.Temperature.ToString(), dicSeriesTemp);
            chartData.SeriesDictionary.Add(AxesName.Pressure.ToString(), dicSeriesPressure);

            chartData.Comment = GetComment(eHead, s1);

            return(chartData);
        }
コード例 #13
0
        public ChartDTO GetChartDataForToday()
        {
            ChartDTO chartDTO       = new ChartDTO();
            var      testHeaderData = this.GetTestHeadersForToday().GroupBy(x => x.Name).Select(x => x.Key).ToList();

            if (testHeaderData.Count == 0)
            {
                return(chartDTO);
            }

            chartDTO.labels = new List <string>();
            foreach (var item in testHeaderData)
            {
                chartDTO.labels.Add(item);
            }
            chartDTO.datasets = new List <ChartDataset>();
            chartDTO.datasets.Add(new ChartDataset()
            {
                label = "Failed", backgroundColor = "#FF6384", data = null, maxBarThickness = 4
            });
            chartDTO.datasets.Add(new ChartDataset()
            {
                label = "Success", backgroundColor = "#4BC0C0", data = null, maxBarThickness = 4
            });

            var testCountFailed = this.GetTestHeadersAll().Where(x => !x.IsTestPassed).GroupBy(x => x.Name).Select(x => new { TestName = x.Key, Count = x.Count() }).ToList();

            chartDTO.datasets[0].data = new double[testCountFailed.Count()];
            int count = 0;

            foreach (var item in testCountFailed)
            {
                chartDTO.datasets[0].data[count] = item.Count;
                count++;
            }
            var testCountPassed = this.GetTestHeadersAll().Where(x => x.IsTestPassed).GroupBy(x => x.Name).Select(x => new { TestName = x.Key, Count = x.Count() }).ToList();

            chartDTO.datasets[1].data = new double[testCountPassed.Count()];
            count = 0;
            foreach (var item in testCountPassed)
            {
                chartDTO.datasets[1].data[count] = item.Count;
                count++;
            }

            return(chartDTO);
        }
コード例 #14
0
        public List <ChartDTO> TrendChartInfoForSupplier(int SupplierId, int CategoryId, int StationeryId)
        {
            List <PurchaseOrderDetail>   PurchaseOrderDetailsList = purchaseOrderDetailRepo.GetPurchaseOrderDetailsBySupplierId(SupplierId);
            IEnumerable <SupplierTender> SupplierTendersList      = supplierTenderRepo.FindBy(x => x.SupplierId == SupplierId);
            List <ChartDTO> chartDTOs = new List <ChartDTO>();

            foreach (PurchaseOrderDetail pod in PurchaseOrderDetailsList)
            {
                foreach (SupplierTender st in SupplierTendersList)
                {
                    if (pod.StationeryId == st.StationeryId && pod.PurchaseOrder.SupplierId == st.SupplierId && pod.Stationery.CategoryId == CategoryId && pod.StationeryId == StationeryId)
                    {
                        ChartDTO chartDTO = new ChartDTO()
                        {
                            PubchaseOrderDetailId     = pod.Id,
                            PurchaseOrderId           = pod.PurchaseOrderId,
                            SupplierChartStationeryId = pod.StationeryId,
                            SupplierChartCategoryId   = pod.Stationery.Category.Id,
                            QuantityOrdered           = pod.QuantityOrdered,
                            QuantityDelivered         = pod.QuantityDelivered == null ? 0 : (int)pod.QuantityDelivered,
                            ItemName      = pod.Stationery.Description,
                            ItemType      = pod.Stationery.Category.Type,
                            UnitOfMeasure = pod.Stationery.UnitOfMeasure,
                            OrderDateTime = pod.PurchaseOrder.OrderDateTime,
                            SupplierName  = pod.PurchaseOrder.Supplier.Name,
                            ItemUnitPrice = st.Price,
                            EmployeeId    = pod.PurchaseOrder.Employee.Id,
                            EmployeeName  = pod.PurchaseOrder.Employee.Name,
                            SupplierId    = pod.PurchaseOrder.SupplierId,
                            PurchaseOrderDetailForChart = pod,
                            EmployeeForChart            = pod.PurchaseOrder.Employee,
                            SupplierForChart            = pod.PurchaseOrder.Supplier,
                            StationeryForChart          = pod.Stationery,
                            PurchaseOrderForChart       = pod.PurchaseOrder,
                            SupplierTenderForChart      = st,
                            CategoryForChart            = pod.Stationery.Category,
                        };
                        chartDTOs.Add(chartDTO);
                    }
                }
            }
            return(chartDTOs);
        }
コード例 #15
0
        private ChartDTO GetWasherChartData(MonitorCollectDataEntity eHead, IList <MonitorCollectDataEntryEntity> lstDetail)
        {
            SeriesDTO s1 = GetSeries(lstDetail, "FValue1", Properties.Resource.WasherSeries1);  //Med
            SeriesDTO s2 = GetSeries(lstDetail, "FValue2", Properties.Resource.WasherSeries2);  //CT
            SeriesDTO s3 = GetSeries(lstDetail, "FValue3", Properties.Resource.WasherSeries3);  //CDNo
            SeriesDTO s5 = GetSeries(lstDetail, "FValue4", Properties.Resource.WasherSeries5);  //Ao
            SeriesDTO s4 = GetSeries(lstDetail, "FValue5", Properties.Resource.WasherSeries4);  //DosV

            AxesDTO axesTemp = new AxesDTO(AxesName.Temperature.ToString());

            axesTemp.AxisYProperty.Add(AxesDTO.AxisProperty.EndText.ToString(), Properties.Resource.TempUnit);
            //axesTemp.SeriesList.Add(sTempIndepCham);

            AxesDTO axesAo = new AxesDTO(AxesName.AoValue.ToString());

            axesAo.AxisYProperty.Add(AxesDTO.AxisProperty.MinValueSerializable.ToString(), Properties.Resource.A0MinValue);
            axesAo.AxisYProperty.Add(AxesDTO.AxisProperty.MaxValueSerializable.ToString(), Properties.Resource.A0MaxValue);

            Dictionary <string, SeriesDTO> dicSeriesTemp = new Dictionary <string, SeriesDTO>();

            dicSeriesTemp.Add(Properties.Resource.WasherSeries2, s2);
            Dictionary <string, SeriesDTO> dicSeriesAo = new Dictionary <string, SeriesDTO>();

            dicSeriesAo.Add(Properties.Resource.WasherSeries5, s5);
            dicSeriesAo.Add(Properties.Resource.WasherSeries1, s1);
            dicSeriesAo.Add(Properties.Resource.WasherSeries3, s3);
            dicSeriesAo.Add(Properties.Resource.WasherSeries4, s4);

            ChartDTO chartData = new ChartDTO();

            chartData.ChartTitle = GetChartTitle(eHead);

            chartData.AxesDictionary.Add(AxesName.Temperature.ToString(), axesTemp);
            chartData.AxesDictionary.Add(AxesName.AoValue.ToString(), axesAo);
            chartData.SeriesDictionary.Add(AxesName.Temperature.ToString(), dicSeriesTemp);
            chartData.SeriesDictionary.Add(AxesName.AoValue.ToString(), dicSeriesAo);

            chartData.Comment = GetComment(eHead, s1);

            //chartData.ErrorData = Utility.GetSensorErrors(eHead, mSyncLast);

            return(chartData);
        }
コード例 #16
0
        public ChartDTO GetChartData()
        {
            mSyncLast = null;
            mDataDic  = new Dictionary <string, DataRow[]>();

            IsNew = true;

            mProgramData = null;

            mShowPropertyDic = GetShowPropertyData();

            // 刷新状态
            SensorHelper <object> helper = new SensorHelper <object>();

            mSensor = helper.SelectSingle <SensorEntity>(string.Format("SensorID = '{0}'", mSensor.SensorID.ToString().ToUpper()), string.Empty);

            SensorDataHeadBll    bllHead = new SensorDataHeadBll();
            SensorDataHeadEntity eHead   = bllHead.GetNewestSensorDataHeadBySensorID(Sensor.SensorID.ToString().ToUpper());

            if (eHead == null)
            {
                ChartDTO chartData = new ChartDTO();
                chartData.ChartTitle = GetChartTitle();
                return(chartData);
            }
            else
            {
                if (eHead.IsCompressed != null && eHead.IsCompressed.HasValue && eHead.IsCompressed.Value)
                {
                    ChartDTO chartData = new ChartDTO();
                    chartData.ChartTitle = GetChartTitle();
                    return(chartData);
                }

                //SensorDataLineBll bllLine = new SensorDataLineBll();
                //mSectionList = bllLine.GetSensorDataLineByDataType(eHead.SensorDataHeadID.ToString(), Utility.GetEnumValue(DataType.Body_SectionTitle));
                mProgramData = GetProgramData(eHead);

                return(GetChartDataByHead(eHead));
            }
        }
コード例 #17
0
        public ChartDTO GetChartData()
        {
            //mSyncLast = null;

            IsNew = true;

            mShowPropertyDic = GetShowPropertyData();

            // 刷新状态
            SensorHelper <object> helper = new SensorHelper <object>();

            mSensor = helper.SelectSingle <SensorEntity>(string.Format("SensorID = '{0}'", mSensor.SensorID.ToString().ToUpper()), string.Empty);

            SensorDataHeadBll    bllHead = new SensorDataHeadBll();
            SensorDataHeadEntity eHead   = bllHead.GetNewestSensorDataHeadBySensorID(Sensor.SensorID.ToString().ToUpper());

            if (eHead == null)
            {
                ChartDTO chartData = new ChartDTO();
                chartData.IsAxisXCustomLabels = false;
                chartData.ChartTitle          = GetChartTitle();
                return(chartData);
            }
            else
            {
                if (eHead.IsCompressed != null && eHead.IsCompressed.HasValue && eHead.IsCompressed.Value)
                {
                    ChartDTO chartData = new ChartDTO();
                    chartData.IsAxisXCustomLabels = false;
                    chartData.ChartTitle          = GetChartTitle();
                    return(chartData);
                }

                return(GetChartDataByHead(eHead));
            }
        }
コード例 #18
0
        public ChartDTO GetYTDGroup()
        {
            var bLbs = DbContext.AD_WeekData.GroupBy(x => x.AD_WeekEnd)
                       .Select(lg => new ChartDTO.Series.dataitem
            {
                name      = lg.Key.ToString().Replace(" 12:00AM", ""),
                y         = lg.Sum(w => w.AD_BudgetLbs != null ? w.AD_BudgetLbs.Value : 0),
                drilldown = "BudgetLbs" + lg.Key.ToString().Replace(" 12:00AM", "")
            }).ToArray();
            var bDollars = DbContext.AD_WeekData.GroupBy(x => x.AD_WeekEnd)
                           .Select(lg => new ChartDTO.Series.dataitem
            {
                name      = lg.Key.ToString().Replace(" 12:00AM", ""),
                y         = (int)lg.Sum(w => w.AD_BudgetDollars != null ? w.AD_BudgetDollars.Value : 0),
                drilldown = "BudgetDollars" + lg.Key.ToString().Replace(" 12:00AM", "")
            }).ToArray();
            var aLbs = DbContext.AD_WeekData.GroupBy(x => x.AD_WeekEnd)
                       .Select(lg => new ChartDTO.Series.dataitem
            {
                name      = lg.Key.ToString().Replace(" 12:00AM", ""),
                y         = lg.Sum(w => w.AD_ActualLbs != null ? w.AD_ActualLbs.Value : 0),
                drilldown = "ActualLbs" + lg.Key.ToString().Replace(" 12:00AM", "")
            }).ToArray();
            var aDollars = DbContext.AD_WeekData.GroupBy(x => x.AD_WeekEnd)
                           .Select(lg => new ChartDTO.Series.dataitem
            {
                name      = lg.Key.ToString().Replace(" 12:00AM", ""),
                y         = (int)lg.Sum(w => w.AD_ActualDollars != null ? w.AD_ActualDollars.Value : 0),
                drilldown = "ActualDollars" + lg.Key.ToString().Replace(" 12:00AM", "")
            }).ToArray();

            var seriesData1 = new ChartDTO.Series
            {
                data           = bLbs.ToArray(),
                color          = "rgba(165,170,217,1)",
                name           = "Budget Lbs",
                pointPadding   = 0.26M,
                pointPlacement = -0.2M,
                yAxis          = 1
            };
            var seriesData2 = new ChartDTO.Series
            {
                data           = bDollars.ToArray(),
                color          = "rgba(126,86,134,.9)",
                name           = "Actual Lbs",
                pointPadding   = 0.4M,
                pointPlacement = -0.2M,
                yAxis          = 1
            };
            var seriesData3 = new ChartDTO.Series
            {
                data           = aLbs.ToArray(),
                color          = "rgba(248,161,63,1)",
                name           = "Budget Dollars",
                pointPadding   = 0.26M,
                pointPlacement = 0.1M,
                yAxis          = 1
            };
            var seriesData4 = new ChartDTO.Series
            {
                data           = aDollars.ToArray(),
                color          = "rgba(186,60,61,.9)",
                name           = "Actual Dollars",
                pointPadding   = 0.4M,
                pointPlacement = 0.1M,
                yAxis          = 1
            };

            ChartDTO.Series[] seriesarray = new ChartDTO.Series[4];
            seriesarray[0] = seriesData1;
            seriesarray[1] = seriesData2;
            seriesarray[2] = seriesData3;
            seriesarray[3] = seriesData4;

            var cht = new ChartDTO();

            cht.ChartSeries = seriesarray;



            //var allDates = DbContext.AD_WeekData.GroupBy(x => x.AD_WeekEnd)
            //.Select(lg => lg.FirstOrDefault().AD_WeekEnd);
            //ChartDTO.DrillDown thisdd = new ChartDTO.DrillDown();

            //foreach (var date in allDates)
            //{
            //    ChartDTO.DrillDown.SeriesItem thisseriesitem = new ChartDTO.DrillDown.SeriesItem();
            //    thisseriesitem.id = "BudgetLbs" + date.ToString();
            //    var prods = DbContext.AD_WeekData.Where(x => x.AD_WeekEnd == date).ToList();


            //}

            return(cht);
        }
コード例 #19
0
        public ChartDTO GetSalesStats()
        {
            var bLbs = DbContext.ADAGIOSalesStatitics.Where(x => x.Date_2.Value.Year > 2000).GroupBy(x => x.Date_2.Value.Year)
                       .Select(lg => new ChartDTO.Series.dataitem
            {
                name      = lg.Key.ToString(),
                y         = lg.Sum(w => w.GrossSalesAmt != null ?  w.GrossSalesAmt.Value : 0),
                drilldown = "GYear" + lg.Key.ToString()
            }).OrderBy(o => o.name).ToArray();
            var bDollars = DbContext.ADAGIOSalesStatitics.Where(x => x.Date_2.Value.Year > 2000).GroupBy(x => x.Date_2.Value.Year)
                           .Select(lg => new ChartDTO.Series.dataitem
            {
                name      = lg.Key.ToString(),
                y         = lg.Sum(w => w.NetSalesAmt != null ? w.NetSalesAmt.Value : 0),
                drilldown = "NYear" + lg.Key.ToString()
            }).OrderBy(o => o.name).ToArray();
            var asps = DbContext.ADAGIOSalesStatitics.Where(x => x.Date_2.Value.Year > 2000).GroupBy(x => x.Date_2.Value.Year)
                       .Select(lg => new ChartDTO.Series.dataitem
            {
                name = lg.Key.ToString(),
                y    = lg.Sum(w => w.NetSalesAmt != null ? w.NetSalesAmt.Value : 0) / lg.Sum(w => w.NetQtySold != null ? w.NetQtySold.Value : 0)
            }).OrderBy(o => o.name).ToArray();
            var aDollars = DbContext.ADAGIOSalesStatitics.Where(x => x.Date_2.Value.Year > 2000).GroupBy(x => x.Date_2.Value.Year)
                           .Select(lg => new ChartDTO.Series.dataitem
            {
                name      = lg.Key.ToString(),
                y         = lg.Sum(w => w.NetQtySold != null ? w.NetQtySold.Value : 0),
                drilldown = "QYear" + lg.Key.ToString()
            }).OrderBy(o => o.name).ToArray();

            var seriesData1 = new ChartDTO.Series
            {
                data           = bLbs.ToArray(),
                color          = "rgba(165,170,217,1)",
                name           = "Gross Sales",
                pointPadding   = 0.26M,
                pointPlacement = -0.2M,
                yAxis          = 0,
                type           = "column"
            };
            var seriesData2 = new ChartDTO.Series
            {
                data           = bDollars.ToArray(),
                color          = "rgba(126,86,134,.9)",
                name           = "Net Sales",
                pointPadding   = 0.4M,
                pointPlacement = -0.2M,
                yAxis          = 0,
                type           = "column"
            };
            var seriesData3 = new ChartDTO.Series
            {
                data           = aDollars.ToArray(),
                color          = "rgba(248,161,63,1)",
                name           = "Net Quantity",
                pointPadding   = 0.26M,
                pointPlacement = 0.1M,
                yAxis          = 0,
                type           = "column"
            };
            var seriesData4 = new ChartDTO.Series
            {
                data  = asps.ToArray(),
                type  = "spline",
                color = "rgba(186,60,61,.9)",
                name  = "ASP",
                yAxis = 1
            };

            ChartDTO.Series[] seriesarray = new ChartDTO.Series[4];
            seriesarray[0] = seriesData1;
            seriesarray[1] = seriesData2;
            seriesarray[2] = seriesData3;
            seriesarray[3] = seriesData4;

            var cht = new ChartDTO();

            cht.ChartSeries = seriesarray;

            List <ChartDTO.Series> drillDownSeries = new List <ChartDTO.Series>();

            foreach (int year in bLbs.Select(x => int.Parse(x.name)))
            {
                var ddGross = DbContext.ADAGIOSalesStatitics.Where(x => x.Date_2.Value.Year == year).GroupBy(x => x.Date_2.Value.Month)
                              .Select(lg => new ChartDTO.Series.dataitem
                {
                    ordering  = lg.Key,
                    name      = lg.Key.ToString(),
                    y         = lg.Sum(w => w.GrossSalesAmt != null ? w.GrossSalesAmt.Value : 0),
                    drilldown = "Month" + lg.Key.ToString()
                }).OrderBy(o => o.ordering).ToArray();
                var ddNet = DbContext.ADAGIOSalesStatitics.Where(x => x.Date_2.Value.Year == year).GroupBy(x => x.Date_2.Value.Month)
                            .Select(lg => new ChartDTO.Series.dataitem
                {
                    ordering  = lg.Key,
                    name      = lg.Key.ToString(),
                    y         = lg.Sum(w => w.NetSalesAmt != null ? w.NetSalesAmt.Value : 0),
                    drilldown = "Month" + lg.Key.ToString()
                }).OrderBy(o => o.ordering).ToArray();
                var ddQty = DbContext.ADAGIOSalesStatitics.Where(x => x.Date_2.Value.Year == year).GroupBy(x => x.Date_2.Value.Month)
                            .Select(lg => new ChartDTO.Series.dataitem
                {
                    ordering  = lg.Key,
                    name      = lg.Key.ToString(),
                    y         = lg.Sum(w => w.NetQtySold != null ? w.NetQtySold.Value : 0),
                    drilldown = "Month" + lg.Key.ToString()
                }).OrderBy(o => o.ordering).ToArray();

                var ddseriesData1 = new ChartDTO.Series
                {
                    data           = ddGross.ToArray(),
                    color          = "rgba(165,170,217,1)",
                    name           = "Gross Sales",
                    pointPadding   = 0.26M,
                    pointPlacement = -0.2M,
                    yAxis          = 1,
                    id             = "GYear" + year.ToString()
                };
                var ddseriesData2 = new ChartDTO.Series
                {
                    data           = ddNet.ToArray(),
                    color          = "rgba(126,86,134,.9)",
                    name           = "Net Sales",
                    pointPadding   = 0.4M,
                    pointPlacement = -0.2M,
                    yAxis          = 1,
                    id             = "NYear" + year.ToString()
                };
                var ddseriesData3 = new ChartDTO.Series
                {
                    data           = ddQty.ToArray(),
                    color          = "rgba(248,161,63,1)",
                    name           = "Net Quantity",
                    pointPadding   = 0.26M,
                    pointPlacement = 0.1M,
                    yAxis          = 1,
                    id             = "QYear" + year.ToString()
                };

                drillDownSeries.Add(ddseriesData1);
                drillDownSeries.Add(ddseriesData2);
                drillDownSeries.Add(ddseriesData3);
            }

            ChartDTO.DrillDown ddData = new ChartDTO.DrillDown();
            ddData.DrillDownSeries = drillDownSeries.ToArray();
            cht.DrillDownData      = ddData;
            return(cht);
        }
コード例 #20
0
        public ChartDTO GetChartDataInc(DateTime?lastReceivedDate, bool canChangeHead)
        {
            mSyncLast = null;
            mDataDic  = new Dictionary <string, DataRow[]>();

            IsNew = false;

            mProgramData = null;

            // 刷新状态
            SensorHelper <object> helper = new SensorHelper <object>();

            mSensor = helper.SelectSingle <SensorEntity>(string.Format("SensorID = '{0}'", mSensor.SensorID.ToString().ToUpper()), string.Empty);

            SensorDataHeadBll bllHead = new SensorDataHeadBll();

            SensorDataHeadEntity eHead = bllHead.GetNewestSensorDataHeadBySensorID(Sensor.SensorID.ToString().ToUpper());

            if (eHead == null)
            {
                return(null);
            }
            else
            {
                if (mHeadEntity != null && eHead.SensorDataHeadID != mHeadEntity.SensorDataHeadID && !canChangeHead)
                {
                    return(null);
                }

                if (eHead.IsCompressed != null && eHead.IsCompressed.HasValue && eHead.IsCompressed.Value)
                {
                    if (canChangeHead)
                    {
                        ChartDTO chartData = new ChartDTO();
                        chartData.ChartTitle = GetChartTitle();
                        chartData.IsReset    = true;
                        return(chartData);
                    }
                    else
                    {
                        return(null);
                    }
                }

                //SensorDataLineBll bllLine = new SensorDataLineBll();
                //mSectionList = bllLine.GetSensorDataLineByDataType(eHead.SensorDataHeadID.ToString(), Utility.GetEnumValue(DataType.Body_SectionTitle));

                if (mHeadEntity != null && eHead.SensorDataHeadID == mHeadEntity.SensorDataHeadID && lastReceivedDate != null && lastReceivedDate.HasValue)
                {
                    mProgramData = GetProgramDataInc(eHead, lastReceivedDate.Value);

                    if (Convert.ToInt32(Sensor.SensorType).Equals(Convert.ToInt32(Common.Consts.SensorType.Sterilizer)))
                    {
                        // 灭菌
                        return(GetSterilizerChartDataInc(eHead, lastReceivedDate.Value));
                    }
                    else if (Convert.ToInt32(Sensor.SensorType).Equals(Convert.ToInt32(Common.Consts.SensorType.Washer)))
                    {
                        // 清洗
                        return(GetWasherChartDataInc(eHead, lastReceivedDate.Value));
                    }
                    else
                    {
                        logger.WarnFormat("未处理的设备类型([传感器:{0},设备类型:{1}])", Sensor.SensorKey, Sensor.SensorType);

                        return(null);
                    }
                }
                else
                {
                    if (canChangeHead)
                    {
                        mSensorData = null;
                        ChartDTO dtoChart = GetChartDataByHead(eHead);
                        dtoChart.IsReset = true;
                        IsNew            = true;
                        return(dtoChart);
                    }
                    else
                    {
                        return(null);
                    }
                }
            }
        }
コード例 #21
0
        private ChartDTO GetChartDataInc(SensorDataHeadEntity eHead, DateTime lastReceivedDate)
        {
            IList <SensorDataLineEntity> lstLine = null;
            SensorHelper <object>        helper  = new SensorHelper <object>();

            if (mIsCompressed)
            {
                lstLine = mSensorCompressedData.GetSensorDataLine();
            }
            else
            {
                string strWhere = string.Empty;
                if (CommonValue.DatabaseType == CommonValue.DatabaseFlag.Oracle)
                {
                    strWhere = string.Format("SensorDataHeadID = '{0}' AND to_char(ReceivedDate, 'YYYY-MM-DD HH24:MI:SS.FF3') > '{1}'", eHead.SensorDataHeadID.ToString().ToUpper(), lastReceivedDate.ToString("yyyy-MM-dd HH:mm:ss.fff"));
                }
                else
                {
                    strWhere = string.Format("SensorDataHeadID = '{0}' AND ReceivedDate > '{1}'", eHead.SensorDataHeadID.ToString().ToUpper(), lastReceivedDate.ToString("yyyy-MM-dd HH:mm:ss.fff"));
                }
                lstLine = helper.SelectList <SensorDataLineEntity>(strWhere, "ReceivedDate");
            }

            SeriesDTO sTemperature = null;
            SeriesDTO sPressure    = null;
            SeriesDTO sHumidity    = null;
            SeriesDTO sVoltage     = null;

            GetSeriesDto(lstLine, ref sTemperature, ref sPressure, ref sHumidity, ref sVoltage);

            MakeSensorData(lstLine);

            ChartDTO chartData = new ChartDTO();

            chartData.IsAxisXCustomLabels = false;

            if (Convert.ToInt32(Sensor.SensorType).Equals(Convert.ToInt32(Common.Consts.SensorType.Temperature)) ||
                Convert.ToInt32(Sensor.SensorType).Equals(Convert.ToInt32(Common.Consts.SensorType.TemperatureHumidity)) ||
                Convert.ToInt32(Sensor.SensorType).Equals(Convert.ToInt32(Common.Consts.SensorType.TemperaturePressure)) ||
                Convert.ToInt32(Sensor.SensorType).Equals(Convert.ToInt32(Common.Consts.SensorType.TemperaturePressureAccurate)))
            {
                // 温度
                Dictionary <string, SeriesDTO> dicSeriesTemperature = new Dictionary <string, SeriesDTO>();
                dicSeriesTemperature.Add(Properties.Resource.TemperatureSeries, sTemperature);
                chartData.SeriesDictionary.Add(Properties.Resource.TemperatureSeries, dicSeriesTemperature);
            }

            if (Convert.ToInt32(Sensor.SensorType).Equals(Convert.ToInt32(Common.Consts.SensorType.Humidity)) ||
                Convert.ToInt32(Sensor.SensorType).Equals(Convert.ToInt32(Common.Consts.SensorType.TemperatureHumidity)))
            {
                // 湿度
                Dictionary <string, SeriesDTO> dicSeriesHumidity = new Dictionary <string, SeriesDTO>();
                dicSeriesHumidity.Add(Properties.Resource.HumiditySeries, sHumidity);
                chartData.SeriesDictionary.Add(Properties.Resource.HumiditySeries, dicSeriesHumidity);
            }

            if (Convert.ToInt32(Sensor.SensorType).Equals(Convert.ToInt32(Common.Consts.SensorType.Pressure)) ||
                Convert.ToInt32(Sensor.SensorType).Equals(Convert.ToInt32(Common.Consts.SensorType.TemperaturePressure)) ||
                Convert.ToInt32(Sensor.SensorType).Equals(Convert.ToInt32(Common.Consts.SensorType.TemperaturePressureAccurate)))
            {
                // 气压
                Dictionary <string, SeriesDTO> dicSeriesPressure = new Dictionary <string, SeriesDTO>();
                dicSeriesPressure.Add(Properties.Resource.PressureSeries, sPressure);
                chartData.SeriesDictionary.Add(Properties.Resource.PressureSeries, dicSeriesPressure);
            }

            chartData.ChartTitle   = GetChartTitle();
            chartData.RealtimeInfo = GetRealtimeInfo(lstLine);

            chartData.Comment = GetComment(chartData.SeriesDictionary);

            chartData.ErrorData = null;

            return(chartData);
        }
コード例 #22
0
        private ChartDTO GetChartDataByHead(SensorDataHeadEntity eHead)
        {
            mHeadEntity = eHead;
            if (mHeadEntity == null)
            {
                return(null);
            }

            IList <SensorDataLineEntity> lstLine = null;
            SensorHelper <object>        helper  = new SensorHelper <object>();

            if (mIsCompressed)
            {
                lstLine = mSensorCompressedData.GetSensorDataLine();
            }
            else
            {
                string strWhere = string.Format("SensorDataHeadID = '{0}'", eHead.SensorDataHeadID.ToString().ToUpper());
                lstLine = helper.SelectList <SensorDataLineEntity>(strWhere, "ReceivedDate");
            }

            SeriesDTO sTemperature = null;
            SeriesDTO sPressure    = null;
            SeriesDTO sHumidity    = null;
            SeriesDTO sVoltage     = null;

            GetSeriesDto(lstLine, ref sTemperature, ref sPressure, ref sHumidity, ref sVoltage);

            MakeSensorData(lstLine);

            ChartDTO chartData = new ChartDTO();

            chartData.IsAxisXCustomLabels = false;

            if (Convert.ToInt32(Sensor.SensorType).Equals(Convert.ToInt32(Common.Consts.SensorType.Temperature)) ||
                Convert.ToInt32(Sensor.SensorType).Equals(Convert.ToInt32(Common.Consts.SensorType.TemperatureHumidity)) ||
                Convert.ToInt32(Sensor.SensorType).Equals(Convert.ToInt32(Common.Consts.SensorType.TemperaturePressure)) ||
                Convert.ToInt32(Sensor.SensorType).Equals(Convert.ToInt32(Common.Consts.SensorType.TemperaturePressureAccurate)))
            {
                // 温度
                AxesDTO axesTemperature = new AxesDTO(Properties.Resource.TemperatureSeries);
                axesTemperature.AxisYProperty.Add(AxesDTO.AxisProperty.EndText.ToString(), Properties.Resource.TemperatureUnit);
                Dictionary <string, SeriesDTO> dicSeriesTemperature = new Dictionary <string, SeriesDTO>();
                dicSeriesTemperature.Add(Properties.Resource.TemperatureSeries, sTemperature);

                chartData.AxesDictionary.Add(Properties.Resource.TemperatureSeries, axesTemperature);
                chartData.SeriesDictionary.Add(Properties.Resource.TemperatureSeries, dicSeriesTemperature);
            }

            if (Convert.ToInt32(Sensor.SensorType).Equals(Convert.ToInt32(Common.Consts.SensorType.Humidity)) ||
                Convert.ToInt32(Sensor.SensorType).Equals(Convert.ToInt32(Common.Consts.SensorType.TemperatureHumidity)))
            {
                // 湿度
                AxesDTO axesHumidity = new AxesDTO(Properties.Resource.HumiditySeries);
                axesHumidity.AxisYProperty.Add(AxesDTO.AxisProperty.EndText.ToString(), Properties.Resource.HumidityUnit);
                Dictionary <string, SeriesDTO> dicSeriesHumidity = new Dictionary <string, SeriesDTO>();
                dicSeriesHumidity.Add(Properties.Resource.HumiditySeries, sHumidity);

                chartData.AxesDictionary.Add(Properties.Resource.HumiditySeries, axesHumidity);
                chartData.SeriesDictionary.Add(Properties.Resource.HumiditySeries, dicSeriesHumidity);
            }

            if (Convert.ToInt32(Sensor.SensorType).Equals(Convert.ToInt32(Common.Consts.SensorType.Pressure)) ||
                Convert.ToInt32(Sensor.SensorType).Equals(Convert.ToInt32(Common.Consts.SensorType.TemperaturePressure)) ||
                Convert.ToInt32(Sensor.SensorType).Equals(Convert.ToInt32(Common.Consts.SensorType.TemperaturePressureAccurate)))
            {
                // 气压
                AxesDTO axesPressure = new AxesDTO(Properties.Resource.PressureSeries);
                axesPressure.AxisYProperty.Add(AxesDTO.AxisProperty.EndText.ToString(), Properties.Resource.PressureUnit);
                Dictionary <string, SeriesDTO> dicSeriesPressure = new Dictionary <string, SeriesDTO>();
                dicSeriesPressure.Add(Properties.Resource.PressureSeries, sPressure);

                chartData.AxesDictionary.Add(Properties.Resource.PressureSeries, axesPressure);
                chartData.SeriesDictionary.Add(Properties.Resource.PressureSeries, dicSeriesPressure);
            }

            chartData.ChartTitle   = GetChartTitle();
            chartData.RealtimeInfo = GetRealtimeInfo(lstLine);

            chartData.Comment = GetComment(chartData.SeriesDictionary);

            chartData.ErrorData = null;

            return(chartData);
        }
コード例 #23
0
        private ChartDTO GetWasherChartData(SensorDataHeadEntity eHead)
        {
            SeriesDTO s1 = null;
            SeriesDTO s2 = null;
            SeriesDTO s3 = null;
            SeriesDTO s4 = null;
            SeriesDTO s5 = null;

            if (mIsCompressed)
            {
                s1 = GetCompressedSeries(eHead, SystemData.MeasurementSensor1, Properties.Resource.WasherSeries1);
                s2 = GetCompressedSeries(eHead, SystemData.MeasurementSensor2, Properties.Resource.WasherSeries2);
                s3 = GetCompressedSeries(eHead, SystemData.MeasurementSensor3, Properties.Resource.WasherSeries3);
                s4 = GetCompressedSeries(eHead, SystemData.MeasurementSensor4, Properties.Resource.WasherSeries4);
                s5 = GetCompressedSeries(eHead, SystemData.MeasurementSensor5, Properties.Resource.WasherSeries5);
            }
            else
            {
                s1 = GetSeries(eHead, SystemData.MeasurementSensor1, Properties.Resource.WasherSeries1);
                s2 = GetSeries(eHead, SystemData.MeasurementSensor2, Properties.Resource.WasherSeries2);
                s3 = GetSeries(eHead, SystemData.MeasurementSensor3, Properties.Resource.WasherSeries3);
                s4 = GetSeries(eHead, SystemData.MeasurementSensor4, Properties.Resource.WasherSeries4);
                s5 = GetSeries(eHead, SystemData.MeasurementSensor5, Properties.Resource.WasherSeries5);
            }

            MergeWasherSensorData();

            AxesDTO axesTemp = new AxesDTO(AxesName.Temperature.ToString());

            axesTemp.AxisYProperty.Add(AxesDTO.AxisProperty.EndText.ToString(), Properties.Resource.TempUnit);
            //axesTemp.SeriesList.Add(sTempIndepCham);

            AxesDTO axesAo = new AxesDTO(AxesName.AoValue.ToString());

            axesAo.AxisYProperty.Add(AxesDTO.AxisProperty.MinValueSerializable.ToString(), Properties.Resource.A0MinValue);
            axesAo.AxisYProperty.Add(AxesDTO.AxisProperty.MaxValueSerializable.ToString(), Properties.Resource.A0MaxValue);

            Dictionary <string, SeriesDTO> dicSeriesTemp = new Dictionary <string, SeriesDTO>();

            dicSeriesTemp.Add(Properties.Resource.WasherSeries2, s2);
            Dictionary <string, SeriesDTO> dicSeriesAo = new Dictionary <string, SeriesDTO>();

            dicSeriesAo.Add(Properties.Resource.WasherSeries5, s5);
            dicSeriesAo.Add(Properties.Resource.WasherSeries1, s1);
            dicSeriesAo.Add(Properties.Resource.WasherSeries3, s3);
            dicSeriesAo.Add(Properties.Resource.WasherSeries4, s4);

            ChartDTO chartData = new ChartDTO();

            string temp = string.Empty;

            if (s2 != null && s2.Points.Count > 0)
            {
                temp = s2.Points[s2.Points.Count - 1].Values[0].ToString("#.0");
            }
            string a0 = string.Empty;

            if (s5 != null && s5.Points.Count > 0)
            {
                a0 = s5.Points[s5.Points.Count - 1].Values[0].ToString("0");
            }

            chartData.ChartTitle   = GetChartTitle();
            chartData.RealtimeInfo = string.Format("温度:{0}\nA0:{1}", temp, a0);

            chartData.AxesDictionary.Add(AxesName.Temperature.ToString(), axesTemp);
            chartData.AxesDictionary.Add(AxesName.AoValue.ToString(), axesAo);
            chartData.SeriesDictionary.Add(AxesName.Temperature.ToString(), dicSeriesTemp);
            chartData.SeriesDictionary.Add(AxesName.AoValue.ToString(), dicSeriesAo);

            chartData.Comment = GetComment(eHead, s1);

            chartData.ErrorData = Utility.GetSensorErrors(eHead, mSyncLast);

            return(chartData);
        }
コード例 #24
0
        private ChartDTO GetSterilizerChartData(SensorDataHeadEntity eHead)
        {
            SeriesDTO s1 = null;
            SeriesDTO s2 = null;
            SeriesDTO s3 = null;
            SeriesDTO s4 = null;
            SeriesDTO s5 = null;
            SeriesDTO s6 = null;

            if (mIsCompressed)
            {
                s1 = GetCompressedSeries(eHead, SystemData.MeasurementSensor1, Properties.Resource.SterilizerSeries1);
                s2 = GetCompressedSeries(eHead, SystemData.MeasurementSensor2, Properties.Resource.SterilizerSeries2);
                s3 = GetCompressedSeries(eHead, SystemData.MeasurementSensor4, Properties.Resource.SterilizerSeries3);
                s4 = GetCompressedSeries(eHead, SystemData.MeasurementSensor5, Properties.Resource.SterilizerSeries4);
                s5 = GetCompressedSeries(eHead, SystemData.MeasurementSensor6, Properties.Resource.SterilizerSeries5);
                s6 = GetCompressedSeries(eHead, SystemData.MeasurementSensor7, Properties.Resource.SterilizerSeries6);
            }
            else
            {
                s1 = GetSeries(eHead, SystemData.MeasurementSensor1, Properties.Resource.SterilizerSeries1);
                s2 = GetSeries(eHead, SystemData.MeasurementSensor2, Properties.Resource.SterilizerSeries2);
                s3 = GetSeries(eHead, SystemData.MeasurementSensor4, Properties.Resource.SterilizerSeries3);
                s4 = GetSeries(eHead, SystemData.MeasurementSensor5, Properties.Resource.SterilizerSeries4);
                s5 = GetSeries(eHead, SystemData.MeasurementSensor6, Properties.Resource.SterilizerSeries5);
                s6 = GetSeries(eHead, SystemData.MeasurementSensor7, Properties.Resource.SterilizerSeries6);
            }

            MergeSterilizerSensorData();

            AxesDTO axesTemp = new AxesDTO(AxesName.Temperature.ToString());

            axesTemp.AxisYProperty.Add(AxesDTO.AxisProperty.MinValueSerializable.ToString(), Properties.Resource.TempMinValue);
            axesTemp.AxisYProperty.Add(AxesDTO.AxisProperty.MaxValueSerializable.ToString(), Properties.Resource.TempMaxValue);
            axesTemp.AxisYProperty.Add(AxesDTO.AxisProperty.EndText.ToString(), Properties.Resource.TempUnit);

            AxesDTO axesPressure = new AxesDTO(AxesName.Pressure.ToString());

            if (!Properties.Resource.PressureMinValue.Equals(Properties.Resource.PressureMaxValue))
            {
                axesPressure.AxisYProperty.Add(AxesDTO.AxisProperty.MinValueSerializable.ToString(), Properties.Resource.PressureMinValue);
                axesPressure.AxisYProperty.Add(AxesDTO.AxisProperty.MaxValueSerializable.ToString(), Properties.Resource.PressureMaxValue);
            }
            axesPressure.AxisYProperty.Add(AxesDTO.AxisProperty.EndText.ToString(), Properties.Resource.PressureUnit);

            Dictionary <string, SeriesDTO> dicSeriesTemp = new Dictionary <string, SeriesDTO>();

            dicSeriesTemp.Add(Properties.Resource.SterilizerSeries1, s1);
            dicSeriesTemp.Add(Properties.Resource.SterilizerSeries2, s2);
            Dictionary <string, SeriesDTO> dicSeriesPressure = new Dictionary <string, SeriesDTO>();

            dicSeriesPressure.Add(Properties.Resource.SterilizerSeries3, s3);
            dicSeriesPressure.Add(Properties.Resource.SterilizerSeries4, s4);
            dicSeriesPressure.Add(Properties.Resource.SterilizerSeries5, s5);
            dicSeriesPressure.Add(Properties.Resource.SterilizerSeries6, s6);

            ChartDTO chartData = new ChartDTO();

            string temp = string.Empty;

            if (s2 != null && s2.Points.Count > 0)
            {
                temp = s2.Points[s2.Points.Count - 1].Values[0].ToString("#.0");
            }
            string p2 = string.Empty;

            if (s4 != null && s4.Points.Count > 0)
            {
                p2 = s4.Points[s4.Points.Count - 1].Values[0].ToString("0");
            }

            chartData.ChartTitle   = GetChartTitle();
            chartData.RealtimeInfo = string.Format("温度:{0}\n压力:{1}", temp, p2);

            chartData.AxesDictionary.Add(AxesName.Temperature.ToString(), axesTemp);
            chartData.AxesDictionary.Add(AxesName.Pressure.ToString(), axesPressure);
            chartData.SeriesDictionary.Add(AxesName.Temperature.ToString(), dicSeriesTemp);
            chartData.SeriesDictionary.Add(AxesName.Pressure.ToString(), dicSeriesPressure);

            chartData.Comment = GetComment(eHead, s1);

            chartData.ErrorData = Utility.GetSensorErrors(eHead, mSyncLast);

            return(chartData);
        }