diff --git a/ProductionSystem/Forms/HomeForm.cs b/ProductionSystem/Forms/HomeForm.cs index 396b4ef..aafee21 100644 --- a/ProductionSystem/Forms/HomeForm.cs +++ b/ProductionSystem/Forms/HomeForm.cs @@ -1579,20 +1579,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"); @@ -1600,6 +1603,7 @@ namespace ProductionSystem.Forms SetMiddleData("BZ5_DB"); SetMiddleData("BZ6_DB"); SetMiddleData("BZ7_DB"); + SetMiddleData("BZ8_DB"); Thread.Sleep(Program.ReadPlcRate); } @@ -1616,14 +1620,14 @@ namespace ProductionSystem.Forms if (entity != null) { string productBarCode = ""; - if (txtProductCode.Text == "暂无条码") - { - productBarCode = "8888"; - } - else + //2024 暂无条码不插入数据 + if (txtProductCode.Text.Contains("暂无条码")) { - productBarCode=txtProductCode.Text; + return; } + //处理换行符 + productBarCode=txtProductCode.Text; + productBarCode= productBarCode.Replace("\r", "").Replace("\n", ""); var value = OmronHelper.GetPlcVal(entity.DataType, entity.Address); if (value.Item2.ToDouble().ToInt()==1) @@ -1905,7 +1909,7 @@ namespace ProductionSystem.Forms { "BZ5", "D1308" }, { "BZ6", "D1310" }, //外露 - { "BZ7", "D1316" }, + { "BZ7", "D1306" }, { "BZ8", "D1314" }, }; @@ -1980,8 +1984,80 @@ namespace ProductionSystem.Forms val = testVal.val; } + int head = 0; if (testResultPoint != null) { + + + if (paraCategory == "BZ1") + { + //电压采集值 + if (testResultPoint.Address == "D1200") + { + head = GetPlcValue("D1100").ToDouble().ToInt(); + } + //电流采集值 + if (testResultPoint.Address == "D1202") + { + head = GetPlcValue("D1102").ToDouble().ToInt(); + } + } + else if(paraCategory == "BZ2") + { + //电压采集值 + if (testResultPoint.Address == "D1204") + { + head = GetPlcValue("D1104").ToDouble().ToInt(); + } + //电流采集值 + if (testResultPoint.Address == "D1206") + { + head = GetPlcValue("D1106").ToDouble().ToInt(); + } + } + else if (paraCategory == "BZ3") + { + //电压采集值 + if (testResultPoint.Address == "D1208") + { + head = GetPlcValue("D1108").ToDouble().ToInt(); + } + //电流采集值 + if (testResultPoint.Address == "D1210") + { + head = GetPlcValue("D1110").ToDouble().ToInt(); + } + } + else if (paraCategory == "BZ4") + { + if (testResultPoint.Address == "D1224") + { + head = GetPlcValue("D1226").ToDouble().ToInt(); + } + } + else if (paraCategory == "BZ5") + { + if (testResultPoint.Address == "D1214") + { + head = GetPlcValue("D1114").ToDouble().ToInt(); + } + } + else if (paraCategory == "BZ6") + { + if (testResultPoint.Address == "D1216") + { + head = GetPlcValue("D1116").ToDouble().ToInt(); + } + } + else if (paraCategory == "BZ7") + { + if (testResultPoint.Address == "D1212") + { + head = GetPlcValue("D1112").ToDouble().ToInt(); + } + } + + var testResult = OmronHelper.GetPlcVal(testResultPoint.DataType, testResultPoint.Address); testResultPoint.Val = testResult.val; result = testResult.val; @@ -1998,6 +2074,8 @@ namespace ProductionSystem.Forms middleMyTestResultControls[j].TestResultText = "Ok"; middleMyTestResultControls[j].TestResultBackColor = Color.Green; + + SetColor(middleMyTestResultControls[j], head); })); } } @@ -2023,6 +2101,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; + } + ///