GBData.cs 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. using System.Collections.Generic;
  2. using System.Data;
  3. using OTSIncAReportApp.ReportTemplate;
  4. using OTSIncAReportApp.OTSSampleReportInfo;
  5. namespace OTSIncAReportApp.OTSTemplateDesigner
  6. {
  7. public class GBData
  8. {
  9. #region 全局变量
  10. public OTSReport_Export m_otsreport_export;
  11. #endregion
  12. #region 构造函数
  13. public GBData(OTSReport_Export in_export)
  14. {
  15. m_otsreport_export = in_export;
  16. }
  17. #endregion
  18. /// <summary>
  19. /// 国标一
  20. /// </summary>
  21. /// <returns></returns>
  22. public List<DataTable> InsertReportTemplateTable_ChineseStandardABCDDS(OTSCLRINTERFACE.CPropParamClr cPropParamClr, List<string> datasourcelist , int DataSourceId ,int GB_index)
  23. {
  24. //得到国标一的DataTable表格
  25. cPropParamClr.SetDataSourceList(datasourcelist);
  26. cPropParamClr.SetDataSourceId(DataSourceId);//
  27. cPropParamClr.SetType((int)OTSSampleReportInfo.DisplayPicutureType.AnalyzeDataTable);//table
  28. cPropParamClr.SetCalTableType(GB_index);//国标1
  29. if (GB_index == (int)OTSSampleReportInfo.CALCULATE_TABLE_TYPE.GB_Method1)
  30. {
  31. List<OTSCLRINTERFACE.CGridDataClr> listGriddataclr = m_otsreport_export.m_ReportApp.m_rstDataMgr.m_ReportMgr.GridDataTransfer(cPropParamClr);
  32. m_otsreport_export.m_ReportApp.im_ChineseStandardABCDDS = new OTSIncAReportGB.ChineseStandardABCDDS(m_otsreport_export.m_ReportApp.m_rstDataMgr.m_ReportMgr, listGriddataclr);
  33. m_otsreport_export.m_ReportApp.m_TablesWindow.Controls.Clear();
  34. return m_otsreport_export.m_ReportApp.im_ChineseStandardABCDDS.ChineseStandardABCD_GetDataTable(); ;
  35. }
  36. else
  37. {
  38. List<OTSCLRINTERFACE.CGridDataClr> listGriddataclr2 = m_otsreport_export.m_ReportApp.m_rstDataMgr.m_ReportMgr.GridDataTransfer(cPropParamClr);//
  39. m_otsreport_export.m_ReportApp.m_TablesWindow.Controls.Clear();
  40. m_otsreport_export.m_ReportApp.im_NationalStandardMethodTwo = new OTSIncAReportGB.NationalStandardMethodTwo(m_otsreport_export.m_ReportApp.m_rstDataMgr.m_ReportMgr, listGriddataclr2);
  41. return m_otsreport_export.m_ReportApp.im_NationalStandardMethodTwo.ChineseStandardABCD_GetDataTable();
  42. }
  43. }
  44. public void criterion_out(GBReport GB_Report, OTSReport_Export in_export,int Index,DataTable dev_internationalLanguage,bool gb_1,bool gb_2,bool AmericanStandard,bool GermanStandard)
  45. {
  46. //首页信息
  47. GB_Report = new GBReport(in_export);
  48. GB_Report.setResultGrid(m_otsreport_export.m_mbszclass);
  49. GB_Report.International_language(dev_internationalLanguage);
  50. for (int i = 0; i < m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList.Count; i++)
  51. {
  52. string anothername = m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[i].anotherFileName.ToString();
  53. string resultfile = m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[i].FilePath.ToString() + "\\" + m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[i].FileName_real.ToString();
  54. m_otsreport_export.m_ReportApp.m_rstDataMgr.m_ReportMgr.AddASmplMsrResultMgr(resultfile, anothername);
  55. }
  56. OTSCLRINTERFACE.CPropParamClr clr_prop = m_otsreport_export.m_ReportApp.m_rstDataMgr.m_ReportMgr.GetPropertyParamTable();
  57. List<string> datasourcelist = m_otsreport_export.m_ReportApp.m_conditionChoose.m_conditionData.GetComboDownListByItemName(OTS_REPORT_PROP_GRID_ITEMS.DATA_SOURCE);
  58. if (gb_1)
  59. {
  60. List<DataTable> GB1 = InsertReportTemplateTable_ChineseStandardABCDDS(clr_prop, datasourcelist, Index, (int)CALCULATE_TABLE_TYPE.GB_Method1);
  61. DataView dv_gb1 = GB1[4].DefaultView;
  62. dv_gb1.Sort = "Grade desc";
  63. DataTable dt_gb1 = dv_gb1.ToTable();
  64. for (int i=0; i < GB1[4].Rows.Count;i++)
  65. {
  66. for(int a=0;a< GB1[4].Columns.Count;a++)
  67. {
  68. GB1[4].Rows[i][a] = dt_gb1.Rows[i][a];
  69. }
  70. }
  71. List<string> GB1NameList = new List<string>();
  72. GB1NameList.Add("A类");
  73. GB1NameList.Add("B类");
  74. GB1NameList.Add("C类");
  75. GB1NameList.Add("D类");
  76. GB1NameList.Add("DS类");
  77. GB_Report.set_GB_Method(GB1, GB1NameList, "方法一");
  78. }
  79. if (gb_2)
  80. {
  81. List<DataTable> GB2 = InsertReportTemplateTable_ChineseStandardABCDDS(clr_prop, datasourcelist, Index, (int)CALCULATE_TABLE_TYPE.GB_Method2);
  82. DataView dv_gb1 = GB2[5].DefaultView;
  83. dv_gb1.Sort = "Grade desc";
  84. DataTable dt_gb1 = dv_gb1.ToTable();
  85. for (int i = 0; i < GB2[5].Rows.Count; i++)
  86. {
  87. for (int a = 0; a < GB2[5].Columns.Count; a++)
  88. {
  89. GB2[5].Rows[i][a] = dt_gb1.Rows[i][a];
  90. }
  91. }
  92. List<string> GB2NameList = new List<string>();
  93. GB2NameList.Add("A类");
  94. GB2NameList.Add("B类");
  95. GB2NameList.Add("C类");
  96. GB2NameList.Add("D类");
  97. GB2NameList.Add("D硫化物类");
  98. GB2NameList.Add("DS类");
  99. GB_Report.set_GB_Method(GB2, GB2NameList, "方法二");
  100. }
  101. DevExpress.XtraReports.UI.ReportPrintTool tool = new DevExpress.XtraReports.UI.ReportPrintTool(GB_Report);
  102. tool.ShowPreview();
  103. }
  104. }
  105. }