diff --git a/ITC81DB_2H/Controls/MainDisplay/ControlMainDisplayModbus.cs b/ITC81DB_2H/Controls/MainDisplay/ControlMainDisplayModbus.cs index 48c0d89..b22507a 100644 --- a/ITC81DB_2H/Controls/MainDisplay/ControlMainDisplayModbus.cs +++ b/ITC81DB_2H/Controls/MainDisplay/ControlMainDisplayModbus.cs @@ -338,7 +338,7 @@ namespace ITC81DB_2H.Controls this.CollectionContents.Add(this.labelContents19); this.CollectionContents.Add(this.labelContents20); - this.buttonBypassDirection.ButtonUp(); + this.buttonSelectDecHexa.ButtonUp(); this.ReceiveCount = 0; this.labelReceiveCount.Text = this.ReceiveCount.ToString(); @@ -388,16 +388,16 @@ namespace ITC81DB_2H.Controls } public void UpdateData(_30000_ModbusData mData) { - if (this.buttonBypassDirection.ButtonStatus == SmartX.SmartButton.BUTSTATUS.UP) + if (this.buttonSelectDecHexa.ButtonStatus == SmartX.SmartButton.BUTSTATUS.UP) { this.labelUpdateFlag.Text = mData.IsUpdate.ToString(); this.labelEquipmentID.Text = mData.EquipmentID.ToString(); this.labelCurrentNo.Text = mData.ProductNo.ToString(); - this.labelUnder.Text = mData.UnderValue.ToString(); - this.labelPass.Text = mData.PassValue.ToString(); - this.labelOver.Text = mData.OverValue.ToString(); - this.labelTare.Text = mData.TareValue.ToString(); + this.labelUnder.Text = mData.UnderValueFloat.ToString(); + this.labelPass.Text = mData.PassValueFloat.ToString(); + this.labelOver.Text = mData.OverValueFloat.ToString(); + this.labelTare.Text = mData.TareValueFloat.ToString(); this.labelUnderCount.Text = mData.UnderCount.ToString(); this.labelPassCount.Text = mData.PassCount.ToString(); @@ -407,10 +407,15 @@ namespace ITC81DB_2H.Controls this.labelTotalCount.Text = mData.TotalCount.ToString(); this.labelGrade.Text = mData.Grade.ToString(); - this.labelWeight.Text = mData.Weight.ToString(); + this.labelWeight.Text = mData.WeightFloat.ToString(); this.labelOperationStatus.Text = mData.OperationStatus.ToString(); this.labelAlarmStatus.Text = mData.AlarmStatus.ToString(); - this.labelSpeed.Text = mData.Speed.ToString(); + if (mData.Speed <= 500) + { + string value = mData.Speed.ToString(); + if (this.labelSpeed.Text != value) + this.labelSpeed.Text = value; + } this.labelMetal.Text = mData.MetalDetectionCount.ToString(); this.labelDouble.Text = mData.DoubleEntryCount.ToString(); } @@ -436,7 +441,12 @@ namespace ITC81DB_2H.Controls this.labelWeight.Text = mData.HexStringWeight; this.labelOperationStatus.Text = mData.HexStringOperationStatus; this.labelAlarmStatus.Text = mData.HexStringAlarmStatus; - this.labelSpeed.Text = mData.HexStringSpeed; + if (mData.Speed <= 500) + { + string value = mData.HexStringSpeed; + if (this.labelSpeed.Text != value) + this.labelSpeed.Text = value; + } this.labelMetal.Text = mData.HexStringMetalDetectionCount; this.labelDouble.Text = mData.HexStringDoubleEntryCount; } @@ -541,7 +551,7 @@ namespace ITC81DB_2H.Controls #endregion #region Event Handler - private void buttonBypassDirection_Click(object sender, EventArgs e) + private void buttonSelectDecHexa_Click(object sender, EventArgs e) { // Automatic Logout Reset if (this.ParentForm.ParentForm.SystemConfig3.IsPart11 == true) diff --git a/ITC81DB_2H/Controls/MainDisplay/ControlMainDisplayModbus.designer.cs b/ITC81DB_2H/Controls/MainDisplay/ControlMainDisplayModbus.designer.cs index a3bdb02..add9852 100644 --- a/ITC81DB_2H/Controls/MainDisplay/ControlMainDisplayModbus.designer.cs +++ b/ITC81DB_2H/Controls/MainDisplay/ControlMainDisplayModbus.designer.cs @@ -46,7 +46,7 @@ this.labelAlarmStatus = new SmartX.SmartLabel(); this.labelOperationStatus = new SmartX.SmartLabel(); this.labelWeight = new SmartX.SmartLabel(); - this.buttonBypassDirection = new SmartX.SmartButton(); + this.buttonSelectDecHexa = new SmartX.SmartButton(); this.smartGroupBox1 = new SmartX.SmartGroupBox(); this.labelTitleReceiveCount2 = new SmartX.SmartLabel(); this.labelTitleStartAddr2 = new SmartX.SmartLabel(); @@ -469,36 +469,36 @@ this.labelWeight.TextVAlign = SmartX.SmartLabel.TextVerAlign.Middle; this.labelWeight.Wordwrap = false; // - // buttonBypassDirection + // buttonSelectDecHexa // - this.buttonBypassDirection.BackPictureBox = null; - this.buttonBypassDirection.BackPictureBox1 = null; - this.buttonBypassDirection.BackPictureBox2 = null; - this.buttonBypassDirection.ButtonColor = System.Drawing.Color.Gray; - this.buttonBypassDirection.ButtonImageAutoSize = true; - this.buttonBypassDirection.ColorKeySamplePosition = new System.Drawing.Point(0, 0); - this.buttonBypassDirection.DisableImage = null; - this.buttonBypassDirection.DownImage = ((System.Drawing.Image)(resources.GetObject("buttonBypassDirection.DownImage"))); - this.buttonBypassDirection.GroupID = 0; - this.buttonBypassDirection.InitVisible = true; - this.buttonBypassDirection.Location = new System.Drawing.Point(53, 22); - this.buttonBypassDirection.Mode = SmartX.SmartButton.BUTTONMODE.PUSH; - this.buttonBypassDirection.Name = "buttonBypassDirection"; - this.buttonBypassDirection.NestedClickEventPrevent = false; - this.buttonBypassDirection.OutlinePixel = 1; - this.buttonBypassDirection.RepeatInterval = 200; - this.buttonBypassDirection.RepeatIntervalAccelerate = null; - this.buttonBypassDirection.SafeInterval = 200; - this.buttonBypassDirection.Size = new System.Drawing.Size(80, 28); - this.buttonBypassDirection.SpecialFunction = SmartX.SmartButton.SPECIALFUNC.NONE; - this.buttonBypassDirection.TabIndex = 727; - this.buttonBypassDirection.TextColor = System.Drawing.Color.Black; - this.buttonBypassDirection.TextDownColor = System.Drawing.Color.White; - this.buttonBypassDirection.TextHAlign = SmartX.SmartButton.TextHorAlign.Middle; - this.buttonBypassDirection.TextLocation = new System.Drawing.Point(0, 0); - this.buttonBypassDirection.TextVAlign = SmartX.SmartButton.TextVerAlign.Middle; - this.buttonBypassDirection.UpImage = ((System.Drawing.Image)(resources.GetObject("buttonBypassDirection.UpImage"))); - this.buttonBypassDirection.Click += new System.EventHandler(this.buttonBypassDirection_Click); + this.buttonSelectDecHexa.BackPictureBox = null; + this.buttonSelectDecHexa.BackPictureBox1 = null; + this.buttonSelectDecHexa.BackPictureBox2 = null; + this.buttonSelectDecHexa.ButtonColor = System.Drawing.Color.Gray; + this.buttonSelectDecHexa.ButtonImageAutoSize = true; + this.buttonSelectDecHexa.ColorKeySamplePosition = new System.Drawing.Point(0, 0); + this.buttonSelectDecHexa.DisableImage = null; + this.buttonSelectDecHexa.DownImage = ((System.Drawing.Image)(resources.GetObject("buttonSelectDecHexa.DownImage"))); + this.buttonSelectDecHexa.GroupID = 0; + this.buttonSelectDecHexa.InitVisible = true; + this.buttonSelectDecHexa.Location = new System.Drawing.Point(53, 22); + this.buttonSelectDecHexa.Mode = SmartX.SmartButton.BUTTONMODE.PUSH; + this.buttonSelectDecHexa.Name = "buttonSelectDecHexa"; + this.buttonSelectDecHexa.NestedClickEventPrevent = false; + this.buttonSelectDecHexa.OutlinePixel = 1; + this.buttonSelectDecHexa.RepeatInterval = 200; + this.buttonSelectDecHexa.RepeatIntervalAccelerate = null; + this.buttonSelectDecHexa.SafeInterval = 200; + this.buttonSelectDecHexa.Size = new System.Drawing.Size(80, 28); + this.buttonSelectDecHexa.SpecialFunction = SmartX.SmartButton.SPECIALFUNC.NONE; + this.buttonSelectDecHexa.TabIndex = 727; + this.buttonSelectDecHexa.TextColor = System.Drawing.Color.Black; + this.buttonSelectDecHexa.TextDownColor = System.Drawing.Color.White; + this.buttonSelectDecHexa.TextHAlign = SmartX.SmartButton.TextHorAlign.Middle; + this.buttonSelectDecHexa.TextLocation = new System.Drawing.Point(0, 0); + this.buttonSelectDecHexa.TextVAlign = SmartX.SmartButton.TextVerAlign.Middle; + this.buttonSelectDecHexa.UpImage = ((System.Drawing.Image)(resources.GetObject("buttonSelectDecHexa.UpImage"))); + this.buttonSelectDecHexa.Click += new System.EventHandler(this.buttonSelectDecHexa_Click); // // smartGroupBox1 // @@ -565,7 +565,7 @@ this.smartGroupBox1.Controls.Add(this.labelOffset5); this.smartGroupBox1.Controls.Add(this.labelOffset4); this.smartGroupBox1.Controls.Add(this.labelOffset3); - this.smartGroupBox1.Controls.Add(this.buttonBypassDirection); + this.smartGroupBox1.Controls.Add(this.buttonSelectDecHexa); this.smartGroupBox1.Controls.Add(this.labelAlarmStatus); this.smartGroupBox1.Controls.Add(this.labelOperationStatus); this.smartGroupBox1.Controls.Add(this.labelWeight); @@ -1843,7 +1843,7 @@ public SmartX.SmartLabel labelAlarmStatus; public SmartX.SmartLabel labelOperationStatus; public SmartX.SmartLabel labelWeight; - private SmartX.SmartButton buttonBypassDirection; + private SmartX.SmartButton buttonSelectDecHexa; public SmartX.SmartLabel labelOffset2; public SmartX.SmartLabel labelOffset3; public SmartX.SmartLabel labelOffset4; diff --git a/ITC81DB_2H/Controls/MainDisplay/ControlMainDisplayModbus.resx b/ITC81DB_2H/Controls/MainDisplay/ControlMainDisplayModbus.resx index 3feb13d..513fd12 100644 --- a/ITC81DB_2H/Controls/MainDisplay/ControlMainDisplayModbus.resx +++ b/ITC81DB_2H/Controls/MainDisplay/ControlMainDisplayModbus.resx @@ -118,7 +118,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + iVBORw0KGgoAAAANSUhEUgAAAFAAAAAcCAYAAAD2izi6AAAABGdBTUEAALGOfPtRkwAAACBjSFJNAACH DwAAjA8AAP1SAACBQAAAfXkAAOmLAAA85QAAGcxzPIV3AAAKOWlDQ1BQaG90b3Nob3AgSUNDIHByb2Zp @@ -196,7 +196,7 @@ L08x/2cSbsdRF+6qT3meCQ3+AR4uKz9SHag8AAAAAElFTkSuQmCC - + iVBORw0KGgoAAAANSUhEUgAAAFAAAAAcCAYAAAD2izi6AAAABGdBTUEAALGOfPtRkwAAACBjSFJNAACH DwAAjA8AAP1SAACBQAAAfXkAAOmLAAA85QAAGcxzPIV3AAAKOWlDQ1BQaG90b3Nob3AgSUNDIHByb2Zp diff --git a/ITC81DB_2H/Controls/MainDisplay/ControlMainDisplayStart.Designer.cs b/ITC81DB_2H/Controls/MainDisplay/ControlMainDisplayStart.Designer.cs index 63fed27..12b16f0 100644 --- a/ITC81DB_2H/Controls/MainDisplay/ControlMainDisplayStart.Designer.cs +++ b/ITC81DB_2H/Controls/MainDisplay/ControlMainDisplayStart.Designer.cs @@ -105,9 +105,9 @@ this.labelTotalCount.ForeColor = System.Drawing.Color.White; this.labelTotalCount.InitVisible = true; this.labelTotalCount.LineSpacing = 0F; - this.labelTotalCount.Location = new System.Drawing.Point(573, 175); + this.labelTotalCount.Location = new System.Drawing.Point(590, 175); this.labelTotalCount.Name = "labelTotalCount"; - this.labelTotalCount.Size = new System.Drawing.Size(115, 30); + this.labelTotalCount.Size = new System.Drawing.Size(100, 30); this.labelTotalCount.TabIndex = 465; this.labelTotalCount.Text = "234567890"; this.labelTotalCount.TextHAlign = SmartX.SmartLabel.TextHorAlign.Right; @@ -125,9 +125,9 @@ this.labelExNGCount.ForeColor = System.Drawing.Color.White; this.labelExNGCount.InitVisible = true; this.labelExNGCount.LineSpacing = 0F; - this.labelExNGCount.Location = new System.Drawing.Point(340, 175); + this.labelExNGCount.Location = new System.Drawing.Point(357, 175); this.labelExNGCount.Name = "labelExNGCount"; - this.labelExNGCount.Size = new System.Drawing.Size(115, 30); + this.labelExNGCount.Size = new System.Drawing.Size(100, 30); this.labelExNGCount.TabIndex = 468; this.labelExNGCount.Text = "234567890"; this.labelExNGCount.TextHAlign = SmartX.SmartLabel.TextHorAlign.Right; @@ -358,13 +358,13 @@ this.labelTitleTotalCount.BackPictureBox2 = null; this.labelTitleTotalCount.BorderColor = System.Drawing.Color.Black; this.labelTitleTotalCount.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.labelTitleTotalCount.Font = new System.Drawing.Font("Arial", 10F, System.Drawing.FontStyle.Bold); + this.labelTitleTotalCount.Font = new System.Drawing.Font("새굴림", 10F, System.Drawing.FontStyle.Bold); this.labelTitleTotalCount.ForeColor = System.Drawing.Color.White; this.labelTitleTotalCount.InitVisible = true; this.labelTitleTotalCount.LineSpacing = 0F; this.labelTitleTotalCount.Location = new System.Drawing.Point(487, 175); this.labelTitleTotalCount.Name = "labelTitleTotalCount"; - this.labelTitleTotalCount.Size = new System.Drawing.Size(80, 30); + this.labelTitleTotalCount.Size = new System.Drawing.Size(100, 30); this.labelTitleTotalCount.TabIndex = 479; this.labelTitleTotalCount.Text = "총계"; this.labelTitleTotalCount.TextHAlign = SmartX.SmartLabel.TextHorAlign.Middle; @@ -378,13 +378,13 @@ this.labelTitleExNgCount.BackPictureBox2 = null; this.labelTitleExNgCount.BorderColor = System.Drawing.Color.Black; this.labelTitleExNgCount.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.labelTitleExNgCount.Font = new System.Drawing.Font("Arial", 10F, System.Drawing.FontStyle.Bold); + this.labelTitleExNgCount.Font = new System.Drawing.Font("새굴림", 10F, System.Drawing.FontStyle.Bold); this.labelTitleExNgCount.ForeColor = System.Drawing.Color.White; this.labelTitleExNgCount.InitVisible = true; this.labelTitleExNgCount.LineSpacing = 0F; this.labelTitleExNgCount.Location = new System.Drawing.Point(254, 175); this.labelTitleExNgCount.Name = "labelTitleExNgCount"; - this.labelTitleExNgCount.Size = new System.Drawing.Size(80, 30); + this.labelTitleExNgCount.Size = new System.Drawing.Size(100, 30); this.labelTitleExNgCount.TabIndex = 478; this.labelTitleExNgCount.Text = "기타불량"; this.labelTitleExNgCount.TextHAlign = SmartX.SmartLabel.TextHorAlign.Middle; @@ -399,7 +399,7 @@ this.labelTitleSpeed.BackPictureBox2 = null; this.labelTitleSpeed.BorderColor = System.Drawing.Color.Black; this.labelTitleSpeed.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.labelTitleSpeed.Font = new System.Drawing.Font("Arial", 10F, System.Drawing.FontStyle.Bold); + this.labelTitleSpeed.Font = new System.Drawing.Font("새굴림", 10F, System.Drawing.FontStyle.Bold); this.labelTitleSpeed.ForeColor = System.Drawing.Color.White; this.labelTitleSpeed.InitVisible = true; this.labelTitleSpeed.LineSpacing = 0F; diff --git a/ITC81DB_2H/Controls/MainDisplay/ControlMainDisplayStart.cs b/ITC81DB_2H/Controls/MainDisplay/ControlMainDisplayStart.cs index 5b8fced..fd4b7db 100644 --- a/ITC81DB_2H/Controls/MainDisplay/ControlMainDisplayStart.cs +++ b/ITC81DB_2H/Controls/MainDisplay/ControlMainDisplayStart.cs @@ -50,6 +50,7 @@ namespace ITC81DB_2H.Controls if (this.ParentForm.ParentForm.SystemConfig1.Language == Define.E_LanguageID.English) { this.labelTitleSpeed.Text = "Speed"; + this.labelTitleExNgCount.Text = "Other faulty"; this.labelTitleTotalCount.Text = "Total"; this.buttonOverRange.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engMainRunOverDisable)); @@ -116,6 +117,7 @@ namespace ITC81DB_2H.Controls else { this.labelTitleSpeed.Text = "속도"; + this.labelTitleExNgCount.Text = "기타불량"; this.labelTitleTotalCount.Text = "총계"; this.buttonOverRange.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.korMainRunOverDisable)); @@ -330,7 +332,7 @@ namespace ITC81DB_2H.Controls if (bValue == false) { if (this.ParentForm.ParentForm.SystemConfig1.Language == Define.E_LanguageID.English) - this.labelTitleExNgCount.Text = "ExNG"; + this.labelTitleExNgCount.Text = "Other faulty"; else this.labelTitleExNgCount.Text = "기타불량"; diff --git a/ITC81DB_2H/Controls/MainDisplay/ControlMainDisplayStopDataStatistics.Designer.cs b/ITC81DB_2H/Controls/MainDisplay/ControlMainDisplayStopDataStatistics.Designer.cs index bae9dda..1290704 100644 --- a/ITC81DB_2H/Controls/MainDisplay/ControlMainDisplayStopDataStatistics.Designer.cs +++ b/ITC81DB_2H/Controls/MainDisplay/ControlMainDisplayStopDataStatistics.Designer.cs @@ -168,9 +168,9 @@ this.labelExNgCount.ForeColor = System.Drawing.Color.White; this.labelExNgCount.InitVisible = true; this.labelExNgCount.LineSpacing = 0F; - this.labelExNgCount.Location = new System.Drawing.Point(340, 175); + this.labelExNgCount.Location = new System.Drawing.Point(358, 175); this.labelExNgCount.Name = "labelExNgCount"; - this.labelExNgCount.Size = new System.Drawing.Size(115, 30); + this.labelExNgCount.Size = new System.Drawing.Size(100, 30); this.labelExNgCount.TabIndex = 26; this.labelExNgCount.Text = "234567890"; this.labelExNgCount.TextHAlign = SmartX.SmartLabel.TextHorAlign.Right; @@ -229,9 +229,9 @@ this.labelTotalCount.ForeColor = System.Drawing.Color.White; this.labelTotalCount.InitVisible = true; this.labelTotalCount.LineSpacing = 0F; - this.labelTotalCount.Location = new System.Drawing.Point(573, 175); + this.labelTotalCount.Location = new System.Drawing.Point(591, 175); this.labelTotalCount.Name = "labelTotalCount"; - this.labelTotalCount.Size = new System.Drawing.Size(115, 30); + this.labelTotalCount.Size = new System.Drawing.Size(100, 30); this.labelTotalCount.TabIndex = 17; this.labelTotalCount.Text = "234567890"; this.labelTotalCount.TextHAlign = SmartX.SmartLabel.TextHorAlign.Right; @@ -365,7 +365,7 @@ this.labelTitleNgCount.BackPictureBox2 = null; this.labelTitleNgCount.BorderColor = System.Drawing.Color.Black; this.labelTitleNgCount.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.labelTitleNgCount.Font = new System.Drawing.Font("Arial", 10F, System.Drawing.FontStyle.Bold); + this.labelTitleNgCount.Font = new System.Drawing.Font("새굴림", 10F, System.Drawing.FontStyle.Bold); this.labelTitleNgCount.ForeColor = System.Drawing.Color.White; this.labelTitleNgCount.InitVisible = true; this.labelTitleNgCount.LineSpacing = 0F; @@ -385,13 +385,13 @@ this.labelTitleExNgCount.BackPictureBox2 = null; this.labelTitleExNgCount.BorderColor = System.Drawing.Color.Black; this.labelTitleExNgCount.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.labelTitleExNgCount.Font = new System.Drawing.Font("Arial", 10F, System.Drawing.FontStyle.Bold); + this.labelTitleExNgCount.Font = new System.Drawing.Font("새굴림", 10F, System.Drawing.FontStyle.Bold); this.labelTitleExNgCount.ForeColor = System.Drawing.Color.White; this.labelTitleExNgCount.InitVisible = true; this.labelTitleExNgCount.LineSpacing = 0F; this.labelTitleExNgCount.Location = new System.Drawing.Point(254, 175); this.labelTitleExNgCount.Name = "labelTitleExNgCount"; - this.labelTitleExNgCount.Size = new System.Drawing.Size(80, 30); + this.labelTitleExNgCount.Size = new System.Drawing.Size(100, 30); this.labelTitleExNgCount.TabIndex = 38; this.labelTitleExNgCount.Text = "기타불량"; this.labelTitleExNgCount.TextHAlign = SmartX.SmartLabel.TextHorAlign.Middle; @@ -406,13 +406,13 @@ this.labelTitleTotalCount.BackPictureBox2 = null; this.labelTitleTotalCount.BorderColor = System.Drawing.Color.Black; this.labelTitleTotalCount.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.labelTitleTotalCount.Font = new System.Drawing.Font("Arial", 10F, System.Drawing.FontStyle.Bold); + this.labelTitleTotalCount.Font = new System.Drawing.Font("새굴림", 10F, System.Drawing.FontStyle.Bold); this.labelTitleTotalCount.ForeColor = System.Drawing.Color.White; this.labelTitleTotalCount.InitVisible = true; this.labelTitleTotalCount.LineSpacing = 0F; this.labelTitleTotalCount.Location = new System.Drawing.Point(487, 175); this.labelTitleTotalCount.Name = "labelTitleTotalCount"; - this.labelTitleTotalCount.Size = new System.Drawing.Size(80, 30); + this.labelTitleTotalCount.Size = new System.Drawing.Size(100, 30); this.labelTitleTotalCount.TabIndex = 39; this.labelTitleTotalCount.Text = "총계"; this.labelTitleTotalCount.TextHAlign = SmartX.SmartLabel.TextHorAlign.Middle; diff --git a/ITC81DB_2H/Controls/MainDisplay/ControlMainDisplayStopDataStatistics.cs b/ITC81DB_2H/Controls/MainDisplay/ControlMainDisplayStopDataStatistics.cs index 64dfff4..610ce60 100644 --- a/ITC81DB_2H/Controls/MainDisplay/ControlMainDisplayStopDataStatistics.cs +++ b/ITC81DB_2H/Controls/MainDisplay/ControlMainDisplayStopDataStatistics.cs @@ -49,8 +49,8 @@ namespace ITC81DB_2H.Controls { this.pictureBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.engMainStatScreen)); - this.labelTitleNgCount.Text = "NG"; - this.labelTitleExNgCount.Text = "ExNG"; + this.labelTitleNgCount.Text = "Faulty"; + this.labelTitleExNgCount.Text = "Other faulty"; this.labelTitleTotalCount.Text = "Total"; } else if (this.ParentForm.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Chinese) @@ -210,7 +210,7 @@ namespace ITC81DB_2H.Controls if (bValue == false) { if (this.ParentForm.ParentForm.SystemConfig1.Language == Define.E_LanguageID.English) - this.labelTitleExNgCount.Text = "ExNG"; + this.labelTitleExNgCount.Text = "Other faulty"; else this.labelTitleExNgCount.Text = "기타불량"; diff --git a/ITC81DB_2H/Datastore/DataStore.cs b/ITC81DB_2H/Datastore/DataStore.cs index 926755d..0518582 100644 --- a/ITC81DB_2H/Datastore/DataStore.cs +++ b/ITC81DB_2H/Datastore/DataStore.cs @@ -569,22 +569,44 @@ namespace ITC81DB_2H #endregion #region Modbus + public class _39000_ModbusAddressAlarm + { + public const short _9001_Alarm1 = 9000; + public const short _9002_Alarm2 = 9001; + public const short _9003_Alarm3 = 9002; + public const short _9004_Alarm4 = 9003; + public const short _9005_Alarm5 = 9004; + public const short _9006_Alarm6 = 9005; + public const short _9007_Alarm7 = 9006; + public const short _9008_Alarm8 = 9007; + public const short _9009_Alarm9 = 9008; + public const short _9010_Alarm10 = 9009; + public const short _9011_Alarm11 = 9010; + public const short _9012_Alarm12 = 9011; + public const short _9013_Alarm13 = 9012; + public const short _9014_Alarm14 = 9013; + public const short _9015_Alarm15 = 9014; + public const short _9016_Alarm16 = 9015; + public const short _9017_Alarm17 = 9016; + public const short _9018_Alarm18 = 9017; + } public class _30000_ModbusAddress { + public const int _01_DecimalPoint = 0; public const int _01_IsUpdate_High = 10; public const int _02_IsUpdate_Low = 11; public const int _03_EquipmentID_High = 12; public const int _04_EquipmentID_Low = 13; public const int _05_ProductNo_High = 14; public const int _06_ProductNo_Low = 15; - public const int _07_UnderValue_High = 16; - public const int _08_UnderValue_Low = 17; - public const int _09_PassValue_High = 18; - public const int _10_PassValue_Low = 19; - public const int _11_OverValue_High = 20; - public const int _12_OverValue_Low = 21; - public const int _13_TareValue_High = 22; - public const int _14_TareValue_Low = 23; + public const int _07_UnderValueFloat_High = 16; + public const int _08_UnderValueFloat_Low = 17; + public const int _09_PassValueFloat_High = 18; + public const int _10_PassValueFloat_Low = 19; + public const int _11_OverValueFloat_High = 20; + public const int _12_OverValueFloat_Low = 21; + public const int _13_TareValueFloat_High = 22; + public const int _14_TareValueFloat_Low = 23; public const int _15_UnderCount_High = 24; public const int _16_UnderCount_Low = 25; public const int _17_PassCount_High = 26; @@ -599,8 +621,8 @@ namespace ITC81DB_2H public const int _26_TotalCount_Low = 35; public const int _27_Grade_High = 36; public const int _28_Grade_Low = 37; - public const int _29_Weight_High = 38; - public const int _30_Weight_Low = 39; + public const int _29_WeightFloat_High = 38; + public const int _30_WeightFloat_Low = 39; public const int _31_OperationStatus_High = 40; public const int _32_OperationStatus_Low = 41; public const int _33_AlarmStatus_High = 42; @@ -611,16 +633,17 @@ namespace ITC81DB_2H public const int _38_MetalDetectionCount_Low = 47; public const int _39_DoubleEntryCount_High = 48; public const int _40_DoubleEntryCount_Low = 49; - public const int _41_ProductName = 50; - public const int _42_ProductName = 51; - public const int _43_ProductName = 52; - public const int _44_ProductName = 53; - public const int _45_ProductName = 54; - public const int _46_ProductName = 55; - public const int _47_ProductName = 56; - public const int _48_ProductName = 57; - public const int _49_ProductName = 58; - public const int _50_ProductName = 59; + public const int _41_ProductName = 50; // 41~50 + public const int _51_UnderValueInt_High = 60; + public const int _52_UnderValueInt_Low = 61; + public const int _53_PassValueInt_High = 62; + public const int _54_PassValueInt_Low = 63; + public const int _55_OverValueInt_High = 64; + public const int _56_OverValueInt_Low = 65; + public const int _57_TareValueInt_High = 66; + public const int _58_TareValueInt_Low = 67; + public const int _59_WeightInt_High = 68; + public const int _60_WeightInt_Low = 69; #region V7 //public const int _01_EquipmentID = 10; @@ -655,10 +678,14 @@ namespace ITC81DB_2H private int m_IsUpdate; private int m_EquipmentID; private int m_ProductNo; - private double m_UnderValue; - private double m_PassValue; - private double m_OverValue; - private double m_TareValue; + private int m_UnderValueInt; + private int m_PassValueInt; + private int m_OverValueInt; + private int m_TareValueInt; + private double m_UnderValueFloat; + private double m_PassValueFloat; + private double m_OverValueFloat; + private double m_TareValueFloat; private UInt32 m_UnderCount; private UInt32 m_PassCount; private UInt32 m_OverCount; @@ -666,13 +693,16 @@ namespace ITC81DB_2H private UInt32 m_ExNGCount; private UInt32 m_TotalCount; private int m_Grade; - private double m_Weight; + private double m_WeightFloat; + private int m_WeightInt; private int m_OperationStatus; private int m_AlarmStatus; private int m_Speed; private UInt32 m_MetalDetectionCount; private UInt32 m_DoubleEntryCount; private byte[] m_ProductName; + + private short[] m_Alarm; #endregion #region Constructor @@ -699,25 +729,46 @@ namespace ITC81DB_2H set { this.m_ProductNo = value; } } - public double UnderValue + public int UnderValueInt { - get { return this.m_UnderValue; } - set { this.m_UnderValue = value; } + get { return this.m_UnderValueInt; } + set { this.m_UnderValueInt = value; } } - public double PassValue + public int PassValueInt { - get { return this.m_PassValue; } - set { this.m_PassValue = value; } + get { return this.m_PassValueInt; } + set { this.m_PassValueInt = value; } } - public double OverValue + public int OverValueInt { - get { return this.m_OverValue; } - set { this.m_OverValue = value; } + get { return this.m_OverValueInt; } + set { this.m_OverValueInt = value; } } - public double TareValue + public int TareValueInt { - get { return this.m_TareValue; } - set { this.m_TareValue = value; } + get { return this.m_TareValueInt; } + set { this.m_TareValueInt = value; } + } + + public double UnderValueFloat + { + get { return this.m_UnderValueFloat; } + set { this.m_UnderValueFloat = value; } + } + public double PassValueFloat + { + get { return this.m_PassValueFloat; } + set { this.m_PassValueFloat = value; } + } + public double OverValueFloat + { + get { return this.m_OverValueFloat; } + set { this.m_OverValueFloat = value; } + } + public double TareValueFloat + { + get { return this.m_TareValueFloat; } + set { this.m_TareValueFloat = value; } } public UInt32 UnderCount @@ -756,10 +807,15 @@ namespace ITC81DB_2H get { return this.m_Grade; } set { this.m_Grade = value; } } - public double Weight + public double WeightFloat { - get { return this.m_Weight; } - set { this.m_Weight = value; } + get { return this.m_WeightFloat; } + set { this.m_WeightFloat = value; } + } + public int WeightInt + { + get { return this.m_WeightInt; } + set { this.m_WeightInt = value; } } public int OperationStatus { @@ -792,6 +848,12 @@ namespace ITC81DB_2H set { this.m_ProductName = value; } } + public short[] Alarm + { + get { return this.m_Alarm; } + set { this.m_Alarm = value; } + } + public string HexStringIsUpdate { get @@ -820,7 +882,7 @@ namespace ITC81DB_2H { get { - byte[] bytes = BitConverter.GetBytes((float)this.UnderValue); + byte[] bytes = BitConverter.GetBytes((float)this.UnderValueFloat); Array.Reverse(bytes); string hexString = BitConverter.ToString(bytes); hexString = hexString.Replace("-", ""); @@ -832,7 +894,7 @@ namespace ITC81DB_2H { get { - byte[] bytes = BitConverter.GetBytes((float)this.PassValue); + byte[] bytes = BitConverter.GetBytes((float)this.PassValueFloat); Array.Reverse(bytes); string hexString = BitConverter.ToString(bytes); hexString = hexString.Replace("-", ""); @@ -844,7 +906,7 @@ namespace ITC81DB_2H { get { - byte[] bytes = BitConverter.GetBytes((float)this.OverValue); + byte[] bytes = BitConverter.GetBytes((float)this.OverValueFloat); Array.Reverse(bytes); string hexString = BitConverter.ToString(bytes); hexString = hexString.Replace("-", ""); @@ -856,7 +918,7 @@ namespace ITC81DB_2H { get { - byte[] bytes = BitConverter.GetBytes((float)this.TareValue); + byte[] bytes = BitConverter.GetBytes((float)this.TareValueFloat); Array.Reverse(bytes); string hexString = BitConverter.ToString(bytes); hexString = hexString.Replace("-", ""); @@ -924,7 +986,7 @@ namespace ITC81DB_2H { get { - byte[] bytes = BitConverter.GetBytes((float)this.Weight); + byte[] bytes = BitConverter.GetBytes((float)this.WeightFloat); byte[] reverseBytes = new byte[bytes.Length]; for (int i = 0; i < bytes.Length; i++) reverseBytes[bytes.Length - 1 - i] = bytes[i]; @@ -975,6 +1037,18 @@ namespace ITC81DB_2H return hexString; } } + public string[] HexStringAlarm + { + get + { + string[] hexString = new string[this.Alarm.Count()]; + + for (int i = 0; i < this.Alarm.Count(); i++) + hexString[i] = this.Alarm[i].ToString("X8"); + + return hexString; + } + } public byte[] _01_IsUpdate_High { @@ -1067,7 +1141,7 @@ namespace ITC81DB_2H byte[] madeData = new byte[2]; byte[] Length4Value = new byte[4]; - Length4Value = Modbus.GetBytes((Single)this.UnderValue); + Length4Value = Modbus.GetBytes((Single)this.UnderValueFloat); for (int i = 0; i < 2; i++) madeData[i] = Length4Value[3 - i]; @@ -1081,7 +1155,7 @@ namespace ITC81DB_2H byte[] madeData = new byte[2]; byte[] Length4Value = new byte[4]; - Length4Value = Modbus.GetBytes((Single)this.UnderValue); + Length4Value = Modbus.GetBytes((Single)this.UnderValueFloat); for (int i = 0; i < 2; i++) madeData[i] = Length4Value[1 - i]; @@ -1095,7 +1169,7 @@ namespace ITC81DB_2H byte[] madeData = new byte[2]; byte[] Length4Value = new byte[4]; - Length4Value = Modbus.GetBytes((Single)this.PassValue); + Length4Value = Modbus.GetBytes((Single)this.PassValueFloat); for (int i = 0; i < 2; i++) madeData[i] = Length4Value[3 - i]; @@ -1109,7 +1183,7 @@ namespace ITC81DB_2H byte[] madeData = new byte[2]; byte[] Length4Value = new byte[4]; - Length4Value = Modbus.GetBytes((Single)this.PassValue); + Length4Value = Modbus.GetBytes((Single)this.PassValueFloat); for (int i = 0; i < 2; i++) madeData[i] = Length4Value[1 - i]; @@ -1123,7 +1197,7 @@ namespace ITC81DB_2H byte[] madeData = new byte[2]; byte[] Length4Value = new byte[4]; - Length4Value = Modbus.GetBytes((Single)this.OverValue); + Length4Value = Modbus.GetBytes((Single)this.OverValueFloat); for (int i = 0; i < 2; i++) madeData[i] = Length4Value[3 - i]; @@ -1137,7 +1211,7 @@ namespace ITC81DB_2H byte[] madeData = new byte[2]; byte[] Length4Value = new byte[4]; - Length4Value = Modbus.GetBytes((Single)this.OverValue); + Length4Value = Modbus.GetBytes((Single)this.OverValueFloat); for (int i = 0; i < 2; i++) madeData[i] = Length4Value[1 - i]; @@ -1151,7 +1225,7 @@ namespace ITC81DB_2H byte[] madeData = new byte[2]; byte[] Length4Value = new byte[4]; - Length4Value = Modbus.GetBytes((Single)this.TareValue); + Length4Value = Modbus.GetBytes((Single)this.TareValueFloat); for (int i = 0; i < 2; i++) madeData[i] = Length4Value[3 - i]; @@ -1165,7 +1239,7 @@ namespace ITC81DB_2H byte[] madeData = new byte[2]; byte[] Length4Value = new byte[4]; - Length4Value = Modbus.GetBytes((Single)this.TareValue); + Length4Value = Modbus.GetBytes((Single)this.TareValueFloat); for (int i = 0; i < 2; i++) madeData[i] = Length4Value[1 - i]; @@ -1375,7 +1449,7 @@ namespace ITC81DB_2H byte[] madeData = new byte[2]; byte[] Length4Value = new byte[4]; - Length4Value = Modbus.GetBytes((Single)this.Weight); + Length4Value = Modbus.GetBytes((Single)this.WeightFloat); for (int i = 0; i < 2; i++) madeData[i] = Length4Value[3 - i]; @@ -1389,7 +1463,7 @@ namespace ITC81DB_2H byte[] madeData = new byte[2]; byte[] Length4Value = new byte[4]; - Length4Value = Modbus.GetBytes((Single)this.Weight); + Length4Value = Modbus.GetBytes((Single)this.WeightFloat); for (int i = 0; i < 2; i++) madeData[i] = Length4Value[1 - i]; @@ -1544,10 +1618,14 @@ namespace ITC81DB_2H this.IsUpdate = 0; this.EquipmentID = 1; this.ProductNo = 1; - this.UnderValue = 100.0; - this.PassValue = 200.0; - this.OverValue = 300.0; - this.TareValue = 0.0; + this.UnderValueFloat = 100.0; + this.PassValueFloat = 200.0; + this.OverValueFloat = 300.0; + this.TareValueFloat = 0.0; + this.UnderValueInt = 1000; + this.PassValueInt = 2000; + this.OverValueInt = 3000; + this.TareValueInt = 0; this.UnderCount = 0; this.PassCount = 0; this.OverCount = 0; @@ -1555,13 +1633,15 @@ namespace ITC81DB_2H this.ExNGCount = 0; this.TotalCount = 0; this.Grade = 5; - this.Weight = 0.0; + this.WeightFloat = 0.0; + this.WeightInt = 0; this.OperationStatus = 0; this.AlarmStatus = 0; this.Speed = 0; this.MetalDetectionCount = 0; this.DoubleEntryCount = 0; this.ProductName = new byte[20]; + this.Alarm = new short[6]; } #endregion } @@ -3847,7 +3927,7 @@ namespace ITC81DB_2H this.BoardMetalDetectionCount = 0; } - private void ProductionSpeedCalculation() + public void ProductionSpeedCalculation() { int currentTimeTickCount = 0, gap = 0; double millisecond = 0.0, speed = 0.0; diff --git a/ITC81DB_2H/Datastore/Define.cs b/ITC81DB_2H/Datastore/Define.cs index 31ca2de..cd8b0d8 100644 --- a/ITC81DB_2H/Datastore/Define.cs +++ b/ITC81DB_2H/Datastore/Define.cs @@ -540,7 +540,7 @@ namespace ITC81DB_2H.Datastore BLDCMotorSpeed, BLDCPollNum, BLDCAttenuatorRatio, - BLDCMotorDirection + BLDCMotorDirection, } public enum E_TrackingAlarm diff --git a/ITC81DB_2H/Datastore/Helper.cs b/ITC81DB_2H/Datastore/Helper.cs index 31dae41..ede8847 100644 --- a/ITC81DB_2H/Datastore/Helper.cs +++ b/ITC81DB_2H/Datastore/Helper.cs @@ -382,6 +382,25 @@ namespace ITC81DB_2H return 0x00; } } + public static string StringToHexString(string strData) + { + string resultHex = string.Empty; + byte[] arr_byteStr = Encoding.Default.GetBytes(strData); + + foreach (byte byteStr in arr_byteStr) + resultHex += string.Format("{0:X2}", byteStr); + + return resultHex; + } + public static string ByteToHexString(byte[] array) + { + string resultHex = ""; + + foreach (byte byteStr in array) + resultHex += string.Format("{0:X2}", byteStr); + + return resultHex; + } /// /// Remove Folder로 이동 diff --git a/ITC81DB_2H/Forms/FormMain.cs b/ITC81DB_2H/Forms/FormMain.cs index bdaae3e..e76be59 100644 --- a/ITC81DB_2H/Forms/FormMain.cs +++ b/ITC81DB_2H/Forms/FormMain.cs @@ -25,8 +25,8 @@ namespace ITC81DB_2H.Forms public partial class FormMain : Form { #region Field - public static string DisplayVersion = "3.3.5"; - public static string ReleaseDate = "2024.09.23"; + public static string DisplayVersion = "3.3.6"; + public static string ReleaseDate = "2025.03.04"; private SmartSplash SmartSplashProgramLoad; public bool IsCommunicationLogOpen; @@ -163,7 +163,9 @@ namespace ITC81DB_2H.Forms public FormMenu ChildFormMenu; // 알람 + public static int CurrentAlarmCount = 32; private AlarmList CurrentAlarmList; + public List CurrentAlarm; // IO Test Input 데이터 취합 private Collection CollectionIOTest_InputData; @@ -470,6 +472,11 @@ namespace ITC81DB_2H.Forms for (int i = 0; i < 300; i++) this.CollectionGraphData.Add(0); + this.CurrentAlarm = new List(); + this.CurrentAlarm.Clear(); + for (int i = 0; i < CurrentAlarmCount; i++) + this.CurrentAlarm.Add(0); + this.SystemConfig1 = new SystemConfigurationItem1(); this.SystemConfig2 = new SystemConfigurationItem2(); this.SystemConfig3 = new SystemConfigurationItem3(); @@ -3122,6 +3129,8 @@ namespace ITC81DB_2H.Forms //// 통신 제대로 받으면 ACK //this.TransferData(string.Format("{0}{1}{2}{3}", CommunicationCommand.RunWeightData, (int)Define.E_ResponseData.ACK, dataID, transferCount), CommunicationID.MainBoard); + // 속도계산 + this.CurrentWeightData.ProductionSpeedCalculation(); if (this.FlagSerialDll == true) { @@ -5231,6 +5240,17 @@ namespace ITC81DB_2H.Forms else if (readByte[1] == ModbusFunctionCode.FunctionCode_04) { #region Read Input Register(0x04) + int tempWeight = 0; + string removeMinus = ""; + if (this.CurrentWeightData.WeightString.StartsWith("-") == true) + { + removeMinus = this.CurrentWeightData.WeightString.Replace("-", ""); + tempWeight = int.Parse(removeMinus); + tempWeight *= -1; + } + else + tempWeight = int.Parse(this.CurrentWeightData.WeightString); + double underValue = Helper.StringToWeight(this.CurrentProductItem.UnderRange, this.SystemConfig1.DecimalPlaces); double passValue = Helper.StringToWeight(this.CurrentProductItem.PassRange, this.SystemConfig1.DecimalPlaces); double overValue = Helper.StringToWeight(this.CurrentProductItem.OverRange, this.SystemConfig1.DecimalPlaces); @@ -5278,6 +5298,13 @@ namespace ITC81DB_2H.Forms switch (j) { #region Make data + + #region Data + case _30000_ModbusAddress._01_DecimalPoint: + length2Value = GetBytes(this.SystemConfig1.DecimalPlaces); + for (int i = 0; i < 2; i++) + madeData[madeDataIndex + i] = length2Value[1 - i]; + break; case _30000_ModbusAddress._01_IsUpdate_High: length4Value = GetBytes(this.UpdateValue); for (int i = 0; i < 2; i++) @@ -5308,42 +5335,42 @@ namespace ITC81DB_2H.Forms for (int i = 0; i < 2; i++) madeData[madeDataIndex + i] = length4Value[1 - i]; break; - case _30000_ModbusAddress._07_UnderValue_High: + case _30000_ModbusAddress._07_UnderValueFloat_High: length4Value = GetBytes((Single)underValue); for (int i = 0; i < 2; i++) madeData[madeDataIndex + i] = length4Value[3 - i]; break; - case _30000_ModbusAddress._08_UnderValue_Low: + case _30000_ModbusAddress._08_UnderValueFloat_Low: length4Value = GetBytes((Single)underValue); for (int i = 0; i < 2; i++) madeData[madeDataIndex + i] = length4Value[1 - i]; break; - case _30000_ModbusAddress._09_PassValue_High: + case _30000_ModbusAddress._09_PassValueFloat_High: length4Value = GetBytes((Single)passValue); for (int i = 0; i < 2; i++) madeData[madeDataIndex + i] = length4Value[3 - i]; break; - case _30000_ModbusAddress._10_PassValue_Low: + case _30000_ModbusAddress._10_PassValueFloat_Low: length4Value = GetBytes((Single)passValue); for (int i = 0; i < 2; i++) madeData[madeDataIndex + i] = length4Value[1 - i]; break; - case _30000_ModbusAddress._11_OverValue_High: + case _30000_ModbusAddress._11_OverValueFloat_High: length4Value = GetBytes((Single)overValue); for (int i = 0; i < 2; i++) madeData[madeDataIndex + i] = length4Value[3 - i]; break; - case _30000_ModbusAddress._12_OverValue_Low: + case _30000_ModbusAddress._12_OverValueFloat_Low: length4Value = GetBytes((Single)overValue); for (int i = 0; i < 2; i++) madeData[madeDataIndex + i] = length4Value[1 - i]; break; - case _30000_ModbusAddress._13_TareValue_High: + case _30000_ModbusAddress._13_TareValueFloat_High: length4Value = GetBytes((Single)tareValue); for (int i = 0; i < 2; i++) madeData[madeDataIndex + i] = length4Value[3 - i]; break; - case _30000_ModbusAddress._14_TareValue_Low: + case _30000_ModbusAddress._14_TareValueFloat_Low: length4Value = GetBytes((Single)tareValue); for (int i = 0; i < 2; i++) madeData[madeDataIndex + i] = length4Value[1 - i]; @@ -5418,7 +5445,7 @@ namespace ITC81DB_2H.Forms for (int i = 0; i < 2; i++) madeData[madeDataIndex + i] = length4Value[1 - i]; break; - case _30000_ModbusAddress._29_Weight_High: + case _30000_ModbusAddress._29_WeightFloat_High: if (this.CurrentSystemStatus.Equipment == Define.E_EquipmentStatus.Stop) length4Value = GetBytes((Single)0.0); else @@ -5426,7 +5453,7 @@ namespace ITC81DB_2H.Forms for (int i = 0; i < 2; i++) madeData[madeDataIndex + i] = length4Value[3 - i]; break; - case _30000_ModbusAddress._30_Weight_Low: + case _30000_ModbusAddress._30_WeightFloat_Low: if (this.CurrentSystemStatus.Equipment == Define.E_EquipmentStatus.Stop) length4Value = GetBytes((Single)0.0); else @@ -5488,14 +5515,102 @@ namespace ITC81DB_2H.Forms for (int i = 0; i < productName.Length; i++) madeData[madeDataIndex + i] = productName[i]; break; + case _30000_ModbusAddress._51_UnderValueInt_High: + length4Value = GetBytes(this.CurrentProductItem.UnderRangeInt); + for (int i = 0; i < 2; i++) + madeData[madeDataIndex + i] = length4Value[3 - i]; + break; + case _30000_ModbusAddress._52_UnderValueInt_Low: + length4Value = GetBytes(this.CurrentProductItem.UnderRangeInt); + for (int i = 0; i < 2; i++) + madeData[madeDataIndex + i] = length4Value[1 - i]; + break; + case _30000_ModbusAddress._53_PassValueInt_High: + length4Value = GetBytes(this.CurrentProductItem.PassRangeInt); + for (int i = 0; i < 2; i++) + madeData[madeDataIndex + i] = length4Value[3 - i]; + break; + case _30000_ModbusAddress._54_PassValueInt_Low: + length4Value = GetBytes(this.CurrentProductItem.PassRangeInt); + for (int i = 0; i < 2; i++) + madeData[madeDataIndex + i] = length4Value[1 - i]; + break; + case _30000_ModbusAddress._55_OverValueInt_High: + length4Value = GetBytes(this.CurrentProductItem.OverRangeInt); + for (int i = 0; i < 2; i++) + madeData[madeDataIndex + i] = length4Value[3 - i]; + break; + case _30000_ModbusAddress._56_OverValueInt_Low: + length4Value = GetBytes(this.CurrentProductItem.OverRangeInt); + for (int i = 0; i < 2; i++) + madeData[madeDataIndex + i] = length4Value[1 - i]; + break; + case _30000_ModbusAddress._57_TareValueInt_High: + length4Value = GetBytes(this.CurrentProductItem.TareRangeInt); + for (int i = 0; i < 2; i++) + madeData[madeDataIndex + i] = length4Value[3 - i]; + break; + case _30000_ModbusAddress._58_TareValueInt_Low: + length4Value = GetBytes(this.CurrentProductItem.TareRangeInt); + for (int i = 0; i < 2; i++) + madeData[madeDataIndex + i] = length4Value[1 - i]; + break; + case _30000_ModbusAddress._59_WeightInt_High: + if (this.CurrentSystemStatus.Equipment == Define.E_EquipmentStatus.Stop) + length4Value = GetBytes(0); + else + length4Value = GetBytes(tempWeight); + for (int i = 0; i < 2; i++) + madeData[madeDataIndex + i] = length4Value[3 - i]; + break; + case _30000_ModbusAddress._60_WeightInt_Low: + if (this.CurrentSystemStatus.Equipment == Define.E_EquipmentStatus.Stop) + length4Value = GetBytes(0); + else + length4Value = GetBytes(tempWeight); + for (int i = 0; i < 2; i++) + madeData[madeDataIndex + i] = length4Value[1 - i]; + break; + #endregion + + #region Alarm + case _39000_ModbusAddressAlarm._9001_Alarm1: + case _39000_ModbusAddressAlarm._9002_Alarm2: + case _39000_ModbusAddressAlarm._9003_Alarm3: + case _39000_ModbusAddressAlarm._9004_Alarm4: + case _39000_ModbusAddressAlarm._9005_Alarm5: + case _39000_ModbusAddressAlarm._9006_Alarm6: + case _39000_ModbusAddressAlarm._9007_Alarm7: + case _39000_ModbusAddressAlarm._9008_Alarm8: + case _39000_ModbusAddressAlarm._9009_Alarm9: + case _39000_ModbusAddressAlarm._9010_Alarm10: + case _39000_ModbusAddressAlarm._9011_Alarm11: + case _39000_ModbusAddressAlarm._9012_Alarm12: + case _39000_ModbusAddressAlarm._9013_Alarm13: + case _39000_ModbusAddressAlarm._9014_Alarm14: + case _39000_ModbusAddressAlarm._9015_Alarm15: + case _39000_ModbusAddressAlarm._9016_Alarm16: + case _39000_ModbusAddressAlarm._9017_Alarm17: + case _39000_ModbusAddressAlarm._9018_Alarm18: + length2Value = GetBytes(this.CurrentAlarm[j - 9000]); + + for (int i = 0; i < 2; i++) + madeData[madeDataIndex + i] = length2Value[1 - i]; + break; + #endregion + default: + for (int i = 0; i < 2; i++) + madeData[madeDataIndex + i] = 0; break; #endregion } if (j == (int)_30000_ModbusAddress._41_ProductName) + { + j += 9; madeDataIndex += 20; - else - madeDataIndex += 2; + } + madeDataIndex += 2; } #endregion } @@ -5631,6 +5746,17 @@ namespace ITC81DB_2H.Forms else if (readByte[7] == ModbusFunctionCode.FunctionCode_04) { #region Read Input Register(0x04) + int tempWeight = 0; + string removeMinus = ""; + if (this.CurrentWeightData.WeightString.StartsWith("-") == true) + { + removeMinus = this.CurrentWeightData.WeightString.Replace("-", ""); + tempWeight = int.Parse(removeMinus); + tempWeight *= -1; + } + else + tempWeight = int.Parse(this.CurrentWeightData.WeightString); + double underValue = Helper.StringToWeight(this.CurrentProductItem.UnderRange, this.SystemConfig1.DecimalPlaces); double passValue = Helper.StringToWeight(this.CurrentProductItem.PassRange, this.SystemConfig1.DecimalPlaces); double overValue = Helper.StringToWeight(this.CurrentProductItem.OverRange, this.SystemConfig1.DecimalPlaces); @@ -5679,6 +5805,13 @@ namespace ITC81DB_2H.Forms switch (j) { #region Make data + + #region Data + case _30000_ModbusAddress._01_DecimalPoint: + length2Value = GetBytes(this.SystemConfig1.DecimalPlaces); + for (int i = 0; i < 2; i++) + madeData[madeDataIndex + i] = length2Value[1 - i]; + break; case _30000_ModbusAddress._01_IsUpdate_High: length4Value = GetBytes(this.UpdateValue); for (int i = 0; i < 2; i++) @@ -5709,42 +5842,42 @@ namespace ITC81DB_2H.Forms for (int i = 0; i < 2; i++) madeData[madeDataIndex + i] = length4Value[1 - i]; break; - case _30000_ModbusAddress._07_UnderValue_High: + case _30000_ModbusAddress._07_UnderValueFloat_High: length4Value = GetBytes((Single)underValue); for (int i = 0; i < 2; i++) madeData[madeDataIndex + i] = length4Value[3 - i]; break; - case _30000_ModbusAddress._08_UnderValue_Low: + case _30000_ModbusAddress._08_UnderValueFloat_Low: length4Value = GetBytes((Single)underValue); for (int i = 0; i < 2; i++) madeData[madeDataIndex + i] = length4Value[1 - i]; break; - case _30000_ModbusAddress._09_PassValue_High: + case _30000_ModbusAddress._09_PassValueFloat_High: length4Value = GetBytes((Single)passValue); for (int i = 0; i < 2; i++) madeData[madeDataIndex + i] = length4Value[3 - i]; break; - case _30000_ModbusAddress._10_PassValue_Low: + case _30000_ModbusAddress._10_PassValueFloat_Low: length4Value = GetBytes((Single)passValue); for (int i = 0; i < 2; i++) madeData[madeDataIndex + i] = length4Value[1 - i]; break; - case _30000_ModbusAddress._11_OverValue_High: + case _30000_ModbusAddress._11_OverValueFloat_High: length4Value = GetBytes((Single)overValue); for (int i = 0; i < 2; i++) madeData[madeDataIndex + i] = length4Value[3 - i]; break; - case _30000_ModbusAddress._12_OverValue_Low: + case _30000_ModbusAddress._12_OverValueFloat_Low: length4Value = GetBytes((Single)overValue); for (int i = 0; i < 2; i++) madeData[madeDataIndex + i] = length4Value[1 - i]; break; - case _30000_ModbusAddress._13_TareValue_High: + case _30000_ModbusAddress._13_TareValueFloat_High: length4Value = GetBytes((Single)tareValue); for (int i = 0; i < 2; i++) madeData[madeDataIndex + i] = length4Value[3 - i]; break; - case _30000_ModbusAddress._14_TareValue_Low: + case _30000_ModbusAddress._14_TareValueFloat_Low: length4Value = GetBytes((Single)tareValue); for (int i = 0; i < 2; i++) madeData[madeDataIndex + i] = length4Value[1 - i]; @@ -5819,7 +5952,7 @@ namespace ITC81DB_2H.Forms for (int i = 0; i < 2; i++) madeData[madeDataIndex + i] = length4Value[1 - i]; break; - case _30000_ModbusAddress._29_Weight_High: + case _30000_ModbusAddress._29_WeightFloat_High: if (this.CurrentSystemStatus.Equipment == Define.E_EquipmentStatus.Stop) length4Value = GetBytes((Single)0.0); else @@ -5827,7 +5960,7 @@ namespace ITC81DB_2H.Forms for (int i = 0; i < 2; i++) madeData[madeDataIndex + i] = length4Value[3 - i]; break; - case _30000_ModbusAddress._30_Weight_Low: + case _30000_ModbusAddress._30_WeightFloat_Low: if (this.CurrentSystemStatus.Equipment == Define.E_EquipmentStatus.Stop) length4Value = GetBytes((Single)0.0); else @@ -5889,12 +6022,101 @@ namespace ITC81DB_2H.Forms for (int i = 0; i < productName.Length; i++) madeData[madeDataIndex + i] = productName[i]; break; + case _30000_ModbusAddress._51_UnderValueInt_High: + length4Value = GetBytes(this.CurrentProductItem.UnderRangeInt); + for (int i = 0; i < 2; i++) + madeData[madeDataIndex + i] = length4Value[3 - i]; + break; + case _30000_ModbusAddress._52_UnderValueInt_Low: + length4Value = GetBytes(this.CurrentProductItem.UnderRangeInt); + for (int i = 0; i < 2; i++) + madeData[madeDataIndex + i] = length4Value[1 - i]; + break; + case _30000_ModbusAddress._53_PassValueInt_High: + length4Value = GetBytes(this.CurrentProductItem.PassRangeInt); + for (int i = 0; i < 2; i++) + madeData[madeDataIndex + i] = length4Value[3 - i]; + break; + case _30000_ModbusAddress._54_PassValueInt_Low: + length4Value = GetBytes(this.CurrentProductItem.PassRangeInt); + for (int i = 0; i < 2; i++) + madeData[madeDataIndex + i] = length4Value[1 - i]; + break; + case _30000_ModbusAddress._55_OverValueInt_High: + length4Value = GetBytes(this.CurrentProductItem.OverRangeInt); + for (int i = 0; i < 2; i++) + madeData[madeDataIndex + i] = length4Value[3 - i]; + break; + case _30000_ModbusAddress._56_OverValueInt_Low: + length4Value = GetBytes(this.CurrentProductItem.OverRangeInt); + for (int i = 0; i < 2; i++) + madeData[madeDataIndex + i] = length4Value[1 - i]; + break; + case _30000_ModbusAddress._57_TareValueInt_High: + length4Value = GetBytes(this.CurrentProductItem.TareRangeInt); + for (int i = 0; i < 2; i++) + madeData[madeDataIndex + i] = length4Value[3 - i]; + break; + case _30000_ModbusAddress._58_TareValueInt_Low: + length4Value = GetBytes(this.CurrentProductItem.TareRangeInt); + for (int i = 0; i < 2; i++) + madeData[madeDataIndex + i] = length4Value[1 - i]; + break; + case _30000_ModbusAddress._59_WeightInt_High: + if (this.CurrentSystemStatus.Equipment == Define.E_EquipmentStatus.Stop) + length4Value = GetBytes(0); + else + length4Value = GetBytes(tempWeight); + for (int i = 0; i < 2; i++) + madeData[madeDataIndex + i] = length4Value[3 - i]; + break; + case _30000_ModbusAddress._60_WeightInt_Low: + if (this.CurrentSystemStatus.Equipment == Define.E_EquipmentStatus.Stop) + length4Value = GetBytes(0); + else + length4Value = GetBytes(tempWeight); + for (int i = 0; i < 2; i++) + madeData[madeDataIndex + i] = length4Value[1 - i]; + break; + #endregion + + #region Alarm + case _39000_ModbusAddressAlarm._9001_Alarm1: + case _39000_ModbusAddressAlarm._9002_Alarm2: + case _39000_ModbusAddressAlarm._9003_Alarm3: + case _39000_ModbusAddressAlarm._9004_Alarm4: + case _39000_ModbusAddressAlarm._9005_Alarm5: + case _39000_ModbusAddressAlarm._9006_Alarm6: + case _39000_ModbusAddressAlarm._9007_Alarm7: + case _39000_ModbusAddressAlarm._9008_Alarm8: + case _39000_ModbusAddressAlarm._9009_Alarm9: + case _39000_ModbusAddressAlarm._9010_Alarm10: + case _39000_ModbusAddressAlarm._9011_Alarm11: + case _39000_ModbusAddressAlarm._9012_Alarm12: + case _39000_ModbusAddressAlarm._9013_Alarm13: + case _39000_ModbusAddressAlarm._9014_Alarm14: + case _39000_ModbusAddressAlarm._9015_Alarm15: + case _39000_ModbusAddressAlarm._9016_Alarm16: + case _39000_ModbusAddressAlarm._9017_Alarm17: + case _39000_ModbusAddressAlarm._9018_Alarm18: + length2Value = GetBytes(this.CurrentAlarm[j - 9000]); + + for (int i = 0; i < 2; i++) + madeData[madeDataIndex + i] = length2Value[1 - i]; + break; + #endregion + default: + for (int i = 0; i < 2; i++) + madeData[madeDataIndex + i] = 0; break; #endregion } if (j == (int)_30000_ModbusAddress._41_ProductName) + { + j += 9; madeDataIndex += 20; + } else madeDataIndex += 2; } @@ -7098,8 +7320,6 @@ namespace ITC81DB_2H.Forms if (this.IsOPCModbusUsing == false) return; - //byte[] productName; - if (this.UpdateValue > 999999999) this.UpdateValue = 0; else @@ -7109,19 +7329,10 @@ namespace ITC81DB_2H.Forms this.Current30000ModbusData.EquipmentID = this.SystemConfig1.EquipmentID; this.Current30000ModbusData.ProductNo = this.SystemConfig1.ProductNumber; - this.Current30000ModbusData.UnderValue = Helper.StringToWeight(this.CurrentProductItem.UnderRange, this.SystemConfig1.DecimalPlaces); - this.Current30000ModbusData.PassValue = Helper.StringToWeight(this.CurrentProductItem.PassRange, this.SystemConfig1.DecimalPlaces); - this.Current30000ModbusData.OverValue = Helper.StringToWeight(this.CurrentProductItem.OverRange, this.SystemConfig1.DecimalPlaces); - this.Current30000ModbusData.TareValue = Helper.StringToWeight(this.CurrentProductItem.TareRange, this.SystemConfig1.DecimalPlaces); - - //// 통신 확인 로그 - //if (this.IsCommunicationLogOpen == true) - //{ - // this.smartFileCommunicationLog.WriteString(string.Format("UnderValue ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, this.Current30000ModbusData.UnderValue.ToString())); - // this.smartFileCommunicationLog.WriteString(string.Format("PassValue ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, this.Current30000ModbusData.PassValue.ToString())); - // this.smartFileCommunicationLog.WriteString(string.Format("OverValue ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, this.Current30000ModbusData.OverValue.ToString())); - // this.smartFileCommunicationLog.WriteString(string.Format("TareValue ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, this.Current30000ModbusData.TareValue.ToString())); - //} + this.Current30000ModbusData.UnderValueFloat = Helper.StringToWeight(this.CurrentProductItem.UnderRange, this.SystemConfig1.DecimalPlaces); + this.Current30000ModbusData.PassValueFloat = Helper.StringToWeight(this.CurrentProductItem.PassRange, this.SystemConfig1.DecimalPlaces); + this.Current30000ModbusData.OverValueFloat = Helper.StringToWeight(this.CurrentProductItem.OverRange, this.SystemConfig1.DecimalPlaces); + this.Current30000ModbusData.TareValueFloat = Helper.StringToWeight(this.CurrentProductItem.TareRange, this.SystemConfig1.DecimalPlaces); this.Current30000ModbusData.UnderCount = (UInt32)this.CurrentWeightData.UnderCount; this.Current30000ModbusData.PassCount = (UInt32)this.CurrentWeightData.PassCount; @@ -7154,12 +7365,12 @@ namespace ITC81DB_2H.Forms if (this.CurrentSystemStatus.Equipment == Define.E_EquipmentStatus.Start) { - this.Current30000ModbusData.Weight = this.CurrentWeightData.Weight; + this.Current30000ModbusData.WeightFloat = this.CurrentWeightData.Weight; this.Current30000ModbusData.OperationStatus = 1; } else { - this.Current30000ModbusData.Weight = 0.0; + this.Current30000ModbusData.WeightFloat = 0.0; this.Current30000ModbusData.OperationStatus = 0; } @@ -7168,18 +7379,14 @@ namespace ITC81DB_2H.Forms else this.Current30000ModbusData.AlarmStatus = 0; - this.Current30000ModbusData.Speed = this.CurrentWeightData.ProductionSpeed; + if (this.CurrentWeightData.ProductionSpeed <= 500) + this.Current30000ModbusData.Speed = this.CurrentWeightData.ProductionSpeed; this.Current30000ModbusData.MetalDetectionCount = (UInt32)this.CurrentWeightData.MetalDetectionCount; this.Current30000ModbusData.DoubleEntryCount = (UInt32)this.CurrentWeightData.DoubleEntryCount; try { byte[] productName = new UTF8Encoding().GetBytes(this.CurrentProductItem.Name); - // 로그 - //if (this.IsCommunicationLogOpen == true) - //{ - // this.smartFileCommunicationLog.WriteString(string.Format("Update30000ModbusItem ({0:yyyy-MM-dd HH:mm:ss}): {1}, {2}", DateTime.Now, BitConverter.ToString(productName), productName.Length)); - //} if (productName.Length > 20) { for (int i = 0; i < 20; i++) @@ -7196,7 +7403,7 @@ namespace ITC81DB_2H.Forms // 로그 //if (this.IsCommunicationLogOpen == true) //{ - // this.smartFileCommunicationLog.WriteString(string.Format("Update30000ModbusItem ({0:yyyy-MM-dd HH:mm:ss}): {1}, {2}", DateTime.Now, BitConverter.ToString(this.Current30000ModbusData.ProductName), this.Current30000ModbusData.ProductName.Length)); + // this.smartFileCommunicationLog.WriteString(string.Format("Update30000ModbusItem ({0:yyyy-MM-dd HH:mm:ss}): {1}, {2}", DateTime.Now, BitConverter.ToString(productName), productName.Length)); //} } catch @@ -7208,6 +7415,24 @@ namespace ITC81DB_2H.Forms this.Current30000ModbusData.ProductName[i] = 0x20; } + this.Current30000ModbusData.UnderValueInt = this.CurrentProductItem.UnderRangeInt; + this.Current30000ModbusData.PassValueInt = this.CurrentProductItem.PassRangeInt; + this.Current30000ModbusData.OverValueInt = this.CurrentProductItem.OverRangeInt; + this.Current30000ModbusData.TareValueInt = this.CurrentProductItem.TareRangeInt; + + int tempWeight = 0; + string removeMinus = ""; + if (this.CurrentWeightData.WeightString.StartsWith("-") == true) + { + removeMinus = this.CurrentWeightData.WeightString.Replace("-", ""); + tempWeight = int.Parse(removeMinus); + tempWeight *= -1; + } + else + tempWeight = int.Parse(this.CurrentWeightData.WeightString); + + this.Current30000ModbusData.WeightInt = tempWeight; + this.ChildFormMainDisplay.MainModbus.UpdateData(this.Current30000ModbusData); } /// @@ -14448,7 +14673,11 @@ namespace ITC81DB_2H.Forms private void CurrentAlarmList_Change(Define.E_TrackingAlarm alarm, string status) { - this.Update30000ModbusItem(); + if (status == "ON") + this.CurrentAlarm[(short)alarm - 1] = 1; + else + this.CurrentAlarm[(short)alarm - 1] = 0; + this.SetTrackingHistoryData(alarm, status); } diff --git a/ITC81DB_2H/Version.txt b/ITC81DB_2H/Version.txt index 70f9a71..46507ce 100644 --- a/ITC81DB_2H/Version.txt +++ b/ITC81DB_2H/Version.txt @@ -13,6 +13,12 @@ ⺻ м 跮 */ +@ Ver 3.3.6 by CJY + - 2025.03.04 + - Ver 3.3.5 Modify + - ȭ ӵ ǥ ȵǴ + - Modbus ׸ ߰ + @ Ver 3.3.5 by CJY - 2024.09.23 - Ver 3.3.4 Modify diff --git a/ITC81DB_2H/bin/Release/ITC81DB_2H.exe b/ITC81DB_2H/bin/Release/ITC81DB_2H.exe index e943fce..88a89ab 100644 Binary files a/ITC81DB_2H/bin/Release/ITC81DB_2H.exe and b/ITC81DB_2H/bin/Release/ITC81DB_2H.exe differ diff --git a/ITC81DB_2H/bin/Release/InModbus.dll b/ITC81DB_2H/bin/Release/InModbus.dll index 0e8800b..3c646aa 100644 Binary files a/ITC81DB_2H/bin/Release/InModbus.dll and b/ITC81DB_2H/bin/Release/InModbus.dll differ diff --git a/ITC81DB_2H/obj/Release/ITC81DB_2H.exe b/ITC81DB_2H/obj/Release/ITC81DB_2H.exe index e943fce..88a89ab 100644 Binary files a/ITC81DB_2H/obj/Release/ITC81DB_2H.exe and b/ITC81DB_2H/obj/Release/ITC81DB_2H.exe differ