private void ProcessReportSolution(reportSolution rSol) { // create document Document doc = new Document(rSol.reportParameters.name, rSol.reportParameters.description, rSol.reportParameters.author, DateTime.Now, null); // load analysis CasePalletAnalysis analysis = LoadPalletAnalysis(doc, rSol.solutionRef.analysisId); if (null == analysis) { return; } // compute solutions treeDiM.StackBuilder.Engine.CasePalletSolver solver = new treeDiM.StackBuilder.Engine.CasePalletSolver(); solver.ProcessAnalysis(analysis); // retrieve wanted solution List <Basics.CasePalletSolution> solutions = analysis.Solutions; if (rSol.solutionRef.index >= solutions.Count) { throw new Exception(string.Format("Analysis {0} has no solution with index {1}", analysis.Name, rSol.solutionRef.index)); } Basics.CasePalletSolution sol = solutions[(int)rSol.solutionRef.index]; // selected solution SelCasePalletSolution selSolution = new SelCasePalletSolution(doc, analysis, sol); // generate report ReporterMSWord reporter = new ReporterMSWord(new ReportData(analysis, selSolution) , rSol.reportParameters.templateFilePath, rSol.reportParameters.outputPath, new Margins()); }
private void toolStripButtonReport_Click(object sender, EventArgs e) { try { Document doc; CasePalletAnalysis analysis; CasePalletSolution casePalletSol; if (!GenerateProject(out doc, out analysis, out casePalletSol)) { return; } SelCasePalletSolution selSolution = new SelCasePalletSolution(doc, analysis, casePalletSol); // define report FormDefineReport formReport = new FormDefineReport(); formReport.ProjectName = doc.Name; if (DialogResult.OK != formReport.ShowDialog()) { return; } Reporter.CompanyLogo = string.Empty; Reporter.ImageSizeSetting = Reporter.eImageSize.IMAGESIZE_DEFAULT; Reporter reporter; ReportData reportData = new ReportData(analysis, selSolution); if (formReport.FileExtension == "doc") { // create "MS Word" report file reporter = new ReporterMSWord( reportData , Settings.Default.ReportTemplatePath , formReport.FilePath , new Margins()); } else if (formReport.FileExtension == "html") { // create "html" report file reporter = new ReporterHtml( reportData , Settings.Default.ReportTemplatePath , formReport.FilePath); } else { return; } // open file if (formReport.OpenGeneratedFile) { Process.Start(new ProcessStartInfo(formReport.FilePath)); } } catch (Exception ex) { _log.Error(ex.ToString()); } }
/// <summary> /// handles ECT analysis removal /// </summary> public void OnECTAnalysisRemoved(Document doc, CasePalletAnalysis analysis, SelCasePalletSolution selSolution, ECTAnalysis ectAnalysis) { /* * // get node * TreeNode ectAnalysisNode = FindNode(null, new NodeTag(NodeTag.NodeType.NT_ECTANALYSIS, doc, analysis, selSolution, ectAnalysis)); * // test * if (null == ectAnalysisNode) * { * _log.Warn(string.Format("Failed to find a valid tree node for truck analysis {0}", ectAnalysis.Name)); * } * // remove node * Nodes.Remove(ectAnalysisNode); */ }
private void ToolsGenerateReport(object sender, EventArgs e) { try { FormDefineReport formReport = new FormDefineReport(); formReport.ProjectName = _analysis.Name; if (DialogResult.OK != formReport.ShowDialog()) { return; } // selected solution SelCasePalletSolution selSolution = new SelCasePalletSolution(null, _analysis, CurrentSolution); ReportData reportData = new ReportData(_analysis, selSolution); Reporter.CompanyLogo = string.Empty; Reporter.ImageSizeSetting = Reporter.eImageSize.IMAGESIZE_DEFAULT; Reporter reporter; if (formReport.FileExtension == "doc") { // create "MS Word" report file reporter = new ReporterMSWord( reportData , Settings.Default.ReportTemplatePath , formReport.FilePath , new Margins()); } else if (formReport.FileExtension == "html") { // create "html" report file reporter = new ReporterHtml( reportData , Settings.Default.ReportTemplatePath , formReport.FilePath); } else { return; } // open file if (formReport.OpenGeneratedFile) { Process.Start(new ProcessStartInfo(formReport.FilePath)); } } catch (Exception ex) { _log.Error(ex.ToString()); } }
public void OnECTAnalysisRemoved(Document doc, CasePalletAnalysis analysis, SelCasePalletSolution selectedSolution, ECTAnalysis ectAnalysis) { }
/* * public void OnCaseAnalysisRemoved(Document doc, BoxCasePalletAnalysis caseAnalysis) * { * } */ public void OnTruckAnalysisRemoved(Document doc, CasePalletAnalysis analysis, SelCasePalletSolution selectedSolution, TruckAnalysis truckAnalysis) { }
void onSolutionSelectionChanged(CasePalletAnalysis analysis, SelCasePalletSolution selSolution) { UpdateSelectButtonText(); UpdateGridCheckBoxes(); }