AAWorkflowWithMES Dec2012
AAWorkflowWithMES Dec2012
12/11/12
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 Invensys Systems, Inc. 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 the 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 Invensys Systems, Inc. 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.
Contents
Chapter 1
Getting Started.......................................... 11
Prerequisites for Performing the Tests ......................................... Initial Setup ................................................................................... Configuring MES and ArchestrA Workflow Software Users .... Configuring MES - Workflow Connector ................................... Configuring the ArchestrA Workflow Software Repository Database .................................................................................. Logging in to ArchestrA Workflow Softwares Enterprise Console .................................................................................... 11 12 12 12 12 12
Contents
Chapter 2
Chapter 3
Contents5
Starting a Job ................................................................................. Creating the Workflow ................................................................ Creating an ArchestrA Workflow Software Form ..................... Binding the Form to the Workflow ............................................ Adding a Variable for the DateTime Input ................................ Linking the Workflow Variables to Form Controls ................... Publishing the Form ................................................................... Testing the Workflow .................................................................. Sample Test Data and Expected Results ............................... Adding Production to a Job ............................................................ Creating the Workflow ................................................................ Creating an ArchestrA Workflow Software Form ..................... Binding the Form to the Workflow ............................................ Adding a Variable for the DateTime Input ................................ Linking the Workflow Variables to Form Controls ................... Publishing the Form ................................................................... Testing the Workflow .................................................................. Sample Test Data and Expected Results ...............................
46 46 46 47 47 48 48 48 49 49 49 50 50 50 51 52 52 52
Chapter 4
Contents
Chapter 5
Chapter 6
Contents7
Adding Production to a Job ............................................................ Creating the Workflow ................................................................ Creating an ArchestrA Workflow Software Form ..................... Binding the Form to the Workflow ............................................ Adding a Variable for the DateTime Input ................................ Linking the Workflow Variables to Form Controls ................... Publishing the Form ................................................................... Testing the Workflow .................................................................. Sample Test Data and Expected Results ...............................
83 83 83 84 84 84 86 86 86
Chapter 7
Appendix A
Index..................................................... 107
Contents
Welcome
This document describes generic ArchestrA Workflow Software workflows that use the ArchestrA Workflow Softwares MES - Workflow Connector to test the communication between the workflows and Wonderware MES Middleware. You can use these tests to gain an understanding of how to set up and use the MES - Workflow Connector to transfer data between an ArchestrA Workflow Software workflow and the Wonderware MES database and activities via the MES Middleware. The document also includes an appendix that describes how to resolve issues that could occur when running the test workflows. This document applies to the following software versions:
Wonderware MES 2012 ArchestrA Workflow Softwares MES - Workflow Connector v1.6
You can view this document online or you can print it, in part or whole, by using the print feature in Adobe Acrobat Reader. This guide assumes you know how to use Microsoft Windows, including navigating menus, moving from application to application, and moving objects on the screen. If you need help with these tasks, see the Microsoft Online Help. In some areas of the MES - Workflow Connector application, you can also right-click to open a menu. The items listed on this menu change, depending on where you are in the product. All items listed on this menu are available as items on the main menus.
10
Documentation Conventions
This documentation uses the following conventions:
Convention Used for
Initial Capitals
Bold Monospace
Paths and file names. Menus, commands, dialog box names, and dialog box options. Code samples and display text.
Technical Support
Wonderware Technical Support offers a variety of support options to answer any questions on Wonderware products and their implementation. Before you contact Technical Support, refer to the relevant section(s) in this documentation for a possible solution to the problem. If you need to contact technical support for help, have the following information ready:
The type and version of the operating system you are using. Details of how to recreate the problem. The exact wording of the error messages you saw. Any relevant output listing from the Log Viewer or any other
diagnostic applications.
Details of what you did to try to solve the problem(s) and your
results.
11
The MES - Workflow Connector provides an integration layer to make connections between ArchestrA Workflow Software workflows and Wonderware MES Middleware. For a complete description of the MES - Workflow Connector, refer to the ArchestrA Workflow Software MES - Workflow Connector User Guide.
MES Client and the MES database are installed. ArchestrA Workflow Software and MES - Workflow Connector
package is installed.
The test procedures provided here assume that the user has some
knowledge about MES software and ArchestrA Workflow Software.
Initial Setup
Configuring MES and ArchestrA Workflow Software Users
Users must be configured in MES and ArchestrA Workflow Software. Refer to the MES Client Users Guide and the ArchestrA Workflow Software Administrator Guide for details.
Launch Internet Explorer. Click Enterprise Console on the Favorites tab. Click MES Users. Login using the user name and password configured in the MES database.
13
The following stateless MES API methods can be used from the MES - Workflow Connector to verify that the datatypes used in MES are compatible with the datatypes used in the MES - Workflow Connector:
Adding a Job
This test procedure calls the Prod.Job.Add stateless API method. The following datatypes used in the job table are tested using the workflow forms to supply the job information to add a new job in the database:
From Internet Explorer, log in to the Enterprise Console as an MES user. On the Enterprise Console menu, click Workflows. The Workflows window appears. On the Ribbon, click the Workflow icon. A New Workflow window appears.
Type the title (e.g., Job.Add), and then click Save and Continue. The Workflow Options window appears. The option on the workflow tasks defaults to Design the workflow now.
Adding a Job15
5 6 7
Click Finish. A workflow window appears. It includes a Start activity by default. In the Activities list, click Engine Activities. Click and drag the Update Variable activity onto the window to the right of the Start activity.
8 9
On the Activities menu, click MES. Click and drag the MESXMLCommand activity onto the window to the right of the UpdateVariable activity.
10 On the tool bar, click the Link icon and create a link from the Start
MESXMLCommand1 activity.
example, MESDB_MES).
16 In the Middleware Connection list, select the Middleware
18 Select the Generate Input XML Variable check box and type job_input in the box.
Adding a Job17
19 Select the Generate Output XML Variable check box and type job_output in the box.
20 Click the Generate Input/Output XML Variable(s) button. 21 At the bottom of the Activity Properties pane, click Save and close
On the Enterprise Console menu, point to Tools, and then click Manage Forms. The Manage Forms window appears.
In the Title box, type a title for the form (for example, Job.Add), and click Save & Continue. You are prompted to select a forms task.
Adding a Job19
Select the Design this form option and click Finish. The Forms Designer window appears with the Job.Add form listed.
Perform the following steps to add each of the controls and set their properties. For a list of the controls and their properties, see the table that follows these steps.
a
On the tool bar, click Add New. A prompt to select the control type appears.
b c
In the radio button list, select the control type and then click Next. The controls properties window appears. On the Basic tab, enter the controls properties as specified in the table.
Note: The control properties included in the Basic tab can vary based on the control type.
When you have finished entering the controls properties, click Save. The control is added to the form.
Control Type
TextInput TextInput TextInput DateInput Number Number Number Number Boolean
Tag Name
Work Order ID Operation ID Sequence Number Required Finish Time Initial Sched Entity ID Target Sched Entity ID Quantity Required Quantity At Start Rework
Mandatory
Y Y Y Y Y Y Y Y N
Other Parameters
Adding a Job21
Control Type
TextInput TextInput TextInput Number
Tag Name
Spare1 Last Edit Comment Item Estimated Production Rate
Mandatory
Y Y Y Y
Other Parameters
Decimal Places: 12
When you have finished adding all of the controls, click the Finish button at the bottom right of the Forms Designer window.
On the Enterprise Console menu, point to Tools, and then click Manage Forms. Select the Job.Add form. On the Ribbon, click Associate.
For the Select Task option, select Bind to an existing workflow. Two list boxes appear to the right of the option.
In the first list, click the workflow name (that is, for the Add a Job procedure, Job.Add). In the second list, click Latest.
6 7 8 9
Click Save and then click Close to close the window. On the Enterprise Console menu, click Workflows. Select the appropriate workflow (that is, Job.Add). On the Ribbon, click Edit. The Edit Form window appears.
10 Click Save & Continue. The Workflow Options window appears. 11 Select the Design the Workflow now check box and then click
Finish to close the window. The Job.Add workflow window appears.
Adding a Job23
With the Job.Add workflow opened, right-click the Start activity and click Activity Properties. The Activity Properties pane appears. On the Activity Properties pane, click the Variables box button. The Variables window appears. In the Workflow Variables box, enter reqfinishtimevar. In the Type list, click date.
2 3 4
5 6
Click Update to save the entries and close the window. In the Activity Properties pane, click the Initialize box button. The Update Variable window appears.
7 8
In the Condition column, hover the pointer over Select and click the list box that appears. A navigation tree appears. Expand the Variables branch and click the Variable.reqfinishtimevar entry.
Click the Tree icon under the Actions column. A list box appears in the Value column.
appears.
12 In the navigation tree, expand the Workflow Instance,
Adding a Job25
14 Complete the entry in the Editor pane so that the full entry is as
15 Click OK and then click Close to close the Variable Editor window.
The completed reqfinishtimevar variable definition appears in the Update Variable window.
16 Click the OK to close the Update Variable window. 17 Click the Save button at the bottom of the Activity Properties
In the workflow window, right-click the UpdateVariable1 activity and click Activity Properties. The Activity Properties pane appears. In the Activity Properties pane, click the Set Variable box button. The Update Variable window appears.
Perform the following steps to link each variable to its corresponding form control. For a list of the workflow variable-to-form control link mapping, see the table that follows these steps.
Adding a Job27
In the Condition column, hover the pointer over Select and click the list box that appears. A navigation tree appears.
Drill down to the variable to be linked and click it. The variable is added to the Condition column.
In the Value column, hover the pointer over Enter value and click the text box that appears.
In the text box, enter the name of the corresponding form control.
See to the table below for a list of the Job.Add form control names.
Variable
XmlVariablesrequest.job.wo_id XmlVariablesrequest.job.oper_id XmlVariablesrequest.job.seq_no XmlVariablesrequest.job.req_finish_time_local XmlVariablesrequest.job.init_sched_ent_id XmlVariablesrequest.job.target_sched_ent_id XmlVariablesrequest.job.qty_reqd XmlVariablesrequest.job.qty_at_start XmlVariablesrequest.job.rework XmlVariablesrequest.job.spare1 XmlVariablesrequest.job.last_edit_comment XmlVariablesrequest.job.item_id XmlVariablesrequest.job.est_prod_rate
* DateTimes are set to workflow variables created to ensure that they are sent as localtime to the MES database.
Adding a Job29
The list of all of the Job.Add links is shown in the following figure.
3 4 5
When all of the workflow variable-to-form control links have been entered, click the OK button to close the Update Variable window. Click the Save button at the bottom of the Activity Properties pane to save the links. Close the workflow window.
In the Workflows window, right-click the Job.Add workflow and click Publish.
Adding a Job31
On the Enterprise Console menu, point to Tools, and then click Manage Forms. The Manage Forms window appears. Right-click the Job.Add form and click Publish.
On the Enterprise Console menu, click Fill Form. A list of available forms appears.
Adding a Job33
4 5 6
When the form is completed, click Finish. A message appears indicating the status of the form submission. Click OK to close the message. Verify that the test data was correctly entered in the MES database.
Control Name
Data Input
1234567890123.12345 1234567890123.12345 No (False) Test Spare1 Test Last Edit Comment QA-Case24 1234567890123.12345
1234567890123.12 1234567890123.12 False Test Spare1 Test Last Edit Comment QA-Case24 1234567890123.12
Column Name
Data Input
Wo_ID Oper_Id Seq_No Req_Finish_Time_Local Init_Sched_Ent_Id Target_Sched_Ent_Id Qty_Reqd Qty_At_Start Rework Spare1 Last_Edit_Comment Item Est_Prod_Rate
String80 String80 Int32 TDatetime Int32 Int32 TFloat TFloat Logical String80 String254 String80 TFloat
Wo1 Oper2 12345 10/29/2012 18:19:20 15 15 987654321.987654 987654321.987654 Yes (True) Test Spare1 Test Last Edit Comment QA-Case24 987654321.987654
Wo1 Oper2 12345 10/29/2012 18:19:20 15 15 987654321.987654 987654321.987654 True Test Spare1 Test Last Edit Comment QA-Case24 987654321.987654
Adding an Attribute35
Adding an Attribute
This test procedure calls the Core.Attr.Add stateless API method. The following datatypes used in the ent table are tested using the workflow forms to supply the attribute information to add a new attribute in the database:
For the workflow title, use Attr.Add. In the Generate Command window: For the stateless API, use Core.Attr.Add For the Generate Input XML Variable, use attr_input For the Generate Output XML Variable, use attr_output
For the form title, use Attr.Add. Specify the following controls for the form:
Control Type
Boolean Number
Tag Name
Predefined Data Type
Mandatory
Other Parameters
TextInput
Attribute Description
attr_desc
Control Type
Number
Tag Name
Attribute Group
Mandatory
Y
Other Parameters
Decimal Places: 0 Min Value: 0 Max Value: 11
Y N Y Decimal Places: 12
XmlVariablesrequest.attr.predefined XmlVariablesrequest. attr.data_type XmlVariablesrequest. attr.attr_desc XmlVariablesrequest. attr.attr_grp XmlVariablesrequest. attr.filtr XmlVariablesresponse.attr_id XmlVariablesresponse.last_edit_at
Adding an Attribute37
39
The following stateless API methods can be used from the MES - Workflow Connector to verify that data is passed correctly from the workflow to the MES database when calling API methods with only a few number of parameters that affects only one table in the MES database, and when calling API methods with a larger number of parameters of different datatypes that affect multiple tables in the database:
Prod.ItemClass.Add, which adds an item class Prod.JobExec.CreateWoFromProcess, which creates a work order
from a process
For the workflow title, use ItemClass.Add. In the Generate Command window: For the stateless API, use Prod.ItemClass.Add For the Generate Input XML Variable, use itemclass_input For the Generate Output XML Variable, use itemclass_output
For the form title, use ItemClass.Add. Specify the following controls for the form:
Control Type
TextInput TextInput Boolean Boolean Boolean Boolean Boolean
Tag Name
New Item Class Item Class Description Produced Consumed Obsolete Purchased Sold
Mandatory
Y Y
Other Parameters
Label Position: Top Label Position: Top Label Position: Top Label Position: Top Label Position: Top
XMLVariables.item_class_input.request. item_class_id XMLVariables.item_class_input.request. item_class_desc XMLVariables.item_class_input.request. produced XMLVariables.item_class_input.request. consumed XMLVariables.item_class_input.request. obsolete XMLVariables.item_class_input.request. purchased XMLVariables.item_class_input.request. sold
For the workflow title, use JobExec.CWFP. In the Generate Command window: For the stateless API, use JobExec.CreateWoFromProcess For the Generate Input XML Variable, use cwfp_input For the Generate Output XML Variable, use cwfp_output
For the form title, use JobExec.CWFP. Specify the following controls for the form:
Control Type
TextInput or Lookup TextInput or Lookup TextInput or Lookup TextInput TextInput TextInput or Lookup TextInput or Lookup DateInput DateInput Number Number Number Button, click Next
Tag Name
Create Work Order for Product Use Production Process Product Specification Work Order ID Description User Name BOM Version Release Date/Time Due Date/Time Required Quantity Start Quantity Priority OK
Mandatory
Y Y N Y N N N Y Y Y Y N
Other Parameters
Cancel
cancel
The variable Release DateTime Local of type date and with the
expression: Convert.ToDateTime (XmlVariables.SFFormData.SKRootDefinition.release_time, System.Globalization.CultureInfo.InvariantCulture) .ToLocalTime()
The variable Due DateTime Local of type date and with the
expression: Convert.ToDateTime (XmlVariables.SFFormData.SKRootDefinition.req_finish_time, System.Globalization.CultureInfo.InvariantCulture) .ToLocalTime()
XMLVariables.cwfp_input.request. item_id XMLVariables.cwfp_input.request. process_id XMLVariables.cwfp_input.request. spec_ver_id XMLVariables.cwfp_input.request. wo_id XMLVariables.cwfp_input.request. wo_desc
* DateTimes are set to workflow variables created to ensure that they are sent as localtime to the MES database.
Variable
XMLVariables.cwfp_input.request. user_id XMLVariables.cwfp_input.request. bom_ver_id XMLVariables.cwfp_input.request. release_time_local XMLVariables.cwfp_input.request. req_finish_time_local XMLVariables.cwfp_input.request. req_qty XMLVariables.cwfp_input.request. start_qty XMLVariables.cwfp_input.request. wo_priority
SKFormData.SKRootDefinition.user_id SKFormData.SKRootDefinition.bom_ver_id Variables.Release DateTime Local* Variables.Due DateTime Local* SKFormData.SKRootDefinition.req_qty SKFormData.SKRootDefinition.start_qty SKFormData.SKRootDefinition.priority
* DateTimes are set to workflow variables created to ensure that they are sent as localtime to the MES database.
Column Name
Data Input
User Id BOM Version Id Release Time Local Required Finish Time Local Required Quantity Start Quantity Priority
Starting a Job
This test procedure calls the Prod.JobExec.StartJob stateless API method to verify that a large number of parameters of different datatypes that affect multiple database tables can be passed correctly from the MES - Workflow Connector and be recorded in the MES database. The process for creating the Start a Job test procedure is the same as that described in "Adding a Job" on page 13, with exceptions as noted in the following topics.
For the workflow title, use JobExec.StartJob. In the Generate Command window: For the stateless API, use Prod.JobExec.StartJob For the Generate Input XML Variable, use startjob_input For the Generate Output XML Variable, use startjob_output
Starting a Job47
Tag Name
Entity ID User Name Work Order ID Operation ID Sequence Number Job Position Status Notes Check Privileges Check Certifications Event Time
Mandatory
Y Y Y Y Y N N Y Y N
Other Parameters
Minimum: 0
The variable Event DateTime Local of type date and with the
expression: Convert.ToDateTime (XmlVariables.SFFormData.SKRootDefinition.event_time, System.Globalization.CultureInfo.InvariantCulture) .ToLocalTime()
XMLVariables.cwfp_input.request. ent_id XMLVariables.cwfp_input.request. user_id XMLVariables.cwfp_input.request. wo_id XMLVariables.cwfp_input.request. oper_id XMLVariables.cwfp_input.request. seq_no XMLVariables.cwfp_input.request. job_pos XMLVariables.cwfp_input.request. status_notes XMLVariables.cwfp_input.request. check_privs XMLVariables.cwfp_input.request. check_certs XMLVariables.cwfp_input.request. event_time_local
SKFormData.SKRootDefinition.ent_id SKFormData.SKRootDefinition.user_id SKFormData.SKRootDefinition.wo_id SKFormData.SKRootDefinition.oper_id SKFormData.SKRootDefinition.seq_no SKFormData.SKRootDefinition.job_pos SKFormData.SKRootDefinition.status_notes SKFormData.SKRootDefinition.check_privs SKFormData.SKRootDefinition.check_certs Variables.Event DateTIme Local*
*DateTime is set to workflow variable created to ensure that it is sent as localtime to the MES database.
Ent Id User Id Work Order Id Operation Id Sequence No Job Position Status Notes Check Privileges Check Certifications Event Time
Int32 String 80 String 80 String80 Int32 Int32 String256 Logical Logical datetime
4 ww TestWO OP-001 0 0 Testing start job Yes (True) No (False) 11/08/2012 5:00:00
For the workflow title, use JobExec.AddProd. In the Generate Command window: For the stateless API, use Prod.JobExec.AddProd For the Generate Input XML Variable, use addprod_input For the Generate Output XML Variable, use addprod_output
For the form title, use JobExec.AddProd. Specify the following controls for the form:
Control Type
Number DateInput TextInput or Lookup Number or Lookup Number Number TextInput TextInput Number or Lookup TextInput or Lookup Number TextInput TextInput Number
Tag Name
Session ID Event Time User Name Entity ID Qty Produced Reason Code Lot No Sublot No Storage Entity ID Produced Item BOM Position Seqment Requirement ID Seqment Response ID Job Position
Mandatory
Y N Y Y Y N N N N N N N N N
Other Parameters
Minimum: 0
Minimum: 0
This test procedure includes an Event Time input in the workflow form. To address the DateTime issue for this input, perform the procedure in "Adding a Variable for the DateTime Input" on page 23 to add the following variable:
The variable Event DateTime Local of type date and with the
expression: Convert.ToDateTime (XmlVariables.SFFormData.SKRootDefinition.event_time, System.Globalization.CultureInfo.InvariantCulture) .ToLocalTime()
XMLVariables.addprod_input.request. session_id XMLVariables.add_prod_input.request. event_time_local XMLVariables.addprod_input.request. user_id XMLVariables.addprod_input.request. ent_id XMLVariables.addprod_input.request. qty_prod XMLVariables.addprod_input.request. reas_cd XMLVariables.addprod_input.request. lot_no XMLVariables.addprod_input.request. sublot_no XMLVariables.addprod_input.request. storage_ent_id XMLVariables.addprod_input.request. item_id
SKFormData.SKRootDefinition.session_id Variables.Event DateTime Local* SKFormData.SKRootDefinition.user_id SKFormData.SKRootDefinition.ent_id SKFormData.SKRootDefinition.qty_prod SKFormData.SKRootDefinition.reas_cd SKFormData.SKRootDefinition.lot_no SKFormData.SKRootDefinition.sublot_no SKFormData.SKRootDefinition.storage_ent_id SKFormData.SKRootDefinition.item_id
*DateTime is set to workflow variable created to insure that it is sent as localtime to the MES database.
Variable
*DateTime is set to workflow variable created to insure that it is sent as localtime to the MES database.
Session Id Event Time User Id Ent Id Qty Prod Reason Code Lot No Sublot No Storage Ent Id Produced Item
Int32 datetime String 80 Int32 Double Int32 String80 String80 Int32 String80
Column Name
Data Input
55
The following stateless API methods can be used from the MES - Workflow Connector to verify that complex event types used in MES are compatible with the event types used in the MES - Workflow Connector
For the workflow title, use JobExec.SetCurLotData. In the Generate Command window: For the stateless API, use JobExec.SetCurLotData For the Generate Input XML Variable, use setcurlotdata_input For the Generate Output XML Variable, use
setcurlotdata_output
For the form title, use JobExec.SetCurLotData. Specify the following controls for the form:
Control Type
Number Number Number TextInput TextInput TextInput Number Number Boolean Boolean
Tag Name
Entity ID Job Pos BOM Pos Default Current Item ID Default Current Lot Number Default Current SubLot Number Default Reason Code Current Storage Entity IDs Backflush Update Inventory
Mandatory
Y Y Y Y Y Y Y Y
Other Parameters
Column Name
Data Input
Starting a Job
This test procedure calls the Prod.JobExec.StartJob stateless API method to verify that the MES - Workflow Connector calls the correct overload method to send data to the MES database. The process for creating the Start a Job test procedure is the same as that described in "Adding a Job" on page 13, with exceptions as noted in the following topics.
For the workflow title, use JobExec.StartJob. In the Generate Command window: For the stateless API, use Prod.JobExec.StartJob For the Generate Input XML Variable, use startjob_input For the Generate Output XML Variable, use startjob_output
Starting a Job59
Tag Name
Entity ID User Name Work Order ID Operation ID Sequence Number Job Position Status Notes Check Privileges Check Certifications Event Time
Mandatory
Y Y Y Y Y N N Y Y N
Other Parameters
Minimum: 0
The variable Event DateTime Local of type date and with the
expression: Convert.ToDateTime (XmlVariables.SFFormData.SKRootDefinition.event_time, System.Globalization.CultureInfo.InvariantCulture) .ToLocalTime()
XMLVariables.cwfp_input.requrest. ent_id XMLVariables.cwfp_input.request. user_id XMLVariables.cwfp_input.request. wo_id XMLVariables.cwfp_input.request. oper_id XMLVariables.cwfp_input.request. seq_no XMLVariables.cwfp_input.request. job_pos XMLVariables.cwfp_input.request. status_notes XMLVariables.cwfp_input.request. check_privs XMLVariables.cwfp_input.request. check_certs XMLVariables.cwfp_input.request. event_time_local
SKFormData.SKRootDefinition.ent_id SKFormData.SKRootDefinition.user_id SKFormData.SKRootDefinition.wo_id SKFormData.SKRootDefinition.oper_id SKFormData.SKRootDefinition.seq_no SKFormData.SKRootDefinition.job_pos SKFormData.SKRootDefinition.status_notes SKFormData.SKRootDefinition.check_privs SKFormData.SKRootDefinition.check_certs Variables.Event DateTIme Local*
*DateTime is set to workflow variable created to ensure that it is sent as localtime to the MES database.
Starting a Job61
Ent Id User Id Work Order Id Operation Id Sequence No Job Position Status Notes Check Privileges Check Certifications Event Time
Int32 String 80 String 80 String80 Int32 Int32 String256 Logical Logical datetime
4 ww TestWO OP-001 0 0 Testing start job Yes (True) No (False) 11/08/2012 5:00:00
Column Name
Data Input
Ent Id User Id Work Order Id Operation Id Sequence No Job Position Status Notes Check Privileges Check Certifications Event Time
Int32 String 80 String 80 String80 Int32 Int32 String256 Logical Logical datetime
4 ww TestWO OP-001 0 0 Testing start job True False Current date and time
63
The following stateless API methods can be used from the MES - Workflow Connector to verify that data is sent correctly when the workflow is on a machine with a different regional setting then the machine that the MES Middleware and database are on.
The host machine should have MES Middleware and the MES
database installed. Set the regional settings to Pacific Time.
For the workflow title, use JobExec.CWFP. In the Generate Command window: For the stateless API, use JobExec.CreateWoFromProcess For the Generate Input XML Variable, use cwfp_input For the Generate Output XML Variable, use cwfp_output
For the form title, use JobExec.CWFP. Specify the following controls for the form:
Control Type
TextInput or Lookup TextInput or Lookup TextInput or Lookup TextInput TextInput TextInput or Lookup TextInput or Lookup DateInput
Tag Name
Create Work Order for Product Use Production Process Product Specification Work Order ID Description User Name BOM Version Release Date/Time
Mandatory
Y N N Y N N N Y
Other Parameters
Control Type
DateInput Number Number Number Button, click Next
Tag Name
Due Date/Time Required Quantity Start Quantity Priority OK
Mandatory
Y Y Y N
Other Parameters
Cancel
cancel
The variable Release DateTime Local of type date and with the
expression: Convert.ToDateTime (XmlVariables.SFFormData.SKRootDefinition.release_time, System.Globalization.CultureInfo.InvariantCulture) .ToLocalTime()
The variable Due DateTime Local of type date and with the
expression: Convert.ToDateTime (XmlVariables.SFFormData.SKRootDefinition.req_finish_time, System.Globalization.CultureInfo.InvariantCulture) .ToLocalTime()
XMLVariables.cwfp_input.request. item_id XMLVariables.cwfp_input.request. process_id XMLVariables.cwfp_input.request. spec_ver_id XMLVariables.cwfp_input.request. wo_id XMLVariables.cwfp_input.request. wo_desc XMLVariables.cwfp_input.request. user_id XMLVariables.cwfp_input.request. bom_ver_id XMLVariables.cwfp_input.request. release_time_local XMLVariables.cwfp_input.request. req_finish_time_local XMLVariables.cwfp_input.request. req_qty XMLVariables.cwfp_input.request. start_qty XMLVariables.cwfp_input.request. wo_priority
SKFormData.SKRootDefinition.item_id SKFormData.SKRootDefinition.process_id SKFormData.SKRootDefinition.spec_ver_id SKFormData.SKRootDefinition.wo_id SKFormData.SKRootDefinition.wo_desc SKFormData.SKRootDefinition.user_id SKFormData.SKRootDefinition.bom_ver_id Variables.Release DateTime Local* Variables.Due DateTime Local* SKFormData.SKRootDefinition.req_qty SKFormData.SKRootDefinition.start_qty SKFormData.SKRootDefinition.priority
* DateTimes are set to workflow variables created to ensure that they are sent as localtime to the MES database.
Item Id Process Id Spec Version Id Work Order Id Work Order Description User Id BOM Version Id Release Time Local Required Finish Time Local Required Quantity Start Quantity Priority
String80 String80 String 80 String 80 String80 String 80 String80 DateTime DateTIme Int32 Int32 Int32
Item-A Process_001 NULL TestWO Work_Order_TestWO Ww V.A.1 11/01/2012 04:00:00 11/16/2012 14:00:00 40 50 2
Item-A Process_001 NULL TestWO Work_Order_TestWO Ww V.A.1 11/01/2012 04:00:00 11/16/2012 14:00:00 40 50 2
Starting a Job
This test procedure calls the Prod.JobExec.StartJob stateless API method to verify that a date entered on an ArchestrA form on a machine with one regional setting is correctly recorded in an MES database on a machine with a different regional setting for the *, *_local, and *_utc fields. The process for creating the Start a Job test procedure is the same as that described in "Adding a Job" on page 13, with exceptions as noted in the following topics.
For the workflow title, use JobExec.StartJob. In the Generate Command window: For the stateless API, use Prod.JobExec.StartJob For the Generate Input XML Variable, use startjob_input For the Generate Output XML Variable, use startjob_output
For the form title, use JobExec.StartJob. Specify the following controls for the form:
Control Type
Number or Lookup TextInput or Lookup TextInput TextInput Number Number TextInput Boolean
Tag Name
Entity ID User Name Work Order ID Operation ID Sequence Number Job Position Status Notes Check Privileges
Mandatory
Y Y Y Y Y N N Y
Other Parameters
Minimum: 0
Starting a Job69
Control Type
Boolean DateInput
Tag Name
Check Certifications Event Time
Mandatory
Y N
Other Parameters
The variable Event DateTime Local of type date and with the
expression: Convert.ToDateTime (XmlVariables.SFFormData.SKRootDefinition.event_time, System.Globalization.CultureInfo.InvariantCulture) .ToLocalTime()
SKFormData.SKRootDefinition.ent_id SKFormData.SKRootDefinition.user_id
*DateTime is set to workflow variable created to ensure that it is sent as localtime to the MES database.
Variable
XMLVariables.cwfp_input.request. wo_id XMLVariables.cwfp_input.request. oper_id XMLVariables.cwfp_input.request. seq_no XMLVariables.cwfp_input.request. job_pos XMLVariables.cwfp_input.request. status_notes XMLVariables.cwfp_input.request. check_privs XMLVariables.cwfp_input.request. check_certs XMLVariables.cwfp_input.request. event_time_local
SKFormData.SKRootDefinition.wo_id SKFormData.SKRootDefinition.oper_id SKFormData.SKRootDefinition.seq_no SKFormData.SKRootDefinition.job_pos SKFormData.SKRootDefinition.status_notes SKFormData.SKRootDefinition.check_privs SKFormData.SKRootDefinition.check_certs Variables.Event DateTime Local*
*DateTime is set to workflow variable created to ensure that it is sent as localtime to the MES database.
4 ww TestWO
4 ww TestWO
Starting a Job71
Column Name
Data Input
Operation Id Sequence No Job Position Status Notes Check Privileges Check Certifications Event Time
OP-001 0 0 Testing start job True False Actual_start_time_local: 11/08/2012 5:00:00 Actual_start_time_utc: 11/08/2012 13:00:00 Actual_start_time: 11/08/2012 2:00:00
73
The following stateless API methods can be used from the MES - Workflow Connector to verify that the localization of datatypes is being passed correctly from the Workflow to the MES database:
Prod.ItemClass.Add, which adds an item class Prod.JobExec.AddProd, which adds production to a job
Note: Other stateless API methods can also be used to verify this functionality.
For the workflow title, use ItemClass.Add. In the Generate Command window: For the stateless API, use Prod.ItemClass.Add For the Generate Input XML Variable, use itemclass_input For the Generate Output XML Variable, use itemclass_output
For the form title, use ItemClass.Add. Specify the following controls for the form:
Control Type
TextInput TextInput Boolean Boolean Boolean Boolean Boolean
Tag Name
New Item Class Item Class Description Produced Consumed Obsolete Purchased Sold
Mandatory
Y Y
Other Parameters
Label Position: Top Label Position: Top Label Position: Top Label Position: Top Label Position: Top
XMLVariables.item_class_input.request. item_class_id XMLVariables.item_class_input.request. item_class_desc XMLVariables.item_class_input.request. produced XMLVariables.item_class_input.request. consumed XMLVariables.item_class_input.request. obsolete XMLVariables.item_class_input.request. purchased XMLVariables.item_class_input.request. sold
Chinese
Column Name Database Data Type Data Input Data Expected in MES Database
Item Class Id Item Class Desc Produced Consumed Obsolete Purchased Sold
Spanish
Column Name Database Data Type Data Input Data Expected in MES Database
Item Class Id Item Class Desc Produced Consumed Obsolete Purchased Sold
Clase de prueba maana maana Yes (True) Yes (True) No (False) No (False) No False)
French
Column Name Database Data Type Data Input Data Expected in MES Database
Item Class Id Item Class Desc Produced Consumed Obsolete Purchased Sold
Catgorie de l'lment Catgorie de l'lment Yes (True) Yes (True) No (False) No (False) No (False)
Japanese
Column Name Database Data Type Data Input Data Expected in MES Database
Item Class Id Item Class Desc Produced Consumed Obsolete Purchased Sold
Russian
Column Name Database Data Type Data Input Data Expected in MES Database
Item Class Id Item Class Desc Produced Consumed Obsolete Purchased Sold
For the workflow title, use Job.Add. In the Generate Command window: For the stateless API, use Prod.Job.Add For the Generate Input XML Variable, use jobadd_input For the Generate Output XML Variable, use jobadd_output
For the form title, use Job.Add. Specify the following controls for the form:
Control Type
TextInput or Lookup TextInput TextInput DateInput Number
Tag Name
Work Order ID Operation ID Sequence No Required Finish Date/Time Rework
Mandatory
Y Y Y Y Y
Other Parameters
Minimum: 0 Maximum: 1
Number Number
int_sched_ent_id target_sched_ent
Y Y
Minimum: 0 Minimum: 0
Control Type
Number Number TextInput TextInput TextInput Number
Tag Name
Quantity Required Quantity At Start Spare1 Last Edit Comment Item ID Estimated Production Rate
Mandatory
Y Y Y Y Y Y
Other Parameters
Minimum: 0 Minimum: 0
XMLVariables.jobadd_input.request. wo_id XMLVariables. jobadd _input.request. oper_id XMLVariables. jobadd _input.request. seq_no XMLVariables.jobadd_input.request. req_finish_time_local XMLVariables.jobadd_input.request. rework XMLVariables.jobadd_input.request. init_sched_ent_id XMLVariables.jobadd_input.request. target_sched_ent_id XMLVariables.jobadd_input.request. req_qty XMLVariables.jobadd_input.request. start_qty XMLVariables.jobadd_input.request. spare1 XMLVariables.jobadd_input.request. last_edit_comment XMLVariables.jobadd_input.request. item_id XMLVariables.jobadd_input.request. est_prod_rate
SKFormData.SKRootDefinition.wo_id SKFormData.SKRootDefinition.oper_id SKFormData.SKRootDefinition.seq_no Variables.RequiredFinish DateTime Local* SKFormData.SKRootDefinition.rework SKFormData.SKRootDefinition.init_sched_ent_ id SKFormData.SKRootDefinition.target_sched_ ent_id SKFormData.SKRootDefinition.req_qty SKFormData.SKRootDefinition.start_qty SKFormData.SKRootDefinition.spare1 SKFormData.SKRootDefinition.last_edit_ comment SKFormData.SKRootDefinition.item_id SKFormData.SKRootDefinition.est_prod_rate
*DateTimes are set to workflow variables created to ensure that they are sent as localtime to the MES database.
Chinese
Column Name Database Data Type Data Input Data Expected in MES Database
Wo_ID Oper_Id Seq_No Req_Finish_Time_Local Init_Sched_Ent_Id Target_Sched_Ent_Id Qty_Reqd Qty_At_Start Rework Spare1 Last_Edit_Comment Item Est_Prod_Rate
String80 String80 Int32 TDatetime Int32 Int32 TFloat TFloat Logical String80 String254 String80 TFloat
Russian
Column Name Database Data Type Data Input Data Expected in MES Database
Column Name
Data Input
Japanese
Column Name Database Data Type Data Input Data Expected in MES Database
Wo_ID Oper_Id Seq_No Req_Finish_Time_Local Init_Sched_Ent_Id Target_Sched_Ent_Id Qty_Reqd Qty_At_Start Rework Spare1 Last_Edit_Comment Item Est_Prod_Rate
String80 String80 Int32 TDatetime Int32 Int32 TFloat TFloat Logical String80 String254 String80 TFloat
For the workflow title, use JobExec.AddProd. In the Generate Command window: For the stateless API, use Prod.JobExec.AddProd For the Generate Input XML Variable, use addprod_input For the Generate Output XML Variable, use addprod_output
For the form title, use JobExec.AddProd. Specify the following controls for the form:
Control Type
Number DateInput
Tag Name
Session ID Event Time
Mandatory
Y N
Other Parameters
Control Type
TextInput Number or Lookup TextInput or Lookup Number TextInput TextInput Number
Tag Name
Sublot No Storage Entity ID Produced Item BOM Position Segment Requirement ID Seqment Response ID Job Position
Mandatory
N N N N N N N
Other Parameters
Minimum: 0
Minimum: 0
The variable Event DateTime Local of type date and with the
expression: Convert.ToDateTime (XmlVariables.SFFormData.SKRootDefinition.event_time, System.Globalization.CultureInfo.InvariantCulture) .ToLocalTime()
Variables
XMLVariables.addprod_input.request. session_id XMLVariables.add_prod_input.request. event_time_local XMLVariables.addprod_input.request. user_id XMLVariables.addprod_input.request. ent_id XMLVariables.addprod_input.request. qty_prod XMLVariables.addprod_input.request. reas_cd XMLVariables.addprod_input.request. lot_no XMLVariables.addprod_input.request. sublot_no XMLVariables.addprod_input.request. storage_ent_id XMLVariables.addprod_input.request. item_id XMLVariables.addprod_input.request. bom_pos XMLVariables.addprod_input.request. seg_req_id XMLVariables.addprod_input.request. seg_res_id XMLVariables.addprod_input.request. job_pos
SKFormData.SKRootDefinition.session_id Variables.Event DateTime Local* SKFormData.SKRootDefinition.user_id SKFormData.SKRootDefinition.ent_id SKFormData.SKRootDefinition.qty_prod SKFormData.SKRootDefinition.reas_cd SKFormData.SKRootDefinition.lot_no SKFormData.SKRootDefinition.sublot_no SKFormData.SKRootDefinition.storage_ent_id SKFormData.SKRootDefinition.item_id SKFormData.SKRootDefinition.bom_pos SKFormData.SKRootDefinition.seg_req_id SKFormData.SKRootDefinition.seg_res_id SKFormData.SKRootDefinition.job_pos
*DateTime is set to a workflow variable created to ensure that it is sent as localtime to the MES database.
DateTime Format 1
Session Id Event Time User Id Ent Id Qty Prod Reason Code Lot No Sublot No Storage Ent Id Produced Item Bom Position Segment Requirement ID Segment Response ID Job Position
Int32 datetime String 80 Int32 Double Int32 String80 String80 Int32 String80 Int32 Null Null Int32
DateTime Format 2
Session Id Event Time User Id Ent Id Qty Prod Reason Code Lot No Sublot No Storage Ent Id Produced Item Bom Position Segment Requirement ID Segment Response ID Job Position
Int32 datetime String 80 Int32 Double Int32 String80 String80 Int32 String80 Int32 Null Null Int32
DateTime Format 3
Session Id Event Time User Id Ent Id Qty Prod Reason Code Lot No
Column Name
Data Input
Sublot No Storage Ent Id Produced Item Bom Position Segment Requirement ID Segment Response ID Job Position
DateTime Format 4
Session Id Event Time User Id Ent Id Qty Prod Reason Code Lot No Sublot No Storage Ent Id Produced Item Bom Position Segment Requirement ID Segment Response ID Job Position
Int32 datetime String 80 Int32 Double Int32 String80 String80 Int32 String80 Int32 Null Null Int32
89
The following stateless API methods can be used from the MES - Workflow Connector to verify that the data of an MES activity is being correctly passed to an ArchestrA Workflow Software workflow:
Prod.ItemClass.Add, which adds an item class Prod.JobExec.CreateWoFromProcess, which creates a work order
from a process
Note: Other stateless API methods can also be used to verify this functionality.
Open MES Workflow Event Creator. In the box at the upper left, enter Prod.ItemClass. A list of stateless APIs that match the entry appears.
3 4
In the list, click Prod.ItemClass.Add. Click the Process button. The parameter grid appears.
In the parameter grid lists, select item_class_id, then item_class_desc, and then produced.
Click the Provision events in all connected Workflow Repositories button. A message appears that confirms the successful provisioning of the event. Click OK to close the message. Click the Provision Post Hook button. A message appears that confirms the successful provisioning of the event, and indicating that the MES Middleware services need to be restarted. Click OK to close the message. MES Middleware Host and MES Service.
7 8
10 Close the MES Workflow Event Creator window and restart the
From Internet Explorer, log in to the ArchestrA Workflow Softwares Enterprise Console as an MES user. On the Enterprise Console menu, click Workflows. The Workflows window appears.
On the Ribbon, click the MES workflow icon. A New MES Workflow window appears.
Field/Option
Title Description Unique Environment Name MES Middleware Machine Name Event Name Pre/Post Hook Object Name
5
The workflow title (e.g., ItemClass.Add). A description of the workflow. Select the environment name (e.g., MESDB_MES). Select the MES Middleware connection (e.g., mes40). Select the event that was created, Prod.ItemClass.Add Select Post Hook. Type item_class.
Click Next and then click Save & Continue. The Workflow Options window appears. The option on the workflow tasks defaults to Design the workflow now.
6 7 8
Click Finish. A workflow window appears. It includes a Start activity by default. In the Activities list, click Human Activities. Click and drag the Information activity onto the window to the right of the Start activity.
On the tool bar, click the Link icon and create a link from the Start activity to the Information1 activity.
12 Click the User option. The User Lookup window appears. 13 In the list at the upper right, select MES Users. 14 In the search box, type an MES user and select
user_name.user_id in the list.
16 Select the user and click the right arrow button to add the user to
18 Click Update to save the assigned actor and close the Assign
Actor(s) window.
pane, click the Subject box button. The Subject window appears.
20 In the main box, type New Item Class Created and press
ENTER.
21 In the first field list, select XML Variables. 22 In the second field list, select MESEventData.
appears.
24 Click the item_class_id variable. The tree closes and the variable
26 Use the same procedure to add the following variables to the main
box:
item_class_desc produced
produced variables from the MESSPHookXmlData tree, just as you did for the three MESEventData variables.
29 Click the Update button. The Subject window closes. 30 At the bottom of the Activity Properties pane, click Save and close
and click Publish. A message appears indicating the status of the publish operation.
32 Click Close to close the message.
Log in to MES Client. Click Production Definition. Click Item Classes. Right-click the Item Class grid and click New. An new item class row appears in the grid. Type the item class ID and description. Select the Produced check box. Save the new item class.
From Internet Explorer, log in to the ArchestrA Workflow Softwares Enterprise Console as an MES user. On the Enterprise Console menu, click Dashboard. The Dashboard window appears.
Open the inbox information for the MES workflow you created with a Subject of New Item Class Created. The data in the body of the email should show the item_class_id, item_class_desc, and produced value for the values coming into the event, and the item_class_id, item_class_desc, and produced value for the values being sent into the Post Hook. They should agree with the values entered in MES Client when creating the item class.
Column Name
Data Input
event.
Complete the fields and options in the New MES Workflow window
as follows:
Field/Option Description
Title Description Unique Environment Name MES Middleware Machine Name Event Name Pre/Post Hook Object Name
WO Created.
The workflow title (e.g., JobExec.CWFP). A description of the workflow. Select the environment name (e.g., MESDB_MES). Select the MES Middleware connection (e.g., mes40). Select the event that was created, Prod. JobExec.CreateWoFromProcess. Select Post Hook. Type job_exec.
In the Subject window, in the first line of the main box, type New In the Subject window main box, append the following XML
variables:
MESEventData: request.wo_id MESEventData: request.release_time MESEventData: request.req_finish_time MESSPHookData: request.wo_id MESSPHookeData: request.release_time MESSHookData: request.req_finish_time
Log in to MES Client. Click Production Definition. Click Process Extension. Click Apply Filters. Right-click one of the processes and click Create Work Order.
100 Chapter 7 Verifying Data Passing from Wonderware MES to an ArchestrA Workflow
6 7
Enter the wo_id, the required quantity, the start quantity, the release date/time, and the due date/time. Click OK.
From Internet Explorer, log in to the ArchestrA Workflow Softwares Enterprise Console as an MES user. On the Enterprise Console menu, click Dashboard. The Dashboard window appears. Open the inbox information for the MES workflow you created with a Subject of New WO Created. The data in the body of the email should show the wo_id, release_time, and req_finish_time value for the values coming into the event, and wo_id, release_time, and req_finish_time value for the values being sent into the Post Hook. They should agree with the values entered in MES Client when creating the work order from the process.
Column Name
Data Input
101
When executing the test procedures, certain issues can occur. These issues and their resolutions are addressed here.
DateTime
By default, ArchestrA Workflow Software converts any time inputs in a workflow form to UTC time. However, the MES stateless API methods assume that times are in local time. This situation can cause incorrect times to be stored in the MES database. For example, if 6a PDT is entered in the workflow form, it is converted to UTC time and passed as 1p to the MES stateless API method. The time is then incorrectly recorded in the MES database as 1p local time and 8p UTC time. To avoid this issue, you must:
Convert the input value from the workflow form for each time
DateTime variable from UTC time to local time.
First, include form controls for the DateTime variables in the Workflow form, as shown in the following example. The entries for these fields will be sent as parameters to the MES stateless API.
With the workflow opened, right-click the Start activity and click Activity Properties. The Activity Properties pane appears. On the Activity Properties pane, click the Variables box button. The Variables window appears. In the Workflow Variables box, enter a name for the DateTime variable.
DateTime103
5 6
Click Update to save the entries and close the window. In the Activity Properties pane, click the Initialize box button. The Update Variable window appears.
7 8
In the Condition column, hover the pointer over Select and click the list box that appears. A navigation tree appears. Expand the Variables branch.
Click the entry for the DateTime variable you just created. A row for the DateTime variable is added to the table in the Update Variable window.
10 Click the Tree icon under the Actions column. A list box appears in
appears.
13 In the navigation tree, expand the Workflow Instance,
16 Click OK and then click Close to close the Variable Editor window.
The completed DateTime variable definition appears in the Update Variable window.
17 Click the OK to close the Update Variable window. 18 Click the Save button at the bottom of the Activity Properties
Regional Settings105
Finally, make sure that you link the DateTime variables to their workflow form controls. The following sample Update Variable window shows two DateTime variables mapped to their workflow form controls.
Regional Settings
When the MES Client and Middleware are in different time zones, the DateTimes do not work correctly between the two zones unless the workaround described in "DateTime" on page 101 is implemented on all the DateTime variables in the workflow forms.
107
Index
A
adding a job 13, 77 adding an attribute 35 adding an item class 40, 73, 90 adding production to a job 49, 83 ArchestrA Workflow form, binding to workflow 21 form, creating 18 form, publishing 31 linking variables to form controls 26 logging in 12 users, configuring 12 workflow, publishing 30 workflow, testing 32 ArchestrA Workflow Repository database, configuring 12 asynchronous methods 105 attribute, adding 35
DateTimes testing with different regional settings 63 UTC/local time issue 101 document conventions 10
E
event types, testing 55
F
form controls, linking to workflow variables 26 forms binding to workflow 21 creating 18 publishing 31
I
item class, adding 40, 73, 90
C
class arrays 106 creating a work order 42, 64, 98
J
job adding 13, 77 adding production to 49, 83 setting lot information for 55 starting 46, 58, 68
D
datatypes, testing localization of 73
108Index
L
local time/UTC issue with DateTime inputs 101 localization of datatypes, testing 73 lot information, setting for a job 55
M
MES - Workflow Connector, configuring 12 MES quality modules 105 MES users, configuring 12
testing complex event types 55 data from MES to Workflow 89 data of various types and amounts 39 datatype compatibility 13 DateTimes with different regional settings 63 localization of datatypes 73
U
UTC/local time issue with DateTime inputs 101
P
prerequisites for performing tests 11
V
variables adding to Start activity 23 linking to form controls 26
R
regional settings 105 testing 63 reporting status failures 106
W
work order, creating 42, 64, 98 workarounds to test procedure issues 101 workflows creating 14 linking variables to form controls 26 publishing 30 testing 32
S
setup, initial 12 Start activity, adding a variable to 23 starting a job 46, 58, 68
T
technical support 10