[성현모] CPXV2 Init
@ -0,0 +1,32 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.30225.117
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SystemX.Net.CP.Middleware.PD", "SystemX.Net.Middleware.UI\SystemX.Net.CP.Middleware.PD.csproj", "{3658FBE5-9A84-4F76-8E19-867DB9F4484D}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{3658FBE5-9A84-4F76-8E19-867DB9F4484D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3658FBE5-9A84-4F76-8E19-867DB9F4484D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3658FBE5-9A84-4F76-8E19-867DB9F4484D}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{3658FBE5-9A84-4F76-8E19-867DB9F4484D}.Debug|x64.Build.0 = Debug|x64
|
||||
{3658FBE5-9A84-4F76-8E19-867DB9F4484D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3658FBE5-9A84-4F76-8E19-867DB9F4484D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{3658FBE5-9A84-4F76-8E19-867DB9F4484D}.Release|x64.ActiveCfg = Release|x64
|
||||
{3658FBE5-9A84-4F76-8E19-867DB9F4484D}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
VisualSVNWorkingCopyRoot = .
|
||||
SolutionGuid = {68CD108D-837F-47FF-A153-70C328D18A84}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
After Width: | Height: | Size: 34 KiB |
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System">
|
||||
<section name="DevExpress.LookAndFeel.Design.AppSettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<applicationSettings>
|
||||
<DevExpress.LookAndFeel.Design.AppSettings>
|
||||
<setting name="DPIAwarenessMode" serializeAs="String">
|
||||
<value>System</value>
|
||||
</setting>
|
||||
</DevExpress.LookAndFeel.Design.AppSettings>
|
||||
</applicationSettings>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||
</startup>
|
||||
</configuration>
|
||||
@ -0,0 +1,564 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using System.Data;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Net.Sockets;
|
||||
using System.Globalization;
|
||||
using System.Threading;
|
||||
using System.Diagnostics;
|
||||
using System.Net;
|
||||
|
||||
using SystemX.Net.BaseProtocol;
|
||||
|
||||
namespace SystemX.Net.Middleware.Commons
|
||||
{
|
||||
|
||||
public static class COMMON
|
||||
{
|
||||
[DllImport("winmm.dll")]
|
||||
public static extern uint timeGetTime();
|
||||
|
||||
public const string Png = "PNG Portable Network Graphics (*.png)|" + "*.png";
|
||||
public const string Jpg = "JPEG File Interchange Format (*.jpg *.jpeg *jfif)|" + "*.jpg;*.jpeg;*.jfif";
|
||||
public const string Bmp = "BMP Windows Bitmap (*.bmp)|" + "*.bmp";
|
||||
public const string Tif = "TIF Tagged Imaged File Format (*.tif *.tiff)|" + "*.tif;*.tiff";
|
||||
public const string Gif = "GIF Graphics Interchange Format (*.gif)|" + "*.gif";
|
||||
public const string AllImages = "Image file|" + "*.png; *.jpg; *.jpeg; *.jfif; *.bmp;*.tif; *.tiff; *.gif";
|
||||
public const string AllFiles = "All files (*.*)" + "|*.*";
|
||||
|
||||
public static string[] mediaExtensions = {
|
||||
".PNG", ".JPG", ".JPEG", ".BMP", ".GIF", //etc
|
||||
".WAV", ".MID", ".MIDI", ".WMA", ".MP3", ".OGG", ".RMA", //etc
|
||||
".AVI", ".MP4", ".DIVX", ".WMV", //etc
|
||||
};
|
||||
|
||||
public static DataTable ConvertCSVtoDataTable(string strFilePath, string strSetHeader)
|
||||
{
|
||||
DataTable dt = null;
|
||||
try
|
||||
{
|
||||
using (StreamReader sr = new StreamReader(strFilePath))
|
||||
{
|
||||
string[] headers = null;
|
||||
|
||||
if(strSetHeader.Length > 0)
|
||||
headers = strSetHeader.Split(',');
|
||||
else
|
||||
headers = sr.ReadLine().Split(',');
|
||||
|
||||
dt = new DataTable();
|
||||
foreach (string header in headers)
|
||||
{
|
||||
dt.Columns.Add(header);
|
||||
}
|
||||
while (!sr.EndOfStream)
|
||||
{
|
||||
string strReadData = sr.ReadLine().Trim();
|
||||
if (strReadData.Length <= 0)
|
||||
break;
|
||||
|
||||
string[] rows = Regex.Split(strReadData, ",(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)");
|
||||
DataRow dr = dt.NewRow();
|
||||
for (int i = 0; i < headers.Length; i++)
|
||||
{
|
||||
dr[i] = rows[i];
|
||||
}
|
||||
dt.Rows.Add(dr);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
dt = null;
|
||||
}
|
||||
|
||||
return dt;
|
||||
}
|
||||
|
||||
public static T ConvertTextToTryValue<T>(string strText, object objFailValue)
|
||||
{
|
||||
object obj;
|
||||
obj = typeof(T);
|
||||
|
||||
int iGetValue = 0;
|
||||
uint uiGetValue = 0;
|
||||
double dGetValue = 0;
|
||||
|
||||
if (obj.ToString().IndexOf("Int") >= 0)
|
||||
{
|
||||
if (!int.TryParse(strText, out iGetValue))
|
||||
obj = objFailValue;
|
||||
else
|
||||
obj = iGetValue;
|
||||
}
|
||||
if (obj.ToString().IndexOf("UInt") >= 0)
|
||||
{
|
||||
if (!uint.TryParse(strText, out uiGetValue))
|
||||
obj = objFailValue;
|
||||
else
|
||||
obj = uiGetValue;
|
||||
}
|
||||
else if (obj.ToString().IndexOf("Double") >= 0)
|
||||
{
|
||||
if (!double.TryParse(strText, out dGetValue))
|
||||
obj = objFailValue;
|
||||
else
|
||||
obj = dGetValue;
|
||||
}
|
||||
|
||||
return (T)Convert.ChangeType(obj, typeof(T));
|
||||
}
|
||||
|
||||
public static T FindByName<T>(this object targetClass, string name) where T : class
|
||||
{
|
||||
System.Reflection.FieldInfo fi = targetClass.GetType().GetField(name, System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
|
||||
|
||||
return fi.GetValue(targetClass) as T;
|
||||
}
|
||||
public static T FindByName<T>(this string name, object targetClass) where T : class
|
||||
{
|
||||
System.Reflection.FieldInfo fi = targetClass.GetType().GetField(name, System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
|
||||
|
||||
return fi.GetValue(targetClass) as T;
|
||||
}
|
||||
|
||||
[DllImport("KERNEL32.DLL", EntryPoint = "RtlZeroMemory")]
|
||||
public static extern bool ZeroMemory(IntPtr Destination, int Length);
|
||||
|
||||
public static string GenerateKey()
|
||||
{
|
||||
// Create an instance of Symetric Algorithm. Key and IV is generated automatically.
|
||||
DESCryptoServiceProvider desCrypto = (DESCryptoServiceProvider)DESCryptoServiceProvider.Create();
|
||||
|
||||
// Use the Automatically generated key for Encryption.
|
||||
return ASCIIEncoding.ASCII.GetString(desCrypto.Key);
|
||||
}
|
||||
public static void EncryptFile(string sInputFilename,
|
||||
string sOutputFilename,
|
||||
string sKey)
|
||||
{
|
||||
FileStream fsInput = new FileStream(sInputFilename,
|
||||
FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
FileStream fsEncrypted = new FileStream(sOutputFilename,
|
||||
FileMode.Create,
|
||||
FileAccess.Write);
|
||||
DESCryptoServiceProvider DES = new DESCryptoServiceProvider();
|
||||
DES.Key = ASCIIEncoding.ASCII.GetBytes(sKey);
|
||||
DES.IV = ASCIIEncoding.ASCII.GetBytes(sKey);
|
||||
ICryptoTransform desencrypt = DES.CreateEncryptor();
|
||||
CryptoStream cryptostream = new CryptoStream(fsEncrypted,
|
||||
desencrypt,
|
||||
CryptoStreamMode.Write);
|
||||
|
||||
byte[] bytearrayinput = new byte[fsInput.Length];
|
||||
fsInput.Read(bytearrayinput, 0, bytearrayinput.Length);
|
||||
cryptostream.Write(bytearrayinput, 0, bytearrayinput.Length);
|
||||
cryptostream.Close();
|
||||
fsInput.Close();
|
||||
fsEncrypted.Close();
|
||||
}
|
||||
|
||||
public static void DecryptFile(string sInputFilename,
|
||||
string sOutputFilename,
|
||||
string sKey)
|
||||
{
|
||||
DESCryptoServiceProvider DES = new DESCryptoServiceProvider();
|
||||
//A 64 bit key and IV is required for this provider.
|
||||
//Set secret key For DES algorithm.
|
||||
DES.Key = ASCIIEncoding.ASCII.GetBytes(sKey);
|
||||
//Set initialization vector.
|
||||
DES.IV = ASCIIEncoding.ASCII.GetBytes(sKey);
|
||||
|
||||
//Create a file stream to read the encrypted file back.
|
||||
FileStream fsread = new FileStream(sInputFilename,
|
||||
FileMode.Open,
|
||||
FileAccess.Read);
|
||||
//Create a DES decryptor from the DES instance.
|
||||
ICryptoTransform desdecrypt = DES.CreateDecryptor();
|
||||
//Create crypto stream set to read and do a
|
||||
//DES decryption transform on incoming bytes.
|
||||
CryptoStream cryptostreamDecr = new CryptoStream(fsread,
|
||||
desdecrypt,
|
||||
CryptoStreamMode.Read);
|
||||
//Print the contents of the decrypted file.
|
||||
StreamWriter fsDecrypted = new StreamWriter(sOutputFilename);
|
||||
fsDecrypted.Write(new StreamReader(cryptostreamDecr).ReadToEnd());
|
||||
fsDecrypted.Flush();
|
||||
fsDecrypted.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public class MngConnectionPool
|
||||
{
|
||||
public int nNumber { set; get; }
|
||||
public bool bUseState { set; get; }
|
||||
public bool bLastConnState { set; get; }
|
||||
public int nUseCommandPort { set; get; }
|
||||
public int nUseStreamPort { set; get; }
|
||||
public bool bRequiredPortReset { set; get; }
|
||||
|
||||
public bool bRequiredPortResetReady { set; get; }
|
||||
|
||||
public Stopwatch stPortTimer { set; get; }
|
||||
public Stopwatch stConnWaitTimer { set; get; }
|
||||
|
||||
public MngConnectionPool(int nPos)
|
||||
{
|
||||
nNumber = nPos;
|
||||
|
||||
bUseState = false;
|
||||
|
||||
bLastConnState = false;
|
||||
|
||||
nUseCommandPort = 0;
|
||||
|
||||
nUseStreamPort = 0;
|
||||
|
||||
bRequiredPortReset = false;
|
||||
|
||||
bRequiredPortResetReady = false;
|
||||
|
||||
stPortTimer = new Stopwatch();
|
||||
stPortTimer.Start();
|
||||
|
||||
stConnWaitTimer = new Stopwatch();
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
bUseState = false;
|
||||
|
||||
bLastConnState = false;
|
||||
|
||||
PortTImerRestart();
|
||||
}
|
||||
|
||||
public void PortTImerRestart()
|
||||
{
|
||||
stPortTimer.Restart();
|
||||
}
|
||||
|
||||
public void ConnWaitTimerStart()
|
||||
{
|
||||
if (stConnWaitTimer.IsRunning)
|
||||
stConnWaitTimer.Restart();
|
||||
else
|
||||
stConnWaitTimer.Start();
|
||||
}
|
||||
|
||||
public void ConnWaitTimerStop()
|
||||
{
|
||||
stConnWaitTimer.Stop();
|
||||
}
|
||||
|
||||
public void ConnWaitTimerReset()
|
||||
{
|
||||
stConnWaitTimer.Reset();
|
||||
}
|
||||
|
||||
public long ConnWaitTime()
|
||||
{
|
||||
return stConnWaitTimer.ElapsedMilliseconds;
|
||||
}
|
||||
}
|
||||
|
||||
public delegate void stCallBackDelegate();
|
||||
|
||||
public static class TimeControl
|
||||
{
|
||||
[DllImport("kernel32.dll", SetLastError = true)]
|
||||
public static extern bool SetSystemTime(ref SYSTEMTIME st);
|
||||
|
||||
[DllImport("kernel32.dll", SetLastError = true)]
|
||||
public static extern bool SetLocalTime(ref SYSTEMTIME st);
|
||||
|
||||
private static SYSTEMTIME dtTimeSystem = new SYSTEMTIME();
|
||||
|
||||
private static bool bSuccessSyncTime;
|
||||
|
||||
public static bool SyncServerTimeResult { get { return bSuccessSyncTime; } }
|
||||
|
||||
//ScheduledTimer
|
||||
private static Timer _Timer;
|
||||
|
||||
private static ServerInfo ServerLoadInfo;
|
||||
|
||||
public static void _WorkTimer()
|
||||
{
|
||||
//TimeSync 시도
|
||||
DoSyncTime(ServerLoadInfo);
|
||||
}
|
||||
|
||||
private static TimeSpan GetDueTime(TimeSpan A, TimeSpan B)
|
||||
{
|
||||
if (A < B)
|
||||
{
|
||||
return B.Subtract(A);
|
||||
}
|
||||
else
|
||||
{
|
||||
//return new TimeSpan(24, 0, 0).Subtract(B.Subtract(A));
|
||||
return new TimeSpan(24, 0, 0).Subtract(A.Subtract(B));
|
||||
}
|
||||
}
|
||||
|
||||
private static void SetTime(TimeSpan _time, stCallBackDelegate callback)
|
||||
{
|
||||
if (_Timer != null)
|
||||
{
|
||||
// Change 매서드 사용 가능.
|
||||
_Timer.Dispose();
|
||||
}
|
||||
|
||||
TimeSpan Now = DateTime.Now.TimeOfDay;
|
||||
TimeSpan DueTime = GetDueTime(Now, _time);
|
||||
|
||||
_Timer = new Timer(new TimerCallback(delegate (object _callback)
|
||||
{
|
||||
((stCallBackDelegate)_callback)();
|
||||
}), callback, DueTime, new TimeSpan(24, 0, 0));
|
||||
}
|
||||
|
||||
public static bool GetSyncTime(ref SYSTEMTIME refSyncTime)
|
||||
{
|
||||
var localDateTime = DateTime.Now.ToLocalTime();
|
||||
|
||||
refSyncTime = new SYSTEMTIME();
|
||||
refSyncTime.wYear = (short)localDateTime.Year;
|
||||
refSyncTime.wMonth = (short)localDateTime.Month;
|
||||
refSyncTime.wDay = (short)localDateTime.Day;
|
||||
refSyncTime.wHour = (short)localDateTime.Hour;
|
||||
refSyncTime.wMinute = (short)localDateTime.Minute;
|
||||
refSyncTime.wSecond = (short)localDateTime.Second;
|
||||
refSyncTime.wMilliseconds = (short)localDateTime.Millisecond;
|
||||
|
||||
return bSuccessSyncTime;
|
||||
}
|
||||
|
||||
public static void DoSyncTime(ServerInfo GetLoadInfo)
|
||||
{
|
||||
ServerLoadInfo = GetLoadInfo;
|
||||
|
||||
Task.Run(() => Work());
|
||||
}
|
||||
|
||||
private static async void Work()
|
||||
{
|
||||
await GetTimeServerDateTime();
|
||||
}
|
||||
|
||||
private static async Task<bool> GetTimeServerDateTime()
|
||||
{
|
||||
var currentProcess = Process.GetCurrentProcess();
|
||||
//Console.WriteLine(currentProcess.Id);
|
||||
|
||||
/*
|
||||
Win32.TokenPrivileges
|
||||
; https://github.com/trondr/Win32.TokenPrivileges
|
||||
*/
|
||||
|
||||
int nCnt = 0;
|
||||
|
||||
bSuccessSyncTime = false;
|
||||
|
||||
SetTime(new TimeSpan(ServerLoadInfo.TimeServerSyncTimeHour,
|
||||
ServerLoadInfo.TimeServerSyncTimeMinute,
|
||||
ServerLoadInfo.TimeServerSyncTimeSecond), _WorkTimer);
|
||||
|
||||
/*SetTime(new TimeSpan(16,
|
||||
37,
|
||||
0), _WorkTimer);*/
|
||||
|
||||
while (true)
|
||||
{
|
||||
string responseText = string.Empty;
|
||||
|
||||
if (nCnt > 3)
|
||||
break;
|
||||
|
||||
try
|
||||
{
|
||||
string strHostName = string.Empty;
|
||||
int nPortNumber = int.MinValue;
|
||||
|
||||
strHostName = ServerLoadInfo.SyncTimeServerAddress;
|
||||
nPortNumber = ServerLoadInfo.SyncTimeServerPort;
|
||||
|
||||
if (nPortNumber == int.MinValue)
|
||||
nPortNumber = 123;
|
||||
|
||||
if (strHostName.Length <= 0)
|
||||
throw new Exception("Time server access address not specified.");
|
||||
|
||||
//default Windows time server
|
||||
//{52.231.114.183}
|
||||
//const string ntpServer = "time.windows.com";
|
||||
|
||||
// NTP message size - 16 bytes of the digest (RFC 2030)
|
||||
var ntpData = new byte[48];
|
||||
|
||||
//Setting the Leap Indicator, Version Number and Mode values
|
||||
ntpData[0] = 0x1B; //LI = 0 (no warning), VN = 3 (IPv4 only), Mode = 3 (Client Mode)
|
||||
|
||||
//var addresses = Dns.GetHostEntry(ntpServer).AddressList;
|
||||
|
||||
IPAddress SetAddress;
|
||||
IPAddress.TryParse(strHostName, out SetAddress);
|
||||
|
||||
//The UDP port number assigned to NTP is 123
|
||||
var ipEndPoint = new IPEndPoint(SetAddress, 123);
|
||||
//var ipEndPoint = new IPEndPoint(addresses[1], 123);
|
||||
//NTP uses UDP
|
||||
|
||||
await Task.Delay(5000);
|
||||
|
||||
using (var socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp))
|
||||
{
|
||||
socket.Connect(ipEndPoint);
|
||||
|
||||
//Stops code hang if NTP is blocked
|
||||
socket.ReceiveTimeout = 5000;
|
||||
|
||||
socket.Send(ntpData);
|
||||
socket.Receive(ntpData);
|
||||
socket.Close();
|
||||
}
|
||||
|
||||
ulong intPart = (ulong)ntpData[40] << 24 | (ulong)ntpData[41] << 16 | (ulong)ntpData[42] << 8 | (ulong)ntpData[43];
|
||||
ulong fractPart = (ulong)ntpData[44] << 24 | (ulong)ntpData[45] << 16 | (ulong)ntpData[46] << 8 | (ulong)ntpData[47];
|
||||
|
||||
var milliseconds = (intPart * 1000) + ((fractPart * 1000) / 0x100000000L);
|
||||
var networkDateTime = (new DateTime(1900, 1, 1)).AddMilliseconds((long)milliseconds);
|
||||
|
||||
var localDateTime = networkDateTime.ToLocalTime();
|
||||
|
||||
//pc에 적용하기
|
||||
dtTimeSystem = new SYSTEMTIME();
|
||||
dtTimeSystem.wYear = (short)localDateTime.Year;
|
||||
dtTimeSystem.wMonth = (short)localDateTime.Month;
|
||||
dtTimeSystem.wDay = (short)localDateTime.Day;
|
||||
dtTimeSystem.wHour = (short)localDateTime.Hour;
|
||||
dtTimeSystem.wMinute = (short)localDateTime.Minute;
|
||||
dtTimeSystem.wSecond = (short)localDateTime.Second;
|
||||
dtTimeSystem.wMilliseconds = (short)localDateTime.Millisecond;
|
||||
|
||||
bool SetResult = false;
|
||||
int lastError = 0;
|
||||
|
||||
try
|
||||
{
|
||||
SetResult = SetLocalTime(ref dtTimeSystem);
|
||||
if (SetResult == false)
|
||||
{
|
||||
lastError = Marshal.GetLastWin32Error();
|
||||
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine("Exception: " + e.Message + " (" + lastError + ")");
|
||||
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
if (SetResult)
|
||||
{
|
||||
Console.WriteLine($"Response: {responseText}, DateTime: {localDateTime}");
|
||||
|
||||
bSuccessSyncTime = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
||||
/*IPAddress SetAddress;
|
||||
IPAddress.TryParse(strHostName, out SetAddress);
|
||||
IPEndPoint SetIpEndPoint = new IPEndPoint(SetAddress, nPortNumber);
|
||||
|
||||
//37 //13 //123
|
||||
//using (var client = new TcpClient(strHostName, nPortNumber))
|
||||
//using (var client = new TcpClient(SetIpEndPoint))
|
||||
using (var streamReader = new StreamReader(client.GetStream()))
|
||||
{
|
||||
await Task.Delay(5000);
|
||||
|
||||
//시간 불러오기
|
||||
responseText = streamReader.ReadToEnd(); // "59442 21-08-16 14:28:19 50 0 0 585.3 UTC(NIST) *"
|
||||
var utcDateTimeString = responseText.Substring(7, 17);
|
||||
|
||||
if (DateTime.TryParseExact(utcDateTimeString, "yy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal, out DateTime utcDateTime) == false)
|
||||
{
|
||||
Console.WriteLine("[ " + nCnt.ToString("D10") + " ] " + responseText);
|
||||
|
||||
//continue;
|
||||
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
var localDateTime = utcDateTime.ToLocalTime();
|
||||
//var systemDateTime = utcDateTime.SetSystemTime();
|
||||
|
||||
//pc에 적용하기
|
||||
dtTimeSystem = new SYSTEMTIME();
|
||||
dtTimeSystem.wYear = (short)localDateTime.Year;
|
||||
dtTimeSystem.wMonth = (short)localDateTime.Month;
|
||||
dtTimeSystem.wDay = (short)localDateTime.Day;
|
||||
dtTimeSystem.wHour = (short)localDateTime.Hour;
|
||||
dtTimeSystem.wMinute = (short)localDateTime.Minute;
|
||||
dtTimeSystem.wSecond = (short)localDateTime.Second;
|
||||
dtTimeSystem.wMilliseconds = (short)localDateTime.Millisecond;
|
||||
|
||||
bool SetResult = false;
|
||||
int lastError = 0;
|
||||
|
||||
try
|
||||
{
|
||||
SetResult = SetLocalTime(ref dtTimeSystem);
|
||||
if (SetResult == false)
|
||||
{
|
||||
lastError = Marshal.GetLastWin32Error();
|
||||
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine("Exception: " + e.Message + " (" + lastError + ")");
|
||||
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
if (SetResult)
|
||||
{
|
||||
Console.WriteLine($"Response: {responseText}, DateTime: {localDateTime}");
|
||||
|
||||
bSuccessSyncTime = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}*/
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine("Exception: " + e.Message + " (" + responseText + ")");
|
||||
|
||||
nCnt++;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,933 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml.Linq;
|
||||
using SystemX.Net;
|
||||
using SystemX.Net.BaseProtocol;
|
||||
using SystemX.Net.DB;
|
||||
|
||||
using CpTesterPlatform.CpLogUtil;
|
||||
|
||||
using static SystemX.Net.Platform.Common.Util.LogMessage;
|
||||
using static SystemX.Net.DB.XDBConnManager;
|
||||
|
||||
namespace SystemX.Common.Log.LSU
|
||||
{
|
||||
public class AnalysisLog_LSU : IDisposable
|
||||
{
|
||||
public bool STATE { set; get; }
|
||||
|
||||
//DataBase
|
||||
private XDBConnManager MngDBConn;
|
||||
//QueryInfo
|
||||
public LogProcessInfo_LSU qiLogProcessInfo;
|
||||
//Log Scan Process Task
|
||||
private Task taskScanProcess;
|
||||
|
||||
private bool m_bTaskBlock;
|
||||
//
|
||||
private Stopwatch stProcessTime;
|
||||
|
||||
private long lLastProcessTime;
|
||||
private long lLastItemTime;
|
||||
private long lLastProcessNum;
|
||||
|
||||
private CancellationTokenSource cts;
|
||||
|
||||
public int SET_LOG_PROC_POS { set; get; }
|
||||
public int SET_LOG_DELETE_MANAGE_POS { set; get; }
|
||||
|
||||
public int SET_LOG_SCAN_SHIFT_TIME { set; get; }
|
||||
public int SET_LOG_MANAGE_SCAN_TIME { set; get; }
|
||||
//
|
||||
private string strLogDataFilePath { set; get; }
|
||||
private eLogDataType eGetLogDataType { set; get; }
|
||||
private eLogAccessType eGetAccessType { set; get; }
|
||||
private CpLogHeader getCpLogHeader;
|
||||
//
|
||||
public bool[] LOG_DATA_CHECK_STATE { set; get; }
|
||||
|
||||
public int[] PROC_NO_LIST;
|
||||
|
||||
public long GET_LAST_PROCESS_TIME()
|
||||
{
|
||||
return lLastProcessTime;
|
||||
}
|
||||
public long GET_LAST_PROCESS_NUM()
|
||||
{
|
||||
return lLastProcessNum;
|
||||
}
|
||||
public long GET_LAST_ITEM_TIME()
|
||||
{
|
||||
return lLastItemTime;
|
||||
}
|
||||
|
||||
~AnalysisLog_LSU()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
public AnalysisLog_LSU()
|
||||
{
|
||||
STATE = true;
|
||||
|
||||
//Proc Position
|
||||
SET_LOG_PROC_POS = 0;
|
||||
SET_LOG_DELETE_MANAGE_POS = 0;
|
||||
|
||||
//1초 마다 미 처리 로그 스캔
|
||||
SET_LOG_SCAN_SHIFT_TIME = 500;
|
||||
|
||||
//24시간 마다 삭제 대상 데이터 스캔
|
||||
SET_LOG_MANAGE_SCAN_TIME = 86400000;
|
||||
|
||||
//PROC NO LIST
|
||||
PROC_NO_LIST = new int[10];
|
||||
PROC_NO_LIST[0] = 180; //PL, CDA
|
||||
PROC_NO_LIST[1] = 190; //PH, PM
|
||||
PROC_NO_LIST[2] = 200; //LK,
|
||||
PROC_NO_LIST[3] = 210; //LT
|
||||
PROC_NO_LIST[4] = 220; //LTV, IR
|
||||
PROC_NO_LIST[5] = 230; //CA
|
||||
PROC_NO_LIST[6] = 240; //FT
|
||||
PROC_NO_LIST[7] = 250; //OSP
|
||||
PROC_NO_LIST[8] = 260; //PV, LVDT
|
||||
PROC_NO_LIST[9] = 270; //UL
|
||||
|
||||
//Unused
|
||||
//PROC_NO_LIST[10] = 280; //GD
|
||||
//PROC_NO_LIST[11] = 290; //P
|
||||
|
||||
XLogDataControl_.SetLogFieldInfo();
|
||||
|
||||
stProcessTime = new Stopwatch();
|
||||
stProcessTime.Start();
|
||||
|
||||
lLastProcessTime = 0;
|
||||
lLastItemTime = 0;
|
||||
|
||||
lLastProcessNum = 0;
|
||||
|
||||
MessageOutput.PrintLogLevel = LogMessageLevel.INFO;
|
||||
|
||||
string strExcutePos = Environment.CurrentDirectory;
|
||||
string strDBInfoPos = strExcutePos + @"\Configure\DBConnInfo.xml";
|
||||
string strQueryInfoPos = strExcutePos + @"\Configure\LogProcessInfo.xml";
|
||||
|
||||
qiLogProcessInfo = new LogProcessInfo_LSU(strQueryInfoPos);
|
||||
if (qiLogProcessInfo.Load())
|
||||
{
|
||||
LOG_DATA_CHECK_STATE = new bool[qiLogProcessInfo.GeManageInfo().Count()];
|
||||
for (int i = 0; i < qiLogProcessInfo.GeManageInfo().Count(); i++)
|
||||
LOG_DATA_CHECK_STATE[i] = true;
|
||||
|
||||
MngDBConn = new XDBConnManager();
|
||||
MngDBConn.ConfigPath = strDBInfoPos;
|
||||
|
||||
if (MngDBConn.OpenConnection())
|
||||
{
|
||||
/*
|
||||
taskScanProcess = null;
|
||||
m_bTaskBlock = false;
|
||||
|
||||
cts = new CancellationTokenSource();
|
||||
taskScanProcess = new Task(new Action<object>(WatchResultTable), cts.Token);
|
||||
taskScanProcess.Start();
|
||||
*/
|
||||
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @" Success to connect to DB. [SystemX.Common.Protocol.Log.LSU_Trimming_4Th : AnalysisLog_.AnalysisLog_]", ConsoleColor.White, LogMessageLevel.DEBUG);
|
||||
}
|
||||
else
|
||||
{
|
||||
STATE = false;
|
||||
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @" Failed to connect to DB. [SystemX.Common.Protocol.Log.LSU_Trimming_4Th : AnalysisLog_.AnalysisLog_]", ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
STATE = false;
|
||||
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @" Read to configure failed. [SystemX.Common.Protocol.Log.LSU_Trimming_4Th : AnalysisLog_.AnalysisLog_]", ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
}
|
||||
protected virtual void Dispose(bool bDisposing)
|
||||
{
|
||||
if (bDisposing)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if (taskScanProcess != null)
|
||||
{
|
||||
cts.Cancel();
|
||||
|
||||
taskScanProcess.Wait();
|
||||
|
||||
m_bTaskBlock = true;
|
||||
}
|
||||
|
||||
// do releasing unmanaged resource (종결자가 없는 객체의 자원 해제)
|
||||
// i.e. close file handle of operating systems
|
||||
|
||||
// suppress calling of Finalizer
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
private DataSet QueryProcess(string strGetQuery, ref bool bResult)//, out byte[] ucQueryByteArray)
|
||||
{
|
||||
bResult = false;
|
||||
|
||||
SqlDataReader xSqlReader = null;
|
||||
|
||||
DataSet ds = new DataSet();
|
||||
DataTable dt = new DataTable();
|
||||
|
||||
int iFieldCnt = 0;
|
||||
int iRecordsAffectedCnt = 0;
|
||||
bool bHasRow = false;
|
||||
|
||||
//ucQueryByteArray = null;
|
||||
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
xSqlReader = MngDBConn.QueryDatabase(eConnCategory.Main, strGetQuery);
|
||||
|
||||
if (xSqlReader != null)
|
||||
{
|
||||
iFieldCnt = xSqlReader.FieldCount;
|
||||
iRecordsAffectedCnt = xSqlReader.RecordsAffected;
|
||||
bHasRow = xSqlReader.HasRows;
|
||||
|
||||
dt.Load(xSqlReader);
|
||||
ds.Tables.Add(dt);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
xSqlReader = null;
|
||||
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"<" + strGetQuery + "> Query process fail![SystemX.Net.Platform.Log : AnalysisLog_.QueryProcess]\r\n" + ex.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (xSqlReader != null)
|
||||
xSqlReader.Close();
|
||||
}
|
||||
|
||||
if (iFieldCnt > 0 || iRecordsAffectedCnt > 0 || bHasRow == true)
|
||||
bResult = true;
|
||||
|
||||
return ds;
|
||||
}
|
||||
private async void WatchResultTable(object objState)
|
||||
{
|
||||
CancellationToken token = (CancellationToken)objState;
|
||||
|
||||
Stopwatch stLogScanTimer = new Stopwatch();
|
||||
stLogScanTimer.Start();
|
||||
Stopwatch stLogManageTimer = new Stopwatch();
|
||||
stLogManageTimer.Start();
|
||||
|
||||
while (!m_bTaskBlock)
|
||||
{
|
||||
if (token.IsCancellationRequested)
|
||||
break;
|
||||
|
||||
try
|
||||
{
|
||||
if (stLogScanTimer.ElapsedMilliseconds >= SET_LOG_SCAN_SHIFT_TIME)
|
||||
{
|
||||
int[] iGetLogNo = QueryStatusResultTable(PROC_NO_LIST[SET_LOG_PROC_POS], token);
|
||||
|
||||
if (iGetLogNo != null)
|
||||
{
|
||||
bool bResult = QueryInfoResultTable(PROC_NO_LIST[SET_LOG_PROC_POS], token, iGetLogNo);
|
||||
}
|
||||
|
||||
SET_LOG_PROC_POS++;
|
||||
|
||||
if (PROC_NO_LIST.Length <= SET_LOG_PROC_POS)
|
||||
SET_LOG_PROC_POS = 0;
|
||||
|
||||
stLogScanTimer.Restart();
|
||||
}
|
||||
if ((stLogManageTimer.ElapsedMilliseconds >= SET_LOG_MANAGE_SCAN_TIME))
|
||||
{
|
||||
//LOG_DATA_CHECK_STATE = false;
|
||||
|
||||
if (qiLogProcessInfo.USE_TABLE_DATA_DELETE_MANAGER)
|
||||
{
|
||||
foreach (KeyValuePair<int, Tuple<bool, string, int>> infoM in qiLogProcessInfo.GeManageInfo())
|
||||
{
|
||||
if (infoM.Value.Item1)
|
||||
{
|
||||
int[] iGetDeleteNo = QueryManageDateTable(infoM.Value.Item2, infoM.Value.Item3.ToString(), token);
|
||||
|
||||
if (iGetDeleteNo != null)
|
||||
{
|
||||
ManageTableDataDelete(iGetDeleteNo, infoM.Value.Item2, infoM.Value.Item3.ToString(), token);
|
||||
}
|
||||
|
||||
iGetDeleteNo = QueryManageDateTable(infoM.Value.Item2, infoM.Value.Item3.ToString(), token);
|
||||
|
||||
//if (iGetDeleteNo != null)
|
||||
// LOG_DATA_CHECK_STATE = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stLogManageTimer.Restart();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"General Queue Process failed.[SystemX.Common.Protocol.Log.LSU_Trimming_4Th : AnalysisLog_LSU.WatchResultTable]\r\n" + ex.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
|
||||
await Task.Delay(1);
|
||||
}
|
||||
}
|
||||
public int[] QueryManageDateTable(string strTableName, string strDateDiff, CancellationToken token)
|
||||
{
|
||||
bool bGetQueryResult = false;
|
||||
|
||||
int[] iQueryNoArr = null;
|
||||
|
||||
DataSet ds = QueryProcess("SELECT TOP(100) * FROM [" + strTableName + "] WHERE No " +
|
||||
"IN(SELECT No FROM [" + strTableName + "] WHERE " +
|
||||
"CONVERT(VARCHAR(8), UpdateDT, 112) <= CONVERT(VARCHAR(8), GETDATE() - " + strDateDiff + ", 112)) ORDER BY No;", ref bGetQueryResult);
|
||||
|
||||
bool hasRows = XCommons.isHasRow(ds);
|
||||
|
||||
if (hasRows)
|
||||
{
|
||||
int iRowNum = ds.Tables[0].Rows.Count;
|
||||
|
||||
iQueryNoArr = new int[iRowNum];
|
||||
Array.Clear(iQueryNoArr, 0, iQueryNoArr.Length);
|
||||
|
||||
for (int i = 0; i < iRowNum; i++)
|
||||
{
|
||||
if (token.IsCancellationRequested)
|
||||
return null;
|
||||
|
||||
var getValue = ds.Tables[0].Rows[i]["No"];
|
||||
|
||||
iQueryNoArr[i] = int.Parse(getValue.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
stProcessTime.Restart();
|
||||
|
||||
return iQueryNoArr;
|
||||
}
|
||||
public bool ManageTableDataDelete(int[] iGetNoArray, string strTableName, string strDateDiff, CancellationToken token)
|
||||
{
|
||||
bool bGetQueryResult = false;
|
||||
|
||||
bool bFindItem = false;
|
||||
long lDataNum = 0;
|
||||
|
||||
foreach (int iGetNo in iGetNoArray)
|
||||
{
|
||||
bFindItem = true;
|
||||
|
||||
lDataNum = iGetNoArray.Count();
|
||||
|
||||
if (token.IsCancellationRequested)
|
||||
break;
|
||||
|
||||
/*
|
||||
QueryProcess("DELETE [" + strTableName + "] WHERE " +
|
||||
"CONVERT(VARCHAR(8), UpdateDT, 112) <= CONVERT(VARCHAR(8), GETDATE() - " + strDateDiff + ", 112);", ref bGetQueryResult);
|
||||
*/
|
||||
|
||||
QueryProcess("DELETE [" + strTableName + "] WHERE No = " + iGetNo + ";", ref bGetQueryResult);
|
||||
}
|
||||
|
||||
if (bFindItem)
|
||||
{
|
||||
lLastProcessTime = stProcessTime.ElapsedMilliseconds;
|
||||
lLastProcessNum = lDataNum;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
public int[] QueryStatusResultTable(int iProcNum, CancellationToken token)
|
||||
{
|
||||
bool bGetQueryResult = false;
|
||||
|
||||
int[] iQueryNoArr = null;
|
||||
|
||||
DataSet ds = QueryProcess("SELECT TOP (50) A.No, A.Status FROM HIST_TestResultData_" + iProcNum.ToString() + " AS A WHERE A.Status = 0 OR A.Status = 10 OR A.Status = 20 OR A.Status = 30 ORDER BY No DESC;", ref bGetQueryResult);
|
||||
|
||||
bool hasRows = XCommons.isHasRow(ds);
|
||||
|
||||
if (hasRows)
|
||||
{
|
||||
int iRowNum = ds.Tables[0].Rows.Count;
|
||||
|
||||
iQueryNoArr = new int[iRowNum];
|
||||
Array.Clear(iQueryNoArr, 0, iQueryNoArr.Length);
|
||||
|
||||
for (int i = 0; i < iRowNum; i++)
|
||||
{
|
||||
if (token.IsCancellationRequested)
|
||||
return null;
|
||||
|
||||
var getValue = ds.Tables[0].Rows[i]["No"];
|
||||
|
||||
iQueryNoArr[i] = int.Parse(getValue.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
stProcessTime.Restart();
|
||||
|
||||
return iQueryNoArr;
|
||||
}
|
||||
private bool SetLogData(int iProcNum, int iGetNo)
|
||||
{
|
||||
bool bGetQueryResult = false;
|
||||
|
||||
DataSet dsLogData = null;
|
||||
DataSet dsModeData = null;
|
||||
DataSet dsPalletData = null;
|
||||
|
||||
strLogDataFilePath = "";
|
||||
|
||||
eGetLogDataType = eLogDataType.None;
|
||||
|
||||
try
|
||||
{
|
||||
dsLogData = QueryProcess("SELECT A.No, A.LogAccessKey, A.ProcNo, A.PalletNumber, A.PalletID, A.PIndex, A.ProdNo, A.ProdID, A.TestID, A.LogDataPath, A.Status, A.UpdateDT " +
|
||||
"FROM HIST_TestResultData_" + iProcNum.ToString() + " AS A WHERE A.No =" + iGetNo.ToString() + ";", ref bGetQueryResult);
|
||||
|
||||
bool hasRows = XCommons.isHasRow(dsLogData);
|
||||
|
||||
if (hasRows)
|
||||
{
|
||||
var Data = dsLogData.Tables[0].Rows[0]["LogDataPath"].ToString().Trim();
|
||||
strLogDataFilePath = Data;
|
||||
|
||||
var vStatus = dsLogData.Tables[0].Rows[0]["Status"];
|
||||
|
||||
if ((short)eLogDataType.Normal == (Convert.ToInt16(vStatus) / 10))
|
||||
eGetLogDataType = eLogDataType.Normal;
|
||||
else if ((short)eLogDataType.CSV_Type0 == (Convert.ToInt16(vStatus) / 10))
|
||||
eGetLogDataType = eLogDataType.CSV_Type0;
|
||||
else if ((short)eLogDataType.CSV_Type1 == (Convert.ToInt16(vStatus) / 10))
|
||||
eGetLogDataType = eLogDataType.CSV_Type1;
|
||||
else if ((short)eLogDataType.CSV_Type2 == (Convert.ToInt16(vStatus) / 10))
|
||||
eGetLogDataType = eLogDataType.CSV_Type2;
|
||||
else
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"General log processing [Log type select] failed.[SystemX.Common.Protocol.Log.LSU_Trimming_4Th : AnalysisLog_.SetLogData]", ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
var vLogAccessKey = dsLogData.Tables[0].Rows[0]["LogAccessKey"].ToString().Trim();
|
||||
var vProcNo = dsLogData.Tables[0].Rows[0]["ProcNo"].ToString().Trim();
|
||||
|
||||
var vPalletNum = dsLogData.Tables[0].Rows[0]["PalletNumber"].ToString().Trim();
|
||||
var vPalletID = dsLogData.Tables[0].Rows[0]["PalletID"].ToString().Trim();
|
||||
var vPIndex = dsLogData.Tables[0].Rows[0]["PIndex"].ToString().Trim();
|
||||
var vProdNo = dsLogData.Tables[0].Rows[0]["ProdNo"].ToString().Trim();
|
||||
var vProdID = dsLogData.Tables[0].Rows[0]["ProdID"].ToString().Trim();
|
||||
|
||||
var vTestID = dsLogData.Tables[0].Rows[0]["TestID"].ToString().Trim();
|
||||
|
||||
dsModeData = QueryProcess("SELECT ModeID FROM CONST_WorkMode WHERE PalletNumber = '" + vPalletNum + "';", ref bGetQueryResult);
|
||||
dsPalletData = QueryProcess("SELECT * FROM STAT_ProdLoad A WHERE A.PalletNumber = '" + vPalletNum + "' ORDER BY A.No;", ref bGetQueryResult);
|
||||
|
||||
if (XCommons.isHasRow(dsModeData) == false ||
|
||||
XCommons.isHasRow(dsPalletData) == false)
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"General log processing [Query mode/pallet information (1)] failed.[SystemX.Common.Protocol.Log.LSU_Trimming_4Th : AnalysisLog_.SetLogData]", ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
|
||||
throw new Exception();
|
||||
}
|
||||
var vpModeID = dsModeData.Tables[0].Rows[0]["ModeID"].ToString().Trim();
|
||||
|
||||
if (eGetLogDataType == eLogDataType.Normal)
|
||||
{
|
||||
CpLogStoreData.vLSaveTableName = qiLogProcessInfo.GetSaveTableName(vTestID.ToString());
|
||||
CpLogStoreData.vLSaveDetailTable = qiLogProcessInfo.GetSaveDetailTable(vTestID.ToString());
|
||||
CpLogStoreData.ExtrctInfo = qiLogProcessInfo.GetExtractInfo(vTestID.ToString());
|
||||
|
||||
foreach (DataRow dr in dsPalletData.Tables[0].Rows)
|
||||
{
|
||||
int iIndex = dsPalletData.Tables[0].Rows.IndexOf(dr);
|
||||
|
||||
int iLogIndex = XLogDataControl_.ConvertTextToTryValue<int>(vPIndex.ToString(), -1);
|
||||
if (iLogIndex == -1)
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"General log processing [Query mode/pallet information (2)] failed.[SystemX.Common.Protocol.Log.LSU_Trimming_4Th : AnalysisLog_.SetLogData]", ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
|
||||
throw new Exception();
|
||||
}
|
||||
else
|
||||
{
|
||||
iLogIndex -= 1;
|
||||
|
||||
CpLogStoreData.vLLogAccessKey = vLogAccessKey;
|
||||
CpLogStoreData.vLProcNo = vProcNo;
|
||||
CpLogStoreData.vLPalletNumber = dsPalletData.Tables[0].Rows[iLogIndex]["PalletNumber"].ToString().Trim();
|
||||
CpLogStoreData.vLPalletID = dsPalletData.Tables[0].Rows[iLogIndex]["PalletID"].ToString().Trim();
|
||||
CpLogStoreData.vLPIndex = dsPalletData.Tables[0].Rows[iLogIndex]["PIndex"].ToString().Trim();
|
||||
CpLogStoreData.vLProdNo = dsPalletData.Tables[0].Rows[iLogIndex]["ProdNo"].ToString().Trim();
|
||||
CpLogStoreData.vLProdID = dsPalletData.Tables[0].Rows[iLogIndex]["ProdID"].ToString().Trim();
|
||||
CpLogStoreData.vLSensorType = dsPalletData.Tables[0].Rows[iLogIndex]["SensorType"].ToString().Trim();
|
||||
|
||||
CpLogStoreData.vLStatus = "-";
|
||||
CpLogStoreData.vLTestID = vTestID;
|
||||
CpLogStoreData.vLResult = "-";
|
||||
CpLogStoreData.vLTestDuration = "-";
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CustomLogStoreData.vLSaveTableName = qiLogProcessInfo.GetSaveTableName(vTestID.ToString());
|
||||
CustomLogStoreData.vLSaveDetailTable = qiLogProcessInfo.GetSaveDetailTable(vTestID.ToString());
|
||||
CustomLogStoreData.ExtrctInfo = qiLogProcessInfo.GetExtractInfo(vTestID.ToString());
|
||||
|
||||
foreach (DataRow dr in dsPalletData.Tables[0].Rows)
|
||||
{
|
||||
int iIndex = dsPalletData.Tables[0].Rows.IndexOf(dr);
|
||||
CustomLogStoreData.vLLogAccessKey[iIndex] = vLogAccessKey;
|
||||
CustomLogStoreData.vLProcNo[iIndex] = vProcNo;
|
||||
CustomLogStoreData.vLPalletNumber[iIndex] = vPalletNum;
|
||||
|
||||
//CustomLogStoreData.vLPalletNumber[iIndex] = dsPalletData.Tables[0].Rows[0]["PalletNumber"].ToString().Trim();
|
||||
CustomLogStoreData.vLPalletID[iIndex] = dsPalletData.Tables[0].Rows[iIndex]["PalletID"].ToString().Trim();
|
||||
CustomLogStoreData.vLPIndex[iIndex] = dsPalletData.Tables[0].Rows[iIndex]["PIndex"].ToString().Trim();
|
||||
CustomLogStoreData.vLProdNo[iIndex] = dsPalletData.Tables[0].Rows[iIndex]["ProdNo"].ToString().Trim();
|
||||
CustomLogStoreData.vLProdID[iIndex] = dsPalletData.Tables[0].Rows[iIndex]["ProdID"].ToString().Trim();
|
||||
CustomLogStoreData.vLSensorType[iIndex] = dsPalletData.Tables[0].Rows[iIndex]["SensorType"].ToString().Trim();
|
||||
|
||||
CustomLogStoreData.SelectProdNo = CustomLogStoreData.vLProdNo[iIndex];
|
||||
|
||||
if (vpModeID.ToString() == "1")
|
||||
CustomLogStoreData.vLStatus[iIndex] = "NORMAL";
|
||||
else if (vpModeID.ToString() == "2")
|
||||
CustomLogStoreData.vLStatus[iIndex] = "REWORK";
|
||||
else if (vpModeID.ToString() == "3")
|
||||
CustomLogStoreData.vLStatus[iIndex] = "RETEST";
|
||||
else
|
||||
CustomLogStoreData.vLStatus[iIndex] = "-";
|
||||
|
||||
CustomLogStoreData.vLTestID[iIndex] = vTestID;
|
||||
CustomLogStoreData.vLResult[iIndex] = "-";
|
||||
|
||||
CustomLogStoreData.vLVal_Min[iIndex] = "-";
|
||||
CustomLogStoreData.vLVal_Max[iIndex] = "-";
|
||||
CustomLogStoreData.vLVal_Meas[iIndex] = "-";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
bGetQueryResult = false;
|
||||
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"General shift log data failed.[SystemX.Common.Protocol.Log.LSU_Trimming_4Th : AnalysisLog_.SetLogData]\r\n" + ex.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
|
||||
return bGetQueryResult;
|
||||
}
|
||||
private bool FileAccessCheck()
|
||||
{
|
||||
bool bAccessCheck = true;
|
||||
|
||||
//File Access Check
|
||||
FileStream fs = null;
|
||||
try
|
||||
{
|
||||
fs = new FileStream(@strLogDataFilePath, FileMode.Open, FileAccess.ReadWrite, FileShare.None);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//File Access fail next file
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"File access check fail. [" + @strLogDataFilePath + "] [SystemX.Common.Protocol.Log.LSU_Trimming_4Th : AnalysisLog_.FileAccessCheck]\r\n" + ex.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
|
||||
bAccessCheck = false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
//FIle Access ok
|
||||
if (fs != null)
|
||||
fs.Close();
|
||||
}
|
||||
|
||||
return bAccessCheck;
|
||||
}
|
||||
private bool GetNoramlDataAccessResult(string strLogDataPath, ref DataSet dsGetSet)
|
||||
{
|
||||
bool bStatusCheck = true;
|
||||
|
||||
dsGetSet = null;
|
||||
|
||||
try
|
||||
{
|
||||
//CpLogCompUtil
|
||||
//CpLogCompUtil.CopyToMemory()
|
||||
DataTable dt = CpLogFileIO.GetLogData(@strLogDataPath, out getCpLogHeader);
|
||||
|
||||
DataSet dsLog = new DataSet();
|
||||
dsLog.Tables.Add(dt);
|
||||
|
||||
dsGetSet = dsLog.Copy();
|
||||
|
||||
bStatusCheck = XCommons.isHasRow(dsLog);
|
||||
|
||||
if (bStatusCheck)
|
||||
{
|
||||
//추출 정보 존재시
|
||||
if (CpLogStoreData.ExtrctInfo.Count > 0)
|
||||
{
|
||||
CpLogStoreData.SetMeasLength(CpLogStoreData.ExtrctInfo.Count);
|
||||
|
||||
foreach (KeyValuePair<int, Tuple<string, bool, string, int, string, string, string>> k in CpLogStoreData.ExtrctInfo)
|
||||
{
|
||||
DataRow[] dr = null;
|
||||
|
||||
if (k.Value.Item2)
|
||||
{
|
||||
foreach (DataRow getDr in dsLog.Tables[0].Rows)
|
||||
{
|
||||
string strGetMO = getDr.ItemArray[2].ToString().Trim();
|
||||
|
||||
if (strGetMO.IndexOf(k.Value.Item3.ToString()) >= 0)
|
||||
{
|
||||
dr = new DataRow[1];
|
||||
dr[0] = getDr;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
//dsLog.Tables[0].Select("Mo = '" + k.Value.Item3.ToString() + "'");
|
||||
}
|
||||
else
|
||||
dsLog.Tables[0].Select("Step = " + k.Value.Item4.ToString());
|
||||
|
||||
int iGetCnt = (dr != null) ? dr.Count() : 0;
|
||||
if (iGetCnt > 0)
|
||||
{
|
||||
string strSetValue = XLogDataControl_.ConvertTextToTryValue<double>(dr[0].ItemArray[5].ToString(), 0).ToString();
|
||||
CpLogStoreData.SetMeasValue(k.Key, strSetValue);
|
||||
}
|
||||
else
|
||||
CpLogStoreData.SetMeasValue(k.Key, "0");
|
||||
}
|
||||
}
|
||||
|
||||
CpLogStoreData.SetCpLogHeaderData(getCpLogHeader);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"CpLog file access get header failed. [" + @strLogDataPath + "] [SystemX.Common.Protocol.Log.LSU_Trimming_4Th : AnalysisLog_.GetNoramlDataAccessResult]\r\n" + ex.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
|
||||
bStatusCheck = false;
|
||||
}
|
||||
|
||||
return bStatusCheck;
|
||||
}
|
||||
private bool GetCustomDataSubProcess(string strDataPath)
|
||||
{
|
||||
bool bStatusCheck = true;
|
||||
|
||||
DataSet dsLogData = null;
|
||||
|
||||
try
|
||||
{
|
||||
if (XLogDataControl_.ReadFileData(eGetLogDataType, @strDataPath))
|
||||
{
|
||||
if (eGetLogDataType == eLogDataType.CSV_Type0)
|
||||
{
|
||||
dsLogData = QueryProcess("SELECT " +
|
||||
"PrsFail_LSpec AS Val_Min, " +
|
||||
"PrsFail_USpec AS Val_Max " +
|
||||
"FROM PROD_ModelChar_LK " +
|
||||
"WHERE " +
|
||||
"PrtProdNo = " +
|
||||
"(SELECT PrtProdNo FROM PROD_ModelChild WHERE ProdNo = '" +
|
||||
CustomLogStoreData.SelectProdNo + "');", ref bStatusCheck);
|
||||
|
||||
for (int i = 0; i < CustomLogStoreData.vLVal_Min.Length; i++)
|
||||
CustomLogStoreData.vLVal_Min[i] = dsLogData.Tables[0].Rows[0]["Val_Min"].ToString().Trim();
|
||||
for (int i = 0; i < CustomLogStoreData.vLVal_Min.Length; i++)
|
||||
CustomLogStoreData.vLVal_Max[i] = dsLogData.Tables[0].Rows[0]["Val_Max"].ToString().Trim();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"Custom file sub process failed. [" + @strDataPath + "] [SystemX.Common.Protocol.Log.LSU_Trimming_4Th : AnalysisLog_.GetCustomDataSubProcess]\r\n" + ex.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
|
||||
bStatusCheck = false;
|
||||
}
|
||||
|
||||
return bStatusCheck;
|
||||
}
|
||||
private SqlCommand[] GetCommandList(int iProcNum, int iGetNo, eLogDataType eCurLogType, eLogAccessType eCurAccessType, ref SqlCommand[] getSubCmd)
|
||||
{
|
||||
bool bGetQueryResult = true;
|
||||
bool hasData = false;
|
||||
|
||||
SqlCommand[] getCmd;
|
||||
getSubCmd = null;
|
||||
|
||||
DataSet dsLogData = null;
|
||||
DataSet dsCpLogRawData = null;
|
||||
|
||||
string strTempFileName = @"D:\TempCreateFolder\";
|
||||
|
||||
try
|
||||
{
|
||||
if (eCurAccessType == eLogAccessType.FileData)
|
||||
{
|
||||
if (FileAccessCheck())
|
||||
{
|
||||
//CP
|
||||
if (eGetLogDataType == eLogDataType.Normal)
|
||||
hasData = GetNoramlDataAccessResult(strLogDataFilePath, ref dsCpLogRawData);
|
||||
//CSV
|
||||
else
|
||||
hasData = GetCustomDataSubProcess(strLogDataFilePath);
|
||||
}
|
||||
}
|
||||
else if (eCurAccessType == eLogAccessType.VarBinaryData)
|
||||
{
|
||||
dsLogData = QueryProcess("SELECT A.No, A.LogAccessKey, A.ProcNo, A.PalletNumber, A.PalletID, A.PIndex, A.ProdNo, A.ProdID, A.TestID, A.LogData, A.Status, A.UpdateDT " +
|
||||
"FROM HIST_TestResultData_" + iProcNum.ToString() + " AS A WHERE A.No =" + iGetNo.ToString() + ";", ref bGetQueryResult);
|
||||
|
||||
var Data = dsLogData.Tables[0].Rows[0]["LogData"];
|
||||
/*
|
||||
N: cd26ccf675d64521884f1693c62ed303
|
||||
D: cd26ccf6-75d6-4521-884f-1693c62ed303
|
||||
B: {cd26ccf6-75d6-4521-884f-1693c62ed303}
|
||||
P: (cd26ccf6-75d6-4521-884f-1693c62ed303)
|
||||
X: {0xcd26ccf6,0x75d6,0x4521,{0x88,0x4f,0x16,0x93,0xc6,0x2e,0xd3,0x03}}
|
||||
*/
|
||||
Guid uguid = Guid.NewGuid();
|
||||
|
||||
strTempFileName = @"D:\TempCreateFolder\";
|
||||
|
||||
if (Directory.Exists(strTempFileName) == false)
|
||||
Directory.CreateDirectory(strTempFileName);
|
||||
|
||||
strTempFileName += uguid.ToString("B") + ".CpLog";
|
||||
|
||||
File.WriteAllBytes(strTempFileName, (byte[])Data);
|
||||
|
||||
//CP
|
||||
if (eGetLogDataType == eLogDataType.Normal)
|
||||
hasData = GetNoramlDataAccessResult(strTempFileName, ref dsCpLogRawData);
|
||||
//CSV
|
||||
else
|
||||
hasData = GetCustomDataSubProcess(strTempFileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"General log processing [Unknown access data] failed.[SystemX.Common.Protocol.Log.LSU_Trimming_4Th : AnalysisLog_.GetCommandList]", ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
|
||||
throw new Exception();
|
||||
}
|
||||
//
|
||||
if (hasData)
|
||||
{
|
||||
getCmd = XLogDataControl_.HISTTableProcess(eGetLogDataType);
|
||||
|
||||
if (eGetLogDataType == eLogDataType.Normal)
|
||||
{
|
||||
//디테일 테이블 저장
|
||||
if (CpLogStoreData.vLSaveDetailTable)
|
||||
{
|
||||
//STEP,POSITION,MO,FNC_NAME,MIN_VALUE,MEASURE_VALUE,MAX_VALUE,DIM,CHECK_RETURN,SPENT_TIME,INFO
|
||||
string columns = "STEP,POSITION,MO,FNC_NAME,MIN_VALUE,MEASURE_VALUE,MAX_VALUE,DIM,CHECK_RETURN,SPENT_TIME,INFO";
|
||||
//columns = string.Join(",", dsCpLogRawData.Tables[0].Columns.Cast<DataColumn>().Select(c => c.ColumnName));
|
||||
|
||||
string values = string.Join(",", columns.Split(',').Select(c => string.Format("@{0}", c)));
|
||||
//values = string.Join(",", dsCpLogRawData.Tables[0].Columns.Cast<DataColumn>().Select(c => string.Format("@{0}", c.ColumnName)));
|
||||
|
||||
String sqlCommandInsert = string.Format("INSERT INTO HIST_TestResultDatail_" + iProcNum.ToString() + " (LogAccessKey, {0}) VALUES (@LogAccessKey, {1})", columns, values);
|
||||
|
||||
getSubCmd = new SqlCommand[dsCpLogRawData.Tables[0].Rows.Count];
|
||||
foreach (DataRow row in dsCpLogRawData.Tables[0].Rows)
|
||||
{
|
||||
int irIndex = dsCpLogRawData.Tables[0].Rows.IndexOf(row);
|
||||
getSubCmd[irIndex] = new SqlCommand(sqlCommandInsert);
|
||||
|
||||
getSubCmd[irIndex].Parameters.Clear();
|
||||
|
||||
getSubCmd[irIndex].Parameters.AddWithValue("@LogAccessKey", CpLogStoreData.vLLogAccessKey);
|
||||
foreach (DataColumn col in dsCpLogRawData.Tables[0].Columns)
|
||||
{
|
||||
int icIndex = dsCpLogRawData.Tables[0].Columns.IndexOf(col);
|
||||
|
||||
string strSetValue = row[col].ToString().Trim();
|
||||
getSubCmd[irIndex].Parameters.AddWithValue("@" + columns.Split(',')[icIndex], strSetValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"General log processing [" + eCurAccessType.ToString() + " : file no has data] failed.[SystemX.Common.Protocol.Log.LSU_Trimming_4Th : AnalysisLog_.GetCommandList]", ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"General log processing [" + eGetLogDataType.ToString() + "] [" + eCurAccessType.ToString() + "] failed.[SystemX.Common.Protocol.Log.LSU_Trimming_4Th : AnalysisLog_.GetCommandList]\r\n" + ex.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
|
||||
getCmd = null;
|
||||
|
||||
int iSetStatus = GetStatusCode(false);
|
||||
|
||||
QueryProcess("UPDATE HIST_TestResultData_" + iProcNum.ToString() + " SET Status = " + iSetStatus + ", UpdateDT = GETDATE() WHERE No = " + iGetNo.ToString() + ";", ref bGetQueryResult);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (File.Exists(strTempFileName))
|
||||
File.Delete(strTempFileName);
|
||||
}
|
||||
|
||||
return getCmd;
|
||||
}
|
||||
public bool QueryInfoResultTable(int iProcNum, CancellationToken token, int[] iGetNoArray)
|
||||
{
|
||||
bool bGetQueryResult = false;
|
||||
bool bFindItem = false;
|
||||
|
||||
long lDataNum = 0;
|
||||
|
||||
foreach (int iGetNo in iGetNoArray)
|
||||
{
|
||||
if (token.IsCancellationRequested)
|
||||
break;
|
||||
|
||||
lDataNum = iGetNoArray.Count();
|
||||
bFindItem = true;
|
||||
|
||||
Stopwatch stMeasTime = new Stopwatch();
|
||||
stMeasTime.Start();
|
||||
|
||||
if (SetLogData(iProcNum, iGetNo) == false)
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"No : " + iGetNo.ToString() + " General log processing [Log data base information] failed. [SystemX.Common.Protocol.Log.LSU_Trimming_4Th : AnalysisLog_.QueryInfoResultTable]", ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
;//
|
||||
}
|
||||
if (File.Exists(strLogDataFilePath))
|
||||
eGetAccessType = eLogAccessType.FileData;
|
||||
else
|
||||
eGetAccessType = eLogAccessType.VarBinaryData;
|
||||
|
||||
//Detatil Command List
|
||||
SqlCommand[] getSubCmd = null;
|
||||
|
||||
//HIST Command and Extractinfo - Update table Command
|
||||
SqlCommand[] getCmd = GetCommandList(iProcNum, iGetNo, eGetLogDataType, eGetAccessType, ref getSubCmd);
|
||||
|
||||
//Command Process
|
||||
bool bCommandProcessResult = true;
|
||||
|
||||
int iSetStatus = GetStatusCode(true);
|
||||
int iSetFailStatus = GetStatusCode(false);
|
||||
|
||||
if (getCmd == null)
|
||||
{
|
||||
bCommandProcessResult = false;
|
||||
|
||||
goto FAILED_PROCESS;
|
||||
}
|
||||
|
||||
foreach (SqlCommand sc in getCmd)
|
||||
{
|
||||
if (sc == null)
|
||||
continue;
|
||||
|
||||
if (MngDBConn.CurrentConnection(eConnCategory.Main).ExecuteNonQuery(sc) == false)
|
||||
bCommandProcessResult = false;
|
||||
}
|
||||
|
||||
if (getSubCmd != null)
|
||||
{
|
||||
foreach (SqlCommand sc in getSubCmd)
|
||||
{
|
||||
if (sc == null)
|
||||
continue;
|
||||
|
||||
if (MngDBConn.CurrentConnection(eConnCategory.Main).ExecuteNonQuery(sc) == false)
|
||||
bCommandProcessResult = false;
|
||||
}
|
||||
}
|
||||
|
||||
FAILED_PROCESS:
|
||||
|
||||
if(bCommandProcessResult)
|
||||
QueryProcess("UPDATE HIST_TestResultData_" + iProcNum.ToString() + " SET Status = " + iSetStatus + ", UpdateDT = GETDATE() WHERE No = " + iGetNo.ToString() + ";", ref bGetQueryResult);
|
||||
else
|
||||
QueryProcess("UPDATE HIST_TestResultData_" + iProcNum.ToString() + " SET Status = " + iSetFailStatus + ", UpdateDT = GETDATE() WHERE No = " + iGetNo.ToString() + ";", ref bGetQueryResult);
|
||||
|
||||
lLastItemTime = stMeasTime.ElapsedMilliseconds;
|
||||
}
|
||||
|
||||
if (bFindItem)
|
||||
{
|
||||
lLastProcessTime = stProcessTime.ElapsedMilliseconds;
|
||||
lLastProcessNum = lDataNum;
|
||||
}
|
||||
|
||||
return bGetQueryResult;
|
||||
}
|
||||
private int GetStatusCode(bool bResult)
|
||||
{
|
||||
int iSetStatus = 0;
|
||||
|
||||
if (eGetLogDataType == eLogDataType.Normal)
|
||||
iSetStatus = 0;
|
||||
else if (eGetLogDataType == eLogDataType.CSV_Type0)
|
||||
iSetStatus = 10;
|
||||
else if (eGetLogDataType == eLogDataType.CSV_Type1)
|
||||
iSetStatus = 20;
|
||||
else if (eGetLogDataType == eLogDataType.CSV_Type2)
|
||||
iSetStatus = 30;
|
||||
else
|
||||
iSetStatus = 100;
|
||||
|
||||
if (bResult)
|
||||
iSetStatus += 1;
|
||||
else
|
||||
iSetStatus += 2;
|
||||
|
||||
return iSetStatus;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,180 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml.Linq;
|
||||
using SystemX.Net.BaseProtocol;
|
||||
using SystemX.Net.DB;
|
||||
|
||||
using CpTesterPlatform.CpLogUtil;
|
||||
|
||||
using static SystemX.Net.Platform.Common.Util.LogMessage;
|
||||
|
||||
namespace SystemX.Common.Log.LSU
|
||||
{
|
||||
/// <summary>
|
||||
/// Query Base Infomation
|
||||
/// </summary>
|
||||
///
|
||||
public class LogProcessInfo_LSU
|
||||
{
|
||||
public bool READ_INFO_STATE { set; get; }
|
||||
|
||||
private string strInfoFilePos;
|
||||
|
||||
|
||||
//TestID, TableName
|
||||
private Dictionary<string, Tuple<int, string>> dicBaseIDInfo;
|
||||
//TestID, DetailLogUse
|
||||
private Dictionary<string, bool> dicDetailInfo;
|
||||
//KEY - STEP, Name, UpdateTableName, ToField
|
||||
private Dictionary<int, Tuple<string, bool, string, int, string, string, string>> dicSubExtrctionInfo;
|
||||
|
||||
public bool USE_TABLE_DATA_DELETE_MANAGER { internal set; get; }
|
||||
|
||||
//KEY - TableName, USE
|
||||
private Dictionary<string, bool> dicTableDataDeleteList;
|
||||
//KEY - No, USE, TableName, Set Date
|
||||
private Dictionary<int, Tuple<bool, string, int>> dicTableDataDeleteManager;
|
||||
|
||||
public LogProcessInfo_LSU(string strGetInfoPath)
|
||||
{
|
||||
strInfoFilePos = strGetInfoPath;
|
||||
|
||||
dicBaseIDInfo = new Dictionary<string, Tuple<int, string>>();
|
||||
dicDetailInfo = new Dictionary<string, bool>();
|
||||
dicSubExtrctionInfo = new Dictionary<int, Tuple<string, bool, string, int, string, string, string>>();
|
||||
//
|
||||
dicTableDataDeleteList = new Dictionary<string, bool>();
|
||||
dicTableDataDeleteManager = new Dictionary<int, Tuple<bool, string, int>>();
|
||||
}
|
||||
public string GetSaveTableName(string strTestID)
|
||||
{
|
||||
if (dicBaseIDInfo.Keys.Contains(strTestID))
|
||||
{
|
||||
return dicBaseIDInfo[strTestID].Item2;
|
||||
}
|
||||
else
|
||||
return "";
|
||||
}
|
||||
public bool GetSaveDetailTable(string strTestID)
|
||||
{
|
||||
if (dicDetailInfo.Keys.Contains(strTestID))
|
||||
return dicDetailInfo[strTestID];
|
||||
else
|
||||
return false;
|
||||
}
|
||||
public List<KeyValuePair<int, Tuple<string, bool, string, int, string, string, string>>> GetExtractInfo(string strTestID)
|
||||
{
|
||||
if (dicBaseIDInfo.Keys.Contains(strTestID))
|
||||
return dicSubExtrctionInfo.ToList().FindAll(x => x.Value.Item1 == strTestID);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
public List<KeyValuePair<int, Tuple<bool, string, int>>> GeManageInfo()
|
||||
{
|
||||
return dicTableDataDeleteManager.ToList();
|
||||
}
|
||||
|
||||
public bool Load()
|
||||
{
|
||||
READ_INFO_STATE = true;
|
||||
|
||||
int iSetPos = 0;
|
||||
try
|
||||
{
|
||||
XDocument xDoc = XDocument.Load(strInfoFilePos);
|
||||
var xElement = xDoc.Element("ROOT");
|
||||
|
||||
if (xElement != null)
|
||||
{
|
||||
var ListGetElement = xElement.Elements("TableDataDeleteManager").ToList();
|
||||
|
||||
foreach (var getXElement in ListGetElement)
|
||||
{
|
||||
USE_TABLE_DATA_DELETE_MANAGER = Convert.ToBoolean(getXElement.Attribute("USE").Value);
|
||||
|
||||
if (getXElement.Elements().ToList().Count > 0)
|
||||
{
|
||||
iSetPos = 0;
|
||||
for (int i = 0; i < getXElement.Elements().ToList().Count; i++)
|
||||
{
|
||||
int iGetDateDiff = 0;
|
||||
if (int.TryParse(getXElement.Element("Management" + (i + 1).ToString()).Attribute("DateDifference").Value.ToString(), out iGetDateDiff))
|
||||
{
|
||||
dicTableDataDeleteList.Add(getXElement.Element("Management" + (i + 1).ToString()).Attribute("TableName").Value,
|
||||
Convert.ToBoolean(getXElement.Element("Management" + (i + 1).ToString()).Attribute("USE").Value));
|
||||
|
||||
dicTableDataDeleteManager.Add(iSetPos++,
|
||||
new Tuple<bool, string, int>(
|
||||
Convert.ToBoolean(getXElement.Element("Management" + (i + 1).ToString()).Attribute("USE").Value),
|
||||
getXElement.Element("Management" + (i + 1).ToString()).Attribute("TableName").Value,
|
||||
iGetDateDiff));
|
||||
}
|
||||
else
|
||||
throw new Exception("DateDifference value error.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ListGetElement = xElement.Elements("QueryInfo").ToList();
|
||||
|
||||
foreach (var getXElement in ListGetElement)
|
||||
{
|
||||
string strBaseID = getXElement.Attribute("ID").Value;
|
||||
|
||||
bool bGetDetailSelect = false;
|
||||
|
||||
int iGetProcNo = int.Parse(getXElement.Attribute("ProcNo").Value);
|
||||
dicBaseIDInfo.Add(strBaseID, new Tuple<int, string>(iGetProcNo, getXElement.Attribute("Table").Value));
|
||||
dicDetailInfo.Add(strBaseID, bool.TryParse(getXElement.Attribute("DetailProcess").Value, out bGetDetailSelect) == true ? bGetDetailSelect : false);
|
||||
|
||||
if (getXElement.Elements().ToList().Count > 0)
|
||||
{
|
||||
iSetPos = 0;
|
||||
for (int i = 0; i < getXElement.Elements().ToList().Count; i++)
|
||||
{
|
||||
int iGetStep = 0;
|
||||
if (int.TryParse(getXElement.Element("ExtractionInfo" + (i + 1).ToString()).Attribute("Step").Value.ToString(), out iGetStep))
|
||||
{
|
||||
string strUpdateTable = getXElement.Element("ExtractionInfo" + (i + 1).ToString()).Attribute("UpdateTableName").Value;
|
||||
|
||||
bool bUpdateTableDiff = dicSubExtrctionInfo.ToList().FindAll(x => x.Value.Item1 == strBaseID).All(x => x.Value.Item6 == strUpdateTable);
|
||||
|
||||
if (bUpdateTableDiff == false)
|
||||
throw new Exception();
|
||||
|
||||
dicSubExtrctionInfo.Add(iSetPos++,
|
||||
new Tuple<string, bool, string, int, string, string, string>(
|
||||
strBaseID,
|
||||
Convert.ToBoolean(getXElement.Element("ExtractionInfo" + (i + 1).ToString()).Attribute("MO_Find").Value),
|
||||
getXElement.Element("ExtractionInfo" + (i + 1).ToString()).Attribute("MO").Value,
|
||||
iGetStep,
|
||||
getXElement.Element("ExtractionInfo" + (i + 1).ToString()).Attribute("Name").Value,
|
||||
getXElement.Element("ExtractionInfo" + (i + 1).ToString()).Attribute("UpdateTableName").Value,
|
||||
getXElement.Element("ExtractionInfo" + (i + 1).ToString()).Attribute("ToField").Value));
|
||||
}
|
||||
else
|
||||
throw new Exception("Step value error.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
READ_INFO_STATE = false;
|
||||
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"LogProcessInfo read failed. [SystemX.Common.Protocol.Log.LSU : LogProcessInfo_LSU.Load]\r\n" + ex.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
|
||||
return READ_INFO_STATE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,490 @@
|
||||
using CpTesterPlatform.CpLogUtil;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Forms.Design;
|
||||
using System.Xml.Linq;
|
||||
using SystemX.Net;
|
||||
using SystemX.Net.BaseProtocol;
|
||||
using SystemX.Net.DB;
|
||||
using SystemX.Net.Platform.Common.ExtensionMethods;
|
||||
using static SystemX.Net.Platform.Common.Util.LogMessage;
|
||||
|
||||
namespace SystemX.Common.Log.LSU
|
||||
{
|
||||
public static class CpLogStoreData
|
||||
{
|
||||
public static string vLSaveTableName = string.Empty;
|
||||
public static bool vLSaveDetailTable = false;
|
||||
public static List<KeyValuePair<int, Tuple<string, bool, string, int, string, string, string>>> ExtrctInfo = null;
|
||||
|
||||
public static string vLLogAccessKey = string.Empty;
|
||||
public static string vLProcNo = string.Empty;
|
||||
public static string vLStation = string.Empty;
|
||||
public static string vLPosition = string.Empty;
|
||||
public static string vLPalletNumber = string.Empty;
|
||||
public static string vLPalletID = string.Empty;
|
||||
public static string vLPIndex = string.Empty;
|
||||
public static string vLProdNo = string.Empty;
|
||||
public static string vLProdID = string.Empty;
|
||||
public static string vLSensorType = string.Empty;
|
||||
public static string vLStatus = string.Empty;
|
||||
public static string vLTestID = string.Empty;
|
||||
public static string vLResult = string.Empty;
|
||||
public static string vLTestDuration = string.Empty;
|
||||
|
||||
public static string[] vLVal_Meas;
|
||||
|
||||
public static void SetMeasLength(int iCnt)
|
||||
{
|
||||
vLVal_Meas = new string[iCnt];
|
||||
|
||||
Array.Clear(vLVal_Meas, 0, iCnt);
|
||||
}
|
||||
public static void SetMeasValue(int iPos, string strValue)
|
||||
{
|
||||
vLVal_Meas[iPos] = strValue;
|
||||
}
|
||||
public static string GetMeasValue(int iPos)
|
||||
{
|
||||
return vLVal_Meas[iPos];
|
||||
}
|
||||
public static void SetCpLogHeaderData(CpLogHeader cpLh)
|
||||
{
|
||||
vLStation = (cpLh.CHANNEL).Trim();
|
||||
vLPosition = (cpLh.WORK_POSITION).Trim();
|
||||
vLStatus = (cpLh.CONTROL + @"/" + cpLh.TYPE).Trim();
|
||||
vLResult = (cpLh.RESULT).Trim();
|
||||
var vTestDuration = (cpLh.DURATION).Trim();
|
||||
|
||||
double dGetDurtion = 0;
|
||||
double.TryParse(vTestDuration.ToString().Trim(), out dGetDurtion);
|
||||
dGetDurtion /= 1000.0;
|
||||
|
||||
vLTestDuration = dGetDurtion.ToString("F3");
|
||||
}
|
||||
}
|
||||
public static class CustomLogStoreData
|
||||
{
|
||||
public static string vLSaveTableName = string.Empty;
|
||||
public static bool vLSaveDetailTable = false;
|
||||
public static List<KeyValuePair<int, Tuple<string, bool, string, int, string, string, string>>> ExtrctInfo = null;
|
||||
|
||||
public static string SelectProdNo = string.Empty;
|
||||
|
||||
public static string[] vLLogAccessKey = new string[6] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty };
|
||||
public static string[] vLProcNo = new string[6] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty };
|
||||
public static string[] vLPalletNumber = new string[6] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty };
|
||||
public static string[] vLPalletID = new string[6] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty };
|
||||
public static string[] vLPIndex = new string[6] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty };
|
||||
public static string[] vLProdNo = new string[6] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty };
|
||||
public static string[] vLProdID = new string[6] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty };
|
||||
public static string[] vLSensorType = new string[6] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty };
|
||||
public static string[] vLStatus = new string[6] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty };
|
||||
public static string[] vLTestID = new string[6] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty };
|
||||
public static string[] vLResult = new string[6] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty };
|
||||
|
||||
public static string[] vLVal_Min = new string[6] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty };
|
||||
public static string[] vLVal_Max = new string[6] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty };
|
||||
public static string[] vLVal_Meas = new string[6] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty };
|
||||
}
|
||||
public static class XLogDataControl_
|
||||
{
|
||||
public static DataTable dtCSVFileData = new DataTable();
|
||||
|
||||
private static Dictionary<string, Tuple<SqlDbType, int>> dicLogField;
|
||||
|
||||
public static void SetLogFieldInfo()
|
||||
{
|
||||
dicLogField = new Dictionary<string, Tuple<SqlDbType, int>>();
|
||||
|
||||
dicLogField.Clear();
|
||||
dicLogField.Add("LogAccessKey", new Tuple<SqlDbType, int>(SqlDbType.NVarChar, 64));
|
||||
dicLogField.Add("ProcNo", new Tuple<SqlDbType, int>(SqlDbType.BigInt, 0));
|
||||
dicLogField.Add("Station", new Tuple<SqlDbType, int>(SqlDbType.NChar, 30));
|
||||
dicLogField.Add("Position", new Tuple<SqlDbType, int>(SqlDbType.NChar, 30));
|
||||
dicLogField.Add("PalletNumber", new Tuple<SqlDbType, int>(SqlDbType.NChar, 20));
|
||||
dicLogField.Add("PalletID", new Tuple<SqlDbType, int>(SqlDbType.NChar, 30));
|
||||
dicLogField.Add("PIndex", new Tuple<SqlDbType, int>(SqlDbType.TinyInt, 0));
|
||||
dicLogField.Add("ProdNo", new Tuple<SqlDbType, int>(SqlDbType.NChar, 30));
|
||||
dicLogField.Add("ProdID", new Tuple<SqlDbType, int>(SqlDbType.NChar, 50));
|
||||
dicLogField.Add("SensorType", new Tuple<SqlDbType, int>(SqlDbType.TinyInt, 0));
|
||||
dicLogField.Add("Status", new Tuple<SqlDbType, int>(SqlDbType.NChar, 50));
|
||||
dicLogField.Add("TestID", new Tuple<SqlDbType, int>(SqlDbType.NChar, 20));
|
||||
dicLogField.Add("Result", new Tuple<SqlDbType, int>(SqlDbType.Bit, 0));
|
||||
dicLogField.Add("TestDuration", new Tuple<SqlDbType, int>(SqlDbType.Float, 0));
|
||||
dicLogField.Add("Val_Min", new Tuple<SqlDbType, int>(SqlDbType.Float, 0));
|
||||
dicLogField.Add("Val_Max", new Tuple<SqlDbType, int>(SqlDbType.Float, 0));
|
||||
dicLogField.Add("Val_Meas", new Tuple<SqlDbType, int>(SqlDbType.Float, 0));
|
||||
}
|
||||
private static void AddLogField(string strName, SqlDbType setType, int iSize)
|
||||
{
|
||||
if (dicLogField.ContainsKey(strName) == false)
|
||||
dicLogField.Add(strName, new Tuple<SqlDbType, int>(setType, iSize));
|
||||
}
|
||||
private static SqlParameter GetMakeSqlParameterInfo(string strSetName, object objValue)
|
||||
{
|
||||
if (dicLogField.ContainsKey(strSetName))
|
||||
{
|
||||
SqlParameter param = new SqlParameter("@" + strSetName, dicLogField[strSetName].Item1, dicLogField[strSetName].Item2);
|
||||
param.Value = objValue;
|
||||
return param;
|
||||
}
|
||||
else
|
||||
return null;
|
||||
}
|
||||
public static T ConvertTextToTryValue<T>(string strText, object objFailValue)
|
||||
{
|
||||
object obj;
|
||||
obj = typeof(T);
|
||||
|
||||
int iGetValue = 0;
|
||||
byte ucGetValue = 0;
|
||||
uint uiGetValue = 0;
|
||||
double dGetValue = 0;
|
||||
|
||||
if (obj.ToString().IndexOf("Byte") >= 0)
|
||||
{
|
||||
if (!byte.TryParse(strText, out ucGetValue))
|
||||
obj = objFailValue;
|
||||
else
|
||||
obj = ucGetValue;
|
||||
}
|
||||
if (obj.ToString().IndexOf("Int") >= 0)
|
||||
{
|
||||
if (!int.TryParse(strText, out iGetValue))
|
||||
obj = objFailValue;
|
||||
else
|
||||
obj = iGetValue;
|
||||
}
|
||||
if (obj.ToString().IndexOf("UInt") >= 0)
|
||||
{
|
||||
if (!uint.TryParse(strText, out uiGetValue))
|
||||
obj = objFailValue;
|
||||
else
|
||||
obj = uiGetValue;
|
||||
}
|
||||
if (obj.ToString().IndexOf("Double") >= 0)
|
||||
{
|
||||
if (!double.TryParse(strText, out dGetValue))
|
||||
obj = objFailValue;
|
||||
else
|
||||
obj = dGetValue;
|
||||
}
|
||||
|
||||
return (T)Convert.ChangeType(obj, typeof(T));
|
||||
}
|
||||
public static SqlCommand[] HISTTableProcess(eLogDataType eGetLogType)
|
||||
{
|
||||
SqlCommand[] cmd = null;
|
||||
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
if (eGetLogType == eLogDataType.Normal)
|
||||
{
|
||||
cmd = new SqlCommand[3];
|
||||
|
||||
String sqlCommandInsert = "";
|
||||
String sqlCommandSubInsert = "";
|
||||
|
||||
String sqlCommandUpdate = "";
|
||||
|
||||
string columns = string.Empty;
|
||||
string subColumns = string.Empty;
|
||||
|
||||
if (CpLogStoreData.ExtrctInfo.Count > 0)
|
||||
{
|
||||
columns = "LogAccessKey,ProcNo,Station,Position,PalletNumber,PalletID,PIndex,ProdNo,ProdID,SensorType,Status,TestID,Result,TestDuration,";
|
||||
subColumns = "LogAccessKey,ProcNo,PalletNumber,PalletID,PIndex,ProdNo,ProdID,TestID";
|
||||
|
||||
sqlCommandUpdate = "UPDATE " + CpLogStoreData.ExtrctInfo[0].Value.Item6 + " SET ";
|
||||
foreach (KeyValuePair<int, Tuple<string, bool, string, int, string, string, string>> k in CpLogStoreData.ExtrctInfo)
|
||||
{
|
||||
sqlCommandUpdate += k.Value.Item7 + " = " + CpLogStoreData.GetMeasValue(k.Key) + ", ";
|
||||
|
||||
columns += k.Value.Item7 + ",";
|
||||
|
||||
AddLogField(k.Value.Item7, SqlDbType.Float, 0);
|
||||
}
|
||||
|
||||
sqlCommandUpdate = sqlCommandUpdate.Remove(sqlCommandUpdate.Length - 2, 1);
|
||||
sqlCommandUpdate += "WHERE PalletNumber = '" + CpLogStoreData.vLPalletNumber + "' AND PIndex = " + CpLogStoreData.vLPIndex + ";";
|
||||
|
||||
columns = columns.Remove(columns.Length - 1, 1);
|
||||
|
||||
cmd[2] = new SqlCommand(sqlCommandUpdate);
|
||||
}
|
||||
else
|
||||
{
|
||||
columns = "LogAccessKey,ProcNo,Station,Position,PalletNumber,PalletID,PIndex,ProdNo,ProdID,SensorType,Status,TestID,Result,TestDuration";
|
||||
subColumns = "LogAccessKey,ProcNo,PalletNumber,PalletID,PIndex,ProdNo,ProdID,TestID";
|
||||
|
||||
cmd[2] = null;
|
||||
}
|
||||
|
||||
string values = string.Join(",", columns.Split(',').Select(c => string.Format("@{0}", c)));
|
||||
string subValues = string.Join(",", subColumns.Split(',').Select(c => string.Format("@{0}", c)));
|
||||
|
||||
sqlCommandInsert = string.Format("INSERT INTO " + CpLogStoreData.vLSaveTableName + " ({0}) VALUES ({1})", columns, values);
|
||||
sqlCommandSubInsert = string.Format("INSERT INTO [HIST_TestNgResult] ({0}) VALUES ({1})", subColumns, subValues);
|
||||
|
||||
cmd[0] = new SqlCommand(sqlCommandInsert);
|
||||
cmd[1] = new SqlCommand(sqlCommandSubInsert);
|
||||
|
||||
SqlParameter[] setParams = new SqlParameter[columns.Split(',').Count()];
|
||||
SqlParameter[] setSubParams = new SqlParameter[subColumns.Split(',').Count()];
|
||||
|
||||
setParams[0] = GetMakeSqlParameterInfo("LogAccessKey", CpLogStoreData.vLLogAccessKey);
|
||||
setParams[1] = GetMakeSqlParameterInfo("ProcNo", CpLogStoreData.vLProcNo);
|
||||
setParams[2] = GetMakeSqlParameterInfo("Station", CpLogStoreData.vLStation);
|
||||
setParams[3] = GetMakeSqlParameterInfo("Position", CpLogStoreData.vLPosition);
|
||||
setParams[4] = GetMakeSqlParameterInfo("PalletNumber", CpLogStoreData.vLPalletNumber);
|
||||
setParams[5] = GetMakeSqlParameterInfo("PalletID", CpLogStoreData.vLPalletID);
|
||||
setParams[6] = GetMakeSqlParameterInfo("PIndex", ConvertTextToTryValue<byte>(CpLogStoreData.vLPIndex, 0));
|
||||
setParams[7] = GetMakeSqlParameterInfo("ProdNo", CpLogStoreData.vLProdNo);
|
||||
setParams[8] = GetMakeSqlParameterInfo("ProdID", CpLogStoreData.vLProdID);
|
||||
setParams[9] = GetMakeSqlParameterInfo("SensorType", CpLogStoreData.vLSensorType);
|
||||
setParams[10] = GetMakeSqlParameterInfo("Status", CpLogStoreData.vLStatus);
|
||||
setParams[11] = GetMakeSqlParameterInfo("TestID", CpLogStoreData.vLTestID);
|
||||
|
||||
setSubParams[0] = GetMakeSqlParameterInfo("LogAccessKey", CpLogStoreData.vLLogAccessKey);
|
||||
setSubParams[1] = GetMakeSqlParameterInfo("ProcNo", CpLogStoreData.vLProcNo);
|
||||
setSubParams[2] = GetMakeSqlParameterInfo("PalletNumber", CpLogStoreData.vLPalletNumber);
|
||||
setSubParams[3] = GetMakeSqlParameterInfo("PalletID", CpLogStoreData.vLPalletID);
|
||||
setSubParams[4] = GetMakeSqlParameterInfo("PIndex", ConvertTextToTryValue<byte>(CpLogStoreData.vLPIndex, 0));
|
||||
setSubParams[5] = GetMakeSqlParameterInfo("ProdNo", CpLogStoreData.vLProdNo);
|
||||
setSubParams[6] = GetMakeSqlParameterInfo("ProdID", CpLogStoreData.vLProdID);
|
||||
setSubParams[7] = GetMakeSqlParameterInfo("TestID", CpLogStoreData.vLTestID);
|
||||
|
||||
if (CpLogStoreData.vLResult.IndexOf("OK") >= 0)
|
||||
{
|
||||
setParams[12] = GetMakeSqlParameterInfo("Result", 1);
|
||||
|
||||
cmd[1] = null;
|
||||
}
|
||||
else
|
||||
setParams[12] = GetMakeSqlParameterInfo("Result", 0);
|
||||
|
||||
setParams[13] = GetMakeSqlParameterInfo("TestDuration", ConvertTextToTryValue<double>(CpLogStoreData.vLTestDuration, 0));
|
||||
|
||||
int iSetPos = 14;
|
||||
if (CpLogStoreData.ExtrctInfo.Count > 0)
|
||||
{
|
||||
foreach (KeyValuePair<int, Tuple<string, bool, string, int, string, string, string>> k in CpLogStoreData.ExtrctInfo)
|
||||
setParams[iSetPos++] = GetMakeSqlParameterInfo(k.Value.Item7, ConvertTextToTryValue<double>(CpLogStoreData.GetMeasValue(k.Key), 0));
|
||||
}
|
||||
|
||||
cmd[0].Parameters.AddRange(setParams);
|
||||
|
||||
if(cmd[1] != null)
|
||||
cmd[1].Parameters.AddRange(setSubParams);
|
||||
}
|
||||
else
|
||||
{
|
||||
object[] objItems;
|
||||
|
||||
if (dtCSVFileData.Rows.Count == 0)
|
||||
throw new Exception();
|
||||
|
||||
cmd = new SqlCommand[dtCSVFileData.Rows.Count + dtCSVFileData.Rows.Count];
|
||||
|
||||
string columns = string.Empty;
|
||||
string subColumns = string.Empty;
|
||||
|
||||
String sqlCommandInsert = "";
|
||||
String sqlCommandSubInsert = "";
|
||||
|
||||
if (eGetLogType == eLogDataType.CSV_Type0)
|
||||
{
|
||||
columns = "LogAccessKey,ProcNo,PalletNumber,PalletID,PIndex,ProdNo,ProdID,SensorType,Status,TestID,Result,Val_Min,Val_Max,Val_Meas";
|
||||
string values = string.Join(",", columns.Split(',').Select(c => string.Format("@{0}", c)));
|
||||
sqlCommandInsert = string.Format("INSERT INTO " + CustomLogStoreData.vLSaveTableName + " ({0}) VALUES ({1})", columns, values);
|
||||
}
|
||||
else
|
||||
{
|
||||
columns = "LogAccessKey,ProcNo,PalletNumber,PalletID,PIndex,ProdNo,ProdID,SensorType,Status,TestID,Result";
|
||||
string values = string.Join(",", columns.Split(',').Select(c => string.Format("@{0}", c)));
|
||||
sqlCommandInsert = string.Format("INSERT INTO " + CustomLogStoreData.vLSaveTableName + " ({0}) VALUES ({1})", columns, values);
|
||||
}
|
||||
|
||||
subColumns = "LogAccessKey,ProcNo,PalletNumber,PalletID,PIndex,ProdNo,ProdID,TestID";
|
||||
string subValues = string.Join(",", subColumns.Split(',').Select(c => string.Format("@{0}", c)));
|
||||
sqlCommandSubInsert = string.Format("INSERT INTO [HIST_TestNgResult] ({0}) VALUES ({1})", subColumns, subValues);
|
||||
|
||||
int iSubPos = 0;
|
||||
for (int i = 0; i < dtCSVFileData.Rows.Count; i++)
|
||||
{
|
||||
iSubPos = dtCSVFileData.Rows.Count + i;
|
||||
|
||||
cmd[i] = null;
|
||||
cmd[iSubPos] = null;
|
||||
|
||||
objItems = dtCSVFileData.Rows[i].ItemArray;
|
||||
|
||||
cmd[i] = new SqlCommand(sqlCommandInsert);
|
||||
cmd[iSubPos] = new SqlCommand(sqlCommandSubInsert);
|
||||
|
||||
int iIndex = 0;
|
||||
if (eGetLogType == eLogDataType.CSV_Type0)
|
||||
iIndex = ConvertTextToTryValue<int>(objItems[1].ToString(), 0);
|
||||
else
|
||||
iIndex = ConvertTextToTryValue<int>(objItems[0].ToString(), 0);
|
||||
|
||||
if (iIndex == 0)
|
||||
throw new Exception();
|
||||
else
|
||||
iIndex -= 1;
|
||||
|
||||
SqlParameter[] setParams = new SqlParameter[columns.Split(',').Count()];
|
||||
SqlParameter[] setSubParams = new SqlParameter[subColumns.Split(',').Count()];
|
||||
|
||||
setParams[0] = GetMakeSqlParameterInfo("LogAccessKey", CustomLogStoreData.vLLogAccessKey[iIndex]);
|
||||
setParams[1] = GetMakeSqlParameterInfo("ProcNo", CustomLogStoreData.vLProcNo[iIndex]);
|
||||
setParams[2] = GetMakeSqlParameterInfo("PalletNumber", CustomLogStoreData.vLPalletNumber[iIndex]);
|
||||
setParams[3] = GetMakeSqlParameterInfo("PalletID", CustomLogStoreData.vLPalletID[iIndex]);
|
||||
setParams[4] = GetMakeSqlParameterInfo("PIndex", ConvertTextToTryValue<byte>(CustomLogStoreData.vLPIndex[iIndex], 0));
|
||||
setParams[5] = GetMakeSqlParameterInfo("ProdNo", CustomLogStoreData.vLProdNo[iIndex]);
|
||||
setParams[6] = GetMakeSqlParameterInfo("ProdID", CustomLogStoreData.vLProdID[iIndex]);
|
||||
setParams[7] = GetMakeSqlParameterInfo("SensorType", CustomLogStoreData.vLSensorType[iIndex]);
|
||||
setParams[8] = GetMakeSqlParameterInfo("Status", CustomLogStoreData.vLStatus[iIndex]);
|
||||
setParams[9] = GetMakeSqlParameterInfo("TestID", CustomLogStoreData.vLTestID[iIndex]);
|
||||
|
||||
setSubParams[0] = GetMakeSqlParameterInfo("LogAccessKey", CustomLogStoreData.vLLogAccessKey[iIndex]);
|
||||
setSubParams[1] = GetMakeSqlParameterInfo("ProcNo", CustomLogStoreData.vLProcNo[iIndex]);
|
||||
setSubParams[2] = GetMakeSqlParameterInfo("PalletNumber", CustomLogStoreData.vLPalletNumber[iIndex]);
|
||||
setSubParams[3] = GetMakeSqlParameterInfo("PalletID", CustomLogStoreData.vLPalletID[iIndex]);
|
||||
setSubParams[4] = GetMakeSqlParameterInfo("PIndex", ConvertTextToTryValue<byte>(CustomLogStoreData.vLPIndex[iIndex], 0));
|
||||
setSubParams[5] = GetMakeSqlParameterInfo("ProdNo", CustomLogStoreData.vLProdNo[iIndex]);
|
||||
setSubParams[6] = GetMakeSqlParameterInfo("ProdID", CustomLogStoreData.vLProdID[iIndex]);
|
||||
setSubParams[7] = GetMakeSqlParameterInfo("TestID", CustomLogStoreData.vLTestID[iIndex]);
|
||||
|
||||
if (eGetLogType == eLogDataType.CSV_Type0)
|
||||
{
|
||||
if (objItems[4].ToString().Trim().IndexOf("OK") >= 0)
|
||||
CustomLogStoreData.vLResult[iIndex] = "1";
|
||||
else
|
||||
CustomLogStoreData.vLResult[iIndex] = "0";
|
||||
|
||||
CustomLogStoreData.vLVal_Meas[iIndex] = objItems[3].ToString().Trim();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (objItems[1].ToString().IndexOf("OK") >= 0)
|
||||
CustomLogStoreData.vLResult[iIndex] = "1";
|
||||
else
|
||||
CustomLogStoreData.vLResult[iIndex] = "0";
|
||||
}
|
||||
//
|
||||
if (CustomLogStoreData.vLResult[iIndex].IndexOf("1") >= 0)
|
||||
cmd[iSubPos] = null;
|
||||
|
||||
setParams[10] = GetMakeSqlParameterInfo("Result", ConvertTextToTryValue<byte>(CustomLogStoreData.vLResult[iIndex], 0));
|
||||
|
||||
if (eGetLogType == eLogDataType.CSV_Type0)
|
||||
{
|
||||
setParams[11] = GetMakeSqlParameterInfo("Val_Min", ConvertTextToTryValue<double>(CustomLogStoreData.vLVal_Min[iIndex], 0));
|
||||
setParams[12] = GetMakeSqlParameterInfo("Val_Max", ConvertTextToTryValue<double>(CustomLogStoreData.vLVal_Max[iIndex], 0));
|
||||
setParams[13] = GetMakeSqlParameterInfo("Val_Meas", ConvertTextToTryValue<double>(CustomLogStoreData.vLVal_Meas[iIndex], 0));
|
||||
}
|
||||
|
||||
cmd[i].Parameters.AddRange(setParams);
|
||||
|
||||
if(cmd[iSubPos] != null)
|
||||
cmd[iSubPos].Parameters.AddRange(setSubParams);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
for (int i = 0; i < cmd.Count(); i++)
|
||||
cmd[i] = null;
|
||||
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @" " + eGetLogType.ToString() + " General log processing [Command create] failed. " + ex.Message + " [SystemX.Common.Protocol.Log.LSU_Trimming_4Th : XLogDataControl_.HISTTableProcess]", ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
|
||||
cmd = null;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
;//
|
||||
}
|
||||
|
||||
return cmd; //(SqlCommand[])cmd.Clone();
|
||||
}
|
||||
public static bool ReadFileData(eLogDataType eType, string strFileName)
|
||||
{
|
||||
string strSetHeader = string.Empty;
|
||||
|
||||
bool bReadStatus = true;
|
||||
try
|
||||
{
|
||||
if (eType == eLogDataType.CSV_Type0)
|
||||
strSetHeader = "No,Index,Time,MeasValue,Result";
|
||||
else if (eType == eLogDataType.CSV_Type1)
|
||||
strSetHeader = "Pallet_Num,Result,Time,X1,X2,X3,Y,Broken,LockingPinArea";
|
||||
else if (eType == eLogDataType.CSV_Type2)
|
||||
strSetHeader = "Pallet_Num,Result,Time,Pin_1_X_Position,Pin_1_Y_Position,Pin_2_X_Position,Pin_2_Y_Position,Pin_3_X_Position,Pin_3_Y_Position,Pin_4_X_Position,Pin_4_Y_Position,Pin_5_X_Position, Pin_5_Y_Position,Pin_6_X_Position,Pin_6_Y_Position,Pin_1_Thickness,Pin_2_Thickness,Pin_3_Thickness,Pin_4_Thickness,Pin_5_Thickness,Pin_6_Thickness,Locking Pin Area,Locking Pin Position";
|
||||
|
||||
using (StreamReader sr = new StreamReader(strFileName))
|
||||
{
|
||||
if (eType != eLogDataType.CSV_Type0)
|
||||
sr.ReadLine();
|
||||
|
||||
dtCSVFileData = new DataTable();
|
||||
while (!sr.EndOfStream)
|
||||
{
|
||||
string strGetData = sr.ReadLine();
|
||||
strGetData = strGetData.Trim();
|
||||
|
||||
if (strGetData.Length <= 0)
|
||||
continue;
|
||||
|
||||
string[] tempList = strGetData.Split(',');
|
||||
|
||||
for (int i = 0; i < tempList.Length; i++)
|
||||
{
|
||||
if (tempList[i].Length <= 0)
|
||||
{
|
||||
List<string> listData = tempList.ToList();
|
||||
listData.RemoveAt(i);
|
||||
tempList = listData.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
object[] objRows = tempList;
|
||||
|
||||
if (dtCSVFileData.Columns.Count <= 0)
|
||||
{
|
||||
foreach (string strData in strSetHeader.Split(','))
|
||||
{
|
||||
DataColumn dc = new DataColumn(strData);
|
||||
dtCSVFileData.Columns.Add(dc);
|
||||
}
|
||||
|
||||
dtCSVFileData.Rows.Add(objRows);
|
||||
}
|
||||
else
|
||||
dtCSVFileData.Rows.Add(objRows);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"General log processing [Read file] failed.[SystemX.Common.Protocol.Log.LSU_Trimming_4Th : STATIC XLogDataControl.ReadFileData]\r\n" + ex.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
|
||||
bReadStatus = false;
|
||||
}
|
||||
|
||||
return bReadStatus;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,213 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml.Linq;
|
||||
using SystemX.Net.BaseProtocol;
|
||||
using SystemX.Net.DB;
|
||||
|
||||
using CpTesterPlatform.CpLogUtil;
|
||||
|
||||
using static SystemX.Net.Platform.Common.Util.LogMessage;
|
||||
|
||||
namespace SystemX.Common.Log.Query
|
||||
{
|
||||
/// <summary>
|
||||
/// Query Base Infomation
|
||||
/// </summary>
|
||||
///
|
||||
public class CallPreMadeQueryInfo
|
||||
{
|
||||
public bool bReadInfoState { set; get; }
|
||||
public bool bHasItem { set; get; }
|
||||
|
||||
public bool bLoading { set; get; }
|
||||
|
||||
private string strInfoFilePos;
|
||||
|
||||
//TestID, TableName
|
||||
private Dictionary<string, int> dicIDInfo;
|
||||
//ID - FROM - QUERY TEXT - RETURN FIELD(INDEX OR FIELD NAME)
|
||||
private Dictionary<int, Tuple<string, string, string, string>> dicUserQueryItem;
|
||||
|
||||
public CallPreMadeQueryInfo(string strGetInfoPath)
|
||||
{
|
||||
strInfoFilePos = strGetInfoPath;
|
||||
|
||||
dicIDInfo = new Dictionary<string, int>();
|
||||
dicUserQueryItem = new Dictionary<int, Tuple<string, string, string, string>>();
|
||||
|
||||
bHasItem = false;
|
||||
bReadInfoState = false;
|
||||
bLoading = false;
|
||||
}
|
||||
|
||||
public List<KeyValuePair<int, Tuple<string, string, string, string>>> GetUserQueryInfo(string strTestID)
|
||||
{
|
||||
if (dicIDInfo.Keys.Contains(strTestID))
|
||||
return dicUserQueryItem.ToList().FindAll(x => x.Value.Item1 == strTestID);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
public Tuple<string, string> GetUserQueryText(string strTestID, List<string> LstParam = null)
|
||||
{
|
||||
string strResultQueryText = string.Empty;
|
||||
|
||||
string strMakeQueryText = string.Empty;
|
||||
string strVarParam1 = string.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
if (bHasItem == false)
|
||||
throw new Exception("User query no have item.");
|
||||
|
||||
if (dicIDInfo.Keys.Contains(strTestID) == false)
|
||||
throw new Exception("Can't find call id.");
|
||||
|
||||
var getQuery = dicUserQueryItem.ToList().FindAll(x => x.Value.Item1 == strTestID);
|
||||
|
||||
if (getQuery == null)
|
||||
throw new Exception("Can't find [" + strTestID + "] ID user query.");
|
||||
|
||||
//받은 파라미터 개수
|
||||
int nParamNum = LstParam != null ? LstParam.Count() : 0;
|
||||
|
||||
string strQueryID = getQuery[0].Value.Item1;
|
||||
string strQueryFrom = getQuery[0].Value.Item2;
|
||||
strMakeQueryText = getQuery[0].Value.Item3;
|
||||
strVarParam1 = getQuery[0].Value.Item4;
|
||||
|
||||
//From 부분 대체
|
||||
int nParamPos = 0;
|
||||
if (strQueryFrom.Length > 0)
|
||||
{
|
||||
if (strMakeQueryText.IndexOf("@$UseFrom@$") < 0)
|
||||
throw new Exception("Access table argument format [@$UseFrom@$] syntax does not exist.");
|
||||
|
||||
string[] strLstQueryForms = strQueryFrom.Split(';');
|
||||
|
||||
foreach (string strFormParam in strLstQueryForms)
|
||||
{
|
||||
if (strMakeQueryText.IndexOf("@$UseFrom@$") < 0)
|
||||
throw new Exception("The number of parameters and the number of argument types do not match.");
|
||||
|
||||
strMakeQueryText = strMakeQueryText.Replace("@$UseFrom@$[" + (nParamPos + 1).ToString() + "]", strFormParam);
|
||||
|
||||
nParamPos++;
|
||||
}
|
||||
}
|
||||
|
||||
//사용자 입력 쿼리 텍스트 파라미터 개수 파악
|
||||
if (nParamNum > 0)
|
||||
{
|
||||
int nQueryParamNum = 0;
|
||||
string strTemp = strMakeQueryText;
|
||||
while (true)
|
||||
{
|
||||
if (strTemp.IndexOf("@$PARAM@$") >= 0)
|
||||
nQueryParamNum++;
|
||||
else
|
||||
break;
|
||||
|
||||
strTemp = strTemp.Remove(strTemp.IndexOf("@$PARAM@$"), 12);
|
||||
}
|
||||
|
||||
if (nParamNum != nQueryParamNum)
|
||||
throw new Exception("The number of parameters does not match.");
|
||||
|
||||
//파라미터 위치 값으로 대체
|
||||
nParamPos = 0;
|
||||
foreach (string strParamValue in LstParam)
|
||||
{
|
||||
strMakeQueryText = strMakeQueryText.Replace("@$PARAM@$[" + (nParamPos + 1).ToString() + "]", strParamValue);
|
||||
|
||||
nParamPos++;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
;//
|
||||
}
|
||||
finally
|
||||
{
|
||||
strResultQueryText = strMakeQueryText;
|
||||
}
|
||||
|
||||
//Query Text, Return Field Pos or Field Name
|
||||
return new Tuple<string, string>(strResultQueryText, strVarParam1);
|
||||
}
|
||||
|
||||
private void GetUserQueryItemInfo(List<XElement> ListGetElement)
|
||||
{
|
||||
bLoading = true;
|
||||
|
||||
dicIDInfo.Clear();
|
||||
dicUserQueryItem.Clear();
|
||||
|
||||
int nSetPos = 0;
|
||||
foreach (var getXElement in ListGetElement)
|
||||
{
|
||||
bHasItem = true;
|
||||
|
||||
string strBaseID = getXElement.Attribute("ID").Value;
|
||||
string strUseFrom = getXElement.Attribute("UseFrom").Value;
|
||||
|
||||
dicIDInfo.Add(strBaseID, nSetPos);
|
||||
|
||||
if (getXElement.Elements().ToList().Count == 1)
|
||||
{
|
||||
for (int i = 0; i < getXElement.Elements().ToList().Count; i++)
|
||||
{
|
||||
string strQueryText = getXElement.Element("QueryDetail").Attribute("QueryText").Value;
|
||||
string strVarParam1 = getXElement.Element("QueryDetail").Attribute("ReturnField").Value;
|
||||
|
||||
dicUserQueryItem.Add(nSetPos++,
|
||||
new Tuple<string, string, string, string>(
|
||||
strBaseID,
|
||||
strUseFrom,
|
||||
strQueryText,
|
||||
strVarParam1));
|
||||
}
|
||||
}
|
||||
else
|
||||
throw new Exception("Need only one by one Query-Information!");
|
||||
}
|
||||
|
||||
bLoading = false;
|
||||
}
|
||||
|
||||
public bool Load()
|
||||
{
|
||||
bReadInfoState = true;
|
||||
|
||||
try
|
||||
{
|
||||
XDocument xDoc = XDocument.Load(strInfoFilePos);
|
||||
var xElement = xDoc.Element("ROOT");
|
||||
|
||||
if (xElement != null)
|
||||
{
|
||||
var ListGetElement = xElement.Elements("UserQueryItem").ToList();
|
||||
|
||||
GetUserQueryItemInfo(ListGetElement);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
bReadInfoState = false;
|
||||
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"UserQueryItem read failed. [SystemX.Common.Protocol.Log.Query : UserQueryInfo.Load]\r\n" + ex.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
|
||||
return bReadInfoState;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,325 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml.Linq;
|
||||
using SystemX.Net;
|
||||
using SystemX.Net.BaseProtocol;
|
||||
using SystemX.Net.DB;
|
||||
|
||||
using CpTesterPlatform.CpLogUtil;
|
||||
|
||||
using static SystemX.Net.Platform.Common.Util.LogMessage;
|
||||
using static SystemX.Net.DB.XDBConnManager;
|
||||
|
||||
namespace SystemX.Common.Log.SIA
|
||||
{
|
||||
public class AnalysisLog_SIA : IDisposable
|
||||
{
|
||||
public bool STATE { set; get; }
|
||||
|
||||
//DataBase
|
||||
private XDBConnManager MngDBConn;
|
||||
//QueryInfo
|
||||
public LogProcessInfo_SIA qiLogProcessInfo;
|
||||
//Log Scan Process Task
|
||||
private Task taskScanProcess;
|
||||
|
||||
private bool m_bTaskBlock;
|
||||
//
|
||||
private Stopwatch stProcessTime;
|
||||
|
||||
private long lLastProcessTime;
|
||||
private long lLastItemTime;
|
||||
private long lLastProcessNum;
|
||||
|
||||
private CancellationTokenSource cts;
|
||||
|
||||
public int SET_LOG_PROC_POS { set; get; }
|
||||
public int SET_LOG_DELETE_MANAGE_POS { set; get; }
|
||||
|
||||
public int SET_LOG_SCAN_SHIFT_TIME { set; get; }
|
||||
public int SET_LOG_MANAGE_SCAN_TIME { set; get; }
|
||||
//
|
||||
private string strLogDataFilePath { set; get; }
|
||||
private eLogDataType eGetLogDataType { set; get; }
|
||||
private eLogAccessType eGetAccessType { set; get; }
|
||||
private CpLogHeader getCpLogHeader;
|
||||
//
|
||||
public bool[] LOG_DATA_CHECK_STATE { set; get; }
|
||||
|
||||
public long GET_LAST_PROCESS_TIME()
|
||||
{
|
||||
return lLastProcessTime;
|
||||
}
|
||||
public long GET_LAST_PROCESS_NUM()
|
||||
{
|
||||
return lLastProcessNum;
|
||||
}
|
||||
public long GET_LAST_ITEM_TIME()
|
||||
{
|
||||
return lLastItemTime;
|
||||
}
|
||||
|
||||
~AnalysisLog_SIA()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
public AnalysisLog_SIA()
|
||||
{
|
||||
STATE = true;
|
||||
|
||||
//Proc Position
|
||||
SET_LOG_PROC_POS = 0;
|
||||
SET_LOG_DELETE_MANAGE_POS = 0;
|
||||
|
||||
//1초 마다 미 처리 로그 스캔
|
||||
SET_LOG_SCAN_SHIFT_TIME = 500;
|
||||
|
||||
//24시간 마다 삭제 대상 데이터 스캔
|
||||
SET_LOG_MANAGE_SCAN_TIME = 86400000;
|
||||
|
||||
stProcessTime = new Stopwatch();
|
||||
stProcessTime.Start();
|
||||
|
||||
lLastProcessTime = 0;
|
||||
lLastItemTime = 0;
|
||||
|
||||
lLastProcessNum = 0;
|
||||
|
||||
MessageOutput.PrintLogLevel = LogMessageLevel.INFO;
|
||||
|
||||
string strExcutePos = Environment.CurrentDirectory;
|
||||
string strDBInfoPos = strExcutePos + @"\Configure\DBConnInfo.xml";
|
||||
string strLogProcessInfoPos = strExcutePos + @"\Configure\LogProcessInfo.xml";
|
||||
|
||||
qiLogProcessInfo = new LogProcessInfo_SIA(strLogProcessInfoPos);
|
||||
if (qiLogProcessInfo.Load())
|
||||
{
|
||||
LOG_DATA_CHECK_STATE = new bool[qiLogProcessInfo.GeManageInfo().Count()];
|
||||
for (int i = 0; i < qiLogProcessInfo.GeManageInfo().Count(); i++)
|
||||
LOG_DATA_CHECK_STATE[i] = true;
|
||||
|
||||
MngDBConn = new XDBConnManager();
|
||||
MngDBConn.ConfigPath = strDBInfoPos;
|
||||
|
||||
if (MngDBConn.OpenConnection())
|
||||
{
|
||||
taskScanProcess = null;
|
||||
m_bTaskBlock = false;
|
||||
|
||||
cts = new CancellationTokenSource();
|
||||
taskScanProcess = new Task(new Action<object>(WatchResultTable), cts.Token);
|
||||
taskScanProcess.Start();
|
||||
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @" Success to connect to DB. [SystemX.Common.Protocol.Log.LSU_Trimming_4Th : AnalysisLog_.AnalysisLog_]", ConsoleColor.White, LogMessageLevel.DEBUG);
|
||||
}
|
||||
else
|
||||
{
|
||||
STATE = false;
|
||||
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @" Failed to connect to DB. [SystemX.Common.Protocol.Log.LSU_Trimming_4Th : AnalysisLog_.AnalysisLog_]", ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
STATE = false;
|
||||
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @" Read to configure failed. [SystemX.Common.Protocol.Log.LSU_Trimming_4Th : AnalysisLog_.AnalysisLog_]", ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
}
|
||||
protected virtual void Dispose(bool bDisposing)
|
||||
{
|
||||
if (bDisposing)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if (taskScanProcess != null)
|
||||
{
|
||||
cts.Cancel();
|
||||
|
||||
taskScanProcess.Wait();
|
||||
|
||||
m_bTaskBlock = true;
|
||||
}
|
||||
|
||||
// do releasing unmanaged resource (종결자가 없는 객체의 자원 해제)
|
||||
// i.e. close file handle of operating systems
|
||||
|
||||
// suppress calling of Finalizer
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
private DataSet QueryProcess(string strGetQuery, ref bool bResult)//, out byte[] ucQueryByteArray)
|
||||
{
|
||||
bResult = false;
|
||||
|
||||
SqlDataReader xSqlReader = null;
|
||||
|
||||
DataSet ds = new DataSet();
|
||||
DataTable dt = new DataTable();
|
||||
|
||||
int iFieldCnt = 0;
|
||||
int iRecordsAffectedCnt = 0;
|
||||
bool bHasRow = false;
|
||||
|
||||
//ucQueryByteArray = null;
|
||||
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
xSqlReader = MngDBConn.QueryDatabase(eConnCategory.Main, strGetQuery);
|
||||
|
||||
if (xSqlReader != null)
|
||||
{
|
||||
iFieldCnt = xSqlReader.FieldCount;
|
||||
iRecordsAffectedCnt = xSqlReader.RecordsAffected;
|
||||
bHasRow = xSqlReader.HasRows;
|
||||
|
||||
dt.Load(xSqlReader);
|
||||
ds.Tables.Add(dt);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
xSqlReader = null;
|
||||
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"<" + strGetQuery + "> Query process fail![SystemX.Net.Platform.Log : AnalysisLog_.QueryProcess]\r\n" + ex.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (xSqlReader != null)
|
||||
xSqlReader.Close();
|
||||
}
|
||||
|
||||
if (iFieldCnt > 0 || iRecordsAffectedCnt > 0 || bHasRow == true)
|
||||
bResult = true;
|
||||
|
||||
return ds;
|
||||
}
|
||||
private async void WatchResultTable(object objState)
|
||||
{
|
||||
CancellationToken token = (CancellationToken)objState;
|
||||
|
||||
Stopwatch stLogManageTimer = new Stopwatch();
|
||||
stLogManageTimer.Start();
|
||||
|
||||
while (!m_bTaskBlock)
|
||||
{
|
||||
if (token.IsCancellationRequested)
|
||||
break;
|
||||
|
||||
try
|
||||
{
|
||||
if ((stLogManageTimer.ElapsedMilliseconds >= SET_LOG_MANAGE_SCAN_TIME))
|
||||
{
|
||||
if (qiLogProcessInfo.USE_TABLE_DATA_DELETE_MANAGER)
|
||||
{
|
||||
foreach (KeyValuePair<int, Tuple<bool, string, int>> infoM in qiLogProcessInfo.GeManageInfo())
|
||||
{
|
||||
if (infoM.Value.Item1)
|
||||
{
|
||||
int[] iGetDeleteNo = QueryManageDateTable(infoM.Value.Item2, infoM.Value.Item3.ToString(), token);
|
||||
|
||||
if (iGetDeleteNo != null)
|
||||
{
|
||||
ManageTableDataDelete(iGetDeleteNo, infoM.Value.Item2, infoM.Value.Item3.ToString(), token);
|
||||
}
|
||||
|
||||
iGetDeleteNo = QueryManageDateTable(infoM.Value.Item2, infoM.Value.Item3.ToString(), token);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stLogManageTimer.Restart();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"General Queue Process failed.[SystemX.Common.Protocol.Log.LSU_Trimming_4Th : AnalysisLog_SIA.WatchResultTable]\r\n" + ex.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
|
||||
await Task.Delay(1);
|
||||
}
|
||||
}
|
||||
public int[] QueryManageDateTable(string strTableName, string strDateDiff, CancellationToken token)
|
||||
{
|
||||
bool bGetQueryResult = false;
|
||||
|
||||
int[] iQueryNoArr = null;
|
||||
|
||||
DataSet ds = QueryProcess("SELECT TOP(100) * FROM [" + strTableName + "] WHERE No " +
|
||||
"IN(SELECT No FROM [" + strTableName + "] WHERE " +
|
||||
"CONVERT(VARCHAR(8), UpdateDT, 112) <= CONVERT(VARCHAR(8), GETDATE() - " + strDateDiff + ", 112)) ORDER BY No;", ref bGetQueryResult);
|
||||
|
||||
bool hasRows = XCommons.isHasRow(ds);
|
||||
|
||||
if (hasRows)
|
||||
{
|
||||
int iRowNum = ds.Tables[0].Rows.Count;
|
||||
|
||||
iQueryNoArr = new int[iRowNum];
|
||||
Array.Clear(iQueryNoArr, 0, iQueryNoArr.Length);
|
||||
|
||||
for (int i = 0; i < iRowNum; i++)
|
||||
{
|
||||
if (token.IsCancellationRequested)
|
||||
return null;
|
||||
|
||||
var getValue = ds.Tables[0].Rows[i]["No"];
|
||||
|
||||
iQueryNoArr[i] = int.Parse(getValue.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
stProcessTime.Restart();
|
||||
|
||||
return iQueryNoArr;
|
||||
}
|
||||
public bool ManageTableDataDelete(int[] iGetNoArray, string strTableName, string strDateDiff, CancellationToken token)
|
||||
{
|
||||
bool bGetQueryResult = false;
|
||||
|
||||
bool bFindItem = false;
|
||||
long lDataNum = 0;
|
||||
|
||||
foreach (int iGetNo in iGetNoArray)
|
||||
{
|
||||
bFindItem = true;
|
||||
|
||||
lDataNum = iGetNoArray.Count();
|
||||
|
||||
if (token.IsCancellationRequested)
|
||||
break;
|
||||
|
||||
/*
|
||||
QueryProcess("DELETE [" + strTableName + "] WHERE " +
|
||||
"CONVERT(VARCHAR(8), UpdateDT, 112) <= CONVERT(VARCHAR(8), GETDATE() - " + strDateDiff + ", 112);", ref bGetQueryResult);
|
||||
*/
|
||||
|
||||
QueryProcess("DELETE [" + strTableName + "] WHERE No = " + iGetNo + ";", ref bGetQueryResult);
|
||||
}
|
||||
|
||||
if (bFindItem)
|
||||
{
|
||||
lLastProcessTime = stProcessTime.ElapsedMilliseconds;
|
||||
lLastProcessNum = lDataNum;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,179 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml.Linq;
|
||||
using SystemX.Net.BaseProtocol;
|
||||
using SystemX.Net.DB;
|
||||
|
||||
using CpTesterPlatform.CpLogUtil;
|
||||
|
||||
using static SystemX.Net.Platform.Common.Util.LogMessage;
|
||||
|
||||
namespace SystemX.Common.Log.SIA
|
||||
{
|
||||
/// <summary>
|
||||
/// Query Base Infomation
|
||||
/// </summary>
|
||||
///
|
||||
public class LogProcessInfo_SIA
|
||||
{
|
||||
public bool READ_INFO_STATE { set; get; }
|
||||
|
||||
private string strInfoFilePos;
|
||||
|
||||
//TestID, TableName
|
||||
private Dictionary<string, Tuple<int, string>> dicBaseIDInfo;
|
||||
//TestID, DetailLogUse
|
||||
private Dictionary<string, bool> dicDetailInfo;
|
||||
//KEY - STEP, Name, UpdateTableName, ToField
|
||||
private Dictionary<int, Tuple<string, bool, string, int, string, string, string>> dicSubExtrctionInfo;
|
||||
|
||||
public bool USE_TABLE_DATA_DELETE_MANAGER { internal set; get; }
|
||||
|
||||
//KEY - TableName, USE
|
||||
private Dictionary<string, bool> dicTableDataDeleteList;
|
||||
//KEY - No, USE, TableName, Set Date
|
||||
private Dictionary<int, Tuple<bool, string, int>> dicTableDataDeleteManager;
|
||||
|
||||
public LogProcessInfo_SIA(string strGetInfoPath)
|
||||
{
|
||||
strInfoFilePos = strGetInfoPath;
|
||||
|
||||
dicBaseIDInfo = new Dictionary<string, Tuple<int, string>>();
|
||||
dicDetailInfo = new Dictionary<string, bool>();
|
||||
dicSubExtrctionInfo = new Dictionary<int, Tuple<string, bool, string, int, string, string, string>>();
|
||||
//
|
||||
dicTableDataDeleteList = new Dictionary<string, bool>();
|
||||
dicTableDataDeleteManager = new Dictionary<int, Tuple<bool, string, int>>();
|
||||
}
|
||||
public string GetSaveTableName(string strTestID)
|
||||
{
|
||||
if (dicBaseIDInfo.Keys.Contains(strTestID))
|
||||
{
|
||||
return dicBaseIDInfo[strTestID].Item2;
|
||||
}
|
||||
else
|
||||
return "";
|
||||
}
|
||||
public bool GetSaveDetailTable(string strTestID)
|
||||
{
|
||||
if (dicDetailInfo.Keys.Contains(strTestID))
|
||||
return dicDetailInfo[strTestID];
|
||||
else
|
||||
return false;
|
||||
}
|
||||
public List<KeyValuePair<int, Tuple<string, bool, string, int, string, string, string>>> GetExtractInfo(string strTestID)
|
||||
{
|
||||
if (dicBaseIDInfo.Keys.Contains(strTestID))
|
||||
return dicSubExtrctionInfo.ToList().FindAll(x => x.Value.Item1 == strTestID);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
public List<KeyValuePair<int, Tuple<bool, string, int>>> GeManageInfo()
|
||||
{
|
||||
return dicTableDataDeleteManager.ToList();
|
||||
}
|
||||
|
||||
public bool Load()
|
||||
{
|
||||
READ_INFO_STATE = true;
|
||||
|
||||
int iSetPos = 0;
|
||||
try
|
||||
{
|
||||
XDocument xDoc = XDocument.Load(strInfoFilePos);
|
||||
var xElement = xDoc.Element("ROOT");
|
||||
|
||||
if (xElement != null)
|
||||
{
|
||||
var ListGetElement = xElement.Elements("TableDataDeleteManager").ToList();
|
||||
|
||||
foreach (var getXElement in ListGetElement)
|
||||
{
|
||||
USE_TABLE_DATA_DELETE_MANAGER = Convert.ToBoolean(getXElement.Attribute("USE").Value);
|
||||
|
||||
if (getXElement.Elements().ToList().Count > 0)
|
||||
{
|
||||
iSetPos = 0;
|
||||
for (int i = 0; i < getXElement.Elements().ToList().Count; i++)
|
||||
{
|
||||
int iGetDateDiff = 0;
|
||||
if (int.TryParse(getXElement.Element("Management" + (i + 1).ToString()).Attribute("DateDifference").Value.ToString(), out iGetDateDiff))
|
||||
{
|
||||
dicTableDataDeleteList.Add(getXElement.Element("Management" + (i + 1).ToString()).Attribute("TableName").Value,
|
||||
Convert.ToBoolean(getXElement.Element("Management" + (i + 1).ToString()).Attribute("USE").Value));
|
||||
|
||||
dicTableDataDeleteManager.Add(iSetPos++,
|
||||
new Tuple<bool, string, int>(
|
||||
Convert.ToBoolean(getXElement.Element("Management" + (i + 1).ToString()).Attribute("USE").Value),
|
||||
getXElement.Element("Management" + (i + 1).ToString()).Attribute("TableName").Value,
|
||||
iGetDateDiff));
|
||||
}
|
||||
else
|
||||
throw new Exception("DateDifference value error.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ListGetElement = xElement.Elements("QueryInfo").ToList();
|
||||
|
||||
foreach (var getXElement in ListGetElement)
|
||||
{
|
||||
string strBaseID = getXElement.Attribute("ID").Value;
|
||||
|
||||
bool bGetDetailSelect = false;
|
||||
|
||||
int iGetProcNo = int.Parse(getXElement.Attribute("ProcNo").Value);
|
||||
dicBaseIDInfo.Add(strBaseID, new Tuple<int, string>(iGetProcNo, getXElement.Attribute("Table").Value));
|
||||
dicDetailInfo.Add(strBaseID, bool.TryParse(getXElement.Attribute("DetailProcess").Value, out bGetDetailSelect) == true ? bGetDetailSelect : false);
|
||||
|
||||
if (getXElement.Elements().ToList().Count > 0)
|
||||
{
|
||||
iSetPos = 0;
|
||||
for (int i = 0; i < getXElement.Elements().ToList().Count; i++)
|
||||
{
|
||||
int iGetStep = 0;
|
||||
if (int.TryParse(getXElement.Element("ExtractionInfo" + (i + 1).ToString()).Attribute("Step").Value.ToString(), out iGetStep))
|
||||
{
|
||||
string strUpdateTable = getXElement.Element("ExtractionInfo" + (i + 1).ToString()).Attribute("UpdateTableName").Value;
|
||||
|
||||
bool bUpdateTableDiff = dicSubExtrctionInfo.ToList().FindAll(x => x.Value.Item1 == strBaseID).All(x => x.Value.Item6 == strUpdateTable);
|
||||
|
||||
if (bUpdateTableDiff == false)
|
||||
throw new Exception();
|
||||
|
||||
dicSubExtrctionInfo.Add(iSetPos++,
|
||||
new Tuple<string, bool, string, int, string, string, string>(
|
||||
strBaseID,
|
||||
Convert.ToBoolean(getXElement.Element("ExtractionInfo" + (i + 1).ToString()).Attribute("MO_Find").Value),
|
||||
getXElement.Element("ExtractionInfo" + (i + 1).ToString()).Attribute("MO").Value,
|
||||
iGetStep,
|
||||
getXElement.Element("ExtractionInfo" + (i + 1).ToString()).Attribute("Name").Value,
|
||||
getXElement.Element("ExtractionInfo" + (i + 1).ToString()).Attribute("UpdateTableName").Value,
|
||||
getXElement.Element("ExtractionInfo" + (i + 1).ToString()).Attribute("ToField").Value));
|
||||
}
|
||||
else
|
||||
throw new Exception("Step value error.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
READ_INFO_STATE = false;
|
||||
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"LogProcessInfo read failed. [SystemX.Common.Protocol.Log.SIA : LogProcessInfo_SIA.Load]\r\n" + ex.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
|
||||
return READ_INFO_STATE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,538 @@
|
||||
using DevExpress.Data.Helpers;
|
||||
using DevExpress.XtraBars;
|
||||
using DevExpress.XtraBars.Navigation;
|
||||
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml.Linq;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
|
||||
using SystemX.Net;
|
||||
using SystemX.Common;
|
||||
using SystemX.Net.BaseProtocol;
|
||||
using SystemX.Net.Comm;
|
||||
using SystemX.Net.Schedule;
|
||||
using SystemX.Net.DB;
|
||||
using SystemX.Common.Serialization;
|
||||
using SystemX.Common.Archive;
|
||||
using DevExpress.Utils.Extensions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using SystemX.Common.Protocol.SIA;
|
||||
|
||||
using static SystemX.Net.Platform.Common.Util.LogMessage;
|
||||
using System.Threading;
|
||||
using SystemX.Net.MiddlewareUI.UIM.Protocol_Method;
|
||||
|
||||
using static SystemX.Net.DB.XDBConnManager;
|
||||
|
||||
namespace SystemX.Net.MiddlewareUI
|
||||
{
|
||||
public partial class MainForm : DevExpress.XtraBars.FluentDesignSystem.FluentDesignForm
|
||||
{
|
||||
private async void WatchRecvCommandQueue()
|
||||
{
|
||||
await Task.Delay(250);
|
||||
|
||||
while (!m_bTaskCommandBlock)
|
||||
{
|
||||
try
|
||||
{
|
||||
CT.ThrowIfCancellationRequested();
|
||||
}
|
||||
catch (OperationCanceledException CancelEx)
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @" Work Canceled. [SystemX.Net.MiddlewareUI : MainForm.WatchRecvCommndQueue]\r\n" + CancelEx.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
|
||||
break;
|
||||
}
|
||||
//
|
||||
try
|
||||
{
|
||||
if (bTaskCommandWaitLock == false) QueryRecvCommandQueue();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"General Queue Process failed.[1] [SystemX.Net.MiddlewareUI : MainForm.WatchRecvCommndQueue]\r\n" + e.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (MngDBConn.GetMainDBAccessTime() >= 120000)
|
||||
{
|
||||
//lock (objSingleTransactionDataAccessWait)
|
||||
{
|
||||
QueryCommandProcess(eConnCategory.Main, "SELECT GETDATE() AS 'CHECK PING';");
|
||||
}
|
||||
}
|
||||
if (MngDBConn.GetShortTermDBAccessTime() >= 120000)
|
||||
{
|
||||
//lock (objSingleTransactionDataAccessWait)
|
||||
{
|
||||
QueryCommandProcess(eConnCategory.ShortTerm, "SELECT GETDATE() AS 'CHECK PING';");
|
||||
}
|
||||
}
|
||||
if (MngDBConn.GetLongTermDBAccessTime() >= 120000)
|
||||
{
|
||||
//lock (objSingleTransactionDataAccessWait)
|
||||
{
|
||||
QueryCommandProcess(eConnCategory.LongTerm, "SELECT GETDATE() AS 'CHECK PING';");
|
||||
}
|
||||
}
|
||||
/*
|
||||
For TestList Update Check
|
||||
*/
|
||||
for (int i = PORT_DISTRIBUTION_NUM; i < ALL_MANAGE_NUM; i++)
|
||||
{
|
||||
if (thisConnInfo[i].ClientConnectState == false)
|
||||
continue;
|
||||
|
||||
foreach (var valuePair in thisTLLoadInfo[i].dicTLInfo)
|
||||
{
|
||||
if (valuePair.Value.bLoaded == false)
|
||||
continue;
|
||||
|
||||
if (valuePair.Value.GetLoadedTime() <= 60000)
|
||||
continue;
|
||||
|
||||
CustomProtocol_ cp = new CustomProtocol_();
|
||||
string strGetQuery = cp.CheckTestListUpdate(valuePair.Value.strProdNo_C, valuePair.Value.strTestCode, valuePair.Value.strTestType, valuePair.Value.strVersion, valuePair.Value.strProdCode);
|
||||
|
||||
DataSet ds = null;
|
||||
|
||||
//lock (objSingleTransactionDataAccessWait)
|
||||
{
|
||||
ds = QueryCommandProcess(eConnCategory.Main, strGetQuery);
|
||||
}
|
||||
|
||||
if (XCommons.isHasRow(ds) == false)
|
||||
continue;
|
||||
|
||||
int nGetStationID = Convert.ToInt32(valuePair.Key.Split(';')[2]);
|
||||
|
||||
DateTime getTestListFileUpdateDT = Convert.ToDateTime(ds.Tables[0].Rows[0]["TestListFileUpdateDT"]);
|
||||
|
||||
if (valuePair.Value.TestListFileUpdateDT != getTestListFileUpdateDT)
|
||||
SendClientAlarmUsePingPacket(i, "TLRL;" + nGetStationID.ToString("D2"));
|
||||
|
||||
valuePair.Value.SetLoadedTime();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"General Queue Process failed.[2] [SystemX.Net.MiddlewareUI : MainForm.WatchRecvCommndQueue]\r\n" + e.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
|
||||
await Task.Delay(10);
|
||||
}
|
||||
|
||||
//return m_bTaskCommandBlock;
|
||||
}
|
||||
//private async void SendCommandEvent(byte[] senderData, ScheduleEvent e)
|
||||
private void SendCommandEvent(byte[] senderData, ScheduleEvent e)
|
||||
{
|
||||
try
|
||||
{
|
||||
int iGetCall = e.CALL_NUMBER;
|
||||
|
||||
if (thisConnInfo[e.CALL_NUMBER].m_ucSendCommandToken == 0x00)
|
||||
thisConnInfo[e.CALL_NUMBER].m_ucSendCommandToken = 0x01;
|
||||
else if(thisConnInfo[e.CALL_NUMBER].m_ucSendCommandToken == 0x01)
|
||||
thisConnInfo[e.CALL_NUMBER].m_ucSendCommandToken = 0x02;
|
||||
else
|
||||
thisConnInfo[e.CALL_NUMBER].m_ucSendCommandToken = 0x01;
|
||||
|
||||
thisConnInfo[e.CALL_NUMBER].m_iSendCommandCnt++;
|
||||
|
||||
if (thisConnInfo[e.CALL_NUMBER].m_iSendCommandCnt + 1 == int.MaxValue)
|
||||
thisConnInfo[e.CALL_NUMBER].m_iSendCommandCnt = 0;
|
||||
|
||||
if (FlowCommandControl[iGetCall] == null)
|
||||
return;
|
||||
|
||||
//소켓 샌드 행위 내부 결과
|
||||
if (e.PROCESS_RESULT == false)
|
||||
{
|
||||
//해당 패킷 횟수 상승 일단 회 차시 기록남기고 드랍
|
||||
FlowCommandControl[iGetCall].SendPacketCycle();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"General <SendCommandEvent> failed.[SystemX.Net.MiddlewareUI : MainForm.SendCommandEvent]\r\n" + ex.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
}
|
||||
//private async void RecvCommandEvent(byte[] senderData, ScheduleEvent e)
|
||||
private void RecvCommandEvent(byte[] senderData, ScheduleEvent e)
|
||||
{
|
||||
try
|
||||
{
|
||||
int iGetCall = e.CALL_NUMBER;
|
||||
|
||||
if (thisConnInfo[e.CALL_NUMBER].m_ucRecvCommandToken == 0x00)
|
||||
thisConnInfo[e.CALL_NUMBER].m_ucRecvCommandToken = 0x01;
|
||||
else if (thisConnInfo[e.CALL_NUMBER].m_ucRecvCommandToken == 0x01)
|
||||
thisConnInfo[e.CALL_NUMBER].m_ucRecvCommandToken = 0x02;
|
||||
else
|
||||
thisConnInfo[e.CALL_NUMBER].m_ucRecvCommandToken = 0x01;
|
||||
|
||||
thisConnInfo[e.CALL_NUMBER].m_iRecvCommandCnt++;
|
||||
|
||||
if (thisConnInfo[e.CALL_NUMBER].m_iRecvCommandCnt + 1 == int.MaxValue)
|
||||
thisConnInfo[e.CALL_NUMBER].m_iRecvCommandCnt = 0;
|
||||
|
||||
if (FlowCommandControl[iGetCall] == null)
|
||||
return;
|
||||
|
||||
int iStoreCnt = senderData.Count();
|
||||
byte[] recvStoreBuffer = senderData;
|
||||
|
||||
//소켓 리시브 행위 결과 전송
|
||||
if (e.PROCESS_RESULT == false)
|
||||
{
|
||||
//받기 실패 단순 실패 응답
|
||||
FlowCommandControl[iGetCall].InsertSendQueue(DateTime.Now, XCommons.SetSimpleResponsPacket(new BASE_PROTOCOL(BASE_PROTOCOL.PROTOCOL_CODE.SIMPLE_RESPONSE), false), null, false, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
BASE_PROTOCOL GET_PROTOCOL = XCommons.GetHeaderProtocol(iStoreCnt, recvStoreBuffer);
|
||||
BASE_PROTOCOL.PROTOCOL_CODE GET_CODE = GET_PROTOCOL.GET_CURRENT_PROTOCOL;
|
||||
|
||||
//응답
|
||||
if (GET_CODE == BASE_PROTOCOL.PROTOCOL_CODE.SIMPLE_RESPONSE)
|
||||
{
|
||||
if (XCommons.GetSimpleResponsResult(iStoreCnt, recvStoreBuffer))
|
||||
FlowCommandControl[iGetCall].SetSendPacketDrop();
|
||||
else
|
||||
FlowCommandControl[iGetCall].SendPacketCycle();
|
||||
}
|
||||
//파일 끝 응답
|
||||
else if (GET_CODE == BASE_PROTOCOL.PROTOCOL_CODE.RAW_END)
|
||||
{
|
||||
if (XCommons.GetSimpleResponsResult(iStoreCnt, recvStoreBuffer))
|
||||
FlowCommandControl[iGetCall].RawStoreQueuePOP();
|
||||
else
|
||||
FlowCommandControl[iGetCall].RawStoreQueuePOP();
|
||||
}
|
||||
//일반 응답
|
||||
else
|
||||
{
|
||||
//성공 응답
|
||||
FlowCommandControl[iGetCall].InsertSendQueue(DateTime.Now, XCommons.SetSimpleResponsPacket(new BASE_PROTOCOL(BASE_PROTOCOL.PROTOCOL_CODE.SIMPLE_RESPONSE), true), null, false, false);
|
||||
|
||||
//받은 큐에 넣어놓기
|
||||
FlowCommandControl[iGetCall].InsertRecvQueue(senderData, null, e.nLABEL);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"General <RecvCommandEvent> failed.[SystemX.Net.MiddlewareUI : MainForm.RecvCommandEvent]\r\n" + ex.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
}
|
||||
|
||||
private bool QueryRecvCommandProcess(int iFlowPos, string strProcessInfo)
|
||||
{
|
||||
int i = iFlowPos;
|
||||
|
||||
bool bState = true;
|
||||
//
|
||||
XData getXData = FlowCommandControl[i].GetResultPacketData();
|
||||
|
||||
if (getXData == null)
|
||||
return false;
|
||||
|
||||
try
|
||||
{
|
||||
thisConnInfo[i].stCommandProcessTime.Restart();
|
||||
|
||||
BASE_PROTOCOL GET_PROTOCOL = getXData.BaseProtocol;
|
||||
BASE_PROTOCOL.PROTOCOL_CODE CODE = GET_PROTOCOL.GET_CURRENT_PROTOCOL;
|
||||
|
||||
HEADER_PACKET getHeader = getXData.HeaderPacket;
|
||||
object objData = getXData.objData;
|
||||
|
||||
byte ucGetLabel = getXData.nLabel;
|
||||
|
||||
bool bUseLabel = true;
|
||||
|
||||
ProtocolShell PS = null;
|
||||
|
||||
switch (CODE)
|
||||
{
|
||||
case BASE_PROTOCOL.PROTOCOL_CODE.CONNECT_STATE:
|
||||
PS = new CONNECT_STATE(this, i, ucGetLabel);
|
||||
PS.ExecuteProtocol(GET_PROTOCOL,
|
||||
CODE,
|
||||
getHeader,
|
||||
objData);
|
||||
break;
|
||||
case BASE_PROTOCOL.PROTOCOL_CODE.DATASET_TRANSEFER:
|
||||
{
|
||||
DataSet ds = null;
|
||||
|
||||
if (getXData.bReplayResult) //Query 성공
|
||||
ds = objData as DataSet;
|
||||
else //Query 실패
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + strProcessInfo + @" PROTOCOL_CODE.DATASET_TRANSEFER Fail.[SystemX.Net.MiddlewareUI : MainForm.QueryRecvCommandQueue]", ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
break;
|
||||
case BASE_PROTOCOL.PROTOCOL_CODE.HOST_INFO_CHECK:
|
||||
if (LoadInfo.USE_HOST_INFO)
|
||||
{
|
||||
PS = new HOST_INFO_CHECK(this, i, ucGetLabel);
|
||||
PS.ExecuteProtocol(GET_PROTOCOL,
|
||||
CODE,
|
||||
getHeader,
|
||||
objData);
|
||||
bUseLabel = false;
|
||||
}
|
||||
break;
|
||||
case BASE_PROTOCOL.PROTOCOL_CODE.PROCESS_QUERY:
|
||||
PS = new PROCESS_QUERY(this, i, ucGetLabel);
|
||||
PS.ExecuteProtocol(GET_PROTOCOL,
|
||||
CODE,
|
||||
getHeader,
|
||||
objData);
|
||||
break;
|
||||
case BASE_PROTOCOL.PROTOCOL_CODE.SYSTEM_QUERY:
|
||||
PS = new SYSTEM_QUERY(this, i, ucGetLabel);
|
||||
PS.ExecuteProtocol(GET_PROTOCOL,
|
||||
CODE,
|
||||
getHeader,
|
||||
objData);
|
||||
break;
|
||||
case BASE_PROTOCOL.PROTOCOL_CODE.USER_QUERY:
|
||||
PS = new USER_QUERY(this, i, ucGetLabel);
|
||||
PS.ExecuteProtocol(GET_PROTOCOL,
|
||||
CODE,
|
||||
getHeader,
|
||||
objData);
|
||||
break;
|
||||
case BASE_PROTOCOL.PROTOCOL_CODE.ETC:
|
||||
{
|
||||
try
|
||||
{
|
||||
USER_PACKET CustomPacket = (USER_PACKET)objData;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + strProcessInfo + @" <BASE_PROTOCOL.PROTOCOL_CODE.ETC:> Recv queue process fail.[SystemX.Net.MiddlewareUI : MainForm.QueryRecvCommandQueue]\r\n" + e.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
finally
|
||||
{ }
|
||||
}
|
||||
break;
|
||||
case BASE_PROTOCOL.PROTOCOL_CODE.INITILALIZE_INFO:
|
||||
{
|
||||
COMM_INFO_PACKET usPacket = (COMM_INFO_PACKET)objData;
|
||||
|
||||
if (ServerCommandSock[i].SOCK_TYPE == SOCKET_TYPE.TCP)
|
||||
{
|
||||
stWatchInitialTime[i].Restart();
|
||||
m_bInitialCallState[i] = false;
|
||||
|
||||
InitializePortDistributionInfoSend(i, "MANUAL", false, PacketFlowControl.CommInfoManualToken);
|
||||
|
||||
thisConnInfo[i].ClientConnectState = false;
|
||||
}
|
||||
else if (ServerCommandSock[i].SOCK_TYPE == SOCKET_TYPE.UDP)
|
||||
{
|
||||
ServerCommandSock[i].strSetRemoteAddress = usPacket.objConnLocalAddress[0].Data;
|
||||
ServerCommandSock[i].strSetRemotePort = usPacket.objConnLocalPort[0].Data;
|
||||
|
||||
stWatchInitialTime[i].Restart();
|
||||
m_bInitialCallState[i] = true;
|
||||
|
||||
ConnPool[i].ConnWaitTimerReset();
|
||||
|
||||
thisConnInfo[i].Initialize();
|
||||
|
||||
thisConnInfo[i].ClientConnectState = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (ServerCommandSock[i].CLIENT_CONNECT && PS != null)
|
||||
{
|
||||
if (PS.GetShellSendOnState())
|
||||
{
|
||||
if (PS.nByteListSize > 0 && PS.IsByteList)
|
||||
{
|
||||
DateTime dtSendTime = DateTime.Now;
|
||||
for (int j = 0; j < PS.nByteListSize; j++)
|
||||
{
|
||||
if (FlowStreamControl[i].InsertSendQueue(dtSendTime, PS.ArrSendByte(j), null, ucGetLabel, true, true) == PacketFlowControl.CommonErrCode)
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (PS.ArrSendByte() != null)
|
||||
{
|
||||
if (bUseLabel)
|
||||
FlowCommandControl[i].InsertSendQueue(DateTime.Now, PS.ArrSendByte(), null, ucGetLabel);
|
||||
else
|
||||
FlowCommandControl[i].InsertSendQueue(DateTime.Now, PS.ArrSendByte(), null, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
thisConnInfo[i].lCommandTime = thisConnInfo[i].stCommandProcessTime.ElapsedMilliseconds;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + strProcessInfo + @" Recv queue process fail.[SystemX.Net.MiddlewareUI : MainForm.QueryRecvCommandProcess]\r\n" + e.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
|
||||
bState = false;
|
||||
}
|
||||
|
||||
return bState;
|
||||
}
|
||||
private bool QueryRecvCommandQueue()
|
||||
{
|
||||
bool bState = true;
|
||||
|
||||
string strProcessDebugInfo = "[Unknown]";
|
||||
|
||||
try
|
||||
{
|
||||
bTaskCommandWaitLock = true;
|
||||
|
||||
//Port-distribution
|
||||
for (int i = 0; i < PORT_DISTRIBUTION_NUM; i++)
|
||||
{
|
||||
if (m_bTaskCommandBlock)
|
||||
break;
|
||||
if (ListenServerOnState[i] == false)
|
||||
continue;
|
||||
|
||||
//0 ~ 10 : Listen Distribution
|
||||
if (m_bInitialCallState[i])
|
||||
{
|
||||
if (stWatchInitialTime[i].ElapsedMilliseconds >= 100)
|
||||
{
|
||||
stWatchInitialTime[i].Restart();
|
||||
m_bInitialCallState[i] = false;
|
||||
|
||||
InitializePortDistributionInfoSend(i, "AUTO", false, PacketFlowControl.CommInfoAutoToken);
|
||||
|
||||
thisConnInfo[i].ClientConnectState = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (ServerCommandSock[i] == null)
|
||||
continue;
|
||||
if (FlowCommandControl[i] == null)
|
||||
continue;
|
||||
if (FlowCommandControl[i].GetCurrentRecvProcessData() != null)
|
||||
continue;
|
||||
|
||||
strProcessDebugInfo = "[" + (i).ToString("D2") + "]" +
|
||||
"[" + ConnPool[i].nUseCommandPort + "]" +
|
||||
"[" + thisConnInfo[i].strConnectHostID + "]" +
|
||||
"[" + thisConnInfo[i].strConnectSection + "]";
|
||||
|
||||
bState = QueryRecvCommandProcess(i, strProcessDebugInfo);
|
||||
|
||||
/*
|
||||
else
|
||||
{
|
||||
if (thisConnInfo[i].ClientConnectState)
|
||||
{
|
||||
if (stWatchInitialTime[i].ElapsedMilliseconds >= 5000)
|
||||
{
|
||||
stWatchInitialTime[i].Restart();
|
||||
|
||||
InitializePortDistributionInfoSend(i, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
//Process
|
||||
for (int i = PORT_DISTRIBUTION_NUM; i < ALL_MANAGE_NUM && !m_bTaskCommandBlock; i++)
|
||||
{
|
||||
if (ServerCommandSock[i] == null)
|
||||
continue;
|
||||
else {
|
||||
if (ServerCommandSock[i].CLIENT_CONNECT == false) {
|
||||
if (ConnPool[i].bLastConnState)
|
||||
continue;
|
||||
|
||||
if (ConnPool[i].ConnWaitTime() >= 90000) {
|
||||
//RemoveElement(i);
|
||||
|
||||
ClearServerInstance(i);
|
||||
|
||||
ConnPool[i].Initialize();
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
if (FlowCommandControl[i] == null)
|
||||
continue;
|
||||
if (FlowCommandControl[i].GetCurrentRecvProcessData() != null)
|
||||
continue;
|
||||
//
|
||||
if (m_bInitialCallState[i])
|
||||
{
|
||||
//접속 후 1초 뒤 Initial
|
||||
if (stWatchInitialTime[i].ElapsedMilliseconds >= 1000)
|
||||
{
|
||||
m_bInitialCallState[i] = false;
|
||||
|
||||
InitializeInfoSend(i);
|
||||
}
|
||||
}
|
||||
//
|
||||
thisConnInfo[i].m_iSendCommandQueueSize = FlowCommandControl[i].GetSendQueueSize();
|
||||
thisConnInfo[i].m_iRecvCommandQueueSize = FlowCommandControl[i].GetRecvQueueSize();
|
||||
|
||||
if ((thisConnInfo[i].m_iSendCommandQueueSize + 1) == int.MaxValue)
|
||||
thisConnInfo[i].m_iSendCommandQueueSize = 0;
|
||||
if ((thisConnInfo[i].m_iRecvCommandQueueSize + 1) == int.MaxValue)
|
||||
thisConnInfo[i].m_iRecvCommandQueueSize = 0;
|
||||
|
||||
strProcessDebugInfo = "[" + (i).ToString("D2") + "]" +
|
||||
"[" + ConnPool[i].nUseCommandPort + "]" +
|
||||
"[" + thisConnInfo[i].strConnectHostID + "]" +
|
||||
"[" + thisConnInfo[i].strConnectSection + "]";
|
||||
|
||||
bState = QueryRecvCommandProcess(i, strProcessDebugInfo);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + strProcessDebugInfo + @" Recv queue process fail.[SystemX.Net.MiddlewareUI : MainForm.QueryRecvCommandQueue]\r\n" + e.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
|
||||
bState = false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
bTaskCommandWaitLock = false;
|
||||
|
||||
nCommandNumber++;
|
||||
|
||||
if (nCommandNumber >= ALL_MANAGE_NUM)
|
||||
nCommandNumber = 0;
|
||||
}
|
||||
|
||||
return bState;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,108 @@
|
||||
using DevExpress.Data.Helpers;
|
||||
using DevExpress.XtraBars;
|
||||
using DevExpress.XtraBars.Navigation;
|
||||
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml.Linq;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
|
||||
using SystemX.Net;
|
||||
using SystemX.Common;
|
||||
using SystemX.Net.BaseProtocol;
|
||||
using SystemX.Net.Comm;
|
||||
using SystemX.Net.Schedule;
|
||||
using SystemX.Net.DB;
|
||||
using SystemX.Common.Serialization;
|
||||
using SystemX.Common.Archive;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using SystemX.Common.Protocol.SIA;
|
||||
|
||||
using static SystemX.Net.Platform.Common.Util.LogMessage;
|
||||
using SystemX.Net.Platform.Common.ExtensionMethods;
|
||||
|
||||
namespace SystemX.Net.MiddlewareUI
|
||||
{
|
||||
public partial class MainForm : DevExpress.XtraBars.FluentDesignSystem.FluentDesignForm
|
||||
{
|
||||
static internal class CpLogProcessInfo
|
||||
{
|
||||
static public string strProcessDebugInfo = string.Empty;
|
||||
static public string strGetFileName = string.Empty;
|
||||
|
||||
//Summary 삽입 정보 생성
|
||||
static public string strHostID = string.Empty;
|
||||
static public string strSection = string.Empty;
|
||||
static public string strStationID = string.Empty;
|
||||
static public string strIdent = string.Empty;
|
||||
static public string strStationName = string.Empty;
|
||||
static public string strProdNo_P = string.Empty;
|
||||
static public string strProdNo_C = string.Empty;
|
||||
static public string strTestType = string.Empty;
|
||||
static public string strTestCode = string.Empty;
|
||||
static public string strVersion = string.Empty;
|
||||
static public string strProdCode = string.Empty;
|
||||
static public string strTestListCntID = string.Empty;
|
||||
|
||||
static public int nTestListFileNo = int.MaxValue;
|
||||
static public int nTestListVariantNo = int.MaxValue;
|
||||
static public int nTestListReleaseNo = int.MaxValue;
|
||||
|
||||
static public string strCpLogFileComment = string.Empty;
|
||||
|
||||
static public Dictionary<string, string> dicCpLogHeader = new Dictionary<string, string>();
|
||||
|
||||
static public int nGetReadStepVersion = int.MaxValue;
|
||||
|
||||
/*
|
||||
* CpLog Header 상 검사 시작 시간 획득 및 맨앞 공백 제거
|
||||
*/
|
||||
static public string strStTime = string.Empty;
|
||||
|
||||
static public long lMainMeasTime = 0;
|
||||
static public long lLongTermMeasTime = 0;
|
||||
}
|
||||
|
||||
private string GetFileName(int iPos, HEADER_PACKET getHeader, string strCreateName, string strSubName)
|
||||
{
|
||||
Random randNumber = new Random();
|
||||
|
||||
string strFileName = strCreateName;
|
||||
|
||||
if (getHeader.objOptionName[0].Data.CompareTo("-") == 0)
|
||||
strFileName += @strSubName + @randNumber.Next().ToString() + @thisConnInfo[iPos].strRecvFileExtension;
|
||||
else
|
||||
strFileName += @thisConnInfo[iPos].strRecvFileName + @thisConnInfo[iPos].strRecvFileExtension;
|
||||
|
||||
if (File.Exists(strFileName) == true)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
strFileName = strCreateName;
|
||||
|
||||
if (getHeader.objOptionName[0].Data.CompareTo("-") == 0)
|
||||
strFileName += @strSubName + @randNumber.Next().ToString() + @thisConnInfo[iPos].strRecvFileExtension;
|
||||
else
|
||||
strFileName += @thisConnInfo[iPos].strRecvFileName + "_" + @randNumber.Next().ToString() + @thisConnInfo[iPos].strRecvFileExtension;
|
||||
|
||||
if (File.Exists(strFileName) == false)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return strFileName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,456 @@
|
||||
using DevExpress.Data.Helpers;
|
||||
using DevExpress.XtraBars;
|
||||
using DevExpress.XtraBars.Navigation;
|
||||
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml.Linq;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
|
||||
using SystemX.Net;
|
||||
using SystemX.Common;
|
||||
using SystemX.Net.BaseProtocol;
|
||||
using SystemX.Net.Comm;
|
||||
using SystemX.Net.Schedule;
|
||||
using SystemX.Net.DB;
|
||||
using SystemX.Common.Serialization;
|
||||
using SystemX.Common.Archive;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using SystemX.Common.Protocol.SIA;
|
||||
|
||||
using static SystemX.Net.Platform.Common.Util.LogMessage;
|
||||
using System.Threading;
|
||||
using SystemX.Net.Middleware.Commons;
|
||||
using SystemX.Net.Platform.SystemX.Common;
|
||||
using CpTesterPlatform.CpLogUtil;
|
||||
|
||||
namespace SystemX.Net.MiddlewareUI
|
||||
{
|
||||
public partial class MainForm : DevExpress.XtraBars.FluentDesignSystem.FluentDesignForm
|
||||
{
|
||||
private async void WatchMappedLogQueue()
|
||||
{
|
||||
await Task.Delay(250);
|
||||
|
||||
while (!m_bTaskMappedLogBlock)
|
||||
{
|
||||
try
|
||||
{
|
||||
CT.ThrowIfCancellationRequested();
|
||||
}
|
||||
catch (OperationCanceledException CancelEx)
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @" Work Canceled. [SystemX.Net.MiddlewareUI : MainForm.WatchRecvStreamQueue]\r\n" + CancelEx.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
|
||||
break;
|
||||
}
|
||||
//
|
||||
try
|
||||
{
|
||||
if (MappedLogQueueData.Count > 0)
|
||||
{
|
||||
Tuple<string, int, HEADER_PACKET, byte[]> GetMappedLogData;
|
||||
|
||||
if (MappedLogQueueData.TryPeek(out GetMappedLogData))
|
||||
{
|
||||
if (SetMemoryMappedFile(GetMappedLogData.Item1, GetMappedLogData.Item2, GetMappedLogData.Item3, GetMappedLogData.Item4))
|
||||
{
|
||||
nMappedLogDataInOutFailedCnt = 0;
|
||||
|
||||
if (MappedLogQueueData.TryDequeue(out GetMappedLogData) == false)
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @" Dequeue(PASS) failed. [SystemX.Net.MiddlewareUI : MainForm.WatchRecvStreamQueue]\r\n", ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (nMappedLogDataInOutFailedCnt > 1)
|
||||
{
|
||||
nMappedLogDataInOutFailedCnt = 0;
|
||||
|
||||
if (MappedLogQueueData.TryDequeue(out GetMappedLogData) == false)
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @" Dequeue(FAIL) failed. [SystemX.Net.MiddlewareUI : MainForm.WatchRecvStreamQueue]\r\n", ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
|
||||
nMappedLogDataInOutFailedCnt++;
|
||||
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @" SetMemoryMappedFile Process failed. [SystemX.Net.MiddlewareUI : MainForm.WatchRecvStreamQueue]\r\n", ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
}
|
||||
else
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @" TryPeek failed. [SystemX.Net.MiddlewareUI : MainForm.WatchRecvStreamQueue]\r\n", ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @" General Queue Process failed. [SystemX.Net.MiddlewareUI : MainForm.WatchRecvStreamQueue]\r\n" + e.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
|
||||
if(bUseMapLogProcess)
|
||||
await Task.Delay(100);
|
||||
else
|
||||
await Task.Delay(10000);
|
||||
}
|
||||
}
|
||||
|
||||
public bool SetMemoryMappedFile(string strType, int nPos, HEADER_PACKET getHeader, byte[] ucFileData)
|
||||
{
|
||||
bool bMapLogCreateResult = true;
|
||||
|
||||
int nSetSize = int.MaxValue;
|
||||
|
||||
byte[] ucSetLogArray = null;
|
||||
|
||||
int nSetReadyPos = (nPos - PORT_DISTRIBUTION_NUM) * LogSharedMemory.nMaxStationSize;
|
||||
|
||||
string strProcessDebugInfo = string.Empty;
|
||||
strProcessDebugInfo = "[" + (nPos).ToString("D2") + "]" +
|
||||
"[" + ConnPool[nPos].nUseStreamPort + "]" +
|
||||
"[" + thisConnInfo[nPos].strConnectHostID + "]" +
|
||||
"[" + thisConnInfo[nPos].strConnectSection + "]";
|
||||
|
||||
CpLogProcessInfo.strProcessDebugInfo = strProcessDebugInfo;
|
||||
|
||||
try
|
||||
{
|
||||
using (InfoLogSharedMemory memInfoLog = new InfoLogSharedMemory(ParamterMapInfoLog))
|
||||
{
|
||||
InfoLogMappedPacket InfoLogMapFile = new InfoLogMappedPacket();
|
||||
nSetSize = Marshal.SizeOf(InfoLogMapFile);
|
||||
ucSetLogArray = new byte[nSetSize];
|
||||
InfoLogMapFile = (InfoLogMappedPacket)SystemXNetSerialization.RawDeSerialize(ucSetLogArray, InfoLogMapFile.GetType());
|
||||
|
||||
if (memInfoLog.CheckFile())
|
||||
{
|
||||
bool bFindInfoLogResult = false;
|
||||
|
||||
//로그 처리가 필요한 위치 조회
|
||||
bool[] bGetStationReadyLog = memInfoLog.Get(out bFindInfoLogResult, nSetSize);
|
||||
|
||||
if (bFindInfoLogResult)
|
||||
Array.Copy(bGetStationReadyLog, 0, InfoLogMapFile.bLogDataReady, 0, SharedMemory.nMaxInfoFullAccessSize);
|
||||
|
||||
using (LogSharedMemory memLog = new LogSharedMemory(ParamterMapLog))
|
||||
{
|
||||
LogMappedPacket LogMapFile = new LogMappedPacket();
|
||||
nSetSize = Marshal.SizeOf(LogMapFile);
|
||||
ucSetLogArray = new byte[nSetSize];
|
||||
LogMapFile = (LogMappedPacket)SystemXNetSerialization.RawDeSerialize(ucSetLogArray, LogMapFile.GetType());
|
||||
|
||||
LogMapFile.bSectionUse = true;
|
||||
LogMapFile.objLogType[0].Data = strType;
|
||||
LogMapFile.bLogFileReadComplete = false;
|
||||
LogMapFile.bLogFileProcessComplete = false;
|
||||
LogMapFile.nNumber = nPos;
|
||||
LogMapFile.bShowCpLogProcessTime = bShowCpLogProcessTime;
|
||||
LogMapFile.nCommandPort = ConnPool[nPos].nUseCommandPort;
|
||||
LogMapFile.nStreamPort = ConnPool[nPos].nUseStreamPort;
|
||||
LogMapFile.objHost[0].Data = thisConnInfo[nPos].strConnectHostID;
|
||||
LogMapFile.objSection[0].Data = thisConnInfo[nPos].strConnectSection;
|
||||
|
||||
bool bMakeTempTestListCntID = false;
|
||||
string strGetStationNameChk = getHeader.objCP_Packet[0].objStationName[0].Data;
|
||||
string strSetOrgStationName = string.Empty;
|
||||
|
||||
bool bHaveTestListID = false;
|
||||
string strGetTransferTestListCntID = string.Empty;
|
||||
|
||||
if (strGetStationNameChk.IndexOf(";@#$%;TFL") >= 0)
|
||||
{
|
||||
bMakeTempTestListCntID = true;
|
||||
|
||||
strSetOrgStationName = strGetStationNameChk.Substring(0, strGetStationNameChk.IndexOf(";@#$%;TFL"));
|
||||
}
|
||||
else
|
||||
strSetOrgStationName = strGetStationNameChk;
|
||||
|
||||
strGetTransferTestListCntID = getHeader.objVarParam1[0].Data;
|
||||
|
||||
if (strGetTransferTestListCntID.Split('@').Count() > 1)
|
||||
bHaveTestListID = true;
|
||||
|
||||
LogMapFile.objStationName[0].Data = strSetOrgStationName;
|
||||
LogMapFile.objOptionFileName[0].Data = getHeader.objOptionName[0].Data;
|
||||
LogMapFile.objOptionFileExtension[0].Data = getHeader.objOptionExtension[0].Data;
|
||||
|
||||
LogMapFile.nStationID = 0;
|
||||
LogMapFile.objProdPNo[0].Data = getHeader.objCP_Packet[0].objProdNo_P[0].Data;
|
||||
LogMapFile.objProdCNo[0].Data = getHeader.objCP_Packet[0].objProdNo_C[0].Data;
|
||||
LogMapFile.objTestType[0].Data = getHeader.objCP_Packet[0].objTestType[0].Data;
|
||||
LogMapFile.objTestCode[0].Data = getHeader.objCP_Packet[0].objTestCode[0].Data;
|
||||
LogMapFile.objVersion[0].Data = getHeader.objCP_Packet[0].objVersion[0].Data;
|
||||
LogMapFile.objProdCode[0].Data = getHeader.objCP_Packet[0].objProdCode[0].Data;
|
||||
LogMapFile.nTestListVariantNo = (int)getHeader.objCP_Packet[0].uiTestListNo;
|
||||
|
||||
bool bCheckResult = string.IsNullOrEmpty(thisConnInfo[nPos].strResultTestListCntID);
|
||||
if (bCheckResult || bMakeTempTestListCntID)
|
||||
{
|
||||
string strSetTempTestListCntID = string.Empty;
|
||||
|
||||
if (bHaveTestListID == false)
|
||||
strSetTempTestListCntID = DateTime.Now.ToString("yyyyMMddHHmmssfff") + "@0";
|
||||
else
|
||||
strSetTempTestListCntID = strGetTransferTestListCntID;
|
||||
|
||||
/// TODO : Failed Transfer File
|
||||
/// Ver 0
|
||||
/// 빈 아이디가 아닐 경우 현재 아이디 정보와 재전송 파일 정보 비교하여 동일할 경우 현재 아이디로 저장
|
||||
/// > 추후 분류(검색)에 문제가 될경우 임시 아이디로 변경 해야 할수도 있다.
|
||||
///
|
||||
/// Ver 1
|
||||
/// 실패한 파일일때만 아이디 확인, 없으면 임시, 있으면 보낸 아이디로 저장
|
||||
/*
|
||||
if (bCheckResult == false)
|
||||
{
|
||||
string strHostSectionInfo =
|
||||
thisConnInfo[nPos].strConnectHostID + ";" +
|
||||
thisConnInfo[nPos].strConnectSection;
|
||||
|
||||
string strMakeCntID =
|
||||
getHeader.objCP_Packet[0].objProdNo_C[0].Data + ";" +
|
||||
getHeader.objCP_Packet[0].objTestType[0].Data + ";" +
|
||||
getHeader.objCP_Packet[0].objTestCode[0].Data + ";" +
|
||||
getHeader.objCP_Packet[0].objVersion[0].Data + ";" +
|
||||
getHeader.objCP_Packet[0].objProdCode[0].Data;// + ";" +
|
||||
//strFileName;
|
||||
|
||||
//패킷의 정보로 Dic 검색 후 존재 한다면 생성하여 현재 아이디랑 비교후 일치한다면 현재 ID 사용
|
||||
if (dicQueryTestListCntID.ContainsKey(strHostSectionInfo))
|
||||
{
|
||||
if (dicQueryTestListCntID[strHostSectionInfo].ContainsKey(strMakeCntID))
|
||||
{
|
||||
string strGetCurTLCntID = dicQueryTestListCntID[strHostSectionInfo][strMakeCntID].dtAccessTime.ToString("yyyyMMddHHmmssfff") + "@" +
|
||||
dicQueryTestListCntID[strHostSectionInfo][strMakeCntID].nCnt.ToString();
|
||||
|
||||
if (thisConnInfo[nPos].strResultTestListCntID.CompareTo(strGetCurTLCntID) == 0)
|
||||
strSetTempTestListCntID = thisConnInfo[nPos].strResultTestListCntID;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
LogMapFile.objResultTestListCntID[0].Data = strSetTempTestListCntID;
|
||||
}
|
||||
else
|
||||
LogMapFile.objResultTestListCntID[0].Data = thisConnInfo[nPos].strResultTestListCntID;
|
||||
|
||||
ucFileData.CopyTo(LogMapFile.ucLogData, 0);
|
||||
|
||||
LogMapFile.nLogDataSize = ucFileData.Count();
|
||||
//
|
||||
string strRandFilePath = string.Empty;
|
||||
|
||||
byte[] ucGetFileData = null;
|
||||
byte[] ucSetFileData = null;
|
||||
|
||||
try
|
||||
{
|
||||
ucGetFileData = new byte[LogMapFile.nLogDataSize];
|
||||
Array.Copy(LogMapFile.ucLogData, 0, ucGetFileData, 0, LogMapFile.nLogDataSize);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + CpLogProcessInfo.strProcessDebugInfo + @" CpLog - Create file data make failed. [SystemX.Net.MiddlewareUI : MainForm.SetMemoryMappedFile] " + e.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
|
||||
ucGetFileData = null;
|
||||
|
||||
bMapLogCreateResult = false;
|
||||
}
|
||||
//
|
||||
try
|
||||
{
|
||||
string strRandName = Path.GetRandomFileName();
|
||||
string strRandFile = Path.GetFileNameWithoutExtension(strRandName);
|
||||
|
||||
string strRandPath = Path.GetTempPath();
|
||||
strRandFilePath = strRandPath + strRandFile + LogMapFile.objOptionFileExtension[0].Data;
|
||||
|
||||
if (ucGetFileData == null)
|
||||
throw new Exception("CpLog - Log file data null.");
|
||||
|
||||
if (LogMapFile.objLogType[0].Data == "RAW_SIZE")
|
||||
ucSetFileData = XDataArchive.DecompressGZipByteToByte(ucGetFileData);
|
||||
else if (LogMapFile.objLogType[0].Data == "FILE_TRANSFER")
|
||||
ucSetFileData = XDataArchive.DecompressDeflateByteToByte(ucGetFileData);
|
||||
|
||||
if (ucSetFileData == null)
|
||||
throw new Exception("CpLog - Log file data decompress failed.");
|
||||
|
||||
CpLogHeader getCpLogHeader = null;
|
||||
|
||||
File.WriteAllBytes(strRandFilePath, ucSetFileData);
|
||||
|
||||
//해당 CpLog 파일 읽기 및 헤더 정보 획득
|
||||
DataTable dtLogData = null;
|
||||
dtLogData = CpLogFileIO.GetLogData(strRandFilePath, out getCpLogHeader);
|
||||
|
||||
if (dtLogData != null && getCpLogHeader != null)
|
||||
{
|
||||
string strGetStationID = getCpLogHeader.CHANNEL.Trim();
|
||||
|
||||
int nGetStationID = int.MaxValue;
|
||||
if (int.TryParse(strGetStationID, out nGetStationID))
|
||||
LogMapFile.nStationID = nGetStationID;
|
||||
|
||||
if (nGetStationID < 0)
|
||||
{
|
||||
LogMapFile.nStationID = 0;
|
||||
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + CpLogProcessInfo.strProcessDebugInfo + @" CpLog - StationID negative value [" + nGetStationID.ToString() + "] detect. [SystemX.Net.MiddlewareUI : MainForm.SetMemoryMappedFile] ", ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
}
|
||||
|
||||
if (LogMapFile.nStationID >= LogSharedMemory.nMaxStationSize)
|
||||
{
|
||||
if (InfoLogMapFile.bLogDataReady[nSetReadyPos])
|
||||
InfoLogMapFile.bLogDataReady[nSetReadyPos] = false;
|
||||
else
|
||||
InfoLogMapFile.bLogDataReady[nSetReadyPos] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (InfoLogMapFile.bLogDataReady[nSetReadyPos + LogMapFile.nStationID])
|
||||
InfoLogMapFile.bLogDataReady[nSetReadyPos + LogMapFile.nStationID] = false;
|
||||
else
|
||||
InfoLogMapFile.bLogDataReady[nSetReadyPos + LogMapFile.nStationID] = true;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + CpLogProcessInfo.strProcessDebugInfo + @" CpLog - Check StationID failed. [SystemX.Net.MiddlewareUI : MainForm.SetMemoryMappedFile] " + e.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
|
||||
bMapLogCreateResult = false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (File.Exists(strRandFilePath))
|
||||
File.Delete(strRandFilePath);
|
||||
|
||||
if (bMapLogCreateResult == false)
|
||||
{
|
||||
//문제 발생 로그 확인 파일생성 위치 및 파일명 생성
|
||||
if (ucGetFileData == null)
|
||||
goto CHECK_LOG_FILE_MAKE_SKIP;
|
||||
if (ucSetFileData == null)
|
||||
goto CHECK_LOG_FILE_MAKE_SKIP;
|
||||
|
||||
try
|
||||
{
|
||||
string strMakeDate = DateTime.Now.ToString(@"yyyy\\MM\\dd\\");
|
||||
|
||||
string strCreateFileName = CPXV2_GetCheckLogFilePath(LogMapFile, strMakeDate);
|
||||
|
||||
if (File.Exists(strCreateFileName) == false)
|
||||
File.WriteAllBytes(strCreateFileName, ucSetFileData);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + CpLogProcessInfo.strProcessDebugInfo + @" CpLog - Check log file create failed. [SystemX.Net.MiddlewareUI : MainForm.SetMemoryMappedFile] " + ex.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
}
|
||||
|
||||
CHECK_LOG_FILE_MAKE_SKIP:;
|
||||
}
|
||||
|
||||
memLog.Set(nPos, LogMapFile);
|
||||
}
|
||||
|
||||
memInfoLog.Set(InfoLogMapFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(memInfoLog.CheckExistsInfoFile() == false)
|
||||
memInfoLog.Set(InfoLogMapFile);
|
||||
|
||||
//Info File Access Failed
|
||||
bMapLogCreateResult = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
/*
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + CpLogProcessInfo.strProcessDebugInfo + @" CpLog - " + $"ST Frame Count {st.FrameCount} [SystemX.Net.MiddlewareUI : MainForm.SetMemoryMappedFile] " + e.Message, ConsoleColor.Red, LogMessageLevel.FATAL);
|
||||
|
||||
for (int n = 0; n < st.FrameCount; n++)
|
||||
{
|
||||
StackFrame sf = st.GetFrame(n);
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + CpLogProcessInfo.strProcessDebugInfo + @" CpLog - " + $"ST Method To String {sf.GetMethod()} [SystemX.Net.MiddlewareUI : MainForm.SetMemoryMappedFile] " + e.Message, ConsoleColor.Red, LogMessageLevel.FATAL);
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + CpLogProcessInfo.strProcessDebugInfo + @" CpLog - " + $"ST Method Name {sf.GetMethod().Name} [SystemX.Net.MiddlewareUI : MainForm.SetMemoryMappedFile] " + e.Message, ConsoleColor.Red, LogMessageLevel.FATAL);
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + CpLogProcessInfo.strProcessDebugInfo + @" CpLog - " + $"ST Line Number {sf.GetFileLineNumber()} [SystemX.Net.MiddlewareUI : MainForm.SetMemoryMappedFile] " + e.Message, ConsoleColor.Red, LogMessageLevel.FATAL);
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + CpLogProcessInfo.strProcessDebugInfo + @" CpLog - " + $"ST Column Number {sf.GetFileColumnNumber()} [SystemX.Net.MiddlewareUI : MainForm.SetMemoryMappedFile] " + e.Message, ConsoleColor.Red, LogMessageLevel.FATAL);
|
||||
}
|
||||
*/
|
||||
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + CpLogProcessInfo.strProcessDebugInfo + @" CpLog - Create Map Log failed. [SystemX.Net.MiddlewareUI : MainForm.SetMemoryMappedFile] " + e.Message, ConsoleColor.Red, LogMessageLevel.FATAL);
|
||||
|
||||
bMapLogCreateResult = false;
|
||||
}
|
||||
|
||||
//long l1 = stChkTime.ElapsedMilliseconds;
|
||||
|
||||
return bMapLogCreateResult;
|
||||
}
|
||||
|
||||
private string CPXV2_GetLogFileName(LogMappedPacket GetMappedInfo, string strCreateName)
|
||||
{
|
||||
Random randNumber = new Random();
|
||||
|
||||
string strFileName = strCreateName;
|
||||
|
||||
if (GetMappedInfo.objOptionFileName[0].Data.CompareTo("-") == 0)
|
||||
strFileName += @"LogFileTemp" + @randNumber.Next().ToString() + @GetMappedInfo.objOptionFileExtension[0].Data;
|
||||
else
|
||||
strFileName += @GetMappedInfo.objOptionFileName[0].Data + @GetMappedInfo.objOptionFileExtension[0].Data;
|
||||
|
||||
if (File.Exists(strFileName) == true)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
strFileName = strCreateName;
|
||||
|
||||
if (GetMappedInfo.objOptionFileName[0].Data.CompareTo("-") == 0)
|
||||
strFileName += @"LogFileTemp" + @randNumber.Next().ToString() + @GetMappedInfo.objOptionFileExtension[0].Data;
|
||||
else
|
||||
strFileName += @GetMappedInfo.objOptionFileName[0].Data + "_" + @randNumber.Next().ToString() + @GetMappedInfo.objOptionFileExtension[0].Data;
|
||||
|
||||
if (File.Exists(strFileName) == false)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return strFileName;
|
||||
}
|
||||
|
||||
private string CPXV2_GetCheckLogFilePath(LogMappedPacket GetMappedInfo,
|
||||
string strMakeDate,
|
||||
bool bGetOnlyFilePath = false)
|
||||
{
|
||||
string strMakeInfo = string.Empty;
|
||||
string strMakeName = string.Empty;
|
||||
|
||||
strMakeInfo = LoadInfo.SERVER_SAVE_POS + @"\" + strMakeDate;
|
||||
strMakeInfo += @"LogFileSave_ProcessPort" + "(" + GetMappedInfo.nStreamPort + ")_" + GetMappedInfo.objHost[0].Data + "_" + GetMappedInfo.objSection[0].Data + @"\LogCheck\";
|
||||
|
||||
if (Directory.Exists(strMakeInfo) == false)
|
||||
Directory.CreateDirectory(strMakeInfo);
|
||||
|
||||
if (bGetOnlyFilePath == false)
|
||||
strMakeName = CPXV2_GetLogFileName(GetMappedInfo, strMakeInfo);
|
||||
else
|
||||
strMakeName = strMakeInfo;
|
||||
|
||||
return strMakeName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,434 @@
|
||||
using DevExpress.Data.Helpers;
|
||||
using DevExpress.XtraBars;
|
||||
using DevExpress.XtraBars.Navigation;
|
||||
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml.Linq;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
|
||||
using SystemX.Net;
|
||||
using SystemX.Common;
|
||||
using SystemX.Net.BaseProtocol;
|
||||
using SystemX.Net.Comm;
|
||||
using SystemX.Net.Schedule;
|
||||
using SystemX.Net.DB;
|
||||
using SystemX.Common.Serialization;
|
||||
using SystemX.Common.Archive;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using SystemX.Common.Protocol.SIA;
|
||||
|
||||
using SystemX.Net.Middleware.Commons;
|
||||
|
||||
using static SystemX.Net.Platform.Common.Util.LogMessage;
|
||||
using System.Threading;
|
||||
using static SystemX.Net.DB.XDBConnManager;
|
||||
|
||||
namespace SystemX.Net.MiddlewareUI
|
||||
{
|
||||
public partial class MainForm : DevExpress.XtraBars.FluentDesignSystem.FluentDesignForm
|
||||
{
|
||||
private bool IsImageExtension(string strFileNameInfo, bool bOnlyExtension = true)
|
||||
{
|
||||
if (bOnlyExtension)
|
||||
return -1 != Array.IndexOf(COMMON.mediaExtensions, strFileNameInfo.ToUpperInvariant());
|
||||
else
|
||||
return -1 != Array.IndexOf(COMMON.mediaExtensions, Path.GetExtension(strFileNameInfo).ToUpperInvariant());
|
||||
}
|
||||
|
||||
public List<byte[]> QueryStreamProcess(string strGetQuery, out byte[] ucQueryByteArray, out DataSet setResultDataSet, params string[] strSendParameters)
|
||||
{
|
||||
SqlDataReader xSqlReader = null;
|
||||
|
||||
int iFieldCnt = 0;
|
||||
int iRecordsAffectedCnt = 0;
|
||||
bool bHasRow = false;
|
||||
|
||||
ucQueryByteArray = null;
|
||||
|
||||
setResultDataSet = null;
|
||||
|
||||
DataSet ds = new DataSet();
|
||||
DataTable dt = new DataTable();
|
||||
|
||||
DataSet getDS = Task.Run(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
xSqlReader = MngDBConn.CurrentConnection(eConnCategory.Main).QueryDatabase(strGetQuery);
|
||||
|
||||
if (xSqlReader != null)
|
||||
{
|
||||
iFieldCnt = xSqlReader.FieldCount;
|
||||
iRecordsAffectedCnt = xSqlReader.RecordsAffected;
|
||||
bHasRow = xSqlReader.HasRows;
|
||||
|
||||
dt.Load(xSqlReader);
|
||||
ds.Tables.Add(dt);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"<" + strGetQuery + "> Query process fail![SystemX.Net.MiddlewareUI : MainForm.QueryProcess]\r\n" + e.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (xSqlReader != null)
|
||||
xSqlReader.Close();
|
||||
|
||||
xSqlReader = null;
|
||||
}
|
||||
|
||||
return ds;
|
||||
}).Result;
|
||||
|
||||
if(XCommons.isHasRow(ds))
|
||||
setResultDataSet = ds.Copy();
|
||||
|
||||
List<byte[]> getStreamList = XCommons.ObjectToByteStreamList(new BASE_PROTOCOL(BASE_PROTOCOL.PROTOCOL_CODE.RAW_SIZE), getDS, null, 0, strSendParameters);
|
||||
|
||||
return getStreamList;
|
||||
}
|
||||
|
||||
public void QueryResultRemake(DataSet dsResult, int iSetFieldCnt, int iSetRecordsAffectedCnt, bool bSetHasRow, out byte[] ucQueryByteArray, params string[] strParameters)
|
||||
{
|
||||
int iFieldCnt = iSetFieldCnt;
|
||||
int iRecordsAffectedCnt = iSetRecordsAffectedCnt;
|
||||
bool bHasRow = bSetHasRow;
|
||||
|
||||
ucQueryByteArray = null;
|
||||
|
||||
ucQueryByteArray = XCommons.ObjectToByteStream(new BASE_PROTOCOL(BASE_PROTOCOL.PROTOCOL_CODE.DATASET_TRANSEFER),
|
||||
dsResult,
|
||||
null,
|
||||
0,
|
||||
iRecordsAffectedCnt,
|
||||
bHasRow,
|
||||
iFieldCnt,
|
||||
strParameters);
|
||||
}
|
||||
|
||||
public Tuple<DataSet, int, int, bool> QueryProcess(string strGetQuery, out byte[] ucQueryByteArray, params string[] strParameters)
|
||||
{
|
||||
SqlDataReader xSqlReader = null;
|
||||
|
||||
int iFieldCnt = 0;
|
||||
int iRecordsAffectedCnt = 0;
|
||||
bool bHasRow = false;
|
||||
|
||||
ucQueryByteArray = null;
|
||||
|
||||
DataSet getDS = Task.Run(() =>
|
||||
{
|
||||
DataSet ds = new DataSet();
|
||||
DataTable dt = new DataTable();
|
||||
|
||||
bool bLockProcess = false;
|
||||
if (strGetQuery.IndexOf("HIST_TestResult") >= 0)
|
||||
bLockProcess = true;
|
||||
|
||||
if(bLockProcess)
|
||||
{
|
||||
//lock (objSingleTransactionDataAccessWait)
|
||||
{
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
xSqlReader = MngDBConn.CurrentConnection(eConnCategory.Main).QueryDatabase(strGetQuery);
|
||||
|
||||
if (xSqlReader != null)
|
||||
{
|
||||
iFieldCnt = xSqlReader.FieldCount;
|
||||
iRecordsAffectedCnt = xSqlReader.RecordsAffected;
|
||||
bHasRow = xSqlReader.HasRows;
|
||||
|
||||
dt.Load(xSqlReader);
|
||||
ds.Tables.Add(dt);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"<" + strGetQuery + "> Query process fail![SystemX.Net.MiddlewareUI : MainForm.QueryProcess]\r\n" + e.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (xSqlReader != null)
|
||||
xSqlReader.Close();
|
||||
|
||||
xSqlReader = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
xSqlReader = MngDBConn.CurrentConnection(eConnCategory.Main).QueryDatabase(strGetQuery);
|
||||
|
||||
if (xSqlReader != null)
|
||||
{
|
||||
iFieldCnt = xSqlReader.FieldCount;
|
||||
iRecordsAffectedCnt = xSqlReader.RecordsAffected;
|
||||
bHasRow = xSqlReader.HasRows;
|
||||
|
||||
dt.Load(xSqlReader);
|
||||
ds.Tables.Add(dt);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"<" + strGetQuery + "> Query process fail![SystemX.Net.MiddlewareUI : MainForm.QueryProcess]\r\n" + e.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (xSqlReader != null)
|
||||
xSqlReader.Close();
|
||||
|
||||
xSqlReader = null;
|
||||
}
|
||||
}
|
||||
|
||||
return ds;
|
||||
}).Result;
|
||||
|
||||
ucQueryByteArray = XCommons.ObjectToByteStream(new BASE_PROTOCOL(BASE_PROTOCOL.PROTOCOL_CODE.DATASET_TRANSEFER),
|
||||
getDS,
|
||||
null,
|
||||
0,
|
||||
iRecordsAffectedCnt,
|
||||
bHasRow,
|
||||
iFieldCnt,
|
||||
strParameters);
|
||||
|
||||
return new Tuple<DataSet, int, int, bool>(getDS, iRecordsAffectedCnt, iFieldCnt, bHasRow);
|
||||
}
|
||||
|
||||
private bool ExcuteNonQueryCommandProcess(SqlCommand cmd)
|
||||
{
|
||||
return Task.Run(() =>
|
||||
{
|
||||
bool bExcuteResult = true;
|
||||
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
bExcuteResult = MngDBConn.CurrentConnection(eConnCategory.Main).ExecuteNonCommandQuery(cmd);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
bExcuteResult = false;
|
||||
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"<" + cmd.CommandText + "> Query excute fail![SystemX.Net.MiddlewareUI : MainForm.AsyncExcuteNonQueryProcess]\r\n" + e.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
return bExcuteResult;
|
||||
}).Result;
|
||||
}
|
||||
|
||||
private bool ExcuteNonQueryStreamProcess(eConnCategory eConnType, SqlCommand cmd)
|
||||
{
|
||||
return Task.Run(() =>
|
||||
{
|
||||
bool bExcuteResult = true;
|
||||
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
bExcuteResult = MngDBConn.CurrentConnection(eConnType).ExecuteNonStreamQuery(cmd);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
bExcuteResult = false;
|
||||
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"<" + cmd.CommandText + "> Query excute fail![SystemX.Net.MiddlewareUI : MainForm.AsyncExcuteNonQueryProcess]\r\n" + e.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
return bExcuteResult;
|
||||
}).Result;
|
||||
}
|
||||
|
||||
private DataSet QueryCommandProcess(eConnCategory eConnType, string strGetQuery, bool bUseTransaction = false)
|
||||
{
|
||||
return Task.Run(() =>
|
||||
{
|
||||
DataSet ds = new DataSet();
|
||||
DataTable dt = new DataTable();
|
||||
|
||||
try
|
||||
{
|
||||
SqlDataReader xSqlReader = null;
|
||||
|
||||
try
|
||||
{
|
||||
int iFieldCnt = 0;
|
||||
int iRecordsAffectedCnt = 0;
|
||||
bool bHasRow = false;
|
||||
|
||||
try
|
||||
{
|
||||
xSqlReader = MngDBConn.CurrentConnection(eConnType).QueryCommandDatabase(strGetQuery, bUseTransaction);
|
||||
|
||||
if (xSqlReader != null)
|
||||
{
|
||||
iFieldCnt = xSqlReader.FieldCount;
|
||||
iRecordsAffectedCnt = xSqlReader.RecordsAffected;
|
||||
bHasRow = xSqlReader.HasRows;
|
||||
|
||||
dt.Load(xSqlReader);
|
||||
ds.Tables.Add(dt);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"<" + strGetQuery + "> Query process fail![SystemX.Net.MiddlewareUI : MainForm.AsyncQueryProcess]\r\n" + e.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (xSqlReader != null)
|
||||
xSqlReader.Close();
|
||||
|
||||
xSqlReader = null;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
return ds;
|
||||
}).Result;
|
||||
}
|
||||
|
||||
private DataSet QueryStreamProcess(eConnCategory eConnType, string strGetQuery)
|
||||
{
|
||||
return Task.Run(() =>
|
||||
{
|
||||
DataSet ds = new DataSet();
|
||||
DataTable dt = new DataTable();
|
||||
|
||||
try
|
||||
{
|
||||
SqlDataReader xSqlReader = null;
|
||||
|
||||
try
|
||||
{
|
||||
int iFieldCnt = 0;
|
||||
int iRecordsAffectedCnt = 0;
|
||||
bool bHasRow = false;
|
||||
|
||||
try
|
||||
{
|
||||
xSqlReader = MngDBConn.CurrentConnection(eConnType).QueryStreamDatabase(strGetQuery);
|
||||
|
||||
if (xSqlReader != null)
|
||||
{
|
||||
iFieldCnt = xSqlReader.FieldCount;
|
||||
iRecordsAffectedCnt = xSqlReader.RecordsAffected;
|
||||
bHasRow = xSqlReader.HasRows;
|
||||
|
||||
dt.Load(xSqlReader);
|
||||
ds.Tables.Add(dt);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"<" + strGetQuery + "> Query process fail![SystemX.Net.MiddlewareUI : MainForm.AsyncQueryProcess]\r\n" + e.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (xSqlReader != null)
|
||||
xSqlReader.Close();
|
||||
|
||||
xSqlReader = null;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
return ds;
|
||||
}).Result;
|
||||
}
|
||||
|
||||
private DataSet QueryProcess(string strGetQuery)
|
||||
{
|
||||
return Task.Run(() =>
|
||||
{
|
||||
SqlDataReader xSqlReader = null;
|
||||
|
||||
DataSet ds = new DataSet();
|
||||
DataTable dt = new DataTable();
|
||||
|
||||
int iFieldCnt = 0;
|
||||
int iRecordsAffectedCnt = 0;
|
||||
bool bHasRow = false;
|
||||
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
xSqlReader = MngDBConn.CurrentConnection(eConnCategory.Main).QueryDatabaseSub(strGetQuery);
|
||||
|
||||
if (xSqlReader != null)
|
||||
{
|
||||
iFieldCnt = xSqlReader.FieldCount;
|
||||
iRecordsAffectedCnt = xSqlReader.RecordsAffected;
|
||||
bHasRow = xSqlReader.HasRows;
|
||||
|
||||
dt.Load(xSqlReader);
|
||||
ds.Tables.Add(dt);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"<" + strGetQuery + "> Query process fail![SystemX.Net.MiddlewareUI : MainForm.QueryProcess]\r\n" + e.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (xSqlReader != null)
|
||||
xSqlReader.Close();
|
||||
|
||||
xSqlReader = null;
|
||||
}
|
||||
|
||||
return ds;
|
||||
}).Result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,477 @@
|
||||
using DevExpress.Data.Helpers;
|
||||
using DevExpress.XtraBars;
|
||||
using DevExpress.XtraBars.Navigation;
|
||||
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml.Linq;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
|
||||
using SystemX.Net;
|
||||
using SystemX.Common;
|
||||
using SystemX.Net.BaseProtocol;
|
||||
using SystemX.Net.Comm;
|
||||
using SystemX.Net.Schedule;
|
||||
using SystemX.Net.DB;
|
||||
using SystemX.Common.Serialization;
|
||||
using SystemX.Common.Archive;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using SystemX.Common.Protocol.SIA;
|
||||
|
||||
using static SystemX.Net.Platform.Common.Util.LogMessage;
|
||||
using System.Threading;
|
||||
using SystemX.Net.Middleware.Commons;
|
||||
using SystemX.Net.Platform.SystemX.Common;
|
||||
using CpTesterPlatform.CpLogUtil;
|
||||
|
||||
namespace SystemX.Net.MiddlewareUI
|
||||
{
|
||||
public partial class MainForm : DevExpress.XtraBars.FluentDesignSystem.FluentDesignForm
|
||||
{
|
||||
private async void WatchRecvStreamQueue()
|
||||
{
|
||||
await Task.Delay(250);
|
||||
|
||||
Stopwatch stLogScanTimer = new Stopwatch();
|
||||
stLogScanTimer.Start();
|
||||
|
||||
while (!m_bTaskStreamBlock)
|
||||
{
|
||||
try
|
||||
{
|
||||
CT.ThrowIfCancellationRequested();
|
||||
}
|
||||
catch (OperationCanceledException CancelEx)
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @" Work Canceled. [SystemX.Net.MiddlewareUI : MainForm.WatchRecvStreamQueue]\r\n" + CancelEx.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
|
||||
break;
|
||||
}
|
||||
//
|
||||
try
|
||||
{
|
||||
if (bTaskStreamWaitLock == false) QueryRecvStreamQueue();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"General Queue Process failed.[SystemX.Net.MiddlewareUI : MainForm.WatchRecvStreamQueue]\r\n" + e.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
|
||||
await Task.Delay(10);
|
||||
}
|
||||
|
||||
//return m_bTaskStreamBlock;
|
||||
}
|
||||
//private async void SendStreamEvent(byte[] senderData, ScheduleEvent e)
|
||||
private void SendStreamEvent(byte[] senderData, ScheduleEvent e)
|
||||
{
|
||||
try
|
||||
{
|
||||
int iGetCall = e.CALL_NUMBER;
|
||||
|
||||
if (thisConnInfo[e.CALL_NUMBER].m_ucSendStreamToken == 0x00)
|
||||
thisConnInfo[e.CALL_NUMBER].m_ucSendStreamToken = 0x01;
|
||||
else if (thisConnInfo[e.CALL_NUMBER].m_ucSendStreamToken == 0x01)
|
||||
thisConnInfo[e.CALL_NUMBER].m_ucSendStreamToken = 0x02;
|
||||
else
|
||||
thisConnInfo[e.CALL_NUMBER].m_ucSendStreamToken = 0x01;
|
||||
|
||||
thisConnInfo[e.CALL_NUMBER].m_iSendStreamCnt++;
|
||||
|
||||
if (thisConnInfo[e.CALL_NUMBER].m_iSendStreamCnt + 1 == int.MaxValue)
|
||||
thisConnInfo[e.CALL_NUMBER].m_iSendStreamCnt = 0;
|
||||
|
||||
if (FlowStreamControl[iGetCall] == null)
|
||||
return;
|
||||
|
||||
//소켓 샌드 행위 내부 결과
|
||||
if (e.PROCESS_RESULT == false)
|
||||
{
|
||||
//해당 패킷 횟수 상승 일단 회 차시 기록남기고 드랍
|
||||
FlowStreamControl[iGetCall].SendPacketCycle();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"General <SendStreamEvent> failed.[SystemX.Net.MiddlewareUI : MainForm.SendStreamEvent]\r\n" + ex.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
}
|
||||
//private async void RecvStreamEvent(byte[] senderData, ScheduleEvent e)
|
||||
private void RecvStreamEvent(byte[] senderData, ScheduleEvent e)
|
||||
{
|
||||
try
|
||||
{
|
||||
int iGetCall = e.CALL_NUMBER;
|
||||
|
||||
if (thisConnInfo[e.CALL_NUMBER].m_ucRecvStreamToken == 0x00)
|
||||
thisConnInfo[e.CALL_NUMBER].m_ucRecvStreamToken = 0x01;
|
||||
else if (thisConnInfo[e.CALL_NUMBER].m_ucRecvStreamToken == 0x01)
|
||||
thisConnInfo[e.CALL_NUMBER].m_ucRecvStreamToken = 0x02;
|
||||
else
|
||||
thisConnInfo[e.CALL_NUMBER].m_ucRecvStreamToken = 0x01;
|
||||
|
||||
thisConnInfo[e.CALL_NUMBER].m_iRecvStreamCnt++;
|
||||
|
||||
if (thisConnInfo[e.CALL_NUMBER].m_iRecvStreamCnt + 1 == int.MaxValue)
|
||||
thisConnInfo[e.CALL_NUMBER].m_iRecvStreamCnt = 0;
|
||||
|
||||
if (FlowStreamControl[iGetCall] == null)
|
||||
return;
|
||||
|
||||
int iStoreCnt = senderData.Count();
|
||||
byte[] recvStoreBuffer = senderData;
|
||||
|
||||
//소켓 리시브 행위 결과 전송
|
||||
if (e.PROCESS_RESULT == false)
|
||||
{
|
||||
//받기 실패 단순 실패 응답
|
||||
FlowStreamControl[iGetCall].InsertSendQueue(DateTime.Now, XCommons.SetSimpleResponsPacket(new BASE_PROTOCOL(BASE_PROTOCOL.PROTOCOL_CODE.SIMPLE_RESPONSE), false), null, false, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
BASE_PROTOCOL GET_PROTOCOL = XCommons.GetHeaderProtocol(iStoreCnt, recvStoreBuffer);
|
||||
BASE_PROTOCOL.PROTOCOL_CODE GET_CODE = GET_PROTOCOL.GET_CURRENT_PROTOCOL;
|
||||
|
||||
//응답
|
||||
if (GET_CODE == BASE_PROTOCOL.PROTOCOL_CODE.SIMPLE_RESPONSE)
|
||||
{
|
||||
if (XCommons.GetSimpleResponsResult(iStoreCnt, recvStoreBuffer))
|
||||
FlowStreamControl[iGetCall].SetSendPacketDrop();
|
||||
else
|
||||
FlowStreamControl[iGetCall].SendPacketCycle();
|
||||
}
|
||||
//파일 끝 응답
|
||||
else if (GET_CODE == BASE_PROTOCOL.PROTOCOL_CODE.RAW_END)
|
||||
{
|
||||
if (XCommons.GetSimpleResponsResult(iStoreCnt, recvStoreBuffer))
|
||||
FlowStreamControl[iGetCall].RawStoreQueuePOP();
|
||||
else
|
||||
FlowStreamControl[iGetCall].RawStoreQueuePOP();
|
||||
}
|
||||
//일반 응답
|
||||
else
|
||||
{
|
||||
//성공 응답
|
||||
FlowStreamControl[iGetCall].InsertSendQueue(DateTime.Now, XCommons.SetSimpleResponsPacket(new BASE_PROTOCOL(BASE_PROTOCOL.PROTOCOL_CODE.SIMPLE_RESPONSE), true), null, false, false);
|
||||
|
||||
//받은 큐에 넣어놓기
|
||||
FlowStreamControl[iGetCall].InsertRecvQueue(senderData, null, e.nLABEL);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"General <RecvStreamEvent> failed.[SystemX.Net.MiddlewareUI : MainForm.RecvStreamEvent]\r\n" + ex.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
}
|
||||
private void SendMiddlewareMessage(int iPos, string strMessage)
|
||||
{
|
||||
if (thisConnInfo[iPos].StreamConnectState == false)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
MESSAGE_PACKET MakeMessagePacket = new MESSAGE_PACKET();
|
||||
int iSendSize = Marshal.SizeOf(MakeMessagePacket);
|
||||
byte[] ucSendArray = new byte[iSendSize];
|
||||
MakeMessagePacket = (MESSAGE_PACKET)SystemXNetSerialization.RawDeSerialize(ucSendArray, MakeMessagePacket.GetType());
|
||||
|
||||
MakeMessagePacket.objMessage[0].Data = strMessage;
|
||||
|
||||
byte[] ucSendByteInfo = XCommons.SpecialObjectToByteStream(new BASE_PROTOCOL(BASE_PROTOCOL.PROTOCOL_CODE.MIDDLEWARE_MESSAGE), MakeMessagePacket);
|
||||
|
||||
FlowStreamControl[iPos].InsertSendQueue(DateTime.Now, ucSendByteInfo, null);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") +
|
||||
@"Send error <Middleware> message.[SystemX.Net.MiddlewareUI : MainForm.SendMiddlewareMessage]\r\n" +
|
||||
ex.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
}
|
||||
|
||||
private byte[] MakeTransferResult(bool bSetRecvResult, bool bSetProcessResult)
|
||||
{
|
||||
TRANSFER_PACKET TransferResult = new TRANSFER_PACKET();
|
||||
int iSendSize = Marshal.SizeOf(TransferResult);
|
||||
byte[] ucSendArray = new byte[iSendSize];
|
||||
TransferResult = (TRANSFER_PACKET)SystemXNetSerialization.RawDeSerialize(ucSendArray, TransferResult.GetType());
|
||||
|
||||
TransferResult.bRecvResult = bSetRecvResult;
|
||||
TransferResult.bProcessResult = bSetProcessResult;
|
||||
|
||||
byte[] ucSendByteInfo = XCommons.SpecialObjectToByteStream(new BASE_PROTOCOL(BASE_PROTOCOL.PROTOCOL_CODE.TRANSFER_RESULT), TransferResult);
|
||||
|
||||
return ucSendByteInfo;
|
||||
}
|
||||
|
||||
private bool QueryRecvStreamProcess(int iFlowPos, string strProcessInfo)
|
||||
{
|
||||
int i = iFlowPos;
|
||||
|
||||
bool bState = true;
|
||||
//
|
||||
XData getXData = FlowStreamControl[i].GetResultPacketData();
|
||||
|
||||
if (getXData == null)
|
||||
return false;
|
||||
|
||||
try
|
||||
{
|
||||
thisConnInfo[i].stStreamProcessTime.Restart();
|
||||
|
||||
BASE_PROTOCOL GET_PROTOCOL = getXData.BaseProtocol;
|
||||
BASE_PROTOCOL.PROTOCOL_CODE CODE = GET_PROTOCOL.GET_CURRENT_PROTOCOL;
|
||||
|
||||
HEADER_PACKET getHeader = getXData.HeaderPacket;
|
||||
object objData = getXData.objData;
|
||||
|
||||
byte ucGetLabel = getXData.nLabel;
|
||||
|
||||
switch (CODE)
|
||||
{
|
||||
case BASE_PROTOCOL.PROTOCOL_CODE.CONNECT_STATE:
|
||||
{
|
||||
PING_PACKET GetPingPacket = (PING_PACKET)objData;
|
||||
|
||||
string strGetMsg = GetPingPacket.objCheckMsg[0].Data;
|
||||
|
||||
PING_PACKET PingPacketMake = new PING_PACKET();
|
||||
int iSendSize = Marshal.SizeOf(PingPacketMake);
|
||||
byte[] ucSendArray = new byte[iSendSize];
|
||||
PingPacketMake = (PING_PACKET)SystemXNetSerialization.RawDeSerialize(ucSendArray, PingPacketMake.GetType());
|
||||
|
||||
PingPacketMake.objCheckMsg[0].Data = "SystemX";
|
||||
|
||||
byte[] ucSendByteInfo = XCommons.SpecialObjectToByteStream(new BASE_PROTOCOL(BASE_PROTOCOL.PROTOCOL_CODE.CONNECT_STATE), PingPacketMake);
|
||||
|
||||
if (ServerStreamSock[i].CLIENT_CONNECT)
|
||||
{
|
||||
if (ucSendByteInfo != null)
|
||||
FlowStreamControl[i].InsertSendQueue(DateTime.Now, ucSendByteInfo, null, ucGetLabel);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case BASE_PROTOCOL.PROTOCOL_CODE.SYNC_TIME_SERVER:
|
||||
{
|
||||
TIME_PACKET GetTimePacket = (TIME_PACKET)objData;
|
||||
string strGetMsg = GetTimePacket.objMsg[0].Data;
|
||||
|
||||
TIME_PACKET timePacketMake = new TIME_PACKET();
|
||||
int iSendSize = Marshal.SizeOf(timePacketMake);
|
||||
byte[] ucSendArray = new byte[iSendSize];
|
||||
timePacketMake = (TIME_PACKET)SystemXNetSerialization.RawDeSerialize(ucSendArray, timePacketMake.GetType());
|
||||
|
||||
TimeControl.GetSyncTime(ref timePacketMake.objTime[0]);
|
||||
|
||||
timePacketMake.objMsg[0].Data = "SyncTimeSend";
|
||||
|
||||
byte[] ucSendByteInfo = XCommons.SpecialObjectToByteStream(new BASE_PROTOCOL(BASE_PROTOCOL.PROTOCOL_CODE.SYNC_TIME_SERVER), timePacketMake);
|
||||
|
||||
if (ServerStreamSock[i].CLIENT_CONNECT)
|
||||
{
|
||||
if (ucSendByteInfo != null)
|
||||
FlowStreamControl[i].InsertSendQueue(DateTime.Now, ucSendByteInfo, null, ucGetLabel);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case BASE_PROTOCOL.PROTOCOL_CODE.FILE_TRANSFER:
|
||||
{
|
||||
string strFileExtension = getHeader.objOptionExtension[0].Data;
|
||||
|
||||
bool bGetResult = false;
|
||||
|
||||
if (strFileExtension.IndexOf(".CpLog") >= 0 ||
|
||||
strFileExtension.IndexOf(".csv") >= 0)
|
||||
{
|
||||
//if (bUseMapLogProcess)
|
||||
MappedLogQueueData.Enqueue(new Tuple<string, int, HEADER_PACKET, byte[]>("FILE_TRANSFER", i, getHeader, objData as byte[]));
|
||||
|
||||
bGetResult = true;
|
||||
}
|
||||
|
||||
FlowStreamControl[i].InsertSendQueue(DateTime.Now, MakeTransferResult(true, bGetResult), null, PacketFlowControl.TransferResultToken, false);
|
||||
}
|
||||
break;
|
||||
case BASE_PROTOCOL.PROTOCOL_CODE.RAW_SIZE:
|
||||
{
|
||||
if (getHeader.uiSourDataNum > 1)
|
||||
{
|
||||
if (thisConnInfo[i].nFileRecvPos > 0)
|
||||
{
|
||||
if ((thisConnInfo[i].nFileRecvPos + 1) != getHeader.uiSourDataNum ||
|
||||
thisConnInfo[i].nFileRecvEndPos == 0)
|
||||
{
|
||||
thisConnInfo[i].nFileRecvPos = 0;
|
||||
thisConnInfo[i].nFileRecvEndPos = 0;
|
||||
|
||||
FlowStreamControl[i].InsertSendQueue(DateTime.Now, XCommons.SetSimpleResponsPacket(new BASE_PROTOCOL(BASE_PROTOCOL.PROTOCOL_CODE.RAW_END), false), null, false, false);
|
||||
|
||||
FlowStreamControl[i].InsertSendQueue(DateTime.Now, MakeTransferResult(false, false), null, PacketFlowControl.TransferResultToken, false);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
if (getHeader.uiSourDataNum == 1)
|
||||
{
|
||||
thisConnInfo[i].lstRecvFileBytes = new List<Tuple<int, byte[]>>();
|
||||
thisConnInfo[i].lstRecvFileBytes.Clear();
|
||||
|
||||
thisConnInfo[i].lstRecvFileBytes.Add(new Tuple<int, byte[]>((int)getHeader.uiSourDataNum, objData as byte[]));
|
||||
|
||||
thisConnInfo[i].nFileRecvPos = (int)getHeader.uiSourDataNum;
|
||||
thisConnInfo[i].nFileRecvEndPos = (int)getHeader.uiDestDataNum;
|
||||
|
||||
thisConnInfo[i].strRecvFileName = getHeader.objOptionName[0].Data;
|
||||
thisConnInfo[i].strRecvFileExtension = getHeader.objOptionExtension[0].Data;
|
||||
}
|
||||
else
|
||||
{
|
||||
thisConnInfo[i].lstRecvFileBytes.Add(new Tuple<int, byte[]>((int)getHeader.uiSourDataNum, objData as byte[]));
|
||||
|
||||
thisConnInfo[i].nFileRecvPos++;
|
||||
}
|
||||
//
|
||||
if (thisConnInfo[i].nFileRecvPos >= thisConnInfo[i].nFileRecvEndPos)
|
||||
{
|
||||
int iSize = 0;
|
||||
|
||||
thisConnInfo[i].lstRecvFileBytes.Sort();
|
||||
|
||||
foreach (Tuple<int, byte[]> tData in thisConnInfo[i].lstRecvFileBytes)
|
||||
iSize += tData.Item2.Count();
|
||||
|
||||
byte[] ucGetDatas = new byte[iSize];
|
||||
int iCopyPos = 0;
|
||||
|
||||
foreach (Tuple<int, byte[]> tData in thisConnInfo[i].lstRecvFileBytes)
|
||||
{
|
||||
Array.Copy(tData.Item2, 0, ucGetDatas, iCopyPos, tData.Item2.Count());
|
||||
|
||||
iCopyPos += tData.Item2.Count();
|
||||
}
|
||||
|
||||
bool bGetResult = false;
|
||||
|
||||
if (thisConnInfo[i].strRecvFileExtension.IndexOf(".CpLog") >= 0 ||
|
||||
thisConnInfo[i].strRecvFileExtension.IndexOf(".csv") >= 0)
|
||||
{
|
||||
//if (bUseMapLogProcess)
|
||||
MappedLogQueueData.Enqueue(new Tuple<string, int, HEADER_PACKET, byte[]>("RAW_SIZE", i, getHeader, objData as byte[]));
|
||||
|
||||
bGetResult = true;
|
||||
}
|
||||
|
||||
thisConnInfo[i].nFileRecvPos = 0;
|
||||
thisConnInfo[i].nFileRecvEndPos = 0;
|
||||
|
||||
FlowStreamControl[i].InsertSendQueue(DateTime.Now, XCommons.SetSimpleResponsPacket(new BASE_PROTOCOL(BASE_PROTOCOL.PROTOCOL_CODE.RAW_END), true), null, false, false);
|
||||
|
||||
FlowStreamControl[i].InsertSendQueue(DateTime.Now, MakeTransferResult(true, bGetResult), null, PacketFlowControl.TransferResultToken, false);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
thisConnInfo[i].lStreamTime = thisConnInfo[i].stStreamProcessTime.ElapsedMilliseconds;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + strProcessInfo + @" Recv queue stream process fail.[SystemX.Net.MiddlewareUI : MainForm.QueryRecvStreamQueue]\r\n" + e.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
|
||||
bState = false;
|
||||
}
|
||||
|
||||
return bState;
|
||||
}
|
||||
|
||||
private bool QueryRecvStreamQueue()
|
||||
{
|
||||
//StackTrace st = new StackTrace(true);
|
||||
|
||||
bool bState = true;
|
||||
|
||||
try
|
||||
{
|
||||
bTaskStreamWaitLock = true;
|
||||
|
||||
for (int i = PORT_DISTRIBUTION_NUM; i < ALL_MANAGE_NUM && !m_bTaskStreamBlock; i++)
|
||||
{
|
||||
if (ServerStreamSock[i] == null)
|
||||
continue;
|
||||
//
|
||||
if (ServerStreamSock[i] != null)
|
||||
{
|
||||
if (ServerStreamSock[i].CLIENT_CONNECT == false)
|
||||
continue;
|
||||
}
|
||||
//
|
||||
if (FlowStreamControl[i] == null)
|
||||
continue;
|
||||
if (FlowStreamControl[i].GetCurrentRecvProcessData() != null)
|
||||
continue;
|
||||
//
|
||||
thisConnInfo[i].m_iSendStreamQueueSize = FlowStreamControl[i].GetSendQueueSize();
|
||||
thisConnInfo[i].m_iRecvStreamQueueSize = FlowStreamControl[i].GetRecvQueueSize();
|
||||
|
||||
if ((thisConnInfo[i].m_iSendStreamQueueSize + 1) == int.MaxValue)
|
||||
thisConnInfo[i].m_iSendStreamQueueSize = 0;
|
||||
if ((thisConnInfo[i].m_iRecvStreamQueueSize + 1) == int.MaxValue)
|
||||
thisConnInfo[i].m_iRecvStreamQueueSize = 0;
|
||||
//
|
||||
string strProcessDebugInfo = string.Empty;
|
||||
strProcessDebugInfo = "[" + (i).ToString("D2") + "]" +
|
||||
"[" + ConnPool[i].nUseStreamPort + "]" +
|
||||
"[" + thisConnInfo[i].strConnectHostID + "]" +
|
||||
"[" + thisConnInfo[i].strConnectSection + "]";
|
||||
|
||||
bState = QueryRecvStreamProcess(i, strProcessDebugInfo);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
/*
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + CpLogProcessInfo.strProcessDebugInfo + @" CpLog - " + $"ST Frame Count {st.FrameCount} [SystemX.Net.MiddlewareUI : MainForm.SetMemoryMappedFile] " + e.Message, ConsoleColor.Red, LogMessageLevel.FATAL);
|
||||
|
||||
for (int n = 0; n < st.FrameCount; n++)
|
||||
{
|
||||
StackFrame sf = st.GetFrame(n);
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + CpLogProcessInfo.strProcessDebugInfo + @" CpLog - " + $"ST Method To String {sf.GetMethod()} [SystemX.Net.MiddlewareUI : MainForm.SetMemoryMappedFile] " + e.Message, ConsoleColor.Red, LogMessageLevel.FATAL);
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + CpLogProcessInfo.strProcessDebugInfo + @" CpLog - " + $"ST Method Name {sf.GetMethod().Name} [SystemX.Net.MiddlewareUI : MainForm.SetMemoryMappedFile] " + e.Message, ConsoleColor.Red, LogMessageLevel.FATAL);
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + CpLogProcessInfo.strProcessDebugInfo + @" CpLog - " + $"ST Line Number {sf.GetFileLineNumber()} [SystemX.Net.MiddlewareUI : MainForm.SetMemoryMappedFile] " + e.Message, ConsoleColor.Red, LogMessageLevel.FATAL);
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + CpLogProcessInfo.strProcessDebugInfo + @" CpLog - " + $"ST Column Number {sf.GetFileColumnNumber()} [SystemX.Net.MiddlewareUI : MainForm.SetMemoryMappedFile] " + e.Message, ConsoleColor.Red, LogMessageLevel.FATAL);
|
||||
}
|
||||
*/
|
||||
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @" Recv queue stream process unknown fail.[SystemX.Net.MiddlewareUI : MainForm.QueryRecvStreamQueue]\r\n" + e.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
|
||||
bState = false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
bTaskStreamWaitLock = false;
|
||||
|
||||
nStreamNumber++;
|
||||
|
||||
if (nStreamNumber >= ALL_MANAGE_NUM)
|
||||
nStreamNumber = 0;
|
||||
}
|
||||
|
||||
return bState;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,653 @@
|
||||
using DevExpress.Data.Helpers;
|
||||
using DevExpress.XtraBars;
|
||||
using DevExpress.XtraBars.Navigation;
|
||||
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml.Linq;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
|
||||
using SystemX.Net;
|
||||
using SystemX.Common;
|
||||
using SystemX.Net.BaseProtocol;
|
||||
using SystemX.Net.Comm;
|
||||
using SystemX.Net.Schedule;
|
||||
using SystemX.Net.DB;
|
||||
using SystemX.Common.Serialization;
|
||||
using SystemX.Common.Archive;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using SystemX.Common.Protocol.SIA;
|
||||
|
||||
using static SystemX.Net.Platform.Common.Util.LogMessage;
|
||||
using System.Threading;
|
||||
using SystemX.Net.Platform.Common.Util;
|
||||
using SystemX.Net.Platform.Common.ExtensionMethods;
|
||||
using SystemX.Net.Middleware.Commons;
|
||||
using static SystemX.Net.DB.XDBConnManager;
|
||||
|
||||
namespace SystemX.Net.MiddlewareUI
|
||||
{
|
||||
public partial class MainForm : DevExpress.XtraBars.FluentDesignSystem.FluentDesignForm
|
||||
{
|
||||
private void Chktimer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
Chktimer.Enabled = false;
|
||||
|
||||
if (MIDDLEWARE_START_STATE == false)
|
||||
{
|
||||
ConsoleUtil.ConsoleVisibleControl();
|
||||
|
||||
//The program is automatically terminated.
|
||||
MessageBox.Show("Server information could not be retrieved. Check the console error text.", "Middleware for Line Bridge", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
|
||||
//this.Close();
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonUserQueryRead_Click(object sender, EventArgs e)
|
||||
{
|
||||
xCallQuery.Load();
|
||||
}
|
||||
|
||||
|
||||
private void buttonListenReset_Click(object sender, EventArgs e)
|
||||
{
|
||||
dataGridViewListen.Rows.Clear();
|
||||
|
||||
ListenServerReset();
|
||||
}
|
||||
|
||||
private void WritePortSendRecvInfo(int nGetPos, int iRowPos)
|
||||
{
|
||||
if (thisConnInfo[nGetPos].m_ucSendCommandToken == 0x1)
|
||||
{
|
||||
if (dataGridViewPort.Rows[iRowPos].Cells[3].Style.BackColor != Color.Yellow)
|
||||
dataGridViewPort.Rows[iRowPos].Cells[3].Style.BackColor = Color.Yellow;
|
||||
}
|
||||
else if (thisConnInfo[nGetPos].m_ucSendCommandToken == 0x2)
|
||||
{
|
||||
if (dataGridViewPort.Rows[iRowPos].Cells[3].Style.BackColor != Color.LightYellow)
|
||||
dataGridViewPort.Rows[iRowPos].Cells[3].Style.BackColor = Color.LightYellow;
|
||||
}
|
||||
//
|
||||
if (thisConnInfo[nGetPos].m_ucRecvCommandToken == 0x1)
|
||||
{
|
||||
if (dataGridViewPort.Rows[iRowPos].Cells[4].Style.BackColor != Color.DeepSkyBlue)
|
||||
dataGridViewPort.Rows[iRowPos].Cells[4].Style.BackColor = Color.DeepSkyBlue;
|
||||
}
|
||||
else if (thisConnInfo[nGetPos].m_ucRecvCommandToken == 0x2)
|
||||
{
|
||||
if (dataGridViewPort.Rows[iRowPos].Cells[4].Style.BackColor != Color.LightSkyBlue)
|
||||
dataGridViewPort.Rows[iRowPos].Cells[4].Style.BackColor = Color.LightSkyBlue;
|
||||
}
|
||||
//
|
||||
if (thisConnInfo[nGetPos].m_ucSendStreamToken == 0x1)
|
||||
{
|
||||
if (dataGridViewPort.Rows[iRowPos].Cells[5].Style.BackColor != Color.Yellow)
|
||||
dataGridViewPort.Rows[iRowPos].Cells[5].Style.BackColor = Color.Yellow;
|
||||
}
|
||||
else if (thisConnInfo[nGetPos].m_ucSendStreamToken == 0x2)
|
||||
{
|
||||
if (dataGridViewPort.Rows[iRowPos].Cells[5].Style.BackColor != Color.LightYellow)
|
||||
dataGridViewPort.Rows[iRowPos].Cells[5].Style.BackColor = Color.LightYellow;
|
||||
}
|
||||
//
|
||||
if (thisConnInfo[nGetPos].m_ucRecvStreamToken == 0x1)
|
||||
{
|
||||
if (dataGridViewPort.Rows[iRowPos].Cells[6].Style.BackColor != Color.DeepSkyBlue)
|
||||
dataGridViewPort.Rows[iRowPos].Cells[6].Style.BackColor = Color.DeepSkyBlue;
|
||||
}
|
||||
else if (thisConnInfo[nGetPos].m_ucRecvStreamToken == 0x2)
|
||||
{
|
||||
if (dataGridViewPort.Rows[iRowPos].Cells[6].Style.BackColor != Color.LightSkyBlue)
|
||||
dataGridViewPort.Rows[iRowPos].Cells[6].Style.BackColor = Color.LightSkyBlue;
|
||||
}
|
||||
|
||||
dataGridViewPort.Rows[iRowPos].Cells[3].Value = thisConnInfo[nGetPos].m_iSendCommandCnt;
|
||||
dataGridViewPort.Rows[iRowPos].Cells[4].Value = thisConnInfo[nGetPos].m_iRecvCommandCnt;
|
||||
dataGridViewPort.Rows[iRowPos].Cells[5].Value = thisConnInfo[nGetPos].m_iSendStreamCnt;
|
||||
dataGridViewPort.Rows[iRowPos].Cells[6].Value = thisConnInfo[nGetPos].m_iRecvStreamCnt;
|
||||
}
|
||||
|
||||
private void PortInfoGridInitialize(int iRowPos)
|
||||
{
|
||||
/*
|
||||
if (strGetText.CompareTo(strSetProcessInfo[nGetPos]) != 0)
|
||||
dataGridViewPort.Rows[i].Cells[2].Value = strSetProcessInfo[nGetPos];
|
||||
*/
|
||||
|
||||
if (dataGridViewPort.Rows[iRowPos].Cells[3].Style.BackColor != Color.White)
|
||||
dataGridViewPort.Rows[iRowPos].Cells[3].Style.BackColor = Color.White;
|
||||
if (dataGridViewPort.Rows[iRowPos].Cells[4].Style.BackColor != Color.White)
|
||||
dataGridViewPort.Rows[iRowPos].Cells[4].Style.BackColor = Color.White;
|
||||
if (dataGridViewPort.Rows[iRowPos].Cells[5].Style.BackColor != Color.White)
|
||||
dataGridViewPort.Rows[iRowPos].Cells[5].Style.BackColor = Color.White;
|
||||
if (dataGridViewPort.Rows[iRowPos].Cells[6].Style.BackColor != Color.White)
|
||||
dataGridViewPort.Rows[iRowPos].Cells[6].Style.BackColor = Color.White;
|
||||
|
||||
if (dataGridViewPort.Rows[iRowPos].Cells[3].Value.ToString().Length > 0)
|
||||
dataGridViewPort.Rows[iRowPos].Cells[3].Value = string.Empty;
|
||||
if (dataGridViewPort.Rows[iRowPos].Cells[4].Value.ToString().Length > 0)
|
||||
dataGridViewPort.Rows[iRowPos].Cells[4].Value = string.Empty;
|
||||
if (dataGridViewPort.Rows[iRowPos].Cells[5].Value.ToString().Length > 0)
|
||||
dataGridViewPort.Rows[iRowPos].Cells[5].Value = string.Empty;
|
||||
if (dataGridViewPort.Rows[iRowPos].Cells[6].Value.ToString().Length > 0)
|
||||
dataGridViewPort.Rows[iRowPos].Cells[6].Value = string.Empty;
|
||||
}
|
||||
|
||||
private void UItimer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
if (m_bTimerLock[(int)TIMER_LOCK.UI_TIMER] == false)
|
||||
{
|
||||
m_bTimerLock[(int)TIMER_LOCK.UI_TIMER] = true;
|
||||
|
||||
if (TimeControl.SyncServerTimeResult)
|
||||
{
|
||||
if (barStaticItemSyncTime.Visibility == BarItemVisibility.Never)
|
||||
{
|
||||
barStaticItemSyncTime.Caption = "[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "] Server time synchronization progressed successfully.";
|
||||
barStaticItemSyncTime.Visibility = BarItemVisibility.Always;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (barStaticItemSyncTime.Visibility == BarItemVisibility.Always)
|
||||
barStaticItemSyncTime.Visibility = BarItemVisibility.Never;
|
||||
}
|
||||
//
|
||||
if (progressBarProgram.Value + 20 <= 100)
|
||||
progressBarProgram.Value += 20;
|
||||
else
|
||||
progressBarProgram.Value = 0;
|
||||
|
||||
//Disconnect Listen Server Reset
|
||||
for (int i = 0; i < PORT_DISTRIBUTION_NUM; i++)
|
||||
{
|
||||
if (ConnPool[i].bRequiredPortReset == false)
|
||||
{
|
||||
//Listen Server Auto Reset 5 Minute
|
||||
if (ConnPool[i].stPortTimer.ElapsedMilliseconds >= 300000)
|
||||
ConnPool[i].bRequiredPortReset = true;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ConnPool[i].bRequiredPortResetReady == false)
|
||||
{
|
||||
ListenServerOnState[i] = false;
|
||||
|
||||
ClearListenElement(i);
|
||||
|
||||
ClearListenServerInstance(i);
|
||||
|
||||
ConnPool[i].bRequiredPortResetReady = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
StartListenServer(i, ConnPool[i].nUseCommandPort, ConnPool[i].nUseStreamPort);
|
||||
|
||||
DisplayListenElement(i);
|
||||
|
||||
ListenServerOnState[i] = true;
|
||||
|
||||
ConnPool[i].PortTImerRestart();
|
||||
|
||||
ConnPool[i].bRequiredPortResetReady = false;
|
||||
ConnPool[i].bRequiredPortReset = false;
|
||||
}
|
||||
|
||||
/*
|
||||
ListenServerOnState[i] = false;
|
||||
|
||||
ClearListenElement(i);
|
||||
|
||||
ClearListenServerInstance(i);
|
||||
|
||||
StartListenServer(i, ConnPool[i].nUseCommandPort, ConnPool[i].nUseStreamPort);
|
||||
|
||||
DisplayListenElement(i);
|
||||
|
||||
ListenServerOnState[i] = true;
|
||||
|
||||
ConnPool[i].bRequiredPortReset = false;
|
||||
*/
|
||||
}
|
||||
|
||||
//Listen
|
||||
dataGridViewListen.SuspendLayout();
|
||||
for (int i = 0; i < dataGridViewListen.RowCount; i++)
|
||||
{
|
||||
if (dataGridViewListen.Rows[i].Cells[0].Value == null)
|
||||
continue;
|
||||
|
||||
string strSetText = string.Empty;
|
||||
|
||||
string strGetNumText = dataGridViewListen.Rows[i].Cells[0].Value.ToString();
|
||||
string strGetText = dataGridViewListen.Rows[i].Cells[1].Value.ToString();
|
||||
|
||||
int nGetPos = int.MaxValue;
|
||||
|
||||
if (int.TryParse(strGetNumText, out nGetPos) == false)
|
||||
continue;
|
||||
|
||||
if (thisConnInfo[nGetPos].ClientConnectState)
|
||||
strSetText = "CONNECT - Assigning port";
|
||||
else
|
||||
strSetText = "WAIT";
|
||||
|
||||
if (strGetText.CompareTo(strSetText) != 0)
|
||||
dataGridViewListen.Rows[i].Cells[1].Value = strSetText;
|
||||
}
|
||||
dataGridViewListen.ResumeLayout();
|
||||
|
||||
//Distribution
|
||||
dataGridViewPort.SuspendLayout();
|
||||
for (int i = 0; i < dataGridViewPort.RowCount; i++)
|
||||
{
|
||||
if (dataGridViewPort.Rows[i].Cells[0].Value == null)
|
||||
continue;
|
||||
|
||||
string strGetText = dataGridViewPort.Rows[i].Cells[2].Value.ToString();
|
||||
string strGetName = dataGridViewPort.Rows[i].Cells[0].Value.ToString();
|
||||
string strConnState = dataGridViewPort.Rows[i].Cells[1].Value.ToString();
|
||||
int nGetPos = Convert.ToInt32(strGetName);
|
||||
|
||||
if (thisConnInfo[nGetPos].ClientConnectState && thisConnInfo[nGetPos].StreamConnectState)
|
||||
{
|
||||
if (thisConnInfo[nGetPos].bHostLoginState)
|
||||
{
|
||||
string strSetText = string.Empty;
|
||||
|
||||
strSetText = strSetProcessInfo[nGetPos] + ("@" + thisConnInfo[nGetPos].strConnectHostID +
|
||||
":" + thisConnInfo[nGetPos].strConnectSection +
|
||||
"@" + thisConnInfo[nGetPos].strCommandEndPointInfo);
|
||||
|
||||
if (strGetText.CompareTo(strSetText) != 0)
|
||||
dataGridViewPort.Rows[i].Cells[2].Value = strSetText;
|
||||
if (strConnState.CompareTo("CONNECT") != 0)
|
||||
dataGridViewPort.Rows[i].Cells[1].Value = "CONNECT";
|
||||
}
|
||||
|
||||
WritePortSendRecvInfo(nGetPos, i);
|
||||
}
|
||||
else
|
||||
{
|
||||
PortInfoGridInitialize(i);
|
||||
|
||||
if (ConnPool[nGetPos].bUseState == false)
|
||||
{
|
||||
if (strGetText.CompareTo("-") != 0)
|
||||
dataGridViewPort.Rows[i].Cells[2].Value = "-";
|
||||
if (strConnState.CompareTo("-") != 0)
|
||||
dataGridViewPort.Rows[i].Cells[1].Value = "-";
|
||||
}
|
||||
}
|
||||
}
|
||||
dataGridViewListen.ResumeLayout();
|
||||
|
||||
/*
|
||||
if (m_iLastGetIndex != -1)
|
||||
DisplayConnectInfo(m_iLastGetIndex);
|
||||
*/
|
||||
|
||||
//DisplayConnectInfoDetect();
|
||||
|
||||
DriveInfo df = new DriveInfo(@LoadInfo.DISK_MONITOR_POS1);
|
||||
string strTip = string.Empty;
|
||||
int nPositionValue = int.MaxValue;
|
||||
|
||||
if (df.IsReady)
|
||||
{
|
||||
strTip = "Drive Name " + df.Name + " Available space " + ((double)df.AvailableFreeSpace / (double)df.TotalSize * 100).ToString("F2") + "%";
|
||||
|
||||
nPositionValue = (int)((double)df.AvailableFreeSpace / (double)df.TotalSize * 100);
|
||||
|
||||
if (progressBarControlC.ToolTip.CompareTo(strTip) != 0)
|
||||
progressBarControlC.ToolTip = strTip;
|
||||
|
||||
if (progressBarControlC.Position != nPositionValue)
|
||||
progressBarControlC.Position = (int)((double)df.AvailableFreeSpace / (double)df.TotalSize * 100);
|
||||
}
|
||||
df = new DriveInfo(@LoadInfo.DISK_MONITOR_POS2);
|
||||
if (df.IsReady)
|
||||
{
|
||||
strTip = "Drive Name " + df.Name + " Available space " + ((double)df.AvailableFreeSpace / (double)df.TotalSize * 100).ToString("F2") + "%";
|
||||
|
||||
nPositionValue = (int)((double)df.AvailableFreeSpace / (double)df.TotalSize * 100);
|
||||
|
||||
if (progressBarControlD.ToolTip.CompareTo(strTip) != 0)
|
||||
progressBarControlD.ToolTip = strTip;
|
||||
|
||||
if (progressBarControlC.Position != nPositionValue)
|
||||
progressBarControlD.Position = (int)((double)df.AvailableFreeSpace / (double)df.TotalSize * 100);
|
||||
}
|
||||
|
||||
m_bTimerLock[(int)TIMER_LOCK.UI_TIMER] = false;
|
||||
}
|
||||
}
|
||||
|
||||
private string MakeInfoConnectProcessText(int nPos, int nCommandPort, int nStreamPort)
|
||||
{
|
||||
string strSetProcessInfo = nPos.ToString("D2") + ":" +
|
||||
nCommandPort.ToString("D4") + ":" +
|
||||
nStreamPort.ToString("D4");
|
||||
|
||||
return strSetProcessInfo;
|
||||
}
|
||||
|
||||
private void DisplayListenElement()
|
||||
{
|
||||
dataGridViewListen.SuspendLayout();
|
||||
for (int i = 0; i < PORT_DISTRIBUTION_NUM; i++)
|
||||
{
|
||||
dataGridViewListen.Rows.Add();
|
||||
|
||||
strSetProcessInfo[i] = MakeInfoConnectProcessText(i, LoadInfo.nListenCommandPort[i], LoadInfo.nListenStreamPort[i]);
|
||||
|
||||
dataGridViewListen.Rows[i].Cells[0].Value = i.ToString();
|
||||
dataGridViewListen.Rows[i].Cells[1].Value = "WAIT";
|
||||
dataGridViewListen.Rows[i].Cells[2].Value = strSetProcessInfo[i];
|
||||
}
|
||||
dataGridViewListen.ResumeLayout();
|
||||
}
|
||||
|
||||
private void DisplayListenElement(int nPos)
|
||||
{
|
||||
dataGridViewListen.SuspendLayout();
|
||||
strSetProcessInfo[nPos] = MakeInfoConnectProcessText(nPos, LoadInfo.nListenCommandPort[nPos], LoadInfo.nListenStreamPort[nPos]);
|
||||
|
||||
dataGridViewListen.Rows[nPos].Cells[0].Value = nPos.ToString();
|
||||
dataGridViewListen.Rows[nPos].Cells[1].Value = "WAIT";
|
||||
dataGridViewListen.Rows[nPos].Cells[2].Value = strSetProcessInfo[nPos];
|
||||
dataGridViewListen.ResumeLayout();
|
||||
}
|
||||
|
||||
private void ClearListenElement(int nPos)
|
||||
{
|
||||
dataGridViewListen.SuspendLayout();
|
||||
strSetProcessInfo[nPos] = string.Empty;
|
||||
|
||||
dataGridViewListen.Rows[nPos].Cells[0].Value = "-";
|
||||
dataGridViewListen.Rows[nPos].Cells[1].Value = "-";
|
||||
dataGridViewListen.Rows[nPos].Cells[2].Value = strSetProcessInfo[nPos];
|
||||
|
||||
dataGridViewListen.ResumeLayout();
|
||||
}
|
||||
|
||||
private void DisplayPortElement()
|
||||
{
|
||||
dataGridViewPort.SuspendLayout();
|
||||
for (int i = PORT_DISTRIBUTION_NUM; i < ALL_MANAGE_NUM; i++)
|
||||
{
|
||||
dataGridViewPort.Rows.Add();
|
||||
|
||||
dataGridViewPort.Rows[i - PORT_DISTRIBUTION_NUM].Cells[0].Value = i.ToString();
|
||||
dataGridViewPort.Rows[i - PORT_DISTRIBUTION_NUM].Cells[1].Value = "-";
|
||||
dataGridViewPort.Rows[i - PORT_DISTRIBUTION_NUM].Cells[2].Value = "-";
|
||||
dataGridViewPort.Rows[i - PORT_DISTRIBUTION_NUM].Cells[3].Value = string.Empty;
|
||||
dataGridViewPort.Rows[i - PORT_DISTRIBUTION_NUM].Cells[4].Value = string.Empty;
|
||||
dataGridViewPort.Rows[i - PORT_DISTRIBUTION_NUM].Cells[5].Value = string.Empty;
|
||||
dataGridViewPort.Rows[i - PORT_DISTRIBUTION_NUM].Cells[6].Value = string.Empty;
|
||||
}
|
||||
dataGridViewPort.ResumeLayout();
|
||||
}
|
||||
|
||||
private void MakeElement(int nPos, int nCommandPort, int nStreamPort)
|
||||
{
|
||||
strSetProcessInfo[nPos] = MakeInfoConnectProcessText(nPos, nCommandPort, nStreamPort);
|
||||
|
||||
dataGridViewPort.Rows[nPos - PORT_DISTRIBUTION_NUM].Cells[1].Value = "WAIT";
|
||||
dataGridViewPort.Rows[nPos - PORT_DISTRIBUTION_NUM].Cells[2].Value = strSetProcessInfo[nPos];
|
||||
}
|
||||
|
||||
private void AddElement(int nPos, int nCommandPort, int nStreamPort)
|
||||
{
|
||||
if (this.InvokeRequired)
|
||||
{
|
||||
this.Invoke(new MethodInvoker(delegate ()
|
||||
{
|
||||
MakeElement(nPos, nCommandPort, nStreamPort);
|
||||
}));
|
||||
}
|
||||
else
|
||||
MakeElement(nPos, nCommandPort, nStreamPort);
|
||||
}
|
||||
|
||||
private void DeleteElement(int nPos)
|
||||
{
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
;//
|
||||
}
|
||||
catch {
|
||||
throw new Exception(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"RemoveElement-DeleteElement " + nPos.ToString("D3") + " [SystemX.Net.MiddlewareUI : MainForm.DeleteElement]\r\n");
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
MessageOutput.ConsoleWrite(e.Message, ConsoleColor.Red, LogMessageLevel.FATAL);
|
||||
}
|
||||
}
|
||||
|
||||
private void RemoveElement(int nPos)
|
||||
{
|
||||
if (this.InvokeRequired)
|
||||
{
|
||||
this.Invoke(new MethodInvoker(delegate ()
|
||||
{
|
||||
DeleteElement(nPos);
|
||||
}));
|
||||
}
|
||||
else
|
||||
DeleteElement(nPos);
|
||||
}
|
||||
|
||||
private void DisplayConnectInfo(int iGetIndex)
|
||||
{
|
||||
if (thisConnInfo[iGetIndex].ClientConnectState &&
|
||||
thisConnInfo[iGetIndex].StreamConnectState)
|
||||
{
|
||||
/*
|
||||
string strRemoteInfo = string.Empty, strLocalInfo = string.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
if (thisConnInfo[iGetIndex].ClientConnectSocket != null)
|
||||
{
|
||||
strLocalInfo = thisConnInfo[iGetIndex]?.ClientConnectSocket?.LocalEndPoint?.ToString();
|
||||
strRemoteInfo = thisConnInfo[iGetIndex]?.ClientConnectSocket?.RemoteEndPoint?.ToString();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"DisplayConnectInfo exception state detect[1]. [SystemX.Net.MiddlewareUI : MainForm.DisplayConnectInfo]\r\n" + e.Message, ConsoleColor.Red, LogMessageLevel.FATAL);
|
||||
|
||||
m_iLastGetIndex = -1;
|
||||
|
||||
strRemoteInfo = "";
|
||||
strLocalInfo = "";
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (strRemoteInfo.IsNullOrEmpty())
|
||||
strRemoteInfo = "";
|
||||
if (strLocalInfo.IsNullOrEmpty())
|
||||
strLocalInfo = "";
|
||||
}
|
||||
*/
|
||||
//
|
||||
try
|
||||
{
|
||||
/* MODIFY
|
||||
dataGridViewState.Rows[0].Cells[0].Value = strLocalInfo;
|
||||
dataGridViewState.Rows[0].Cells[1].Value = "-";
|
||||
dataGridViewState.Rows[0].Cells[2].Value = "ON";
|
||||
dataGridViewState.Rows[0].Cells[3].Value = strRemoteInfo;
|
||||
|
||||
dataGridViewState.Rows[0].Cells[4].Value = thisConnInfo[iGetIndex].m_iSendCommandCnt.ToString("D6") + "," + thisConnInfo[iGetIndex].m_iSendStreamCnt.ToString("D6");
|
||||
dataGridViewState.Rows[0].Cells[5].Value = thisConnInfo[iGetIndex].m_iRecvCommandCnt.ToString("D6") + "," + thisConnInfo[iGetIndex].m_iRecvStreamCnt.ToString("D6");
|
||||
|
||||
dataGridViewState.Rows[0].Cells[6].Value = thisConnInfo[iGetIndex].m_iSendCommandQueueSize.ToString("D6") + "," + thisConnInfo[iGetIndex].m_iSendStreamQueueSize.ToString("D6");
|
||||
dataGridViewState.Rows[0].Cells[7].Value = thisConnInfo[iGetIndex].m_iRecvCommandQueueSize.ToString("D6") + "," + thisConnInfo[iGetIndex].m_iRecvStreamQueueSize.ToString("D6");
|
||||
|
||||
dataGridViewTime.Rows[0].Cells[0].Value = thisConnInfo[iGetIndex].lCommandTime.ToString();
|
||||
dataGridViewTime.Rows[0].Cells[1].Value = thisConnInfo[iGetIndex].lStreamTime.ToString();
|
||||
|
||||
dataGridViewTime.Rows[0].Cells[2].Value = ServerCommandSock[iGetIndex].ServerTokenPosCheck(0);
|
||||
dataGridViewTime.Rows[0].Cells[3].Value = ServerStreamSock[iGetIndex].ServerTokenPosCheck(1);
|
||||
*/
|
||||
}
|
||||
catch (Exception e) {
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"DisplayConnectInfo exception state detect[2]. [SystemX.Net.MiddlewareUI : MainForm.DisplayConnectInfo]\r\n" + e.Message, ConsoleColor.Red, LogMessageLevel.FATAL);
|
||||
|
||||
m_iLastGetIndex = -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* MODIFY
|
||||
dataGridViewState.Rows[0].Cells[0].Value = string.Empty;
|
||||
dataGridViewState.Rows[0].Cells[1].Value = "-";
|
||||
dataGridViewState.Rows[0].Cells[2].Value = "OFF";
|
||||
dataGridViewState.Rows[0].Cells[3].Value = string.Empty;
|
||||
|
||||
dataGridViewState.Rows[0].Cells[4].Value = string.Empty;
|
||||
dataGridViewState.Rows[0].Cells[5].Value = string.Empty;
|
||||
|
||||
dataGridViewState.Rows[0].Cells[6].Value = string.Empty;
|
||||
dataGridViewState.Rows[0].Cells[7].Value = string.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
if (ServerCommandSock[iGetIndex] != null)
|
||||
dataGridViewTime.Rows[0].Cells[2].Value = ServerCommandSock[iGetIndex].ServerTokenPosCheck(0);
|
||||
if (ServerStreamSock[iGetIndex] != null)
|
||||
dataGridViewTime.Rows[0].Cells[3].Value = ServerStreamSock[iGetIndex].ServerTokenPosCheck(1);
|
||||
}
|
||||
catch (Exception e) {
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"Server socket status check failed. [SystemX.Net.MiddlewareUI : MainForm.DisplayConnectInfo]\r\n" + e.Message, ConsoleColor.Red, LogMessageLevel.FATAL);
|
||||
|
||||
m_iLastGetIndex = -1;
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
private void DisplayConnectInfoDetect()
|
||||
{
|
||||
for (int i = PORT_DISTRIBUTION_NUM; i < ALL_MANAGE_NUM; i++)
|
||||
{
|
||||
if (thisConnInfo[i].ClientConnectState == false)
|
||||
continue;
|
||||
|
||||
//
|
||||
if (thisConnInfo[i].ConnectStreamCheck)
|
||||
{
|
||||
if (thisConnInfo[i].stStreamCheckTime.ElapsedMilliseconds >= 20000)
|
||||
{
|
||||
thisConnInfo[i].stStreamCheckTime.Restart();
|
||||
thisConnInfo[i].ConnectStreamCheck = false;
|
||||
|
||||
if (thisConnInfo[i].StreamConnectState == false)
|
||||
{
|
||||
ResetStreamConnectSetCheck(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
/*
|
||||
string strRemoteInfo = string.Empty, strLocalInfo = string.Empty;
|
||||
|
||||
bool bGetSocketInfo = true;
|
||||
try
|
||||
{
|
||||
if (thisConnInfo[i].ClientConnectSocket != null)
|
||||
{
|
||||
strLocalInfo = thisConnInfo[i]?.ClientConnectSocket?.LocalEndPoint?.ToString();
|
||||
strRemoteInfo = thisConnInfo[i]?.ClientConnectSocket?.RemoteEndPoint?.ToString();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
ServerStreamSock[i].ServerSocketUnknownError(false);
|
||||
ServerCommandSock[i].ServerSocketUnknownError(false);
|
||||
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @" " + i.ToString("D2") + " ConnectInfo exception state detect. - Socket clear[1]. [SystemX.Net.MiddlewareUI : MainForm.DisplayConnectInfoDetect]\r\n" + e.Message, ConsoleColor.Red, LogMessageLevel.FATAL);
|
||||
|
||||
strRemoteInfo = "";
|
||||
strLocalInfo = "";
|
||||
|
||||
bGetSocketInfo = false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (strRemoteInfo.IsNullOrEmpty())
|
||||
strRemoteInfo = "";
|
||||
if (strLocalInfo.IsNullOrEmpty())
|
||||
strLocalInfo = "";
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
if (bGetSocketInfo == false)
|
||||
continue;
|
||||
//
|
||||
try
|
||||
{
|
||||
;//
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @" " + i.ToString("D2") + " ConnectInfo exception state detect. - Socket clear[2]. [SystemX.Net.MiddlewareUI : MainForm.DisplayConnectInfoDetect]\r\n" + e.Message, ConsoleColor.Red, LogMessageLevel.FATAL);
|
||||
|
||||
ResetConnectSetCheck(i);
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
private void GridRowCellClick(object sender, EventArgs e)
|
||||
{
|
||||
string[] strGetEleInfo = ((AccordionControlElement)sender).Text.Split(':');
|
||||
|
||||
if (strGetEleInfo.Count() > 0)
|
||||
{
|
||||
int iGetIndex = Convert.ToInt32(strGetEleInfo[0]);
|
||||
|
||||
m_iLastGetIndex = iGetIndex;
|
||||
|
||||
DisplayConnectInfo(iGetIndex);
|
||||
|
||||
if (thisConnInfo[iGetIndex].stCheckTime.ElapsedMilliseconds <= 400)
|
||||
{
|
||||
string strTextMsg = ((AccordionControlElement)sender).Text;
|
||||
if (MessageBox.Show("You want to [" + strTextMsg + "] server point initialize?", "Middleware for Line Bridge - Middleware UI", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
try
|
||||
{
|
||||
ResetConnectSetCheck(iGetIndex);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + @"[" + strTextMsg + "] initialize failed. [SystemX.Net.MiddlewareUI : MainForm.accordionControlElement_Click]\r\n" + ex.Message, ConsoleColor.Yellow, LogMessageLevel.DEBUG);
|
||||
}
|
||||
}
|
||||
}
|
||||
thisConnInfo[iGetIndex].stCheckTime.Restart();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
592
SystemX.Net.CP.Middleware.PD/SystemX.Net.Middleware.UI/MainForm.Designer.cs
generated
Normal file
@ -0,0 +1,592 @@
|
||||
using DevExpress.XtraBars;
|
||||
using DevExpress.XtraBars.Ribbon;
|
||||
|
||||
namespace SystemX.Net.MiddlewareUI
|
||||
{
|
||||
partial class MainForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
|
||||
this.fluentDesignFormContainer1 = new DevExpress.XtraBars.FluentDesignSystem.FluentDesignFormContainer();
|
||||
this.panel2 = new System.Windows.Forms.Panel();
|
||||
this.panel6 = new System.Windows.Forms.Panel();
|
||||
this.dataGridViewPort = new System.Windows.Forms.DataGridView();
|
||||
this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.dataGridViewListen = new System.Windows.Forms.DataGridView();
|
||||
this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.progressBarProgram = new System.Windows.Forms.ProgressBar();
|
||||
this.panelSubFunc = new System.Windows.Forms.Panel();
|
||||
this.buttonMapLogClear = new System.Windows.Forms.Button();
|
||||
this.buttonListenReset = new System.Windows.Forms.Button();
|
||||
this.buttonUserQueryRead = new System.Windows.Forms.Button();
|
||||
this.panel7 = new System.Windows.Forms.Panel();
|
||||
this.panel3 = new System.Windows.Forms.Panel();
|
||||
this.progressBarControlD = new DevExpress.XtraEditors.ProgressBarControl();
|
||||
this.progressBarControlC = new DevExpress.XtraEditors.ProgressBarControl();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.pictureBox3 = new System.Windows.Forms.PictureBox();
|
||||
this.pictureBox2 = new System.Windows.Forms.PictureBox();
|
||||
this.Title_label = new System.Windows.Forms.Label();
|
||||
this.AlisPictureBox = new System.Windows.Forms.PictureBox();
|
||||
this.fluentDesignFormControl1 = new DevExpress.XtraBars.FluentDesignSystem.FluentDesignFormControl();
|
||||
this.barCheckItemShowCpLogTime = new DevExpress.XtraBars.BarCheckItem();
|
||||
this.barStaticItemSyncTime = new DevExpress.XtraBars.BarStaticItem();
|
||||
this.barToggleSwitchItemMapLog = new DevExpress.XtraBars.BarToggleSwitchItem();
|
||||
this.Chktimer = new System.Windows.Forms.Timer(this.components);
|
||||
this.UItimer = new System.Windows.Forms.Timer(this.components);
|
||||
this.notifyIcon = new System.Windows.Forms.NotifyIcon(this.components);
|
||||
this.contextMenuSubStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.toolStripMenuItemExit = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripComboBox1 = new System.Windows.Forms.ToolStripComboBox();
|
||||
this.fluentDesignFormContainer1.SuspendLayout();
|
||||
this.panel2.SuspendLayout();
|
||||
this.panel6.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridViewPort)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridViewListen)).BeginInit();
|
||||
this.panelSubFunc.SuspendLayout();
|
||||
this.panel3.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.progressBarControlD.Properties)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.progressBarControlC.Properties)).BeginInit();
|
||||
this.panel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.AlisPictureBox)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.fluentDesignFormControl1)).BeginInit();
|
||||
this.contextMenuSubStrip.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// fluentDesignFormContainer1
|
||||
//
|
||||
this.fluentDesignFormContainer1.Controls.Add(this.panel2);
|
||||
this.fluentDesignFormContainer1.Controls.Add(this.panel1);
|
||||
this.fluentDesignFormContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.fluentDesignFormContainer1.Location = new System.Drawing.Point(0, 46);
|
||||
this.fluentDesignFormContainer1.Name = "fluentDesignFormContainer1";
|
||||
this.fluentDesignFormContainer1.Size = new System.Drawing.Size(1979, 958);
|
||||
this.fluentDesignFormContainer1.TabIndex = 0;
|
||||
//
|
||||
// panel2
|
||||
//
|
||||
this.panel2.Controls.Add(this.panel6);
|
||||
this.panel2.Controls.Add(this.panelSubFunc);
|
||||
this.panel2.Controls.Add(this.panel7);
|
||||
this.panel2.Controls.Add(this.panel3);
|
||||
this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel2.Location = new System.Drawing.Point(0, 74);
|
||||
this.panel2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.panel2.Name = "panel2";
|
||||
this.panel2.Size = new System.Drawing.Size(1979, 884);
|
||||
this.panel2.TabIndex = 3;
|
||||
//
|
||||
// panel6
|
||||
//
|
||||
this.panel6.Controls.Add(this.dataGridViewPort);
|
||||
this.panel6.Controls.Add(this.dataGridViewListen);
|
||||
this.panel6.Controls.Add(this.progressBarProgram);
|
||||
this.panel6.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel6.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel6.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.panel6.Name = "panel6";
|
||||
this.panel6.Size = new System.Drawing.Size(1979, 592);
|
||||
this.panel6.TabIndex = 18;
|
||||
//
|
||||
// dataGridViewPort
|
||||
//
|
||||
this.dataGridViewPort.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
|
||||
this.dataGridViewPort.ColumnHeadersHeight = 34;
|
||||
this.dataGridViewPort.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.dataGridViewTextBoxColumn1,
|
||||
this.dataGridViewTextBoxColumn2,
|
||||
this.dataGridViewTextBoxColumn3,
|
||||
this.Column3,
|
||||
this.Column5,
|
||||
this.Column6,
|
||||
this.Column7});
|
||||
this.dataGridViewPort.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.dataGridViewPort.Location = new System.Drawing.Point(0, 461);
|
||||
this.dataGridViewPort.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.dataGridViewPort.Name = "dataGridViewPort";
|
||||
this.dataGridViewPort.RowHeadersWidth = 62;
|
||||
this.dataGridViewPort.RowTemplate.Height = 23;
|
||||
this.dataGridViewPort.Size = new System.Drawing.Size(1979, 131);
|
||||
this.dataGridViewPort.TabIndex = 24;
|
||||
//
|
||||
// dataGridViewTextBoxColumn1
|
||||
//
|
||||
this.dataGridViewTextBoxColumn1.HeaderText = "Number";
|
||||
this.dataGridViewTextBoxColumn1.MinimumWidth = 8;
|
||||
this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
|
||||
this.dataGridViewTextBoxColumn1.ReadOnly = true;
|
||||
this.dataGridViewTextBoxColumn1.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||
//
|
||||
// dataGridViewTextBoxColumn2
|
||||
//
|
||||
this.dataGridViewTextBoxColumn2.HeaderText = "State";
|
||||
this.dataGridViewTextBoxColumn2.MinimumWidth = 8;
|
||||
this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2";
|
||||
this.dataGridViewTextBoxColumn2.ReadOnly = true;
|
||||
this.dataGridViewTextBoxColumn2.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||
//
|
||||
// dataGridViewTextBoxColumn3
|
||||
//
|
||||
this.dataGridViewTextBoxColumn3.HeaderText = "Detail";
|
||||
this.dataGridViewTextBoxColumn3.MinimumWidth = 8;
|
||||
this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3";
|
||||
this.dataGridViewTextBoxColumn3.ReadOnly = true;
|
||||
this.dataGridViewTextBoxColumn3.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||
//
|
||||
// Column3
|
||||
//
|
||||
this.Column3.HeaderText = "Command Send";
|
||||
this.Column3.MinimumWidth = 8;
|
||||
this.Column3.Name = "Column3";
|
||||
this.Column3.ReadOnly = true;
|
||||
this.Column3.Resizable = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.Column3.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||
//
|
||||
// Column5
|
||||
//
|
||||
this.Column5.HeaderText = "Command Recv";
|
||||
this.Column5.MinimumWidth = 8;
|
||||
this.Column5.Name = "Column5";
|
||||
this.Column5.ReadOnly = true;
|
||||
this.Column5.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||
//
|
||||
// Column6
|
||||
//
|
||||
this.Column6.HeaderText = "Stream Send";
|
||||
this.Column6.MinimumWidth = 8;
|
||||
this.Column6.Name = "Column6";
|
||||
this.Column6.ReadOnly = true;
|
||||
this.Column6.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||
//
|
||||
// Column7
|
||||
//
|
||||
this.Column7.HeaderText = "Stream Recv";
|
||||
this.Column7.MinimumWidth = 8;
|
||||
this.Column7.Name = "Column7";
|
||||
this.Column7.ReadOnly = true;
|
||||
this.Column7.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||
//
|
||||
// dataGridViewListen
|
||||
//
|
||||
this.dataGridViewListen.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
|
||||
this.dataGridViewListen.ColumnHeadersHeight = 34;
|
||||
this.dataGridViewListen.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.Column1,
|
||||
this.Column4,
|
||||
this.Column2});
|
||||
this.dataGridViewListen.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.dataGridViewListen.Location = new System.Drawing.Point(0, 60);
|
||||
this.dataGridViewListen.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.dataGridViewListen.Name = "dataGridViewListen";
|
||||
this.dataGridViewListen.RowHeadersWidth = 62;
|
||||
this.dataGridViewListen.RowTemplate.Height = 23;
|
||||
this.dataGridViewListen.Size = new System.Drawing.Size(1979, 401);
|
||||
this.dataGridViewListen.TabIndex = 21;
|
||||
//
|
||||
// Column1
|
||||
//
|
||||
this.Column1.HeaderText = "Number(Listen)";
|
||||
this.Column1.MinimumWidth = 8;
|
||||
this.Column1.Name = "Column1";
|
||||
this.Column1.ReadOnly = true;
|
||||
this.Column1.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||
//
|
||||
// Column4
|
||||
//
|
||||
this.Column4.HeaderText = "State";
|
||||
this.Column4.MinimumWidth = 8;
|
||||
this.Column4.Name = "Column4";
|
||||
this.Column4.ReadOnly = true;
|
||||
this.Column4.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||
//
|
||||
// Column2
|
||||
//
|
||||
this.Column2.HeaderText = "Detail";
|
||||
this.Column2.MinimumWidth = 8;
|
||||
this.Column2.Name = "Column2";
|
||||
this.Column2.ReadOnly = true;
|
||||
this.Column2.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||
//
|
||||
// progressBarProgram
|
||||
//
|
||||
this.progressBarProgram.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.progressBarProgram.ForeColor = System.Drawing.SystemColors.HotTrack;
|
||||
this.progressBarProgram.Location = new System.Drawing.Point(0, 0);
|
||||
this.progressBarProgram.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.progressBarProgram.Name = "progressBarProgram";
|
||||
this.progressBarProgram.Size = new System.Drawing.Size(1979, 60);
|
||||
this.progressBarProgram.Style = System.Windows.Forms.ProgressBarStyle.Marquee;
|
||||
this.progressBarProgram.TabIndex = 20;
|
||||
//
|
||||
// panelSubFunc
|
||||
//
|
||||
this.panelSubFunc.BackColor = System.Drawing.Color.Azure;
|
||||
this.panelSubFunc.Controls.Add(this.buttonMapLogClear);
|
||||
this.panelSubFunc.Controls.Add(this.buttonListenReset);
|
||||
this.panelSubFunc.Controls.Add(this.buttonUserQueryRead);
|
||||
this.panelSubFunc.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.panelSubFunc.Location = new System.Drawing.Point(0, 592);
|
||||
this.panelSubFunc.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.panelSubFunc.Name = "panelSubFunc";
|
||||
this.panelSubFunc.Size = new System.Drawing.Size(1979, 58);
|
||||
this.panelSubFunc.TabIndex = 17;
|
||||
//
|
||||
// buttonMapLogClear
|
||||
//
|
||||
this.buttonMapLogClear.BackColor = System.Drawing.Color.Ivory;
|
||||
this.buttonMapLogClear.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.buttonMapLogClear.Location = new System.Drawing.Point(1088, 0);
|
||||
this.buttonMapLogClear.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.buttonMapLogClear.Name = "buttonMapLogClear";
|
||||
this.buttonMapLogClear.Size = new System.Drawing.Size(297, 58);
|
||||
this.buttonMapLogClear.TabIndex = 4;
|
||||
this.buttonMapLogClear.Text = "Map Log Clear";
|
||||
this.buttonMapLogClear.UseVisualStyleBackColor = false;
|
||||
this.buttonMapLogClear.Click += new System.EventHandler(this.buttonMapLogClear_Click);
|
||||
//
|
||||
// buttonListenReset
|
||||
//
|
||||
this.buttonListenReset.BackColor = System.Drawing.Color.Gold;
|
||||
this.buttonListenReset.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.buttonListenReset.Location = new System.Drawing.Point(1385, 0);
|
||||
this.buttonListenReset.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.buttonListenReset.Name = "buttonListenReset";
|
||||
this.buttonListenReset.Size = new System.Drawing.Size(297, 58);
|
||||
this.buttonListenReset.TabIndex = 3;
|
||||
this.buttonListenReset.Text = "Listen Socket Reset";
|
||||
this.buttonListenReset.UseVisualStyleBackColor = false;
|
||||
this.buttonListenReset.Click += new System.EventHandler(this.buttonListenReset_Click);
|
||||
//
|
||||
// buttonUserQueryRead
|
||||
//
|
||||
this.buttonUserQueryRead.BackColor = System.Drawing.Color.Ivory;
|
||||
this.buttonUserQueryRead.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.buttonUserQueryRead.Location = new System.Drawing.Point(1682, 0);
|
||||
this.buttonUserQueryRead.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.buttonUserQueryRead.Name = "buttonUserQueryRead";
|
||||
this.buttonUserQueryRead.Size = new System.Drawing.Size(297, 58);
|
||||
this.buttonUserQueryRead.TabIndex = 2;
|
||||
this.buttonUserQueryRead.Text = "User Query Information Reload";
|
||||
this.buttonUserQueryRead.UseVisualStyleBackColor = false;
|
||||
this.buttonUserQueryRead.Click += new System.EventHandler(this.buttonUserQueryRead_Click);
|
||||
//
|
||||
// panel7
|
||||
//
|
||||
this.panel7.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.panel7.Location = new System.Drawing.Point(0, 650);
|
||||
this.panel7.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.panel7.Name = "panel7";
|
||||
this.panel7.Size = new System.Drawing.Size(1979, 94);
|
||||
this.panel7.TabIndex = 14;
|
||||
//
|
||||
// panel3
|
||||
//
|
||||
this.panel3.Controls.Add(this.progressBarControlD);
|
||||
this.panel3.Controls.Add(this.progressBarControlC);
|
||||
this.panel3.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.panel3.Location = new System.Drawing.Point(0, 744);
|
||||
this.panel3.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.panel3.Name = "panel3";
|
||||
this.panel3.Size = new System.Drawing.Size(1979, 140);
|
||||
this.panel3.TabIndex = 2;
|
||||
//
|
||||
// progressBarControlD
|
||||
//
|
||||
this.progressBarControlD.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.progressBarControlD.Location = new System.Drawing.Point(0, 69);
|
||||
this.progressBarControlD.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.progressBarControlD.Name = "progressBarControlD";
|
||||
this.progressBarControlD.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.UltraFlat;
|
||||
this.progressBarControlD.Properties.EditFormat.FormatString = "WEQWEQW";
|
||||
this.progressBarControlD.Properties.ReadOnly = true;
|
||||
this.progressBarControlD.Size = new System.Drawing.Size(1979, 71);
|
||||
this.progressBarControlD.TabIndex = 1;
|
||||
this.progressBarControlD.ToolTipAnchor = DevExpress.Utils.ToolTipAnchor.Cursor;
|
||||
this.progressBarControlD.ToolTipIconType = DevExpress.Utils.ToolTipIconType.Asterisk;
|
||||
this.progressBarControlD.ToolTipTitle = "Show harddisk remain value(%)";
|
||||
//
|
||||
// progressBarControlC
|
||||
//
|
||||
this.progressBarControlC.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.progressBarControlC.Location = new System.Drawing.Point(0, 0);
|
||||
this.progressBarControlC.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.progressBarControlC.Name = "progressBarControlC";
|
||||
this.progressBarControlC.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.UltraFlat;
|
||||
this.progressBarControlC.Properties.EditFormat.FormatString = "WEQWEQW";
|
||||
this.progressBarControlC.Properties.ReadOnly = true;
|
||||
this.progressBarControlC.Size = new System.Drawing.Size(1979, 69);
|
||||
this.progressBarControlC.TabIndex = 0;
|
||||
this.progressBarControlC.ToolTipAnchor = DevExpress.Utils.ToolTipAnchor.Cursor;
|
||||
this.progressBarControlC.ToolTipIconType = DevExpress.Utils.ToolTipIconType.Asterisk;
|
||||
this.progressBarControlC.ToolTipTitle = "Show harddisk remain value(%)";
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.panel1.Controls.Add(this.pictureBox3);
|
||||
this.panel1.Controls.Add(this.pictureBox2);
|
||||
this.panel1.Controls.Add(this.Title_label);
|
||||
this.panel1.Controls.Add(this.AlisPictureBox);
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.panel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(1979, 74);
|
||||
this.panel1.TabIndex = 2;
|
||||
//
|
||||
// pictureBox3
|
||||
//
|
||||
this.pictureBox3.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.pictureBox3.Image = global::SystemX.Net.MiddlewareUI.UIM.Properties.Resources.ALIS;
|
||||
this.pictureBox3.Location = new System.Drawing.Point(220, 0);
|
||||
this.pictureBox3.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.pictureBox3.Name = "pictureBox3";
|
||||
this.pictureBox3.Size = new System.Drawing.Size(133, 72);
|
||||
this.pictureBox3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||
this.pictureBox3.TabIndex = 4;
|
||||
this.pictureBox3.TabStop = false;
|
||||
//
|
||||
// pictureBox2
|
||||
//
|
||||
this.pictureBox2.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.pictureBox2.Image = global::SystemX.Net.MiddlewareUI.UIM.Properties.Resources.CI;
|
||||
this.pictureBox2.Location = new System.Drawing.Point(1770, 0);
|
||||
this.pictureBox2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.pictureBox2.Name = "pictureBox2";
|
||||
this.pictureBox2.Size = new System.Drawing.Size(207, 72);
|
||||
this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||
this.pictureBox2.TabIndex = 3;
|
||||
this.pictureBox2.TabStop = false;
|
||||
//
|
||||
// Title_label
|
||||
//
|
||||
this.Title_label.BackColor = System.Drawing.Color.White;
|
||||
this.Title_label.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.Title_label.Font = new System.Drawing.Font("Times New Roman", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.Title_label.Location = new System.Drawing.Point(220, 0);
|
||||
this.Title_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.Title_label.Name = "Title_label";
|
||||
this.Title_label.Size = new System.Drawing.Size(1757, 72);
|
||||
this.Title_label.TabIndex = 2;
|
||||
this.Title_label.Text = "CP ALIS";
|
||||
this.Title_label.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.Title_label.DoubleClick += new System.EventHandler(this.label1_DoubleClick);
|
||||
//
|
||||
// AlisPictureBox
|
||||
//
|
||||
this.AlisPictureBox.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.AlisPictureBox.Image = global::SystemX.Net.MiddlewareUI.UIM.Properties.Resources.Kefico_CI;
|
||||
this.AlisPictureBox.Location = new System.Drawing.Point(0, 0);
|
||||
this.AlisPictureBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.AlisPictureBox.Name = "AlisPictureBox";
|
||||
this.AlisPictureBox.Size = new System.Drawing.Size(220, 72);
|
||||
this.AlisPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||
this.AlisPictureBox.TabIndex = 1;
|
||||
this.AlisPictureBox.TabStop = false;
|
||||
//
|
||||
// fluentDesignFormControl1
|
||||
//
|
||||
this.fluentDesignFormControl1.FluentDesignForm = this;
|
||||
this.fluentDesignFormControl1.Items.AddRange(new DevExpress.XtraBars.BarItem[] {
|
||||
this.barCheckItemShowCpLogTime,
|
||||
this.barStaticItemSyncTime,
|
||||
this.barToggleSwitchItemMapLog});
|
||||
this.fluentDesignFormControl1.Location = new System.Drawing.Point(0, 0);
|
||||
this.fluentDesignFormControl1.Name = "fluentDesignFormControl1";
|
||||
this.fluentDesignFormControl1.Size = new System.Drawing.Size(1979, 46);
|
||||
this.fluentDesignFormControl1.TabIndex = 2;
|
||||
this.fluentDesignFormControl1.TabStop = false;
|
||||
this.fluentDesignFormControl1.TitleItemLinks.Add(this.barCheckItemShowCpLogTime);
|
||||
this.fluentDesignFormControl1.TitleItemLinks.Add(this.barStaticItemSyncTime);
|
||||
this.fluentDesignFormControl1.TitleItemLinks.Add(this.barToggleSwitchItemMapLog);
|
||||
//
|
||||
// barCheckItemShowCpLogTime
|
||||
//
|
||||
this.barCheckItemShowCpLogTime.CheckBoxVisibility = DevExpress.XtraBars.CheckBoxVisibility.BeforeText;
|
||||
this.barCheckItemShowCpLogTime.Id = 0;
|
||||
this.barCheckItemShowCpLogTime.Name = "barCheckItemShowCpLogTime";
|
||||
this.barCheckItemShowCpLogTime.CheckedChanged += new DevExpress.XtraBars.ItemClickEventHandler(this.barCheckItemShowCpLogTime_CheckedChanged);
|
||||
//
|
||||
// barStaticItemSyncTime
|
||||
//
|
||||
this.barStaticItemSyncTime.Caption = "Server time synchronization progressed successfully.";
|
||||
this.barStaticItemSyncTime.Id = 0;
|
||||
this.barStaticItemSyncTime.ImageOptions.SvgImage = ((DevExpress.Utils.Svg.SvgImage)(resources.GetObject("barStaticItemSyncTime.ImageOptions.SvgImage")));
|
||||
this.barStaticItemSyncTime.Name = "barStaticItemSyncTime";
|
||||
this.barStaticItemSyncTime.PaintStyle = DevExpress.XtraBars.BarItemPaintStyle.CaptionGlyph;
|
||||
this.barStaticItemSyncTime.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
|
||||
//
|
||||
// barToggleSwitchItemMapLog
|
||||
//
|
||||
this.barToggleSwitchItemMapLog.Caption = "[MappedFileLogProcessOption]";
|
||||
this.barToggleSwitchItemMapLog.Id = 0;
|
||||
this.barToggleSwitchItemMapLog.Name = "barToggleSwitchItemMapLog";
|
||||
this.barToggleSwitchItemMapLog.CheckedChanged += new DevExpress.XtraBars.ItemClickEventHandler(this.barToggleSwitchItemMapLog_CheckedChanged);
|
||||
//
|
||||
// Chktimer
|
||||
//
|
||||
this.Chktimer.Enabled = true;
|
||||
this.Chktimer.Interval = 1000;
|
||||
this.Chktimer.Tick += new System.EventHandler(this.Chktimer_Tick);
|
||||
//
|
||||
// UItimer
|
||||
//
|
||||
this.UItimer.Tick += new System.EventHandler(this.UItimer_Tick);
|
||||
//
|
||||
// notifyIcon
|
||||
//
|
||||
this.notifyIcon.BalloonTipIcon = System.Windows.Forms.ToolTipIcon.Info;
|
||||
this.notifyIcon.BalloonTipText = "2020-09 Ver 1.2.0";
|
||||
this.notifyIcon.BalloonTipTitle = "For ALIS middleware program";
|
||||
this.notifyIcon.ContextMenuStrip = this.contextMenuSubStrip;
|
||||
this.notifyIcon.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon.Icon")));
|
||||
this.notifyIcon.Text = "Middleware";
|
||||
this.notifyIcon.Visible = true;
|
||||
this.notifyIcon.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.notifyIcon_MouseDoubleClick);
|
||||
//
|
||||
// contextMenuSubStrip
|
||||
//
|
||||
this.contextMenuSubStrip.Font = new System.Drawing.Font("Times New Roman", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.contextMenuSubStrip.ImageScalingSize = new System.Drawing.Size(24, 24);
|
||||
this.contextMenuSubStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.toolStripSeparator1,
|
||||
this.toolStripMenuItemExit});
|
||||
this.contextMenuSubStrip.Name = "contextMenuSubStrip";
|
||||
this.contextMenuSubStrip.Size = new System.Drawing.Size(207, 42);
|
||||
this.contextMenuSubStrip.Text = "Menu";
|
||||
this.contextMenuSubStrip.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.contextMenuSubStrip_ItemClicked);
|
||||
//
|
||||
// toolStripSeparator1
|
||||
//
|
||||
this.toolStripSeparator1.Name = "toolStripSeparator1";
|
||||
this.toolStripSeparator1.Size = new System.Drawing.Size(203, 6);
|
||||
//
|
||||
// toolStripMenuItemExit
|
||||
//
|
||||
this.toolStripMenuItemExit.BackColor = System.Drawing.Color.Khaki;
|
||||
this.toolStripMenuItemExit.Name = "toolStripMenuItemExit";
|
||||
this.toolStripMenuItemExit.Size = new System.Drawing.Size(206, 32);
|
||||
this.toolStripMenuItemExit.Text = "Program Exit";
|
||||
//
|
||||
// toolStripComboBox1
|
||||
//
|
||||
this.toolStripComboBox1.Margin = new System.Windows.Forms.Padding(1, 0, 1, 0);
|
||||
this.toolStripComboBox1.Name = "toolStripComboBox1";
|
||||
this.toolStripComboBox1.Size = new System.Drawing.Size(121, 23);
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 22F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1979, 1004);
|
||||
this.ControlContainer = this.fluentDesignFormContainer1;
|
||||
this.Controls.Add(this.fluentDesignFormContainer1);
|
||||
this.Controls.Add(this.fluentDesignFormControl1);
|
||||
this.FluentDesignFormControl = this.fluentDesignFormControl1;
|
||||
this.IconOptions.Icon = ((System.Drawing.Icon)(resources.GetObject("MainForm.IconOptions.Icon")));
|
||||
this.Name = "MainForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "SystemX.Net.Middleware.UI - CPXV2 v240529";
|
||||
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing);
|
||||
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.MainForm_FormClosed);
|
||||
this.fluentDesignFormContainer1.ResumeLayout(false);
|
||||
this.panel2.ResumeLayout(false);
|
||||
this.panel6.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridViewPort)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridViewListen)).EndInit();
|
||||
this.panelSubFunc.ResumeLayout(false);
|
||||
this.panel3.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.progressBarControlD.Properties)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.progressBarControlC.Properties)).EndInit();
|
||||
this.panel1.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.AlisPictureBox)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.fluentDesignFormControl1)).EndInit();
|
||||
this.contextMenuSubStrip.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
private DevExpress.XtraBars.FluentDesignSystem.FluentDesignFormContainer fluentDesignFormContainer1;
|
||||
private DevExpress.XtraBars.FluentDesignSystem.FluentDesignFormControl fluentDesignFormControl1;
|
||||
private System.Windows.Forms.PictureBox AlisPictureBox;
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private System.Windows.Forms.Label Title_label;
|
||||
private System.Windows.Forms.Panel panel2;
|
||||
private System.Windows.Forms.Timer Chktimer;
|
||||
private System.Windows.Forms.Timer UItimer;
|
||||
private System.Windows.Forms.Panel panel3;
|
||||
private DevExpress.XtraEditors.ProgressBarControl progressBarControlC;
|
||||
private DevExpress.XtraEditors.ProgressBarControl progressBarControlD;
|
||||
private System.Windows.Forms.NotifyIcon notifyIcon;
|
||||
private System.Windows.Forms.PictureBox pictureBox2;
|
||||
private System.Windows.Forms.PictureBox pictureBox3;
|
||||
private System.Windows.Forms.ContextMenuStrip contextMenuSubStrip;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
|
||||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemExit;
|
||||
private System.Windows.Forms.ToolStripComboBox toolStripComboBox1;
|
||||
private System.Windows.Forms.Panel panel7;
|
||||
private System.Windows.Forms.Panel panelSubFunc;
|
||||
private System.Windows.Forms.Button buttonUserQueryRead;
|
||||
private BarCheckItem barCheckItemShowCpLogTime;
|
||||
private BarStaticItem barStaticItemSyncTime;
|
||||
private System.Windows.Forms.Panel panel6;
|
||||
private System.Windows.Forms.DataGridView dataGridViewPort;
|
||||
private System.Windows.Forms.DataGridView dataGridViewListen;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column1;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column4;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column2;
|
||||
private System.Windows.Forms.ProgressBar progressBarProgram;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn1;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn2;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn3;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column3;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column5;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column6;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column7;
|
||||
private System.Windows.Forms.Button buttonListenReset;
|
||||
private BarToggleSwitchItem barToggleSwitchItemMapLog;
|
||||
private System.Windows.Forms.Button buttonMapLogClear;
|
||||
}
|
||||
}
|
||||
|
||||
1060
SystemX.Net.CP.Middleware.PD/SystemX.Net.Middleware.UI/MainForm.cs
Normal file
1352
SystemX.Net.CP.Middleware.PD/SystemX.Net.Middleware.UI/MainForm.resx
Normal file
@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace SystemX.Net.MiddlewareUI
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
bool bCreateProgram = false;
|
||||
|
||||
Mutex SetMutex = new Mutex(true, "SystemX.Net.Middleware.UI CPXV2", out bCreateProgram);
|
||||
|
||||
if (bCreateProgram)
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new MainForm());
|
||||
|
||||
SetMutex.ReleaseMutex();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("[SystemX.Net.MiddlewareUI CPXV2] Already this program excute now. Check the process.", "SystemX.Net.Middleware.UI", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("SystemX.Net.MiddlewareUI")]
|
||||
[assembly: AssemblyDescription("SystemX")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("SystemX")]
|
||||
[assembly: AssemblyProduct("SystemX.Net.MiddlewareUI")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2022")]
|
||||
[assembly: AssemblyTrademark("CP-ServerX")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("83f9d8f8-1fc1-4c57-bef0-9b0f33d4ff9e")]
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("20.22.11.29")]
|
||||
[assembly: AssemblyFileVersion("20.22.11.29")]
|
||||
173
SystemX.Net.CP.Middleware.PD/SystemX.Net.Middleware.UI/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,173 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 이 코드는 도구를 사용하여 생성되었습니다.
|
||||
// 런타임 버전:4.0.30319.42000
|
||||
//
|
||||
// 파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면
|
||||
// 이러한 변경 내용이 손실됩니다.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace SystemX.Net.MiddlewareUI.UIM.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 지역화된 문자열 등을 찾기 위한 강력한 형식의 리소스 클래스입니다.
|
||||
/// </summary>
|
||||
// 이 클래스는 ResGen 또는 Visual Studio와 같은 도구를 통해 StronglyTypedResourceBuilder
|
||||
// 클래스에서 자동으로 생성되었습니다.
|
||||
// 멤버를 추가하거나 제거하려면 .ResX 파일을 편집한 다음 /str 옵션을 사용하여 ResGen을
|
||||
// 다시 실행하거나 VS 프로젝트를 다시 빌드하십시오.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 이 클래스에서 사용하는 캐시된 ResourceManager 인스턴스를 반환합니다.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SystemX.Net.MiddlewareUI.UIM.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 이 강력한 형식의 리소스 클래스를 사용하여 모든 리소스 조회에 대해 현재 스레드의 CurrentUICulture 속성을
|
||||
/// 재정의합니다.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// System.Drawing.Bitmap 형식의 지역화된 리소스를 찾습니다.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap ALIS {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("ALIS", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// System.Drawing.Bitmap 형식의 지역화된 리소스를 찾습니다.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap Bubble_16x16 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Bubble_16x16", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// System.Drawing.Bitmap 형식의 지역화된 리소스를 찾습니다.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap Bubble_32x32 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Bubble_32x32", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// System.Drawing.Bitmap 형식의 지역화된 리소스를 찾습니다.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap Cancel_16x16 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Cancel_16x16", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// System.Drawing.Bitmap 형식의 지역화된 리소스를 찾습니다.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap Cancel_32x32 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Cancel_32x32", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// System.Drawing.Bitmap 형식의 지역화된 리소스를 찾습니다.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap CI {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("CI", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// System.Drawing.Bitmap 형식의 지역화된 리소스를 찾습니다.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap Database_16x16 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Database_16x16", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// System.Drawing.Bitmap 형식의 지역화된 리소스를 찾습니다.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap Database_32x32 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Database_32x32", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// System.Drawing.Bitmap 형식의 지역화된 리소스를 찾습니다.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap Kefico_CI {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Kefico_CI", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// System.Drawing.Bitmap 형식의 지역화된 리소스를 찾습니다.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap Publish_16x16 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Publish_16x16", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// System.Drawing.Bitmap 형식의 지역화된 리소스를 찾습니다.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap Publish_32x32 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Publish_32x32", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,154 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="ALIS" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\ALIS.PNG;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Bubble_16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Bubble_16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Bubble_32x32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Bubble_32x32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Cancel_16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Cancel_16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Cancel_32x32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Cancel_32x32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="CI" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\CI.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Database_16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Database_16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Database_32x32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Database_32x32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Kefico_CI" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Kefico CI.PNG;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Publish_16x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Publish_16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Publish_32x32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Publish_32x32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
||||
26
SystemX.Net.CP.Middleware.PD/SystemX.Net.Middleware.UI/Properties/Settings.Designer.cs
generated
Normal file
@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 이 코드는 도구를 사용하여 생성되었습니다.
|
||||
// 런타임 버전:4.0.30319.42000
|
||||
//
|
||||
// 파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면
|
||||
// 이러한 변경 내용이 손실됩니다.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace SystemX.Net.MiddlewareUI.UIM.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles />
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
@ -0,0 +1 @@
|
||||
DevExpress.XtraEditors.ProgressBarControl, DevExpress.XtraEditors.v20.2, Version=20.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SystemX.Common;
|
||||
using SystemX.Common.Serialization;
|
||||
using SystemX.Net.BaseProtocol;
|
||||
using SystemX.Net.Schedule;
|
||||
|
||||
namespace SystemX.Net.MiddlewareUI.UIM.Protocol_Method
|
||||
{
|
||||
public class CONNECT_STATE : ProtocolShell, IProtocol
|
||||
{
|
||||
public CONNECT_STATE(MainForm parent, int iPos, byte nLabel)
|
||||
: base(parent, iPos, nLabel)
|
||||
{
|
||||
}
|
||||
|
||||
public override void ExecuteProtocol(BASE_PROTOCOL GET_PROTOCOL,
|
||||
BASE_PROTOCOL.PROTOCOL_CODE CODE,
|
||||
HEADER_PACKET getHeader,
|
||||
object objData)
|
||||
{
|
||||
PING_PACKET GetPingPacket = (PING_PACKET)objData;
|
||||
|
||||
string strGetMsg = GetPingPacket.objCheckMsg[0].Data;
|
||||
|
||||
PING_PACKET PingPacketMake = new PING_PACKET();
|
||||
int iSendSize = Marshal.SizeOf(PingPacketMake);
|
||||
byte[] ucSendArray = new byte[iSendSize];
|
||||
PingPacketMake = (PING_PACKET)SystemXNetSerialization.RawDeSerialize(ucSendArray, PingPacketMake.GetType());
|
||||
|
||||
PingPacketMake.objCheckMsg[0].Data = "SystemX";
|
||||
|
||||
ucSendByteInfo = XCommons.SpecialObjectToByteStream(new BASE_PROTOCOL(BASE_PROTOCOL.PROTOCOL_CODE.CONNECT_STATE), PingPacketMake);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,172 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SystemX.Common;
|
||||
using SystemX.Common.Serialization;
|
||||
using SystemX.Net.BaseProtocol;
|
||||
using SystemX.Net.Schedule;
|
||||
using static SystemX.Net.DB.XDBConnManager;
|
||||
using static SystemX.Net.MiddlewareUI.MainForm;
|
||||
|
||||
namespace SystemX.Net.MiddlewareUI.UIM.Protocol_Method
|
||||
{
|
||||
public class HOST_INFO_CHECK : ProtocolShell, IProtocol
|
||||
{
|
||||
public HOST_INFO_CHECK(MainForm parent, int iPos, byte nLabel)
|
||||
: base(parent, iPos, nLabel)
|
||||
{
|
||||
}
|
||||
|
||||
public override void ExecuteProtocol(BASE_PROTOCOL GET_PROTOCOL,
|
||||
BASE_PROTOCOL.PROTOCOL_CODE CODE,
|
||||
HEADER_PACKET getHeader,
|
||||
object objData)
|
||||
{
|
||||
SYSTEM_HOST_PACKET usPacket = (SYSTEM_HOST_PACKET)objData;
|
||||
|
||||
bool bGetUseUIM = usPacket.bUseUIM;
|
||||
bool bGetUseSimpleLookupOption = usPacket.bUseSimpleLookupOption;
|
||||
|
||||
string strGetHostID = usPacket.objHostID[0].Data;
|
||||
|
||||
if (bGetUseUIM && bGetUseSimpleLookupOption)
|
||||
strGetHostID = "SIMPLE-LOOKUP";
|
||||
|
||||
string strGetSection = usPacket.objSection[0].Data;
|
||||
string strGetTestCode = usPacket.objTestCode[0].Data;
|
||||
string strGetMessage = usPacket.objMessage[0].Data;
|
||||
|
||||
SYSTEM_HOST_PACKET MakeLoginPacket = new SYSTEM_HOST_PACKET();
|
||||
int iSendSize = Marshal.SizeOf(MakeLoginPacket);
|
||||
byte[] ucSendArray = new byte[iSendSize];
|
||||
MakeLoginPacket = (SYSTEM_HOST_PACKET)SystemXNetSerialization.RawDeSerialize(ucSendArray, MakeLoginPacket.GetType());
|
||||
|
||||
MakeLoginPacket.objHostID[0].Data = strGetHostID;
|
||||
MakeLoginPacket.objSection[0].Data = strGetSection;
|
||||
MakeLoginPacket.objTestCode[0].Data = strGetTestCode;
|
||||
|
||||
try
|
||||
{
|
||||
ConnectInfoStore thisConnInfo = Parent_.GetConnectInfo(nPos) as ConnectInfoStore;
|
||||
|
||||
bool bForcePass = false;
|
||||
|
||||
DataTable dtHostTable = null;
|
||||
DataTable dtUserTable = null;
|
||||
|
||||
DataRow[] drFindInfo = null;
|
||||
|
||||
thisConnInfo.bHostLoginState = false;
|
||||
|
||||
bool bUseExist = true;
|
||||
|
||||
if (bGetUseUIM && bGetUseSimpleLookupOption)
|
||||
bForcePass = true;
|
||||
|
||||
if (bForcePass == false)
|
||||
{
|
||||
dtHostTable = Parent_.GetDBConn().CurrentConnection(eConnCategory.Main).GetHostList(true);
|
||||
dtUserTable = Parent_.GetDBConn().CurrentConnection(eConnCategory.Main).GetUserList(true);
|
||||
|
||||
if (bGetUseUIM)
|
||||
drFindInfo = dtUserTable.Select($"UserID='{strGetHostID}' AND Password='{strGetSection}'");
|
||||
else
|
||||
drFindInfo = dtHostTable.Select($"HostID='{strGetHostID}' AND Section='{strGetSection}'");
|
||||
|
||||
bUseExist = Parent_.GetConnectInfoFindHost(strGetHostID, strGetSection, bGetUseUIM);
|
||||
}
|
||||
|
||||
if (((drFindInfo != null ? drFindInfo.Count() > 0 : false) &&
|
||||
bUseExist == false) ||
|
||||
bForcePass)
|
||||
{
|
||||
string strRegIP = string.Empty;
|
||||
string strConnectIP = string.Empty;
|
||||
string strRegTestCode = string.Empty;
|
||||
|
||||
if (drFindInfo[0].Table.Columns.Contains("TestCode"))
|
||||
strRegTestCode = drFindInfo[0]["TestCode"].ToString();
|
||||
|
||||
if (bGetUseUIM == false)
|
||||
strRegIP = drFindInfo[0]["IP"].ToString();
|
||||
|
||||
strConnectIP = thisConnInfo.strCommandEndPointInfo;
|
||||
|
||||
//TODO : For Test Server Code
|
||||
if (true || strConnectIP.IndexOf(strRegIP) >= 0 || bGetUseUIM)
|
||||
{
|
||||
;//IP Address Compare Result PASS
|
||||
//
|
||||
//
|
||||
}
|
||||
else
|
||||
{
|
||||
MakeLoginPacket.objMessage[0].Data = $"HostID={strGetHostID} Section={strGetSection} [FAIL] It is not the IP address specified in the host information.";
|
||||
|
||||
throw new Exception("[IP Address Check Error]");
|
||||
}
|
||||
|
||||
bool bTestCodeCompareResult = true;
|
||||
|
||||
if (strRegTestCode.Length > 0)
|
||||
{
|
||||
if (strRegTestCode.CompareTo(strGetTestCode) != 0)
|
||||
{
|
||||
bTestCodeCompareResult = false;
|
||||
|
||||
MakeLoginPacket.objMessage[0].Data = $"HostID={strGetHostID} Section={strGetSection} ServerCode={strRegTestCode} ClientCode={strGetTestCode} [FAIL] The host's registered test code and the test code sent by the client do not match.";
|
||||
}
|
||||
}
|
||||
|
||||
if (bTestCodeCompareResult == false)
|
||||
{
|
||||
throw new Exception("[TestCode Check Error]");
|
||||
}
|
||||
|
||||
MakeLoginPacket.objMessage[0].Data = $"HostID={strGetHostID} Section={strGetSection} [SUCCESS] Welcome.";
|
||||
|
||||
thisConnInfo.strConnectHostID = strGetHostID;
|
||||
|
||||
if (bGetUseUIM == false)
|
||||
thisConnInfo.strConnectSection = strGetSection;
|
||||
else
|
||||
{
|
||||
thisConnInfo.strConnectSection = strConnectIP;
|
||||
|
||||
MakeLoginPacket.objMessage[0].Data = $"HostID={strGetHostID} Section={thisConnInfo.strConnectSection} [SUCCESS] Welcome.";
|
||||
}
|
||||
|
||||
string strHostSectionInfo =
|
||||
thisConnInfo.strConnectHostID + ";" +
|
||||
thisConnInfo.strConnectSection;
|
||||
|
||||
if (Parent_.TestListCntID.ContainsKey(strHostSectionInfo))
|
||||
Parent_.TestListCntID[strHostSectionInfo].Clear();
|
||||
|
||||
thisConnInfo.strResultTestListCntID = string.Empty;
|
||||
|
||||
Parent_.SetLoginState(strGetHostID, thisConnInfo.strConnectSection, true);
|
||||
|
||||
thisConnInfo.bHostLoginState = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(bUseExist)
|
||||
MakeLoginPacket.objMessage[0].Data = $"HostID={strGetHostID} Section={strGetSection} [FAIL] HOST ID already in use.";
|
||||
else
|
||||
MakeLoginPacket.objMessage[0].Data = $"HostID={strGetHostID} Section={strGetSection} [FAIL] That information does not exist.";
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
MakeLoginPacket.objMessage[0].Data = $"HostID={strGetHostID} Section={strGetSection} [FAIL] Middleware login process error. " + ex.Message;
|
||||
}
|
||||
|
||||
ucSendByteInfo = XCommons.SpecialObjectToByteStream(new BASE_PROTOCOL(BASE_PROTOCOL.PROTOCOL_CODE.HOST_INFO_CHECK), MakeLoginPacket);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,675 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SystemX.Common;
|
||||
using SystemX.Common.Serialization;
|
||||
using SystemX.Net.BaseProtocol;
|
||||
using SystemX.Net.Schedule;
|
||||
|
||||
using static SystemX.Net.MiddlewareUI.MainForm;
|
||||
|
||||
namespace SystemX.Net.MiddlewareUI.UIM.Protocol_Method
|
||||
{
|
||||
public class PROCESS_QUERY : ProtocolShell, IProtocol
|
||||
{
|
||||
protected enum ISSUANCE_TYPE
|
||||
{
|
||||
NONE = 0,
|
||||
ISSUANCE = 1,
|
||||
REISSUANCE = 2
|
||||
}
|
||||
|
||||
ISSUANCE_TYPE eTypeIssuance;
|
||||
|
||||
string strGetMacAddress;
|
||||
|
||||
string strReturnMessage;
|
||||
|
||||
string strGetProductID;
|
||||
|
||||
Int64 nAbrogateMacUQNo;
|
||||
Int64 nReIssuanceProductUQNo;
|
||||
|
||||
DataSet ds;
|
||||
|
||||
public PROCESS_QUERY(MainForm parent, int iPos, byte nLabel)
|
||||
: base(parent, iPos, nLabel)
|
||||
{
|
||||
eTypeIssuance = ISSUANCE_TYPE.NONE;
|
||||
|
||||
strGetMacAddress = string.Empty;
|
||||
|
||||
strReturnMessage = string.Empty;
|
||||
|
||||
strGetProductID = string.Empty;
|
||||
|
||||
ds = null;
|
||||
}
|
||||
|
||||
public override void ExecuteProtocol(BASE_PROTOCOL GET_PROTOCOL,
|
||||
BASE_PROTOCOL.PROTOCOL_CODE CODE,
|
||||
HEADER_PACKET getHeader,
|
||||
object objData)
|
||||
{
|
||||
//QUERY PALLET INFO
|
||||
PROCESS_PACKET ppPacket = (PROCESS_PACKET)objData;
|
||||
|
||||
byte[] ucQueryByteArray = null;
|
||||
|
||||
ConnectInfoStore thisConnInfo = Parent_.GetConnectInfo(nPos) as ConnectInfoStore;
|
||||
|
||||
switch (GET_PROTOCOL.GetOptionCode())
|
||||
{
|
||||
case BASE_PROTOCOL.OPTION_CODE.QUERY_TESTLIST:
|
||||
{
|
||||
IsByteList = true;
|
||||
|
||||
string strGetQuery = cp.QueryFindTestList(ppPacket);
|
||||
|
||||
int nLoadPosition = 0;
|
||||
|
||||
getStreamList = Parent_.QueryStreamProcess(strGetQuery, out ucQueryByteArray, out ds);
|
||||
|
||||
if (XCommons.isHasRow(ds) == true)
|
||||
{
|
||||
nLoadPosition = Convert.ToInt32(ds.Tables[0].Rows[0]["UseTLPosition"]);
|
||||
|
||||
if (nLoadPosition > 0)
|
||||
{
|
||||
strGetQuery = cp.QuerySelectTestListData(ppPacket, nLoadPosition);
|
||||
|
||||
getStreamList = Parent_.QueryStreamProcess(strGetQuery, out ucQueryByteArray, out ds);
|
||||
}
|
||||
}
|
||||
|
||||
thisConnInfo.strResultTestListCntID = string.Empty;
|
||||
|
||||
string GetTestListCntID = string.Empty;
|
||||
|
||||
for (int n = 0; n < 2; n++)
|
||||
{
|
||||
GetTestListCntID = Parent_.SetQueryTestListInfo(nPos, thisConnInfo.strConnectHostID, thisConnInfo.strConnectSection, ppPacket, ds);
|
||||
|
||||
if ((GetTestListCntID.IndexOf("[FAIL]") >= 0) ||
|
||||
(GetTestListCntID.IndexOf("[CHECK]") >= 0) ||
|
||||
(GetTestListCntID.IndexOf("[ERROR]") >= 0))
|
||||
break;
|
||||
|
||||
thisConnInfo.strResultTestListCntID = GetTestListCntID;
|
||||
|
||||
if (string.IsNullOrEmpty(GetTestListCntID) == false)
|
||||
{
|
||||
getStreamList = Parent_.QueryStreamProcess(strGetQuery, out ucQueryByteArray, out ds, thisConnInfo.strResultTestListCntID);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
nByteListSize = getStreamList.Count;
|
||||
|
||||
/*
|
||||
if (string.IsNullOrEmpty(GetTestListCntID) == true)
|
||||
this.bThisShellSendOn = false;
|
||||
*/
|
||||
}
|
||||
break;
|
||||
case BASE_PROTOCOL.OPTION_CODE.CHECK_VAILD_TESTLIST:
|
||||
{
|
||||
IsByteList = true;
|
||||
|
||||
string strGetQuery = cp.QueryFindTestList(ppPacket, true);
|
||||
|
||||
getStreamList = Parent_.QueryStreamProcess(strGetQuery, out ucQueryByteArray, out ds);
|
||||
|
||||
nByteListSize = getStreamList.Count;
|
||||
}
|
||||
break;
|
||||
case BASE_PROTOCOL.OPTION_CODE.GET_ISSUANCE_MACADDRESS:
|
||||
{
|
||||
//Query 결과 : DataSet, RecordsAffectedCnt, FieldCnt, HasRow
|
||||
var vResult = new Tuple<DataSet, int, int, bool>(null, 0, 0, false);
|
||||
|
||||
//Param 1 : Query 문 Param 2 : Table Return 위치
|
||||
var vMakeQueryText = new Tuple<string, string>(string.Empty, string.Empty);
|
||||
|
||||
int nErrCode = 0;
|
||||
|
||||
try
|
||||
{
|
||||
strGetProductID = ppPacket.objProductID[0].Data;
|
||||
|
||||
eTypeIssuance = (ISSUANCE_TYPE)Enum.Parse(typeof(ISSUANCE_TYPE), ppPacket.objTestCode[0].Data);
|
||||
|
||||
vMakeQueryText = Parent_.GetUsetQueryInfo().GetUserQueryText("ID_IsIssued", new List<string>() { strGetProductID });
|
||||
|
||||
vResult = Parent_.QueryProcess(vMakeQueryText.Item1, out ucSendByteInfo);
|
||||
|
||||
ds = vResult.Item1;
|
||||
|
||||
//발행된 이력이 존재 만약 재발행 옵션이라면
|
||||
if (XCommons.isHasRow(ds) == true)
|
||||
{
|
||||
//발행된 맥어드레스 리턴
|
||||
vMakeQueryText = Parent_.GetUsetQueryInfo().GetUserQueryText("LookUpMacAddress_ByID", new List<string>() { strGetProductID });
|
||||
|
||||
//Query Text, Return Field Pos or Field Name
|
||||
vResult = Parent_.QueryProcess(vMakeQueryText.Item1, out ucSendByteInfo);
|
||||
|
||||
//Data Set, Field Cnt, Records Affected Cnt, Has Row
|
||||
ds = vResult.Item1;
|
||||
|
||||
strGetMacAddress = GetTableValue(ds, vMakeQueryText.Item2);
|
||||
|
||||
if (eTypeIssuance == ISSUANCE_TYPE.ISSUANCE)
|
||||
{
|
||||
strReturnMessage = "[ERROR] ID [" + strGetProductID + "] that has already been issued. The issued MAC address is as follows [" + strGetMacAddress + "].";
|
||||
|
||||
nErrCode = -2;
|
||||
|
||||
throw new Exception(strReturnMessage);
|
||||
}
|
||||
else if (eTypeIssuance == ISSUANCE_TYPE.REISSUANCE)
|
||||
{
|
||||
string strGetMacUQNo = ds.Tables[0].Rows[0][0].ToString();
|
||||
string strGetProductUQNo = ds.Tables[0].Rows[0][3].ToString();
|
||||
|
||||
nAbrogateMacUQNo = Int64.MaxValue;
|
||||
nReIssuanceProductUQNo = Int64.MaxValue;
|
||||
|
||||
Int64.TryParse(strGetMacUQNo, out nAbrogateMacUQNo);
|
||||
Int64.TryParse(strGetProductUQNo, out nReIssuanceProductUQNo);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//발행된 이력이 없을때 재발행 옵션일시 재발행 에러 처리
|
||||
if (eTypeIssuance == ISSUANCE_TYPE.REISSUANCE)
|
||||
{
|
||||
//실패 발행된 맥어드레스 리턴 및 에러 문구
|
||||
vMakeQueryText = Parent_.GetUsetQueryInfo().GetUserQueryText("LookUpMacAddress_ByID", new List<string>() { strGetProductID });
|
||||
|
||||
//Query Text, Return Field Pos or Field Name
|
||||
vResult = Parent_.QueryProcess(vMakeQueryText.Item1, out ucSendByteInfo);
|
||||
|
||||
//Data Set, Field Cnt, Records Affected Cnt, Has Row
|
||||
ds = vResult.Item1;
|
||||
|
||||
strGetMacAddress = string.Empty;
|
||||
|
||||
strReturnMessage = "[ERROR] ID [" + strGetProductID + "] There is no published history. In the case of the reissue option, only the issued ID can be processed.";
|
||||
|
||||
nErrCode = -3;
|
||||
|
||||
throw new Exception(strReturnMessage);
|
||||
}
|
||||
}
|
||||
|
||||
//현재 발행갯수 확인 및 Index Seek
|
||||
int nCurrentMacNum = GetCurrentMacQuantity();
|
||||
|
||||
if (nCurrentMacNum == int.MinValue)
|
||||
{
|
||||
strReturnMessage = "[ERROR] Failed to get internal index start number.(MacAddress)";
|
||||
|
||||
nErrCode = -12;
|
||||
|
||||
throw new Exception(strReturnMessage);
|
||||
}
|
||||
|
||||
string strGetProductNo = string.Empty;
|
||||
Int64 nGetProductNo = Int64.MaxValue;
|
||||
|
||||
if (eTypeIssuance == ISSUANCE_TYPE.ISSUANCE)
|
||||
{
|
||||
//현재 제품 발행갯수 확인 및 Index Seek
|
||||
int nCurrentProductNum = GetCurrentProductQuantity();
|
||||
|
||||
if (nCurrentProductNum == int.MinValue)
|
||||
{
|
||||
strReturnMessage = "[ERROR] Failed to get internal index start number.(Product)";
|
||||
|
||||
nErrCode = -13;
|
||||
|
||||
throw new Exception(strReturnMessage);
|
||||
}
|
||||
else
|
||||
{
|
||||
//등록될 제품 위치 가져오기
|
||||
vMakeQueryText = Parent_.GetUsetQueryInfo().GetUserQueryText("Product_ToBeRegisterCheck", new List<string>() { nCurrentProductNum.ToString() });
|
||||
|
||||
vResult = Parent_.QueryProcess(vMakeQueryText.Item1, out ucSendByteInfo);
|
||||
|
||||
ds = vResult.Item1;
|
||||
|
||||
//미등록 제품 위치 가져오기 실패시(조회 실패)
|
||||
if (XCommons.isHasRow(ds) == false)
|
||||
{
|
||||
strReturnMessage = "[ERROR] ID [" + strGetProductID + "] Failed to look up register position.";
|
||||
|
||||
nErrCode = -14;
|
||||
|
||||
throw new Exception(strReturnMessage);
|
||||
}
|
||||
|
||||
//해당 맥 어드레스 번호 학인
|
||||
strGetProductNo = ds.Tables[0].Rows[0][0].ToString();
|
||||
|
||||
nGetProductNo = Int64.MaxValue;
|
||||
Int64.TryParse(strGetProductNo, out nGetProductNo);
|
||||
}
|
||||
}
|
||||
else if (eTypeIssuance == ISSUANCE_TYPE.REISSUANCE)
|
||||
{
|
||||
nGetProductNo = nReIssuanceProductUQNo;
|
||||
strGetProductNo = nGetProductNo.ToString();
|
||||
}
|
||||
|
||||
//맥 어드레스 하나 가져오기
|
||||
vMakeQueryText = Parent_.GetUsetQueryInfo().GetUserQueryText("MacAddress_ToBeIssuedCheck", new List<string>() { nCurrentMacNum.ToString() });
|
||||
|
||||
vResult = Parent_.QueryProcess(vMakeQueryText.Item1, out ucSendByteInfo);
|
||||
|
||||
ds = vResult.Item1;
|
||||
|
||||
//미지정 맥 어드레스 가져오기 실패시(조회 실패)
|
||||
if (XCommons.isHasRow(ds) == false)
|
||||
{
|
||||
strReturnMessage = "[ERROR] ID [" + strGetProductID + "] Failed to look up unissued MAC address.";
|
||||
|
||||
nErrCode = -15;
|
||||
|
||||
throw new Exception(strReturnMessage);
|
||||
}
|
||||
|
||||
//해당 맥 어드레스 번호 학인
|
||||
string strGetMacNo = ds.Tables[0].Rows[0][0].ToString();
|
||||
|
||||
Int64 nGetMacNo = Int64.MaxValue;
|
||||
Int64.TryParse(strGetMacNo, out nGetMacNo);
|
||||
|
||||
//해당 맥 어드레스 발급 여부 확인
|
||||
vMakeQueryText = Parent_.GetUsetQueryInfo().GetUserQueryText("CheckMacAddressIsItemState", new List<string>() { strGetMacNo });
|
||||
|
||||
vResult = Parent_.QueryProcess(vMakeQueryText.Item1, out ucSendByteInfo);
|
||||
|
||||
ds = vResult.Item1;
|
||||
|
||||
//발급 여부 관련 쿼리 실패시
|
||||
if (XCommons.isHasRow(ds) == false)
|
||||
{
|
||||
strReturnMessage = "[ERROR] ID [" + strGetProductID + "] Failed to look up unissued MAC address.";
|
||||
|
||||
nErrCode = -16;
|
||||
|
||||
throw new Exception(strReturnMessage);
|
||||
}
|
||||
|
||||
//발급 여부 확인
|
||||
bool bIsIssuedState = Convert.ToBoolean(ds.Tables[0].Rows[0][0]);
|
||||
bool bIsAbrogateState = Convert.ToBoolean(ds.Tables[0].Rows[0][1]);
|
||||
strGetMacAddress = ds.Tables[0].Rows[0][2].ToString();
|
||||
|
||||
//이미 발급된 맥 어드레스
|
||||
if (bIsIssuedState)
|
||||
{
|
||||
strReturnMessage = "[ERROR] ID [" + strGetProductID + "] It was searched by the MAC address that was already issued.";
|
||||
|
||||
nErrCode = -17;
|
||||
|
||||
strGetMacAddress = string.Empty;
|
||||
|
||||
throw new Exception(strReturnMessage);
|
||||
}
|
||||
//이미 폐기된 맥 어드레스
|
||||
if (bIsAbrogateState)
|
||||
{
|
||||
strReturnMessage = "[ERROR] ID [" + strGetProductID + "] It was searched by the MAC address that was abrogate.";
|
||||
|
||||
nErrCode = -18;
|
||||
|
||||
strGetMacAddress = string.Empty;
|
||||
|
||||
throw new Exception(strReturnMessage);
|
||||
}
|
||||
|
||||
//해당 맥 어드레스 발급 여부 발급 상태로 변경
|
||||
vMakeQueryText = Parent_.GetUsetQueryInfo().GetUserQueryText("ChangeIsIssuedState", new List<string>() { strGetMacNo });
|
||||
|
||||
Parent_.QueryProcess(vMakeQueryText.Item1, out ucSendByteInfo);
|
||||
|
||||
//해당 맥 어드레스 발급 여부 확인
|
||||
vMakeQueryText = Parent_.GetUsetQueryInfo().GetUserQueryText("CheckMacAddressIsItemState", new List<string>() { strGetMacNo });
|
||||
|
||||
vResult = Parent_.QueryProcess(vMakeQueryText.Item1, out ucSendByteInfo);
|
||||
|
||||
ds = vResult.Item1;
|
||||
|
||||
//발급 여부 관련 쿼리 실패시
|
||||
if (XCommons.isHasRow(ds) == false)
|
||||
{
|
||||
strReturnMessage = "[ERROR] ID [" + strGetProductID + "] Failed to check whether the MAC address is issued.";
|
||||
|
||||
nErrCode = -19;
|
||||
|
||||
strGetMacAddress = string.Empty;
|
||||
|
||||
throw new Exception(strReturnMessage);
|
||||
}
|
||||
|
||||
//발급 여부 확인
|
||||
bIsIssuedState = Convert.ToBoolean(ds.Tables[0].Rows[0][0]);
|
||||
|
||||
//발급이 안되었다면
|
||||
if (bIsIssuedState == false)
|
||||
{
|
||||
strReturnMessage = "[ERROR] ID [" + strGetProductID + "] Failed to change whether to issue the MAC address.";
|
||||
|
||||
nErrCode = -20;
|
||||
|
||||
strGetMacAddress = string.Empty;
|
||||
|
||||
throw new Exception(strReturnMessage);
|
||||
}
|
||||
|
||||
if (eTypeIssuance == ISSUANCE_TYPE.ISSUANCE)
|
||||
{
|
||||
//해당 위치 받은 제품 ID 정보로 변경
|
||||
vMakeQueryText = Parent_.GetUsetQueryInfo().GetUserQueryText("NewUpdateProductIDInfo", new List<string>() { strGetProductID, strGetProductNo });
|
||||
|
||||
Parent_.QueryProcess(vMakeQueryText.Item1, out ucSendByteInfo);
|
||||
}
|
||||
else if (eTypeIssuance == ISSUANCE_TYPE.REISSUANCE)
|
||||
{
|
||||
//해당 위치 받은 제품 ID 정보로 변경
|
||||
vMakeQueryText = Parent_.GetUsetQueryInfo().GetUserQueryText("GetProductInfo", new List<string>() { strGetProductNo });
|
||||
|
||||
vResult = Parent_.QueryProcess(vMakeQueryText.Item1, out ucSendByteInfo);
|
||||
|
||||
ds = vResult.Item1;
|
||||
|
||||
//제품 전체 정보 조회 실패
|
||||
if (XCommons.isHasRow(ds) == false)
|
||||
{
|
||||
strReturnMessage = "[ERROR] ID [" + strGetProductID + "] Product all information inquiry failed.";
|
||||
|
||||
nErrCode = -21;
|
||||
|
||||
strGetMacAddress = string.Empty;
|
||||
|
||||
throw new Exception(strReturnMessage);
|
||||
}
|
||||
|
||||
bool bReIssued = Convert.ToBoolean(ds.Tables[0].Rows[0][4]);
|
||||
int nIssuedNumber = int.Parse(ds.Tables[0].Rows[0][5].ToString());
|
||||
|
||||
nIssuedNumber += 1;
|
||||
|
||||
vMakeQueryText = Parent_.GetUsetQueryInfo().GetUserQueryText("SetProductIssueInfo", new List<string>() { nIssuedNumber.ToString(), strGetProductNo });
|
||||
|
||||
Parent_.QueryProcess(vMakeQueryText.Item1, out ucSendByteInfo);
|
||||
}
|
||||
|
||||
//해당 위치 제품 ID 정보 일치 확인
|
||||
vMakeQueryText = Parent_.GetUsetQueryInfo().GetUserQueryText("CheckProductIDInfo", new List<string>() { strGetProductNo });
|
||||
|
||||
vResult = Parent_.QueryProcess(vMakeQueryText.Item1, out ucSendByteInfo);
|
||||
|
||||
ds = vResult.Item1;
|
||||
|
||||
//제품 ID 정보 조회 실패
|
||||
if (XCommons.isHasRow(ds) == false)
|
||||
{
|
||||
strReturnMessage = "[ERROR] ID [" + strGetProductID + "] Product ID information inquiry failed.";
|
||||
|
||||
nErrCode = -22;
|
||||
|
||||
strGetMacAddress = string.Empty;
|
||||
|
||||
throw new Exception(strReturnMessage);
|
||||
}
|
||||
|
||||
string strID = ds.Tables[0].Rows[0][0].ToString();
|
||||
|
||||
//제품 ID 정보 불 일치
|
||||
if (strID.CompareTo(strGetProductID) != 0)
|
||||
{
|
||||
strReturnMessage = "[ERROR] ID [" + strGetProductID + "] Failed to change ID information owned by the MAC address.";
|
||||
|
||||
nErrCode = -23;
|
||||
|
||||
strGetMacAddress = string.Empty;
|
||||
|
||||
throw new Exception(strReturnMessage);
|
||||
}
|
||||
|
||||
//맥어드레스 참조 제품 관계 번호(UNIQUE) 업데이트
|
||||
vMakeQueryText = Parent_.GetUsetQueryInfo().GetUserQueryText("UpdateMacAddressRelationNumber", new List<string>() { strGetProductNo, strGetMacNo });
|
||||
|
||||
Parent_.QueryProcess(vMakeQueryText.Item1, out ucSendByteInfo);
|
||||
|
||||
//제품 참조 맥 어드레스 관계 번호(UNIQUE) 업데이트
|
||||
vMakeQueryText = Parent_.GetUsetQueryInfo().GetUserQueryText("UpdateProductIDRelationNumber", new List<string>() { strGetMacNo, strGetProductNo });
|
||||
|
||||
Parent_.QueryProcess(vMakeQueryText.Item1, out ucSendByteInfo);
|
||||
|
||||
if (eTypeIssuance == ISSUANCE_TYPE.ISSUANCE)
|
||||
{
|
||||
//서머리 기록
|
||||
SetPublishSummary("Issued", nGetMacNo, "Issuance processing by MAC address issuance request.");
|
||||
|
||||
//제품 등록 INDEX SEEK
|
||||
SetProductQuantity();
|
||||
}
|
||||
else if (eTypeIssuance == ISSUANCE_TYPE.REISSUANCE)
|
||||
{
|
||||
vMakeQueryText = Parent_.GetUsetQueryInfo().GetUserQueryText("ChangeIsAbrogateState", new List<string>() { nAbrogateMacUQNo.ToString() });
|
||||
|
||||
Parent_.QueryProcess(vMakeQueryText.Item1, out ucSendByteInfo);
|
||||
|
||||
//서머리 기록
|
||||
SetPublishSummary("Abrogate", nAbrogateMacUQNo, "Abrogate of previously registered mac address information by requesting MAC address reissuance.");
|
||||
|
||||
//서머리 기록
|
||||
SetPublishSummary("Reissued", nGetMacNo, "Reissuance processing by MAC address reissuance request.");
|
||||
}
|
||||
|
||||
//맥 어드레스 등록 가능 갯수 변경
|
||||
SetMacQuantity();
|
||||
|
||||
//처리된 해당 제품 ID 관련 맥 어드레스 재 조회
|
||||
vMakeQueryText = Parent_.GetUsetQueryInfo().GetUserQueryText("LookUpMacAddress_ByID", new List<string>() { strGetProductID });
|
||||
|
||||
vResult = Parent_.QueryProcess(vMakeQueryText.Item1, out ucSendByteInfo);
|
||||
|
||||
ds = vResult.Item1;
|
||||
|
||||
//strReturnMessage = strGetMacAddress;
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
//Error Process
|
||||
if (strReturnMessage == string.Empty)
|
||||
strReturnMessage = e.Message;
|
||||
}
|
||||
finally
|
||||
{
|
||||
//결과 보내기
|
||||
Parent_.QueryResultRemake(ds,
|
||||
vResult.Item2,
|
||||
vResult.Item3,
|
||||
vResult.Item4,
|
||||
out ucSendByteInfo,
|
||||
vMakeQueryText.Item2,
|
||||
strReturnMessage,
|
||||
nErrCode.ToString());
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private bool SetPublishSummary(string strSetResult, Int64 nReferenceNo = Int64.MaxValue, string strSetDesc = "")
|
||||
{
|
||||
bool bSummaryResult = true;
|
||||
|
||||
var vMakeQueryText = Parent_.GetUsetQueryInfo().GetUserQueryText("PublishSummaryNumberCheck");
|
||||
|
||||
var vResult = Parent_.QueryProcess(vMakeQueryText.Item1, out ucSendByteInfo);
|
||||
|
||||
ds = vResult.Item1;
|
||||
|
||||
Int64 nSummaryNo = Int64.MaxValue;
|
||||
|
||||
try
|
||||
{
|
||||
if (Int64.TryParse(ds.Tables[0].Rows[0][0].ToString(), out nSummaryNo) == false)
|
||||
throw new Exception();
|
||||
|
||||
string strNowTime = DateTime.Now.ToString("yyyyMMddHHmmssfff");
|
||||
|
||||
nSummaryNo += 1;
|
||||
|
||||
ConnectInfoStore thisConnInfo = Parent_.GetConnectInfo(nPos) as ConnectInfoStore;
|
||||
|
||||
string strQueryID = nSummaryNo + "-" + strNowTime;
|
||||
string strRefNum = nReferenceNo == Int64.MaxValue ? null : nReferenceNo.ToString();
|
||||
|
||||
List<string> lstParam = new List<string>();
|
||||
|
||||
lstParam.Add(strQueryID);
|
||||
lstParam.Add(strRefNum);
|
||||
|
||||
lstParam.Add(thisConnInfo.strConnectHostID);
|
||||
lstParam.Add(thisConnInfo.strConnectSection);
|
||||
|
||||
lstParam.Add(strGetProductID);
|
||||
|
||||
lstParam.Add(strSetResult);
|
||||
lstParam.Add(strSetDesc);
|
||||
|
||||
vMakeQueryText = Parent_.GetUsetQueryInfo().GetUserQueryText("PublishSummaryInsert", lstParam);
|
||||
|
||||
vResult = Parent_.QueryProcess(vMakeQueryText.Item1, out ucSendByteInfo);
|
||||
}
|
||||
catch
|
||||
{
|
||||
bSummaryResult = false;
|
||||
}
|
||||
|
||||
return bSummaryResult;
|
||||
}
|
||||
|
||||
private int GetCurrentMacQuantity()
|
||||
{
|
||||
int nCurCnt = int.MaxValue;
|
||||
|
||||
var vMakeQueryText = Parent_.GetUsetQueryInfo().GetUserQueryText("Check_Mac_Quantity");
|
||||
|
||||
var vResult = Parent_.QueryProcess(vMakeQueryText.Item1, out ucSendByteInfo);
|
||||
|
||||
ds = vResult.Item1;
|
||||
|
||||
try
|
||||
{
|
||||
if (int.TryParse(ds.Tables[0].Rows[0][0].ToString(), out nCurCnt) == false)
|
||||
throw new Exception();
|
||||
}
|
||||
catch
|
||||
{
|
||||
nCurCnt = int.MinValue;
|
||||
}
|
||||
|
||||
return nCurCnt;
|
||||
}
|
||||
|
||||
private bool SetMacQuantity()
|
||||
{
|
||||
bool bResult = true;
|
||||
|
||||
var vMakeQueryText = Parent_.GetUsetQueryInfo().GetUserQueryText("Check_Mac_Quantity");
|
||||
|
||||
var vResult = Parent_.QueryProcess(vMakeQueryText.Item1, out ucSendByteInfo);
|
||||
|
||||
ds = vResult.Item1;
|
||||
|
||||
try
|
||||
{
|
||||
Int64 nCurCnt = Int64.MaxValue;
|
||||
|
||||
if (Int64.TryParse(ds.Tables[0].Rows[0][0].ToString(), out nCurCnt) == false)
|
||||
throw new Exception();
|
||||
|
||||
nCurCnt += 1;
|
||||
|
||||
vMakeQueryText = Parent_.GetUsetQueryInfo().GetUserQueryText("Set_Mac_Quantity", new List<string>() { nCurCnt.ToString() });
|
||||
|
||||
vResult = Parent_.QueryProcess(vMakeQueryText.Item1, out ucSendByteInfo);
|
||||
}
|
||||
catch
|
||||
{
|
||||
bResult = false;
|
||||
}
|
||||
|
||||
return bResult;
|
||||
}
|
||||
|
||||
private int GetCurrentProductQuantity()
|
||||
{
|
||||
int nCurCnt = int.MaxValue;
|
||||
|
||||
var vMakeQueryText = Parent_.GetUsetQueryInfo().GetUserQueryText("Check_Product_Quantity");
|
||||
|
||||
var vResult = Parent_.QueryProcess(vMakeQueryText.Item1, out ucSendByteInfo);
|
||||
|
||||
ds = vResult.Item1;
|
||||
|
||||
try
|
||||
{
|
||||
if (int.TryParse(ds.Tables[0].Rows[0][0].ToString(), out nCurCnt) == false)
|
||||
throw new Exception();
|
||||
}
|
||||
catch
|
||||
{
|
||||
nCurCnt = int.MinValue;
|
||||
}
|
||||
|
||||
return nCurCnt;
|
||||
}
|
||||
|
||||
private bool SetProductQuantity()
|
||||
{
|
||||
bool bResult = true;
|
||||
|
||||
var vMakeQueryText = Parent_.GetUsetQueryInfo().GetUserQueryText("Check_Product_Quantity");
|
||||
|
||||
var vResult = Parent_.QueryProcess(vMakeQueryText.Item1, out ucSendByteInfo);
|
||||
|
||||
ds = vResult.Item1;
|
||||
|
||||
try
|
||||
{
|
||||
Int64 nCurCnt = Int64.MaxValue;
|
||||
|
||||
if (Int64.TryParse(ds.Tables[0].Rows[0][0].ToString(), out nCurCnt) == false)
|
||||
throw new Exception();
|
||||
|
||||
nCurCnt += 1;
|
||||
|
||||
vMakeQueryText = Parent_.GetUsetQueryInfo().GetUserQueryText("Set_Product_Quantity", new List<string>() { nCurCnt.ToString() });
|
||||
|
||||
vResult = Parent_.QueryProcess(vMakeQueryText.Item1, out ucSendByteInfo);
|
||||
}
|
||||
catch
|
||||
{
|
||||
bResult = false;
|
||||
}
|
||||
|
||||
return bResult;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SystemX.Common;
|
||||
using SystemX.Common.Serialization;
|
||||
using SystemX.Net.BaseProtocol;
|
||||
using SystemX.Net.Schedule;
|
||||
|
||||
namespace SystemX.Net.MiddlewareUI.UIM.Protocol_Method
|
||||
{
|
||||
public class SYSTEM_QUERY : ProtocolShell, IProtocol
|
||||
{
|
||||
public SYSTEM_QUERY(MainForm parent, int iPos, byte nLabel)
|
||||
: base(parent, iPos, nLabel)
|
||||
{
|
||||
}
|
||||
|
||||
public override void ExecuteProtocol(BASE_PROTOCOL GET_PROTOCOL,
|
||||
BASE_PROTOCOL.PROTOCOL_CODE CODE,
|
||||
HEADER_PACKET getHeader,
|
||||
object objData)
|
||||
{
|
||||
QUERY_PACKET usPacket = (QUERY_PACKET)objData;
|
||||
|
||||
string strGetQueryText = usPacket.objQueryText[0].Data;
|
||||
|
||||
Parent_.QueryProcess(strGetQueryText, out ucSendByteInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,113 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SystemX.Common;
|
||||
using SystemX.Common.Serialization;
|
||||
using SystemX.Net.BaseProtocol;
|
||||
using SystemX.Net.Schedule;
|
||||
|
||||
using static SystemX.Net.Platform.Common.Util.LogMessage;
|
||||
|
||||
namespace SystemX.Net.MiddlewareUI.UIM.Protocol_Method
|
||||
{
|
||||
public class USER_QUERY : ProtocolShell, IProtocol
|
||||
{
|
||||
public USER_QUERY(MainForm parent, int iPos, byte nLabel)
|
||||
: base(parent, iPos, nLabel)
|
||||
{
|
||||
}
|
||||
|
||||
public override void ExecuteProtocol(BASE_PROTOCOL GET_PROTOCOL,
|
||||
BASE_PROTOCOL.PROTOCOL_CODE CODE,
|
||||
HEADER_PACKET getHeader,
|
||||
object objData)
|
||||
{
|
||||
QUERY_PACKET usPacket = (QUERY_PACKET)objData;
|
||||
|
||||
string strGetQueryText = usPacket.objQueryText[0].Data;
|
||||
|
||||
string[] stLstInfo = strGetQueryText.Split(';');
|
||||
|
||||
//User Query Call
|
||||
if (stLstInfo[0].CompareTo("UserQueryCall") == 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Parent_.GetUsetQueryInfo().bHasItem == false)
|
||||
throw new Exception("User query no have item.");
|
||||
|
||||
var getQuery = Parent_.GetUsetQueryInfo().GetUserQueryInfo(stLstInfo[1]);
|
||||
|
||||
if (getQuery == null)
|
||||
throw new Exception("Can't find [" + stLstInfo[1] + "] ID user query.");
|
||||
|
||||
//받은 파라미터 개수
|
||||
int nParamNum = stLstInfo.Count() - 2;
|
||||
|
||||
string strQueryID = getQuery[0].Value.Item1;
|
||||
string strQueryFrom = getQuery[0].Value.Item2;
|
||||
string strMakeQueryText = getQuery[0].Value.Item3;
|
||||
string strVarParam1 = getQuery[0].Value.Item4;
|
||||
|
||||
//From 부분 대체
|
||||
int nParamPos = 0;
|
||||
if (strQueryFrom.Length > 0)
|
||||
{
|
||||
if (strMakeQueryText.IndexOf("@$UseFrom@$") < 0)
|
||||
throw new Exception("Access table argument format [@$UseFrom@$] syntax does not exist.");
|
||||
|
||||
string[] strLstQueryForms = strQueryFrom.Split(';');
|
||||
|
||||
foreach (string strFormParam in strLstQueryForms)
|
||||
{
|
||||
if (strMakeQueryText.IndexOf("@$UseFrom@$") < 0)
|
||||
throw new Exception("The number of parameters and the number of argument types do not match.");
|
||||
|
||||
strMakeQueryText = strMakeQueryText.Replace("@$UseFrom@$[" + (nParamPos + 1).ToString() + "]", strFormParam);
|
||||
|
||||
nParamPos++;
|
||||
}
|
||||
}
|
||||
|
||||
//사용자 입력 쿼리 텍스트 파라미터 개수 파악
|
||||
int nQueryParamNum = 0;
|
||||
string strTemp = strMakeQueryText;
|
||||
while (true)
|
||||
{
|
||||
if (strTemp.IndexOf("@$PARAM@$") >= 0)
|
||||
nQueryParamNum++;
|
||||
else
|
||||
break;
|
||||
|
||||
strTemp = strTemp.Remove(strTemp.IndexOf("@$PARAM@$"), 12);
|
||||
}
|
||||
|
||||
if(nParamNum != nQueryParamNum)
|
||||
throw new Exception("The number of parameters does not match.");
|
||||
|
||||
//파라미터 정리
|
||||
string[] lstParams = new string[nParamNum];
|
||||
Array.Copy(stLstInfo, 2, lstParams, 0, nParamNum);
|
||||
|
||||
//파라미터 위치 값으로 대체
|
||||
nParamPos = 0;
|
||||
foreach (string strParamValue in lstParams)
|
||||
{
|
||||
strMakeQueryText = strMakeQueryText.Replace("@$PARAM@$[" + (nParamPos + 1).ToString() + "]", strParamValue);
|
||||
|
||||
nParamPos++;
|
||||
}
|
||||
|
||||
Parent_.QueryProcess(strMakeQueryText, out ucSendByteInfo, strVarParam1);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageOutput.ConsoleWrite(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss>>") + " User query process error! [" + e.Message + "] \r\n" + e.Message, ConsoleColor.Red, LogMessageLevel.FATAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,90 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SystemX.Common.Protocol.SIA;
|
||||
using SystemX.Net.BaseProtocol;
|
||||
using SystemX.Net.Schedule;
|
||||
using static SystemX.Net.MiddlewareUI.MainForm;
|
||||
|
||||
namespace SystemX.Net.MiddlewareUI.UIM.Protocol_Method
|
||||
{
|
||||
public interface IProtocol
|
||||
{
|
||||
}
|
||||
|
||||
public class ProtocolShell
|
||||
{
|
||||
public MainForm Parent_;
|
||||
|
||||
protected CustomProtocol_ cp = new CustomProtocol_();
|
||||
|
||||
protected int nPos;
|
||||
|
||||
protected byte nLabel;
|
||||
|
||||
protected byte[] ucSendByteInfo;
|
||||
|
||||
protected List<byte[]> getStreamList;
|
||||
|
||||
protected bool bThisShellSendOn;
|
||||
|
||||
public bool GetShellSendOnState()
|
||||
{
|
||||
return bThisShellSendOn;
|
||||
}
|
||||
|
||||
public byte[] ArrSendByte(int nPos = 0)
|
||||
{
|
||||
if (IsByteList == false)
|
||||
return ucSendByteInfo;
|
||||
else
|
||||
return getStreamList.ElementAt(nPos);
|
||||
}
|
||||
|
||||
public bool IsByteList { protected set; get; }
|
||||
|
||||
public int nByteListSize { protected set; get; }
|
||||
|
||||
public ProtocolShell(MainForm parent, int iPos, byte nLabel)
|
||||
{
|
||||
this.bThisShellSendOn = true;
|
||||
|
||||
this.IsByteList = false;
|
||||
|
||||
this.nByteListSize = 0;
|
||||
|
||||
this.Parent_ = parent;
|
||||
|
||||
this.nPos = iPos;
|
||||
|
||||
this.nLabel = nLabel;
|
||||
}
|
||||
|
||||
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 virtual void ExecuteProtocol(BASE_PROTOCOL GET_PROTOCOL,
|
||||
BASE_PROTOCOL.PROTOCOL_CODE CODE,
|
||||
HEADER_PACKET getHeader,
|
||||
object objData){ /*Virtual*/ }
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 259 B |
|
After Width: | Height: | Size: 339 B |
|
After Width: | Height: | Size: 9.3 KiB |
|
After Width: | Height: | Size: 289 B |
|
After Width: | Height: | Size: 386 B |
|
After Width: | Height: | Size: 265 B |
|
After Width: | Height: | Size: 368 B |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 431 B |
|
After Width: | Height: | Size: 765 B |
@ -0,0 +1,213 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{3658FBE5-9A84-4F76-8E19-867DB9F4484D}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>SystemX.Net.MiddlewareUI.UIM</RootNamespace>
|
||||
<AssemblyName>SystemX.Net.MiddlewareUI.UIM</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>ALIS ICON.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Common.Logging, Version=3.4.1.0, Culture=neutral, PublicKeyToken=af08829b84f0328e, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Common.Logging.3.4.1\lib\net40\Common.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Common.Logging.Core, Version=3.4.1.0, Culture=neutral, PublicKeyToken=af08829b84f0328e, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Common.Logging.Core.3.4.1\lib\net40\Common.Logging.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="CpApplciationIntrf">
|
||||
<HintPath>Reference\Cp\CpApplciationIntrf.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="CpApplication">
|
||||
<HintPath>Reference\Cp\CpApplication.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="CpCommon">
|
||||
<HintPath>Reference\Cp\CpCommon.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.Data.Desktop.v20.2, Version=20.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DevExpress.Data.v20.2, Version=20.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DevExpress.Utils.v20.2, Version=20.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DevExpress.XtraBars.v20.2, Version=20.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
|
||||
<Reference Include="DevExpress.XtraEditors.v20.2, Version=20.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="SystemX.Net.Platform, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\Output.SystemX\SystemX.Net.Platform.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="LogProcess\LSU_Trimming_4Th_LogProcess\AnalysisLog_LSU.cs" />
|
||||
<Compile Include="LogProcess\LSU_Trimming_4Th_LogProcess\ReadLogProcessInfo_LSU.cs" />
|
||||
<Compile Include="LogProcess\LSU_Trimming_4Th_LogProcess\XLogDataControl_.cs" />
|
||||
<Compile Include="LogProcess\ReadUserQueryInfo_.cs" />
|
||||
<Compile Include="LogProcess\Smart_Inhibitor_1th_LogProcess\AnalysisLog_SIA.cs" />
|
||||
<Compile Include="LogProcess\Smart_Inhibitor_1th_LogProcess\ReadLogProcessInfo_SIA.cs" />
|
||||
<Compile Include="MainForm Sub\MappedLog.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MainForm Sub\UI.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MainForm Sub\Function.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MainForm Sub\Query.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MainForm Sub\FileProcess.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MainForm Sub\Stream.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MainForm Sub\Command.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Commons.cs" />
|
||||
<Compile Include="MainForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MainForm.Designer.cs">
|
||||
<DependentUpon>MainForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Protocol Method\Command Protocol\USER_QUERY.cs" />
|
||||
<Compile Include="Protocol Method\Command Protocol\SYSTEM_QUERY.cs" />
|
||||
<Compile Include="Protocol Method\Command Protocol\PROCESS_QUERY.cs" />
|
||||
<Compile Include="Protocol Method\ProtocolShell.cs" />
|
||||
<Compile Include="Protocol Method\Command Protocol\HOST_INFO_CHECK.cs" />
|
||||
<Compile Include="Protocol Method\Command Protocol\CONNECT_STATE.cs" />
|
||||
<EmbeddedResource Include="MainForm.resx">
|
||||
<DependentUpon>MainForm.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\licenses.licx" />
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<None Include="App.config" />
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\ALIS.PNG" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\Bubble_16x16.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\Bubble_32x32.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\Cancel_16x16.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\Cancel_32x32.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\Database_16x16.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\Database_32x32.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\Publish_16x16.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\Publish_32x32.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="ALIS ICON.ico" />
|
||||
<None Include="Resources\CI.png" />
|
||||
<None Include="Resources\Kefico CI.PNG" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Protocol Method\Stream Protocol\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Common.Logging" version="3.4.1" targetFramework="net452" />
|
||||
<package id="Common.Logging.Core" version="3.4.1" targetFramework="net452" />
|
||||
<package id="Microsoft.CSharp" version="4.0.1" targetFramework="net452" />
|
||||
<package id="Win32.TokenPrivileges" version="1.0.19073.2" targetFramework="net452" />
|
||||
</packages>
|
||||