GetWorkCode

Definition

Usage

Obtain the ID of the specified work code. For details, see SetWorkCode.

Parameter

ID of a work code

ID of the work code described by WorkCodeID

Return Value

Return True if it is successful, or return False.

Related Function

SetWorkCode

 

Ejemplo

C#

        /// <summary>
/// Get the workcode by its id.
/// </summary>
/// <param name="AWorkCode">ID of the work code described by WorkCodeID</param>
/// <param name="WorkCodeID">ID of a work code</param>
/// <param name="IP"> Ip of device </param>
/// <param name="Port"> Port of Device </param>
/// <param name="MachineNumber"> Device Number </param>
private void GetWorkCode(int AWorkCode, int WorkCodeID, string IP = "10.0.0.44", int Port = 4370, int MachineNumber = 1)
{
        //Create Standalone SDK class dynamicly.
	zkemkeeper.CZKEMClass axCZKEM1 = new zkemkeeper.CZKEMClass();
	axCZKEM1.Connect_Net(IP, Port);
        int idwErrorCode = 0;
        if (axCZKEM1.GetWorkCode(WorkCodeID, out AWorkCode))
	{
		MessageBox.Show("WorkCode: " + AWorkCode, "Success");
	}
        else
	{
		axCZKEM1.GetLastError(ref idwErrorCode);
		MessageBox.Show("Operation failed,ErrorCode=" + idwErrorCode.ToString(), "Error");
	}
}

VB

''' <summary>
''' Get the workcode by its id.
''' </summary>
''' <param name="AWorkCode"></param>
''' <param name="WorkCodeID"></param>
''' <param name="IP"> Ip of device </param>
''' <param name="Port"> Port of Device </param>
''' <param name="MachineNumber"> Device Number </param>
Private Sub GetWorkCode(AWorkCode As Integer, WorkCodeID As Integer, Optional IP As String = "10.0.0.44", Optional Port As Integer = 4370, Optional MachineNumber As Integer = 1)
'Create Standalone SDK class dynamicly.
Dim axCZKEM1 As New zkemkeeper.CZKEM
	axCZKEM1.Connect_Net(IP, Port)
Dim idwErrorCode As Integer = 0
If axCZKEM1.GetWorkCode(WorkCodeID, AWorkCode) = True Then
		MsgBox("Work Code" & AWorkCode, MsgBoxStyle.Information, "Success")
Else
		axCZKEM1.GetLastError(idwErrorCode)
		MsgBox("Operation failed,ErrorCode=" & idwErrorCode.ToString(), MsgBoxStyle.Exclamation, "Error")
End If
End Sub