/* * Copyright (c) 2018 iTAC Software AG, Germany. All Rights Reserved. * * This software is protected by copyright. Under no circumstances may any part of this file in any form be copied, * printed, edited or otherwise distributed, be stored in a retrieval system, or be translated into another language * without the written permission of iTAC Software AG. */ // created 31.10.2018 08:16:46 using System; using System.Collections.Generic; using com.itac.oib.monitoring.contracts.data; namespace com.itac.oib.monitoring.contracts.data { // source: assembly 5.1.0.84 // source: assembly ASM.AS.OIB.Monitoring.Proxy public class RecipeMapper { // used for itac->asm: True // used for asm->itac: True // maps iTAC namespace conform type to ASM namespace type public static Asm.As.Oib.Monitoring.Proxy.Business.Objects.Recipe get(Recipe asmRecipe) { if (asmRecipe == null) { return null; } Asm.As.Oib.Monitoring.Proxy.Business.Objects.Recipe itacRecipe = new Asm.As.Oib.Monitoring.Proxy.Business.Objects.Recipe(); mapItac2Asm(itacRecipe, asmRecipe); return itacRecipe; } public static void mapItac2Asm(Asm.As.Oib.Monitoring.Proxy.Business.Objects.Recipe itacRecipe, Recipe asmRecipe) { itacRecipe.LineName = asmRecipe.LineName; itacRecipe.LineFullPath = asmRecipe.LineFullPath; itacRecipe.StationName = asmRecipe.StationName; itacRecipe.StationFullPath = asmRecipe.StationFullPath; itacRecipe.StartTime = asmRecipe.StartTime; // complex property Conveyor, isArray:False, isGeneric:False itacRecipe.Conveyor = com.itac.oib.monitoring.contracts.data.ConveyorTypeMapper.get( asmRecipe.Conveyor); itacRecipe.RecipeName = asmRecipe.RecipeName; itacRecipe.RecipeFullPath = asmRecipe.RecipeFullPath; itacRecipe.SetupName = asmRecipe.SetupName; itacRecipe.SetupFullPath = asmRecipe.SetupFullPath; itacRecipe.CycleTime = asmRecipe.CycleTime; itacRecipe.ComponentBarcode = asmRecipe.ComponentBarcode; itacRecipe.StationCycleTimeValid = asmRecipe.StationCycleTimeValid; itacRecipe.StationCycleTime = asmRecipe.StationCycleTime; itacRecipe.ParallelProcessingFactor = asmRecipe.ParallelProcessingFactor; itacRecipe.Bypassed = asmRecipe.Bypassed; itacRecipe.OrderId = asmRecipe.OrderId; // property Heads is readonly(no set method) // property TargetBoards is readonly(no set method) // property TrackEntries is readonly(no set method) // property RecipeAddOnEntries is readonly(no set method) itacRecipe.LBOActive = asmRecipe.LBOActive; itacRecipe.LBOActiveStationInLine = asmRecipe.LBOActiveStationInLine; itacRecipe.DownloadMode = asmRecipe.DownloadMode; itacRecipe.ProductionMode = asmRecipe.ProductionMode; } // maps iTAC namespace conform array to ASM namespace array public static Asm.As.Oib.Monitoring.Proxy.Business.Objects.Recipe[] get(Recipe[] asmRecipe) { if (asmRecipe == null) { return null; } Asm.As.Oib.Monitoring.Proxy.Business.Objects.Recipe[] itacRecipe = new Asm.As.Oib.Monitoring.Proxy.Business.Objects.Recipe[asmRecipe.Length]; for (int i = 0; i < asmRecipe.Length; i++) { // to itac array itacRecipe[i] = RecipeMapper.get(asmRecipe[i]); } return itacRecipe; } // maps iTAC namespace conform array to ASM namespace list public static List getList(Recipe[] asmRecipe) { if (asmRecipe == null) { return null; } List itacRecipe = new List(); for (int i = 0; i < asmRecipe.Length; i++) { itacRecipe.Add(RecipeMapper.get(asmRecipe[i])); } return itacRecipe; } // map type from ASM namespace to iTAC namespace public static Recipe get(Asm.As.Oib.Monitoring.Proxy.Business.Objects.Recipe asmRecipe) { if (asmRecipe == null) { return null; } Recipe itacRecipe = new Recipe(); mapAsm2Itac(asmRecipe, itacRecipe); return itacRecipe; } public static void mapAsm2Itac(Asm.As.Oib.Monitoring.Proxy.Business.Objects.Recipe asmRecipe, Recipe itacRecipe) { itacRecipe.LineName = asmRecipe.LineName; itacRecipe.LineFullPath = asmRecipe.LineFullPath; itacRecipe.StationName = asmRecipe.StationName; itacRecipe.StationFullPath = asmRecipe.StationFullPath; itacRecipe.StartTime = asmRecipe.StartTime; itacRecipe.Conveyor = com.itac.oib.monitoring.contracts.data.ConveyorTypeMapper.get(asmRecipe.Conveyor); // complex asm property Conveyor itacRecipe.RecipeName = asmRecipe.RecipeName; itacRecipe.RecipeFullPath = asmRecipe.RecipeFullPath; itacRecipe.SetupName = asmRecipe.SetupName; itacRecipe.SetupFullPath = asmRecipe.SetupFullPath; itacRecipe.CycleTime = asmRecipe.CycleTime; itacRecipe.ComponentBarcode = asmRecipe.ComponentBarcode; itacRecipe.StationCycleTimeValid = asmRecipe.StationCycleTimeValid; itacRecipe.StationCycleTime = asmRecipe.StationCycleTime; itacRecipe.ParallelProcessingFactor = asmRecipe.ParallelProcessingFactor; itacRecipe.Bypassed = asmRecipe.Bypassed; itacRecipe.OrderId = asmRecipe.OrderId; // maps ASM list 2 iTAC array itacRecipe.Heads = HeadMapper.getArray(asmRecipe.Heads); // maps ASM list 2 iTAC array itacRecipe.TargetBoards = TargetBoardMapper.getArray(asmRecipe.TargetBoards); // maps ASM list 2 iTAC array itacRecipe.TrackEntries = TrackEntryMapper.getArray(asmRecipe.TrackEntries); // maps ASM list 2 iTAC array itacRecipe.RecipeAddOnEntries = RecipeAddOnMapper.getArray(asmRecipe.RecipeAddOnEntries); itacRecipe.LBOActive = asmRecipe.LBOActive; itacRecipe.LBOActiveStationInLine = asmRecipe.LBOActiveStationInLine; itacRecipe.DownloadMode = asmRecipe.DownloadMode; itacRecipe.ProductionMode = asmRecipe.ProductionMode; } // maps ASM namespace conform list to iTAC namespace array public static Recipe[] getArray(IList asmRecipe) { if (asmRecipe == null) { return null; } Recipe[] itacRecipe = new Recipe[asmRecipe.Count]; for (int i = 0; i < asmRecipe.Count; i++) { itacRecipe[i] = RecipeMapper.get(asmRecipe[i]); } return itacRecipe; } // maps ASM namespace conform array to iTAC namespace array public static Recipe[] getArray(Asm.As.Oib.Monitoring.Proxy.Business.Objects.Recipe[] asmRecipe) { if (asmRecipe == null) { return null; } Recipe[] itacRecipe = new Recipe[asmRecipe.Length]; for (int i = 0; i < asmRecipe.Length; i++) { itacRecipe[i] = RecipeMapper.get(asmRecipe[i]); } return itacRecipe; } } }