using HybirdFrameworkCore.Autofac.Attribute; using log4net; namespace Service.Mgr; [Scope("SingleInstance")] public class PlcTaskMgr { private static readonly ILog Log = LogManager.GetLogger(typeof(PlcTaskMgr)); public bool QueryPlcTask(int taskNo, int ingStatus, int exceptionStatus) { /*Log.Info($"PlcTaskMgr.QueryPlcTask taskNo={taskNo} execute start -------------------"); bool isSuccess = false; InvokeStatus invokeStatus = Invoker.Invoke("QueryPlcTask", 1000, 5, () => isSuccess, () => { var readPlcTaskStatus = PlcMgr.ReadPlcTaskStatus(); Log.Info($"PlcTaskMgr.QueryPlcTask taskNo={taskNo} execute resp readPlcTaskStatus={readPlcTaskStatus}"); if (ingStatus == readPlcTaskStatus) { } else if (exceptionStatus == readPlcTaskStatus) { Log.Info( $"PlcTaskMgr.QueryPlcTask taskNo={taskNo} execute fail readPlcTaskStatus={readPlcTaskStatus}"); throw new Exception("PlcTaskMgr.QueryPlcTask readPlcTaskStatus=" + readPlcTaskStatus); } else if (9000 == readPlcTaskStatus || 1001== readPlcTaskStatus ) { Log.Info($"PlcTaskMgr.QueryPlcTask taskNo={taskNo} execute success readPlcTaskStatus={readPlcTaskStatus}"); isSuccess = true; } }, () => { Log.Info($"PlcTaskMgr.QueryPlcTask taskNo={taskNo} execute ing"); if (taskNo == 2) { SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.InfoBatteryMove); }else if (taskNo == 5) { SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.InfoFireRemove); } }, true, () => { } , 5, InvokeStatus.Exception); if (InvokeStatus.Exception == invokeStatus) { return false; } Log.Info($"PlcTaskMgr.QueryPlcTask taskNo={taskNo} execute end success-------------------"); return true;*/ return false; } }