From 7625275c51db8fda245da26f50f8238acfbdc3f2 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 19 Jul 2021 17:24:24 +0200 Subject: [PATCH] UPdate ewon adapter --- IOB-WIN-NEXT/AdapterForm.Designer.cs | 15 ++++++++++++++- IOB-WIN-NEXT/AdapterForm.cs | 5 +++++ IOB-WIN-NEXT/IobGeneric.cs | 9 +++++++++ IOB-WIN-NEXT/IobOpcUaEwon.cs | 2 ++ IOB-WIN-NEXT/UAClient.cs | 9 ++++++--- 5 files changed, 36 insertions(+), 4 deletions(-) diff --git a/IOB-WIN-NEXT/AdapterForm.Designer.cs b/IOB-WIN-NEXT/AdapterForm.Designer.cs index f7439f39..6f48781e 100644 --- a/IOB-WIN-NEXT/AdapterForm.Designer.cs +++ b/IOB-WIN-NEXT/AdapterForm.Designer.cs @@ -102,6 +102,7 @@ this.label10 = new System.Windows.Forms.Label(); this.lblDataProc = new System.Windows.Forms.Label(); this.lblQueueLen = new System.Windows.Forms.Label(); + this.btnForceAutoOdl = new System.Windows.Forms.Button(); this.statusStrip1.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout(); this.tabData.SuspendLayout(); @@ -787,6 +788,7 @@ // tabMes // this.tabMes.BackColor = System.Drawing.Color.Transparent; + this.tabMes.Controls.Add(this.btnForceAutoOdl); this.tabMes.Controls.Add(this.panel1); this.tabMes.Location = new System.Drawing.Point(4, 22); this.tabMes.Name = "tabMes"; @@ -962,6 +964,16 @@ this.lblQueueLen.TabIndex = 83; this.lblQueueLen.Text = "###"; // + // btnForceAutoOdl + // + this.btnForceAutoOdl.Location = new System.Drawing.Point(352, 6); + this.btnForceAutoOdl.Name = "btnForceAutoOdl"; + this.btnForceAutoOdl.Size = new System.Drawing.Size(173, 23); + this.btnForceAutoOdl.TabIndex = 89; + this.btnForceAutoOdl.Text = "Force AutoODL"; + this.btnForceAutoOdl.UseVisualStyleBackColor = true; + this.btnForceAutoOdl.Click += new System.EventHandler(this.btnForceAutoOdl_Click); + // // AdapterForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -1080,5 +1092,6 @@ private System.Windows.Forms.Label lblQueueMessLen; private System.Windows.Forms.Label lblPzCountIob; private System.Windows.Forms.Label lblPzCountMac; - } + private System.Windows.Forms.Button btnForceAutoOdl; + } } \ No newline at end of file diff --git a/IOB-WIN-NEXT/AdapterForm.cs b/IOB-WIN-NEXT/AdapterForm.cs index 9e831372..897c210e 100644 --- a/IOB-WIN-NEXT/AdapterForm.cs +++ b/IOB-WIN-NEXT/AdapterForm.cs @@ -733,6 +733,11 @@ namespace IOB_WIN_NEXT #region Private Methods + private void btnForceAutoOdl_Click(object sender, EventArgs e) + { + iobObj.forceResetOdl(); + } + private void BtnOpenLog_Click(object sender, EventArgs e) { try diff --git a/IOB-WIN-NEXT/IobGeneric.cs b/IOB-WIN-NEXT/IobGeneric.cs index 7a1f7b0d..98eb5b3e 100644 --- a/IOB-WIN-NEXT/IobGeneric.cs +++ b/IOB-WIN-NEXT/IobGeneric.cs @@ -3176,6 +3176,15 @@ namespace IOB_WIN_NEXT return answ; } + /// + /// forza reset ODL + /// + public void forceResetOdl() + { + lgInfo("Registrato richiesta forzatura reset ODL"); + pzCountResetted = true; + } + /// /// Effettua chiamata x split ODL /// diff --git a/IOB-WIN-NEXT/IobOpcUaEwon.cs b/IOB-WIN-NEXT/IobOpcUaEwon.cs index a1880879..ee291d4a 100644 --- a/IOB-WIN-NEXT/IobOpcUaEwon.cs +++ b/IOB-WIN-NEXT/IobOpcUaEwon.cs @@ -145,6 +145,7 @@ namespace IOB_WIN_NEXT /// protected override void plcWriteParams(List updatedPar) { +#if false if (!testDone) { try @@ -160,6 +161,7 @@ namespace IOB_WIN_NEXT lgError($"Eccezione in WriteTestNodes{Environment.NewLine}{exc}"); } } +#endif dataConf currMem = null; int byteSize = 0; diff --git a/IOB-WIN-NEXT/UAClient.cs b/IOB-WIN-NEXT/UAClient.cs index c77de71c..5ea7e49f 100644 --- a/IOB-WIN-NEXT/UAClient.cs +++ b/IOB-WIN-NEXT/UAClient.cs @@ -776,6 +776,9 @@ namespace IOB_WIN_NEXT try { + // scrivo vaslori a caso.. hhmm odierni + int hhmm = 9876; + int.TryParse(DateTime.Now.ToString("HHmm"), out hhmm); // Write the configured nodes WriteValueCollection nodesToWrite = new WriteValueCollection(); @@ -784,21 +787,21 @@ namespace IOB_WIN_NEXT commWriteVal.NodeId = new NodeId("ns=4;s=IO_151"); commWriteVal.AttributeId = Attributes.Value; commWriteVal.Value = new DataValue(); - commWriteVal.Value.Value = (int)111; + commWriteVal.Value.Value = (int)hhmm - 10; nodesToWrite.Add(commWriteVal); WriteValue artWriteVal = new WriteValue(); artWriteVal.NodeId = new NodeId("ns=4;s=IO_151"); artWriteVal.AttributeId = Attributes.Value; artWriteVal.Value = new DataValue(); - artWriteVal.Value.Value = (int)222; + artWriteVal.Value.Value = (int)hhmm; nodesToWrite.Add(artWriteVal); WriteValue qtyWriteVal = new WriteValue(); qtyWriteVal.NodeId = new NodeId("ns=4;s=IO_153"); qtyWriteVal.AttributeId = Attributes.Value; qtyWriteVal.Value = new DataValue(); - qtyWriteVal.Value.Value = (int)333; + qtyWriteVal.Value.Value = (int)hhmm + 10; nodesToWrite.Add(qtyWriteVal); #if false