INT69DC_7C/INT69DC_7C/Forms/FormMain.cs

12204 lines
634 KiB
C#

using System;
using System.Linq;
using System.Collections.ObjectModel;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using SmartX;
using InModbus;
using INT69DC_7C.DialogForms;
using INT69DC_7C.Part11_Encryption;
using INT69DC_7C.Part11_UserManager;
using INT69DC_7C.SerialManger;
namespace INT69DC_7C.Forms
{
public partial class FormMain : Form
{
#region Field
private SmartX.SmartSplash SmartSplashProgramLoad;
private int CommunicationCheckCount;
public bool IsCommunicationLogOpen;
public bool IsCom1LogOpen;
public bool IsCom3LogOpen;
public bool IsBootingComplete;
public bool IsAdcLogOpen;
private bool FlagADCValueWrite;
public int BufferSmartUart; // Buffer size 정의
public bool FlagThreadMessage1; // 플레그 쓰레드 메시지 11
private bool IsModbusCommonDataSend; // Modbus 공통 데이터 Start 시 한번 전송용
public int FlagAutomaticLogoutWarningTime; //Part11 Auto Logout
private string ComPortMainToLCD; // DllSerial Port
public bool FlagDllSerial; // DllSerial 사용여부
private string TransferNum; // 수신데이터 ID저장 (재전송 시 사용)
// OPC
private static int ModbusTotalBytes = 232; // 전체 bytes
// 파일 위치
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_PathDataOthersFolder;
private string m_PathEncryptionFolder;
private string m_PathHeaderFolder;
private static string m_PathBinFolder;
// 로그온 색상
public Color ColorLogOff;
public Color ColorLogOn;
// Form 생성
public FormMainDisplay ChildFormMainDisplay;
public FormMenu ChildFormMenu;
public FormSystemSetting ChildFormSystemSetting;
public FormMotorSetting ChildFormMotorSetting;
public FormCalibration ChildFormCalibration;
public FormIOTest ChildFormIOTest;
public FormEquipmentSetting ChildFormEquipmentSetting;
public FormDataBackup ChildFormDataBackup;
public FormConfiguration ChildFormConfiguration;
public FormTimeSetting ChildFormTimeSetting;
public FormInformation ChildFormInformation;
public FormFactoryInitialize ChildFormFactoryInitialize;
public FormProgramUpdate ChildFormProgramUpdate;
public FormEquipmentTest ChildFormEquipmentTest;
public FormDataStatistics ChildFormDataStatistics;
public FormOptionSetting ChildFormOptionSetting;
public FormCommunication ChildFormCommunication;
public FormUserEditor ChildFormUserEditor;
public FormUserGroupEditor ChildFormUserGroupEditor;
public FormDataBackup_Part11 ChildFormDataBackup_Part11;
public FormDataViewer ChildFormDataViewer;
// 장비 구동 상태
private DataStore.EquipmentStatus m_EquipmentStatus;
// System Configuration
public SystemConfigurationItem SystemConfig;
// 현재 선택 된 품목
public ProductItem CurrentProductItem;
// 현재 선택 된 판정 설정 값
public JudgmentSetItem CurrentJudgmentSetItem;
// 중량 조정 설정값
public CalibrationItem CurrentCalibrationItem;
// 제로 파라미터 설정값
public ZeroParameterItem CurrentZeroParameterItem;
// 옵션 파라미터 설정값
public OptionParameterItem CurrentOptionParameterItem;
// 통신 ABFood
public CommunicationStatusItem CommunicationABFood;
// 현재 선택 된 피드백 설정 값
public FeedbackConfiguration CurrentFeedbackItem;
// 열별 중량 데이터
public Collection<WeightData> CollectionWeightData;
// 장비테스트모드 열별 중량 데이터
public Collection<WeightData> CollectionWeightDataTest;
// TotalPass Count
public Counter CurrentAlarmTotalPassCnt;
// UserGroup
public UserGroup CurrentUserGroup;
// Dll User_Name List
public List<string> ListDllUserName;
// Dataviewer Filter
public DataViewerFilter CurrentDataViewerFilter;
// Judgment Result Buffer
private Collection<DataStore.JudgmentStatus> CollJudgmentStatus;
// Collection
private Collection<int> CollectionGraphData; // 판정설정 그래프 데이터
private Collection<string> CollectionIOTest_InputData; // IO Test Input 데이터 취합
private Collection<string> CollectionIOTest_InputData1; // IO Test Input1 데이터 취합 확장보드
private Collection<string> CollectionZeroParameterRange; // 자동영점 - 범위
private Collection<string> CollectionZeroParameterTime; // 자동영점 - 시간
private Collection<string> CollectionZeroParameterVariates; // 자동영점 - 변량
private Collection<string> CollectionBalanceWeight; // 분동중량값
private Collection<string> CollectionMaxWeight; // 분동중량값
private Collection<string> CollectionDigit; // 한눈의값
private Collection<string> CollectionFilter; // 필터
private Collection<string> CollectionVersion; // 프로그램 버전
private Collection<string> CollectionIndividualDirection; // 모터 개별 회전 방향
public Collection<string> CollectionProductName; // 품목명 리스트
public Collection<FeedBackSystem1> CollectionFeedbackStatus; // 피드백 시스템1
// Modbus Data
public _30000_ModbusData Current30000ModbusData;
public _40000_ModbusData Current40000ModbusData;
// Modbus
public Modbus Modbus;
// Ethernet
public bool IsEthernetThreadStop;
private bool IsEthernetTransferData;
public object EthernetTransferData;
private TcpClient EthernetTcpClient;
private NetworkStream EthernetNetStream;
private StreamReader EthernetStmReader;
private StreamWriter EthernetStmWriter;
private delegate void TransferDataByteArrayCallback(byte[] byteArray);
private delegate void TransferDataStringCallback(string strtext);
private delegate void TextStatusCallback(string strtext);
private delegate void UIControlCallback(bool bEnable);
private delegate void UIServerStatusCallback(bool bEnable);
#endregion
#region Constructor
public FormMain()
{
InitializeComponent();
// 프로그램 로딩 이미지
this.SmartSplashProgramLoad = new SmartX.SmartSplash();
this.SmartSplashProgramLoad.CenterPosition = true;
this.SmartSplashProgramLoad.AnimationInterval = 100;
this.SmartSplashProgramLoad.LoadingImagePathname = "SmartLoading3";
this.SmartSplashProgramLoad.Start();
}
#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 PathDataOthersFolder
{
get { return this.m_PathDataOthersFolder; }
private set { this.m_PathDataOthersFolder = value; }
}
public string PathEncryptionFolder
{
get { return this.m_PathEncryptionFolder; }
set { this.m_PathEncryptionFolder = value; }
}
public string PathHeaderFolder
{
get { return this.m_PathHeaderFolder; }
private set { this.m_PathHeaderFolder = value; }
}
public static string PathBinFolder
{
get { return m_PathBinFolder; }
private set { m_PathBinFolder = value; }
}
public DataStore.EquipmentStatus EquipmentStatus
{
get { return this.m_EquipmentStatus; }
private set { this.m_EquipmentStatus = value; }
}
#endregion
#region Method
public static void Exception(Exception ex)
{
try
{
string fileName = "SD Card\\Data\\Others\\" + 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 CreateForm()
{
this.ChildFormMainDisplay = new FormMainDisplay(this);
this.ChildFormMenu = new FormMenu(this);
this.ChildFormDataStatistics = new FormDataStatistics(this);
this.ChildFormDataViewer = new FormDataViewer(this);
this.ChildFormInformation = new FormInformation(this);
this.ChildFormCommunication = new FormCommunication(this);
this.ChildFormMotorSetting = new FormMotorSetting(this);
this.ChildFormEquipmentSetting = new FormEquipmentSetting(this);
this.ChildFormOptionSetting = new FormOptionSetting(this);
this.ChildFormConfiguration = new FormConfiguration(this);
this.ChildFormSystemSetting = new FormSystemSetting(this);
this.ChildFormEquipmentTest = new FormEquipmentTest(this);
this.ChildFormCalibration = new FormCalibration(this);
this.ChildFormIOTest = new FormIOTest(this);
this.ChildFormTimeSetting = new FormTimeSetting(this);
this.ChildFormFactoryInitialize = new FormFactoryInitialize(this);
this.ChildFormProgramUpdate = new FormProgramUpdate(this);
this.ChildFormUserEditor = new FormUserEditor(this);
this.ChildFormUserGroupEditor = new FormUserGroupEditor(this);
if (this.SystemConfig.IsOptPart11 == true)
this.ChildFormDataBackup_Part11 = new FormDataBackup_Part11(this);
else
this.ChildFormDataBackup = new FormDataBackup(this);
this.smartForm.MainForm = this;
this.smartForm.AddChildForm(this.ChildFormMainDisplay);
this.smartForm.AddChildForm(this.ChildFormMenu);
this.smartForm.AddChildForm(this.ChildFormDataStatistics);
this.smartForm.AddChildForm(this.ChildFormDataViewer);
this.smartForm.AddChildForm(this.ChildFormInformation);
this.smartForm.AddChildForm(this.ChildFormCommunication);
this.smartForm.AddChildForm(this.ChildFormMotorSetting);
this.smartForm.AddChildForm(this.ChildFormEquipmentSetting);
this.smartForm.AddChildForm(this.ChildFormOptionSetting);
this.smartForm.AddChildForm(this.ChildFormConfiguration);
this.smartForm.AddChildForm(this.ChildFormSystemSetting);
this.smartForm.AddChildForm(this.ChildFormEquipmentTest);
this.smartForm.AddChildForm(this.ChildFormCalibration);
this.smartForm.AddChildForm(this.ChildFormIOTest);
this.smartForm.AddChildForm(this.ChildFormTimeSetting);
this.smartForm.AddChildForm(this.ChildFormFactoryInitialize);
this.smartForm.AddChildForm(this.ChildFormProgramUpdate);
this.smartForm.AddChildForm(this.ChildFormUserEditor);
this.smartForm.AddChildForm(this.ChildFormUserGroupEditor);
if (this.SystemConfig.IsOptPart11 == true)
this.smartForm.AddChildForm(this.ChildFormDataBackup_Part11);
else
this.smartForm.AddChildForm(this.ChildFormDataBackup);
}
private void CreateCollection()
{
this.CollectionWeightData = new Collection<WeightData>();
this.CollectionWeightDataTest = new Collection<WeightData>();
this.CollectionGraphData = new Collection<int>();
this.CollectionIOTest_InputData = new Collection<string>();
this.CollectionIOTest_InputData1 = new Collection<string>();
this.CollectionZeroParameterRange = new Collection<string>();
this.CollectionZeroParameterTime = new Collection<string>();
this.CollectionZeroParameterVariates = new Collection<string>();
this.CollectionBalanceWeight = new Collection<string>();
this.CollectionMaxWeight = new Collection<string>();
this.CollectionDigit = new Collection<string>();
this.CollectionFilter = new Collection<string>();
this.CollectionVersion = new Collection<string>();
this.CollectionIndividualDirection = new Collection<string>();
this.CollectionProductName = new Collection<string>();
this.CollectionFeedbackStatus = new Collection<FeedBackSystem1>();
this.CollJudgmentStatus = new Collection<DataStore.JudgmentStatus>();
this.CollectionWeightData.Clear();
this.CollectionWeightDataTest.Clear();
this.CollectionGraphData.Clear();
this.CollectionIOTest_InputData.Clear();
this.CollectionIOTest_InputData1.Clear();
this.CollectionZeroParameterRange.Clear();
this.CollectionZeroParameterTime.Clear();
this.CollectionZeroParameterVariates.Clear();
this.CollectionBalanceWeight.Clear();
this.CollectionMaxWeight.Clear();
this.CollectionDigit.Clear();
this.CollectionFilter.Clear();
this.CollectionVersion.Clear();
this.CollectionIndividualDirection.Clear();
this.CollectionProductName.Clear();
this.CollectionFeedbackStatus.Clear();
this.CollJudgmentStatus.Clear();
for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++)
{
this.CollectionWeightData.Add(new WeightData());
this.CollectionWeightDataTest.Add(new WeightData());
this.CollectionZeroParameterRange.Add("");
this.CollectionZeroParameterTime.Add("");
this.CollectionZeroParameterVariates.Add("");
this.CollectionBalanceWeight.Add("");
this.CollectionMaxWeight.Add("");
this.CollectionDigit.Add("");
this.CollectionFilter.Add("");
this.CollectionFeedbackStatus.Add(new FeedBackSystem1());
this.CollJudgmentStatus.Add(DataStore.JudgmentStatus.Empty);
}
for (int i = 0; i < 13; i++)
{
this.CollectionVersion.Add("");
}
for (int i = 0; i < 100; i++)
{
this.CollectionGraphData.Add(0);
}
for (int i = 0; i < 16; i++)
{
this.CollectionIOTest_InputData.Add("0");
this.CollectionIOTest_InputData1.Add("0");
}
for (int i = 0; i < 12; i++)
{
this.CollectionIndividualDirection.Add("0");
}
}
private void DefaultSetting1()
{
// AB Food
this.timerOPT1.Interval = 1000;
this.timerOPT1.Enabled = false;
// AB Food
this.timerTimeoutOPT1.Interval = 800;
this.timerTimeoutOPT1.Enabled = false;
this.timerAdcLog.Interval = 300000;
this.timerAdcLog.Enabled = false;
this.ColorLogOff = Color.Red;
this.ColorLogOn = Color.Green;
this.CommunicationCheckCount = 0;
this.IsCommunicationLogOpen = false;
this.IsCom1LogOpen = false;
this.IsCom3LogOpen = false;
this.IsBootingComplete = false;
this.IsAdcLogOpen = false;
this.FlagADCValueWrite = false;
this.EquipmentStatus = DataStore.EquipmentStatus.Stop;
this.BufferSmartUart = 1000000; // 1MB
this.FlagThreadMessage1 = false;
this.IsModbusCommonDataSend = false;
this.TransferNum = "-";
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.PathDataOthersFolder = this.PathDataFolder + "Others\\";
this.PathEncryptionFolder = this.PathLaunchFolder + "Encryption\\";
this.PathHeaderFolder = this.PathLaunchFolder + "Header\\";
PathBinFolder = this.PathLaunchFolder + "Bin\\";
this.SystemConfig = new SystemConfigurationItem();
this.CurrentProductItem = new ProductItem();
this.CurrentJudgmentSetItem = new JudgmentSetItem();
this.CurrentCalibrationItem = new CalibrationItem();
this.CurrentZeroParameterItem = new ZeroParameterItem();
this.CurrentOptionParameterItem = new OptionParameterItem();
this.CommunicationABFood = new CommunicationStatusItem();
this.CurrentFeedbackItem = new FeedbackConfiguration();
this.Current30000ModbusData = new _30000_ModbusData();
this.Current40000ModbusData = new _40000_ModbusData();
this.Modbus = new Modbus();
this.CurrentUserGroup = new UserGroup();
this.CurrentDataViewerFilter = new DataViewerFilter();
this.ListDllUserName = new List<string>();
this.ListDllUserName.Clear();
// SystemFile 폴더 생성
if (Directory.Exists(this.PathSystemFileFolder) == false)
Directory.CreateDirectory(this.PathSystemFileFolder);
// DataBackup 폴더 생성
if (Directory.Exists(this.PathDataBackupFolder) == false)
Directory.CreateDirectory(this.PathDataBackupFolder);
// DataStatistics 폴더 생성
if (Directory.Exists(this.PathDataStatisticsFolder) == false)
Directory.CreateDirectory(this.PathDataStatisticsFolder);
// Data 폴더 생성
if (Directory.Exists(this.PathDataFolder) == false)
Directory.CreateDirectory(this.PathDataFolder);
// History 폴더 생성
if (Directory.Exists(this.PathDataHistoryFolder) == false)
Directory.CreateDirectory(this.PathDataHistoryFolder);
// Inspection 폴더 생성
if (Directory.Exists(this.PathDataInspectionFolder) == false)
Directory.CreateDirectory(this.PathDataInspectionFolder);
// Others 폴더 생성
if (Directory.Exists(this.PathDataOthersFolder) == false)
Directory.CreateDirectory(this.PathDataOthersFolder);
// Encryption 폴더 생성
if (Directory.Exists(this.PathEncryptionFolder) == false)
Directory.CreateDirectory(this.PathEncryptionFolder);
// Header 폴더 생성
if (Directory.Exists(this.PathHeaderFolder) == false)
Directory.CreateDirectory(this.PathHeaderFolder);
// Bin 폴더 생성
if (Directory.Exists(PathBinFolder) == false)
Directory.CreateDirectory(PathBinFolder);
}
private void DefaultSetting2()
{
this.timerTimeoutOPT1.Interval = this.SystemConfig.ABFoodTimeoutInterval;
this.timerTimeOutTransmission.Interval = this.CurrentJudgmentSetItem.JudgmentDelayTime - 100;
// 이더넷
if (this.SystemConfig.EthernetOperationMode == 1)
{
try
{
if (string.Compare(this.smartConfigs.IPSettings.DeviceIP, "0.0.0.0") != 0)
this.EthernetServerStart();
if (this.SystemConfig.EthernetOperationMode == 1 && this.smartTCPMultiServer.IsStart == true)
this.ChildFormMainDisplay.TimerServer(true);
}
catch
{
}
}
else if (this.SystemConfig.EthernetOperationMode == 2)
this.EthernetClientDisconnect();
this.CurrentAlarmTotalPassCnt = new Counter(this.SystemConfig.EquipmentColumns, this.SystemConfig.AlarmTotalPassCnt);
// DllSerial 사용여부 설정
this.FlagDllSerial = true;
if (this.FlagDllSerial == true)
{
// SerialDll Initialize
this.ComPortMainToLCD = "COM2:";
SerialMgrComm.IntializeSerialManager();
//SerialMgrComm.SerialPortMessageReceive += this.SerialPort_MessageReceive;
//SerialMgrComm.SerialPortErrMessageReceive += this.SerialPort_ErrMessageReceive;
SerialMgrComm.SerialPortStrMessageReceive += this.SerialPort_StrMessageReceive;
SerialMgrComm.SerialPortErrStrMessageReceive += this.SerialPort_ErrStrMessageReceive;
SerialMgrComm.SerialPortGetVersionDataEvent += this.Serialport_GetVersionDataEvent;
}
}
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;
}
}
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.UserListGetVersionDataEvent += this.UserManager_UserListGetVersionDataEvent;
UserManager.IntializeUserManager(this.PathSystemFileFolder);
if (this.SystemConfig.AutomaticLogout == 1)
this.FlagAutomaticLogoutWarningTime = 30;
else
this.FlagAutomaticLogoutWarningTime = 60;
UserManager.UserManager_AutoLogoutSetTimeout(this.SystemConfig.AutomaticLogout, this.FlagAutomaticLogoutWarningTime);
}
private void InitializeAES()
{
Encryption.DllAesEncryption_Event += AesEncryption_Event;
Encryption.DllAesEncryption_GetVersionDataEvent += AesEncryption_GetVersionDataEvent;
Encryption.InitializeEncryption();
}
private void SerialPort_MessageReceive(object data)
{
this.UI_Invoke(delegate
{
this.Serialport_ReceiveDataEvent(data.ToString());
});
}
private void SerialPort_StrMessageReceive(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.WriteString(string.Format("Receive ({0:yyyy-MM-dd HH:mm:ss}): {1} : Dll(Err MSG)", DateTime.Now, data));
});
}
private void SerialPort_ErrStrMessageReceive(object data)
{
this.UI_Invoke(delegate
{
if (this.IsCommunicationLogOpen == true)
this.smartFileCommunicationLog.WriteString(string.Format("Receive ({0:yyyy-MM-dd HH:mm:ss}): {1} : Dll(Err MSG)", DateTime.Now, data));
});
}
private void TrasferSystemParameter(SystemConfigurationItem item)
{
int value = 0;
StringBuilder sb = new StringBuilder();
sb.Append(Helper.StringZeroFillDigits4(item.EquipmentID.ToString()));
sb.Append(Helper.StringZeroFillDigits4(item.EquipmentMode.ToString()));
sb.Append(Helper.StringZeroFillDigits4(item.EquipmentColumns.ToString()));
if (item.IsIndividualNG == false)
sb.Append(Helper.StringZeroFillDigits4("0"));
else
sb.Append(Helper.StringZeroFillDigits4("1"));
if (item.IsDischargeConveyor == false)
sb.Append(Helper.StringZeroFillDigits4("0"));
else
sb.Append(Helper.StringZeroFillDigits4("1"));
value = (int)item.DischargeConveyorDirectionCW;
sb.Append(Helper.StringZeroFillDigits4(value.ToString()));
if (item.IsFeedingConveyor == false)
sb.Append(Helper.StringZeroFillDigits4("0"));
else
sb.Append(Helper.StringZeroFillDigits4("1"));
sb.Append(Helper.StringZeroFillDigits4(item.ImpellerMotorAnglePass.ToString()));
sb.Append(Helper.StringZeroFillDigits4(item.ImpellerMotorBaudrate.ToString()));
if (item.IsImpellerMotorDirectionCW == false)
sb.Append(Helper.StringZeroFillDigits4("0"));
else
sb.Append(Helper.StringZeroFillDigits4("1"));
sb.Append(Helper.StringZeroFillDigits4(item.InputSensorSelect.ToString()));
if(item.IsFeedingConveyorRunPass == true)
sb.Append(Helper.StringZeroFillDigits4("0"));
else
sb.Append(Helper.StringZeroFillDigits4("1"));
sb.Append(Helper.StringZeroFillDigits4(item.ImpellerMotorAngleNG.ToString()));
sb.Append(Helper.StringZeroFillDigits4(item.StepMotorType.ToString()));
sb.Append(Helper.StringZeroFillDigits4("0"));
sb.Append(Helper.StringZeroFillDigits4("0"));
sb.Append(Helper.StringZeroFillDigits4("0"));
sb.Append(Helper.StringZeroFillDigits4("0"));
sb.Append(Helper.StringZeroFillDigits4("0"));
sb.Append(Helper.StringZeroFillDigits4("0"));
this.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._9032_ParameterSystem, sb.ToString());
}
public void TransferProductParameter(int productNumber)
{
string value = "";
StringBuilder sb = new StringBuilder();
ProductItem pItem = new ProductItem();
JudgmentSetItem jItem = new JudgmentSetItem();
this.LoadProductFile(ref pItem, productNumber - 1);
this.LoadJudgmentSetFile(ref jItem, productNumber - 1);
sb.Append(Helper.StringZeroFillDigits7(pItem.UnderRange));
sb.Append(Helper.StringZeroFillDigits7(pItem.OverRange));
sb.Append(Helper.StringZeroFillDigits7(pItem.TareRange));
value = Helper.DoubleToString(jItem.DynamicCorrection, 7);
value = value.Replace(".", "");
sb.Append(Helper.StringZeroFillDigits7(value));
sb.Append(Helper.StringZeroFillDigits4(jItem.Filter.ToString()));
sb.Append(Helper.StringZeroFillDigits4(jItem.JudgmentDelayTime.ToString()));
sb.Append(Helper.StringZeroFillDigits4(jItem.DoubleDelayTime.ToString()));
sb.Append(Helper.StringZeroFillDigits4(jItem.JudgmentCount.ToString()));
sb.Append(Helper.StringZeroFillDigits4(jItem.FeedingConveyorDelayTime.ToString()));
sb.Append(Helper.StringZeroFillDigits4(jItem.FeedingConveyorRunTime.ToString()));
sb.Append(Helper.StringZeroFillDigits4(jItem.RejectConveyorDelayTime.ToString()));
sb.Append(Helper.StringZeroFillDigits4(jItem.RejectConveyorRunTime.ToString()));
sb.Append(Helper.StringZeroFillDigits4(jItem.Sorter1Mode.ToString()));
sb.Append(Helper.StringZeroFillDigits4(jItem.Sorter1DelayTime.ToString()));
sb.Append(Helper.StringZeroFillDigits4(jItem.Sorter1RunTime.ToString()));
sb.Append(Helper.StringZeroFillDigits4("0000"));// Dummy
sb.Append(Helper.StringZeroFillDigits4("0000"));// Dummy
sb.Append(Helper.StringZeroFillDigits4(jItem.FeedSpeed.ToString()));
sb.Append(Helper.StringZeroFillDigits4(jItem.ForcedZeroDelayTime.ToString()));
sb.Append(Helper.StringZeroFillDigits4("0000"));// Dummy
sb.Append(Helper.StringZeroFillDigits4("0000"));// Dummy
sb.Append(Helper.StringZeroFillDigits4("0000"));// Dummy
sb.Append(Helper.StringZeroFillDigits4("0000"));// Dummy
sb.Append(Helper.StringZeroFillDigits4("0000"));// Dummy
sb.Append(Helper.StringZeroFillDigits4("0000"));// Dummy
sb.Append(Helper.StringZeroFillDigits4("0000"));// Dummy
sb.Append(Helper.StringZeroFillDigits4(productNumber.ToString()));
this.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._9016_ParameterProduct, sb.ToString());
}
private void StartThreadMessage1()
{
if (this.smartThread.State != SmartThread.ThreadState.Running)
{
this.smartThread.Start();
this.FlagThreadMessage1 = false;
}
}
#region Uart Communication
private void OpenSmartUartLink()
{
string fullPath = "";
try
{
if (this.FlagDllSerial == true)
SerialMgrComm.serialPortOpen(this.ComPortMainToLCD, 115200, 0, 0, 8);
else
{
if (this.smartSerialPortLink.IsOpen == false)
this.smartSerialPortLink.Open();
}
}
catch
{
}
#region Test 용 통신 로그
fullPath = this.PathDataBackupFolder + "Communicationlog.txt";
this.smartFileCommunicationLog.FilePathName = fullPath;
//this.smartFileCommunicationLog.Open();
//this.IsCommunicationLogOpen = true;
#endregion
#region ADC 통신 로그
fullPath = this.PathDataBackupFolder + this.SystemConfig.UsbID.ToString() + "ADC_log.txt";
this.smartFileAdcLog.FilePathName = fullPath;
#endregion
}
public void CloseSmartUartLink()
{
if (this.FlagDllSerial == true)
SerialMgrComm.serialPortClose(this.ComPortMainToLCD);
else
this.smartSerialPortLink.Close();
}
private bool SizeCheck(string cmd, string strTemp)
{
bool ret = false;
string dataSize = "";
int size = 0;
if (strTemp == null || strTemp.Length == 0)
{
ret = false;
return ret;
}
try
{
if (cmd == "P")
dataSize = strTemp.Substring(14, strTemp.Length - 16);
else // "S"
dataSize = strTemp.Substring(10, strTemp.Length - 12);
size = int.Parse(strTemp.Substring(6, 4).Trim());
}
catch
{
ret = false;
return ret;
}
if (dataSize.Length == size)
ret = true;
else
ret = false;
return ret;
}
private bool Checksumcalculator(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 = Helper.Checksumcalculator(strTemp.Substring(0, strTemp.Length - 2));
if (chkSum == dataChksum)
ret = true;
else
ret = false;
}
return ret;
}
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;
}
private void SetCollectionForStringToByte(ref Collection<byte> collection, string value)
{
byte[] byteData;
if (collection == null)
return;
byteData = Encoding.UTF8.GetBytes(value);
for (int i = 0; i < byteData.Length; i++)
collection.Add(byteData[i]);
}
private void UpdateWeightData(int index, string receiveData)
{
int index2 = 0;
if (this.SystemConfig.IsWeightViewForward == true)
{
this.CollectionWeightData[index].JudgmentStatus = Helper.StringToJudgmentStatus(receiveData.Substring(0, 2));
this.CollectionWeightData[index].Weight = Helper.StringToWeight(receiveData.Substring(2, 5), this.SystemConfig.DecimalPlaces);
this.CollectionWeightData[index].WeightString = receiveData.Substring(2, 5);
this.CollectionWeightData[index].ADCValue = receiveData.Substring(7, 5);
if (this.SystemConfig.EthernetOperationMode == 3)
this.Update30000ModbusData(index);
}
else
{
index2 = this.CollectionWeightData.Count - (index + 1);
this.CollectionWeightData[index2].JudgmentStatus = Helper.StringToJudgmentStatus(receiveData.Substring(0, 2));
this.CollectionWeightData[index2].Weight = Helper.StringToWeight(receiveData.Substring(2, 5), this.SystemConfig.DecimalPlaces);
this.CollectionWeightData[index2].WeightString = receiveData.Substring(2, 5);
this.CollectionWeightData[index2].ADCValue = receiveData.Substring(7, 5);
if (this.SystemConfig.EthernetOperationMode == 3)
this.Update30000ModbusData(index2);
}
}
private void UpdateWeightDataTest(int index, string receiveData)
{
int index2 = 0;
if (this.SystemConfig.IsWeightViewForward == true)
{
this.CollectionWeightDataTest[index].JudgmentStatus = Helper.StringToJudgmentStatus(receiveData.Substring(0, 2));
this.CollectionWeightDataTest[index].Weight = Helper.StringToWeight(receiveData.Substring(2, 5), this.SystemConfig.DecimalPlaces);
this.CollectionWeightDataTest[index].ADCValue = receiveData.Substring(7, 5);
}
else
{
index2 = this.CollectionWeightDataTest.Count - (index + 1);
this.CollectionWeightDataTest[index2].JudgmentStatus = Helper.StringToJudgmentStatus(receiveData.Substring(0, 2));
this.CollectionWeightDataTest[index2].Weight = Helper.StringToWeight(receiveData.Substring(2, 5), this.SystemConfig.DecimalPlaces);
this.CollectionWeightDataTest[index2].ADCValue = receiveData.Substring(7, 5);
}
}
public int TransferData(string command, string id)
{
int ret = 0;
string chkSum = "cc";
StringBuilder sb = new StringBuilder();
sb.Append(command);
sb.Append(id);
chkSum = Helper.Checksumcalculator(sb.ToString());
sb.Append(chkSum);
// Serial Write
if (this.FlagDllSerial == true)
SerialMgrComm.serialPortMessage(this.ComPortMainToLCD, sb.ToString());
else
{
if (this.smartSerialPortLink.IsOpen == true)
this.smartSerialPortLink.WriteFrame(sb.ToString(), SmartSerialPort.CODETYPES.ASCIICODE);
}
// 통신 확인 로그
if (this.IsCommunicationLogOpen == true)
this.smartFileCommunicationLog.WriteString(string.Format("Send ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, sb.ToString()));
return ret;
}
public int TransferDataStream(string command, string id, string address, byte[] datas)
{
int ret = 0, count = 0;
byte[] byteData;
string chkSum = "cc";
Collection<byte> byteCollection = new Collection<byte>();
// command;
this.SetCollectionForStringToByte(ref byteCollection, command);
// id;
this.SetCollectionForStringToByte(ref byteCollection, id);
// data Length
this.SetCollectionForStringToByte(ref byteCollection, Helper.StringZeroFillDigits4((datas.Length + 5).ToString()));
// address
this.SetCollectionForStringToByte(ref byteCollection, address);
// datas Length
this.SetCollectionForStringToByte(ref byteCollection, Helper.StringZeroFillDigits4((datas.Length).ToString()));
// 'A' 고정값
this.SetCollectionForStringToByte(ref byteCollection, "A");
// datas
for (int i = 0; i < datas.Length; i++)
byteCollection.Add(datas[i]);
// chkSum
byteData = new byte[byteCollection.Count];
for (int i = 0; i < byteCollection.Count; i++)
byteData[i] = byteCollection[i];
chkSum = this.Checksumcalculator(byteData);
this.SetCollectionForStringToByte(ref byteCollection, chkSum);
// collection -> byte[]
byteData = new byte[byteCollection.Count];
for (int i = 0; i < byteCollection.Count; i++)
byteData[i] = byteCollection[i];
// Serial Write
if (this.FlagDllSerial == true)
SerialMgrComm.serialPortMessageByte(this.ComPortMainToLCD, byteData, byteData.Length);
else
{
if (this.smartSerialPortLink.IsOpen == true)
this.smartSerialPortLink.WriteFrame(byteData);
}
// 통신 확인 로그
if (this.IsCommunicationLogOpen == true)
{
string log = "";
for (int i = 0; i < byteCollection.Count; i++)
log += byteCollection[i].ToString("X2");
this.smartFileCommunicationLog.WriteString(string.Format("Send ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, log));
}
return ret;
}
public int TransferDataStream(string command, string id, string address, string data)
{
int ret = 0;
string chkSum = "cc";
StringBuilder sb = new StringBuilder();
sb.Append(command);
sb.Append(id);
sb.Append(Helper.StringZeroFillDigits4(data.Length.ToString()));
sb.Append(address);
sb.Append(data);
chkSum = Helper.Checksumcalculator(sb.ToString());
sb.Append(chkSum);
// Serial Write
if (this.FlagDllSerial == true)
SerialMgrComm.serialPortMessage(this.ComPortMainToLCD, sb.ToString());
else
{
if (this.smartSerialPortLink.IsOpen == true)
this.smartSerialPortLink.WriteFrame(sb.ToString(), SmartSerialPort.CODETYPES.ASCIICODE);
}
// 통신 확인 로그
if (this.IsCommunicationLogOpen == true)
this.smartFileCommunicationLog.WriteString(string.Format("Send ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, sb.ToString()));
return ret;
}
private void ReceiveData(string strTemp)
{
int ret = 0;
try
{
switch (strTemp[0])
{
case 'C':
if ((ret = this.ReceiveCommandC(strTemp)) != 0)
return;
break;
case 'P':
if ((ret = this.ReceiveCommandP(strTemp)) != 0)
return;
break;
case 'S':
if ((ret = this.ReceiveCommandS(strTemp)) != 0)
return;
break;
default:
break;
}
}
catch
{
}
}
private void ReceiveData()
{
int ret = 0;
string strTemp = "";
byte[] readByte;
SmartSerialPort.FRAMEDATAREADSTATUS receiveDataState = SmartSerialPort.FRAMEDATAREADSTATUS.EMPTY;
try
{
receiveDataState = this.smartSerialPortLink.ReadQueue(out readByte);
strTemp = Encoding.Default.GetString(readByte, 0, readByte.Length);
}
catch (Exception e)
{
return;
}
if ((receiveDataState == SmartSerialPort.FRAMEDATAREADSTATUS.EMPTY) || (receiveDataState == SmartSerialPort.FRAMEDATAREADSTATUS.FAILDATA))
{
return;
}
try
{
switch (strTemp[0])
{
case 'C':
if ((ret = this.ReceiveCommandC(strTemp)) != 0)
return;
break;
case 'P':
if ((ret = this.ReceiveCommandP(strTemp)) != 0)
return;
break;
case 'S':
if ((ret = this.ReceiveCommandS(strTemp)) != 0)
return;
break;
default:
break;
}
}
catch
{
}
}
private int ReceiveCommandC(string strTemp)
{
int ret = 0;
string cmd = "";
if (this.Checksumcalculator(strTemp) == false)
{
// 로그
if (this.IsCommunicationLogOpen == true)
this.smartFileCommunicationLog.WriteString(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.WriteString(string.Format("Receive ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, strTemp));
cmd = strTemp.Substring(0, 3);
switch (cmd)
{
case "CI0":
this.IsBootingComplete = false;
this.TransferDataStream(CommunicationCommand.Read, CommunicationID.MainBoard, CommunicationAddress._6901_ParameterRead, "");
//this.TrasferSystemParameter(this.SystemConfig);
break;
case "CBS":
#region Start
this.EquipmentStatus = DataStore.EquipmentStatus.Start;
// 운전시 중량 0 으로 Clear
foreach (WeightData data in this.CollectionWeightData)
{
data.Weight = 0.0;
}
// 피드백 데이터 삭제
foreach (FeedBackSystem1 data in this.CollectionFeedbackStatus)
{
data.ClearDataAll();
}
// CH3 OPT1 모드일때
if (this.SystemConfig.Serial3Mode == 1)
{
this.timerOPT1.Enabled = false;
this.UartCom3TransferDataABFood(DataStore.ABFoodDataCommand.Normal, (int)DataStore.ABFoodDataStatus.Normal);
}
// 연속NG 메시지박스
this.ChildFormMainDisplay.UpdateAlarmMessage3Display(false);
// Part 11
if (this.SystemConfig.IsOptPart11 == true)
this.SetTrackingHistoryData(DataStore.TrackingOperation.EquipmentStart, "");
this.ChildFormMainDisplay.UpdateEquipmentStatusDisplay(this.EquipmentStatus);
this.ChildFormEquipmentTest.UpdateEquipmentStatusDisplay(this.EquipmentStatus);
this.ChildFormSystemSetting.UpdateEquipmentStatusDisplay(this.EquipmentStatus);
this.ModbusCommonDataSend();
#endregion
break;
case "CBT":
#region Stop
this.EquipmentStatus = DataStore.EquipmentStatus.Stop;
// 생산속도 Clear
foreach (WeightData data in this.CollectionWeightData)
{
data.ProductionSpeed = 0;
data.IsStart = false;
}
// 연속 NG 수량 Clear
for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++)
{
this.CollectionWeightData[i].ContinuousNG = 0;
this.CollectionWeightData[i].IsContinuousNG = false;
}
// CH3 OPT1 모드일때
// 정지시 1초마다 데이터 전송(태국ABFood)
if (this.SystemConfig.Serial3Mode == 1)
{
if (this.timerOPT1.Enabled == false)
this.timerOPT1.Enabled = true;
}
else
this.timerOPT1.Enabled = false;
// 이더넷
if (this.SystemConfig.EthernetOperationMode == 2)
this.EthernetClientDisconnect();
// Part 11
if (this.SystemConfig.IsOptPart11 == true)
this.SetTrackingHistoryData(DataStore.TrackingOperation.EquipmentStop, "");
this.ChildFormMainDisplay.UpdateEquipmentStatusDisplay(this.EquipmentStatus);
this.ChildFormEquipmentTest.UpdateEquipmentStatusDisplay(this.EquipmentStatus);
this.ChildFormSystemSetting.UpdateEquipmentStatusDisplay(this.EquipmentStatus);
#endregion
break;
case "CBE":
break;
case "CBZ":
break;
default:
break;
}
return ret;
}
private int ReceiveCommandP(string strTemp)
{
int ret = 0;
string cmd = "", address = "", lane = "", receiveData = "";
// SIZE 확인
if (this.SizeCheck("P", strTemp) == false)
{
// 로그
if (this.IsCommunicationLogOpen == true)
this.smartFileCommunicationLog.WriteString(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.Checksumcalculator(strTemp) == false)
{
// 로그
if (this.IsCommunicationLogOpen == true)
this.smartFileCommunicationLog.WriteString(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.WriteString(string.Format("Receive ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, strTemp));
cmd = strTemp.Substring(0, 3);
lane = strTemp.Substring(5, 1);
address = strTemp.Substring(10, 4);
receiveData = strTemp.Substring(14, strTemp.Length - 16);
switch (cmd)
{
case "PR0":
if ((ret = this.ReceiveCommandPR0(lane, address, receiveData)) != 0)
return ret = -1;
break;
case "PW0":
if ((ret = this.ReceiveCommandPW0(lane, address, receiveData)) != 0)
return ret = -1;
break;
case "PB0":
if ((ret = this.ReceiveCommandPB0(lane, address, receiveData)) != 0)
return ret = -1;
break;
default:
break;
}
return ret;
}
private int ReceiveCommandS(string strTemp)
{
int ret = 0;
string cmd = "", lane = "", receiveData = "";
string transferNum = "";
// SIZE 확인
if (this.SizeCheck("S", strTemp) == false)
{
// 로그
if (this.IsCommunicationLogOpen == true)
this.smartFileCommunicationLog.WriteString(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.Checksumcalculator(strTemp) == false)
{
// 로그
if (this.IsCommunicationLogOpen == true)
this.smartFileCommunicationLog.WriteString(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.WriteString(string.Format("Receive ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, strTemp));
cmd = strTemp.Substring(0, 3);
transferNum = strTemp.Substring(3, 1);
lane = strTemp.Substring(5, 1);
receiveData = strTemp.Substring(10, strTemp.Length - 12);
switch (cmd)
{
case "SN0":
if ((ret = this.ReceiveCommandSN0(lane, receiveData)) != 0)
return ret;
break;
case "SR0":
if (this.TransferNum != transferNum)
this.TransferNum = transferNum;
else
return ret = -1;
if ((ret = this.ReceiveCommandSR0(lane, receiveData)) != 0)
return ret;
break;
case "SC0":
if ((ret = this.ReceiveCommandSC0(lane, receiveData)) != 0)
return ret;
break;
case "SF0":
if ((ret = this.ReceiveCommandSF0(lane, receiveData)) != 0)
return ret;
break;
case "SG0":
if ((ret = this.ReceiveCommandSG0(lane, receiveData)) != 0)
return ret;
break;
case "ST0":
if ((ret = this.ReceiveCommandST0(lane, receiveData)) != 0)
return ret;
break;
case "ST1":
if ((ret = this.ReceiveCommandST1(lane, receiveData)) != 0)
return ret;
break;
default:
break;
}
return ret;
}
// 파라미터 읽기 응답
private int ReceiveCommandPR0(string lane, string address, string receiveData)
{
int ret = 0, iValue = 0;
string sValue = "";
try
{
switch (address)
{
case "1104":
#region Value Assign
// value는 총 7자리(0000000). 뒤의 6자리가 net value.
// 오른쪽 끝부터 두자리씩 3개의 value는 각각 1~4, 5~8, 9~12열의 개별 회전 방향 정보임.
// 예) receiveData = 0151413이라면, 13을 2진수로 변환한 값 1101을 뒤집어 1011로 변환하면 왼쪽부터 순서대로 1~4열 개별방향을 알 수 있음.
string[] tempArray = new string[3];
int a = 0, c = 0;
c = int.Parse(receiveData.Substring(1, 6));
receiveData = c.ToString("D7");
// receiveData를 3개의 값으로 나누고, 2진수로 변환
for (int i = 0; i < 3; i++)
tempArray[2 - i] = receiveData.Substring((i + 1) + (i * 1), 2);
// 2진수로 변환한 값 Collection에 넣기
for (int i = 0; i < tempArray.Length; i++)
{
int quotient = int.Parse(tempArray[i]);
while (a < 4 * (i + 1))
{
this.CollectionIndividualDirection[a] = Helper.ReminderByTwo(quotient.ToString());
quotient /= 2;
a++;
if (quotient < 2)
{
this.CollectionIndividualDirection[a] = quotient.ToString();
a++;
if (a < 4 * (i + 1))
{
while (a < 4 * (i + 1))
{
this.CollectionIndividualDirection[a] = "0";
a++;
}
}
}
}
}
#endregion
this.ChildFormMotorSetting.UpdateMotorDirectionDisplay(this.EquipmentStatus, this.CollectionIndividualDirection);
break;
case "1500":
#region Value Assign
for (int i = 0; i < this.SystemConfig.EquipmentColumns + 1; i++)
{
this.CollectionVersion[i] = receiveData.Substring(i * 4, 4);
}
this.ChildFormInformation.UpdateProgreamVersionDisplay(this.EquipmentStatus, this.CollectionVersion);
#endregion
break;
case "2001":
#region Value Assign
iValue = int.Parse(receiveData);
if (iValue <= 0 || iValue > 1000)
return ret = -1;
this.SystemConfig.ProductNumber = iValue;
#endregion
// 최초에 부팅이 완료 되었는지 확인
if (this.IsBootingComplete == false)
{
this.IsBootingComplete = true;
// 부팅 후 영점이안맞아 강제로 영점 잡는 명령 보냄..(V1.0.3)
this.TransferData(CommunicationCommand.Zero, CommunicationID.SubBoardAll);
}
this.SaveSystemConfigurationFile(this.SystemConfig);
this.LoadProductFile(ref this.CurrentProductItem, this.SystemConfig.ProductNumber - 1);
this.LoadCounterFile(ref this.CollectionWeightData, this.SystemConfig.ProductNumber - 1);
this.LoadJudgmentSetFile(ref this.CurrentJudgmentSetItem, this.SystemConfig.ProductNumber - 1);
this.LoadFeedbackItemFile(ref this.CurrentFeedbackItem, this.SystemConfig.ProductNumber - 1);
// 생산속도 Clear
foreach (WeightData data in this.CollectionWeightData)
{
data.ProductionSpeed = 0;
data.IsStart = false;
}
// 피드백 데이터 삭제
foreach (FeedBackSystem1 data in this.CollectionFeedbackStatus)
{
data.ClearData();
}
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
this.ChildFormMainDisplay.UpdateCurrentProductDisplay(this.EquipmentStatus, this.CurrentProductItem, this.CurrentJudgmentSetItem, this.CollectionWeightData);
else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormSystemSetting)
this.ChildFormSystemSetting.UpdateItemNoDisplay(this.EquipmentStatus, this.CurrentProductItem, this.CurrentJudgmentSetItem);
break;
case "3001":
#region Value Assign
for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++)
this.CollectionMaxWeight[i] = receiveData.Substring(i * 7, 7).Trim();
#endregion
this.ChildFormConfiguration.UpdateMaxWeightDisplay(this.EquipmentStatus, this.CollectionMaxWeight);
break;
case "3002":
#region Value Assign
for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++)
this.CollectionBalanceWeight[i] = receiveData.Substring(i * 7, 7).Trim();
#endregion
this.ChildFormConfiguration.UpdateBalanceWeightDisplay(this.EquipmentStatus, this.CollectionBalanceWeight);
break;
case "3003":
#region Value Assign
for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++)
this.CollectionDigit[i] = receiveData.Substring(i * 7, 7).Trim();
#endregion
this.ChildFormConfiguration.UpdateDigitDisplay(this.EquipmentStatus, this.CollectionDigit);
break;
case "3901":
#region Value Assign
this.CurrentCalibrationItem.MaxWeight = receiveData.Substring(0, 7).Trim();
this.CurrentCalibrationItem.BalanceWeight = receiveData.Substring(7, 7).Trim();
this.CurrentCalibrationItem.Digit = receiveData.Substring(14, 7).Trim();
switch (this.SystemConfig.EquipmentColumns)
{
case 7:
this.CurrentCalibrationItem.Constant1 = receiveData.Substring(21, 7).Trim();
this.CurrentCalibrationItem.Constant2 = receiveData.Substring(28, 7).Trim();
this.CurrentCalibrationItem.Constant3 = receiveData.Substring(35, 7).Trim();
this.CurrentCalibrationItem.Constant4 = receiveData.Substring(42, 7).Trim();
this.CurrentCalibrationItem.Constant5 = receiveData.Substring(49, 7).Trim();
this.CurrentCalibrationItem.Constant6 = receiveData.Substring(56, 7).Trim();
this.CurrentCalibrationItem.Constant7 = receiveData.Substring(63, 7).Trim();
break;
case 8:
this.CurrentCalibrationItem.Constant1 = receiveData.Substring(21, 7).Trim();
this.CurrentCalibrationItem.Constant2 = receiveData.Substring(28, 7).Trim();
this.CurrentCalibrationItem.Constant3 = receiveData.Substring(35, 7).Trim();
this.CurrentCalibrationItem.Constant4 = receiveData.Substring(42, 7).Trim();
this.CurrentCalibrationItem.Constant5 = receiveData.Substring(49, 7).Trim();
this.CurrentCalibrationItem.Constant6 = receiveData.Substring(56, 7).Trim();
this.CurrentCalibrationItem.Constant7 = receiveData.Substring(63, 7).Trim();
this.CurrentCalibrationItem.Constant8 = receiveData.Substring(70, 7).Trim();
break;
case 10:
this.CurrentCalibrationItem.Constant1 = receiveData.Substring(21, 7).Trim();
this.CurrentCalibrationItem.Constant2 = receiveData.Substring(28, 7).Trim();
this.CurrentCalibrationItem.Constant3 = receiveData.Substring(35, 7).Trim();
this.CurrentCalibrationItem.Constant4 = receiveData.Substring(42, 7).Trim();
this.CurrentCalibrationItem.Constant5 = receiveData.Substring(49, 7).Trim();
this.CurrentCalibrationItem.Constant6 = receiveData.Substring(56, 7).Trim();
this.CurrentCalibrationItem.Constant7 = receiveData.Substring(63, 7).Trim();
this.CurrentCalibrationItem.Constant8 = receiveData.Substring(70, 7).Trim();
this.CurrentCalibrationItem.Constant9 = receiveData.Substring(77, 7).Trim();
this.CurrentCalibrationItem.Constant10 = receiveData.Substring(84, 7).Trim();
break;
case 12:
this.CurrentCalibrationItem.Constant1 = receiveData.Substring(21, 7).Trim();
this.CurrentCalibrationItem.Constant2 = receiveData.Substring(28, 7).Trim();
this.CurrentCalibrationItem.Constant3 = receiveData.Substring(35, 7).Trim();
this.CurrentCalibrationItem.Constant4 = receiveData.Substring(42, 7).Trim();
this.CurrentCalibrationItem.Constant5 = receiveData.Substring(49, 7).Trim();
this.CurrentCalibrationItem.Constant6 = receiveData.Substring(56, 7).Trim();
this.CurrentCalibrationItem.Constant7 = receiveData.Substring(63, 7).Trim();
this.CurrentCalibrationItem.Constant8 = receiveData.Substring(70, 7).Trim();
this.CurrentCalibrationItem.Constant9 = receiveData.Substring(77, 7).Trim();
this.CurrentCalibrationItem.Constant10 = receiveData.Substring(84, 7).Trim();
this.CurrentCalibrationItem.Constant11 = receiveData.Substring(91, 7).Trim();
this.CurrentCalibrationItem.Constant12 = receiveData.Substring(98, 7).Trim();
break;
default:
break;
}
#endregion
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormCalibration)
this.ChildFormCalibration.UpdateConfiguration(this.EquipmentStatus, this.CurrentCalibrationItem);
else
this.ChildFormEquipmentTest.UpdateCalibrationItemDisplay(this.EquipmentStatus, this.CurrentCalibrationItem);
break;
case "4001":
#region Value Assign
for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++)
this.CollectionZeroParameterTime[i] = receiveData.Substring(i * 4, 4).Trim();
#endregion
this.ChildFormConfiguration.UpdateZeroParameterTimeDisplay(this.EquipmentStatus, this.CollectionZeroParameterTime);
break;
case "4002":
#region Value Assign
for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++)
this.CollectionZeroParameterRange[i] = receiveData.Substring(i * 4, 4).Trim();
#endregion
this.ChildFormConfiguration.UpdateZeroParameterRangeDisplay(this.EquipmentStatus, this.CollectionZeroParameterRange);
break;
case "4003":
#region Value Assign
for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++)
this.CollectionZeroParameterVariates[i] = receiveData.Substring(i * 4, 4).Trim();
#endregion
this.ChildFormConfiguration.UpdateZeroParameterVariateDisplay(this.EquipmentStatus, this.CollectionZeroParameterVariates);
break;
case "4901":
#region Value Assign
this.CurrentZeroParameterItem.Time = receiveData.Substring(0, 4).Trim();
this.CurrentZeroParameterItem.Range = receiveData.Substring(4, 4).Trim();
this.CurrentZeroParameterItem.Variate = receiveData.Substring(8, 4).Trim();
this.CurrentZeroParameterItem.Mode = receiveData.Substring(12, 4).Trim();
#endregion
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormConfiguration)
this.ChildFormConfiguration.UpdateZeroParameterDisplay(this.EquipmentStatus, this.CurrentZeroParameterItem);
else
{
this.ChildFormEquipmentTest.UpdateZeroParameterDisplay(this.EquipmentStatus, this.CurrentZeroParameterItem);
this.TransferDataStream(CommunicationCommand.Read, CommunicationID.MainBoard, CommunicationAddress._6901_ParameterRead, "");
}
break;
case "5001":
#region Value Assign
for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++)
this.CollectionFilter[i] = receiveData.Substring(i * 4, 4).Trim();
#endregion
this.ChildFormConfiguration.UpdateFilterDisplay(this.EquipmentStatus, this.CollectionFilter);
break;
case "5013":
#region Value Assign
sValue = receiveData.Substring(0, 4).Trim();
#endregion
this.ChildFormSystemSetting.UpdateP5013Display(this.EquipmentStatus, sValue);
break;
case "6901":
#region Value Assign
this.CurrentOptionParameterItem.BuzzerOnTime = receiveData.Substring(0, 4).Trim();
this.CurrentOptionParameterItem.RelayOnTime = receiveData.Substring(4, 4).Trim();
this.CurrentOptionParameterItem.PassAlarm = receiveData.Substring(8, 4).Trim();
this.CurrentOptionParameterItem.PassAlarmCount = receiveData.Substring(12, 4).Trim();
this.CurrentOptionParameterItem.DoubleEnter = receiveData.Substring(16, 4).Trim();
this.CurrentOptionParameterItem.Chattering = receiveData.Substring(20, 4).Trim();
#endregion
if (this.IsBootingComplete == false)
{
this.TrasferSystemParameter(this.SystemConfig);
}
else
{
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormConfiguration)
this.ChildFormConfiguration.UpdateOptionParameterDisplay(this.EquipmentStatus, this.CurrentOptionParameterItem);
else
this.ChildFormEquipmentTest.UpdateOptionParameterDisplay(this.EquipmentStatus, this.CurrentOptionParameterItem, this.SystemConfig);
}
break;
default:
break;
}
}
catch
{
ret = -1;
}
return ret;
}
// 파라미터 쓰기 응답
private int ReceiveCommandPW0(string lane, string address, string receiveData)
{
int ret = 0;
DataStore.ResponseData response = DataStore.ResponseData.NAK;
try
{
if (receiveData == "0000")
response = DataStore.ResponseData.NAK;
else
response = DataStore.ResponseData.ACK;
switch (address)
{
case "9002":
if (response == DataStore.ResponseData.ACK)
this.TransferProductParameter(this.SystemConfig.ProductNumber);
break;
case "9032":
if (response == DataStore.ResponseData.ACK)
this.TransferProductParameter(this.SystemConfig.ProductNumber);
break;
case "9016":
if (response == DataStore.ResponseData.ACK)
this.TransferDataStream(CommunicationCommand.Read, CommunicationID.MainBoard, CommunicationAddress._2001_ProductNumber, "");
break;
default:
break;
}
}
catch
{
ret = -1;
}
return ret;
}
// Bypass to motor
private int ReceiveCommandPB0(string lane, string address, string receiveData)
{
int ret = 0;
DataStore.ResponseData response = DataStore.ResponseData.NAK;
try
{
if (receiveData == "0000")
response = DataStore.ResponseData.NAK;
else
response = DataStore.ResponseData.ACK;
switch (address)
{
case "1101":
break;
case "1102":
break;
case "1103":
break;
default:
break;
}
}
catch
{
ret = -1;
}
return ret;
}
// 정지시 중량
private int ReceiveCommandSN0(string lane, string receiveData)
{
int ret = 0;
try
{
switch (lane)
{
case "Z":
#region Value Assign
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
{
if (this.SystemConfig.IsWeightViewForward == true)
{
for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Stop)
{
this.CollectionWeightData[i].Status = Helper.StringToWeightStatus(receiveData.Substring(i * 12, 2));
this.CollectionWeightData[i].Weight = Helper.StringToWeight(receiveData.Substring(i * 12 + 2, 5), this.SystemConfig.DecimalPlaces);
this.CollectionWeightData[i].ADCValue = receiveData.Substring(i * 12 + 7, 5);
}
else
{
this.CollectionWeightData[i].Status = Helper.StringToWeightStatus(receiveData.Substring(i * 12, 2));
}
}
}
else
{
for (int i = 1; i <= this.SystemConfig.EquipmentColumns; i++)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Stop)
{
this.CollectionWeightData[this.SystemConfig.EquipmentColumns - i].Status = Helper.StringToWeightStatus(receiveData.Substring((i-1) * 12, 2));
this.CollectionWeightData[this.SystemConfig.EquipmentColumns - i].Weight = Helper.StringToWeight(receiveData.Substring((i - 1) * 12 + 2, 5), this.SystemConfig.DecimalPlaces);
this.CollectionWeightData[this.SystemConfig.EquipmentColumns - i].ADCValue = receiveData.Substring((i - 1) * 12 + 7, 5);
}
else
{
this.CollectionWeightData[this.SystemConfig.EquipmentColumns - i].Status = Helper.StringToWeightStatus(receiveData.Substring((i - 1) * 12, 2));
}
}
}
}
else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest)
{
if (this.SystemConfig.IsWeightViewForward == true)
{
for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++)
{
this.CollectionWeightDataTest[i].Status = Helper.StringToWeightStatus(receiveData.Substring(i * 12, 2));
this.CollectionWeightDataTest[i].Weight = Helper.StringToWeight(receiveData.Substring(i * 12 + 2, 5), this.SystemConfig.DecimalPlaces);
this.CollectionWeightDataTest[i].ADCValue = receiveData.Substring(i * 12 + 7, 5);
}
}
else
{
for (int i = 1; i <= this.SystemConfig.EquipmentColumns; i++)
{
this.CollectionWeightDataTest[this.SystemConfig.EquipmentColumns - i].Status = Helper.StringToWeightStatus(receiveData.Substring((i - 1) * 12, 2));
this.CollectionWeightDataTest[this.SystemConfig.EquipmentColumns - i].Weight = Helper.StringToWeight(receiveData.Substring((i - 1) * 12 + 2, 5), this.SystemConfig.DecimalPlaces);
this.CollectionWeightDataTest[this.SystemConfig.EquipmentColumns - i].ADCValue = receiveData.Substring((i - 1) * 12 + 7, 5);
}
}
}
#endregion
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
{
this.ChildFormMainDisplay.UpdateStopWeightDisplay(this.EquipmentStatus, this.CollectionWeightData);
}
else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest)
{
this.ChildFormEquipmentTest.UpdateStopWeightDisplay(this.EquipmentStatus, this.CollectionWeightDataTest);
if (this.IsAdcLogOpen == true)
{
if (this.FlagADCValueWrite == true)
{
StringBuilder sb = new StringBuilder();
for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++)
{
sb.Append(this.CollectionWeightDataTest[i].ADCValue);
sb.Append(",");
}
this.smartFileAdcLog.WriteString(string.Format("Receive,{0:yyyy-MM-dd HH:mm:ss},{1}", DateTime.Now, sb.ToString()));
this.FlagADCValueWrite = false;
}
}
}
break;
default:
break;
}
}
catch
{
ret = -1;
}
return ret;
}
// 운전시 중량
private int ReceiveCommandSR0(string lane, string receiveData)
{
bool result = false;
int ret = 0;
string etherStringData = "";
StringBuilder sb = new StringBuilder();
try
{
if (this.SystemConfig.EthernetMode == 3)
{
if (this.IsModbusCommonDataSend == false)
{
this.ModbusCommonDataSend();
this.IsModbusCommonDataSend = true;
}
}
switch (lane)
{
case "A":
#region 1열
#region Value Assign
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
this.UpdateWeightData(0, receiveData);
else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest)
this.UpdateWeightDataTest(0, receiveData);
#endregion
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
{
#region FormMainDisplay
#region 통합 전송하기 위한 데이터 체크
// 중량 갱신이 되었는지 체크
if (this.SystemConfig.IsWeightViewForward == true)
this.CollectionWeightData[0].IsUpdate = true;
else
this.CollectionWeightData[this.CollectionWeightData.Count - 1].IsUpdate = true;
#endregion
#region 화면 갱신, 데이터 백업
if (this.SystemConfig.IsWeightViewForward == true)
{
this.ChildFormMainDisplay.UpdateStartWeightDisplay1(this.EquipmentStatus, this.CollectionWeightData[0]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay1(this.EquipmentStatus, this.CollectionFeedbackStatus[0]);
}
else
{
switch (this.SystemConfig.EquipmentColumns)
{
case 7:
this.ChildFormMainDisplay.UpdateStartWeightDisplay7(this.EquipmentStatus, this.CollectionWeightData[6]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay7(this.EquipmentStatus, this.CollectionFeedbackStatus[6]);
break;
case 8:
this.ChildFormMainDisplay.UpdateStartWeightDisplay8(this.EquipmentStatus, this.CollectionWeightData[7]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay8(this.EquipmentStatus, this.CollectionFeedbackStatus[7]);
break;
case 10:
this.ChildFormMainDisplay.UpdateStartWeightDisplay10(this.EquipmentStatus, this.CollectionWeightData[9]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay10(this.EquipmentStatus, this.CollectionFeedbackStatus[9]);
break;
case 12:
this.ChildFormMainDisplay.UpdateStartWeightDisplay12(this.EquipmentStatus, this.CollectionWeightData[11]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay12(this.EquipmentStatus, this.CollectionFeedbackStatus[11]);
break;
default:
break;
}
}
#endregion
#region 이중진입
if (this.CurrentOptionParameterItem.DoubleEnter == "1")
{
// 이중진입(상한 판정시 하한설정값에 두배이면 이중) 이면 STOP
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.CollectionWeightData[0].JudgmentStatus == DataStore.JudgmentStatus.Double)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
this.ChildFormMainDisplay.UpdateAlarmMessage1Display();
}
}
else
{
if (this.CollectionWeightData[this.CollectionWeightData.Count - 1].JudgmentStatus == DataStore.JudgmentStatus.Double)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
this.ChildFormMainDisplay.UpdateAlarmMessage1Display();
}
}
}
#endregion
#region 입력센서 연속 입력 시 정지
if (this.SystemConfig.IsEmergencyStopEntrySensorError == true)
{
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.CollectionWeightData[0].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
// 메시지 11 - 입력센서 에러에 의해 정지하였습니다
this.StartThreadMessage1();
}
}
else
{
if (this.CollectionWeightData[this.CollectionWeightData.Count - 1].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
// 메시지 11 - 입력센서 에러에 의해 정지하였습니다
this.StartThreadMessage1();
}
}
}
#endregion
#region 이더넷
if (this.SystemConfig.IsEthernetEnable == true)
{
if (this.SystemConfig.EthernetMode == 1)
{
#region OPT2
if (this.SystemConfig.IsIntegratedTransmission == false)
{
#region 개별 전송
if (this.SystemConfig.IsWeightViewForward == true)
etherStringData = this.Protocol_OPT2(this.SystemConfig, this.CollectionWeightData[0], 1);
else
etherStringData = this.Protocol_OPT2(this.SystemConfig, this.CollectionWeightData[this.CollectionWeightData.Count - 1], this.CollectionWeightData.Count);
this.SendEthernetData(etherStringData);
#endregion
}
#endregion
}
else if (this.SystemConfig.EthernetMode == 2)
{
#region OPT3
if (this.SystemConfig.IsIntegratedTransmission == false)
{
#region 개발 전송
if (this.SystemConfig.IsWeightViewForward == true)
etherStringData = this.Protocol_OPT3(this.SystemConfig, this.CollectionWeightData[0], 1, this.CurrentProductItem);
else
etherStringData = this.Protocol_OPT3(this.SystemConfig, this.CollectionWeightData[this.CollectionWeightData.Count - 1], this.CollectionWeightData.Count, this.CurrentProductItem);
this.SendEthernetData(etherStringData);
#endregion
}
#endregion
}
else if (this.SystemConfig.EthernetMode == 3)
{
#region Modus
byte[] etherByteData = this.Modbus.WriteMultipleRegisterTCP(
this.Protocol_Modbus_Client_Write_Lane_Data(0), this.SystemConfig.ModbusTcpStartAddress + (1 * 50) + 140);
this.EthernetWeightDataForModbus(etherByteData);
#endregion
}
else if (this.SystemConfig.EthernetMode == 4)
{
#region OPT5
if (this.SystemConfig.IsIntegratedTransmission == false)
{
#region 개별 전송
if (this.SystemConfig.IsWeightViewForward == true)
etherStringData = this.Protocol_OPT5(this.SystemConfig, this.CollectionWeightData[0], 1, this.CurrentProductItem);
else
etherStringData = this.Protocol_OPT5(this.SystemConfig, this.CollectionWeightData[this.CollectionWeightData.Count - 1], this.CollectionWeightData.Count, this.CurrentProductItem);
this.SendEthernetData(etherStringData);
#endregion
}
#endregion
}
}
#endregion
#region Serial3
if (this.SystemConfig.Serial3Mode == 1) // OPT1 - ABFood 통신 피드백
{
#region Serial3 Mode1
if (this.SystemConfig.EquipmentMode == 2)
{
if (this.timerTimeoutOPT1.Enabled == false)
this.timerTimeoutOPT1.Enabled = true;
// sensor error, double(이중) 이면 STOP
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.CollectionWeightData[0].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
}
}
else
{
if (this.CollectionWeightData[this.CollectionWeightData.Count - 1].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
}
}
// EquipmentColumns 수 만큼 중량이 들어왔는지 체크 후 데이터 전송하는 함수(EquipmentColumns 갯수가 다 들어아야 데이터 전송함)
this.UartCom3WeightDataTransfer(this.CollectionWeightData);
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 2) // OPT2 - 중량 데이터 피드백
{
#region Serial3 Mode2
if (this.SystemConfig.IsIntegratedTransmission == false)
{
#region 개발 전송
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT2(1, this.CollectionWeightData[0]);
else
this.SerialCH3OPT2(this.CollectionWeightData.Count, this.CollectionWeightData[this.CollectionWeightData.Count - 1]);
#endregion
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 3) // OPT3 - 중량 데이터 피드백 (기준값 포함)
{
#region Serial3 Mode3
if (this.SystemConfig.IsIntegratedTransmission == false)
{
#region 개발 전송
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT3(1, this.CollectionWeightData[0]);
else
this.SerialCH3OPT3(this.CollectionWeightData.Count, this.CollectionWeightData[this.CollectionWeightData.Count - 1]);
#endregion
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 4) // OPT4 - 피드백 시스템1
{
#region Serial3 Mode4
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT4(1, this.CollectionWeightData[0]);
else
this.SerialCH3OPT4(this.CollectionWeightData.Count, this.CollectionWeightData[this.CollectionWeightData.Count - 1]);
#endregion
}
else if (this.SystemConfig.Serial3Mode == 5) // Printer - 산업용 프린터
{
#region Serial3 Mode5
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.SystemConfig.IsPrintPerProductEnable == true)
this.SerialCH3Printer(1, this.CollectionWeightData[0]);
}
else
{
if (this.SystemConfig.IsPrintPerProductEnable == true)
this.SerialCH3Printer(this.CollectionWeightData.Count, this.CollectionWeightData[this.CollectionWeightData.Count - 1]);
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 6) // OPT5 - 중량 데이터 피드백 (중량설정값 포함)
{
#region Serial3 Mode6
if (this.SystemConfig.IsIntegratedTransmission == false)
{
#region 개별 전송
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT5(1, this.CollectionWeightData[0]);
else
this.SerialCH3OPT5(this.CollectionWeightData.Count, this.CollectionWeightData[this.CollectionWeightData.Count - 1]);
#endregion
}
#endregion
}
#endregion
if (this.SystemConfig.IsIntegratedTransmission == true)
{
#region 통합 전송
if (this.timerTimeOutTransmission.Enabled == false)
this.timerTimeOutTransmission.Enabled = true;
// EquipmentColumns 수 만큼 중량이 들어왔는지 체크 후 데이터 전송하는 함수(EquipmentColumns 갯수가 다 들어아야 데이터 전송함)
this.IntegratedTransmissionCheck(this.CollectionWeightData);
#endregion
}
#endregion
}
else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest)
{
#region FormEquipmentTest
if (this.SystemConfig.IsWeightViewForward == true)
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay1(this.EquipmentStatus, this.CollectionWeightDataTest[0]);
else
{
switch (this.SystemConfig.EquipmentColumns)
{
case 7:
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay7(this.EquipmentStatus, this.CollectionWeightDataTest[6]);
break;
case 8:
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay8(this.EquipmentStatus, this.CollectionWeightDataTest[7]);
break;
case 10:
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay10(this.EquipmentStatus, this.CollectionWeightDataTest[9]);
break;
case 12:
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay12(this.EquipmentStatus, this.CollectionWeightDataTest[11]);
break;
default:
break;
}
}
#endregion
}
#endregion
break;
case "B":
#region 2열
#region Value Assign
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
this.UpdateWeightData(1, receiveData);
else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest)
this.UpdateWeightDataTest(1, receiveData);
#endregion
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
{
#region FormMainDisplay
#region 통합 전송하기 위한 데이터 체크
// 중량 갱신이 되었는지 체크
if (this.SystemConfig.IsWeightViewForward == true)
this.CollectionWeightData[1].IsUpdate = true;
else
this.CollectionWeightData[this.CollectionWeightData.Count - 2].IsUpdate = true;
#endregion
#region 화면 갱신, 데이터 백업
if (this.SystemConfig.IsWeightViewForward == true)
{
this.ChildFormMainDisplay.UpdateStartWeightDisplay2(this.EquipmentStatus, this.CollectionWeightData[1]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay2(this.EquipmentStatus, this.CollectionFeedbackStatus[1]);
}
else
{
switch (this.SystemConfig.EquipmentColumns)
{
case 7:
this.ChildFormMainDisplay.UpdateStartWeightDisplay6(this.EquipmentStatus, this.CollectionWeightData[5]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay6(this.EquipmentStatus, this.CollectionFeedbackStatus[5]);
break;
case 8:
this.ChildFormMainDisplay.UpdateStartWeightDisplay7(this.EquipmentStatus, this.CollectionWeightData[6]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay7(this.EquipmentStatus, this.CollectionFeedbackStatus[6]);
break;
case 10:
this.ChildFormMainDisplay.UpdateStartWeightDisplay9(this.EquipmentStatus, this.CollectionWeightData[8]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay9(this.EquipmentStatus, this.CollectionFeedbackStatus[8]);
break;
case 12:
this.ChildFormMainDisplay.UpdateStartWeightDisplay11(this.EquipmentStatus, this.CollectionWeightData[10]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay11(this.EquipmentStatus, this.CollectionFeedbackStatus[10]);
break;
default:
break;
}
}
#endregion
#region 이중진입
if (this.CurrentOptionParameterItem.DoubleEnter == "1")
{
// 이중진입(상한 판정시 하한설정값에 두배이면 이중) 이면 STOP
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.CollectionWeightData[1].JudgmentStatus == DataStore.JudgmentStatus.Double)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
this.ChildFormMainDisplay.UpdateAlarmMessage1Display();
}
}
else
{
if (this.CollectionWeightData[this.CollectionWeightData.Count - 2].JudgmentStatus == DataStore.JudgmentStatus.Double)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
this.ChildFormMainDisplay.UpdateAlarmMessage1Display();
}
}
}
#endregion
#region 입력센서 연속 입력 시 정지
if (this.SystemConfig.IsEmergencyStopEntrySensorError == true)
{
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.CollectionWeightData[1].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
// 메시지 11 - 입력센서 에러에 의해 정지하였습니다
this.StartThreadMessage1();
}
}
else
{
if (this.CollectionWeightData[this.CollectionWeightData.Count - 2].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
// 메시지 11 - 입력센서 에러에 의해 정지하였습니다
this.StartThreadMessage1();
}
}
}
#endregion
#region 이더넷
if (this.SystemConfig.IsEthernetEnable == true)
{
if (this.SystemConfig.EthernetMode == 1)
{
#region OPT2
etherStringData = this.Protocol_OPT2(this.SystemConfig, this.CollectionWeightData[1], 2);
this.SendEthernetData(etherStringData);
#endregion
}
else if (this.SystemConfig.EthernetMode == 2)
{
#region OPT3
etherStringData = this.Protocol_OPT3(this.SystemConfig, this.CollectionWeightData[1], 2, this.CurrentProductItem);
this.SendEthernetData(etherStringData);
#endregion
}
else if (this.SystemConfig.EthernetMode == 3)
{
#region Modbus
byte[] etherByteData = this.Modbus.WriteMultipleRegisterTCP(
this.Protocol_Modbus_Client_Write_Lane_Data(1), this.SystemConfig.ModbusTcpStartAddress + (2 * 50) + 140);
this.EthernetWeightDataForModbus(etherByteData);
#endregion
}
else if (this.SystemConfig.EthernetMode == 4)
{
#region OPT5
etherStringData = this.Protocol_OPT5(this.SystemConfig, this.CollectionWeightData[1], 2, this.CurrentProductItem);
this.SendEthernetData(etherStringData);
#endregion
}
}
#endregion
#region Serial3
if (this.SystemConfig.Serial3Mode == 1) // OPT1 - ABFood 통신 피드백
{
#region Serial3 Mode1
if (this.SystemConfig.EquipmentMode == 2)
{
if (this.timerTimeoutOPT1.Enabled == false)
this.timerTimeoutOPT1.Enabled = true;
// sensor error, double(이중) 이면 STOP
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.CollectionWeightData[1].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
}
}
else
{
if (this.CollectionWeightData[this.CollectionWeightData.Count - 2].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
}
}
// EquipmentColumns 수 만큼 중량이 들어왔는지 체크 후 데이터 전송하는 함수(EquipmentColumns 갯수가 다 들어아야 데이터 전송함)
this.UartCom3WeightDataTransfer(this.CollectionWeightData);
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 2) // OPT2 - 중량 데이터 피드백
{
#region Serial3 Mode2
if (this.SystemConfig.IsIntegratedTransmission == false)
{
#region 개별 전송
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT2(2, this.CollectionWeightData[1]);
else
this.SerialCH3OPT2(this.CollectionWeightData.Count - 1, this.CollectionWeightData[this.CollectionWeightData.Count - 2]);
#endregion
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 3) // OPT3 - 중량 데이터 피드백
{
#region Serial3 Mode3
if (this.SystemConfig.IsIntegratedTransmission == false)
{
#region 개별 전송
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT3(2, this.CollectionWeightData[1]);
else
this.SerialCH3OPT3(this.CollectionWeightData.Count - 1, this.CollectionWeightData[this.CollectionWeightData.Count - 2]);
#endregion
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 4) // OPT4 - 피드백 시스템1
{
#region Serial3 Mode4
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT4(2, this.CollectionWeightData[1]);
else
this.SerialCH3OPT4(this.CollectionWeightData.Count - 1, this.CollectionWeightData[this.CollectionWeightData.Count - 2]);
#endregion
}
else if (this.SystemConfig.Serial3Mode == 5) // Printer - 산업용 프린터
{
#region Serial3 Mode5
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.SystemConfig.IsPrintPerProductEnable == true)
this.SerialCH3Printer(2, this.CollectionWeightData[1]);
}
else
{
if (this.SystemConfig.IsPrintPerProductEnable == true)
this.SerialCH3Printer(this.CollectionWeightData.Count - 1, this.CollectionWeightData[this.CollectionWeightData.Count - 2]);
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 6) // OPT5 - 중량 데이터 피드백 (중량설정값 포함)
{
#region Serial3 Mode6
if (this.SystemConfig.IsIntegratedTransmission == false)
{
#region 개별 전송
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT5(2, this.CollectionWeightData[1]);
else
this.SerialCH3OPT5(this.CollectionWeightData.Count - 1, this.CollectionWeightData[this.CollectionWeightData.Count - 2]);
#endregion
}
#endregion
}
#endregion
if (this.SystemConfig.IsIntegratedTransmission == true)
{
#region 통합 전송
if (this.timerTimeOutTransmission.Enabled == false)
this.timerTimeOutTransmission.Enabled = true;
// EquipmentColumns 수 만큼 중량이 들어왔는지 체크 후 데이터 전송하는 함수(EquipmentColumns 갯수가 다 들어아야 데이터 전송함)
this.IntegratedTransmissionCheck(this.CollectionWeightData);
#endregion
}
#endregion
}
else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest)
{
#region FormEquipmentTest
if (this.SystemConfig.IsWeightViewForward == true)
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay2(this.EquipmentStatus, this.CollectionWeightDataTest[1]);
else
{
switch (this.SystemConfig.EquipmentColumns)
{
case 7:
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay6(this.EquipmentStatus, this.CollectionWeightDataTest[5]);
break;
case 8:
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay7(this.EquipmentStatus, this.CollectionWeightDataTest[6]);
break;
case 10:
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay9(this.EquipmentStatus, this.CollectionWeightDataTest[8]);
break;
case 12:
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay11(this.EquipmentStatus, this.CollectionWeightDataTest[10]);
break;
default:
break;
}
}
#endregion
}
#endregion
break;
case "C":
#region 3열
#region Value Assign
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
this.UpdateWeightData(2, receiveData);
else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest)
this.UpdateWeightDataTest(2, receiveData);
#endregion
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
{
#region FormMainDisplay
#region 통합 전송하기 위한 데이터 체크
// 중량 갱신이 되었는지 체크
if (this.SystemConfig.IsWeightViewForward == true)
this.CollectionWeightData[2].IsUpdate = true;
else
this.CollectionWeightData[this.CollectionWeightData.Count - 3].IsUpdate = true;
#endregion
#region 화면 갱신, 데이터 백업
if (this.SystemConfig.IsWeightViewForward == true)
{
this.ChildFormMainDisplay.UpdateStartWeightDisplay3(this.EquipmentStatus, this.CollectionWeightData[2]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay3(this.EquipmentStatus, this.CollectionFeedbackStatus[2]);
}
else
{
switch (this.SystemConfig.EquipmentColumns)
{
case 7:
this.ChildFormMainDisplay.UpdateStartWeightDisplay5(this.EquipmentStatus, this.CollectionWeightData[4]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay5(this.EquipmentStatus, this.CollectionFeedbackStatus[4]);
break;
case 8:
this.ChildFormMainDisplay.UpdateStartWeightDisplay6(this.EquipmentStatus, this.CollectionWeightData[5]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay6(this.EquipmentStatus, this.CollectionFeedbackStatus[5]);
break;
case 10:
this.ChildFormMainDisplay.UpdateStartWeightDisplay8(this.EquipmentStatus, this.CollectionWeightData[7]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay8(this.EquipmentStatus, this.CollectionFeedbackStatus[7]);
break;
case 12:
this.ChildFormMainDisplay.UpdateStartWeightDisplay10(this.EquipmentStatus, this.CollectionWeightData[9]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay10(this.EquipmentStatus, this.CollectionFeedbackStatus[9]);
break;
default:
break;
}
}
#endregion
#region 이중진입
if (this.CurrentOptionParameterItem.DoubleEnter == "1")
{
// 이중진입(상한 판정시 하한설정값에 두배이면 이중) 이면 STOP
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.CollectionWeightData[2].JudgmentStatus == DataStore.JudgmentStatus.Double)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
this.ChildFormMainDisplay.UpdateAlarmMessage1Display();
}
}
else
{
if (this.CollectionWeightData[this.CollectionWeightData.Count - 3].JudgmentStatus == DataStore.JudgmentStatus.Double)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
this.ChildFormMainDisplay.UpdateAlarmMessage1Display();
}
}
}
#endregion
#region 입력센서 연속 입력 시 정지
if (this.SystemConfig.IsEmergencyStopEntrySensorError == true)
{
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.CollectionWeightData[2].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
// 메시지 11 - 입력센서 에러에 의해 정지하였습니다
this.StartThreadMessage1();
}
}
else
{
if (this.CollectionWeightData[this.CollectionWeightData.Count - 3].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
// 메시지 11 - 입력센서 에러에 의해 정지하였습니다
this.StartThreadMessage1();
}
}
}
#endregion
#region 이더넷
if (this.SystemConfig.IsEthernetEnable == true)
{
if (this.SystemConfig.EthernetMode == 1)
{
#region OPT2
etherStringData = this.Protocol_OPT2(this.SystemConfig, this.CollectionWeightData[2], 3);
this.SendEthernetData(etherStringData);
#endregion
}
else if (this.SystemConfig.EthernetMode == 2)
{
#region OPT3
etherStringData = this.Protocol_OPT3(this.SystemConfig, this.CollectionWeightData[2], 3, this.CurrentProductItem);
this.SendEthernetData(etherStringData);
#endregion
}
else if (this.SystemConfig.EthernetMode == 3)
{
#region Modbus
byte[] etherByteData = this.Modbus.WriteMultipleRegisterTCP(
this.Protocol_Modbus_Client_Write_Lane_Data(2), this.SystemConfig.ModbusTcpStartAddress + (3 * 50) + 140);
this.EthernetWeightDataForModbus(etherByteData);
#endregion
}
else if (this.SystemConfig.EthernetMode == 4)
{
#region OPT5
etherStringData = this.Protocol_OPT5(this.SystemConfig, this.CollectionWeightData[2], 3, this.CurrentProductItem);
this.SendEthernetData(etherStringData);
#endregion
}
}
#endregion
#region Serial3
if (this.SystemConfig.Serial3Mode == 1) // OPT1 - ABFood 통신 피드백
{
#region Serial3 Mode1
if (this.SystemConfig.EquipmentMode == 2)
{
if (this.timerTimeoutOPT1.Enabled == false)
this.timerTimeoutOPT1.Enabled = true;
// sensor error, double(이중) 이면 STOP
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.CollectionWeightData[2].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
}
}
else
{
if (this.CollectionWeightData[this.CollectionWeightData.Count - 3].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
}
}
// EquipmentColumns 수 만큼 중량이 들어왔는지 체크 후 데이터 전송하는 함수(EquipmentColumns 갯수가 다 들어아야 데이터 전송함)
this.UartCom3WeightDataTransfer(this.CollectionWeightData);
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 2) // OPT2 - 중량 데이터 피드백
{
#region Serial3 Mode2
if (this.SystemConfig.IsIntegratedTransmission == false)
{
#region 개별 전송
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT2(3, this.CollectionWeightData[2]);
else
this.SerialCH3OPT2(this.CollectionWeightData.Count - 2, this.CollectionWeightData[this.CollectionWeightData.Count - 3]);
#endregion
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 3) // OPT2 - 중량 데이터 피드백
{
#region Serial3 Mode3
if (this.SystemConfig.IsIntegratedTransmission == false)
{
#region 개별 전송
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT3(3, this.CollectionWeightData[2]);
else
this.SerialCH3OPT3(this.CollectionWeightData.Count - 2, this.CollectionWeightData[this.CollectionWeightData.Count - 3]);
#endregion
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 4) // OPT4 - 피드백 시스템1
{
#region Serial3 Mode4
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT4(3, this.CollectionWeightData[2]);
else
this.SerialCH3OPT4(this.CollectionWeightData.Count - 2, this.CollectionWeightData[this.CollectionWeightData.Count - 3]);
#endregion
}
else if (this.SystemConfig.Serial3Mode == 5) // Printer - 산업용 프린터
{
#region Serial3 Mode5
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.SystemConfig.IsPrintPerProductEnable == true)
this.SerialCH3Printer(3, this.CollectionWeightData[2]);
}
else
{
if (this.SystemConfig.IsPrintPerProductEnable == true)
this.SerialCH3Printer(this.CollectionWeightData.Count - 2, this.CollectionWeightData[this.CollectionWeightData.Count - 3]);
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 6) // OPT5 - 중량 데이터 피드백 (중량설정값 포함)
{
#region Serial3 Mode6
if (this.SystemConfig.IsIntegratedTransmission == false)
{
#region 개별 전송
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT5(3, this.CollectionWeightData[2]);
else
this.SerialCH3OPT5(this.CollectionWeightData.Count - 2, this.CollectionWeightData[this.CollectionWeightData.Count - 3]);
#endregion
}
#endregion
}
#endregion
if (this.SystemConfig.IsIntegratedTransmission == true)
{
#region 통합 전송
if (this.timerTimeOutTransmission.Enabled == false)
this.timerTimeOutTransmission.Enabled = true;
// EquipmentColumns 수 만큼 중량이 들어왔는지 체크 후 데이터 전송하는 함수(EquipmentColumns 갯수가 다 들어아야 데이터 전송함)
this.IntegratedTransmissionCheck(this.CollectionWeightData);
#endregion
}
#endregion
}
else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest)
{
#region FormEquipmentTest
if (this.SystemConfig.IsWeightViewForward == true)
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay3(this.EquipmentStatus, this.CollectionWeightDataTest[2]);
else
{
switch (this.SystemConfig.EquipmentColumns)
{
case 7:
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay5(this.EquipmentStatus, this.CollectionWeightDataTest[4]);
break;
case 8:
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay6(this.EquipmentStatus, this.CollectionWeightDataTest[5]);
break;
case 10:
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay8(this.EquipmentStatus, this.CollectionWeightDataTest[7]);
break;
case 12:
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay10(this.EquipmentStatus, this.CollectionWeightDataTest[9]);
break;
default:
break;
}
}
#endregion
}
#endregion
break;
case "D":
#region 4열
#region Value Assign
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
this.UpdateWeightData(3, receiveData);
else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest)
this.UpdateWeightDataTest(3, receiveData);
#endregion
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
{
#region FormMainDisplay
#region 통합 전송하기 위한 데이터 체크
// 중량 갱신이 되었는지 체크
if (this.SystemConfig.IsWeightViewForward == true)
this.CollectionWeightData[3].IsUpdate = true;
else
this.CollectionWeightData[this.CollectionWeightData.Count - 4].IsUpdate = true;
#endregion
#region 화면 갱신, 데이터 백업
if (this.SystemConfig.IsWeightViewForward == true)
{
this.ChildFormMainDisplay.UpdateStartWeightDisplay4(this.EquipmentStatus, this.CollectionWeightData[3]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay4(this.EquipmentStatus, this.CollectionFeedbackStatus[3]);
}
else
{
switch (this.SystemConfig.EquipmentColumns)
{
case 7:
this.ChildFormMainDisplay.UpdateStartWeightDisplay4(this.EquipmentStatus, this.CollectionWeightData[3]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay4(this.EquipmentStatus, this.CollectionFeedbackStatus[3]);
break;
case 8:
this.ChildFormMainDisplay.UpdateStartWeightDisplay5(this.EquipmentStatus, this.CollectionWeightData[4]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay5(this.EquipmentStatus, this.CollectionFeedbackStatus[4]);
break;
case 10:
this.ChildFormMainDisplay.UpdateStartWeightDisplay7(this.EquipmentStatus, this.CollectionWeightData[6]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay7(this.EquipmentStatus, this.CollectionFeedbackStatus[6]);
break;
case 12:
this.ChildFormMainDisplay.UpdateStartWeightDisplay9(this.EquipmentStatus, this.CollectionWeightData[8]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay9(this.EquipmentStatus, this.CollectionFeedbackStatus[8]);
break;
default:
break;
}
}
#endregion
#region 이중진입
if (this.CurrentOptionParameterItem.DoubleEnter == "1")
{
// 이중진입(상한 판정시 하한설정값에 두배이면 이중) 이면 STOP
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.CollectionWeightData[3].JudgmentStatus == DataStore.JudgmentStatus.Double)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
this.ChildFormMainDisplay.UpdateAlarmMessage1Display();
}
}
else
{
if (this.CollectionWeightData[this.CollectionWeightData.Count - 4].JudgmentStatus == DataStore.JudgmentStatus.Double)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
this.ChildFormMainDisplay.UpdateAlarmMessage1Display();
}
}
}
#endregion
#region 입력센서 연속 입력 시 정지
if (this.SystemConfig.IsEmergencyStopEntrySensorError == true)
{
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.CollectionWeightData[3].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
// 메시지 11 - 입력센서 에러에 의해 정지하였습니다
this.StartThreadMessage1();
}
}
else
{
if (this.CollectionWeightData[this.CollectionWeightData.Count - 4].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
// 메시지 11 - 입력센서 에러에 의해 정지하였습니다
this.StartThreadMessage1();
}
}
}
#endregion
#region 이더넷
if (this.SystemConfig.IsEthernetEnable == true)
{
if (this.SystemConfig.EthernetMode == 1)
{
#region OPT2
etherStringData = this.Protocol_OPT2(this.SystemConfig, this.CollectionWeightData[3], 4);
this.SendEthernetData(etherStringData);
#endregion
}
else if (this.SystemConfig.EthernetMode == 2)
{
#region OPT3
etherStringData = this.Protocol_OPT3(this.SystemConfig, this.CollectionWeightData[3], 4, this.CurrentProductItem);
this.SendEthernetData(etherStringData);
#endregion
}
else if (this.SystemConfig.EthernetMode == 3) // Modbus
{
#region Modbus
byte[] etherByteData = this.Modbus.WriteMultipleRegisterTCP(
this.Protocol_Modbus_Client_Write_Lane_Data(3), this.SystemConfig.ModbusTcpStartAddress + (4 * 50) + 140);
this.EthernetWeightDataForModbus(etherByteData);
#endregion
}
else if (this.SystemConfig.EthernetMode == 4)
{
#region OPT5
etherStringData = this.Protocol_OPT5(this.SystemConfig, this.CollectionWeightData[3], 4, this.CurrentProductItem);
this.SendEthernetData(etherStringData);
#endregion
}
}
#endregion
#region Serial3
if (this.SystemConfig.Serial3Mode == 1) // OPT1 - ABFood 통신 피드백
{
#region Serial3 Mode1
if (this.SystemConfig.EquipmentMode == 2)
{
if (this.timerTimeoutOPT1.Enabled == false)
this.timerTimeoutOPT1.Enabled = true;
// sensor error, double(이중) 이면 STOP
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.CollectionWeightData[3].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
}
}
else
{
if (this.CollectionWeightData[this.CollectionWeightData.Count - 4].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
}
}
// EquipmentColumns 수 만큼 중량이 들어왔는지 체크 후 데이터 전송하는 함수(EquipmentColumns 갯수가 다 들어아야 데이터 전송함)
this.UartCom3WeightDataTransfer(this.CollectionWeightData);
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 2) // OPT2 - 중량 데이터 피드백
{
#region Serial3 Mode2
if (this.SystemConfig.IsIntegratedTransmission == false)
{
#region 개별 전송
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT2(4, this.CollectionWeightData[3]);
else
this.SerialCH3OPT2(this.CollectionWeightData.Count - 3, this.CollectionWeightData[this.CollectionWeightData.Count - 4]);
#endregion
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 3) // OPT3 - 중량 데이터 피드백
{
#region Serial3 Mode3
if (this.SystemConfig.IsIntegratedTransmission == false)
{
#region 개별 전송
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT3(4, this.CollectionWeightData[3]);
else
this.SerialCH3OPT3(this.CollectionWeightData.Count - 3, this.CollectionWeightData[this.CollectionWeightData.Count - 4]);
#endregion
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 4) // OPT4 - 피드백 시스템1
{
#region Serial3 Mode4
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT4(4, this.CollectionWeightData[3]);
else
this.SerialCH3OPT4(this.CollectionWeightData.Count - 3, this.CollectionWeightData[this.CollectionWeightData.Count - 4]);
#endregion
}
else if (this.SystemConfig.Serial3Mode == 5) // Printer - 산업용 프린터
{
#region Serial3 Mode5
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.SystemConfig.IsPrintPerProductEnable == true)
this.SerialCH3Printer(4, this.CollectionWeightData[3]);
}
else
{
if (this.SystemConfig.IsPrintPerProductEnable == true)
this.SerialCH3Printer(this.CollectionWeightData.Count - 3, this.CollectionWeightData[this.CollectionWeightData.Count - 4]);
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 6) // OPT5 - 중량 데이터 피드백 (중량설정값 포함)
{
#region Serial3 Mode6
if (this.SystemConfig.IsIntegratedTransmission == false)
{
#region 개별 전송
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT5(4, this.CollectionWeightData[3]);
else
this.SerialCH3OPT5(this.CollectionWeightData.Count - 3, this.CollectionWeightData[this.CollectionWeightData.Count - 4]);
#endregion
}
#endregion
}
#endregion
if (this.SystemConfig.IsIntegratedTransmission == true)
{
#region 통합 전송
if (this.timerTimeOutTransmission.Enabled == false)
this.timerTimeOutTransmission.Enabled = true;
// EquipmentColumns 수 만큼 중량이 들어왔는지 체크 후 데이터 전송하는 함수(EquipmentColumns 갯수가 다 들어아야 데이터 전송함)
this.IntegratedTransmissionCheck(this.CollectionWeightData);
#endregion
}
#endregion
}
else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest)
{
#region FormEquipmentTest
if (this.SystemConfig.IsWeightViewForward == true)
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay4(this.EquipmentStatus, this.CollectionWeightDataTest[3]);
else
{
switch (this.SystemConfig.EquipmentColumns)
{
case 7:
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay4(this.EquipmentStatus, this.CollectionWeightDataTest[3]);
break;
case 8:
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay5(this.EquipmentStatus, this.CollectionWeightDataTest[4]);
break;
case 10:
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay7(this.EquipmentStatus, this.CollectionWeightDataTest[6]);
break;
case 12:
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay9(this.EquipmentStatus, this.CollectionWeightDataTest[8]);
break;
default:
break;
}
}
#endregion
}
#endregion
break;
case "E":
#region 5열
#region Value Assign
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
this.UpdateWeightData(4, receiveData);
else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest)
this.UpdateWeightDataTest(4, receiveData);
#endregion
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
{
#region FormMainDisplay
#region 통합 전송하기 위한 데이터 체크
// 중량 갱신이 되었는지 체크
if (this.SystemConfig.IsWeightViewForward == true)
this.CollectionWeightData[4].IsUpdate = true;
else
this.CollectionWeightData[this.CollectionWeightData.Count - 5].IsUpdate = true;
#endregion
#region 화면 갱신, 데이터 백업
if (this.SystemConfig.IsWeightViewForward == true)
{
this.ChildFormMainDisplay.UpdateStartWeightDisplay5(this.EquipmentStatus, this.CollectionWeightData[4]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay5(this.EquipmentStatus, this.CollectionFeedbackStatus[4]);
}
else
{
switch (this.SystemConfig.EquipmentColumns)
{
case 7:
this.ChildFormMainDisplay.UpdateStartWeightDisplay3(this.EquipmentStatus, this.CollectionWeightData[2]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay3(this.EquipmentStatus, this.CollectionFeedbackStatus[2]);
break;
case 8:
this.ChildFormMainDisplay.UpdateStartWeightDisplay4(this.EquipmentStatus, this.CollectionWeightData[3]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay4(this.EquipmentStatus, this.CollectionFeedbackStatus[3]);
break;
case 10:
this.ChildFormMainDisplay.UpdateStartWeightDisplay6(this.EquipmentStatus, this.CollectionWeightData[5]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay6(this.EquipmentStatus, this.CollectionFeedbackStatus[5]);
break;
case 12:
this.ChildFormMainDisplay.UpdateStartWeightDisplay8(this.EquipmentStatus, this.CollectionWeightData[7]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay8(this.EquipmentStatus, this.CollectionFeedbackStatus[7]);
break;
default:
break;
}
}
#endregion
#region 이중진입
if (this.CurrentOptionParameterItem.DoubleEnter == "1")
{
// 이중진입(상한 판정시 하한설정값에 두배이면 이중) 이면 STOP
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.CollectionWeightData[4].JudgmentStatus == DataStore.JudgmentStatus.Double)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
this.ChildFormMainDisplay.UpdateAlarmMessage1Display();
}
}
else
{
if (this.CollectionWeightData[this.CollectionWeightData.Count - 5].JudgmentStatus == DataStore.JudgmentStatus.Double)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
this.ChildFormMainDisplay.UpdateAlarmMessage1Display();
}
}
}
#endregion
#region 입력센서 연속 입력 시 정지
if (this.SystemConfig.IsEmergencyStopEntrySensorError == true)
{
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.CollectionWeightData[4].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
// 메시지 11 - 입력센서 에러에 의해 정지하였습니다
this.StartThreadMessage1();
}
}
else
{
if (this.CollectionWeightData[this.CollectionWeightData.Count - 5].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
// 메시지 11 - 입력센서 에러에 의해 정지하였습니다
this.StartThreadMessage1();
}
}
}
#endregion
#region 이더넷
if (this.SystemConfig.IsEthernetEnable == true)
{
if (this.SystemConfig.EthernetMode == 1)
{
#region OPT2
etherStringData = this.Protocol_OPT2(this.SystemConfig, this.CollectionWeightData[4], 5);
this.SendEthernetData(etherStringData);
#endregion
}
else if (this.SystemConfig.EthernetMode == 2)
{
#region OPT3
etherStringData = this.Protocol_OPT3(this.SystemConfig, this.CollectionWeightData[4], 5, this.CurrentProductItem);
this.SendEthernetData(etherStringData);
#endregion
}
else if (this.SystemConfig.EthernetMode == 3)
{
#region Modbus
byte[] etherByteData = this.Modbus.WriteMultipleRegisterTCP(
this.Protocol_Modbus_Client_Write_Lane_Data(4), this.SystemConfig.ModbusTcpStartAddress + (5 * 50) + 140);
this.EthernetWeightDataForModbus(etherByteData);
#endregion
}
else if (this.SystemConfig.EthernetMode == 4)
{
#region OPT5
etherStringData = this.Protocol_OPT5(this.SystemConfig, this.CollectionWeightData[4], 5, this.CurrentProductItem);
this.SendEthernetData(etherStringData);
#endregion
}
}
#endregion
#region Serial3
if (this.SystemConfig.Serial3Mode == 1) // OPT1 - ABFood 통신 피드백
{
#region Serial3 Mode1
if (this.SystemConfig.EquipmentMode == 2)
{
if (this.timerTimeoutOPT1.Enabled == false)
this.timerTimeoutOPT1.Enabled = true;
// sensor error, double(이중) 이면 STOP
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.CollectionWeightData[4].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
}
}
else
{
if (this.CollectionWeightData[this.CollectionWeightData.Count - 5].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
}
}
// EquipmentColumns 수 만큼 중량이 들어왔는지 체크 후 데이터 전송하는 함수(EquipmentColumns 갯수가 다 들어아야 데이터 전송함)
this.UartCom3WeightDataTransfer(this.CollectionWeightData);
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 2) // OPT2 - 중량 데이터 피드백
{
#region Serial3 Mode2
if (this.SystemConfig.IsIntegratedTransmission == false)
{
#region 개별 전송
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT2(5, this.CollectionWeightData[4]);
else
this.SerialCH3OPT2(this.CollectionWeightData.Count - 4, this.CollectionWeightData[this.CollectionWeightData.Count - 5]);
#endregion
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 3) // OPT3 - 중량 데이터 피드백
{
#region Serial3 Mode3
if (this.SystemConfig.IsIntegratedTransmission == false)
{
#region 개별 전송
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT3(5, this.CollectionWeightData[4]);
else
this.SerialCH3OPT3(this.CollectionWeightData.Count - 4, this.CollectionWeightData[this.CollectionWeightData.Count - 5]);
#endregion
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 4) // OPT4 - 피드백 시스템1
{
#region Serial3 Mode4
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT4(5, this.CollectionWeightData[4]);
else
this.SerialCH3OPT4(this.CollectionWeightData.Count - 4, this.CollectionWeightData[this.CollectionWeightData.Count - 5]);
#endregion
}
else if (this.SystemConfig.Serial3Mode == 5) // Printer - 산업용 프린터
{
#region Serial3 Mode5
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.SystemConfig.IsPrintPerProductEnable == true)
this.SerialCH3Printer(5, this.CollectionWeightData[4]);
}
else
{
if (this.SystemConfig.IsPrintPerProductEnable == true)
this.SerialCH3Printer(this.CollectionWeightData.Count - 4, this.CollectionWeightData[this.CollectionWeightData.Count - 5]);
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 6) // OPT5 - 중량 데이터 피드백 (중량설정값 포함)
{
#region Serial3 Mode6
if (this.SystemConfig.IsIntegratedTransmission == false)
{
#region 개별 전송
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT5(5, this.CollectionWeightData[4]);
else
this.SerialCH3OPT5(this.CollectionWeightData.Count - 4, this.CollectionWeightData[this.CollectionWeightData.Count - 5]);
#endregion
}
#endregion
}
#endregion
if (this.SystemConfig.IsIntegratedTransmission == true)
{
#region 통합 전송
if (this.timerTimeOutTransmission.Enabled == false)
this.timerTimeOutTransmission.Enabled = true;
// EquipmentColumns 수 만큼 중량이 들어왔는지 체크 후 데이터 전송하는 함수(EquipmentColumns 갯수가 다 들어아야 데이터 전송함)
this.IntegratedTransmissionCheck(this.CollectionWeightData);
#endregion
}
#endregion
}
else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest)
{
#region FormEquipmentTest
if (this.SystemConfig.IsWeightViewForward == true)
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay5(this.EquipmentStatus, this.CollectionWeightDataTest[4]);
else
{
switch (this.SystemConfig.EquipmentColumns)
{
case 7:
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay3(this.EquipmentStatus, this.CollectionWeightDataTest[2]);
break;
case 8:
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay4(this.EquipmentStatus, this.CollectionWeightDataTest[3]);
break;
case 10:
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay6(this.EquipmentStatus, this.CollectionWeightDataTest[5]);
break;
case 12:
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay8(this.EquipmentStatus, this.CollectionWeightDataTest[7]);
break;
default:
break;
}
}
#endregion
}
#endregion
break;
case "F":
#region 6열
#region Value Assign
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
this.UpdateWeightData(5, receiveData);
else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest)
this.UpdateWeightDataTest(5, receiveData);
#endregion
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
{
#region FormMainDisplay
#region 통합 전송하기 위한 데이터 체크
// 중량 갱신이 되었는지 체크
if (this.SystemConfig.IsWeightViewForward == true)
this.CollectionWeightData[5].IsUpdate = true;
else
this.CollectionWeightData[this.CollectionWeightData.Count - 6].IsUpdate = true;
#endregion
#region 화면 갱신, 데이터 백업
if (this.SystemConfig.IsWeightViewForward == true)
{
this.ChildFormMainDisplay.UpdateStartWeightDisplay6(this.EquipmentStatus, this.CollectionWeightData[5]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay6(this.EquipmentStatus, this.CollectionFeedbackStatus[5]);
}
else
{
switch (this.SystemConfig.EquipmentColumns)
{
case 7:
this.ChildFormMainDisplay.UpdateStartWeightDisplay2(this.EquipmentStatus, this.CollectionWeightData[1]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay2(this.EquipmentStatus, this.CollectionFeedbackStatus[1]);
break;
case 8:
this.ChildFormMainDisplay.UpdateStartWeightDisplay3(this.EquipmentStatus, this.CollectionWeightData[2]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay3(this.EquipmentStatus, this.CollectionFeedbackStatus[2]);
break;
case 10:
this.ChildFormMainDisplay.UpdateStartWeightDisplay5(this.EquipmentStatus, this.CollectionWeightData[4]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay5(this.EquipmentStatus, this.CollectionFeedbackStatus[4]);
break;
case 12:
this.ChildFormMainDisplay.UpdateStartWeightDisplay7(this.EquipmentStatus, this.CollectionWeightData[6]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay7(this.EquipmentStatus, this.CollectionFeedbackStatus[6]);
break;
default:
break;
}
}
#endregion
#region 이중진입
if (this.CurrentOptionParameterItem.DoubleEnter == "1")
{
// 이중진입(상한 판정시 하한설정값에 두배이면 이중) 이면 STOP
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.CollectionWeightData[5].JudgmentStatus == DataStore.JudgmentStatus.Double)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
this.ChildFormMainDisplay.UpdateAlarmMessage1Display();
}
}
else
{
if (this.CollectionWeightData[this.CollectionWeightData.Count - 6].JudgmentStatus == DataStore.JudgmentStatus.Double)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
this.ChildFormMainDisplay.UpdateAlarmMessage1Display();
}
}
}
#endregion
#region 입력센서 연속 입력 시 정지
if (this.SystemConfig.IsEmergencyStopEntrySensorError == true)
{
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.CollectionWeightData[5].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
// 메시지 11 - 입력센서 에러에 의해 정지하였습니다
this.StartThreadMessage1();
}
}
else
{
if (this.CollectionWeightData[this.CollectionWeightData.Count - 6].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
// 메시지 11 - 입력센서 에러에 의해 정지하였습니다
this.StartThreadMessage1();
}
}
}
#endregion
#region 이더넷
if (this.SystemConfig.IsEthernetEnable == true)
{
if (this.SystemConfig.EthernetMode == 1)
{
#region OPT2
etherStringData = this.Protocol_OPT2(this.SystemConfig, this.CollectionWeightData[5], 6);
this.SendEthernetData(etherStringData);
#endregion
}
else if (this.SystemConfig.EthernetMode == 2)
{
#region OPT3
etherStringData = this.Protocol_OPT3(this.SystemConfig, this.CollectionWeightData[5], 6, this.CurrentProductItem);
this.SendEthernetData(etherStringData);
#endregion
}
else if (this.SystemConfig.EthernetMode == 3)
{
#region Modbus
byte[] etherByteData = this.Modbus.WriteMultipleRegisterTCP(
this.Protocol_Modbus_Client_Write_Lane_Data(5), this.SystemConfig.ModbusTcpStartAddress + (6 * 50) + 140);
this.EthernetWeightDataForModbus(etherByteData);
#endregion
}
else if (this.SystemConfig.EthernetMode == 4)
{
#region OPT5
etherStringData = this.Protocol_OPT5(this.SystemConfig, this.CollectionWeightData[5], 6, this.CurrentProductItem);
this.SendEthernetData(etherStringData);
#endregion
}
}
#endregion
#region Serial3
if (this.SystemConfig.Serial3Mode == 1) // OPT1 - ABFood 통신 피드백
{
#region Serial3 Mode1
if (this.SystemConfig.EquipmentMode == 2)
{
if (this.timerTimeoutOPT1.Enabled == false)
this.timerTimeoutOPT1.Enabled = true;
// sensor error, double(이중) 이면 STOP
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.CollectionWeightData[5].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
}
}
else
{
if (this.CollectionWeightData[this.CollectionWeightData.Count - 6].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
}
}
// EquipmentColumns 수 만큼 중량이 들어왔는지 체크 후 데이터 전송하는 함수(EquipmentColumns 갯수가 다 들어아야 데이터 전송함)
this.UartCom3WeightDataTransfer(this.CollectionWeightData);
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 2) // OPT2 - 중량 데이터 피드백
{
#region Serial3 Mode2
if (this.SystemConfig.IsIntegratedTransmission == false)
{
#region 개별 전송
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT2(6, this.CollectionWeightData[5]);
else
this.SerialCH3OPT2(this.CollectionWeightData.Count - 5, this.CollectionWeightData[this.CollectionWeightData.Count - 6]);
#endregion
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 3) // OPT3 - 중량 데이터 피드백
{
#region Serial3 Mode3
if (this.SystemConfig.IsIntegratedTransmission == false)
{
#region 개별 전송
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT3(6, this.CollectionWeightData[5]);
else
this.SerialCH3OPT3(this.CollectionWeightData.Count - 5, this.CollectionWeightData[this.CollectionWeightData.Count - 6]);
#endregion
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 4) // OPT4 - 피드백 시스템1
{
#region Serial3 Mode4
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT4(6, this.CollectionWeightData[5]);
else
this.SerialCH3OPT4(this.CollectionWeightData.Count - 5, this.CollectionWeightData[this.CollectionWeightData.Count - 6]);
#endregion
}
else if (this.SystemConfig.Serial3Mode == 5) // Printer - 산업용 프린터
{
#region Serial3 Mode5
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.SystemConfig.IsPrintPerProductEnable == true)
this.SerialCH3Printer(6, this.CollectionWeightData[5]);
}
else
{
if (this.SystemConfig.IsPrintPerProductEnable == true)
this.SerialCH3Printer(this.CollectionWeightData.Count - 5, this.CollectionWeightData[this.CollectionWeightData.Count - 6]);
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 6) // OPT5 - 중량 데이터 피드백 (중량설정값 포함)
{
#region Serial3 Mode6
if (this.SystemConfig.IsIntegratedTransmission == false)
{
#region 개별 전송
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT5(6, this.CollectionWeightData[5]);
else
this.SerialCH3OPT5(this.CollectionWeightData.Count - 5, this.CollectionWeightData[this.CollectionWeightData.Count - 6]);
#endregion
}
#endregion
}
#endregion
if (this.SystemConfig.IsIntegratedTransmission == true)
{
#region 통합 전송
if (this.timerTimeOutTransmission.Enabled == false)
this.timerTimeOutTransmission.Enabled = true;
// EquipmentColumns 수 만큼 중량이 들어왔는지 체크 후 데이터 전송하는 함수(EquipmentColumns 갯수가 다 들어아야 데이터 전송함)
this.IntegratedTransmissionCheck(this.CollectionWeightData);
#endregion
}
#endregion
}
else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest)
{
#region FormEquipmentTest
if (this.SystemConfig.IsWeightViewForward == true)
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay6(this.EquipmentStatus, this.CollectionWeightDataTest[5]);
else
{
switch (this.SystemConfig.EquipmentColumns)
{
case 7:
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay2(this.EquipmentStatus, this.CollectionWeightDataTest[1]);
break;
case 8:
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay3(this.EquipmentStatus, this.CollectionWeightDataTest[2]);
break;
case 10:
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay5(this.EquipmentStatus, this.CollectionWeightDataTest[4]);
break;
case 12:
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay7(this.EquipmentStatus, this.CollectionWeightDataTest[6]);
break;
default:
break;
}
}
#endregion
}
#endregion
break;
case "G":
#region 7열
#region Value Assign
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
this.UpdateWeightData(6, receiveData);
else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest)
this.UpdateWeightDataTest(6, receiveData);
#endregion
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
{
#region FormMainDisplay
#region 통합 전송하기 위한 데이터 체크
// 중량 갱신이 되었는지 체크
if (this.SystemConfig.IsWeightViewForward == true)
this.CollectionWeightData[6].IsUpdate = true;
else
this.CollectionWeightData[this.CollectionWeightData.Count - 7].IsUpdate = true;
#endregion
#region 화면 갱신, 데이터 백업
if (this.SystemConfig.IsWeightViewForward == true)
{
this.ChildFormMainDisplay.UpdateStartWeightDisplay7(this.EquipmentStatus, this.CollectionWeightData[6]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay7(this.EquipmentStatus, this.CollectionFeedbackStatus[6]);
}
else
{
switch (this.SystemConfig.EquipmentColumns)
{
case 7:
this.ChildFormMainDisplay.UpdateStartWeightDisplay1(this.EquipmentStatus, this.CollectionWeightData[0]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay1(this.EquipmentStatus, this.CollectionFeedbackStatus[0]);
break;
case 8:
this.ChildFormMainDisplay.UpdateStartWeightDisplay2(this.EquipmentStatus, this.CollectionWeightData[1]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay2(this.EquipmentStatus, this.CollectionFeedbackStatus[1]);
break;
case 10:
this.ChildFormMainDisplay.UpdateStartWeightDisplay4(this.EquipmentStatus, this.CollectionWeightData[3]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay4(this.EquipmentStatus, this.CollectionFeedbackStatus[3]);
break;
case 12:
this.ChildFormMainDisplay.UpdateStartWeightDisplay6(this.EquipmentStatus, this.CollectionWeightData[5]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay6(this.EquipmentStatus, this.CollectionFeedbackStatus[5]);
break;
default:
break;
}
}
#endregion
#region 이중진입
if (this.CurrentOptionParameterItem.DoubleEnter == "1")
{
// 이중진입(상한 판정시 하한설정값에 두배이면 이중) 이면 STOP
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.CollectionWeightData[6].JudgmentStatus == DataStore.JudgmentStatus.Double)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
this.ChildFormMainDisplay.UpdateAlarmMessage1Display();
}
}
else
{
if (this.CollectionWeightData[this.CollectionWeightData.Count - 7].JudgmentStatus == DataStore.JudgmentStatus.Double)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
this.ChildFormMainDisplay.UpdateAlarmMessage1Display();
}
}
}
#endregion
#region 입력센서 연속 입력 시 정지
if (this.SystemConfig.IsEmergencyStopEntrySensorError == true)
{
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.CollectionWeightData[6].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
// 메시지 11 - 입력센서 에러에 의해 정지하였습니다
this.StartThreadMessage1();
}
}
else
{
if (this.CollectionWeightData[this.CollectionWeightData.Count - 7].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
// 메시지 11 - 입력센서 에러에 의해 정지하였습니다
this.StartThreadMessage1();
}
}
}
#endregion
#region 이더넷
if (this.SystemConfig.IsEthernetEnable == true)
{
if (this.SystemConfig.EthernetMode == 1)
{
#region OPT2
etherStringData = this.Protocol_OPT2(this.SystemConfig, this.CollectionWeightData[6], 7);
this.SendEthernetData(etherStringData);
#endregion
}
else if (this.SystemConfig.EthernetMode == 2)
{
#region OPT3
etherStringData = this.Protocol_OPT3(this.SystemConfig, this.CollectionWeightData[6], 7, this.CurrentProductItem);
this.SendEthernetData(etherStringData);
#endregion
}
else if (this.SystemConfig.EthernetMode == 3)
{
#region Modbus
byte[] etherByteData = this.Modbus.WriteMultipleRegisterTCP(
this.Protocol_Modbus_Client_Write_Lane_Data(6), this.SystemConfig.ModbusTcpStartAddress + (7 * 50) + 140);
this.EthernetWeightDataForModbus(etherByteData);
#endregion
}
else if (this.SystemConfig.EthernetMode == 4)
{
#region OPT5
etherStringData = this.Protocol_OPT5(this.SystemConfig, this.CollectionWeightData[6], 7, this.CurrentProductItem);
this.SendEthernetData(etherStringData);
#endregion
}
}
#endregion
#region Serial3
if (this.SystemConfig.Serial3Mode == 1) // OPT1 - ABFood 통신 피드백
{
#region Serial3 Mode1
if (this.SystemConfig.EquipmentMode == 2)
{
if (this.timerTimeoutOPT1.Enabled == false)
this.timerTimeoutOPT1.Enabled = true;
// sensor error, double(이중) 이면 STOP
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.CollectionWeightData[6].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
}
}
else
{
if (this.CollectionWeightData[this.CollectionWeightData.Count - 7].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
}
}
// EquipmentColumns 수 만큼 중량이 들어왔는지 체크 후 데이터 전송하는 함수(EquipmentColumns 갯수가 다 들어아야 데이터 전송함)
this.UartCom3WeightDataTransfer(this.CollectionWeightData);
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 2) // OPT2 - 중량 데이터 피드백
{
#region Serial3 Mode2
if (this.SystemConfig.IsIntegratedTransmission == false)
{
#region 개별 전송
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT2(7, this.CollectionWeightData[6]);
else
this.SerialCH3OPT2(this.CollectionWeightData.Count - 6, this.CollectionWeightData[this.CollectionWeightData.Count - 7]);
#endregion
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 3) // OPT3 - 중량 데이터 피드백
{
#region Serial3 Mode3
if (this.SystemConfig.IsIntegratedTransmission == false)
{
#region 개별 전송
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT3(7, this.CollectionWeightData[6]);
else
this.SerialCH3OPT3(this.CollectionWeightData.Count - 6, this.CollectionWeightData[this.CollectionWeightData.Count - 7]);
#endregion
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 4) // OPT4 - 피드백 시스템1
{
#region Serial3 Mode4
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT4(7, this.CollectionWeightData[6]);
else
this.SerialCH3OPT4(this.CollectionWeightData.Count - 6, this.CollectionWeightData[this.CollectionWeightData.Count - 7]);
#endregion
}
else if (this.SystemConfig.Serial3Mode == 5) // Printer - 산업용 프린터
{
#region Serial3 Mode5
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.SystemConfig.IsPrintPerProductEnable == true)
this.SerialCH3Printer(7, this.CollectionWeightData[6]);
}
else
{
if (this.SystemConfig.IsPrintPerProductEnable == true)
this.SerialCH3Printer(this.CollectionWeightData.Count - 6, this.CollectionWeightData[this.CollectionWeightData.Count - 7]);
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 6) // OPT5 - 중량 데이터 피드백 (중량설정값 포함)
{
#region Serial3 Mode6
if (this.SystemConfig.IsIntegratedTransmission == false)
{
#region 개별 전송
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT5(7, this.CollectionWeightData[6]);
else
this.SerialCH3OPT5(this.CollectionWeightData.Count - 6, this.CollectionWeightData[this.CollectionWeightData.Count - 7]);
#endregion
}
#endregion
}
#endregion
if (this.SystemConfig.IsIntegratedTransmission == true)
{
#region 통합 전송
if (this.timerTimeOutTransmission.Enabled == false)
this.timerTimeOutTransmission.Enabled = true;
// EquipmentColumns 수 만큼 중량이 들어왔는지 체크 후 데이터 전송하는 함수(EquipmentColumns 갯수가 다 들어아야 데이터 전송함)
this.IntegratedTransmissionCheck(this.CollectionWeightData);
#endregion
}
#endregion
}
else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest)
{
#region FormEquipmentTest
if (this.SystemConfig.IsWeightViewForward == true)
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay7(this.EquipmentStatus, this.CollectionWeightDataTest[6]);
else
{
switch (this.SystemConfig.EquipmentColumns)
{
case 7:
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay1(this.EquipmentStatus, this.CollectionWeightDataTest[0]);
break;
case 8:
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay2(this.EquipmentStatus, this.CollectionWeightDataTest[1]);
break;
case 10:
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay4(this.EquipmentStatus, this.CollectionWeightDataTest[3]);
break;
case 12:
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay6(this.EquipmentStatus, this.CollectionWeightDataTest[5]);
break;
default:
break;
}
}
#endregion
}
#endregion
break;
case "H":
#region 8열
#region Value Assign
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
this.UpdateWeightData(7, receiveData);
else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest)
this.UpdateWeightDataTest(7, receiveData);
#endregion
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
{
#region FormMainDisplay
#region 통합 전송하기 위한 데이터 체크
// 중량 갱신이 되었는지 체크
if (this.SystemConfig.IsWeightViewForward == true)
this.CollectionWeightData[7].IsUpdate = true;
else
this.CollectionWeightData[this.CollectionWeightData.Count - 8].IsUpdate = true;
#endregion
#region 화면 갱신, 데이터 백업
if (this.SystemConfig.IsWeightViewForward == true)
{
this.ChildFormMainDisplay.UpdateStartWeightDisplay8(this.EquipmentStatus, this.CollectionWeightData[7]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay8(this.EquipmentStatus, this.CollectionFeedbackStatus[7]);
}
else
{
switch (this.SystemConfig.EquipmentColumns)
{
case 7:
break;
case 8:
this.ChildFormMainDisplay.UpdateStartWeightDisplay1(this.EquipmentStatus, this.CollectionWeightData[0]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay1(this.EquipmentStatus, this.CollectionFeedbackStatus[0]);
break;
case 10:
this.ChildFormMainDisplay.UpdateStartWeightDisplay3(this.EquipmentStatus, this.CollectionWeightData[2]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay3(this.EquipmentStatus, this.CollectionFeedbackStatus[2]);
break;
case 12:
this.ChildFormMainDisplay.UpdateStartWeightDisplay5(this.EquipmentStatus, this.CollectionWeightData[4]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay5(this.EquipmentStatus, this.CollectionFeedbackStatus[4]);
break;
default:
break;
}
}
#endregion
#region 이중진입
if (this.CurrentOptionParameterItem.DoubleEnter == "1")
{
// 이중진입(상한 판정시 하한설정값에 두배이면 이중) 이면 STOP
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.CollectionWeightData[7].JudgmentStatus == DataStore.JudgmentStatus.Double)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
this.ChildFormMainDisplay.UpdateAlarmMessage1Display();
}
}
else
{
if (this.CollectionWeightData[this.CollectionWeightData.Count - 8].JudgmentStatus == DataStore.JudgmentStatus.Double)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
this.ChildFormMainDisplay.UpdateAlarmMessage1Display();
}
}
}
#endregion
#region 입력센서 연속 입력 시 정지
if (this.SystemConfig.IsEmergencyStopEntrySensorError == true)
{
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.CollectionWeightData[7].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
// 메시지 11 - 입력센서 에러에 의해 정지하였습니다
this.StartThreadMessage1();
}
}
else
{
if (this.CollectionWeightData[this.CollectionWeightData.Count - 8].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
// 메시지 11 - 입력센서 에러에 의해 정지하였습니다
this.StartThreadMessage1();
}
}
}
#endregion
#region 이더넷
if (this.SystemConfig.IsEthernetEnable == true)
{
if (this.SystemConfig.EthernetMode == 1)
{
#region OPT2
etherStringData = this.Protocol_OPT2(this.SystemConfig, this.CollectionWeightData[7], 8);
this.SendEthernetData(etherStringData);
#endregion
}
else if (this.SystemConfig.EthernetMode == 2)
{
#region OPT3
etherStringData = this.Protocol_OPT3(this.SystemConfig, this.CollectionWeightData[7], 8, this.CurrentProductItem);
this.SendEthernetData(etherStringData);
#endregion
}
else if (this.SystemConfig.EthernetMode == 3)
{
#region Modbus
byte[] etherByteData = this.Modbus.WriteMultipleRegisterTCP(
this.Protocol_Modbus_Client_Write_Lane_Data(7), this.SystemConfig.ModbusTcpStartAddress + (8 * 50) + 140);
this.EthernetWeightDataForModbus(etherByteData);
#endregion
}
else if (this.SystemConfig.EthernetMode == 4)
{
#region OPT5
etherStringData = this.Protocol_OPT5(this.SystemConfig, this.CollectionWeightData[7], 8, this.CurrentProductItem);
this.SendEthernetData(etherStringData);
#endregion
}
}
#endregion
#region Serial3
if (this.SystemConfig.Serial3Mode == 1) // OPT1 - ABFood 통신 피드백
{
#region Serial3 Mode1
if (this.SystemConfig.EquipmentMode == 2)
{
if (this.timerTimeoutOPT1.Enabled == false)
this.timerTimeoutOPT1.Enabled = true;
// sensor error, double(이중) 이면 STOP
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.CollectionWeightData[7].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
}
}
else
{
if (this.CollectionWeightData[this.CollectionWeightData.Count - 8].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
}
}
// EquipmentColumns 수 만큼 중량이 들어왔는지 체크 후 데이터 전송하는 함수(EquipmentColumns 갯수가 다 들어아야 데이터 전송함)
this.UartCom3WeightDataTransfer(this.CollectionWeightData);
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 2) // OPT2 - 중량 데이터 피드백
{
#region Serial3 Mode2
if (this.SystemConfig.IsIntegratedTransmission == false)
{
#region 개별 전송
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT2(8, this.CollectionWeightData[7]);
else
this.SerialCH3OPT2(this.CollectionWeightData.Count - 7, this.CollectionWeightData[this.CollectionWeightData.Count - 8]);
#endregion
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 3) // OPT3 - 중량 데이터 피드백
{
#region Serial3 Mode3
if (this.SystemConfig.IsIntegratedTransmission == false)
{
#region 개별 전송
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT3(8, this.CollectionWeightData[7]);
else
this.SerialCH3OPT3(this.CollectionWeightData.Count - 7, this.CollectionWeightData[this.CollectionWeightData.Count - 8]);
#endregion
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 4) // OPT4 - 피드백 시스템1
{
#region Serial3 Mode4
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT4(8, this.CollectionWeightData[7]);
else
this.SerialCH3OPT4(this.CollectionWeightData.Count - 7, this.CollectionWeightData[this.CollectionWeightData.Count - 8]);
#endregion
}
else if (this.SystemConfig.Serial3Mode == 5) // Printer - 산업용 프린터
{
#region Serial3 Mode5
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.SystemConfig.IsPrintPerProductEnable == true)
this.SerialCH3Printer(8, this.CollectionWeightData[7]);
}
else
{
if (this.SystemConfig.IsPrintPerProductEnable == true)
this.SerialCH3Printer(this.CollectionWeightData.Count - 7, this.CollectionWeightData[this.CollectionWeightData.Count - 8]);
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 6) // OPT5 - 중량 데이터 피드백 (중량설정값 포함)
{
#region Serial3 Mode6
if (this.SystemConfig.IsIntegratedTransmission == false)
{
#region 개별 전송
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT5(8, this.CollectionWeightData[7]);
else
this.SerialCH3OPT5(this.CollectionWeightData.Count - 7, this.CollectionWeightData[this.CollectionWeightData.Count - 8]);
#endregion
}
#endregion
}
#endregion
if (this.SystemConfig.IsIntegratedTransmission == true)
{
#region 통합 전송
if (this.timerTimeOutTransmission.Enabled == false)
this.timerTimeOutTransmission.Enabled = true;
// EquipmentColumns 수 만큼 중량이 들어왔는지 체크 후 데이터 전송하는 함수(EquipmentColumns 갯수가 다 들어아야 데이터 전송함)
this.IntegratedTransmissionCheck(this.CollectionWeightData);
#endregion
}
#endregion
}
else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest)
{
#region FormEquipmentTest
if (this.SystemConfig.IsWeightViewForward == true)
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay8(this.EquipmentStatus, this.CollectionWeightDataTest[7]);
else
{
switch (this.SystemConfig.EquipmentColumns)
{
case 7:
break;
case 8:
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay1(this.EquipmentStatus, this.CollectionWeightDataTest[0]);
break;
case 10:
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay3(this.EquipmentStatus, this.CollectionWeightDataTest[2]);
break;
case 12:
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay5(this.EquipmentStatus, this.CollectionWeightDataTest[4]);
break;
default:
break;
}
}
#endregion
}
#endregion
break;
case "I":
#region 9열
#region Value Assign
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
this.UpdateWeightData(8, receiveData);
else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest)
this.UpdateWeightDataTest(8, receiveData);
#endregion
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
{
#region FormMainDisplay
#region 통합 전송하기 위한 데이터 체크
// 중량 갱신이 되었는지 체크
if (this.SystemConfig.IsWeightViewForward == true)
this.CollectionWeightData[8].IsUpdate = true;
else
this.CollectionWeightData[this.CollectionWeightData.Count - 9].IsUpdate = true;
#endregion
#region 화면 갱신, 데이터 백업
if (this.SystemConfig.IsWeightViewForward == true)
{
this.ChildFormMainDisplay.UpdateStartWeightDisplay9(this.EquipmentStatus, this.CollectionWeightData[8]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay9(this.EquipmentStatus, this.CollectionFeedbackStatus[8]);
}
else
{
switch (this.SystemConfig.EquipmentColumns)
{
case 7:
break;
case 8:
break;
case 10:
this.ChildFormMainDisplay.UpdateStartWeightDisplay2(this.EquipmentStatus, this.CollectionWeightData[1]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay2(this.EquipmentStatus, this.CollectionFeedbackStatus[1]);
break;
case 12:
this.ChildFormMainDisplay.UpdateStartWeightDisplay4(this.EquipmentStatus, this.CollectionWeightData[3]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay4(this.EquipmentStatus, this.CollectionFeedbackStatus[3]);
break;
default:
break;
}
}
#endregion
#region 이중진입
if (this.CurrentOptionParameterItem.DoubleEnter == "1")
{
// 이중진입(상한 판정시 하한설정값에 두배이면 이중) 이면 STOP
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.CollectionWeightData[8].JudgmentStatus == DataStore.JudgmentStatus.Double)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
this.ChildFormMainDisplay.UpdateAlarmMessage1Display();
}
}
else
{
if (this.CollectionWeightData[this.CollectionWeightData.Count - 9].JudgmentStatus == DataStore.JudgmentStatus.Double)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
this.ChildFormMainDisplay.UpdateAlarmMessage1Display();
}
}
}
#endregion
#region 입력센서 연속 입력 시 정지
if (this.SystemConfig.IsEmergencyStopEntrySensorError == true)
{
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.CollectionWeightData[8].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
// 메시지 11 - 입력센서 에러에 의해 정지하였습니다
this.StartThreadMessage1();
}
}
else
{
if (this.CollectionWeightData[this.CollectionWeightData.Count - 9].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
// 메시지 11 - 입력센서 에러에 의해 정지하였습니다
this.StartThreadMessage1();
}
}
}
#endregion
#region 이더넷
if (this.SystemConfig.IsEthernetEnable == true)
{
if (this.SystemConfig.EthernetMode == 1)
{
#region OPT2
etherStringData = this.Protocol_OPT2(this.SystemConfig, this.CollectionWeightData[8], 9);
this.SendEthernetData(etherStringData);
#endregion
}
else if (this.SystemConfig.EthernetMode == 2)
{
#region OPT3
etherStringData = this.Protocol_OPT3(this.SystemConfig, this.CollectionWeightData[8], 9, this.CurrentProductItem);
this.SendEthernetData(etherStringData);
#endregion
}
else if (this.SystemConfig.EthernetMode == 3)
{
#region Modbus
byte[] etherByteData = this.Modbus.WriteMultipleRegisterTCP(
this.Protocol_Modbus_Client_Write_Lane_Data(8), this.SystemConfig.ModbusTcpStartAddress + (9 * 50) + 140);
this.EthernetWeightDataForModbus(etherByteData);
#endregion
}
else if (this.SystemConfig.EthernetMode == 4)
{
#region OPT5
etherStringData = this.Protocol_OPT5(this.SystemConfig, this.CollectionWeightData[8], 9, this.CurrentProductItem);
this.SendEthernetData(etherStringData);
#endregion
}
}
#endregion
#region Serial3
if (this.SystemConfig.Serial3Mode == 1) // OPT1 - ABFood 통신 피드백
{
#region Serial3 Mode1
if (this.SystemConfig.EquipmentMode == 2)
{
if (this.timerTimeoutOPT1.Enabled == false)
this.timerTimeoutOPT1.Enabled = true;
// sensor error, double(이중) 이면 STOP
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.CollectionWeightData[8].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
}
}
else
{
if (this.CollectionWeightData[this.CollectionWeightData.Count - 9].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
}
}
// EquipmentColumns 수 만큼 중량이 들어왔는지 체크 후 데이터 전송하는 함수(EquipmentColumns 갯수가 다 들어아야 데이터 전송함)
this.UartCom3WeightDataTransfer(this.CollectionWeightData);
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 2) // OPT2 - 중량 데이터 피드백
{
#region Serial3 Mode2
if (this.SystemConfig.IsIntegratedTransmission == false)
{
#region 개별 전송
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT2(9, this.CollectionWeightData[8]);
else
this.SerialCH3OPT2(this.CollectionWeightData.Count - 8, this.CollectionWeightData[this.CollectionWeightData.Count - 9]);
#endregion
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 3) // OPT3 - 중량 데이터 피드백
{
#region Serial3 Mode3
if (this.SystemConfig.IsIntegratedTransmission == false)
{
#region 개별 전송
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT3(9, this.CollectionWeightData[8]);
else
this.SerialCH3OPT3(this.CollectionWeightData.Count - 8, this.CollectionWeightData[this.CollectionWeightData.Count - 9]);
#endregion
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 4) // OPT4 - 피드백 시스템1
{
#region Serial3 Mode4
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT4(9, this.CollectionWeightData[8]);
else
this.SerialCH3OPT4(this.CollectionWeightData.Count - 8, this.CollectionWeightData[this.CollectionWeightData.Count - 9]);
#endregion
}
else if (this.SystemConfig.Serial3Mode == 5) // Printer - 산업용 프린터
{
#region Serial3 Mode5
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.SystemConfig.IsPrintPerProductEnable == true)
this.SerialCH3Printer(9, this.CollectionWeightData[8]);
}
else
{
if (this.SystemConfig.IsPrintPerProductEnable == true)
this.SerialCH3Printer(this.CollectionWeightData.Count - 8, this.CollectionWeightData[this.CollectionWeightData.Count - 9]);
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 6) // OPT5 - 중량 데이터 피드백 (중량설정값 포함)
{
#region Serial3 Mode6
if (this.SystemConfig.IsIntegratedTransmission == false)
{
#region 개별 전송
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT5(9, this.CollectionWeightData[8]);
else
this.SerialCH3OPT5(this.CollectionWeightData.Count - 8, this.CollectionWeightData[this.CollectionWeightData.Count - 9]);
#endregion
}
#endregion
}
#endregion
if (this.SystemConfig.IsIntegratedTransmission == true)
{
#region 통합 전송
if (this.timerTimeOutTransmission.Enabled == false)
this.timerTimeOutTransmission.Enabled = true;
// EquipmentColumns 수 만큼 중량이 들어왔는지 체크 후 데이터 전송하는 함수(EquipmentColumns 갯수가 다 들어아야 데이터 전송함)
this.IntegratedTransmissionCheck(this.CollectionWeightData);
#endregion
}
#endregion
}
else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest)
{
#region FormEquipmentTest
if (this.SystemConfig.IsWeightViewForward == true)
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay9(this.EquipmentStatus, this.CollectionWeightDataTest[8]);
else
{
switch (this.SystemConfig.EquipmentColumns)
{
case 7:
break;
case 8:
break;
case 10:
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay2(this.EquipmentStatus, this.CollectionWeightDataTest[1]);
break;
case 12:
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay4(this.EquipmentStatus, this.CollectionWeightDataTest[3]);
break;
default:
break;
}
}
#endregion
}
#endregion
break;
case "J":
#region 10열
#region Value Assign
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
this.UpdateWeightData(9, receiveData);
else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest)
this.UpdateWeightDataTest(9, receiveData);
#endregion
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
{
#region FormMainDisplay
#region 통합 전송하기 위한 데이터 체크
// 중량 갱신이 되었는지 체크
if (this.SystemConfig.IsWeightViewForward == true)
this.CollectionWeightData[9].IsUpdate = true;
else
this.CollectionWeightData[this.CollectionWeightData.Count - 10].IsUpdate = true;
#endregion
#region 화면 갱신, 데이터 백업
if (this.SystemConfig.IsWeightViewForward == true)
{
this.ChildFormMainDisplay.UpdateStartWeightDisplay10(this.EquipmentStatus, this.CollectionWeightData[9]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay10(this.EquipmentStatus, this.CollectionFeedbackStatus[9]);
}
else
{
switch (this.SystemConfig.EquipmentColumns)
{
case 7:
break;
case 8:
break;
case 10:
this.ChildFormMainDisplay.UpdateStartWeightDisplay1(this.EquipmentStatus, this.CollectionWeightData[0]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay1(this.EquipmentStatus, this.CollectionFeedbackStatus[0]);
break;
case 12:
this.ChildFormMainDisplay.UpdateStartWeightDisplay3(this.EquipmentStatus, this.CollectionWeightData[2]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay3(this.EquipmentStatus, this.CollectionFeedbackStatus[2]);
break;
default:
break;
}
}
#endregion
#region 이중진입
if (this.CurrentOptionParameterItem.DoubleEnter == "1")
{
// 이중진입(상한 판정시 하한설정값에 두배이면 이중) 이면 STOP
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.CollectionWeightData[9].JudgmentStatus == DataStore.JudgmentStatus.Double)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
this.ChildFormMainDisplay.UpdateAlarmMessage1Display();
}
}
else
{
if (this.CollectionWeightData[this.CollectionWeightData.Count - 10].JudgmentStatus == DataStore.JudgmentStatus.Double)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
this.ChildFormMainDisplay.UpdateAlarmMessage1Display();
}
}
}
#endregion
#region 입력센서 연속 입력 시 정지
if (this.SystemConfig.IsEmergencyStopEntrySensorError == true)
{
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.CollectionWeightData[9].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
// 메시지 11 - 입력센서 에러에 의해 정지하였습니다
this.StartThreadMessage1();
}
}
else
{
if (this.CollectionWeightData[this.CollectionWeightData.Count - 10].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
// 메시지 11 - 입력센서 에러에 의해 정지하였습니다
this.StartThreadMessage1();
}
}
}
#endregion
#region 이더넷
if (this.SystemConfig.IsEthernetEnable == true)
{
if (this.SystemConfig.EthernetMode == 1)
{
#region OPT2
etherStringData = this.Protocol_OPT2(this.SystemConfig, this.CollectionWeightData[9], 10);
this.SendEthernetData(etherStringData);
#endregion
}
else if (this.SystemConfig.EthernetMode == 2)
{
#region OPT3
etherStringData = this.Protocol_OPT3(this.SystemConfig, this.CollectionWeightData[9], 10, this.CurrentProductItem);
this.SendEthernetData(etherStringData);
#endregion
}
else if (this.SystemConfig.EthernetMode == 3)
{
#region Modbus
byte[] etherByteData = this.Modbus.WriteMultipleRegisterTCP(
this.Protocol_Modbus_Client_Write_Lane_Data(9), this.SystemConfig.ModbusTcpStartAddress + (10 * 50) + 140);
this.EthernetWeightDataForModbus(etherByteData);
#endregion
}
else if (this.SystemConfig.EthernetMode == 4)
{
#region OPT5
etherStringData = this.Protocol_OPT5(this.SystemConfig, this.CollectionWeightData[9], 10, this.CurrentProductItem);
this.SendEthernetData(etherStringData);
#endregion
}
}
#endregion
#region Serial3
if (this.SystemConfig.Serial3Mode == 1) // OPT1 - ABFood 통신 피드백
{
#region Serial3 Mode1
if (this.SystemConfig.EquipmentMode == 2)
{
if (this.timerTimeoutOPT1.Enabled == false)
this.timerTimeoutOPT1.Enabled = true;
// sensor error, double(이중) 이면 STOP
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.CollectionWeightData[9].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
}
}
else
{
if (this.CollectionWeightData[this.CollectionWeightData.Count - 10].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
}
}
// EquipmentColumns 수 만큼 중량이 들어왔는지 체크 후 데이터 전송하는 함수(EquipmentColumns 갯수가 다 들어아야 데이터 전송함)
this.UartCom3WeightDataTransfer(this.CollectionWeightData);
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 2) // OPT2 - 중량 데이터 피드백
{
#region Serial3 Mode2
if (this.SystemConfig.IsIntegratedTransmission == false)
{
#region 개별 전송
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT2(10, this.CollectionWeightData[9]);
else
this.SerialCH3OPT2(this.CollectionWeightData.Count - 9, this.CollectionWeightData[this.CollectionWeightData.Count - 10]);
#endregion
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 3) // OPT3 - 중량 데이터 피드백
{
#region Serial3 Mode3
if (this.SystemConfig.IsIntegratedTransmission == false)
{
#region 개별 전송
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT3(10, this.CollectionWeightData[9]);
else
this.SerialCH3OPT3(this.CollectionWeightData.Count - 9, this.CollectionWeightData[this.CollectionWeightData.Count - 10]);
#endregion
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 4) // OPT4 - 피드백 시스템1
{
#region Serial3 Mode4
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT4(10, this.CollectionWeightData[9]);
else
this.SerialCH3OPT4(this.CollectionWeightData.Count - 9, this.CollectionWeightData[this.CollectionWeightData.Count - 10]);
#endregion
}
else if (this.SystemConfig.Serial3Mode == 5) // Printer - 산업용 프린터
{
#region Serial3 Mode5
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.SystemConfig.IsPrintPerProductEnable == true)
this.SerialCH3Printer(10, this.CollectionWeightData[9]);
}
else
{
if (this.SystemConfig.IsPrintPerProductEnable == true)
this.SerialCH3Printer(this.CollectionWeightData.Count - 9, this.CollectionWeightData[this.CollectionWeightData.Count - 10]);
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 6) // OPT5 - 중량 데이터 피드백 (중량설정값 포함)
{
#region Serial3 Mode6
if (this.SystemConfig.IsIntegratedTransmission == false)
{
#region 개별 전송
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT5(10, this.CollectionWeightData[9]);
else
this.SerialCH3OPT5(this.CollectionWeightData.Count - 9, this.CollectionWeightData[this.CollectionWeightData.Count - 10]);
#endregion
}
#endregion
}
#endregion
if (this.SystemConfig.IsIntegratedTransmission == true)
{
#region 통합 전송
if (this.timerTimeOutTransmission.Enabled == false)
this.timerTimeOutTransmission.Enabled = true;
// EquipmentColumns 수 만큼 중량이 들어왔는지 체크 후 데이터 전송하는 함수(EquipmentColumns 갯수가 다 들어아야 데이터 전송함)
this.IntegratedTransmissionCheck(this.CollectionWeightData);
#endregion
}
#endregion
}
else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest)
{
#region FormEquipmentTest
if (this.SystemConfig.IsWeightViewForward == true)
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay10(this.EquipmentStatus, this.CollectionWeightDataTest[9]);
else
{
switch (this.SystemConfig.EquipmentColumns)
{
case 7:
break;
case 8:
break;
case 10:
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay1(this.EquipmentStatus, this.CollectionWeightDataTest[0]);
break;
case 12:
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay3(this.EquipmentStatus, this.CollectionWeightDataTest[2]);
break;
default:
break;
}
}
#endregion
}
#endregion
break;
case "K":
#region 11열
#region Value Assign
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
this.UpdateWeightData(10, receiveData);
else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest)
this.UpdateWeightDataTest(10, receiveData);
#endregion
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
{
#region FormMainDisplay
#region 통합 전송하기 위한 데이터 체크
// 중량 갱신이 되었는지 체크
if (this.SystemConfig.IsWeightViewForward == true)
this.CollectionWeightData[10].IsUpdate = true;
else
this.CollectionWeightData[this.CollectionWeightData.Count - 11].IsUpdate = true;
#endregion
#region 화면 갱신, 데이터 백업
if (this.SystemConfig.IsWeightViewForward == true)
{
this.ChildFormMainDisplay.UpdateStartWeightDisplay11(this.EquipmentStatus, this.CollectionWeightData[10]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay11(this.EquipmentStatus, this.CollectionFeedbackStatus[10]);
}
else
{
switch (this.SystemConfig.EquipmentColumns)
{
case 7:
break;
case 8:
break;
case 10:
break;
case 12:
this.ChildFormMainDisplay.UpdateStartWeightDisplay2(this.EquipmentStatus, this.CollectionWeightData[1]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay2(this.EquipmentStatus, this.CollectionFeedbackStatus[1]);
break;
default:
break;
}
}
#endregion
#region 이중진입
if (this.CurrentOptionParameterItem.DoubleEnter == "1")
{
// 이중진입(상한 판정시 하한설정값에 두배이면 이중) 이면 STOP
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.CollectionWeightData[10].JudgmentStatus == DataStore.JudgmentStatus.Double)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
this.ChildFormMainDisplay.UpdateAlarmMessage1Display();
}
}
else
{
if (this.CollectionWeightData[this.CollectionWeightData.Count - 11].JudgmentStatus == DataStore.JudgmentStatus.Double)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
this.ChildFormMainDisplay.UpdateAlarmMessage1Display();
}
}
}
#endregion
#region 입력센서 연속 입력 시 정지
if (this.SystemConfig.IsEmergencyStopEntrySensorError == true)
{
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.CollectionWeightData[10].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
// 메시지 11 - 입력센서 에러에 의해 정지하였습니다
this.StartThreadMessage1();
}
}
else
{
if (this.CollectionWeightData[this.CollectionWeightData.Count - 11].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
// 메시지 11 - 입력센서 에러에 의해 정지하였습니다
this.StartThreadMessage1();
}
}
}
#endregion
#region 이더넷
if (this.SystemConfig.IsEthernetEnable == true)
{
if (this.SystemConfig.EthernetMode == 1)
{
#region OPT2
etherStringData = this.Protocol_OPT2(this.SystemConfig, this.CollectionWeightData[10], 11);
this.SendEthernetData(etherStringData);
#endregion
}
else if (this.SystemConfig.EthernetMode == 2)
{
#region OPT3
etherStringData = this.Protocol_OPT3(this.SystemConfig, this.CollectionWeightData[10], 11, this.CurrentProductItem);
this.SendEthernetData(etherStringData);
#endregion
}
else if (this.SystemConfig.EthernetMode == 3)
{
#region Modbus
byte[] etherByteData = this.Modbus.WriteMultipleRegisterTCP(
this.Protocol_Modbus_Client_Write_Lane_Data(10), this.SystemConfig.ModbusTcpStartAddress + (11 * 50) + 140);
this.EthernetWeightDataForModbus(etherByteData);
#endregion
}
else if (this.SystemConfig.EthernetMode == 4)
{
#region OPT5
etherStringData = this.Protocol_OPT5(this.SystemConfig, this.CollectionWeightData[10], 11, this.CurrentProductItem);
this.SendEthernetData(etherStringData);
#endregion
}
}
#endregion
#region Serial3
if (this.SystemConfig.Serial3Mode == 1) // OPT1 - ABFood 통신 피드백
{
#region Serial3 Mode1
if (this.SystemConfig.EquipmentMode == 2)
{
if (this.timerTimeoutOPT1.Enabled == false)
this.timerTimeoutOPT1.Enabled = true;
// sensor error, double(이중) 이면 STOP
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.CollectionWeightData[10].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
}
}
else
{
if (this.CollectionWeightData[this.CollectionWeightData.Count - 11].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
}
}
// EquipmentColumns 수 만큼 중량이 들어왔는지 체크 후 데이터 전송하는 함수(EquipmentColumns 갯수가 다 들어아야 데이터 전송함)
this.UartCom3WeightDataTransfer(this.CollectionWeightData);
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 2) // OPT2 - 중량 데이터 피드백
{
#region Serial3 Mode2
if (this.SystemConfig.IsIntegratedTransmission == false)
{
#region 개별 전송
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT2(11, this.CollectionWeightData[10]);
else
this.SerialCH3OPT2(this.CollectionWeightData.Count - 10, this.CollectionWeightData[this.CollectionWeightData.Count - 11]);
#endregion
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 3) // OPT3 - 중량 데이터 피드백
{
#region Serial3 Mode3
if (this.SystemConfig.IsIntegratedTransmission == false)
{
#region 개별 전송
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT3(11, this.CollectionWeightData[10]);
else
this.SerialCH3OPT3(this.CollectionWeightData.Count - 10, this.CollectionWeightData[this.CollectionWeightData.Count - 11]);
#endregion
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 4) // OPT4 - 피드백 시스템1
{
#region Serial3 Mode4
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT4(11, this.CollectionWeightData[10]);
else
this.SerialCH3OPT4(this.CollectionWeightData.Count - 10, this.CollectionWeightData[this.CollectionWeightData.Count - 11]);
#endregion
}
else if (this.SystemConfig.Serial3Mode == 5) // Printer - 산업용 프린터
{
#region Serial3 Mode5
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.SystemConfig.IsPrintPerProductEnable == true)
this.SerialCH3Printer(11, this.CollectionWeightData[10]);
}
else
{
if (this.SystemConfig.IsPrintPerProductEnable == true)
this.SerialCH3Printer(this.CollectionWeightData.Count - 10, this.CollectionWeightData[this.CollectionWeightData.Count - 11]);
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 6) // OPT5 - 중량 데이터 피드백 (중량설정값 포함)
{
#region Serial3 Mode6
if (this.SystemConfig.IsIntegratedTransmission == false)
{
#region 개별 전송
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT5(11, this.CollectionWeightData[10]);
else
this.SerialCH3OPT5(this.CollectionWeightData.Count - 10, this.CollectionWeightData[this.CollectionWeightData.Count - 11]);
#endregion
}
#endregion
}
#endregion
if (this.SystemConfig.IsIntegratedTransmission == true)
{
#region 통합 전송
if (this.timerTimeOutTransmission.Enabled == false)
this.timerTimeOutTransmission.Enabled = true;
// EquipmentColumns 수 만큼 중량이 들어왔는지 체크 후 데이터 전송하는 함수(EquipmentColumns 갯수가 다 들어아야 데이터 전송함)
this.IntegratedTransmissionCheck(this.CollectionWeightData);
#endregion
}
#endregion
}
else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest)
{
#region FormEquipmentTest
if (this.SystemConfig.IsWeightViewForward == true)
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay11(this.EquipmentStatus, this.CollectionWeightDataTest[10]);
else
{
switch (this.SystemConfig.EquipmentColumns)
{
case 7:
break;
case 8:
break;
case 10:
break;
case 12:
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay2(this.EquipmentStatus, this.CollectionWeightDataTest[1]);
break;
default:
break;
}
}
#endregion
}
#endregion
break;
case "L":
#region 12열
#region Value Assign
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
this.UpdateWeightData(11, receiveData);
else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest)
this.UpdateWeightDataTest(11, receiveData);
#endregion
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
{
#region FormMainDisplay
#region 통합 전송하기 위한 데이터 체크
// 중량 갱신이 되었는지 체크
if (this.SystemConfig.IsWeightViewForward == true)
this.CollectionWeightData[11].IsUpdate = true;
else
this.CollectionWeightData[this.CollectionWeightData.Count - 12].IsUpdate = true;
#endregion
#region 화면 갱신, 데이터 백업
if (this.SystemConfig.IsWeightViewForward == true)
{
this.ChildFormMainDisplay.UpdateStartWeightDisplay12(this.EquipmentStatus, this.CollectionWeightData[11]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay12(this.EquipmentStatus, this.CollectionFeedbackStatus[11]);
}
else
{
switch (this.SystemConfig.EquipmentColumns)
{
case 7:
break;
case 8:
break;
case 10:
break;
case 12:
this.ChildFormMainDisplay.UpdateStartWeightDisplay1(this.EquipmentStatus, this.CollectionWeightData[0]);
this.ChildFormMainDisplay.UpdateFeedbackDataDisplay1(this.EquipmentStatus, this.CollectionFeedbackStatus[0]);
break;
default:
break;
}
}
#endregion
#region 이중진입
if (this.CurrentOptionParameterItem.DoubleEnter == "1")
{
// 이중진입(상한 판정시 하한설정값에 두배이면 이중) 이면 STOP
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.CollectionWeightData[11].JudgmentStatus == DataStore.JudgmentStatus.Double)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
this.ChildFormMainDisplay.UpdateAlarmMessage1Display();
}
}
else
{
if (this.CollectionWeightData[this.CollectionWeightData.Count - 12].JudgmentStatus == DataStore.JudgmentStatus.Double)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
this.ChildFormMainDisplay.UpdateAlarmMessage1Display();
}
}
}
#endregion
#region 입력센서 연속 입력 시 정지
if (this.SystemConfig.IsEmergencyStopEntrySensorError == true)
{
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.CollectionWeightData[11].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
// 메시지 11 - 입력센서 에러에 의해 정지하였습니다
this.StartThreadMessage1();
}
}
else
{
if (this.CollectionWeightData[this.CollectionWeightData.Count - 12].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
// 메시지 11 - 입력센서 에러에 의해 정지하였습니다
this.StartThreadMessage1();
}
}
}
#endregion
#region 이더넷
if (this.SystemConfig.IsEthernetEnable == true)
{
if (this.SystemConfig.EthernetMode == 1)
{
#region OPT2
etherStringData = this.Protocol_OPT2(this.SystemConfig, this.CollectionWeightData[11], 12);
this.SendEthernetData(etherStringData);
#endregion
}
else if (this.SystemConfig.EthernetMode == 2)
{
#region OPT3
etherStringData = this.Protocol_OPT3(this.SystemConfig, this.CollectionWeightData[11], 12, this.CurrentProductItem);
this.SendEthernetData(etherStringData);
#endregion
}
else if (this.SystemConfig.EthernetMode == 3) // Modbus
{
#region Modbus
byte[] etherByteData = this.Modbus.WriteMultipleRegisterTCP(
this.Protocol_Modbus_Client_Write_Lane_Data(11), this.SystemConfig.ModbusTcpStartAddress + (12 * 50) + 140);
this.EthernetWeightDataForModbus(etherByteData);
#endregion
}
else if (this.SystemConfig.EthernetMode == 4)
{
#region OPT5
etherStringData = this.Protocol_OPT5(this.SystemConfig, this.CollectionWeightData[11], 12, this.CurrentProductItem);
this.SendEthernetData(etherStringData);
#endregion
}
}
#endregion
#region Serial3
if (this.SystemConfig.Serial3Mode == 1) // OPT1 - ABFood 통신 피드백
{
#region Serial3 Mode1
if (this.SystemConfig.EquipmentMode == 2)
{
if (this.timerTimeoutOPT1.Enabled == false)
this.timerTimeoutOPT1.Enabled = true;
// sensor error, double(이중) 이면 STOP
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.CollectionWeightData[11].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
}
}
else
{
if (this.CollectionWeightData[this.CollectionWeightData.Count - 12].JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
}
}
// EquipmentColumns 수 만큼 중량이 들어왔는지 체크 후 데이터 전송하는 함수(EquipmentColumns 갯수가 다 들어아야 데이터 전송함)
this.UartCom3WeightDataTransfer(this.CollectionWeightData);
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 2) // OPT2 - 중량 데이터 피드백
{
#region Serial3 Mode2
if (this.SystemConfig.IsIntegratedTransmission == false)
{
#region 개별 전송
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT2(12, this.CollectionWeightData[11]);
else
this.SerialCH3OPT2(this.CollectionWeightData.Count - 11, this.CollectionWeightData[this.CollectionWeightData.Count - 12]);
#endregion
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 3) // OPT3 - 중량 데이터 피드백
{
#region Serial3 Mode3
if (this.SystemConfig.IsIntegratedTransmission == false)
{
#region 개별 전송
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT3(12, this.CollectionWeightData[11]);
else
this.SerialCH3OPT3(this.CollectionWeightData.Count - 11, this.CollectionWeightData[this.CollectionWeightData.Count - 12]);
#endregion
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 4) // OPT4 - 피드백 시스템1
{
#region Serial3 Mode4
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT4(12, this.CollectionWeightData[11]);
else
this.SerialCH3OPT4(this.CollectionWeightData.Count - 11, this.CollectionWeightData[this.CollectionWeightData.Count - 12]);
#endregion
}
else if (this.SystemConfig.Serial3Mode == 5) // Printer - 산업용 프린터
{
#region Serial3 Mode5
if (this.SystemConfig.IsWeightViewForward == true)
{
if (this.SystemConfig.IsPrintPerProductEnable == true)
this.SerialCH3Printer(12, this.CollectionWeightData[11]);
}
else
{
if (this.SystemConfig.IsPrintPerProductEnable == true)
this.SerialCH3Printer(this.CollectionWeightData.Count - 11, this.CollectionWeightData[this.CollectionWeightData.Count - 12]);
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 6) // OPT5 - 중량 데이터 피드백
{
#region Serial3 Mode6
if (this.SystemConfig.IsIntegratedTransmission == false)
{
#region 개별 전송
if (this.SystemConfig.IsWeightViewForward == true)
this.SerialCH3OPT5(12, this.CollectionWeightData[11]);
else
this.SerialCH3OPT5(this.CollectionWeightData.Count - 11, this.CollectionWeightData[this.CollectionWeightData.Count - 12]);
#endregion
}
#endregion
}
#endregion
if (this.SystemConfig.IsIntegratedTransmission == true)
{
#region 통합 전송
if (this.timerTimeOutTransmission.Enabled == false)
this.timerTimeOutTransmission.Enabled = true;
// EquipmentColumns 수 만큼 중량이 들어왔는지 체크 후 데이터 전송하는 함수(EquipmentColumns 갯수가 다 들어아야 데이터 전송함)
this.IntegratedTransmissionCheck(this.CollectionWeightData);
#endregion
}
#endregion
}
else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest)
{
#region FormEquipmentTest
if (this.SystemConfig.IsWeightViewForward == true)
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay12(this.EquipmentStatus, this.CollectionWeightDataTest[11]);
else
{
switch (this.SystemConfig.EquipmentColumns)
{
case 7:
break;
case 8:
break;
case 10:
break;
case 12:
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay1(this.EquipmentStatus, this.CollectionWeightDataTest[0]);
break;
default:
break;
}
}
#endregion
}
#endregion
break;
case "Z":
#region 전체
#region Value Assign
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
{
if (this.SystemConfig.IsWeightViewForward == true)
{
#region Forward
DataStore.JudgmentStatus jStatus = DataStore.JudgmentStatus.Empty;
bool result1 = false;
for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++)
{
jStatus = Helper.StringToJudgmentStatus(receiveData.Substring(i * 12, 2));
this.CollJudgmentStatus[i] = jStatus;
if (jStatus != DataStore.JudgmentStatus.Pass)
result1 = true;
}
if (this.SystemConfig.IsIndividualNG == false)
{
// 판정데이터 검사
if (result1 == true)
{
for (int i = 0; i < this.CollJudgmentStatus.Count; i++)
{
if (this.CollJudgmentStatus[i] == DataStore.JudgmentStatus.Pass)
this.CollJudgmentStatus[i] = DataStore.JudgmentStatus.EXNg;
}
}
}
for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++)
{
this.CollectionWeightData[i].JudgmentStatus = this.CollJudgmentStatus[i];
this.CollectionWeightData[i].Weight = Helper.StringToWeight(receiveData.Substring(i * 12 + 2, 5), this.SystemConfig.DecimalPlaces);
this.CollectionWeightData[i].WeightString = receiveData.Substring(i * 12 + 2, 5);
this.CollectionWeightData[i].ADCValue = receiveData.Substring(i * 12 + 7, 5);
if (this.SystemConfig.EthernetOperationMode == 3)
this.Update30000ModbusData(i);
}
#endregion
}
else
{
#region Reverse
DataStore.JudgmentStatus jStatus = DataStore.JudgmentStatus.Empty;
bool result1 = false;
for (int i = 1; i <= this.SystemConfig.EquipmentColumns; i++)
{
jStatus = Helper.StringToJudgmentStatus(receiveData.Substring((i - 1) * 12, 2));
this.CollJudgmentStatus[this.CollJudgmentStatus.Count - i] = jStatus;
if (jStatus != DataStore.JudgmentStatus.Pass)
result1 = true;
}
if (this.SystemConfig.IsIndividualNG == false)
{
// 판정데이터 검사
if (result1 == true)
{
for (int i = 1; i <= this.SystemConfig.EquipmentColumns; i++)
{
if (this.CollJudgmentStatus[this.SystemConfig.EquipmentColumns - i] == DataStore.JudgmentStatus.Pass)
this.CollJudgmentStatus[this.SystemConfig.EquipmentColumns - i] = DataStore.JudgmentStatus.EXNg;
}
}
}
for (int i = 1; i <= this.SystemConfig.EquipmentColumns; i++)
{
this.CollectionWeightData[this.CollectionWeightData.Count - i].JudgmentStatus = Helper.StringToJudgmentStatus(receiveData.Substring((i - 1) * 12, 2));
this.CollectionWeightData[this.CollectionWeightData.Count - i].Weight = Helper.StringToWeight(receiveData.Substring((i - 1) * 12 + 2, 5), this.SystemConfig.DecimalPlaces);
this.CollectionWeightData[this.CollectionWeightData.Count - i].WeightString = receiveData.Substring((i - 1) * 12 + 2, 5);
this.CollectionWeightData[this.CollectionWeightData.Count - i].ADCValue = receiveData.Substring((i - 1) * 12 + 7, 5);
if (this.SystemConfig.EthernetOperationMode == 3)
this.Update30000ModbusData(this.CollectionWeightData.Count - i);
}
#endregion
}
}
else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest)
{
if (this.SystemConfig.IsWeightViewForward == true)
{
for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++)
{
this.CollectionWeightDataTest[i].JudgmentStatus = Helper.StringToJudgmentStatus(receiveData.Substring(i * 12, 2));
this.CollectionWeightDataTest[i].Weight = Helper.StringToWeight(receiveData.Substring(i * 12 + 2, 5), this.SystemConfig.DecimalPlaces);
this.CollectionWeightDataTest[i].ADCValue = receiveData.Substring(i * 12 + 7, 5);
}
}
else
{
for (int i = 1; i <= this.SystemConfig.EquipmentColumns; i++)
{
this.CollectionWeightDataTest[this.CollectionWeightDataTest.Count - i].JudgmentStatus = Helper.StringToJudgmentStatus(receiveData.Substring((i - 1) * 12, 2));
this.CollectionWeightDataTest[this.CollectionWeightDataTest.Count - i].Weight = Helper.StringToWeight(receiveData.Substring((i - 1) * 12 + 2, 5), this.SystemConfig.DecimalPlaces);
this.CollectionWeightDataTest[this.CollectionWeightDataTest.Count - i].ADCValue = receiveData.Substring((i - 1) * 12 + 7, 5);
}
}
}
#endregion
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
{
#region FormMainDisplay
#region 이중진입
if (this.CurrentOptionParameterItem.DoubleEnter == "1")
{
// 이중진입(상한 판정시 하한설정값에 두배이면 이중) 이면 STOP
foreach (WeightData data in this.CollectionWeightData)
{
if (data.JudgmentStatus == DataStore.JudgmentStatus.Double)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
{
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
this.ChildFormMainDisplay.UpdateAlarmMessage1Display();
break;
}
}
}
}
#endregion
#region 화면 갱신, 데이터 백업
this.TrackingInspectionData(this.CollectionWeightData);
this.ChildFormMainDisplay.UpdateStartWeightDisplay(this.EquipmentStatus, this.CollectionWeightData);
#endregion
#region 입력센서 연속 입력 시 정지
if (this.SystemConfig.IsEmergencyStopEntrySensorError == true)
{
foreach (WeightData data in this.CollectionWeightData)
{
if (data.JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
// 메시지 11 - 입력센서 에러에 의해 정지하였습니다
this.StartThreadMessage1();
break;
}
}
}
#endregion
#region 이더넷
if (this.SystemConfig.IsEthernetEnable == true)
{
if (this.SystemConfig.EthernetMode == 1)
{
#region OPT2
etherStringData = this.Protocol_OPT2(this.SystemConfig, this.CollectionWeightData);
this.SendEthernetData(etherStringData);
#endregion
}
else if (this.SystemConfig.EthernetMode == 2)
{
#region OPT3
etherStringData = this.Protocol_OPT3(this.SystemConfig, this.CollectionWeightData, this.CurrentProductItem);
this.SendEthernetData(etherStringData);
#endregion
}
else if (this.SystemConfig.EthernetMode == 3)
{
#region Modbus
for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++)
{
byte[] etherByteData = this.Modbus.WriteMultipleRegisterTCP(
this.Protocol_Modbus_Client_Write_Lane_Data(i), this.SystemConfig.ModbusTcpStartAddress + ((i + 1) * 50) + 140);
this.EthernetWeightDataForModbus(etherByteData);
}
#endregion
}
else if (this.SystemConfig.EthernetMode == 4)
{
#region OPT5
etherStringData = this.Protocol_OPT5(this.SystemConfig, this.CollectionWeightData, this.CurrentProductItem);
this.SendEthernetData(etherStringData);
#endregion
}
}
#endregion
#region Serial3
if (this.SystemConfig.Serial3Mode == 1) // OPT1 - ABFood 통신 피드백
{
#region Serial3 Mode1
// sensor error 이면 STOP
foreach (WeightData data in this.CollectionWeightData)
{
if (data.JudgmentStatus == DataStore.JudgmentStatus.SensorError || data.JudgmentStatus == DataStore.JudgmentStatus.Double)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
{
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
break;
}
}
}
this.UartCom3TransferDataABFood(DataStore.ABFoodDataCommand.Normal, (int)DataStore.ABFoodDataStatus.Normal);
#endregion
}
else if (this.SystemConfig.Serial3Mode == 2) // OPT2 - 중량 데이터 피드백
{
# region Serial3 Mode2
if (this.SystemConfig.IsIndividualTransmission == false)
this.SerialCH3OPT2(this.CollectionWeightData);
else
{
for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++)
this.SerialCH3OPT2(i + 1, this.CollectionWeightData[i]);
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 3) // OPT3 - 중량 데이터 피드백
{
#region Serial3 Mode3
if (this.SystemConfig.IsIndividualTransmission == false)
this.SerialCH3OPT3(this.CollectionWeightData);
else
{
for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++)
this.SerialCH3OPT3(i + 1, this.CollectionWeightData[i]);
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 4) // OPT4 - 중량 데이터 피드백
{
#region Serial3 Mode3
for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++)
this.SerialCH3OPT4(i + 1, this.CollectionWeightData[i]);
#endregion
}
else if (this.SystemConfig.Serial3Mode == 5) // Printer - 산업용 프린터
{
#region Serial3 Mode5
if (this.SystemConfig.IsPrintPerProductEnable == true)
{
for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++)
this.SerialCH3Printer(i + 1, this.CollectionWeightData[i]);
}
#endregion
}
else if (this.SystemConfig.Serial3Mode == 6) // OPT5 - 중량 데이터 피드백
{
#region Serial3 Mode3
if (this.SystemConfig.IsIndividualTransmission == false)
this.SerialCH3OPT5(this.CollectionWeightData);
else
{
for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++)
this.SerialCH3OPT5(i + 1, this.CollectionWeightData[i]);
}
#endregion
}
#endregion
#region ACNC(Alarm Continuous Ng Count)
if (this.SystemConfig.IsAlarmContinuousNGEnable == true)
{
for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++)
{
if (this.CollectionWeightData[i].IsContinuousNG == true)
{
this.CollectionWeightData[i].ContinuousNG++;
if (this.CollectionWeightData[i].ContinuousNG >= this.SystemConfig.AlarmContinuousNG)
{
//this.CollectionWeightData[i].ContinuousNG = 0;
this.TransferData(CommunicationCommand.AlarmPulseNG, CommunicationID.MainBoard);
this.ChildFormMainDisplay.UpdateAlarmMessage3Display(true);
}
}
}
}
#endregion
#region ATPC(Alarm Total Pass Count)
if (this.SystemConfig.IsAlarmTotalPassCntEnable == true)
{
result = this.CurrentAlarmTotalPassCnt.SetCountStic1(this.CollectionWeightData);
if (result == true)
this.TransferData(CommunicationCommand.AlarmPulseNG, CommunicationID.MainBoard);
this.ChildFormMainDisplay.UpdateAlarmTotalPassCountDisplay(this.CurrentAlarmTotalPassCnt);
}
#endregion
#endregion
}
else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest)
{
#region FormEquipmentTest
this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay(this.EquipmentStatus, this.CollectionWeightDataTest);
#endregion
}
#endregion
break;
default:
break;
}
}
catch
{
ret = -1;
}
return ret;
}
// 중량조정시 중량
private int ReceiveCommandSC0(string lane, string receiveData)
{
int ret = 0;
switch (lane)
{
case "Z":
#region Value Assign
for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++)
{
this.CollectionWeightData[i].Status = Helper.StringToWeightStatus(receiveData.Substring(i * 12, 2));
this.CollectionWeightData[i].Weight = Helper.StringToWeight(receiveData.Substring(i * 12 + 2, 5), this.SystemConfig.DecimalPlaces);
this.CollectionWeightData[i].ADCValue = receiveData.Substring(i * 12 + 7, 5);
}
#endregion
this.ChildFormCalibration.UpdateWeightDisplay(this.EquipmentStatus, this.CollectionWeightData);
break;
default:
break;
}
return ret;
}
// 판정설정시 중량 - 정지
private int ReceiveCommandSF0(string lane, string receiveData)
{
int ret = 0;
switch (lane)
{
case "Z":
#region Value Assign
for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++)
{
this.CollectionWeightData[i].Status = Helper.StringToWeightStatus(receiveData.Substring(i * 12, 2));
this.CollectionWeightData[i].Weight = Helper.StringToWeight(receiveData.Substring(i * 12 + 2, 5), this.SystemConfig.DecimalPlaces);
this.CollectionWeightData[i].ADCValue = receiveData.Substring(i * 12 + 7, 5);
}
#endregion
this.ChildFormSystemSetting.UpdateStopWeightDisplay(this.EquipmentStatus, this.CollectionWeightData);
break;
default:
break;
}
return ret;
}
// 판정설정 그래프
private int ReceiveCommandSG0(string lane, string receiveData)
{
int ret = 0, temp = 20;
switch (lane)
{
case "A":
#region Value Assign
this.CollectionWeightData[0].Weight = Helper.StringToWeight(receiveData.Substring(2, 5), this.SystemConfig.DecimalPlaces);
this.CollectionWeightData[0].ADCValue = receiveData.Substring(7, 5);
for (int i = 0; i < this.CollectionGraphData.Count; i++)
{
this.CollectionGraphData[i] = int.Parse(receiveData.Substring(temp, 5));
temp += 5;
}
#endregion
this.ChildFormSystemSetting.UpdateGraphDataDisplay(this.EquipmentStatus, this.CollectionWeightData[0], this.CollectionGraphData);
break;
case "B":
#region Value Assign
this.CollectionWeightData[1].Weight = Helper.StringToWeight(receiveData.Substring(2, 5), this.SystemConfig.DecimalPlaces);
this.CollectionWeightData[1].ADCValue = receiveData.Substring(7, 5);
for (int i = 0; i < this.CollectionGraphData.Count; i++)
{
this.CollectionGraphData[i] = int.Parse(receiveData.Substring(temp, 5));
temp += 5;
}
#endregion
this.ChildFormSystemSetting.UpdateGraphDataDisplay(this.EquipmentStatus, this.CollectionWeightData[1], this.CollectionGraphData);
break;
case "C":
#region Value Assign
this.CollectionWeightData[2].Weight = Helper.StringToWeight(receiveData.Substring(2, 5), this.SystemConfig.DecimalPlaces);
this.CollectionWeightData[2].ADCValue = receiveData.Substring(7, 5);
for (int i = 0; i < this.CollectionGraphData.Count; i++)
{
this.CollectionGraphData[i] = int.Parse(receiveData.Substring(temp, 5));
temp += 5;
}
#endregion
this.ChildFormSystemSetting.UpdateGraphDataDisplay(this.EquipmentStatus, this.CollectionWeightData[2], this.CollectionGraphData);
break;
case "D":
#region Value Assign
this.CollectionWeightData[3].Weight = Helper.StringToWeight(receiveData.Substring(2, 5), this.SystemConfig.DecimalPlaces);
this.CollectionWeightData[3].ADCValue = receiveData.Substring(7, 5);
for (int i = 0; i < this.CollectionGraphData.Count; i++)
{
this.CollectionGraphData[i] = int.Parse(receiveData.Substring(temp, 5));
temp += 5;
}
#endregion
this.ChildFormSystemSetting.UpdateGraphDataDisplay(this.EquipmentStatus, this.CollectionWeightData[3], this.CollectionGraphData);
break;
case "E":
#region Value Assign
this.CollectionWeightData[4].Weight = Helper.StringToWeight(receiveData.Substring(2, 5), this.SystemConfig.DecimalPlaces);
this.CollectionWeightData[4].ADCValue = receiveData.Substring(7, 5);
for (int i = 0; i < this.CollectionGraphData.Count; i++)
{
this.CollectionGraphData[i] = int.Parse(receiveData.Substring(temp, 5));
temp += 5;
}
#endregion
this.ChildFormSystemSetting.UpdateGraphDataDisplay(this.EquipmentStatus, this.CollectionWeightData[4], this.CollectionGraphData);
break;
case "F":
#region Value Assign
this.CollectionWeightData[5].Weight = Helper.StringToWeight(receiveData.Substring(2, 5), this.SystemConfig.DecimalPlaces);
this.CollectionWeightData[5].ADCValue = receiveData.Substring(7, 5);
for (int i = 0; i < this.CollectionGraphData.Count; i++)
{
this.CollectionGraphData[i] = int.Parse(receiveData.Substring(temp, 5));
temp += 5;
}
#endregion
this.ChildFormSystemSetting.UpdateGraphDataDisplay(this.EquipmentStatus, this.CollectionWeightData[5], this.CollectionGraphData);
break;
case "G":
#region Value Assign
this.CollectionWeightData[6].Weight = Helper.StringToWeight(receiveData.Substring(2, 5), this.SystemConfig.DecimalPlaces);
this.CollectionWeightData[6].ADCValue = receiveData.Substring(7, 5);
for (int i = 0; i < this.CollectionGraphData.Count; i++)
{
this.CollectionGraphData[i] = int.Parse(receiveData.Substring(temp, 5));
temp += 5;
}
#endregion
this.ChildFormSystemSetting.UpdateGraphDataDisplay(this.EquipmentStatus, this.CollectionWeightData[6], this.CollectionGraphData);
break;
case "H":
#region Value Assign
this.CollectionWeightData[7].Weight = Helper.StringToWeight(receiveData.Substring(2, 5), this.SystemConfig.DecimalPlaces);
this.CollectionWeightData[7].ADCValue = receiveData.Substring(7, 5);
for (int i = 0; i < this.CollectionGraphData.Count; i++)
{
this.CollectionGraphData[i] = int.Parse(receiveData.Substring(temp, 5));
temp += 5;
}
#endregion
this.ChildFormSystemSetting.UpdateGraphDataDisplay(this.EquipmentStatus, this.CollectionWeightData[7], this.CollectionGraphData);
break;
case "I":
#region Value Assign
this.CollectionWeightData[8].Weight = Helper.StringToWeight(receiveData.Substring(2, 5), this.SystemConfig.DecimalPlaces);
this.CollectionWeightData[8].ADCValue = receiveData.Substring(7, 5);
for (int i = 0; i < this.CollectionGraphData.Count; i++)
{
this.CollectionGraphData[i] = int.Parse(receiveData.Substring(temp, 5));
temp += 5;
}
#endregion
this.ChildFormSystemSetting.UpdateGraphDataDisplay(this.EquipmentStatus, this.CollectionWeightData[8], this.CollectionGraphData);
break;
case "J":
#region Value Assign
this.CollectionWeightData[9].Weight = Helper.StringToWeight(receiveData.Substring(2, 5), this.SystemConfig.DecimalPlaces);
this.CollectionWeightData[9].ADCValue = receiveData.Substring(7, 5);
for (int i = 0; i < this.CollectionGraphData.Count; i++)
{
this.CollectionGraphData[i] = int.Parse(receiveData.Substring(temp, 5));
temp += 5;
}
#endregion
this.ChildFormSystemSetting.UpdateGraphDataDisplay(this.EquipmentStatus, this.CollectionWeightData[9], this.CollectionGraphData);
break;
case "K":
#region Value Assign
this.CollectionWeightData[10].Weight = Helper.StringToWeight(receiveData.Substring(2, 5), this.SystemConfig.DecimalPlaces);
this.CollectionWeightData[10].ADCValue = receiveData.Substring(7, 5);
for (int i = 0; i < this.CollectionGraphData.Count; i++)
{
this.CollectionGraphData[i] = int.Parse(receiveData.Substring(temp, 5));
temp += 5;
}
#endregion
this.ChildFormSystemSetting.UpdateGraphDataDisplay(this.EquipmentStatus, this.CollectionWeightData[10], this.CollectionGraphData);
break;
case "L":
#region Value Assign
this.CollectionWeightData[11].Weight = Helper.StringToWeight(receiveData.Substring(2, 5), this.SystemConfig.DecimalPlaces);
this.CollectionWeightData[11].ADCValue = receiveData.Substring(7, 5);
for (int i = 0; i < this.CollectionGraphData.Count; i++)
{
this.CollectionGraphData[i] = int.Parse(receiveData.Substring(temp, 5));
temp += 5;
}
#endregion
this.ChildFormSystemSetting.UpdateGraphDataDisplay(this.EquipmentStatus, this.CollectionWeightData[11], this.CollectionGraphData);
break;
default:
break;
}
return ret;
}
// IO테스트-IN
private int ReceiveCommandST0(string lane, string receiveData)
{
int ret = 0;
switch (lane)
{
case "0":
#region Value Assign
for (int i = 0; i < 16; i++)
this.CollectionIOTest_InputData[i] = receiveData.Substring(i, 1);
#endregion
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormIOTest)
this.ChildFormIOTest.UpdateInputRead(this.CollectionIOTest_InputData);
else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest)
this.ChildFormEquipmentTest.UpdateInputRead(this.CollectionIOTest_InputData);
break;
default:
break;
}
return ret;
}
// IO테스트1-IN
private int ReceiveCommandST1(string lane, string receiveData)
{
int ret = 0;
switch (lane)
{
case "0":
#region Value Assign
for (int i = 0; i < 16; i++)
this.CollectionIOTest_InputData1[i] = receiveData.Substring(i, 1);
#endregion
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormIOTest)
{
if (this.ChildFormIOTest != null)
this.ChildFormIOTest.UpdateInputRead1(this.CollectionIOTest_InputData1);
}
break;
default:
break;
}
return ret;
}
#endregion
#region SystemConfiguration File
private void CreateSystemConfigurationFile()
{
StructSystemConfigurationItem structItem1;
StructSystemConfigurationItem1 structItem2;
this.SystemConfig.Initialization();
structItem1.IsDataBackup = this.SystemConfig.IsDataBackup;
structItem1.IsOptFeedbackBoardUse = this.SystemConfig.IsOptFeedbackBoardUse;
structItem1.IsFeedingConveyor = this.SystemConfig.IsFeedingConveyor;
structItem1.IsIndividualNG = this.SystemConfig.IsIndividualNG;
structItem1.IsDischargeConveyor = this.SystemConfig.IsDischargeConveyor;
structItem1.IsImpellerMotorDirectionCW = this.SystemConfig.IsImpellerMotorDirectionCW;
structItem1.IsWeightViewForward = this.SystemConfig.IsWeightViewForward;
structItem1.DecimalPlaces = this.SystemConfig.DecimalPlaces;
structItem1.FeedbackSampleCount = this.SystemConfig.FeedbackSampleCount;
structItem1.EquipmentColumns = this.SystemConfig.EquipmentColumns;
structItem1.EquipmentID = this.SystemConfig.EquipmentID;
structItem1.EquipmentMode = this.SystemConfig.EquipmentMode;
structItem1.ProductNumber = this.SystemConfig.ProductNumber;
structItem1.FeedbackIgnorePackages = this.SystemConfig.FeedbackIgnorePackages;
structItem1.FeedbackPulseWidth = this.SystemConfig.FeedbackPulseWidth;
structItem1.Serial3BaudRate = this.SystemConfig.Serial3BaudRate;
structItem1.Serial3Mode = this.SystemConfig.Serial3Mode;
structItem1.UsbID = this.SystemConfig.UsbID;
structItem1.DummyString6 = "";
structItem1.Unit = this.SystemConfig.Unit;
structItem1.Language = this.SystemConfig.Language;
structItem1.ImpellerMotorBaudrate = this.SystemConfig.ImpellerMotorBaudrate;
structItem1.ImpellerMotorAnglePass = this.SystemConfig.ImpellerMotorAnglePass;
structItem1.SerialNumber = this.SystemConfig.SerialNumber;
// dummy bool
structItem1.IsOptDataStatistics = this.SystemConfig.IsOptDataStatistics;
structItem1.IsLogin = this.SystemConfig.IsLogin;
structItem1.IsIndividualTransmission = this.SystemConfig.IsIndividualTransmission;
structItem1.IsEmergencyStopEntrySensorError = this.SystemConfig.IsEmergencyStopEntrySensorError;
structItem1.IsFeedingConveyorRunPass = this.SystemConfig.IsFeedingConveyorRunPass;
// dummy int
structItem1.FeedbackCorrectionRate = this.SystemConfig.FeedbackCorrectionRate;
structItem1.DischargeConveyorDirectionCW = (int)this.SystemConfig.DischargeConveyorDirectionCW;
structItem1.AlarmContinuousNG = this.SystemConfig.AlarmContinuousNG;
structItem1.InputSensorSelect = this.SystemConfig.InputSensorSelect;
structItem1.ABFoodTimeoutInterval = this.SystemConfig.ABFoodTimeoutInterval;
// dummy string
structItem1.User_Level1_Name = this.SystemConfig.User_Level1_Name;
structItem1.User_Level2_Name = this.SystemConfig.User_Level2_Name;
structItem1.User_Level3_Name = this.SystemConfig.User_Level3_Name;
structItem1.DummyString4 = "";
structItem1.DummyString5 = "";
this.smartFileIO.WriteStructure(structItem1, 0);
structItem2.DummyBool1 = false;
structItem2.DummyBool2 = false;
structItem2.DummyBool3 = false;
structItem2.DummyBool4 = false;
structItem2.DummyBool5 = false;
structItem2.DummyBool6 = false;
structItem2.DummyBool7 = false;
structItem2.DummyBool8 = false;
structItem2.DummyBool9 = false;
structItem2.DummyBool10 = false;
structItem2.DummyBool11 = false;
structItem2.DummyBool12 = false;
structItem2.DummyBool13 = false;
structItem2.DummyBool14 = false;
structItem2.DummyBool15 = false;
structItem2.IsOptPrinter = this.SystemConfig.IsOptPrinter;
structItem2.IsOptPart11 = this.SystemConfig.IsOptPart11;
structItem2.IsAlarmTotalPassCntEnable = this.SystemConfig.IsAlarmTotalPassCntEnable;
structItem2.IsIntegratedTransmission = this.SystemConfig.IsIntegratedTransmission;
structItem2.IsAlarmContinuousNGEnable = this.SystemConfig.IsAlarmContinuousNGEnable;
structItem2.DummyInt1 = 0;
structItem2.DummyInt2 = 0;
structItem2.DummyInt3 = 0;
structItem2.DummyInt4 = 0;
structItem2.DummyInt5 = 0;
structItem2.DummyInt6 = 0;
structItem2.DataStoragePeriod = this.SystemConfig.DataStoragePeriod;
structItem2.AutomaticLogout = this.SystemConfig.AutomaticLogout;
structItem2.AlarmTotalPassCnt = this.SystemConfig.AlarmTotalPassCnt;
structItem2.ModbusTcpStartAddress = this.SystemConfig.ModbusTcpStartAddress;
structItem2.ModbusRtuSlaveID = this.SystemConfig.ModbusRtuSlaveID;
structItem2.ModbusTcpAddress1 = this.SystemConfig.ModbusTcpAddress1;
structItem2.ModbusTcpAddress2 = this.SystemConfig.ModbusTcpAddress2;
structItem2.EthernetLocalPort = this.SystemConfig.EthernetLocalPort;
structItem2.EthernetOperationMode = this.SystemConfig.EthernetOperationMode;
structItem2.EthernetMode = this.SystemConfig.EthernetMode;
structItem2.EthernetServerPort = SystemConfig.EthernetServerPort;
structItem2.StepMotorType = this.SystemConfig.StepMotorType;
structItem2.ImpellerMotorAnglePass = this.SystemConfig.ImpellerMotorAnglePass;
structItem2.ImpellerMotorAngleNG = this.SystemConfig.ImpellerMotorAngleNG;
structItem2.DummyString1 = "";
structItem2.DummyString2 = "";
structItem2.DummyString3 = "";
structItem2.DummyString4 = "";
structItem2.DummyString5 = "";
structItem2.EthernetServerAddress = this.SystemConfig.EthernetServerAddress;
structItem2.DummyString7 = "";
structItem2.DummyString8 = "";
structItem2.DummyString9 = "";
structItem2.DummyString10 = "";
this.smartFileIO.WriteStructure(structItem2, 1);
}
public void SaveSystemConfigurationFile(SystemConfigurationItem item)
{
string fullFilePath = "";
bool fileCheck = false;
StructSystemConfigurationItem structItem1;
StructSystemConfigurationItem1 structItem2;
this.smartFileIO.Close();
fullFilePath = this.PathSystemFileFolder + "system.cfg";
this.smartFileIO.FilePathName = fullFilePath;
FileInfo fileInfo = new FileInfo(fullFilePath);
fileCheck = fileInfo.Exists;
if (fileCheck == true)
this.smartFileIO.Open(this.BufferSmartUart);
else
{
this.smartFileIO.Open(this.BufferSmartUart);
this.CreateSystemConfigurationFile();
}
#region StructItem1
structItem1.IsDataBackup = item.IsDataBackup;
structItem1.IsOptFeedbackBoardUse = item.IsOptFeedbackBoardUse;
structItem1.IsFeedingConveyor = item.IsFeedingConveyor;
structItem1.IsIndividualNG = item.IsIndividualNG;
structItem1.IsDischargeConveyor = item.IsDischargeConveyor;
structItem1.IsImpellerMotorDirectionCW = item.IsImpellerMotorDirectionCW;
structItem1.IsWeightViewForward = item.IsWeightViewForward;
structItem1.DecimalPlaces = item.DecimalPlaces;
structItem1.FeedbackSampleCount = item.FeedbackSampleCount;
structItem1.EquipmentColumns = item.EquipmentColumns;
structItem1.EquipmentID = item.EquipmentID;
structItem1.EquipmentMode = item.EquipmentMode;
structItem1.ProductNumber = item.ProductNumber;
structItem1.FeedbackIgnorePackages = item.FeedbackIgnorePackages;
structItem1.FeedbackPulseWidth = item.FeedbackPulseWidth;
structItem1.Serial3BaudRate = item.Serial3BaudRate;
structItem1.Serial3Mode = item.Serial3Mode;
structItem1.UsbID = item.UsbID;
structItem1.DummyString6 = "";
structItem1.Unit = item.Unit;
structItem1.Language = item.Language;
structItem1.ImpellerMotorBaudrate = item.ImpellerMotorBaudrate;
structItem1.ImpellerMotorAnglePass = item.ImpellerMotorAnglePass;
structItem1.SerialNumber = item.SerialNumber;
// dummy bool
structItem1.IsOptDataStatistics = item.IsOptDataStatistics;
structItem1.IsLogin = item.IsLogin;
structItem1.IsIndividualTransmission = item.IsIndividualTransmission;
structItem1.IsEmergencyStopEntrySensorError = item.IsEmergencyStopEntrySensorError;
structItem1.IsFeedingConveyorRunPass = item.IsFeedingConveyorRunPass;
// dummy int
structItem1.FeedbackCorrectionRate = item.FeedbackCorrectionRate;
structItem1.DischargeConveyorDirectionCW = (int)item.DischargeConveyorDirectionCW;
structItem1.AlarmContinuousNG = item.AlarmContinuousNG;
structItem1.InputSensorSelect = item.InputSensorSelect;
structItem1.ABFoodTimeoutInterval = item.ABFoodTimeoutInterval;
// dummy string
structItem1.User_Level1_Name = item.User_Level1_Name;
structItem1.User_Level2_Name = item.User_Level2_Name;
structItem1.User_Level3_Name = item.User_Level3_Name;
structItem1.DummyString4 = "";
structItem1.DummyString5 = "";
#endregion
this.smartFileIO.WriteStructure(structItem1, 0);
#region StructItem2
structItem2.DummyBool1 = false;
structItem2.DummyBool2 = false;
structItem2.DummyBool3 = false;
structItem2.DummyBool4 = false;
structItem2.DummyBool5 = false;
structItem2.DummyBool6 = false;
structItem2.DummyBool7 = false;
structItem2.DummyBool8 = false;
structItem2.DummyBool9 = false;
structItem2.DummyBool10 = false;
structItem2.DummyBool11 = false;
structItem2.DummyBool12 = false;
structItem2.DummyBool13 = false;
structItem2.DummyBool14 = false;
structItem2.DummyBool15 = false;
structItem2.IsOptPrinter = item.IsOptPrinter;
structItem2.IsOptPart11 = item.IsOptPart11;
structItem2.IsAlarmTotalPassCntEnable = item.IsAlarmTotalPassCntEnable;
structItem2.IsIntegratedTransmission = item.IsIntegratedTransmission;
structItem2.IsAlarmContinuousNGEnable = item.IsAlarmContinuousNGEnable;
structItem2.DummyInt1 = 0;
structItem2.DummyInt2 = 0;
structItem2.DummyInt3 = 0;
structItem2.DummyInt4 = 0;
structItem2.DummyInt5 = 0;
structItem2.DummyInt6 = 0;
structItem2.DataStoragePeriod = item.DataStoragePeriod;
structItem2.AutomaticLogout = item.AutomaticLogout;
structItem2.AlarmTotalPassCnt = item.AlarmTotalPassCnt;
structItem2.ModbusTcpStartAddress = item.ModbusTcpStartAddress;
structItem2.ModbusRtuSlaveID = item.ModbusRtuSlaveID;
structItem2.ModbusTcpAddress1 = item.ModbusTcpAddress1;
structItem2.ModbusTcpAddress2 = item.ModbusTcpAddress2;
structItem2.EthernetLocalPort = item.EthernetLocalPort;
structItem2.EthernetOperationMode = item.EthernetOperationMode;
structItem2.EthernetMode = item.EthernetMode;
structItem2.EthernetServerPort = item.EthernetServerPort;
structItem2.StepMotorType = item.StepMotorType;
structItem2.ImpellerMotorAnglePass = item.ImpellerMotorAnglePass;
structItem2.ImpellerMotorAngleNG = item.ImpellerMotorAngleNG;
structItem2.DummyString1 = "";
structItem2.DummyString2 = "";
structItem2.DummyString3 = "";
structItem2.DummyString4 = "";
structItem2.DummyString5 = "";
structItem2.EthernetServerAddress = item.EthernetServerAddress;
structItem2.DummyString7 = "";
structItem2.DummyString8 = "";
structItem2.DummyString9 = "";
structItem2.DummyString10 = "";
#endregion
this.smartFileIO.WriteStructure(structItem2, 1);
this.smartFileIO.Close();
}
private void LoadSystemConfigurationFile()
{
string fullFilePath = "";
bool fileCheck = false, save = false;
StructSystemConfigurationItem structItem1;
StructSystemConfigurationItem1 structItem2;
this.smartFileIO.Close();
fullFilePath = this.PathSystemFileFolder + "system.cfg";
this.smartFileIO.FilePathName = fullFilePath;
FileInfo fileInfo = new FileInfo(fullFilePath);
fileCheck = fileInfo.Exists;
if (fileCheck == true)
this.smartFileIO.Open(this.BufferSmartUart);
else
{
this.smartFileIO.Open(this.BufferSmartUart);
this.CreateSystemConfigurationFile();
}
try
{
structItem1 = (StructSystemConfigurationItem)this.smartFileIO.ReadStructure(0, typeof(StructSystemConfigurationItem));
this.SystemConfig.IsDataBackup = structItem1.IsDataBackup;
this.SystemConfig.IsFeedingConveyor = structItem1.IsFeedingConveyor;
this.SystemConfig.IsIndividualNG = structItem1.IsIndividualNG;
this.SystemConfig.IsDischargeConveyor = structItem1.IsDischargeConveyor;
this.SystemConfig.IsImpellerMotorDirectionCW = structItem1.IsImpellerMotorDirectionCW;
this.SystemConfig.DischargeConveyorDirectionCW = (DataStore.DischargeConveyorDirection)structItem1.DischargeConveyorDirectionCW;
this.SystemConfig.IsWeightViewForward = structItem1.IsWeightViewForward;
this.SystemConfig.IsFeedingConveyorRunPass = structItem1.IsFeedingConveyorRunPass;
this.SystemConfig.DecimalPlaces = structItem1.DecimalPlaces;
this.SystemConfig.EquipmentColumns = structItem1.EquipmentColumns;
this.SystemConfig.EquipmentID = structItem1.EquipmentID;
this.SystemConfig.EquipmentMode = structItem1.EquipmentMode;
this.SystemConfig.ProductNumber = structItem1.ProductNumber;
this.SystemConfig.Serial3BaudRate = structItem1.Serial3BaudRate;
this.SystemConfig.Serial3Mode = structItem1.Serial3Mode;
this.SystemConfig.UsbID = structItem1.UsbID;
this.SystemConfig.Unit = structItem1.Unit;
this.SystemConfig.Language = structItem1.Language;
this.SystemConfig.ImpellerMotorBaudrate = structItem1.ImpellerMotorBaudrate;
this.SystemConfig.ImpellerMotorAnglePass = structItem1.ImpellerMotorAnglePass;
this.SystemConfig.SerialNumber = structItem1.SerialNumber;
this.SystemConfig.ABFoodTimeoutInterval = structItem1.ABFoodTimeoutInterval;
this.SystemConfig.InputSensorSelect = structItem1.InputSensorSelect;
this.SystemConfig.AlarmContinuousNG = structItem1.AlarmContinuousNG;
this.SystemConfig.IsEmergencyStopEntrySensorError = structItem1.IsEmergencyStopEntrySensorError;
this.SystemConfig.IsIndividualTransmission = structItem1.IsIndividualTransmission;
this.SystemConfig.IsLogin = structItem1.IsLogin;
this.SystemConfig.FeedbackCorrectionRate = structItem1.FeedbackCorrectionRate;
this.SystemConfig.FeedbackIgnorePackages = structItem1.FeedbackIgnorePackages;
this.SystemConfig.FeedbackPulseWidth = structItem1.FeedbackPulseWidth;
this.SystemConfig.FeedbackSampleCount = structItem1.FeedbackSampleCount;
this.SystemConfig.IsOptFeedbackBoardUse = structItem1.IsOptFeedbackBoardUse;
this.SystemConfig.IsOptDataStatistics = structItem1.IsOptDataStatistics;
// User_Level1_Name
if (structItem1.User_Level1_Name == "")
{
save = true;
this.SystemConfig.User_Level1_Name = "Level 1";
}
else
this.SystemConfig.User_Level1_Name = structItem1.User_Level1_Name;
// User_Level2_Name
if (structItem1.User_Level2_Name == "")
{
save = true;
this.SystemConfig.User_Level2_Name = "Level 2";
}
else
this.SystemConfig.User_Level2_Name = structItem1.User_Level2_Name;
// User_Level3_Name
if (structItem1.User_Level3_Name == "")
{
save = true;
this.SystemConfig.User_Level3_Name = "Level 3";
}
else
this.SystemConfig.User_Level3_Name = structItem1.User_Level3_Name;
structItem2 = (StructSystemConfigurationItem1)this.smartFileIO.ReadStructure(1, typeof(StructSystemConfigurationItem1));
this.SystemConfig.ImpellerMotorAnglePass = structItem2.ImpellerMotorAnglePass;
this.SystemConfig.ImpellerMotorAngleNG = structItem2.ImpellerMotorAngleNG;
this.SystemConfig.StepMotorType = structItem2.StepMotorType;
this.SystemConfig.EthernetLocalPort = structItem2.EthernetLocalPort;
this.SystemConfig.EthernetMode = structItem2.EthernetMode;
this.SystemConfig.EthernetOperationMode = structItem2.EthernetOperationMode;
this.SystemConfig.EthernetServerAddress = structItem2.EthernetServerAddress;
this.SystemConfig.EthernetServerPort = structItem2.EthernetServerPort;
this.SystemConfig.ModbusTcpStartAddress = structItem2.ModbusTcpStartAddress;
this.SystemConfig.ModbusRtuSlaveID = structItem2.ModbusRtuSlaveID;
this.SystemConfig.ModbusTcpAddress1 = structItem2.ModbusTcpAddress1;
this.SystemConfig.ModbusTcpAddress2 = structItem2.ModbusTcpAddress2;
this.SystemConfig.IsAlarmContinuousNGEnable = structItem2.IsAlarmContinuousNGEnable;
this.SystemConfig.IsIntegratedTransmission = structItem2.IsIntegratedTransmission;
this.SystemConfig.IsAlarmTotalPassCntEnable = structItem2.IsAlarmTotalPassCntEnable;
if (structItem2.AlarmTotalPassCnt < 20)
{
save = true;
this.SystemConfig.AlarmTotalPassCnt = 20;
}
else
this.SystemConfig.AlarmTotalPassCnt = structItem2.AlarmTotalPassCnt;
// Part11
this.SystemConfig.IsOptPart11 = structItem2.IsOptPart11;
// AutomaticLogout
this.SystemConfig.AutomaticLogout = structItem2.AutomaticLogout;
// DataStoragePeriod
if (structItem2.DataStoragePeriod == 0)
{
save = true;
this.SystemConfig.DataStoragePeriod = 12;
}
else
this.SystemConfig.DataStoragePeriod = structItem2.DataStoragePeriod;
// Printer
this.SystemConfig.IsOptPrinter = structItem2.IsOptPrinter;
}
catch
{
DialogFormMessage myMsg = new DialogFormMessage(17, this.SystemConfig.Language);
myMsg.ShowDialog();
this.smartFileIO.Close();
}
this.smartFileIO.Close();
if (save == true)
this.SaveSystemConfigurationFile(this.SystemConfig);
}
#endregion
#region ProductItem File
private void CreateProductFile()
{
StructProductItem structItem;
this.CurrentProductItem.Initialization();
for (int i = 0; i < 1000; i++)
{
structItem.Number = i + 1;
structItem.Name = string.Format("Product {0}", i + 1);
structItem.LotNo = string.Format("Lot {0}", i + 1);
structItem.OverRange = this.CurrentProductItem.OverRange;
structItem.PassRange = this.CurrentProductItem.PassRange;
structItem.UnderRange = this.CurrentProductItem.UnderRange;
structItem.TareRange = this.CurrentProductItem.TareRange;
structItem.DummyString1 = "";
structItem.DummyString2 = "";
structItem.DummyString3 = "";
structItem.DummyString4 = "";
structItem.DummyString5 = "";
structItem.DummyString6 = "";
structItem.DummyString7 = "";
structItem.DummyString8 = "";
this.smartFileIO.WriteStructure_Begin(structItem, i);
}
this.smartFileIO.WriteStructure_End();
}
public void SaveProductFile(ProductItem item, int index)
{
bool fileCheck = false;
string fullFilePath = "";
StructProductItem structItem;
this.smartFileIO.Close();
fullFilePath = this.PathSystemFileFolder + "ProductItem.int";
this.smartFileIO.FilePathName = fullFilePath;
FileInfo fileInfo = new FileInfo(fullFilePath);
fileCheck = fileInfo.Exists;
if (fileCheck == true)
this.smartFileIO.Open(this.BufferSmartUart);
else
{
this.smartFileIO.Open(this.BufferSmartUart);
this.CreateProductFile();
}
structItem.Number = item.Number;
structItem.Name = item.Name;
structItem.LotNo = item.LotNo;
structItem.OverRange = item.OverRange;
structItem.PassRange = item.PassRange;
structItem.UnderRange = item.UnderRange;
structItem.TareRange = item.TareRange;
structItem.DummyString1 = "";
structItem.DummyString2 = "";
structItem.DummyString3 = "";
structItem.DummyString4 = "";
structItem.DummyString5 = "";
structItem.DummyString6 = "";
structItem.DummyString7 = "";
structItem.DummyString8 = "";
this.smartFileIO.WriteStructure_Begin(structItem, index);
this.smartFileIO.WriteStructure_End();
this.smartFileIO.Close();
}
public void LoadProductFile(ref ProductItem item, int index)
{
bool fileCheck = false;
string fullFilePath = "";
StructProductItem structItem;
this.smartFileIO.Close();
fullFilePath = this.PathSystemFileFolder + "ProductItem.int";
this.smartFileIO.FilePathName = fullFilePath;
FileInfo fileInfo = new FileInfo(fullFilePath);
fileCheck = fileInfo.Exists;
if (fileCheck == true)
this.smartFileIO.Open(this.BufferSmartUart);
else
{
this.smartFileIO.Open(this.BufferSmartUart);
this.CreateProductFile();
}
try
{
structItem = (StructProductItem)this.smartFileIO.ReadStructure(index, typeof(StructProductItem));
item.Number = structItem.Number;
item.Name = structItem.Name;
item.LotNo = structItem.LotNo;
item.OverRange = structItem.OverRange;
item.PassRange = structItem.PassRange;
item.UnderRange = structItem.UnderRange;
item.TareRange = structItem.TareRange;
}
catch
{
DialogFormMessage myMsg = new DialogFormMessage(17, this.SystemConfig.Language);
myMsg.ShowDialog();
this.smartFileIO.Close();
}
this.smartFileIO.Close();
}
public void LoadProductName(ref Collection<string> values)
{
string fullFilePath = "";
StructProductItem structItem;
this.smartFileIO.Close();
values.Clear();
fullFilePath = this.PathSystemFileFolder + "ProductItem.int";
this.smartFileIO.FilePathName = fullFilePath;
this.smartFileIO.Open(this.BufferSmartUart);
if (this.smartFileIO.ReadStructureAllBuffer() == true)
{
for (int i = 0; i < 1000; i++)
{
structItem = (StructProductItem)this.smartFileIO.ReadStructureBuffer(typeof(StructProductItem), i);
values.Add(structItem.Name);
}
}
this.smartFileIO.Close();
}
public void LoadProductFile(ref Collection<ProductItem> values)
{
string fullFilePath = "";
StructProductItem structItem;
this.smartFileIO.Close();
fullFilePath = this.PathSystemFileFolder + "ProductItem.int";
this.smartFileIO.FilePathName = fullFilePath;
this.smartFileIO.Open(this.BufferSmartUart);
if (this.smartFileIO.ReadStructureAllBuffer() == true)
{
for (int i = 0; i < 1000; i++)
{
structItem = (StructProductItem)this.smartFileIO.ReadStructureBuffer(typeof(StructProductItem), i);
values[i].Number = structItem.Number;
values[i].Name = structItem.Name;
values[i].LotNo = structItem.LotNo;
values[i].OverRange = structItem.OverRange;
values[i].PassRange = structItem.PassRange;
values[i].UnderRange = structItem.UnderRange;
values[i].TareRange = structItem.TareRange;
}
}
this.smartFileIO.Close();
}
#endregion
#region JudgmentSetItem File
private void CreateJudgmentSetFile()
{
StructJudgmentSetItem structItem;
this.CurrentJudgmentSetItem.Initialization();
for (int i = 0; i < 1000; i++)
{
structItem.Filter = this.CurrentJudgmentSetItem.Filter;
structItem.JudgmentDelayTime = this.CurrentJudgmentSetItem.JudgmentDelayTime;
structItem.DoubleDelayTime = this.CurrentJudgmentSetItem.DoubleDelayTime;
structItem.JudgmentCount = this.CurrentJudgmentSetItem.JudgmentCount;
structItem.FeedSpeed = this.CurrentJudgmentSetItem.FeedSpeed;
structItem.DynamicCorrection = this.CurrentJudgmentSetItem.DynamicCorrection;
structItem.DischargeConveyorDelayTime = this.CurrentJudgmentSetItem.RejectConveyorDelayTime;
structItem.DischargeConveyorOperatingTime = this.CurrentJudgmentSetItem.RejectConveyorRunTime;
structItem.FeedingConveyorDelayTime = this.CurrentJudgmentSetItem.FeedingConveyorDelayTime;
structItem.FeedingConveyorOperatingTime = this.CurrentJudgmentSetItem.FeedingConveyorRunTime;
structItem.Sorter1Mode = this.CurrentJudgmentSetItem.Sorter1Mode;
structItem.Sorter1DelayTime = this.CurrentJudgmentSetItem.Sorter1DelayTime;
structItem.Sorter1OperatingTime = this.CurrentJudgmentSetItem.Sorter1RunTime;
structItem.Sorter2Mode = this.CurrentJudgmentSetItem.Sorter2Mode;
structItem.Sorter2DelayTime = this.CurrentJudgmentSetItem.Sorter2DelayTime;
structItem.Sorter2OperatingTime = this.CurrentJudgmentSetItem.Sorter2RunTime;
structItem.Sorter3Mode = this.CurrentJudgmentSetItem.Sorter3Mode;
structItem.Sorter3DelayTime = this.CurrentJudgmentSetItem.Sorter3DelayTime;
structItem.Sorter3OperatingTime = this.CurrentJudgmentSetItem.Sorter3RunTime;
structItem.Sorter4Mode = this.CurrentJudgmentSetItem.Sorter4Mode;
structItem.Sorter4DelayTime = this.CurrentJudgmentSetItem.Sorter4DelayTime;
structItem.Sorter4OperatingTime = this.CurrentJudgmentSetItem.Sorter4RunTime;
structItem.DummyInt1 = 0;
structItem.DummyInt2 = 0;
structItem.DummyInt3 = 0;
structItem.DummyInt4 = 0;
structItem.ForcedZeroDelayTime = this.CurrentJudgmentSetItem.ForcedZeroDelayTime;
structItem.DummyString1 = "";
structItem.DummyString2 = "";
structItem.DummyString3 = "";
structItem.DummyString4 = "";
structItem.DummyString5 = "";
this.smartFileIO.WriteStructure_Begin(structItem, i);
}
this.smartFileIO.WriteStructure_End();
}
public void SaveJudgmentSetFile(JudgmentSetItem item, int index)
{
bool fileCheck = false;
string fullFilePath = "";
StructJudgmentSetItem structItem;
this.smartFileIO.Close();
fullFilePath = this.PathSystemFileFolder + "JudgmentSetItem.int";
this.smartFileIO.FilePathName = fullFilePath;
FileInfo fileInfo = new FileInfo(fullFilePath);
fileCheck = fileInfo.Exists;
if (fileCheck == true)
this.smartFileIO.Open(this.BufferSmartUart);
else
{
this.smartFileIO.Open(this.BufferSmartUart);
this.CreateJudgmentSetFile();
}
structItem.Filter = item.Filter;
structItem.JudgmentDelayTime = item.JudgmentDelayTime;
structItem.DoubleDelayTime = item.DoubleDelayTime;
structItem.JudgmentCount = item.JudgmentCount;
structItem.FeedSpeed = item.FeedSpeed;
structItem.DynamicCorrection = item.DynamicCorrection;
structItem.DischargeConveyorDelayTime = item.RejectConveyorDelayTime;
structItem.DischargeConveyorOperatingTime = item.RejectConveyorRunTime;
structItem.FeedingConveyorDelayTime = item.FeedingConveyorDelayTime;
structItem.FeedingConveyorOperatingTime = item.FeedingConveyorRunTime;
structItem.Sorter1Mode = item.Sorter1Mode;
structItem.Sorter1DelayTime = item.Sorter1DelayTime;
structItem.Sorter1OperatingTime = item.Sorter1RunTime;
structItem.Sorter2Mode = item.Sorter2Mode;
structItem.Sorter2DelayTime = item.Sorter2DelayTime;
structItem.Sorter2OperatingTime = item.Sorter2RunTime;
structItem.Sorter3Mode = item.Sorter3Mode;
structItem.Sorter3DelayTime = item.Sorter3DelayTime;
structItem.Sorter3OperatingTime = item.Sorter3RunTime;
structItem.Sorter4Mode = item.Sorter4Mode;
structItem.Sorter4DelayTime = item.Sorter4DelayTime;
structItem.Sorter4OperatingTime = item.Sorter4RunTime;
structItem.DummyInt1 = 0;
structItem.DummyInt2 = 0;
structItem.DummyInt3 = 0;
structItem.DummyInt4 = 0;
structItem.ForcedZeroDelayTime = item.ForcedZeroDelayTime;
structItem.DummyString1 = "";
structItem.DummyString2 = "";
structItem.DummyString3 = "";
structItem.DummyString4 = "";
structItem.DummyString5 = "";
this.smartFileIO.WriteStructure_Begin(structItem, index);
this.smartFileIO.WriteStructure_End();
this.smartFileIO.Close();
}
public void LoadJudgmentSetFile(ref JudgmentSetItem item, int index)
{
bool fileCheck = false;
string fullFilePath = "";
StructJudgmentSetItem structItem;
this.smartFileIO.Close();
fullFilePath = this.PathSystemFileFolder + "JudgmentSetItem.int";
this.smartFileIO.FilePathName = fullFilePath;
FileInfo fileInfo = new FileInfo(fullFilePath);
fileCheck = fileInfo.Exists;
if (fileCheck == true)
this.smartFileIO.Open(this.BufferSmartUart);
else
{
this.smartFileIO.Open(this.BufferSmartUart);
this.CreateJudgmentSetFile();
}
try
{
if (this.smartFileIO.ReadStructureAllBuffer() == true)
{
structItem = (StructJudgmentSetItem)this.smartFileIO.ReadStructureBuffer(typeof(StructJudgmentSetItem), index);
item.Filter = structItem.Filter;
item.JudgmentDelayTime = structItem.JudgmentDelayTime;
item.DoubleDelayTime = structItem.DoubleDelayTime;
item.JudgmentCount = structItem.JudgmentCount;
item.FeedSpeed = structItem.FeedSpeed;
item.DynamicCorrection = structItem.DynamicCorrection;
item.RejectConveyorDelayTime = structItem.DischargeConveyorDelayTime;
item.RejectConveyorRunTime = structItem.DischargeConveyorOperatingTime;
item.FeedingConveyorDelayTime = structItem.FeedingConveyorDelayTime;
item.FeedingConveyorRunTime = structItem.FeedingConveyorOperatingTime;
item.Sorter1Mode = structItem.Sorter1Mode;
item.Sorter1DelayTime = structItem.Sorter1DelayTime;
item.Sorter1RunTime = structItem.Sorter1OperatingTime;
item.Sorter2Mode = structItem.Sorter2Mode;
item.Sorter2DelayTime = structItem.Sorter2DelayTime;
item.Sorter2RunTime = structItem.Sorter2OperatingTime;
item.Sorter3Mode = structItem.Sorter3Mode;
item.Sorter3DelayTime = structItem.Sorter3DelayTime;
item.Sorter3RunTime = structItem.Sorter3OperatingTime;
item.Sorter4Mode = structItem.Sorter4Mode;
item.Sorter4DelayTime = structItem.Sorter4DelayTime;
item.Sorter4RunTime = structItem.Sorter4OperatingTime;
item.ForcedZeroDelayTime = structItem.ForcedZeroDelayTime;
}
}
catch
{
DialogFormMessage myMsg = new DialogFormMessage(17, this.SystemConfig.Language);
myMsg.ShowDialog();
this.smartFileIO.Close();
}
this.smartFileIO.Close();
}
#endregion
#region Counter File
private void CreateCounterFile()
{
StructCounter structItem;
for (int i = 0; i < 1000; i++)
{
structItem.OverCount1 = 0;
structItem.PassCount1 = 0;
structItem.UnderCount1 = 0;
structItem.ExNGCount1 = 0;
structItem.OverCount2 = 0;
structItem.PassCount2 = 0;
structItem.UnderCount2 = 0;
structItem.ExNGCount2 = 0;
structItem.OverCount3 = 0;
structItem.PassCount3 = 0;
structItem.UnderCount3 = 0;
structItem.ExNGCount3 = 0;
structItem.OverCount4 = 0;
structItem.PassCount4 = 0;
structItem.UnderCount4 = 0;
structItem.ExNGCount4 = 0;
structItem.OverCount5 = 0;
structItem.PassCount5 = 0;
structItem.UnderCount5 = 0;
structItem.ExNGCount5 = 0;
structItem.OverCount6 = 0;
structItem.PassCount6 = 0;
structItem.UnderCount6 = 0;
structItem.ExNGCount6 = 0;
structItem.OverCount7 = 0;
structItem.PassCount7 = 0;
structItem.UnderCount7 = 0;
structItem.ExNGCount7 = 0;
structItem.OverCount8 = 0;
structItem.PassCount8 = 0;
structItem.UnderCount8 = 0;
structItem.ExNGCount8 = 0;
structItem.OverCount9 = 0;
structItem.PassCount9 = 0;
structItem.UnderCount9 = 0;
structItem.ExNGCount9 = 0;
structItem.OverCount10 = 0;
structItem.PassCount10 = 0;
structItem.UnderCount10 = 0;
structItem.ExNGCount10 = 0;
structItem.OverCount11 = 0;
structItem.PassCount11 = 0;
structItem.UnderCount11 = 0;
structItem.ExNGCount11 = 0;
structItem.OverCount12 = 0;
structItem.PassCount12 = 0;
structItem.UnderCount12 = 0;
structItem.ExNGCount12 = 0;
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;
this.smartFileIO.WriteStructure_Begin(structItem, i);
}
this.smartFileIO.WriteStructure_End();
}
public void SaveCounterFile(Collection<WeightData> items, int index)
{
string fullFilePath = "";
bool fileCheck = false;
StructCounter structItem;
this.smartFileIO.Close();
fullFilePath = this.PathSystemFileFolder + "counterItem.int";
this.smartFileIO.FilePathName = fullFilePath;
FileInfo fileInfo = new FileInfo(fullFilePath);
fileCheck = fileInfo.Exists;
if (fileCheck == true)
this.smartFileIO.Open(this.BufferSmartUart);
else
{
this.smartFileIO.Open(this.BufferSmartUart);
this.CreateCounterFile();
}
structItem.OverCount1 = items[0].OverCount;
structItem.PassCount1 = items[0].PassCount;
structItem.UnderCount1 = items[0].UnderCount;
structItem.ExNGCount1 = items[0].ExNGCount;
structItem.OverCount2 = items[1].OverCount;
structItem.PassCount2 = items[1].PassCount;
structItem.UnderCount2 = items[1].UnderCount;
structItem.ExNGCount2 = items[1].ExNGCount;
structItem.OverCount3 = items[2].OverCount;
structItem.PassCount3 = items[2].PassCount;
structItem.UnderCount3 = items[2].UnderCount;
structItem.ExNGCount3 = items[2].ExNGCount;
structItem.OverCount4 = items[3].OverCount;
structItem.PassCount4 = items[3].PassCount;
structItem.UnderCount4 = items[3].UnderCount;
structItem.ExNGCount4 = items[3].ExNGCount;
structItem.OverCount5 = items[4].OverCount;
structItem.PassCount5 = items[4].PassCount;
structItem.UnderCount5 = items[4].UnderCount;
structItem.ExNGCount5 = items[4].ExNGCount;
structItem.OverCount6 = items[5].OverCount;
structItem.PassCount6 = items[5].PassCount;
structItem.UnderCount6 = items[5].UnderCount;
structItem.ExNGCount6 = items[5].ExNGCount;
structItem.OverCount7 = items[6].OverCount;
structItem.PassCount7 = items[6].PassCount;
structItem.UnderCount7 = items[6].UnderCount;
structItem.ExNGCount7 = items[6].ExNGCount;
if (this.SystemConfig.EquipmentColumns == 7)
{
structItem.OverCount8 = 0;
structItem.PassCount8 = 0;
structItem.UnderCount8 = 0;
structItem.ExNGCount8 = 0;
structItem.OverCount9 = 0;
structItem.PassCount9 = 0;
structItem.UnderCount9 = 0;
structItem.ExNGCount9 = 0;
structItem.OverCount10 = 0;
structItem.PassCount10 = 0;
structItem.UnderCount10 = 0;
structItem.ExNGCount10 = 0;
structItem.OverCount11 = 0;
structItem.PassCount11 = 0;
structItem.UnderCount11 = 0;
structItem.ExNGCount11 = 0;
structItem.OverCount12 = 0;
structItem.PassCount12 = 0;
structItem.UnderCount12 = 0;
structItem.ExNGCount12 = 0;
}
else if (this.SystemConfig.EquipmentColumns == 8)
{
structItem.OverCount8 = items[7].OverCount;
structItem.PassCount8 = items[7].PassCount;
structItem.UnderCount8 = items[7].UnderCount;
structItem.ExNGCount8 = items[7].ExNGCount;
structItem.OverCount9 = 0;
structItem.PassCount9 = 0;
structItem.UnderCount9 = 0;
structItem.ExNGCount9 = 0;
structItem.OverCount10 = 0;
structItem.PassCount10 = 0;
structItem.UnderCount10 = 0;
structItem.ExNGCount10 = 0;
structItem.OverCount11 = 0;
structItem.PassCount11 = 0;
structItem.UnderCount11 = 0;
structItem.ExNGCount11 = 0;
structItem.OverCount12 = 0;
structItem.PassCount12 = 0;
structItem.UnderCount12 = 0;
structItem.ExNGCount12 = 0;
}
else if (this.SystemConfig.EquipmentColumns == 10)
{
structItem.OverCount8 = items[7].OverCount;
structItem.PassCount8 = items[7].PassCount;
structItem.UnderCount8 = items[7].UnderCount;
structItem.ExNGCount8 = items[7].ExNGCount;
structItem.OverCount9 = items[8].OverCount;
structItem.PassCount9 = items[8].PassCount;
structItem.UnderCount9 = items[8].UnderCount;
structItem.ExNGCount9 = items[8].ExNGCount;
structItem.OverCount10 = items[9].OverCount;
structItem.PassCount10 = items[9].PassCount;
structItem.UnderCount10 = items[9].UnderCount;
structItem.ExNGCount10 = items[9].ExNGCount;
structItem.OverCount11 = 0;
structItem.PassCount11 = 0;
structItem.UnderCount11 = 0;
structItem.ExNGCount11 = 0;
structItem.OverCount12 = 0;
structItem.PassCount12 = 0;
structItem.UnderCount12 = 0;
structItem.ExNGCount12 = 0;
}
else
{
structItem.OverCount8 = items[7].OverCount;
structItem.PassCount8 = items[7].PassCount;
structItem.UnderCount8 = items[7].UnderCount;
structItem.ExNGCount8 = items[7].ExNGCount;
structItem.OverCount9 = items[8].OverCount;
structItem.PassCount9 = items[8].PassCount;
structItem.UnderCount9 = items[8].UnderCount;
structItem.ExNGCount9 = items[8].ExNGCount;
structItem.OverCount10 = items[9].OverCount;
structItem.PassCount10 = items[9].PassCount;
structItem.UnderCount10 = items[9].UnderCount;
structItem.ExNGCount10 = items[9].ExNGCount;
structItem.OverCount11 = items[10].OverCount;
structItem.PassCount11 = items[10].PassCount;
structItem.UnderCount11 = items[10].UnderCount;
structItem.ExNGCount11 = items[10].ExNGCount;
structItem.OverCount12 = items[11].OverCount;
structItem.PassCount12 = items[11].PassCount;
structItem.UnderCount12 = items[11].UnderCount;
structItem.ExNGCount12 = items[11].ExNGCount;
}
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;
this.smartFileIO.WriteStructure_Begin(structItem, index);
this.smartFileIO.WriteStructure_End();
this.smartFileIO.Close();
}
public void LoadCounterFile(ref Collection<WeightData> items, int index)
{
string fullFilePath = "";
bool fileCheck = false;
StructCounter structItem;
this.smartFileIO.Close();
fullFilePath = this.PathSystemFileFolder + "counterItem.int";
this.smartFileIO.FilePathName = fullFilePath;
FileInfo fileInfo = new FileInfo(fullFilePath);
fileCheck = fileInfo.Exists;
if (fileCheck == true)
this.smartFileIO.Open(this.BufferSmartUart);
else
{
this.smartFileIO.Open(this.BufferSmartUart);
this.CreateCounterFile();
}
try
{
if (this.smartFileIO.ReadStructureAllBuffer() == true)
{
structItem = (StructCounter)this.smartFileIO.ReadStructureBuffer(typeof(StructCounter), index);
items[0].UnderCount = structItem.UnderCount1;
items[0].PassCount = structItem.PassCount1;
items[0].OverCount = structItem.OverCount1;
items[0].ExNGCount = structItem.ExNGCount1;
items[1].UnderCount = structItem.UnderCount2;
items[1].PassCount = structItem.PassCount2;
items[1].OverCount = structItem.OverCount2;
items[1].ExNGCount = structItem.ExNGCount2;
items[2].UnderCount = structItem.UnderCount3;
items[2].PassCount = structItem.PassCount3;
items[2].OverCount = structItem.OverCount3;
items[2].ExNGCount = structItem.ExNGCount3;
items[3].UnderCount = structItem.UnderCount4;
items[3].PassCount = structItem.PassCount4;
items[3].OverCount = structItem.OverCount4;
items[3].ExNGCount = structItem.ExNGCount4;
items[4].UnderCount = structItem.UnderCount5;
items[4].PassCount = structItem.PassCount5;
items[4].OverCount = structItem.OverCount5;
items[4].ExNGCount = structItem.ExNGCount5;
items[5].UnderCount = structItem.UnderCount6;
items[5].PassCount = structItem.PassCount6;
items[5].OverCount = structItem.OverCount6;
items[5].ExNGCount = structItem.ExNGCount6;
items[6].UnderCount = structItem.UnderCount7;
items[6].PassCount = structItem.PassCount7;
items[6].OverCount = structItem.OverCount7;
items[6].ExNGCount = structItem.ExNGCount7;
switch (this.SystemConfig.EquipmentColumns)
{
case 8:
items[7].UnderCount = structItem.UnderCount8;
items[7].PassCount = structItem.PassCount8;
items[7].OverCount = structItem.OverCount8;
items[7].ExNGCount = structItem.ExNGCount8;
break;
case 10:
items[7].UnderCount = structItem.UnderCount8;
items[7].PassCount = structItem.PassCount8;
items[7].OverCount = structItem.OverCount8;
items[7].ExNGCount = structItem.ExNGCount8;
items[8].UnderCount = structItem.UnderCount9;
items[8].PassCount = structItem.PassCount9;
items[8].OverCount = structItem.OverCount9;
items[8].ExNGCount = structItem.ExNGCount9;
items[9].UnderCount = structItem.UnderCount10;
items[9].PassCount = structItem.PassCount10;
items[9].OverCount = structItem.OverCount10;
items[9].ExNGCount = structItem.ExNGCount10;
break;
case 12:
items[7].UnderCount = structItem.UnderCount8;
items[7].PassCount = structItem.PassCount8;
items[7].OverCount = structItem.OverCount8;
items[7].ExNGCount = structItem.ExNGCount8;
items[8].UnderCount = structItem.UnderCount9;
items[8].PassCount = structItem.PassCount9;
items[8].OverCount = structItem.OverCount9;
items[8].ExNGCount = structItem.ExNGCount9;
items[9].UnderCount = structItem.UnderCount10;
items[9].PassCount = structItem.PassCount10;
items[9].OverCount = structItem.OverCount10;
items[9].ExNGCount = structItem.ExNGCount10;
items[10].UnderCount = structItem.UnderCount11;
items[10].PassCount = structItem.PassCount11;
items[10].OverCount = structItem.OverCount11;
items[10].ExNGCount = structItem.ExNGCount11;
items[11].UnderCount = structItem.UnderCount12;
items[11].PassCount = structItem.PassCount12;
items[11].OverCount = structItem.OverCount12;
items[11].ExNGCount = structItem.ExNGCount12;
break;
default:
break;
}
}
}
catch
{
DialogFormMessage myMsg = new DialogFormMessage(17, this.SystemConfig.Language);
myMsg.ShowDialog();
this.smartFileIO.Close();
}
this.smartFileIO.Close();
}
#endregion
#region FeedbackItem File
private void CreateFeedbackItemFile()
{
string fullFilePath = "";
StructFeedbackConfiguration structItem;
Collection<ProductItem> collectionProductItem;
collectionProductItem = new Collection<ProductItem>();
for (int i = 0; i < 1000; i++)
collectionProductItem.Add(new ProductItem());
this.LoadProductFile(ref collectionProductItem);
this.smartFileIO.Close();
fullFilePath = this.PathSystemFileFolder + "FeedbackItem.int";
this.smartFileIO.FilePathName = fullFilePath;
this.smartFileIO.Open(this.BufferSmartUart);
this.CurrentFeedbackItem.Initialization();
for (int i = 0; i < 1000; i++)
{
structItem.HightLimit = collectionProductItem[i].OverRange;
structItem.LowLimit = collectionProductItem[i].UnderRange;
structItem.DeadZone = this.CurrentFeedbackItem.DeadZone;
structItem.DummyBool1 = false;
structItem.DummyBool2 = false;
structItem.DummyBool3 = false;
structItem.DummyInt1 = 1;
structItem.DummyInt2 = 1;
structItem.DummyInt3 = 1;
structItem.DummyString1 = "";
structItem.DummyString2 = "";
structItem.DummyString3 = "";
this.smartFileIO.WriteStructure_Begin(structItem, i);
}
this.smartFileIO.WriteStructure_End();
}
public void SaveFeedbackItemFile(FeedbackConfiguration item, int index)
{
bool fileCheck = false;
string fullFilePath = "";
StructFeedbackConfiguration structItem;
this.smartFileIO.Close();
fullFilePath = this.PathSystemFileFolder + "FeedbackItem.int";
this.smartFileIO.FilePathName = fullFilePath;
FileInfo fileInfo = new FileInfo(fullFilePath);
fileCheck = fileInfo.Exists;
if (fileCheck == false)
this.CreateFeedbackItemFile();
else
this.smartFileIO.Open(this.BufferSmartUart);
structItem.HightLimit = item.HighLimit;
structItem.LowLimit = item.LowLimit;
structItem.DeadZone = item.DeadZone;
structItem.DummyBool1 = false;
structItem.DummyBool2 = false;
structItem.DummyBool3 = false;
structItem.DummyInt1 = 1;
structItem.DummyInt2 = 1;
structItem.DummyInt3 = 1;
structItem.DummyString1 = "";
structItem.DummyString2 = "";
structItem.DummyString3 = "";
this.smartFileIO.WriteStructure_Begin(structItem, index);
this.smartFileIO.WriteStructure_End();
this.smartFileIO.Close();
}
public void LoadFeedbackItemFile(ref FeedbackConfiguration item, int index)
{
bool fileCheck = false;
string fullFilePath = "";
StructFeedbackConfiguration structItem;
this.smartFileIO.Close();
fullFilePath = this.PathSystemFileFolder + "FeedbackItem.int";
this.smartFileIO.FilePathName = fullFilePath;
FileInfo fileInfo = new FileInfo(fullFilePath);
fileCheck = fileInfo.Exists;
if (fileCheck == false)
this.CreateFeedbackItemFile();
else
this.smartFileIO.Open(this.BufferSmartUart);
try
{
structItem = (StructFeedbackConfiguration)this.smartFileIO.ReadStructure(index, typeof(StructFeedbackConfiguration));
item.HighLimit = structItem.HightLimit;
item.LowLimit = structItem.LowLimit;
item.DeadZone = structItem.DeadZone;
}
catch
{
DialogFormMessage myMsg = new DialogFormMessage(17, this.SystemConfig.Language);
myMsg.ShowDialog();
this.smartFileIO.Close();
}
this.smartFileIO.Close();
}
#endregion
#region UserGroupFile
private void CreateUserGroupFile()
{
StructUserGroupItem structItem;
UserGroupItem item = new UserGroupItem();
#region Level1
structItem.IsMainDisplayProductNo = true;
structItem.IsMainDisplayWeightSetting = false;
structItem.IsMainDisplayClear = true;
structItem.IsMainDispalySubMenu = false;
structItem.IsMenuTimeSetting = false;
structItem.IsMenuInformation = true;
structItem.IsMenuDataBackup = true;
structItem.IsMenuCalibration = false;
structItem.IsMenuCommunication = false;
structItem.IsMenuConfiguration = false;
structItem.IsMenuSystemSetting = false;
structItem.IsMenuMotorSetting = false;
structItem.IsMenuUpdate = false;
structItem.IsMenuFactoryReset = false;
structItem.IsMenuEquipmentSetting = false;
structItem.IsMenuIOTest = false;
structItem.IsMenuDataStatistics = true;
structItem.IsMenuUserSetting = true;
structItem.IsMenuUserGroupSetting = false;
structItem.IsMenuDataViewer = false;
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;
structItem.Dummy18 = false;
structItem.Dummy19 = false;
structItem.Dummy20 = false;
this.smartFileIO.WriteStructure_Begin(structItem, 0);
#endregion
#region Level2
structItem.IsMainDisplayProductNo = true;
structItem.IsMainDisplayWeightSetting = true;
structItem.IsMainDisplayClear = true;
structItem.IsMainDispalySubMenu = true;
structItem.IsMenuTimeSetting = false;
structItem.IsMenuInformation = true;
structItem.IsMenuDataBackup = true;
structItem.IsMenuCalibration = true;
structItem.IsMenuCommunication = false;
structItem.IsMenuConfiguration = false;
structItem.IsMenuSystemSetting = true;
structItem.IsMenuMotorSetting = false;
structItem.IsMenuUpdate = false;
structItem.IsMenuFactoryReset = false;
structItem.IsMenuEquipmentSetting = false;
structItem.IsMenuIOTest = false;
structItem.IsMenuDataStatistics = true;
structItem.IsMenuUserSetting = true;
structItem.IsMenuUserGroupSetting = false;
structItem.IsMenuDataViewer = 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;
structItem.Dummy18 = false;
structItem.Dummy19 = false;
structItem.Dummy20 = false;
this.smartFileIO.WriteStructure_Begin(structItem, 1);
#endregion
#region Level3
structItem.IsMainDisplayProductNo = true;
structItem.IsMainDisplayWeightSetting = true;
structItem.IsMainDisplayClear = true;
structItem.IsMainDispalySubMenu = true;
structItem.IsMenuTimeSetting = true;
structItem.IsMenuInformation = true;
structItem.IsMenuDataBackup = true;
structItem.IsMenuCalibration = true;
structItem.IsMenuCommunication = true;
structItem.IsMenuConfiguration = true;
structItem.IsMenuSystemSetting = true;
structItem.IsMenuMotorSetting = true;
structItem.IsMenuUpdate = true;
structItem.IsMenuFactoryReset = true;
structItem.IsMenuEquipmentSetting = true;
structItem.IsMenuIOTest = true;
structItem.IsMenuDataStatistics = true;
structItem.IsMenuUserSetting = true;
structItem.IsMenuUserGroupSetting = true;
structItem.IsMenuDataViewer = 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;
structItem.Dummy18 = false;
structItem.Dummy19 = false;
structItem.Dummy20 = false;
this.smartFileIO.WriteStructure_Begin(structItem, 2);
#endregion
#region NotLogin
structItem.IsMainDisplayProductNo = true;
structItem.IsMainDisplayWeightSetting = true;
structItem.IsMainDisplayClear = true;
structItem.IsMainDispalySubMenu = true;
structItem.IsMenuTimeSetting = true;
structItem.IsMenuInformation = true;
structItem.IsMenuDataBackup = true;
structItem.IsMenuCalibration = true;
structItem.IsMenuCommunication = true;
structItem.IsMenuConfiguration = true;
structItem.IsMenuSystemSetting = true;
structItem.IsMenuMotorSetting = true;
structItem.IsMenuUpdate = true;
structItem.IsMenuFactoryReset = true;
structItem.IsMenuEquipmentSetting = true;
structItem.IsMenuIOTest = true;
structItem.IsMenuDataStatistics = false;
structItem.IsMenuUserSetting = false;
structItem.IsMenuUserGroupSetting = false;
structItem.IsMenuDataViewer = false;
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;
structItem.Dummy18 = false;
structItem.Dummy19 = false;
structItem.Dummy20 = false;
this.smartFileIO.WriteStructure_Begin(structItem, 3);
#endregion
this.smartFileIO.WriteStructure_End();
}
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;
if (fileCheck == true)
this.smartFileIO.Open(this.BufferSmartUart);
else
{
this.smartFileIO.Open(this.BufferSmartUart);
this.CreateUserGroupFile();
}
#region Level1
structItem.IsMainDisplayProductNo = item.Level1.IsMainDisplayProductNo;
structItem.IsMainDisplayWeightSetting = item.Level1.IsMainDisplayWeightSetting;
structItem.IsMainDisplayClear = item.Level1.IsMainDisplayClear;
structItem.IsMainDispalySubMenu = item.Level1.IsMainDisplaySubMenu;
structItem.IsMenuTimeSetting = item.Level1.IsMenuTime;
structItem.IsMenuInformation = item.Level1.IsMenuInformation;
structItem.IsMenuDataBackup = item.Level1.IsMenuDataBackup;
structItem.IsMenuCalibration = item.Level1.IsMenuCalibration;
structItem.IsMenuCommunication = item.Level1.IsMenuCommunication;
structItem.IsMenuConfiguration = item.Level1.IsMenuConfiguration;
structItem.IsMenuSystemSetting = item.Level1.IsMenuSystem;
structItem.IsMenuMotorSetting = item.Level1.IsMenuMotor;
structItem.IsMenuUpdate = item.Level1.IsMenuUpdate;
structItem.IsMenuFactoryReset = item.Level1.IsMenuInitialization;
structItem.IsMenuEquipmentSetting = item.Level1.IsMenuEquipment;
structItem.IsMenuIOTest = item.Level1.IsMenuIOTest;
structItem.IsMenuDataStatistics = item.Level1.IsMenuStatistics;
structItem.IsMenuUserSetting = item.Level1.IsMenuUser;
structItem.IsMenuUserGroupSetting = item.Level1.IsMenuUserGroupEditor;
structItem.IsMenuDataViewer = item.Level1.IsMenuViewer;
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;
structItem.Dummy18 = false;
structItem.Dummy19 = false;
structItem.Dummy20 = false;
this.smartFileIO.WriteStructure_Begin(structItem, (int)DataStore.E_UserGroup_FileIndex.f0_Level1);
#endregion
#region Level2
structItem.IsMainDisplayProductNo = item.Level2.IsMainDisplayProductNo;
structItem.IsMainDisplayWeightSetting = item.Level2.IsMainDisplayWeightSetting;
structItem.IsMainDisplayClear = item.Level2.IsMainDisplayClear;
structItem.IsMainDispalySubMenu = item.Level2.IsMainDisplaySubMenu;
structItem.IsMenuTimeSetting = item.Level2.IsMenuTime;
structItem.IsMenuInformation = item.Level2.IsMenuInformation;
structItem.IsMenuDataBackup = item.Level2.IsMenuDataBackup;
structItem.IsMenuCalibration = item.Level2.IsMenuCalibration;
structItem.IsMenuCommunication = item.Level2.IsMenuCommunication;
structItem.IsMenuConfiguration = item.Level2.IsMenuConfiguration;
structItem.IsMenuSystemSetting = item.Level2.IsMenuSystem;
structItem.IsMenuMotorSetting = item.Level2.IsMenuMotor;
structItem.IsMenuUpdate = item.Level2.IsMenuUpdate;
structItem.IsMenuFactoryReset = item.Level2.IsMenuInitialization;
structItem.IsMenuEquipmentSetting = item.Level2.IsMenuEquipment;
structItem.IsMenuIOTest = item.Level2.IsMenuIOTest;
structItem.IsMenuDataStatistics = item.Level2.IsMenuStatistics;
structItem.IsMenuUserSetting = item.Level2.IsMenuUser;
structItem.IsMenuUserGroupSetting = item.Level2.IsMenuUserGroupEditor;
structItem.IsMenuDataViewer = item.Level2.IsMenuViewer;
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;
structItem.Dummy18 = false;
structItem.Dummy19 = false;
structItem.Dummy20 = false;
this.smartFileIO.WriteStructure_Begin(structItem, (int)DataStore.E_UserGroup_FileIndex.f1_Level2);
#endregion
#region Level3
structItem.IsMainDisplayProductNo = item.Level3.IsMainDisplayProductNo;
structItem.IsMainDisplayWeightSetting = item.Level3.IsMainDisplayWeightSetting;
structItem.IsMainDisplayClear = item.Level3.IsMainDisplayClear;
structItem.IsMainDispalySubMenu = item.Level3.IsMainDisplaySubMenu;
structItem.IsMenuTimeSetting = item.Level3.IsMenuTime;
structItem.IsMenuInformation = item.Level3.IsMenuInformation;
structItem.IsMenuDataBackup = item.Level3.IsMenuDataBackup;
structItem.IsMenuCalibration = item.Level3.IsMenuCalibration;
structItem.IsMenuCommunication = item.Level3.IsMenuCommunication;
structItem.IsMenuConfiguration = item.Level3.IsMenuConfiguration;
structItem.IsMenuSystemSetting = item.Level3.IsMenuSystem;
structItem.IsMenuMotorSetting = item.Level3.IsMenuMotor;
structItem.IsMenuUpdate = item.Level3.IsMenuUpdate;
structItem.IsMenuFactoryReset = item.Level3.IsMenuInitialization;
structItem.IsMenuEquipmentSetting = item.Level3.IsMenuEquipment;
structItem.IsMenuIOTest = item.Level3.IsMenuIOTest;
structItem.IsMenuDataStatistics = item.Level3.IsMenuStatistics;
structItem.IsMenuUserSetting = item.Level3.IsMenuUser;
structItem.IsMenuUserGroupSetting = item.Level3.IsMenuUserGroupEditor;
structItem.IsMenuDataViewer = item.Level3.IsMenuViewer;
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;
structItem.Dummy18 = false;
structItem.Dummy19 = false;
structItem.Dummy20 = false;
this.smartFileIO.WriteStructure_Begin(structItem, (int)DataStore.E_UserGroup_FileIndex.f2_Level3);
#endregion
#region NotLogin
structItem.IsMainDisplayProductNo = item.NotLogin.IsMainDisplayProductNo;
structItem.IsMainDisplayWeightSetting = item.NotLogin.IsMainDisplayWeightSetting;
structItem.IsMainDisplayClear = item.NotLogin.IsMainDisplayClear;
structItem.IsMainDispalySubMenu = item.NotLogin.IsMainDisplaySubMenu;
structItem.IsMenuTimeSetting = item.NotLogin.IsMenuTime;
structItem.IsMenuInformation = item.NotLogin.IsMenuInformation;
structItem.IsMenuDataBackup = item.NotLogin.IsMenuDataBackup;
structItem.IsMenuCalibration = item.NotLogin.IsMenuCalibration;
structItem.IsMenuCommunication = item.NotLogin.IsMenuCommunication;
structItem.IsMenuConfiguration = item.NotLogin.IsMenuConfiguration;
structItem.IsMenuSystemSetting = item.NotLogin.IsMenuSystem;
structItem.IsMenuMotorSetting = item.NotLogin.IsMenuMotor;
structItem.IsMenuUpdate = item.NotLogin.IsMenuUpdate;
structItem.IsMenuFactoryReset = item.NotLogin.IsMenuInitialization;
structItem.IsMenuEquipmentSetting = item.NotLogin.IsMenuEquipment;
structItem.IsMenuIOTest = item.NotLogin.IsMenuIOTest;
structItem.IsMenuDataStatistics = item.NotLogin.IsMenuStatistics;
structItem.IsMenuUserSetting = item.NotLogin.IsMenuUser;
structItem.IsMenuUserGroupSetting = item.NotLogin.IsMenuUserGroupEditor;
structItem.IsMenuDataViewer = item.NotLogin.IsMenuViewer;
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;
structItem.Dummy18 = false;
structItem.Dummy19 = false;
structItem.Dummy20 = false;
this.smartFileIO.WriteStructure_Begin(structItem, (int)DataStore.E_UserGroup_FileIndex.f3_NotLogin);
#endregion
this.smartFileIO.WriteStructure_End();
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;
if (fileCheck == true)
this.smartFileIO.Open(this.BufferSmartUart);
else
{
this.smartFileIO.Open(this.BufferSmartUart);
this.CreateUserGroupFile();
}
try
{
if (this.smartFileIO.ReadStructureAllBuffer() == true)
{
#region Level1
structItem = (StructUserGroupItem)this.smartFileIO.ReadStructureBuffer(typeof(StructUserGroupItem), (int)DataStore.E_UserGroup_FileIndex.f0_Level1);
item.Level1.IsMainDisplayProductNo = structItem.IsMainDisplayProductNo;
item.Level1.IsMainDisplayWeightSetting = structItem.IsMainDisplayWeightSetting;
item.Level1.IsMainDisplayClear = structItem.IsMainDisplayClear;
item.Level1.IsMainDisplaySubMenu = structItem.IsMainDispalySubMenu;
item.Level1.IsMenuTime = structItem.IsMenuTimeSetting;
item.Level1.IsMenuInformation = structItem.IsMenuInformation;
item.Level1.IsMenuDataBackup = structItem.IsMenuDataBackup;
item.Level1.IsMenuCalibration = structItem.IsMenuCalibration;
item.Level1.IsMenuCommunication = structItem.IsMenuCommunication;
item.Level1.IsMenuConfiguration = structItem.IsMenuConfiguration;
item.Level1.IsMenuSystem = structItem.IsMenuSystemSetting;
item.Level1.IsMenuMotor = structItem.IsMenuMotorSetting;
item.Level1.IsMenuUpdate = structItem.IsMenuUpdate;
item.Level1.IsMenuInitialization = structItem.IsMenuFactoryReset;
item.Level1.IsMenuEquipment = structItem.IsMenuEquipmentSetting;
item.Level1.IsMenuIOTest = structItem.IsMenuIOTest;
item.Level1.IsMenuStatistics = structItem.IsMenuDataStatistics;
item.Level1.IsMenuUser = true;
item.Level1.IsMenuUserGroupEditor = structItem.IsMenuUserGroupSetting;
item.Level1.IsMenuViewer = structItem.IsMenuDataViewer;
#endregion
#region Level2
structItem = (StructUserGroupItem)this.smartFileIO.ReadStructureBuffer(typeof(StructUserGroupItem), (int)DataStore.E_UserGroup_FileIndex.f1_Level2);
item.Level2.IsMainDisplayProductNo = structItem.IsMainDisplayProductNo;
item.Level2.IsMainDisplayWeightSetting = structItem.IsMainDisplayWeightSetting;
item.Level2.IsMainDisplayClear = structItem.IsMainDisplayClear;
item.Level2.IsMainDisplaySubMenu = structItem.IsMainDispalySubMenu;
item.Level2.IsMenuTime = structItem.IsMenuTimeSetting;
item.Level2.IsMenuInformation = structItem.IsMenuInformation;
item.Level2.IsMenuDataBackup = structItem.IsMenuDataBackup;
item.Level2.IsMenuCalibration = structItem.IsMenuCalibration;
item.Level2.IsMenuCommunication = structItem.IsMenuCommunication;
item.Level2.IsMenuConfiguration = structItem.IsMenuConfiguration;
item.Level2.IsMenuSystem = structItem.IsMenuSystemSetting;
item.Level2.IsMenuMotor = structItem.IsMenuMotorSetting;
item.Level2.IsMenuUpdate = structItem.IsMenuUpdate;
item.Level2.IsMenuInitialization = structItem.IsMenuFactoryReset;
item.Level2.IsMenuEquipment = structItem.IsMenuEquipmentSetting;
item.Level2.IsMenuIOTest = structItem.IsMenuIOTest;
item.Level2.IsMenuStatistics = structItem.IsMenuDataStatistics;
item.Level2.IsMenuUser = true;
item.Level2.IsMenuUserGroupEditor = structItem.IsMenuUserGroupSetting;
item.Level2.IsMenuViewer = structItem.IsMenuDataViewer;
#endregion
#region Level3
structItem = (StructUserGroupItem)this.smartFileIO.ReadStructureBuffer(typeof(StructUserGroupItem), (int)DataStore.E_UserGroup_FileIndex.f2_Level3);
item.Level3.IsMainDisplayProductNo = structItem.IsMainDisplayProductNo;
item.Level3.IsMainDisplayWeightSetting = structItem.IsMainDisplayWeightSetting;
item.Level3.IsMainDisplayClear = structItem.IsMainDisplayClear;
item.Level3.IsMainDisplaySubMenu = structItem.IsMainDispalySubMenu;
item.Level3.IsMenuTime = structItem.IsMenuTimeSetting;
item.Level3.IsMenuInformation = structItem.IsMenuInformation;
item.Level3.IsMenuDataBackup = structItem.IsMenuDataBackup;
item.Level3.IsMenuCalibration = structItem.IsMenuCalibration;
item.Level3.IsMenuCommunication = structItem.IsMenuCommunication;
item.Level3.IsMenuConfiguration = structItem.IsMenuConfiguration;
item.Level3.IsMenuSystem = structItem.IsMenuSystemSetting;
item.Level3.IsMenuMotor = structItem.IsMenuMotorSetting;
item.Level3.IsMenuUpdate = structItem.IsMenuUpdate;
item.Level3.IsMenuInitialization = structItem.IsMenuFactoryReset;
item.Level3.IsMenuEquipment = structItem.IsMenuEquipmentSetting;
item.Level3.IsMenuIOTest = structItem.IsMenuIOTest;
item.Level3.IsMenuStatistics = structItem.IsMenuDataStatistics;
item.Level3.IsMenuUser = true;
item.Level3.IsMenuUserGroupEditor = structItem.IsMenuUserGroupSetting;
item.Level3.IsMenuViewer = structItem.IsMenuDataViewer;
#endregion
#region NotLogin
structItem = (StructUserGroupItem)this.smartFileIO.ReadStructureBuffer(typeof(StructUserGroupItem), (int)DataStore.E_UserGroup_FileIndex.f3_NotLogin);
item.NotLogin.IsMainDisplayProductNo = structItem.IsMainDisplayProductNo;
item.NotLogin.IsMainDisplayWeightSetting = structItem.IsMainDisplayWeightSetting;
item.NotLogin.IsMainDisplayClear = structItem.IsMainDisplayClear;
item.NotLogin.IsMainDisplaySubMenu = structItem.IsMainDispalySubMenu;
item.NotLogin.IsMenuTime = structItem.IsMenuTimeSetting;
item.NotLogin.IsMenuInformation = structItem.IsMenuInformation;
item.NotLogin.IsMenuDataBackup = structItem.IsMenuDataBackup;
item.NotLogin.IsMenuCalibration = structItem.IsMenuCalibration;
item.NotLogin.IsMenuCommunication = structItem.IsMenuCommunication;
item.NotLogin.IsMenuConfiguration = structItem.IsMenuConfiguration;
item.NotLogin.IsMenuSystem = structItem.IsMenuSystemSetting;
item.NotLogin.IsMenuMotor = structItem.IsMenuMotorSetting;
item.NotLogin.IsMenuUpdate = structItem.IsMenuUpdate;
item.NotLogin.IsMenuInitialization = structItem.IsMenuFactoryReset;
item.NotLogin.IsMenuEquipment = structItem.IsMenuEquipmentSetting;
item.NotLogin.IsMenuIOTest = structItem.IsMenuIOTest;
item.NotLogin.IsMenuStatistics = structItem.IsMenuDataStatistics;
item.NotLogin.IsMenuUser = false;
item.NotLogin.IsMenuUserGroupEditor = structItem.IsMenuUserGroupSetting;
item.NotLogin.IsMenuViewer = structItem.IsMenuDataViewer;
#endregion
}
}
catch
{
DialogFormMessage myMsg = new DialogFormMessage(17, this.SystemConfig.Language);
myMsg.ShowDialog();
this.smartFileIO.Close();
}
this.smartFileIO.Close();
}
#endregion
#region FeedbackSystem1
private void SetFeedbackSystem1(int lane, WeightData data)
{
int checkWeight = 0;
int passRange = 0, lowLimit = 0, highLimit = 0, deadZone = 0, deadZoneLow = 0, deadZoneHigh = 0;
DataStore.FeedbackStatus status = DataStore.FeedbackStatus.None;
checkWeight = int.Parse(data.WeightString);
passRange = int.Parse(this.CurrentProductItem.PassRange);
lowLimit = int.Parse(this.CurrentFeedbackItem.LowLimit);
highLimit = int.Parse(this.CurrentFeedbackItem.HighLimit);
deadZone = int.Parse(this.CurrentFeedbackItem.DeadZone);
deadZoneLow = passRange - deadZone;
deadZoneHigh = passRange + deadZone;
if (((checkWeight < deadZoneLow) && (checkWeight > lowLimit)) || ((checkWeight > deadZoneHigh) && (checkWeight < highLimit)))
{
if ((checkWeight < deadZoneLow) && (checkWeight > lowLimit))
status = DataStore.FeedbackStatus.Negative;
else
status = DataStore.FeedbackStatus.Positive;
this.CollectionFeedbackStatus[lane - 1].SetWeight(checkWeight, status);
}
else
this.CollectionFeedbackStatus[lane - 1].ClearDataList();
}
#endregion
#region OPC, Modbus
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;
}
public ushort Grade(DataStore.JudgmentStatus status)
{
ushort judgmentStatus = 0;
switch (status)
{
case DataStore.JudgmentStatus.Pass:
judgmentStatus = 1;
break;
case DataStore.JudgmentStatus.Over:
judgmentStatus = 2;
break;
case DataStore.JudgmentStatus.Under:
judgmentStatus = 3;
break;
case DataStore.JudgmentStatus.Double:
case DataStore.JudgmentStatus.EXNg:
case DataStore.JudgmentStatus.SensorError:
judgmentStatus = 4;
break;
default:
judgmentStatus = 0;
break;
}
return judgmentStatus;
}
private void Update30000UpdateData(int index)
{
if (this.CollectionWeightData[index].UpdateCount > 65535)
this.CollectionWeightData[index].UpdateCount = 0;
else
this.CollectionWeightData[index].UpdateCount++;
this.Current30000ModbusData.LaneModbusData[index].Update = this.CollectionWeightData[index].UpdateCount;
}
public void Update30000ModbusData()
{
for(int i = 0; i < this.SystemConfig.EquipmentColumns; i++)
this.Update30000UpdateData(i);
this.Current30000ModbusData.UnderValue = Helper.StringToWeight(this.CurrentProductItem.UnderRange, this.SystemConfig.DecimalPlaces);
this.Current30000ModbusData.PassValue = Helper.StringToWeight(this.CurrentProductItem.PassRange, this.SystemConfig.DecimalPlaces);
this.Current30000ModbusData.OverValue = Helper.StringToWeight(this.CurrentProductItem.OverRange, this.SystemConfig.DecimalPlaces);
this.Current30000ModbusData.TareValue = Helper.StringToWeight(this.CurrentProductItem.TareRange, this.SystemConfig.DecimalPlaces);
this.Current30000ModbusData.HighLimit = Helper.StringToWeight(this.CurrentFeedbackItem.HighLimit, this.SystemConfig.DecimalPlaces);
this.Current30000ModbusData.DeadZoneHighLimit =
Helper.StringToWeight((int.Parse(this.CurrentProductItem.PassRange) - int.Parse(this.CurrentFeedbackItem.DeadZone)).ToString(), this.SystemConfig.DecimalPlaces);
this.Current30000ModbusData.DeadZoneLowLimit =
Helper.StringToWeight(this.CurrentProductItem.PassRange + this.CurrentFeedbackItem.DeadZone, this.SystemConfig.DecimalPlaces);
this.Current30000ModbusData.LowLimit = Helper.StringToWeight(this.CurrentFeedbackItem.LowLimit, this.SystemConfig.DecimalPlaces);
this.Current30000ModbusData.SampleCount = (UInt32)this.SystemConfig.FeedbackSampleCount;
this.Current30000ModbusData.IgnoreCount = (UInt32)this.SystemConfig.FeedbackIgnorePackages;
}
public void Update30000ModbusData(int index)
{
this.Update30000UpdateData(index);
this.Current30000ModbusData.LaneModbusData[index].Grade = this.Grade(this.CollectionWeightData[index].JudgmentStatus);
this.Current30000ModbusData.LaneModbusData[index].Weight = this.CollectionWeightData[index].Weight;
this.Current30000ModbusData.LaneModbusData[index].UnderCount = (UInt32)this.CollectionWeightData[index].UnderCount;
this.Current30000ModbusData.LaneModbusData[index].PassCount = (UInt32)this.CollectionWeightData[index].PassCount;
this.Current30000ModbusData.LaneModbusData[index].OverCount = (UInt32)this.CollectionWeightData[index].OverCount;
this.Current30000ModbusData.LaneModbusData[index].ExNGCount = (UInt32)this.CollectionWeightData[index].ExNGCount;
}
// Common 값 변경 시 통신전송
public void ModbusCommonDataSend()
{
// 이더넷
if (this.SystemConfig.EthernetOperationMode == 1)
{
byte[] etherByteData = this.Modbus.WriteMultipleRegisterTCP(this.Protocol_Modbus_Client_Write_Common_Data(), 1010);
if (this.smartTCPMultiServer.ClientInfoList != null)
{
foreach (SmartTCPMultiServer.CLIENTSINFOS info in this.smartTCPMultiServer.ClientInfoList)
this.EthernetServerSendMessage(info, etherByteData);
}
}
else if (this.SystemConfig.EthernetOperationMode == 2)
{
byte[] etherByteData = this.Modbus.WriteMultipleRegisterTCP(
this.Protocol_Modbus_Client_Write_Common_Data(), this.SystemConfig.ModbusTcpStartAddress);
this.EthernetWeightDataForModbus(etherByteData);
}
}
// Lane Test 통신전송
public void ModbusLaneTestDataSend(int lane)
{
// 이더넷
if (this.SystemConfig.EthernetOperationMode == 1)
{
byte[] etherByteData = this.Modbus.WriteMultipleRegisterTCP(this.Protocol_Modbus_Client_Write_Common_Data(), 1010 + 140 + (lane * 50));
if (this.smartTCPMultiServer.ClientInfoList != null)
{
foreach (SmartTCPMultiServer.CLIENTSINFOS info in this.smartTCPMultiServer.ClientInfoList)
this.EthernetServerSendMessage(info, etherByteData);
}
}
else if (this.SystemConfig.EthernetOperationMode == 2)
{
byte[] etherByteData = this.Modbus.WriteMultipleRegisterTCP(
this.Protocol_Modbus_Client_Write_Lane_Test_Data(lane), this.SystemConfig.ModbusTcpStartAddress + 140 + (lane * 50));
this.EthernetWeightDataForModbus(etherByteData);
}
}
public byte[] Protocol_Modbus_Client_Write_Lane_Test_Data(int laneIndex)
{
int index = 0;
byte[] madeData = new byte[32];
byte[] length4Value = new byte[4];
byte[] length2Value = new byte[2];
var random = new Random();
Single ranDouble = Single.Parse(string.Format("{0:F2}", random.NextDouble()));
length2Value = GetBytes(this.Current30000ModbusData.LaneModbusData[laneIndex].Update);
for (int i = 0; i < 2; i++)
madeData[i] = length2Value[1 - i];
length2Value = GetBytes(this.Current30000ModbusData.LaneModbusData[laneIndex].Grade);
for (int i = 0; i < 2; i++)
madeData[2 + i] = length2Value[1 - i];
length4Value = GetBytes(ranDouble + random.Next(999));
for (int i = 0; i < 4; i++)
madeData[4 + i] = length4Value[3 - i];
length4Value = GetBytes(random.Next(9999999));
for (int i = 0; i < 4; i++)
madeData[8 + i] = length4Value[3 - i];
length4Value = GetBytes(random.Next(9999999));
for (int i = 0; i < 4; i++)
madeData[12 + i] = length4Value[3 - i];
length4Value = GetBytes(random.Next(9999999));
for (int i = 0; i < 4; i++)
madeData[16 + i] = length4Value[3 - i];
length4Value = GetBytes(random.Next(9999999));
for (int i = 0; i < 4; i++)
madeData[20 + i] = length4Value[3 - i];
length4Value = GetBytes(random.Next(9999999));
for (int i = 0; i < 4; i++)
madeData[24 + i] = length4Value[3 - i];
length4Value = GetBytes(random.Next(9999999));
for (int i = 0; i < 4; i++)
madeData[28 + i] = length4Value[3 - i];
return madeData;
}
/// <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._01_Clear:
#region 40011_소거 요청
for (int i = 0; i < 2; i++)
Length2Value[i] = readByte[13 + madeDataIndex + i];
this.Current40000ModbusData._40011_Clear = Modbus.ToBigEndianAndInt(Length2Value);
if (this.Current40000ModbusData._40011_Clear == 1)
{
try
{
this.ChildFormMainDisplay.Clear();
this.Current40000ModbusData._40011_Clear = 0;
// 성공
this.Current40000ModbusData._40012_ClearResult = 1;
}
catch
{
// 실패
this.Current40000ModbusData._40012_ClearResult = 2;
}
}
#endregion
break;
case _40000_ModbusAddress._02_ClearResult:
#region 40012_소거 요청 결과
for (int i = 0; i < 2; i++)
Length2Value[i] = readByte[13 + madeDataIndex + i];
this.Current40000ModbusData._40012_ClearResult = Modbus.ToBigEndianAndInt(Length2Value);
#endregion
break;
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(CommunicationCommand.Start, CommunicationID.MainBoard);
else
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
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;
case _40000_ModbusAddress._05_ProductChange_High:
#region 40015_품번 변경 요청
for (int i = 0; i < 4; i++)
Length4Value[i] = readByte[13 + madeDataIndex + i];
this.Current40000ModbusData._40015_ProductChange = Modbus.ToBigEndianAndInt(Length4Value);
if (this.Current40000ModbusData._40015_ProductChange != 0)
{
try
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Stop)
{
if (this.Current40000ModbusData._40015_ProductChange >= 1
&& this.Current40000ModbusData._40015_ProductChange <= 1000)
this.ChildFormMainDisplay.ProductChange(this.Current40000ModbusData._40015_ProductChange);
this.Current40000ModbusData._40015_ProductChange = 0;
// 성공
this.Current40000ModbusData._40017_ProductChangeResult = 1;
}
else
{
this.Current40000ModbusData._40015_ProductChange = 0;
this.Current40000ModbusData._40017_ProductChangeResult = 2;
}
}
catch
{
// 실패
this.Current40000ModbusData._40017_ProductChangeResult = 2;
}
}
#endregion
break;
case _40000_ModbusAddress._07_ProductChangeResult:
#region 40017_품번 변경 요청 수행 결과
for (int i = 0; i < 2; i++)
Length2Value[i] = readByte[13 + madeDataIndex + i];
this.Current40000ModbusData._40017_ProductChangeResult = Modbus.ToBigEndianAndInt(Length2Value);
#endregion
break;
case _40000_ModbusAddress._08_UnderRange_High:
#region 40018_Under 중량설정 요청
for (int i = 0; i < 4; i++)
Length4Value[i] = readByte[13 + madeDataIndex + i];
floatNum = Modbus.ToBigEndianAndFloat(Length4Value);
this.Current40000ModbusData._40018_UnderRange =
int.Parse(Helper.DoubleToString((double)floatNum, this.SystemConfig.DecimalPlaces).Replace(".", ""));
if (this.Current40000ModbusData._40018_UnderRange >= 0 && this.Current40000ModbusData._40018_UnderRange <= 99999)
{
try
{
this.CurrentProductItem.UnderRange = this.Current40000ModbusData._40018_UnderRange.ToString();
this.SaveProductFile(this.CurrentProductItem, this.SystemConfig.ProductNumber - 1);
this.TransferProductParameter(this.SystemConfig.ProductNumber);
this.Update30000ModbusData();
this.ModbusCommonDataSend();
this.ChildFormMainDisplay.UpdateCurrentProductDisplay(this.EquipmentStatus, this.CurrentProductItem, this.CurrentJudgmentSetItem, this.CollectionWeightData);
// 초기값으로 설정해놓기
this.Current40000ModbusData._40018_UnderRange = 0;
// 성공
this.Current40000ModbusData._40020_UnderRangeResult = 1;
}
catch
{
// 실패
this.Current40000ModbusData._40020_UnderRangeResult = 2;
}
}
else
{
// 실패
this.Current40000ModbusData._40020_UnderRangeResult = 2;
}
#endregion
break;
case _40000_ModbusAddress._10_UnderRangeResult:
#region 40020_Under 중량설정 요청 수행 결과
for (int i = 0; i < 2; i++)
Length2Value[i] = readByte[13 + madeDataIndex + i];
this.Current40000ModbusData._40020_UnderRangeResult = Modbus.ToBigEndianAndInt(Length2Value);
#endregion
break;
case _40000_ModbusAddress._11_PassRange_High:
#region 40021_Pass 중량설정 요청
for (int i = 0; i < 4; i++)
Length4Value[i] = readByte[13 + madeDataIndex + i];
floatNum = Modbus.ToBigEndianAndFloat(Length4Value);
this.Current40000ModbusData._40021_PassRange =
int.Parse(Helper.DoubleToString((double)floatNum, this.SystemConfig.DecimalPlaces).Replace(".", ""));
if (this.Current40000ModbusData._40021_PassRange >= 0 && this.Current40000ModbusData._40021_PassRange <= 99999)
{
try
{
string value = "";
int digit = 0, temp = 0;
this.CurrentProductItem.PassRange = this.Current40000ModbusData._40021_PassRange.ToString();
this.SaveProductFile(this.CurrentProductItem, this.SystemConfig.ProductNumber - 1);
this.TransferProductParameter(this.SystemConfig.ProductNumber);
this.Update30000ModbusData();
this.ModbusCommonDataSend();
this.ChildFormMainDisplay.UpdateCurrentProductDisplay(this.EquipmentStatus, this.CurrentProductItem, this.CurrentJudgmentSetItem, this.CollectionWeightData);
// 초기값으로 설정해놓기
this.Current40000ModbusData._40021_PassRange = 0;
// 성공
this.Current40000ModbusData._40023_PassRangeResult = 1;
}
catch
{
// 실패
this.Current40000ModbusData._40023_PassRangeResult = 2;
}
}
else
{
// 실패
this.Current40000ModbusData._40023_PassRangeResult = 2;
}
#endregion
break;
case _40000_ModbusAddress._13_PassRangeResult:
#region 40023_Pass 중량설정 요청 수행 결과
for (int i = 0; i < 2; i++)
Length2Value[i] = readByte[13 + madeDataIndex + i];
this.Current40000ModbusData._40023_PassRangeResult = Modbus.ToBigEndianAndInt(Length2Value);
#endregion
break;
case _40000_ModbusAddress._14_OverRange_High:
#region 40024_Over 중량설정 요청
for (int i = 0; i < 4; i++)
Length4Value[i] = readByte[13 + madeDataIndex + i];
floatNum = Modbus.ToBigEndianAndFloat(Length4Value);
this.Current40000ModbusData._40024_OverRange =
int.Parse(Helper.DoubleToString((double)floatNum, this.SystemConfig.DecimalPlaces).Replace(".", ""));
if (this.Current40000ModbusData._40024_OverRange >= 0 && this.Current40000ModbusData._40024_OverRange <= 99999)
{
try
{
this.CurrentProductItem.OverRange = this.Current40000ModbusData._40024_OverRange.ToString();
this.SaveProductFile(this.CurrentProductItem, this.SystemConfig.ProductNumber - 1);
this.TransferProductParameter(this.SystemConfig.ProductNumber);
this.Update30000ModbusData();
this.ModbusCommonDataSend();
this.ChildFormMainDisplay.UpdateCurrentProductDisplay(this.EquipmentStatus, this.CurrentProductItem, this.CurrentJudgmentSetItem, this.CollectionWeightData);
// 초기값으로 설정해놓기
this.Current40000ModbusData._40024_OverRange = 0;
// 성공
this.Current40000ModbusData._40026_OverRangeResult = 1;
}
catch
{
// 실패
this.Current40000ModbusData._40026_OverRangeResult = 2;
}
}
else
{
// 실패
this.Current40000ModbusData._40026_OverRangeResult = 2;
}
#endregion
break;
case _40000_ModbusAddress._16_OverRangeResult:
#region 40026_Over 중량설정 요청 수행 결과
for (int i = 0; i < 2; i++)
Length2Value[i] = readByte[13 + madeDataIndex + i];
this.Current40000ModbusData._40026_OverRangeResult = Modbus.ToBigEndianAndInt(Length2Value);
#endregion
break;
case _40000_ModbusAddress._17_TareWeight_High:
#region 40027_Tare 중량설정 요청
for (int i = 0; i < 4; i++)
Length4Value[i] = readByte[13 + madeDataIndex + i];
floatNum = Modbus.ToBigEndianAndFloat(Length4Value);
this.Current40000ModbusData._40027_TareWeight =
int.Parse(Helper.DoubleToString((double)floatNum, this.SystemConfig.DecimalPlaces).Replace(".", ""));
if (this.Current40000ModbusData._40027_TareWeight >= 0 && this.Current40000ModbusData._40027_TareWeight <= 99999)
{
try
{
this.CurrentProductItem.TareRange = this.Current40000ModbusData._40027_TareWeight.ToString();
this.SaveProductFile(this.CurrentProductItem, this.SystemConfig.ProductNumber - 1);
this.TransferProductParameter(this.SystemConfig.ProductNumber);
this.Update30000ModbusData();
this.ModbusCommonDataSend();
this.ChildFormMainDisplay.UpdateCurrentProductDisplay(this.EquipmentStatus, this.CurrentProductItem, this.CurrentJudgmentSetItem, this.CollectionWeightData);
// 초기값으로 설정해놓기
this.Current40000ModbusData._40027_TareWeight = 0;
// 성공
this.Current40000ModbusData._40029_TareWeightResult = 1;
}
catch
{
// 실패
this.Current40000ModbusData._40029_TareWeightResult = 2;
}
}
else
{
// 실패
this.Current40000ModbusData._40029_TareWeightResult = 2;
}
#endregion
break;
case _40000_ModbusAddress._19_TareWeightResult:
#region 40029_Tare 중량설정 요청 수행 결과
for (int i = 0; i < 2; i++)
Length2Value[i] = readByte[13 + madeDataIndex + i];
this.Current40000ModbusData._40029_TareWeightResult = Modbus.ToBigEndianAndInt(Length2Value);
#endregion
break;
default:
break;
#endregion
}
madeDataIndex += 2;
}
}
#endregion
#region Communication Protocol
private string Protocol_OPT2_NotStxEtx(SystemConfigurationItem system, Collection<WeightData> datas)
{
StringBuilder sb = new StringBuilder();
sb.Append(string.Format("IN{0:D3}", system.EquipmentID));
sb.Append(string.Format("{0:D4}", system.ProductNumber));
for (int i = 0; i < system.EquipmentColumns; i++)
{
if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Under)
sb.Append("U");
else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Pass)
sb.Append("P");
else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Over)
sb.Append("O");
else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Double)
sb.Append("D");
else
sb.Append("E");
sb.Append(Helper.StringBlankFillDigits6(Helper.DoubleToString(datas[i].Weight, system.DecimalPlaces)));
}
return sb.ToString();
}
private string Protocol_OPT2_NotStxEtx_1(SystemConfigurationItem system, Collection<WeightData> datas)
{
StringBuilder sb = new StringBuilder();
sb.Append(string.Format("IN{0:D3}", system.EquipmentID));
sb.Append(string.Format("{0:D4}", system.ProductNumber));
for (int i = 0; i < system.EquipmentColumns; i++)
{
if (system.EquipmentMode == 2)
{
if (datas[i].IsUpdate == true)
{
if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Under)
sb.Append("U");
else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Pass)
sb.Append("P");
else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Over)
sb.Append("O");
else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Double)
sb.Append("D");
else
sb.Append("E");
}
else
sb.Append("E");
}
else
{
if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Under)
sb.Append("U");
else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Pass)
sb.Append("P");
else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Over)
sb.Append("O");
else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Double)
sb.Append("D");
else
sb.Append("E");
}
sb.Append(Helper.StringBlankFillDigits6(Helper.DoubleToString(datas[i].Weight, system.DecimalPlaces)));
}
return sb.ToString();
}
public string Protocol_OPT2(SystemConfigurationItem system, Collection<WeightData> datas)
{
StringBuilder sb = new StringBuilder();
sb.Append((char)0x02);
sb.Append(this.Protocol_OPT2_NotStxEtx(system, datas));
sb.Append((char)0x03);
return sb.ToString();
}
private string Protocol_OPT2_NotStxEtx(SystemConfigurationItem system, WeightData data, int lane)
{
StringBuilder sb = new StringBuilder();
sb.Append(string.Format("IN{0:D3}", system.EquipmentID));
sb.Append(string.Format("{0:D4}", system.ProductNumber));
sb.Append(string.Format("{0:D2}", lane));
if (data.JudgmentStatus == DataStore.JudgmentStatus.Under)
sb.Append("U");
else if (data.JudgmentStatus == DataStore.JudgmentStatus.Pass)
sb.Append("P");
else if (data.JudgmentStatus == DataStore.JudgmentStatus.Over)
sb.Append("O");
else if (data.JudgmentStatus == DataStore.JudgmentStatus.Double)
sb.Append("D");
else
sb.Append("E");
sb.Append(Helper.StringBlankFillDigits6(Helper.DoubleToString(data.Weight, system.DecimalPlaces)));
return sb.ToString();
}
public string Protocol_OPT2(SystemConfigurationItem system, WeightData data, int lane)
{
StringBuilder sb = new StringBuilder();
sb.Append((char)0x02);
sb.Append(this.Protocol_OPT2_NotStxEtx(system, data, lane));
sb.Append((char)0x03);
return sb.ToString();
}
private string Protocol_OPT3_NotStxEtx(SystemConfigurationItem system, Collection<WeightData> datas, ProductItem pItem)
{
StringBuilder sb = new StringBuilder();
sb.Append(string.Format("IN{0:D3}", system.EquipmentID));
sb.Append(string.Format("{0:D4}", system.ProductNumber));
sb.Append(Helper.StringBlankFillDigits6(Helper.StringToDecimalPlaces(pItem.PassRange, system.DecimalPlaces)));
for (int i = 0; i < system.EquipmentColumns; i++)
{
if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Under)
sb.Append("U");
else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Pass)
sb.Append("P");
else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Over)
sb.Append("O");
else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Double)
sb.Append("D");
else
sb.Append("E");
sb.Append(Helper.StringBlankFillDigits6(Helper.DoubleToString(datas[i].Weight, system.DecimalPlaces)));
}
return sb.ToString();
}
private string Protocol_OPT3_NotStxEtx_1(SystemConfigurationItem system, Collection<WeightData> datas, ProductItem pItem)
{
StringBuilder sb = new StringBuilder();
sb.Append(string.Format("IN{0:D3}", system.EquipmentID));
sb.Append(string.Format("{0:D4}", system.ProductNumber));
sb.Append(Helper.StringBlankFillDigits6(Helper.StringToDecimalPlaces(pItem.PassRange, system.DecimalPlaces)));
for (int i = 0; i < system.EquipmentColumns; i++)
{
if (system.EquipmentMode == 2)
{
if (datas[i].IsUpdate == true)
{
if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Under)
sb.Append("U");
else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Pass)
sb.Append("P");
else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Over)
sb.Append("O");
else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Double)
sb.Append("D");
else
sb.Append("E");
}
else
sb.Append("E");
}
else
{
if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Under)
sb.Append("U");
else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Pass)
sb.Append("P");
else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Over)
sb.Append("O");
else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Double)
sb.Append("D");
else
sb.Append("E");
}
sb.Append(Helper.StringBlankFillDigits6(Helper.DoubleToString(datas[i].Weight, system.DecimalPlaces)));
}
return sb.ToString();
}
public string Protocol_OPT3(SystemConfigurationItem system, Collection<WeightData> datas, ProductItem pItem)
{
StringBuilder sb = new StringBuilder();
sb.Append((char)0x02);
sb.Append(this.Protocol_OPT3_NotStxEtx(system, datas, pItem));
sb.Append((char)0x03);
return sb.ToString();
}
private string Protocol_OPT3_NotStxEtx(SystemConfigurationItem system, WeightData data, int lane, ProductItem pItem)
{
StringBuilder sb = new StringBuilder();
sb.Append(string.Format("IN{0:D3}", system.EquipmentID));
sb.Append(string.Format("{0:D4}", system.ProductNumber));
sb.Append(Helper.StringBlankFillDigits6(Helper.StringToDecimalPlaces(pItem.PassRange, system.DecimalPlaces)));
sb.Append(string.Format("{0:D2}", lane));
if (data.JudgmentStatus == DataStore.JudgmentStatus.Under)
sb.Append("U");
else if (data.JudgmentStatus == DataStore.JudgmentStatus.Pass)
sb.Append("P");
else if (data.JudgmentStatus == DataStore.JudgmentStatus.Over)
sb.Append("O");
else if (data.JudgmentStatus == DataStore.JudgmentStatus.Double)
sb.Append("D");
else
sb.Append("E");
sb.Append(Helper.StringBlankFillDigits6(Helper.DoubleToString(data.Weight, system.DecimalPlaces)));
return sb.ToString();
}
public string Protocol_OPT3(SystemConfigurationItem system, WeightData data, int lane, ProductItem pItem)
{
StringBuilder sb = new StringBuilder();
sb.Append((char)0x02);
sb.Append(this.Protocol_OPT3_NotStxEtx(system, data, lane, pItem));
sb.Append((char)0x03);
return sb.ToString();
}
private string Protocol_OPT5_NotStxEtx(SystemConfigurationItem system, Collection<WeightData> datas, ProductItem pItem)
{
StringBuilder sb = new StringBuilder();
sb.Append(string.Format("IN{0:D3}", system.EquipmentID));
sb.Append(string.Format("{0:D4}", system.ProductNumber));
sb.Append(Helper.StringBlankFillDigits6(Helper.StringToDecimalPlaces(pItem.UnderRange, system.DecimalPlaces)));
sb.Append(Helper.StringBlankFillDigits6(Helper.StringToDecimalPlaces(pItem.PassRange, system.DecimalPlaces)));
sb.Append(Helper.StringBlankFillDigits6(Helper.StringToDecimalPlaces(pItem.OverRange, system.DecimalPlaces)));
sb.Append(Helper.StringBlankFillDigits6(Helper.StringToDecimalPlaces(pItem.TareRange, system.DecimalPlaces)));
for (int i = 0; i < system.EquipmentColumns; i++)
{
if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Under)
sb.Append("U");
else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Pass)
sb.Append("P");
else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Over)
sb.Append("O");
else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Double)
sb.Append("D");
else
sb.Append("E");
sb.Append(Helper.StringBlankFillDigits6(Helper.DoubleToString(datas[i].Weight, system.DecimalPlaces)));
}
return sb.ToString();
}
private string Protocol_OPT5_NotStxEtx_1(SystemConfigurationItem system, Collection<WeightData> datas, ProductItem pItem)
{
StringBuilder sb = new StringBuilder();
sb.Append(string.Format("IN{0:D3}", system.EquipmentID));
sb.Append(string.Format("{0:D4}", system.ProductNumber));
sb.Append(Helper.StringBlankFillDigits6(Helper.StringToDecimalPlaces(pItem.UnderRange, system.DecimalPlaces)));
sb.Append(Helper.StringBlankFillDigits6(Helper.StringToDecimalPlaces(pItem.PassRange, system.DecimalPlaces)));
sb.Append(Helper.StringBlankFillDigits6(Helper.StringToDecimalPlaces(pItem.OverRange, system.DecimalPlaces)));
sb.Append(Helper.StringBlankFillDigits6(Helper.StringToDecimalPlaces(pItem.TareRange, system.DecimalPlaces)));
for (int i = 0; i < system.EquipmentColumns; i++)
{
if (system.EquipmentMode == 2)
{
if (datas[i].IsUpdate == true)
{
if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Under)
sb.Append("U");
else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Pass)
sb.Append("P");
else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Over)
sb.Append("O");
else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Double)
sb.Append("D");
else
sb.Append("E");
}
else
sb.Append("E");
}
else
{
if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Under)
sb.Append("U");
else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Pass)
sb.Append("P");
else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Over)
sb.Append("O");
else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Double)
sb.Append("D");
else
sb.Append("E");
}
sb.Append(Helper.StringBlankFillDigits6(Helper.DoubleToString(datas[i].Weight, system.DecimalPlaces)));
}
return sb.ToString();
}
public string Protocol_OPT5(SystemConfigurationItem system, Collection<WeightData> datas, ProductItem pItem)
{
StringBuilder sb = new StringBuilder();
sb.Append((char)0x02);
sb.Append(this.Protocol_OPT5_NotStxEtx(system, datas, pItem));
sb.Append((char)0x03);
return sb.ToString();
}
private string Protocol_OPT5_NotStxEtx(SystemConfigurationItem system, WeightData data, int lane, ProductItem pItem)
{
StringBuilder sb = new StringBuilder();
sb.Append(string.Format("IN{0:D3}", system.EquipmentID));
sb.Append(string.Format("{0:D4}", system.ProductNumber));
sb.Append(Helper.StringBlankFillDigits6(Helper.StringToDecimalPlaces(pItem.UnderRange, system.DecimalPlaces)));
sb.Append(Helper.StringBlankFillDigits6(Helper.StringToDecimalPlaces(pItem.PassRange, system.DecimalPlaces)));
sb.Append(Helper.StringBlankFillDigits6(Helper.StringToDecimalPlaces(pItem.OverRange, system.DecimalPlaces)));
sb.Append(Helper.StringBlankFillDigits6(Helper.StringToDecimalPlaces(pItem.TareRange, system.DecimalPlaces)));
sb.Append(string.Format("{0:D2}", lane));
if (data.JudgmentStatus == DataStore.JudgmentStatus.Under)
sb.Append("U");
else if (data.JudgmentStatus == DataStore.JudgmentStatus.Pass)
sb.Append("P");
else if (data.JudgmentStatus == DataStore.JudgmentStatus.Over)
sb.Append("O");
else if (data.JudgmentStatus == DataStore.JudgmentStatus.Double)
sb.Append("D");
else
sb.Append("E");
sb.Append(Helper.StringBlankFillDigits6(Helper.DoubleToString(data.Weight, system.DecimalPlaces)));
return sb.ToString();
}
public string Protocol_OPT5(SystemConfigurationItem system, WeightData data, int lane, ProductItem pItem)
{
StringBuilder sb = new StringBuilder();
sb.Append((char)0x02);
sb.Append(this.Protocol_OPT5_NotStxEtx(system, data, lane, pItem));
sb.Append((char)0x03);
return sb.ToString();
}
public byte[] Protocol_Modbus_Client_Write_Common_Data()
{
int index = 0;
byte[] madeData = new byte[40];
byte[] length4Value = new byte[4];
byte[] length2Value = new byte[2];
double underValue = this.Current30000ModbusData.UnderValue; // Helper.StringToWeight(this.Current30000ModbusData.UnderRange, this.SystemConfig.DecimalPlaces);
double passValue = Helper.StringToWeight(this.CurrentProductItem.PassRange, this.SystemConfig.DecimalPlaces);
double overValue = Helper.StringToWeight(this.CurrentProductItem.OverRange, this.SystemConfig.DecimalPlaces);
double tareValue = Helper.StringToWeight(this.CurrentProductItem.TareRange, this.SystemConfig.DecimalPlaces);
double lowLimit = Helper.StringToWeight(this.CurrentFeedbackItem.LowLimit, this.SystemConfig.DecimalPlaces);
double highLimit = Helper.StringToWeight(this.CurrentFeedbackItem.HighLimit, this.SystemConfig.DecimalPlaces);
double deadZoneLow = Helper.StringToWeight((int.Parse(this.CurrentProductItem.PassRange) - int.Parse(this.CurrentFeedbackItem.DeadZone)).ToString(), this.SystemConfig.DecimalPlaces);
double deadZoneHigh = Helper.StringToWeight(this.CurrentProductItem.PassRange + this.CurrentFeedbackItem.DeadZone, this.SystemConfig.DecimalPlaces);
#region 고정 Data(10개, 40 bytes)
// 하한값
length4Value = GetBytes((Single)underValue);
for (int i = 0; i < 4; i++)
madeData[i] = length4Value[3 - i];
// 기준값
length4Value = GetBytes((Single)passValue);
for (int i = 0; i < 4; i++)
madeData[4 + i] = length4Value[3 - i];
// 상한값
length4Value = GetBytes((Single)overValue);
for (int i = 0; i < 4; i++)
madeData[8 + i] = length4Value[3 - i];
// 용기값
length4Value = GetBytes((Single)tareValue);
for (int i = 0; i < 4; i++)
madeData[12 + i] = length4Value[3 - i];
// Feedback - High Limit
length4Value = GetBytes((Single)highLimit);
for (int i = 0; i < 4; i++)
madeData[16 + i] = length4Value[3 - i];
// Feedback - Deadzone High Limit
length4Value = GetBytes((Single)deadZoneHigh);
for (int i = 0; i < 4; i++)
madeData[20 + i] = length4Value[3 - i];
// Feedback - Deadzone Low Limit
length4Value = GetBytes((Single)deadZoneLow);
for (int i = 0; i < 4; i++)
madeData[24 + i] = length4Value[3 - i];
// Feedback - Low Limit
length4Value = GetBytes((Single)lowLimit);
for (int i = 0; i < 4; i++)
madeData[28 + i] = length4Value[3 - i];
// Feedback - Sample Count
length4Value = GetBytes(this.SystemConfig.FeedbackSampleCount);
for (int i = 0; i < 4; i++)
madeData[32 + i] = length4Value[3 - i];
// Feedback - Ignore Count
length4Value = GetBytes(this.SystemConfig.FeedbackIgnorePackages);
for (int i = 0; i < 4; i++)
madeData[36 + i] = length4Value[3 - i];
#endregion
return madeData;
}
public byte[] Protocol_Modbus_Client_Write_Lane_Data(int laneIndex)
{
int index = 0;
byte[] madeData = new byte[32];
byte[] length4Value = new byte[4];
byte[] length2Value = new byte[2];
length2Value = GetBytes(this.Current30000ModbusData.LaneModbusData[laneIndex].Update);
for (int i = 0; i < 2; i++)
madeData[i] = length2Value[1 - i];
length2Value = GetBytes(this.Current30000ModbusData.LaneModbusData[laneIndex].Grade);
for (int i = 0; i < 2; i++)
madeData[2 + i] = length2Value[1 - i];
length4Value = GetBytes((Single)this.Current30000ModbusData.LaneModbusData[laneIndex].Weight);
for (int i = 0; i < 4; i++)
madeData[4 + i] = length4Value[3 - i];
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[laneIndex].UnderCount);
for (int i = 0; i < 4; i++)
madeData[8 + i] = length4Value[3 - i];
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[laneIndex].PassCount);
for (int i = 0; i < 4; i++)
madeData[12 + i] = length4Value[3 - i];
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[laneIndex].OverCount);
for (int i = 0; i < 4; i++)
madeData[16 + i] = length4Value[3 - i];
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[laneIndex].NGCount);
for (int i = 0; i < 4; i++)
madeData[20 + i] = length4Value[3 - i];
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[laneIndex].ExNGCount);
for (int i = 0; i < 4; i++)
madeData[24 + i] = length4Value[3 - i];
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[laneIndex].TotalCount);
for (int i = 0; i < 4; i++)
madeData[28 + i] = length4Value[3 - i];
return madeData;
}
private byte[] Protocol_Modbus_Server_Read_Lane_Data(byte[] readByte)
{
byte[] startAddressByte = new byte[2] { readByte[8], readByte[9] };
byte[] numberOfRegisterByte = new byte[2] { readByte[10], readByte[11] };
int startAddressInt;
int numberOfRegisterInt;
int madeDataIndex = 0;
byte[] length2Value = new byte[2];
byte[] length4Value = new byte[4];
startAddressInt = Modbus.ToBigEndianAndInt(startAddressByte);
numberOfRegisterInt = Modbus.ToBigEndianAndInt(numberOfRegisterByte);
byte[] madeData = new byte[numberOfRegisterInt * 2];
if (readByte[7] == ModbusFunctionCode.FunctionCode_03)
{
#region Read Holding Register(0x03)
for (int j = startAddressInt; j < startAddressInt + numberOfRegisterInt; j++)
{
switch (j)
{
#region Make data
case _40000_ModbusAddress._01_Clear:
length2Value = GetBytes(this.Current40000ModbusData._40011_Clear);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[1 - i];
break;
case _40000_ModbusAddress._02_ClearResult:
length2Value = GetBytes(this.Current40000ModbusData._40012_ClearResult);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[1 - i];
break;
case _40000_ModbusAddress._03_Operation:
length2Value = GetBytes(this.Current40000ModbusData._40013_Operation);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[1 - i];
break;
case _40000_ModbusAddress._04_OperationResult:
length2Value = GetBytes(this.Current40000ModbusData._40014_OperationResult);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[1 - i];
break;
case _40000_ModbusAddress._05_ProductChange_High:
length4Value = GetBytes(this.Current40000ModbusData._40015_ProductChange);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case _40000_ModbusAddress._06_ProductChange_Low:
length4Value = GetBytes(this.Current40000ModbusData._40015_ProductChange);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case _40000_ModbusAddress._07_ProductChangeResult:
length2Value = GetBytes(this.Current40000ModbusData._40017_ProductChangeResult);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[1 - i];
break;
case _40000_ModbusAddress._08_UnderRange_High:
length4Value = GetBytes(this.Current40000ModbusData._40018_UnderRange);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case _40000_ModbusAddress._09_UnderRange_Low:
length4Value = GetBytes(this.Current40000ModbusData._40018_UnderRange);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case _40000_ModbusAddress._10_UnderRangeResult:
length2Value = GetBytes(this.Current40000ModbusData._40020_UnderRangeResult);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[1 - i];
break;
case _40000_ModbusAddress._11_PassRange_High:
length4Value = GetBytes(this.Current40000ModbusData._40021_PassRange);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case _40000_ModbusAddress._12_PassRange_Low:
length4Value = GetBytes(this.Current40000ModbusData._40021_PassRange);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case _40000_ModbusAddress._13_PassRangeResult:
length2Value = GetBytes(this.Current40000ModbusData._40023_PassRangeResult);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[1 - i];
break;
case _40000_ModbusAddress._14_OverRange_High:
length4Value = GetBytes(this.Current40000ModbusData._40024_OverRange);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case _40000_ModbusAddress._15_OverRange_Low:
length4Value = GetBytes(this.Current40000ModbusData._40024_OverRange);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case _40000_ModbusAddress._16_OverRangeResult:
length2Value = GetBytes(this.Current40000ModbusData._40026_OverRangeResult);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[1 - i];
break;
case _40000_ModbusAddress._17_TareWeight_High:
length4Value = GetBytes(this.Current40000ModbusData._40027_TareWeight);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case _40000_ModbusAddress._18_TareWeight_Low:
length4Value = GetBytes(this.Current40000ModbusData._40027_TareWeight);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case _40000_ModbusAddress._19_TareWeightResult:
length2Value = GetBytes(this.Current40000ModbusData._40029_TareWeightResult);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[1 - i];
break;
default:
break;
#endregion
}
madeDataIndex += 2;
}
#endregion
}
else if (readByte[7] == ModbusFunctionCode.FunctionCode_04)
{
#region Read Input Register(0x04)
double underValue = this.Current30000ModbusData.UnderValue;
double passValue = this.Current30000ModbusData.PassValue;
double overValue = this.Current30000ModbusData.OverValue;
double tareValue = this.Current30000ModbusData.TareValue;
double lowLimit = this.Current30000ModbusData.LowLimit;
double highLimit = this.Current30000ModbusData.HighLimit;
double deadZoneLow = this.Current30000ModbusData.DeadZoneLowLimit;
double deadZoneHigh = this.Current30000ModbusData.DeadZoneHighLimit;
int equipmentStatus;
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
equipmentStatus = 1;
else
equipmentStatus = 0;
for (int j = startAddressInt; j < startAddressInt + numberOfRegisterInt; j++)
{
switch (j)
{
#region Common data
case (int)DataStore._30000_Modbus.UnderRange_High:
length4Value = GetBytes((Single)underValue);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus.UnderRange_Low:
length4Value = GetBytes((Single)underValue);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus.PassRange_High:
length4Value = GetBytes((Single)passValue);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus.PassRange_Low:
length4Value = GetBytes((Single)passValue);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus.OverRange_High:
length4Value = GetBytes((Single)overValue);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus.OverRange_Low:
length4Value = GetBytes((Single)overValue);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus.TareRange_High:
length4Value = GetBytes((Single)tareValue);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus.TareRange_Low:
length4Value = GetBytes((Single)tareValue);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus.HighLimit_High:
length4Value = GetBytes((Single)highLimit);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus.HighLimit_Low:
length4Value = GetBytes((Single)highLimit);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus.DeadZoneHighLimit_High:
length4Value = GetBytes((Single)deadZoneHigh);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus.DeadZoneHighLimit_Low:
length4Value = GetBytes((Single)deadZoneHigh);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus.DeadZoneLowLimit_High:
length4Value = GetBytes((Single)deadZoneLow);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus.DeadZoneLowLimit_Low:
length4Value = GetBytes((Single)deadZoneLow);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus.LowLimit_High:
length4Value = GetBytes((Single)lowLimit);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus.LowLimit_Low:
length4Value = GetBytes((Single)lowLimit);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus.SampleCount_High:
length4Value = GetBytes(this.SystemConfig.FeedbackSampleCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus.SampleCount_Low:
length4Value = GetBytes(this.SystemConfig.FeedbackSampleCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus.IgnoreCount_High:
length4Value = GetBytes(this.SystemConfig.FeedbackIgnorePackages);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus.IgnoreCount_Low:
length4Value = GetBytes(this.SystemConfig.FeedbackIgnorePackages);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
#endregion
#region #1
case (int)DataStore._30000_Modbus._1_Update:
length2Value = GetBytes(this.Current30000ModbusData.LaneModbusData[0].Update);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[1 - i];
break;
case (int)DataStore._30000_Modbus._1_Grade:
length2Value = GetBytes(this.Current30000ModbusData.LaneModbusData[0].Grade);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[1 - i];
break;
case (int)DataStore._30000_Modbus._1_Weight_High:
if (this.EquipmentStatus == DataStore.EquipmentStatus.Stop)
length4Value = GetBytes((Single)0.0);
else
length4Value = GetBytes((Single)this.Current30000ModbusData.LaneModbusData[0].Weight);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._1_Weight_Low:
if (this.EquipmentStatus == DataStore.EquipmentStatus.Stop)
length4Value = GetBytes((Single)0.0);
else
length4Value = GetBytes((Single)this.Current30000ModbusData.LaneModbusData[0].Weight);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._1_UnderCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[0].UnderCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._1_UnderCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[0].UnderCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._1_PassCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[0].PassCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._1_PassCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[0].PassCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._1_OverCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[0].OverCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._1_OverCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[0].OverCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._1_NGCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[0].NGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._1_NgCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[0].NGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._1_ExNGCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[0].ExNGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._1_ExNgCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[0].ExNGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._1_TotalCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[0].TotalCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._1_TotalCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[0].TotalCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
#endregion
#region #2
case (int)DataStore._30000_Modbus._2_Update:
length2Value = GetBytes(this.Current30000ModbusData.LaneModbusData[1].Update);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[1 - i];
break;
case (int)DataStore._30000_Modbus._2_Grade:
length2Value = GetBytes(this.Current30000ModbusData.LaneModbusData[1].Grade);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[1 - i];
break;
case (int)DataStore._30000_Modbus._2_Weight_High:
if (this.EquipmentStatus == DataStore.EquipmentStatus.Stop)
length4Value = GetBytes((Single)0.0);
else
length4Value = GetBytes((Single)this.Current30000ModbusData.LaneModbusData[1].Weight);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._2_Weight_Low:
if (this.EquipmentStatus == DataStore.EquipmentStatus.Stop)
length4Value = GetBytes((Single)0.0);
else
length4Value = GetBytes((Single)this.Current30000ModbusData.LaneModbusData[1].Weight);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._2_UnderCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[1].UnderCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._2_UnderCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[1].UnderCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._2_PassCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[1].PassCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._2_PassCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[1].PassCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._2_OverCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[1].OverCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._2_OverCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[1].OverCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._2_NGCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[1].NGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._2_NgCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[1].NGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._2_ExNGCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[1].ExNGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._2_ExNgCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[1].ExNGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._2_TotalCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[1].TotalCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._2_TotalCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[1].TotalCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
#endregion
#region #3
case (int)DataStore._30000_Modbus._3_Update:
length2Value = GetBytes(this.Current30000ModbusData.LaneModbusData[2].Update);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[1 - i];
break;
case (int)DataStore._30000_Modbus._3_Grade:
length2Value = GetBytes(this.Current30000ModbusData.LaneModbusData[2].Grade);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[1 - i];
break;
case (int)DataStore._30000_Modbus._3_Weight_High:
if (this.EquipmentStatus == DataStore.EquipmentStatus.Stop)
length4Value = GetBytes((Single)0.0);
else
length4Value = GetBytes((Single)this.Current30000ModbusData.LaneModbusData[2].Weight);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._3_Weight_Low:
if (this.EquipmentStatus == DataStore.EquipmentStatus.Stop)
length4Value = GetBytes((Single)0.0);
else
length4Value = GetBytes((Single)this.Current30000ModbusData.LaneModbusData[2].Weight);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._3_UnderCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[2].UnderCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._3_UnderCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[2].UnderCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._3_PassCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[2].PassCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._3_PassCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[2].PassCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._3_OverCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[2].OverCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._3_OverCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[2].OverCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._3_NGCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[2].NGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._3_NgCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[2].NGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._3_ExNGCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[2].ExNGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._3_ExNgCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[2].ExNGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._3_TotalCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[2].TotalCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._3_TotalCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[2].TotalCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
#endregion
#region #4
case (int)DataStore._30000_Modbus._4_Update:
length2Value = GetBytes(this.Current30000ModbusData.LaneModbusData[3].Update);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[1 - i];
break;
case (int)DataStore._30000_Modbus._4_Grade:
length2Value = GetBytes(this.Current30000ModbusData.LaneModbusData[3].Grade);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[1 - i];
break;
case (int)DataStore._30000_Modbus._4_Weight_High:
if (this.EquipmentStatus == DataStore.EquipmentStatus.Stop)
length4Value = GetBytes((Single)0.0);
else
length4Value = GetBytes((Single)this.Current30000ModbusData.LaneModbusData[3].Weight);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._4_Weight_Low:
if (this.EquipmentStatus == DataStore.EquipmentStatus.Stop)
length4Value = GetBytes((Single)0.0);
else
length4Value = GetBytes((Single)this.Current30000ModbusData.LaneModbusData[3].Weight);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._4_UnderCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[3].UnderCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._4_UnderCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[3].UnderCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._4_PassCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[3].PassCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._4_PassCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[3].PassCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._4_OverCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[3].OverCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._4_OverCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[3].OverCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._4_NGCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[3].NGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._4_NgCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[3].NGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._4_ExNGCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[3].ExNGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._4_ExNgCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[3].ExNGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._4_TotalCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[3].TotalCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._4_TotalCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[3].TotalCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
#endregion
#region #5
case (int)DataStore._30000_Modbus._5_Update:
length2Value = GetBytes(this.Current30000ModbusData.LaneModbusData[4].Update);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[1 - i];
break;
case (int)DataStore._30000_Modbus._5_Grade:
length2Value = GetBytes(this.Current30000ModbusData.LaneModbusData[4].Grade);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[1 - i];
break;
case (int)DataStore._30000_Modbus._5_Weight_High:
if (this.EquipmentStatus == DataStore.EquipmentStatus.Stop)
length4Value = GetBytes((Single)0.0);
else
length4Value = GetBytes((Single)this.Current30000ModbusData.LaneModbusData[4].Weight);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._5_Weight_Low:
if (this.EquipmentStatus == DataStore.EquipmentStatus.Stop)
length4Value = GetBytes((Single)0.0);
else
length4Value = GetBytes((Single)this.Current30000ModbusData.LaneModbusData[4].Weight);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._5_UnderCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[4].UnderCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._5_UnderCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[4].UnderCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._5_PassCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[4].PassCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._5_PassCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[4].PassCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._5_OverCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[4].OverCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._5_OverCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[4].OverCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._5_NGCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[4].NGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._5_NgCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[4].NGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._5_ExNGCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[4].ExNGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._5_ExNgCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[4].ExNGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._5_TotalCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[4].TotalCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._5_TotalCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[4].TotalCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
#endregion
#region #6
case (int)DataStore._30000_Modbus._6_Update:
length2Value = GetBytes(this.Current30000ModbusData.LaneModbusData[5].Update);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[1 - i];
break;
case (int)DataStore._30000_Modbus._6_Grade:
length2Value = GetBytes(this.Current30000ModbusData.LaneModbusData[5].Grade);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[1 - i];
break;
case (int)DataStore._30000_Modbus._6_Weight_High:
if (this.EquipmentStatus == DataStore.EquipmentStatus.Stop)
length4Value = GetBytes((Single)0.0);
else
length4Value = GetBytes((Single)this.Current30000ModbusData.LaneModbusData[5].Weight);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._6_Weight_Low:
if (this.EquipmentStatus == DataStore.EquipmentStatus.Stop)
length4Value = GetBytes((Single)0.0);
else
length4Value = GetBytes((Single)this.Current30000ModbusData.LaneModbusData[5].Weight);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._6_UnderCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[5].UnderCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._6_UnderCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[5].UnderCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._6_PassCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[5].PassCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._6_PassCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[5].PassCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._6_OverCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[5].OverCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._6_OverCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[5].OverCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._6_NGCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[5].NGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._6_NgCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[5].NGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._6_ExNGCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[5].ExNGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._6_ExNgCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[5].ExNGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._6_TotalCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[5].TotalCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._6_TotalCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[5].TotalCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
#endregion
#region #7
case (int)DataStore._30000_Modbus._7_Update:
length2Value = GetBytes(this.Current30000ModbusData.LaneModbusData[6].Update);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[1 - i];
break;
case (int)DataStore._30000_Modbus._7_Grade:
length2Value = GetBytes(this.Current30000ModbusData.LaneModbusData[6].Grade);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[1 - i];
break;
case (int)DataStore._30000_Modbus._7_Weight_High:
if (this.EquipmentStatus == DataStore.EquipmentStatus.Stop)
length4Value = GetBytes((Single)0.0);
else
length4Value = GetBytes((Single)this.Current30000ModbusData.LaneModbusData[6].Weight);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._7_Weight_Low:
if (this.EquipmentStatus == DataStore.EquipmentStatus.Stop)
length4Value = GetBytes((Single)0.0);
else
length4Value = GetBytes((Single)this.Current30000ModbusData.LaneModbusData[6].Weight);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._7_UnderCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[6].UnderCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._7_UnderCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[6].UnderCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._7_PassCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[6].PassCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._7_PassCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[6].PassCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._7_OverCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[6].OverCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._7_OverCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[6].OverCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._7_NGCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[6].NGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._7_NgCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[6].NGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._7_ExNGCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[6].ExNGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._7_ExNgCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[6].ExNGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._7_TotalCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[6].TotalCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._7_TotalCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[6].TotalCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
#endregion
#region #8
case (int)DataStore._30000_Modbus._8_Update:
length2Value = GetBytes(this.Current30000ModbusData.LaneModbusData[7].Update);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[1 - i];
break;
case (int)DataStore._30000_Modbus._8_Grade:
length2Value = GetBytes(this.Current30000ModbusData.LaneModbusData[7].Grade);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[1 - i];
break;
case (int)DataStore._30000_Modbus._8_Weight_High:
if (this.EquipmentStatus == DataStore.EquipmentStatus.Stop)
length4Value = GetBytes((Single)0.0);
else
length4Value = GetBytes((Single)this.Current30000ModbusData.LaneModbusData[7].Weight);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._8_Weight_Low:
if (this.EquipmentStatus == DataStore.EquipmentStatus.Stop)
length4Value = GetBytes((Single)0.0);
else
length4Value = GetBytes((Single)this.Current30000ModbusData.LaneModbusData[7].Weight);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._8_UnderCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[7].UnderCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._8_UnderCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[7].UnderCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._8_PassCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[7].PassCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._8_PassCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[7].PassCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._8_OverCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[7].OverCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._8_OverCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[7].OverCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._8_NGCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[7].NGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._8_NgCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[7].NGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._8_ExNGCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[7].ExNGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._8_ExNgCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[7].ExNGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._8_TotalCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[7].TotalCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._8_TotalCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[7].TotalCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
#endregion
#region #9
case (int)DataStore._30000_Modbus._9_Update:
length2Value = GetBytes(this.Current30000ModbusData.LaneModbusData[8].Update);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[1 - i];
break;
case (int)DataStore._30000_Modbus._9_Grade:
length2Value = GetBytes(this.Current30000ModbusData.LaneModbusData[8].Grade);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[1 - i];
break;
case (int)DataStore._30000_Modbus._9_Weight_High:
if (this.EquipmentStatus == DataStore.EquipmentStatus.Stop)
length4Value = GetBytes((Single)0.0);
else
length4Value = GetBytes((Single)this.Current30000ModbusData.LaneModbusData[8].Weight);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._9_Weight_Low:
if (this.EquipmentStatus == DataStore.EquipmentStatus.Stop)
length4Value = GetBytes((Single)0.0);
else
length4Value = GetBytes((Single)this.Current30000ModbusData.LaneModbusData[8].Weight);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._9_UnderCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[8].UnderCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._9_UnderCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[8].UnderCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._9_PassCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[8].PassCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._9_PassCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[8].PassCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._9_OverCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[8].OverCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._9_OverCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[8].OverCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._9_NGCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[8].NGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._9_NgCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[8].NGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._9_ExNGCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[8].ExNGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._9_ExNgCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[8].ExNGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._9_TotalCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[8].TotalCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._9_TotalCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[8].TotalCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
#endregion
#region #10
case (int)DataStore._30000_Modbus._10_Update:
length2Value = GetBytes(this.Current30000ModbusData.LaneModbusData[9].Update);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[1 - i];
break;
case (int)DataStore._30000_Modbus._10_Grade:
length2Value = GetBytes(this.Current30000ModbusData.LaneModbusData[9].Grade);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[1 - i];
break;
case (int)DataStore._30000_Modbus._10_Weight_High:
if (this.EquipmentStatus == DataStore.EquipmentStatus.Stop)
length4Value = GetBytes((Single)0.0);
else
length4Value = GetBytes((Single)this.Current30000ModbusData.LaneModbusData[9].Weight);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._10_Weight_Low:
if (this.EquipmentStatus == DataStore.EquipmentStatus.Stop)
length4Value = GetBytes((Single)0.0);
else
length4Value = GetBytes((Single)this.Current30000ModbusData.LaneModbusData[9].Weight);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._10_UnderCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[9].UnderCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._10_UnderCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[9].UnderCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._10_PassCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[9].PassCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._10_PassCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[9].PassCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._10_OverCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[9].OverCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._10_OverCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[9].OverCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._10_NGCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[9].NGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._10_NgCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[9].NGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._10_ExNGCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[9].ExNGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._10_ExNgCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[9].ExNGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._10_TotalCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[9].TotalCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._10_TotalCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[9].TotalCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
#endregion
#region #11
case (int)DataStore._30000_Modbus._11_Update:
length2Value = GetBytes(this.Current30000ModbusData.LaneModbusData[10].Update);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[1 - i];
break;
case (int)DataStore._30000_Modbus._11_Grade:
length2Value = GetBytes(this.Current30000ModbusData.LaneModbusData[10].Grade);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[1 - i];
break;
case (int)DataStore._30000_Modbus._11_Weight_High:
if (this.EquipmentStatus == DataStore.EquipmentStatus.Stop)
length4Value = GetBytes((Single)0.0);
else
length4Value = GetBytes((Single)this.Current30000ModbusData.LaneModbusData[10].Weight);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._11_Weight_Low:
if (this.EquipmentStatus == DataStore.EquipmentStatus.Stop)
length4Value = GetBytes((Single)0.0);
else
length4Value = GetBytes((Single)this.Current30000ModbusData.LaneModbusData[10].Weight);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._11_UnderCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[10].UnderCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._11_UnderCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[10].UnderCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._11_PassCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[10].PassCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._11_PassCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[10].PassCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._11_OverCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[10].OverCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._11_OverCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[10].OverCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._11_NGCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[10].NGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._11_NgCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[10].NGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._11_ExNGCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[10].ExNGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._11_ExNgCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[10].ExNGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._11_TotalCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[10].TotalCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._11_TotalCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[10].TotalCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
#endregion
#region #12
case (int)DataStore._30000_Modbus._12_Update:
length2Value = GetBytes(this.Current30000ModbusData.LaneModbusData[11].Update);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[1 - i];
break;
case (int)DataStore._30000_Modbus._12_Grade:
length2Value = GetBytes(this.Current30000ModbusData.LaneModbusData[11].Grade);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[1 - i];
break;
case (int)DataStore._30000_Modbus._12_Weight_High:
if (this.EquipmentStatus == DataStore.EquipmentStatus.Stop)
length4Value = GetBytes((Single)0.0);
else
length4Value = GetBytes((Single)this.Current30000ModbusData.LaneModbusData[11].Weight);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._12_Weight_Low:
if (this.EquipmentStatus == DataStore.EquipmentStatus.Stop)
length4Value = GetBytes((Single)0.0);
else
length4Value = GetBytes((Single)this.Current30000ModbusData.LaneModbusData[11].Weight);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._12_UnderCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[11].UnderCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._12_UnderCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[11].UnderCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._12_PassCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[11].PassCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._12_PassCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[11].PassCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._12_OverCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[11].OverCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._12_OverCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[11].OverCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._12_NGCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[11].NGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._12_NgCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[11].NGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._12_ExNGCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[11].ExNGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._12_ExNgCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[11].ExNGCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
case (int)DataStore._30000_Modbus._12_TotalCount_High:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[11].TotalCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[3 - i];
break;
case (int)DataStore._30000_Modbus._12_TotalCount_Low:
length4Value = GetBytes(this.Current30000ModbusData.LaneModbusData[11].TotalCount);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length4Value[1 - i];
break;
#endregion
default:
length2Value = GetBytes(0);
for (int i = 0; i < 2; i++)
madeData[madeDataIndex + i] = length2Value[1 - i];
break;
}
madeDataIndex += 2;
}
#endregion
}
return madeData;
}
#endregion
#region Integrated Transmission
public void IntegratedTransmission(Collection<WeightData> datas)
{
#region ATPC
if (this.SystemConfig.IsAlarmTotalPassCntEnable == true)
{
bool result = this.CurrentAlarmTotalPassCnt.SetCountStic2(datas);
if (result == true)
this.TransferData(CommunicationCommand.AlarmPulseNG, CommunicationID.MainBoard);
this.ChildFormMainDisplay.UpdateAlarmTotalPassCountDisplay(this.CurrentAlarmTotalPassCnt);
}
#endregion
#region COM3
switch (this.SystemConfig.Serial3Mode)
{
case 2:
this.SerialCom3Write(this.Protocol_OPT2_NotStxEtx_1(this.SystemConfig, datas));
break;
case 3:
this.SerialCom3Write(this.Protocol_OPT3_NotStxEtx_1(this.SystemConfig, datas, this.CurrentProductItem));
break;
case 6:
this.SerialCom3Write(this.Protocol_OPT5_NotStxEtx_1(this.SystemConfig, datas, this.CurrentProductItem));
break;
default:
break;
}
#endregion
#region Ethernet
switch (this.SystemConfig.EthernetMode)
{
case 1:
this.SendEthernetData(this.Protocol_OPT2_NotStxEtx_1(this.SystemConfig, datas));
break;
case 2:
this.SendEthernetData(this.Protocol_OPT3_NotStxEtx_1(this.SystemConfig, datas, this.CurrentProductItem));
break;
case 4:
this.SendEthernetData(this.Protocol_OPT5_NotStxEtx_1(this.SystemConfig, datas, this.CurrentProductItem));
break;
default:
break;
}
#endregion
// DataBackup
this.TrackingInspectionData(datas);
}
public void IntegratedTransmissionCheck(Collection<WeightData> datas)
{
int value = 0;
for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++)
{
if (datas[i].IsUpdate == true || datas[i].IsBypassMode == true)
value++;
}
if (value == this.SystemConfig.EquipmentColumns)
{
this.timerTimeOutTransmission.Enabled = false;
this.IntegratedTransmission(datas);
foreach (WeightData data in this.CollectionWeightData)
data.IsUpdate = false;
}
}
#endregion
#region Serial Com3
public void SerialCom3Open()
{
string fullPath = "";
if (this.SystemConfig.Serial3Mode == 1)
{
this.smartSerialPortCom3.ErrorCheckMode = SmartSerialPort.ERRORCHECK.CHECKSUM8;
this.smartSerialPortCom3.ErrorCode_Location = SmartSerialPort.ERRORCODELOCATION.TAIL;
}
else
{
this.smartSerialPortCom3.ErrorCheckMode = SmartSerialPort.ERRORCHECK.NONE;
}
if (this.SystemConfig.Serial3Mode != 0)
{
try
{
switch (this.SystemConfig.Serial3BaudRate)
{
case 0:
this.smartSerialPortCom3.Baud_Rate = SmartSerialPort.BAUDRATE._9600bps;
break;
case 1:
this.smartSerialPortCom3.Baud_Rate = SmartSerialPort.BAUDRATE._19200bps;
break;
case 2:
this.smartSerialPortCom3.Baud_Rate = SmartSerialPort.BAUDRATE._38400bps;
break;
case 3:
this.smartSerialPortCom3.Baud_Rate = SmartSerialPort.BAUDRATE._115200bps;
break;
default:
this.smartSerialPortCom3.Baud_Rate = SmartSerialPort.BAUDRATE._9600bps;
break;
}
if (this.smartSerialPortCom3.IsOpen == false)
this.smartSerialPortCom3.Open();
if (this.SystemConfig.Serial3Mode == 1)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Stop)
this.timerOPT1.Enabled = true;
else
this.timerOPT1.Enabled = false;
}
}
catch
{
}
}
#region Test 용 통신 로그
fullPath = this.PathDataBackupFolder + "COM3log.txt";
this.smartFileCom3Log.FilePathName = fullPath;
//this.IsCom3LogOpen = true;
//this.smartFileCom3Log.Open();
#endregion
}
public void SerialCom3Write(string data)
{
this.smartSerialPortCom3.WriteFrame(data, SmartSerialPort.CODETYPES.ASCIICODE);
if (this.IsCom3LogOpen == true)
this.smartFileCom3Log.WriteString(string.Format("Send ({0:yyyy-MM-dd HH:mm:ss}): {1}", data));
}
private int SerialCom3Write(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.StringZeroFillDigits4(data.Length.ToString()));
sb.Append(address);
sb.Append(data);
chkSum = Helper.Checksumcalculator(sb.ToString());
sb.Append(chkSum);
if (this.smartSerialPortCom3.IsReadStart == true)
this.smartSerialPortCom3.WriteFrame(sb.ToString(), SmartSerialPort.CODETYPES.ASCIICODE);
// 통신 확인 로그
if (this.IsCom3LogOpen == true)
this.smartFileCom3Log.WriteString(string.Format("Send ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, sb.ToString()));
return ret;
}
#region OPT1 - ABFood 통신 피드백
private bool CheckIdABFood(int id)
{
if (this.SystemConfig.UsbID == id)
return true;
else
return false;
}
private int CheckDecimalPlaceABFood(string data)
{
int decimalPlace = 0;
foreach (char c in data)
{
if (c == '.')
decimalPlace++;
}
return decimalPlace;
}
private string CurrentWeightABFood()
{
string weight = "";
StringBuilder sb = new StringBuilder();
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
{
#region START
for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++)
{
if (this.SystemConfig.EquipmentMode == 2)
{
if (this.CollectionWeightData[i].IsUpdate == true)
{
if (this.CollectionWeightData[i].IsADCError == true)
{
sb.Append("E");
weight = Helper.DoubleToString(this.CollectionWeightData[i].Weight, this.SystemConfig.DecimalPlaces);
sb.Append(Helper.StringZeroFillDigits6(weight));
continue;
}
else if (this.CollectionWeightData[i].IsBypassMode)
{
sb.Append("B");
weight = Helper.DoubleToString(this.CollectionWeightData[i].Weight, this.SystemConfig.DecimalPlaces);
sb.Append(Helper.StringZeroFillDigits6(weight));
continue;
}
else if (this.CollectionWeightData[i].JudgmentStatus == DataStore.JudgmentStatus.Under)
{
sb.Append("U");
weight = Helper.DoubleToString(this.CollectionWeightData[i].Weight, this.SystemConfig.DecimalPlaces);
sb.Append(Helper.StringZeroFillDigits6(weight));
continue;
}
else if (this.CollectionWeightData[i].JudgmentStatus == DataStore.JudgmentStatus.Pass)
{
sb.Append("P");
weight = Helper.DoubleToString(this.CollectionWeightData[i].Weight, this.SystemConfig.DecimalPlaces);
sb.Append(Helper.StringZeroFillDigits6(weight));
continue;
}
else if (this.CollectionWeightData[i].JudgmentStatus == DataStore.JudgmentStatus.Over)
{
sb.Append("O");
weight = Helper.DoubleToString(this.CollectionWeightData[i].Weight, this.SystemConfig.DecimalPlaces);
sb.Append(Helper.StringZeroFillDigits6(weight));
continue;
}
}
else
{
sb.Append("E");
//sb.Append(Helper.StringZeroFillDigits6("0"));
weight = Helper.StringToDecimalPlaces("0", this.SystemConfig.DecimalPlaces);
sb.Append(Helper.StringZeroFillDigits6(weight));
}
}
else
{
if (this.CollectionWeightData[i].IsADCError == true)
{
sb.Append("E");
weight = Helper.DoubleToString(this.CollectionWeightData[i].Weight, this.SystemConfig.DecimalPlaces);
sb.Append(Helper.StringZeroFillDigits6(weight));
continue;
}
else if (this.CollectionWeightData[i].IsBypassMode)
{
sb.Append("B");
weight = Helper.DoubleToString(this.CollectionWeightData[i].Weight, this.SystemConfig.DecimalPlaces);
sb.Append(Helper.StringZeroFillDigits6(weight));
continue;
}
else if (this.CollectionWeightData[i].JudgmentStatus == DataStore.JudgmentStatus.Under)
{
sb.Append("U");
weight = Helper.DoubleToString(this.CollectionWeightData[i].Weight, this.SystemConfig.DecimalPlaces);
sb.Append(Helper.StringZeroFillDigits6(weight));
continue;
}
else if (this.CollectionWeightData[i].JudgmentStatus == DataStore.JudgmentStatus.Pass)
{
sb.Append("P");
weight = Helper.DoubleToString(this.CollectionWeightData[i].Weight, this.SystemConfig.DecimalPlaces);
sb.Append(Helper.StringZeroFillDigits6(weight));
continue;
}
else if (this.CollectionWeightData[i].JudgmentStatus == DataStore.JudgmentStatus.Over)
{
sb.Append("O");
weight = Helper.DoubleToString(this.CollectionWeightData[i].Weight, this.SystemConfig.DecimalPlaces);
sb.Append(Helper.StringZeroFillDigits6(weight));
continue;
}
else
{
sb.Append("R");
weight = Helper.DoubleToString(this.CollectionWeightData[i].Weight, this.SystemConfig.DecimalPlaces);
sb.Append(Helper.StringZeroFillDigits6(weight));
continue;
}
}
}
foreach (WeightData data in this.CollectionWeightData)
data.IsUpdate = false;
#endregion
}
else
{
#region STOP
for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++)
{
if (this.CollectionWeightData[i].IsADCError == true)
{
sb.Append("E");
weight = Helper.DoubleToString(this.CollectionWeightData[i].Weight, this.SystemConfig.DecimalPlaces);
sb.Append(Helper.StringZeroFillDigits6(weight));
continue;
}
else if (this.CollectionWeightData[i].IsBypassMode)
{
sb.Append("B");
weight = Helper.DoubleToString(this.CollectionWeightData[i].Weight, this.SystemConfig.DecimalPlaces);
sb.Append(Helper.StringZeroFillDigits6(weight));
continue;
}
else
{
sb.Append("R");
weight = Helper.DoubleToString(this.CollectionWeightData[i].Weight, this.SystemConfig.DecimalPlaces);
sb.Append(Helper.StringZeroFillDigits6(weight));
continue;
}
}
#endregion
}
return sb.ToString();
}
private void UartCom3ReceiveDataABFood()
{
int ret = 0;
string strTemp = "";
byte[] readByte;
StringBuilder sb = new StringBuilder();
SmartSerialPort.FRAMEDATAREADSTATUS receiveDataState = SmartSerialPort.FRAMEDATAREADSTATUS.EMPTY;
receiveDataState = this.smartSerialPortCom3.ReadQueue(out readByte);
strTemp = Encoding.Default.GetString(readByte, 0, readByte.Length);
if ((receiveDataState == SmartSerialPort.FRAMEDATAREADSTATUS.EMPTY) || (receiveDataState == SmartSerialPort.FRAMEDATAREADSTATUS.FAILDATA))
{
//this.UartCom3TransferDataABFood(ABFoodCommunicationCommand.WeightData, (int)DataStore.ABFoodDataStatus.ReceivedDataError);
this.UartCom3TransferDataABFood(DataStore.ABFoodDataCommand.Normal, (int)DataStore.ABFoodDataStatus.ReceivedDataError);
return;
}
if (this.IsCom3LogOpen == true)
this.smartFileCom3Log.WriteString(string.Format("Receive ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, strTemp.ToString()));
try
{
switch (strTemp[2])
{
case 'M':
if ((ret = this.UartCom3ReceiveCommamdM(strTemp)) != 0)
return;
break;
case 'P':
if ((ret = this.UartCom3ReceiveCommandP(strTemp)) != 0)
return;
break;
case 'R':
//if ((ret = this.UartCom3ReceiveCommandR(strTemp)) != 0)
// return;
break;
default:
break;
}
}
catch
{
}
}
private void UartCom3TransferDataABFood(DataStore.ABFoodDataCommand cmd, int dataStatus)
{
string value = "", command = "";
StringBuilder sb = new StringBuilder();
switch (cmd)
{
case DataStore.ABFoodDataCommand.Normal:
command = "W0";
break;
case DataStore.ABFoodDataCommand.ModifySetting:
this.timerOPT1.Enabled = false;
command = "M0";
break;
case DataStore.ABFoodDataCommand.ProductNumberChange:
this.timerOPT1.Enabled = false;
command = "P0";
break;
default:
break;
}
sb.Append(Helper.StringZeroFillDigits2(this.SystemConfig.UsbID.ToString())); // ID
sb.Append(command); // CMD
sb.Append(dataStatus); // DATA STATUS
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start) // EQUIPMENT STATUS
sb.Append("S");
else
sb.Append("T");
if (this.SystemConfig.ProductNumber < 100) // PRODUCT NUMBER
sb.Append(Helper.StringZeroFillDigits2(this.SystemConfig.ProductNumber.ToString()));
else
sb.Append("99");
value = Helper.StringToDecimalPlaces(this.CurrentProductItem.UnderRange, this.SystemConfig.DecimalPlaces);
sb.Append(Helper.StringZeroFillDigits6(value)); // UNDER RANGE
value = Helper.StringToDecimalPlaces(this.CurrentProductItem.PassRange, this.SystemConfig.DecimalPlaces);
sb.Append(Helper.StringZeroFillDigits6(value)); // PASS RANGE
value = Helper.StringToDecimalPlaces(this.CurrentProductItem.OverRange, this.SystemConfig.DecimalPlaces);
sb.Append(Helper.StringZeroFillDigits6(value)); // OVER RANGE
sb.Append(this.CurrentWeightABFood()); // WEIGHT 7*Equipment Column
if (this.smartSerialPortCom3.IsOpen == true)
{
this.smartSerialPortCom3.WriteFrame(sb.ToString(), SmartSerialPort.CODETYPES.ASCIICODE);
if (this.IsCom3LogOpen == true)
this.smartFileCom3Log.WriteString(string.Format("Send ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, sb.ToString()));
}
foreach (WeightData data in this.CollectionWeightData)
data.IsUpdate = false;
if (this.EquipmentStatus == DataStore.EquipmentStatus.Stop)
{
if (this.timerOPT1.Enabled == false)
this.timerOPT1.Enabled = true;
}
}
private int UartCom3ReceiveCommamdM(string strTemp)
{
int ret = 0, decimalPlaceUnder = 0, decimalPlacePass = 0, decimalPlaceOver = 0;
double underRange = 0.0, passRange = 0.0, OverRange = 0.0;
string value = "";
StringBuilder sb = new StringBuilder();
// ID Check
try
{
if (this.CheckIdABFood(int.Parse(strTemp.Substring(0, 2))) == false)
{
//this.UartCom3TransferDataABFood(ABFoodCommunicationCommand.ModifySetting, (int)DataStore.ABFoodDataStatus.IDError);
this.UartCom3TransferDataABFood(DataStore.ABFoodDataCommand.ModifySetting, (int)DataStore.ABFoodDataStatus.IDError);
return ret = -1;
}
}
catch
{
//this.UartCom3TransferDataABFood(ABFoodCommunicationCommand.ModifySetting, (int)DataStore.ABFoodDataStatus.IDError);
this.UartCom3TransferDataABFood(DataStore.ABFoodDataCommand.ModifySetting, (int)DataStore.ABFoodDataStatus.IDError);
return ret = -1;
}
// 품번 Check
try
{
if (int.Parse(strTemp.Substring(5, 2)) != this.SystemConfig.ProductNumber)
{
//this.UartCom3TransferDataABFood(ABFoodCommunicationCommand.ModifySetting, (int)DataStore.ABFoodDataStatus.ProductNumberError);
this.UartCom3TransferDataABFood(DataStore.ABFoodDataCommand.ModifySetting, (int)DataStore.ABFoodDataStatus.ProductNumberError);
return ret = -1;
}
}
catch
{
//this.UartCom3TransferDataABFood(ABFoodCommunicationCommand.ModifySetting, (int)DataStore.ABFoodDataStatus.ProductNumberError);
this.UartCom3TransferDataABFood(DataStore.ABFoodDataCommand.ModifySetting, (int)DataStore.ABFoodDataStatus.ProductNumberError);
return ret = -1;
}
// 설정값 Check
try
{
// 소수점 Check
decimalPlaceUnder = this.CheckDecimalPlaceABFood(strTemp.Substring(7, 6));
decimalPlacePass = this.CheckDecimalPlaceABFood(strTemp.Substring(13, 6));
decimalPlaceOver = this.CheckDecimalPlaceABFood(strTemp.Substring(19, 6));
if ((decimalPlaceUnder != this.SystemConfig.DecimalPlaces) || (decimalPlacePass != this.SystemConfig.DecimalPlaces) ||
(decimalPlaceOver != this.SystemConfig.DecimalPlaces))
{
//this.UartCom3TransferDataABFood(ABFoodCommunicationCommand.ModifySetting, (int)DataStore.ABFoodDataStatus.SettingError);
this.UartCom3TransferDataABFood(DataStore.ABFoodDataCommand.ModifySetting, (int)DataStore.ABFoodDataStatus.SettingError);
return ret = -1;
}
// Range Check
underRange = double.Parse(strTemp.Substring(7, 6));
passRange = double.Parse(strTemp.Substring(13, 6));
OverRange = double.Parse(strTemp.Substring(19, 6));
if ((underRange < 0) || (underRange > passRange) || (underRange > OverRange) || (OverRange < passRange) || (OverRange == passRange))
{
//this.UartCom3TransferDataABFood(ABFoodCommunicationCommand.ModifySetting, (int)DataStore.ABFoodDataStatus.SettingError);
this.UartCom3TransferDataABFood(DataStore.ABFoodDataCommand.ModifySetting, (int)DataStore.ABFoodDataStatus.SettingError);
return ret = -1;
}
value = Helper.DoubleToString(underRange, this.SystemConfig.DecimalPlaces);
this.CurrentProductItem.UnderRange = value.Replace(".", "");
value = Helper.DoubleToString(passRange, this.SystemConfig.DecimalPlaces);
this.CurrentProductItem.PassRange = value.Replace(".", "");
value = Helper.DoubleToString(OverRange, this.SystemConfig.DecimalPlaces);
this.CurrentProductItem.OverRange = value.Replace(".", "");
sb.Append(Helper.StringZeroFillDigits7(this.CurrentProductItem.UnderRange));
sb.Append(Helper.StringZeroFillDigits7(this.CurrentProductItem.OverRange));
sb.Append(Helper.StringZeroFillDigits7(this.CurrentProductItem.TareRange));
this.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._9003_ParameterWeightRange, sb.ToString());
this.SaveProductFile(this.CurrentProductItem, this.SystemConfig.ProductNumber - 1);
this.ChildFormMainDisplay.UpdateCurrentProductDisplay(this.EquipmentStatus, this.CurrentProductItem, this.CurrentJudgmentSetItem, this.CollectionWeightData);
this.ChildFormMainDisplay.RescaleControl();
//this.UartCom3TransferDataABFood(ABFoodCommunicationCommand.ModifySetting, (int)DataStore.ABFoodDataStatus.Normal);
this.UartCom3TransferDataABFood(DataStore.ABFoodDataCommand.ModifySetting, (int)DataStore.ABFoodDataStatus.Normal);
}
catch
{
//this.UartCom3TransferDataABFood(ABFoodCommunicationCommand.ModifySetting, (int)DataStore.ABFoodDataStatus.SettingError);
this.UartCom3TransferDataABFood(DataStore.ABFoodDataCommand.ModifySetting, (int)DataStore.ABFoodDataStatus.SettingError);
return ret = -1;
}
return ret;
}
private int UartCom3ReceiveCommandP(string strTemp)
{
int ret = 0, no = 0;
// 운전 중이면 품번 변경 X
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
{
//this.UartCom3TransferDataABFood(ABFoodCommunicationCommand.ProductNumberChange, (int)DataStore.ABFoodDataStatus.SettingError);
this.UartCom3TransferDataABFood(DataStore.ABFoodDataCommand.ProductNumberChange, (int)DataStore.ABFoodDataStatus.SettingError);
return ret = -1;
}
// ID Check
try
{
if (this.CheckIdABFood(int.Parse(strTemp.Substring(0, 2))) == false)
{
//this.UartCom3TransferDataABFood(ABFoodCommunicationCommand.ProductNumberChange, (int)DataStore.ABFoodDataStatus.IDError);
this.UartCom3TransferDataABFood(DataStore.ABFoodDataCommand.ProductNumberChange, (int)DataStore.ABFoodDataStatus.IDError);
return ret = -1;
}
}
catch
{
//this.UartCom3TransferDataABFood(ABFoodCommunicationCommand.ProductNumberChange, (int)DataStore.ABFoodDataStatus.IDError);
this.UartCom3TransferDataABFood(DataStore.ABFoodDataCommand.ProductNumberChange, (int)DataStore.ABFoodDataStatus.IDError);
return ret = -1;
}
// 품번 Check
try
{
no = int.Parse(strTemp.Substring(5, 2));
if (no == this.SystemConfig.ProductNumber)
{
//this.UartCom3TransferDataABFood(ABFoodCommunicationCommand.ProductNumberChange, (int)DataStore.ABFoodDataStatus.Normal);
this.UartCom3TransferDataABFood(DataStore.ABFoodDataCommand.ProductNumberChange, (int)DataStore.ABFoodDataStatus.Normal);
return ret;
}
else if (no <= 0 || no > 99)
{
//this.UartCom3TransferDataABFood(ABFoodCommunicationCommand.ProductNumberChange, (int)DataStore.ABFoodDataStatus.SettingError);
this.UartCom3TransferDataABFood(DataStore.ABFoodDataCommand.ProductNumberChange, (int)DataStore.ABFoodDataStatus.SettingError);
return ret = -1;
}
else
{
this.ChildFormMainDisplay.ProductChange(no);
//this.UartCom3TransferDataABFood(ABFoodCommunicationCommand.ProductNumberChange, (int)DataStore.ABFoodDataStatus.Normal);
this.UartCom3TransferDataABFood(DataStore.ABFoodDataCommand.ProductNumberChange, (int)DataStore.ABFoodDataStatus.Normal);
return ret;
}
}
catch
{
//this.UartCom3TransferDataABFood(ABFoodCommunicationCommand.ProductNumberChange, (int)DataStore.ABFoodDataStatus.SettingError);
this.UartCom3TransferDataABFood(DataStore.ABFoodDataCommand.ProductNumberChange, (int)DataStore.ABFoodDataStatus.SettingError);
return ret = -1;
}
return ret;
}
public void UartCom3WeightDataTransfer(Collection<WeightData> datas)
{
int value = 0;
for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++)
{
if (datas[i].IsUpdate == true || datas[i].IsBypassMode == true)
value++;
}
if (value == this.SystemConfig.EquipmentColumns)
{
this.timerTimeoutOPT1.Enabled = false;
//this.UartCom3TransferDataABFood(ABFoodCommunicationCommand.WeightData, (int)DataStore.ABFoodDataStatus.Normal);
this.UartCom3TransferDataABFood(DataStore.ABFoodDataCommand.Normal, (int)DataStore.ABFoodDataStatus.Normal);
}
}
#endregion
#region OPT2 - 중량 데이터 피드백
public void SerialCH3OPT2(int lane, WeightData data)
{
this.SerialCom3Write(this.Protocol_OPT2_NotStxEtx(this.SystemConfig, data, lane));
}
public void SerialCH3OPT2(Collection<WeightData> datas)
{
this.SerialCom3Write(this.Protocol_OPT2_NotStxEtx_1(this.SystemConfig, datas));
}
#endregion
#region OPT3 - 중량 데이터 피드백 (기준설정값 포함)
public void SerialCH3OPT3(int lane, WeightData data)
{
this.SerialCom3Write(this.Protocol_OPT3_NotStxEtx(this.SystemConfig, data, lane, this.CurrentProductItem));
}
public void SerialCH3OPT3(Collection<WeightData> datas)
{
this.SerialCom3Write(this.Protocol_OPT3_NotStxEtx_1(this.SystemConfig, datas, this.CurrentProductItem));
}
#endregion
#region OPT4 - 피드백 시스템 (보드 사용)
private void UartCom3ReceiveDataFeedbackBoard()
{
int ret = 0;
string strTemp = "";
byte[] readByte;
StringBuilder sb = new StringBuilder();
SmartSerialPort.FRAMEDATAREADSTATUS receiveDataState = SmartSerialPort.FRAMEDATAREADSTATUS.EMPTY;
receiveDataState = this.smartSerialPortCom3.ReadQueue(out readByte);
strTemp = Encoding.Default.GetString(readByte, 0, readByte.Length);
if ((receiveDataState == SmartSerialPort.FRAMEDATAREADSTATUS.EMPTY) || (receiveDataState == SmartSerialPort.FRAMEDATAREADSTATUS.FAILDATA))
{
return;
}
try
{
switch (strTemp[7])
{
case 'C':
if ((ret = this.UartCom3ReceiveFeedbackBoardCommamdC(strTemp)) != 0)
return;
break;
case 'P':
if ((ret = this.UartCom3ReceiveFeedbackBoardCommamdP(strTemp)) != 0)
return;
break;
default:
break;
}
}
catch
{
}
}
private int UartCom3ReceiveFeedbackBoardCommamdC(string strTemp)
{
int ret = 0;
string cmd = "";
if (this.Checksumcalculator(strTemp) == false)
{
// 로그
if (this.IsCom3LogOpen == true)
this.smartFileCom3Log.WriteString(string.Format("Receive ({0:yyyy-MM-dd HH:mm:ss}): {1} : Receive Command Data CHKSUM Error", DateTime.Now, strTemp));
return ret = -1;
}
// 로그
if (this.IsCom3LogOpen == true)
this.smartFileCom3Log.WriteString(string.Format("Receive ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, strTemp));
cmd = strTemp.Substring(0, 3);
switch (cmd)
{
case "CI0":
this.timerTimeoutOPT4_OnlineCheck.Enabled = false;
this.UartCom3FeedbackBoardBooting();
break;
case "CT0":
this.timerTimeoutOPT4_OnlineCheck.Enabled = false;
this.ChildFormMainDisplay.UpdateFeedbackBoardStatusDisplay(true);
this.timerTimeoutOPT4_OnlineCheck.Enabled = true;
break;
default:
break;
}
return ret;
}
private int UartCom3ReceiveFeedbackBoardCommamdP(string strTemp)
{
int ret = 0;
string cmd = "", address = "", lane = "", receiveData = "";
// SIZE 확인
if (this.SizeCheck("P", strTemp) == false)
{
// 로그
if (this.IsCom3LogOpen == true)
this.smartFileCom3Log.WriteString(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.Checksumcalculator(strTemp) == false)
{
// 로그
if (this.IsCom3LogOpen == true)
this.smartFileCom3Log.WriteString(string.Format("Receive ({0:yyyy-MM-dd HH:mm:ss}): {1} : Receive Stream Data CHKSUM Error", DateTime.Now, strTemp));
return ret = -1;
}
// 로그
if (this.IsCom3LogOpen == true)
this.smartFileCom3Log.WriteString(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 "PW0":
if ((ret = this.UartCom3ReceiveFeedbackBoardCommamdPW0(lane, address, receiveData)) != 0)
return ret = -1;
break;
default:
break;
}
return ret;
}
private int UartCom3ReceiveFeedbackBoardCommamdPW0(string lane, string address, string receiveData)
{
int ret = 0;
string value = "";
DataStore.ResponseData response = DataStore.ResponseData.NAK;
try
{
if (receiveData == "0000")
response = DataStore.ResponseData.NAK;
else
response = DataStore.ResponseData.ACK;
switch (address)
{
case "6203":
if (response == DataStore.ResponseData.ACK)
{
this.timerTimeoutOPT4.Enabled = false;
this.CurrentFeedbackItem.RetryCount = 0;
this.CurrentFeedbackItem.DataTransfer = DataStore.FeedbackBoardDataTransfer.None;
if (this.CurrentFeedbackItem.IsBootingComplete == false)
{
this.CurrentFeedbackItem.DataTransfer = DataStore.FeedbackBoardDataTransfer.Step2_6208;
value = Helper.StringZeroFillDigits4(this.SystemConfig.FeedbackCorrectionRate.ToString());
this.UartCom3FeedbackBoardTransfer(CommunicationAddress._6208_FeedbackCollectionRate, value);
}
this.ChildFormMainDisplay.UpdateFeedbackBoardStatusDisplay(true);
}
else
{
value = Helper.StringZeroFillDigits4(this.SystemConfig.FeedbackPulseWidth.ToString());
this.UartCom3FeedbackBoardTransfer(CommunicationAddress._6203_FeedbackPulseWidth, value);
this.ChildFormMainDisplay.UpdateFeedbackBoardStatusDisplay(false);
}
break;
case "6208":
if (response == DataStore.ResponseData.ACK)
{
this.timerTimeoutOPT4.Enabled = false;
this.CurrentFeedbackItem.RetryCount = 0;
this.CurrentFeedbackItem.DataTransfer = DataStore.FeedbackBoardDataTransfer.None;
if (this.CurrentFeedbackItem.IsBootingComplete == false)
{
this.CurrentFeedbackItem.IsBootingComplete = true;
this.timerTimeoutOPT4_OnlineCheck.Enabled = true;
this.CurrentFeedbackItem.DataTransfer = DataStore.FeedbackBoardDataTransfer.None;
}
this.ChildFormMainDisplay.UpdateFeedbackBoardStatusDisplay(true);
}
else
{
value = Helper.StringZeroFillDigits4(this.SystemConfig.FeedbackCorrectionRate.ToString());
this.UartCom3FeedbackBoardTransfer(CommunicationAddress._6208_FeedbackCollectionRate, value);
this.ChildFormMainDisplay.UpdateFeedbackBoardStatusDisplay(false);
}
break;
default:
break;
}
}
catch
{
ret = -1;
}
return ret;
}
private void UartCom3FeedbackBoardBooting()
{
string value = "";
this.timerTimeoutOPT4.Enabled = false;
this.CurrentFeedbackItem.IsBootingComplete = false;
this.CurrentFeedbackItem.RetryCount = 0;
this.CurrentFeedbackItem.DataTransfer = DataStore.FeedbackBoardDataTransfer.Step1_6203;
value = Helper.StringZeroFillDigits4(this.SystemConfig.FeedbackPulseWidth.ToString());
this.UartCom3FeedbackBoardTransfer(CommunicationAddress._6203_FeedbackPulseWidth, value);
}
public void UartCom3FeedbackBoardTransfer(string address, string data)
{
this.SerialCom3Write(CommunicationCommand.Write, CommunicationID.MainBoard, address, data);
this.timerTimeoutOPT4.Enabled = true;
}
public void SerialCH3OPT4(int lane, WeightData data)
{
double passRange = 0.0, sumWeight = 0.0, averageWeight = 0.0, feedbackWeight = 0.0;
StringBuilder sb = new StringBuilder();
if (this.CollectionFeedbackStatus[lane - 1].IsTransferData == true)
{
this.CollectionFeedbackStatus[lane - 1].IgnoreCount++;
if (this.CollectionFeedbackStatus[lane - 1].IgnoreCount >= this.SystemConfig.FeedbackIgnorePackages)
{
this.CollectionFeedbackStatus[lane - 1].IgnoreCount = 0;
this.CollectionFeedbackStatus[lane - 1].IsTransferData = false;
}
}
else
{
this.SetFeedbackSystem1(lane, data);
if (this.CollectionFeedbackStatus[lane - 1].WeightList.Count >= this.SystemConfig.FeedbackSampleCount)
{
passRange = Helper.StringToWeight(this.CurrentProductItem.PassRange, this.SystemConfig.DecimalPlaces);
sumWeight = Helper.StringToWeight(this.CollectionFeedbackStatus[lane - 1].SumWeight.ToString(), this.SystemConfig.DecimalPlaces);
averageWeight = Math.Round((sumWeight / this.SystemConfig.FeedbackSampleCount), this.SystemConfig.DecimalPlaces);
feedbackWeight = averageWeight - passRange;
this.CollectionFeedbackStatus[lane - 1].FeedbackWeight = feedbackWeight;
sb.Append(string.Format("IN{0:D3}", this.SystemConfig.EquipmentID));
sb.Append(string.Format("{0:D4}", this.SystemConfig.ProductNumber));
sb.Append(string.Format("{0:D2}", lane));
if (feedbackWeight < 0)
sb.Append("-");
else
sb.Append("+");
sb.Append(Helper.StringBlankFillDigits6(Helper.DoubleToString(Math.Abs(feedbackWeight), this.SystemConfig.DecimalPlaces)));
this.smartSerialPortCom3.WriteFrame(sb.ToString(), SmartSerialPort.CODETYPES.ASCIICODE);
this.CollectionFeedbackStatus[lane - 1].ClearData();
this.CollectionFeedbackStatus[lane - 1].IsTransferData = true;
if (this.IsCom3LogOpen == true)
this.smartFileCom3Log.WriteString(string.Format("Send ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, sb.ToString()));
}
}
}
public void SerialCH3OPT4Test(int lane, WeightData data)
{
StringBuilder sb = new StringBuilder();
sb.Append(string.Format("IN{0:D3}", this.SystemConfig.EquipmentID));
sb.Append(string.Format("{0:D4}", this.SystemConfig.ProductNumber));
sb.Append(string.Format("{0:D2}", lane));
sb.Append("+");
sb.Append(Helper.StringBlankFillDigits6(Helper.DoubleToString(0.5, this.SystemConfig.DecimalPlaces)));
this.smartSerialPortCom3.WriteFrame(sb.ToString(), SmartSerialPort.CODETYPES.ASCIICODE);
if (this.IsCom3LogOpen == true)
this.smartFileCom3Log.WriteString(string.Format("Send ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, sb.ToString()));
}
#endregion
#region Printer - 산업용 프린터
public void SerialCH3PrinterHeadLine()
{
this.smartSerialPortCom3.WriteNoneFrame("\n--------------------------------", SmartSerialPort.CODETYPES.ASCIICODE);
this.smartSerialPortCom3.WriteNoneFrame(" NO LANE GRADE WEIGHT COUNT", SmartSerialPort.CODETYPES.ASCIICODE);
this.smartSerialPortCom3.WriteNoneFrame("\n--------------------------------", SmartSerialPort.CODETYPES.ASCIICODE);
this.smartSerialPortCom3.WriteNoneFrame("\n", SmartSerialPort.CODETYPES.ASCIICODE);
}
public void SerialCH3Printer(Collection<WeightData> datas)
{
string value = "";
StringBuilder sb = new StringBuilder();
for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++)
{
sb.Append(string.Format("{0, 4}", this.SystemConfig.ProductNumber));
sb.Append(string.Format("{0, 3}", i + 1));
if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Under)
sb.Append(" U");
else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Pass)
sb.Append(" P");
else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Over)
sb.Append(" O");
else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Double)
sb.Append(" D");
else
sb.Append(" E");
value = Helper.DoubleToString(datas[i].Weight, this.SystemConfig.DecimalPlaces);
sb.Append(value.PadLeft(9, ' '));
value = datas[i].TotalCount.ToString();
sb.Append(value.PadLeft(11, ' '));
sb.Append("\n");
}
this.smartSerialPortCom3.WriteNoneFrame(sb.ToString(), SmartSerialPort.CODETYPES.ASCIICODE);
if (this.IsCom3LogOpen == true)
this.smartFileCom3Log.WriteString(string.Format("Send ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, sb.ToString()));
}
public void SerialCH3Printer(int lane, WeightData data)
{
string value = "";
StringBuilder sb = new StringBuilder();
sb.Append(string.Format("{0, 4}", this.SystemConfig.ProductNumber));
sb.Append(string.Format("{0, 3}", lane));
if (data.JudgmentStatus == DataStore.JudgmentStatus.Under)
sb.Append(" U");
else if (data.JudgmentStatus == DataStore.JudgmentStatus.Pass)
sb.Append(" P");
else if (data.JudgmentStatus == DataStore.JudgmentStatus.Over)
sb.Append(" O");
else if (data.JudgmentStatus == DataStore.JudgmentStatus.Double)
sb.Append(" D");
else
sb.Append(" E");
value = Helper.DoubleToString(data.Weight, this.SystemConfig.DecimalPlaces);
sb.Append(value.PadLeft(9, ' '));
value = data.TotalCount.ToString();
sb.Append(value.PadLeft(11, ' '));
sb.Append("\n");
this.smartSerialPortCom3.WriteNoneFrame(sb.ToString(), SmartSerialPort.CODETYPES.ASCIICODE);
if (this.IsCom3LogOpen == true)
this.smartFileCom3Log.WriteString(string.Format("Send ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, sb.ToString()));
}
#endregion
#region OPT5 - 중량 데이터 피드백 (중량설정값 포함)
public void SerialCH3OPT5(int lane, WeightData data)
{
this.SerialCom3Write(this.Protocol_OPT5_NotStxEtx(this.SystemConfig, data, lane, this.CurrentProductItem));
}
public void SerialCH3OPT5(Collection<WeightData> datas)
{
this.SerialCom3Write(this.Protocol_OPT5_NotStxEtx_1(this.SystemConfig, datas, this.CurrentProductItem));
}
#endregion
#endregion
#region Ethernet
private void SendEthernetData(string etherData)
{
if (this.SystemConfig.EthernetOperationMode == 1)
{
if (this.smartTCPMultiServer.ClientInfoList != null)
{
foreach (SmartTCPMultiServer.CLIENTSINFOS client in this.smartTCPMultiServer.ClientInfoList)
this.EthernetServerSendMessage(client, etherData);
}
}
else
this.EthernetWeightData(etherData);
}
#region Server
public void EthernetServerStart()
{
if (this.smartTCPMultiServer.IsStart == false)
{
this.ChildFormCommunication.DisplayLabelLocalPort(false);
this.smartTCPMultiServer.Port = this.SystemConfig.EthernetLocalPort;
this.smartTCPMultiServer.Start();
}
}
public void EthernetServerStop()
{
if (this.smartTCPMultiServer.IsStart == true)
{
this.ChildFormCommunication.DisplayLabelLocalPort(true);
this.smartTCPMultiServer.Stop();
}
}
public void EthernetServerSendMessage(SmartTCPMultiServer.CLIENTSINFOS client, string msg)
{
this.smartTCPMultiServer.SendStringASCIIID(client.strID, msg);
}
public void EthernetServerSendMessage(SmartTCPMultiServer.CLIENTSINFOS client, byte[] bytes)
{
this.smartTCPMultiServer.SendByteByClientID(client.strID, bytes);
}
#endregion
#region Client
Thread cpClientThread;
public void EthernetClientConnect()
{
if (this.IsEthernetThreadStop == false)
return; // Online 경우
if (this.SystemConfig.IsEthernetEnable == false)
{
this.TextStatusOut("<Disable");
return;
}
if (string.Compare(this.SystemConfig.EthernetServerAddress, "0.0.0.0") == 0)
{
this.TextStatusOut("<Addr Err");
return;
}
try
{
this.cpClientThread = new Thread(new ThreadStart(EthernetClientReceiveThread));
this.cpClientThread.IsBackground = true;
this.cpClientThread.Start();
}
catch
{
TextStatusOut(">Thread Error");
}
}
public void EthernetClientDisconnect()
{
this.IsEthernetThreadStop = true;
this.IsModbusCommonDataSend = false;
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();
}
private void EthernetClientReceiveThread()
{
//this.cpClientThread.Abort();
int nConnectPort = Convert.ToInt32(this.SystemConfig.EthernetServerPort);
try
{
this.DelegateTextStatusOut(">Now Connecting..");
this.EthernetTcpClient = new TcpClient(this.SystemConfig.EthernetServerAddress, nConnectPort);
this.EthernetNetStream = EthernetTcpClient.GetStream();
this.EthernetStmReader = new StreamReader(EthernetNetStream);
this.EthernetStmWriter = new StreamWriter(EthernetNetStream);
this.DelegateUISeverStatus(true);
this.DelegateTextStatusOut(">Connected Server");
this.SetTrackingHistoryData(DataStore.TrackingOperation.EthernetConnect, "Client");
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);
}
while (this.IsEthernetThreadStop == false)
{
string strRecvMsg = this.EthernetStmReader.ReadLine();
if (null == strRecvMsg)
{
this.DelegateTextStatusOut(">Server Out");
this.SetTrackingHistoryData(DataStore.TrackingOperation.EthernetDisconnect, "Client");
this.IsEthernetThreadStop = true;
break;
}
this.DelegateTextStatusOut(strRecvMsg);
}
}
catch
{
this.DelegateTextStatusOut(">Connect Fail !");
}
finally
{
this.IsEthernetThreadStop = true;
this.DelegateUISeverStatus(false);
this.DelegateTextStatusOut(">Disconnected Server");
this.SetTrackingHistoryData(DataStore.TrackingOperation.EthernetDisconnect, "Client");
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();
}
return;
}
private void UIServerStatus(bool status)
{
if (this.ChildFormMainDisplay != null)
this.ChildFormMainDisplay.UpdateEthernetStatusDisplay(status);
}
private void DelegateUISeverStatus(bool status)
{
this.Invoke(new UIServerStatusCallback(this.UIServerStatus), status);
}
private void TextStatusOut(string value)
{
if (this.ChildFormCommunication != null)
this.ChildFormCommunication.UpdateEthernetStatusDisplay(value);
}
private void DelegateTextStatusOut(string value)
{
this.Invoke(new TextStatusCallback(this.TextStatusOut), value);
}
private void DelegateTransferData(string data)
{
this.Invoke(new TransferDataStringCallback(this.EthernetSendMessage), data);
}
private void DelegateTransferData(byte[] data)
{
this.Invoke(new TransferDataByteArrayCallback(this.EthernetSendMessage), data);
}
private void DelegateTransferData(byte data)
{
this.Invoke(new TransferDataStringCallback(this.EthernetSendMessage), data);
}
public void EthernetSendMessage(string msg)
{
try
{
this.EthernetStmWriter.Write(msg);
this.EthernetStmWriter.Flush();
// 로그
if (this.IsCommunicationLogOpen == true)
this.smartFileCommunicationLog.WriteString(string.Format("Send ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, msg));
}
catch
{
this.DelegateUISeverStatus(false);
this.DelegateTextStatusOut("> Disconnect");
}
}
public void EthernetSendMessage(byte[] msg)
{
try
{
this.EthernetStmWriter.BaseStream.Write(msg, 0, msg.Length);
this.EthernetStmWriter.Flush();
// 로그
if (this.IsCommunicationLogOpen == true)
this.smartFileCommunicationLog.WriteString(string.Format("Send ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, BitConverter.ToString(msg)));
}
catch
{
this.DelegateUISeverStatus(false);
this.DelegateTextStatusOut("> Disconnect");
}
}
public void EthernetSendMessage(byte msg)
{
try
{
this.EthernetStmWriter.WriteLine(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 temp)
{
this.IsEthernetTransferData = true;
this.EthernetTransferData = temp;
if (this.IsEthernetThreadStop == true)
this.EthernetClientConnect();
else
this.EthernetSendMessage((byte)this.EthernetTransferData);
}
public void EthernetWeightDataForModbus(byte[] bytes)
{
this.IsEthernetTransferData = true;
this.EthernetTransferData = bytes;
if (this.IsEthernetThreadStop == true)
this.EthernetClientConnect();
else
this.EthernetSendMessage(bytes);
}
#endregion
#endregion
#region Serial Com4
public void SerialCom4Open()
{
if (this.SystemConfig.IsOptPrinter == true)
{
if (this.serialPort4.IsOpen == false)
this.serialPort4.Open();
}
}
public void SerialCom4Close()
{
this.serialPort4.Close();
}
public void SerialCom4TransferData(string data)
{
if (this.serialPort4.IsOpen == false)
return;
this.serialPort4.WriteLine(data);
}
#endregion
#region Backup
private void DeleteLogFile(string path, DataStore.E_DataType type)
{
string dataFolderPath = "";
switch (type)
{
case DataStore.E_DataType.None:
break;
case DataStore.E_DataType.History:
dataFolderPath = this.PathDataHistoryFolder;
break;
case DataStore.E_DataType.Inspection:
dataFolderPath = this.PathDataInspectionFolder;
break;
case DataStore.E_DataType.Others:
dataFolderPath = this.PathDataOthersFolder;
break;
default:
break;
}
foreach (string Folder in Directory.GetDirectories(path))
{
this.DeleteLogFile(Folder, type); //재귀함수 호출
if (Directory.GetDirectories(Folder).Count() == 0 && Directory.GetFiles(Folder).Count() == 0 && Folder != dataFolderPath)
Directory.Delete(Folder, true);
}
foreach (string file in Directory.GetFiles(path))
{
FileInfo fi = new FileInfo(file);
if (DateTime.ParseExact(fi.Name.Substring(1, 8), "yyyyMMdd", null) < DateTime.Now.AddMonths(-1 * this.SystemConfig.DataStoragePeriod))
fi.Delete();
}
}
#endregion
#region Tracking Inspection data
private void GetTrackingInspectionFolderPath(ref string folder, ref string fileName)
{
DateTime time = DateTime.Now;
if (this.SystemConfig.IsOptPart11 == false)
{
folder = this.PathDataBackupFolder;
fileName = string.Format("{0:yyyyMMdd}_{1}.csv", time, this.SystemConfig.ProductNumber);
}
else
{
folder = string.Format("{0}{1}\\{2}\\", this.PathDataInspectionFolder, time.Year, time.Month);
fileName = string.Format("I{0:yyyyMMdd}_{1}.csv", time, this.SystemConfig.ProductNumber);
}
}
private void TrackingInspectionData(Collection<WeightData> items)
{
bool fileCheck = false, directoryCheck = false;
string fullFilePath = "", folderPath = "", fileName = "";
StreamWriter sw;
if (this.SystemConfig.IsDataBackup == true)
{
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("P_No");
sw.Write(",");
sw.Write("Name");
sw.Write(",");
sw.Write("Lot");
sw.Write(",");
sw.Write("UnderRange");
sw.Write(",");
sw.Write("PassRange");
sw.Write(",");
sw.Write("OverRange");
sw.Write(",");
sw.Write("TareRange");
for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++)
{
sw.Write(",");
sw.Write(string.Format("#{0}_Weight", i + 1));
sw.Write(",");
sw.Write(string.Format("#{0}_Grade", i + 1));
}
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.CurrentProductItem.Number);
sw.Write(",");
sw.Write(this.CurrentProductItem.Name);
sw.Write(",");
sw.Write(this.CurrentProductItem.LotNo);
sw.Write(",");
sw.Write(Helper.StringToDecimalPlaces(this.CurrentProductItem.UnderRange, this.SystemConfig.DecimalPlaces));
sw.Write(",");
sw.Write(Helper.StringToDecimalPlaces(this.CurrentProductItem.PassRange, this.SystemConfig.DecimalPlaces));
sw.Write(",");
sw.Write(Helper.StringToDecimalPlaces(this.CurrentProductItem.OverRange, this.SystemConfig.DecimalPlaces));
sw.Write(",");
sw.Write(Helper.StringToDecimalPlaces(this.CurrentProductItem.TareRange, this.SystemConfig.DecimalPlaces));
for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++)
{
if (this.SystemConfig.EquipmentMode == 2)
{
if (items[i].IsUpdate == true)
{
sw.Write(",");
sw.Write(Helper.DoubleToString(items[i].Weight, this.SystemConfig.DecimalPlaces));
sw.Write(",");
sw.Write(items[i].JudgmentStatus);
}
else
{
sw.Write(",");
sw.Write(Helper.DoubleToString(0.0, this.SystemConfig.DecimalPlaces));
sw.Write(",");
sw.Write(DataStore.JudgmentStatus.Empty);
}
}
else
{
sw.Write(",");
sw.Write(Helper.DoubleToString(items[i].Weight, this.SystemConfig.DecimalPlaces));
sw.Write(",");
sw.Write(items[i].JudgmentStatus);
}
}
sw.WriteLine();
sw.Close();
}
}
private void RemoveInspectionDataFile()
{
bool directoryCheck = false;
try
{
if (this.SystemConfig.IsOptPart11 == true)
this.DeleteLogFile(this.PathDataInspectionFolder, DataStore.E_DataType.Inspection);
else
{
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(DataStore.TrackingOperation type, string detail)
{
HistoryData data = new HistoryData();
data.Type = "Operation";
data.Time = DateTime.Now;
data.LoginID = this.SystemConfig.CurrentUser.ID;
data.Event = type.ToString();
data.Detail = detail;
data.BeforeData = "";
data.AfterData = "";
this.TrackingHistoryData(data);
}
public void SetTrackingHistoryData(DataStore.TrackingAlarm type, string detail)
{
HistoryData data = new HistoryData();
data.Type = "Alarm";
data.Time = DateTime.Now;
data.LoginID = this.SystemConfig.CurrentUser.ID;
data.Event = type.ToString();
data.Detail = detail;
data.BeforeData = "";
data.AfterData = "";
this.TrackingHistoryData(data);
}
public void SetTrackingHistoryData(DataStore.TrackingParameter type, string detail, string before, string after)
{
if (before == after)
return;
HistoryData data = new HistoryData();
data.Type = "Parameter";
data.Time = DateTime.Now;
data.LoginID = this.SystemConfig.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;
if (this.SystemConfig.IsOptPart11 == true)
{
folderPath = string.Format("{0}{1}\\{2}\\", this.PathDataHistoryFolder, time.Year, time.Month);
fileName = string.Format("H{0:yyyyMMdd}.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);
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();
}
}
private void RemoveHistoryDataFile()
{
try
{
this.DeleteLogFile(this.PathDataHistoryFolder, DataStore.E_DataType.History);
}
catch
{
}
}
#endregion
#region Tracking Others data
private void RemoveOthersDataFile()
{
try
{
this.DeleteLogFile(this.PathDataOthersFolder, DataStore.E_DataType.Others);
}
catch
{
}
}
#endregion
#endregion
#region Override Member
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
// 변수 초기 셋팅1
this.DefaultSetting1();
// SystemConfiguration 읽기
this.LoadSystemConfigurationFile();
// Collection 생성
this.CreateCollection();
// Count 읽기
this.LoadCounterFile(ref this.CollectionWeightData, this.SystemConfig.ProductNumber - 1);
// 품목 파일 읽기
this.LoadProductFile(ref this.CurrentProductItem, this.SystemConfig.ProductNumber - 1);
// 판정설정 파일 읽기
this.LoadJudgmentSetFile(ref this.CurrentJudgmentSetItem, this.SystemConfig.ProductNumber - 1);
// 품목명 읽기
this.LoadProductName(ref this.CollectionProductName);
// Feedback 파일 읽기
this.LoadFeedbackItemFile(ref this.CurrentFeedbackItem, this.SystemConfig.ProductNumber - 1);
// UserGroup File Load
this.LoadUserGroupFile(ref this.CurrentUserGroup);
// 변수 초기 셋팅2
// 시스템설정 값 로딩 후 셋팅
this.DefaultSetting2();
this.Update30000ModbusData();
for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++)
this.Update30000ModbusData(i);
// UserManager 초기화
if (this.SystemConfig.IsLogin == true)
{
this.InitializeUserManager();
this.SystemConfig.CurrentUser.Group = DataStore.UserGroup.LogOut;
}
else
this.SystemConfig.CurrentUser.Group = DataStore.UserGroup.NotLogin;
// Encryption 초기화
if (this.SystemConfig.IsOptPart11 == true)
{
this.InitializeAES();
}
// 폼생성
this.CreateForm();
//Console.WriteLine("Program Load");
this.SmartSplashProgramLoad.Finish();
// 디버거 연결할때 사용
// 타이머 밑에 코드 주석처리하고, 타이머 사용하면 디버거 연결됨..
//this.smartTimer1.Start();
this.smartForm.Show((int)DataStore.FormStore.FormMainDisplay);
// 통신 OPEN
this.OpenSmartUartLink();
// Serial3 통신 Open
this.SerialCom3Open();
// Serial4 통신 Open
this.SerialCom4Open();
Thread.Sleep(100);
// 초기 파라미터 전송
this.TransferDataStream(CommunicationCommand.Read, CommunicationID.MainBoard, CommunicationAddress._6901_ParameterRead, "");
if (this.SystemConfig.IsOptFeedbackBoardUse == true && this.SystemConfig.Serial3Mode == 4)
this.UartCom3FeedbackBoardBooting();
// UserManager_GetUserListName
this.timerUserList.Enabled = true;
}
#endregion
#region Event Handler
private void smartSerialPortCom3_OnReadQueueEvent()
{
switch (this.SystemConfig.Serial3Mode)
{
case 1:
#region ABFood
this.UartCom3ReceiveDataABFood();
#endregion
break;
case 4:
#region Feedback Board
if (this.SystemConfig.IsOptFeedbackBoardUse == true)
this.UartCom3ReceiveDataFeedbackBoard();
#endregion
break;
default:
break;
}
}
private void timerTimeout_Tick(object sender, EventArgs e)
{
this.timerTimeoutOPT1.Enabled = false;
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
}
private void timerOPT1_Tick(object sender, EventArgs e)
{
this.UartCom3TransferDataABFood(DataStore.ABFoodDataCommand.Normal, (int)DataStore.ABFoodDataStatus.Normal);
}
private void timerAdcLog_Tick(object sender, EventArgs e)
{
this.FlagADCValueWrite = true;
}
private void timerTimeoutOPT4_Tick(object sender, EventArgs e)
{
string value = "";
this.timerTimeoutOPT4.Enabled = false;
if (this.CurrentFeedbackItem.DataTransfer == DataStore.FeedbackBoardDataTransfer.Step1_6203)
{
if (this.CurrentFeedbackItem.RetryCount < 5)
{
value = Helper.StringZeroFillDigits4(this.SystemConfig.FeedbackPulseWidth.ToString());
this.SerialCom3Write(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._6203_FeedbackPulseWidth, value);
this.timerTimeoutOPT4.Enabled = true;
this.CurrentFeedbackItem.RetryCount++;
}
else
{
this.CurrentFeedbackItem.RetryCount = 0;
this.ChildFormMainDisplay.UpdateFeedbackBoardStatusDisplay(false);
}
}
else if(this.CurrentFeedbackItem.DataTransfer == DataStore.FeedbackBoardDataTransfer.Step2_6208)
{
if (this.CurrentFeedbackItem.RetryCount < 5)
{
value = Helper.StringZeroFillDigits4(this.SystemConfig.FeedbackCorrectionRate.ToString());
this.SerialCom3Write(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._6208_FeedbackCollectionRate, value);
this.timerTimeoutOPT4.Enabled = true;
this.CurrentFeedbackItem.RetryCount++;
}
else
{
this.CurrentFeedbackItem.RetryCount = 0;
this.ChildFormMainDisplay.UpdateFeedbackBoardStatusDisplay(false);
}
}
}
private void timerTimeoutOPT4_OnlineCheck_Tick(object sender, EventArgs e)
{
this.timerTimeoutOPT4_OnlineCheck.Enabled = false;
this.ChildFormMainDisplay.UpdateFeedbackBoardStatusDisplay(false);
}
private void timerTimeOutTransmission_Tick(object sender, EventArgs e)
{
this.timerTimeOutTransmission.Enabled = false;
this.IntegratedTransmission(this.CollectionWeightData);
foreach (WeightData data in this.CollectionWeightData)
data.IsUpdate = false;
}
private void timerUserList_Tick(object sender, EventArgs e)
{
this.timerUserList.Enabled = false;
UserManager.UserManager_GetUserListName();
}
private void smartThread_UIThreadFunction(ThreadArgs args)
{
// 메시지 11. 입력센서 에러에 의해 정지하였습니다.
if (this.FlagThreadMessage1 == false)
{
DialogFormMessage msg = new DialogFormMessage(11, this.SystemConfig.Language, this);
msg.ShowDialog();
this.FlagThreadMessage1 = true;
}
}
private void smartThread_OnEnding(ThreadArgs args)
{
}
private void smartTCPMultiServer_OnReceiveHandler(SmartTCPMultiServer.CHandleClinet.READINFO datas)
{
int ret = 0;
byte[] readByte;
string strRecData = "";
byte[] sendOPCDatas = new byte[57];
byte[] sendModbusDatas;
byte[] madeDatas;
try
{
readByte = datas.receiveDatas;
strRecData = SmartTCPMultiServer.ConvertAsciiByteToString(readByte);
}
catch
{
return;
}
switch (this.SystemConfig.EthernetMode)
{
case (int)DataStore.EthernetMode.f3_Modbus_TCP:
#region Modbus TCP
if (this.smartTCPMultiServer.ClientInfoList != null)
{
if (readByte[7] == 0x03) // Read Holding Register
{
#region Read Holding Register
try
{
byte[] responseData;
byte errorCheck = this.Modbus.CheckRequestSpecialDataErrorTCP(readByte, ModbusFunctionCode.FunctionCode_03);
if (errorCheck == 0x00)
responseData = this.Modbus.MakeTCPResponseData(readByte, this.Protocol_Modbus_Server_Read_Lane_Data(readByte), ModbusFunctionCode.FunctionCode_03);
else
responseData = this.Modbus.MakeTCPErrorResponseData(readByte, errorCheck, ModbusFunctionCode.FunctionCode_03);
foreach (SmartTCPMultiServer.CLIENTSINFOS client in this.smartTCPMultiServer.ClientInfoList)
{
this.smartTCPMultiServer.SendByteByClientID(client.strID, responseData);
}
// 로그
if (this.IsCommunicationLogOpen == true)
{
this.smartFileCommunicationLog.WriteString(string.Format("Receive TCP ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, BitConverter.ToString(readByte)));
this.smartFileCommunicationLog.WriteString(string.Format("Send TCP ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, BitConverter.ToString(responseData)));
}
}
catch
{
}
#endregion
}
else 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.CheckRequestSpecialDataErrorTCP(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.WriteString(string.Format("Receive TCP ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, BitConverter.ToString(readByte)));
this.smartFileCommunicationLog.WriteString(string.Format("Send TCP ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, BitConverter.ToString(responseData)));
}
}
catch
{
}
#endregion
}
else // Read Input Register(0x04)
{
#region Read Input Register
try
{
byte[] responseData;
byte errorCheck = this.Modbus.CheckRequestSpecialDataErrorTCP(readByte, ModbusFunctionCode.FunctionCode_04);
if (errorCheck == 0x00)
responseData = this.Modbus.MakeTCP04ResponseData(readByte, this.Protocol_Modbus_Server_Read_Lane_Data(readByte));
else
responseData = this.Modbus.MakeTCP04ErrorResponseData(readByte, errorCheck);
foreach (SmartTCPMultiServer.CLIENTSINFOS client in this.smartTCPMultiServer.ClientInfoList)
{
this.smartTCPMultiServer.SendByteByClientID(client.strID, responseData);
}
// 로그
if (this.IsCommunicationLogOpen == true)
{
this.smartFileCommunicationLog.WriteString(string.Format("Receive TCP ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, BitConverter.ToString(readByte)));
this.smartFileCommunicationLog.WriteString(string.Format("Send TCP ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, BitConverter.ToString(responseData)));
}
}
catch
{
}
#endregion
}
}
#endregion
break;
default:
break;
}
}
private void smartSerialPortLink_OnReadQueueEvent()
{
this.ReceiveData();
// 통신 확인
if (this.CommunicationCheckCount / 3 == 1)
{
this.ChildFormMainDisplay.pictureBoxCommunicationStatus.Visible = true;
this.CommunicationCheckCount = 0;
}
else
{
this.ChildFormMainDisplay.pictureBoxCommunicationStatus.Visible = false;
this.CommunicationCheckCount += 1;
}
}
#region DLL_SerialportEvent
private void Serialport_ReceiveDataEvent(string data)
{
this.ReceiveData(data);
// 통신 확인
if (this.CommunicationCheckCount / 3 == 1)
{
this.ChildFormMainDisplay.pictureBoxCommunicationStatus.Visible = true;
this.CommunicationCheckCount = 0;
}
else
{
this.ChildFormMainDisplay.pictureBoxCommunicationStatus.Visible = false;
this.CommunicationCheckCount += 1;
}
}
private void Serialport_GetVersionDataEvent(object data)
{
try
{
if (this.ChildFormInformation != null)
{
this.UI_Invoke(delegate
{
this.ChildFormInformation.UpdateSerialportVersionDisplay(data.ToString());
});
}
}
catch
{
}
}
#endregion
#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.SystemConfig.CurrentForm == DataStore.FormStore.FormUserEditor)
this.ChildFormUserEditor.CallBackGetUserData(userList);
}
catch
{
}
}
private void UserManager_UserListLoginTimeoutDataEvent(object data)
{
try
{
UserManager.UserMgr_login_timeout_t loginTimeout = (UserManager.UserMgr_login_timeout_t)data;
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
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.SystemConfig.CurrentForm == DataStore.FormStore.FormUserEditor)
this.ChildFormUserEditor.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.ChildFormUserEditor.CallBackUserListDeleteDataEvent(user);
}
catch
{
}
}
private void UserManager_UserListModifyUserDataEvent(object data)
{
try
{
UserManager.UserMgr_user_modify_t user = (UserManager.UserMgr_user_modify_t)data;
this.ChildFormUserEditor.CallBackUserModifyUserData(user);
}
catch
{
}
}
private void UserManager_UserListModifyInfoDataEvent(object data)
{
try
{
UserManager.UserMgr_user_info_t user = (UserManager.UserMgr_user_info_t)data;
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormUserEditor)
this.ChildFormUserEditor.CallBackUserListModifyInfoDataEvent(user);
//else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
//this.ChildFormMainDisplay.CallBackUserListModifyInfoDataEvent(user);
}
catch
{
}
}
private void UserManager_UserListNewDataEvent(object data)
{
try
{
UserManager.UserMgr_user_info_t user = (UserManager.UserMgr_user_info_t)data;
this.ChildFormUserEditor.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
{
}
}
private void UserManager_UserListGetVersionDataEvent(object data)
{
try
{
if (this.ChildFormInformation != null)
this.ChildFormInformation.UpdatePart11UserManagerVersionDisplay(data.ToString());
}
catch
{
}
}
#endregion
#region EncryptionEvent
private void AesEncryption_Event(object data)
{
try
{
Encryption.auth_encryption_status_t status = (Encryption.auth_encryption_status_t)data;
//this.labelStatus.Text = status.percentage.ToString();
//this.StatusPercentage = status.percentage;
this.ChildFormDataBackup_Part11.CallBackEncryptionEvent(status);
}
catch
{
}
}
private void AesEncryption_GetVersionDataEvent(object data)
{
if (this.ChildFormInformation != null)
this.ChildFormInformation.UpdatePart11AesEncryptionVersionDisplay(data.ToString());
}
#endregion
private void smartTimer1_Tick(object sender, EventArgs e)
{
this.smartTimer1.Stop();
this.smartForm.Show((int)DataStore.FormStore.FormMainDisplay);
// 통신 OPEN
this.OpenSmartUartLink();
// Serial3 통신 Open
this.SerialCom3Open();
Thread.Sleep(100);
// 초기 파라미터 전송
this.TransferDataStream(CommunicationCommand.Read, CommunicationID.MainBoard, CommunicationAddress._6901_ParameterRead, "");
if (this.SystemConfig.IsOptFeedbackBoardUse == true && this.SystemConfig.Serial3Mode == 4)
this.UartCom3FeedbackBoardBooting();
// UserManager_GetUserListName
this.timerUserList.Enabled = true;
}
#endregion
}
}