판정 프로토콜 수정

- 생산속도, 재전송 기능 추가
main
DESKTOP-S459P9R\LSJ 2025-07-10 14:57:37 +09:00
parent b08fd0b845
commit 24323daf94
3 changed files with 234 additions and 127 deletions

View File

@ -1518,7 +1518,7 @@ namespace INT99DC_7C
{
this.m_JudgmentStatus = value;
this.ProductionSpeedCalculation();
//this.ProductionSpeedCalculation();
if (value == DataStore.JudgmentStatus.Under)
{
@ -3770,4 +3770,58 @@ namespace INT99DC_7C
#endregion
}
#endregion
#region CommunicationRespone
public class CommunicationRespone
{
#region Field
private bool m_IsFirst;
private string m_TransactionID;
private string m_TransferCount;
#endregion
#region Constructor
public CommunicationRespone()
{
this.Initialization();
}
#endregion
#region Property
public bool IsFirst
{
get { return this.m_IsFirst; }
set { this.m_IsFirst = value; }
}
/// <summary>
/// Data ID (0~9)
/// </summary>
public string TransactionID
{
get { return this.m_TransactionID; }
set { this.m_TransactionID = value; }
}
/// <summary>
/// 재전송 CNT (0~9)
/// </summary>
public string TransferCount
{
get { return this.m_TransferCount; }
set { this.m_TransferCount = value; }
}
#endregion
#region Method
public void Initialization()
{
this.IsFirst = false;
this.TransactionID = "a";
this.TransferCount = "a";
}
#endregion
}
#endregion
}

View File

