[성현모] JsonConvertTool 추가, 서머리 수량 버그수정
This commit is contained in:
@ -46,19 +46,20 @@ namespace SystemX.Net.XAdaptor.PC
|
||||
string strTestListVersion,
|
||||
string strProductionCode);
|
||||
|
||||
/*
|
||||
bool QueryTestList(uint nStationID, string strProdNo_C,
|
||||
string strTestType,
|
||||
string strTestCode,
|
||||
string strTestListVersion,
|
||||
string strProductionCode);
|
||||
|
||||
/*
|
||||
bool WaitQueryTestList(uint nStationID, string strProdNo_C,
|
||||
string strTestType,
|
||||
string strTestCode,
|
||||
string strTestListVersion,
|
||||
string strProductionCode);
|
||||
*/
|
||||
|
||||
Task<Tuple<string, int>> GetTestListQueryWithFilePath(string strFilePath, uint nStationID, string strProdNo_C,
|
||||
string strTestType,
|
||||
string strTestCode,
|
||||
@ -86,7 +87,7 @@ namespace SystemX.Net.XAdaptor.PC
|
||||
string targetVersion,
|
||||
string targetProdCode);
|
||||
|
||||
eFileSendRecvResult SendCustomFile(string strFilePos, bool bRecvResultWait = false, ushort usPalletIndex = 0);
|
||||
//eFileSendRecvResult SendCustomFile(string strFilePos, bool bRecvResultWait = false, ushort usPalletIndex = 0);
|
||||
|
||||
eSetConfigFileResult SetConfigureFile(string strFilePos);
|
||||
}
|
||||
|
||||
@ -84,6 +84,12 @@ namespace SystemX.Net.XAdaptor.PC
|
||||
private CancellationTokenSource SubCTS;
|
||||
private CancellationToken SubCT;
|
||||
//
|
||||
private Task taskConnectWorkProcess;
|
||||
private bool m_bTaskConnectWorkBlock;
|
||||
//
|
||||
CancellationTokenSource ConnWorkCTS;
|
||||
CancellationToken ConnWorkCT;
|
||||
//
|
||||
private bool bConnectCommandSocketFlag;
|
||||
private bool bConnectStreamSocketFlag;
|
||||
//
|
||||
@ -170,12 +176,12 @@ namespace SystemX.Net.XAdaptor.PC
|
||||
return null;
|
||||
}
|
||||
|
||||
private enum TIMER_LOCK
|
||||
private enum TASK_RUN_SYNC_LOCK
|
||||
{
|
||||
RECONNECT_TIMER = 0
|
||||
CONN_WORKER = 0
|
||||
}
|
||||
|
||||
private bool[] m_bTimerLock;
|
||||
private bool[] TaskRunSyncLock;
|
||||
|
||||
private void InitMember()
|
||||
{
|
||||
@ -260,10 +266,24 @@ namespace SystemX.Net.XAdaptor.PC
|
||||
{
|
||||
RecvWaitEvent -= RecvWaitEventCall;
|
||||
|
||||
ClearCommandWatchTask();
|
||||
ClearStreamWatchTask();
|
||||
|
||||
if (taskConnectWorkProcess != null)
|
||||
{
|
||||
ConnWorkCTS.Cancel();
|
||||
|
||||
m_bTaskConnectWorkBlock = true;
|
||||
|
||||
taskConnectWorkProcess.ConfigureAwait(false);
|
||||
//taskConnectWorkProcess.Wait();
|
||||
|
||||
taskConnectWorkProcess = null;
|
||||
}
|
||||
|
||||
if (bDisposing)
|
||||
{
|
||||
ClearCommandWatchTask();
|
||||
ClearStreamWatchTask();
|
||||
;//
|
||||
}
|
||||
|
||||
ClearCommandClientInstance();
|
||||
@ -275,16 +295,6 @@ namespace SystemX.Net.XAdaptor.PC
|
||||
// suppress calling of Finalizer
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
private void SetRetryTimer()
|
||||
{
|
||||
reConnectTimer = new WTimer();
|
||||
reConnectTimer.Enabled = false;
|
||||
reConnectTimer.Interval = 1500;
|
||||
reConnectTimer.Tick += ReConnectTimer_Tick;
|
||||
reConnectTimer.Start();
|
||||
reConnectTimer.Enabled = true;
|
||||
}
|
||||
|
||||
private bool CheckConfigFileBuildEndPoint()
|
||||
{
|
||||
@ -411,13 +421,15 @@ namespace SystemX.Net.XAdaptor.PC
|
||||
ClearStreamClientInstance();
|
||||
}
|
||||
|
||||
private async void ReConnectTimer_Tick(object sender, EventArgs e)
|
||||
private async void ConnWorker()
|
||||
{
|
||||
if (m_bTimerLock[(int)TIMER_LOCK.RECONNECT_TIMER] == false)
|
||||
{
|
||||
m_bTimerLock[(int)TIMER_LOCK.RECONNECT_TIMER] = true;
|
||||
while(ConnWorkCT.IsCancellationRequested == false &&
|
||||
m_bTaskConnectWorkBlock == false &&
|
||||
TaskRunSyncLock[(int)TASK_RUN_SYNC_LOCK.CONN_WORKER] == false)
|
||||
{
|
||||
await Task.Delay(250);
|
||||
|
||||
if(SubscribeConnectInfo.bSetChangeConnect)
|
||||
if (SubscribeConnectInfo.bSetChangeConnect)
|
||||
{
|
||||
if (SubscribeConnectInfo.bReqConnectAbort == false)
|
||||
SubscribeConnectInfo.bReqConnectAbort = true;
|
||||
@ -512,8 +524,6 @@ namespace SystemX.Net.XAdaptor.PC
|
||||
|
||||
ROUTINE_OUT:
|
||||
*/
|
||||
|
||||
m_bTimerLock[(int)TIMER_LOCK.RECONNECT_TIMER] = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -559,8 +569,8 @@ namespace SystemX.Net.XAdaptor.PC
|
||||
|
||||
thisConnInfo = new ClientInfoStore();
|
||||
//
|
||||
m_bTimerLock = new bool[10];
|
||||
Array.Clear(m_bTimerLock, 0, 10);
|
||||
TaskRunSyncLock = new bool[10];
|
||||
Array.Clear(TaskRunSyncLock, 0, 10);
|
||||
//
|
||||
if (ClientReadyEndPoint == false)
|
||||
CheckConfigFileBuildEndPoint();
|
||||
@ -578,8 +588,13 @@ namespace SystemX.Net.XAdaptor.PC
|
||||
thisConnInfo.OnStreamTime();
|
||||
thisConnInfo.OnStreamCheckTime();
|
||||
//
|
||||
//if (CLIENT_AUTO_CONNECT)
|
||||
SetRetryTimer();
|
||||
ConnWorkCTS = new CancellationTokenSource();
|
||||
ConnWorkCT = ConnWorkCTS.Token;
|
||||
|
||||
m_bTaskConnectWorkBlock = false;
|
||||
taskConnectWorkProcess = new Task(new Action(ConnWorker), ConnWorkCT);
|
||||
taskConnectWorkProcess.Start();
|
||||
//
|
||||
}
|
||||
|
||||
// TODO : FTP ALIS
|
||||
|
||||
@ -353,7 +353,7 @@ namespace SystemX.Net.XAdaptor.PC
|
||||
return bResult;
|
||||
}
|
||||
|
||||
public bool QueryTestList(uint nStationID, string strProdNo_C,
|
||||
private bool QueryTestList(uint nStationID, string strProdNo_C,
|
||||
string strTestType,
|
||||
string strTestCode,
|
||||
string strTestListVersion,
|
||||
@ -685,8 +685,14 @@ QUERY_TESTLIST:
|
||||
//
|
||||
eFileSendRecvResult sendrecvResult = eFileSendRecvResult.None;
|
||||
|
||||
string strSetBackupFilePos = strFilePos;
|
||||
string strSetBackupFileName = Path.GetFileName(strFilePos);
|
||||
|
||||
byte[] ucSetBackupFileData = null;
|
||||
|
||||
//TestListCntID
|
||||
string strGetCurrentTestListID = (mgrPRODTestList as TProdTestListInfo).GetTestListCntID();
|
||||
//(mgrPRODTestList as TProdTestListInfo).GetTestListCntID();
|
||||
string strGetCurrentTestListID = CurrentTestList().GetTestListCntID();
|
||||
|
||||
string strSetBackupInfo = targetStationName + ";" +
|
||||
targetTestListNo + ";" +
|
||||
@ -698,11 +704,6 @@ QUERY_TESTLIST:
|
||||
targetProdCode + ";" +
|
||||
strGetCurrentTestListID;
|
||||
|
||||
string strSetBackupFilePos = strFilePos;
|
||||
string strSetBackupFileName = Path.GetFileName(strFilePos);
|
||||
|
||||
byte[] ucSetBackupFileData = null;
|
||||
|
||||
//File Access Check
|
||||
Stopwatch stWaitSendTime = new Stopwatch();
|
||||
stWaitSendTime.Start();
|
||||
@ -809,6 +810,20 @@ QUERY_TESTLIST:
|
||||
}
|
||||
}
|
||||
|
||||
//TestListCntID
|
||||
//(mgrPRODTestList as TProdTestListInfo).GetTestListCntID();
|
||||
strGetCurrentTestListID = CurrentTestList().GetTestListCntID();
|
||||
|
||||
strSetBackupInfo = targetStationName + ";" +
|
||||
targetTestListNo + ";" +
|
||||
targetProcNo_P + ";" +
|
||||
targetProcNo_C + ";" +
|
||||
targetTestType + ";" +
|
||||
targetTestCode + ";" +
|
||||
targetVersion + ";" +
|
||||
targetProdCode + ";" +
|
||||
strGetCurrentTestListID;
|
||||
|
||||
thisConnInfo.OnStreamTime();
|
||||
|
||||
if (sendrecvResult == eFileSendRecvResult.None)
|
||||
@ -1102,7 +1117,7 @@ QUERY_TESTLIST:
|
||||
return sendrecvResult;
|
||||
}
|
||||
|
||||
public eFileSendRecvResult SendCustomFile(string strFilePos, bool bResultWait = false, ushort usPalletIndex = 0)
|
||||
private eFileSendRecvResult SendCustomFile(string strFilePos, bool bResultWait = false, ushort usPalletIndex = 0)
|
||||
{
|
||||
if (thisConnInfo.ConnectStreamState == false)
|
||||
return eFileSendRecvResult.StreamSocketNoConnect;
|
||||
|
||||
@ -250,6 +250,12 @@ namespace SystemX.Net.XAdaptor.PC
|
||||
case BASE_PROTOCOL.PROTOCOL_CODE.FILE_TRANSFER:
|
||||
{
|
||||
byte[] ucFileData = objData as byte[];
|
||||
|
||||
/*
|
||||
string strGetTestListCntID = getHeader.objVarParam1[0].Data;
|
||||
|
||||
QueryTestListProcess(ucFileData, strGetTestListCntID);
|
||||
*/
|
||||
}
|
||||
break;
|
||||
case BASE_PROTOCOL.PROTOCOL_CODE.TRANSFER_RESULT:
|
||||
@ -317,9 +323,15 @@ namespace SystemX.Net.XAdaptor.PC
|
||||
if (getHeader.usPalletIndex == ushort.MaxValue)
|
||||
{
|
||||
string strGetTestListCntID = getHeader.objVarParam1[0].Data;
|
||||
string strGetCallType = getHeader.objVarParam2[0].Data;
|
||||
|
||||
QueryTestListProcess(ucGetDatas, strGetTestListCntID);
|
||||
|
||||
if(strGetCallType.Contains("DOWNLOAD_TL"))
|
||||
QueryTestListProcess(ucGetDatas, strGetTestListCntID);
|
||||
else if (strGetCallType.Contains("CHECK_TL"))
|
||||
QueryTestListCheckProcess(ucGetDatas);
|
||||
else
|
||||
QueryTestListProcess(ucGetDatas, strGetTestListCntID);
|
||||
//
|
||||
//Task<int> tkProcTestlist = new Task<int>(new Func<int>(() => QueryTestListProcess(ucGetDatas).Result));
|
||||
//tkProcTestlist.Start();
|
||||
|
||||
|
||||
@ -26,6 +26,30 @@ namespace SystemX.Net.XAdaptor.PC
|
||||
{
|
||||
public partial class XAdaptorPC
|
||||
{
|
||||
private bool QueryTestListCheckProcess(byte[] ucGetDatas)
|
||||
{
|
||||
bool bSetResult = false;
|
||||
|
||||
try
|
||||
{
|
||||
DataSet QueryTestList = null;
|
||||
QueryTestList = XDataArchive.DecompressByteToDataset(ucGetDatas);
|
||||
|
||||
(mgrPRODTestList as TProdTestListInfo).SetTestListDataSetCopy(QueryTestList);
|
||||
}
|
||||
catch
|
||||
{
|
||||
bSetResult = false;
|
||||
}
|
||||
|
||||
finally
|
||||
{
|
||||
;//
|
||||
}
|
||||
|
||||
return bSetResult;
|
||||
}
|
||||
|
||||
private bool QueryTestListProcess(byte[] ucGetDatas, string strGetTestListCntID)
|
||||
{
|
||||
bool bSetResult = false;
|
||||
@ -35,8 +59,8 @@ namespace SystemX.Net.XAdaptor.PC
|
||||
DataSet QueryTestList = null;
|
||||
QueryTestList = XDataArchive.DecompressByteToDataset(ucGetDatas);
|
||||
|
||||
(mgrPRODTestList as TProdTestListInfo).SetTestListDataSet(QueryTestList);
|
||||
(mgrPRODTestList as TProdTestListInfo).SetTestListCntID(strGetTestListCntID);
|
||||
(mgrPRODTestList as TProdTestListInfo).SetTestListDataSetCopy(QueryTestList);
|
||||
(mgrPRODTestList as TProdTestListInfo).SetTestListDataSet();
|
||||
|
||||
if (XCommons.isHasRow(mgrPRODTestList.getTestListDataSet()))
|
||||
{
|
||||
@ -50,6 +74,9 @@ namespace SystemX.Net.XAdaptor.PC
|
||||
int iCol2 = mgrPRODTestList.getTestListDataSet().Tables[0].Columns.IndexOf("FileName");
|
||||
}
|
||||
|
||||
if(string.IsNullOrEmpty(strGetTestListCntID) == false)
|
||||
(mgrPRODTestList as TProdTestListInfo).SetTestListCntID(strGetTestListCntID);
|
||||
|
||||
bSetResult = true;
|
||||
}
|
||||
|
||||
@ -184,7 +211,7 @@ namespace SystemX.Net.XAdaptor.PC
|
||||
|
||||
if (bUseRandDistribution)
|
||||
{
|
||||
Random r = new Random((int)(DateTime.Now.Ticks));
|
||||
Random r = new Random(Guid.NewGuid().GetHashCode());
|
||||
|
||||
nPortNumber = GetDistributionPort(r, nPortNumber);
|
||||
}
|
||||
@ -246,7 +273,7 @@ namespace SystemX.Net.XAdaptor.PC
|
||||
|
||||
if (bUseRandDistribution)
|
||||
{
|
||||
Random r = new Random((int)(DateTime.Now.Ticks));
|
||||
Random r = new Random(Guid.NewGuid().GetHashCode());
|
||||
|
||||
nPortNumber = GetDistributionPort(r, nPortNumber);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user