You can set up a custom procedure that runs when you click New Code from on the single Coding on the Fly dialog box for valve component groups. This custom procedure manipulates table details before generating the commodity code for a valve component group.
Project default
You must set a project default, ZS_SE_CCDL, if you want to have the CIP run. If the entry is None for this project default, then the software does not run a CIP, and the code is returned.
The format of the entry for the project default is:
\custom\CustomerName.dll CustomerName.GenerationCustomize
The first part provides the location of the DLL based on the root directory, and the second part provides the class name of the custom class, including the root namespace.
Custom Procedure
Interface
The commodity code details customization depends on the following interface and transfer classes.
Public Interface ICommodityCodeGenerationCustomProcedures
Sub ModifyCommodityCodeDetails( _
ByVal information As CommodityCodeGenerationInformationForCustomProcedure, _
ByVal data As CommodityCodeGenerationDataForCustomProcedure, _
ByVal context As WorkingContextForCustomProcedure)
End Interface
This interface function is called when the user clicks OK on the single Coding on the Fly dialog box.
Parameters of the interface
-
The first parameter is a class of type CommodityCodeGenerationInformationForCustomProcedure. All members of this class are read-only. You can use these members to retrieve information from the database. The members are:
-
The second parameter is a class with one more class:
The CommodityCodeDetailsForCustomProcedure is as follows:
CommodityId and ProjectId are read-only fields. TableGroupId and TableDetailId can be modified. You can add new optional tables defined in the rule.
-
The third parameter is a working context class with the following members:
If Cancel is set to True, no changes are used from the calling module.
Connection is the Oracle connection to the correct login context. You can use this property to read or modify data in the database.
Example 1
\bin\SPRDServerBusiness.dll Intergraph.Sprd.ServerBusiness.BusCommodityGenerationCipSample1
Public Class BusCommodityGenerationCipSample2
Implements ICommodityCodeGenerationCustomProcedures
''' <summary>
''' Modifies a table detail
''' </summary>
''' <param name="information"></param>
''' <param name="data"></param>
''' <param name="context"></param>
''' <remarks></remarks>
Public Sub ModifyCommodityCodeDetails(ByVal information As CommodityCodeGenerationInformationForCustomProcedure, ByVal data As CommodityCodeGenerationDataForCustomProcedure, ByVal context As WorkingContextForCustomProcedure) Implements ICommodityCodeGenerationCustomProcedures.ModifyCommodityCodeDetails
context.Messages.Add("Custom Procedure Cip Sample 1")
Dim duplicateCommodityCodeDetails As New List(Of CommodityCodeDetailsForCustomProcedure)
For Each commodityCodeDetail As CommodityCodeDetailsForCustomProcedure In data.TableDetails
'Check if material table detail is AA and replace it with AK.
If commodityCodeDetail.TableDetailId = "731434" Then
commodityCodeDetail.TableDetailId = "731443"
End If
duplicateCommodityCodeDetails.Add(commodityCodeDetail)
Next
data.TableDetails.Clear()
data.TableDetails.AddRange(duplicateCommodityCodeDetails.ToArray)
context.Cancel = False
End Sub
End Class
Example 2
''' <summary>
''' Duplicates all filter lines.
''' </summary>
''' <remarks></remarks>
Public Class BusCommodityGenerationCipSample2
Implements ICommodityCodeGenerationCustomProcedures
''' <summary>
''' Adds an optional table detail.
''' </summary>
''' <param name="information"></param>
''' <param name="data"></param>
''' <param name="context"></param>
''' <remarks></remarks>
Public Sub ModifyCommodityCodeDetails(ByVal information As CommodityCodeGenerationInformationForCustomProcedure, ByVal data As CommodityCodeGenerationDataForCustomProcedure, ByVal context As WorkingContextForCustomProcedure) Implements ICommodityCodeGenerationCustomProcedures.ModifyCommodityCodeDetails
context.Messages.Add("Custom Procedure Cip Sample 2")
Dim newDetail As New CommodityCodeDetailsForCustomProcedure
newDetail.TableId = "7193"
newDetail.TableGroupId = "502730"
newDetail.TableDetailId = "5042"
data.TableDetails.Add(newDetail)
context.Cancel = False
End Sub
End Class