private item BuildItem(AnalysisHomo analysis) { if (analysis is AnalysisCasePallet analysisCasePallet) { Packable packable = analysisCasePallet.Content; ConstraintSetCasePallet constraintSet = analysisCasePallet.ConstraintSet as ConstraintSetCasePallet; bool[] orient = constraintSet.AllowedOrientations; StringBuilder sbOrient = new StringBuilder(); foreach (bool b in orient) { sbOrient.Append(b ? "1" : "0"); } return(new item() { id = 1, name = packable.Name, length = packable.OuterDimensions.X, width = packable.OuterDimensions.Y, height = packable.OuterDimensions.Z, weight = packable.Weight, maxWeightOnTop = 0.0, permittedOrientations = sbOrient.ToString() }); } else { throw new Exception(string.Format("Unexpected analysis type : {0}", analysis.GetType())); } }
private loadSpace BuildLoadSpace(AnalysisHomo analysis) { if (analysis is AnalysisCasePallet analysisCasePallet) { PalletProperties palletProperties = analysisCasePallet.PalletProperties; ConstraintSetCasePallet constraintSet = analysisCasePallet.ConstraintSet as ConstraintSetCasePallet; return(new loadSpace() { id = 1, name = palletProperties.Name, length = palletProperties.Length, width = palletProperties.Width, baseHeight = palletProperties.Height, maxLengthOverhang = constraintSet.Overhang.X, maxWidthOverhang = constraintSet.Overhang.Y, maxLoadHeight = constraintSet.OptMaxHeight.Activated ? constraintSet.OptMaxHeight.Value : 0.0, maxLoadWeight = constraintSet.OptMaxWeight.Activated ? constraintSet.OptMaxWeight.Value : 0.0 }); } else { throw new Exception(string.Format("Unexpected analysis type : {0}", analysis.GetType())); } }
public void EditAnalysis(AnalysisHomo analysis) { // search for any DockContentAnalysis window and close it var seq = (from view in Views where view is DockContentAnalysisEdit && analysis == (view as DockContentAnalysisEdit).Analysis select view); if (seq.Count() > 0) { seq.First().Close(); } // instantiate a form to edit analysis Form form = null; if (analysis is AnalysisCasePallet analysisCasePallet) { form = new FormNewAnalysisCasePallet(this, analysisCasePallet); } else if (analysis is AnalysisBoxCase analysisBoxCase) { form = new FormNewAnalysisBoxCase(this, analysisBoxCase); } else if (analysis is AnalysisCylinderPallet analysisCylinderPallet) { form = new FormNewAnalysisCylinderPallet(this, analysisCylinderPallet); } else if (analysis is AnalysisCylinderCase analysisCylinderCase) { form = new FormNewAnalysisCylinderCase(this, analysisCylinderCase); } else if (analysis is AnalysisPalletTruck analysisPalletTruck) { form = new FormNewAnalysisPalletTruck(this, analysisPalletTruck); } else if (analysis is AnalysisCaseTruck analysisCaseTruck) { form = new FormNewAnalysisCaseTruck(this, analysisCaseTruck); } else if (analysis is AnalysisCylinderTruck analysisCylinderTruck) { form = new FormNewAnalysisCylinderTruck(this, analysisCylinderTruck); } else if (analysis is AnalysisHCylPallet analysisHCylPallet) { form = new FormNewAnalysisHCylPallet(this, analysisHCylPallet); } else if (analysis is AnalysisHCylTruck analysisHCylTruck) { form = new FormNewAnalysisHCylTruck(this, analysisHCylTruck); } else { _log.Error($"Unexepected analysis type = {analysis.GetType()}"); return; } if (DialogResult.OK == form.ShowDialog()) { Modify(); } }