INT_LKD_2/INT_LKD_2/Forms/FormMain.cs

6322 lines
306 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.Threading;
using System.Net.Sockets;
using System.Windows.Forms;
using SmartX;
using InModbus;
using INT_LKD_2.DataStore;
using INT_LKD_2.Part11_UserManager;
using INT_LKD_2.DialogForms;
using INT_LKD_2.SerialManger;
namespace INT_LKD_2.Forms
{
public partial class FormMain : Form
{
#region Field
public bool IsSmartFileIOOpen;
public bool IsCommunicationLogOpen;
private int CommunicationCheckCount_Master;
private int CommunicationCheckCount_Slave;
public int FlagAutomaticLogoutWarningTime;
private bool ChangeModeRecipe;
public bool FlagDllSerial; // DllSerial 사용여부
public string ComPortMainToLCD; // DllSerial Port
// 로그온 색상
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;
// UserGroup
public UserGroup CurrentUserGroup;
// 업데이트 메인보드
public UpdateForMainBoard UpdateForMain;
// 현재 장비 상태
public SystemStatus CurrentSystemStatus;
// SystemConfiguration
public SystemConfiguration SystemConfig;
// Current Recipe
public Recipe CurrentRecipe;
// Loading Recipe
private Recipe LoadingRecipe;
// Leak Data
private LeakData CurrentLeakData;
public Collection<LeakData1> CurrentLeakDatas;
// Dll User_Name List
public List<string> ListDllUserName;
// IO Test - input data
private Collection<string> CollectionIOTest_InputData;
// 알람
private AlarmList CurrentAlarmList;
// Modbus
public Modbus Modbus;
// Modbus Data
public _30000_ModbusData Current30000ModbusData;
public _40000_ModbusData Current40000ModbusData;
// 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 FormMainDisplay ChildFormMainDisplay;
public FormMenu ChildFormMenu;
private delegate void ModbusStatusCallback();
#endregion
#region Constructor
public FormMain()
{
// Splash start
SmartSplash.Start(SmartX.SmartSplash.BuiltInLoadingImages.LOADING1_SMALL, 300);
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; }
}
#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_Master = 0;
this.CommunicationCheckCount_Slave = 0;
this.ChangeModeRecipe = false;
this.CurrentUserGroup = new UserGroup();
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.Current30000ModbusData = new _30000_ModbusData();
this.Current40000ModbusData = new _40000_ModbusData();
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.LoadingRecipe = 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);
// DllSerial 사용여부 설정
this.FlagDllSerial = false;
if (this.FlagDllSerial == true)
{
// SerialDll Initialize
this.ComPortMainToLCD = "COM2:";
SerialMgrComm.IntializeSerialManager();
SerialMgrComm.SerialPortMessageReceive += this.SerialPort_MessageReceive;
SerialMgrComm.SerialPortErrMessageReceive += this.SerialPort_ErrMessageReceive;
SerialMgrComm.SerialPortGetVersionDataEvent += this.Serialport_GetVersionDataEvent;
}
}
private void DefaultSetting2()
{
// 이더넷
if (this.SystemConfig.ETHERNET_OP_MODE == 1)
{
try
{
if (string.Compare(this.smartConfigs.IPSettings.DeviceIP, "0.0.0.0") != 0)
this.EthernetServerStart();
this.ChildFormMainDisplay.TimerServer(true);
}
catch
{
}
}
else if (this.SystemConfig.ETHERNET_OP_MODE == 2)
{
this.EthernetClientDisconnect();
}
if (this.SystemConfig.ETHERNET_COMM_MODE != (int)Define.E_CommMode.f0_None)
{
switch (this.SystemConfig.ETHERNET_COMM_MODE)
{
case (int)Define.E_CommMode.f1_Modbus:
this.ChildFormMainDisplay.MainButtonModbusAdd(true);
break;
default:
break;
}
}
this.ChildFormMainDisplay.InitialEthernetIcon();
}
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.smartForm1.MainForm = this;
// MainDisplay
this.ChildFormMainDisplay = new FormMainDisplay(this);
this.smartForm1.AddChildForm(this.ChildFormMainDisplay);
// Menu
this.ChildFormMenu = new FormMenu(this);
this.smartForm1.AddChildForm(this.ChildFormMenu);
}
private void TransferSystemParameter9039(Define.E_BoardMode mode)
{
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()));
if (mode == Define.E_BoardMode.Master)
this.TransferDataStream_Master(CommunicationCommand.Write, CommunicationID.MainBoardMaster, CommunicationAddress._9039_ParameterAll, sb.ToString());
else
this.TransferDataStream_Slave(CommunicationCommand.Write, CommunicationID.MainBoardMaster, CommunicationAddress._9039_ParameterAll, sb.ToString());
}
public void TransferRecipeParameter9043(int number, Define.E_BoardMode mode)
{
string value = "";
StringBuilder sb = new StringBuilder();
this.LoadingRecipe = new Recipe();
this.ChangeModeRecipe = true;
this.LoadRecipeFile(ref this.LoadingRecipe, number - 1);
sb.Append(Helper.StringBlankFillDigits4(this.LoadingRecipe.NUMBER.ToString()));
sb.Append(Helper.StringBlankFillDigits4(this.LoadingRecipe.VACUUM_START_SEC.ToString()));
sb.Append(Helper.StringBlankFillDigits4(this.LoadingRecipe.VACUUM_HOLD1_SEC.ToString()));
sb.Append(Helper.StringBlankFillDigits4(this.LoadingRecipe.VACUUM_HOLD2_SEC.ToString()));
sb.Append(Helper.StringBlankFillDigits4(this.LoadingRecipe.VACUUM_BREAK_SEC.ToString()));
sb.Append(Helper.StringBlankFillDigits6(this.LoadingRecipe.DISP_JUDG_MAX_DIFF));
sb.Append(Helper.StringBlankFillDigits6(this.LoadingRecipe.DISP_JUDG_MIN_HEIGHT));
sb.Append(Helper.StringBlankFillDigits6(this.LoadingRecipe.DISP_JUDG_EMPTY_LEVEL));
sb.Append(Helper.StringBlankFillDigits6(this.LoadingRecipe.DIFF_LR_LIMIT));
sb.Append(Helper.StringBlankFillDigits4(this.LoadingRecipe.DIFF_LR_DELAY_SEC));
sb.Append(Helper.StringBlankFillDigits6(this.LoadingRecipe.VACUUM_GUAGE_LEVEL));
if (this.LoadingRecipe.DISP_JUDG_ENABLE == false)
value = "0";
else
value = "1";
sb.Append(Helper.StringBlankFillDigits4(value));
sb.Append(Helper.StringBlankFillDigits4(this.LoadingRecipe.DIFF_LR_CYCLE.ToString()));
if (mode == Define.E_BoardMode.Master)
this.TransferDataStream_Master(CommunicationCommand.Write, CommunicationID.MainBoardMaster, CommunicationAddress._9043_RecipeParameter, sb.ToString());
else
this.TransferDataStream_Slave(CommunicationCommand.Write, CommunicationID.MainBoardMaster, 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_Master(CommunicationCommand.ModeNormal, CommunicationID.MainBoardMaster);
this.TransferData_Slave(CommunicationCommand.ModeNormal, CommunicationID.MainBoardMaster);
break;
case Define.E_EquipmentMode.Menu:
this.TransferData_Master(CommunicationCommand.ModeMenu, CommunicationID.MainBoardMaster);
this.TransferData_Slave(CommunicationCommand.ModeMenu, CommunicationID.MainBoardMaster);
break;
case Define.E_EquipmentMode.IOTest:
this.TransferData_Master(CommunicationCommand.ModeIOTest, CommunicationID.MainBoardMaster);
this.TransferData_Slave(CommunicationCommand.ModeIOTest, CommunicationID.MainBoardMaster);
break;
case Define.E_EquipmentMode.EquipmentTest:
this.TransferData_Master(CommunicationCommand.ModeEquipmentTest, CommunicationID.MainBoardMaster);
this.TransferData_Slave(CommunicationCommand.ModeEquipmentTest, CommunicationID.MainBoardMaster);
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.DIFF_LR_LIMIT = this.CurrentRecipe.DIFF_LR_LIMIT;
structItem.DIFF_LR_DELAY_SEC = this.LoadingRecipe.DIFF_LR_DELAY_SEC;
structItem.DIFF_LR_CYCLE = this.LoadingRecipe.DIFF_LR_CYCLE;
structItem.DISP_JUDG_EMPTY_LEVEL = this.LoadingRecipe.DISP_JUDG_EMPTY_LEVEL;
structItem.DISP_JUDG_ENABLE = this.LoadingRecipe.DISP_JUDG_ENABLE;
structItem.DISP_JUDG_MAX_DIFF = this.LoadingRecipe.DISP_JUDG_MAX_DIFF;
structItem.DISP_JUDG_MIN_HEIGHT = this.LoadingRecipe.DISP_JUDG_MIN_HEIGHT;
structItem.VACUUM_START_SEC = this.CurrentRecipe.VACUUM_START_SEC;
structItem.VACUUM_HOLD1_SEC = this.CurrentRecipe.VACUUM_HOLD1_SEC;
structItem.VACUUM_HOLD2_SEC = this.CurrentRecipe.VACUUM_HOLD2_SEC;
structItem.VACUUM_BREAK_SEC = this.CurrentRecipe.VACUUM_BREAK_SEC;
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.DIFF_LR_CYCLE = item.DIFF_LR_CYCLE;
structItem.DIFF_LR_DELAY_SEC = item.DIFF_LR_DELAY_SEC;
structItem.DIFF_LR_LIMIT = item.DIFF_LR_LIMIT;
structItem.DISP_JUDG_EMPTY_LEVEL = item.DISP_JUDG_EMPTY_LEVEL;
structItem.DISP_JUDG_ENABLE = item.DISP_JUDG_ENABLE;
structItem.DISP_JUDG_MAX_DIFF = item.DISP_JUDG_MAX_DIFF;
structItem.DISP_JUDG_MIN_HEIGHT = item.DISP_JUDG_MIN_HEIGHT;
structItem.VACUUM_START_SEC = item.VACUUM_START_SEC;
structItem.VACUUM_HOLD1_SEC = item.VACUUM_HOLD1_SEC;
structItem.VACUUM_HOLD2_SEC = item.VACUUM_HOLD2_SEC;
structItem.VACUUM_BREAK_SEC = item.VACUUM_BREAK_SEC;
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.DIFF_LR_CYCLE = structItem.DIFF_LR_CYCLE;
item.DIFF_LR_DELAY_SEC = structItem.DIFF_LR_DELAY_SEC;
item.DIFF_LR_LIMIT = structItem.DIFF_LR_LIMIT;
item.DISP_JUDG_EMPTY_LEVEL = structItem.DISP_JUDG_EMPTY_LEVEL;
item.DISP_JUDG_ENABLE = structItem.DISP_JUDG_ENABLE;
item.DISP_JUDG_MAX_DIFF = structItem.DISP_JUDG_MAX_DIFF;
item.DISP_JUDG_MIN_HEIGHT = structItem.DISP_JUDG_MIN_HEIGHT;
item.VACUUM_START_SEC = structItem.VACUUM_START_SEC;
item.VACUUM_HOLD1_SEC = structItem.VACUUM_HOLD1_SEC;
item.VACUUM_HOLD2_SEC = structItem.VACUUM_HOLD2_SEC;
item.VACUUM_BREAK_SEC = structItem.VACUUM_BREAK_SEC;
item.VACUUM_GUAGE_LEVEL = structItem.VACUUM_GUAGE_LEVEL;
this.smartFileIO.Close();
}
#endregion
#region Uart Communication
public void OpenSmartUartLink()
{
string fullPath = "";
try
{
if (this.FlagDllSerial == true)
SerialMgrComm.serialPortOpen(this.ComPortMainToLCD, 115200, 0, 0, 8);
else
{
if (this.smartSerialPortMaster.IsOpen == false)
this.smartSerialPortMaster.Open();
if (this.smartSerialPortSlave.IsOpen == false)
this.smartSerialPortSlave.Open();
}
}
catch
{
}
#region Test 용 통신 로그
fullPath = this.PathDataBackupFolder + "Communicationlog.txt";
this.smartFileCommunicationLog.FilePathName = fullPath;
//this.smartFileCommunicationLog.Open();
//this.IsCommunicationLogOpen = true;
#endregion
}
public void CloseSmartUartLink()
{
if (this.FlagDllSerial == true)
SerialMgrComm.serialPortClose(this.ComPortMainToLCD);
else
{
this.smartSerialPortMaster.Close();
this.smartSerialPortSlave.Close();
}
this.IsCommunicationLogOpen = false;
this.smartFileCommunicationLog.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;
}
#region Master
public int TransferData_Master(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);
// Serial Write
if (this.FlagDllSerial == true)
SerialMgrComm.serialPortMessage(this.ComPortMainToLCD, sb.ToString());
else
{
if (this.smartSerialPortMaster.IsOpen == true)
this.smartSerialPortMaster.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_Master(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);
// Serial Write
if (this.FlagDllSerial == true)
SerialMgrComm.serialPortMessage(this.ComPortMainToLCD, sb.ToString());
else
{
if (this.smartSerialPortMaster.IsOpen == true)
this.smartSerialPortMaster.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_Master(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);
// Serial Write
if (this.FlagDllSerial == true)
SerialMgrComm.serialPortMessage(this.ComPortMainToLCD, sb.ToString());
else
{
if (this.smartSerialPortMaster.IsOpen == true)
this.smartSerialPortMaster.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_Master(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);
// Serial Write
if (this.FlagDllSerial == true)
SerialMgrComm.serialPortMessage(this.ComPortMainToLCD, sb.ToString());
else
{
if (this.smartSerialPortMaster.IsOpen == true)
this.smartSerialPortMaster.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_Master()
{
int ret = 0;
string strTemp = "";
byte[] readByte;
SmartSerialPort.FRAMEDATAREADSTATUS receiveDataState = SmartSerialPort.FRAMEDATAREADSTATUS.EMPTY;
try
{
receiveDataState = this.smartSerialPortMaster.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_Master(strTemp)) != 0)
return;
break;
case 'P':
if ((ret = this.ReceiveCommandP_Master(strTemp)) != 0)
return;
break;
case 'S':
if ((ret = this.ReceiveCommandS_Master(strTemp)) != 0)
return;
break;
default:
break;
}
}
catch
{
}
}
private void ReceiveData_Master(string strTemp)
{
int ret = 0;
try
{
switch (strTemp[0])
{
case 'C':
if ((ret = this.ReceiveCommandC_Master(strTemp)) != 0)
return;
break;
case 'P':
if ((ret = this.ReceiveCommandP_Master(strTemp)) != 0)
return;
break;
case 'S':
if ((ret = this.ReceiveCommandS_Master(strTemp)) != 0)
return;
break;
default:
break;
}
}
catch
{
}
}
private int ReceiveCommandC_Master(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(Define.E_BoardMode.Master);
break;
case "CBS":
this.CurrentSystemStatus.EquipmentStatus = DataStore.Define.E_EquipmentStatus.Start;
this.TransferData_Slave(CommunicationCommand.Start, CommunicationID.MainBoardSlave);
this.ChildFormMainDisplay.UpdateEquipmentStatusDisplay(this.CurrentSystemStatus.EquipmentStatus);
this.ChildFormMenu.UpdateEquipmentStatusDisplay(this.CurrentSystemStatus.EquipmentStatus);
break;
case "CBT":
this.CurrentSystemStatus.EquipmentStatus = Define.E_EquipmentStatus.Stop;
this.TransferData_Slave(CommunicationCommand.Stop, CommunicationID.MainBoardSlave);
this.ChildFormMainDisplay.UpdateEquipmentStatusDisplay(this.CurrentSystemStatus.EquipmentStatus);
this.ChildFormMenu.UpdateEquipmentStatusDisplay(this.CurrentSystemStatus.EquipmentStatus);
break;
default:
break;
}
return ret;
}
private int ReceiveCommandP_Master(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_Master(lane, address, receiveData)) != 0)
return ret = -1;
break;
case "PW0":
if ((ret = this.ReceiveCommandPW0_Master(lane, address, receiveData)) != 0)
return ret = -1;
break;
default:
break;
}
return ret;
}
private int ReceiveCommandS_Master(string strTemp)
{
int ret = 0;
string cmd = "", retryCNT = "", 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);
retryCNT = strTemp.Substring(4, 1);
lane = strTemp.Substring(5, 1);
receiveData = strTemp.Substring(10, strTemp.Length - 12);
switch (cmd)
{
case "SLA":
if ((ret = this.ReceiveCommandSLA_Master(lane, retryCNT, receiveData)) != 0)
return ret;
break;
case "SLB":
if ((ret = this.ReceiveCommandSLB_Master(lane, receiveData)) != 0)
return ret;
break;
case "SLC":
if ((ret = this.ReceiveCommandSLC_Master(lane, receiveData)) != 0)
return ret;
break;
case "SLD":
if ((ret = this.ReceiveCommandSLD_Master(lane, receiveData)) != 0)
return ret;
break;
case "SLE":
if ((ret = this.ReceiveCommandSLE_Master(lane, receiveData)) != 0)
return ret;
break;
case "ST0":
if ((ret = this.ReceiveCommandST0_Master(lane, receiveData)) != 0)
return ret;
break;
case "SA0":
if ((ret = this.ReceiveCommandSA0_Master(lane, receiveData)) != 0)
return ret;
break;
default:
break;
}
return ret;
}
// 파라미터 읽기 응답
private int ReceiveCommandPR0_Master(string lane, string address, string receiveData)
{
int ret = 0, iValue = 0;
try
{
switch (address)
{
case "1502":
switch (lane)
{
case "0":
#region Value Assign
this.SystemConfig.MAINBOARD_VERSION_MASTER = receiveData;
#endregion
this.ChildFormMenu.UpdateMainBoardVersionMasterDisplay(this.SystemConfig.MAINBOARD_VERSION_MASTER);
break;
//case "1":
// #region Value Assign
// this.SystemConfig.MAINBOARD_VERSION_SLAVE = receiveData;
// #endregion
// this.ChildFormMenu.UpdateMainBoardVersionSlaveDisplay(this.SystemConfig.MAINBOARD_VERSION_SLAVE);
// break;
default:
break;
}
break;
case "2001":
#region Value Assign
iValue = int.Parse(receiveData);
if (iValue <= 0 || iValue > 1000)
return ret = -1;
this.SystemConfig.RECIPE_NUMBER = iValue;
this.ChangeModeRecipe = false;
#endregion
this.SaveSystemConfigurationFile(this.SystemConfig);
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_Master(string lane, string address, string receiveData)
{
int ret = 0;
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, Define.E_BoardMode.Master);
break;
case "9043":
if (response == Define.E_ResponseData.ACK)
this.TransferDataStream_Master(CommunicationCommand.Read, CommunicationID.MainBoardMaster, CommunicationAddress._2001_ProductNumber, "");
break;
default:
break;
}
}
catch
{
ret = -1;
}
return ret;
}
// 판정 데이터
private int ReceiveCommandSLA_Master(string lane, string retryCNT, string receiveData)
{
int ret = 0;
try
{
// 응답
this.TransferData_Master(string.Format("{0}{1}0{2}", CommunicationCommand.Respone, 1, retryCNT), lane);
switch (lane)
{
case "A":
#region 1열
#region Value Assign
this.CurrentLeakDatas[0].Judgment.Result = Helper.StringToJudgmentStatus(receiveData.Substring(0, 1));
this.CurrentLeakDatas[0].Judgment.DIFF_Result = Helper.StringToJudgmentStatus(receiveData.Substring(1, 1));
this.CurrentLeakDatas[0].Judgment.DISP_Result = Helper.StringToJudgmentStatus(receiveData.Substring(2, 1));
this.CurrentLeakDatas[0].Judgment.DIFF_SecBufMax = receiveData.Substring(3, 8).Trim();
this.CurrentLeakDatas[0].Judgment.DIFF_SecBufSum = receiveData.Substring(11, 8).Trim();
this.CurrentLeakDatas[0].Judgment.DISP_Min = receiveData.Substring(19, 6).Trim();
this.CurrentLeakDatas[0].Judgment.DISP_MDataMax = receiveData.Substring(25, 6).Trim();
this.CurrentLeakDatas[0].Judgment.DISP_MDataDiff = receiveData.Substring(31, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayJudgmentData1(this.CurrentLeakDatas[0]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
this.ChildFormMenu.UpdateDisplayEquipmentJudgmentData1(this.CurrentLeakDatas[0]);
#endregion
break;
case "B":
#region 2열
#region Value Assign
this.CurrentLeakDatas[1].Judgment.Result = Helper.StringToJudgmentStatus(receiveData.Substring(0, 1));
this.CurrentLeakDatas[1].Judgment.DIFF_Result = Helper.StringToJudgmentStatus(receiveData.Substring(1, 1));
this.CurrentLeakDatas[1].Judgment.DISP_Result = Helper.StringToJudgmentStatus(receiveData.Substring(2, 1));
this.CurrentLeakDatas[1].Judgment.DIFF_SecBufMax = receiveData.Substring(3, 8).Trim();
this.CurrentLeakDatas[1].Judgment.DIFF_SecBufSum = receiveData.Substring(11, 8).Trim();
this.CurrentLeakDatas[1].Judgment.DISP_Min = receiveData.Substring(19, 6).Trim();
this.CurrentLeakDatas[1].Judgment.DISP_MDataMax = receiveData.Substring(25, 6).Trim();
this.CurrentLeakDatas[1].Judgment.DISP_MDataDiff = receiveData.Substring(31, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayJudgmentData2(this.CurrentLeakDatas[1]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
this.ChildFormMenu.UpdateDisplayEquipmentJudgmentData2(this.CurrentLeakDatas[1]);
#endregion
break;
case "C":
#region 3열
#region Value Assign
this.CurrentLeakDatas[2].Judgment.Result = Helper.StringToJudgmentStatus(receiveData.Substring(0, 1));
this.CurrentLeakDatas[2].Judgment.DIFF_Result = Helper.StringToJudgmentStatus(receiveData.Substring(1, 1));
this.CurrentLeakDatas[2].Judgment.DISP_Result = Helper.StringToJudgmentStatus(receiveData.Substring(2, 1));
this.CurrentLeakDatas[2].Judgment.DIFF_SecBufMax = receiveData.Substring(3, 8).Trim();
this.CurrentLeakDatas[2].Judgment.DIFF_SecBufSum = receiveData.Substring(11, 8).Trim();
this.CurrentLeakDatas[2].Judgment.DISP_Min = receiveData.Substring(19, 6).Trim();
this.CurrentLeakDatas[2].Judgment.DISP_MDataMax = receiveData.Substring(25, 6).Trim();
this.CurrentLeakDatas[2].Judgment.DISP_MDataDiff = receiveData.Substring(31, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayJudgmentData3(this.CurrentLeakDatas[2]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
this.ChildFormMenu.UpdateDisplayEquipmentJudgmentData3(this.CurrentLeakDatas[2]);
#endregion
break;
case "D":
#region 4열
#region Value Assign
this.CurrentLeakDatas[3].Judgment.Result = Helper.StringToJudgmentStatus(receiveData.Substring(0, 1));
this.CurrentLeakDatas[3].Judgment.DIFF_Result = Helper.StringToJudgmentStatus(receiveData.Substring(1, 1));
this.CurrentLeakDatas[3].Judgment.DISP_Result = Helper.StringToJudgmentStatus(receiveData.Substring(2, 1));
this.CurrentLeakDatas[3].Judgment.DIFF_SecBufMax = receiveData.Substring(3, 8).Trim();
this.CurrentLeakDatas[3].Judgment.DIFF_SecBufSum = receiveData.Substring(11, 8).Trim();
this.CurrentLeakDatas[3].Judgment.DISP_Min = receiveData.Substring(19, 6).Trim();
this.CurrentLeakDatas[3].Judgment.DISP_MDataMax = receiveData.Substring(25, 6).Trim();
this.CurrentLeakDatas[3].Judgment.DISP_MDataDiff = receiveData.Substring(31, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayJudgmentData4(this.CurrentLeakDatas[3]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
this.ChildFormMenu.UpdateDisplayEquipmentJudgmentData4(this.CurrentLeakDatas[3]);
#endregion
break;
case "E":
#region 5열
#region Value Assign
this.CurrentLeakDatas[4].Judgment.Result = Helper.StringToJudgmentStatus(receiveData.Substring(0, 1));
this.CurrentLeakDatas[4].Judgment.DIFF_Result = Helper.StringToJudgmentStatus(receiveData.Substring(1, 1));
this.CurrentLeakDatas[4].Judgment.DISP_Result = Helper.StringToJudgmentStatus(receiveData.Substring(2, 1));
this.CurrentLeakDatas[4].Judgment.DIFF_SecBufMax = receiveData.Substring(3, 8).Trim();
this.CurrentLeakDatas[4].Judgment.DIFF_SecBufSum = receiveData.Substring(11, 8).Trim();
this.CurrentLeakDatas[4].Judgment.DISP_Min = receiveData.Substring(19, 6).Trim();
this.CurrentLeakDatas[4].Judgment.DISP_MDataMax = receiveData.Substring(25, 6).Trim();
this.CurrentLeakDatas[4].Judgment.DISP_MDataDiff = receiveData.Substring(31, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayJudgmentData5(this.CurrentLeakDatas[4]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
this.ChildFormMenu.UpdateDisplayEquipmentJudgmentData5(this.CurrentLeakDatas[4]);
#endregion
break;
case "F":
#region 6열
#region Value Assign
this.CurrentLeakDatas[5].Judgment.Result = Helper.StringToJudgmentStatus(receiveData.Substring(0, 1));
this.CurrentLeakDatas[5].Judgment.DIFF_Result = Helper.StringToJudgmentStatus(receiveData.Substring(1, 1));
this.CurrentLeakDatas[5].Judgment.DISP_Result = Helper.StringToJudgmentStatus(receiveData.Substring(2, 1));
this.CurrentLeakDatas[5].Judgment.DIFF_SecBufMax = receiveData.Substring(3, 8).Trim();
this.CurrentLeakDatas[5].Judgment.DIFF_SecBufSum = receiveData.Substring(11, 8).Trim();
this.CurrentLeakDatas[5].Judgment.DISP_Min = receiveData.Substring(19, 6).Trim();
this.CurrentLeakDatas[5].Judgment.DISP_MDataMax = receiveData.Substring(25, 6).Trim();
this.CurrentLeakDatas[5].Judgment.DISP_MDataDiff = receiveData.Substring(31, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayJudgmentData6(this.CurrentLeakDatas[5]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
this.ChildFormMenu.UpdateDisplayEquipmentJudgmentData6(this.CurrentLeakDatas[5]);
#endregion
break;
case "G":
#region 7열
#region Value Assign
this.CurrentLeakDatas[6].Judgment.Result = Helper.StringToJudgmentStatus(receiveData.Substring(0, 1));
this.CurrentLeakDatas[6].Judgment.DIFF_Result = Helper.StringToJudgmentStatus(receiveData.Substring(1, 1));
this.CurrentLeakDatas[6].Judgment.DISP_Result = Helper.StringToJudgmentStatus(receiveData.Substring(2, 1));
this.CurrentLeakDatas[6].Judgment.DIFF_SecBufMax = receiveData.Substring(3, 8).Trim();
this.CurrentLeakDatas[6].Judgment.DIFF_SecBufSum = receiveData.Substring(11, 8).Trim();
this.CurrentLeakDatas[6].Judgment.DISP_Min = receiveData.Substring(19, 6).Trim();
this.CurrentLeakDatas[6].Judgment.DISP_MDataMax = receiveData.Substring(25, 6).Trim();
this.CurrentLeakDatas[6].Judgment.DISP_MDataDiff = receiveData.Substring(31, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayJudgmentData7(this.CurrentLeakDatas[6]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
this.ChildFormMenu.UpdateDisplayEquipmentJudgmentData7(this.CurrentLeakDatas[6]);
#endregion
break;
case "H":
#region 8열
#region Value Assign
this.CurrentLeakDatas[7].Judgment.Result = Helper.StringToJudgmentStatus(receiveData.Substring(0, 1));
this.CurrentLeakDatas[7].Judgment.DIFF_Result = Helper.StringToJudgmentStatus(receiveData.Substring(1, 1));
this.CurrentLeakDatas[7].Judgment.DISP_Result = Helper.StringToJudgmentStatus(receiveData.Substring(2, 1));
this.CurrentLeakDatas[7].Judgment.DIFF_SecBufMax = receiveData.Substring(3, 8).Trim();
this.CurrentLeakDatas[7].Judgment.DIFF_SecBufSum = receiveData.Substring(11, 8).Trim();
this.CurrentLeakDatas[7].Judgment.DISP_Min = receiveData.Substring(19, 6).Trim();
this.CurrentLeakDatas[7].Judgment.DISP_MDataMax = receiveData.Substring(25, 6).Trim();
this.CurrentLeakDatas[7].Judgment.DISP_MDataDiff = receiveData.Substring(31, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayJudgmentData8(this.CurrentLeakDatas[7]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
this.ChildFormMenu.UpdateDisplayEquipmentJudgmentData8(this.CurrentLeakDatas[7]);
#endregion
break;
case "I":
#region 9열
#region Value Assign
this.CurrentLeakDatas[8].Judgment.Result = Helper.StringToJudgmentStatus(receiveData.Substring(0, 1));
this.CurrentLeakDatas[8].Judgment.DIFF_Result = Helper.StringToJudgmentStatus(receiveData.Substring(1, 1));
this.CurrentLeakDatas[8].Judgment.DISP_Result = Helper.StringToJudgmentStatus(receiveData.Substring(2, 1));
this.CurrentLeakDatas[8].Judgment.DIFF_SecBufMax = receiveData.Substring(3, 8).Trim();
this.CurrentLeakDatas[8].Judgment.DIFF_SecBufSum = receiveData.Substring(11, 8).Trim();
this.CurrentLeakDatas[8].Judgment.DISP_Min = receiveData.Substring(19, 6).Trim();
this.CurrentLeakDatas[8].Judgment.DISP_MDataMax = receiveData.Substring(25, 6).Trim();
this.CurrentLeakDatas[8].Judgment.DISP_MDataDiff = receiveData.Substring(31, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayJudgmentData9(this.CurrentLeakDatas[8]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
this.ChildFormMenu.UpdateDisplayEquipmentJudgmentData9(this.CurrentLeakDatas[8]);
#endregion
break;
case "J":
#region 10열
#region Value Assign
this.CurrentLeakDatas[9].Judgment.Result = Helper.StringToJudgmentStatus(receiveData.Substring(0, 1));
this.CurrentLeakDatas[9].Judgment.DIFF_Result = Helper.StringToJudgmentStatus(receiveData.Substring(1, 1));
this.CurrentLeakDatas[9].Judgment.DISP_Result = Helper.StringToJudgmentStatus(receiveData.Substring(2, 1));
this.CurrentLeakDatas[9].Judgment.DIFF_SecBufMax = receiveData.Substring(3, 8).Trim();
this.CurrentLeakDatas[9].Judgment.DIFF_SecBufSum = receiveData.Substring(11, 8).Trim();
this.CurrentLeakDatas[9].Judgment.DISP_Min = receiveData.Substring(19, 6).Trim();
this.CurrentLeakDatas[9].Judgment.DISP_MDataMax = receiveData.Substring(25, 6).Trim();
this.CurrentLeakDatas[9].Judgment.DISP_MDataDiff = receiveData.Substring(31, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayJudgmentData10(this.CurrentLeakDatas[9]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
this.ChildFormMenu.UpdateDisplayEquipmentJudgmentData10(this.CurrentLeakDatas[9]);
#endregion
break;
case "K":
#region 11열
#region Value Assign
this.CurrentLeakDatas[10].Judgment.Result = Helper.StringToJudgmentStatus(receiveData.Substring(0, 1));
this.CurrentLeakDatas[10].Judgment.DIFF_Result = Helper.StringToJudgmentStatus(receiveData.Substring(1, 1));
this.CurrentLeakDatas[10].Judgment.DISP_Result = Helper.StringToJudgmentStatus(receiveData.Substring(2, 1));
this.CurrentLeakDatas[10].Judgment.DIFF_SecBufMax = receiveData.Substring(3, 8).Trim();
this.CurrentLeakDatas[10].Judgment.DIFF_SecBufSum = receiveData.Substring(11, 8).Trim();
this.CurrentLeakDatas[10].Judgment.DISP_Min = receiveData.Substring(19, 6).Trim();
this.CurrentLeakDatas[10].Judgment.DISP_MDataMax = receiveData.Substring(25, 6).Trim();
this.CurrentLeakDatas[10].Judgment.DISP_MDataDiff = receiveData.Substring(31, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayJudgmentData11(this.CurrentLeakDatas[10]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
this.ChildFormMenu.UpdateDisplayEquipmentJudgmentData11(this.CurrentLeakDatas[10]);
#endregion
break;
case "L":
#region 12열
#region Value Assign
this.CurrentLeakDatas[11].Judgment.Result = Helper.StringToJudgmentStatus(receiveData.Substring(0, 1));
this.CurrentLeakDatas[11].Judgment.DIFF_Result = Helper.StringToJudgmentStatus(receiveData.Substring(1, 1));
this.CurrentLeakDatas[11].Judgment.DISP_Result = Helper.StringToJudgmentStatus(receiveData.Substring(2, 1));
this.CurrentLeakDatas[11].Judgment.DIFF_SecBufMax = receiveData.Substring(3, 8).Trim();
this.CurrentLeakDatas[11].Judgment.DIFF_SecBufSum = receiveData.Substring(11, 8).Trim();
this.CurrentLeakDatas[11].Judgment.DISP_Min = receiveData.Substring(19, 6).Trim();
this.CurrentLeakDatas[11].Judgment.DISP_MDataMax = receiveData.Substring(25, 6).Trim();
this.CurrentLeakDatas[11].Judgment.DISP_MDataDiff = receiveData.Substring(31, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayJudgmentData12(this.CurrentLeakDatas[11]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
this.ChildFormMenu.UpdateDisplayEquipmentJudgmentData12(this.CurrentLeakDatas[11]);
#endregion
break;
default:
break;
}
if (this.SystemConfig.MODBUS_TCP_SELECTFUNCTION == (int)Define.E_ModbusFunction._16_WriteMultipleRegister)
{
byte[] sendData = this.Modbus.MakeTCPSendAllData(this.Transfer_1_Modbus_Write(), this.SystemConfig.MODBUS_TCP_START_ADDRESS);
this.EthernetWeightDataForModbus(sendData);
}
}
catch
{
ret = -1;
}
return ret;
}
// 진행상태
private int ReceiveCommandSLB_Master(string lane, string receiveData)
{
int ret = 0;
try
{
switch (lane)
{
case "A":
#region Value Assign
this.CurrentLeakDatas[0].ProcessStatus = Helper.StringToProcessStatus(receiveData.Substring(0, 2));
this.CurrentLeakDatas[11].ProcessStatus = Helper.StringToProcessStatus(receiveData.Substring(0, 2));
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
{
// MainDisplay
this.ChildFormMainDisplay.UpdateDisplayProcessStatus(this.CurrentLeakDatas[0].ProcessStatus);
this.ChildFormMainDisplay.UpdateDisplayProcessStatus1(this.CurrentLeakDatas[0].ProcessStatus);
}
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
{
// Equipment
this.ChildFormMenu.UpdateDisplay_Equipment_ProcessStatus(this.CurrentLeakDatas[0].ProcessStatus);
this.ChildFormMenu.UpdateDisplay_Equipment1_ProcessStatusMeasuring1(this.CurrentLeakDatas[0].ProcessStatus, "1");
this.ChildFormMenu.UpdateDisplay_Equipment1_ProcessStatusMeasuring2(this.CurrentLeakDatas[0].ProcessStatus, "12");
}
break;
case "B":
#region Value Assign
this.CurrentLeakDatas[1].ProcessStatus = Helper.StringToProcessStatus(receiveData.Substring(0, 2));
this.CurrentLeakDatas[10].ProcessStatus = Helper.StringToProcessStatus(receiveData.Substring(0, 2));
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
{
// MainDisplay
this.ChildFormMainDisplay.UpdateDisplayProcessStatus(this.CurrentLeakDatas[1].ProcessStatus);
this.ChildFormMainDisplay.UpdateDisplayProcessStatus2(this.CurrentLeakDatas[1].ProcessStatus);
}
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
{
// Equipment
this.ChildFormMenu.UpdateDisplay_Equipment_ProcessStatus(this.CurrentLeakDatas[1].ProcessStatus);
this.ChildFormMenu.UpdateDisplay_Equipment1_ProcessStatusMeasuring1(this.CurrentLeakDatas[1].ProcessStatus, "2");
this.ChildFormMenu.UpdateDisplay_Equipment1_ProcessStatusMeasuring2(this.CurrentLeakDatas[1].ProcessStatus, "11");
}
break;
case "C":
#region Value Assign
this.CurrentLeakDatas[2].ProcessStatus = Helper.StringToProcessStatus(receiveData.Substring(0, 2));
this.CurrentLeakDatas[9].ProcessStatus = Helper.StringToProcessStatus(receiveData.Substring(0, 2));
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
{
// MainDisplay
this.ChildFormMainDisplay.UpdateDisplayProcessStatus(this.CurrentLeakDatas[2].ProcessStatus);
this.ChildFormMainDisplay.UpdateDisplayProcessStatus3(this.CurrentLeakDatas[2].ProcessStatus);
}
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
{
// Equipment
this.ChildFormMenu.UpdateDisplay_Equipment_ProcessStatus(this.CurrentLeakDatas[2].ProcessStatus);
this.ChildFormMenu.UpdateDisplay_Equipment1_ProcessStatusMeasuring1(this.CurrentLeakDatas[2].ProcessStatus, "3");
this.ChildFormMenu.UpdateDisplay_Equipment1_ProcessStatusMeasuring2(this.CurrentLeakDatas[2].ProcessStatus, "10");
}
break;
case "D":
#region Value Assign
this.CurrentLeakDatas[3].ProcessStatus = Helper.StringToProcessStatus(receiveData.Substring(0, 2));
this.CurrentLeakDatas[8].ProcessStatus = Helper.StringToProcessStatus(receiveData.Substring(0, 2));
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
{
// MainDisplay
this.ChildFormMainDisplay.UpdateDisplayProcessStatus(this.CurrentLeakDatas[3].ProcessStatus);
this.ChildFormMainDisplay.UpdateDisplayProcessStatus4(this.CurrentLeakDatas[3].ProcessStatus);
}
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
{
// Equipment
this.ChildFormMenu.UpdateDisplay_Equipment_ProcessStatus(this.CurrentLeakDatas[3].ProcessStatus);
this.ChildFormMenu.UpdateDisplay_Equipment1_ProcessStatusMeasuring1(this.CurrentLeakDatas[3].ProcessStatus, "4");
this.ChildFormMenu.UpdateDisplay_Equipment1_ProcessStatusMeasuring2(this.CurrentLeakDatas[3].ProcessStatus, "9");
}
break;
case "E":
#region Value Assign
this.CurrentLeakDatas[4].ProcessStatus = Helper.StringToProcessStatus(receiveData.Substring(0, 2));
this.CurrentLeakDatas[7].ProcessStatus = Helper.StringToProcessStatus(receiveData.Substring(0, 2));
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
{
// MainDisplay
this.ChildFormMainDisplay.UpdateDisplayProcessStatus(this.CurrentLeakDatas[4].ProcessStatus);
this.ChildFormMainDisplay.UpdateDisplayProcessStatus5(this.CurrentLeakDatas[4].ProcessStatus);
}
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
{
// Equipment
this.ChildFormMenu.UpdateDisplay_Equipment_ProcessStatus(this.CurrentLeakDatas[4].ProcessStatus);
this.ChildFormMenu.UpdateDisplay_Equipment1_ProcessStatusMeasuring1(this.CurrentLeakDatas[4].ProcessStatus, "5");
this.ChildFormMenu.UpdateDisplay_Equipment1_ProcessStatusMeasuring2(this.CurrentLeakDatas[4].ProcessStatus, "8");
}
break;
case "F":
#region Value Assign
this.CurrentLeakDatas[5].ProcessStatus = Helper.StringToProcessStatus(receiveData.Substring(0, 2));
this.CurrentLeakDatas[6].ProcessStatus = Helper.StringToProcessStatus(receiveData.Substring(0, 2));
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
{
// MainDisplay
this.ChildFormMainDisplay.UpdateDisplayProcessStatus(this.CurrentLeakDatas[5].ProcessStatus);
this.ChildFormMainDisplay.UpdateDisplayProcessStatus6(this.CurrentLeakDatas[5].ProcessStatus);
}
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
{
// Equipment
this.ChildFormMenu.UpdateDisplay_Equipment_ProcessStatus(this.CurrentLeakDatas[5].ProcessStatus);
this.ChildFormMenu.UpdateDisplay_Equipment1_ProcessStatusMeasuring1(this.CurrentLeakDatas[5].ProcessStatus, "6");
this.ChildFormMenu.UpdateDisplay_Equipment1_ProcessStatusMeasuring2(this.CurrentLeakDatas[5].ProcessStatus, "7");
}
break;
case "G":
break;
case "H":
break;
case "I":
break;
case "J":
break;
default:
break;
}
}
catch
{
ret = -1;
}
return ret;
}
// 차압 센서 데이터
private int ReceiveCommandSLC_Master(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.SecBuf = receiveData.Substring(8, 8).Trim();
this.CurrentLeakDatas[0].DiffData.SecBufSum = receiveData.Substring(16, 8).Trim();
this.CurrentLeakDatas[0].DiffData.SecBufMax = receiveData.Substring(24, 8).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDiffData1(this.CurrentLeakDatas[0]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
{
this.ChildFormMenu.UpdateDisplayIOTestDiffDataSlave(this.CurrentLeakDatas[0]);
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.SecBuf = receiveData.Substring(8, 8).Trim();
this.CurrentLeakDatas[1].DiffData.SecBufSum = receiveData.Substring(16, 8).Trim();
this.CurrentLeakDatas[1].DiffData.SecBufMax = receiveData.Substring(24, 8).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDiffData2(this.CurrentLeakDatas[1]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.SecBuf = receiveData.Substring(8, 8).Trim();
this.CurrentLeakDatas[2].DiffData.SecBufSum = receiveData.Substring(16, 8).Trim();
this.CurrentLeakDatas[2].DiffData.SecBufMax = receiveData.Substring(24, 8).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDiffData3(this.CurrentLeakDatas[2]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.SecBuf = receiveData.Substring(8, 8).Trim();
this.CurrentLeakDatas[3].DiffData.SecBufSum = receiveData.Substring(16, 8).Trim();
this.CurrentLeakDatas[3].DiffData.SecBufMax = receiveData.Substring(24, 8).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDiffData4(this.CurrentLeakDatas[3]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.SecBuf = receiveData.Substring(8, 8).Trim();
this.CurrentLeakDatas[4].DiffData.SecBufSum = receiveData.Substring(16, 8).Trim();
this.CurrentLeakDatas[4].DiffData.SecBufMax = receiveData.Substring(24, 8).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDiffData5(this.CurrentLeakDatas[4]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.SecBuf = receiveData.Substring(8, 8).Trim();
this.CurrentLeakDatas[5].DiffData.SecBufSum = receiveData.Substring(16, 8).Trim();
this.CurrentLeakDatas[5].DiffData.SecBufMax = receiveData.Substring(24, 8).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDiffData6(this.CurrentLeakDatas[5]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.SecBuf = receiveData.Substring(8, 8).Trim();
this.CurrentLeakDatas[6].DiffData.SecBufSum = receiveData.Substring(16, 8).Trim();
this.CurrentLeakDatas[6].DiffData.SecBufMax = receiveData.Substring(24, 8).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDiffData7(this.CurrentLeakDatas[6]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.SecBuf = receiveData.Substring(8, 8).Trim();
this.CurrentLeakDatas[7].DiffData.SecBufSum = receiveData.Substring(16, 8).Trim();
this.CurrentLeakDatas[7].DiffData.SecBufMax = receiveData.Substring(24, 8).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDiffData8(this.CurrentLeakDatas[7]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.SecBuf = receiveData.Substring(8, 8).Trim();
this.CurrentLeakDatas[8].DiffData.SecBufSum = receiveData.Substring(16, 8).Trim();
this.CurrentLeakDatas[8].DiffData.SecBufMax = receiveData.Substring(24, 8).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDiffData9(this.CurrentLeakDatas[8]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.SecBuf = receiveData.Substring(8, 8).Trim();
this.CurrentLeakDatas[9].DiffData.SecBufSum = receiveData.Substring(16, 8).Trim();
this.CurrentLeakDatas[9].DiffData.SecBufMax = receiveData.Substring(24, 8).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDiffData10(this.CurrentLeakDatas[9]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
this.ChildFormMenu.UpdateDisplayEquipmentDiffData10(this.CurrentLeakDatas[9]);
#endregion
break;
case "K":
#region 11열
#region Value Assign
this.CurrentLeakDatas[10].DiffData.MAdc = receiveData.Substring(0, 8).Trim();
this.CurrentLeakDatas[10].DiffData.SecBuf = receiveData.Substring(8, 8).Trim();
this.CurrentLeakDatas[10].DiffData.SecBufSum = receiveData.Substring(16, 8).Trim();
this.CurrentLeakDatas[10].DiffData.SecBufMax = receiveData.Substring(24, 8).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDiffData11(this.CurrentLeakDatas[10]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
this.ChildFormMenu.UpdateDisplayEquipmentDiffData11(this.CurrentLeakDatas[10]);
#endregion
break;
case "L":
#region 12열
#region Value Assign
this.CurrentLeakDatas[11].DiffData.MAdc = receiveData.Substring(0, 8).Trim();
this.CurrentLeakDatas[11].DiffData.SecBuf = receiveData.Substring(8, 8).Trim();
this.CurrentLeakDatas[11].DiffData.SecBufSum = receiveData.Substring(16, 8).Trim();
this.CurrentLeakDatas[11].DiffData.SecBufMax = receiveData.Substring(24, 8).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDiffData12(this.CurrentLeakDatas[11]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
{
this.ChildFormMenu.UpdateDisplayIOTestDiffDataMaster(this.CurrentLeakDatas[11]);
this.ChildFormMenu.UpdateDisplayEquipmentDiffData12(this.CurrentLeakDatas[11]);
}
#endregion
break;
default:
break;
}
}
catch
{
ret = -1;
}
return ret;
}
// 변위 센서 데이터
private int ReceiveCommandSLD_Master(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.MDataMax = receiveData.Substring(18, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDispData1(this.CurrentLeakDatas[0]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
{
this.ChildFormMenu.UpdateDisplayIOTestDispDataSlave(this.CurrentLeakDatas[0]);
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.MDataMax = receiveData.Substring(18, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDispData2(this.CurrentLeakDatas[1]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.MDataMax = receiveData.Substring(18, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDispData3(this.CurrentLeakDatas[2]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.MDataMax = receiveData.Substring(18, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDispData4(this.CurrentLeakDatas[3]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.MDataMax = receiveData.Substring(18, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDispData5(this.CurrentLeakDatas[4]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.MDataMax = receiveData.Substring(18, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDispData6(this.CurrentLeakDatas[5]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.MDataMax = receiveData.Substring(18, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDispData7(this.CurrentLeakDatas[6]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.MDataMax = receiveData.Substring(18, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDispData8(this.CurrentLeakDatas[7]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.MDataMax = receiveData.Substring(18, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDispData9(this.CurrentLeakDatas[8]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.MDataMax = receiveData.Substring(18, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDispData10(this.CurrentLeakDatas[9]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
this.ChildFormMenu.UpdateDisplayEquipmentDispData10(this.CurrentLeakDatas[9]);
#endregion
break;
case "K":
#region 11열
#region Value Assign
this.CurrentLeakDatas[10].DispData.RData = receiveData.Substring(0, 6).Trim();
this.CurrentLeakDatas[10].DispData.MData = receiveData.Substring(6, 6).Trim();
this.CurrentLeakDatas[10].DispData.MDataDiff = receiveData.Substring(12, 6).Trim();
this.CurrentLeakDatas[10].DispData.MDataMax = receiveData.Substring(18, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDispData11(this.CurrentLeakDatas[10]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
this.ChildFormMenu.UpdateDisplayEquipmentDispData11(this.CurrentLeakDatas[10]);
#endregion
break;
case "L":
#region 12열
#region Value Assign
this.CurrentLeakDatas[11].DispData.RData = receiveData.Substring(0, 6).Trim();
this.CurrentLeakDatas[11].DispData.MData = receiveData.Substring(6, 6).Trim();
this.CurrentLeakDatas[11].DispData.MDataDiff = receiveData.Substring(12, 6).Trim();
this.CurrentLeakDatas[11].DispData.MDataMax = receiveData.Substring(18, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDispData12(this.CurrentLeakDatas[11]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
{
this.ChildFormMenu.UpdateDisplayIOTestDispDataMaster(this.CurrentLeakDatas[11]);
this.ChildFormMenu.UpdateDisplayEquipmentDispData12(this.CurrentLeakDatas[11]);
}
#endregion
break;
default:
break;
}
}
catch
{
ret = -1;
}
return ret;
}
// 압력 데이터
private int ReceiveCommandSLE_Master(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.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayPresData1(this.CurrentLeakDatas[0]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
{
this.ChildFormMenu.UpdateDisplayIOTestPresDataSlave(this.CurrentLeakDatas[0]);
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.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayPresData2(this.CurrentLeakDatas[1]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayPresData3(this.CurrentLeakDatas[2]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayPresData4(this.CurrentLeakDatas[3]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayPresData5(this.CurrentLeakDatas[4]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayPresData6(this.CurrentLeakDatas[5]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayPresData7(this.CurrentLeakDatas[6]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayPresData8(this.CurrentLeakDatas[7]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayPresData9(this.CurrentLeakDatas[8]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayPresData10(this.CurrentLeakDatas[9]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
this.ChildFormMenu.UpdateDisplayEquipmentPresData10(this.CurrentLeakDatas[9]);
#endregion
break;
case "K":
#region 11열
#region Value Assign
this.CurrentLeakDatas[10].PresData.WorkingChamber =
string.Format("{0}{1}", receiveData.Substring(0, 1), receiveData.Substring(1, 5).Trim());
this.CurrentLeakDatas[10].PresData.MasterChamber =
string.Format("{0}{1}", receiveData.Substring(6, 1), receiveData.Substring(7, 5).Trim());
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayPresData11(this.CurrentLeakDatas[10]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
this.ChildFormMenu.UpdateDisplayEquipmentPresData11(this.CurrentLeakDatas[10]);
#endregion
break;
case "L":
#region 12열
#region Value Assign
this.CurrentLeakDatas[11].PresData.WorkingChamber =
string.Format("{0}{1}", receiveData.Substring(0, 1), receiveData.Substring(1, 5).Trim());
this.CurrentLeakDatas[11].PresData.MasterChamber =
string.Format("{0}{1}", receiveData.Substring(6, 1), receiveData.Substring(7, 5).Trim());
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayPresData12(this.CurrentLeakDatas[11]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
{
this.ChildFormMenu.UpdateDisplayIOTestPresDataMaster(this.CurrentLeakDatas[11]);
this.ChildFormMenu.UpdateDisplayEquipmentPresData12(this.CurrentLeakDatas[11]);
}
#endregion
break;
default:
break;
}
}
catch
{
ret = -1;
}
return ret;
}
// IO테스트-IN
private int ReceiveCommandST0_Master(string lane, string receiveData)
{
int ret = 0;
switch (lane)
{
case "0":
#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.UpdateDisplayIOTestInputDataMaster(this.CollectionIOTest_InputData);
break;
case "1":
#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.UpdateDisplayIOTestInputDataSlave(this.CollectionIOTest_InputData);
break;
default:
break;
}
return ret;
}
// 알람
private int ReceiveCommandSA0_Master(string lane, string receiveData)
{
int ret = 0;
switch (lane)
{
case "Z":
#region Value Assign
this.CurrentAlarmList.SetAlarmMaster(receiveData.Substring(0, 8));
#endregion
this.ChildFormMainDisplay.UpdateDisplayAlarmView(this.CurrentAlarmList);
this.ChildFormMenu.UpdateDisplayIOTestAlarmView(this.CurrentAlarmList);
this.ChildFormMenu.UpdateDisplayAlarmView(this.CurrentAlarmList);
break;
default:
break;
}
return ret;
}
#endregion
#region Slave
public int TransferData_Slave(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);
// Serial Write
if (this.FlagDllSerial == true)
SerialMgrComm.serialPortMessage(this.ComPortMainToLCD, sb.ToString());
else
{
if (this.smartSerialPortSlave.IsOpen == true)
this.smartSerialPortSlave.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_Slave(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);
// Serial Write
if (this.FlagDllSerial == true)
SerialMgrComm.serialPortMessage(this.ComPortMainToLCD, sb.ToString());
else
{
if (this.smartSerialPortSlave.IsOpen == true)
this.smartSerialPortSlave.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_Slave(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);
// Serial Write
if (this.FlagDllSerial == true)
SerialMgrComm.serialPortMessage(this.ComPortMainToLCD, sb.ToString());
else
{
if (this.smartSerialPortSlave.IsOpen == true)
this.smartSerialPortSlave.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_Slave(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);
// Serial Write
if (this.FlagDllSerial == true)
SerialMgrComm.serialPortMessage(this.ComPortMainToLCD, sb.ToString());
else
{
if (this.smartSerialPortSlave.IsOpen == true)
this.smartSerialPortSlave.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_Slave()
{
int ret = 0;
string strTemp = "";
byte[] readByte;
SmartSerialPort.FRAMEDATAREADSTATUS receiveDataState = SmartSerialPort.FRAMEDATAREADSTATUS.EMPTY;
try
{
receiveDataState = this.smartSerialPortSlave.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_Slave(strTemp)) != 0)
return;
break;
case 'P':
if ((ret = this.ReceiveCommandP_Slave(strTemp)) != 0)
return;
break;
case 'S':
if ((ret = this.ReceiveCommandS_Slave(strTemp)) != 0)
return;
break;
default:
break;
}
}
catch
{
}
}
private int ReceiveCommandC_Slave(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.TransferData_Master(CommunicationCommand.Stop, CommunicationID.MainBoardMaster);
this.TransferSystemParameter9039(Define.E_BoardMode.Slave);
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_Slave(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_Slave(lane, address, receiveData)) != 0)
return ret = -1;
break;
case "PW0":
if ((ret = this.ReceiveCommandPW0_Slave(lane, address, receiveData)) != 0)
return ret = -1;
break;
default:
break;
}
return ret;
}
private int ReceiveCommandS_Slave(string strTemp)
{
int ret = 0;
string cmd = "", retryCNT = "", 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);
retryCNT = strTemp.Substring(4, 1);
lane = strTemp.Substring(5, 1);
receiveData = strTemp.Substring(10, strTemp.Length - 12);
switch (cmd)
{
case "SLA":
if ((ret = this.ReceiveCommandSLA_Slave(lane, retryCNT, receiveData)) != 0)
return ret;
break;
case "SLB":
if ((ret = this.ReceiveCommandSLB_Slave(lane, receiveData)) != 0)
return ret;
break;
case "SLC":
if ((ret = this.ReceiveCommandSLC_Slave(lane, receiveData)) != 0)
return ret;
break;
case "SLD":
if ((ret = this.ReceiveCommandSLD_Slave(lane, receiveData)) != 0)
return ret;
break;
case "SLE":
if ((ret = this.ReceiveCommandSLE_Slave(lane, receiveData)) != 0)
return ret;
break;
case "ST0":
if ((ret = this.ReceiveCommandST0_Slave(lane, receiveData)) != 0)
return ret;
break;
case "SA0":
if ((ret = this.ReceiveCommandSA0_Slave(lane, receiveData)) != 0)
return ret;
break;
default:
break;
}
return ret;
}
// 파라미터 읽기 응답
private int ReceiveCommandPR0_Slave(string lane, string address, string receiveData)
{
int ret = 0, iValue = 0;
try
{
switch (address)
{
case "1502":
switch (lane)
{
//case "0":
// #region Value Assign
// this.SystemConfig.MAINBOARD_VERSION_MASTER = receiveData;
// #endregion
// this.ChildFormMenu.UpdateMainBoardVersionMasterDisplay(this.SystemConfig.MAINBOARD_VERSION_MASTER);
// break;
case "1":
#region Value Assign
this.SystemConfig.MAINBOARD_VERSION_SLAVE = receiveData;
#endregion
this.ChildFormMenu.UpdateMainBoardVersionSlaveDisplay(this.SystemConfig.MAINBOARD_VERSION_SLAVE);
break;
default:
break;
}
break;
case "2001":
#region Value Assign
iValue = int.Parse(receiveData);
if (iValue <= 0 || iValue > 1000)
return ret = -1;
this.SystemConfig.RECIPE_NUMBER = iValue;
this.ChangeModeRecipe = false;
#endregion
this.SaveSystemConfigurationFile(this.SystemConfig);
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_Slave(string lane, string address, string receiveData)
{
int ret = 0;
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, Define.E_BoardMode.Slave);
break;
case "9043":
if (response == Define.E_ResponseData.ACK)
this.TransferDataStream_Slave(CommunicationCommand.Read, CommunicationID.MainBoardMaster, CommunicationAddress._2001_ProductNumber, "");
break;
default:
break;
}
}
catch
{
ret = -1;
}
return ret;
}
// 판정 데이터
private int ReceiveCommandSLA_Slave(string lane, string retryCNT, string receiveData)
{
int ret = 0;
try
{
// 응답
this.TransferData_Master(string.Format("{0}{1}0{2}", CommunicationCommand.Respone, 1, retryCNT), lane);
switch (lane)
{
case "A":
#region 1열
#region Value Assign
this.CurrentLeakDatas[0].Judgment.Result = Helper.StringToJudgmentStatus(receiveData.Substring(0, 1));
this.CurrentLeakDatas[0].Judgment.DIFF_Result = Helper.StringToJudgmentStatus(receiveData.Substring(1, 1));
this.CurrentLeakDatas[0].Judgment.DISP_Result = Helper.StringToJudgmentStatus(receiveData.Substring(2, 1));
this.CurrentLeakDatas[0].Judgment.DIFF_SecBufMax = receiveData.Substring(3, 8).Trim();
this.CurrentLeakDatas[0].Judgment.DIFF_SecBufSum = receiveData.Substring(11, 8).Trim();
this.CurrentLeakDatas[0].Judgment.DISP_Min = receiveData.Substring(19, 6).Trim();
this.CurrentLeakDatas[0].Judgment.DISP_MDataMax = receiveData.Substring(25, 6).Trim();
this.CurrentLeakDatas[0].Judgment.DISP_MDataDiff = receiveData.Substring(31, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayJudgmentData1(this.CurrentLeakDatas[0]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
this.ChildFormMenu.UpdateDisplayEquipmentJudgmentData1(this.CurrentLeakDatas[0]);
#endregion
break;
case "B":
#region 2열
#region Value Assign
this.CurrentLeakDatas[1].Judgment.Result = Helper.StringToJudgmentStatus(receiveData.Substring(0, 1));
this.CurrentLeakDatas[1].Judgment.DIFF_Result = Helper.StringToJudgmentStatus(receiveData.Substring(1, 1));
this.CurrentLeakDatas[1].Judgment.DISP_Result = Helper.StringToJudgmentStatus(receiveData.Substring(2, 1));
this.CurrentLeakDatas[1].Judgment.DIFF_SecBufMax = receiveData.Substring(3, 8).Trim();
this.CurrentLeakDatas[1].Judgment.DIFF_SecBufSum = receiveData.Substring(11, 8).Trim();
this.CurrentLeakDatas[1].Judgment.DISP_Min = receiveData.Substring(19, 6).Trim();
this.CurrentLeakDatas[1].Judgment.DISP_MDataMax = receiveData.Substring(25, 6).Trim();
this.CurrentLeakDatas[1].Judgment.DISP_MDataDiff = receiveData.Substring(31, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayJudgmentData2(this.CurrentLeakDatas[1]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
this.ChildFormMenu.UpdateDisplayEquipmentJudgmentData2(this.CurrentLeakDatas[1]);
#endregion
break;
case "C":
#region 3열
#region Value Assign
this.CurrentLeakDatas[2].Judgment.Result = Helper.StringToJudgmentStatus(receiveData.Substring(0, 1));
this.CurrentLeakDatas[2].Judgment.DIFF_Result = Helper.StringToJudgmentStatus(receiveData.Substring(1, 1));
this.CurrentLeakDatas[2].Judgment.DISP_Result = Helper.StringToJudgmentStatus(receiveData.Substring(2, 1));
this.CurrentLeakDatas[2].Judgment.DIFF_SecBufMax = receiveData.Substring(3, 8).Trim();
this.CurrentLeakDatas[2].Judgment.DIFF_SecBufSum = receiveData.Substring(11, 8).Trim();
this.CurrentLeakDatas[2].Judgment.DISP_Min = receiveData.Substring(19, 6).Trim();
this.CurrentLeakDatas[2].Judgment.DISP_MDataMax = receiveData.Substring(25, 6).Trim();
this.CurrentLeakDatas[2].Judgment.DISP_MDataDiff = receiveData.Substring(31, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayJudgmentData3(this.CurrentLeakDatas[2]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
this.ChildFormMenu.UpdateDisplayEquipmentJudgmentData3(this.CurrentLeakDatas[2]);
#endregion
break;
case "D":
#region 4열
#region Value Assign
this.CurrentLeakDatas[3].Judgment.Result = Helper.StringToJudgmentStatus(receiveData.Substring(0, 1));
this.CurrentLeakDatas[3].Judgment.DIFF_Result = Helper.StringToJudgmentStatus(receiveData.Substring(1, 1));
this.CurrentLeakDatas[3].Judgment.DISP_Result = Helper.StringToJudgmentStatus(receiveData.Substring(2, 1));
this.CurrentLeakDatas[3].Judgment.DIFF_SecBufMax = receiveData.Substring(3, 8).Trim();
this.CurrentLeakDatas[3].Judgment.DIFF_SecBufSum = receiveData.Substring(11, 8).Trim();
this.CurrentLeakDatas[3].Judgment.DISP_Min = receiveData.Substring(19, 6).Trim();
this.CurrentLeakDatas[3].Judgment.DISP_MDataMax = receiveData.Substring(25, 6).Trim();
this.CurrentLeakDatas[3].Judgment.DISP_MDataDiff = receiveData.Substring(31, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayJudgmentData4(this.CurrentLeakDatas[3]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
this.ChildFormMenu.UpdateDisplayEquipmentJudgmentData4(this.CurrentLeakDatas[3]);
#endregion
break;
case "E":
#region 5열
#region Value Assign
this.CurrentLeakDatas[4].Judgment.Result = Helper.StringToJudgmentStatus(receiveData.Substring(0, 1));
this.CurrentLeakDatas[4].Judgment.DIFF_Result = Helper.StringToJudgmentStatus(receiveData.Substring(1, 1));
this.CurrentLeakDatas[4].Judgment.DISP_Result = Helper.StringToJudgmentStatus(receiveData.Substring(2, 1));
this.CurrentLeakDatas[4].Judgment.DIFF_SecBufMax = receiveData.Substring(3, 8).Trim();
this.CurrentLeakDatas[4].Judgment.DIFF_SecBufSum = receiveData.Substring(11, 8).Trim();
this.CurrentLeakDatas[4].Judgment.DISP_Min = receiveData.Substring(19, 6).Trim();
this.CurrentLeakDatas[4].Judgment.DISP_MDataMax = receiveData.Substring(25, 6).Trim();
this.CurrentLeakDatas[4].Judgment.DISP_MDataDiff = receiveData.Substring(31, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayJudgmentData5(this.CurrentLeakDatas[4]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
this.ChildFormMenu.UpdateDisplayEquipmentJudgmentData5(this.CurrentLeakDatas[4]);
#endregion
break;
case "F":
#region 6열
#region Value Assign
this.CurrentLeakDatas[5].Judgment.Result = Helper.StringToJudgmentStatus(receiveData.Substring(0, 1));
this.CurrentLeakDatas[5].Judgment.DIFF_Result = Helper.StringToJudgmentStatus(receiveData.Substring(1, 1));
this.CurrentLeakDatas[5].Judgment.DISP_Result = Helper.StringToJudgmentStatus(receiveData.Substring(2, 1));
this.CurrentLeakDatas[5].Judgment.DIFF_SecBufMax = receiveData.Substring(3, 8).Trim();
this.CurrentLeakDatas[5].Judgment.DIFF_SecBufSum = receiveData.Substring(11, 8).Trim();
this.CurrentLeakDatas[5].Judgment.DISP_Min = receiveData.Substring(19, 6).Trim();
this.CurrentLeakDatas[5].Judgment.DISP_MDataMax = receiveData.Substring(25, 6).Trim();
this.CurrentLeakDatas[5].Judgment.DISP_MDataDiff = receiveData.Substring(31, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayJudgmentData6(this.CurrentLeakDatas[5]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
this.ChildFormMenu.UpdateDisplayEquipmentJudgmentData6(this.CurrentLeakDatas[5]);
#endregion
break;
case "G":
#region 7열
#region Value Assign
this.CurrentLeakDatas[6].Judgment.Result = Helper.StringToJudgmentStatus(receiveData.Substring(0, 1));
this.CurrentLeakDatas[6].Judgment.DIFF_Result = Helper.StringToJudgmentStatus(receiveData.Substring(1, 1));
this.CurrentLeakDatas[6].Judgment.DISP_Result = Helper.StringToJudgmentStatus(receiveData.Substring(2, 1));
this.CurrentLeakDatas[6].Judgment.DIFF_SecBufMax = receiveData.Substring(3, 8).Trim();
this.CurrentLeakDatas[6].Judgment.DIFF_SecBufSum = receiveData.Substring(11, 8).Trim();
this.CurrentLeakDatas[6].Judgment.DISP_Min = receiveData.Substring(19, 6).Trim();
this.CurrentLeakDatas[6].Judgment.DISP_MDataMax = receiveData.Substring(25, 6).Trim();
this.CurrentLeakDatas[6].Judgment.DISP_MDataDiff = receiveData.Substring(31, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayJudgmentData7(this.CurrentLeakDatas[6]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
this.ChildFormMenu.UpdateDisplayEquipmentJudgmentData7(this.CurrentLeakDatas[6]);
#endregion
break;
case "H":
#region 8열
#region Value Assign
this.CurrentLeakDatas[7].Judgment.Result = Helper.StringToJudgmentStatus(receiveData.Substring(0, 1));
this.CurrentLeakDatas[7].Judgment.DIFF_Result = Helper.StringToJudgmentStatus(receiveData.Substring(1, 1));
this.CurrentLeakDatas[7].Judgment.DISP_Result = Helper.StringToJudgmentStatus(receiveData.Substring(2, 1));
this.CurrentLeakDatas[7].Judgment.DIFF_SecBufMax = receiveData.Substring(3, 8).Trim();
this.CurrentLeakDatas[7].Judgment.DIFF_SecBufSum = receiveData.Substring(11, 8).Trim();
this.CurrentLeakDatas[7].Judgment.DISP_Min = receiveData.Substring(19, 6).Trim();
this.CurrentLeakDatas[7].Judgment.DISP_MDataMax = receiveData.Substring(25, 6).Trim();
this.CurrentLeakDatas[7].Judgment.DISP_MDataDiff = receiveData.Substring(31, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayJudgmentData8(this.CurrentLeakDatas[7]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
this.ChildFormMenu.UpdateDisplayEquipmentJudgmentData8(this.CurrentLeakDatas[7]);
#endregion
break;
case "I":
#region 9열
#region Value Assign
this.CurrentLeakDatas[8].Judgment.Result = Helper.StringToJudgmentStatus(receiveData.Substring(0, 1));
this.CurrentLeakDatas[8].Judgment.DIFF_Result = Helper.StringToJudgmentStatus(receiveData.Substring(1, 1));
this.CurrentLeakDatas[8].Judgment.DISP_Result = Helper.StringToJudgmentStatus(receiveData.Substring(2, 1));
this.CurrentLeakDatas[8].Judgment.DIFF_SecBufMax = receiveData.Substring(3, 8).Trim();
this.CurrentLeakDatas[8].Judgment.DIFF_SecBufSum = receiveData.Substring(11, 8).Trim();
this.CurrentLeakDatas[8].Judgment.DISP_Min = receiveData.Substring(19, 6).Trim();
this.CurrentLeakDatas[8].Judgment.DISP_MDataMax = receiveData.Substring(25, 6).Trim();
this.CurrentLeakDatas[8].Judgment.DISP_MDataDiff = receiveData.Substring(31, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayJudgmentData9(this.CurrentLeakDatas[8]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
this.ChildFormMenu.UpdateDisplayEquipmentJudgmentData9(this.CurrentLeakDatas[8]);
#endregion
break;
case "J":
#region 10열
#region Value Assign
this.CurrentLeakDatas[9].Judgment.Result = Helper.StringToJudgmentStatus(receiveData.Substring(0, 1));
this.CurrentLeakDatas[9].Judgment.DIFF_Result = Helper.StringToJudgmentStatus(receiveData.Substring(1, 1));
this.CurrentLeakDatas[9].Judgment.DISP_Result = Helper.StringToJudgmentStatus(receiveData.Substring(2, 1));
this.CurrentLeakDatas[9].Judgment.DIFF_SecBufMax = receiveData.Substring(3, 8).Trim();
this.CurrentLeakDatas[9].Judgment.DIFF_SecBufSum = receiveData.Substring(11, 8).Trim();
this.CurrentLeakDatas[9].Judgment.DISP_Min = receiveData.Substring(19, 6).Trim();
this.CurrentLeakDatas[9].Judgment.DISP_MDataMax = receiveData.Substring(25, 6).Trim();
this.CurrentLeakDatas[9].Judgment.DISP_MDataDiff = receiveData.Substring(31, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayJudgmentData10(this.CurrentLeakDatas[9]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
this.ChildFormMenu.UpdateDisplayEquipmentJudgmentData10(this.CurrentLeakDatas[9]);
#endregion
break;
case "K":
#region 11열
#region Value Assign
this.CurrentLeakDatas[10].Judgment.Result = Helper.StringToJudgmentStatus(receiveData.Substring(0, 1));
this.CurrentLeakDatas[10].Judgment.DIFF_Result = Helper.StringToJudgmentStatus(receiveData.Substring(1, 1));
this.CurrentLeakDatas[10].Judgment.DISP_Result = Helper.StringToJudgmentStatus(receiveData.Substring(2, 1));
this.CurrentLeakDatas[10].Judgment.DIFF_SecBufMax = receiveData.Substring(3, 8).Trim();
this.CurrentLeakDatas[10].Judgment.DIFF_SecBufSum = receiveData.Substring(11, 8).Trim();
this.CurrentLeakDatas[10].Judgment.DISP_Min = receiveData.Substring(19, 6).Trim();
this.CurrentLeakDatas[10].Judgment.DISP_MDataMax = receiveData.Substring(25, 6).Trim();
this.CurrentLeakDatas[10].Judgment.DISP_MDataDiff = receiveData.Substring(31, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayJudgmentData11(this.CurrentLeakDatas[10]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
this.ChildFormMenu.UpdateDisplayEquipmentJudgmentData11(this.CurrentLeakDatas[10]);
#endregion
break;
case "L":
#region 12열
#region Value Assign
this.CurrentLeakDatas[11].Judgment.Result = Helper.StringToJudgmentStatus(receiveData.Substring(0, 1));
this.CurrentLeakDatas[11].Judgment.DIFF_Result = Helper.StringToJudgmentStatus(receiveData.Substring(1, 1));
this.CurrentLeakDatas[11].Judgment.DISP_Result = Helper.StringToJudgmentStatus(receiveData.Substring(2, 1));
this.CurrentLeakDatas[11].Judgment.DIFF_SecBufMax = receiveData.Substring(3, 8).Trim();
this.CurrentLeakDatas[11].Judgment.DIFF_SecBufSum = receiveData.Substring(11, 8).Trim();
this.CurrentLeakDatas[11].Judgment.DISP_Min = receiveData.Substring(19, 6).Trim();
this.CurrentLeakDatas[11].Judgment.DISP_MDataMax = receiveData.Substring(25, 6).Trim();
this.CurrentLeakDatas[11].Judgment.DISP_MDataDiff = receiveData.Substring(31, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayJudgmentData12(this.CurrentLeakDatas[11]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
this.ChildFormMenu.UpdateDisplayEquipmentJudgmentData12(this.CurrentLeakDatas[11]);
#endregion
break;
default:
break;
}
if (this.SystemConfig.MODBUS_TCP_SELECTFUNCTION == (int)Define.E_ModbusFunction._16_WriteMultipleRegister)
{
byte[] sendData = this.Modbus.MakeTCPSendAllData(this.Transfer_1_Modbus_Write(), this.SystemConfig.MODBUS_TCP_START_ADDRESS);
this.EthernetWeightDataForModbus(sendData);
}
}
catch
{
ret = -1;
}
return ret;
}
// 진행상태
private int ReceiveCommandSLB_Slave(string lane, string receiveData)
{
int ret = 0;
try
{
switch (lane)
{
case "A":
#region Value Assign
this.CurrentLeakDatas[0].ProcessStatus = Helper.StringToProcessStatus(receiveData.Substring(0, 2));
this.CurrentLeakDatas[11].ProcessStatus = Helper.StringToProcessStatus(receiveData.Substring(0, 2));
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
{
// MainDisplay
this.ChildFormMainDisplay.UpdateDisplayProcessStatus(this.CurrentLeakDatas[0].ProcessStatus);
this.ChildFormMainDisplay.UpdateDisplayProcessStatus1(this.CurrentLeakDatas[0].ProcessStatus);
}
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
{
// Equipment
this.ChildFormMenu.UpdateDisplay_Equipment_ProcessStatus(this.CurrentLeakDatas[0].ProcessStatus);
this.ChildFormMenu.UpdateDisplay_Equipment1_ProcessStatusMeasuring1(this.CurrentLeakDatas[0].ProcessStatus, "1");
this.ChildFormMenu.UpdateDisplay_Equipment1_ProcessStatusMeasuring2(this.CurrentLeakDatas[0].ProcessStatus, "12");
}
break;
case "B":
#region Value Assign
this.CurrentLeakDatas[1].ProcessStatus = Helper.StringToProcessStatus(receiveData.Substring(0, 2));
this.CurrentLeakDatas[10].ProcessStatus = Helper.StringToProcessStatus(receiveData.Substring(0, 2));
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
{
// MainDisplay
this.ChildFormMainDisplay.UpdateDisplayProcessStatus(this.CurrentLeakDatas[1].ProcessStatus);
this.ChildFormMainDisplay.UpdateDisplayProcessStatus2(this.CurrentLeakDatas[1].ProcessStatus);
}
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
{
// Equipment
this.ChildFormMenu.UpdateDisplay_Equipment_ProcessStatus(this.CurrentLeakDatas[1].ProcessStatus);
this.ChildFormMenu.UpdateDisplay_Equipment1_ProcessStatusMeasuring1(this.CurrentLeakDatas[1].ProcessStatus, "2");
this.ChildFormMenu.UpdateDisplay_Equipment1_ProcessStatusMeasuring2(this.CurrentLeakDatas[1].ProcessStatus, "11");
}
break;
case "C":
#region Value Assign
this.CurrentLeakDatas[2].ProcessStatus = Helper.StringToProcessStatus(receiveData.Substring(0, 2));
this.CurrentLeakDatas[9].ProcessStatus = Helper.StringToProcessStatus(receiveData.Substring(0, 2));
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
{
// MainDisplay
this.ChildFormMainDisplay.UpdateDisplayProcessStatus(this.CurrentLeakDatas[2].ProcessStatus);
this.ChildFormMainDisplay.UpdateDisplayProcessStatus3(this.CurrentLeakDatas[2].ProcessStatus);
}
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
{
// Equipment
this.ChildFormMenu.UpdateDisplay_Equipment_ProcessStatus(this.CurrentLeakDatas[2].ProcessStatus);
this.ChildFormMenu.UpdateDisplay_Equipment1_ProcessStatusMeasuring1(this.CurrentLeakDatas[2].ProcessStatus, "3");
this.ChildFormMenu.UpdateDisplay_Equipment1_ProcessStatusMeasuring2(this.CurrentLeakDatas[2].ProcessStatus, "10");
}
break;
case "D":
#region Value Assign
this.CurrentLeakDatas[3].ProcessStatus = Helper.StringToProcessStatus(receiveData.Substring(0, 2));
this.CurrentLeakDatas[8].ProcessStatus = Helper.StringToProcessStatus(receiveData.Substring(0, 2));
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
{
// MainDisplay
this.ChildFormMainDisplay.UpdateDisplayProcessStatus(this.CurrentLeakDatas[3].ProcessStatus);
this.ChildFormMainDisplay.UpdateDisplayProcessStatus4(this.CurrentLeakDatas[3].ProcessStatus);
}
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
{
// Equipment
this.ChildFormMenu.UpdateDisplay_Equipment_ProcessStatus(this.CurrentLeakDatas[3].ProcessStatus);
this.ChildFormMenu.UpdateDisplay_Equipment1_ProcessStatusMeasuring1(this.CurrentLeakDatas[3].ProcessStatus, "4");
this.ChildFormMenu.UpdateDisplay_Equipment1_ProcessStatusMeasuring2(this.CurrentLeakDatas[3].ProcessStatus, "9");
}
break;
case "E":
#region Value Assign
this.CurrentLeakDatas[4].ProcessStatus = Helper.StringToProcessStatus(receiveData.Substring(0, 2));
this.CurrentLeakDatas[7].ProcessStatus = Helper.StringToProcessStatus(receiveData.Substring(0, 2));
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
{
// MainDisplay
this.ChildFormMainDisplay.UpdateDisplayProcessStatus(this.CurrentLeakDatas[4].ProcessStatus);
this.ChildFormMainDisplay.UpdateDisplayProcessStatus5(this.CurrentLeakDatas[4].ProcessStatus);
}
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
{
// Equipment
this.ChildFormMenu.UpdateDisplay_Equipment_ProcessStatus(this.CurrentLeakDatas[4].ProcessStatus);
this.ChildFormMenu.UpdateDisplay_Equipment1_ProcessStatusMeasuring1(this.CurrentLeakDatas[4].ProcessStatus, "5");
this.ChildFormMenu.UpdateDisplay_Equipment1_ProcessStatusMeasuring2(this.CurrentLeakDatas[4].ProcessStatus, "8");
}
break;
case "F":
#region Value Assign
this.CurrentLeakDatas[5].ProcessStatus = Helper.StringToProcessStatus(receiveData.Substring(0, 2));
this.CurrentLeakDatas[6].ProcessStatus = Helper.StringToProcessStatus(receiveData.Substring(0, 2));
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
{
// MainDisplay
this.ChildFormMainDisplay.UpdateDisplayProcessStatus(this.CurrentLeakDatas[5].ProcessStatus);
this.ChildFormMainDisplay.UpdateDisplayProcessStatus6(this.CurrentLeakDatas[5].ProcessStatus);
}
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
{
// Equipment
this.ChildFormMenu.UpdateDisplay_Equipment_ProcessStatus(this.CurrentLeakDatas[5].ProcessStatus);
this.ChildFormMenu.UpdateDisplay_Equipment1_ProcessStatusMeasuring1(this.CurrentLeakDatas[5].ProcessStatus, "6");
this.ChildFormMenu.UpdateDisplay_Equipment1_ProcessStatusMeasuring2(this.CurrentLeakDatas[5].ProcessStatus, "7");
}
break;
case "G":
break;
case "H":
break;
case "I":
break;
case "J":
break;
default:
break;
}
}
catch
{
ret = -1;
}
return ret;
}
// 차압 센서 데이터
private int ReceiveCommandSLC_Slave(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.SecBuf = receiveData.Substring(8, 8).Trim();
this.CurrentLeakDatas[0].DiffData.SecBufSum = receiveData.Substring(16, 8).Trim();
this.CurrentLeakDatas[0].DiffData.SecBufMax = receiveData.Substring(24, 8).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDiffData1(this.CurrentLeakDatas[0]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
{
this.ChildFormMenu.UpdateDisplayIOTestDiffDataSlave(this.CurrentLeakDatas[0]);
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.SecBuf = receiveData.Substring(8, 8).Trim();
this.CurrentLeakDatas[1].DiffData.SecBufSum = receiveData.Substring(16, 8).Trim();
this.CurrentLeakDatas[1].DiffData.SecBufMax = receiveData.Substring(24, 8).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDiffData2(this.CurrentLeakDatas[1]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.SecBuf = receiveData.Substring(8, 8).Trim();
this.CurrentLeakDatas[2].DiffData.SecBufSum = receiveData.Substring(16, 8).Trim();
this.CurrentLeakDatas[2].DiffData.SecBufMax = receiveData.Substring(24, 8).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDiffData3(this.CurrentLeakDatas[2]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.SecBuf = receiveData.Substring(8, 8).Trim();
this.CurrentLeakDatas[3].DiffData.SecBufSum = receiveData.Substring(16, 8).Trim();
this.CurrentLeakDatas[3].DiffData.SecBufMax = receiveData.Substring(24, 8).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDiffData4(this.CurrentLeakDatas[3]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.SecBuf = receiveData.Substring(8, 8).Trim();
this.CurrentLeakDatas[4].DiffData.SecBufSum = receiveData.Substring(16, 8).Trim();
this.CurrentLeakDatas[4].DiffData.SecBufMax = receiveData.Substring(24, 8).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDiffData5(this.CurrentLeakDatas[4]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.SecBuf = receiveData.Substring(8, 8).Trim();
this.CurrentLeakDatas[5].DiffData.SecBufSum = receiveData.Substring(16, 8).Trim();
this.CurrentLeakDatas[5].DiffData.SecBufMax = receiveData.Substring(24, 8).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDiffData6(this.CurrentLeakDatas[5]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.SecBuf = receiveData.Substring(8, 8).Trim();
this.CurrentLeakDatas[6].DiffData.SecBufSum = receiveData.Substring(16, 8).Trim();
this.CurrentLeakDatas[6].DiffData.SecBufMax = receiveData.Substring(24, 8).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDiffData7(this.CurrentLeakDatas[6]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.SecBuf = receiveData.Substring(8, 8).Trim();
this.CurrentLeakDatas[7].DiffData.SecBufSum = receiveData.Substring(16, 8).Trim();
this.CurrentLeakDatas[7].DiffData.SecBufMax = receiveData.Substring(24, 8).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDiffData8(this.CurrentLeakDatas[7]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.SecBuf = receiveData.Substring(8, 8).Trim();
this.CurrentLeakDatas[8].DiffData.SecBufSum = receiveData.Substring(16, 8).Trim();
this.CurrentLeakDatas[8].DiffData.SecBufMax = receiveData.Substring(24, 8).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDiffData9(this.CurrentLeakDatas[8]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.SecBuf = receiveData.Substring(8, 8).Trim();
this.CurrentLeakDatas[9].DiffData.SecBufSum = receiveData.Substring(16, 8).Trim();
this.CurrentLeakDatas[9].DiffData.SecBufMax = receiveData.Substring(24, 8).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDiffData10(this.CurrentLeakDatas[9]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
this.ChildFormMenu.UpdateDisplayEquipmentDiffData10(this.CurrentLeakDatas[9]);
#endregion
break;
case "K":
#region 11열
#region Value Assign
this.CurrentLeakDatas[10].DiffData.MAdc = receiveData.Substring(0, 8).Trim();
this.CurrentLeakDatas[10].DiffData.SecBuf = receiveData.Substring(8, 8).Trim();
this.CurrentLeakDatas[10].DiffData.SecBufSum = receiveData.Substring(16, 8).Trim();
this.CurrentLeakDatas[10].DiffData.SecBufMax = receiveData.Substring(24, 8).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDiffData11(this.CurrentLeakDatas[10]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
this.ChildFormMenu.UpdateDisplayEquipmentDiffData11(this.CurrentLeakDatas[10]);
#endregion
break;
case "L":
#region 12열
#region Value Assign
this.CurrentLeakDatas[11].DiffData.MAdc = receiveData.Substring(0, 8).Trim();
this.CurrentLeakDatas[11].DiffData.SecBuf = receiveData.Substring(8, 8).Trim();
this.CurrentLeakDatas[11].DiffData.SecBufSum = receiveData.Substring(16, 8).Trim();
this.CurrentLeakDatas[11].DiffData.SecBufMax = receiveData.Substring(24, 8).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDiffData12(this.CurrentLeakDatas[11]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
{
this.ChildFormMenu.UpdateDisplayIOTestDiffDataMaster(this.CurrentLeakDatas[11]);
this.ChildFormMenu.UpdateDisplayEquipmentDiffData12(this.CurrentLeakDatas[11]);
}
#endregion
break;
default:
break;
}
}
catch
{
ret = -1;
}
return ret;
}
// 변위 센서 데이터
private int ReceiveCommandSLD_Slave(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.MDataMax = receiveData.Substring(18, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDispData1(this.CurrentLeakDatas[0]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
{
this.ChildFormMenu.UpdateDisplayIOTestDispDataSlave(this.CurrentLeakDatas[0]);
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.MDataMax = receiveData.Substring(18, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDispData2(this.CurrentLeakDatas[1]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.MDataMax = receiveData.Substring(18, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDispData3(this.CurrentLeakDatas[2]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.MDataMax = receiveData.Substring(18, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDispData4(this.CurrentLeakDatas[3]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.MDataMax = receiveData.Substring(18, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDispData5(this.CurrentLeakDatas[4]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.MDataMax = receiveData.Substring(18, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDispData6(this.CurrentLeakDatas[5]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.MDataMax = receiveData.Substring(18, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDispData7(this.CurrentLeakDatas[6]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.MDataMax = receiveData.Substring(18, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDispData8(this.CurrentLeakDatas[7]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.MDataMax = receiveData.Substring(18, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDispData9(this.CurrentLeakDatas[8]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.MDataMax = receiveData.Substring(18, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDispData10(this.CurrentLeakDatas[9]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
this.ChildFormMenu.UpdateDisplayEquipmentDispData10(this.CurrentLeakDatas[9]);
#endregion
break;
case "K":
#region 11열
#region Value Assign
this.CurrentLeakDatas[10].DispData.RData = receiveData.Substring(0, 6).Trim();
this.CurrentLeakDatas[10].DispData.MData = receiveData.Substring(6, 6).Trim();
this.CurrentLeakDatas[10].DispData.MDataDiff = receiveData.Substring(12, 6).Trim();
this.CurrentLeakDatas[10].DispData.MDataMax = receiveData.Substring(18, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDispData11(this.CurrentLeakDatas[10]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
this.ChildFormMenu.UpdateDisplayEquipmentDispData11(this.CurrentLeakDatas[10]);
#endregion
break;
case "L":
#region 12열
#region Value Assign
this.CurrentLeakDatas[11].DispData.RData = receiveData.Substring(0, 6).Trim();
this.CurrentLeakDatas[11].DispData.MData = receiveData.Substring(6, 6).Trim();
this.CurrentLeakDatas[11].DispData.MDataDiff = receiveData.Substring(12, 6).Trim();
this.CurrentLeakDatas[11].DispData.MDataMax = receiveData.Substring(18, 6).Trim();
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayDispData12(this.CurrentLeakDatas[11]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
{
this.ChildFormMenu.UpdateDisplayIOTestDispDataMaster(this.CurrentLeakDatas[11]);
this.ChildFormMenu.UpdateDisplayEquipmentDispData12(this.CurrentLeakDatas[11]);
}
#endregion
break;
default:
break;
}
}
catch
{
ret = -1;
}
return ret;
}
// 압력 데이터
private int ReceiveCommandSLE_Slave(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.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayPresData1(this.CurrentLeakDatas[0]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
{
this.ChildFormMenu.UpdateDisplayIOTestPresDataSlave(this.CurrentLeakDatas[0]);
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.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayPresData2(this.CurrentLeakDatas[1]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayPresData3(this.CurrentLeakDatas[2]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayPresData4(this.CurrentLeakDatas[3]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayPresData5(this.CurrentLeakDatas[4]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayPresData6(this.CurrentLeakDatas[5]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayPresData7(this.CurrentLeakDatas[6]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayPresData8(this.CurrentLeakDatas[7]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayPresData9(this.CurrentLeakDatas[8]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
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.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayPresData10(this.CurrentLeakDatas[9]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
this.ChildFormMenu.UpdateDisplayEquipmentPresData10(this.CurrentLeakDatas[9]);
#endregion
break;
case "K":
#region 11열
#region Value Assign
this.CurrentLeakDatas[10].PresData.WorkingChamber =
string.Format("{0}{1}", receiveData.Substring(0, 1), receiveData.Substring(1, 5).Trim());
this.CurrentLeakDatas[10].PresData.MasterChamber =
string.Format("{0}{1}", receiveData.Substring(6, 1), receiveData.Substring(7, 5).Trim());
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayPresData11(this.CurrentLeakDatas[10]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
this.ChildFormMenu.UpdateDisplayEquipmentPresData11(this.CurrentLeakDatas[10]);
#endregion
break;
case "L":
#region 12열
#region Value Assign
this.CurrentLeakDatas[11].PresData.WorkingChamber =
string.Format("{0}{1}", receiveData.Substring(0, 1), receiveData.Substring(1, 5).Trim());
this.CurrentLeakDatas[11].PresData.MasterChamber =
string.Format("{0}{1}", receiveData.Substring(6, 1), receiveData.Substring(7, 5).Trim());
#endregion
// 화면 표시
if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateDisplayPresData12(this.CurrentLeakDatas[11]);
else if (this.CurrentSystemStatus.CurrentForm == Define.E_FormStore.FormMenu)
{
this.ChildFormMenu.UpdateDisplayIOTestPresDataMaster(this.CurrentLeakDatas[11]);
this.ChildFormMenu.UpdateDisplayEquipmentPresData12(this.CurrentLeakDatas[11]);
}
#endregion
break;
default:
break;
}
}
catch
{
ret = -1;
}
return ret;
}
// IO테스트-IN
private int ReceiveCommandST0_Slave(string lane, string receiveData)
{
int ret = 0;
switch (lane)
{
case "0":
#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.UpdateDisplayIOTestInputDataMaster(this.CollectionIOTest_InputData);
break;
case "1":
#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.UpdateDisplayIOTestInputDataSlave(this.CollectionIOTest_InputData);
break;
default:
break;
}
return ret;
}
// 알람
private int ReceiveCommandSA0_Slave(string lane, string receiveData)
{
int ret = 0;
switch (lane)
{
case "Z":
#region Value Assign
this.CurrentAlarmList.SetAlarmSlave(receiveData.Substring(0, 8));
#endregion
this.ChildFormMainDisplay.UpdateDisplayAlarmView(this.CurrentAlarmList);
this.ChildFormMenu.UpdateDisplayIOTestAlarmView(this.CurrentAlarmList);
this.ChildFormMenu.UpdateDisplayAlarmView(this.CurrentAlarmList);
break;
default:
break;
}
return ret;
}
#endregion
#endregion
#region Communication protocol
public byte[] Transfer_1_Modbus_Write()
{
byte[] madeData = new byte[20];
byte[] Length2Value = new byte[2];
for (int j = 0; j < this.SystemConfig.EQUIPMENT_LANE; j++)
{
Length2Value = GetBytes(this.Current30000ModbusData.CollectionIsProcessing[j]);
for (int i = 0; i < 2; i++)
madeData[i] = Length2Value[2 - i];
Length2Value = GetBytes(this.Current30000ModbusData.CollectionIsLeak[j]);
for (int i = 0; i < 2; i++)
madeData[i] = Length2Value[2 - i];
}
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];
startAddressInt = Modbus.ToBigEndianAndInt(startAddressByte);
numberOfRegisterInt = Modbus.ToBigEndianAndInt(numberOfRegisterByte);
byte[] madeData = new byte[numberOfRegisterInt * 2];
if (readByte[7] == ModbusFunctionCode.FunctionCode_04)
{
for (int j = startAddressInt; j < startAddressInt + numberOfRegisterInt; j++)
{
switch (j)
{
#region Make data
case _30000_ModbusAddress._01_1_IsProcessing:
length2Value = GetBytes(this.Current30000ModbusData.CollectionIsProcessing[0]);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[2 - i];
break;
case _30000_ModbusAddress._02_1_IsLeak:
length2Value = GetBytes(this.Current30000ModbusData.CollectionIsLeak[0]);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[2 - i];
break;
case _30000_ModbusAddress._03_2_IsProcessing:
length2Value = GetBytes(this.Current30000ModbusData.CollectionIsProcessing[1]);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[2 - i];
break;
case _30000_ModbusAddress._04_2_IsLeak:
length2Value = GetBytes(this.Current30000ModbusData.CollectionIsLeak[1]);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[2 - i];
break;
case _30000_ModbusAddress._05_3_IsProcessing:
length2Value = GetBytes(this.Current30000ModbusData.CollectionIsProcessing[2]);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[2 - i];
break;
case _30000_ModbusAddress._06_3_IsLeak:
length2Value = GetBytes(this.Current30000ModbusData.CollectionIsLeak[2]);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[2 - i];
break;
case _30000_ModbusAddress._07_4_IsProcessing:
length2Value = GetBytes(this.Current30000ModbusData.CollectionIsProcessing[3]);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[2 - i];
break;
case _30000_ModbusAddress._08_4_IsLeak:
length2Value = GetBytes(this.Current30000ModbusData.CollectionIsLeak[3]);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[2 - i];
break;
case _30000_ModbusAddress._09_5_IsProcessing:
length2Value = GetBytes(this.Current30000ModbusData.CollectionIsProcessing[4]);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[2 - i];
break;
case _30000_ModbusAddress._10_5_IsLeak:
length2Value = GetBytes(this.Current30000ModbusData.CollectionIsLeak[4]);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[2 - i];
break;
case _30000_ModbusAddress._11_6_IsProcessing:
length2Value = GetBytes(this.Current30000ModbusData.CollectionIsProcessing[5]);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[2 - i];
break;
case _30000_ModbusAddress._12_6_IsLeak:
length2Value = GetBytes(this.Current30000ModbusData.CollectionIsLeak[5]);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[2 - i];
break;
case _30000_ModbusAddress._13_7_IsProcessing:
length2Value = GetBytes(this.Current30000ModbusData.CollectionIsProcessing[6]);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[2 - i];
break;
case _30000_ModbusAddress._14_7_IsLeak:
length2Value = GetBytes(this.Current30000ModbusData.CollectionIsLeak[6]);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[2 - i];
break;
case _30000_ModbusAddress._15_8_IsProcessing:
length2Value = GetBytes(this.Current30000ModbusData.CollectionIsProcessing[7]);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[2 - i];
break;
case _30000_ModbusAddress._16_8_IsLeak:
length2Value = GetBytes(this.Current30000ModbusData.CollectionIsLeak[7]);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[2 - i];
break;
case _30000_ModbusAddress._17_9_IsProcessing:
length2Value = GetBytes(this.Current30000ModbusData.CollectionIsProcessing[8]);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[2 - i];
break;
case _30000_ModbusAddress._18_9_IsLeak:
length2Value = GetBytes(this.Current30000ModbusData.CollectionIsLeak[8]);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[2 - i];
break;
case _30000_ModbusAddress._19_10_IsProcessing:
length2Value = GetBytes(this.Current30000ModbusData.CollectionIsProcessing[9]);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[2 - i];
break;
case _30000_ModbusAddress._20_10_IsLeak:
length2Value = GetBytes(this.Current30000ModbusData.CollectionIsLeak[9]);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[2 - i];
break;
case _30000_ModbusAddress._21_11_IsProcessing:
length2Value = GetBytes(this.Current30000ModbusData.CollectionIsProcessing[10]);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[2 - i];
break;
case _30000_ModbusAddress._22_11_IsLeak:
length2Value = GetBytes(this.Current30000ModbusData.CollectionIsLeak[10]);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[2 - i];
break;
case _30000_ModbusAddress._23_12_IsProcessing:
length2Value = GetBytes(this.Current30000ModbusData.CollectionIsProcessing[11]);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[2 - i];
break;
case _30000_ModbusAddress._24_12_IsLeak:
length2Value = GetBytes(this.Current30000ModbusData.CollectionIsLeak[11]);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[2 - i];
break;
default:
break;
#endregion
}
madeDataIndex += 2;
}
}
return madeData;
}
#endregion
#region Ethernet
public static byte[] GetBytes(int argument)
{
byte[] byteArray = BitConverter.GetBytes(argument);
return byteArray;
}
public static byte[] GetBytes(Single argument)
{
byte[] byteArray = BitConverter.GetBytes(argument);
return byteArray;
}
public static byte[] GetBytes(uint argument)
{
byte[] byteArray = BitConverter.GetBytes(argument);
return byteArray;
}
/// <summary>
/// OPC, Modbus - 항목 업데이트 시마다 +1
/// </summary>
public void Update30000ModbusItem()
{
for (int i = 0; i < this.SystemConfig.EQUIPMENT_LANE; i++)
{
switch (this.CurrentLeakDatas[i].ProcessStatus)
{
case Define.E_ProcessStatus._0_None:
case Define.E_ProcessStatus._1_Ready:
case Define.E_ProcessStatus._2_ProductEntry:
this.Current30000ModbusData.CollectionIsProcessing[i] = 0;
break;
case Define.E_ProcessStatus._3_MoveToLeak:
case Define.E_ProcessStatus._4_MoveToCheck:
this.Current30000ModbusData.CollectionIsProcessing[i] = 1;
break;
case Define.E_ProcessStatus._5_ChamberMerge:
case Define.E_ProcessStatus._6_VacuumStart:
case Define.E_ProcessStatus._7_VacuumHold:
case Define.E_ProcessStatus._8_Judgment:
case Define.E_ProcessStatus._9_VacuumBreak:
this.Current30000ModbusData.CollectionIsProcessing[i] = 2;
break;
case Define.E_ProcessStatus._10_ChamberRelease:
case Define.E_ProcessStatus._11_MoveToReady:
this.Current30000ModbusData.CollectionIsProcessing[i] = 3;
break;
default:
break;
}
this.Current30000ModbusData.CollectionIsLeak[i] = (short)this.CurrentLeakDatas[i].Judgment.Result;
}
this.ChildFormMainDisplay.ChildModbus.UpdateData(this.Current30000ModbusData);
//this.DelegateModbusStatus();
// 로그
if (this.IsCommunicationLogOpen == true)
{
this.smartFileCommunicationLog.StringType.Write(string.Format("Update30000ModbusItem ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, this.Current30000ModbusData.CollectionIsProcessing[0].ToString()));
this.smartFileCommunicationLog.StringType.Write(string.Format("Update30000ModbusItem ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, this.Current30000ModbusData.CollectionIsLeak[0]));
}
}
/// <summary>
/// Modbus TCP - Write Multiple Register에 대한 Manage 메소드
/// </summary>
/// <param name="readByte">전송받은 Modbus Data</param>
public void ReceiveModbusTCPWriteManager(byte[] readByte)
{
int startAddressInt;
int numberOfRegisterInt;
float floatNum;
byte[] startAddressByte = new byte[2] { readByte[8], readByte[9] };
byte[] numberOfRegisterByte = new byte[2] { readByte[10], readByte[11] };
int madeDataIndex = 0;
byte[] Length2Value = new byte[2];
byte[] Length4Value = new byte[4];
byte[] Length12Value = new byte[12];
byte[] Length14Value = new byte[14];
startAddressInt = Modbus.ToBigEndianAndInt(startAddressByte);
numberOfRegisterInt = Modbus.ToBigEndianAndInt(numberOfRegisterByte);
for (int j = startAddressInt; j < startAddressInt + numberOfRegisterInt; j++)
{
switch (j)
{
#region Change data
case _40000_ModbusAddress._03_Operation:
#region 40013_운전/정지 요청, 1:운전/2:정지
for (int i = 0; i < 2; i++)
Length2Value[i] = readByte[13 + madeDataIndex + i];
this.Current40000ModbusData._40013_Operation = Modbus.ToBigEndianAndInt(Length2Value);
if (this.Current40000ModbusData._40013_Operation != 0)
{
try
{
if (this.Current40000ModbusData._40013_Operation == 1)
{
this.TransferData_Master(CommunicationCommand.Start, CommunicationID.MainBoardMaster);
}
else
{
this.TransferData_Master(CommunicationCommand.Stop, CommunicationID.MainBoardMaster);
}
this.Current40000ModbusData._40013_Operation = 0;
// 성공
this.Current40000ModbusData._40014_OperationResult = 1;
}
catch
{
// 실패
this.Current40000ModbusData._40014_OperationResult = 2;
}
}
#endregion
break;
case _40000_ModbusAddress._04_OperationResult:
#region 40014_운전/정지 요청 수행 결과
for (int i = 0; i < 2; i++)
Length2Value[i] = readByte[13 + madeDataIndex + i];
this.Current40000ModbusData._40014_OperationResult = Modbus.ToBigEndianAndInt(Length2Value);
#endregion
break;
default:
break;
#endregion
}
madeDataIndex += 2;
}
}
#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.Empty:
value = "Empty";
break;
case Define.E_JudgmentStatus.Error:
value = "Error";
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(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(",");
for (int i = 0; i < this.SystemConfig.EQUIPMENT_LANE; i++)
{
sw.Write(string.Format("#{0}_Result", i + 1));
sw.Write(",");
sw.Write("DIFF");
sw.Write(",");
sw.Write("DISP");
sw.Write(",");
sw.Write("DIFF_Max");
sw.Write(",");
sw.Write("DIFF_Msum");
sw.Write(",");
sw.Write("DISP_Min");
sw.Write(",");
sw.Write("DISP_Max");
sw.Write(",");
sw.Write("DISP_Diff");
sw.Write(",");
}
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(",");
for (int i = 0; i < this.SystemConfig.EQUIPMENT_LANE; i++)
{
sw.Write(this.GetJudgmentResult(items[i].Judgment.Result));
sw.Write(",");
sw.Write(this.GetJudgmentResult(items[i].Judgment.DIFF_Result));
sw.Write(",");
sw.Write(this.GetJudgmentResult(items[i].Judgment.DISP_Result));
sw.Write(",");
sw.Write(items[i].Judgment.DIFF_SecBufMax);
sw.Write(",");
sw.Write(items[i].Judgment.DIFF_SecBufSum);
sw.Write(",");
sw.Write(items[i].Judgment.DISP_Min);
sw.Write(",");
sw.Write(items[i].Judgment.DISP_MDataMax);
sw.Write(",");
sw.Write(items[i].Judgment.DISP_MDataDiff);
sw.Write(",");
}
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 - Servo Motor
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();
// Splash finish
SmartSplash.Finish();
this.smartForm1.Show((int)Define.E_FormStore.FormMainDisplay);
// 초기 파라미터 전송
this.TransferSystemParameter9039(Define.E_BoardMode.Master);
this.TransferSystemParameter9039(Define.E_BoardMode.Slave);
// 이더넷 설정
this.DefaultSetting2();
// timer1 Get user List Name
//UserManager.UserManager_GetUserListName();
this.timerUserList.Enabled = true;
// System Timer
this.timerSystem.Enabled = true;
this.ModbusOpen();
}
#endregion
#region Event Handler
private void smartSerialPortMaster_OnReadQueueEvent()
{
this.ReceiveData_Master();
// 통신 확인
if (this.CommunicationCheckCount_Master / 3 == 1)
{
this.ChildFormMainDisplay.labelCommunicationStatus_Master.Visible = true;
this.CommunicationCheckCount_Master = 0;
}
else
{
this.ChildFormMainDisplay.labelCommunicationStatus_Master.Visible = false;
this.CommunicationCheckCount_Master += 1;
}
}
private void smartTCPMultiServer_OnReceiveHandler(SmartTCPMultiServer.CHandleClient.READINFO datas)
{
byte[] readByte;
string strRecData = "";
try
{
readByte = datas.receiveDatas;
strRecData = SmartTCPMultiServer.ConvertAsciiByteToString(readByte);
}
catch
{
return;
}
switch (this.SystemConfig.ETHERNET_COMM_MODE)
{
case (int)Define.E_CommMode.f1_Modbus:
#region Modbus TCP
if (this.smartTCPMultiServer.ClientInfoList != null)
{
this.ChildFormMainDisplay.ChildModbus.UpdateReceiveCount();
//Console.Write("\n" + string.Format("Receive Modbus {0:yyyy-MM-dd HH:mm:ss}: {1}", DateTime.Now, Helper.ByteToHexString(readByte)));
if (readByte[7] == 0x10) // Write Multiple Register
{
#region Write Multiple Register
try
{
byte[] errorResponseData = new byte[9];
byte[] responseData = new byte[12];
byte errorCheck = this.Modbus.CheckRequestLeakTesterDataErrorTCP(readByte, ModbusFunctionCode.FunctionCode_16);
if (errorCheck == 0x00)
{
for (int i = 0; i < 12; i++)
responseData[i] = readByte[i];
responseData[5] = 0x06;
foreach (SmartTCPMultiServer.CLIENTSINFOS client in this.smartTCPMultiServer.ClientInfoList)
{
this.smartTCPMultiServer.SendByteByClientID(client.strID, responseData);
}
this.ReceiveModbusTCPWriteManager(readByte);
}
else
{
for (int i = 0; i < 5; i++)
errorResponseData[i] = readByte[i];
// Length
errorResponseData[5] = 0x03;
// Unit ID
errorResponseData[6] = 0x01;
// Function Code
errorResponseData[7] = 0x90;
// Error Code
errorResponseData[8] = errorCheck;
foreach (SmartTCPMultiServer.CLIENTSINFOS client in this.smartTCPMultiServer.ClientInfoList)
{
this.smartTCPMultiServer.SendByteByClientID(client.strID, responseData);
}
}
// 로그
if (this.IsCommunicationLogOpen == true)
{
this.smartFileCommunicationLog.StringType.Write(string.Format("Receive TCP ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, BitConverter.ToString(readByte)));
this.smartFileCommunicationLog.StringType.Write(string.Format("Send TCP ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, BitConverter.ToString(responseData)));
}
}
catch
{
}
#endregion
}
else // Read Input Register(0x04)
{
if (this.SystemConfig.MODBUS_TCP_SELECTFUNCTION == (int)Define.E_ModbusFunction._04_ReadInputRegister)
{
#region Read Input Register
try
{
byte[] responseData;
byte errorCheck = this.Modbus.CheckRequestLeakTesterDataErrorTCP(readByte, ModbusFunctionCode.FunctionCode_04);
if (errorCheck == 0x00)
responseData = this.Modbus.MakeTCP04ResponseData(readByte, this.Transfer_1_Modbus_Read_TCP(readByte));
else
responseData = this.Modbus.MakeTCP04ErrorResponseData(readByte, errorCheck);
foreach (SmartTCPMultiServer.CLIENTSINFOS client in this.smartTCPMultiServer.ClientInfoList)
{
this.smartTCPMultiServer.SendByteByClientID(client.strID, responseData);
}
//Console.Write("\n" + string.Format("Send Modbus {0:yyyy-MM-dd HH:mm:ss}: {1}", DateTime.Now, Helper.ByteToHexString(responseData)));
// 로그
if (this.IsCommunicationLogOpen == true)
{
this.smartFileCommunicationLog.StringType.Write(string.Format("Receive TCP ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, Helper.ByteToHexString(readByte)));
this.smartFileCommunicationLog.StringType.Write(string.Format("Send TCP ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, Helper.ByteToHexString(responseData)));
}
}
catch
{
}
#endregion
}
}
}
#endregion
break;
default:
break;
}
}
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();
}
private void timerClientTryConnect_Tick(object sender, EventArgs e)
{
this.DelegateTimerTryConnect(false);
this.EthernetClientConnect();
}
private void timerSystem_Tick(object sender, EventArgs e)
{
DateTime time = DateTime.Now;
this.ChildFormMainDisplay.UpdateDisplayTime(time);
this.ChildFormMenu.UpdateDisplayTime(time);
}
#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
#region DLL_SerialportEvent
private void Serialport_ReceiveDataEvent(string data)
{
this.ReceiveData_Master(data);
// 통신 확인
if (this.CommunicationCheckCount_Master / 3 == 1)
{
this.ChildFormMainDisplay.labelCommunicationStatus_Master.Visible = true;
this.CommunicationCheckCount_Master = 0;
}
else
{
this.ChildFormMainDisplay.labelCommunicationStatus_Master.Visible = false;
this.CommunicationCheckCount_Master += 1;
}
}
private void SerialPort_MessageReceive(object data)
{
this.UI_Invoke(delegate
{
this.Serialport_ReceiveDataEvent(data.ToString());
});
}
private void SerialPort_ErrMessageReceive(object data)
{
this.UI_Invoke(delegate
{
if (this.IsCommunicationLogOpen == true)
this.smartFileCommunicationLog.StringType.Write(string.Format("Receive ({0:yyyy-MM-dd HH:mm:ss}): {1} : Dll(Err MSG)", DateTime.Now, data));
});
}
private void Serialport_GetVersionDataEvent(object data)
{
try
{
//if (this.ChildFormInformation != null)
//{
// this.UI_Invoke(delegate
// {
// this.ChildFormInformation.UpdateSerialportVersionDisplay(data.ToString());
// });
//}
}
catch
{
}
}
#endregion
private void smartSerialPortSlave_OnReadQueueEvent()
{
this.ReceiveData_Slave();
// 통신 확인
if (this.CommunicationCheckCount_Slave / 3 == 1)
{
this.ChildFormMainDisplay.labelCommunicationStatus_Slave.Visible = true;
this.CommunicationCheckCount_Slave = 0;
}
else
{
this.ChildFormMainDisplay.labelCommunicationStatus_Slave.Visible = false;
this.CommunicationCheckCount_Slave += 1;
}
}
#endregion
}
}