/* * 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 23.11.2018 08:09:33 using System; using System.Collections.Generic; using com.itac.oib.monitoring.contracts.data; namespace com.itac.oib.monitoring.contracts.data { // source: assembly 3.2.0.152 // 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 itacRecipe) { if (itacRecipe == null) { return null; } Asm.As.Oib.Monitoring.Proxy.Business.Objects.Recipe asmRecipe = new Asm.As.Oib.Monitoring.Proxy.Business.Objects.Recipe(); mapItac2Asm(asmRecipe, itacRecipe); return asmRecipe; } public static void mapItac2Asm(Asm.As.Oib.Monitoring.Proxy.Business.Objects.Recipe asmRecipe, Recipe itacRecipe) { asmRecipe.LineName = itacRecipe.LineName; asmRecipe.LineFullPath = itacRecipe.LineFullPath; asmRecipe.StationName = itacRecipe.StationName; asmRecipe.StationFullPath = itacRecipe.StationFullPath; asmRecipe.StartTime = itacRecipe.StartTime; // complex property Conveyor, isArray:False, isGeneric:False asmRecipe.Conveyor = com.itac.oib.monitoring.contracts.data.ConveyorTypeMapper.get( itacRecipe.Conveyor); asmRecipe.RecipeName = itacRecipe.RecipeName; asmRecipe.RecipeFullPath = itacRecipe.RecipeFullPath; asmRecipe.SetupName = itacRecipe.SetupName; asmRecipe.SetupFullPath = itacRecipe.SetupFullPath; asmRecipe.CycleTime = itacRecipe.CycleTime; asmRecipe.ComponentBarcode = itacRecipe.ComponentBarcode; asmRecipe.StationCycleTimeValid = itacRecipe.StationCycleTimeValid; asmRecipe.StationCycleTime = itacRecipe.StationCycleTime; asmRecipe.ParallelProcessingFactor = itacRecipe.ParallelProcessingFactor; asmRecipe.Bypassed = itacRecipe.Bypassed; asmRecipe.OrderId = itacRecipe.OrderId; // skip readonly property Heads // skip readonly property TargetBoards // skip readonly property TrackEntries // skip readonly property RecipeAddOnEntries } // maps iTAC namespace conform array to ASM namespace array public static Asm.As.Oib.Monitoring.Proxy.Business.Objects.Recipe[] get(Recipe[] itacRecipe) { if (itacRecipe == null) { return null; } Asm.As.Oib.Monitoring.Proxy.Business.Objects.Recipe[] asmRecipe = new Asm.As.Oib.Monitoring.Proxy.Business.Objects.Recipe[itacRecipe.Length]; for (int i = 0; i < itacRecipe.Length; i++) { // to itac array asmRecipe[i] = RecipeMapper.get(itacRecipe[i]); } return asmRecipe; } // 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); } // 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; } } }