コード例 #1
0
ファイル: ArtTch.cs プロジェクト: xu2018meng/PSOG_new
        /// <summary>
        /// 质量分析查询
        /// </summary>
        /// <param name="page">页号</param>
        /// <param name="rows">行数</param>
        /// <returns></returns>
        public EasyUIData getQualityList(String page, String rows, Plant plant)
        {
            IDao       dao  = new Dao(plant, false);
            EasyUIData grid = new EasyUIData();
            List <RTResExLimsPoint> limsPoint = new List <RTResExLimsPoint>();
            String  sql = "select count(1) over() allrowCount, LimsPoint_MATCODE,LimsPoint_SAMPLEPOINTDESC,LimsPoint_TESTNO,LimsPoint_ANALYLE,LimsPoint_fValue,LimsPoint_UNITS,Status,LimsPoint_High,LimsPoint_Low,Time from RTResEx_LimsPoint  order by status asc , Time desc ";//LimsPoint_PLANT like '%二催化%'
            DataSet ds  = dao.executeQuery(sql, Int32.Parse(page), Int32.Parse(rows));

            if (BeanTools.DataSetIsNotNull(ds))
            {
                grid.total = BeanTools.DBToInt(ds.Tables[0].Rows[0]["allrowCount"]); //获取总行数

                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    RTResExLimsPoint point = new RTResExLimsPoint();
                    String           value = dr["LimsPoint_fValue"].ToString();
                    point.limsPointMatCode         = (string)dr["LimsPoint_MATCODE"];
                    point.limsPointSamplePointDesc = dr["LimsPoint_SAMPLEPOINTDESC"].ToString();
                    point.limsPointTestNo          = (string)dr["LimsPoint_TESTNO"];

                    point.limsPointAnalyle = (string)dr["LimsPoint_ANALYLE"];
                    if (value.Length > 4)
                    {
                        value = value.Substring(0, 4);
                    }
                    point.limsPointFValue = value;
                    point.limsPointUnits  = (string)dr["LimsPoint_UNITS"];
                    point.status          = (string)dr["Status"];
                    point.limsPointHigh   = dr["LimsPoint_High"].ToString();
                    point.limsPointLow    = dr["LimsPoint_Low"].ToString();
                    point.time            = BeanTools.DataTimeToString(dr["Time"]);

                    limsPoint.Add(point);
                }
            }
            grid.rows = limsPoint;
            return(grid);
        }
コード例 #2
0
ファイル: ExpExecl.cs プロジェクト: xu2018meng/PSOG_new
        public static void fillcompToData(SqlDataReader dr, ISheet sheet, IRow row, ICellStyle datastyle, IFont datafont, ICellStyle style, IFont font, int rowIndex)
        {
            //设置列宽
            sheet.SetColumnWidth(0, 5500);
            sheet.SetColumnWidth(1, 5500);
            sheet.SetColumnWidth(2, 3700);
            sheet.SetColumnWidth(3, 5000);
            sheet.SetColumnWidth(4, 9000);

            //设置行高
            sheet.DefaultRowHeight = 350;

            //表头数据
            ICell cell0 = row.CreateCell(0);

            cell0.SetCellValue("开始时间");
            cell0.CellStyle = style;

            ICell cell1 = row.CreateCell(1);

            cell1.SetCellValue("结束时间");
            cell1.CellStyle = style;

            ICell cell2 = row.CreateCell(2);

            cell2.SetCellValue("报警个数");
            cell2.CellStyle = style;


            ICell cell3 = row.CreateCell(3);

            cell3.SetCellValue("10Min平均报警率");
            cell3.CellStyle = style;

            ICell cell4 = row.CreateCell(4);

            cell4.SetCellValue("报警位号");
            cell4.CellStyle = style;

            //填充数据
            if (null != dr)
            {
                while (dr.Read())
                {
                    rowIndex++;
                    row = sheet.CreateRow(rowIndex);

                    cell0 = row.CreateCell(0);
                    cell0.SetCellValue(BeanTools.DataTimeToString(dr["ZHStartTime"]));
                    cell0.CellStyle = datastyle;

                    cell1 = row.CreateCell(1);
                    cell1.SetCellValue(BeanTools.DataTimeToString(dr["ZHEndTime"]));
                    cell1.CellStyle = datastyle;


                    cell2 = row.CreateCell(2);
                    cell2.SetCellValue(BeanTools.ObjectToString(dr["ZHErrorCount"]));
                    cell2.CellStyle           = datastyle;
                    cell2.CellStyle.Alignment = HorizontalAlignment.RIGHT;

                    cell3 = row.CreateCell(3);
                    cell3.SetCellValue(Math.Round(BeanTools.ObjectToDouble(dr["ZHPercent"]), 7));
                    cell3.CellStyle           = datastyle;
                    cell3.CellStyle.Alignment = HorizontalAlignment.RIGHT;

                    string startTime = BeanTools.ObjectToString(dr["ZHAlarmItems"]);
                    cell4 = row.CreateCell(4);
                    cell4.SetCellValue(startTime);
                    cell4.CellStyle           = datastyle;
                    cell3.CellStyle.Alignment = HorizontalAlignment.LEFT;
                }
            }
        }
