Browse Source

1. Revise JobInfo remain bug in JobOperationView;
2. Optimize DiReplen codes;

niuyx 5 days ago
parent
commit
2fd073d295

+ 5 - 2
CyberX8_MainPages/Unity/WaferStatusHandler.cs

@@ -1,4 +1,5 @@
-using OpenSEMI.ClientBase;
+using MECF.Framework.Common.DataCenter;
+using OpenSEMI.ClientBase;
 using OpenSEMI.Core.Msg;
 using System;
 using System.Collections.Generic;
@@ -70,6 +71,8 @@ namespace CyberX8_MainPages.Unity
                         if (mWafers != null && mWafers.Count == pair.Value.Wafers.Count)
                         {
                             int index;
+                            bool isCassettePresent = true;
+                            if (pair.Key.Contains("LP")) isCassettePresent = (bool)QueryDataClient.Instance.Service.GetData($"{pair.Key}.CassettePlaced");
                             for (int i = 0; i < mWafers.Count; i++)
                             {
                                 //status used in UI control
@@ -81,7 +84,7 @@ namespace CyberX8_MainPages.Unity
                                 pair.Value.Wafers[i].WaferStatus = mWafers[index].WaferStatus;
                                 pair.Value.Wafers[i].WaferID = mWafers[index].WaferID;
                                 pair.Value.Wafers[i].SourceName = mWafers[index].SourceName;
-                                if (!string.IsNullOrEmpty(mWafers[index].SequenceName))
+                                if (!string.IsNullOrEmpty(mWafers[index].SequenceName) || !isCassettePresent)
                                 {
                                     pair.Value.Wafers[i].SequenceName = mWafers[index].SequenceName;
                                 }

+ 12 - 2
CyberX8_MainPages/Unity/WaferStatusImp.cs

@@ -23,17 +23,20 @@ namespace CyberX8_MainPages.Unity
             List<WaferInfo> result = new List<WaferInfo>();
             string param = moduleID + ".ModuleWaferList";
             ACC.WaferInfo[] wafers = QueryDataClient.Instance.Service.GetData(param) as ACC.WaferInfo[];
+
+            bool isCassettePresent = true;
+            if (moduleID.Contains("LP")) isCassettePresent = (bool)QueryDataClient.Instance.Service.GetData($"{moduleID}.CassettePlaced");
             if (wafers != null)
             {
                 for (int i = 0; i < wafers.Length; i++)
                 {
-                    result.Add(WaferInfoConverter(wafers[i], moduleID, i));
+                    result.Add(WaferInfoConverter(wafers[i], moduleID, i, isCassettePresent));
                 }
             }
             return result;
         }
 
-        private WaferInfo WaferInfoConverter(ACC.WaferInfo awafer, string modid, int slotid)
+        private WaferInfo WaferInfoConverter(ACC.WaferInfo awafer, string modid, int slotid, bool isCassettePresent)
         {
             WaferInfo wafer = new WaferInfo();
             wafer.ModuleID = modid;
@@ -46,6 +49,13 @@ namespace CyberX8_MainPages.Unity
             {
                 wafer.SequenceName = awafer.SequenceName;
             }
+            else
+            {
+                if (!isCassettePresent)
+                {
+                    wafer.SequenceName = "";
+                }
+            }
             return wafer;
         }
 

+ 3 - 0
CyberX8_MainPages/ViewModels/JobOperationViewModel.cs

@@ -500,6 +500,9 @@ namespace CyberX8_MainPages.ViewModels
             {
                 SequenceSelectedItemsSource3.Add(seqitem);
             }
+            LP1WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP1"];
+            LP2WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP2"];
+            LP3WaferAssociation.ModuleData = ModuleManager.ModuleInfos["LP3"];
         }
         /// <summary>
         /// 隐藏

+ 4 - 3
CyberX8_MainPages/ViewModels/ReservoirsAnolyteViewModel.cs

@@ -663,7 +663,8 @@ namespace CyberX8_MainPages.ViewModels
             _rtDataKeys.Add($"{Module}.IsCalibrateEnable");
             _rtDataKeys.Add($"{Module}.ReservoirAverageANLevel");
             _rtDataKeys.Add($"{Module}.CroseDoseType");
