Wonderware FactorySuite InTrack
OLE Reference
May, 2001
Wonderware Corporation
All rights reserved. No part of this documentation shall be reproduced, stored in a retrieval system, or transmitted by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior written permission of the Wonderware Corporation. No copyright or patent liability is assumed with respect to the use of the information contained herein. Although every precaution has been taken in the preparation of this documentation, the publisher and author assume no responsibility for errors or omissions. Neither is any liability assumed for damages resulting from the use of the information contained herein. The information in this documentation is subject to change without notice and does not represent a commitment on the part of Wonderware Corporation. The software described in this documentation is furnished under a license or nondisclosure agreement. This software may be used or copied only in accordance with the terms of these agreements.
2001 Wonderware Corporation. All Rights Reserved. 100 Technology Drive Irvine, CA 92618 U.S.A. (949) 727-3200 http://www.wonderware.com Trademarks All terms mentioned in this book that are known to be trademarks or service marks have been appropriately capitalized. Wonderware Corporation cannot attest to the accuracy of this information. Use of a term in this book should not be regarded as affecting the validity of any trademark or service mark. Wonderware is a registered trademark of Wonderware Corporation. Wonderware FactorySuite, InTouch, WindowMaker, WindowViewer, SQL Access Manager, Recipe Manager, SPC Pro, DBDump, DBLoad, HDMerge, HistData, Wonderware Logger, InControl, InTrack, InBatch, IndustrialSQL, FactoryOffice, Scout, SuiteLink and NetDDE are trademarks of Wonderware Corporation.
i
Contents
Chapter 1 OLE Automation and InTouch Elements of OLE Automation...... 1-2 InTouch OLE Automation Client Extensions...... 1-3 InTouch Automation Expressions...... 1-3 Creating an Object ...... 1-6 Managing an Object...... 1-7 Testing for a Valid Object ...... 1-7 Getting a Property Value ...... 1-8 Setting a Property ...... 1-10 Calling a Method ...... 1-11 InTouch Error Handling...... 1-14 Frequent Automation Object Errors...... 1-17
ii Table of Contents
Chapter 2 InTrack OLE Automation Automation Server InTrack Concepts...... 2-2 Structural Information...... 2-2 Activity Information...... 2-3 Using Keys...... 2-6 Type Library ...... 2-7 Overview of InTrack OLE Automation Classes...... 2-8 Application...... 2-8 General...... 2-9 Structural...... 2-10 Activity...... 2-10 Dialog ...... 2-10 Query...... 2-11 MES Application Development Notes ...... 2-12 Database Transactions ...... 2-12 Handling InTrack Errors...... 2-14 Working with Collection Objects...... 2-15 Object Creation...... 2-15 Working with InTouch Selectors ...... 2-16 Working with InTouch Dialogs...... 2-16
Chapter 3 Application Objects Database Object Class ...... 3-2 Identification...... 3-3 Properties...... 3-4 Methods ...... 3-5
Table Of Contents iii
Chapter 4 General Objects...... 4-1 Amount Object Class...... 4-3 Identification...... 4-3 Using Amount Objects...... 4-3 Examples 4-3 Serialization 4-4 Properties...... 4-5 Methods ...... 4-5 ArchiveItem Object Class ...... 4-8 Identification...... 4-8 Using ArchiveItem...... 4-8 Properties...... 4-10 Classes Included in an ArchiveItem Object ...... 4-11 ArchiveItems Object Class...... 4-14 Identification...... 4-14 Property ...... 4-14 Methods ...... 4-15 BOMItem Object Class ...... 4-17 Identification...... 4-17 Using BOMItem Objects ...... 4-17 Properties...... 4-18 Methods ...... 4-19 BOMItems Object Class...... 4-22 Identification...... 4-22 Using BOMItems Collection Objects ...... 4-22 Properties...... 4-22 Methods ...... 4-23 BOMSubItem Object Class...... 4-25 Identification...... 4-25 Properties...... 4-26 BOMSubItems Object Class ...... 4-27 Identification...... 4-27 Properties...... 4-27 Methods ...... 4-28 CloseItem Object Class...... 4-30 Identification...... 4-30 Properties...... 4-31 CloseItems Object Class ...... 4-32 Identification...... 4-32 Property ...... 4-32 Methods ...... 4-33
iv Table of Contents
CompleteItem Object Class...... 4-35 Identification...... 4-35 Properties...... 4-36 CompleteItems Object Class ...... 4-37 Identification...... 4-37 Property...... 4-37 Methods ...... 4-38 ConsumableMaterial Object Class...... 4-40 Identification...... 4-40 Properties...... 4-41 Methods ...... 4-42 ConsumableMaterials Object Class ...... 4-43 Identification...... 4-43 Property...... 4-44 Methods ...... 4-44 ConsumeItem Object Class ...... 4-46 Identification...... 4-46 Properties...... 4-47 ConsumeItems Object Class...... 4-48 Identification...... 4-48 Property...... 4-48 Methods ...... 4-49 Date Object Class...... 4-51 Identification...... 4-51 Properties...... 4-51 Methods ...... 4-52 DateTime Object Class ...... 4-55 Identification...... 4-55 Using DateTime Objects...... 4-55 Properties...... 4-56 Methods ...... 4-56 DisassembleItem Object Class...... 4-62 Identification...... 4-62 Using DisassembleItem Objects...... 4-62 Properties...... 4-63 Methods ...... 4-64 DisassembleItems Object Class...... 4-65 Identification...... 4-65 Property...... 4-65 Methods ...... 4-66
Table Of Contents v
Selector Object Class...... 4-68 Identification...... 4-68 Optional Selector Properties...... 4-68 SelectionChangeTagName Property 4-68 MaxNumberOfRows Property 4-69 Filter and Sort Properties 4-69 Properties...... 4-72 Methods ...... 4-73 SerialNumbers Object Class ...... 4-74 Identification...... 4-74 Using SerialNumbers Objects...... 4-74 Property ...... 4-74 Methods ...... 4-75 SetpointItem Object Class...... 4-78 Identification...... 4-78 Properties...... 4-78 Methods ...... 4-79 GetLimits 4-79 GetLimitValue 4-79 SetLimits 4-80 SetpointItems Object Class ...... 4-81 Identification...... 4-81 Properties...... 4-81 Methods ...... 4-81 StartItem Object Class ...... 4-83 Identification...... 4-83 Properties...... 4-84 StartItems Object Class...... 4-85 Identification...... 4-85 Property ...... 4-85 Methods ...... 4-86 StepInputItem Object Class...... 4-88 Identification...... 4-88 Properties...... 4-89 Methods ...... 4-89 StepInputItems Object Class ...... 4-90 Identification...... 4-90 Properties...... 4-90 Methods ...... 4-91
vi Table of Contents
StepOutputItem Object Class ...... 4-93 Identification...... 4-93 Properties...... 4-95 Methods ...... 4-96 StepOutputItems Object Class...... 4-97 Identification...... 4-97 Property...... 4-97 Methods ...... 4-98 StepSetpointItem Object Class ...... 4-100 Identification...... 4-100 Properties...... 4-100 Methods ...... 4-101 InitializeFrom 4-101 StepSetpointItems Object Class...... 4-102 Identification...... 4-102 Properties...... 4-102 Methods ...... 4-102 Time Object Class ...... 4-105 Identification...... 4-105 Properties...... 4-105 Methods ...... 4-106 TimeInterval Object Class...... 4-108 Identification...... 4-108 Properties...... 4-108 Methods ...... 4-109
Table Of Contents vii
Chapter 5 Structural Objects Classification Object Class...... 5-3 Identification...... 5-3 Properties...... 5-3 Methods ...... 5-5 Create 5-5 Delete 5-5 GetUDAType 5-6 GetUDAValue 5-6 Load 5-7 SetRoot 5-7 SetUDAValue 5-7 ClassificationItem Object Class...... 5-8 Identification...... 5-8 Properties...... 5-9 Methods ...... 5-10 Attach 5-10 Create 5-10 Delete 5-10 Detach 5-11 GetUDAType 5-11 GetUDAValue 5-12 Load 5-12 SetUDAValue 5-12 ClassificationItems Object Class ...... 5-13 Identification...... 5-13 Properties...... 5-13 Methods ...... 5-13 Item 5-14 Remove 5-14 CustomerSpecification Object Class ...... 5-15 Identification...... 5-15 Automation Interface 5-15 Properties...... 5-15 Methods ...... 5-16 Create 5-16 Delete 5-16 GetUDAType 5-17 GetUDAValue 5-17 Load 5-17 SetUDAValue 5-18
viii Table of Contents
DataSetItem Object Class...... 5-19 Identification...... 5-19 Properties...... 5-19 Methods ...... 5-20 GetHoldFlags 5-20 GetLimitValue 5-21 GetRanges 5-21 SetHoldFlags 5-22 SetRanges 5-23 DataSetItems Object Class...... 5-24 Identification...... 5-24 Properties...... 5-24 Methods ...... 5-24 Add 5-24 Clear 5-24 Item 5-25 Remove 5-25 DataSetTemplate Object Class ...... 5-26 Identification...... 5-26 Automation Interface 5-26 Properties...... 5-27 Methods ...... 5-28 AddDataSetItems 5-28 AssociateParent 5-28 Create 5-29 Delete 5-29 DeleteDataSetItems 5-30 DisassociateParent 5-30 GetItemIntegerRanges 5-31 GetItemRealRanges 5-33 GetUDAType 5-34 GetUDAValue 5-35 Load 5-35 SetUDA 5-36 DataSetTemplates Object Class...... 5-37 Identification...... 5-37 Properties...... 5-37 Methods ...... 5-37 Add 5-37 Clear 5-37 Item 5-38 Remove 5-38
Table Of Contents ix
DispositionCode Object Class...... 5-39 Identification...... 5-39 Properties...... 5-39 Methods ...... 5-40 Create 5-40 Delete 5-40 GetUDAType 5-40 GetUDAValue 5-41 Load 5-41 SetUDAValue 5-41 DispositionCodes Object Class ...... 5-42 Identification...... 5-42 Properties...... 5-42 Methods ...... 5-42 Add 5-42 Clear 5-43 Item 5-43 Remove 5-43 FailureReasons Object Class...... 5-44 Identification...... 5-44 Properties...... 5-44 Methods ...... 5-44 Add 5-44 Clear 5-44 Item 5-45 Remove 5-45 FailureSymptoms Object Class...... 5-46 Identification...... 5-46 Properties...... 5-46 Methods ...... 5-46 Add 5-46 Clear 5-46 Item 5-47 Remove 5-47 Location Object Class...... 5-48 Identification...... 5-48 Properties...... 5-48 Methods ...... 5-48 Create 5-49 Delete 5-49 GetUDAType 5-49 GetUDAValue 5-50 Load 5-50 SetUDAValue 5-50
x Table of Contents
Machine Object Class...... 5-51 Identification...... 5-51 Properties...... 5-52 Methods ...... 5-52 AddDataSetTemplates 5-52 AssignRepairPerson 5-53 BringOnLine 5-53 Close 5-54 CloseRepair 5-55 Complete 5-56 CompleteTask 5-57 Create 5-58 Delete 5-58 DeleteAllDataSetTemplates 5-59 DeleteDataSetTemplates 5-59 GetTaskWorkInstructions 5-59 GetUDAType 5-60 GetUDAValue 5-60 Load 5-60 OpenRepair 5-61 SetUDAValue 5-61 Start 5-62 StartRepair 5-63 StartTask 5-64 StopRepair 5-65 TakeOffline 5-66 UpdateDiagnosis 5-66 UpdateFailureReason 5-66 UpdateFailureSymptom 5-67 UpdateWorkStatus 5-67 Machines Object Class...... 5-68 Identification...... 5-68 Properties...... 5-68 Methods ...... 5-68 Add 5-68 Clear 5-68 Item 5-69 Remove 5-69 MachineTask Object Class...... 5-70 Identification...... 5-70 Properties...... 5-71 MachineTasks Object Class ...... 5-72 Identification...... 5-72 Properties...... 5-72 Methods ...... 5-72 Add 5-72 Clear 5-72 Item 5-73 Remove 5-73
Table Of Contents xi
MachineType Object Class ...... 5-74 Identification...... 5-74 Properties...... 5-74 Methods ...... 5-75 AddFailureReasons 5-75 AddFailureSymptoms 5-75 AddMachineTasks 5-75 Create 5-76 Delete 5-76 DeleteAllFailureReasons 5-76 DeleteAllFailureSymptoms 5-77 DeleteAllMachineTasks 5-77 DeleteFailureReasons 5-77 DeleteFailureSymptoms 5-78 DeleteMachineTasks 5-78 GetUDAType 5-78 GetUDAValue 5-79 Load 5-79 SetUDAValue 5-79 Material Object Class...... 5-80 Identification...... 5-80 Properties...... 5-82 Methods ...... 5-83 AddCycleTimeOverride 5-83 AddDataSetOverride 5-83 AddInputItems 5-84 AddMachineOverride 5-85 AddOutputItems 5-86 AddOverlapOverride 5-86 AddSetpointTemplateOverride 5-87 AddTrackingOverride 5-87 AddWorkInstructionsOverride 5-88 AddYieldOverride 5-89 AssociateRoute 5-89 Create 5-90 CreateBOM 5-91 DelAllDataSetOverride 5-91 DelAllMachineOverride 5-92 DelAllSetpointTemplateOverrides 5-92 DelAllWorkInstructionsOverride 5-93 Delete 5-93 DeleteAllInputItems 5-93 DeleteAllOutputItems 5-93 DeleteBOM 5-94 DeleteCycleTimeOverride 5-94 DeleteDataSetOverride 5-94 DeleteInputItems 5-95 DeleteMachineOverride 5-95 DeleteOutputItems 5-96 DeleteOverlapOverride 5-96 DeleteSetpointTemplateOverride 5-97
xii Table of Contents
DeleteTrackingOverride 5-97 DeleteWorkInstructionsOverride 5-98 DeleteYieldOverride 5-98 GetUDAType 5-99 GetUDAValue 5-99 Load 5-99 RemoveRouteAssociation 5-100 SetControlType 5-100 SetDescription 5-100 SetLifeTime 5-101 SetQuantity 5-101 SetUDAValue 5-101 SetUnitsOfMeasure 5-102 ToggleDataSetOverride 5-102 ToggleMachineOverride 5-103 ToggleSetpointTemplateOverride 5-103 ToggleWorkInstructionsOverride 5-104 Operation Object Class ...... 5-105 Identification...... 5-105 Properties...... 5-105 Methods ...... 5-106 AddDataSetTemplates 5-106 AddQualifiedMachines 5-106 AddSetpointTemplates 5-107 AddWorkInstructions 5-107 Create 5-108 CreateEx 5-109 Delete 5-110 DeleteAllDataSetTemplates 5-110 DeleteAllQualifiedMachines 5-110 DeleteAllSetpointTemplates 5-110 DeleteAllWorkInstructions 5-110 DeleteDataSetTemplates 5-111 DeleteQualifiedMachines 5-111 DeleteSetpointTemplates 5-112 DeleteWorkInstructions 5-112 GetUDAType 5-112 GetUDAValue 5-113 Load 5-113 SetUDAValue 5-113 Privilege Object Class...... 5-114 Identification...... 5-114 Properties...... 5-114
Table Of Contents xiii
Privileges Object Class ...... 5-116 Identification...... 5-116 Properties...... 5-116 Methods ...... 5-116 Add 5-116 Clear 5-116 Item 5-117 Remove 5-117 Route Object Class...... 5-118 Identification...... 5-118 Properties...... 5-118 Methods ...... 5-121 AddInputItems 5-121 AddOutputItems 5-121 AddRoutePaths 5-122 AddRouteSteps 5-122 AddSetpointItems 5-123 Create 5-124 Delete 5-125 DeleteAllInputItems 5-125 DeleteAllOutputItems 5-125 DeleteAllSetpointItems 5-126 DeleteInputItems 5-126 DeleteOutputItems 5-127 DeleteRoutePaths 5-127 DeleteRouteSteps 5-127 DeleteSetpointItems 5-128 GetDispMaterialOutput 5-128 GetInfo 5-129 GetUDAType 5-129 GetUDAValue 5-129 Load 5-130 SetDefaultDispositionCode 5-130 SetInitialRouteStep 5-130 SetUDAValue 5-131 RoutePath Object Class...... 5-132 Identification...... 5-132 Properties...... 5-132 Methods ...... 5-132 RoutePaths Object Class ...... 5-133 Identification...... 5-133 Property ...... 5-133 Methods ...... 5-133 Add 5-133 Clear 5-134 Item 5-134 Remove 5-134
xiv Table of Contents
RouteStep Object Class ...... 5-135 Identification...... 5-135 Properties...... 5-135 Methods ...... 5-136 RouteSteps Object Class...... 5-137 Identification...... 5-137 Properties...... 5-137 Methods ...... 5-137 Add 5-137 Clear 5-137 Item 5-138 Remove 5-138 SecurityGroup Object Class...... 5-139 Identification...... 5-139 Properties...... 5-139 Methods ...... 5-140 AddPrivileges 5-140 Create 5-140 Delete 5-140 DeletePrivileges 5-141 Load 5-141 SecurityGroups Object Class...... 5-142 Identification...... 5-142 Properties...... 5-142 Methods ...... 5-142 Add 5-142 Clear 5-143 Item 5-143 Remove 5-143 SetpointTemplate Object Class...... 5-144 Identification...... 5-144 Properties...... 5-144 Methods ...... 5-145 AddSetpointItems 5-145 AssociateParent 5-145 Create 5-146 Delete 5-146 DeleteSetpointItems 5-146 DisassociateParent 5-147 GetUDAType 5-147 GetUDAValue 5-148 Load 5-148 SetUDA 5-148
Table Of Contents xv
SetpointTemplates Object Class ...... 5-149 Identification...... 5-149 Properties...... 5-149 Methods ...... 5-149 Add 5-149 Clear 5-150 Item 5-150 Remove 5-150 Table Object Class...... 5-151 Identification...... 5-151 Using the Table Object Class...... 5-151 Properties...... 5-153 Methods ...... 5-154 Create 5-154 Delete 5-154 Load 5-154 Modify 5-155 Row Methods...... 5-156 DeleteRow 5-156 ReadRow 5-156 SaveRow 5-157 TableColumn Object Class...... 5-158 Identification...... 5-158 Properties...... 5-158 Methods ...... 5-159 TableColumns Object Class...... 5-160 Identification...... 5-160 Properties...... 5-160 Methods ...... 5-160 Add 5-160 Clear 5-160 Item 5-161 Remove 5-161 User Object Class...... 5-162 Identification...... 5-162 Property ...... 5-162 Methods ...... 5-163 ChangePassword 5-163 ClockIn 5-164 ClockOut 5-164 Create 5-164 Delete 5-164 GetQualificationStatus 5-165 GrantPrivileges 5-165 Load 5-165 RevokePrivileges 5-166 UserCertification Object Class ...... 5-167
xvi Table of Contents
Identification...... 5-167 Properties...... 5-167 Methods ...... 5-168 Create 5-168 Delete 5-168 GetUDAType 5-169 GetUDAValue 5-169 Load 5-170 SetUDA 5-170 SetWhenIssued 5-170 UserCertifications Object Class...... 5-171 Identification...... 5-171 Properties...... 5-171 Methods ...... 5-171 Add 5-171 Clear 5-172 Item 5-172 Remove 5-172 WorkInstructions Object Class...... 5-173 Identification...... 5-173 Properties...... 5-174 Methods ...... 5-175 Create 5-175 Delete 5-176 GetUDAType 5-176 GetUDAValue 5-177 Load 5-177 SetUDAValue 5-178 WorkInstructionsList Object Class...... 5-179 Identification...... 5-179 Property...... 5-179 Methods ...... 5-179 Add 5-179 Clear 5-180 Item 5-180 Remove 5-180
Table Of Contents xvii
Chapter 6 Activity Objects InTrack Object Class Constants...... 6-2 DataSetSample Object Class...... 6-3 Identification...... 6-3 Properties...... 6-7 Methods ...... 6-8 Lot Object Class...... 6-25 Identification...... 6-25 Properties...... 6-25 Methods ...... 6-26 Sublot Object Class...... 6-37 Sublot Identification 6-37 Identification...... 6-37 Properties...... 6-38 Methods ...... 6-40
Chapter 7 Dialog Objects Dialog.Adjust Object Class ...... 7-4 Properties...... 7-4 Method...... 7-4 Dialog.Close Object Class ...... 7-5 Properties...... 7-5 Method...... 7-5 Dialog.CloseRepair Object Class...... 7-6 Properties...... 7-6 Method...... 7-6 Dialog.Collect Object Class...... 7-7 Properties...... 7-7 Method...... 7-7 Dialog.Comment Object Class ...... 7-8 Properties...... 7-8 Method...... 7-8 Dialog.Complete Object Class ...... 7-9 Properties...... 7-9 Method...... 7-9 Dialog.CompleteTask Object Class ...... 7-10 Properties...... 7-10 Method...... 7-10
xviii Table of Contents
Dialog.Connect Object Class...... 7-11 Properties...... 7-11 Method...... 7-11 Dialog.Consume Object Class ...... 7-12 Properties...... 7-12 Method...... 7-12 Dialog.Create Object Class ...... 7-13 Properties...... 7-13 Method...... 7-13 Dialog.Delete Object Class ...... 7-14 Properties...... 7-14 Method...... 7-14 Dialog.Detail Object Class...... 7-15 Properties...... 7-15 Method...... 7-15 Dialog.Disconnect Object Class ...... 7-16 Property...... 7-16 Method...... 7-16 Dialog.Filter Object Class ...... 7-17 Properties...... 7-17 Methods ...... 7-17 Dialog.Instruct Object Class ...... 7-19 Properties...... 7-19 Method...... 7-19 Dialog.LogIn Object Class ...... 7-20 Properties...... 7-20 Method...... 7-20 Dialog.LogOut Object Class...... 7-21 Property...... 7-21 Method...... 7-21 Dialog.MachineStatus Object Class ...... 7-22 Properties...... 7-22 Method...... 7-22 Dialog.Merge Object Class...... 7-23 Properties...... 7-23 Method...... 7-23 Dialog.Move Object Class ...... 7-24 Properties...... 7-24 Method...... 7-24
Table Of Contents xix
Dialog.OpenRepair Object Class...... 7-25 Properties...... 7-25 Method...... 7-25 Dialog.Purge Object Class...... 7-26 Property ...... 7-26 Method...... 7-26 Dialog.Receive Object Class...... 7-27 Properties...... 7-27 Method...... 7-27 Dialog.Ship Object Class...... 7-28 Properties...... 7-28 Method...... 7-28 Dialog.Split Object Class...... 7-29 Properties...... 7-29 Method...... 7-29 Dialog.Start Object Class...... 7-30 Properties...... 7-30 Method...... 7-30 Dialog.StartTask Object Class...... 7-31 Properties...... 7-31 Method...... 7-31 Dialog.Status Object Class ...... 7-32 Properties...... 7-32 Method...... 7-32 Dialog.Undo Object Class ...... 7-33 Properties...... 7-33 Method...... 7-33 Dialog.UpdateRepair Object Class...... 7-34 Properties...... 7-34 Method...... 7-35
xx Table of Contents
Chapter 8 Query Objects QueryAllDisposition Object Class ...... 8-5 Identification...... 8-5 Properties...... 8-5 Methods ...... 8-5 QueryAllDSTemplate Object Class...... 8-7 Identification...... 8-7 Properties...... 8-7 Methods ...... 8-7 QueryAllLocation Object Class...... 8-9 Identification...... 8-9 Properties...... 8-9 Methods ...... 8-9 QueryAllMachine Object Class ...... 8-11 Identification...... 8-11 Properties...... 8-11 Methods ...... 8-11 QueryAllOperation Object Class...... 8-13 Identification...... 8-13 Properties...... 8-13 Methods ...... 8-13 QueryAllRoute Object Class...... 8-15 Identification...... 8-15 Properties...... 8-15 Methods ...... 8-15 QueryAllSetpointTemplate Object Class...... 8-17 Identification...... 8-17 Properties...... 8-17 Methods ...... 8-17 QueryCloseLot Object Class...... 8-19 Identification...... 8-19 Properties...... 8-19 Methods ...... 8-20 QueryConsumeLot Object Class ...... 8-21 Identification...... 8-21 Properties...... 8-21 Methods ...... 8-22
Table Of Contents xxi
QueryDataSetItem Object Class...... 8-23 Identification...... 8-23 Properties...... 8-23 Methods ...... 8-24 QueryDataSetSample Object Class...... 8-25 Identification...... 8-25 Properties...... 8-25 Methods ...... 8-26 QueryDataSetTimeStamp Object Class...... 8-27 Identification...... 8-27 Properties...... 8-27 Methods ...... 8-28 QueryDisposition Object Class...... 8-29 Identification...... 8-29 Properties...... 8-29 Methods ...... 8-30 QueryExpiredMachineTask Object Class ...... 8-31 Identification...... 8-31 Properties...... 8-31 Methods ...... 8-31 QueryInWarningMachineTask Object Class...... 8-33 Identification...... 8-33 Properties...... 8-33 Methods ...... 8-33 QueryLotDataSet Object Class...... 8-35 Identification...... 8-35 Properties...... 8-35 Methods ...... 8-36 QueryLotDataSetSample Object Class ...... 8-37 Identification...... 8-37 Properties...... 8-37 Methods ...... 8-38 QueryLotDataSetTimeStamp Object Class...... 8-39 Identification...... 8-39 Properties...... 8-39 Methods ...... 8-40 QueryLotLocation Object Class...... 8-41 Identification...... 8-41 Properties...... 8-41 Methods ...... 8-42
xxii Table of Contents
QueryLotMachine Object Class ...... 8-43 Identification...... 8-43 Properties...... 8-43 Methods ...... 8-44 QueryLotMachineQty Object Class...... 8-45 Identification...... 8-45 Properties...... 8-45 Methods ...... 8-46 QueryLotPurgeItem Object Class ...... 8-47 Identification...... 8-47 Properties...... 8-47 Methods ...... 8-48 QueryLotSerialNumber Object Class ...... 8-50 Identification...... 8-50 Properties...... 8-50 Methods ...... 8-51 QueryLotUndo Object Class...... 8-52 Identification...... 8-52 Properties...... 8-52 Methods ...... 8-53 QueryLotWorkInstructions Object Class...... 8-54 Identification...... 8-54 Properties...... 8-54 Methods ...... 8-55 QueryMachineDataSet Object Class...... 8-56 Identification...... 8-56 Properties...... 8-56 Methods ...... 8-57 QueryMachineDataSetSample Object Class ...... 8-58 Identification...... 8-58 Properties...... 8-58 Methods ...... 8-59 QueryMachineDataSetTimeStamp Object Class ...... 8-60 Identification...... 8-60 Properties...... 8-60 Methods ...... 8-61 QueryMachineLot Object Class ...... 8-62 Identification...... 8-62 Properties...... 8-62 Methods ...... 8-63
Table Of Contents xxiii
QueryMachinesAtOperation Object Class...... 8-64 Identification...... 8-64 Properties...... 8-64 Methods ...... 8-65 QueryMachineTask Object Class...... 8-66 Identification...... 8-66 Properties...... 8-66 Methods ...... 8-67 QueryMaterial Object Class ...... 8-68 Identification...... 8-68 Properties...... 8-68 Methods ...... 8-69 QueryMaterialInput Object Class...... 8-70 Identification...... 8-70 Properties...... 8-70 Methods ...... 8-71 QueryMaterialOutput Object Class...... 8-72 Identification...... 8-72 Properties...... 8-72 Methods ...... 8-73 QueryMaterialRoute Object Class...... 8-74 Identification...... 8-74 Properties...... 8-74 Methods ...... 8-75 QueryMaterialSpec Object Class ...... 8-76 Identification...... 8-76 Properties...... 8-76 Methods ...... 8-77 QueryMergeLot Object Class...... 8-78 Identification...... 8-78 Properties...... 8-78 Methods ...... 8-79 QueryOperation Object Class...... 8-80 Identification...... 8-80 Properties...... 8-80 Methods ...... 8-81 QueryQualifiedUser Object Class ...... 8-82 Identification...... 8-82 Properties...... 8-82 Methods ...... 8-83
xxiv Table of Contents
QueryRouteMaterial Object Class ...... 8-84 Identification...... 8-84 Properties...... 8-84 Methods ...... 8-85 QueryRouteStep Object Class ...... 8-86 Identification...... 8-86 Properties...... 8-86 Methods ...... 8-87 QueryRuntimeConfig Object Class...... 8-88 Identification...... 8-88 Properties...... 8-88 Methods ...... 8-88 QuerySQL Object Class ...... 8-90 Identification...... 8-92 Properties...... 8-92 Methods ...... 8-92 QueryStepSetpoint Object Class...... 8-97 Identification...... 8-97 Properties...... 8-97 Methods ...... 8-98 QuerySubstituteMaterialInput Object Class...... 8-99 Identification...... 8-99 Properties...... 8-99 Methods ...... 8-100 QueryTypedMachines Object Class...... 8-101 Identification...... 8-101 Properties...... 8-101 Methods ...... 8-102 QueryUDA_Name Object Class...... 8-103 Identification...... 8-103 Properties...... 8-103 Methods ...... 8-104
Table Of Contents xxv
Chapter 9 Import API Objects...... 9-1 Create, Load and Delete...... 9-3 User Defined Attributes ...... 9-3 Standard Properties...... 9-3 Collection Methods...... 9-3 InCustomerSpecification Object Class...... 9-4 Properties...... 9-4 Methods ...... 9-4 Create 9-4 Delete 9-5 GetUDAType 9-5 GetUDAValue 9-5 Load 9-6 SetUDAValue 9-6 InDataSetItem Object Class...... 9-7 Properties...... 9-7 Methods ...... 9-8 GetHoldFlags 9-8 GetLimitValue 9-9 GetRanges 9-9 SetHoldFlags 9-10 SetRanges 9-11 InDataSetItems Object Class ...... 9-12 Properties...... 9-12 Methods ...... 9-12 InDataSetTemplate Object Class...... 9-14 Properties...... 9-14 Methods ...... 9-15 AddDataSetItems 9-15 AssociateParent 9-15 Create 9-16 Delete 9-16 DeleteDataSetItems 9-17 DisassociateParent 9-17 GetItemIntegerRanges 9-18 GetItemRealRanges 9-19 GetUDAType 9-20 GetUDAValue 9-20 Load 9-21 SetUDA 9-21 InDataSetTemplates Object Class...... 9-22 Properties...... 9-22 Methods ...... 9-22
xxvi Table of Contents
InDispositionCode Object Class ...... 9-24 Properties...... 9-24 Methods ...... 9-24 Create 9-24 Delete 9-25 GetUDAType 9-25 GetUDAValue 9-25 Load 9-26 SetUDAValue 9-26 InDispositionCodes Object Class...... 9-27 Properties...... 9-27 Methods ...... 9-27 InLocation Object Class ...... 9-29 Properties...... 9-29 Methods ...... 9-29 Create 9-29 Delete 9-29 GetUDAType 9-30 GetUDAValue 9-30 Load 9-30 SetUDAValue 9-31 InMachine Object Class ...... 9-32 Properties...... 9-32 Methods ...... 9-33 AddDataSetTemplates 9-33 AssignRepairPerson 9-33 BringOnLine 9-33 Close 9-34 CloseRepair 9-34 Complete 9-34 CompleteTask 9-34 Create 9-35 Delete 9-35 DeleteAllDataSetTemplates 9-36 DeleteDataSetTemplates 9-36 GetTaskWorkInstructions 9-36 GetUDAType 9-37 GetUDAValue 9-37 Load 9-37 OpenRepair 9-38 SetUDAValue 9-38 Start 9-38 StartRepair 9-39 StartTask 9-39 StopRepair 9-39 TakeOffline 9-39 UpdateDiagnosis 9-40 UpdateFailureReason 9-40 UpdateFailureSymptom 9-40 UpdateWorkStatus 9-41
Table Of Contents xxvii
InMachines Object Class...... 9-42 Properties...... 9-42 Methods ...... 9-42 InMachineType Object Class...... 9-44 Properties...... 9-44 Methods ...... 9-44 AddFailureReasons 9-44 AddFailureSymptoms 9-45 AddMachineTasks 9-45 Create 9-46 Delete 9-46 DeleteAllFailureReasons 9-47 DeleteAllFailureSymptoms 9-47 DeleteAllMachineTasks 9-47 DeleteFailureReasons 9-47 DeleteFailureSymptoms 9-48 DeleteMachineTasks 9-48 GetUDAType 9-48 GetUDAValue 9-49 SetUDAValue 9-49 InMaterial Object Class ...... 9-50 Properties...... 9-50 Methods ...... 9-51 AddCycleTimeOverride 9-51 AddDataSetOverride 9-51 AddInputItems 9-52 AddMachineOverride 9-52 AddOutputItems 9-53 AddOverlapOverride 9-53 AddSetpointTemplateOverride 9-54 AddTrackingOverride 9-54 AddWorkInstructionsOverride 9-55 AddYieldOverride 9-55 AssociateRoute 9-55 Create 9-56 CreateBOM 9-56 Delete 9-57 DeleteBOM 9-57 DeleteCycleTimeOverride 9-57 DeleteDataSetOverride 9-57 DelAllDataSetOverride 9-58 DeleteInputItems 9-58 DeleteAllInputItems 9-58 DeleteMachineOverride 9-59 DelAllMachineOverride 9-59 DeleteOutputItems 9-60 DeleteAllOutputItems 9-60 DeleteOverlapOverride 9-60 DeleteSetpointTemplateOverride 9-61 DelAllSetpointTemplateOverride 9-61 DeleteTrackingOverride 9-62
xxviii Table of Contents
DeleteWorkInstructionsOverride 9-62 DelAllWorkInstructionsOverride 9-63 DeleteYieldOverride 9-63 GetUDAType 9-63 GetUDAValue 9-64 Load 9-64 RemoveRouteAssociation 9-64 SetControlType 9-65 SetDescription 9-65 SetLifeTime 9-65 SetQuantity 9-66 SetUDAValue 9-66 SetUnitsOfMeasure 9-66 ToggleDataSetOverride 9-67 ToggleMachineOverride 9-67 ToggleSetpointTemplateOverride 9-68 ToggleWorkInstructionsOverride 9-68 InOperation Object Class...... 9-69 Properties...... 9-69 Methods ...... 9-70 AddDataSetTemplates 9-70 AddQualifiedMachines 9-70 AddSetpointTemplates 9-71 AddWorkInstructions 9-71 Create 9-72 CreateEx 9-73 Delete 9-74 DeleteDataSetTemplates 9-74 DeleteAllDataSetTemplates 9-74 DeleteQualifiedMachines 9-75 DeleteAllQualifiedMachines 9-75 DeleteSetpointTemplates 9-75 DeleteAllSetpointTemplates 9-76 DeleteWorkInstructions 9-76 DeleteAllWorkInstructions 9-76 GetUDAType 9-77 GetUDAValue 9-77 Load 9-77 SetUDAValue 9-78 InRoute Object Class...... 9-79 Properties...... 9-79 Methods ...... 9-80 AddInputItems 9-80 AddOutputItems 9-80 AddRoutePaths 9-81 AddRouteSteps 9-81 AddSetpointItems 9-82 Create 9-82 Delete 9-83 DeleteAllInputItems 9-83 DeleteAllOutputItems 9-83
Table Of Contents xxix
DeleteAllSetpointItems 9-84 DeleteInputItems 9-84 DeleteOutputItems 9-84 DeleteRoutePaths 9-85 DeleteRouteSteps 9-85 DeleteSetpointItems 9-85 GetDispMaterialOutput 9-86 GetInfo 9-86 GetUDAType 9-87 GetUDAValue 9-87 SetDefaultDispositionCode 9-88 SetInitialRouteStep 9-88 SetUDAValue 9-88 InRoutePath Object Class...... 9-89 Properties...... 9-89 Methods ...... 9-89 InRoutePaths Object Class ...... 9-90 Properties...... 9-90 Methods ...... 9-90 Add 9-90 Clear 9-90 Item 9-91 Remove 9-91 InRouteStep Object Class ...... 9-92 Properties...... 9-92 Methods ...... 9-92 InRouteSteps Object Class...... 9-94 Properties...... 9-94 Methods ...... 9-94 Add 9-94 Clear 9-94 Item 9-95 Remove 9-95 InSetpointItem Object Class ...... 9-96 Properties...... 9-96 Methods ...... 9-97 GetLimits 9-97 GetLimitValue 9-97 SetLimits 9-98 InSetpointItems Object Class...... 9-99 Properties...... 9-99 Methods ...... 9-99
xxx Table of Contents
InSetpointTemplate Object Class ...... 9-101 Properties...... 9-101 Methods ...... 9-102 AddSetpointItems 9-102 AssociateParent 9-102 Create 9-103 Delete 9-103 DeleteSetpointItems 9-104 DisassociateParent 9-104 GetUDA 9-104 GetUDAType 9-105 GetUDAValue 9-105 Load 9-106 SetUDA 9-106 InSetpointTemplates Object Class...... 9-107 Properties...... 9-107 Methods ...... 9-107 InStepSetpointItem Object Class...... 9-109 Properties...... 9-109 Methods ...... 9-110 InitializeFrom 9-110 InStepSetpointItems Object Class ...... 9-111 Properties...... 9-111 Methods ...... 9-111 InTable Object Class ...... 9-114 Properties...... 9-115 Methods ...... 9-115 Row Methods...... 9-117 InTableColumn Object Class...... 9-119 Properties...... 9-119 Methods ...... 9-119 InTableColumns Object Class ...... 9-120 Properties...... 9-120 Methods ...... 9-120 InWorkInstructions Object Class...... 9-122 Properties...... 9-122 Methods ...... 9-123 Create 9-123 Delete 9-124 GetUDAType 9-124 GetUDAValue 9-124 SetUDAValue 9-125
Table Of Contents xxxi
InWorkInstructionsList Object Class ...... 9-126 Property ...... 9-126 Methods ...... 9-126 Add 9-126 Clear 9-126 Item 9-126 Remove 9-127
Chapter 10 ActiveX Controls ...... 10-1 Grid-Based ActiveX Controls ...... 10-3 Common Properties ...... 10-3 Column Title 10-3 Column Number 10-3 Column Width 10-3 Column Resizing 10-3 Changing Column Attributes ...... 10-4 ITDataItemList ...... 10-5 Properties...... 10-5 Methods ...... 10-6 Refresh 10-6 Clear 10-6 Events ...... 10-6 DblClick 10-6 SelectionChanged 10-6 ShutDown 10-6 StartUp 10-6 ITLotDataSet...... 10-7 Properties...... 10-7 Methods ...... 10-8 Refresh 10-8 Clear 10-8 Events ...... 10-8 DblClick 10-8 SelectionChanged 10-8 ShutDown 10-8 StartUp 10-8 ITLotDispCode...... 10-9 Properties...... 10-9 Methods ...... 10-10 Refresh 10-10 Clear 10-10 Events ...... 10-10 DblClick 10-10 SelectionChanged 10-10 ShutDown 10-10 StartUp 10-10
xxxii Table of Contents
ITLotInputItems ...... 10-11 Properties...... 10-11 Methods ...... 10-11 Refresh 10-12 Clear 10-12 Events ...... 10-12 DblClick 10-12 SelectionChanged 10-12 ShutDown 10-12 StartUp 10-12 ITLotInputMtls...... 10-13 Properties...... 10-13 Methods ...... 10-14 Refresh 10-14 Clear 10-14 Events ...... 10-14 DblClick 10-14 SelectionChanged 10-14 ShutDown 10-14 StartUp 10-14 ITLotMachAvail ...... 10-15 Properties...... 10-15 Methods ...... 10-16 Refresh 10-16 Clear 10-16 Events ...... 10-16 DblClick 10-16 SelectionChanged 10-16 ShutDown 10-16 StartUp 10-16 ITLotUndoList ...... 10-17 Properties...... 10-17 Methods ...... 10-18 Refresh 10-18 Clear 10-18 Events ...... 10-18 DblClick 10-18 SelectionChanged 10-18 ShutDown 10-18 StartUp 10-18
Table Of Contents xxxiii
ITLotWorkInst...... 10-19 Properties...... 10-19 Methods ...... 10-20 Refresh 10-20 Clear 10-20 Events ...... 10-20 DblClick 10-20 SelectionChanged 10-20 ShutDown 10-20 StartUp 10-20 ITSubInputMtls ...... 10-21 Properties...... 10-21 Methods ...... 10-22 Refresh 10-22 Clear 10-22 Events ...... 10-22 DblClick 10-22 SelectionChanged 10-22 ShutDown 10-22 StartUp 10-22 ITSelector ...... 10-23 Using the ITSelector Control 10-23 Changing Column Select Properties 10-24 ITSelector Colors 10-24 Properties...... 10-25 Methods ...... 10-26 Refresh 10-26 Clear 10-26 CellValue (r, c) 10-26 ColumnValue (r, heading) 10-26 SelectRow (s) 10-26 Events ...... 10-27 DblClick 10-27 SelectionChanged 10-27 ShutDown 10-27 StartUp 10-27
xxxiv Table of Contents
ListBox ActiveX Controls...... 10-28 Common Properties ...... 10-28 ITLotMergeList...... 10-29 Properties...... 10-29 Methods ...... 10-30 Refresh 10-30 Clear 10-30 Events ...... 10-30 DblClick 10-30 SelectionChanged 10-30 ShutDown 10-30 StartUp 10-30 ITMachineInfoList...... 10-31 Properties...... 10-31 Methods ...... 10-32 Refresh 10-32 Clear 10-32 Events ...... 10-32 DblClick 10-32 SelectionChanged 10-32 ShutDown 10-32 StartUp 10-32 ITQueryList...... 10-33 Properties...... 10-33 Methods ...... 10-34 Clear 10-34 Refresh 10-34 SelectRow (s) 10-34 Events ...... 10-34 DblClick 10-34 SelectionChanged 10-34 ShutDown 10-34 StartUp 10-34 ITSampleList ...... 10-35 Properties...... 10-35 Methods ...... 10-36 Clear 10-36 Refresh 10-36 SelectRow (s) 10-36 Events ...... 10-36 DblClick 10-36 SelectionChanged 10-36 ShutDown 10-36 StartUp 10-36
xviii InTrack and FactorySuite xviii
InTrack and FactorySuite
InTrack is a full-featured manufacturing execution system (MES) that provides an integrated framework for managing a manufacturing enterprise. InTrack works in conjunction with other FactorySuite components, such as InTouch. InTouch is a Windows based Human-Machine Interface (HMI) software package that provides the development environment for creating InTrack manufacturing models, automation scripts, and the runtime user interface. The development environment is called WindowMaker, and the runtime environment is called WindowViewer. This book is a reference for using InTrack OLE Automation. InTrack ModelMaker is used to created the structural model, materials, machines and other objects needed by the runtime application. Detailed reports can be generated from InTrack database information using the included reporting tool or any other reporting software that can acces SQL tables.
InTrack OLE Automation
Primary access to the runtime facilities of InTrack is through Microsoft Object Linking and Embedding (OLE) Automation Objects. This technology lets you quickly develop an InTrack MES application using modern Object-Oriented Programming techniques from a variety of Windows development environments. InTrack OLE Automation classes provide full access to all material and resource tracking facilities. As a productivity aid, classes are provided to support direct plant operator interaction with InTrack runtime through dialogs. Specialized classes also have been provided to support retrieving (querying) information from an InTrack database. For InTouch users, two extensions have been added to support rapid application development. First, this release of the FactorySuite includes an upgraded version of InTrack that features ActiveX controls. For more information on ActiveX controls and COM/DCOM capabilities, see the InTrack ActiveX Controls manual. Second, the InTouch scripting language has been extended to provide direct access to Microsoft OLE Automation object technology.
1-1
CHAPTER 1
OLE Automation and InTouch
Microsoft Object Linking and Embedding (OLE) technology supports a wide variety of information exchange and manipulation facilities between a client and server. InTrack contains an OLE Server that provides facilities for MES runtime tracking using OLE Automation objects (automation objects). An InTouch application acts as a client that informs the InTrack server of manufacturing state changes. This chapter provides a brief outline of the OLE Automation architecture. Procedures for using OLE Automation through the new InTouch extensions also are described.
Note InTouch OLE Automation object extensions are available in InTouch.
Contents Elements of OLE Automation, 2 InTouch OLE Automation Client Extensions, 3
1-2 Chapter 1
Elements of OLE Automation
In a very simplified form, OLE provides a standardized communications facility between a client and a server. The automation object component of OLE provides Object Oriented Programming facilities in this client/server environment. The server provides specific computational skills through object classes. The client asserts how the skills are used by creating objects and accessing their members. OLE provides the communication link between the client and server. To understand automation objects, it is necessary to have a basic understanding of Object Oriented Programming concepts. Objects are identifiable and unique entities that can be created based on an object class. Classes define a related set of properties (data) and methods (functions). Hence, all objects of the same class have the same set of properties and methods, though each object might have different values for its properties. OLE Automation and InTouch 1-3
InTouch OLE Automation Client Extensions
InTouch extensions provide easy access to automation objects using three primary components: Eight additional built-in functions have been added to InTouch. OLE_CreateObject OLE_IsObjectValid OLE_GetLastObjectError OLE_ReleaseObject OLE_GetLastObjectErrorMessage OLE_ResetObjectError OLE_IncrementOnObjectError OLE_ShowMessageOnObjectError Standard InTouch function templates and online Help for these functions are available through the System and Help buttons, respectively, in the Functions box of the Script Editor dialogs. A unary operator indicates the start of an OLE Automation expression. An InTrack OLE Browser provides templates and online Help for all InTrack automation object classes. The Browser is accessed through the InTrack OLE button in the lower right corner of the Script Editor dialogs.
InTouch Automation Expressions
All references to automation objects within InTouch start with a percent sign and are followed by a name that identifies the object reference. The name must start with an alpha character and can consist of alpha, numeric and underscore characters. Names are case insensitive and global. Examples of different object names are: %ObjectName (or %objectName or %objectname) %Lot5 %lot_5 %aMachine %A_Machine %Sublot Do not confuse object names with InTouch tagnames. You can have an OLE Automation object and an InTouch tag with the same name (except for the percent prefix).
Object References
These “percent names” are specifically referred to as object references because they are pointers to automation objects. Two different names can access the same object using the following InTouch script statement: %Object1 = %Object2; After executing this statement both object references “point” to the same automation object. Object reference names are automatically defined when first used during runtime. They are global—you can initialize them in one script and use them in another script. As with most object-oriented programming languages, the “dot” operator is supported for referencing the properties and methods of an object. The following example shows the use of the dot operator to set an object property to the value 5: %Object.Property = 5; 1-4 Chapter 1
Nested Objects (Dot Operators)
If objects are members of other objects, the “dot” operator can be used multiple times. Setting the property of a nested object to the value 6 would appear as: %Object.Property_For_Nested_Object.Property = 6; There are a few specific rules for working with the dot operator: 1. No embedded spaces can be placed within the specification of the object reference and any member references: • No space between the percent sign and the start of the object reference name. • No space between the object reference name, the “dot” operator and the name of the class member. • No space between the property name of a nested object, the “dot” operator and the name of the property of the nested object. 2. The number of characters for the entire specification cannot exceed 98 counting from (and including) the percent sign to the last member reference. For example, the length of the specification %Object.Property is 16 characters, and the length of the specification %Object.Property_For_Nested_Object.Property is 44 characters.
Data Type Conversions, InTouch to OLE
Not all InTouch data types are supported by the OLE extensions. The following summarizes the supported data types and data conversions. Note that the conversion occurs at runtime and not in WindowMaker. Hence, the data conversion can cause unexpected results with no error reported.
Integer 32-bit signed value. Converts to the following data types: To Real The value is floated. To Message Standard conversion to a sequence of decimal digits - possibly prefixed by a minus sign. To Discrete Converts to TRUE (1) if value is not zero, else FALSE (0). Real 64-bit resolution. InTouch computes using 64-bit resolution but stores the results in 32-bit resolution tags. The automation object interface works with the higher resolution. Converts to the following data types: To Integer The real value is truncated. To Message Standard conversion to a sequence of decimal digits and decimal point possibly prefixed by a minus sign. To Discrete Converts to TRUE (1) if value is not zero, else FALSE (0). OLE Automation and InTouch 1-5
Message A string limited to 131 characters (InTouch constraint). Data conversions are more complex for this data type and are a more likely source of runtime errors. To Integer Same as the InTouch built-in function StringToIntg. If the string starts with a number (ignoring spaces but including a minus sign) the number is converted. Anything else results in a zero value. To Real Same as the InTouch built-in function StringToReal. If the string starts with a number (ignoring spaces but including a minus sign) the number is converted. Anything else results in a zero value. To Discrete Converts to an integer then applies rule to convert an integer to a discrete. To Object Reference This conversion is needed only in a few very special cases and should be avoided. Misuse of this conversion facility can cause WindowViewer to exit with a fatal error. This conversion will report an error with any input other than a string generated by conversion of an object reference. Discrete Converts to the following data types: To Integer One if TRUE, else zero. To Real One if TRUE, else zero. To Message “0” for False and “-1” for True. Object Reference In general, object references should not be used in any context where data conversion might occur. Converts to the following data types: To Message A specially formatted string that includes the hexadecimal representation of the object reference.
Restrictions
Two important restrictions apply to InTouch automation object extensions: Extensions are available only from within InTouch scripts. The extensions use “late binding”—most errors cannot be identified until the script has been executed. 1-6 Chapter 1
Creating an Object
Automation objects are created via the InTouch built-in system function OLE_CreateObject. The syntax for this function is: OLE_CreateObject(%Object, “className”); where: OLE_CreateObject The function that creates the automation object %Object Name used to reference the automation object className The name of the class provided by the OLE Server This function has no return value.
Example For example, to create an object of the InTrack class Sublot the statement would be: OLE_CreateObject(%Sublot, “InTrack.Sublot”); Misspelling “className” is a frequent error that cannot be identified within WindowMaker. The error will not be identified and reported until you execute the function in WindowViewer To avoid misspellings, use the OLE_CreateObject templates found in the InTrack OLE Browser. When an object is first created, its properties are automatically set to applicable defaults by the server.
Note: An object reference name does not require initialization with a call to OLE_CreateObject. In a previous example an assignment statement was used to associate an object reference with an object. OLE Automation and InTouch 1-7
Managing an Object
An object is valid as long as at least one object refers to it. However, it is good practice to release an object that is no longer in use to conserve system resources. To release an object: 1. Create a new object with the same object reference name. When you create a new automation object with the same name as an existing automation object reference, the original automation object is released and the new object is associated with the original name. For example: OLE_CreateObject(%Object, “InTrack.Sublot”); OLE_CreateObject(%Object, “InTrack.DateTime”); The first statement causes an object of class Sublot to be created and referenced by %Object. The second statement releases the object of class Sublot, then creates an object of class DateTime and associates it with %Object. 2. Use the built-in OLE_ReleaseObject system function. The syntax for this function is: OLE_ReleaseObject(%objectName); where: %objectName The name of the automation object reference There is no return value for this function and it never fails. 3. Set a reference to a second object. The syntax to set an automation object to another automation object is: %object1 = %object2; where: %object1 Is the object reference to be “pointed” to the same object as %object2. The automation object previously associated with %object1 will be released. %object2 Automation object to reference with the name, %object1. It must be of the same type. In this example any object associated with %object1 is released.
Testing for a Valid Object
After the relationship between an object reference and an OLE Automation object has been broken via the OLE_ReleaseObject function, the reference is “invalid.” Using an invalid reference in any object expression will result in an error at runtime. An InTouch built-in system function OLE_IsObjectValid enables validity checking of an object reference. The syntax for this function is: OLE_IsObjectValid(%objectName); where: %objectName The name of the automation object reference to release from memory This function returns a discrete (Boolean) value indicating if the %objectName is currently bound to a valid automation object. 1-8 Chapter 1
Getting a Property Value
A property is a named attribute that defines an object’s characteristics or an aspect of its behavior. The dot operator separates the object reference from the name of the property. When a tag is allowed in an InTouch script, the following syntax can be used to return the value of an automation object’s property: %Object.Property where: %Object Automation object reference Property An object attribute If the property of an object is itself an object, the “dot” operator can be used multiple times; as in the following example: %Object.Property1.Property2 where: %Object Automation object reference. Property1 A property of %Object. Note that the property can be an embedded object or a reference to another object. InTouch and OLE automatically handle both cases. Property2 A property of the nested object from which a value is to be retrieved. Using multiple dots translates into multiple “get property” operations. In this example a simple “get” is done for %Object.Property1, which, according to OLE Automation standards, returns a reference to the nested object. This returned reference is used to perform another simple “get” for Property2. This could be performed manually with two InTouch script statements: %tempObject = %Object.Property1; %tempObject.Property2; This sequence of actions is important for several reasons: 1. Errors resolving property names can occur for each dot operator. 2. Multiple dots can be used in a variety of contexts to simplify coding, such as getting properties, setting priorities and calling methods.
Example 1 The goal is to increment an InTouch tag value if it is the first day of the month between 1:00 a.m. and 2:00 a.m. This code fragment illustrates several concepts: OLE_CreateObject(%DateTime, "InTrack.DateTime"); %DateTime.SetLocalTime(); IF (%DateTime.Day == 1) AND (%DateTime.Hour > 1) AND (%DateTime.Hour < 2) THEN Tag=Tag+1; ENDIF; OLE_ReleaseObject(%DateTime); OLE Automation and InTouch 1-9
Example 2 This example illustrates use of the multiple “dot” operator. The goal is to get some capacity information about a machine resource into InTouch tags for displaying to an operator. The example is highly contrived, but illustrates getting properties in a variety of InTouch expression contexts. For simplicity, it is assumed that the object %Machine has been created as an instance of InTrack.Machine, and that appropriate information has been loaded from the InTrack database (the mechanics of this are described in later sections). NumerUnitsTag = %Machine.Capacity.Quantity; TypicalWeightTag = %Machine.Capacity.Quantity * 40.6; ContrivedLoadingTag = Log(%Machine.Capacity.Quantity) + 1; UnitsNameTag = %Machine.Capacity.Units; 1-10 Chapter 1
Setting a Property
The value of an input or output object property can be set using three methods: Use an assignment statement (described in this section). Pass the property reference as an output parameter to a method. Call a method to set one or multiple properties of an object in a single action (new values are passed as parameters). These facilities are class specific. Refer to the method references in the chapters that follow for more information.
Note References to properties of automation objects cannot be passed as “by reference” (output) parameters to DLL functions called from InTouch scripts. The value of an object property cannot be changed by a DLL function.
The basic syntax for setting an object property value through an assignment statement is as follows: %Object.Property = Value; where: %Object Automation object reference Property An object attribute Value Value that you want to assign to the object attribute As with getting object properties, if the property of an object is itself an object, the “dot” operator can be used multiple times: %Object.Property1.Property2 = Value; where: %Object Automation object reference Property1 A property of %Object that is of type object Property2 A property of the nested object that is to have its value set This one InTouch statement using multiple “dot” operators is equivalent to: %tempObject = %Object.Property1; %tempObject.Property2 = Value;
Example The first line of this example creates an automation object of the Amount class named %PrimaryAmt. The second and third lines of script set the %PrimaryAmt automation object’s Quantity property to “100” and the Units property to “each.” OLE_CreateObject(%PrimaryAmt, “InTrack.Amount”); %PrimaryAmt.Quantity = 100; %PrimaryAmt.Units = “each”; OLE Automation and InTouch 1-11
Calling a Method
Calling a member method of an automation object is the typical way a client asks the server to do work on its behalf. The following syntax illustrates how to call a method on an automation object: resultValue = %Object.Method(Parameter1, Parameter2, ...); %Object.Method(Parameter1, Parameter2, ...); where: resultValue A data value returned by the method. %Object Automation object reference. Method Action performed by the automation object. Parameters Information to be passed into or returned from the method. The number of parameters is defined by the method being called. Parameters can be read only or input/output.
Restrictions
The following restrictions apply to calling methods: Methods can be called as a “subroutine” (no return value). If the method does return a value, it is discarded. If a return value is to be used, it must be assigned unmodified. The method call cannot be a term in an expression. Typically, script execution is blocked until the method returns from processing, unless the method performs transactions that require user interaction through dialogs. You must insure that the correct number of parameters is passed. There is no support for OLE “optional” parameters. 1-12 Chapter 1
Parameter Types
Some restrictions apply to the types of data that can be passed to an Automation method from InTouch.
Data Type May be represented as a
Integer Constant, expression, read-only tag, read/write tag, or read/write OLE Automation property Real Constant, expression, read-only tag, read/write tag, or read/write OLE Automation property Message Constant, expression, read-only tag, read/write tag, or read/write OLE Automation property Discrete Constant, expression, read-only tag, read/write tag, or read/write OLE Automation property Object Object reference name or read/write OLE Automation property
Note that some methods are “polymorphic,” and can take several different types of data for the same parameter. InTouch supports this facility for input-only parameters.
Output Parameters
InTouch does not differentiate between method parameters that are input only and input/output. If the parameter can be updated, a value is stored into it. A parameter can be updated if: The parameter is the name of a read/write InTouch tag. The parameter is an object reference name. The parameter specifies an object property. In the following InTouch statement the first three parameters will be updated, since each meets the corresponding option listed above. The other parameters will not be updated. %Obj1.Method(tag1, %obj2, %obj3.property1.property2, tag1 + 3, %obj4.property + 0); OLE Automation and InTouch 1-13
Return Values
To capture the return value of a method, the left side of the assignment must be: The name of a read / write InTouch tag. An object reference name. An object property specification.
Example 1 Assume that an automation object of class SerialNumbers has been created and named %SerialNumbers. The following script statement will add the serial number “1234” to the serial numbers in the %SerialNumbers collection object: returnCode = %SerialNumbers.Add(“1234”);
Example 2 Assume that an automation object of the Sublot class has been created and named %Sublot_Object. You want to use the Sublot Ship method, which contains two parameters that are automation objects, %PrimaryAmt and %SecondaryAmt: ReturnCode = %Sublot_Object.Ship (%PrimaryAmt, %SecondaryAmt, “customerName”) ; where: %PrimaryAmt Amount objectidentifying the primary quantity to ship %SecondaryAmt Amount automation object identifying the secondary quantity to ship customerName Name of the customer receiving the shipment
Sample You want to ship 100 manuals (primary amount), each weighing 2 pounds (secondary amount) to a customer (Wonderware). You must create the parameter automation objects, %PrimaryAmt and %SecondaryAmt, and set their properties, before you can call the Ship method. Each step is outlined below: 1. Create an Amount object to represent the primary quantity and set the properties: OLE_CreateObject(%PrimaryAmt, “InTrack.Amount”); %PrimaryAmt.Quantity = 100; %PrimaryAmt.Units = “each”; 2. Create an Amount object to represent the secondary quantity and set the properties: OLE_CreateObject(%SecondaryAmt, “InTrack.Amount”); %SecondaryAmt.Quantity = 2; %SecondaryAmt.Units = “pounds”; 3. Call the Ship method on the %Sublot_Object using the following syntax: returnCode = %Sublot_Object.Ship(%PrimaryAmt, %SecondaryAmt, “Wonderware”); 1-14 Chapter 1
InTouch Error Handling
When handling errors, determine if the error was caused by using OLE Automation incorrectly, or if the error was returned from the OLE server. InTouch identifies OLE errors in a message box and records them in the WWLogger. InTouch script execution is not terminated by an OLE error. The action taken depends on the task at the time of the error: If it occurs during a get property operation, zero or an empty string is returned for the properties value. If it occurs on a set property operation, the property value is not changed. If it occurs on a method call, the method is not invoked, no changes are made to any parameter values, and the return value for the method is zero or an empty string. To assist with error handling, five system reporting functions are provided: OLE_GetLastObjectError OLE_GetLastObjectErrorMessage OLE_ResetObjectError OLE_ShowMessageOnObjectError OLE_IncrementOnObjectError Details for these functions are provided below.
OLE_GetLastObjectError
To get the error number for the last reported error through the Microsoft “last error” variable: value = OLE_GetLastObjectError(); where: value Is an integer into which the error number is stored. Error numbers are internally unsigned 32-bit integers. InTouch does not have the same integer range, so error codes that use high-order bits will not be returned correctly.
OLE_GetLastObjectErrorMessage
To get the error message (description) for the last reported error: value = OLE_GetLastObjectErrorMessage(); where: value Is a string (message) set to the error message. This text also is presented in the error message box. It contains embedded carriage return and line feed characters. If the text exceeds the 131-character string limit imposed by InTouch, the message is truncated. OLE Automation and InTouch 1-15
OLE_ResetObjectError
The value of the “last error” is changed only when an error occurs. It is not reset upon successful completion of an OLE Automation action. In some cases application development is made easier by setting the “last error” to a known state, performing several OLE Automation actions, then testing for a change in the “last error” value. This function will set the Microsoft internal “last error” value to zero. The syntax for this function is: OLE_ResetObjectError();
OLE_ShowMessageOnObjectError
This function controls the display and required operator input when an OLE interface error or OLE exception occurs. While this message box is displayed, the script that caused the error is blocked from running until the message box is acknowledged (for example, the OK button is clicked). Background scripts will continue to execute. An OLE interface error involves a failure to communicate with the Microsoft OLE infrastructure provided by the Microsoft Windows-NT operating system. It does not reflect a processing error identified by an OLE server. An OLE exception can be caused either by the OLE infrastructure or OLE server. The syntax for this function is: OLE_ShowMessageOnObjectError(discreteTag); where: discreteTag Defines the name of the Boolean (discrete) value that indicates whether to display a message box to a user if an OLE error or exception occurs, where: -1 = display message box (default) 0 = do not display message box The following script disables the display of the OLE error message box for a call to the Create method of the object %Lot. After the method call, the OLE error message box is re-enabled for display on any subsequent error. OLE_ShowMessageOnObjectError(0); %Lot.Create("abc"); OLE_ShowMessageOnObjectError(1); 1-16 Chapter 1
OLE_IncrementOnObjectError
This function increments an integer tag if an OLE interface error or OLE exception occurs.
Note If the OLE_ShowMessageOnObjectError function is executed with the discrete tag enabled, the value is incremented after the OLE error message box is displayed and acknowledged.
An OLE interface error involves a failure to communicate with the Microsoft OLE infrastructure provided by the Microsoft Windows-NT operating system. It does not reflect a processing error identified by an OLE server. An OLE exception can be caused either by the OLE infrastructure or OLE server. The tag specified by this function will be incremented on each error until another call specifies a different tag. The tag is not remembered across executions of WindowViewer. The syntax for this function is: OLE_IncrementOnObjectError(integerTag); where: integerTag Defines the name of the integer tag to be incremented upon error or exception. The following script increments the value of the variable referenced by the errorCount tag by 1 each time an OLE interface error or OLE exception occurs. OLE_IncrementOnObjectError(errorCount); OLE Automation and InTouch 1-17
Frequent Automation Object Errors
Frequent errors when using InTouch OLE Automation extensions and their remedies are listed below. OLE object reference name has not been defined. An object reference name has been used to reference a property (%object.property) or call a method (%object.method(parameter) ) before being associated with an object. Check that the object reference name is not misspelled. Verify the name associated with an object by using the InTouch system function OLE_CreateObject or by assigning one object reference to another. Unknown property or method name. Verify that the property or method name is spelled correctly. Attempt to update read-only property. This error is obvious when the read only property is on the left side of an assignment statement. It is more difficult to spot when it is being updated as a return parameter from a method call. Type mismatch. The data being passed as a parameter for update is not correct. This indicates that automatic data conversion does not have enough information to take the correct action. Manually assign the data to an InTouch tag of the correct type and use the tag. Invalid class string. This generally indicates that the class name (second parameter) in an OLE_CreateObject function call is misspelled. Parameter not optional. Check that the correct number of parameters is being passed. Unexpected results but no error reported. Data type conversion is performed at runtime. Accidentally assigning a string to an integer would not generate an error; however, you may get a result of zero if the string does not start with digits. Object reference path element is not an OLE object. When using multiple “dot” operators, this error occurs if one of the properties in the path is not an embedded object or object reference. 2-1
CHAPTER 2
InTrack OLE Automation Server
InTrack runtime architecture consists of five primary components: An MES Tracking Application This InTouch HMI application can perform both MES Tracking tasks and manufacturing control/operator interface tasks. Microsoft OLE support facilities InTrack OLE Automation Server Implements a controlled gateway between the MES application and the RDBMS where the tracking data is maintained. Relational Database Management System (RDBMS) This system maintains InTrack MES tracking information. MES modeling and tracking information stored in RDBMS tables. The InTrack OLE Automation server implements a variety of automation object classes. These classes provide convenient mechanisms for performing MES tracking operations that update the database. Additional classes organize temporary MES tracking information in memory and retrieve information from the RDBMS. The InTrack tables maintained within the RDBMS are part of the InTrack public interface. You are free to use a variety of RDBMS query and reporting tools to access this information.
Caution: Never modify an InTrack RDBMS table or its contents directly. Doing so will damage the integrity of the InTrack database, resulting in unrecoverable failure of tracking applications.
The InTrack OLE Automation Server consists of several Microsoft Dynamically Linked Libraries (DLLs). The most visible of these is TRACKOBJ.DLL, the entry point for the implementation of the OLE Automation Interface. This DLL file name might appear in messages associated with OLE Interface errors.
Contents InTrack Concepts, 2 Type Library, 7 Overview of InTrack OLE Automation Classes, 8 MES Application Development Notes, 12
2-2 Chapter 2
InTrack Concepts
The information InTrack maintains in the RDBMS tables can be divided into two categories: Structural Information used to model the components and structure of your manufacturing processes. Tracking of materials and resources is performed within the context of this model. Activity Data collected during the operation of the factory that reflects the state of material and resources. The InTrack OLE Automation Server supports the collection and validation of activity information, and records information into the database. The server also provides facilities to reduce the effort required to implement MES tracking applications. To identify information within the database, the InTrack server uses specially formatted strings (messages) referred to as keys. The format of these keys is described in the following sections.
Structural Information
InTrack ModelMaker or OLE Automation can be used to build a description of your factory. A structural description of your factory can be built manually with InTrack ModelMaker or automated using the InTrack OLE Automation interface. The processes are identical, although the syntax may vary. For example, the InTouch statement “OLE_CreateObject…” would be expressed as “Dim db as new…” in Visual Basic. Structural objects are stored in the RDBMS. They are separate from the OLE Automation objects used by the MES Application Client, also described in this book. For more information on modeling objects, see Chapter 5, "Structural Objects." To perform manufacturing tracking, it is often necessary to identify specific structural objects. When using InTrack automation objects, use a ModelKey. This key (string) has the same format as names used in Model Maker. For example: The disposition code structural object named “ok” has the ModelKey “ok” The material structural object named “Cookies” has the ModelKey “Cookies” The material key is Name[version]. The work instructions structural object named “Mixing[1.4]” has the ModelKey “Mixing[1.4]” InTrack OLE Automation Server 2-3
Activity Information
Working with activity information is the primary function of the InTrack OLE Server. This section will discuss a few of these concepts and their relationships to InTrack automation objects.
Material Tracking
Two concepts form the core of material tracking: Lot Represents a quantity of material being tracked and identified by a unique name. Sublot Identifies the location or process state of some, or all, of the material associated with a lot.
LOT ID: x15 Quantity: 180
SUBLOT SUBLOT SUBLOT SUBLOT Location: receiving Location: shop1 Location: ship1 Location: shipping WIP: WIP: milling:setup WIP: repair:1 WIP: Quantity: 25 Quantity: 110 Quantity: 5 Quantity: 40 A lot always has one or more sublots associated with it. The above illustration and description that follows show how the material for a single lot can be distributed across locations and manufacturing states. The lot named “x15” has a total quantity of 180 items distributed across four sublots. 1. 25 items are located in “receiving”. The lack of a WIP (work in progress) state indicates that these items are in inventory. 2. 110 items are at location “shop1” and its manufacturing state is identified by a WIP indicating route “milling” at the step named “setup”. 3. Five items are at location “shop1” and its manufacturing state is identified by a WIP indicating route “repair” at the step named “1”. 4. 40 items are in inventory location “shipping”.
Lot Keys
To identify lots and sublots within the database, the InTrack server uses special keys. The key used to identify a lot within the database is a simple name referred to as a Lot_ID. In the above example the Lot_ID is “x15”, so the LotKey would be “x15”. 2-4 Chapter 2
Sublot Keys
The keys for sublots are more complex. They have the general form: “Lot_ID@route_name[route_version]:route_step@location” ; where: Lot_ID Lot identification number. For bulk inventory, the lotID is composed of a material name and version information in the following format: material[version] route_name Name of the route to which the sublot is assigned (only for identifying WIP lots) route_version Route version (optional) route_step Route step where the sublot is currently processing location Physical location of the sublot (optional) For the diagram on the previous page, the following keys would be used: 1. x15@receiving 2. x15@milling:setup@shop1 3. x15@repair:1@shop1 4. x15@shipping The InTrack server provides two automation classes for accessing lot and sublot information, Lot and Sublot. Note that creating an automation object does not create corresponding information in the database. The automation objects provide a way to communicate with the database. To create an automation object of the Lot class, you could use the InTouch statement: OLE_CreateObject(%Lot, “InTrack.Lot”); To create a material to be tracked as a Lot in the database, use the method: %Lot.Create(“x15@shipping”, … ); (a more detailed example is provided in the reference section for this method). When you use the Create method of the Lot class to create a new lot activity object in the database, a new sublot object also is created. Similarly, if you use the Create method of the Sublot class and give it a name for a lot that does not exist, a new lot also is created in the database. Because process and location tracking is performed at the sublot level, the Sublot class contains methods for changing the state of the material. Understanding these methods is the starting point for any MES application developer. InTrack OLE Automation Server 2-5
Resource Tracking
Resource tracking is provided for machines and users. In both cases the resource to be tracked must be a structural object in the InTrack database. Machine tracking is performed using the Machine class. Tracking is provided for: Machine repair Machine maintenance, called tasks Machine status For machine status tracking, there is some overlap of functionality between Sublot class methods and those of the Machine class. Depending how you choose to do resource tracking, considerable application development effort can be saved by using one group over the other.
Data Collection
Collection of data, not related to material consumption, is performed using data set templates defined in ModelMaker or entered in the InTrack database using OLE Automation. These templates can be used in three contexts: Related to a specific sublot. Data collected using this facility can be used to determine if the data collection requirements for an operation have been met. Related to a specific machine. Data collection requirements are not enforced for machines. Ad hoc data collection. Information can be collected at any time and saved. A single set of collected data is called a sample. The DataSetSample object class is used to construct new samples, access existing samples, or modify existing samples. 2-6 Chapter 2
Using Keys
In the above descriptions, the concept of keys has been described as the notation for identifying information in the database. The InTrack automation objects are designed to use this key information to simplify MES application development. Rather than require that a key be passed with each method call that involves a database transaction, the key is maintained as a property of the automation object. This way, one automation object can be created, its key property initialized, and several different methods can be invoked on that object without having to manually update the key. In the following example, the Sublot key is specified once, then three standard operation transactions are performed in sequence: %Sublot.SublotKey = "x15@receiving"; %Sublot.Start( … ); %SubLot.Consume( … ); %Sublot.Complete( … ); Another advantage of keys is that a single automation object can be used to access information on different database objects. In the following example, the total quantity of material in inventory for the above Lot diagram is computed: %Sublot.SublotKey = “x15@receiving”; %Sublot.Load(); total = %Sublot.QueuedAmt.Quantity; %Sublot.SublotKey = “x15@shipping”; %Sublot.Load(); total = total + %Sublot.QueuedAmt.Quantity ; InTrack OLE Automation Server 2-7
Type Library
The InTrack Automation Server has an associated Type Library (InTrack_Automation) embedded in the InTrack Automation Server (TRACKOBJ.DLL). The type library describes all ActiveX objects that are available via the Automation Server. By accessing the type library, development environments, applications and object browsers can determine the characteristics of any InTrack Automation object. Detailed information is available on all Interfaces and associated properties, methods, and events; including method parameter and return types. Using a type library to access Automation Objects is approximately two times faster than accessing them through the standard IDispatch Interface without type information. For details on using type libraries, consult your respective development environment on how (and if) you can use type libraries to aid in the development process. 2-8 Chapter 2
Overview of InTrack OLE Automation Classes
InTrack OLE Automation classes are grouped into six categories. These categories are reflected in the organization of the reference section of this book, the InTrack OLE Browser provided within InTouch and the on-line help. Each object can be defined through InTouch or through an OLE interface. The same naming convention is used for all objects in all automation classes. For example, an amount object used to pass quantity information in a variety of methods, would be identified as:
Object Name: InAmount Interface Name: IInAmount InTouch Object Name: %Amount The automation objects are named consistently throughout InTrack. Likewise the methods of these objects use the same names throughout. For example, you will find Add and Load methods in many different object classes.
Application
This category contains only one class: Database. You must have one, and only one, instance of this class in any InTrack tracking application. Two unique properties of this class, BackDate and Comment, have values that are automatically applied to any database transaction (regardless of class or method). These properties are seldom needed, so including them as parameters in every method that performs a transaction would be inconvenient. The Database object class also includes some critical methods:
Connection Methods (Connect, Disconnect)
These methods access the RDBMS used to store the InTrack tables. Computationally expensive operations, they should be called only once – when the tracking application starts and when it shuts down.
User Access Control Methods (UserLogon, UserLogoff)
These database methods identify the operator on transaction logs and ensure transaction security.
Transaction Control Methods (BeginTrans, CommitTrans, RollbackTrans)
Transaction control methods provide direct control over database transaction. All methods placed between the BeginTrans and Commit Trans method are treated as a single transaction set, committed only after the CommitTrans method is passed. The RollbackTrans method is used to undo previous commitments. It cancels all commands that have been started, but does not affect transactions that have been completed previously. InTrack OLE Automation Server 2-9
User-Defined Table Access Methods (GetUDA, GetUDAType, GetUDAValue, SetUDAType)
The UDA methodsaccess to and update the values stored as user-defined attributes (a facility for user extension of InTrack RDBMS tables). They also are found in other automation classes.
General
This category contains a variety of classes that organize information used by other classes. For example: Specification of quantities, units and serial numbers. Encoding for dates and times. Enumeration of Sublots to be used in specific transactions. Selectors to let plant operators choose sublots or machines from a list. Some of these organizational classes known as “Collections” and “Selectors” have special characteristics.
Collection Classes
Collection classes are specialized classes that enable the processing of multiple objects. For example, materials used in a manufacturing route may be consumed at the same step, or as part of the same transaction. A ConsumeItem object would be created for each material consumed. In order to allow processing of multiple items, the collection object ConsumeItems can be created, then populated with individual items (using the Add method). When established, collection objects enable processing of multiple objects as a group, instead of individually. Generally, to identify a collection class, the letter “s” is appended to the object name (ConsumeItems is a collection of ConsumeItem objects, DisassembleItems is a collection of DisassembleItem objects, etc.). Create and use collection classes to save time during scripting. 2-10 Chapter 2
Structural
The automation classes in this group represent the structural objects that can be defined in an InTrack database. Methods of these object classes can be used to create structural database objects, just as they would be created using the ModelMaker editors. The classes are: CustomerSpecification DataSetTemplate DispositionCodes Location Machine Material Operation Route SetpointTemplate User WorkInstructions
Import API
Import API objects provide an OLE interface to InTrack objects. Standard ModelMaker objects can be created in Visual Basic or other program languages, then imported into the InTrack system. The ImportAPI object corresponds directly to the structural object. For example, InLocation is the import API equivalent of the Location object.
Activity
The automation classes in this group form the core of the MES tracking. Each was described in the concepts section above: Lot Sublot DataSetSample
Dialog
InTrack runtime provides a set of Windows dialogs from which a factory operator or supervisor can perform any database transaction. Each dialog is accessed by its own OLE Automation class. One dialog class supports the InTouch Selector window control. This control displays lots or machines an operator can choose to perform an action. Selectors, when combined with dialog classes, can reduce the effort needed to develop an MES tracking application. Examples of combining these facilities can be found in the scripts associated with the InTrack Wizard buttons within InTouch. InTrack OLE Automation Server 2-11
Query
This large collection of classes provides quick and easy access to much of the information contained in the InTrack database tables. Many are specifically structured to provide information required by Sublot and Machine methods. There also is a general query class, Query.SQL, that supports access to all information in the InTrack database. All query classes operate in the same basic manner: 1. A Query method that takes parameters filters how much information is returned. The result of the query is a set of rows that can be examined. The number of rows found is stored in the property RowCount. 2. After the Query method has completed, information from each row can be accessed by calling the SetRow method. This method loads the values of class properties to reflect the corresponding information from the database. The Index property is set to indicate which row is currently loaded into the other object properties.
2-12 Chapter 2
MES Application Development Notes
This section addresses topics related to the implementation of an MES application using the InTrack OLE Automation Server.
Database Transactions
The InTrack MES data is always held in RDBMS tables. Retrieving a copy of this information into an InTrack automation object involves performing a database transaction. For example: 1. Create an automation object of the InTrack class Sublot: OLE_CreateObject (%Sublot, “InTrack.Sublot”) ; 2. To identify the sublot for which you want information, set the SublotKey property. %Sublot.SublotKey = “Lot-123@waterroute[1]:step1@location1”; 3. Call the Load method to have the InTrack Automation Server perform a database transaction that sets the automation object’s properties with information from the database: %Sublot.Load(); The above example assumes that the specified sublot has been created within the database. Remember, automation objects are gateways, not the database objects themselves.
Example — Creating and Starting a New Sublot
The following example creates a new sublot in the MES database and starts it at the first operation of its manufacturing route: 1. Create aSublot object to be used as the gateway to the MES data. OLE_CreateObject(%Sublot, “InTrack.Sublot”); 2. Set the SublotKey property for the unique key to access this sublot in the future. %Sublot.SublotKey = “Lot-12345@waterroute[1]:step1@location1”; 3. Call a Create method of the Sublot object. This call causes the InTrack Automation Server to perform a database transaction. returnCode = %Sublot.Create(“Sparkling”, %PrimaryAmt, %SecondaryAmt, 10, "", "", "", %DueDate); 4 The same automation object can be used to start the sublot at the first route step. This method also causes a database transaction. returnCode = %Sublot.Start(%PrimaryAmt, %SecondaryAmt, 1); InTrack OLE Automation Server 2-13
Example — Grouping Individual Transactions
For some special tracking applications it is necessary to exercise control over database transactions; that is, to group several method calls (which would normally be one transaction each) into a single transaction. This can be done by using three methods of the Database class: BeginTrans, CommitTrans, and RollbackTrans. The above example could be rewritten to perform one database transaction instead of two: 1. Create a Sublot object used as the gateway to the MES data. OLE_CreateObject(%Sublot, “InTrack.Sublot”); 2. Set the SublotKey property for the unique key to access this sublot in the future. %Sublot.SublotKey = “Lot-12345@waterroute[1]:step1@location1” ; 3. Assert control of database transactions. %Database.BeginTrans(); 4. Call the Create method. No transaction is performed. returnCode = %Sublot.Create(“Sparkling”, %PrimaryAmt, %SecondaryAmt, 10, "", "", "", %DueDate); 5 Call the Start method. No transaction is performed. returnCode = %Sublot.Start(%PrimaryAmt, %SecondaryAmt, 1); 6. Assert that database transactions for Create and Start should be performed as one transaction. %Database.CommitTrans();
2-14 Chapter 2
Handling InTrack Errors
There is a difference between OLE errors and errors identified and reported by the InTrack OLE Automation Server. There are few conditions in which InTrack server errors can occur: Setting an object property to an invalid value. For example setting the month property of an object of the Date class to 13. This form of error will cause an OLE Exception (similar to what the OLE does when attempting to set the value of a read only property). Calling a method and passing invalid data for a parameter. This error is reported by a “return code” described below. Violating a manufacturing constraint. Manufacturing constraints are defined in Model Maker or are built-in manufacturing rules in InTrack. Environmental problems occurring during a transaction with the database. This could include: The RDBMS is down or off-line. The network is down. An object of the Database class has not been created and connected to the RDBMS. These kinds of conditions are also reported through a return code.
Return Codes
A return code is an integer returned by a method to indicate if its work was completed successfully or if there was an error. A return code of zero indicates success. In a few cases the return code is a method output parameter. It usually is returned as the value of the method, in the form: returnCode = %Database.Connect(“Supervisor”, “Authority”); A description for any error (i.e., a returnCode value) can be retrieved with the GetErrorMessage method of the Database class. InTrack OLE Automation Server 2-15
Working with Collection Objects
Collection automation objects let you work with a set of similar automation objects as a single group instead of as single entities. Collection objects have standard properties and methods. A standard collection object property is the Count property, which identifies the number of items in the collection. Standard collection object methods include Add, Remove, and Item. Use the Add method to add an individual automation object to a collection. Use the Remove method to remove an individual automation object from a collection. The Item method locates a specific automation object within the collection through an index number.
Note: Adding an object to a collection adds a reference, the contents of the object are not copied.
Example — Using a StartItem Object Collection to Start Machines
Aa StartItem object identifies the type and amount of a material processed in a Start method of a Machine object. If you have four StartItem objects (%StartItem_Object1, %StartItem_Object2, %StartItem_Object3, and %StartItem_Object4), you could pass each one into the Start method separately or you could create a collection object (%StartItems_ObjectA) to process all four automation objects as a single entity. 1. Use the following script to add %StartItem_Object1, %StartItem_Object2, %StartItem_Object3, and %StartItem_Object4 to StartItems_ObjectA. returnCode = %StartItems_ObjectA.Add(%StartItem_Object1); returnCode = %StartItems_ObjectA.Add(%StartItem_Object2); returnCode = %StartItems_ObjectA.Add(%StartItem_Object3); returnCode = %StartItems_ObjectA.Add(%StartItem_Object4); %StartItems_ObjectA now contains references to all four automation objects: %StartItem_Object1, %StartItem_Object2, %StartItem_Object3, and %StartItem_Object4. 2. The following script removes the reference to %StartItem_Object1 from %StartItems_ObjectA: returnCode = %StartItems_ObjectA.Remove (%StartItem_Object1) ; %StartItems_ObjectA now contains only three automation objects: %StartItem_Object2, %StartItem_Object3, and %StartItem_Object4. When %StartItems_ObjectA is complete, you can use it in the Start method of a Machine object, named %Machine_Object in the following script: returnCode = %Machine_Object.Start(%StartItems_ObjectA); When you call this Start method, InTrack automatically processes the three StartItem automation objects in %StartItems_ObjectA without further intervention. 3. The Item method lets you view an individual item in a collection. Select the item you want to view with an index number. To view the first item in %StartItems_ObjectA, use the following syntax: returnCode = %StartItems_ObjectA.Item(1);
Object Creation
Creating automation objects (using the OLE_CreateObject function) can be computationally expensive. A good technique to minimize this cost is to create the objects needed at application startup and release them on application exit. 2-16 Chapter 2
The design of InTrack OLE Automation classes facilitates this approach. The same object of class Sublot can be used to access and update different database sublots simply by changing the SublotKey property.
Working with InTouch Selectors
InTrack extensions to InTouch include “selector” facilities to simplify application development. The function of a selector is to present an organized list of lots, sublots or machines. A plant operator can choose a member from this list for use in an InTrack transaction. Selectors have two components. 1. An InTouch selector wizard that can be placed in a window with a display of information in spread sheet format. 2. An automation object that can be “attached” to a selector wizard. The object can be used to configure the displayed and get the results of operator selections. For more information on Selector automation objects, see Chapter 4, “General Objects.” Additional examples of working with selectors can be found in the InTouch scripts associated with InTrack wizards.
Working with InTouch Dialogs
InTrack Dialog automation objects provide a set of Windows dialogs from which an operator can perform any database transaction not involving serial numbers. Using these dialogs on a fully or partly serialized lot will fail. Three steps are standard for these dialogs: 1. Create an automation object for the needed dialog. 2. Set its properties to reflect the lot, sublot, or machine on which the dialog is to work.
Note Setting the key property to indicate the lot, sublot, or machine is required.
3. Call the Launch method. InTrack OLE Automation Server 2-17
Dialog Class Launch Methods
Remember that the Launch method of the Dialog classes simply packages the property values and queues them with a request to run the associated dialog. This has several implications: The script that called the Launch method is not blocked. Within InTouch, you can be notified when the operator is finished with the dialog by setting the DoneFlagName property before calling Launch. Notification is not supported for applications developed outside InTouch. Because dialogs are queued and the Launch method is not blocked, it is possible to overrun the operator with too many dialogs. That is, the application easily can call the Launch method faster than the operator can respond. At some point the queue fills or encounters a memory allocation problem. Queuing requests to run dialogs eliminates the need to determine when to release or reuse dialog objects to Launch. Dialog automation objects have been used to implement the InTrack wizard extensions to InTouch. Refer to the scripts associated with these buttons for examples. Dialogs will fail when working with serialized lots. Dialogs will not unserialize a sublot. 3-1
CHAPTER 3
Application Objects
The Application object category consists of the Database object class. Manipulating the properties of the the Database class or calling methods on the Database class affects the entire application.
Contents Database Object Class, 2
3-2 Chapter 3
Database Object Class
The Database class has properties and methods that affect the entire application. For example, the BackDate, Comment, and UDALogFlag properties for all objects are accessed through the Database class. The BeginTrans, CommitTrans, and RollbackTrans methods of the Database class control transaction processing for the entire application. Before you can use automation objects, you must connect to the database.