From 7e3f87542cfc4c46fa987b70afd93b6764526189 Mon Sep 17 00:00:00 2001 From: chiDT Date: Tue, 1 Jul 2025 23:02:33 +0900 Subject: [PATCH] =?UTF-8?q?1.=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EC=88=98?= =?UTF-8?q?=EC=8B=A0=EC=A0=84=EC=97=90=EB=8A=94=20=EC=95=8C=EB=9E=8C?= =?UTF-8?q?=EC=9D=B4=20=EC=9A=B8=EB=A6=AC=EC=A7=80=20=EC=95=8A=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=ED=95=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cVMS.NET_CS/FMain.cs | 11 ++- cVMS.NET_CS/Frm_Sub.cs | 5 +- cVMS.NET_CS/HMI/MainDisplay/CITEM.cs | 2 + cVMS.NET_CS/HMI/MainDisplay/DispCtrl.cs | 115 ++++++++++++++++-------- cVMS.NET_CS/RunCode/Step/_STEP_RUN.cs | 4 +- cVMS.NET_CS/RunCode/_95_SPS.cs | 2 +- cVMS.NET_CS/pub.cs | 15 ++-- 7 files changed, 102 insertions(+), 52 deletions(-) diff --git a/cVMS.NET_CS/FMain.cs b/cVMS.NET_CS/FMain.cs index b5b01ee..a911780 100644 --- a/cVMS.NET_CS/FMain.cs +++ b/cVMS.NET_CS/FMain.cs @@ -96,7 +96,7 @@ namespace vmsnet this.DispCtrl1.Size = new System.Drawing.Size(774, 699); this.DispCtrl1.TabIndex = 3; this.DispCtrl1.Times = null; - this.DispCtrl1.Values = null; + this.DispCtrl1._Values = null; this.DispCtrl1.OnAlamChange += DispCtrl1_OnAlamChangeL; this.DispCtrl1.OnChangedShowIndex += DispCtrl1_OnChangedShowIndex; this.DispCtrl1.OnClickCell += DispCtrl1_OnClickCell; @@ -1249,7 +1249,8 @@ namespace vmsnet if (maxunno < 0) maxunno = 5; if (maxchno < 0) maxchno = 59; - PUB.Values = new int[maxmcno + 1, maxunno + 1, maxchno + 1]; + PUB._Values = new int[maxmcno + 1, maxunno + 1, maxchno + 1]; + PUB.Received = new bool[maxmcno + 1, maxunno + 1, maxchno + 1]; PUB.Times = new string[maxmcno + 1, maxunno + 1, maxchno + 1]; PUB.ChNos = new int[maxmcno + 1, maxunno + 1, maxchno + 1]; PUB.ChVOffset = new float[maxmcno + 1, maxunno + 1, maxchno + 1]; @@ -1263,7 +1264,8 @@ namespace vmsnet { for (int k = 0; k <= maxchno; k++) { - PUB.Values[c, i, k] = 0; + PUB._Values[c, i, k] = 0; + PUB.Received[c, i, k] = false; PUB.Times[c, i, k] = ""; PUB.ChVOffset[c, i, k] = 0f; PUB.ChDecPos[c, i, k] = 0; @@ -1289,7 +1291,8 @@ namespace vmsnet PUB.StatusMSG("Ready..."); this.DispCtrl1.initmsg = "Complete"; this.DispCtrl1.init = true; - this.DispCtrl1.Values = PUB.Values; + this.DispCtrl1._Values = PUB._Values; + this.DispCtrl1.Received = PUB.Received; this.DispCtrl1.Times = PUB.Times; this.DispCtrl1.SmallSize = PUB.CONFIG.viewSize; ////개별표시모드일떄 사용하는 윈도우의 크기 this.DispCtrl1.FullScreen = true; diff --git a/cVMS.NET_CS/Frm_Sub.cs b/cVMS.NET_CS/Frm_Sub.cs index e714182..d338b71 100644 --- a/cVMS.NET_CS/Frm_Sub.cs +++ b/cVMS.NET_CS/Frm_Sub.cs @@ -64,7 +64,7 @@ namespace vmsnet this.DispCtrl1.Size = new System.Drawing.Size(774, 699); this.DispCtrl1.TabIndex = 3; this.DispCtrl1.Times = null; - this.DispCtrl1.Values = null; + this.DispCtrl1._Values = null; this.DispCtrl1.OnAlamChange += DispCtrl1_OnAlamChangeL; this.DispCtrl1.OnChangedShowIndex += DispCtrl1_OnChangedShowIndex; this.DispCtrl1.OnClickCell += DispCtrl1_OnClickCell; @@ -768,7 +768,8 @@ namespace vmsnet PUB.StatusMSG("Ready..."); this.DispCtrl1.initmsg = "Complete"; this.DispCtrl1.init = true; - this.DispCtrl1.Values = PUB.Values; + this.DispCtrl1._Values = PUB._Values; + this.DispCtrl1.Received = PUB.Received; this.DispCtrl1.Times = PUB.Times; //Me.DispCtrl1.WINDOW.restarttime = CONFIG.Restart this.DispCtrl1.SmallSize = System.Convert.ToInt32(PUB.CONFIG.viewSize); diff --git a/cVMS.NET_CS/HMI/MainDisplay/CITEM.cs b/cVMS.NET_CS/HMI/MainDisplay/CITEM.cs index 9356463..dbff603 100644 --- a/cVMS.NET_CS/HMI/MainDisplay/CITEM.cs +++ b/cVMS.NET_CS/HMI/MainDisplay/CITEM.cs @@ -69,6 +69,7 @@ namespace vmsnet.HMI private String _value = ""; public int value2 = 0; //소수자리가 들어가기전의 값 + public bool received = false; public Single CurValue =0f; public Single CurValue1 = 0f; @@ -92,6 +93,7 @@ namespace vmsnet.HMI BarRect = new RectangleF(0, 0, 0, 0); _value = ""; value2 = 0; + received = false; mtime = ""; idx = 0; // detailform = null; diff --git a/cVMS.NET_CS/HMI/MainDisplay/DispCtrl.cs b/cVMS.NET_CS/HMI/MainDisplay/DispCtrl.cs index a9ad399..3ac0265 100644 --- a/cVMS.NET_CS/HMI/MainDisplay/DispCtrl.cs +++ b/cVMS.NET_CS/HMI/MainDisplay/DispCtrl.cs @@ -129,7 +129,8 @@ namespace vmsnet.HMI // } //} - private int[,,] values; + private bool[,,] received; + private int[,,] _values; private String[,,] times; private Boolean _init = false; //그리드초기화완료여부 @@ -309,10 +310,20 @@ namespace vmsnet.HMI #region *** Constructors *** - public int[,,] Values + /// + /// 데이터를 수신했는지 + /// + public bool[,,] Received { - get { return this.values; } - set { this.values = value; } + get { return this.received; } + set { this.received = value; } + } + + + public int[,,] _Values + { + get { return this._values; } + set { this._values = value; } } public String[,,] Times @@ -670,9 +681,10 @@ namespace vmsnet.HMI //값의 저장소가 아에없다면? //Boolean OverDATA = false; var alarmRemark = string.Empty; - if (this.Values == null) + if (this._Values == null) { Item.value2 = 0; + Item.received = false; Item.CurValue = 0f; Item.CurValue1 = 0f; TimeStr = "Null Error"; @@ -685,6 +697,7 @@ namespace vmsnet.HMI if (!Item.사용) //사용여부자체를 설정한다. { Item.value2 = 0; + Item.received = false; Item.alamv = -999; Item.CurValue = 0f; //미설정상태라면 값을 표시하지 않는다. Item.CurValue1 = 0f; @@ -698,18 +711,20 @@ namespace vmsnet.HMI //Br = new SolidBrush(Color.Black); Offset = Item.Offset; //수동으로입력된 옾셋 - var u1 = this.Values.GetUpperBound(0); - var u2 = this.Values.GetUpperBound(1); - var u3 = this.Values.GetUpperBound(2); + var u1 = this._Values.GetUpperBound(0); + var u2 = this._Values.GetUpperBound(1); + var u3 = this._Values.GetUpperBound(2); if (Item.idx_dev >= 0 && Item.idx_unit >= 0 && Item.idx_ch >= 0 && Item.idx_dev <= u1 && Item.idx_unit <= u2 && Item.idx_ch <= u3) { - Item.value2 = this.Values[Item.idx_dev, Item.idx_unit, Item.idx_ch]; //측정값 + Item.value2 = this._Values[Item.idx_dev, Item.idx_unit, Item.idx_ch]; //측정값 TimeStr = this.Times[Item.idx_dev, Item.idx_unit, Item.idx_ch]; //측정시간 + Item.received = this.Received[Item.idx_dev, Item.idx_unit, Item.idx_ch]; //수신여부 } else { Item.value2 = 0; + Item.received = false; TimeStr = ""; } @@ -791,7 +806,12 @@ namespace vmsnet.HMI if (Item.alamv == -999 || Item.alamv == 0) Item.alamv = Item.CurValue; Item.적용형태 = "AUTO"; - if (Item.CurValue > Item.alamv) //큰값이 있을경우 상한선을 확인한다. + if (Item.received == false) + { + Item.onalamh = false; + Item.onalaml = false; + } + else if (Item.CurValue > Item.alamv) //큰값이 있을경우 상한선을 확인한다. { Single gap = Math.Abs(Item.CurValue - Item.alamv); if (gap >= Math.Abs(Item.aalamh)) @@ -818,7 +838,12 @@ namespace vmsnet.HMI else if (grp.AlarmType == "MANUAL") { Item.적용형태 = "MANUAL"; - if (Item.CurValue >= Item.alamh) + if (Item.received == false) + { + Item.onalamh = false; + Item.onalaml = false; + } + else if (Item.CurValue >= Item.alamh) { Item.onalamh = true; Item.onalaml = false; @@ -842,7 +867,12 @@ namespace vmsnet.HMI break; case COMM.EALAMTYPE.개별알람: Item.적용형태 = "MANUAL"; - if (Item.CurValue >= Item.alamh) + if (Item.received == false) + { + Item.onalamh = false; + Item.onalaml = false; + } + else if (Item.CurValue >= Item.alamh) { Item.onalamh = true; Item.onalaml = false; @@ -864,7 +894,12 @@ namespace vmsnet.HMI /* 작성자: 이재웅, 작성일: 2025-06-17, 작성내용: 'Item.alamv == 0' OR조건 추가 */ if (Item.alamv == -999 || Item.alamv == 0) Item.alamv = Item.CurValue; - if (Item.CurValue > Item.alamv) //큰값이 있을경우 상한선을 확인한다. + if (Item.received == false) + { + Item.onalamh = false; + Item.onalaml = false; + } + else if (Item.CurValue > Item.alamv) //큰값이 있을경우 상한선을 확인한다. { Single gap = Math.Abs(Item.CurValue - Item.alamv); if (gap >= Math.Abs(Item.aalamh)) @@ -897,7 +932,7 @@ namespace vmsnet.HMI { String alamtimes = ""; - if (TimeStr != "" && TimeStr != "Not USE") + if (TimeStr != "" && TimeStr != "Not USE") alamtimes = DateTime.Parse(TimeStr).ToString("yy-MM-dd HH:mm:ss"); else alamtimes = ""; @@ -934,7 +969,7 @@ namespace vmsnet.HMI } } - if (!Item.활성화 && Item.사용) + if ((!Item.활성화 && Item.사용) || Item.received == false) { Item._onalamover = false; Item._onalamh = false; @@ -954,6 +989,10 @@ namespace vmsnet.HMI BrColor = (Color.DarkMagenta); grp._errorcount += 1; } + else if (Item.received == false) + { + ValueStr = "--"; + } else if (!Item.활성화) { ValueStr = "--"; @@ -1294,7 +1333,7 @@ namespace vmsnet.HMI //g.DrawString(this.window.disconnecttime.ToString(), this.Font, Brushes.Red, R.Left,R.Top); } - + grp._amp = 0; if (grp._ampidx != "" && grp._ampidx != null) { @@ -1306,7 +1345,7 @@ namespace vmsnet.HMI try { grp._ampdecpos = 3; - grp._amp = (float)(this.Values[di1, di2, di3 - 1] / (Math.Pow(10, grp._ampdecpos))); + grp._amp = (float)(this._Values[di1, di2, di3 - 1] / (Math.Pow(10, grp._ampdecpos))); } catch { @@ -1357,7 +1396,7 @@ namespace vmsnet.HMI grp._nbalam_l = true; //a2 on if (!grp._pre_nbalam_l) { - if (grp.AlarmType != "STOP") OnAlamChange(grp.IDX, COMM.EALAMRAISETYPE.A2_ON, COMM.EALAMTYPE.사용안함, "NB", + if (grp.AlarmType != "STOP") OnAlamChange(grp.IDX, COMM.EALAMRAISETYPE.A2_ON, COMM.EALAMTYPE.사용안함, "NB", (Single)nullvalue, (Single)grp.nbl, (Single)grp.nbl, $"> {grp.nbl}"); grp._pre_nbalam_l = true; A2 = false; @@ -1404,7 +1443,7 @@ namespace vmsnet.HMI grp._nbalam_h = true; if (!grp._pre_nbalam_h) //이전에 발생안햇다면 { - if (grp.AlarmType != "STOP") OnAlamChange(grp.IDX, COMM.EALAMRAISETYPE.A1_ON, COMM.EALAMTYPE.사용안함, "NB", + if (grp.AlarmType != "STOP") OnAlamChange(grp.IDX, COMM.EALAMRAISETYPE.A1_ON, COMM.EALAMTYPE.사용안함, "NB", (Single)nullvalue, (Single)grp.nbh, (Single)grp.nbh, $"> {grp.nbh}"); grp._pre_nbalam_h = true; blink1 = 0; @@ -1490,7 +1529,7 @@ namespace vmsnet.HMI //끝부분에 KA 를 표시한다. String Kaunit = grp._ampunit;// +grp._ampidx.ToString() + "/" + grp._ampdecpos.ToString(); - + /* 작성자: 이재웅, 작성일: 2024-12-04, 작성내용: {전류량[KA] × 100} 변경 */ String MaxKA = (grp._amp * 10f).ToString("#0.00"); @@ -1732,7 +1771,7 @@ namespace vmsnet.HMI if (grp.Showinfo) infogrp = grp; //else //{ - DrawGroup(g, grp, new Point(0, 0), new SizeF(WINDOW.ITEMWIDTH, WINDOW.ITEMHEIGHT), WindowRect, 열번호, 줄번호, false, visible); + DrawGroup(g, grp, new Point(0, 0), new SizeF(WINDOW.ITEMWIDTH, WINDOW.ITEMHEIGHT), WindowRect, 열번호, 줄번호, false, visible); //} idx += 1; @@ -2072,27 +2111,27 @@ namespace vmsnet.HMI //if (this.FullScreen) //{ /* 작성자: 이재웅, 작성일: 2024-12-04, 작성내용: '전체보기' 상태일 때만 그룹헤더의 [Null Balance] 팝업 정보가 표시되도록 변경 */ - //마우스가 현재 그룹헤더에 존재하는지확인 (헤더에 올경우 특정 정보를 표시) - if (!Mouseinfo.Hand && !Mouseinfo.Move) + //마우스가 현재 그룹헤더에 존재하는지확인 (헤더에 올경우 특정 정보를 표시) + if (!Mouseinfo.Hand && !Mouseinfo.Move) + { + int tpidx = Check_GroupHeader(e, true); + if (tpidx != -1) { - int tpidx = Check_GroupHeader(e, true); - if (tpidx != -1) - { - Mouseinfo.Hand = true; - this.GROUPS[tpidx].Showinfo = true; - //this.showHeaderInfo = true; - } + Mouseinfo.Hand = true; + this.GROUPS[tpidx].Showinfo = true; + //this.showHeaderInfo = true; + } - } - //마우스가 현재 그룹에 존재하는지? - if (!Mouseinfo.Hand && !Mouseinfo.Move) + } + //마우스가 현재 그룹에 존재하는지? + if (!Mouseinfo.Hand && !Mouseinfo.Move) + { + int tpidx = Check_Group(e); + if (tpidx != -1) { - int tpidx = Check_Group(e); - if (tpidx != -1) - { - Mouseinfo.Hand = true; - } + Mouseinfo.Hand = true; } + } //} if (Mouseinfo.Hand) this.Cursor = Cursors.Hand; diff --git a/cVMS.NET_CS/RunCode/Step/_STEP_RUN.cs b/cVMS.NET_CS/RunCode/Step/_STEP_RUN.cs index b18f52c..9f95c44 100644 --- a/cVMS.NET_CS/RunCode/Step/_STEP_RUN.cs +++ b/cVMS.NET_CS/RunCode/Step/_STEP_RUN.cs @@ -74,7 +74,7 @@ namespace vmsnet try { - PUB.KA1_SUM += (float)(PUB.Values[di1, di2, di3 - 1] / (Math.Pow(10, _ampdecpos))); + PUB.KA1_SUM += (float)(PUB._Values[di1, di2, di3 - 1] / (Math.Pow(10, _ampdecpos))); } catch { } } @@ -89,7 +89,7 @@ namespace vmsnet try { - PUB.KA2_SUM += (float)(PUB.Values[di1, di2, di3 - 1] / (Math.Pow(10, _ampdecpos))); + PUB.KA2_SUM += (float)(PUB._Values[di1, di2, di3 - 1] / (Math.Pow(10, _ampdecpos))); } catch { } } diff --git a/cVMS.NET_CS/RunCode/_95_SPS.cs b/cVMS.NET_CS/RunCode/_95_SPS.cs index 2976c91..1ea0643 100644 --- a/cVMS.NET_CS/RunCode/_95_SPS.cs +++ b/cVMS.NET_CS/RunCode/_95_SPS.cs @@ -15,7 +15,7 @@ namespace vmsnet } //셀정보자동저장 - if (PUB.CONFIG.savetermcellinfo > 0) + if (PUB.sm != null && PUB.sm.Step == ESMStep.RUN && PUB.CONFIG.savetermcellinfo > 0) { var ts_saveCellinfo = DateTime.Now - PUB.LastWindowCellinfoSaved; if (ts_saveCellinfo.TotalMinutes > PUB.CONFIG.savetermcellinfo) diff --git a/cVMS.NET_CS/pub.cs b/cVMS.NET_CS/pub.cs index 92f2e56..40e3a13 100644 --- a/cVMS.NET_CS/pub.cs +++ b/cVMS.NET_CS/pub.cs @@ -48,10 +48,14 @@ namespace vmsnet public static DigitalIndicator indicator; public static int sleepoffset = 0; ////쓰레드슬립시간 + /// + /// 데이터를 수신받았는지 체크 + /// + public static bool[,,] Received; /// /// 측정값(전압)이 들어있다(mcidx/unitno/chidx) /// - public static int[,,] Values; + public static int[,,] _Values; /// /// 측정값(시간)이 들어있다(mcidx/unitno/chidx) /// yyyy-MM-dd HH:mm:ss @@ -221,16 +225,17 @@ namespace vmsnet /// public static bool AddMeasureValue(int mcidx, int unit, int ch, int value, string time) { - var l0 = PUB.Values.GetUpperBound(0) + 1; //mc array size - var l1 = PUB.Values.GetUpperBound(1) + 1; //unit array size - var l2 = PUB.Values.GetUpperBound(2) + 1; //ch array size + var l0 = PUB._Values.GetUpperBound(0) + 1; //mc array size + var l1 = PUB._Values.GetUpperBound(1) + 1; //unit array size + var l2 = PUB._Values.GetUpperBound(2) + 1; //ch array size if (mcidx < l0 && unit < l1 && ch > 0 && ch <= l2) { try { - PUB.Values[mcidx, unit, ch - 1] = value; + PUB._Values[mcidx, unit, ch - 1] = value; PUB.Times[mcidx, unit, ch - 1] = time; + PUB.Received[mcidx, unit, ch - 1] = true; return true; } catch (Exception)