public PalletSolutionDesc(PalletSolutionDatabase db, CasePalletSolution sol, string friendlyName) { BoxProperties boxProperties = sol.Analysis.BProperties as BoxProperties; PalletProperties palletProperties = sol.Analysis.PalletProperties; PalletConstraintSet constraintSet = sol.Analysis.ConstraintSet; _guid = Guid.NewGuid(); _friendlyName = friendlyName; _key = new PalletSolutionKey( palletProperties.Length, palletProperties.Width, constraintSet.MaximumHeight , constraintSet.OverhangX, constraintSet.OverhangY); _caseDimensions[0] = boxProperties.Length; _caseDimensions[1] = boxProperties.Width; _caseDimensions[2] = boxProperties.Height; _insideCaseDimensions[0] = boxProperties.InsideLength; _insideCaseDimensions[1] = boxProperties.InsideWidth; _insideCaseDimensions[2] = boxProperties.InsideHeight; _caseWeight = boxProperties.Weight; _palletWeight = palletProperties.Weight; _caseOrientation = sol.CaseOrientation; _caseCount = sol.CaseCount; _parentDB = db; }
/// <summary> /// Loads pallet solution from database file /// </summary> public CasePalletSolution LoadPalletSolution() { if (null == _palletSolution) { if (!File.Exists(FullFilePath)) { return(null); // database file not available -> existing } else { Document doc = new Document(FullFilePath, null); if (!doc.AnalysesCasePallet.Any()) { return(null); // no analysis -> exiting } CasePalletAnalysis analysis = doc.AnalysesCasePallet.First() as CasePalletAnalysis; if (analysis.Solutions.Count < 1) { return(null); // no solution -> exiting } _palletSolution = null; // doc.CasePalletAnalyses[0].Solutions[0]; } } return(_palletSolution); }
public SelCasePalletSolution(Document document, CasePalletAnalysis analysis, CasePalletSolution sol) : base(document) { _analysis = analysis; _analysis.AddDependancy(this); _solution = sol; ID.Name = sol.Title; }
public void SelectSolutionBySol(CasePalletSolution sol) { if (HasSolutionSelected(sol)) { return; } // instantiate new SelSolution var selSolution = new SelCasePalletSolution(ParentDocument, this, sol); // insert in list _selectedSolutions.Add(selSolution); // fire event SolutionSelected?.Invoke(this, selSolution); // set document modified (not analysis, otherwise selected solutions are erased) ParentDocument.Modify(); }
public int CompareTo(object obj) { CasePalletSolution sol = (CasePalletSolution)obj; if (this.CaseCount > sol.CaseCount) { return(-1); } else if (this.CaseCount == sol.CaseCount) { return(0); } else { return(1); } }
/// <summary> /// Append new solution descriptor /// </summary> /// <param name="desc"></param> public void Append(SelCasePalletSolution selSolution, string name, bool keepSimilarSolutions) { Document document = selSolution.Analysis.ParentDocument; CasePalletSolution sol = selSolution.Solution; CasePalletAnalysis analysis = sol.Analysis; // instantiate new descriptor PalletSolutionDesc desc = new PalletSolutionDesc(this, sol, name); // remove similar solutions if (!keepSimilarSolutions) { RemoveByKeyAndCaseDimensions(desc); } // save solution as stb file document.WriteSolution(selSolution, desc.FullFilePath); _palletSolutionList.Add(desc); _palletSolutionList.Sort(); if (null != SolutionAppended) { SolutionAppended(this, new PalletSolutionEventArgs(desc)); } Save(); }
public bool HasSolutionSelected(CasePalletSolution sol) { return(null != GetSelSolutionBySolution(sol)); }
public SelCasePalletSolution GetSelSolutionBySolution(CasePalletSolution sol) { return(_selectedSolutions.Find(delegate(SelCasePalletSolution selSol) { return selSol.Solution == sol; })); }
public void UnSelectSolutionBySol(CasePalletSolution sol) { UnSelectSolution(GetSelSolutionBySolution(sol)); }
public CaseOptimSolution(CaseDefinition caseDefinition, CasePalletSolution palletSolution) { _caseDefinition = caseDefinition; _palletSolution = palletSolution; }
public SelCasePalletSolution GetSelSolutionBySolution(CasePalletSolution sol) { return(_selectedSolutions.Find(selSol => selSol.Solution == sol)); }