コード例 #3
0
ファイル: ExpExecl.cs プロジェクト: xu2018meng/PSOG_new
        /// <summary>
        /// 报警历史统计
        /// </summary>
        /// <param name="dt"></param>
        /// <param name="sheet"></param>
        /// <param name="row"></param>
        /// <param name="datastyle"></param>
        /// <param name="datafont"></param>
        /// <param name="style"></param>
        /// <param name="font"></param>
        /// <param name="rowIndex"></param>
        public static void fillHisData(DataTable dt, ISheet sheet, IRow row, ICellStyle datastyle, IFont datafont, ICellStyle style, IFont font, int rowIndex)
        {
            //设置列宽
            sheet.SetColumnWidth(0, 4000);
            sheet.SetColumnWidth(1, 8000);
            sheet.SetColumnWidth(2, 2600);
            sheet.SetColumnWidth(3, 2000);
            sheet.SetColumnWidth(4, 6000);
            sheet.SetColumnWidth(5, 5500);
            sheet.SetColumnWidth(6, 5500);

            //设置行高
            sheet.DefaultRowHeight = 350;

            //表头数据
            ICell cell0 = row.CreateCell(0);

            cell0.SetCellValue("位号");
            cell0.CellStyle = style;

            ICell cell1 = row.CreateCell(1);

            cell1.SetCellValue("描述");
            cell1.CellStyle = style;

            ICell cell2 = row.CreateCell(2);

            cell2.SetCellValue("状态");
            cell2.CellStyle = style;

            ICell cell3 = row.CreateCell(3);

            cell3.SetCellValue("分级");
            cell3.CellStyle = style;

            ICell cell4 = row.CreateCell(4);

            cell4.SetCellValue("持续时间");
            cell4.CellStyle = style;

            ICell cell5 = row.CreateCell(5);

            cell5.SetCellValue("开始时间");
            cell5.CellStyle = style;

            ICell cell6 = row.CreateCell(6);

            cell6.SetCellValue("结束时间");
            cell6.CellStyle = style;

            //填充数据
            if (null != dt)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    rowIndex++;
                    row = sheet.CreateRow(rowIndex);

                    cell0 = row.CreateCell(0);
                    cell0.SetCellValue(BeanTools.ObjectToString(dr["AlarmManager_History_Items"]));
                    cell0.CellStyle = datastyle;

                    cell1 = row.CreateCell(1);
                    cell1.SetCellValue(BeanTools.ObjectToString(dr["AlarmManager_History_Describe"]));
                    cell1.CellStyle           = datastyle;
                    cell1.CellStyle.Alignment = HorizontalAlignment.LEFT;

                    cell2 = row.CreateCell(2);
                    cell2.SetCellValue(BeanTools.ObjectToString(dr["AlarmManager_History_State"]));
                    cell2.CellStyle = datastyle;

                    cell3 = row.CreateCell(3);
                    cell3.SetCellValue(BeanTools.ObjectToString(dr["AlarmManager_History_AlarmClass"]));
                    cell3.CellStyle           = datastyle;
                    cell3.CellStyle.Alignment = HorizontalAlignment.LEFT;

                    string startTime = BeanTools.ObjectToString(dr["AlarmManager_History_StartTime"]);
                    string endTime   = BeanTools.ObjectToString(dr["AlarmManager_History_EndTime"]);
                    long   duration  = (string.IsNullOrEmpty(endTime) ? DateTime.Now.Ticks : DateTime.Parse(endTime).Ticks - DateTime.Parse(startTime).Ticks) / 555000000;
                    cell4 = row.CreateCell(4);
                    cell4.SetCellValue(duration);
                    cell4.CellStyle = datastyle;

                    cell5 = row.CreateCell(5);
                    cell5.SetCellValue(BeanTools.DataTimeToString(dr["AlarmManager_History_StartTime"]));
                    cell5.CellStyle           = datastyle;
                    cell5.CellStyle.Alignment = HorizontalAlignment.LEFT;

                    cell6 = row.CreateCell(6);
                    cell6.SetCellValue(BeanTools.DataTimeToString(dr["AlarmManager_History_EndTime"]));
                    cell6.CellStyle = datastyle;
                }
            }
        }