From 70803709f572e7a9fa2301abfe31dfafe796bfb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=88=91=E5=8F=AB=E9=94=84=E5=A4=B4?= Date: Thu, 11 Apr 2024 16:58:08 +0800 Subject: [PATCH] fix --- ProductionSystem/Forms/HomeForm.cs | 81 ++++++++++++++++++++++-------- 1 file changed, 59 insertions(+), 22 deletions(-) diff --git a/ProductionSystem/Forms/HomeForm.cs b/ProductionSystem/Forms/HomeForm.cs index cc65488..b581bac 100644 --- a/ProductionSystem/Forms/HomeForm.cs +++ b/ProductionSystem/Forms/HomeForm.cs @@ -1578,20 +1578,23 @@ namespace ProductionSystem.Forms GetPlc(Program.BZ8, "BZ8"); - count++; - if (count == 5) - { - Collect("BZ1"); - Collect("BZ2"); - Collect("BZ3"); - Collect("BZ4"); - Collect("BZ5"); - Collect("BZ6"); - Collect("BZ7"); - Collect("BZ8"); - count = 0; - - } + // count++; + // if (count == 1) + // { + // + // count = 0; + // + // } + + Collect("BZ1"); + Collect("BZ2"); + Collect("BZ3"); + Collect("BZ4"); + Collect("BZ5"); + Collect("BZ6"); + Collect("BZ7"); + Collect("BZ8"); + SetMiddleData("BZ1_DB"); SetMiddleData("BZ2_DB"); SetMiddleData("BZ3_DB"); @@ -1616,16 +1619,14 @@ namespace ProductionSystem.Forms if (entity != null) { string productBarCode = ""; - if (txtProductCode.Text == "暂无条码") + //2024 暂无条码不插入数据 + if (txtProductCode.Text.Contains("暂无条码")) { - productBarCode = "8888"; - } - else - { - //处理换行符 - productBarCode=txtProductCode.Text; - productBarCode= productBarCode.Replace("\r", "").Replace("\n", ""); + return; } + //处理换行符 + productBarCode=txtProductCode.Text; + productBarCode= productBarCode.Replace("\r", "").Replace("\n", ""); var value = OmronHelper.GetPlcVal(entity.DataType, entity.Address); if (value.Item2.ToDouble().ToInt()==1) @@ -1982,8 +1983,21 @@ namespace ProductionSystem.Forms val = testVal.val; } + int head = 0; if (testResultPoint != null) { + + + if (paraCategory == "BZ1") + { + //电压采集值 + if (testResultPoint.Address == "D1200") + { + head = GetPlcValue("D1100").ToDouble().ToInt(); + } + } + + var testResult = OmronHelper.GetPlcVal(testResultPoint.DataType, testResultPoint.Address); testResultPoint.Val = testResult.val; result = testResult.val; @@ -2000,6 +2014,8 @@ namespace ProductionSystem.Forms middleMyTestResultControls[j].TestResultText = "Ok"; middleMyTestResultControls[j].TestResultBackColor = Color.Green; + + SetColor(middleMyTestResultControls[j], head); })); } } @@ -2025,6 +2041,27 @@ namespace ProductionSystem.Forms + private void SetColor(MyTestResultControl control, int status) + { + switch (status) + { + case 0: + control.TestResultBackColor = Color.LightGray; + control.TestResultText = "空闲"; + break; + case 1: + control.TestResultBackColor = Color.Green; + control.TestResultText = "OK"; + break; + + case 2: + control.TestResultBackColor = Color.Red; + control.TestResultText = "NG"; + break; + } + control.TestResultBackColor = Color.Red; + } + ///