-            _rtDataKeys.Add($"{Module}.DIReplenMaxTimeOut");
+            _rtDataKeys.Add($"{Module}.IsDIReplenPerfillTimeOut");
+            _rtDataKeys.Add($"{Module}.IsDIReplenMaxTimeOut");
 
             if (_timer == null)
             {
@@ -697,8 +698,8 @@ namespace CyberX8_MainPages.ViewModels
                     IsCalibrateEnable = CommonFunction.GetValue<bool>(_rtDataValueDic, $"{Module}.IsCalibrateEnable");
                     State = CommonFunction.GetValue<string>(_rtDataValueDic, $"{Module}.FsmState");
 
-                    IsDIReplenFault = CommonFunction.GetValue<bool>(_rtDataValueDic, $"{Module}.IsDIReplenInFault")
-                        || CommonFunction.GetValue<bool>(_rtDataValueDic, $"{Module}.DIReplenMaxTimeOut");
+                    IsDIReplenFault = CommonFunction.GetValue<bool>(_rtDataValueDic, $"{Module}.IsDIReplenPerfillTimeOut")
+                        || CommonFunction.GetValue<bool>(_rtDataValueDic, $"{Module}.IsDIReplenMaxTimeOut");
 
                     if ("Idle".Equals(State)) 
                     {

+ 5 - 3
CyberX8_MainPages/ViewModels/ReservoirsCatholyteViewModel.cs

@@ -515,13 +515,14 @@ namespace CyberX8_MainPages.ViewModels
             _rtDataKeys.Add($"{Module}.CAPumpSpeed");
             _rtDataKeys.Add($"{Module}.IsCAHighLevel");
             _rtDataKeys.Add($"{Module}.IsCALowLevel");
-            _rtDataKeys.Add($"{Module}.IsDIReplenInFault");
             _rtDataKeys.Add($"{Module}.TemperatureControllerData");
             _rtDataKeys.Add($"{Module}.CurrentRecipe");
             _rtDataKeys.Add($"{Module}.FsmState");
             _rtDataKeys.Add($"{Module}.EvaporatorType");
             _rtDataKeys.Add($"{Module}.ReservoirAverageCALevel");
             _rtDataKeys.Add($"System.Facilities.CDAEnable");
+            _rtDataKeys.Add($"{Module}.IsDIReplenPerfillTimeOut");
+            _rtDataKeys.Add($"{Module}.IsDIReplenMaxTimeOut");
             if (_timer == null)
             {
                 _timer = new DispatcherTimer();
@@ -549,8 +550,9 @@ namespace CyberX8_MainPages.ViewModels
                     CAPumpSpeed = CommonFunction.GetValue<double>(_rtDataValueDic, $"{Module}.CAPumpSpeed");
                     IsHighLevel = CommonFunction.GetValue<bool>(_rtDataValueDic, $"{Module}.IsCAHighLevel");
                     IsLowLevel = CommonFunction.GetValue<bool>(_rtDataValueDic, $"{Module}.IsCALowLevel");
-                    IsDIReplenFault = CommonFunction.GetValue<bool>(_rtDataValueDic, $"{Module}.IsDIReplenInFault");
-                    
+                    IsDIReplenFault = CommonFunction.GetValue<bool>(_rtDataValueDic, $"{Module}.IsDIReplenPerfillTimeOut")
+                        || CommonFunction.GetValue<bool>(_rtDataValueDic, $"{Module}.IsDIReplenMaxTimeOut");
+
                     CdaOn = CommonFunction.GetValue<bool>(_rtDataValueDic, $"System.Facilities.CDAEnable");
                     TemperatureControlData = CommonFunction.GetValue<TemperatureControllerData>(_rtDataValueDic, $"{Module}.TemperatureControllerData");
                     TCEnableStatus = TemperatureControlData.ControlOperationModel == 0 ? "Disable" : "Enable";

+ 4 - 4
CyberX8_MainPages/ViewModels/StandardHotReservoirsViewModel.cs

@@ -792,8 +792,8 @@ namespace CyberX8_MainPages.ViewModels
             _rtDataKeys.Add($"{Module}.PumpSpeed");
             _rtDataKeys.Add($"{Module}.IsRegulatePump");
             _rtDataKeys.Add($"{Module}.IsCMMConfig");
-            _rtDataKeys.Add($"{Module}.IsDIReplenInFault");
-            _rtDataKeys.Add($"{Module}.DIReplenMaxTimeOut");
+            _rtDataKeys.Add($"{Module}.IsDIReplenPerfillTimeOut");
+            _rtDataKeys.Add($"{Module}.IsDIReplenMaxTimeOut");
             if (_timer == null)
             {
                 _timer = new DispatcherTimer();
@@ -1169,8 +1169,8 @@ namespace CyberX8_MainPages.ViewModels
                         //HedFlow管流
                         HEDFlowIsOn = (ReservoirData.HedFlow > 0) ? true : false;
                         //DIReplenFault
-                        IsDiReplenFault = CommonFunction.GetValue<bool>(_rtDataValueDic, $"{Module}.IsDIReplenInFault")
-                        || CommonFunction.GetValue<bool>(_rtDataValueDic, $"{Module}.DIReplenMaxTimeOut");
+                        IsDiReplenFault = CommonFunction.GetValue<bool>(_rtDataValueDic, $"{Module}.IsDIReplenPerfillTimeOut")
+                        || CommonFunction.GetValue<bool>(_rtDataValueDic, $"{Module}.IsDIReplenMaxTimeOut");
 
                         IsError = State== "Error" ? true : false;
                     }

+ 64 - 77
CyberX8_RT/Devices/Reservoir/CompactMembranReservoirDevice.cs

@@ -157,10 +157,6 @@ namespace CyberX8_RT.Devices.Reservoir
         /// </summary>
         private int _manualReplenSecond = 0;
         /// <summary>
-        /// 注水是否出错
-        /// </summary>
-        private bool _isDiReplenInFault = false;
-        /// <summary>
         /// Fast leak Test时间间隔
         /// </summary>
         private int _aNLeakOperatingUpdateTime;
@@ -269,10 +265,6 @@ namespace CyberX8_RT.Devices.Reservoir
         /// </summary>
         private HashSet<string> errorLogSet = new HashSet<string>();
         /// <summary>
-        /// 累计补水超时
-        /// </summary>
-        private bool _diReplenMaxTimeOut;
-        /// <summary>
         /// 是否有其他DIReplen的警告
         /// </summary>
         private bool _isOtherDIReplenWarnOn = false;
@@ -280,6 +272,14 @@ namespace CyberX8_RT.Devices.Reservoir
         /// Facility DIReplen Off Warning
         /// </summary>
         private bool _isTotalDIReplenWarnOn = false;
+        /// <summary>
+        /// 累计补水是否超时
+        /// </summary>
+        private bool _isDIReplenMaxTimeOut = false;
+        /// <summary>
+        /// 单次补水是否超时
+        /// </summary>
+        private bool _isDIReplenPerfillTimeOut = false;
         #endregion
 
         #region 属性
@@ -340,16 +340,13 @@ namespace CyberX8_RT.Devices.Reservoir
         /// </summary>
         public CounterFlowData ReservoirCounterByPassFlow { get { return _reservoirCounterByPassFlow; } }
         /// <summary>
-        /// 补水累计超时
+        /// 累计补水是否超时
         /// </summary>
-        public bool DiReplenMaxTimeOut
-        {
-            get { return _diReplenMaxTimeOut; }
-        }
+        public bool IsDIReplenMaxTimeOut { get { return _isDIReplenMaxTimeOut; } }
         /// <summary>
-        /// 注水是否出错
+        /// 单次补水是否超时
         /// </summary>
-        public bool IsDiReplenInFault { get { return _isDiReplenInFault; } }
+        public bool IsDIReplenPerfillTimeOut { get { return _isDIReplenPerfillTimeOut; } }
         /// <summary>
         /// Facility DIReplenOn
         /// </summary>
@@ -488,13 +485,13 @@ namespace CyberX8_RT.Devices.Reservoir
             DATA.Subscribe($"{Module}.IsCALowLevel", () => IsCALowLevel, SubscriptionAttribute.FLAG.IgnoreSaveDB);
             DATA.Subscribe($"{Module}.IsANHighLevel", () => IsANHighLevel, SubscriptionAttribute.FLAG.IgnoreSaveDB);
             DATA.Subscribe($"{Module}.IsANLowLevel", () => IsANLowLevel, SubscriptionAttribute.FLAG.IgnoreSaveDB);
-            DATA.Subscribe($"{Module}.IsDIReplenInFault", () => _isDiReplenInFault, SubscriptionAttribute.FLAG.IgnoreSaveDB);
             DATA.Subscribe($"{Module}.EvaporatorType", () => reservoirItem.EvaporatorType, SubscriptionAttribute.FLAG.IgnoreSaveDB);
             DATA.Subscribe($"{Module}.CroseDoseType", () => reservoirItem.CrossDoseType, SubscriptionAttribute.FLAG.IgnoreSaveDB);
             DATA.Subscribe($"{Module}.IsLeakDetected", () => _isLeakDetected, SubscriptionAttribute.FLAG.IgnoreSaveDB);
             DATA.Subscribe($"{Module}.IsCrossDoseInstalled", () => _isCrossDoseInstalled, SubscriptionAttribute.FLAG.IgnoreSaveDB);
             DATA.Subscribe($"{Module}.ANBypassCounterFlow", () => ReservoirCounterByPassFlow.CounterValue, SubscriptionAttribute.FLAG.IgnoreSaveDB);
-            DATA.Subscribe($"{Module}.DIReplenMaxTimeOut", () => _diReplenMaxTimeOut, SubscriptionAttribute.FLAG.IgnoreSaveDB);
+            DATA.Subscribe($"{Module}.IsDIReplenPerfillTimeOut", () => _isDIReplenPerfillTimeOut, SubscriptionAttribute.FLAG.IgnoreSaveDB);
+            DATA.Subscribe($"{Module}.IsDIReplenMaxTimeOut", () => _isDIReplenMaxTimeOut, SubscriptionAttribute.FLAG.IgnoreSaveDB);
 
             if (_isCrossDoseInstalled)
             {
@@ -567,17 +564,10 @@ namespace CyberX8_RT.Devices.Reservoir
         /// <param name="args"></param>
         private bool DIReplenClearError(string cmd, object[] args)
         {
-            _isDiReplenInFault = false;
+            _isDIReplenPerfillTimeOut = false;
             return true;
         }
         /// <summary>
-        /// DI Replen超时
-        /// </summary>
-        private void DiReplenTimeOutOpeartion(bool timeOutFlag)
-        {
-            _diReplenMaxTimeOut = timeOutFlag;
-        }
-        /// <summary>
         /// 重置时长
         /// </summary>
         /// <param name="cmd"></param>
@@ -585,7 +575,7 @@ namespace CyberX8_RT.Devices.Reservoir
         /// <returns></returns>
         private bool ResetTotalTime(string cmd, object[] objs)
         {
-            _diReplenMaxTimeOut = false;
+            _isDIReplenMaxTimeOut = false;
             _persistentValue.TotalReplen = 0;
             _persistentValue.LastTotalReplen = 0;
             ReservoirsPersistentManager.Instance.UpdatePersistentValue(Module);
@@ -729,7 +719,7 @@ namespace CyberX8_RT.Devices.Reservoir
 
                 if (_reservoirData.ANDiReplen) ANDiReplenOff("", null);
                 if (_reservoirData.CADiReplen) CADiReplenOff("", null);
-                _isDiReplenInFault = false;
+                _isDIReplenPerfillTimeOut = false;
 
                 _persistentValue.OperatingMode = currentOperation;
 
@@ -902,7 +892,7 @@ namespace CyberX8_RT.Devices.Reservoir
                 if (!_isTotalDIReplenWarnOn)
                 {
                     _isTotalDIReplenWarnOn = true;
-                    LOG.WriteLog(eEvent.WARN_RESERVOIR, Module, "Facilities DiReplen is Off");
+                    LOG.WriteLog(eEvent.WARN_RESERVOIR, Module, "Facilities DiReplen is Off, can't start auto diReplen");
                 }
                 return false;
             }
@@ -913,7 +903,7 @@ namespace CyberX8_RT.Devices.Reservoir
             SafetyDevice safetyDevice = DEVICE.GetDevice<SafetyDevice>("Safety");
             if (safetyDevice != null && safetyDevice.SafetyData.ReservoirHighLevel)
             {
-                LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, $"Safety high is Activate");
+                LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, $"Safety high is Activate, can't start auto diReplen");
                 return false;
             }
             if (CheckOtherReservoirDiReplenStatus())
@@ -955,7 +945,7 @@ namespace CyberX8_RT.Devices.Reservoir
                             if (!_isOtherDIReplenWarnOn)
                             {
                                 _isOtherDIReplenWarnOn = true;
-                                LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, $"{item} DIReplen is on");
+                                LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, $"{item} DiReplen valve is on. {Module} is waiting DiReplen");
                             }
                             return true;
                         }
