INT_PT002/INT_PT002/Forms/FormMain.cs

4096 lines
180 KiB
C#

using System;
using System.Linq;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using SmartX;
using INT_PT002.DataStore;
using INT_PT002.Part11_UserManager;
using INT_PT002.DialogForms;
using System.Net.Sockets;
using InModbus;
namespace INT_PT002.Forms
{
public partial class FormMain : Form
{
#region Field
public bool IsSmartFileIOOpen;
public bool IsCommunicationLogOpen;
private int CommunicationCheckCount;
public int FlagAutomaticLogoutWarningTime;
// 로그온 색상
public Color ColorLogOff;
public Color ColorLogOn;
private Color ColorButtonEnabled;
private Color ColorButtonDisabled;
// 파일 위치
private string m_PathLaunchFolder;
private string m_PathSystemFileFolder;
private string m_PathDataBackupFolder;
private string m_PathProgramSaveFolder;
private string m_PathDataStatisticsFolder;
private string m_PathDataFolder;
private string m_PathDataHistoryFolder;
private string m_PathDataInspectionFolder;
private string m_PathDataAlarmFolder;
private static string m_PathBinFolder;
// UserGroup
public UserGroup CurrentUserGroup;
// 업데이트 메인보드
public UpdateForMainBoard UpdateForMain;
// 현재 장비 상태
public SystemStatus CurrentSystemStatus;
// SystemConfiguration
public SystemConfiguration SystemConfig;
// Current Recipe
public Recipe CurrentRecipe;
// Leak Data
private LeakData CurrentLeakData;
private Collection<LeakData1> CurrentLeakDatas;
// Dll User_Name List
public List<string> ListDllUserName;
// IO Test - input data
private Collection<string> CollectionIOTest_InputData;
// 장비 구동 상태
private Define.E_EquipmentStatus m_EquipmentStatus;
// 알람
private AlarmList CurrentAlarmList;
// Modbus
public Modbus Modbus;
// Ethernet
private bool IsEthernetThreadStop;
private bool IsEthernetTransferData;
public object EthernetTransferData;
private TcpClient EthernetTcpClient;
private NetworkStream EthernetNetStream;
private StreamReader EthernetStmReader;
private StreamWriter EthernetStmWriter;
private delegate void TransferByteArrayDataCallback(byte[] byteArray);
private delegate void TransferStringDataCallback(string strText);
private delegate void TransferByteDataCallback(byte byteText);
private delegate void TextStatusCallback(string strText);
private delegate void UIControlCallback(bool bEnable);
private delegate void UIServerStatusCallback(bool bEnable);
private delegate void UITimerWorkCallback(bool bEnable);
private delegate void TimerTryConnectCallback(bool bEnable);
// Form
public FormMainDisplay3 ChildFormMainDisplay;
public FormMenu ChildFormMenu;
#endregion
#region Constructor
public FormMain()
{
InitializeComponent();
}
#endregion
#region Property
public string PathLaunchFolder
{
get { return this.m_PathLaunchFolder; }
set { this.m_PathLaunchFolder = value; }
}
public string PathSystemFileFolder
{
get { return this.m_PathSystemFileFolder; }
set { this.m_PathSystemFileFolder = value; }
}
public string PathDataBackupFolder
{
get { return this.m_PathDataBackupFolder; }
set { this.m_PathDataBackupFolder = value; }
}
public string PathProgramSaveFolder
{
get { return this.m_PathProgramSaveFolder; }
set { this.m_PathProgramSaveFolder = value; }
}
public string PathDataStatisticsFolder
{
get { return this.m_PathDataStatisticsFolder; }
private set { this.m_PathDataStatisticsFolder = value; }
}
public string PathDataFolder
{
get { return this.m_PathDataFolder; }
private set { this.m_PathDataFolder = value; }
}
public string PathDataHistoryFolder
{
get { return this.m_PathDataHistoryFolder; }
private set { this.m_PathDataHistoryFolder = value; }
}
public string PathDataInspectionFolder
{
get { return this.m_PathDataInspectionFolder; }
private set { this.m_PathDataInspectionFolder = value; }
}
public string PathDataAlarmFolder
{
get { return this.m_PathDataAlarmFolder; }
private set { this.m_PathDataAlarmFolder = value; }
}
public Define.E_EquipmentStatus EquipmentStatus
{
get { return this.m_EquipmentStatus; }
private set { this.m_EquipmentStatus = value; }
}
#endregion
#region Method
public static void Exception(Exception ex)
{
try
{
string fileName = "SD Card\\DataBackup\\" + string.Format("{0:yyyyMMdd_HHmmss}_Exception.txt", DateTime.Now);
FileStream fs = new FileStream(fileName, FileMode.OpenOrCreate);
StreamWriter sw = new StreamWriter(fs);
sw.Write(ex.ToString());
sw.Close();
fs.Close();
}
catch
{
string fileName = "Flash Disk\\" + string.Format("{0:yyyyMMdd_HHmmss}_Exception.txt", DateTime.Now);
FileStream fs = new FileStream(fileName, FileMode.OpenOrCreate);
StreamWriter sw = new StreamWriter(fs);
sw.Write(ex.ToString());
sw.Close();
fs.Close();
}
}
private void DefaultSetting()
{
this.IsSmartFileIOOpen = false;
this.IsCommunicationLogOpen = false;
this.CommunicationCheckCount = 0;
this.CurrentUserGroup = new UserGroup();
this.EquipmentStatus = Define.E_EquipmentStatus.Stop;
this.PathLaunchFolder = "SD Card\\";
this.PathSystemFileFolder = this.PathLaunchFolder + "SystemFile\\";
this.PathDataBackupFolder = this.PathLaunchFolder + "DataBackup\\";
this.PathProgramSaveFolder = this.PathLaunchFolder + "Program\\";
this.PathDataStatisticsFolder = this.PathLaunchFolder + "DataStatistics\\";
this.PathDataFolder = this.PathLaunchFolder + "Data\\";
this.PathDataHistoryFolder = this.PathDataFolder + "History\\";
this.PathDataInspectionFolder = this.PathDataFolder + "Inspection\\";
this.PathDataAlarmFolder = this.PathDataFolder + "Alarm\\";
this.Modbus = new Modbus();
this.ColorLogOff = Color.Red;
this.ColorLogOn = Color.FromArgb(39, 200, 64);
this.ColorButtonEnabled = Color.Teal;
this.ColorButtonDisabled = Color.Gray;
this.CurrentAlarmList = new AlarmList();
this.CurrentAlarmList.EventAlarmStateChange += new Define.EventHandlerAlarmStateChange(this.CurrentAlarmList_Change);
this.CurrentSystemStatus = new SystemStatus();
this.SystemConfig = new SystemConfiguration();
this.CurrentRecipe = new Recipe();
this.UpdateForMain = new UpdateForMainBoard();
this.ListDllUserName = new List<string>();
this.ListDllUserName.Clear();
this.CurrentLeakData = new LeakData(this.SystemConfig.EQUIPMENT_LANE);
this.CurrentLeakDatas = new Collection<LeakData1>();
for (int i = 0; i < this.SystemConfig.EQUIPMENT_LANE; i++)
this.CurrentLeakDatas.Add(new LeakData1());
this.CollectionIOTest_InputData = new Collection<string>();
for (int i = 0; i < 5; i++)
this.CollectionIOTest_InputData.Add("0");
// SystemFile 폴더 생성
if (Directory.Exists(this.PathSystemFileFolder) == false)
Directory.CreateDirectory(this.PathSystemFileFolder);
// DataBackup 폴더 생성
if (Directory.Exists(this.PathDataBackupFolder) == false)
Directory.CreateDirectory(this.PathDataBackupFolder);
}
private void InitializeUserManager()
{
UserManager.UserListNewDataEvent += this.UserManager_UserListNewDataEvent;
UserManager.UserListAddDataEvent += this.UserManager_UserListAddDataEvent;
UserManager.UserListModifyUserDataEvent += this.UserManager_UserListModifyUserDataEvent;
UserManager.UserListModifyInfoDataEvent += this.UserManager_UserListModifyInfoDataEvent;
UserManager.UserListDeleteDataEvent += this.UserManager_UserListDeleteDataEvent;
UserManager.UserListLockDataEvent += this.UserManager_UserListLockDataEvent;
UserManager.UserListDefautSettingDataEvent += this.UserManager_UserListDefaultSettingDataEvent;
UserManager.UserListLoginTimeoutDataEvent += this.UserManager_UserListLoginTimeoutDataEvent;
UserManager.UserListGetListDataEvent += this.UserManager_UserListGetListDataEvent;
UserManager.UserListLoginDataEvent += this.UserManager_UserListLoginDataEvent;
UserManager.UserListLogoutDataEvent += this.UserManager_UserListLogoutDataEvent;
UserManager.UserListGetListNameDataEvent += this.UserManager_UserListGetListNameDataEvent;
UserManager.IntializeUserManager(this.PathSystemFileFolder);
//if (this.SystemConfig.AUTOMATIC_LOGOUT == 1)
// this.FlagAutomaticLogoutWarningTime = 30;
//else
// this.FlagAutomaticLogoutWarningTime = 60;
//UserManager.UserManager_AutoLogoutSetTimeout(this.SystemConfig.AUTOMATIC_LOGOUT, this.FlagAutomaticLogoutWarningTime);
UserManager.UserManager_AutoLogoutSetTimeout(0, 0);
}
private void CreateForm()
{
this.ChildFormMainDisplay = new FormMainDisplay3(this);
this.ChildFormMenu = new FormMenu(this);
this.smartForm1.MainForm = this;
this.smartForm1.AddChildForm(this.ChildFormMainDisplay);
this.smartForm1.AddChildForm(this.ChildFormMenu);
}
private void TransferSystemParameter9039()
{
StringBuilder sb = new StringBuilder();
sb.Append(Helper.StringBlankFillDigits4(this.SystemConfig.LCD_DATA_PERIOD.ToString()));
sb.Append(Helper.StringBlankFillDigits4(this.SystemConfig.CHATTERING.ToString()));
sb.Append(Helper.StringBlankFillDigits4(this.SystemConfig.JUDGMENT_DELAY_MSEC.ToString()));
sb.Append(Helper.StringBlankFillDigits4(this.SystemConfig.BUZZER_OP.ToString()));
sb.Append(Helper.StringBlankFillDigits4(this.SystemConfig.SB_DIFF_FILTER.ToString()));
sb.Append(Helper.StringBlankFillDigits4(this.SystemConfig.SB_DATA_MODE.ToString()));
sb.Append(Helper.StringBlankFillDigits4(this.SystemConfig.SB_DATA_PERIOD.ToString()));
sb.Append(Helper.StringBlankFillDigits4(this.SystemConfig.SB_DIFF_MODE.ToString()));
sb.Append(Helper.StringBlankFillDigits4(this.SystemConfig.EQUIPMENT_LANE.ToString()));
sb.Append(Helper.StringBlankFillDigits4(this.SystemConfig.CHECK_LANE.ToString()));
this.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._9039_ParameterAll, sb.ToString());
}
public void TransferRecipeParameter9043(int number)
{
StringBuilder sb = new StringBuilder();
Recipe item = new Recipe();
this.LoadRecipeFile(ref item, number - 1);
sb.Append(Helper.StringBlankFillDigits4(item.NUMBER.ToString()));
sb.Append(Helper.StringBlankFillDigits4(item.VACUUM_RELIEF.ToString()));
sb.Append(Helper.StringBlankFillDigits4(item.VACUUM_HOLD1.ToString()));
sb.Append(Helper.StringBlankFillDigits4(item.VACUUM_HOLD2.ToString()));
sb.Append(Helper.StringBlankFillDigits4(item.VACUUM_BLOWOFF.ToString()));
sb.Append(Helper.StringBlankFillDigits6(item.DISP_JUDG_STD_LEVEL));
sb.Append(Helper.StringBlankFillDigits6(item.DISP_JUDG_MIN_LEVEL));
sb.Append(Helper.StringBlankFillDigits6(item.DISP_JUDG_EMPTY_LEVEL));
sb.Append(Helper.StringBlankFillDigits4(item.DISP_HOLD_DELAY_MSEC.ToString()));
sb.Append(Helper.StringBlankFillDigits8(item.DIFF_LR_SECOND));
sb.Append(Helper.StringBlankFillDigits8(item.DIFF_LR_TOTAL));
sb.Append(Helper.StringBlankFillDigits8(item.DIFF_LR_MEAN));
sb.Append(Helper.StringBlankFillDigits4(item.DIFF_HOLD_DELAY_MSEC.ToString()));
sb.Append(Helper.StringBlankFillDigits6(item.VACUUM_GUAGE_LEVEL));
this.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._9043_RecipeParameter, sb.ToString());
}
public void FormChange(int index)
{
this.smartForm1.Show(index);
}
public Color ButtonColorChange(bool bValue)
{
if (bValue == false)
return this.ColorButtonDisabled;
else
return this.ColorButtonEnabled;
}
private bool UI_Invoke(ThreadStart invoker)
{
try
{
if (this.InvokeRequired)
{
if (this.IsDisposed)
return true;
this.Invoke(invoker);
}
else
{
invoker();
}
return true;
}
catch (Exception e)
{
return false;
}
}
/// <summary>
/// Set Mode
/// </summary>
/// <param name="mode"></param>
public void SetDisplayMode(Define.E_EquipmentMode mode)
{
if (this.CurrentSystemStatus.CurrentEquipmentMode == mode)
return;
else
this.CurrentSystemStatus.CurrentEquipmentMode = mode;
switch (mode)
{
case Define.E_EquipmentMode.Normal:
this.TransferData(CommunicationCommand.ModeNormal, CommunicationID.MainBoard);
break;
case Define.E_EquipmentMode.Menu:
this.TransferData(CommunicationCommand.ModeMenu, CommunicationID.MainBoard);
break;
case Define.E_EquipmentMode.IOTest:
this.TransferData(CommunicationCommand.ModeIOTest, CommunicationID.MainBoard);
break;
case Define.E_EquipmentMode.EquipmentTest:
this.TransferData(CommunicationCommand.ModeEquipmentTest, CommunicationID.MainBoard);
break;
default:
break;
}
}
/// <summary>
/// Set Time
/// </summary>
/// <param name="mode"></param>
public void SetCurrentTime(DateTime time)
{
this.smartConfigs.ControlPanel.SetSystemDateTime(time);
}
#region SmartFile
public void OpenSmartFileIO()
{
if (this.IsSmartFileIOOpen == true)
this.smartFileIO.Close();
this.smartFileIO.Open();
this.IsSmartFileIOOpen = true;
}
public void CloseSmartFileIO()
{
if (this.IsSmartFileIOOpen == true)
{
this.smartFileIO.Close();
this.IsSmartFileIOOpen = false;
}
}
public void SmartFileIOStringWrite(string sValue)
{
this.OpenSmartFileIO();
this.smartFileIO.StringType.Write(sValue);
}
public void SmartFileIOStringWrite(string sValue, int index)
{
this.OpenSmartFileIO();
try
{
this.smartFileIO.StringType.Write(sValue, index, SmartFile.WriteMode.Overwrite);
}
catch
{
this.smartFileIO.StringType.Write(sValue, index, SmartFile.WriteMode.Append);
}
}
#endregion
#region SystemConfiguration File
private void CreateSystemConfigurationFile()
{
StructSystemConfigurationItem structItem;
this.SystemConfig.Initialize();
structItem.RECIPE_NUMBER = this.SystemConfig.RECIPE_NUMBER;
structItem.LANGUAGE = this.SystemConfig.LANGUAGE;
structItem.CHART1_DRAW_STEP = this.SystemConfig.CHART1_DRAW_STEP;
structItem.CHART2_DRAW_STEP = this.SystemConfig.CHART2_DRAW_STEP;
structItem.LCD_DATA_PERIOD = this.SystemConfig.LCD_DATA_PERIOD;
structItem.CHATTERING = this.SystemConfig.CHATTERING;
structItem.JUDGMENT_DELAY_MSEC = this.SystemConfig.JUDGMENT_DELAY_MSEC;
structItem.BUZZER_OP = this.SystemConfig.BUZZER_OP;
structItem.SB_DIFF_FILTER = this.SystemConfig.SB_DIFF_FILTER;
structItem.SB_DIFF_MODE = this.SystemConfig.SB_DIFF_MODE;
structItem.SB_DATA_MODE = this.SystemConfig.SB_DATA_MODE;
structItem.SB_DATA_PERIOD = this.SystemConfig.SB_DATA_PERIOD;
structItem.AUTOMATIC_LOGOUT = this.SystemConfig.AUTOMATIC_LOGOUT;
structItem.NUMBER_OF_LOGIN_FAILURE = this.SystemConfig.NUMBER_OF_LOGIN_FAILURE;
structItem.ETHERNET_COMM_MODE = this.SystemConfig.ETHERNET_COMM_MODE;
structItem.ETHERNET_OP_MODE = this.SystemConfig.ETHERNET_OP_MODE;
structItem.ETHERNET_LOCAL_PORT = this.SystemConfig.ETHERNET_LOCAL_PORT;
structItem.ETHERNET_SERVER_PORT = this.SystemConfig.ETHERNET_SERVER_PORT;
structItem.MODBUS_TCP_SELECTFUNCTION = this.SystemConfig.MODBUS_TCP_SELECTFUNCTION;
structItem.MODBUS_TCP_START_ADDRESS = this.SystemConfig.MODBUS_TCP_START_ADDRESS;
structItem.EQUIPMENT_LANE = this.SystemConfig.EQUIPMENT_LANE;
structItem.CHECK_LANE = this.SystemConfig.CHECK_LANE;
structItem.SERIAL_NUMBER = this.SystemConfig.SERIAL_NUMBER;
structItem.LEVEL1_NAME = this.SystemConfig.LEVEL1_NAME;
structItem.LEVEL2_NAME = this.SystemConfig.LEVEL2_NAME;
structItem.LEVEL3_NAME = this.SystemConfig.LEVEL3_NAME;
structItem.ETHERNET_SERVER_IP = this.SystemConfig.ETHERNET_SERVER_IP;
structItem.DummyBool1 = false;
structItem.DummyBool2 = false;
structItem.DummyBool3 = false;
structItem.DummyBool4 = false;
structItem.DummyBool5 = false;
structItem.DummyBool6 = false;
structItem.DummyBool7 = false;
structItem.DummyBool8 = false;
structItem.DummyBool9 = false;
structItem.DummyBool10 = false;
structItem.DummyInt1 = 0;
structItem.DummyInt2 = 0;
structItem.DummyInt3 = 0;
structItem.DummyInt4 = 0;
structItem.DummyInt5 = 0;
structItem.DummyInt6 = 0;
structItem.DummyInt7 = 0;
structItem.DummyInt8 = 0;
structItem.DummyInt9 = 0;
structItem.DummyInt10 = 0;
structItem.DummyString1 = "";
structItem.DummyString2 = "";
structItem.DummyString3 = "";
structItem.DummyString4 = "";
structItem.DummyString5 = "";
this.smartFileIO.StructType.Write(structItem, 0, SmartFile.WriteMode.Overwrite);
}
public void SaveSystemConfigurationFile(SystemConfiguration item)
{
string fullFilePath = "";
bool fileCheck = false;
StructSystemConfigurationItem structItem;
fullFilePath = this.PathSystemFileFolder + "system.cfg";
this.smartFileIO.FilePathName = fullFilePath;
FileInfo fileInfo = new FileInfo(fullFilePath);
fileCheck = fileInfo.Exists;
if (fileCheck == true)
{
this.smartFileIO.Open();
this.smartFileIO.StructType.SetStructType(typeof(StructSystemConfigurationItem));
}
else
{
this.smartFileIO.Open();
this.smartFileIO.StructType.SetStructType(typeof(StructSystemConfigurationItem));
this.CreateSystemConfigurationFile();
}
structItem.RECIPE_NUMBER = item.RECIPE_NUMBER;
structItem.LANGUAGE = item.LANGUAGE;
structItem.CHART1_DRAW_STEP = item.CHART1_DRAW_STEP;
structItem.CHART2_DRAW_STEP = item.CHART2_DRAW_STEP;
structItem.LCD_DATA_PERIOD = item.LCD_DATA_PERIOD;
structItem.CHATTERING = item.CHATTERING;
structItem.JUDGMENT_DELAY_MSEC = item.JUDGMENT_DELAY_MSEC;
structItem.BUZZER_OP = item.BUZZER_OP;
structItem.SB_DIFF_FILTER = item.SB_DIFF_FILTER;
structItem.SB_DIFF_MODE = item.SB_DIFF_MODE;
structItem.SB_DATA_MODE = item.SB_DATA_MODE;
structItem.SB_DATA_PERIOD = item.SB_DATA_PERIOD;
structItem.AUTOMATIC_LOGOUT = item.AUTOMATIC_LOGOUT;
structItem.NUMBER_OF_LOGIN_FAILURE = item.NUMBER_OF_LOGIN_FAILURE;
structItem.ETHERNET_COMM_MODE = item.ETHERNET_COMM_MODE;
structItem.ETHERNET_OP_MODE = item.ETHERNET_OP_MODE;
structItem.ETHERNET_LOCAL_PORT = item.ETHERNET_LOCAL_PORT;
structItem.ETHERNET_SERVER_PORT = item.ETHERNET_SERVER_PORT;
structItem.MODBUS_TCP_SELECTFUNCTION = item.MODBUS_TCP_SELECTFUNCTION;
structItem.MODBUS_TCP_START_ADDRESS = item.MODBUS_TCP_START_ADDRESS;
structItem.EQUIPMENT_LANE = item.EQUIPMENT_LANE;
structItem.CHECK_LANE = item.CHECK_LANE;
structItem.SERIAL_NUMBER = item.SERIAL_NUMBER;
structItem.LEVEL1_NAME = item.LEVEL1_NAME;
structItem.LEVEL2_NAME = item.LEVEL2_NAME;
structItem.LEVEL3_NAME = item.LEVEL3_NAME;
structItem.ETHERNET_SERVER_IP = item.ETHERNET_SERVER_IP;
structItem.DummyBool1 = false;
structItem.DummyBool2 = false;
structItem.DummyBool3 = false;
structItem.DummyBool4 = false;
structItem.DummyBool5 = false;
structItem.DummyBool6 = false;
structItem.DummyBool7 = false;
structItem.DummyBool8 = false;
structItem.DummyBool9 = false;
structItem.DummyBool10 = false;
structItem.DummyInt1 = 0;
structItem.DummyInt2 = 0;
structItem.DummyInt3 = 0;
structItem.DummyInt4 = 0;
structItem.DummyInt5 = 0;
structItem.DummyInt6 = 0;
structItem.DummyInt7 = 0;
structItem.DummyInt8 = 0;
structItem.DummyInt9 = 0;
structItem.DummyInt10 = 0;
structItem.DummyString1 = "";
structItem.DummyString2 = "";
structItem.DummyString3 = "";
structItem.DummyString4 = "";
structItem.DummyString5 = "";
this.smartFileIO.StructType.Write(structItem, 0, SmartFile.WriteMode.Overwrite);
this.smartFileIO.Close();
}
public void LoadSystemConfigurationFile()
{
string fullFilePath = "";
bool fileCheck = false;
StructSystemConfigurationItem structItem;
fullFilePath = this.PathSystemFileFolder + "system.cfg";
this.smartFileIO.FilePathName = fullFilePath;
FileInfo fileInfo = new FileInfo(fullFilePath);
fileCheck = fileInfo.Exists;
if (fileCheck == true)
{
this.smartFileIO.Open();
this.smartFileIO.StructType.SetStructType(typeof(StructSystemConfigurationItem));
}
else
{
this.smartFileIO.Open();
this.smartFileIO.StructType.SetStructType(typeof(StructSystemConfigurationItem));
this.CreateSystemConfigurationFile();
}
structItem = (StructSystemConfigurationItem)this.smartFileIO.StructType.Read(0);
this.SystemConfig.RECIPE_NUMBER = structItem.RECIPE_NUMBER;
this.SystemConfig.LANGUAGE = structItem.LANGUAGE;
this.SystemConfig.CHART1_DRAW_STEP = structItem.CHART1_DRAW_STEP;
this.SystemConfig.CHART2_DRAW_STEP = structItem.CHART2_DRAW_STEP;
this.SystemConfig.LCD_DATA_PERIOD = structItem.LCD_DATA_PERIOD;
this.SystemConfig.CHATTERING = structItem.CHATTERING;
this.SystemConfig.JUDGMENT_DELAY_MSEC = structItem.JUDGMENT_DELAY_MSEC;
this.SystemConfig.BUZZER_OP = structItem.BUZZER_OP;
this.SystemConfig.SB_DIFF_FILTER = structItem.SB_DIFF_FILTER;
this.SystemConfig.SB_DIFF_MODE = structItem.SB_DIFF_MODE;
this.SystemConfig.SB_DATA_MODE = structItem.SB_DATA_MODE;
this.SystemConfig.SB_DATA_PERIOD = structItem.SB_DATA_PERIOD;
this.SystemConfig.ETHERNET_COMM_MODE = structItem.ETHERNET_COMM_MODE;
this.SystemConfig.ETHERNET_OP_MODE = structItem.ETHERNET_OP_MODE;
this.SystemConfig.ETHERNET_LOCAL_PORT = structItem.ETHERNET_LOCAL_PORT;
this.SystemConfig.ETHERNET_SERVER_PORT = structItem.ETHERNET_SERVER_PORT;
this.SystemConfig.MODBUS_TCP_SELECTFUNCTION = structItem.MODBUS_TCP_SELECTFUNCTION;
this.SystemConfig.MODBUS_TCP_START_ADDRESS = structItem.MODBUS_TCP_START_ADDRESS;
this.SystemConfig.EQUIPMENT_LANE = structItem.EQUIPMENT_LANE;
this.SystemConfig.CHECK_LANE = structItem.CHECK_LANE;
this.SystemConfig.SERIAL_NUMBER = structItem.SERIAL_NUMBER;
this.SystemConfig.LEVEL1_NAME = structItem.LEVEL1_NAME;
this.SystemConfig.LEVEL2_NAME = structItem.LEVEL2_NAME;
this.SystemConfig.LEVEL3_NAME = structItem.LEVEL3_NAME;
this.SystemConfig.ETHERNET_SERVER_IP = structItem.ETHERNET_SERVER_IP;
this.smartFileIO.Close();
}
#endregion
#region Recipe File
private void CreateRecipeFile()
{
StructRecipe structItem;
this.CurrentRecipe.Initialize();
for (int i = 0; i < 1000; i++)
{
structItem.NUMBER = i + 1;
structItem.NAME = string.Format("INTECH {0}", i + 1);
structItem.LOT = string.Format("LOT {0}", i + 1);
structItem.DISP_JUDG_STD_LEVEL = this.CurrentRecipe.DISP_JUDG_STD_LEVEL;
structItem.DISP_JUDG_MIN_LEVEL = this.CurrentRecipe.DISP_JUDG_MIN_LEVEL;
structItem.DISP_JUDG_EMPTY_LEVEL = this.CurrentRecipe.DISP_JUDG_EMPTY_LEVEL;
structItem.DISP_HOLD_DELAY_MSEC = this.CurrentRecipe.DISP_HOLD_DELAY_MSEC;
structItem.DIFF_LR_SECOND = this.CurrentRecipe.DIFF_LR_SECOND;
structItem.DIFF_LR_TOTAL = this.CurrentRecipe.DIFF_LR_TOTAL;
structItem.DIFF_LR_MEAN = this.CurrentRecipe.DIFF_LR_MEAN;
structItem.DIFF_HOLD_DELAY_MSEC = this.CurrentRecipe.DIFF_HOLD_DELAY_MSEC;
structItem.VACUUM_RELIEF = this.CurrentRecipe.VACUUM_RELIEF;
structItem.VACUUM_HOLD1 = this.CurrentRecipe.VACUUM_HOLD1;
structItem.VACUUM_HOLD2 = this.CurrentRecipe.VACUUM_HOLD2;
structItem.VACUUM_BLOWOFF = this.CurrentRecipe.VACUUM_BLOWOFF;
structItem.VACUUM_GUAGE_LEVEL = this.CurrentRecipe.VACUUM_GUAGE_LEVEL;
this.smartFileIO.StructType.WriteBuffer(structItem, i, SmartFile.WriteMode.Append);
}
this.smartFileIO.StructType.WriteBufferSave();
}
public void SaveRecipeFile(Recipe item)
{
bool fileCheck = false;
string fullFilePath = "";
StructRecipe structItem;
fullFilePath = this.PathSystemFileFolder + "RecipeItem.int";
this.smartFileIO.FilePathName = fullFilePath;
FileInfo fileInfo = new FileInfo(fullFilePath);
fileCheck = fileInfo.Exists;
this.smartFileIO.Open();
this.smartFileIO.StructType.SetStructType(typeof(StructRecipe));
if (this.smartFileIO.StructType.GetCount() != 1000)
this.CreateRecipeFile();
structItem.NUMBER = item.NUMBER;
structItem.NAME = item.NAME;
structItem.LOT = item.LOT;
structItem.DISP_JUDG_STD_LEVEL = item.DISP_JUDG_STD_LEVEL;
structItem.DISP_JUDG_MIN_LEVEL = item.DISP_JUDG_MIN_LEVEL;
structItem.DISP_JUDG_EMPTY_LEVEL = item.DISP_JUDG_EMPTY_LEVEL;
structItem.DISP_HOLD_DELAY_MSEC = item.DISP_HOLD_DELAY_MSEC;
structItem.DIFF_LR_SECOND = item.DIFF_LR_SECOND;
structItem.DIFF_LR_TOTAL = item.DIFF_LR_TOTAL;
structItem.DIFF_LR_MEAN = item.DIFF_LR_MEAN;
structItem.DIFF_HOLD_DELAY_MSEC = item.DIFF_HOLD_DELAY_MSEC;
structItem.VACUUM_RELIEF = item.VACUUM_RELIEF;
structItem.VACUUM_HOLD1 = item.VACUUM_HOLD1;
structItem.VACUUM_HOLD2 = item.VACUUM_HOLD2;
structItem.VACUUM_BLOWOFF = item.VACUUM_BLOWOFF;
structItem.VACUUM_GUAGE_LEVEL = item.VACUUM_GUAGE_LEVEL;
this.smartFileIO.StructType.Write(structItem, item.NUMBER - 1, SmartFile.WriteMode.Overwrite);
this.smartFileIO.Close();
}
public void LoadRecipeFile(ref Recipe item, int index)
{
string fullFilePath = "";
bool fileCheck = false;
StructRecipe structItem;
fullFilePath = this.PathSystemFileFolder + "RecipeItem.int";
this.smartFileIO.FilePathName = fullFilePath;
FileInfo fileInfo = new FileInfo(fullFilePath);
fileCheck = fileInfo.Exists;
this.smartFileIO.Open();
this.smartFileIO.StructType.SetStructType(typeof(StructRecipe));
if (this.smartFileIO.StructType.GetCount() != 1000)
this.CreateRecipeFile();
structItem = (StructRecipe)this.smartFileIO.StructType.Read(index);
item.NUMBER = structItem.NUMBER;
item.NAME = structItem.NAME;
item.LOT = structItem.LOT;
item.DISP_JUDG_STD_LEVEL = structItem.DISP_JUDG_STD_LEVEL;
item.DISP_JUDG_MIN_LEVEL = structItem.DISP_JUDG_MIN_LEVEL;
item.DISP_JUDG_EMPTY_LEVEL = structItem.DISP_JUDG_EMPTY_LEVEL;
item.DISP_HOLD_DELAY_MSEC = structItem.DISP_HOLD_DELAY_MSEC;
item.DIFF_LR_SECOND = structItem.DIFF_LR_SECOND;
item.DIFF_LR_TOTAL = structItem.DIFF_LR_TOTAL;
item.DIFF_LR_MEAN = structItem.DIFF_LR_MEAN;
item.DIFF_HOLD_DELAY_MSEC = structItem.DIFF_HOLD_DELAY_MSEC;
item.VACUUM_RELIEF = structItem.VACUUM_RELIEF;
item.VACUUM_HOLD1 = structItem.VACUUM_HOLD1;
item.VACUUM_HOLD2 = structItem.VACUUM_HOLD2;
item.VACUUM_BLOWOFF = structItem.VACUUM_BLOWOFF;
item.VACUUM_GUAGE_LEVEL = structItem.VACUUM_GUAGE_LEVEL;
this.smartFileIO.Close();
}
#endregion
#region Uart Communication
public void OpenSmartUartLink()
{
string fullPath = "";
try
{
if (this.smartSerialPortLink.IsOpen == false)
this.smartSerialPortLink.Open();
}
catch
{
}
#region Test 용 통신 로그
fullPath = this.PathDataBackupFolder + "Communicationlog.txt";
this.smartFileCommunicationLog.FilePathName = fullPath;
this.smartFileCommunicationLog.Open();
this.IsCommunicationLogOpen = true;
#endregion
}
public void CloseSmartUartLink()
{
this.IsCommunicationLogOpen = false;
this.smartFileCommunicationLog.Close();
this.smartSerialPortLink.Close();
}
private bool SizeCheck(string cmd, string strTemp)
{
bool ret = false;
string dataSize = "";
int size = 0;
if (strTemp == null || strTemp.Length == 0)
{
ret = false;
return ret;
}
try
{
if (cmd == "P")
dataSize = strTemp.Substring(14, strTemp.Length - 16);
else // "S"
dataSize = strTemp.Substring(10, strTemp.Length - 12);
size = int.Parse(strTemp.Substring(6, 4).Trim());
}
catch
{
ret = false;
return ret;
}
if (dataSize.Length == size)
ret = true;
else
{
ret = false;
}
return ret;
}
private bool ChksumCheck(string strTemp)
{
bool ret = false;
string chkSum = "", dataChksum = "";
if (strTemp == null || strTemp.Length == 0)
ret = false;
else
{
chkSum = strTemp.Substring(strTemp.Length - 2, 2);
dataChksum = this.Checksumcalculator(strTemp.Substring(0, strTemp.Length - 2));
if (chkSum == dataChksum)
ret = true;
else
ret = false;
}
return ret;
}
private string Checksumcalculator(string strTemp)
{
string chkSum = "";
byte[] temp;
int value = 0, first = 0, second = 0;
char char1, char2;
if (strTemp == null || strTemp.Length == 0)
chkSum = "cc";
else
{
temp = new UTF8Encoding().GetBytes(strTemp);
for (int i = 0; i < temp.Length; i++)
value += temp[i];
first = (value & 0x00f0) >> 4;
if (first > 9)
char1 = (char)(first + 0x37);
else
char1 = (char)(first + 0x30);
second = value & 0x000f;
if (second > 9)
char2 = (char)(second + 0x37);
else
char2 = (char)(second + 0x30);
chkSum = char1.ToString() + char2.ToString();
}
return chkSum;
}
private string Checksumcalculator(byte[] strTemp)
{
string chkSum = "";
byte[] temp;
int value = 0, first = 0, second = 0;
char char1, char2;
if (strTemp == null || strTemp.Length == 0)
chkSum = "cc";
else
{
temp = strTemp;
for (int i = 0; i < temp.Length; i++)
value += temp[i];
first = (value & 0x00f0) >> 4;
if (first > 9)
char1 = (char)(first + 0x37);
else
char1 = (char)(first + 0x30);
second = value & 0x000f;
if (second > 9)
char2 = (char)(second + 0x37);
else
char2 = (char)(second + 0x30);
chkSum = char1.ToString() + char2.ToString();
}
return chkSum;
}
public int TransferData(string command, string id)
{
int ret = 0;
string chkSum = "cc";
StringBuilder sb = new StringBuilder();
sb.Append(command);
sb.Append(id);
chkSum = this.Checksumcalculator(sb.ToString());
sb.Append(chkSum);
if (this.smartSerialPortLink.IsOpen == true)
this.smartSerialPortLink.WriteFrame(sb.ToString(), SmartSerialPort.CODETYPES.ASCIICODE);
// 통신 확인 로그
if (this.IsCommunicationLogOpen == true)
this.smartFileCommunicationLog.StringType.Write(string.Format("Send ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, sb.ToString()));
return ret;
}
public int TransferDataStream(string command, string id, string address, string data)
{
int ret = 0;
string chkSum = "cc";
StringBuilder sb = new StringBuilder();
sb.Append(command);
sb.Append(id);
sb.Append(Helper.StringBlankFillDigits4(data.Length.ToString()));
sb.Append(address);
sb.Append(data);
chkSum = this.Checksumcalculator(sb.ToString());
sb.Append(chkSum);
if (this.smartSerialPortLink.IsOpen == true)
this.smartSerialPortLink.WriteFrame(sb.ToString(), SmartSerialPort.CODETYPES.ASCIICODE);
// 통신 확인 로그
if (this.IsCommunicationLogOpen == true)
this.smartFileCommunicationLog.StringType.Write(string.Format("Send ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, sb.ToString()));
return ret;
}
public int TransferDataStream4(string command, string id, string address, string data)
{
int ret = 0;
string chkSum = "cc";
StringBuilder sb = new StringBuilder();
sb.Append(command);
sb.Append(id);
sb.Append(Helper.StringBlankFillDigits4("4"));
sb.Append(address);
sb.Append(Helper.StringBlankFillDigits4(data));
chkSum = this.Checksumcalculator(sb.ToString());
sb.Append(chkSum);
if (this.smartSerialPortLink.IsOpen == true)
this.smartSerialPortLink.WriteFrame(sb.ToString(), SmartSerialPort.CODETYPES.ASCIICODE);
// 통신 확인 로그
if (this.IsCommunicationLogOpen == true)
this.smartFileCommunicationLog.StringType.Write(string.Format("Send ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, sb.ToString()));
return ret;
}
public int TransferDataStream6(string command, string id, string address, string data)
{
int ret = 0;
string chkSum = "cc";
StringBuilder sb = new StringBuilder();
sb.Append(command);
sb.Append(id);
sb.Append(Helper.StringBlankFillDigits4("6"));
sb.Append(address);
sb.Append(Helper.StringBlankFillDigits6(data));
chkSum = this.Checksumcalculator(sb.ToString());
sb.Append(chkSum);
if (this.smartSerialPortLink.IsOpen == true)
this.smartSerialPortLink.WriteFrame(sb.ToString(), SmartSerialPort.CODETYPES.ASCIICODE);
// 통신 확인 로그
if (this.IsCommunicationLogOpen == true)
this.smartFileCommunicationLog.StringType.Write(string.Format("Send ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, sb.ToString()));
return ret;
}
private void ReceiveData()
{
int ret = 0;
string strTemp = "";
byte[] readByte;
SmartSerialPort.FRAMEDATAREADSTATUS receiveDataState = SmartSerialPort.FRAMEDATAREADSTATUS.EMPTY;
try
{
receiveDataState = this.smartSerialPortLink.ReadQueue(out readByte);
strTemp = Encoding.Default.GetString(readByte, 0, readByte.Length);
}
catch
{
return;
}
if ((receiveDataState == SmartSerialPort.FRAMEDATAREADSTATUS.EMPTY) || (receiveDataState == SmartSerialPort.FRAMEDATAREADSTATUS.FAILDATA))
{
return;
}
try
{
switch (strTemp[0])
{
case 'C':
if ((ret = this.ReceiveCommandC(strTemp)) != 0)
return;
break;
case 'P':
if ((ret = this.ReceiveCommandP(strTemp)) != 0)
return;
break;
case 'S':
if ((ret = this.ReceiveCommandS(strTemp)) != 0)
return;
break;
default:
break;
}
}
catch
{
}
}
private int ReceiveCommandC(string strTemp)
{
int ret = 0;
string cmd = "", data = "";
if (this.ChksumCheck(strTemp) == false)
{
// 로그
if (this.IsCommunicationLogOpen == true)
this.smartFileCommunicationLog.StringType.Write(string.Format("Receive ({0:yyyy-MM-dd HH:mm:ss}): {1} : Receive Command Data CHKSUM Error", DateTime.Now, strTemp));
return ret = -1;
}
// 로그
if (this.IsCommunicationLogOpen == true)
this.smartFileCommunicationLog.StringType.Write(string.Format("Receive ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, strTemp));
cmd = strTemp.Substring(0, 3);
switch (cmd)
{
case "CI0":
this.CurrentSystemStatus.EquipmentStatus = Define.E_EquipmentStatus.Stop;
this.ChildFormMainDisplay.UpdateEquipmentStatusDisplay(this.CurrentSystemStatus.EquipmentStatus);
this.ChildFormMenu.UpdateEquipmentStatusDisplay(this.CurrentSystemStatus.EquipmentStatus);
this.TransferSystemParameter9039();
break;
case "CBS":
this.CurrentSystemStatus.EquipmentStatus = DataStore.Define.E_EquipmentStatus.Start;
this.ChildFormMainDisplay.UpdateEquipmentStatusDisplay(this.CurrentSystemStatus.EquipmentStatus);
this.ChildFormMenu.UpdateEquipmentStatusDisplay(this.CurrentSystemStatus.EquipmentStatus);
break;
case "CBT":
this.CurrentSystemStatus.EquipmentStatus = Define.E_EquipmentStatus.Stop;
this.ChildFormMainDisplay.UpdateEquipmentStatusDisplay(this.CurrentSystemStatus.EquipmentStatus);
this.ChildFormMenu.UpdateEquipmentStatusDisplay(this.CurrentSystemStatus.EquipmentStatus);
break;
default:
break;
}
return ret;
}
private int ReceiveCommandP(string strTemp)
{
int ret = 0;
string cmd = "", address = "", lane = "", receiveData = "";
// SIZE 확인
if (this.SizeCheck("P", strTemp) == false)
{
// 로그
if (this.IsCommunicationLogOpen == true)
this.smartFileCommunicationLog.StringType.Write(string.Format("Receive ({0:yyyy-MM-dd HH:mm:ss}): {1} : Receive Stream Data SIZE Error", DateTime.Now, strTemp));
return ret = -1;
}
// CHKSUM 확인
if (this.ChksumCheck(strTemp) == false)
{
// 로그
if (this.IsCommunicationLogOpen == true)
this.smartFileCommunicationLog.StringType.Write(string.Format("Receive ({0:yyyy-MM-dd HH:mm:ss}): {1} : Receive Stream Data CHKSUM Error", DateTime.Now, strTemp));
return ret = -1;
}
// 로그
if (this.IsCommunicationLogOpen == true)
this.smartFileCommunicationLog.StringType.Write(string.Format("Receive ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, strTemp));
cmd = strTemp.Substring(0, 3);
lane = strTemp.Substring(5, 1);
address = strTemp.Substring(10, 4);
receiveData = strTemp.Substring(14, strTemp.Length - 16);
switch (cmd)
{
case "PR0":
if ((ret = this.ReceiveCommandPR0(lane, address, receiveData)) != 0)
return ret = -1;
break;
case "PW0":
if ((ret = this.ReceiveCommandPW0(lane, address, receiveData)) != 0)
return ret = -1;
break;
default:
break;
}
return ret;
}
private int ReceiveCommandS(string strTemp)
{
int ret = 0;
string cmd = "", lane = "", receiveData = "";
// SIZE 확인
if (this.SizeCheck("S", strTemp) == false)
{
// 로그
if (this.IsCommunicationLogOpen == true)
this.smartFileCommunicationLog.StringType.Write(string.Format("Receive ({0:yyyy-MM-dd HH:mm:ss}): {1} : Receive Stream Data SIZE Error", DateTime.Now, strTemp));
return ret = -1;
}
// CHKSUM 확인
if (this.ChksumCheck(strTemp) == false)
{
// 로그
if (this.IsCommunicationLogOpen == true)
this.smartFileCommunicationLog.StringType.Write(string.Format("Receive ({0:yyyy-MM-dd HH:mm:ss}): {1} : Receive Stream Data CHKSUM Error", DateTime.Now, strTemp));
return ret = -1;
}
// 로그
if (this.IsCommunicationLogOpen == true)
this.smartFileCommunicationLog.StringType.Write(string.Format("Receive ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, strTemp));
cmd = strTemp.Substring(0, 3);
lane = strTemp.Substring(5, 1);
receiveData = strTemp.Substring(10, strTemp.Length - 12);
switch (cmd)
{
case "SLA":
if ((ret = this.ReceiveCommandSLA(lane, receiveData)) != 0)
return ret;
break;
case "SLB":
if ((ret = this.ReceiveCommandSLB(lane, receiveData)) != 0)
return ret;
break;
case "SLC":
if ((ret = this.ReceiveCommandSLC(lane, receiveData)) != 0)
return ret;
break;
case "SLD":
if ((ret = this.ReceiveCommandSLD(lane, receiveData)) != 0)
return ret;
break;
case "SLE":
if ((ret = this.ReceiveCommandSLE(lane, receiveData)) != 0)
return ret;
break;
case "ST0":
if ((ret = this.ReceiveCommandST0(lane, receiveData)) != 0)
return ret;
break;
case "SA0":
if ((ret = this.ReceiveCommandSA0(lane, receiveData)) != 0)
return ret;
break;
default:
break;
}
return ret;
}
// 파라미터 읽기 응답
private int ReceiveCommandPR0(string lane, string address, string receiveData)
{
int ret = 0, iValue = 0;
try
{
switch (address)
{
case "1502":
#region Value Assign
this.SystemConfig.MAINBOARD_VERSION = receiveData;
#endregion
this.ChildFormMenu.UpdateMainBoardVersionDisplay(this.SystemConfig.MAINBOARD_VERSION);
break;
case "2001":
#region Value Assign
iValue = int.Parse(receiveData);
if (iValue <= 0 || iValue > 1000)
return ret = -1;
this.SystemConfig.RECIPE_NUMBER = iValue;
#endregion
this.LoadRecipeFile(ref this.CurrentRecipe, this.SystemConfig.RECIPE_NUMBER - 1);
this.ChildFormMainDisplay.UpdateDisplayRecipeData(this.CurrentRecipe);
this.ChildFormMenu.UpdateDisplayRecipeData(this.CurrentRecipe);
break;
default:
break;
}
}
catch
{
ret = -1;
}
return ret;
}
// 파라미터 쓰기 응답
private int ReceiveCommandPW0(string lane, string address, string receiveData)
{
int ret = 0, index = 0;
byte[] beforeData;
string ack = "", data = "";
Define.E_ResponseData response = Define.E_ResponseData.NAK;
try
{
if (receiveData == "0")
response = Define.E_ResponseData.NAK;
else
response = Define.E_ResponseData.ACK;
switch (address)
{
case "9039":
if (response == Define.E_ResponseData.ACK)
this.TransferRecipeParameter9043(this.SystemConfig.RECIPE_NUMBER);
break;
case "9043":
if (response == Define.E_ResponseData.ACK)
this.TransferDataStream(CommunicationCommand.Read, CommunicationID.MainBoard, CommunicationAddress._2001_ProductNumber, "");
break;
default:
break;
}
}
catch
{
ret = -1;
}
return ret;
}
// 판정 데이터
private int ReceiveCommandSLA(string lane, string receiveData)
{
int ret = 0;
try
{
switch (lane)
{
case "A":
#region 1열
#region Value Assign
this.CurrentLeakDatas[0].Judgment = Helper.StringToJudgmentStatus(receiveData.Substring(0, 1));
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateDisplayJudgmentData1(this.CurrentLeakDatas[0]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentJudgmentData1(this.CurrentLeakDatas[0]);
#endregion
break;
case "B":
#region 2열
#region Value Assign
this.CurrentLeakDatas[1].Judgment = Helper.StringToJudgmentStatus(receiveData.Substring(0, 1));
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateDisplayJudgmentData2(this.CurrentLeakDatas[1]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentJudgmentData2(this.CurrentLeakDatas[1]);
#endregion
break;
case "C":
#region 3열
#region Value Assign
this.CurrentLeakDatas[2].Judgment = Helper.StringToJudgmentStatus(receiveData.Substring(0, 1));
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateDisplayJudgmentData3(this.CurrentLeakDatas[2]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentJudgmentData3(this.CurrentLeakDatas[2]);
#endregion
break;
case "D":
#region 4열
#region Value Assign
this.CurrentLeakDatas[3].Judgment = Helper.StringToJudgmentStatus(receiveData.Substring(0, 1));
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateDisplayJudgmentData4(this.CurrentLeakDatas[3]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentJudgmentData4(this.CurrentLeakDatas[3]);
#endregion
break;
case "E":
#region 5열
#region Value Assign
this.CurrentLeakDatas[4].Judgment = Helper.StringToJudgmentStatus(receiveData.Substring(0, 1));
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateDisplayJudgmentData5(this.CurrentLeakDatas[4]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentJudgmentData5(this.CurrentLeakDatas[4]);
#endregion
break;
case "F":
#region 6열
#region Value Assign
this.CurrentLeakDatas[5].Judgment = Helper.StringToJudgmentStatus(receiveData.Substring(0, 1));
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateDisplayJudgmentData6(this.CurrentLeakDatas[5]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentJudgmentData6(this.CurrentLeakDatas[5]);
#endregion
break;
case "G":
#region 7열
#region Value Assign
this.CurrentLeakDatas[6].Judgment = Helper.StringToJudgmentStatus(receiveData.Substring(0, 1));
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateDisplayJudgmentData7(this.CurrentLeakDatas[6]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentJudgmentData7(this.CurrentLeakDatas[6]);
#endregion
break;
case "H":
#region 8열
#region Value Assign
this.CurrentLeakDatas[7].Judgment = Helper.StringToJudgmentStatus(receiveData.Substring(0, 1));
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateDisplayJudgmentData8(this.CurrentLeakDatas[7]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentJudgmentData8(this.CurrentLeakDatas[7]);
#endregion
break;
case "I":
#region 9열
#region Value Assign
this.CurrentLeakDatas[8].Judgment = Helper.StringToJudgmentStatus(receiveData.Substring(0, 1));
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateDisplayJudgmentData9(this.CurrentLeakDatas[8]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentJudgmentData9(this.CurrentLeakDatas[8]);
#endregion
break;
case "J":
#region 10열
#region Value Assign
this.CurrentLeakDatas[9].Judgment = Helper.StringToJudgmentStatus(receiveData.Substring(0, 1));
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateDisplayJudgmentData10(this.CurrentLeakDatas[9]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentJudgmentData10(this.CurrentLeakDatas[9]);
#endregion
break;
case "Z":
#region Value Assign
for (int i = 0; i < this.SystemConfig.EQUIPMENT_LANE; i++)
this.CurrentLeakData.CollJudgment[i] = Helper.StringToJudgmentStatus(receiveData.Substring(i * 1, 1));
#endregion
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateDisplayJudgmentData(this.CurrentLeakData);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentJudgmentData(this.CurrentLeakData);
break;
default:
break;
}
}
catch
{
ret = -1;
}
return ret;
}
// 진행상태
private int ReceiveCommandSLB(string lane, string receiveData)
{
int ret = 0;
try
{
switch (lane)
{
case "A":
case "B":
#region Value Assign
this.CurrentLeakDatas[0].ProcessStatus = Helper.StringToProcessStatus(receiveData.Substring(0, 2));
this.CurrentLeakDatas[1].ProcessStatus = Helper.StringToProcessStatus(receiveData.Substring(0, 2));
#endregion
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateProcessStatusDisplay(this.CurrentLeakDatas[0].ProcessStatus);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentProcessStatusDisplay(this.CurrentLeakDatas[0].ProcessStatus);
break;
case "C":
case "D":
#region Value Assign
this.CurrentLeakDatas[2].ProcessStatus = Helper.StringToProcessStatus(receiveData.Substring(0, 2));
this.CurrentLeakDatas[3].ProcessStatus = Helper.StringToProcessStatus(receiveData.Substring(0, 2));
#endregion
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateProcessStatusDisplay(this.CurrentLeakDatas[2].ProcessStatus);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentProcessStatusDisplay(this.CurrentLeakDatas[2].ProcessStatus);
break;
case "E":
case "F":
#region Value Assign
this.CurrentLeakDatas[4].ProcessStatus = Helper.StringToProcessStatus(receiveData.Substring(0, 2));
this.CurrentLeakDatas[5].ProcessStatus = Helper.StringToProcessStatus(receiveData.Substring(0, 2));
#endregion
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateProcessStatusDisplay(this.CurrentLeakDatas[4].ProcessStatus);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentProcessStatusDisplay(this.CurrentLeakDatas[4].ProcessStatus);
break;
case "G":
case "H":
#region Value Assign
this.CurrentLeakDatas[6].ProcessStatus = Helper.StringToProcessStatus(receiveData.Substring(0, 2));
this.CurrentLeakDatas[7].ProcessStatus = Helper.StringToProcessStatus(receiveData.Substring(0, 2));
#endregion
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateProcessStatusDisplay(this.CurrentLeakDatas[6].ProcessStatus);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentProcessStatusDisplay(this.CurrentLeakDatas[6].ProcessStatus);
break;
case "I":
case "J":
#region Value Assign
this.CurrentLeakDatas[8].ProcessStatus = Helper.StringToProcessStatus(receiveData.Substring(0, 2));
this.CurrentLeakDatas[9].ProcessStatus = Helper.StringToProcessStatus(receiveData.Substring(0, 2));
#endregion
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateProcessStatusDisplay(this.CurrentLeakDatas[8].ProcessStatus);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentProcessStatusDisplay(this.CurrentLeakDatas[8].ProcessStatus);
break;
case "Z":
#region Value Assign
Define.E_ProcessStatus process = Helper.StringToProcessStatus(receiveData.Substring(0, 2));
for (int i = 0; i < this.SystemConfig.EQUIPMENT_LANE; i++)
this.CurrentLeakDatas[i].ProcessStatus = process;
#endregion
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateProcessStatusDisplay(this.CurrentLeakDatas[0].ProcessStatus);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentProcessStatusDisplay(this.CurrentLeakDatas[0].ProcessStatus);
break;
default:
break;
}
}
catch
{
ret = -1;
}
return ret;
}
// 차압 센서 데이터
private int ReceiveCommandSLC(string lane, string receiveData)
{
int ret = 0;
try
{
switch (lane)
{
case "A":
#region 1열
#region Value Assign
this.CurrentLeakDatas[0].DiffData.MAdc = receiveData.Substring(0, 8).Trim();
this.CurrentLeakDatas[0].DiffData.SecBufDiff = receiveData.Substring(8, 8).Trim();
this.CurrentLeakDatas[0].DiffData.SecBufSum = receiveData.Substring(16, 8).Trim();
this.CurrentLeakDatas[0].DiffData.DiffMean = receiveData.Substring(24, 8).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDiffData1(this.CurrentLeakDatas[0]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.IOTest)
this.ChildFormMenu.UpdateDisplayIOTestDiffData1(this.CurrentLeakDatas[0]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentDiffData1(this.CurrentLeakDatas[0]);
#endregion
break;
case "B":
#region 2열
#region Value Assign
this.CurrentLeakDatas[1].DiffData.MAdc = receiveData.Substring(0, 8).Trim();
this.CurrentLeakDatas[1].DiffData.SecBufDiff = receiveData.Substring(8, 8).Trim();
this.CurrentLeakDatas[1].DiffData.SecBufSum = receiveData.Substring(16, 8).Trim();
this.CurrentLeakDatas[1].DiffData.DiffMean = receiveData.Substring(24, 8).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDiffData2(this.CurrentLeakDatas[1]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.IOTest)
this.ChildFormMenu.UpdateDisplayIOTestDiffData2(this.CurrentLeakDatas[1]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentDiffData2(this.CurrentLeakDatas[1]);
#endregion
break;
case "C":
#region 3열
#region Value Assign
this.CurrentLeakDatas[2].DiffData.MAdc = receiveData.Substring(0, 8).Trim();
this.CurrentLeakDatas[2].DiffData.SecBufDiff = receiveData.Substring(8, 8).Trim();
this.CurrentLeakDatas[2].DiffData.SecBufSum = receiveData.Substring(16, 8).Trim();
this.CurrentLeakDatas[2].DiffData.DiffMean = receiveData.Substring(24, 8).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDiffData3(this.CurrentLeakDatas[2]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.IOTest)
this.ChildFormMenu.UpdateDisplayIOTestDiffData3(this.CurrentLeakDatas[2]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentDiffData3(this.CurrentLeakDatas[2]);
#endregion
break;
case "D":
#region 4열
#region Value Assign
this.CurrentLeakDatas[3].DiffData.MAdc = receiveData.Substring(0, 8).Trim();
this.CurrentLeakDatas[3].DiffData.SecBufDiff = receiveData.Substring(8, 8).Trim();
this.CurrentLeakDatas[3].DiffData.SecBufSum = receiveData.Substring(16, 8).Trim();
this.CurrentLeakDatas[3].DiffData.DiffMean = receiveData.Substring(24, 8).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDiffData4(this.CurrentLeakDatas[3]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.IOTest)
this.ChildFormMenu.UpdateDisplayIOTestDiffData4(this.CurrentLeakDatas[3]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentDiffData4(this.CurrentLeakDatas[3]);
#endregion
break;
case "E":
#region 5열
#region Value Assign
this.CurrentLeakDatas[4].DiffData.MAdc = receiveData.Substring(0, 8).Trim();
this.CurrentLeakDatas[4].DiffData.SecBufDiff = receiveData.Substring(8, 8).Trim();
this.CurrentLeakDatas[4].DiffData.SecBufSum = receiveData.Substring(16, 8).Trim();
this.CurrentLeakDatas[4].DiffData.DiffMean = receiveData.Substring(24, 8).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDiffData5(this.CurrentLeakDatas[4]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.IOTest)
this.ChildFormMenu.UpdateDisplayIOTestDiffData5(this.CurrentLeakDatas[4]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentDiffData5(this.CurrentLeakDatas[4]);
#endregion
break;
case "F":
#region 6열
#region Value Assign
this.CurrentLeakDatas[5].DiffData.MAdc = receiveData.Substring(0, 8).Trim();
this.CurrentLeakDatas[5].DiffData.SecBufDiff = receiveData.Substring(8, 8).Trim();
this.CurrentLeakDatas[5].DiffData.SecBufSum = receiveData.Substring(16, 8).Trim();
this.CurrentLeakDatas[5].DiffData.DiffMean = receiveData.Substring(24, 8).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDiffData6(this.CurrentLeakDatas[5]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.IOTest)
this.ChildFormMenu.UpdateDisplayIOTestDiffData6(this.CurrentLeakDatas[5]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentDiffData6(this.CurrentLeakDatas[5]);
#endregion
break;
case "G":
#region 7열
#region Value Assign
this.CurrentLeakDatas[6].DiffData.MAdc = receiveData.Substring(0, 8).Trim();
this.CurrentLeakDatas[6].DiffData.SecBufDiff = receiveData.Substring(8, 8).Trim();
this.CurrentLeakDatas[6].DiffData.SecBufSum = receiveData.Substring(16, 8).Trim();
this.CurrentLeakDatas[6].DiffData.DiffMean = receiveData.Substring(24, 8).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDiffData7(this.CurrentLeakDatas[6]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.IOTest)
this.ChildFormMenu.UpdateDisplayIOTestDiffData7(this.CurrentLeakDatas[6]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentDiffData7(this.CurrentLeakDatas[6]);
#endregion
break;
case "H":
#region 8열
#region Value Assign
this.CurrentLeakDatas[7].DiffData.MAdc = receiveData.Substring(0, 8).Trim();
this.CurrentLeakDatas[7].DiffData.SecBufDiff = receiveData.Substring(8, 8).Trim();
this.CurrentLeakDatas[7].DiffData.SecBufSum = receiveData.Substring(16, 8).Trim();
this.CurrentLeakDatas[7].DiffData.DiffMean = receiveData.Substring(24, 8).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDiffData8(this.CurrentLeakDatas[7]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.IOTest)
this.ChildFormMenu.UpdateDisplayIOTestDiffData8(this.CurrentLeakDatas[7]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentDiffData8(this.CurrentLeakDatas[7]);
#endregion
break;
case "I":
#region 9열
#region Value Assign
this.CurrentLeakDatas[8].DiffData.MAdc = receiveData.Substring(0, 8).Trim();
this.CurrentLeakDatas[8].DiffData.SecBufDiff = receiveData.Substring(8, 8).Trim();
this.CurrentLeakDatas[8].DiffData.SecBufSum = receiveData.Substring(16, 8).Trim();
this.CurrentLeakDatas[8].DiffData.DiffMean = receiveData.Substring(24, 8).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDiffData9(this.CurrentLeakDatas[8]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.IOTest)
this.ChildFormMenu.UpdateDisplayIOTestDiffData9(this.CurrentLeakDatas[8]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentDiffData9(this.CurrentLeakDatas[8]);
#endregion
break;
case "J":
#region 10열
#region Value Assign
this.CurrentLeakDatas[9].DiffData.MAdc = receiveData.Substring(0, 8).Trim();
this.CurrentLeakDatas[9].DiffData.SecBufDiff = receiveData.Substring(8, 8).Trim();
this.CurrentLeakDatas[9].DiffData.SecBufSum = receiveData.Substring(16, 8).Trim();
this.CurrentLeakDatas[9].DiffData.DiffMean = receiveData.Substring(24, 8).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDiffData10(this.CurrentLeakDatas[9]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.IOTest)
this.ChildFormMenu.UpdateDisplayIOTestDiffData10(this.CurrentLeakDatas[9]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentDiffData10(this.CurrentLeakDatas[9]);
#endregion
break;
case "Z":
#region Value Assign
for (int i = 0; i < this.SystemConfig.EQUIPMENT_LANE; i++)
{
this.CurrentLeakData.CollDiffData[i].MAdc = receiveData.Substring(i * 32, 8).Trim();
this.CurrentLeakData.CollDiffData[i].SecBufDiff = receiveData.Substring((i * 32) + 8, 8).Trim();
this.CurrentLeakData.CollDiffData[i].SecBufSum = receiveData.Substring((i * 32) + 16, 8).Trim();
this.CurrentLeakData.CollDiffData[i].DiffMean = receiveData.Substring((i * 32) + 24, 8).Trim();
}
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDiffData(this.CurrentLeakData.CollDiffData);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.IOTest)
this.ChildFormMenu.UpdateDisplayIOTestDiffData(this.CurrentLeakData.CollDiffData);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentDiffData(this.CurrentLeakData.CollDiffData);
break;
default:
break;
}
}
catch
{
ret = -1;
}
return ret;
}
// 변위 센서 데이터
private int ReceiveCommandSLD(string lane, string receiveData)
{
int ret = 0;
try
{
switch (lane)
{
case "A":
#region 1열
#region Value Assign
this.CurrentLeakDatas[0].DispData.RData = receiveData.Substring(0, 6).Trim();
this.CurrentLeakDatas[0].DispData.MData = receiveData.Substring(6, 6).Trim();
this.CurrentLeakDatas[0].DispData.MDataDiff = receiveData.Substring(12, 6).Trim();
this.CurrentLeakDatas[0].DispData.STD = receiveData.Substring(18, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDispData1(this.CurrentLeakDatas[0]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.IOTest)
this.ChildFormMenu.UpdateDisplayIOTestDispData1(this.CurrentLeakDatas[0]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentDispData1(this.CurrentLeakDatas[0]);
#endregion
break;
case "B":
#region 2열
#region Value Assign
this.CurrentLeakDatas[1].DispData.RData = receiveData.Substring(0, 6).Trim();
this.CurrentLeakDatas[1].DispData.MData = receiveData.Substring(6, 6).Trim();
this.CurrentLeakDatas[1].DispData.MDataDiff = receiveData.Substring(12, 6).Trim();
this.CurrentLeakDatas[1].DispData.STD = receiveData.Substring(18, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDispData2(this.CurrentLeakDatas[1]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.IOTest)
this.ChildFormMenu.UpdateDisplayIOTestDispData2(this.CurrentLeakDatas[1]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentDispData2(this.CurrentLeakDatas[1]);
#endregion
break;
case "C":
#region 3열
#region Value Assign
this.CurrentLeakDatas[2].DispData.RData = receiveData.Substring(0, 6).Trim();
this.CurrentLeakDatas[2].DispData.MData = receiveData.Substring(6, 6).Trim();
this.CurrentLeakDatas[2].DispData.MDataDiff = receiveData.Substring(12, 6).Trim();
this.CurrentLeakDatas[2].DispData.STD = receiveData.Substring(18, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDispData3(this.CurrentLeakDatas[2]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.IOTest)
this.ChildFormMenu.UpdateDisplayIOTestDispData3(this.CurrentLeakDatas[2]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentDispData3(this.CurrentLeakDatas[2]);
#endregion
break;
case "D":
#region 4열
#region Value Assign
this.CurrentLeakDatas[3].DispData.RData = receiveData.Substring(0, 6).Trim();
this.CurrentLeakDatas[3].DispData.MData = receiveData.Substring(6, 6).Trim();
this.CurrentLeakDatas[3].DispData.MDataDiff = receiveData.Substring(12, 6).Trim();
this.CurrentLeakDatas[3].DispData.STD = receiveData.Substring(18, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDispData4(this.CurrentLeakDatas[3]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.IOTest)
this.ChildFormMenu.UpdateDisplayIOTestDispData4(this.CurrentLeakDatas[3]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentDispData4(this.CurrentLeakDatas[3]);
#endregion
break;
case "E":
#region 5열
#region Value Assign
this.CurrentLeakDatas[4].DispData.RData = receiveData.Substring(0, 6).Trim();
this.CurrentLeakDatas[4].DispData.MData = receiveData.Substring(6, 6).Trim();
this.CurrentLeakDatas[4].DispData.MDataDiff = receiveData.Substring(12, 6).Trim();
this.CurrentLeakDatas[4].DispData.STD = receiveData.Substring(18, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDispData5(this.CurrentLeakDatas[4]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.IOTest)
this.ChildFormMenu.UpdateDisplayIOTestDispData5(this.CurrentLeakDatas[4]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentDispData5(this.CurrentLeakDatas[4]);
#endregion
break;
case "F":
#region 6열
#region Value Assign
this.CurrentLeakDatas[5].DispData.RData = receiveData.Substring(0, 6).Trim();
this.CurrentLeakDatas[5].DispData.MData = receiveData.Substring(6, 6).Trim();
this.CurrentLeakDatas[5].DispData.MDataDiff = receiveData.Substring(12, 6).Trim();
this.CurrentLeakDatas[5].DispData.STD = receiveData.Substring(18, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDispData6(this.CurrentLeakDatas[5]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.IOTest)
this.ChildFormMenu.UpdateDisplayIOTestDispData6(this.CurrentLeakDatas[5]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentDispData6(this.CurrentLeakDatas[5]);
#endregion
break;
case "G":
#region 7열
#region Value Assign
this.CurrentLeakDatas[6].DispData.RData = receiveData.Substring(0, 6).Trim();
this.CurrentLeakDatas[6].DispData.MData = receiveData.Substring(6, 6).Trim();
this.CurrentLeakDatas[6].DispData.MDataDiff = receiveData.Substring(12, 6).Trim();
this.CurrentLeakDatas[6].DispData.STD = receiveData.Substring(18, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDispData7(this.CurrentLeakDatas[6]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.IOTest)
this.ChildFormMenu.UpdateDisplayIOTestDispData7(this.CurrentLeakDatas[6]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentDispData7(this.CurrentLeakDatas[6]);
#endregion
break;
case "H":
#region 8열
#region Value Assign
this.CurrentLeakDatas[7].DispData.RData = receiveData.Substring(0, 6).Trim();
this.CurrentLeakDatas[7].DispData.MData = receiveData.Substring(6, 6).Trim();
this.CurrentLeakDatas[7].DispData.MDataDiff = receiveData.Substring(12, 6).Trim();
this.CurrentLeakDatas[7].DispData.STD = receiveData.Substring(18, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDispData8(this.CurrentLeakDatas[7]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.IOTest)
this.ChildFormMenu.UpdateDisplayIOTestDispData8(this.CurrentLeakDatas[7]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentDispData8(this.CurrentLeakDatas[7]);
#endregion
break;
case "I":
#region 9열
#region Value Assign
this.CurrentLeakDatas[8].DispData.RData = receiveData.Substring(0, 6).Trim();
this.CurrentLeakDatas[8].DispData.MData = receiveData.Substring(6, 6).Trim();
this.CurrentLeakDatas[8].DispData.MDataDiff = receiveData.Substring(12, 6).Trim();
this.CurrentLeakDatas[8].DispData.STD = receiveData.Substring(18, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDispData9(this.CurrentLeakDatas[8]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.IOTest)
this.ChildFormMenu.UpdateDisplayIOTestDispData9(this.CurrentLeakDatas[8]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentDispData9(this.CurrentLeakDatas[8]);
#endregion
break;
case "J":
#region 10열
#region Value Assign
this.CurrentLeakDatas[9].DispData.RData = receiveData.Substring(0, 6).Trim();
this.CurrentLeakDatas[9].DispData.MData = receiveData.Substring(6, 6).Trim();
this.CurrentLeakDatas[9].DispData.MDataDiff = receiveData.Substring(12, 6).Trim();
this.CurrentLeakDatas[9].DispData.STD = receiveData.Substring(18, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDispData10(this.CurrentLeakDatas[9]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.IOTest)
this.ChildFormMenu.UpdateDisplayIOTestDispData10(this.CurrentLeakDatas[9]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentDispData10(this.CurrentLeakDatas[9]);
#endregion
break;
case "Z":
#region Value Assign
for (int i = 0; i < this.SystemConfig.EQUIPMENT_LANE; i++)
{
this.CurrentLeakData.CollDispData[i].RData = receiveData.Substring(i * 24, 6).Trim();
this.CurrentLeakData.CollDispData[i].MData = receiveData.Substring((i * 24) + 6, 6).Trim();
this.CurrentLeakData.CollDispData[i].MDataDiff = receiveData.Substring((i * 24) + 12, 6).Trim();
this.CurrentLeakData.CollDispData[i].STD = receiveData.Substring((i * 24) + 18, 6).Trim();
}
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDispData(this.CurrentLeakData.CollDispData);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.IOTest)
this.ChildFormMenu.UpdateDisplayIOTestDispData(this.CurrentLeakData.CollDispData);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentDispData(this.CurrentLeakData.CollDispData);
break;
default:
break;
}
}
catch
{
ret = -1;
}
return ret;
}
// 압력 데이터
private int ReceiveCommandSLE(string lane, string receiveData)
{
int ret = 0;
try
{
switch (lane)
{
case "A":
#region 1열
#region Value Assign
this.CurrentLeakDatas[0].PresData.WorkingChamber =
string.Format("{0}{1}", receiveData.Substring(0, 1), receiveData.Substring(1, 5).Trim());
this.CurrentLeakDatas[0].PresData.MasterChamber =
string.Format("{0}{1}", receiveData.Substring(6, 1), receiveData.Substring(7, 5).Trim());
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateDisplayPresData1(this.CurrentLeakDatas[0]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.IOTest)
this.ChildFormMenu.UpdateDisplayIOTestPresData1(this.CurrentLeakDatas[0]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentPresData1(this.CurrentLeakDatas[0]);
#endregion
break;
case "B":
#region 2열
#region Value Assign
this.CurrentLeakDatas[1].PresData.WorkingChamber =
string.Format("{0}{1}", receiveData.Substring(0, 1), receiveData.Substring(1, 5).Trim());
this.CurrentLeakDatas[1].PresData.MasterChamber =
string.Format("{0}{1}", receiveData.Substring(6, 1), receiveData.Substring(7, 5).Trim());
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateDisplayPresData2(this.CurrentLeakDatas[1]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.IOTest)
this.ChildFormMenu.UpdateDisplayIOTestPresData2(this.CurrentLeakDatas[1]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentPresData2(this.CurrentLeakDatas[1]);
#endregion
break;
case "C":
#region 3열
#region Value Assign
this.CurrentLeakDatas[2].PresData.WorkingChamber =
string.Format("{0}{1}", receiveData.Substring(0, 1), receiveData.Substring(1, 5).Trim());
this.CurrentLeakDatas[2].PresData.MasterChamber =
string.Format("{0}{1}", receiveData.Substring(6, 1), receiveData.Substring(7, 5).Trim());
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateDisplayPresData3(this.CurrentLeakDatas[2]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.IOTest)
this.ChildFormMenu.UpdateDisplayIOTestPresData3(this.CurrentLeakDatas[2]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentPresData3(this.CurrentLeakDatas[2]);
#endregion
break;
case "D":
#region 4열
#region Value Assign
this.CurrentLeakDatas[3].PresData.WorkingChamber =
string.Format("{0}{1}", receiveData.Substring(0, 1), receiveData.Substring(1, 5).Trim());
this.CurrentLeakDatas[3].PresData.MasterChamber =
string.Format("{0}{1}", receiveData.Substring(6, 1), receiveData.Substring(7, 5).Trim());
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateDisplayPresData4(this.CurrentLeakDatas[3]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.IOTest)
this.ChildFormMenu.UpdateDisplayIOTestPresData4(this.CurrentLeakDatas[3]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentPresData4(this.CurrentLeakDatas[3]);
#endregion
break;
case "E":
#region 5열
#region Value Assign
this.CurrentLeakDatas[4].PresData.WorkingChamber =
string.Format("{0}{1}", receiveData.Substring(0, 1), receiveData.Substring(1, 5).Trim());
this.CurrentLeakDatas[4].PresData.MasterChamber =
string.Format("{0}{1}", receiveData.Substring(6, 1), receiveData.Substring(7, 5).Trim());
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateDisplayPresData5(this.CurrentLeakDatas[4]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.IOTest)
this.ChildFormMenu.UpdateDisplayIOTestPresData5(this.CurrentLeakDatas[4]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentPresData5(this.CurrentLeakDatas[4]);
#endregion
break;
case "F":
#region 6열
#region Value Assign
this.CurrentLeakDatas[5].PresData.WorkingChamber =
string.Format("{0}{1}", receiveData.Substring(0, 1), receiveData.Substring(1, 5).Trim());
this.CurrentLeakDatas[5].PresData.MasterChamber =
string.Format("{0}{1}", receiveData.Substring(6, 1), receiveData.Substring(7, 5).Trim());
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateDisplayPresData6(this.CurrentLeakDatas[5]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.IOTest)
this.ChildFormMenu.UpdateDisplayIOTestPresData6(this.CurrentLeakDatas[5]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentPresData6(this.CurrentLeakDatas[5]);
#endregion
break;
case "G":
#region 7열
#region Value Assign
this.CurrentLeakDatas[6].PresData.WorkingChamber =
string.Format("{0}{1}", receiveData.Substring(0, 1), receiveData.Substring(1, 5).Trim());
this.CurrentLeakDatas[6].PresData.MasterChamber =
string.Format("{0}{1}", receiveData.Substring(6, 1), receiveData.Substring(7, 5).Trim());
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateDisplayPresData7(this.CurrentLeakDatas[6]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.IOTest)
this.ChildFormMenu.UpdateDisplayIOTestPresData7(this.CurrentLeakDatas[6]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentPresData7(this.CurrentLeakDatas[6]);
#endregion
break;
case "H":
#region 8열
#region Value Assign
this.CurrentLeakDatas[7].PresData.WorkingChamber =
string.Format("{0}{1}", receiveData.Substring(0, 1), receiveData.Substring(1, 5).Trim());
this.CurrentLeakDatas[7].PresData.MasterChamber =
string.Format("{0}{1}", receiveData.Substring(6, 1), receiveData.Substring(7, 5).Trim());
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateDisplayPresData8(this.CurrentLeakDatas[7]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.IOTest)
this.ChildFormMenu.UpdateDisplayIOTestPresData8(this.CurrentLeakDatas[7]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentPresData8(this.CurrentLeakDatas[7]);
#endregion
break;
case "I":
#region 9열
#region Value Assign
this.CurrentLeakDatas[8].PresData.WorkingChamber =
string.Format("{0}{1}", receiveData.Substring(0, 1), receiveData.Substring(1, 5).Trim());
this.CurrentLeakDatas[8].PresData.MasterChamber =
string.Format("{0}{1}", receiveData.Substring(6, 1), receiveData.Substring(7, 5).Trim());
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateDisplayPresData9(this.CurrentLeakDatas[8]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.IOTest)
this.ChildFormMenu.UpdateDisplayIOTestPresData9(this.CurrentLeakDatas[8]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentPresData9(this.CurrentLeakDatas[8]);
#endregion
break;
case "J":
#region 10열
#region Value Assign
this.CurrentLeakDatas[9].PresData.WorkingChamber =
string.Format("{0}{1}", receiveData.Substring(0, 1), receiveData.Substring(1, 5).Trim());
this.CurrentLeakDatas[9].PresData.MasterChamber =
string.Format("{0}{1}", receiveData.Substring(6, 1), receiveData.Substring(7, 5).Trim());
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateDisplayPresData10(this.CurrentLeakDatas[9]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.IOTest)
this.ChildFormMenu.UpdateDisplayIOTestPresData10(this.CurrentLeakDatas[9]);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentPresData10(this.CurrentLeakDatas[9]);
#endregion
break;
case "Z":
#region Value Assign
for (int i = 0; i < this.SystemConfig.EQUIPMENT_LANE; i++)
{
this.CurrentLeakData.CollPresData[i].WorkingChamber =
string.Format("{0}{1}", receiveData.Substring(i * 6, 1), receiveData.Substring((i * 6) + 1, 5).Trim());
this.CurrentLeakData.CollPresData[i].MasterChamber =
string.Format("{0}{1}", receiveData.Substring((i * 6) + 60, 1), receiveData.Substring((i * 6) + 61, 5).Trim());
}
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateDisplayPresData(this.CurrentLeakData.CollPresData);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.IOTest)
this.ChildFormMenu.UpdateDisplayIOTestPresData(this.CurrentLeakData.CollPresData);
else if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.Equipment)
this.ChildFormMenu.UpdateDisplayEquipmentPresData(this.CurrentLeakData.CollPresData);
break;
default:
break;
}
}
catch
{
ret = -1;
}
return ret;
}
// IO테스트-IN
private int ReceiveCommandST0(string lane, string receiveData)
{
int ret = 0;
switch (lane)
{
case "Z":
#region Value Assign
for (int i = 0; i < 5; i++)
this.CollectionIOTest_InputData[i] = receiveData.Substring(i, 1);
#endregion
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.IOTest)
this.ChildFormMenu.UpdateDisplayIOTestInputData(this.CollectionIOTest_InputData);
break;
default:
break;
}
return ret;
}
// 알람
private int ReceiveCommandSA0(string lane, string receiveData)
{
int ret = 0;
switch (lane)
{
case "Z":
#region Value Assign
this.CurrentAlarmList.SetAlarm(receiveData.Substring(0, 8));
#endregion
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.UpdateDisplayAlarmView(this.CurrentAlarmList);
else
{
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.IOTest)
this.ChildFormMenu.UpdateDisplayIOTestAlarmView(this.CurrentAlarmList);
this.ChildFormMenu.UpdateDisplayAlarmView(this.CurrentAlarmList);
}
break;
default:
break;
}
return ret;
}
#endregion
#region Communication protocol
public byte[] Transfer_1_Modbus_Write()
{
byte[] madeData = new byte[10];
byte[] Length4Value = new byte[4];
return madeData;
}
private byte[] Transfer_1_Modbus_Read_TCP(byte[] readByte)
{
byte[] startAddressByte = new byte[2] { readByte[8], readByte[9] };
byte[] numberOfRegisterByte = new byte[2] { readByte[10], readByte[11] };
int startAddressInt;
int numberOfRegisterInt;
int madeDataIndex = 0;
byte[] length2Value = new byte[2];
byte[] length4Value = new byte[4];
startAddressInt = Modbus.ToBigEndianAndInt(startAddressByte);
numberOfRegisterInt = Modbus.ToBigEndianAndInt(numberOfRegisterByte);
byte[] madeData = new byte[numberOfRegisterInt * 2];
if (readByte[7] == ModbusFunctionCode.FunctionCode_04)
{
}
return madeData;
}
#endregion
#region Ethernet
#region Client
public void EthernetClientConnect()
{
if (this.IsEthernetThreadStop == false)
return; // Online 경우
if (this.SystemConfig.IsEthernetEnable == false)
{
this.TextStatusOut("<Disable");
return;
}
if (string.Compare(this.SystemConfig.ETHERNET_SERVER_IP, "0.0.0.0") == 0)
{
this.TextStatusOut("<Addr Err");
return;
}
try
{
Thread cpClientThread = new Thread(new ThreadStart(EthernetClientReceiveThread));
cpClientThread.IsBackground = true;
cpClientThread.Start();
//this.IsUsingTimerEthernetPing(true);
}
catch
{
TextStatusOut(">Thread Error");
}
}
public void EthernetClientDisconnect()
{
this.DelegateUISeverStatus(false);
if (null != this.EthernetStmReader)
this.EthernetStmReader.Close();
if (null != this.EthernetStmWriter)
this.EthernetStmWriter.Close();
if (null != this.EthernetNetStream)
this.EthernetNetStream.Close();
if (null != this.EthernetTcpClient)
this.EthernetTcpClient.Close();
this.IsEthernetThreadStop = true;
this.DelegateTextStatusOut(">Disconnected");
this.SetTrackingHistoryData(Define.E_TrackingOperation.ClientDisconnect, "");
//---------------------
GC.Collect();
GC.WaitForPendingFinalizers();
//---------------------
if (this.CurrentSystemStatus.EquipmentStatus == Define.E_EquipmentStatus.Start
&& this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.DelegateTimerTryConnect(true);
}
private void EthernetClientReceiveThread()
{
int nConnectPort = Convert.ToInt32(this.SystemConfig.ETHERNET_SERVER_PORT);
try
{
this.DelegateTextStatusOut(">Now Connecting..");
this.EthernetTcpClient = new TcpClient(this.SystemConfig.ETHERNET_SERVER_IP, nConnectPort);
this.EthernetNetStream = this.EthernetTcpClient.GetStream();
this.EthernetStmReader = new StreamReader(this.EthernetNetStream);
this.EthernetStmWriter = new StreamWriter(this.EthernetNetStream);
this.DelegateUISeverStatus(true);
this.DelegateTextStatusOut(">Connected Server");
this.SetTrackingHistoryData(Define.E_TrackingOperation.ClientConnect, "");
this.IsEthernetThreadStop = false;
// 판정 데이터 전송
if (this.IsEthernetTransferData == true)
{
this.IsEthernetTransferData = false;
Type type = this.EthernetTransferData.GetType();
if (type == typeof(string))
this.DelegateTransferData((string)this.EthernetTransferData);
else if (type == typeof(byte[]))
this.DelegateTransferData((byte[])this.EthernetTransferData);
else if (type == typeof(byte))
this.DelegateTransferData((byte)this.EthernetTransferData);
}
char[] charArray = new char[20];
while (this.IsEthernetThreadStop == false)
{
var strRecDataCount = this.EthernetStmReader.Read(charArray, 0, charArray.Length);
var strRecData = new string(charArray, 0, strRecDataCount);
//Console.Write("\n" + string.Format("EthernetStmReader.Read {0:yyyy-MM-dd HH:mm:ss}: {1}", DateTime.Now, strRecData));
if (null == strRecData)
{
this.DelegateTextStatusOut(">Server Out");
this.IsEthernetThreadStop = true;
break;
}
this.DelegateTextStatusOut(strRecData);
}
}
catch
{
this.DelegateTextStatusOut(">Connect Fail !");
}
finally
{
this.EthernetClientDisconnect();
}
return;
}
private void UIServerStatus(bool status)
{
this.ChildFormMainDisplay.UpdateEthernetStatusDisplay(status);
}
public void DelegateUISeverStatus(bool status)
{
this.Invoke(new UIServerStatusCallback(this.UIServerStatus), status);
}
private void TextStatusOut(string value)
{
if (this.ChildFormMenu.Child_System_Ethernet != null)
this.ChildFormMenu.Child_System_Ethernet.UpdateEthernetStatusDisplay(value);
}
private void DelegateTextStatusOut(string value)
{
this.Invoke(new TextStatusCallback(this.TextStatusOut), value);
}
private void TimerTryConnect(bool status)
{
this.timerClientTryConnect.Enabled = status;
}
private void DelegateTimerTryConnect(bool status)
{
this.Invoke(new TimerTryConnectCallback(this.TimerTryConnect), status);
}
private void DelegateTransferData(string data)
{
this.Invoke(new TransferStringDataCallback(this.EthernetSendMessage), data);
}
private void DelegateTransferData(byte[] data)
{
this.Invoke(new TransferByteArrayDataCallback(this.EthernetSendMessage), data);
}
private void DelegateTransferData(byte data)
{
this.Invoke(new TransferByteDataCallback(this.EthernetSendMessage), data);
}
public void EthernetSendMessage(string msg)
{
try
{
this.EthernetStmWriter.Write(msg);
this.EthernetStmWriter.Flush();
}
catch
{
this.DelegateUISeverStatus(false);
this.DelegateTextStatusOut("> Disconnect");
}
}
public void EthernetSendMessage(byte[] msg)
{
try
{
this.EthernetStmWriter.BaseStream.Write(msg, 0, msg.Length);
this.EthernetStmWriter.Flush();
}
catch
{
this.DelegateUISeverStatus(false);
this.DelegateTextStatusOut("> Disconnect");
}
}
public void EthernetSendMessage(byte msg)
{
try
{
this.EthernetStmWriter.Write(msg);
this.EthernetStmWriter.Flush();
}
catch
{
this.DelegateUISeverStatus(false);
this.DelegateTextStatusOut("> Disconnect");
}
}
public void EthernetWeightData(string strTemp)
{
this.IsEthernetTransferData = true;
this.EthernetTransferData = strTemp;
if (this.IsEthernetThreadStop == true)
this.EthernetClientConnect();
else
this.EthernetSendMessage((string)this.EthernetTransferData);
}
public void EthernetWeightData(byte[] bytes)
{
this.IsEthernetTransferData = true;
this.EthernetTransferData = bytes;
if (this.IsEthernetThreadStop == true)
this.EthernetClientConnect();
else
this.EthernetSendMessage(bytes);
}
public void EthernetWeightDataForModbus(byte[] bytes)
{
this.IsEthernetTransferData = true;
this.EthernetTransferData = bytes;
if (this.IsEthernetThreadStop == true)
this.EthernetClientConnect();
else
this.EthernetSendMessage(bytes);
}
#endregion
#region Server
public void EthernetServerStart()
{
if (this.smartTCPMultiServer.IsStart == false)
{
this.ChildFormMenu.Child_System_Ethernet.DisplayLabelLocalPort(false);
this.smartTCPMultiServer.Port = this.SystemConfig.ETHERNET_LOCAL_PORT;
this.smartTCPMultiServer.Start();
}
}
public void EthernetServerStop()
{
if (this.smartTCPMultiServer.IsStart == true)
{
this.ChildFormMenu.Child_System_Ethernet.DisplayLabelLocalPort(true);
this.smartTCPMultiServer.Stop();
this.SetTrackingHistoryData(Define.E_TrackingOperation.ServerOFF, "");
}
}
public void EthernetServerSendMessage(SmartTCPMultiServer.CLIENTSINFOS client, string msg)
{
if (this.smartTCPMultiServer.SendStringASCIIID(client.strID, msg) == true)
{
// 로그
if (this.IsCommunicationLogOpen == true)
this.smartFileCommunicationLog.StringType.Write(string.Format("Ethernet Send ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, msg));
}
}
public void EthernetServerSendMessage(SmartTCPMultiServer.CLIENTSINFOS client, byte[] bytes)
{
if (this.smartTCPMultiServer.SendByteByClientID(client.strID, bytes) == true)
{
// 로그
if (this.IsCommunicationLogOpen == true)
this.smartFileCommunicationLog.StringType.Write(string.Format("Ethernet Send ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, Encoding.Default.GetString(bytes, 0, bytes.Length)));
}
}
#endregion
#endregion
#region Backup
public List<string> GetSeletedNodeList(TreeView tree)
{
int yearCNT, monthCNT, dayCNT;
List<string> listSelectedFile = new List<string>();
yearCNT = tree.Nodes.Count;
if (yearCNT != 0)
{
for (int i = 0; i < yearCNT; i++)
{
monthCNT = tree.Nodes[i].Nodes.Count;
if (monthCNT != 0)
{
for (int j = 0; j < monthCNT; j++)
{
dayCNT = tree.Nodes[i].Nodes[j].Nodes.Count;
if (dayCNT != 0)
{
for (int k = 0; k < dayCNT; k++)
{
//if (tree.Nodes[i].Nodes[j].Nodes[k].Checked == true)
//{
//listSelectedFile.Add(tree.Nodes[i].Nodes[j].Nodes[k].Text);
listSelectedFile.Add(string.Format("{0}\\{1}\\{2}", tree.Nodes[i].Text, tree.Nodes[i].Nodes[j].Text, tree.Nodes[i].Nodes[j].Nodes[k].Text));
//}
}
}
}
}
}
}
return listSelectedFile;
}
#endregion
#region Tracking Inspection data
private string GetJudgmentResult(Define.E_JudgmentStatus judg)
{
string value = "";
switch (judg)
{
case Define.E_JudgmentStatus.None:
value = "-";
break;
case Define.E_JudgmentStatus.Pass:
value = "Pass";
break;
case Define.E_JudgmentStatus.Ng:
value = "Leak";
break;
case Define.E_JudgmentStatus.Error:
value = "Empty";
break;
default:
break;
}
return value;
}
private void GetTrackingInspectionFolderPath(ref string folder, ref string fileName)
{
DateTime time = DateTime.Now;
folder = string.Format("{0}{1}\\{2}\\", this.PathDataInspectionFolder, time.Year, time.Month);
fileName = string.Format("{0:yyyyMMdd}_Inspection_{1}.csv", time, this.CurrentRecipe.NUMBER);
}
public void TrackingInspectionData(LeakData item)
{
bool fileCheck = false, directoryCheck = false;
string fullFilePath = "", folderPath = "", fileName = "";
StreamWriter sw;
this.GetTrackingInspectionFolderPath(ref folderPath, ref fileName);
fullFilePath = string.Format("{0}{1}", folderPath, fileName);
DirectoryInfo di = new DirectoryInfo(folderPath);
directoryCheck = di.Exists;
// 폴더 체크
if (directoryCheck == false)
di.Create();
FileInfo fileInfo = new FileInfo(fullFilePath);
fileCheck = fileInfo.Exists;
sw = new StreamWriter(fullFilePath, true, Encoding.UTF8);
if (fileCheck == false)
{
this.RemoveInspectionDataFile();
sw.Write("Date");
sw.Write(",");
sw.Write("Time");
sw.Write(",");
sw.Write("Name");
sw.Write(",");
sw.Write("Lot");
sw.Write(",");
sw.Write("1");
sw.Write(",");
sw.Write("2");
sw.Write(",");
sw.Write("3");
sw.Write(",");
sw.Write("4");
sw.Write(",");
sw.Write("5");
sw.Write(",");
sw.Write("6");
sw.Write(",");
sw.Write("7");
sw.Write(",");
sw.Write("8");
sw.Write(",");
sw.Write("9");
sw.Write(",");
sw.Write("10");
sw.WriteLine();
}
sw.Write(string.Format("{0:yyyy-MM-dd}", DateTime.Now));
sw.Write(",");
sw.Write(string.Format("{0:HH:mm:ss}", DateTime.Now));
sw.Write(",");
sw.Write(this.CurrentRecipe.NAME);
sw.Write(",");
sw.Write(this.CurrentRecipe.LOT);
sw.Write(",");
sw.Write(this.GetJudgmentResult(item.CollJudgment[0]));
sw.Write(",");
sw.Write(this.GetJudgmentResult(item.CollJudgment[1]));
sw.Write(",");
sw.Write(this.GetJudgmentResult(item.CollJudgment[2]));
sw.Write(",");
sw.Write(this.GetJudgmentResult(item.CollJudgment[3]));
sw.Write(",");
sw.Write(this.GetJudgmentResult(item.CollJudgment[4]));
sw.Write(",");
sw.Write(this.GetJudgmentResult(item.CollJudgment[5]));
sw.Write(",");
sw.Write(this.GetJudgmentResult(item.CollJudgment[6]));
sw.Write(",");
sw.Write(this.GetJudgmentResult(item.CollJudgment[7]));
sw.Write(",");
sw.Write(this.GetJudgmentResult(item.CollJudgment[8]));
sw.Write(",");
sw.Write(this.GetJudgmentResult(item.CollJudgment[9]));
sw.WriteLine();
sw.Close();
}
public void TrackingInspectionData(Collection<LeakData1> items)
{
bool fileCheck = false, directoryCheck = false;
string fullFilePath = "", folderPath = "", fileName = "";
StreamWriter sw;
this.GetTrackingInspectionFolderPath(ref folderPath, ref fileName);
fullFilePath = string.Format("{0}{1}", folderPath, fileName);
DirectoryInfo di = new DirectoryInfo(folderPath);
directoryCheck = di.Exists;
// 폴더 체크
if (directoryCheck == false)
di.Create();
FileInfo fileInfo = new FileInfo(fullFilePath);
fileCheck = fileInfo.Exists;
sw = new StreamWriter(fullFilePath, true, Encoding.UTF8);
if (fileCheck == false)
{
this.RemoveInspectionDataFile();
sw.Write("Date");
sw.Write(",");
sw.Write("Time");
sw.Write(",");
sw.Write("Name");
sw.Write(",");
sw.Write("Lot");
sw.Write(",");
sw.Write("1");
sw.Write(",");
sw.Write("2");
sw.Write(",");
sw.Write("3");
sw.Write(",");
sw.Write("4");
sw.Write(",");
sw.Write("5");
sw.Write(",");
sw.Write("6");
sw.Write(",");
sw.Write("7");
sw.Write(",");
sw.Write("8");
sw.Write(",");
sw.Write("9");
sw.Write(",");
sw.Write("10");
sw.WriteLine();
}
sw.Write(string.Format("{0:yyyy-MM-dd}", DateTime.Now));
sw.Write(",");
sw.Write(string.Format("{0:HH:mm:ss}", DateTime.Now));
sw.Write(",");
sw.Write(this.CurrentRecipe.NAME);
sw.Write(",");
sw.Write(this.CurrentRecipe.LOT);
sw.Write(",");
sw.Write(this.GetJudgmentResult(items[0].Judgment));
sw.Write(",");
sw.Write(this.GetJudgmentResult(items[1].Judgment));
sw.Write(",");
sw.Write(this.GetJudgmentResult(items[2].Judgment));
sw.Write(",");
sw.Write(this.GetJudgmentResult(items[3].Judgment));
sw.Write(",");
sw.Write(this.GetJudgmentResult(items[4].Judgment));
sw.Write(",");
sw.Write(this.GetJudgmentResult(items[5].Judgment));
sw.Write(",");
sw.Write(this.GetJudgmentResult(items[6].Judgment));
sw.Write(",");
sw.Write(this.GetJudgmentResult(items[7].Judgment));
sw.Write(",");
sw.Write(this.GetJudgmentResult(items[8].Judgment));
sw.Write(",");
sw.Write(this.GetJudgmentResult(items[9].Judgment));
sw.WriteLine();
sw.Close();
}
private void RemoveInspectionDataFile()
{
bool directoryCheck = false;
try
{
string dday = string.Format("{0:yyyyMMdd}", DateTime.Now.AddDays(-180)) + ".csv";
DirectoryInfo dir = new DirectoryInfo(this.PathDataInspectionFolder);
directoryCheck = dir.Exists;
// 폴더 체크
if (directoryCheck == false)
dir.Create();
FileInfo[] files = dir.GetFiles();
foreach (FileInfo subfile in files)
{
if (subfile.Name.StartsWith("20")) // 날짜 비교하여 10일 지난화일은 삭제함
{
if (subfile.Name.CompareTo(dday) < 0)
{
subfile.Delete();
}
}
}
}
catch
{
}
}
#endregion
#region Tracking History data
public void SetTrackingHistoryData(Define.E_TrackingOperation type, string detail)
{
HistoryData data = new HistoryData();
data.Type = "Operation";
data.Time = DateTime.Now;
data.LoginID = this.CurrentSystemStatus.CurrentUser.ID;
data.Event = type.ToString();
data.Detail = detail;
data.BeforeData = "";
data.AfterData = "";
this.TrackingHistoryData(data);
}
public void SetTrackingHistoryData(Define.E_TrackingOperation eventType, string detail, string loginID)
{
HistoryData data = new HistoryData();
data.Type = "Operation";
data.Time = DateTime.Now;
data.LoginID = loginID;
data.Event = eventType.ToString();
data.Detail = detail;
data.BeforeData = "";
data.AfterData = "";
this.TrackingHistoryData(data);
}
public void SetTrackingHistoryData(Define.E_TrackingAlarm eventType, string detail)
{
HistoryData data = new HistoryData();
data.Type = "Alarm";
data.Time = DateTime.Now;
data.LoginID = this.CurrentSystemStatus.CurrentUser.ID;
data.Event = eventType.ToString();
data.Detail = detail;
data.BeforeData = "";
data.AfterData = "";
this.TrackingHistoryData(data);
}
public void SetTrackingHistoryData(Define.E_TrackingParameter type, string detail, string before, string after)
{
HistoryData data = new HistoryData();
data.Type = "Parameter";
data.Time = DateTime.Now;
data.LoginID = this.CurrentSystemStatus.CurrentUser.ID;
data.Event = type.ToString();
data.Detail = detail;
data.BeforeData = before;
data.AfterData = after;
this.TrackingHistoryData(data);
}
private void TrackingHistoryData(HistoryData data)
{
bool fileCheck = false, directoryCheck = false;
string fullFilePath = "", folderPath = "", fileName = "";
StreamWriter sw;
DateTime time = DateTime.Now;
folderPath = string.Format("{0}{1}\\{2}\\", this.PathDataHistoryFolder, time.Year, time.Month);
fileName = string.Format("{0:yyyyMMdd}_History.csv", time);
fullFilePath = string.Format("{0}{1}", folderPath, fileName);
DirectoryInfo di = new DirectoryInfo(folderPath);
directoryCheck = di.Exists;
// 폴더 체크
if (directoryCheck == false)
di.Create();
FileInfo fileInfo = new FileInfo(fullFilePath);
fileCheck = fileInfo.Exists;
sw = new StreamWriter(fullFilePath, true, Encoding.UTF8);
try
{
if (fileCheck == false)
{
this.RemoveHistoryDataFile();
sw.Write("Date");
sw.Write(",");
sw.Write("Time");
sw.Write(",");
sw.Write("LoginID");
sw.Write(",");
sw.Write("Event");
sw.Write(",");
sw.Write("Detail");
sw.Write(",");
sw.Write("Before");
sw.Write(",");
sw.Write("After");
sw.Write(",");
sw.Write("Type");
sw.WriteLine();
}
sw.Write(string.Format("{0:yyyy-MM-dd}", DateTime.Now));
sw.Write(",");
sw.Write(string.Format("{0:HH:mm:ss}", DateTime.Now));
sw.Write(",");
sw.Write(data.LoginID);
sw.Write(",");
sw.Write(data.Event.ToString());
sw.Write(",");
sw.Write(data.Detail);
sw.Write(",");
sw.Write(data.BeforeData);
sw.Write(",");
sw.Write(data.AfterData);
sw.Write(",");
sw.Write(data.Type);
sw.WriteLine();
sw.Close();
}
catch
{
}
}
private void RemoveHistoryDataFile()
{
bool directoryCheck = false;
try
{
string dday = string.Format("{0:yyyyMMdd}", DateTime.Now.AddDays(-180)) + ".csv";
DirectoryInfo dir = new DirectoryInfo(this.PathDataHistoryFolder);
directoryCheck = dir.Exists;
// 폴더 체크
if (directoryCheck == false)
dir.Create();
FileInfo[] files = dir.GetFiles();
foreach (FileInfo subfile in files)
{
if (subfile.Name.StartsWith("20")) // 날짜 비교하여 10일 지난화일은 삭제함
{
if (subfile.Name.CompareTo(dday) < 0)
subfile.Delete();
}
}
}
catch
{
}
}
#endregion
#region Tracking Alarm data
public void SetTrackingAlarmData(Define.E_TrackingAlarm type, string detail)
{
HistoryData data = new HistoryData();
data.Type = "Alarm";
data.Time = DateTime.Now;
data.LoginID = this.CurrentSystemStatus.CurrentUser.ID;
data.Event = type.ToString();
data.Detail = detail;
data.BeforeData = "";
data.AfterData = "";
this.TrackingAlarmData(data);
}
private void TrackingAlarmData(HistoryData data)
{
bool fileCheck = false, directoryCheck = false;
string fullFilePath = "", folderPath = "", fileName = "";
StreamWriter sw;
DateTime time = DateTime.Now;
folderPath = string.Format("{0}{1}\\{2}\\", this.PathDataAlarmFolder, time.Year, time.Month);
fileName = string.Format("{0:yyyyMMdd}_Alarm.csv", time);
fullFilePath = string.Format("{0}{1}", folderPath, fileName);
DirectoryInfo di = new DirectoryInfo(folderPath);
directoryCheck = di.Exists;
// 폴더 체크
if (directoryCheck == false)
di.Create();
FileInfo fileInfo = new FileInfo(fullFilePath);
fileCheck = fileInfo.Exists;
sw = new StreamWriter(fullFilePath, true, Encoding.UTF8);
try
{
if (fileCheck == false)
{
this.RemoveAlarmDataFile();
sw.Write("Date");
sw.Write(",");
sw.Write("Time");
sw.Write(",");
sw.Write("LoginID");
sw.Write(",");
sw.Write("Event");
sw.Write(",");
sw.Write("Detail");
sw.WriteLine();
}
sw.Write(string.Format("{0:yyyy-MM-dd}", DateTime.Now));
sw.Write(",");
sw.Write(string.Format("{0:HH:mm:ss}", DateTime.Now));
sw.Write(",");
sw.Write(data.LoginID);
sw.Write(",");
sw.Write(data.Event.ToString());
sw.Write(",");
sw.Write(data.Detail);
sw.WriteLine();
sw.Close();
}
catch
{
}
}
private void RemoveAlarmDataFile()
{
bool directoryCheck = false;
try
{
string dday = string.Format("{0:yyyyMMdd}", DateTime.Now.AddDays(-180)) + ".csv";
DirectoryInfo dir = new DirectoryInfo(this.PathDataAlarmFolder);
directoryCheck = dir.Exists;
// 폴더 체크
if (directoryCheck == false)
dir.Create();
FileInfo[] files = dir.GetFiles();
foreach (FileInfo subfile in files)
{
if (subfile.Name.StartsWith("20")) // 날짜 비교하여 10일 지난화일은 삭제함
{
if (subfile.Name.CompareTo(dday) < 0)
subfile.Delete();
}
}
}
catch
{
}
}
#endregion
#region UserGroupFile
private void CreateUserGroupFile()
{
StructUserGroupItem structItem;
UserGroupItem item = new UserGroupItem();
for (int i = 0; i < 2; i++)
{
#region StructItem
structItem.IsMainDisplayRecipeChange = item.IsMainDisplayProductChange;
structItem.IsMainDisplayClear = item.IsMainDisplayClear;
structItem.IsMainDispalySubMenu = item.IsMainDisplaySubMenu;
structItem.IsMenuRecipe = item.IsMenuRecipe;
structItem.IsMenuUserSetting = item.IsMenuUserSetting;
structItem.IsMenuUserGroupEditor = item.IsMenuUserGroupEditor;
structItem.IsMenuIOTest = item.IsMenuIOTest;
structItem.IsMenuEquipmentLog = item.IsMenuHistoryLog;
structItem.IsMenuCheckLog = item.IsMenuInspectionLog;
structItem.IsMenuAlarmList = item.IsMenuAlarmLog;
structItem.IsMenuInformation = item.IsMenuInformation;
structItem.IsMenuStatus = item.IsMenuEquipment;
structItem.IsMenuEthernet = item.IsMenuEthernet;
structItem.Dummy1 = false;
structItem.Dummy2 = false;
structItem.Dummy3 = false;
structItem.Dummy4 = false;
structItem.Dummy5 = false;
structItem.Dummy6 = false;
structItem.Dummy7 = false;
structItem.Dummy8 = false;
structItem.Dummy9 = false;
structItem.Dummy10 = false;
structItem.Dummy11 = false;
structItem.Dummy12 = false;
structItem.Dummy13 = false;
structItem.Dummy14 = false;
structItem.Dummy15 = false;
structItem.Dummy16 = false;
structItem.Dummy17 = false;
#endregion
this.smartFileIO.StructType.Write(structItem, i, SmartFile.WriteMode.Overwrite);
}
for (int i = 2; i < 4; i++)
{
#region StructItem
structItem.IsMainDisplayRecipeChange = true;
structItem.IsMainDisplayClear = true;
structItem.IsMainDispalySubMenu = true;
structItem.IsMenuRecipe = true;
structItem.IsMenuUserSetting = true;
structItem.IsMenuUserGroupEditor = true;
structItem.IsMenuIOTest = true;
structItem.IsMenuEquipmentLog = true;
structItem.IsMenuCheckLog = true;
structItem.IsMenuAlarmList = true;
structItem.IsMenuInformation = true;
structItem.IsMenuStatus = true;
structItem.IsMenuEthernet = true;
structItem.Dummy1 = false;
structItem.Dummy2 = false;
structItem.Dummy3 = false;
structItem.Dummy4 = false;
structItem.Dummy5 = false;
structItem.Dummy6 = false;
structItem.Dummy7 = false;
structItem.Dummy8 = false;
structItem.Dummy9 = false;
structItem.Dummy10 = false;
structItem.Dummy11 = false;
structItem.Dummy12 = false;
structItem.Dummy13 = false;
structItem.Dummy14 = false;
structItem.Dummy15 = false;
structItem.Dummy16 = false;
structItem.Dummy17 = false;
#endregion
this.smartFileIO.StructType.Write(structItem, i, SmartFile.WriteMode.Overwrite);
}
}
public void SaveUserGroupFile(UserGroup item)
{
string fullFilePath = "";
bool fileCheck = false;
StructUserGroupItem structItem;
fullFilePath = this.PathSystemFileFolder + "UserGroup.int";
this.smartFileIO.FilePathName = fullFilePath;
FileInfo fileInfo = new FileInfo(fullFilePath);
fileCheck = fileInfo.Exists;
this.OpenSmartFileIO();
this.smartFileIO.StructType.SetStructType(typeof(StructUserGroupItem));
if (fileCheck == false)
this.CreateUserGroupFile();
#region Level1
structItem.IsMainDisplayRecipeChange = item.Level1.IsMainDisplayProductChange;
structItem.IsMainDisplayClear = item.Level1.IsMainDisplayClear;
structItem.IsMainDispalySubMenu = item.Level1.IsMainDisplaySubMenu;
structItem.IsMenuRecipe = item.Level1.IsMenuRecipe;
structItem.IsMenuUserSetting = item.Level1.IsMenuUserSetting;
structItem.IsMenuUserGroupEditor = item.Level1.IsMenuUserGroupEditor;
structItem.IsMenuIOTest = item.Level1.IsMenuIOTest;
structItem.IsMenuEquipmentLog = item.Level1.IsMenuHistoryLog;
structItem.IsMenuCheckLog = item.Level1.IsMenuInspectionLog;
structItem.IsMenuAlarmList = item.Level1.IsMenuAlarmLog;
structItem.IsMenuInformation = item.Level1.IsMenuInformation;
structItem.IsMenuStatus = item.Level1.IsMenuEquipment;
structItem.IsMenuEthernet = item.Level1.IsMenuEthernet;
structItem.Dummy1 = false;
structItem.Dummy2 = false;
structItem.Dummy3 = false;
structItem.Dummy4 = false;
structItem.Dummy5 = false;
structItem.Dummy6 = false;
structItem.Dummy7 = false;
structItem.Dummy8 = false;
structItem.Dummy9 = false;
structItem.Dummy10 = false;
structItem.Dummy11 = false;
structItem.Dummy12 = false;
structItem.Dummy13 = false;
structItem.Dummy14 = false;
structItem.Dummy15 = false;
structItem.Dummy16 = false;
structItem.Dummy17 = false;
this.smartFileIO.StructType.Write(structItem, (int)Define.E_UserGroup.Level1, SmartFile.WriteMode.Overwrite);
#endregion
#region Level2
structItem.IsMainDisplayRecipeChange = item.Level2.IsMainDisplayProductChange;
structItem.IsMainDisplayClear = item.Level2.IsMainDisplayClear;
structItem.IsMainDispalySubMenu = item.Level2.IsMainDisplaySubMenu;
structItem.IsMenuRecipe = item.Level2.IsMenuRecipe;
structItem.IsMenuUserSetting = item.Level2.IsMenuUserSetting;
structItem.IsMenuUserGroupEditor = item.Level2.IsMenuUserGroupEditor;
structItem.IsMenuIOTest = item.Level2.IsMenuIOTest;
structItem.IsMenuEquipmentLog = item.Level2.IsMenuHistoryLog;
structItem.IsMenuCheckLog = item.Level2.IsMenuInspectionLog;
structItem.IsMenuAlarmList = item.Level2.IsMenuAlarmLog;
structItem.IsMenuInformation = item.Level2.IsMenuInformation;
structItem.IsMenuStatus = item.Level2.IsMenuEquipment;
structItem.IsMenuEthernet = item.Level2.IsMenuEthernet;
structItem.Dummy1 = false;
structItem.Dummy2 = false;
structItem.Dummy3 = false;
structItem.Dummy4 = false;
structItem.Dummy5 = false;
structItem.Dummy6 = false;
structItem.Dummy7 = false;
structItem.Dummy8 = false;
structItem.Dummy9 = false;
structItem.Dummy10 = false;
structItem.Dummy11 = false;
structItem.Dummy12 = false;
structItem.Dummy13 = false;
structItem.Dummy14 = false;
structItem.Dummy15 = false;
structItem.Dummy16 = false;
structItem.Dummy17 = false;
this.smartFileIO.StructType.Write(structItem, (int)Define.E_UserGroup.Level2, SmartFile.WriteMode.Overwrite);
#endregion
#region Level3
structItem.IsMainDisplayRecipeChange = item.Level3.IsMainDisplayProductChange;
structItem.IsMainDisplayClear = item.Level3.IsMainDisplayClear;
structItem.IsMainDispalySubMenu = item.Level3.IsMainDisplaySubMenu;
structItem.IsMenuRecipe = item.Level3.IsMenuRecipe;
structItem.IsMenuUserSetting = item.Level3.IsMenuUserSetting;
structItem.IsMenuUserGroupEditor = item.Level3.IsMenuUserGroupEditor;
structItem.IsMenuIOTest = item.Level3.IsMenuIOTest;
structItem.IsMenuEquipmentLog = item.Level3.IsMenuHistoryLog;
structItem.IsMenuCheckLog = item.Level3.IsMenuInspectionLog;
structItem.IsMenuAlarmList = item.Level3.IsMenuAlarmLog;
structItem.IsMenuInformation = item.Level3.IsMenuInformation;
structItem.IsMenuStatus = item.Level3.IsMenuEquipment;
structItem.IsMenuEthernet = item.Level3.IsMenuEthernet;
structItem.Dummy1 = false;
structItem.Dummy2 = false;
structItem.Dummy3 = false;
structItem.Dummy4 = false;
structItem.Dummy5 = false;
structItem.Dummy6 = false;
structItem.Dummy7 = false;
structItem.Dummy8 = false;
structItem.Dummy9 = false;
structItem.Dummy10 = false;
structItem.Dummy11 = false;
structItem.Dummy12 = false;
structItem.Dummy13 = false;
structItem.Dummy14 = false;
structItem.Dummy15 = false;
structItem.Dummy16 = false;
structItem.Dummy17 = false;
this.smartFileIO.StructType.Write(structItem, (int)Define.E_UserGroup.Level3, SmartFile.WriteMode.Overwrite);
#endregion
#region Admin
//structItem.IsMainDisplayRecipeChange = item.Admin.IsMainDisplayProductChange;
//structItem.IsMainDisplayClear = item.Admin.IsMainDisplayClear;
//structItem.IsMainDispalySubMenu = item.Admin.IsMainDisplaySubMenu;
//structItem.IsMenuRecipe = item.Admin.IsMenuRecipe;
//structItem.IsMenuUserSetting = item.Admin.IsMenuUserSetting;
//structItem.IsMenuUserGroupEditor = item.Admin.IsMenuUserGroupEditor;
//structItem.IsMenuIOTest = item.Admin.IsMenuIOTest;
//structItem.IsMenuEquipmentLog = item.Admin.IsMenuHistoryLog;
//structItem.IsMenuCheckLog = item.Admin.IsMenuInspectionLog;
//structItem.IsMenuAlarmList = item.Admin.IsMenuAlarmLog;
//structItem.IsMenuInformation = item.Admin.IsMenuInformation;
//structItem.IsMenuStatus = item.Admin.IsMenuEquipment;
//structItem.IsMenuEthernet = item.Admin.IsMenuEthernet;
structItem.IsMainDisplayRecipeChange = true;
structItem.IsMainDisplayClear = true;
structItem.IsMainDispalySubMenu = true;
structItem.IsMenuRecipe = true;
structItem.IsMenuUserSetting = true;
structItem.IsMenuUserGroupEditor = true;
structItem.IsMenuIOTest = true;
structItem.IsMenuEquipmentLog = true;
structItem.IsMenuCheckLog = true;
structItem.IsMenuAlarmList = true;
structItem.IsMenuInformation = true;
structItem.IsMenuStatus = true;
structItem.IsMenuEthernet = true;
structItem.Dummy1 = false;
structItem.Dummy2 = false;
structItem.Dummy3 = false;
structItem.Dummy4 = false;
structItem.Dummy5 = false;
structItem.Dummy6 = false;
structItem.Dummy7 = false;
structItem.Dummy8 = false;
structItem.Dummy9 = false;
structItem.Dummy10 = false;
structItem.Dummy11 = false;
structItem.Dummy12 = false;
structItem.Dummy13 = false;
structItem.Dummy14 = false;
structItem.Dummy15 = false;
structItem.Dummy16 = false;
structItem.Dummy17 = false;
this.smartFileIO.StructType.Write(structItem, (int)Define.E_UserGroup.Admin, SmartFile.WriteMode.Overwrite);
#endregion
this.smartFileIO.Close();
}
public void SaveUserGroupFile_Level1(UserGroupItem item)
{
string fullFilePath = "";
bool fileCheck = false;
StructUserGroupItem structItem;
fullFilePath = this.PathSystemFileFolder + "UserGroup.int";
this.smartFileIO.FilePathName = fullFilePath;
FileInfo fileInfo = new FileInfo(fullFilePath);
fileCheck = fileInfo.Exists;
this.OpenSmartFileIO();
this.smartFileIO.StructType.SetStructType(typeof(StructUserGroupItem));
if (fileCheck == false)
this.CreateUserGroupFile();
#region Level1
structItem.IsMainDisplayRecipeChange = item.IsMainDisplayProductChange;
structItem.IsMainDisplayClear = item.IsMainDisplayClear;
structItem.IsMainDispalySubMenu = item.IsMainDisplaySubMenu;
structItem.IsMenuRecipe = item.IsMenuRecipe;
structItem.IsMenuUserSetting = item.IsMenuUserSetting;
structItem.IsMenuUserGroupEditor = item.IsMenuUserGroupEditor;
structItem.IsMenuIOTest = item.IsMenuIOTest;
structItem.IsMenuEquipmentLog = item.IsMenuHistoryLog;
structItem.IsMenuCheckLog = item.IsMenuInspectionLog;
structItem.IsMenuAlarmList = item.IsMenuAlarmLog;
structItem.IsMenuInformation = item.IsMenuInformation;
structItem.IsMenuStatus = item.IsMenuEquipment;
structItem.IsMenuEthernet = item.IsMenuEthernet;
structItem.Dummy1 = false;
structItem.Dummy2 = false;
structItem.Dummy3 = false;
structItem.Dummy4 = false;
structItem.Dummy5 = false;
structItem.Dummy6 = false;
structItem.Dummy7 = false;
structItem.Dummy8 = false;
structItem.Dummy9 = false;
structItem.Dummy10 = false;
structItem.Dummy11 = false;
structItem.Dummy12 = false;
structItem.Dummy13 = false;
structItem.Dummy14 = false;
structItem.Dummy15 = false;
structItem.Dummy16 = false;
structItem.Dummy17 = false;
this.smartFileIO.StructType.Write(structItem, (int)Define.E_UserGroup.Level1, SmartFile.WriteMode.Overwrite);
#endregion
this.smartFileIO.Close();
}
public void SaveUserGroupFile_Level2(UserGroupItem item)
{
string fullFilePath = "";
bool fileCheck = false;
StructUserGroupItem structItem;
fullFilePath = this.PathSystemFileFolder + "UserGroup.int";
this.smartFileIO.FilePathName = fullFilePath;
FileInfo fileInfo = new FileInfo(fullFilePath);
fileCheck = fileInfo.Exists;
this.OpenSmartFileIO();
this.smartFileIO.StructType.SetStructType(typeof(StructUserGroupItem));
if (fileCheck == false)
this.CreateUserGroupFile();
#region Level2
structItem.IsMainDisplayRecipeChange = item.IsMainDisplayProductChange;
structItem.IsMainDisplayClear = item.IsMainDisplayClear;
structItem.IsMainDispalySubMenu = item.IsMainDisplaySubMenu;
structItem.IsMenuRecipe = item.IsMenuRecipe;
structItem.IsMenuUserSetting = item.IsMenuUserSetting;
structItem.IsMenuUserGroupEditor = item.IsMenuUserGroupEditor;
structItem.IsMenuIOTest = item.IsMenuIOTest;
structItem.IsMenuEquipmentLog = item.IsMenuHistoryLog;
structItem.IsMenuCheckLog = item.IsMenuInspectionLog;
structItem.IsMenuAlarmList = item.IsMenuAlarmLog;
structItem.IsMenuInformation = item.IsMenuInformation;
structItem.IsMenuStatus = item.IsMenuEquipment;
structItem.IsMenuEthernet = item.IsMenuEthernet;
structItem.Dummy1 = false;
structItem.Dummy2 = false;
structItem.Dummy3 = false;
structItem.Dummy4 = false;
structItem.Dummy5 = false;
structItem.Dummy6 = false;
structItem.Dummy7 = false;
structItem.Dummy8 = false;
structItem.Dummy9 = false;
structItem.Dummy10 = false;
structItem.Dummy11 = false;
structItem.Dummy12 = false;
structItem.Dummy13 = false;
structItem.Dummy14 = false;
structItem.Dummy15 = false;
structItem.Dummy16 = false;
structItem.Dummy17 = false;
this.smartFileIO.StructType.Write(structItem, (int)Define.E_UserGroup.Level2, SmartFile.WriteMode.Overwrite);
#endregion
this.smartFileIO.Close();
}
public void SaveUserGroupFile_Level3(UserGroupItem item)
{
string fullFilePath = "";
bool fileCheck = false;
StructUserGroupItem structItem;
fullFilePath = this.PathSystemFileFolder + "UserGroup.int";
this.smartFileIO.FilePathName = fullFilePath;
FileInfo fileInfo = new FileInfo(fullFilePath);
fileCheck = fileInfo.Exists;
this.OpenSmartFileIO();
this.smartFileIO.StructType.SetStructType(typeof(StructUserGroupItem));
if (fileCheck == false)
this.CreateUserGroupFile();
#region Level3
structItem.IsMainDisplayRecipeChange = item.IsMainDisplayProductChange;
structItem.IsMainDisplayClear = item.IsMainDisplayClear;
structItem.IsMainDispalySubMenu = item.IsMainDisplaySubMenu;
structItem.IsMenuRecipe = item.IsMenuRecipe;
structItem.IsMenuUserSetting = item.IsMenuUserSetting;
structItem.IsMenuUserGroupEditor = item.IsMenuUserGroupEditor;
structItem.IsMenuIOTest = item.IsMenuIOTest;
structItem.IsMenuEquipmentLog = item.IsMenuHistoryLog;
structItem.IsMenuCheckLog = item.IsMenuInspectionLog;
structItem.IsMenuAlarmList = item.IsMenuAlarmLog;
structItem.IsMenuInformation = item.IsMenuInformation;
structItem.IsMenuStatus = item.IsMenuEquipment;
structItem.IsMenuEthernet = item.IsMenuEthernet;
structItem.Dummy1 = false;
structItem.Dummy2 = false;
structItem.Dummy3 = false;
structItem.Dummy4 = false;
structItem.Dummy5 = false;
structItem.Dummy6 = false;
structItem.Dummy7 = false;
structItem.Dummy8 = false;
structItem.Dummy9 = false;
structItem.Dummy10 = false;
structItem.Dummy11 = false;
structItem.Dummy12 = false;
structItem.Dummy13 = false;
structItem.Dummy14 = false;
structItem.Dummy15 = false;
structItem.Dummy16 = false;
structItem.Dummy17 = false;
this.smartFileIO.StructType.Write(structItem, (int)Define.E_UserGroup.Level3, SmartFile.WriteMode.Overwrite);
#endregion
this.smartFileIO.Close();
}
public void SaveUserGroupFile_Admin(UserGroupItem item)
{
string fullFilePath = "";
bool fileCheck = false;
StructUserGroupItem structItem;
fullFilePath = this.PathSystemFileFolder + "UserGroup.int";
this.smartFileIO.FilePathName = fullFilePath;
FileInfo fileInfo = new FileInfo(fullFilePath);
fileCheck = fileInfo.Exists;
this.OpenSmartFileIO();
this.smartFileIO.StructType.SetStructType(typeof(StructUserGroupItem));
if (fileCheck == false)
this.CreateUserGroupFile();
#region Default
structItem.IsMainDisplayRecipeChange = item.IsMainDisplayProductChange;
structItem.IsMainDisplayClear = item.IsMainDisplayClear;
structItem.IsMainDispalySubMenu = item.IsMainDisplaySubMenu;
structItem.IsMenuRecipe = item.IsMenuRecipe;
structItem.IsMenuUserSetting = item.IsMenuUserSetting;
structItem.IsMenuUserGroupEditor = item.IsMenuUserGroupEditor;
structItem.IsMenuIOTest = item.IsMenuIOTest;
structItem.IsMenuEquipmentLog = item.IsMenuHistoryLog;
structItem.IsMenuCheckLog = item.IsMenuInspectionLog;
structItem.IsMenuAlarmList = item.IsMenuAlarmLog;
structItem.IsMenuInformation = item.IsMenuInformation;
structItem.IsMenuStatus = item.IsMenuEquipment;
structItem.IsMenuEthernet = item.IsMenuEthernet;
structItem.Dummy1 = false;
structItem.Dummy2 = false;
structItem.Dummy3 = false;
structItem.Dummy4 = false;
structItem.Dummy5 = false;
structItem.Dummy6 = false;
structItem.Dummy7 = false;
structItem.Dummy8 = false;
structItem.Dummy9 = false;
structItem.Dummy10 = false;
structItem.Dummy11 = false;
structItem.Dummy12 = false;
structItem.Dummy13 = false;
structItem.Dummy14 = false;
structItem.Dummy15 = false;
structItem.Dummy16 = false;
structItem.Dummy17 = false;
this.smartFileIO.StructType.Write(structItem, (int)Define.E_UserGroup.Admin, SmartFile.WriteMode.Overwrite);
#endregion
this.smartFileIO.Close();
}
private void LoadUserGroupFile(ref UserGroup item)
{
string fullFilePath = "";
bool fileCheck = false;
StructUserGroupItem structItem;
fullFilePath = this.PathSystemFileFolder + "UserGroup.int";
this.smartFileIO.FilePathName = fullFilePath;
FileInfo fileInfo = new FileInfo(fullFilePath);
fileCheck = fileInfo.Exists;
this.OpenSmartFileIO();
this.smartFileIO.StructType.SetStructType(typeof(StructUserGroupItem));
if (fileCheck == false)
this.CreateUserGroupFile();
try
{
this.smartFileIO.StructType.FillBuffer();
#region Level1
structItem = (StructUserGroupItem)this.smartFileIO.StructType.ReadBuffer((int)Define.E_UserGroup.Level1);
item.Level1.IsMainDisplayProductChange = structItem.IsMainDisplayRecipeChange;
item.Level1.IsMainDisplayClear = structItem.IsMainDisplayClear;
item.Level1.IsMainDisplaySubMenu = structItem.IsMainDispalySubMenu;
item.Level1.IsMenuRecipe = structItem.IsMenuRecipe;
item.Level1.IsMenuUserSetting = structItem.IsMenuUserSetting;
item.Level1.IsMenuUserGroupEditor = structItem.IsMenuUserGroupEditor;
item.Level1.IsMenuIOTest = structItem.IsMenuIOTest;
item.Level1.IsMenuHistoryLog = structItem.IsMenuEquipmentLog;
item.Level1.IsMenuInspectionLog = structItem.IsMenuCheckLog;
item.Level1.IsMenuAlarmLog = structItem.IsMenuAlarmList;
item.Level1.IsMenuInformation = structItem.IsMenuInformation;
item.Level1.IsMenuEquipment = structItem.IsMenuStatus;
item.Level1.IsMenuEthernet = structItem.IsMenuEthernet;
#endregion
#region Level2
structItem = (StructUserGroupItem)this.smartFileIO.StructType.ReadBuffer((int)Define.E_UserGroup.Level2);
item.Level2.IsMainDisplayProductChange = structItem.IsMainDisplayRecipeChange;
item.Level2.IsMainDisplayClear = structItem.IsMainDisplayClear;
item.Level2.IsMainDisplaySubMenu = structItem.IsMainDispalySubMenu;
item.Level2.IsMenuRecipe = structItem.IsMenuRecipe;
item.Level2.IsMenuUserSetting = structItem.IsMenuUserSetting;
item.Level2.IsMenuUserGroupEditor = structItem.IsMenuUserGroupEditor;
item.Level2.IsMenuIOTest = structItem.IsMenuIOTest;
item.Level2.IsMenuHistoryLog = structItem.IsMenuEquipmentLog;
item.Level2.IsMenuInspectionLog = structItem.IsMenuCheckLog;
item.Level2.IsMenuAlarmLog = structItem.IsMenuAlarmList;
item.Level2.IsMenuInformation = structItem.IsMenuInformation;
item.Level2.IsMenuEquipment = structItem.IsMenuStatus;
item.Level2.IsMenuEthernet = structItem.IsMenuEthernet;
#endregion
#region Level3
structItem = (StructUserGroupItem)this.smartFileIO.StructType.ReadBuffer((int)Define.E_UserGroup.Level3);
item.Level3.IsMainDisplayProductChange = structItem.IsMainDisplayRecipeChange;
item.Level3.IsMainDisplayClear = structItem.IsMainDisplayClear;
item.Level3.IsMainDisplaySubMenu = structItem.IsMainDispalySubMenu;
item.Level3.IsMenuRecipe = structItem.IsMenuRecipe;
item.Level3.IsMenuUserSetting = structItem.IsMenuUserSetting;
item.Level3.IsMenuUserGroupEditor = structItem.IsMenuUserGroupEditor;
item.Level3.IsMenuIOTest = structItem.IsMenuIOTest;
item.Level3.IsMenuHistoryLog = structItem.IsMenuEquipmentLog;
item.Level3.IsMenuInspectionLog = structItem.IsMenuCheckLog;
item.Level3.IsMenuAlarmLog = structItem.IsMenuAlarmList;
item.Level3.IsMenuInformation = structItem.IsMenuInformation;
item.Level3.IsMenuEquipment = structItem.IsMenuStatus;
item.Level3.IsMenuEthernet = structItem.IsMenuEthernet;
#endregion
#region Default
//structItem = (StructUserGroupItem)this.smartFileIO.StructType.ReadBuffer((int)Define.E_UserGroup.Admin);
//item.Admin.IsMainDisplayProductChange = structItem.IsMainDisplayRecipeChange;
//item.Admin.IsMainDisplayClear = structItem.IsMainDisplayClear;
//item.Admin.IsMainDisplaySubMenu = structItem.IsMainDispalySubMenu;
//item.Admin.IsMenuRecipe = structItem.IsMenuRecipe;
//item.Admin.IsMenuUserSetting = structItem.IsMenuUserSetting;
//item.Admin.IsMenuUserGroupEditor = structItem.IsMenuUserGroupEditor;
//item.Admin.IsMenuIOTest = structItem.IsMenuIOTest;
//item.Admin.IsMenuHistoryLog = structItem.IsMenuEquipmentLog;
//item.Admin.IsMenuInspectionLog = structItem.IsMenuCheckLog;
//item.Admin.IsMenuAlarmLog = structItem.IsMenuAlarmList;
//item.Admin.IsMenuInformation = structItem.IsMenuInformation;
//item.Admin.IsMenuEquipment = structItem.IsMenuStatus;
//item.Admin.IsMenuEthernet = structItem.IsMenuEthernet;
item.Admin.IsMainDisplayProductChange = true;
item.Admin.IsMainDisplayClear = true;
item.Admin.IsMainDisplaySubMenu = true;
item.Admin.IsMenuRecipe = true;
item.Admin.IsMenuUserSetting = true;
item.Admin.IsMenuUserGroupEditor = true;
item.Admin.IsMenuIOTest = true;
item.Admin.IsMenuHistoryLog = true;
item.Admin.IsMenuInspectionLog = true;
item.Admin.IsMenuAlarmLog = true;
item.Admin.IsMenuInformation = true;
item.Admin.IsMenuEquipment = true;
item.Admin.IsMenuEthernet = true;
#endregion
}
catch
{
DialogFormMessage myMsg = new DialogFormMessage(17, this.SystemConfig.LANGUAGE);
myMsg.ShowDialog();
this.smartFileIO.Close();
}
this.smartFileIO.Close();
}
#endregion
#region Modbus
public void ModbusOpen()
{
if (this.smartModbus.IsOpen == true)
this.smartModbus.PortClose();
this.smartModbus.PortOpen();
}
public void ModbusClose()
{
this.smartModbus.PortClose();
}
public string ServoMotorRead1(int slaveAddress, int parameterAddress)
{
int value = 0;
byte[] readData = new byte[2];
this.smartModbus.SlaveAddress = slaveAddress;
this.smartModbus.ReadHoldingRegister(parameterAddress, 1, out readData);
Array.Reverse(readData);
value = BitConverter.ToInt16(readData, 0);
return string.Format("{0}", value);
}
public string ServoMotorRead2(int slaveAddress, int parameterAddress)
{
int value = 0;
byte[] readData = new byte[4];
this.smartModbus.SlaveAddress = slaveAddress;
this.smartModbus.ReadHoldingRegister(parameterAddress, 2, out readData);
byte[] readData1 = new byte[4];
readData1[0] = readData[1];
readData1[1] = readData[0];
readData1[2] = readData[3];
readData1[3] = readData[2];
value = BitConverter.ToInt32(readData1, 0);
return string.Format("{0}", value);
}
public void ServoMotorWrite1(int slaveAddress, int parameterAddress, int value, SmartLabel label)
{
this.smartModbus.SlaveAddress = slaveAddress;
if (this.smartModbus.WriteSingleRegister(parameterAddress, value) == SmartX.SmartModbus.EXCEPTIONCODE.SUCCESS)
{
//MessageBox.Show("쓰기완료");
}
label.Text = this.ServoMotorRead1(slaveAddress, parameterAddress);
}
public void ServoMotorWrite1(int slaveAddress, int parameterAddress, int value)
{
this.smartModbus.SlaveAddress = slaveAddress;
if (this.smartModbus.WriteSingleRegister(parameterAddress, value) == SmartX.SmartModbus.EXCEPTIONCODE.SUCCESS)
{
//MessageBox.Show("쓰기완료");
}
}
public void ServoMotorWrite2(int slaveAddress, int parameterAddress, int value, SmartLabel label)
{
byte[] data = BitConverter.GetBytes(value);
byte[] readData1 = new byte[4];
readData1[0] = data[1];
readData1[1] = data[0];
readData1[2] = data[3];
readData1[3] = data[2];
this.smartModbus.SlaveAddress = slaveAddress;
if (this.smartModbus.WriteMultipleRegister(parameterAddress, 2, readData1) == SmartX.SmartModbus.EXCEPTIONCODE.SUCCESS)
{
//MessageBox.Show("쓰기완료");
}
label.Text = this.ServoMotorRead2(slaveAddress, parameterAddress);
}
public void ServoMotorWrite2(int slaveAddress, int parameterAddress, int value)
{
byte[] data = BitConverter.GetBytes(value);
byte[] readData1 = new byte[4];
readData1[0] = data[1];
readData1[1] = data[0];
readData1[2] = data[3];
readData1[3] = data[2];
this.smartModbus.SlaveAddress = slaveAddress;
if (this.smartModbus.WriteMultipleRegister(parameterAddress, 2, readData1) == SmartX.SmartModbus.EXCEPTIONCODE.SUCCESS)
{
//MessageBox.Show("쓰기완료");
}
}
#endregion
#endregion
#region Override Member
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
// 변수 초기 셋팅
this.DefaultSetting();
// SystemConfiguration 파일 읽기
this.LoadSystemConfigurationFile();
// Recipe 파일 읽기
this.LoadRecipeFile(ref this.CurrentRecipe, this.SystemConfig.RECIPE_NUMBER - 1);
// UserGroup File Load
this.LoadUserGroupFile(ref this.CurrentUserGroup);
// UserManager 초기화
this.InitializeUserManager();
this.CurrentSystemStatus.CurrentUser.Group = Define.E_UserGroup.LogOut;
//UserManager.UserManager_GetUserListName();
// Form 생성
this.CreateForm();
// 통신 OPEN
this.OpenSmartUartLink();
this.smartForm1.Show(1);
// 초기 파라미터 전송
this.TransferSystemParameter9039();
// timer1 Get user List Name
//UserManager.UserManager_GetUserListName();
this.timerUserList.Enabled = true;
this.ModbusOpen();
}
#endregion
#region Event Handler
private void smartSerialPortLink_OnReadQueueEvent()
{
this.ReceiveData();
// 통신 확인
if (this.CommunicationCheckCount / 3 == 1)
{
if (this.ChildFormMainDisplay != null)
this.ChildFormMainDisplay.labelCommunicationStatus.Visible = true;
this.CommunicationCheckCount = 0;
}
else
{
if (this.ChildFormMainDisplay != null)
this.ChildFormMainDisplay.labelCommunicationStatus.Visible = false;
this.CommunicationCheckCount += 1;
}
}
private void smartButton1_Click(object sender, EventArgs e)
{
this.smartForm1.Show(2);
}
private void smartButton2_Click(object sender, EventArgs e)
{
this.smartForm1.Show(1);
}
private void CurrentAlarmList_Change(Define.E_TrackingAlarm alarm, string status)
{
this.SetTrackingAlarmData(alarm, status);
}
private void timerUserList_Tick(object sender, EventArgs e)
{
this.timerUserList.Enabled = false;
UserManager.UserManager_GetUserListName();
}
#region UserManagerEvent
private void UserManager_UserListLogoutDataEvent(int status)
{
try
{
if (status == (int)UserManager.USERMGR_LOGOUT_STATUS_OK)
{
// logout
}
else
{
// logout fail !!!
//MessageBox.Show("Logout Failed !!!!");
}
}
catch
{
}
}
private void UserManager_UserListLoginDataEvent(int status, object data)
{
try
{
if (status == (int)UserManager.E_user_mgr_status.USER_MGR_STATUS_OK)
{
UserManager.UserMgr_user_info_t userInfo = (UserManager.UserMgr_user_info_t)data;
//this.ChildFormMainDisplay.updatedisplayuser
//String Message;
}
else
{
this.UI_Invoke(delegate
{
// login fail !!!
//textBox_id.Enabled = true;
//textBox_pw.Enabled = true;
//comboBox_logout_timeout.Enabled = true;
//button_login.Text = "LOGIN";
//Activation.IsLogin = false;
});
}
}
catch
{
}
}
private void UserManager_UserListGetListDataEvent(object data)
{
try
{
UserManager.UserMgr_user_list_t userList = (UserManager.UserMgr_user_list_t)data;
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.UserEditor)
this.ChildFormMenu.CallBackGetUserData(userList);
}
catch
{
}
}
private void UserManager_UserListLoginTimeoutDataEvent(object data)
{
try
{
UserManager.UserMgr_login_timeout_t loginTimeout = (UserManager.UserMgr_login_timeout_t)data;
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.CallBackUserListLoginTimeoutDataEvent(loginTimeout);
}
catch (Exception e)
{
}
}
private void UserManager_UserListLockDataEvent(object data)
{
try
{
UserManager.UserMgr_user_lock_t user = (UserManager.UserMgr_user_lock_t)data;
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.UserEditor)
this.ChildFormMenu.CallBackUserListLockDataEvent(user);
}
catch
{
}
}
private void UserManager_UserListDefaultSettingDataEvent(object data)
{
try
{
}
catch
{
}
}
private void UserManager_UserListDeleteDataEvent(object data)
{
try
{
UserManager.UserMgr_user_del_t user = (UserManager.UserMgr_user_del_t)data;
this.ChildFormMenu.CallBackUserListDeleteDataEvent(user);
}
catch
{
}
}
private void UserManager_UserListModifyUserDataEvent(object data)
{
try
{
UserManager.UserMgr_user_modify_t user = (UserManager.UserMgr_user_modify_t)data;
this.ChildFormMenu.CallBackUserModifyUserData(user);
}
catch
{
}
}
private void UserManager_UserListModifyInfoDataEvent(object data)
{
try
{
UserManager.UserMgr_user_info_t user = (UserManager.UserMgr_user_info_t)data;
//this.ChildFormMenu.Child_User_UserEditor.CallBackUserListModifyInfoDataEvent(user);
if (this.CurrentSystemStatus.CurrentDisplayMode == Define.E_DisplayModeStore.MainDisplay)
this.ChildFormMainDisplay.CallBackUserListModifyInfoData(user);
else
this.ChildFormMenu.CallBackUserListModifyInfoData(user);
}
catch
{
}
}
private void UserManager_UserListNewDataEvent(object data)
{
try
{
UserManager.UserMgr_user_info_t user = (UserManager.UserMgr_user_info_t)data;
this.ChildFormMenu.CallBackUserListNewData(user);
}
catch (Exception e)
{
}
}
private void UserManager_UserListAddDataEvent(object data)
{
try
{
UserManager.UserMgr_user_add_t userAdd = (UserManager.UserMgr_user_add_t)data;
if (userAdd.status == (int)UserManager.E_user_mgr_status.USER_MGR_STATUS_OK)
{
//for (int i = 0; i < this.CollectionUser.Count; i++)
//{
// if (this.CollectionUser[i].ID == userAdd.user_id)
// {
// this.FlagUserListCNT++;
// this.CollectionUser[i].IsUpdate = true;
// this.CollectionUser[i].IsLockAccount = userAdd.flock_status_account == 0 ? false : true;
// this.CollectionUser[i].IsLockPassword = userAdd.flock_status_password == 0 ? false : true;
// break;
// }
//}
}
else
{
//for (int i = 0; i < this.CollectionUser.Count; i++)
//{
// if (this.CollectionUser[i].ID == userAdd.user_id)
// {
// this.CollectionUser.RemoveAt(i);
// break;
// }
//}
//this.SaveUserFile(this.CollectionUser);
}
}
catch
{
}
}
private void UserManager_UserListGetListNameDataEvent(object data)
{
try
{
UserManager.UserMgr_user_list_name_t name = (UserManager.UserMgr_user_list_name_t)data;
if (name.total_count == 0)
return;
this.ListDllUserName.Add(name.user_id);
}
catch
{
}
}
#endregion
private void timerClientTryConnect_Tick(object sender, EventArgs e)
{
}
#endregion
}
}