GBData.cs 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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.International_language(dev_internationalLanguage);
  49. for (int i = 0; i < m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList.Count; i++)
  50. {
  51. string anothername = m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[i].anotherFileName.ToString();
  52. 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();
  53. m_otsreport_export.m_ReportApp.m_rstDataMgr.m_ReportMgr.AddASmplMsrResultMgr(resultfile, anothername);
  54. }
  55. List<string> datasourcelist = m_otsreport_export.m_ReportApp.m_conditionChoose.m_conditionData.GetComboDownListByItemName(OTS_REPORT_PROP_GRID_ITEMS.DATA_SOURCE);
  56. OTSCLRINTERFACE.CPropParamClr clr_prop = m_otsreport_export.m_ReportApp.m_rstDataMgr.m_ReportMgr.GetPropertyParamTable();
  57. clr_prop.SetDataSourceList(datasourcelist);
  58. clr_prop.SetDataSourceId(Index);//
  59. clr_prop.SetCalTableType((int)CALCULATE_TABLE_TYPE.GB_Method1);
  60. clr_prop.SetType((int)DisplayPicutureType.AnalyzeDataTable);//table
  61. var tbl = m_otsreport_export.m_ReportApp.m_rstDataMgr.m_ReportMgr.GetAllGBFields(clr_prop);
  62. GB_Report.setResultGrid(m_otsreport_export.m_mbszclass, tbl);
  63. if (gb_1)
  64. {
  65. List<DataTable> GB1 = InsertReportTemplateTable_ChineseStandardABCDDS(clr_prop, datasourcelist, Index, (int)CALCULATE_TABLE_TYPE.GB_Method1);
  66. DataView dv_gb1 = GB1[4].DefaultView;
  67. dv_gb1.Sort = "Grade desc";
  68. DataTable dt_gb1 = dv_gb1.ToTable();
  69. for (int i=0; i < GB1[4].Rows.Count;i++)
  70. {
  71. for(int a=0;a< GB1[4].Columns.Count;a++)
  72. {
  73. GB1[4].Rows[i][a] = dt_gb1.Rows[i][a];
  74. }
  75. }
  76. List<string> GB1NameList = new List<string>();
  77. GB1NameList.Add("A类");
  78. GB1NameList.Add("B类");
  79. GB1NameList.Add("C类");
  80. GB1NameList.Add("D类");
  81. GB1NameList.Add("DS类");
  82. GB_Report.set_GB_Method(GB1, GB1NameList, "方法一");
  83. }
  84. if (gb_2)
  85. {
  86. List<DataTable> GB2 = InsertReportTemplateTable_ChineseStandardABCDDS(clr_prop, datasourcelist, Index, (int)CALCULATE_TABLE_TYPE.GB_Method2);
  87. DataView dv_gb1 = GB2[5].DefaultView;
  88. dv_gb1.Sort = "Grade desc";
  89. DataTable dt_gb1 = dv_gb1.ToTable();
  90. for (int i = 0; i < GB2[5].Rows.Count; i++)
  91. {
  92. for (int a = 0; a < GB2[5].Columns.Count; a++)
  93. {
  94. GB2[5].Rows[i][a] = dt_gb1.Rows[i][a];
  95. }
  96. }
  97. List<string> GB2NameList = new List<string>();
  98. GB2NameList.Add("A类");
  99. GB2NameList.Add("B类");
  100. GB2NameList.Add("C类");
  101. GB2NameList.Add("D类");
  102. GB2NameList.Add("D硫化物类");
  103. GB2NameList.Add("DS类");
  104. GB_Report.set_GB_Method(GB2, GB2NameList, "方法二");
  105. }
  106. DevExpress.XtraReports.UI.ReportPrintTool tool = new DevExpress.XtraReports.UI.ReportPrintTool(GB_Report);
  107. tool.ShowPreview();
  108. }
  109. }
  110. }