1524 lines
71 KiB
C#
1524 lines
71 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Collections.Generic;
|
|
using System.Collections.ObjectModel;
|
|
using System.ComponentModel;
|
|
using System.Drawing;
|
|
using System.Data;
|
|
using System.Text;
|
|
using System.Threading;
|
|
using System.Windows.Forms;
|
|
using System.Net;
|
|
|
|
using SmartX;
|
|
using ITC81DB_ImageDll;
|
|
using ITC81DB.DialogForms;
|
|
using ITC81DB.Forms;
|
|
|
|
namespace ITC81DB.Controls
|
|
{
|
|
public partial class ControlCenterConfiEthernet : UserControl
|
|
{
|
|
#region Field
|
|
private static int ModeSTD2 = 4;
|
|
private FormMenu m_ParentForm;
|
|
|
|
public ControlConfiEthernetLocalIP ControlEthernetLocalIP;
|
|
public ControlConfiHitachi ControlHitachi;
|
|
public ControlConfiMarkoPrint ControlMarkoprint;
|
|
public ControlConfiModbus ControlModbusTCP;
|
|
public ControlConfiMULTiJET ControlMultiJet;
|
|
|
|
private delegate void ConnetedIPStatusCallback(string value);
|
|
#endregion
|
|
|
|
#region Constructor
|
|
public ControlCenterConfiEthernet(FormMenu parent)
|
|
{
|
|
InitializeComponent();
|
|
|
|
this.ParentForm = parent;
|
|
|
|
this.DefaultSetting();
|
|
this.InitializeDesign();
|
|
}
|
|
#endregion
|
|
|
|
#region Property
|
|
public FormMenu ParentForm
|
|
{
|
|
get { return this.m_ParentForm; }
|
|
private set { this.m_ParentForm = value; }
|
|
}
|
|
#endregion
|
|
|
|
#region Method
|
|
public void InitializeDesign()
|
|
{
|
|
Class1 images = new Class1();
|
|
|
|
this.labelTitleConnectedIP.Text = "Connceted IP";
|
|
this.labelTitleServerPort.Text = "Port";
|
|
this.labelTitleClientServerIP.Text = "Server IP";
|
|
this.labelTitleClientServerPort.Text = "Server Port";
|
|
|
|
this.buttonLocalIP.Font = new Font("새굴림", 13, FontStyle.Bold);
|
|
this.buttonLocalIP.Text = "Local IP";
|
|
this.buttonStart.Text = "Start";
|
|
this.buttonStop.Text = "Stop";
|
|
|
|
if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.English)
|
|
{
|
|
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.engBackgroundEthernet));
|
|
|
|
this.comboBoxEthernetOpMode.Items.Clear();
|
|
this.comboBoxEthernetOpMode.SelectedIndexChanged -= new EventHandler(this.comboBoxEthernetOpMode_SelectedIndexChanged);
|
|
this.comboBoxEthernetOpMode.Items.Add("None");
|
|
this.comboBoxEthernetOpMode.Items.Add("Server");
|
|
this.comboBoxEthernetOpMode.Items.Add("Client");
|
|
this.comboBoxEthernetOpMode.SelectedIndex = 0;
|
|
this.comboBoxEthernetOpMode.SelectedIndexChanged += new EventHandler(this.comboBoxEthernetOpMode_SelectedIndexChanged);
|
|
}
|
|
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Chinese)
|
|
{
|
|
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.chnBackgroundEthernet));
|
|
|
|
this.labelTitleConnectedIP.Text = "连接的IP";
|
|
this.labelTitleServerPort.Text = "端口";
|
|
this.labelTitleClientServerIP.Text = "服务器IP";
|
|
this.labelTitleClientServerPort.Text = "服务器端口";
|
|
|
|
this.buttonLocalIP.Font = new Font("새굴림", 11, FontStyle.Bold);
|
|
this.buttonLocalIP.Text = "设备IP地址";
|
|
this.buttonStart.Text = "开启";
|
|
this.buttonStop.Text = "停止";
|
|
|
|
this.comboBoxEthernetOpMode.Items.Clear();
|
|
this.comboBoxEthernetOpMode.SelectedIndexChanged -= new EventHandler(this.comboBoxEthernetOpMode_SelectedIndexChanged);
|
|
this.comboBoxEthernetOpMode.Items.Add("不使用");
|
|
this.comboBoxEthernetOpMode.Items.Add("服务器");
|
|
this.comboBoxEthernetOpMode.Items.Add("客户端");
|
|
this.comboBoxEthernetOpMode.SelectedIndex = 0;
|
|
this.comboBoxEthernetOpMode.SelectedIndexChanged += new EventHandler(this.comboBoxEthernetOpMode_SelectedIndexChanged);
|
|
}
|
|
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Czech)
|
|
{
|
|
}
|
|
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Russian)
|
|
{
|
|
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.rusBackgroundEthernet));
|
|
|
|
this.labelTitleConnectedIP.Text = "Подключенный IP";
|
|
this.labelTitleServerPort.Text = "Порт";
|
|
this.labelTitleClientServerIP.Text = "Сервер IP";
|
|
this.labelTitleClientServerPort.Text = "Сервер Порт";
|
|
|
|
this.buttonLocalIP.Font = new Font("새굴림", 13, FontStyle.Bold);
|
|
this.buttonLocalIP.Text = "IP адрес";
|
|
this.buttonStart.Text = "Старт";
|
|
this.buttonStop.Text = "Стоп";
|
|
|
|
this.comboBoxEthernetOpMode.Items.Clear();
|
|
this.comboBoxEthernetOpMode.SelectedIndexChanged -= new EventHandler(this.comboBoxEthernetOpMode_SelectedIndexChanged);
|
|
this.comboBoxEthernetOpMode.Items.Add("Нет");
|
|
this.comboBoxEthernetOpMode.Items.Add("Сервер");
|
|
this.comboBoxEthernetOpMode.Items.Add("Клиент");
|
|
this.comboBoxEthernetOpMode.SelectedIndex = 0;
|
|
this.comboBoxEthernetOpMode.SelectedIndexChanged += new EventHandler(this.comboBoxEthernetOpMode_SelectedIndexChanged);
|
|
}
|
|
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.German)
|
|
{
|
|
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.gerBackgroundEthernet));
|
|
|
|
this.comboBoxEthernetOpMode.Items.Clear();
|
|
this.comboBoxEthernetOpMode.SelectedIndexChanged -= new EventHandler(this.comboBoxEthernetOpMode_SelectedIndexChanged);
|
|
this.comboBoxEthernetOpMode.Items.Add("None");
|
|
this.comboBoxEthernetOpMode.Items.Add("Server");
|
|
this.comboBoxEthernetOpMode.Items.Add("Client");
|
|
this.comboBoxEthernetOpMode.SelectedIndex = 0;
|
|
this.comboBoxEthernetOpMode.SelectedIndexChanged += new EventHandler(this.comboBoxEthernetOpMode_SelectedIndexChanged);
|
|
}
|
|
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Spanish)
|
|
{
|
|
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.engBackgroundEthernet));
|
|
|
|
this.comboBoxEthernetOpMode.Items.Clear();
|
|
this.comboBoxEthernetOpMode.SelectedIndexChanged -= new EventHandler(this.comboBoxEthernetOpMode_SelectedIndexChanged);
|
|
this.comboBoxEthernetOpMode.Items.Add("Ninguna");
|
|
this.comboBoxEthernetOpMode.Items.Add("Servidor");
|
|
this.comboBoxEthernetOpMode.Items.Add("Cliente");
|
|
this.comboBoxEthernetOpMode.SelectedIndex = 0;
|
|
this.comboBoxEthernetOpMode.SelectedIndexChanged += new EventHandler(this.comboBoxEthernetOpMode_SelectedIndexChanged);
|
|
}
|
|
else
|
|
{
|
|
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.korBackgroundEthernet));
|
|
|
|
this.comboBoxEthernetOpMode.Items.Clear();
|
|
this.comboBoxEthernetOpMode.SelectedIndexChanged -= new EventHandler(this.comboBoxEthernetOpMode_SelectedIndexChanged);
|
|
this.comboBoxEthernetOpMode.Items.Add("None");
|
|
this.comboBoxEthernetOpMode.Items.Add("Server");
|
|
this.comboBoxEthernetOpMode.Items.Add("Client");
|
|
this.comboBoxEthernetOpMode.SelectedIndex = 0;
|
|
this.comboBoxEthernetOpMode.SelectedIndexChanged += new EventHandler(this.comboBoxEthernetOpMode_SelectedIndexChanged);
|
|
}
|
|
}
|
|
private void DefaultSetting()
|
|
{
|
|
string[] sValue;
|
|
|
|
this.ControlEthernetLocalIP = new ControlConfiEthernetLocalIP(this.ParentForm);
|
|
this.Controls.Add(this.ControlEthernetLocalIP);
|
|
this.ControlEthernetLocalIP.Location = new Point(0, 217);
|
|
|
|
this.ControlHitachi = new ControlConfiHitachi(this.ParentForm);
|
|
this.Controls.Add(this.ControlHitachi);
|
|
this.ControlHitachi.Location = new Point(0, 217);
|
|
|
|
this.ControlMarkoprint = new ControlConfiMarkoPrint(this.ParentForm);
|
|
this.Controls.Add(this.ControlMarkoprint);
|
|
this.ControlMarkoprint.Location = new Point(0, 217);
|
|
|
|
this.ControlModbusTCP = new ControlConfiModbus(this.ParentForm);
|
|
this.Controls.Add(this.ControlModbusTCP);
|
|
this.ControlModbusTCP.Location = new Point(0, 217);
|
|
|
|
this.ControlMultiJet = new ControlConfiMULTiJET(this.ParentForm);
|
|
this.Controls.Add(this.ControlMultiJet);
|
|
this.ControlMultiJet.Location = new Point(0, 217);
|
|
|
|
this.ControlVisible(false);
|
|
|
|
if (this.ParentForm.ParentForm.SystemConfig2.IsEthernetEnable == true)
|
|
{
|
|
this.buttonStart.Enabled = true;
|
|
this.buttonStop.Enabled = true;
|
|
}
|
|
else
|
|
{
|
|
this.buttonStart.Enabled = false;
|
|
this.buttonStop.Enabled = false;
|
|
}
|
|
|
|
this.labelServerStatus.Text = "-";
|
|
this.labelClientStatus.Text = "-";
|
|
this.labelConnectedIP.Text = "-";
|
|
|
|
// Host IP
|
|
sValue = this.ParentForm.ParentForm.SystemConfig2.EthernetAddress.Split('.');
|
|
this.labelHostIP1.Text = sValue[0];
|
|
this.labelHostIP2.Text = sValue[1];
|
|
this.labelHostIP3.Text = sValue[2];
|
|
this.labelHostIP4.Text = sValue[3];
|
|
|
|
this.labelHostPort.Text = this.ParentForm.ParentForm.SystemConfig2.EthernetHostPort.ToString();
|
|
this.labelLocalPort.Text = this.ParentForm.ParentForm.SystemConfig2.EthernetLocalPort.ToString();
|
|
|
|
this.ChangeCommunicationMode();
|
|
|
|
this.buttonSaveClient.Enabled = false;
|
|
}
|
|
public void ChangeCommunicationMode()
|
|
{
|
|
this.comboBoxEthernetMode.Items.Clear();
|
|
this.comboBoxEthernetMode.SelectedIndexChanged -= new EventHandler(this.comboBoxEthernetMode_SelectedIndexChanged);
|
|
if (this.ParentForm.ParentForm.SystemConfig2.IsCommunicationOption == true)
|
|
{
|
|
this.comboBoxEthernetMode.Items.Add("None");
|
|
this.comboBoxEthernetMode.Items.Add("STD1");
|
|
this.comboBoxEthernetMode.Items.Add("Remote");
|
|
this.comboBoxEthernetMode.Items.Add("Printer");
|
|
this.comboBoxEthernetMode.Items.Add("imaje 9410 OPT1"); // 한맥 4
|
|
this.comboBoxEthernetMode.Items.Add("imaje 9028 OPT1"); // 한맥 5
|
|
this.comboBoxEthernetMode.Items.Add("OPT0"); // 대주 6
|
|
this.comboBoxEthernetMode.Items.Add("imaje 9410 OPT2"); // 한맥 7
|
|
this.comboBoxEthernetMode.Items.Add("imaje 9028 OPT2"); // 한맥 8
|
|
this.comboBoxEthernetMode.Items.Add("Hitachi"); // 히타치 9
|
|
this.comboBoxEthernetMode.Items.Add("MACSA Laser"); // MACSA 10
|
|
this.comboBoxEthernetMode.Items.Add("Markoprint"); // Markoprint 11
|
|
this.comboBoxEthernetMode.Items.Add("alphaJET"); // alphaJET 12
|
|
this.comboBoxEthernetMode.Items.Add("Marking(VJ1510)"); // VJ1510 13
|
|
this.comboBoxEthernetMode.Items.Add("OPT1"); // 금속검출기(액트라 - 안리쯔) 14
|
|
this.comboBoxEthernetMode.Items.Add("OPT2"); // NOW1(Now PPI에 사용) 15
|
|
this.comboBoxEthernetMode.Items.Add("OPC"); // 16
|
|
this.comboBoxEthernetMode.Items.Add("OPT3"); // 17
|
|
this.comboBoxEthernetMode.Items.Add("HP-200"); // 18
|
|
this.comboBoxEthernetMode.Items.Add("Smart Jet"); // 19
|
|
this.comboBoxEthernetMode.Items.Add("imaje 9410 OPT3"); // 한맥 20
|
|
this.comboBoxEthernetMode.Items.Add("RFID Speedway R420"); // Impinj Speedway-R420(RFID) 21
|
|
this.comboBoxEthernetMode.Items.Add("Modbus TCP"); // 모드버스 TCP 22
|
|
this.comboBoxEthernetMode.Items.Add("STD2"); // STD2 23
|
|
this.comboBoxEthernetMode.Items.Add("MULTi-JET"); // MULTi-JET 24
|
|
this.comboBoxEthernetMode.Items.Add("DJ(VIDEOJET)"); // DJ VIDEOJET 25
|
|
this.comboBoxEthernetMode.Items.Add("LINX8830"); // LINX8830 잉크젯 프린터 26
|
|
this.comboBoxEthernetMode.Items.Add("MYJET"); // MYJET 잉크젯 프린터 27
|
|
this.comboBoxEthernetMode.Items.Add("OPT4"); // 바코드 값과 함께 전송(Tasco건) 28
|
|
}
|
|
else
|
|
{
|
|
this.comboBoxEthernetMode.Items.Add("None");
|
|
this.comboBoxEthernetMode.Items.Add("STD1");
|
|
this.comboBoxEthernetMode.Items.Add("Remote");
|
|
this.comboBoxEthernetMode.Items.Add("Printer");
|
|
this.comboBoxEthernetMode.Items.Add("STD2"); // STD2 23
|
|
}
|
|
this.comboBoxEthernetMode.SelectedIndexChanged += new EventHandler(this.comboBoxEthernetMode_SelectedIndexChanged);
|
|
}
|
|
|
|
public void DisplayLabelReceive(string sValue)
|
|
{
|
|
this.labelReceive.Text = sValue;
|
|
}
|
|
public void DisplayLabelLocalPort(bool bValue)
|
|
{
|
|
if (bValue == false)
|
|
{
|
|
this.labelLocalPort.Enabled = false;
|
|
this.labelLocalPort.BackColor = Color.Silver;
|
|
}
|
|
else
|
|
{
|
|
this.labelLocalPort.Enabled = true;
|
|
this.labelLocalPort.BackColor = Color.White;
|
|
}
|
|
}
|
|
public void UpdateEthernetStatusDisplay(string value)
|
|
{
|
|
if (this.labelClientStatus.Text != value)
|
|
this.labelClientStatus.Text = value;
|
|
}
|
|
private void UpdateLabelFormatDisplay()
|
|
{
|
|
this.buttonTestSend.Enabled = true;
|
|
|
|
if (this.ParentForm.ParentForm.SystemConfig2.IsCommunicationOption == false)
|
|
{
|
|
switch (this.comboBoxEthernetMode.SelectedIndex)
|
|
{
|
|
case 0: // None
|
|
this.labelFormat.Text = "";
|
|
break;
|
|
case 1: // STD1
|
|
this.labelFormat.Text = "STX[1],ID[5],No[4],U[6],P[6],O[6],Grd[1],Sign[1],Weight[6],ETX[1]";
|
|
break;
|
|
case 2: // Remote
|
|
this.labelFormat.Text = "STX[1],No[2],Grd[1],Weight[6],ETX[1]";
|
|
break;
|
|
case 3: // Printer
|
|
this.labelFormat.Text = "No[4],Grd[8],Weight[10],CNT[10]";
|
|
break;
|
|
case 4: // STD2
|
|
this.labelFormat.Text = "STX[1],ID[5],No[4],U[6],P[6],O[6],UC[7],PC[7],OC[7],ExC[7],TC[9],Grd[1],Sign[1],Weight[6],ETX[1]";
|
|
break;
|
|
default:
|
|
this.labelFormat.Text = "";
|
|
break;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
switch (this.comboBoxEthernetMode.SelectedIndex)
|
|
{
|
|
case 0: // None
|
|
this.labelFormat.Text = "";
|
|
break;
|
|
case 1: // STD1
|
|
this.labelFormat.Text = "STX[1],ID[5],No[4],U[6],P[6],O[6],Grd[1],Sign[1],Weight[6],ETX[1]";
|
|
break;
|
|
case 2: // Remote
|
|
this.labelFormat.Text = "STX[1],No[2],Grd[1],Weight[6],ETX[1]";
|
|
break;
|
|
case 3: // Printer
|
|
this.labelFormat.Text = "No[4],Grd[8],Weight[10],CNT[10]";
|
|
break;
|
|
case 4: // markem-imaje 9410 OPT1
|
|
this.labelFormat.Text = "0xE8,0x00,0x08,0x01,0x00,0x05,W[5],Chksum[1]";
|
|
break;
|
|
case 5: // markem-imaje 9028 OPT1
|
|
this.labelFormat.Text = "0x99,0x00,0x07,0x12,W[5],0x12,Chksum[1]";
|
|
break;
|
|
case 6: // 노바렉스 대주
|
|
this.labelFormat.Text = "0x1B,EW----;1.00I,0x0D,0x1B,P1-0-000000000;A9mm;,W[6],0x0D,0x1B,EX----;,0x0D,0x02,TZ1.00I;13,0x0D,0x03";
|
|
break;
|
|
case 7: // markem-imaje 9410 OPT2
|
|
this.labelFormat.Text = "0xE8,0x00,0x08,0x01,0x00,0x05,W[5],Chksum[1]";
|
|
break;
|
|
case 8: // markem-imaje 9028 OPT2
|
|
this.labelFormat.Text = "0x05/0x99,0x00,0x07,0x12,W[5],0x12,Chksum[1]";
|
|
break;
|
|
case 9: // Hitachi
|
|
this.labelFormat.Text = "STX[1],Length[1],Room Number[1],W[5],ETX[1]";
|
|
break;
|
|
case 10: // MACSA Laser
|
|
this.labelFormat.Text = "STX[1],0xFE,0x41,0x30,0x06,W[6],Chk[1],(Chk[1]&0xff)[1],ETX[1]";
|
|
break;
|
|
case 11: // Markoprint
|
|
this.labelFormat.Text = "STX[1],TZcosmax.;00I;13,0x0D,W[6],Unit[1],0x0D,ETX[1]";
|
|
break;
|
|
case 12: // alphaJET
|
|
this.labelFormat.Text = "<GP><LOADLAB>label\\1234.txt</LOADLAB><DSET><DF aI=''1''>,W[6],Unit[1],</DF></DSET></GP>";
|
|
break;
|
|
case (int)DataStore.SerialMode.f13_Marking_VJ1510:
|
|
case (int)DataStore.SerialMode.f25_DJ_VIDEOJET:
|
|
this.labelFormat.Text = "STX[1],0x55,0x4B,0x0A,Weight[4](No Decimal point),ETX[1]";
|
|
break;
|
|
case 14: // OPT1
|
|
this.labelFormat.Text = "Start:STX[1],12,ETX[1], Stop:STX[1],13,ETX[1], Number change:STX[1],200,No[2],ETX[1]";
|
|
break;
|
|
case 15:
|
|
break;
|
|
case 16: // OPC
|
|
this.buttonTestSend.Enabled = false;
|
|
this.labelFormat.Text = "OPC : opc.tcp://192.168.4.10";
|
|
break;
|
|
case 17: // OPT3
|
|
this.labelFormat.Text = "STX[1],Date[9],Time[9],Count[9],grd[9],W[9],Lot[9],O[9],U[9],P[9],ETX[1]";
|
|
break;
|
|
case 18: // HP-200
|
|
this.labelFormat.Text = "Pass : 02 4a 30 2c W[6] 0d 04 / NG : 02 4a 30 2c 20 20 20 20 20 20 0d 04 -> Screen Update : 02 5a 04";
|
|
break;
|
|
case 19: // Smart Jet
|
|
this.labelFormat.Text = "STX[1], A01, WeightData[6], EOT[1]";
|
|
break;
|
|
case 20: // markem-imaje 9410 OPT3
|
|
this.labelFormat.Text = "0xE8,0x00,0x08,0x01,0x00,0x05,W[5],Chksum[1]";
|
|
break;
|
|
case (int)DataStore.EthernetMode.f22_Modbus_TCP: // Modbus_TCP
|
|
this.labelFormat.Text = "ID, Product No, Under, Pass, Over, Under Count, Pass Count, Over Count, NG Count, ExNG Count, Total Count, Grade, Weight, Status(Run/Stop)";
|
|
break;
|
|
case (int)DataStore.EthernetMode.f23_STD2: // STD2
|
|
this.labelFormat.Text = "STX[1],ID[5],No[4],U[6],P[6],O[6],UC[7],PC[7],OC[7],ExC[7],TC[9],Grd[1],Sign[1],Weight[6],ETX[1]";
|
|
break;
|
|
case (int)DataStore.EthernetMode.f24_MULTi_JET: // Multi-jet
|
|
this.labelFormat.Text = "0x1B,0x02,Slave Address[1],0x1D,0x02,0x01,0x0A,Date[10],0x02,0x07,Weight[6],'g',0x1B,0x03,Chksum[1]";
|
|
break;
|
|
case (int)DataStore.EthernetMode.f26_LINX8830: // LINX8830
|
|
this.labelFormat.Text = "0x1B,0x02,0x1D,0x06,0x00,Weight[6],0x1B,0x03";
|
|
break;
|
|
case (int)DataStore.EthernetMode.f27_MYJET: // MYJET
|
|
this.labelFormat.Text = "0x1B,0x02,IP[1],0x1D,0x01,0x01,0x06,Weight[6],0x1B,0x03,Checksum[1]";
|
|
break;
|
|
case (int)DataStore.EthernetMode.f28_OPT4: // OPT4
|
|
this.labelFormat.Text = "0x02,Date[yyyy-MM-dd HH:mm:ss, 19];Grade[1];Weight[6];Data,0x03";
|
|
break;
|
|
default:
|
|
this.buttonTestSend.Enabled = false;
|
|
this.labelFormat.Text = "Private use";
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
public void DisplayHiddenMenu(bool bValue)
|
|
{
|
|
if (bValue == true)
|
|
{
|
|
this.buttonPingTimer.Visible = true;
|
|
}
|
|
else
|
|
{
|
|
this.buttonPingTimer.Visible = false;
|
|
}
|
|
}
|
|
|
|
private void ButtonAddOnDisplay()
|
|
{
|
|
this.DisplayBottomSettingMenu();
|
|
|
|
if (this.comboBoxEthernetMode.SelectedIndex == (int)DataStore.EthernetMode.f9_Hitachi
|
|
|| this.comboBoxEthernetMode.SelectedIndex == (int)DataStore.EthernetMode.f11_Markoprint
|
|
|| this.comboBoxEthernetMode.SelectedIndex == (int)DataStore.EthernetMode.f16_OPC
|
|
|| this.comboBoxEthernetMode.SelectedIndex == (int)DataStore.EthernetMode.f22_Modbus_TCP
|
|
|| this.comboBoxEthernetMode.SelectedIndex == (int)DataStore.EthernetMode.f24_MULTi_JET)
|
|
this.buttonAddon.Visible = true;
|
|
else
|
|
this.buttonAddon.Visible = false;
|
|
}
|
|
private void ControlVisible(bool visible)
|
|
{
|
|
this.ControlHitachi.Visible = visible;
|
|
this.ControlMarkoprint.Visible = visible;
|
|
this.ControlModbusTCP.Visible = visible;
|
|
this.ControlMultiJet.Visible = visible;
|
|
}
|
|
private void DisplayBottomSettingMenu()
|
|
{
|
|
this.ControlVisible(false);
|
|
|
|
this.buttonTestSend.Enabled = true;
|
|
|
|
if (this.comboBoxEthernetMode.SelectedIndex == (int)DataStore.EthernetMode.f9_Hitachi)
|
|
{
|
|
this.ControlHitachi.Visible = true;
|
|
this.ControlHitachi.BringToFront();
|
|
this.ControlHitachi.DisplayRefresh(this.ParentForm.CurrentConfigurationMenu());
|
|
}
|
|
else if (this.comboBoxEthernetMode.SelectedIndex == (int)DataStore.EthernetMode.f11_Markoprint)
|
|
{
|
|
this.ControlMarkoprint.Visible = true;
|
|
this.ControlMarkoprint.BringToFront();
|
|
this.ControlMarkoprint.DisplayRefresh(this.ParentForm.CurrentConfigurationMenu());
|
|
}
|
|
else if (this.comboBoxEthernetMode.SelectedIndex == (int)DataStore.EthernetMode.f22_Modbus_TCP
|
|
|| this.comboBoxEthernetMode.SelectedIndex == (int)DataStore.EthernetMode.f16_OPC)
|
|
{
|
|
this.ControlModbusTCP.DisplayRefresh(this.ParentForm.CurrentConfigurationMenu());
|
|
this.ControlModbusTCP.Visible = true;
|
|
this.ControlModbusTCP.BringToFront();
|
|
}
|
|
else if (this.comboBoxEthernetMode.SelectedIndex == (int)DataStore.EthernetMode.f24_MULTi_JET)
|
|
{
|
|
this.ControlMultiJet.Visible = true;
|
|
this.ControlMultiJet.BringToFront();
|
|
this.ControlMultiJet.DisplayRefresh(this.ParentForm.CurrentConfigurationMenu());
|
|
}
|
|
else
|
|
{
|
|
|
|
}
|
|
}
|
|
|
|
private void ConnectedIPStatusOut(string value)
|
|
{
|
|
this.labelConnectedIP.Text = value;
|
|
}
|
|
public void DelegateConnectedIPStatusOut(string value)
|
|
{
|
|
this.Invoke(new ConnetedIPStatusCallback(this.ConnectedIPStatusOut), value);
|
|
}
|
|
|
|
public void DisplayRefresh(SystemStatus status)
|
|
{
|
|
this.ParentForm.ParentForm.CurrentSystemStatus.CurrentDisplay = DataStore.DisplayStore.ConfiEthernet;
|
|
this.ParentForm.ParentForm.SetDisplayMode(DataStore.DisplayMode.Menu);
|
|
this.ParentForm.DisplayTitleRoot(this.ParentForm.ParentForm.CurrentSystemStatus);
|
|
|
|
this.comboBoxEthernetMode.SelectedIndexChanged -= new EventHandler(this.comboBoxEthernetMode_SelectedIndexChanged);
|
|
this.comboBoxEthernetOpMode.SelectedIndexChanged -= new EventHandler(this.comboBoxEthernetOpMode_SelectedIndexChanged);
|
|
|
|
this.comboBoxEthernetOpMode.SelectedIndex = this.ParentForm.ParentForm.SystemConfig2.EthernetOperationMode;
|
|
if (this.ParentForm.ParentForm.SystemConfig2.IsCommunicationOption == false)
|
|
{
|
|
if (this.ParentForm.ParentForm.SystemConfig2.EthernetCommMode == (int)DataStore.EthernetMode.f23_STD2)
|
|
this.comboBoxEthernetMode.SelectedIndex = ModeSTD2;
|
|
else if (this.ParentForm.ParentForm.SystemConfig2.EthernetCommMode > this.comboBoxEthernetMode.Items.Count - 1)
|
|
{
|
|
this.comboBoxEthernetMode.SelectedIndex = 0;
|
|
this.ParentForm.ParentForm.SystemConfig2.EthernetCommMode = this.comboBoxEthernetMode.SelectedIndex;
|
|
this.ParentForm.ParentForm.SaveSystemConfigurationFile2(this.ParentForm.ParentForm.SystemConfig2);
|
|
}
|
|
else
|
|
this.comboBoxEthernetMode.SelectedIndex = this.ParentForm.ParentForm.SystemConfig2.EthernetCommMode;
|
|
}
|
|
else
|
|
this.comboBoxEthernetMode.SelectedIndex = this.ParentForm.ParentForm.SystemConfig2.EthernetCommMode;
|
|
if (this.ParentForm.ParentForm.SystemConfig2.EthernetCommMode == (int)DataStore.EthernetMode.f16_OPC)
|
|
this.comboBoxEthernetOpMode.Enabled = false;
|
|
|
|
this.comboBoxEthernetMode.SelectedIndexChanged += new EventHandler(this.comboBoxEthernetMode_SelectedIndexChanged);
|
|
this.comboBoxEthernetOpMode.SelectedIndexChanged += new EventHandler(this.comboBoxEthernetOpMode_SelectedIndexChanged);
|
|
|
|
this.UpdateLabelFormatDisplay();
|
|
|
|
this.DisplayHiddenMenu(false);
|
|
if (this.ParentForm.ParentForm.SystemConfig3.IsEthernetPingTimer == true)
|
|
{
|
|
this.buttonPingTimer.Text = "Ping Close";
|
|
this.buttonPingTimer.ButtonDown();
|
|
}
|
|
else
|
|
{
|
|
this.buttonPingTimer.Text = "Ping Open";
|
|
this.buttonPingTimer.ButtonUp();
|
|
}
|
|
|
|
if (this.comboBoxEthernetOpMode.SelectedIndex == 1)
|
|
{
|
|
this.buttonStart.Enabled = true;
|
|
this.buttonStop.Enabled = true;
|
|
|
|
if (string.Compare(this.ParentForm.ParentForm.smartConfigs.IPSettings.DeviceIP, "0.0.0.0") == 0)
|
|
{
|
|
if (this.labelServerStatus.Text != ">Addr Err")
|
|
this.labelServerStatus.Text = ">Addr Err";
|
|
|
|
this.timerServer.Enabled = false;
|
|
}
|
|
else
|
|
{
|
|
this.ParentForm.ParentForm.EthernetServerStart();
|
|
|
|
if (this.timerServer.Enabled != true)
|
|
this.timerServer.Enabled = true;
|
|
}
|
|
}
|
|
else if (this.comboBoxEthernetOpMode.SelectedIndex == 2)
|
|
{
|
|
this.buttonStart.Enabled = true;
|
|
this.buttonStop.Enabled = true;
|
|
|
|
this.ParentForm.ParentForm.EthernetClientConnect();
|
|
}
|
|
else
|
|
{
|
|
this.buttonStart.Enabled = false;
|
|
this.buttonStop.Enabled = false;
|
|
|
|
this.labelServerStatus.Text = "-";
|
|
this.labelClientStatus.Text = "-";
|
|
this.labelConnectedIP.Text = "-";
|
|
}
|
|
this.labelLocalPort.Text = this.ParentForm.ParentForm.SystemConfig2.EthernetLocalPort.ToString();
|
|
|
|
this.ButtonAddOnDisplay();
|
|
this.buttonSave.Enabled = false;
|
|
}
|
|
#endregion
|
|
|
|
#region Event Handler
|
|
private void buttonClientStart_Click(object sender, EventArgs e)
|
|
{
|
|
this.ParentForm.ParentForm.EthernetClientConnect();
|
|
}
|
|
private void buttonClientStop_Click(object sender, EventArgs e)
|
|
{
|
|
this.ParentForm.ParentForm.EthernetClientDisconnect();
|
|
}
|
|
private void buttonTestSend_Click(object sender, EventArgs e)
|
|
{
|
|
int tempStringLength = 0;
|
|
string tempString = "";
|
|
string str = "";
|
|
bool isFillZero = this.ParentForm.ParentForm.SystemConfig3.IsCharToFillZeroEthernet;
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
byte[] byteArray = new byte[12];
|
|
byte[] weightBytes = new byte[4];
|
|
byte[] bytes = new byte[100];
|
|
|
|
if (this.comboBoxEthernetMode.SelectedIndex == 0)
|
|
return;
|
|
|
|
switch (this.comboBoxEthernetMode.SelectedIndex)
|
|
{
|
|
case 1:
|
|
#region STD1
|
|
sb.Append((char)0x02);
|
|
sb.Append("IN001");
|
|
sb.Append("0001");
|
|
sb.Append(Helper.StringZeroFillDigits6(Helper.StringToDecimalPlaces("1000", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
|
|
sb.Append(Helper.StringZeroFillDigits6(Helper.StringToDecimalPlaces("2000", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
|
|
sb.Append(Helper.StringZeroFillDigits6(Helper.StringToDecimalPlaces("3000", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
|
|
sb.Append("P");
|
|
sb.Append(" ");
|
|
sb.Append(string.Format("{0, 6}", Helper.DoubleToString(123.4, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
|
|
sb.Append((char)0x03);
|
|
#endregion
|
|
break;
|
|
case 2:
|
|
#region Remote
|
|
sb.Append((char)0x02);
|
|
sb.Append("01");
|
|
sb.Append("P");
|
|
sb.Append("0");
|
|
sb.Append(Helper.StringToDecimalPlaces("1234", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces));
|
|
sb.Append((char)0x03);
|
|
#endregion
|
|
break;
|
|
case 3:
|
|
#region Printer
|
|
sb.Append("0001");
|
|
sb.Append(" Pass");
|
|
sb.Append(" " + Helper.StringToDecimalPlaces("1234", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces));
|
|
sb.Append("1234567890");
|
|
#endregion
|
|
break;
|
|
case 4:
|
|
if (this.ParentForm.ParentForm.SystemConfig2.IsCommunicationOption == false)
|
|
{
|
|
#region STD2
|
|
sb.Append((char)0x02);
|
|
sb.Append("IN001");
|
|
sb.Append("0001");
|
|
sb.Append(Helper.StringZeroFillDigits6(Helper.StringToDecimalPlaces("1000", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
|
|
sb.Append(Helper.StringZeroFillDigits6(Helper.StringToDecimalPlaces("2000", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
|
|
sb.Append(Helper.StringZeroFillDigits6(Helper.StringToDecimalPlaces("3000", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
|
|
sb.Append(string.Format("{0:0000000}", 11111));
|
|
sb.Append(string.Format("{0:0000000}", 22222));
|
|
sb.Append(string.Format("{0:0000000}", 33333));
|
|
sb.Append(string.Format("{0:0000000}", 11111));
|
|
sb.Append(string.Format("{0:000000000}", 77777));
|
|
sb.Append("P");
|
|
sb.Append(" ");
|
|
sb.Append(Helper.StringZeroFillDigits6(Helper.DoubleToString(123.4, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
|
|
sb.Append((char)0x03);
|
|
#endregion
|
|
}
|
|
else
|
|
{
|
|
#region imaje 9410 OPT1
|
|
byteArray = new byte[12];
|
|
weightBytes = new byte[5];
|
|
// 외부변수사용 : 0xE8
|
|
byteArray[0] = 0xE8;
|
|
// Length : 0x00, 0x08 고정값
|
|
byteArray[1] = 0x00;
|
|
byteArray[2] = 0x08;
|
|
|
|
byteArray[3] = 0x01; // 1번 외부변수 번호
|
|
byteArray[4] = 0x00;
|
|
byteArray[5] = 0x05; // 1번 외부변수 길이
|
|
|
|
tempString = string.Format("{0,5}", Helper.StringToWeight("1234", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces));
|
|
weightBytes = new UTF8Encoding().GetBytes(tempString);
|
|
for (int i = 0; i < weightBytes.Length; i++)
|
|
{
|
|
byteArray[i + 6] = weightBytes[i];
|
|
}
|
|
|
|
byteArray[11] = 0x00;
|
|
byteArray[11] = Helper.ChecksumCalculator(byteArray);
|
|
#endregion
|
|
}
|
|
break;
|
|
case 5:
|
|
#region imaje 9028 OPT1
|
|
byteArray = new byte[11];
|
|
weightBytes = new byte[5];
|
|
|
|
// byteArray[0] ~ byteArray[3]은 고정
|
|
byteArray[0] = 0x99;
|
|
byteArray[1] = 0x00;
|
|
byteArray[2] = 0x07;
|
|
byteArray[3] = 0x12;
|
|
|
|
weightBytes = new UTF8Encoding().GetBytes(string.Format("{0,5}", Helper.StringToWeight("1234", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
|
|
for (int i = 0; i < weightBytes.Length; i++)
|
|
{
|
|
byteArray[i + 4] = weightBytes[i];
|
|
}
|
|
|
|
byteArray[9] = 0x12;
|
|
byteArray[10] = 0x00;
|
|
byteArray[10] = Helper.ChecksumCalculator(byteArray);
|
|
#endregion
|
|
break;
|
|
case 6:
|
|
#region OPT3 - 노바렉스 대주
|
|
sb.Append((char)0x1B);
|
|
sb.Append("EW----;1.00I");
|
|
sb.Append((char)0x0D);
|
|
sb.Append((char)0x1B);
|
|
sb.Append("P1-0-000000000;A9mm;");
|
|
sb.Append(string.Format("{0,6}", Helper.StringToWeight("1234", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
|
|
sb.Append((char)0x0D);
|
|
sb.Append((char)0x1B);
|
|
sb.Append("EX----;");
|
|
sb.Append((char)0x0D);
|
|
sb.Append((char)0x02);
|
|
sb.Append("TZ1.00I;13");
|
|
sb.Append((char)0x0D);
|
|
sb.Append((char)0x03);
|
|
#endregion
|
|
break;
|
|
case 7:
|
|
#region imaje 9410 OPT2
|
|
byteArray = new byte[12];
|
|
weightBytes = new byte[5];
|
|
|
|
// 외부변수사용 : 0xE8
|
|
byteArray[0] = 0xE8;
|
|
// Length : 0x00, 0x08 고정값
|
|
byteArray[1] = 0x00;
|
|
byteArray[2] = 0x08;
|
|
|
|
byteArray[3] = 0x01; // 1번 외부변수 번호
|
|
byteArray[4] = 0x00;
|
|
byteArray[5] = 0x05; // 1번 외부변수 길이
|
|
|
|
if (this.ParentForm.ParentForm.CurrentWeightData.JudgmentStatus == DataStore.JudgmentStatus.Pass)
|
|
{
|
|
tempString = string.Format("{0,5}", Helper.StringToWeight("1234", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces));
|
|
weightBytes = new UTF8Encoding().GetBytes(tempString);
|
|
for (int i = 0; i < weightBytes.Length; i++)
|
|
{
|
|
byteArray[i + 6] = weightBytes[i];
|
|
}
|
|
}
|
|
else
|
|
{
|
|
for (int i = 0; i < 5; i++)
|
|
{
|
|
byteArray[i + 6] = 0x20;
|
|
}
|
|
}
|
|
|
|
byteArray[11] = 0x00;
|
|
byteArray[11] = Helper.ChecksumCalculator(byteArray);
|
|
#endregion
|
|
break;
|
|
case 8:
|
|
#region imaje 9028 OPT2
|
|
byteArray = new byte[11];
|
|
weightBytes = new byte[5];
|
|
|
|
switch (this.ParentForm.ParentForm.SystemConfig2.EthernetOperationMode)
|
|
{
|
|
case 1:
|
|
if (this.ParentForm.ParentForm.smartTCPMultiServer.ClientInfoList != null)
|
|
{
|
|
foreach (SmartTCPMultiServer.CLIENTSINFOS client in this.ParentForm.ParentForm.smartTCPMultiServer.ClientInfoList)
|
|
{
|
|
this.ParentForm.ParentForm.EthernetServerSendMessage(client, this.ParentForm.ParentForm.SendChar(DataStore.CharValue.ENQ));
|
|
}
|
|
}
|
|
break;
|
|
case 2:
|
|
this.ParentForm.ParentForm.EthernetWeightData(this.ParentForm.ParentForm.SendChar(DataStore.CharValue.ENQ));
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
|
|
Thread.Sleep(30);
|
|
|
|
// 중량발송 : 0x99
|
|
byteArray[0] = 0x99;
|
|
|
|
// Length : 0x00, 0x02 고정값
|
|
byteArray[1] = 0x00;
|
|
byteArray[2] = 0x07;
|
|
byteArray[3] = 0x12;
|
|
|
|
if (this.ParentForm.ParentForm.CurrentWeightData.JudgmentStatus == DataStore.JudgmentStatus.Pass)
|
|
{
|
|
tempString = string.Format("{0,5}", Helper.StringToWeight("1234", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces));
|
|
weightBytes = new UTF8Encoding().GetBytes(tempString);
|
|
for (int i = 0; i < weightBytes.Length; i++)
|
|
{
|
|
byteArray[i + 4] = weightBytes[i];
|
|
}
|
|
}
|
|
else
|
|
{
|
|
for (int i = 0; i < 5; i++)
|
|
{
|
|
byteArray[i + 4] = 0x20;
|
|
}
|
|
}
|
|
|
|
byteArray[9] = 0x12;
|
|
byteArray[10] = 0x00;
|
|
byteArray[10] = Helper.ChecksumCalculator(byteArray);
|
|
#endregion
|
|
break;
|
|
case 9:
|
|
#region Hitachi
|
|
sb.Append((char)0x02);
|
|
sb.Append((char)0x10);
|
|
sb.Append((char)0x31);
|
|
sb.Append(string.Format("{0,6}", Helper.StringToWeight("1234", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
|
|
sb.Append((char)0x03);
|
|
#endregion
|
|
break;
|
|
case 10:
|
|
#region MACSA Laser
|
|
byteArray = new byte[14];
|
|
bytes = new byte[6];
|
|
byte sum = 0x00;
|
|
|
|
byteArray[0] = 0x02;
|
|
byteArray[1] = 0xFE;
|
|
byteArray[2] = 0x41;
|
|
byteArray[3] = 0x30;
|
|
byteArray[4] = 0x06;
|
|
|
|
bytes = new UTF8Encoding().GetBytes(string.Format("{0,6}", Helper.StringToWeight("1234", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
|
|
|
|
for (int i = 0; i < bytes.Length; i++)
|
|
{
|
|
byteArray[i + 5] = bytes[i];
|
|
}
|
|
|
|
byteArray[11] = byteArray[12] = byteArray[13] = 0x00;
|
|
byteArray[11] = Helper.ChecksumCalculator(byteArray);
|
|
byteArray[12] = (byte)(byteArray[11] & 0x00ff);
|
|
byteArray[13] = 0x03;
|
|
#endregion
|
|
break;
|
|
case 11:
|
|
#region Markoprint
|
|
byteArray = new byte[50];
|
|
bytes = new byte[30];
|
|
weightBytes = new byte[30];
|
|
string strCosmax = "TZcosmax.00I;13";
|
|
string strCosmax2 = "TZcosmax2.00I;13";
|
|
string strDate = string.Format("{0:yyyy.MM.dd}", DateTime.Now);
|
|
string str2 = "";
|
|
|
|
byteArray[0] = 0x02; // <STX>
|
|
|
|
bytes = new UTF8Encoding().GetBytes(strCosmax);
|
|
for (int i = 0; i < bytes.Length; i++)
|
|
{
|
|
byteArray[i + 1] = bytes[i];
|
|
}
|
|
|
|
byteArray[strCosmax.Length + 1] = 0x0D;
|
|
|
|
weightBytes = new UTF8Encoding().GetBytes(string.Format("{0,6}{1}", Helper.StringToWeight("1234", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces), this.ParentForm.ParentForm.SystemConfig1.Unit));
|
|
|
|
for (int i = 0; i < weightBytes.Length; i++)
|
|
{
|
|
byteArray[i + strCosmax.Length + 2] = weightBytes[i];
|
|
}
|
|
|
|
byteArray[strCosmax.Length + weightBytes.Length + 2] = 0x0D;
|
|
byteArray[strCosmax.Length + weightBytes.Length + 3] = 0x03;
|
|
#endregion
|
|
break;
|
|
case 12:
|
|
#region alphaJET
|
|
byteArray = new byte[150];
|
|
bytes = new byte[100];
|
|
weightBytes = new byte[20];
|
|
int length = 0;
|
|
string fileName = "label\\1234.txt";
|
|
|
|
bytes = new UTF8Encoding().GetBytes("<GP><LOADLAB>" + fileName + "</LOADLAB><DSET>" + @"<DF aI=""1"">");
|
|
for (int i = 0; i < bytes.Length; i++)
|
|
{
|
|
byteArray[i] = bytes[i];
|
|
}
|
|
|
|
length = bytes.Length;
|
|
|
|
///////////////////////////////////////////
|
|
|
|
weightBytes = new UTF8Encoding().GetBytes(string.Format("{0,6}{1}", Helper.StringToWeight("1234", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces), this.ParentForm.ParentForm.SystemConfig1.Unit));
|
|
|
|
for (int i = 0; i < weightBytes.Length; i++)
|
|
{
|
|
byteArray[i + length] = weightBytes[i];
|
|
}
|
|
|
|
length = length + weightBytes.Length;
|
|
|
|
////////////////////////////////////////////
|
|
|
|
bytes = new UTF8Encoding().GetBytes("</DF>");
|
|
for (int i = 0; i < bytes.Length; i++)
|
|
{
|
|
byteArray[i + length] = bytes[i];
|
|
}
|
|
|
|
length = length + bytes.Length;
|
|
|
|
bytes = new UTF8Encoding().GetBytes("</DSET></GP>");
|
|
for (int i = 0; i < bytes.Length; i++)
|
|
{
|
|
byteArray[i + length] = bytes[i];
|
|
}
|
|
#endregion
|
|
break;
|
|
case (int)DataStore.SerialMode.f13_Marking_VJ1510:
|
|
case (int)DataStore.SerialMode.f25_DJ_VIDEOJET:
|
|
#region Marking(VJ1510)
|
|
byteArray = new byte[9];
|
|
|
|
sb.Append((char)0x02);
|
|
sb.Append((char)0x55); // U(고정)
|
|
sb.Append((char)0x4B); // K(고정)
|
|
sb.Append((char)0x0A); // LF(고정)
|
|
sb.Append("1234");
|
|
sb.Append((char)0x03);
|
|
#endregion
|
|
break;
|
|
case 14:
|
|
#region OPT1
|
|
sb.Append((char)0x02);
|
|
sb.Append("20001");
|
|
sb.Append((char)0x03);
|
|
#endregion
|
|
break;
|
|
case 15:
|
|
break;
|
|
case 16:
|
|
break;
|
|
case 17:
|
|
#region OPT3
|
|
string tempValue = "";
|
|
DateTime dt = DateTime.Now;
|
|
|
|
sb.Append((char)0x02);
|
|
sb.Append(string.Format(" {0:yyyyMMdd}", dt));
|
|
sb.Append(string.Format(" {0:HH:mm:ss}", dt));
|
|
sb.Append(" 12345");
|
|
sb.Append(" P");
|
|
sb.Append(string.Format("{0,9}", 123.4));
|
|
if (this.ParentForm.ParentForm.CurrentProductItem.LotNo.Length > 9)
|
|
sb.Append(this.ParentForm.ParentForm.CurrentProductItem.LotNo.Substring(0, 9));
|
|
else
|
|
sb.Append(this.ParentForm.ParentForm.CurrentProductItem.LotNo.PadLeft(9, ' '));
|
|
sb.Append((Helper.StringToDecimalPlaces(this.ParentForm.ParentForm.CurrentProductItem.OverRange, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)).PadLeft(9));
|
|
sb.Append((Helper.StringToDecimalPlaces(this.ParentForm.ParentForm.CurrentProductItem.UnderRange, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)).PadLeft(9));
|
|
sb.Append((Helper.StringToDecimalPlaces(this.ParentForm.ParentForm.CurrentProductItem.PassRange, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)).PadLeft(9));
|
|
sb.Append((char)0x03);
|
|
#endregion
|
|
break;
|
|
case 18:
|
|
#region HP-200
|
|
sb.Append((char)0x02);
|
|
sb.Append((char)0x4a);
|
|
sb.Append((char)0x30);
|
|
sb.Append((char)0x2c);
|
|
sb.Append(" 123.4");
|
|
sb.Append((char)0x0d);
|
|
sb.Append((char)0x04);
|
|
|
|
switch (this.ParentForm.ParentForm.SystemConfig2.EthernetOperationMode)
|
|
{
|
|
case 1:
|
|
if (this.ParentForm.ParentForm.smartTCPMultiServer.ClientInfoList != null)
|
|
{
|
|
foreach (SmartTCPMultiServer.CLIENTSINFOS client in this.ParentForm.ParentForm.smartTCPMultiServer.ClientInfoList)
|
|
this.ParentForm.ParentForm.EthernetServerSendMessage(client, sb.ToString());
|
|
}
|
|
break;
|
|
case 2:
|
|
this.ParentForm.ParentForm.EthernetWeightData(sb.ToString());
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
|
|
sb = new StringBuilder();
|
|
|
|
sb.Append((char)0x02);
|
|
sb.Append((char)0x5a);
|
|
sb.Append((char)0x04);
|
|
#endregion
|
|
break;
|
|
case 19:
|
|
#region Smart Jet
|
|
sb.Append((char)0x02);
|
|
sb.Append("A01");
|
|
sb.Append(" 12.34");
|
|
sb.Append((char)0x04);
|
|
#endregion
|
|
break;
|
|
case 20:
|
|
#region imaje 9410 OPT3
|
|
byteArray = new byte[12];
|
|
weightBytes = new byte[5];
|
|
|
|
// 외부변수사용 : 0xE8
|
|
byteArray[0] = 0xE8;
|
|
// Length : 0x00, 0x08 고정값
|
|
byteArray[1] = 0x00;
|
|
byteArray[2] = 0x08;
|
|
|
|
byteArray[3] = 0x01; // 1번 외부변수 번호
|
|
byteArray[4] = 0x00;
|
|
byteArray[5] = 0x05; // 1번 외부변수 길이
|
|
|
|
weightBytes = new UTF8Encoding().GetBytes(string.Format("{0,5}", Helper.StringToWeight("1234", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
|
|
for (int i = 0; i < weightBytes.Length; i++)
|
|
{
|
|
byteArray[i + 6] = weightBytes[i];
|
|
}
|
|
|
|
byteArray[11] = 0x00;
|
|
byteArray[11] = Helper.ChecksumCalculator(byteArray);
|
|
#endregion
|
|
break;
|
|
case (int)DataStore.EthernetMode.f22_Modbus_TCP:
|
|
#region Modbus TCP(16. Write Multiple Registers)
|
|
if (this.ParentForm.ParentForm.SystemConfig2.ModbusTCPSelectFunction == (int)DataStore.ModbusFunction._16_WriteMultipleRegister)
|
|
{
|
|
byte[] sendData = this.ParentForm.ParentForm.Modbus.MakeTCPSendAllData(this.ParentForm.ParentForm.Transfer_22_Modbus_Write(), this.ParentForm.ParentForm.SystemConfig3.ModbusTCPStartAddress);
|
|
|
|
this.ParentForm.ParentForm.EthernetWeightDataForModbus(sendData);
|
|
}
|
|
#endregion
|
|
break;
|
|
case (int)DataStore.EthernetMode.f23_STD2:
|
|
#region STD2
|
|
sb.Append((char)0x02);
|
|
sb.Append("IN001");
|
|
sb.Append("0001");
|
|
sb.Append(Helper.StringZeroFillDigits6(Helper.StringToDecimalPlaces("1000", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
|
|
sb.Append(Helper.StringZeroFillDigits6(Helper.StringToDecimalPlaces("2000", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
|
|
sb.Append(Helper.StringZeroFillDigits6(Helper.StringToDecimalPlaces("3000", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
|
|
sb.Append(string.Format("{0:0000000}", 11111));
|
|
sb.Append(string.Format("{0:0000000}", 22222));
|
|
sb.Append(string.Format("{0:0000000}", 33333));
|
|
sb.Append(string.Format("{0:0000000}", 11111));
|
|
sb.Append(string.Format("{0:000000000}", 77777));
|
|
sb.Append("P");
|
|
sb.Append(" ");
|
|
sb.Append(string.Format("{0, 6}", Helper.DoubleToString(123.4, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
|
|
sb.Append((char)0x03);
|
|
#endregion
|
|
break;
|
|
case (int)DataStore.EthernetMode.f24_MULTi_JET:
|
|
#region MULTi_JET
|
|
byte slaveAddress = 1;
|
|
byteArray = new byte[29];
|
|
bytes = new byte[7];
|
|
byte[] date = new UTF8Encoding().GetBytes(string.Format("{0:yyyy.MM.dd}", DateTime.Now));
|
|
|
|
byteArray[0] = 0x1B;
|
|
byteArray[1] = 0x02;
|
|
slaveAddress = Convert.ToByte(this.ParentForm.ParentForm.SystemConfig2.MULTiJETSlaveAddressEthernet);
|
|
byteArray[2] = slaveAddress;
|
|
byteArray[3] = 0x1D; // 고정값, 원격 필드 데이터 다운로드(1D)
|
|
byteArray[4] = 0x02; // 데이터 개수
|
|
byteArray[5] = 0x01; // 필드ID(마킹기 화면에서 설정 가능)
|
|
byteArray[6] = 0x0A; // 현재 필드ID 자리수
|
|
for (int i = 0; i < date.Length; i++)
|
|
byteArray[7 + i] = date[i];
|
|
byteArray[17] = 0x02; // 필드ID(마킹기 화면에서 설정 가능)
|
|
byteArray[18] = 0x07; // 현재 필드ID 자리수
|
|
tempString = "123.4g ";
|
|
for (int i = 0; i < tempString.Length; i++)
|
|
{
|
|
bytes[i] = Convert.ToByte(tempString[i]);
|
|
byteArray[19 + i] = bytes[i];
|
|
}
|
|
byteArray[26] = 0x1B;
|
|
byteArray[27] = 0x03;
|
|
byteArray[28] = this.ParentForm.ParentForm.Checksumcalculator1digit(byteArray);
|
|
#endregion
|
|
break;
|
|
case (int)DataStore.EthernetMode.f26_LINX8830:
|
|
#region LINX8830
|
|
// 0~4 고정값
|
|
sb.Append((char)0x1b);
|
|
sb.Append((char)0x02);
|
|
sb.Append((char)0x1D);
|
|
sb.Append((char)0x06);
|
|
sb.Append((char)0x00);
|
|
|
|
if (isFillZero == true)
|
|
sb.Append(Helper.StringZeroFillDigits6(Helper.DoubleToString(123.4, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
|
|
else
|
|
sb.Append(this.ParentForm.ParentForm.PadLeft(6, Helper.DoubleToString(123.4, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
|
|
|
|
// 11~12 고정값
|
|
sb.Append((char)0x1b);
|
|
sb.Append((char)0x03);
|
|
#endregion
|
|
break;
|
|
case (int)DataStore.EthernetMode.f27_MYJET:
|
|
#region MYJET
|
|
byteArray = new byte[16];
|
|
bytes = new byte[6];
|
|
|
|
// 0~6 고정값
|
|
byteArray[0] = 0x1B;
|
|
byteArray[1] = 0x02;
|
|
string[] ethernetAddr = this.ParentForm.ParentForm.SystemConfig2.EthernetAddress.Split('.');
|
|
byteArray[2] = Helper.StringToHex(ethernetAddr[ethernetAddr.Length - 1]); // Server IP 맨 마지막자리
|
|
byteArray[3] = 0x1D;
|
|
byteArray[4] = 0x01;
|
|
byteArray[5] = 0x01;
|
|
byteArray[6] = 0x06;
|
|
|
|
if (isFillZero == true)
|
|
bytes = new UTF8Encoding().GetBytes(Helper.StringZeroFillDigits6(Helper.DoubleToString(123.4, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
|
|
else
|
|
bytes = new UTF8Encoding().GetBytes(this.ParentForm.ParentForm.PadLeft(6, Helper.DoubleToString(123.4, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
|
|
|
|
for (int i = 0; i < bytes.Length; i++)
|
|
{
|
|
byteArray[i + 7] = bytes[i];
|
|
}
|
|
|
|
// 13~14 고정값
|
|
byteArray[13] = 0x1B;
|
|
byteArray[14] = 0x03;
|
|
|
|
byteArray[15] = 0x00;
|
|
byteArray[15] = this.ParentForm.ParentForm.Checksumcalculator1digit(byteArray);
|
|
#endregion
|
|
break;
|
|
case (int)DataStore.EthernetMode.f28_OPT4:
|
|
#region OPT4
|
|
sb.Append((char)0x02);
|
|
sb.Append(string.Format("{0:yyyy-MM-dd-HH:mm:ss}", DateTime.Now));
|
|
sb.Append(";");
|
|
sb.Append("P");
|
|
sb.Append(";");
|
|
sb.Append(Helper.StringZeroFillDigits6(Helper.DoubleToString(123.4, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces)));
|
|
sb.Append(";");
|
|
sb.Append(this.ParentForm.ParentForm.CurrentBarcode.BarcodePeek());
|
|
sb.Append((char)0x03);
|
|
#endregion
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
|
|
switch (this.ParentForm.ParentForm.SystemConfig2.EthernetOperationMode)
|
|
{
|
|
case 1:
|
|
|
|
if (this.ParentForm.ParentForm.smartTCPMultiServer.ClientInfoList != null)
|
|
{
|
|
foreach (SmartTCPMultiServer.CLIENTSINFOS client in this.ParentForm.ParentForm.smartTCPMultiServer.ClientInfoList)
|
|
{
|
|
if (sb.ToString() == "")
|
|
this.ParentForm.ParentForm.EthernetServerSendMessage(client, byteArray);
|
|
else
|
|
this.ParentForm.ParentForm.EthernetServerSendMessage(client, sb.ToString());
|
|
}
|
|
}
|
|
break;
|
|
case 2:
|
|
if (sb.ToString() == "")
|
|
this.ParentForm.ParentForm.EthernetWeightData(byteArray);
|
|
else
|
|
this.ParentForm.ParentForm.EthernetWeightData(sb.ToString());
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
private void buttonSaveClient_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
this.ParentForm.ParentForm.SystemConfig2.EthernetHostPort = int.Parse(this.labelHostPort.Text);
|
|
}
|
|
catch
|
|
{
|
|
this.ParentForm.ParentForm.SystemConfig2.EthernetHostPort = 0;
|
|
}
|
|
|
|
this.ParentForm.ParentForm.SystemConfig2.EthernetAddress = string.Format("{0}.{1}.{2}.{3}",
|
|
this.labelHostIP1.Text, this.labelHostIP2.Text, this.labelHostIP3.Text, this.labelHostIP4.Text);
|
|
|
|
this.ParentForm.ParentForm.SaveSystemConfigurationFile2(this.ParentForm.ParentForm.SystemConfig2);
|
|
this.ParentForm.ParentForm.EthernetClientDisconnect();
|
|
this.buttonSaveClient.Enabled = false;
|
|
}
|
|
|
|
private void labelHostPort_Click(object sender, EventArgs e)
|
|
{
|
|
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelHostPort.Text, 5, 0, false, this.ParentForm.ParentForm.SystemConfig1.Language);
|
|
|
|
if (myKeyPad.ShowDialog() == DialogResult.OK)
|
|
{
|
|
this.labelHostPort.Text = myKeyPad.StringValue;
|
|
this.buttonSaveClient.Enabled = true;
|
|
}
|
|
}
|
|
private void labelHostIP1_Click(object sender, EventArgs e)
|
|
{
|
|
string temp = "";
|
|
|
|
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelHostIP1.Text, 3, 0, false, this.ParentForm.ParentForm.SystemConfig1.Language);
|
|
|
|
if (myKeyPad.ShowDialog() == DialogResult.OK)
|
|
{
|
|
if (myKeyPad.IntValue > 255)
|
|
{
|
|
temp = "0 ~ 255";
|
|
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig1.Language, temp);
|
|
myMsg.ShowDialog();
|
|
}
|
|
else
|
|
{
|
|
this.labelHostIP1.Text = myKeyPad.StringValue;
|
|
this.buttonSaveClient.Enabled = true;
|
|
}
|
|
}
|
|
}
|
|
private void labelHostIP2_Click(object sender, EventArgs e)
|
|
{
|
|
string temp = "";
|
|
|
|
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelHostIP2.Text, 3, 0, false, this.ParentForm.ParentForm.SystemConfig1.Language);
|
|
|
|
if (myKeyPad.ShowDialog() == DialogResult.OK)
|
|
{
|
|
if (myKeyPad.IntValue > 255)
|
|
{
|
|
temp = "0 ~ 255";
|
|
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig1.Language, temp);
|
|
myMsg.ShowDialog();
|
|
}
|
|
else
|
|
{
|
|
this.labelHostIP2.Text = myKeyPad.StringValue;
|
|
this.buttonSaveClient.Enabled = true;
|
|
}
|
|
}
|
|
}
|
|
private void labelHostIP3_Click(object sender, EventArgs e)
|
|
{
|
|
string temp = "";
|
|
|
|
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelHostIP3.Text, 3, 0, false, this.ParentForm.ParentForm.SystemConfig1.Language);
|
|
|
|
if (myKeyPad.ShowDialog() == DialogResult.OK)
|
|
{
|
|
if (myKeyPad.IntValue > 255)
|
|
{
|
|
temp = "0 ~ 255";
|
|
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig1.Language, temp);
|
|
myMsg.ShowDialog();
|
|
}
|
|
else
|
|
{
|
|
this.labelHostIP3.Text = myKeyPad.StringValue;
|
|
this.buttonSaveClient.Enabled = true;
|
|
}
|
|
}
|
|
}
|
|
private void labelHostIP4_Click(object sender, EventArgs e)
|
|
{
|
|
string temp = "";
|
|
|
|
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelHostIP4.Text, 3, 0, false, this.ParentForm.ParentForm.SystemConfig1.Language);
|
|
|
|
if (myKeyPad.ShowDialog() == DialogResult.OK)
|
|
{
|
|
if (myKeyPad.IntValue > 255)
|
|
{
|
|
temp = "0 ~ 255";
|
|
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig1.Language, temp);
|
|
myMsg.ShowDialog();
|
|
}
|
|
else
|
|
{
|
|
this.labelHostIP4.Text = myKeyPad.StringValue;
|
|
this.buttonSaveClient.Enabled = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void timerServer_Tick(object sender, EventArgs e)
|
|
{
|
|
if (this.ParentForm.ParentForm.smartTCPMultiServer.IsStart == true)
|
|
{
|
|
if (this.labelServerStatus.Text != ">Start")
|
|
this.labelServerStatus.Text = ">Start";
|
|
|
|
this.smartListBoxClientList.ClearAll();
|
|
this.labelClientCount.Text = "-";
|
|
this.labelConnectedIP.Text = "-";
|
|
|
|
if (this.ParentForm.ParentForm.smartTCPMultiServer.ClientInfoList != null)
|
|
{
|
|
int length = this.ParentForm.ParentForm.smartTCPMultiServer.ClientInfoList.Length;
|
|
for (int i = 0; i < length; i++)
|
|
{
|
|
this.smartListBoxClientList.AddItem(
|
|
this.ParentForm.ParentForm.smartTCPMultiServer.ClientInfoList[i].strID + ", " +
|
|
this.ParentForm.ParentForm.smartTCPMultiServer.ClientInfoList[i].strIPAddress);
|
|
}
|
|
|
|
this.labelClientCount.Text = length.ToString();
|
|
if (this.ParentForm.ParentForm.smartTCPMultiServer.ClientInfoList == null)
|
|
this.labelConnectedIP.Text = "-";
|
|
else
|
|
this.labelConnectedIP.Text = this.ParentForm.ParentForm.smartTCPMultiServer.ClientInfoList[0].strIPAddress;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (this.labelServerStatus.Text != ">Stop")
|
|
this.labelServerStatus.Text = ">Stop";
|
|
|
|
this.smartListBoxClientList.ClearAll();
|
|
this.labelClientCount.Text = "-";
|
|
}
|
|
}
|
|
private void labelLocalPort_Click(object sender, EventArgs e)
|
|
{
|
|
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelLocalPort.Text, 5, 0, false, this.ParentForm.ParentForm.SystemConfig1.Language);
|
|
|
|
if (myKeyPad.ShowDialog() == DialogResult.OK)
|
|
{
|
|
this.labelLocalPort.Text = myKeyPad.StringValue;
|
|
this.ParentForm.ParentForm.SystemConfig2.EthernetLocalPort = myKeyPad.IntValue;
|
|
this.ParentForm.ParentForm.SaveSystemConfigurationFile2(this.ParentForm.ParentForm.SystemConfig2);
|
|
this.ParentForm.ParentForm.smartTCPMultiServer.Port = myKeyPad.IntValue;
|
|
}
|
|
}
|
|
|
|
private void buttonStart_Click(object sender, EventArgs e)
|
|
{
|
|
if (this.ParentForm.ParentForm.SystemConfig2.EthernetOperationMode == 1)
|
|
{
|
|
this.buttonStart.Enabled = true;
|
|
this.buttonStop.Enabled = true;
|
|
|
|
if (string.Compare(this.ParentForm.ParentForm.smartConfigs.IPSettings.DeviceIP, "0.0.0.0") == 0)
|
|
{
|
|
if (this.labelServerStatus.Text != ">Addr Err")
|
|
this.labelServerStatus.Text = ">Addr Err";
|
|
|
|
this.timerServer.Enabled = false;
|
|
}
|
|
else
|
|
{
|
|
this.ParentForm.ParentForm.EthernetServerStart();
|
|
|
|
if (this.timerServer.Enabled != true)
|
|
this.timerServer.Enabled = true;
|
|
}
|
|
}
|
|
else if (this.ParentForm.ParentForm.SystemConfig2.EthernetOperationMode == 2)
|
|
{
|
|
this.buttonStart.Enabled = true;
|
|
this.buttonStop.Enabled = true;
|
|
|
|
this.ParentForm.ParentForm.EthernetClientConnect();
|
|
}
|
|
}
|
|
private void buttonStop_Click(object sender, EventArgs e)
|
|
{
|
|
if (this.ParentForm.ParentForm.SystemConfig2.EthernetOperationMode == 1)
|
|
{
|
|
this.timerServer.Enabled = false;
|
|
this.ParentForm.ParentForm.EthernetServerStop();
|
|
|
|
if (this.labelServerStatus.Text != ">Stop")
|
|
this.labelServerStatus.Text = ">Stop";
|
|
}
|
|
else if (this.ParentForm.ParentForm.SystemConfig2.EthernetOperationMode == 2)
|
|
{
|
|
this.ParentForm.ParentForm.EthernetClientDisconnect();
|
|
}
|
|
}
|
|
|
|
private void buttonLocalIP_Click(object sender, EventArgs e)
|
|
{
|
|
this.ControlEthernetLocalIP.Visible = true;
|
|
this.ControlEthernetLocalIP.BringToFront();
|
|
this.ControlEthernetLocalIP.DisplayRefresh();
|
|
}
|
|
|
|
private void buttonPingTimer_Click(object sender, EventArgs e)
|
|
{
|
|
if (this.buttonPingTimer.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
|
|
{
|
|
this.ParentForm.ParentForm.SystemConfig3.IsEthernetPingTimer = true;
|
|
this.buttonPingTimer.Text = "Ping Close";
|
|
this.ParentForm.ParentForm.IsUsingTimerEthernetPing(true);
|
|
}
|
|
else
|
|
{
|
|
this.ParentForm.ParentForm.SystemConfig3.IsEthernetPingTimer = false;
|
|
this.buttonPingTimer.Text = "Ping Open";
|
|
this.ParentForm.ParentForm.IsUsingTimerEthernetPing(false);
|
|
}
|
|
|
|
this.ParentForm.ParentForm.SaveSystemConfigurationFile3(this.ParentForm.ParentForm.SystemConfig3);
|
|
}
|
|
|
|
private void comboBoxEthernetMode_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
if (this.comboBoxEthernetMode.SelectedIndex == (int)DataStore.EthernetMode.f16_OPC) // OPC
|
|
this.comboBoxEthernetOpMode.Enabled = false;
|
|
else
|
|
this.comboBoxEthernetOpMode.Enabled = true;
|
|
|
|
this.buttonSave.Enabled = true;
|
|
|
|
this.UpdateLabelFormatDisplay();
|
|
}
|
|
private void comboBoxEthernetOpMode_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
this.buttonSave.Enabled = true;
|
|
}
|
|
|
|
private void buttonSave_Click(object sender, EventArgs e)
|
|
{
|
|
int mode = 0;
|
|
|
|
if (this.comboBoxEthernetMode.SelectedIndex == (int)DataStore.EthernetMode.f16_OPC) // OPC
|
|
{
|
|
DialogFormMessage msg = new DialogFormMessage(26, this.ParentForm.ParentForm.SystemConfig1.Language);
|
|
msg.ShowDialog();
|
|
|
|
this.labelLocalPort.Text = "502";
|
|
this.ParentForm.ParentForm.SystemConfig2.EthernetLocalPort = 502;
|
|
this.ParentForm.ParentForm.smartTCPMultiServer.Port = 502;
|
|
this.comboBoxEthernetOpMode.SelectedIndex = 1;
|
|
}
|
|
|
|
if (this.comboBoxEthernetOpMode.SelectedIndex == 1)
|
|
{
|
|
this.ParentForm.ParentForm.EthernetClientDisconnect();
|
|
this.ParentForm.ParentForm.SystemConfig2.EthernetOperationMode = 1;
|
|
|
|
this.buttonStart.Enabled = true;
|
|
this.buttonStop.Enabled = true;
|
|
}
|
|
else if (this.comboBoxEthernetOpMode.SelectedIndex == 2)
|
|
{
|
|
this.labelServerStatus.Text = "-";
|
|
this.timerServer.Enabled = false;
|
|
this.ParentForm.ParentForm.EthernetServerStop();
|
|
this.ParentForm.ParentForm.SystemConfig2.EthernetOperationMode = 2;
|
|
this.ParentForm.ParentForm.EthernetClientDisconnect();
|
|
|
|
this.buttonStart.Enabled = true;
|
|
this.buttonStop.Enabled = true;
|
|
}
|
|
else
|
|
{
|
|
this.timerServer.Enabled = false;
|
|
this.ParentForm.ParentForm.EthernetServerStop();
|
|
this.ParentForm.ParentForm.EthernetClientDisconnect();
|
|
this.ParentForm.ParentForm.SystemConfig2.EthernetOperationMode = 0;
|
|
|
|
this.buttonStart.Enabled = false;
|
|
this.buttonStop.Enabled = false;
|
|
|
|
this.labelServerStatus.Text = "-";
|
|
this.labelClientStatus.Text = "-";
|
|
this.labelConnectedIP.Text = "-";
|
|
}
|
|
|
|
if (this.ParentForm.ParentForm.SystemConfig2.IsCommunicationOption == false && this.comboBoxEthernetMode.SelectedIndex == ModeSTD2)
|
|
mode = (int)DataStore.EthernetMode.f23_STD2;
|
|
else
|
|
mode = this.comboBoxEthernetMode.SelectedIndex;
|
|
this.ParentForm.ParentForm.SystemConfig2.EthernetCommMode = mode;
|
|
|
|
if (this.ParentForm.ParentForm.SystemConfig1.SerialCOM1Mode == (int)DataStore.SerialMode.f22_Modbus_RTU
|
|
|| this.ParentForm.ParentForm.SystemConfig1.SerialCOM3Mode == (int)DataStore.SerialMode.f22_Modbus_RTU
|
|
|| this.ParentForm.ParentForm.SystemConfig1.SerialCOM4Mode == (int)DataStore.SerialMode.f22_Modbus_RTU
|
|
|| this.ParentForm.ParentForm.SystemConfig2.EthernetCommMode == (int)DataStore.EthernetMode.f22_Modbus_TCP
|
|
|| this.ParentForm.ParentForm.SystemConfig1.SerialCOM1Mode == (int)DataStore.SerialMode.f16_OPC
|
|
|| this.ParentForm.ParentForm.SystemConfig1.SerialCOM3Mode == (int)DataStore.SerialMode.f16_OPC
|
|
|| this.ParentForm.ParentForm.SystemConfig1.SerialCOM4Mode == (int)DataStore.SerialMode.f16_OPC
|
|
|| this.ParentForm.ParentForm.SystemConfig2.EthernetCommMode == (int)DataStore.EthernetMode.f16_OPC)
|
|
this.ParentForm.ParentForm.ChildFormMainDisplay.MainBottomModbusIconAdd(true);
|
|
else
|
|
this.ParentForm.ParentForm.ChildFormMainDisplay.MainBottomModbusIconAdd(false);
|
|
|
|
this.ParentForm.ParentForm.SaveSystemConfigurationFile2(this.ParentForm.ParentForm.SystemConfig2);
|
|
|
|
this.ButtonAddOnDisplay();
|
|
this.buttonSave.Enabled = false;
|
|
}
|
|
|
|
private void buttonAddon_Click(object sender, EventArgs e)
|
|
{
|
|
if (this.ControlHitachi.Visible == false && this.ControlMarkoprint.Visible == false && this.ControlModbusTCP.Visible == false
|
|
&& this.ControlMultiJet.Visible == false)
|
|
this.DisplayBottomSettingMenu();
|
|
else
|
|
{
|
|
this.ControlVisible(false);
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
}
|