From 8676e8eda572df9bae9b4d8ae74cbdd7f0d6c021 Mon Sep 17 00:00:00 2001 From: wangsr Date: Wed, 11 Oct 2023 08:35:26 +0800 Subject: [PATCH] 3000 --- .../ManualControl/InitAction.cs | 42 ++++++++++++++++--- 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/InitAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/InitAction.cs index 5292e07..04395ee 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/InitAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/InitAction.cs @@ -41,6 +41,8 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl int flag = 0; + int no = 0; + IBaseControl WaterActualValue1; IBaseControl WaterActualValue2; IBaseControl WaterActualValue3; @@ -148,8 +150,29 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl private void Timer1_Tick() { - Time(1, 1); + bool mixok1 = PlcConnect.Instance.ReadBool("DB3000.0.0").Content; + Time(1, mixok1?1:0); + bool mixok2 = PlcConnect.Instance.ReadBool("DB3000.0.1").Content; + Time(2, mixok2 ? 1 : 0); + + bool mixok3 = PlcConnect.Instance.ReadBool("DB3000.0.2").Content; + Time(3, mixok3 ? 1 : 0); + + + bool mixok4 = PlcConnect.Instance.ReadBool("DB3000.0.3").Content; + Time(4, mixok4 ? 1 : 0); + + bool mixok5 = PlcConnect.Instance.ReadBool("DB3000.0.4").Content; + Time(5, mixok5 ? 1 : 0); + + bool mixok6 = PlcConnect.Instance.ReadBool("DB3000.0.5").Content; + Time(6, mixok6 ? 1 : 0); + bool mixok7 = PlcConnect.Instance.ReadBool("DB3000.0.6").Content; + Time(7, mixok7 ? 1 : 0); + + bool mixok8 = PlcConnect.Instance.ReadBool("DB3000.0.7").Content; + Time(8, mixok8 ? 1 : 0); } @@ -163,11 +186,10 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl state = statu.ToString(), }; HttpResponse httpResponse = new HttpResponse(); - ManualLogControl("湿混机1下发请求"); - MesnacServiceManager.Instance.LoggingService.Info("湿混机1下发请求"); + // MesnacServiceManager.Instance.LoggingService.Info($"湿混机{deviceNo}下发请求"); string returnTest = httpResponse.PostResponse(tankIsDischargedSyncEntity); - ManualLogControl("湿混机1返回数据 " + returnTest); - MesnacServiceManager.Instance.LoggingService.Info("湿混机1返回数据" + returnTest); + // ManualLogControl($"湿混机{deviceNo}返回数据 " + returnTest); + MesnacServiceManager.Instance.LoggingService.Info($"湿混机{deviceNo}返回数据" + returnTest); } @@ -175,7 +197,7 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl private void ReadFromPlc(object sender, EventArgs e) { - Timer1_Tick(); + flag += 1; if (flag > 10) @@ -184,6 +206,14 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl LogInsertToDatabase(); } + no += 1; + + if(no > 5) + { + no = 0; + Timer1_Tick(); + } + if (GetAllDbMCControlsByOption(DbOptionTypes.InitData).Count == 0) { timer.Stop();