@@ -968,7 +958,7 @@ namespace CyberX8_RT.Devices.Reservoir
                             if (!_isOtherDIReplenWarnOn)
                             {
                                 _isOtherDIReplenWarnOn = true;
-                                LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, $"{item} AN_DIReplen is on");
+                                LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, $"{item} AN DiReplen valve is on. {Module} is waiting DiReplen");
                             }
                             return true;
                         }
@@ -977,7 +967,7 @@ namespace CyberX8_RT.Devices.Reservoir
                             if (!_isOtherDIReplenWarnOn)
                             {
                                 _isOtherDIReplenWarnOn = true;
-                                LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, $"{item} CA_DIReplen is on");
+                                LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, $"{item} CA DiReplen valve is on. {Module} is waiting DiReplen");
                             }
                             return true;
                         }
@@ -1559,16 +1549,16 @@ namespace CyberX8_RT.Devices.Reservoir
                 LOG.WriteLog(eEvent.WARN_RESERVOIR, Module, $"{Module} is not initialized. Can't start DiReplen");
                 return false;
             }
-            if (DiReplenMaxTimeOut)
+            if (IsDIReplenMaxTimeOut)
             {
                 double diValveMaxOnTime = SC.GetValue<double>($"Reservoir.{Module}.DIValveMaxOnTime");
-                LOG.WriteLog(eEvent.WARN_RESERVOIR, Module, $"Direplen time over conifg's DIValveMaxOnTime:{diValveMaxOnTime} min");
+                LOG.WriteLog(eEvent.WARN_RESERVOIR, Module, $"DiReplen time over conifg's DIValveMaxOnTime:{diValveMaxOnTime} min");
                 return false;
             }