@ -111,6 +111,8 @@ namespace INT99DC_7C.Forms
public List<string> ListDllUserName;
// TotalPass Count
public Counter CurrentAlarmTotalPassCnt;
// Communication Respone
private CommunicationRespone CurrentComRespone;
// Collection
private Collection<int> CollectionGraphData; // 판정설정 그래프 데이터
@ -410,6 +412,7 @@ namespace INT99DC_7C.Forms
this.CurrentOptionParameterItem = new OptionParameterItem();
this.CurrentUserGroup = new UserGroup();
this.CurrentDataViewerFilter = new DataViewerFilter();
this.CurrentComRespone = new CommunicationRespone();
this.ListDllUserName = new List<string>();
this.ListDllUserName.Clear();
@ -908,6 +911,9 @@ namespace INT99DC_7C.Forms
else
this.timerOPT1.Enabled = false;
// Respone
this.CurrentComRespone.Initialization();
// Part 11
if (this.SystemConfig.IsPart11 == true)
this.SetTrackingHistoryData(DataStore.TrackingOperation.EquipmentStop, "");
@ -980,7 +986,7 @@ namespace INT99DC_7C.Forms
private int ReceiveCommandS(string strTemp)
{
int ret = 0;
string cmd = "", lane = "", receiveData = "";
string cmd = "", lane = "", receiveData = "", dataID = "", transferCNT = "";
// SIZE 확인
if (this.SizeCheck("S", strTemp) == false)
@ -1004,6 +1010,8 @@ namespace INT99DC_7C.Forms
this.smartFileCommunicationLog.WriteString(string.Format("Receive ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, strTemp));
cmd = strTemp.Substring(0, 3);
dataID = strTemp.Substring(3, 1);
transferCNT = strTemp.Substring(4, 1);
lane = strTemp.Substring(5, 1);
receiveData = strTemp.Substring(10, strTemp.Length - 12);
@ -1018,7 +1026,7 @@ namespace INT99DC_7C.Forms
return ret;
break;
case "SR0":
if ((ret = this.ReceiveCommandSR0(lane, receiveData)) != 0)
if ((ret = this.ReceiveCommandSR0(lane, receiveData, dataID, transferCNT)) != 0)
return ret;
break;
case "SC0":
@ -1193,6 +1201,23 @@ namespace INT99DC_7C.Forms
this.CurrentCalibrationItem.Constant11 = receiveData.Substring(91, 7).Trim();
this.CurrentCalibrationItem.Constant12 = receiveData.Substring(98, 7).Trim();
break;
case 15:
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();
this.CurrentCalibrationItem.Constant13 = receiveData.Substring(105, 7).Trim();
this.CurrentCalibrationItem.Constant14 = receiveData.Substring(112, 7).Trim();
this.CurrentCalibrationItem.Constant15 = receiveData.Substring(119, 7).Trim();
break;
default:
break;
}
@ -1460,7 +1485,7 @@ namespace INT99DC_7C.Forms
return ret;
}
// 운전시 중량
private int ReceiveCommandSR0(string lane, string receiveData)
private int ReceiveCommandSR0(string lane, string receiveData, string transactionID, string transferCNT)
{
bool result = false;
int ret = 0;
@ -1482,159 +1507,177 @@ namespace INT99DC_7C.Forms
{
case "Z":
#region Value Assign
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
if (this.CurrentComRespone.TransactionID != transactionID)
{
if (this.SystemConfig.IsWeightViewForward == true)
this.CurrentComRespone.TransactionID = transactionID;
this.CurrentComRespone.TransferCount = transferCNT;
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
{
for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++)
if (this.SystemConfig.IsWeightViewForward == true)
{
this.CollectionWeightData[i].JudgmentStatus = Helper.StringToJudgmentStatus(receiveData.Substring(i * 12, 2));
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);
this.Update30000ModbusData(i);
for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++)
{
this.CollectionWeightData[i].JudgmentStatus = Helper.StringToJudgmentStatus(receiveData.Substring(i * 7, 2));
this.CollectionWeightData[i].Weight = Helper.StringToWeight(receiveData.Substring(i * 7 + 2, 5), this.SystemConfig.DecimalPlaces);
this.CollectionWeightData[i].WeightString = receiveData.Substring(i * 7 + 2, 5);
//this.CollectionWeightData[i].ADCValue = receiveData.Substring(i * 12 + 7, 5);
if (this.SystemConfig.IsModbusEnable == true)
this.Update30000ModbusData(i);
}
}
else
{
for (int i = 1; i <= this.SystemConfig.EquipmentColumns; i++)
{
this.CollectionWeightData[this.CollectionWeightData.Count - i].JudgmentStatus = Helper.StringToJudgmentStatus(receiveData.Substring((i - 1) * 7, 2));
this.CollectionWeightData[this.CollectionWeightData.Count - i].Weight = Helper.StringToWeight(receiveData.Substring((i - 1) * 7 + 2, 5), this.SystemConfig.DecimalPlaces);
this.CollectionWeightData[this.CollectionWeightData.Count - i].WeightString = receiveData.Substring((i - 1) * 7 + 2, 5);
//this.CollectionWeightData[this.CollectionWeightData.Count - i].ADCValue = receiveData.Substring((i - 1) * 12 + 7, 5);
if (this.SystemConfig.IsModbusEnable == true)
this.Update30000ModbusData(this.CollectionWeightData.Count - i);
}
}
}
else
else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest)
{
for (int i = 1; i <= this.SystemConfig.EquipmentColumns; i++)
if (this.SystemConfig.IsWeightViewForward == true)
{
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);
this.Update30000ModbusData(this.CollectionWeightData.Count - i);
for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++)
{
this.CollectionWeightDataTest[i].JudgmentStatus = Helper.StringToJudgmentStatus(receiveData.Substring(i * 7, 2));
this.CollectionWeightDataTest[i].Weight = Helper.StringToWeight(receiveData.Substring(i * 7 + 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) * 7, 2));
this.CollectionWeightDataTest[this.CollectionWeightDataTest.Count - i].Weight = Helper.StringToWeight(receiveData.Substring((i - 1) * 7 + 2, 5), this.SystemConfig.DecimalPlaces);
//this.CollectionWeightDataTest[this.CollectionWeightDataTest.Count - i].ADCValue = receiveData.Substring((i - 1) * 12 + 7, 5);
}
}
}
}
else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest)
{
if (this.SystemConfig.IsWeightViewForward == true)
// 생산속도
try
{
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);
}
this.CollectionWeightData[0].ProductionSpeed = int.Parse(receiveData.Substring(receiveData.Length - 4, 4).Trim());
}
else
catch
{
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);
}
this.CollectionWeightData[0].ProductionSpeed = 0;
}
}
#endregion
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
{
#region 이중진입
if (this.CurrentOptionParameterItem.DoubleEnter == "1")
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
{
// 이중진입(상한 판정시 하한설정값에 두배이면 이중) 이면 STOP
foreach (WeightData data in this.CollectionWeightData)
#region 이중진입
if (this.CurrentOptionParameterItem.DoubleEnter == "1")
{
if (data.JudgmentStatus == DataStore.JudgmentStatus.Double)
// 이중진입(상한 판정시 하한설정값에 두배이면 이중) 이면 STOP
foreach (WeightData data in this.CollectionWeightData)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
if (data.JudgmentStatus == DataStore.JudgmentStatus.Double)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
{
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
this.ChildFormMainDisplay.UpdateAlarmMessageDisplay();
break;
}
}
}
}
#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 - 중량 데이터 피드백
this.SerialCH3OPT2(this.CollectionWeightData);
else if (this.SystemConfig.Serial3Mode == 4) // OPT3 - 중량 데이터 피드백 (중량설정값 포함)
this.SerialCH3OPT3(this.CollectionWeightData, this.CurrentProductItem);
#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);
this.ChildFormMainDisplay.UpdateAlarmMessageDisplay();
// 메시지 11 - 입력센서 에러에 의해 정지하였습니다
this.StartThreadMessage1();
break;
}
}
}
}
#endregion
#endregion
#region Serial3
if (this.SystemConfig.Serial3Mode == 1) // OPT1 - ABFood 통신 피드백
{
#region Serial3 Mode1
// sensor error 이면 STOP
foreach (WeightData data in this.CollectionWeightData)
#region ACNC(Alarm Continuous Ng Count)
if (this.SystemConfig.IsAlarmContinuousNGEnable == true)
{
if (data.JudgmentStatus == DataStore.JudgmentStatus.SensorError || data.JudgmentStatus == DataStore.JudgmentStatus.Double)
for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++)
{
if (this.EquipmentStatus == DataStore.EquipmentStatus.Start)
if (this.CollectionWeightData[i].IsContinuousNG == true)
{
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
break;
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
this.UartCom3TransferDataABFood(DataStore.ABFoodDataCommand.Normal, (int)DataStore.ABFoodDataStatus.Normal);
#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
}
else if (this.SystemConfig.Serial3Mode == 2) // OPT2 - 중량 데이터 피드백
this.SerialCH3OPT2(this.CollectionWeightData);
else if (this.SystemConfig.Serial3Mode == 4) // OPT3 - 중량 데이터 피드백 (중량설정값 포함)
this.SerialCH3OPT3(this.CollectionWeightData, this.CurrentProductItem);
#endregion
#region 화면 갱신, 데이터 백업
this.TrackingInspectionData(this.CollectionWeightData);
this.ChildFormMainDisplay.UpdateStartWeightDisplay(this.EquipmentStatus, this.CollectionWeightData);
#endregion
#region 입력센서 연속 입력 시 정지
if (this.SystemConfig.IsEmergencyStopEntrySensorError == true)
else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest)
{
foreach (WeightData data in this.CollectionWeightData)
{
if (data.JudgmentStatus == DataStore.JudgmentStatus.SensorError)
{
this.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
// 메시지 11 - 입력센서 에러에 의해 정지하였습니다
this.StartThreadMessage1();
break;
}
}
}
#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);
}
}
}
this.ChildFormEquipmentTest.UpdateStartWeightDisplay(this.EquipmentStatus, this.CollectionWeightDataTest);
}
#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
}
else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest)
{
this.ChildFormEquipmentTest.UpdateStartWeightDisplay(this.EquipmentStatus, this.CollectionWeightDataTest);
}
break;
default:
@ -1699,7 +1742,7 @@ namespace INT99DC_7C.Forms
// 판정설정 그래프
private int ReceiveCommandSG0(string lane, string receiveData)
{
int ret = 0, temp = 12;
int ret = 0, temp = 20;
switch (lane)
{
@ -8782,10 +8825,12 @@ namespace INT99DC_7C.Forms
//Console.WriteLine(string.Format("{0} : DefaultSetting2", DateTime.Now));
// Modbus Data Update
this.Update30000ModbusData();
for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++)
this.Update30000ModbusData(i);
if (this.SystemConfig.IsModbusEnable == true)
{
this.Update30000ModbusData();
for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++)
this.Update30000ModbusData(i);
}
//Console.WriteLine(string.Format("{0} : Update30000ModbusData", DateTime.Now));
// UserManager 초기화

View File

@ -2019,6 +2019,14 @@ namespace INT99DC_7C.Forms
if (this.MainDisplayTable12 != null)
this.MainDisplayTable12.UpdateBypassDisplay(this.ParentForm.CollectionWeightData);
break;
case 15:
if (this.MainDisplayEachBarGraph15 != null)
this.MainDisplayEachBarGraph15.UpdateBypassDisplay(this.ParentForm.CollectionWeightData);
if (this.MainDisplayDotGraph15 != null)
this.MainDisplayDotGraph15.UpdateBypassDisplay(this.ParentForm.CollectionWeightData);
if (this.MainDisplayTable15 != null)
this.MainDisplayTable15.UpdateBypassDisplay(this.ParentForm.CollectionWeightData);
break;
default:
break;
}