Ejemplo n.º 1
0
 public ReportData(
     CasePalletAnalysis palletAnalysis, SelCasePalletSolution selSolution
     , CylinderPalletAnalysis cylinderPalletAnalysis, SelCylinderPalletSolution selCylinderPalletSolution
     , HCylinderPalletAnalysis hCylinderPalletAnalysis, SelHCylinderPalletSolution selHCylinderPalletSolution
     , BoxCaseAnalysis boxCaseAnalysis, SelBoxCaseSolution selBoxCaseSolution
     , BoxCasePalletAnalysis caseAnalysis, SelBoxCasePalletSolution selCaseSolution
     , PackPalletAnalysis packPalletAnalysis, SelPackPalletSolution selPackPalletSolution
     )
 {
     // case/pallet analysis
     _palletAnalysis = palletAnalysis;
     _selSolution = selSolution;
     // box/case/pallet analysis
     _caseAnalysis = caseAnalysis;
     _selCaseSolution = selCaseSolution;
     // Cylinder analysis
     _cylinderPalletAnalysis = cylinderPalletAnalysis;
     _selCylinderPalletSolution = selCylinderPalletSolution;
     // HCylinder analysis
     _hCylinderPalletAnalysis = hCylinderPalletAnalysis;
     _selHCylinderPalletSolution = selHCylinderPalletSolution;
     // Box case analysis
     _boxCaseAnalysis = boxCaseAnalysis;
     _selBoxCaseSolution = selBoxCaseSolution;
     // Pack pallet analysis
     _packPalletAnalysis = packPalletAnalysis;
     _selPackPalletSolution = selPackPalletSolution;
 }
Ejemplo n.º 2
0
 public void UnSelectSolution(SelBoxCaseSolution selSolution)
 {
     if (null == selSolution)
     {
         return;                      // this solution not selected
     }
     // remove from list
     _selectedSolutions.Remove(selSolution);
     ParentDocument.RemoveItem(selSolution);
     // fire event
     if (null != SolutionSelectionRemoved)
     {
         SolutionSelectionRemoved(this, selSolution);
     }
     // set document modified (not analysis, otherwise selected solutions are erased)
     ParentDocument.Modify();
 }
Ejemplo n.º 3
0
        public void SelectSolutionByIndex(int index)
        {
            if (index < 0 || index > _solutions.Count)
            {
                return;  // no solution with this index
            }
            if (HasSolutionSelected(index))
            {
                return;                                         // solution already selected
            }
            // instantiate new SelSolution
            SelBoxCaseSolution selSolution = new SelBoxCaseSolution(ParentDocument, this, _solutions[index]);

            // insert in list
            _selectedSolutions.Add(selSolution);
            // fire event
            if (null != SolutionSelected)
            {
                SolutionSelected(this, selSolution);
            }
            // set document modified (not analysis, otherwise selected solutions are erased)
            ParentDocument.Modify();
        }
 void onSolutionSelectionChanged(BoxCaseAnalysis analysis, SelBoxCaseSolution selSolution)
 {
     UpdateSelectButtonText();
     UpdateGridCheckBoxes();
 }
Ejemplo n.º 5
0
        public void SaveBoxCaseSolution(BoxCaseAnalysis analysis, BoxCaseSolution sol, SelBoxCaseSolution selSolution, XmlElement solutionsElt, XmlDocument xmlDoc)
        {
            // Solution
            XmlElement solutionElt = xmlDoc.CreateElement("Solution");
            solutionsElt.AppendChild(solutionElt);
            // Pattern name
            XmlAttribute patternNameAttribute = xmlDoc.CreateAttribute("Pattern");
            patternNameAttribute.Value = sol.PatternName;
            solutionElt.Attributes.Append(patternNameAttribute);
            // ortho axis
            XmlAttribute orthoAxisAttribute = xmlDoc.CreateAttribute("OrthoAxis");
            orthoAxisAttribute.Value = HalfAxis.ToString(sol.OrthoAxis);
            solutionElt.Attributes.Append(orthoAxisAttribute);
            // limit
            XmlAttribute limitReached = xmlDoc.CreateAttribute("LimitReached");
            limitReached.Value = string.Format("{0}", (int)sol.LimitReached);
            solutionElt.Attributes.Append(limitReached);
            // layers
            XmlElement layersElt = xmlDoc.CreateElement("Layers");
            solutionElt.AppendChild(layersElt);

            foreach (BoxLayer boxLayer in sol)
                Save(boxLayer, layersElt, xmlDoc);

            // Is selected ?
            if (null != selSolution)
            {
                // selected attribute
                XmlAttribute selAttribute = xmlDoc.CreateAttribute("Selected");
                selAttribute.Value = "true";
                solutionElt.Attributes.Append(selAttribute);
            }
        }
