From 2090b4da55c677dd18e3d3de03d13d24ff1ee891 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=88=91=E5=8F=AB=E9=94=84=E5=A4=B4?= Date: Wed, 13 Dec 2023 14:09:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89run=20=E9=93=BE=E6=8E=A5plc?= =?UTF-8?q?=20=E5=87=BA=E9=94=99=E6=8F=90=E7=A4=BA=20=20=E7=BB=99mes=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=94=A8=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ManualControl/InitAction.cs | 46 +++++++++---------- Main/MCRun/Program.cs | 15 +----- 2 files changed, 22 insertions(+), 39 deletions(-) diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/InitAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/InitAction.cs index 10c4cfc..0e642ff 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/InitAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/InitAction.cs @@ -421,14 +421,7 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl private void Time(int deviceNo, int statu) { - //OpenDoorService.Insert(new OpenDoorEntity() - //{ - // DeviceId = deviceNo, - // OpenTime = DateTime.Now, - // CreateTime = DateTime.Now, - // Status = statu - //}); - + if (WetStatus.ContainsKey(deviceNo) == false) { WetStatus.Add(deviceNo, statu); @@ -444,23 +437,26 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl private void DonwloadWetState(int deviceNo, int statu) { - TankIsDischargedSyncEntity tankIsDischargedSyncEntity = new TankIsDischargedSyncEntity() - { - reqCode = System.Guid.NewGuid().ToString(), - reqTime = DateTime.Now, - deviceNo = deviceNo.ToString(), - state = statu.ToString(), - }; - - //即使网络不同 也不会影响上位机的使用 - ThreadPool.QueueUserWorkItem(delegate - { - HttpResponse httpResponse = new HttpResponse(); - // MesnacServiceManager.Instance.LoggingService.Info($"湿混机{deviceNo}下发请求"); - string returnTest = httpResponse.PostResponse(tankIsDischargedSyncEntity); - // LjManualLog.ManualLogControl($"湿混机{deviceNo}返回数据 " + returnTest); - MesnacServiceManager.Instance.LoggingService.Info($"湿混机{deviceNo}返回数据" + returnTest); - }); + string userName= string.IsNullOrWhiteSpace(UserInfo.Instance.UserName) ? "Edit" : UserInfo.Instance.UserName; + if (userName.Length > 0 && userName != "Edit") + { + //即使网络不同 也不会影响上位机的使用 + ThreadPool.QueueUserWorkItem(delegate + { + TankIsDischargedSyncEntity tankIsDischargedSyncEntity = new TankIsDischargedSyncEntity() + { + reqCode = System.Guid.NewGuid().ToString(), + reqTime = DateTime.Now, + deviceNo = deviceNo.ToString(), + state = statu.ToString(), + }; + HttpResponse httpResponse = new HttpResponse(); + MesnacServiceManager.Instance.LoggingService.Info($"湿混机{deviceNo}下发请求:{statu}"); + string returnTest = httpResponse.PostResponse(tankIsDischargedSyncEntity); + // LjManualLog.ManualLogControl($"湿混机{deviceNo}返回数据 " + returnTest); + MesnacServiceManager.Instance.LoggingService.Info($"湿混机{deviceNo}返回数据" + returnTest); + }); + } } #endregion diff --git a/Main/MCRun/Program.cs b/Main/MCRun/Program.cs index 57a49b5..a923766 100644 --- a/Main/MCRun/Program.cs +++ b/Main/MCRun/Program.cs @@ -105,20 +105,7 @@ namespace MCRun { AppConfigHandler.Instance.InitCustomerMenuAndToolStrip(WorkbenchSingleton.Workbench.TopMenu, WorkbenchSingleton.Workbench.ToolStrip); //初始化自定义系统菜单和工具栏 - try - { - var instance = Mesnac.Equips.Factory.Instance.ConfigFile; - XmlDocument doc = new XmlDocument(); - doc.Load(instance); - var nodes = doc.ChildNodes[1].ChildNodes[0].ChildNodes[0].ChildNodes[4].ChildNodes[0]; - var ip = nodes.Attributes["value"].Value; - //初始化HslCommunication 11.0.6.0 - // PlcBusiness.Instance.InitPlcConnect(PlcType.SiemensPlc,ip, 102); - } - catch (Exception exception) - { - ICSharpCode.Core.LoggingService.Debug("HSLPlc读取失败"); - } + //初始化连接报警器 // DoControl.Instance.ComOn();