private void UpdateAction_Execute(object sender, EventArgs e) { QueryResult UniquePlant = new QueryResult(); try { Book.Visible = false; Book.AutoRedraw = false; FM.ClearBook(); FM.Book.BackColorBkg = Color.FromKnownColor(KnownColor.Control); FM.Book.Locked = false; int row = 2 /*1 - для заголовка*/, column = 1, maxrow = int.MinValue; bool allflag = (IntegralCheck.Checked && /*!PlantsCheck.Checked &&*/ !UNCCheck.Checked && !ProductsCheck.Checked); if (allflag) { UNCCheck.Checked = true; UNCCheck.Enabled = false; StatusSplash.ProgressInit(UNCCombo.Items.Count); } StatusSplash.Create(MainStatusStrip); for (int p = 0; p < (allflag ? UNCCombo.Items.Count : 1); p++) { StatusSplash.Message("Создание и анализ отчета..."); if (allflag) UNCCombo.SelectedIndex = p; // строим запрос OracleCommand Command = DataConnection.CreateCommand(); Command.CommandText = @" select unique plantid, longplantname, sortorder, standardnr, /*productid,*/ productdocument, /*ProductSpecification,*/ uncproductcode, synonymtext, /*productname,*/ testnd, testgroup, textmodule, uniontext, reqtext1, unit, uncmodulecode, sortnr, /*okpgroup, okpcode, ntd, shortname, tradename, ndname,*/ uncproduct from productspecificationview where /*plantid != 3 and*/ 1=1 %PlantMacro% %UNCMacro% %ProductMacro% order by uncproductcode, sortnr, sortorder, standardnr, synonymtext"; ApplyPlantMacro(Command); ApplyUNCMacro(Command); ApplyProductMacro(Command); QueryResult Data = new QueryResult(Command.ExecuteReader()); foreach (DataRow datarow in Data.Rows) foreach (DataColumn datacolumn in Data.Columns) datarow[datacolumn.ColumnName] = StartForm.DictionaryReplace(datarow[datacolumn.ColumnName].ToString()); QueryResult[] SplittedData = Data.Split("PlantID, LongPlantName", out UniquePlant); column = 1; Parts = new List<AnalyzePart>(); for (int i = 0; i < UniquePlant.Rows.Count; i++) { int startrow = row; ReportProduct(ref row, ref column, SplittedData[i], UniquePlant.Rows[i]); if (IntegralCheck.Checked) { //column += MaxCol; maxrow = Math.Max(maxrow, row); row = startrow; } } if (allflag) { row = maxrow + 1; FM.SetBorder(row, 1, row, FM.ColumnsCount, EdgeEnum.Top, LineStyleEnum.Thick); StatusSplash.ProgressAdd(); } if (IntegralCheck.Checked) AnalyzeParts(); } //FM.Book.Rows = maxrow + FM.Book.FixedRows; ReportTitle(1); if (allflag) { UNCCheck.Checked = false; UNCCheck.Enabled = true; } } finally { FM.Book.Locked = true; Book.AutoRedraw = true; Book.Refresh(); Book.Visible = true;// UniquePlant.Rows.Count > 0; StatusSplash.Close(); StatusSplash.Close(); } }
private void UpdateData(ref int row) { int startrow = row; StatusSplash.Message("��������� ������..."); DataCommand = OracleProc.Execute(DataConnection, "DataAccessPKG.GetCertTankData", new object[] { (PlantCombo.SelectedItem as DataRowView)["PlantID"], (ControlTypeCombo.SelectedItem as DataRowView)["OsgID"], (ProductCombo.SelectedItem as DataRowView)["ProductID"],Date1.Value, Date2.Value, null }); DataResult = new QueryResult(DataCommand.Parameters["rc"].Value); foreach (DataRow dr in DataResult.Rows) { dr["TestGroup"] = StartForm.DictionaryReplace(dr["TestGroup"].ToString()); dr["TextModule"] = StartForm.DictionaryReplace(dr["TextModule"].ToString()); } QueryResult UniqueSplit; QueryResult[] SplittedData = DataResult.Split("plantid, productid, certproductdescription", out UniqueSplit); Parts = new ReportPart[SplittedData.Length]; StatusSplash.Message("������������ ������..."); // ����� ���� ������ ������ �� ����� - ������ �� ����������� �������� StatusSplash.ProgressInit(SplittedData.Length); for (int i = 0; i < SplittedData.Length; i++) { Parts[i] = new ReportPart(); Parts[i].Data = SplittedData[i].Transpose( "plantid, productid, qaonr, qaodecisiontime, tank, tanklevel, tankmass, batchno, certnr", "testgroup, textmodule, modulenorm, precisionid", "result, upperlimit, lowerlimit", out Parts[i].Rows, out Parts[i].Columns); Parts[i].Data.Columns.Add(new DataColumn("RowNumber", typeof(int))); Parts[i].DataFields = new Dictionary<int, string>(); // ������� ���������� � ����� - �����, ������� int inforow = row; row += 1;//row += 2; Parts[i].TitleInfoRow = inforow; UpdatePart(Parts[i], ref row); /*FM.DrawCell(inforow, 1, inforow, Parts[i].DynamicColumns.LastColumn, plants.FindPlant(Convert.ToInt32(UniqueSplit[i, "plantid"])).ShortPlantName, AlignmentEnum.LeftCenter, true, true).FontSize = 10;*/ FM.DrawCell(inforow/*+1*/, 1, inforow/*+1*/, Parts[i].DynamicColumns.LastColumn, UniqueSplit[i, "certproductdescription"], AlignmentEnum.LeftCenter, true, true).FontSize = 10; FM.SetRowAutoHeight(inforow, inforow + 1); StatusSplash.ProgressAdd(); } row++; }
private void ReportProduct(ref int row, ref int column, QueryResult PlantData, DataRow Plant) { int maxrow = int.MinValue, startrow = row; // Делим данные по продуктам QueryResult UniqueProduct; // UNCProductCode, ProductName, SynonymText, TradeName, NDName, NTD, ProductDocument, TradeName, NDName, NTD QueryResult[] SplittedData = PlantData.Split("StandardNR, UNCProductCode, SynonymText, ProductDocument", out UniqueProduct); for (int i = 0; i < UniqueProduct.Rows.Count; i++) { if (i > 0 && !IntegralCheck.Checked) row += 2; ReportData(ref row, column, SplittedData[i], Plant, UniqueProduct.Rows[i]); maxrow = Math.Max(maxrow, row); if (IntegralCheck.Checked) { column += MaxCol; row = startrow; } /*else row++;*/ // рисуем границу } //row--; row = maxrow; }