-            if (IsDiReplenInFault)
+            if (IsDIReplenPerfillTimeOut)
             {
                 double diValveMaxOnTimePerFill = SC.GetValue<double>($"Reservoir.{Module}.DIValveMaxOnTimePerFill");
-                LOG.WriteLog(eEvent.WARN_RESERVOIR, Module, $"Direplen time over conifg's DIValveMaxOnTimePerFill:{diValveMaxOnTimePerFill} min");
+                LOG.WriteLog(eEvent.WARN_RESERVOIR, Module, $"DiReplen time over conifg's DIValveMaxOnTimePerFill:{diValveMaxOnTimePerFill} min");
                 return false;
             }
             bool result = direplenOn("", null);
@@ -2417,40 +2407,7 @@ namespace CyberX8_RT.Devices.Reservoir
         /// <returns></returns>
         private bool OnTimer()
         {
-            //补水监控
-            if (_direplenHelper != null)
-            {
-                _direplenHelper.MonitorPeriodTime(DiReplenTimeOutOpeartion);
-                if (!_diReplenMaxTimeOut && !_isDiReplenInFault && TotalDIReplenOn)
-                {
-                    if (_currentOperation == ReservoirOperation.ManualANDiReplen)
-                    {
-                        bool result = _direplenHelper.MonitorManualDiReplenComplete(_manualReplenSecond, ANDiReplenOff, DiReplenTimeOutOpeartion);
-                        if (result)
-                        {
-                            _currentOperation = ReservoirOperation.None;
-                        }
-                    }
-                    if (_currentOperation == ReservoirOperation.ManualCADiReplen)
-                    {
-                        bool result = _direplenHelper.MonitorManualDiReplenComplete(_manualReplenSecond, CADiReplenOff, DiReplenTimeOutOpeartion);
-                        if (result)
-                        {
-                            _currentOperation = ReservoirOperation.None;
-                        }
-                    }
-                    if (_currentOperation == ReservoirOperation.AutoANDiReplen)
-                    {
-                        AutoDiReplenMonitor(ANDiReplenOff, _reservoirData.ANLevel, _resRecipe.ReservoirANLevel, _resRecipe.ANDIReplenEnable,
-                            _resRecipe.ANDIReplenTimeRate, _resRecipe.ANDIReplenCurrentRate);
-                    }
-                    if (_currentOperation == ReservoirOperation.AutoCADiReplen)
-                    {
-                        AutoDiReplenMonitor(CADiReplenOff, _reservoirData.CALevel, _resRecipe.ReservoirCALevel, _resRecipe.DIReplenEnable,
-                            _resRecipe.DIReplenTimeRate, _resRecipe.DIReplenCurrentRate);
-                    }
-                }        
-            }
+            
             //计算AN/CA level的平均值
             if (ReservoirData != null)
             {
@@ -2570,17 +2527,49 @@ namespace CyberX8_RT.Devices.Reservoir
                 if (ReservoirData.CASampleFlow) CASampleOff("", null);
             }
             //DIReplen总阀未开关闭槽体DIReplen;未初始化关闭槽体DIReplen
-            if (!systemFacility.DIReplenEnable || (reservoirEntity == null || !reservoirEntity.IsInitialized))
+            if (!systemFacility.DIReplenEnable || reservoirEntity == null || !reservoirEntity.IsInitialized)
             {
                 if (_reservoirData.ANDiReplen) ANDiReplenOff("", null);
                 if (_reservoirData.CADiReplen) CADiReplenOff("", null);
             }
             if (reservoirEntity == null || !reservoirEntity.IsInitialized)
             {
-                if (_reservoirData.ANDiReplen) ANDiReplenOff("", null);
-                if (_reservoirData.CADiReplen) CADiReplenOff("", null);
                 return true;
             }
+            //补水监控
+            if (_direplenHelper != null)
+            {
+                _direplenHelper.MonitorPeriodTime(ref _isDIReplenMaxTimeOut);
+                if (!_isDIReplenMaxTimeOut && !_isDIReplenPerfillTimeOut && TotalDIReplenOn)
+                {
+                    if (_currentOperation == ReservoirOperation.ManualANDiReplen)
+                    {
+                        bool result = _direplenHelper.MonitorManualDiReplenComplete(_manualReplenSecond, ANDiReplenOff, ref _isDIReplenMaxTimeOut);
+                        if (result)
+                        {
+                            _currentOperation = ReservoirOperation.None;
+                        }
+                    }
+                    if (_currentOperation == ReservoirOperation.ManualCADiReplen)
+                    {
+                        bool result = _direplenHelper.MonitorManualDiReplenComplete(_manualReplenSecond, CADiReplenOff, ref _isDIReplenMaxTimeOut);
+                        if (result)
+                        {
+                            _currentOperation = ReservoirOperation.None;
+                        }
+                    }
+                    if (_currentOperation == ReservoirOperation.AutoANDiReplen)
+                    {
+                        AutoDiReplenMonitor(ANDiReplenOff, _reservoirData.ANLevel, _resRecipe.ReservoirANLevel, _resRecipe.ANDIReplenEnable,
+                            _resRecipe.ANDIReplenTimeRate, _resRecipe.ANDIReplenCurrentRate);
+                    }
+                    if (_currentOperation == ReservoirOperation.AutoCADiReplen)
+                    {
+                        AutoDiReplenMonitor(CADiReplenOff, _reservoirData.CALevel, _resRecipe.ReservoirCALevel, _resRecipe.DIReplenEnable,
+                            _resRecipe.DIReplenTimeRate, _resRecipe.DIReplenCurrentRate);
+                    }
+                }
+            }
             if (_isCrossDoseInstalled)
             {
                 if (_crossDoseHelper.CrossDoseState == RState.Running)
@@ -2633,12 +2622,10 @@ namespace CyberX8_RT.Devices.Reservoir
         private void AutoDiReplenMonitor(Func<string, object[], bool> direplenOff, double level, double recipeLevel, bool replenEnable,
             int direplenTimeRate, int direplenCurrentRate)
         {
-            var result = _direplenHelper.AutoDiReplenMonitorTimeOut(direplenOff, DiReplenTimeOutOpeartion);
-            if (result.Item1)
+            var result = _direplenHelper.AutoDiReplenMonitorTimeOut(direplenOff, ref _isDIReplenMaxTimeOut, ref _isDIReplenPerfillTimeOut);
+            if (result)
             {
                 _currentOperation = ReservoirOperation.None;
-                //触发注水异常信号
-                if (result.Item2 == DIReplenFaultType.PerFillTimeOut) _isDiReplenInFault = true;
             }
             else
             {

+ 18 - 30
CyberX8_RT/Devices/Reservoir/ReservoirDiReplenHelper.cs

@@ -4,13 +4,7 @@ using Aitex.Core.RT.SCCore;
 using CyberX8_RT.Devices.Facilities;
 using MECF.Framework.Common.Alarm;
 using MECF.Framework.Common.Persistent.Reservoirs;
-using MECF.Framework.Common.RecipeCenter;
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reflection;
-using System.Text;
-using System.Threading.Tasks;
 
 namespace CyberX8_RT.Devices.Reservoir
 {
@@ -44,7 +38,7 @@ namespace CyberX8_RT.Devices.Reservoir
         /// <summary>
         /// 监控
         /// </summary>
-        public void MonitorPeriodTime(Action<bool> timeOutAction)
+        public void MonitorPeriodTime(ref bool maxTimeout)
         {
             double levelHysteresis = SC.GetValue<double>("Reservoir.LevelHysteresis");
             double diValveMaxOnTimePeriod = SC.GetValue<double>($"Reservoir.{_module}.DIValveMaxOnTimePeriod");
@@ -55,7 +49,7 @@ namespace CyberX8_RT.Devices.Reservoir
                 if (DateTime.Now.Subtract(_persistentValue.PeriodStartTime).TotalMinutes >= diValveMaxOnTimePeriod * 60)
                 {
                     LOG.WriteLog(eEvent.INFO_RESERVOIR, _module, $"Time is over config DIValveMaxOnTimePeriod:{diValveMaxOnTimePeriod} hour. Restart timer");
-                    timeOutAction(false);
+                    maxTimeout = false;
                     _persistentValue.PeriodStartTime = DateTime.Now;
                     _persistentValue.TotalReplen = 0;
                     _persistentValue.LastTotalReplen = 0;
@@ -66,7 +60,7 @@ namespace CyberX8_RT.Devices.Reservoir
         /// <summary>
         /// 监控手动注水
         /// </summary>
-        public bool MonitorManualDiReplenComplete(int replenSecond, Func<string, object[], bool> direplenOffAction, Action<bool> timeOutAction)
+        public bool MonitorManualDiReplenComplete(int replenSecond, Func<string, object[], bool> direplenOffAction, ref bool maxTimeout)
         {
             lock (_locker)
             {
@@ -79,8 +73,8 @@ namespace CyberX8_RT.Devices.Reservoir
                 bool result = direplenOffAction("", null);
                 if (result)
                 {
-                    timeOutAction(true);
-                    LOG.WriteLog(eEvent.WARN_RESERVOIR, _module, $"Direplen time over config DIValveMaxOnTime:{diValveMaxOnTime} min");
+                    maxTimeout = true;
+                    LOG.WriteLog(eEvent.WARN_RESERVOIR, _module, $"DiReplen time over config DIValveMaxOnTime:{diValveMaxOnTime} min");
                     _persistentValue.LastTotalReplen = _persistentValue.TotalReplen;
                     _persistentValue.IsDiReplenOn = false;
                     ReservoirsPersistentManager.Instance.UpdatePersistentValue(_module);
@@ -91,12 +85,11 @@ namespace CyberX8_RT.Devices.Reservoir
             {
                 bool result = direplenOffAction("", null);
                 if (result)
-                {
-                    timeOutAction(true);
+                { 
                     _persistentValue.LastTotalReplen = _persistentValue.TotalReplen;
                     _persistentValue.IsDiReplenOn = false;
                     ReservoirsPersistentManager.Instance.UpdatePersistentValue(_module);
-                    LOG.WriteLog(eEvent.INFO_RESERVOIR, _module, "Manual Direplen complete");
+                    LOG.WriteLog(eEvent.INFO_RESERVOIR, _module, "Manual DiReplen Complete");
                 }
                 return result;
             }
@@ -106,7 +99,7 @@ namespace CyberX8_RT.Devices.Reservoir
         /// 自动注水超时
         /// </summary>
         /// <returns></returns>
-        public (bool, DIReplenFaultType) AutoDiReplenMonitorTimeOut(Func<string, object[], bool> direplenOffAction, Action<bool> timeOutAction)
+        public bool AutoDiReplenMonitorTimeOut(Func<string, object[], bool> direplenOffAction, ref bool maxTimeOut, ref bool perfillTimeOut)
         {
             lock (_locker)
             {
@@ -119,8 +112,9 @@ namespace CyberX8_RT.Devices.Reservoir
                 bool result = direplenOffAction("", null);
                 if (result)
                 {
-                    AlarmListManager.Instance.AddWarn(_module, $"", $"{_module} Direplen time over config DIValveMaxOnTimePerFill:{diValveMaxOnTimePerFill} min");
-                    LOG.WriteLog(eEvent.WARN_RESERVOIR, _module, $"Direplen time over conifg DIValveMaxOnTimePerFill:{diValveMaxOnTimePerFill} min");
+                    perfillTimeOut = true;
+                    AlarmListManager.Instance.AddWarn(_module, $"", $"{_module} DiReplen time over config DIValveMaxOnTimePerFill:{diValveMaxOnTimePerFill} min");
+                    LOG.WriteLog(eEvent.WARN_RESERVOIR, _module, $"DiReplen time over conifg DIValveMaxOnTimePerFill:{diValveMaxOnTimePerFill} min");
                     //补水超时关闭总的补水阀
                     SystemFacilities systemFacilities = DEVICE.GetDevice<SystemFacilities>("System.Facilities");
                     if (systemFacilities != null)
@@ -131,7 +125,7 @@ namespace CyberX8_RT.Devices.Reservoir
                     _persistentValue.IsDiReplenOn = false;
                     ReservoirsPersistentManager.Instance.UpdatePersistentValue(_module);
                 }
-                return (result, DIReplenFaultType.PerFillTimeOut);
+                return result;
             }
             //累计补水超时
             double diValveMaxOnTime = SC.GetValue<double>($"Reservoir.{_module}.DIValveMaxOnTime");
@@ -140,16 +134,16 @@ namespace CyberX8_RT.Devices.Reservoir
                 bool result = direplenOffAction("", null);
                 if (result)
                 {
-                    timeOutAction(true);
-                    AlarmListManager.Instance.AddWarn(_module, $"", $"{_module} Direplen time over config DIValveMaxOnTime:{diValveMaxOnTime} min");
-                    LOG.WriteLog(eEvent.WARN_RESERVOIR, _module, $"Direplen time over conifg DIValveMaxOnTime:{diValveMaxOnTime} min");
+                    maxTimeOut = true;
+                    AlarmListManager.Instance.AddWarn(_module, $"", $"{_module} DiReplen time over config DIValveMaxOnTime:{diValveMaxOnTime} min");
+                    LOG.WriteLog(eEvent.WARN_RESERVOIR, _module, $"DiReplen time over conifg DIValveMaxOnTime:{diValveMaxOnTime} min");
                     _persistentValue.LastTotalReplen = _persistentValue.TotalReplen;
                     _persistentValue.IsDiReplenOn = false;
                     ReservoirsPersistentManager.Instance.UpdatePersistentValue(_module);
                 }
-                return (result, DIReplenFaultType.MaxTimeOut);
+                return result;
             }
-            return (false, DIReplenFaultType.None);
+            return false;
         }
         /// <summary>
         /// 自动注水是否结束
@@ -166,7 +160,7 @@ namespace CyberX8_RT.Devices.Reservoir
             if (replenEnable && direplenTimeRate == 0 && direplenCurrentRate == 0 &&
                 level >= recipeLevel)
             {
-                LOG.WriteLog(eEvent.INFO_RESERVOIR, _module, "Auto replen complete");
+                LOG.WriteLog(eEvent.INFO_RESERVOIR, _module, "Auto DiReplen Complete");
                 bool result = direplenOffAction("", null);
                 if (result)
                 {
@@ -178,11 +172,5 @@ namespace CyberX8_RT.Devices.Reservoir
             }
             return false;
         }
-        public enum DIReplenFaultType
-        {
-            None,
-            MaxTimeOut,
-            PerFillTimeOut
-        }
     }
 }

+ 30 - 42
CyberX8_RT/Devices/Reservoir/StandardHotReservoirDevice.cs

@@ -112,10 +112,6 @@ namespace CyberX8_RT.Devices.Reservoir
         /// </summary>
         private int _manualReplenSecond = 0;
         /// <summary>
-        /// 注水是否出错
-        /// </summary>
-        private bool _isDiReplenInFault = false;
-        /// <summary>
         /// Recipe
         /// </summary>
         private ResRecipe _resRecipe;
@@ -230,10 +226,6 @@ namespace CyberX8_RT.Devices.Reservoir
         /// </summary>
         private Dictionary<string, HoldoffTimeSignalMonitor> _holdoffTimeSignalDic = new Dictionary<string, HoldoffTimeSignalMonitor>();
         /// <summary>
-        /// 累计补水超时
-        /// </summary>
-        private bool _diReplenMaxTimeOut;
-        /// <summary>
         /// 是否有其他DIReplen的警告
         /// </summary>
         private bool _isOtherDIReplenWarnOn = false;
@@ -241,6 +233,14 @@ namespace CyberX8_RT.Devices.Reservoir
         /// Facility DIReplen Off Warning
         /// </summary>
         private bool _isTotalDIReplenWarnOn = false;
+        /// <summary>
+        /// 累计补水是否超时
+        /// </summary>
+        private bool _isDIReplenMaxTimeOut = false;
+        /// <summary>
+        /// 单次补水是否超时
+        /// </summary>
+        private bool _isDIReplenPerfillTimeOut = false;
         #endregion
 
         #region 属性
@@ -297,13 +297,6 @@ namespace CyberX8_RT.Devices.Reservoir
         /// </summary>
         public bool IsRegulatePump { get { return _isRegulatePump; } }
         /// <summary>
-        /// 补水累计超时
-        /// </summary>
-        public bool DiReplenMaxTimeOut
-        {
-            get { return _diReplenMaxTimeOut; }
-        }
-        /// <summary>
         /// 每隔30秒打印槽体相关的信息
         /// </summary>
         private DateTime _periodLogTime;
@@ -319,9 +312,13 @@ namespace CyberX8_RT.Devices.Reservoir
             }
         }
         /// <summary>
-        /// 注水是否出错
+        /// 单次补水是否超时
         /// </summary>
-        public bool IsDiReplenInFault { get { return _isDiReplenInFault; } }
+        public bool IsDIReplenPerfillTimeOut { get { return _isDIReplenPerfillTimeOut; } }
+        /// <summary>
+        /// 累计补水是否超时
+        /// </summary>
+        public bool IsDIReplenMaxTimeOut { get { return _isDIReplenMaxTimeOut; } }
         #endregion
         /// <summary>
         /// 初始化成功清除对应的错误log
@@ -436,12 +433,12 @@ namespace CyberX8_RT.Devices.Reservoir
             //DIReplen
             if (_direplenHelper != null)
             {
-                _direplenHelper.MonitorPeriodTime(DiReplenTimeOutOpeartion);
-                if (!_diReplenMaxTimeOut && !_isDiReplenInFault && TotalDIReplenOn)
+                _direplenHelper.MonitorPeriodTime(ref _isDIReplenMaxTimeOut);
+                if (!_isDIReplenMaxTimeOut && !_isDIReplenPerfillTimeOut && TotalDIReplenOn)
                 {
                     if (_currentOperation == ReservoirOperation.ManualDiReplen && _reservoirData.DiReplen)
                     {
-                        bool result = _direplenHelper.MonitorManualDiReplenComplete(_manualReplenSecond, DIReplenOff, DiReplenTimeOutOpeartion);
+                        bool result = _direplenHelper.MonitorManualDiReplenComplete(_manualReplenSecond, DIReplenOff, ref _isDIReplenMaxTimeOut);
                         if (result)
                         {
                             _currentOperation = ReservoirOperation.None;
@@ -449,12 +446,10 @@ namespace CyberX8_RT.Devices.Reservoir
                     }
                     else if (_currentOperation == ReservoirOperation.AutoDiReplen && _reservoirData.DiReplen)
                     {
-                        var result = _direplenHelper.AutoDiReplenMonitorTimeOut(DIReplenOff, DiReplenTimeOutOpeartion);
-                        if (result.Item1)
+                        var result = _direplenHelper.AutoDiReplenMonitorTimeOut(DIReplenOff, ref _isDIReplenMaxTimeOut, ref _isDIReplenPerfillTimeOut);
+                        if (result)
                         {
                             _currentOperation = ReservoirOperation.None;
-                            //触发注水异常信号
-                            if (result.Item2 == DIReplenFaultType.PerFillTimeOut) _isDiReplenInFault = true;
                         }
                         else
                         {
@@ -859,14 +854,14 @@ namespace CyberX8_RT.Devices.Reservoir
             DATA.Subscribe($"{Module}.RecipeName", () => (_resRecipe != null ? _resRecipe.Ppid : ""), SubscriptionAttribute.FLAG.IgnoreSaveDB);
             DATA.Subscribe($"{Module}.HedFlow", () => _reservoirData.HedFlow, SubscriptionAttribute.FLAG.IgnoreSaveDB);
             DATA.Subscribe($"{Module}.PHEnable", () => _reservoirData.PHFlowValve, SubscriptionAttribute.FLAG.IgnoreSaveDB);
-            DATA.Subscribe($"{Module}.IsDIReplenInFault", () => _isDiReplenInFault, SubscriptionAttribute.FLAG.IgnoreSaveDB);
             DATA.Subscribe($"{Module}.ReservoirPowerOn", () => _reservoirData.ResPowerOn, SubscriptionAttribute.FLAG.IgnoreSaveDB);
             DATA.Subscribe($"{Module}.HedPowerOn", () => _reservoirData.HedPowerOn, SubscriptionAttribute.FLAG.IgnoreSaveDB);
             DATA.Subscribe($"{Module}.IsRegulatePump", () => _isRegulatePump, SubscriptionAttribute.FLAG.IgnoreSaveDB);
             DATA.Subscribe($"{Module}.PumpSpeed", () => _regulatePumpSpeed, SubscriptionAttribute.FLAG.IgnoreSaveDB);
             DATA.Subscribe($"{Module}.IsCMMConfig", () => _isCMMConfig, SubscriptionAttribute.FLAG.IgnoreSaveDB);
             DATA.Subscribe($"{Module}.SubordinateReservoirPump", () => _reservoirData.RegulatePumpSignalIn, SubscriptionAttribute.FLAG.IgnoreSaveDB);
-            DATA.Subscribe($"{Module}.DIReplenMaxTimeOut", () => _diReplenMaxTimeOut, SubscriptionAttribute.FLAG.IgnoreSaveDB);
+            DATA.Subscribe($"{Module}.IsDIReplenPerfillTimeOut", () => _isDIReplenPerfillTimeOut, SubscriptionAttribute.FLAG.IgnoreSaveDB);
+            DATA.Subscribe($"{Module}.IsDIReplenMaxTimeOut", () => _isDIReplenMaxTimeOut, SubscriptionAttribute.FLAG.IgnoreSaveDB);
         }
         /// <summary>
         /// 初始化操作
@@ -1050,17 +1045,10 @@ namespace CyberX8_RT.Devices.Reservoir
         /// <param name="args"></param>
         private bool DIReplenClearError(string cmd, object[] args)
         {
-            _isDiReplenInFault = false;
+            _isDIReplenPerfillTimeOut = false;
             return true;
         }
         /// <summary>
-        /// DI Replen超时
-        /// </summary>
-        private void DiReplenTimeOutOpeartion(bool timeOutFlag)
-        {
-            _diReplenMaxTimeOut = timeOutFlag;
-        }
-        /// <summary>
         /// 重置时长
         /// </summary>
         /// <param name="cmd"></param>
@@ -1068,7 +1056,7 @@ namespace CyberX8_RT.Devices.Reservoir
         /// <returns></returns>
         private bool ResetTotalTime(string cmd, object[] objs)
         {
-            _diReplenMaxTimeOut = false;
+            _isDIReplenMaxTimeOut = false;
             _persistentValue.TotalReplen = 0;
             _persistentValue.LastTotalReplen = 0;
             ReservoirsPersistentManager.Instance.UpdatePersistentValue(Module);
@@ -1409,7 +1397,7 @@ namespace CyberX8_RT.Devices.Reservoir
                 if (!_isTotalDIReplenWarnOn)
                 {
                     _isTotalDIReplenWarnOn = true;
-                    LOG.WriteLog(eEvent.WARN_RESERVOIR, Module, "Facilities DiReplen is Off");
+                    LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, "Facilities DiReplen is Off, can't start auto diReplen");
                 }
                 return false;
             }
@@ -1420,7 +1408,7 @@ namespace CyberX8_RT.Devices.Reservoir
             SafetyDevice safetyDevice = DEVICE.GetDevice<SafetyDevice>("Safety");
             if (safetyDevice != null && safetyDevice.SafetyData.ReservoirHighLevel)
             {
-                LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, $"Safety high is Activate");
+                LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, $"Safety high is Activate, can't start auto diReplen");
                 return false;
             }
             if (CheckOtherReservoirDiReplenStatus())
@@ -1462,7 +1450,7 @@ namespace CyberX8_RT.Devices.Reservoir
                             if (!_isOtherDIReplenWarnOn)
                             {
                                 _isOtherDIReplenWarnOn = true;
-                                LOG.WriteLog(eEvent.WARN_RESERVOIR, Module, $"{item} DIReplen is on");
+                                LOG.WriteLog(eEvent.WARN_RESERVOIR, Module, $"{item} DiReplen valve is on. {Module} is waiting DiReplen");
                             }
                             return true;
                         }
@@ -1475,7 +1463,7 @@ namespace CyberX8_RT.Devices.Reservoir
                             if (!_isOtherDIReplenWarnOn)
                             {
                                 _isOtherDIReplenWarnOn = true;
-                                LOG.WriteLog(eEvent.WARN_RESERVOIR, Module, $"{item} AN_DIReplen is on");
+                                LOG.WriteLog(eEvent.WARN_RESERVOIR, Module, $"{item} AN DiReplen valve is on. {Module} is waiting DiReplen");
                             }
                             return true;
                         }
@@ -1484,7 +1472,7 @@ namespace CyberX8_RT.Devices.Reservoir
                             if (!_isOtherDIReplenWarnOn)
                             {
                                 _isOtherDIReplenWarnOn = true;
-                                LOG.WriteLog(eEvent.WARN_RESERVOIR, Module, $"{item} CA_DIReplen is on");
+                                LOG.WriteLog(eEvent.WARN_RESERVOIR, Module, $"{item} CA DiReplen valve is on. {Module} is waiting DiReplen");
                             }
                             return true;
                         }
@@ -1535,13 +1523,13 @@ namespace CyberX8_RT.Devices.Reservoir
                 LOG.WriteLog(eEvent.WARN_RESERVOIR, Module, $"{Module} is not initialized. Can't start DiReplen");
                 return false;
             }
-            if (DiReplenMaxTimeOut)
+            if (IsDIReplenMaxTimeOut)
             {
                 double diValveMaxOnTime = SC.GetValue<double>($"Reservoir.{Module}.DIValveMaxOnTime");
                 LOG.WriteLog(eEvent.WARN_RESERVOIR, Module, $"Direplen time over conifg's DIValveMaxOnTime:{diValveMaxOnTime} min");
                 return false;
             }
-            if (IsDiReplenInFault)
+            if (IsDIReplenPerfillTimeOut)
             {
                 double diValveMaxOnTimePerFill = SC.GetValue<double>($"Reservoir.{Module}.DIValveMaxOnTimePerFill");
                 LOG.WriteLog(eEvent.WARN_RESERVOIR, Module, $"Direplen time over conifg's DIValveMaxOnTimePerFill:{diValveMaxOnTimePerFill} min");

+ 4 - 33
CyberX8_RT/Devices/Reservoir/TotalReservoirDevice.cs

@@ -47,15 +47,6 @@ namespace CyberX8_RT.Devices.Reservoir
         /// 定时器
         /// </summary>
         private PeriodicJob _period;
-        /// <summary>
-        /// DiReplen Warning Dictionary
-        /// </summary>      
-        private Dictionary<string, bool> _diReplenWarnDic = new Dictionary<string, bool>() {
-            {"Reservoir1", false},
-            {"Reservoir2", false},
-            {"Reservoir3", false},
-            {"Reservoir4", false},
-        };
         #endregion
         #region 属性
         /// <summary>
@@ -190,17 +181,13 @@ namespace CyberX8_RT.Devices.Reservoir
                     if (reservoirItem.SubType == STRATUS)
                     {
                         StandardHotReservoirDevice reservoirDevice = DEVICE.GetDevice<StandardHotReservoirDevice>(module);
-                        if (!reservoirEntity.IsInitialized || reservoirDevice.DiReplenMaxTimeOut
-                            || reservoirDevice.IsDireplenOn || reservoirDevice.IsDiReplenInFault)
+                        if (!reservoirEntity.IsInitialized || reservoirDevice.IsDIReplenPerfillTimeOut
+                            || reservoirDevice.IsDireplenOn || reservoirDevice.IsDIReplenMaxTimeOut)
                         {
                             continue;
                         }
-                        if (reservoirDevice.NeedAutoDireplen)
+                        if (reservoirDevice.NeedAutoDireplen && !reservoirDevice.IsDireplenOn)
                         {
-                            if (!CheckFacilityDiReplenOn(reservoirDevice.TotalDIReplenOn, module))
-                            {
-                                continue;
-                            }
                             reservoirDevice.AutoDireplen();
                         }
                     }
@@ -212,23 +199,7 @@ namespace CyberX8_RT.Devices.Reservoir
             }
             return true;
         }
-        private bool CheckFacilityDiReplenOn(bool diReplenOn, string module)
-        {
-            if (!diReplenOn)
-            {
-                if (!_diReplenWarnDic[module])
-                {
-                    _diReplenWarnDic[module] = true;
-                    LOG.WriteLog(eEvent.WARN_RESERVOIR, module, $"SystemFacility DIReplen is off, {module} can't do auto DIReplen");
-                }
-                return false;
-            }
-            else
-            {
-                _diReplenWarnDic[module] = false;
-                return true;
-            }
-        }
+        
         public void Monitor()
         {
         }