parent
1ee3ab4361
commit
5c9c0053bc
|
@ -240,6 +240,7 @@ namespace INT63DC_6CH.Controls
|
|||
{
|
||||
// 중량
|
||||
value = Helper.StringToDecimalPlaces(weightDatas[i].WeightString, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
|
||||
|
||||
if (this.CollectionLabelWeightValue[i].Text != value)
|
||||
this.CollectionLabelWeightValue[i].Text = value;
|
||||
if (this.CollectionLabelWeightValue[i].ForeColor != Color.Black)
|
||||
|
|
|
@ -60,6 +60,15 @@ namespace INT63DC_6CH
|
|||
Japanese,
|
||||
};
|
||||
|
||||
public enum E_CommMode
|
||||
{
|
||||
f0_None = 0,
|
||||
f1_STD1 = 1,
|
||||
f2_STD2 = 2,
|
||||
f3_STD3 = 3,
|
||||
f4_Modbus = 4,
|
||||
};
|
||||
|
||||
public enum UserGroup
|
||||
{
|
||||
None = 0,
|
||||
|
@ -1666,17 +1675,18 @@ namespace INT63DC_6CH
|
|||
/// </summary>
|
||||
public string WeightString
|
||||
{
|
||||
get
|
||||
{
|
||||
get
|
||||
{
|
||||
string ret = "";
|
||||
|
||||
if (this.Sign == "-")
|
||||
ret = "-" + this.m_WeightString.Remove(1, 0);
|
||||
ret = "-" + this.m_WeightString.Remove(0, 1);
|
||||
else
|
||||
ret = this.m_WeightString;
|
||||
|
||||
return ret;
|
||||
return ret;
|
||||
}
|
||||
//get { return this.m_WeightString; }
|
||||
set { this.m_WeightString = value; }
|
||||
}
|
||||
public string Sign
|
||||
|
|
|
@ -159,7 +159,7 @@ namespace INT63DC_6CH.Forms
|
|||
this.comboBoxMode.Items.Add("STD1");
|
||||
this.comboBoxMode.Items.Add("STD2");
|
||||
this.comboBoxMode.Items.Add("STD3");
|
||||
//this.comboBoxMode.Items.Add("Modbus");
|
||||
this.comboBoxMode.Items.Add("Modbus");
|
||||
this.comboBoxMode.SelectedIndex = 0;
|
||||
this.comboBoxMode.SelectedIndexChanged += new EventHandler(this.comboBoxMode_SelectedIndexChanged);
|
||||
|
||||
|
@ -454,10 +454,18 @@ namespace INT63DC_6CH.Forms
|
|||
{
|
||||
switch (index)
|
||||
{
|
||||
case 3 : // Modbus
|
||||
this.labelTitleStartAddress.Visible = true;
|
||||
this.labelStartAddress.Visible = true;
|
||||
this.labelStartAddress.Text = this.ParentForm.SystemConfig.ModbusTcpStartAddress.ToString();
|
||||
case (int)DataStore.E_CommMode.f4_Modbus : // Modbus
|
||||
if (this.comboBoxOperationMode.SelectedIndex == 2)
|
||||
{
|
||||
this.labelTitleStartAddress.Visible = true;
|
||||
this.labelStartAddress.Visible = true;
|
||||
this.labelStartAddress.Text = this.ParentForm.SystemConfig.ModbusTcpStartAddress.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.labelTitleStartAddress.Visible = false;
|
||||
this.labelStartAddress.Visible = false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
this.labelTitleStartAddress.Visible = false;
|
||||
|
@ -758,13 +766,13 @@ namespace INT63DC_6CH.Forms
|
|||
{
|
||||
string before = "", after = "";
|
||||
|
||||
if (this.ParentForm.SystemConfig.EthernetMode == 1)
|
||||
if (this.ParentForm.SystemConfig.EthernetMode == (int)DataStore.E_CommMode.f1_STD1)
|
||||
before = "STD1";
|
||||
else if (this.ParentForm.SystemConfig.EthernetMode == 2)
|
||||
else if (this.ParentForm.SystemConfig.EthernetMode == (int)DataStore.E_CommMode.f2_STD2)
|
||||
before = "STD2";
|
||||
else if (this.ParentForm.SystemConfig.EthernetMode == 3)
|
||||
else if (this.ParentForm.SystemConfig.EthernetMode == (int)DataStore.E_CommMode.f3_STD3)
|
||||
before = "STD3";
|
||||
else if (this.ParentForm.SystemConfig.EthernetMode == 4)
|
||||
else if (this.ParentForm.SystemConfig.EthernetMode == (int)DataStore.E_CommMode.f4_Modbus)
|
||||
before = "Modbus";
|
||||
else
|
||||
before = "None";
|
||||
|
|
|
@ -420,7 +420,7 @@ namespace INT63DC_6CH.Forms
|
|||
|
||||
if (myKeyPad.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (myKeyPad.doubleValue < 0 || myKeyPad.doubleValue > 99)
|
||||
if (myKeyPad.doubleValue < 1 || myKeyPad.doubleValue > 99)
|
||||
{
|
||||
// 입력범위를 확인하세요
|
||||
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.SystemConfig.Language);
|
||||
|
|
|
@ -114,6 +114,7 @@
|
|||
this.smartTCPMultiServer.MaxReceiveBufferSize = 1000;
|
||||
this.smartTCPMultiServer.Port = 5001;
|
||||
this.smartTCPMultiServer.ReceiveTimeout = 3000;
|
||||
this.smartTCPMultiServer.OnReceiveHandler += new SmartX.SmartTCPMultiServer.ReceiveHandler(this.smartTCPMultiServer_OnReceiveHandler);
|
||||
//
|
||||
// timerUserList
|
||||
//
|
||||
|
|
|
@ -889,7 +889,7 @@ namespace INT63DC_6CH.Forms
|
|||
// 비상정지시 장비 정지상태로 변환
|
||||
if (this.IsServoOrigin == true)
|
||||
{
|
||||
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
|
||||
//this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
|
||||
this.ChildFormMainDisplay.UpdateDisplayAlarmMessageServoOrigin();
|
||||
}
|
||||
break;
|
||||
|
@ -1348,32 +1348,32 @@ namespace INT63DC_6CH.Forms
|
|||
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
|
||||
{
|
||||
#region Serial 3
|
||||
if (this.SystemConfig.Serial3Mode == 1) // STD1 - 중량 데이터 피드백
|
||||
if (this.SystemConfig.Serial3Mode == (int)DataStore.E_CommMode.f1_STD1) // STD1 - 중량 데이터 피드백
|
||||
this.SerialCH3STD1(this.CollectionWeightData);
|
||||
else if (this.SystemConfig.Serial3Mode == 2) // STD2 - 중량 데이터 피드백
|
||||
else if (this.SystemConfig.Serial3Mode == (int)DataStore.E_CommMode.f2_STD2) // STD2 - 중량 데이터 피드백
|
||||
this.SerialCH3STD2(this.CollectionWeightData);
|
||||
else if (this.SystemConfig.Serial3Mode == 3) // STD3 - 중량 데이터 피드백
|
||||
else if (this.SystemConfig.Serial3Mode == (int)DataStore.E_CommMode.f3_STD3) // STD3 - 중량 데이터 피드백
|
||||
this.SerialCH3STD3(this.CollectionWeightData);
|
||||
#endregion
|
||||
|
||||
#region 이더넷
|
||||
if (this.SystemConfig.IsEthernetEnable == true)
|
||||
{
|
||||
if (this.SystemConfig.EthernetMode == 1) // STD1 - 중량 데이터 피드백
|
||||
if (this.SystemConfig.EthernetMode == (int)DataStore.E_CommMode.f1_STD1) // STD1 - 중량 데이터 피드백
|
||||
{
|
||||
#region OPT2
|
||||
etherStringData = this.Protocol_STD1(this.SystemConfig, this.CollectionWeightData);
|
||||
this.SendEthernetData(etherStringData);
|
||||
#endregion
|
||||
}
|
||||
else if (this.SystemConfig.EthernetMode == 2) // STD2 - 중량 데이터 피드백
|
||||
else if (this.SystemConfig.EthernetMode == (int)DataStore.E_CommMode.f2_STD2) // STD2 - 중량 데이터 피드백
|
||||
{
|
||||
#region OPT2
|
||||
etherStringData = this.Protocol_STD2(this.SystemConfig, this.CollectionWeightData, this.CurrentProductItem);
|
||||
this.SendEthernetData(etherStringData);
|
||||
#endregion
|
||||
}
|
||||
else if (this.SystemConfig.EthernetMode == 3) // STD3 - 중량 데이터 피드백
|
||||
else if (this.SystemConfig.EthernetMode == (int)DataStore.E_CommMode.f3_STD3) // STD3 - 중량 데이터 피드백
|
||||
{
|
||||
#region OPT3
|
||||
etherStringData = this.Protocol_STD3(this.SystemConfig, this.CollectionWeightData, this.CurrentProductItem);
|
||||
|
@ -6971,7 +6971,7 @@ namespace INT63DC_6CH.Forms
|
|||
|
||||
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
|
||||
{
|
||||
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
|
||||
//this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
|
||||
this.timerEmergencyStop.Enabled = true;
|
||||
}
|
||||
}
|
||||
|
@ -7273,5 +7273,152 @@ namespace INT63DC_6CH.Forms
|
|||
|
||||
this.EquipmentStatus1 = this.EquipmentStatus;
|
||||
}
|
||||
|
||||
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.E_CommMode.f4_Modbus:
|
||||
#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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1497,8 +1497,8 @@ namespace INT63DC_6CH.Forms
|
|||
this.labelProductName.Enabled = false;
|
||||
|
||||
// 공압 알람 이면 장비 정지
|
||||
if(this.ParentForm.CurrentAlarmList.IsPressureError == true)
|
||||
this.ParentForm.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
|
||||
//if(this.ParentForm.CurrentAlarmList.IsPressureError == true)
|
||||
// this.ParentForm.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
|
||||
#endregion
|
||||
}
|
||||
else
|
||||
|
@ -1804,10 +1804,16 @@ namespace INT63DC_6CH.Forms
|
|||
this.panelAlarmMessageBox2.BringToFront();
|
||||
this.panelAlarmMessageBox2.Visible = true;
|
||||
|
||||
this.ParentForm.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
|
||||
//this.ParentForm.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
|
||||
this.ParentForm.TransferData(CommunicationCommand.BuzzerOn, CommunicationID.MainBoard);
|
||||
this.ParentForm.CurrentAlarmList.IsBuzzerStatus = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.panelAlarmMessageBox2.Visible = false;
|
||||
this.ParentForm.TransferData(CommunicationCommand.BuzzerOff, CommunicationID.MainBoard);
|
||||
this.ParentForm.CurrentAlarmList.IsBuzzerStatus = false;
|
||||
}
|
||||
}
|
||||
public void UpdateDisplayAlarmMessageServoOrigin()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue