[성현모] CPXV2 Init
This commit is contained in:
@ -0,0 +1,498 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using SystemX.Common;
|
||||
using SystemX.Common.Serialization;
|
||||
using SystemX.Net.BaseProtocol;
|
||||
using SystemX.Net.Comm;
|
||||
using SystemX.Net.Schedule;
|
||||
using static SystemX.Net.Platform.Common.Util.LogMessage;
|
||||
|
||||
namespace SystemX.Net.XAdaptor.PC
|
||||
{
|
||||
[ComVisible(true)]
|
||||
[Guid("837C547C-E1EC-453E-BA98-2F5EEDFD6CF6")]
|
||||
[ClassInterface(ClassInterfaceType.None)]
|
||||
[ProgId("SystemX.Net.XAdaptor.PC.XAdaptorPC")]
|
||||
[ComDefaultInterface(typeof(IComXPCAdaptor))]
|
||||
public partial class XAdaptorPC
|
||||
{
|
||||
private string MakeDataSetToText(DataSet ds)
|
||||
{
|
||||
string strMakeText = string.Empty;
|
||||
string strMakeColInfo = "000@";
|
||||
string[] strRowTextArray = null;
|
||||
|
||||
try
|
||||
{
|
||||
if (ds != null)
|
||||
{
|
||||
foreach (DataTable dt in ds.Tables)
|
||||
{
|
||||
strRowTextArray = new string[dt.Rows.Count];
|
||||
|
||||
foreach (DataColumn dc in dt.Columns)
|
||||
strMakeColInfo += dc.ColumnName + ",";
|
||||
|
||||
strMakeColInfo = strMakeColInfo.Remove(strMakeColInfo.Length - 1, 1);
|
||||
|
||||
strMakeColInfo += ";";
|
||||
|
||||
strMakeText = strMakeColInfo;
|
||||
|
||||
int iPos = 0;
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
{
|
||||
string[] strRowTrimArray = new string[dr.ItemArray.Count()];
|
||||
for (int i = 0; i < dr.ItemArray.Count(); i++)
|
||||
strRowTrimArray[i] = dr.ItemArray[i].ToString().Trim();
|
||||
|
||||
strRowTextArray[iPos] = string.Join(",", strRowTrimArray);
|
||||
strRowTextArray[iPos] = strRowTextArray[iPos].Trim();
|
||||
|
||||
strMakeText += (iPos + 1).ToString("D3") + "@" + strRowTextArray[iPos] + ";";
|
||||
|
||||
iPos++;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (strRowTextArray == null)
|
||||
strMakeText = "";
|
||||
else if (strRowTextArray.Count() <= 0)
|
||||
strMakeText = "";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
strMakeText = "";
|
||||
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") +
|
||||
@"Dataset to text process fail. [SystemX.Net.XAdaptor.PC : XPCAdaptor.MakeDataSetToText]\r\n" +
|
||||
ex.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
|
||||
return strMakeText;
|
||||
}
|
||||
|
||||
[ComVisible(true)]
|
||||
public bool ComGetClientSocketConnect()
|
||||
{
|
||||
return StateClientSocketConnect;
|
||||
}
|
||||
|
||||
[ComVisible(true)]
|
||||
public bool ComGetClientStreamSocketConnect()
|
||||
{
|
||||
return StateClientStreamSocketConnect;
|
||||
}
|
||||
|
||||
[ComVisible(true)]
|
||||
public bool ComGetClientInfo()
|
||||
{
|
||||
return StateClientGetInformation;
|
||||
}
|
||||
|
||||
[ComVisible(true)]
|
||||
public bool ComGetAdaptorConnectState()
|
||||
{
|
||||
return StateAdaptorConnect;
|
||||
}
|
||||
|
||||
[ComVisible(true)]
|
||||
public string ComGetCommandMessage()
|
||||
{
|
||||
return strCheckCommandMsg;
|
||||
}
|
||||
|
||||
[ComVisible(true)]
|
||||
public string ComGetStreamMessage()
|
||||
{
|
||||
return strCheckCommandMsg;
|
||||
}
|
||||
|
||||
[ComVisible(true)]
|
||||
public async Task<bool> ComClientTryConnet(int nCommandPortNum = int.MaxValue, int nStreamPortNum = int.MaxValue)
|
||||
{
|
||||
bool bResult = true;
|
||||
|
||||
StateAdaptorConnect = true;
|
||||
|
||||
try
|
||||
{
|
||||
//ConnectCommandWaitEvent.Reset();
|
||||
//ConnectStreamWaitEvent.Reset();
|
||||
|
||||
bConnectCommandSocketFlag = false;
|
||||
bConnectStreamSocketFlag = false;
|
||||
|
||||
StateAdaptorConnect &= ClientCommandSet(SOCKET_TYPE.TCP, false, nCommandPortNum);
|
||||
StateAdaptorConnect &= ClientStreamSet(SOCKET_TYPE.TCP, false, nStreamPortNum);
|
||||
|
||||
Stopwatch stWaitConnect = new Stopwatch();
|
||||
stWaitConnect.Start();
|
||||
|
||||
while(stWaitConnect.ElapsedMilliseconds < CONNECT_TIME_OUT)
|
||||
{
|
||||
if(bConnectCommandSocketFlag)
|
||||
{
|
||||
await Task.Delay(100).ConfigureAwait(false);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
await Task.Delay(10).ConfigureAwait(false);
|
||||
}
|
||||
if(bConnectCommandSocketFlag)
|
||||
SetCommandWatchTask();
|
||||
else
|
||||
{
|
||||
bResult = false;
|
||||
|
||||
throw new Exception("Can not connect Command Socket.");
|
||||
}
|
||||
//
|
||||
stWaitConnect.Restart();
|
||||
while (stWaitConnect.ElapsedMilliseconds < CONNECT_TIME_OUT)
|
||||
{
|
||||
if (bConnectStreamSocketFlag)
|
||||
{
|
||||
await Task.Delay(100).ConfigureAwait(false);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
await Task.Delay(10).ConfigureAwait(false);
|
||||
}
|
||||
if (bConnectStreamSocketFlag)
|
||||
SetStreamWatchTask();
|
||||
else
|
||||
{
|
||||
bResult = false;
|
||||
|
||||
throw new Exception("Can not connect Stream Socket.");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
bResult = false;
|
||||
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") +
|
||||
@"Client Connection Attempt Error. [SystemX.Net.XAdaptor.PC - IComXPCAdaptor : XPCAdaptor.ComClientTryConnet]\r\n" +
|
||||
ex.Message, ConsoleColor.Red, LogMessageLevel.DEBUG);
|
||||
}
|
||||
finally
|
||||
{
|
||||
;//
|
||||
}
|
||||
|
||||
return bResult;
|
||||
}
|
||||
|
||||
[ComVisible(true)]
|
||||
public async Task<bool> ComClientTryDistributionConnet(int nCommandPortNum = int.MaxValue)
|
||||
{
|
||||
bool bResult = true;
|
||||
|
||||
StateAdaptorConnect = true;
|
||||
|
||||
thisConnInfo.stLoginTimeOut.Restart();
|
||||
|
||||
try
|
||||
{
|
||||
ClearCommandClientInstance();
|
||||
|
||||
//ConnectCommandWaitEvent.Reset();
|
||||
|
||||
bConnectCommandSocketFlag = false;
|
||||
|
||||
StateAdaptorConnect &= ClientCommandSet(SOCKET_TYPE.TCP, true, nCommandPortNum);
|
||||
|
||||
Stopwatch stWaitConnect = new Stopwatch();
|
||||
stWaitConnect.Start();
|
||||
|
||||
while (stWaitConnect.ElapsedMilliseconds < CONNECT_TIME_OUT)
|
||||
{
|
||||
if (bConnectCommandSocketFlag)
|
||||
{
|
||||
await Task.Delay(10).ConfigureAwait(false);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
await Task.Delay(10).ConfigureAwait(false);
|
||||
}
|
||||
if (bConnectCommandSocketFlag)
|
||||
SetCommandWatchTask();
|
||||
else
|
||||
{
|
||||
bResult = false;
|
||||
|
||||
throw new Exception("Can not connect Command Socket.");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
bResult = false;
|
||||
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") +
|
||||
@"Client Connection Attempt Error. [SystemX.Net.XAdaptor.PC - IComXPCAdaptor : XPCAdaptor.ComClientTryConnet]\r\n" +
|
||||
ex.Message, ConsoleColor.Red, LogMessageLevel.DEBUG);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (ClientCommandSock.SOCK_TYPE == SOCKET_TYPE.UDP && bResult)
|
||||
{
|
||||
COMM_INFO_PACKET ConnectCommSendInfo = new COMM_INFO_PACKET();
|
||||
int iSendSize = Marshal.SizeOf(ConnectCommSendInfo);
|
||||
byte[] ucSendArray = new byte[iSendSize];
|
||||
ConnectCommSendInfo = (COMM_INFO_PACKET)SystemXNetSerialization.RawDeSerialize(ucSendArray, ConnectCommSendInfo.GetType());
|
||||
|
||||
ConnectCommSendInfo.bPortDistribution = true;
|
||||
|
||||
ConnectCommSendInfo.usPortCommandNumber = (ushort)0;
|
||||
ConnectCommSendInfo.usPortStreamNumber = (ushort)0;
|
||||
|
||||
ConnectCommSendInfo.objConnLocalAddress[0].Data = ClientCommandSock.strGetLocalAddress;
|
||||
ConnectCommSendInfo.objConnLocalPort[0].Data = ClientCommandSock.strGetLocalPort;
|
||||
|
||||
byte[] ucSendByteInfo = XCommons.SpecialObjectToByteStream(new BASE_PROTOCOL(BASE_PROTOCOL.PROTOCOL_CODE.INITILALIZE_INFO), ConnectCommSendInfo);
|
||||
|
||||
FlowCommandControl.InsertSendQueue(DateTime.Now, ucSendByteInfo, null);
|
||||
}
|
||||
}
|
||||
|
||||
return bResult;
|
||||
}
|
||||
|
||||
[ComVisible(true)]
|
||||
public async Task<bool> WaitComClientTryDistributionConnet(int nCommandPortNum = int.MaxValue)
|
||||
{
|
||||
bool bResult = true;
|
||||
|
||||
StateAdaptorConnect = true;
|
||||
|
||||
thisConnInfo.stLoginTimeOut.Restart();
|
||||
|
||||
try
|
||||
{
|
||||
ClearCommandClientInstance();
|
||||
|
||||
//ConnectCommandWaitEvent.Reset();
|
||||
|
||||
bConnectCommandSocketFlag = false;
|
||||
|
||||
StateAdaptorConnect &= ClientCommandSet(SOCKET_TYPE.TCP, true, nCommandPortNum);
|
||||
|
||||
Stopwatch stWaitConnect = new Stopwatch();
|
||||
stWaitConnect.Start();
|
||||
|
||||
while (stWaitConnect.ElapsedMilliseconds < CONNECT_TIME_OUT)
|
||||
{
|
||||
if (bConnectCommandSocketFlag)
|
||||
{
|
||||
await Task.Delay(10).ConfigureAwait(false);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
await Task.Delay(10).ConfigureAwait(false);
|
||||
}
|
||||
if (bConnectCommandSocketFlag)
|
||||
SetCommandWatchTask();
|
||||
else
|
||||
{
|
||||
bResult = false;
|
||||
|
||||
throw new Exception("Can not connect Command Socket.");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
bResult = false;
|
||||
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") +
|
||||
@"Client Connection Attempt Error. [SystemX.Net.XAdaptor.PC - IComXPCAdaptor : XPCAdaptor.ComClientTryConnet]\r\n" +
|
||||
ex.Message, ConsoleColor.Red, LogMessageLevel.DEBUG);
|
||||
}
|
||||
//
|
||||
finally
|
||||
{
|
||||
if (bResult)
|
||||
{
|
||||
await Task.Delay(500).ConfigureAwait(false);
|
||||
|
||||
COMM_INFO_PACKET ConnectCommSendInfo = new COMM_INFO_PACKET();
|
||||
int iSendSize = Marshal.SizeOf(ConnectCommSendInfo);
|
||||
byte[] ucSendArray = new byte[iSendSize];
|
||||
ConnectCommSendInfo = (COMM_INFO_PACKET)SystemXNetSerialization.RawDeSerialize(ucSendArray, ConnectCommSendInfo.GetType());
|
||||
|
||||
ConnectCommSendInfo.bPortDistribution = true;
|
||||
|
||||
ConnectCommSendInfo.usPortCommandNumber = (ushort)0;
|
||||
ConnectCommSendInfo.usPortStreamNumber = (ushort)0;
|
||||
|
||||
byte[] ucSendByteInfo = XCommons.SpecialObjectToByteStream(new BASE_PROTOCOL(BASE_PROTOCOL.PROTOCOL_CODE.INITILALIZE_INFO), ConnectCommSendInfo);
|
||||
|
||||
FlowCommandControl.InsertSendQueue(DateTime.Now, ucSendByteInfo, null, PacketFlowControl.CommInfoManualToken, false);
|
||||
|
||||
await WaitTaskJoin(waitCommandParam, FlowCommandControl, PacketFlowControl.CommInfoManualToken, false);
|
||||
|
||||
if (QueryResult.bQueryResult)
|
||||
bResult = true;
|
||||
else
|
||||
bResult = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (bResult)
|
||||
{
|
||||
if (await ComClientTryConnet(SubscribeConnectInfo.nChangeCommandPort, SubscribeConnectInfo.nChangeStreamPort) == false)
|
||||
{
|
||||
AdaptorAbort();
|
||||
|
||||
bResult = false;
|
||||
}
|
||||
}
|
||||
|
||||
return bResult;
|
||||
}
|
||||
|
||||
[ComVisible(true)]
|
||||
public bool ComClientTryDisconnect()
|
||||
{
|
||||
bool bResult = true;
|
||||
|
||||
try
|
||||
{
|
||||
ClearCommonVar();
|
||||
|
||||
ClearCommandWatchTask();
|
||||
ClearStreamWatchTask();
|
||||
|
||||
ClearCommandClientInstance();
|
||||
ClearStreamClientInstance();
|
||||
|
||||
this.ClientCommandErrorEvent(null, null);
|
||||
this.ClientStreamErrorEvent(null, null);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
bResult = false;
|
||||
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") +
|
||||
@"Client Disconnect Attempt Error. [SystemX.Net.XAdaptor.PC - IComXPCAdaptor : XPCAdaptor.ComClientTryDisconnect]\r\n" +
|
||||
ex.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
|
||||
return bResult;
|
||||
}
|
||||
|
||||
[ComVisible(true)]
|
||||
public bool ComCheckConnectState()
|
||||
{
|
||||
bool bStatus = false;
|
||||
|
||||
try
|
||||
{
|
||||
thisConnInfo.OnCommandTime();
|
||||
|
||||
try
|
||||
{
|
||||
PING_PACKET MakePingPacket = new PING_PACKET();
|
||||
int iSendSize = Marshal.SizeOf(MakePingPacket);
|
||||
byte[] ucSendArray = new byte[iSendSize];
|
||||
MakePingPacket = (PING_PACKET)SystemXNetSerialization.RawDeSerialize(ucSendArray, MakePingPacket.GetType());
|
||||
|
||||
MakePingPacket.objCheckMsg[0].Data = "Who?";
|
||||
|
||||
byte[] ucSendByteInfo = XCommons.SpecialObjectToByteStream(new BASE_PROTOCOL(BASE_PROTOCOL.PROTOCOL_CODE.CONNECT_STATE), MakePingPacket);
|
||||
|
||||
byte ucGetLabel = FlowCommandControl.InsertSendQueue(DateTime.Now, ucSendByteInfo, null, true);
|
||||
|
||||
if (ComWaitResult(ucGetLabel) == null)
|
||||
{
|
||||
FlowCommandControl.STM.ClearLabel(ucGetLabel);
|
||||
}
|
||||
else
|
||||
bStatus = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") +
|
||||
@"Command Socket ping check error. [SystemX.Net.XAdaptor.PC - IComXPCAdaptor : XPCAdaptor.ComCheckConnectState]\r\n" +
|
||||
ex.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
finally { }
|
||||
}
|
||||
finally
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
return bStatus;
|
||||
}
|
||||
|
||||
[ComVisible(true)]
|
||||
public bool ComCheckConnectStreamState()
|
||||
{
|
||||
try
|
||||
{
|
||||
thisConnInfo.OnStreamTime();
|
||||
|
||||
try
|
||||
{
|
||||
PING_PACKET MakePingPacket = new PING_PACKET();
|
||||
int iSendSize = Marshal.SizeOf(MakePingPacket);
|
||||
byte[] ucSendArray = new byte[iSendSize];
|
||||
MakePingPacket = (PING_PACKET)SystemXNetSerialization.RawDeSerialize(ucSendArray, MakePingPacket.GetType());
|
||||
|
||||
MakePingPacket.objCheckMsg[0].Data = "Who?";
|
||||
|
||||
byte[] ucSendByteInfo = XCommons.SpecialObjectToByteStream(new BASE_PROTOCOL(BASE_PROTOCOL.PROTOCOL_CODE.CONNECT_STATE), MakePingPacket);
|
||||
|
||||
FlowStreamControl.InsertSendQueue(DateTime.Now, ucSendByteInfo, null);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") +
|
||||
@"Stream Socket ping check error. [SystemX.Net.XAdaptor.PC - IComXPCAdaptor: XPCAdaptor.ComCheckConnectStreamState]\r\n" +
|
||||
ex.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
finally { }
|
||||
}
|
||||
finally
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
[ComVisible(true)]
|
||||
public string ComSetConfigureFile(string strFilePos)
|
||||
{
|
||||
if (File.Exists(strFilePos))
|
||||
{
|
||||
strSetAdaptorConfigFilePos = strFilePos;
|
||||
|
||||
if (CheckConfigFileBuildEndPoint())
|
||||
{
|
||||
return strFilePos;
|
||||
}
|
||||
else
|
||||
return "";
|
||||
}
|
||||
else
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,222 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Remoting.Messaging;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using SystemX.Common;
|
||||
using SystemX.Common.Serialization;
|
||||
using SystemX.Net.BaseProtocol;
|
||||
using SystemX.Net.Schedule;
|
||||
using SystemX.Net.XAdaptor;
|
||||
using static SystemX.Net.Platform.Common.Util.LogMessage;
|
||||
|
||||
namespace SystemX.Net.XAdaptor.PC
|
||||
{
|
||||
public partial class XAdaptorPC
|
||||
{
|
||||
private byte SendCallQuery(string strQueryCallID, params string[] strParameterValues)
|
||||
{
|
||||
QUERY_PACKET QueryPacket = new QUERY_PACKET();
|
||||
int iSizeQueryPacket = Marshal.SizeOf(QueryPacket);
|
||||
byte[] ucQueryPacketArray = new byte[iSizeQueryPacket];
|
||||
|
||||
QueryPacket = (QUERY_PACKET)SystemXNetSerialization.RawDeSerialize(ucQueryPacketArray, QueryPacket.GetType());
|
||||
|
||||
string strSendText = string.Empty;
|
||||
strSendText = "UserQueryCall;";
|
||||
|
||||
if (strParameterValues.Length > 0)
|
||||
{
|
||||
strSendText += (strQueryCallID + ";");
|
||||
|
||||
foreach (string strParam in strParameterValues)
|
||||
{
|
||||
strSendText += (strParam + ";");
|
||||
}
|
||||
|
||||
strSendText = strSendText.Remove(strSendText.Length - 1, 1);
|
||||
}
|
||||
else
|
||||
strSendText += strQueryCallID;
|
||||
|
||||
QueryPacket.objQueryText[0].Data = strSendText;
|
||||
|
||||
ucQueryPacketArray = XCommons.SpecialObjectToByteStream(new BASE_PROTOCOL(BASE_PROTOCOL.PROTOCOL_CODE.USER_QUERY), QueryPacket);
|
||||
|
||||
return FlowCommandControl.InsertSendQueue(DateTime.Now, ucQueryPacketArray, null, true);
|
||||
}
|
||||
|
||||
private DataSet WaitCallQueryLookUp(string strQueryCallID, params string[] strParameterValues)
|
||||
{
|
||||
if (thisConnInfo.ConnectCommandState == false)
|
||||
return null;
|
||||
if (thisConnInfo.InitialInfoState == false)
|
||||
return null;
|
||||
|
||||
DataSet dsReturnSet = null;
|
||||
|
||||
try
|
||||
{
|
||||
thisConnInfo.OnCommandTime();
|
||||
|
||||
try
|
||||
{
|
||||
byte ucGetLabel = SendCallQuery(strQueryCallID, strParameterValues);
|
||||
|
||||
WaitThreadJoin(waitCommandParam, FlowCommandControl, ucGetLabel);
|
||||
|
||||
if (QueryResult.QueryDataSet != null)
|
||||
{
|
||||
if (QueryResult.bQueryResult) //Query 문 실행 성공
|
||||
dsReturnSet = QueryResult.QueryDataSet;
|
||||
else //Query 문 실행 실패(구문 오류 또는 연결 오류)
|
||||
dsReturnSet = null;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") +
|
||||
@"Registered query call error. [" + strQueryCallID + "][SystemX.Net.XAdaptor.PC - IXPCAdaptor : XPCAdaptor.WaitCallQuery]\r\n" +
|
||||
ex.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
finally
|
||||
{
|
||||
;//
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
return dsReturnSet;
|
||||
}
|
||||
|
||||
private DataSet WaitCallQuery(string strQueryCallID, params string[] strParameterValues)
|
||||
{
|
||||
if (thisConnInfo.ConnectCommandState == false)
|
||||
return null;
|
||||
if (thisConnInfo.InitialInfoState == false)
|
||||
return null;
|
||||
if (LoadInfo.SIMPLE_LOOKUP_OPTION == true)
|
||||
return null;
|
||||
|
||||
DataSet dsReturnSet = null;
|
||||
|
||||
try
|
||||
{
|
||||
thisConnInfo.OnCommandTime();
|
||||
|
||||
try
|
||||
{
|
||||
byte ucGetLabel = SendCallQuery(strQueryCallID, strParameterValues);
|
||||
|
||||
WaitThreadJoin(waitCommandParam, FlowCommandControl, ucGetLabel);
|
||||
|
||||
if (QueryResult.QueryDataSet != null)
|
||||
{
|
||||
if (QueryResult.bQueryResult) //Query 문 실행 성공
|
||||
dsReturnSet = QueryResult.QueryDataSet;
|
||||
else //Query 문 실행 실패(구문 오류 또는 연결 오류)
|
||||
dsReturnSet = null;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") +
|
||||
@"Registered query call error. [" + strQueryCallID + "][SystemX.Net.XAdaptor.PC - IXPCAdaptor : XPCAdaptor.WaitCallQuery]\r\n" +
|
||||
ex.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
finally
|
||||
{
|
||||
;//
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
return dsReturnSet;
|
||||
}
|
||||
|
||||
public DataSet WaitUserQuery(string strQuery)
|
||||
{
|
||||
if (thisConnInfo.ConnectCommandState == false)
|
||||
return null;
|
||||
if (thisConnInfo.InitialInfoState == false)
|
||||
return null;
|
||||
if (LoadInfo.SIMPLE_LOOKUP_OPTION == true)
|
||||
return null;
|
||||
|
||||
string[] strCheck = strQuery.Split(' ');
|
||||
string strUpperText = string.Empty;
|
||||
|
||||
foreach (string strItem in strCheck)
|
||||
{
|
||||
strUpperText = strItem.ToUpper();
|
||||
|
||||
if (strUpperText.CompareTo("INSERT") == 0 ||
|
||||
strUpperText.CompareTo("UPDATE") == 0 ||
|
||||
strUpperText.CompareTo("DELETE") == 0)
|
||||
{
|
||||
MessageBox.Show("SQL control syntax other than SELECT syntax is not supported.", "XAdaptor", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
string strQueryText = strQuery.ToUpper();
|
||||
|
||||
DataSet dsReturnSet = null;
|
||||
|
||||
try
|
||||
{
|
||||
thisConnInfo.OnCommandTime();
|
||||
|
||||
try
|
||||
{
|
||||
QUERY_PACKET QueryPacket = new QUERY_PACKET();
|
||||
int iSizeQueryPacket = Marshal.SizeOf(QueryPacket);
|
||||
byte[] ucQueryPacketArray = new byte[iSizeQueryPacket];
|
||||
QueryPacket = (QUERY_PACKET)SystemXNetSerialization.RawDeSerialize(ucQueryPacketArray, QueryPacket.GetType());
|
||||
QueryPacket.objQueryText[0].Data = strQuery;
|
||||
ucQueryPacketArray = XCommons.SpecialObjectToByteStream(new BASE_PROTOCOL(BASE_PROTOCOL.PROTOCOL_CODE.SYSTEM_QUERY), QueryPacket);
|
||||
|
||||
byte ucGetLabel = FlowCommandControl.InsertSendQueue(DateTime.Now, ucQueryPacketArray, null, true);
|
||||
|
||||
WaitThreadJoin(waitCommandParam, FlowCommandControl, ucGetLabel);
|
||||
|
||||
if (QueryResult.QueryDataSet != null)
|
||||
{
|
||||
if (QueryResult.bQueryResult) //Query 문 실행 성공
|
||||
dsReturnSet = QueryResult.QueryDataSet;
|
||||
else //Query 문 실행 실패(구문 오류 또는 연결 오류)
|
||||
dsReturnSet = null;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") +
|
||||
@"User program query call error. [" + strQuery + "][SystemX.Net.XAdaptor.PC - IXPCAdaptor : XPCAdaptor.WaitUserQuery]\r\n" +
|
||||
ex.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
finally
|
||||
{
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
return dsReturnSet;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,432 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Remoting.Messaging;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using SystemX.Common;
|
||||
using SystemX.Common.Serialization;
|
||||
using SystemX.Net.BaseProtocol;
|
||||
using SystemX.Net.Schedule;
|
||||
using SystemX.Net.XAdaptor;
|
||||
using static SystemX.Net.Platform.Common.Util.LogMessage;
|
||||
|
||||
namespace SystemX.Net.XAdaptor.PC
|
||||
{
|
||||
public partial class XAdaptorPC
|
||||
{
|
||||
public eResultCheck CheckIssuedID(string strProductID)
|
||||
{
|
||||
if(strProductID.Length <= 0)
|
||||
return eResultCheck.InvalidFormat;
|
||||
|
||||
DataSet dsResult = WaitCallQuery("ID_IsIssued", strProductID);
|
||||
|
||||
if (XCommons.isHasRow(dsResult))
|
||||
return eResultCheck.AlreadyIssued;
|
||||
else
|
||||
return eResultCheck.NotIssued;
|
||||
}
|
||||
|
||||
//맥 어드레스 무결성 체크
|
||||
public eMacAddressType IsMacAddressForm(string strMacAddress)
|
||||
{
|
||||
// IP4 ADDRESS (25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}
|
||||
/* IP6 ADDRESS
|
||||
(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:)
|
||||
{1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:)
|
||||
{1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4})
|
||||
{1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:)
|
||||
{1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})
|
||||
|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]
|
||||
{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}
|
||||
[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]
|
||||
{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]
|
||||
|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))
|
||||
*/
|
||||
// MAC ADDRESS
|
||||
// ([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}
|
||||
//^([[:xdigit:]]{2}[:.-]?){5}[[:xdigit:]]{2}$
|
||||
//^([0-9a-fA-F]{2}[:.-]?){5}[0-9a-fA-F]{2}$/g
|
||||
Regex r1 = new Regex("^([0-9a-fA-F]{2}){5}[0-9a-fA-F]{2}$");
|
||||
Regex r2 = new Regex("^([0-9a-fA-F]{2}[:]+){5}[0-9a-fA-F]{2}$");
|
||||
Regex r3 = new Regex("^([0-9a-fA-F]{2}[-]+){5}[0-9a-fA-F]{2}$");
|
||||
Regex r4 = new Regex("^([0-9a-fA-F]{2}[.]+){5}[0-9a-fA-F]{2}$");
|
||||
Regex r5 = new Regex("^([0-9a-fA-F]{2}[:.-]?){5}[0-9a-fA-F]{2}$");
|
||||
|
||||
bool b1 = r1.Match(strMacAddress).Success;
|
||||
bool b2 = r2.Match(strMacAddress).Success;
|
||||
bool b3 = r3.Match(strMacAddress).Success;
|
||||
bool b4 = r4.Match(strMacAddress).Success;
|
||||
bool b5 = r5.Match(strMacAddress).Success;
|
||||
|
||||
eMacAddressType type = eMacAddressType.Normal;
|
||||
|
||||
if (b5 == false)
|
||||
return eMacAddressType.InvalidMacAddressFormat;
|
||||
|
||||
if (b2)
|
||||
type = eMacAddressType.Colon;
|
||||
else if (b3)
|
||||
type = eMacAddressType.Hyphen;
|
||||
else if (b4)
|
||||
type = eMacAddressType.Dot;
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
private string MacAddressFormatRecalculation(string strMacAddress)
|
||||
{
|
||||
string strFindMacAddress = string.Empty;
|
||||
|
||||
foreach (char c in strMacAddress)
|
||||
{
|
||||
if (char.IsLetterOrDigit(c))
|
||||
strFindMacAddress += c;
|
||||
}
|
||||
|
||||
return strFindMacAddress;
|
||||
}
|
||||
|
||||
private string MacAddressFormatChange(string strText, eMacAddressType type)
|
||||
{
|
||||
string strChangeMacAddress = string.Empty;
|
||||
|
||||
int nPos = 0;
|
||||
foreach (char c in strText)
|
||||
{
|
||||
if(nPos / 2 == 1)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case eMacAddressType.Colon:
|
||||
strChangeMacAddress += ":";
|
||||
break;
|
||||
case eMacAddressType.Hyphen:
|
||||
strChangeMacAddress += "-";
|
||||
break;
|
||||
case eMacAddressType.Dot:
|
||||
strChangeMacAddress += ".";
|
||||
break;
|
||||
}
|
||||
|
||||
nPos = 0;
|
||||
}
|
||||
|
||||
if (char.IsLetterOrDigit(c))
|
||||
strChangeMacAddress += c;
|
||||
|
||||
nPos++;
|
||||
}
|
||||
|
||||
return strChangeMacAddress;
|
||||
}
|
||||
|
||||
|
||||
//목록에 존재하는 맥어드레스 인지
|
||||
public bool CheckListMacAddress(string strMacAddress)
|
||||
{
|
||||
if (IsMacAddressForm(strMacAddress) == eMacAddressType.InvalidMacAddressFormat)
|
||||
return false;
|
||||
|
||||
string strFindMacAddress = MacAddressFormatRecalculation(strMacAddress);
|
||||
|
||||
DataSet dsResult = WaitCallQuery("MacAddress_Check", strFindMacAddress);
|
||||
|
||||
if (XCommons.isHasRow(dsResult))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
public eResultCheck CheckIssuedMacAddress(string strMacAddress)
|
||||
{
|
||||
if (IsMacAddressForm(strMacAddress) == eMacAddressType.InvalidMacAddressFormat)
|
||||
return eResultCheck.InvalidMacAddressFormat;
|
||||
|
||||
string strFindMacAddress = MacAddressFormatRecalculation(strMacAddress);
|
||||
|
||||
DataSet dsResult = WaitCallQuery("MacAddress_IsIssued", strFindMacAddress);
|
||||
|
||||
if (XCommons.isHasRow(dsResult))
|
||||
return eResultCheck.AlreadyIssued;
|
||||
else
|
||||
return eResultCheck.NotIssued;
|
||||
}
|
||||
private int GetCurrentQuantity()
|
||||
{
|
||||
int nCurCnt = int.MaxValue;
|
||||
|
||||
DataSet dsResult = WaitCallQuery("Check_Mac_Quantity");
|
||||
|
||||
try
|
||||
{
|
||||
if (XCommons.isHasRow(dsResult))
|
||||
{
|
||||
if (int.TryParse(dsResult.Tables[0].Rows[0][0].ToString(), out nCurCnt) == false)
|
||||
throw new Exception();
|
||||
}
|
||||
else
|
||||
nCurCnt = int.MinValue;
|
||||
}
|
||||
catch
|
||||
{
|
||||
nCurCnt = int.MinValue;
|
||||
}
|
||||
|
||||
return nCurCnt;
|
||||
}
|
||||
|
||||
//현재 발행 예정 대상 주소
|
||||
public string GetToBeIssuedMacAddress(eMacAddressType type = eMacAddressType.Normal)
|
||||
{
|
||||
int nGetCurrent = GetCurrentQuantity();
|
||||
|
||||
if (nGetCurrent == int.MaxValue || nGetCurrent == int.MinValue)
|
||||
return "";
|
||||
|
||||
DataSet dsResult = WaitCallQuery("MacAddress_ToBeIssuedCheck", nGetCurrent.ToString());
|
||||
|
||||
string strGetMacAddress = string.Empty;
|
||||
|
||||
if (XCommons.isHasRow(dsResult))
|
||||
{
|
||||
strGetMacAddress = dsResult.Tables[0].Rows[0][1].ToString();
|
||||
|
||||
strGetMacAddress = MacAddressFormatChange(strGetMacAddress, type);
|
||||
}
|
||||
|
||||
return strGetMacAddress;
|
||||
}
|
||||
|
||||
//총개수
|
||||
public int GetTotalAddressNumber()
|
||||
{
|
||||
DataSet dsResult = WaitCallQuery("Check_Mac_Quantity");
|
||||
|
||||
int nValue = 0;
|
||||
|
||||
if (XCommons.isHasRow(dsResult))
|
||||
{
|
||||
if (int.TryParse(dsResult.Tables[0].Rows[0][1].ToString(), out nValue) == false)
|
||||
nValue = -1;
|
||||
}
|
||||
|
||||
return nValue;
|
||||
}
|
||||
|
||||
//발행 개수 확인
|
||||
public int GetCurrentIssuedAddressNumber()
|
||||
{
|
||||
DataSet dsResult = WaitCallQuery("Check_Mac_Quantity");
|
||||
|
||||
int nValue = 0;
|
||||
|
||||
if (XCommons.isHasRow(dsResult))
|
||||
{
|
||||
if (int.TryParse(dsResult.Tables[0].Rows[0][0].ToString(), out nValue) == false)
|
||||
nValue = -1;
|
||||
}
|
||||
|
||||
return nValue;
|
||||
}
|
||||
|
||||
//남은 개수 확인
|
||||
public int GetRemainAddressNumber()
|
||||
{
|
||||
DataSet dsResult = WaitCallQuery("Check_Mac_Quantity");
|
||||
|
||||
int nValue1 = 0;
|
||||
int nValue2 = 0;
|
||||
|
||||
int nResult = 0;
|
||||
|
||||
if (XCommons.isHasRow(dsResult))
|
||||
{
|
||||
if (int.TryParse(dsResult.Tables[0].Rows[0][0].ToString(), out nValue1) == false)
|
||||
nValue1 = -1;
|
||||
if (int.TryParse(dsResult.Tables[0].Rows[0][1].ToString(), out nValue2) == false)
|
||||
nValue2 = -1;
|
||||
|
||||
if (nValue1 == -1 || nValue2 == -1)
|
||||
nResult = -1;
|
||||
else
|
||||
nResult = nValue2 - nValue1;
|
||||
}
|
||||
|
||||
return nResult;
|
||||
}
|
||||
|
||||
protected string GetTableValue(DataSet ds, string strParam1)
|
||||
{
|
||||
string strValue = string.Empty;
|
||||
|
||||
if (strParam1.Length > 0)
|
||||
{
|
||||
int nIndex = int.MaxValue;
|
||||
|
||||
if (int.TryParse(strParam1, out nIndex))
|
||||
strValue = ds.Tables[0].Rows[0][nIndex].ToString();
|
||||
else
|
||||
strValue = ds.Tables[0].Rows[0][strParam1].ToString();
|
||||
}
|
||||
else
|
||||
strValue = ds.Tables[0].Rows[0][0].ToString();
|
||||
|
||||
return strValue;
|
||||
}
|
||||
|
||||
public string LookUpIDbyMacAddress(string strMacAddress)
|
||||
{
|
||||
if (IsMacAddressForm(strMacAddress) == eMacAddressType.InvalidMacAddressFormat)
|
||||
return "InvalidMacAddressFormat";
|
||||
|
||||
string strFindMacAddress = MacAddressFormatRecalculation(strMacAddress);
|
||||
|
||||
DataSet dsResult = WaitCallQueryLookUp("LookUpID_ByMacAddress", strFindMacAddress);
|
||||
|
||||
string strValue = string.Empty;
|
||||
|
||||
if (XCommons.isHasRow(dsResult))
|
||||
strValue = GetTableValue(dsResult, QueryResult.strVarParam1);
|
||||
|
||||
return strValue;
|
||||
}
|
||||
|
||||
|
||||
public string LookUpMacAddressbyID(ref string strProductID, eLookUpOption SetLookUpOption = eLookUpOption.CompareToSame, eMacAddressType type = eMacAddressType.Normal)
|
||||
{
|
||||
DataSet dsResult = null;
|
||||
|
||||
if(SetLookUpOption == eLookUpOption.StartWith)
|
||||
dsResult = WaitCallQueryLookUp("LookUpMacAddress_ByLikeID", strProductID + "%");
|
||||
else if (SetLookUpOption == eLookUpOption.EndWith)
|
||||
dsResult = WaitCallQueryLookUp("LookUpMacAddress_ByLikeID", "%" + strProductID);
|
||||
else if(SetLookUpOption == eLookUpOption.ContainWith)
|
||||
dsResult = WaitCallQueryLookUp("LookUpMacAddress_ByLikeID", "%" + strProductID + "%");
|
||||
else
|
||||
dsResult = WaitCallQueryLookUp("LookUpMacAddress_ByID", strProductID);
|
||||
|
||||
string strGetMacAddress = string.Empty;
|
||||
|
||||
string strValue = string.Empty;
|
||||
|
||||
if (XCommons.isHasRow(dsResult))
|
||||
{
|
||||
strValue = GetTableValue(dsResult, QueryResult.strVarParam1);
|
||||
|
||||
strValue = MacAddressFormatChange(strValue, type);
|
||||
|
||||
strProductID = dsResult.Tables[0].Rows[0][4].ToString();
|
||||
}
|
||||
|
||||
return strValue;
|
||||
}
|
||||
|
||||
private string RequestMacAddressIssuance(string strProductID, ref string strRetrunMessage, out int nErrCode, bool bReissuance = false)
|
||||
{
|
||||
nErrCode = int.MinValue;
|
||||
|
||||
strRetrunMessage = string.Empty;
|
||||
|
||||
string strGetUniqueInfo = string.Empty;
|
||||
|
||||
if (thisConnInfo.ConnectCommandState == false)
|
||||
return "[Error] Need connect command socket.";
|
||||
if (thisConnInfo.InitialInfoState == false)
|
||||
return "[Error] Need InitialInfoState information.";
|
||||
if (LoadInfo.SIMPLE_LOOKUP_OPTION == true)
|
||||
return "[Error] Cannot do this in simple lookup mode.";
|
||||
|
||||
try
|
||||
{
|
||||
thisConnInfo.OnCommandTime();
|
||||
|
||||
try
|
||||
{
|
||||
PROCESS_PACKET MakeProcessPacket = new PROCESS_PACKET();
|
||||
int iSendSize = Marshal.SizeOf(MakeProcessPacket);
|
||||
byte[] ucSendArray = new byte[iSendSize];
|
||||
MakeProcessPacket = (PROCESS_PACKET)SystemXNetSerialization.RawDeSerialize(ucSendArray, MakeProcessPacket.GetType());
|
||||
|
||||
MakeProcessPacket.nStationID = 0;
|
||||
MakeProcessPacket.objProdNo_C[0].Data = "";
|
||||
MakeProcessPacket.objTestType[0].Data = "";
|
||||
MakeProcessPacket.objTestCode[0].Data = ((bReissuance == false) ? "ISSUANCE" : "REISSUANCE");
|
||||
MakeProcessPacket.objTestListFileVersion[0].Data = "";
|
||||
MakeProcessPacket.objProductionCode[0].Data = "";
|
||||
MakeProcessPacket.objProductID[0].Data = strProductID;
|
||||
|
||||
byte[] ucSendByteInfo = XCommons.SpecialObjectToByteStream(new BASE_PROTOCOL(BASE_PROTOCOL.PROTOCOL_CODE.PROCESS_QUERY, BASE_PROTOCOL.OPTION_CODE.GET_ISSUANCE_MACADDRESS), MakeProcessPacket);
|
||||
|
||||
byte ucGetLabel = FlowCommandControl.InsertSendQueue(DateTime.Now, ucSendByteInfo, null, true);
|
||||
|
||||
WaitThreadJoin(waitCommandParam, FlowCommandControl, ucGetLabel);
|
||||
|
||||
if (XCommons.isHasRow(QueryResult.QueryDataSet))
|
||||
strGetUniqueInfo = GetTableValue(QueryResult.QueryDataSet, QueryResult.strVarParam1);
|
||||
|
||||
int.TryParse(QueryResult.strVarParam3, out nErrCode);
|
||||
|
||||
strRetrunMessage = QueryResult.strVarParam2;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") +
|
||||
@"MacAddress issuance request error. [SystemX.Net.XAdaptor.PC - IXPCAdaptor : RequestMacAddressIssuance]\r\n" +
|
||||
ex.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
finally { }
|
||||
}
|
||||
finally
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
return strGetUniqueInfo;
|
||||
}
|
||||
|
||||
public ResultIssued IssuanceRequest(string strProductID, bool bReissuance = false, eMacAddressType type = eMacAddressType.Normal)
|
||||
{
|
||||
int nGetErrCode = 0;
|
||||
|
||||
string strGetErrMsg = string.Empty;
|
||||
|
||||
string strGetUniqueInfo = string.Empty;
|
||||
|
||||
if (strProductID.Length <= 0)
|
||||
return new ResultIssued(eResultIssued.InvalidFormat);
|
||||
|
||||
strGetUniqueInfo = RequestMacAddressIssuance(strProductID, ref strGetErrMsg, out nGetErrCode, bReissuance);
|
||||
|
||||
if(IsMacAddressForm(strGetUniqueInfo) != eMacAddressType.InvalidMacAddressFormat)
|
||||
strGetUniqueInfo = MacAddressFormatChange(strGetUniqueInfo, type);
|
||||
|
||||
eResultIssued riReturn = eResultIssued.None;
|
||||
|
||||
switch(nGetErrCode)
|
||||
{
|
||||
case 0:
|
||||
riReturn = eResultIssued.Success;
|
||||
break;
|
||||
case -2:
|
||||
riReturn = eResultIssued.AlreadyIssued;
|
||||
break;
|
||||
case -3:
|
||||
riReturn = eResultIssued.InformationWithoutIssuanceHistory;
|
||||
break;
|
||||
default:
|
||||
riReturn = eResultIssued.Failed;
|
||||
break;
|
||||
}
|
||||
|
||||
return new ResultIssued(riReturn, strGetUniqueInfo, strGetErrMsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user