Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Manufacturing Execution System 2023 R2

Content of the Code in the TestHooksClass​.cs

  • Last UpdatedOct 23, 2024
  • 1 minute read

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace TestHooksNamespace

{

public class TestHooksClass

{

public TestHooksClass()

{ }

public void TestHooksMethod(string xmlSource)

{

// Compose a string that consists of three lines.

string lines = string.Format("DateTime: {0}, XMLSource: {1}",

DateTime.Now.ToString(), xmlSource);

// Write the string to a file.

using (System.IO.StreamWriter file = new

System.IO.StreamWriter("c:\\Temp\\UomLog.txt", true))

{

file.WriteLine(lines);

}

}

}

}

The value for the xmlSource parameter contains the XML message for the normal middleware event. The structure of the XML message used for this case is listed below:

<?xml version='1.0'?>

<request>

<object>uom</object>

<msgtype>exec</msgtype>

<cmd>add</cmd>

<uom>

<session_id>119</session_id>

<description>Unit_001</description>

<abbreviation>ssss</abbreviation>

<last_edit_comment></last_edit_comment>

</uom>

<validate>1</validate>

</request>

The text output is written to the text file UomLog.txt in the format below:

DateTime: 1/2/2013 11:34:44 AM, XMLSource:
<?xmlversion='1.0'?><request><object>uom</object>
<msgtype>exec</msgtype><cmd>add</cmd><uom><session_id>119
</session_id><description>Unit_001</description>
<abbreviation>ssss</abbreviation><last_edit_comment>
</last_edit_comment></uom><validate>1</validate></request>

The concept described above is also applicable to configuring the post-hook of type assembly.

TitleResults for “How to create a CRG?”Also Available in