Ejemplo n.º 6
0
 public ReportData(BoxCaseAnalysis boxCaseAnalysis, SelBoxCaseSolution selBoxCaseSolution)
 {
     _boxCaseAnalysis = boxCaseAnalysis;
     _selBoxCaseSolution = selBoxCaseSolution;
 }
Ejemplo n.º 7
0
 private void onBoxCaseAnalysisSolutionSelectionRemoved(BoxCaseAnalysis analysis, SelBoxCaseSolution selSolution)
 {
     // retrieve parent document
     Document doc = analysis.ParentDocument;
     // get node
     TreeNode selSolutionNode = FindNode(null, new NodeTag(NodeTag.NodeType.NT_BOXCASEANALYSISSOLUTION, doc, analysis, selSolution));
     // test
     if (null == selSolutionNode)
     {
         _log.Error(string.Format("Failed to find a valid tree node for selSolution {0}", selSolution.Name));
         return;
     }
     // remove node
     Nodes.Remove(selSolutionNode);
 }
Ejemplo n.º 8
0
 private void onBoxCaseAnalysisSolutionSelected(BoxCaseAnalysis analysis, SelBoxCaseSolution selSolution)
 {
     // retrieve parent document
     Document doc = analysis.ParentDocument;
     // get parent node
     TreeNode parentNode = FindNode(null, new NodeTag(NodeTag.NodeType.NT_BOXCASEANALYSIS, doc, analysis));
     // insert selected solution node
     TreeNode nodeSelSolution = new TreeNode(selSolution.Name, 15, 15);
     nodeSelSolution.Tag = new NodeTag(NodeTag.NodeType.NT_BOXCASEANALYSISSOLUTION, doc, analysis, selSolution);
     parentNode.Nodes.Add(nodeSelSolution);
     // expand tree nodes
     parentNode.Expand();
 }
Ejemplo n.º 9
0
 public NodeTag(NodeType type, Document doc, BoxCaseAnalysis boxCaseAnalysis, SelBoxCaseSolution selBoxCaseSolution)
 {
     _type = type;
     _document = doc;
     _boxCaseAnalysis = boxCaseAnalysis;
     _selBoxCaseSolution = selBoxCaseSolution;
 }
Ejemplo n.º 10
0
 public void onBoxCaseAnalysisSolutionRemoved(Document doc, BoxCaseAnalysis boxCaseAnalysis, SelBoxCaseSolution selSolution)
 {
     // get node
     TreeNode selSolutionNode = FindNode(null, new NodeTag(NodeTag.NodeType.NT_CASESOLUTION, doc, boxCaseAnalysis, selSolution));
     // test
     if (null == selSolutionNode)
     {
         _log.Error(string.Format("Failed to find a valid tree node for selSolution {0}", selSolution.Name));
         return;
     }
     // remove node
     Nodes.Remove(selSolutionNode);
 }
        private void ToolsGenerateReport(object sender, EventArgs e)
        {
            try
            {
                FormDefineReport formReport = new FormDefineReport();
                formReport.ProjectName = _analysis.Name;
                if (DialogResult.OK != formReport.ShowDialog())
                    return;
                // selected solution
                SelBoxCaseSolution selSolution = new SelBoxCaseSolution(_doc, _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());
            }
        }
Ejemplo n.º 12
0
 public void UnSelectSolution(SelBoxCaseSolution selSolution)
 {
     if (null == selSolution) return; // this solution not selected
     // remove from list
     _selectedSolutions.Remove(selSolution);
     ParentDocument.RemoveItem(selSolution);
     // fire event
     if (null != SolutionSelectionRemoved)
         SolutionSelectionRemoved(this, selSolution);
     // set document modified (not analysis, otherwise selected solutions are erased)
     ParentDocument.Modify();
 }
Ejemplo n.º 13
0
 public void SelectSolutionByIndex(int index)
 {
     if (index < 0 || index > _solutions.Count)
         return;  // no solution with this index
     if (HasSolutionSelected(index)) return;             // solution already selected
     // instantiate new SelSolution
     SelBoxCaseSolution selSolution = new SelBoxCaseSolution(ParentDocument, this, _solutions[index]);
     // insert in list
     _selectedSolutions.Add(selSolution);
     // fire event
     if (null != SolutionSelected)
         SolutionSelected(this, selSolution);
     // set document modified (not analysis, otherwise selected solutions are erased)
     ParentDocument.Modify();
 }