/// <summary> /// Initializes a new instance of the <see cref="IG"/> class. /// <summary> /// <param name="_Parent"></param> override public void Initialize(XL2SO _Parent) { m_Parent = _Parent; m_General = new General(); m_ScriptPart = new ScriptPart(); m_ExcelPart = new ExcelPart(); m_InstanceListPart = new InstanceListPart(); m_OutputPart = new OutputPart(); m_General.FoldoutStyle = new GUIStyle("FoldOut"); m_General.FoldoutStyle.fontStyle = FontStyle.Bold; }
/// <summary> /// Initializes a new instance of the <see cref="SG"/> class. /// </summary> /// <remarks> /// Set instance members and check if template file exists. /// </remarks> /// <param name="_Parent"> Parent <see cref="XL2SO"/> instance </param> override public void Initialize(XL2SO _Parent) { // Initialize instance members m_Parent = _Parent; m_General = new General(); m_ExcelPart = new ExcelPart(); m_FieldListPart = new FieldListPart(); m_OutputPart = new OutputPart(); CreateDataTypeList(); CreateGUIStyles(); // Check if template file exists MonoScript mono_this = MonoScript.FromScriptableObject(m_Parent); string script_path = AssetDatabase.GetAssetPath(mono_this); string script_directory = Path.GetDirectoryName(script_path); m_General.TemplatePath = script_directory + "\\ScriptTemplate.txt"; m_General.TemplateExists = File.Exists(m_General.TemplatePath); }
// Helper function to speed up device retrieval by caching it in the local dictionary private Device getDevice(Guid deviceId, OutputPart outputPart) { if (devices.ContainsKey(deviceId)) { return(devices[deviceId]); } else { using (KAIAMDataTestContainer db = new KAIAMDataTestContainer(Program.connString)) { var device = (from d in db.Devices where d.Id == deviceId select d); if (device.Any()) { Device dev = device.First(); if (outputPart != null && !outputParts.ContainsKey(outputPart.Id)) { outputParts.Add(outputPart.Id, outputPart); } devices.Add(deviceId, device.First()); String cm = "Kaiam"; if (device.First().ContractManufacturer != null) { cm = device.First().ContractManufacturer.Name; } contrManufs.Add(deviceId, cm); foreach (var br in device.First().BatchRequest.OrderBy(it => it.TimeStampRequested)) { if (!batchRequests.ContainsKey(deviceId)) { batchRequests.Add(deviceId, new List <_BatchRequest>()); } batchRequests[deviceId].Add(new _BatchRequest { date = br.TimeStampRequested, name = br.Name }); } // Deterimine tosa, rosa, pbda try { if (device.First().AssemblyRecords.Any()) { foreach (var assrec in device.First().AssemblyRecords) { if (assrec.AssemblyItems.Any()) { foreach (var assitm in assrec.AssemblyItems) { if (assitm != null && assitm.BOMItem != null && assitm.BOMItem.InfeedPart != null) { if (!tosarosas.ContainsKey(deviceId)) { tosarosas.Add(deviceId, new Dictionary <String, String>()); } var asstype = assitm.BOMItem.InfeedPart.Name; var assnumber = assitm.SerialNumber; tosarosas[deviceId].Add(asstype, assnumber); } } } } } } catch (Exception exc) { Program.log("ERROR: TOSA ROSA " + exc.Message); } return(device.First()); } } } return(null); }
// Helper function to speed up device retrieval by caching it in the local dictionary private Device getDevice(Guid deviceId, OutputPart outputPart) { if (devices.ContainsKey(deviceId)) { return devices[deviceId]; } else { using (KAIAMDataTestContainer db = new KAIAMDataTestContainer(Program.connString)) { var device = (from d in db.Devices where d.Id == deviceId select d); if (device.Any()) { Device dev = device.First(); if (outputPart != null && !outputParts.ContainsKey(outputPart.Id)) { outputParts.Add(outputPart.Id, outputPart); } devices.Add(deviceId, device.First()); String cm = "Kaiam"; if (device.First().ContractManufacturer != null) { cm = device.First().ContractManufacturer.Name; } contrManufs.Add(deviceId, cm); foreach (var br in device.First().BatchRequest.OrderBy(it => it.TimeStampRequested)) { if (!batchRequests.ContainsKey(deviceId)) { batchRequests.Add(deviceId, new List<_BatchRequest>()); } batchRequests[deviceId].Add(new _BatchRequest { date = br.TimeStampRequested, name = br.Name }); } // Deterimine tosa, rosa, pbda try { if (device.First().AssemblyRecords.Any()) { foreach (var assrec in device.First().AssemblyRecords) { if (assrec.AssemblyItems.Any()) { foreach (var assitm in assrec.AssemblyItems) { if (assitm != null && assitm.BOMItem != null && assitm.BOMItem.InfeedPart != null) { if (!tosarosas.ContainsKey(deviceId)) { tosarosas.Add(deviceId, new Dictionary<String, String>()); } var asstype = assitm.BOMItem.InfeedPart.Name; var assnumber = assitm.SerialNumber; tosarosas[deviceId].Add(asstype, assnumber); } } } } } } catch (Exception exc) { Program.log("ERROR: TOSA ROSA " + exc.Message); } return device.First(); } } } return null; }