Forráskód Böngészése

add DM reservoir relate data banding

chenzk 1 hete%!(EXTRA string=óta)
szülő
commit
d68fc0b5b2

+ 1 - 0
Framework/Common/DataCenter/IQueryDataService.cs

@@ -158,6 +158,7 @@ namespace MECF.Framework.Common.DataCenter
     [ServiceKnownType(typeof(Dictionary<string, ReplenPersistentValue>))]
     [ServiceKnownType(typeof(List<AlarmList>))]
     [ServiceKnownType(typeof(ObservableCollection<SignalTowerItem>))]
+    [ServiceKnownType(typeof(ReservoirData))]
     public interface IQueryDataService
 	{
 		[OperationContract]

+ 322 - 2
PunkHPX8_MainPages/ViewModels/DMReservoirViewModel.cs

@@ -1,12 +1,332 @@
-using System;
+using Aitex.Core.UI.MVVM;
+using MECF.Framework.Common.CommonData.Metal;
+using MECF.Framework.Common.CommonData.Reservoir;
+using MECF.Framework.Common.CommonData.TemperatureControl;
+using MECF.Framework.Common.DataCenter;
+using MECF.Framework.Common.Device.Safety;
+using MECF.Framework.Common.OperationCenter;
+using MECF.Framework.Common.Persistent.Reservoirs;
+using MECF.Framework.Common.RecipeCenter;
+using MECF.Framework.Common.Utilities;
+using Prism.Mvvm;
+using PunkHPX8_MainPages.Model;
+using System;
 using System.Collections.Generic;
+using System.Collections.ObjectModel;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using System.Windows.Input;
+using System.Windows.Threading;
 
 namespace PunkHPX8_MainPages.ViewModels
 {
-    public class DMReservoirViewModel
+    public class DMReservoirViewModel : BindableBase
     {
+        #region 常量
+        private const string RESERVOIRS_DATA = "ReservoirsData";
+        private const string RESERVOIRS = "reservoirs";
+        private const string PERSISTENT_VALUE = "PersistentValue";
+        #endregion
+
+        #region 内部变量
+        private List<string> _rtDataKeys = new List<string>();
+        private Dictionary<string, object> _rtDataValueDic = new Dictionary<string, object>();
+        DispatcherTimer _timer;
+        private bool _isEnabled;
+        private bool _isError;
+        private bool _isAutoEnabled;
+        private SafetyData _commonSafetyData;
+
+        private string _module;
+        private string _state;
+        private ResRecipe _currentRecipe;
+        private ReservoirsPersistentValue _reservoirsPersistent;
+
+        private string _recipeType;
+
+        private int _inputCAPumpSpeed;
+        private int _inputANPumpSpeed;
+        private int _inputReturnFlowOpenPercent;
+
+        private TemperatureControllerData _temperatureControlData;
+        private string _tcEnableStatus;
+        private string _tcName;
+
+        private ReservoirData _reservoirData;
+
+        private ObservableCollection<RecipeNode> _recipeNodes;
+        private string _currentRecipeFileName;
+  
+        private double _returnValveOpenPerccent;
+        private bool _isCADIReplenFault;
+        private bool _isANDIReplenFault;
+        private double _flowAdjustDelta;
+        private double _maxFlowDelta;
+        private bool _isFolwDeltaUnBlance = false;
+        private bool _isHighLevel;
+        private bool _isLowLevel;
+        private bool _isLeakDetected;
+        private bool _cdaOn;
+
+
+        /// <summary>
+        /// 是否配置Exhaust
+        /// </summary>
+        private bool _isEvaporatorConfig;
+        /// <summary>
+        /// 是否正在手动注水
+        /// </summary>
+        private bool _isManualReplen;
+        /// <summary>
+        /// 手动注水时长(秒)
+        /// </summary>
+        private int _manualFillSeconds;
+        /// <summary>
+        /// DIValveMaxOnTime
+        /// </summary>
+        private double _diValveMaxOnTime;
+
+
+        /// <summary>
+        /// CellModuleName集合
+        /// </summary>
+        private ObservableCollection<string> _cellModuleNameCollection = new ObservableCollection<string>();
+        /// <summary>
+        /// Cell A面Flow集合
+        /// </summary>
+        private ObservableCollection<double> _cellModuleNameFlowCollection = new ObservableCollection<double>();
+        /// <summary>
+        /// MetalData
+        /// </summary>
+        private ObservableCollection<CompactMembranMetalDeviceData> _metalDatas = new ObservableCollection<CompactMembranMetalDeviceData>();
+        /// <summary>
+        /// MetalData的CellFlow集合
+        /// </summary>
+        private ObservableCollection<double> _metalCellFlowDatas = new ObservableCollection<double>();
+        /// <summary>
+        /// Meatl UI数据
+        /// </summary>
+        private ObservableCollection<ReservoirsUIData> _reservoirsUIDatas = new ObservableCollection<ReservoirsUIData>();
+
+        #endregion
+
+        #region 属性
+        public string Module 
+        { 
+            get { return _module; } 
+            set { SetProperty(ref _module, value); } 
+        }
+        public bool IsEnabled
+        {
+            get { return _isEnabled; }
+            set { SetProperty(ref _isEnabled, value); }
+        }
+        public bool IsError
+        {
+            get { return _isError; }
+            set { SetProperty(ref _isError, value); }
+        }
+        public bool IsAutoEnabled
+        {
+            get { return _isAutoEnabled; }
+            set { SetProperty(ref _isAutoEnabled, value); }
+        }
+        public SafetyData CommonSafetyData
+        {
+            get { return _commonSafetyData; }
+            set { SetProperty(ref _commonSafetyData, value); }
+        }
+
+        public string State
+        {
+            get { return _state; }
+            set { SetProperty(ref _state, value); }
+        }
+        public ResRecipe CurrentRecipe
+        {
+            get { return _currentRecipe; }
+            set { SetProperty(ref _currentRecipe, value); }
+        }
+        public ReservoirsPersistentValue ReservoirsPersistent
+        {
+            get { return _reservoirsPersistent; }
+            set { SetProperty(ref _reservoirsPersistent, value); }
+        }
+
+        public string RecipeType
+        {
+            get { return _recipeType; }
+            set { SetProperty(ref _recipeType, value); }
+        }
+
+        public int InputCAPumpSpeed
+        {
+            get { return _inputCAPumpSpeed; }
+            set
+            {
+                SetProperty(ref _inputCAPumpSpeed, value);
+            }
+        }
+        public int InputANPumpSpeed
+        {
+            get { return _inputANPumpSpeed; }
+            set
+            {
+                SetProperty(ref _inputANPumpSpeed, value);
+            }
+        }
+        public int InputRetrunFlowOpenPercent
+        {
+            get { return _inputReturnFlowOpenPercent; }
+            set
+            {
+                SetProperty(ref _inputReturnFlowOpenPercent, value);
+            }
+        }
+       
+        public TemperatureControllerData TemperatureControlData
+        {
+            get { return _temperatureControlData; }
+            set { SetProperty(ref _temperatureControlData, value); }
+        }
+        public string TCEnableStatus
+        {
+            get { return _tcEnableStatus; }
+            set { SetProperty(ref _tcEnableStatus, value); }
+        }
+        
+        
+        public ReservoirData ReservoirData
+        {
+            get { return _reservoirData; }
+            set { SetProperty(ref _reservoirData, value); }
+        }
+        #endregion
+
+
+        #region 指令
+        public ICommand InitializeCommand { get; set; }
+        public ICommand CAPumpSpeedSetCommand { get; set; }
+        public ICommand ANPumpSpeedSetCommand { get; set; }
+        public ICommand ReturnFlowOpenPercentSetCommand { get; set; }
+
+        #endregion
+
+        public DMReservoirViewModel()
+        {
+            InitializeCommand = new DelegateCommand<object>(InitializeAction);
+            CAPumpSpeedSetCommand = new DelegateCommand<object>(CAPumpSpeedSetAction);
+            ANPumpSpeedSetCommand = new DelegateCommand<object>(ANPumpSpeedSetAction);
+            ReturnFlowOpenPercentSetCommand = new DelegateCommand<object>(ReturnFlowOpenPercentSetAction);
+        }
+
+        #region 命令方法
+        /// <summary>
+        /// 初始化
+        /// </summary>
+        /// <param name="param"></param>
+        private void InitializeAction(object param)
+        {
+            InvokeClient.Instance.Service.DoOperation($"{Module}.InitializeAll");
+        }
+        /// <summary>
+        /// 设置CA pump泵速
+        /// </summary>
+        /// <param name="param"></param>
+        private void CAPumpSpeedSetAction(object param)
+        {
+            InvokeClient.Instance.Service.DoOperation($"{Module}.InitializeAll");
+        }
+        /// <summary>
+        /// 设置AN pump泵速
+        /// </summary>
+        /// <param name="param"></param>
+        private void ANPumpSpeedSetAction(object param)
+        {
+            InvokeClient.Instance.Service.DoOperation($"{Module}.InitializeAll");
+        }
+        /// <summary>
+        /// 设置return flow valve开闭的程度
+        /// </summary>
+        /// <param name="param"></param>
+        private void ReturnFlowOpenPercentSetAction(object param)
+        {
+            InvokeClient.Instance.Service.DoOperation($"{Module}.InitializeAll");
+        }
+        #endregion
+
+        public void LoadData(string systemName)
+        {
+            RecipeType = "res";
+            Module = systemName;
+            _rtDataKeys.Clear();
+            _rtDataKeys.Add($"{Module}.{PERSISTENT_VALUE}");
+            _rtDataKeys.Add($"{Module}.CurrentRecipe");
+            _rtDataKeys.Add($"{Module}.FsmState");
+            _rtDataKeys.Add($"Safety.SafetyData");
+            _rtDataKeys.Add($"{Module}.ReservoirData");
+            //_rtDataKeys.Add($"{Module}.TemperatureControllerData");
+            if (_timer == null)
+            {
+                _timer = new DispatcherTimer();
+                _timer.Interval = TimeSpan.FromMilliseconds(200);
+                _timer.Tick += Timer_Tick;
+            }
+            _timer.Start();
+
+        }
+
+        private void Timer_Tick(object sender, EventArgs e)
+        {
+            if (_rtDataKeys.Count != 0)
+            {
+                _rtDataValueDic = QueryDataClient.Instance.Service.PollData(_rtDataKeys);
+                if (_rtDataValueDic != null)
+                {
+                    State = CommonFunction.GetValue<string>(_rtDataValueDic, $"{Module}.FsmState");
+                    ReservoirData = CommonFunction.GetValue<ReservoirData>(_rtDataValueDic, $"{Module}.ReservoirData");
+                    CommonSafetyData = CommonFunction.GetValue<SafetyData>(_rtDataValueDic, $"Safety.SafetyData");
+                    ReservoirsPersistent = CommonFunction.GetValue<ReservoirsPersistentValue>(_rtDataValueDic, $"{Module}.{PERSISTENT_VALUE}");
+                    if (ReservoirsPersistent!= null && "Manual".Equals(ReservoirsPersistent.OperatingMode))
+                    {
+                        IsEnabled = true;
+                        IsAutoEnabled = true;
+                    }
+                    else if (ReservoirsPersistent != null &&  "Auto".Equals(ReservoirsPersistent.OperatingMode))
+                    {
+                        IsAutoEnabled = true;
+                        IsEnabled = false;
+                    }
+                    else
+                    {
+                        State = "Stopped";
+                        IsEnabled = false;
+                        IsAutoEnabled = false;
+                    }
+                    CurrentRecipe = CommonFunction.GetValue<ResRecipe>(_rtDataValueDic, $"{Module}.CurrentRecipe");
+                    //TemperatureControlData = CommonFunction.GetValue<TemperatureControllerData>(_rtDataValueDic, $"{Module}.TemperatureControllerData");
+                    //TCEnableStatus = TemperatureControlData.ControlOperationModel == 0 ? "Disable" : "Enable";
+                    //_tcName = TemperatureControlData.Name;
+
+
+                }
+            }
+        }
+
+        /// <summary>
+        /// 隐藏
+        /// </summary>
+        public void Hide()
+        {
+            if (_timer != null)
+            {
+                _timer.Stop();
+            }
+        }
+
+
+
+
     }
 }

+ 0 - 8
PunkHPX8_MainPages/ViewModels/ResRecipeViewModel.cs

@@ -187,14 +187,6 @@ namespace PunkHPX8_MainPages.ViewModels
             PropertyValidResultDic["ANLevelWarningLow"] = false;
 
             PropertyValidResultDic["ReservoirANLevel"] = false;
-            PropertyValidResultDic["BurnInTime"] = false;
-            PropertyValidResultDic["BurnInCurrent"] = false;
-            PropertyValidResultDic["BurnInCycles"] = false;
-            PropertyValidResultDic["BurnInMinCurrentLimit"] = false;
-            PropertyValidResultDic["CMMCurrentSetPoint"] = false;
-            PropertyValidResultDic["CMMCurrentFaultPercent"] = false;
-            PropertyValidResultDic["CMMCurrentWarningPercent"] = false;
-            PropertyValidResultDic["CMMMinVoltage"] = false;
 
 
 

+ 69 - 35
PunkHPX8_MainPages/Views/DMReservoirView.xaml

@@ -24,6 +24,17 @@
         <converters:boolToRedColor2 x:Key="boolToRedColor2"/>
         <converters:BoolToVisibility2 x:Key="boolToVisibility2"/>
         <converters:MutiBoolToBool x:Key="mutiBoolToBool"/>
+        <converters:BoolToErrorColor x:Key="boolToErrorColor"></converters:BoolToErrorColor>
+        <converters:BoolToYellowColor x:Key="boolToYellowColor"></converters:BoolToYellowColor>
+        <converters:BoolToYellowColor2 x:Key="boolToYellowColor2"></converters:BoolToYellowColor2>
+
+        <converters:BoolToGreenRedColor x:Key="boolToGreenRedColor"></converters:BoolToGreenRedColor>
+        <converters:BoolToRedGreenColor x:Key="boolToRedGreenColor"></converters:BoolToRedGreenColor>
+
+        <converters:BoolToColor4 x:Key="boolToColor4"></converters:BoolToColor4>
+        <converters:BoolToColor6 x:Key="boolToColor6"></converters:BoolToColor6>
+        <converters:BoolToColor7 x:Key="boolToColor7"></converters:BoolToColor7>
+        <converters:BoolToBool x:Key="boolReverse"></converters:BoolToBool>
     </UserControl.Resources>
     <Canvas>
         <Grid>
@@ -44,12 +55,14 @@
             </Grid.ColumnDefinitions>
             <Grid Grid.Row="1" Grid.Column="0">
                 <userControls:ReservoirsInformationPanel HorizontalAlignment="Left" Margin="10,0,0,0" VerticalAlignment="Center" 
-                      ModuleTitle="{Binding Module}"
-                      
-                      
-                                    />
+                      ModuleTitle="{Binding Module}"                                         
+                      RecipeContentValue="{Binding CurrentRecipe.Ppid}"
+                      StateValue="{Binding State}"
+                      OperatingModeValue="{Binding ReservoirsPersistent.OperatingMode}"
+                      RecipeModeValue="{Binding ReservoirsPersistent.RecipeOperatingMode}"
+                      />
             </Grid>
-            <GroupBox Header="CA DIW Replen" FontWeight="Bold" FontSize="15" Grid.Row="2" Grid.Column="0" Width="200" Grid.RowSpan="2" Height="350" Margin="0,0,270,110">
+            <GroupBox Header="CA DIW Replen" FontWeight="Bold" FontSize="15" Grid.Row="2" Grid.Column="0" Width="200" Grid.RowSpan="2" Height="320" Margin="0,0,270,170">
                 <Grid>
                     <Grid.RowDefinitions>
                         <RowDefinition Height="35"></RowDefinition>
@@ -95,7 +108,7 @@
                     </Grid>
                 </Grid>
             </GroupBox>
-            <GroupBox Header="AN DIW Replen" FontWeight="Bold" FontSize="15" Grid.Row="3" Grid.Column="0" Width="200" Grid.RowSpan="2" Height="350" Margin="0,0,270,90">
+            <GroupBox Header="AN DIW Replen" FontWeight="Bold" FontSize="15" Grid.Row="3" Grid.Column="0" Width="200" Grid.RowSpan="2" Height="320" Margin="0,0,270,170">
                 <Grid>
                     <Grid.RowDefinitions>
                         <RowDefinition Height="35"></RowDefinition>
@@ -142,7 +155,9 @@
                 </Grid>
             </GroupBox>
             <Grid Grid.Row="1" Grid.Column="2" Grid.RowSpan="2" Margin="10 0 0 200">
-                <userControls:RecipeLoad Margin="10,10,0,0" Module="{Binding Module}" HeadName="Res Recipe"
+                <userControls:RecipeLoad Margin="10,10,0,0" 
+                  Module="{Binding Module}" 
+                  HeadName="Res Recipe"
                   RecipeType="{Binding RecipeType}" IsEnabled="{Binding IsEnabled}"
                   SelectedRecipeNode="{Binding SelectedRecipeNode,Mode=TwoWay}"
                   RecipeModeValue="{Binding ReservoirsPersistent.RecipeOperatingMode}" />
@@ -154,27 +169,26 @@
                     <RowDefinition Height="50"></RowDefinition>
                 </Grid.RowDefinitions>
                 <Grid Grid.Row="0">
-                    <Label Content="{Binding Module}"  FontSize="35" FontWeight="Bold" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" VerticalAlignment="Bottom" HorizontalAlignment="Center" Margin="0,0,0,13"></Label>
+                    <Label Content="{Binding Module}"  FontSize="35" FontWeight="Bold" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,0,0,0"></Label>
                 </Grid>
                 <Grid Grid.Row="1">
                     <Button IsEnabled="{Binding IsAutoEnabled}" Style="{StaticResource SysBtnStyle}"  Grid.Column="1" Height="30" Width="100" HorizontalAlignment="Center" Content="Initialize" Command="{Binding InitializeCommand}"></Button>
                 </Grid>
                 <Grid Grid.Row="2">
-                    <Label Content="Operating Mode"  FontSize="15" FontWeight="Bold" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" VerticalAlignment="Bottom" HorizontalAlignment="Center"></Label>
+                    <Label Content="Operating Mode"  FontSize="15" FontWeight="Bold" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" VerticalAlignment="Top" HorizontalAlignment="Center"></Label>
                 </Grid>
             </Grid>
-            <Grid Grid.Row="2" Grid.Column="3">
-                <userControls:OperatingModeControl HorizontalAlignment="Center" Margin="0,10,0,0" VerticalAlignment="Top" 
+            <userControls:OperatingModeControl HorizontalAlignment="Center" Margin="0,0,0,100" VerticalAlignment="Center"   Grid.Row="1" Grid.Column="3" Grid.RowSpan="2"
                                    ModuleName="{Binding Module}"
                                    OperationModeValue="{Binding ReservoirsPersistent.OperatingMode}"/>
-            </Grid>
+ 
             <Grid Grid.Row="2" Grid.Column="3">
-                <Label Content="Recipe Mode"  FontSize="15" FontWeight="Bold" Margin="0,0,0,40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" VerticalAlignment="Center" HorizontalAlignment="Center"></Label>
-                <userControls:RecipeModeControl HorizontalAlignment="Center" Margin="0,170,0,0" VerticalAlignment="Top" Width="190"
+                <Label Content="Recipe Mode"  FontSize="15" FontWeight="Bold" Margin="0,0,0,90" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" VerticalAlignment="Center" HorizontalAlignment="Center"></Label>
+                <userControls:RecipeModeControl HorizontalAlignment="Center" Margin="0,140,0,0" VerticalAlignment="Top" Width="190"
                                    ModuleName="{Binding Module}"
-                                   RecipeModeValue="{Binding ReservoirsPersistent.RecipeMode}" />
+                                   RecipeModeValue="{Binding ReservoirsPersistent.RecipeOperatingMode}" />
             </Grid>
-            <GroupBox Grid.Row="2" Grid.Column="2" Grid.ColumnSpan="2" Grid.RowSpan="3" HorizontalAlignment="Right" Height="240" VerticalAlignment="Center" Margin="0,0,0,50">
+            <GroupBox Grid.Row="2" Grid.Column="2" Grid.ColumnSpan="2" Grid.RowSpan="3" HorizontalAlignment="Right" Height="240" VerticalAlignment="Center" Margin="0,0,50,120">
                 <Grid>
                     <Grid.RowDefinitions>
                         <RowDefinition Height="30"/>
@@ -199,41 +213,41 @@
                         <Label Content="Return Valve Open" FontSize="14" FontWeight="Bold"   Margin="10,0,0,0" VerticalContentAlignment="Center" HorizontalContentAlignment="Left"/>
                     </Grid>
                     <Grid Grid.Row="1" Grid.Column="0" >
-                        <Control:IntegerTextBox IsEnabled="{Binding IsEnabled}" Value="{Binding ManualFillSeconds,Mode=TwoWay}" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,0,0,0" Height="30"  Width="70"/>
+                        <Control:IntegerTextBox IsEnabled="{Binding IsEnabled}" Value="{Binding InputCAPumpSpeed,Mode=TwoWay}" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,0,0,0" Height="30"  Width="70"/>
                     </Grid>
                     <Border Grid.Row="1" Grid.Column="1" Background="Black" Width="80" Height="30" Margin="0 0 0 0">
-                        <TextBlock Text="{Binding DIValveMaxOnTime,StringFormat={}{0} sec}" Foreground="Lime" FontSize="14" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center"/>
+                        <TextBlock Text="{Binding ReservoirData.CaPumpSpeed}" Foreground="Lime" FontSize="14" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                     </Border>
                     <Grid Grid.Row="3" Grid.Column="2">
-                        <Button IsEnabled="{Binding IsEnabled}" Style="{StaticResource SysBtnStyle}" Command="{Binding DIReplenClearErrorCommand}" Height="30" Width="50" Margin="0,0,10,0" HorizontalAlignment="Center" VerticalAlignment="Center"  Content="Set"/>
+                        <Button IsEnabled="{Binding IsEnabled}" Style="{StaticResource SysBtnStyle}" Command="{Binding ANPumpSpeedSetCommand}" Height="30" Width="50" Margin="0,0,10,0" HorizontalAlignment="Center" VerticalAlignment="Center"  Content="Set"/>
                     </Grid>
                     <Grid Grid.Row="3" Grid.Column="0" >
-                        <Control:IntegerTextBox IsEnabled="{Binding IsEnabled}" Value="{Binding ManualFillSeconds,Mode=TwoWay}" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,0,0,0" Height="30"  Width="70"/>
+                        <Control:IntegerTextBox IsEnabled="{Binding InputANPumpSpeed}" Value="{Binding ManualFillSeconds,Mode=TwoWay}" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,0,0,0" Height="30"  Width="70"/>
                     </Grid>
                     <Border Grid.Row="3" Grid.Column="1" Background="Black" Width="80" Height="30" Margin="0 0 0 0">
-                        <TextBlock Text="{Binding DIValveMaxOnTime,StringFormat={}{0} sec}" Foreground="Lime" FontSize="14" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center"/>
+                        <TextBlock Text="{Binding ReservoirData.AnPumpSpeed}" Foreground="Lime" FontSize="14" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                     </Border>
                     <Grid Grid.Row="5" Grid.Column="2">
-                        <Button IsEnabled="{Binding IsEnabled}" Style="{StaticResource SysBtnStyle}" Command="{Binding DIReplenClearErrorCommand}" Height="30" Width="50" Margin="0,0,10,0" HorizontalAlignment="Center" VerticalAlignment="Center"  Content="Set"/>
+                        <Button IsEnabled="{Binding IsEnabled}" Style="{StaticResource SysBtnStyle}" Command="{Binding ReturnFlowOpenPercentSetCommand}" Height="30" Width="50" Margin="0,0,10,0" HorizontalAlignment="Center" VerticalAlignment="Center"  Content="Set"/>
                     </Grid>
                     <Grid Grid.Row="5" Grid.Column="0" >
-                        <Control:IntegerTextBox IsEnabled="{Binding IsEnabled}" Value="{Binding ManualFillSeconds,Mode=TwoWay}" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,0,0,0" Height="30"  Width="70"/>
+                        <Control:IntegerTextBox IsEnabled="{Binding IsEnabled}" Value="{Binding InputRetrunFlowOpenPercent,Mode=TwoWay}" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,0,0,0" Height="30"  Width="70"/>
                     </Grid>
                     <Border Grid.Row="5" Grid.Column="1" Background="Black" Width="80" Height="30" Margin="0 0 0 0">
-                        <TextBlock Text="{Binding DIValveMaxOnTime,StringFormat={}{0} sec}" Foreground="Lime" FontSize="14" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center"/>
+                        <TextBlock Text="{Binding ReservoirData.ReturnValvePercent}" Foreground="Lime" FontSize="14" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                     </Border>
                     <Grid Grid.Row="1" Grid.Column="2">
-                        <Button IsEnabled="{Binding IsEnabled}" Style="{StaticResource SysBtnStyle}" Command="{Binding DIReplenClearErrorCommand}" Height="30" Width="50" Margin="0,0,10,0" HorizontalAlignment="Center" VerticalAlignment="Center"  Content="Set"/>
+                        <Button IsEnabled="{Binding IsEnabled}" Style="{StaticResource SysBtnStyle}" Command="{Binding CAPumpSpeedSetCommand}" Height="30" Width="50" Margin="0,0,10,0" HorizontalAlignment="Center" VerticalAlignment="Center"  Content="Set"/>
                     </Grid>
                 </Grid>
             </GroupBox>
-            <GroupBox Header="Status" Grid.Row="4" Grid.Column="2" Grid.ColumnSpan="2" Grid.RowSpan="2" HorizontalAlignment="Right" Height="230" VerticalAlignment="Center" Margin="0,0,0,40">
+            <GroupBox Header="Status" Grid.Row="4" Grid.Column="2" Grid.ColumnSpan="2" Grid.RowSpan="2" HorizontalAlignment="Right" Height="190" VerticalAlignment="Center" Margin="0,0,50,150">
                 <Grid>
                     <Grid.RowDefinitions>
-                        <RowDefinition Height="50"/>
-                        <RowDefinition Height="50"/>
-                        <RowDefinition Height="50"/>
-                        <RowDefinition Height="50"/>
+                        <RowDefinition Height="40"/>
+                        <RowDefinition Height="40"/>
+                        <RowDefinition Height="40"/>
+                        <RowDefinition Height="40"/>
                     </Grid.RowDefinitions>
                     <Grid.ColumnDefinitions>
                         <ColumnDefinition Width="200"></ColumnDefinition>
@@ -253,21 +267,41 @@
                     </Grid>
 
                     <Grid Grid.Row="0" Grid.Column="1">
-                        <Ellipse Grid.Column="0" Width="16" Height="16" HorizontalAlignment="Right" Margin="0 0 70 0"  Fill="{Binding IsDIReplenFault, Converter={StaticResource boolToRedColor}}" Stroke="Silver"/>
+                        <Ellipse Grid.Column="0" Width="16" Height="16" HorizontalAlignment="Right" Margin="0 0 70 0"  Fill="{Binding CommonSafetyData.Reservoir12CAPumpEdm,Converter={StaticResource boolToRedGreenColor}}" Stroke="Silver"/>
                     </Grid>
                     <Grid Grid.Row="1" Grid.Column="1">
-                        <Ellipse Grid.Column="0" Width="16" Height="16" HorizontalAlignment="Right" Margin="0 0 70 0"  Fill="{Binding IsDIReplenFault, Converter={StaticResource boolToRedColor}}" Stroke="Silver"/>
+                        <Ellipse Grid.Column="0" Width="16" Height="16" HorizontalAlignment="Right" Margin="0 0 70 0"   Fill="{Binding CommonSafetyData.Reservoir1CALevelHigh,Converter={StaticResource boolToGreenRedColor}}" Stroke="Silver"/>
                     </Grid>
                     <Grid Grid.Row="2" Grid.Column="1">
-                        <Ellipse Grid.Column="0" Width="16" Height="16" HorizontalAlignment="Right" Margin="0 0 70 0"  Fill="{Binding IsDIReplenFault, Converter={StaticResource boolToRedColor}}" Stroke="Silver"/>
+                        <Ellipse Grid.Column="0" Width="16" Height="16" HorizontalAlignment="Right" Margin="0 0 70 0"  Fill="{Binding CommonSafetyData.PlatingCell12LeakDetected,Converter={StaticResource boolToYellowColor}}"  Stroke="Silver"/>
                     </Grid>
                     <Border Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" Background="Black" Width="80" Height="30" Margin="80 0 0 0">
-                        <TextBlock Text="{Binding DIValveMaxOnTime,StringFormat={}{0} sec}" Foreground="Lime" FontSize="14" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center"/>
+                        <TextBlock Text="{Binding CurrentRecipe.Metal}" Foreground="Lime" FontSize="14" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                     </Border>
                 </Grid>
             </GroupBox>
             <Grid Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3" Grid.RowSpan="3" Margin="200,0,0,0">
-                <userControls:DMReservoirUIControl >
+                <userControls:DMReservoirUIControl
+                    ModuleName="{Binding Module}"
+                    ANIsolationValve="True"
+                    CAIsolationValve="True"
+                    ReturnFlowValve="{Binding ReservoirData.ReturnValveOpening}"
+                    DegasValve="True"
+                    SampleValve="{Binding ReservoirData.SampleOut}"
+                    IsANPumpOpen="{Binding ReservoirData.AnPumpEnable}"
+                    IsCAPumpOpen="{Binding ReservoirData.CaPumpRunning}"
+                    IsCALevelHigh="True"
+                    IsCALevelLow="True"
+                    IsANLevelHigh="{Binding ReservoirData.AnTowerHigh}"
+                    IsANLevelLow="{Binding ReservoirData.CaWaterLevel}"
+                    ANFlow="0"
+                    CAFlow="0"
+                    CALevel="{Binding ReservoirData.CaLevel}"
+                    CALevelRaw="{Binding ReservoirData.CaLevel}"
+                    ReservoirTemperature ="{Binding TemperatureControlData.ReserviorTemperature}"
+                    TCStatus ="{Binding TemperatureControlData.Status}"
+                    TCEnableStatus ="{Binding TCEnableStatus}"
+                    >
                     
                 </userControls:DMReservoirUIControl>
             </Grid>

+ 3 - 3
PunkHPX8_MainPages/Views/ResRecipeView.xaml

@@ -245,9 +245,9 @@
                                             <ColumnDefinition Width="220"></ColumnDefinition>
                                             <ColumnDefinition/>
                                         </Grid.ColumnDefinitions>
-                                        <UserControls:GroupDigitalBoxControl Grid.Column="0" Grid.Row="0" Title="AN Flow Set Point" Unit="L/min" MinValue="0" MaxValue="1" DigitalValue="{Binding Recipe.ANFlowSetPoint,Mode=TwoWay}" ValidResult="{Binding PropertyValidResultDic[ANFlowSetPoint],Mode=TwoWay}" Width="220"/>
-                                        <UserControls:GroupDigitalBoxControl Grid.Column="0" Grid.Row="1" Title="AN Flow Rate Warning Low" Unit="L/min" MinValue="0" MaxValue="1" DigitalValue="{Binding Recipe.ANFlowRateWarningLow,Mode=TwoWay}" ValidResult="{Binding PropertyValidResultDic[ANFlowRateWarningLow],Mode=TwoWay}" Width="220"/>
-                                        <UserControls:GroupDigitalBoxControl Grid.Column="0" Grid.Row="2" Title="AN Flow Rate Error Low" Unit="L/min" MinValue="0" MaxValue="1" DigitalValue="{Binding Recipe.ANFlowRateErrorLow,Mode=TwoWay}" ValidResult="{Binding PropertyValidResultDic[ANFlowRateErrorLow],Mode=TwoWay}" Width="220"/>
+                                        <UserControls:GroupDigitalBoxControl Grid.Column="0" Grid.Row="0" Title="AN Flow Set Point" Unit="L/min" MinValue="0" MaxValue="150" DigitalValue="{Binding Recipe.ANFlowSetPoint,Mode=TwoWay}" ValidResult="{Binding PropertyValidResultDic[ANFlowSetPoint],Mode=TwoWay}" Width="220"/>
+                                        <UserControls:GroupDigitalBoxControl Grid.Column="0" Grid.Row="1" Title="AN Flow Rate Warning Low" Unit="L/min" MinValue="0" MaxValue="150" DigitalValue="{Binding Recipe.ANFlowRateWarningLow,Mode=TwoWay}" ValidResult="{Binding PropertyValidResultDic[ANFlowRateWarningLow],Mode=TwoWay}" Width="220"/>
+                                        <UserControls:GroupDigitalBoxControl Grid.Column="0" Grid.Row="2" Title="AN Flow Rate Error Low" Unit="L/min" MinValue="0" MaxValue="150" DigitalValue="{Binding Recipe.ANFlowRateErrorLow,Mode=TwoWay}" ValidResult="{Binding PropertyValidResultDic[ANFlowRateErrorLow],Mode=TwoWay}" Width="220"/>
                                     </Grid>
                                 </GroupBox>
                             </Grid>

+ 2 - 1
PunkHPX8_MainPages/Views/ReservoirsCatholyteView.xaml

@@ -55,7 +55,8 @@
                 <Grid Grid.Row="2" Grid.Column="3">
                     <ctrls:OperatingModeControl HorizontalAlignment="Left" Margin="10,0,0,0" VerticalAlignment="Top" 
                                            ModuleName="{Binding Module}"
-                                           OperationModeValue="{Binding ReservoirsPersistent.OperatingMode}"/>
+                                           OperationModeValue="{Binding ReservoirsPersistent.OperatingMode}"
+                                                />
                 </Grid>
                 <Grid Grid.Row="1" Grid.Column="3">
                     <Grid.RowDefinitions>

+ 5 - 2
PunkHPX8_MainPages/Views/ReservoirsView.xaml

@@ -50,8 +50,11 @@
                                                    ResRecipeCommonData="{Binding  CurrentRecipe}"/>
                 </Grid>
                 <Grid Grid.Row="1" Grid.Column="1" Grid.RowSpan="2" Margin="10 0 0 0">
-                    <ctrls:RecipeLoad Margin="10,10,0,0" Module="{Binding Module}" HeadName="Res Recipe"
-                                  RecipeType="{Binding RecipeType}" IsEnabled="{Binding IsEnabled}"
+                    <ctrls:RecipeLoad Margin="10,10,0,0" 
+                                  Module="{Binding Module}" 
+                                  HeadName="Res Recipe"
+                                  RecipeType="{Binding RecipeType}" 
+                                  IsEnabled="{Binding IsEnabled}"
                                   SelectedRecipeNode="{Binding SelectedRecipeNode,Mode=TwoWay}"
                                   RecipeModeValue="{Binding ReservoirsPersistent.RecipeOperatingMode}" />
                 </Grid>

+ 2 - 2
PunkHPX8_RT/Config/Layout/ToolLayoutConfiguration.xml

@@ -160,7 +160,7 @@
 			<ReservoirID>1</ReservoirID>
 			<Size>2</Size>
 			<TCID>TC1-1</TCID>
-			<SubType>Stratus</SubType>
+			<SubType>DM</SubType>
 			<PHProbeChannelNumber>1</PHProbeChannelNumber>
 			<PlannedInitialChemistry>Ni</PlannedInitialChemistry>
 			<PlatingCells>
@@ -173,7 +173,7 @@
 					<PlatingPowerSupplyAID>Power13-1</PlatingPowerSupplyAID>
 					<PlatingPowerSupplyBID>Power14-1</PlatingPowerSupplyBID>
 					<LinmotID>LNM3-2</LinmotID>
-					<SubType>Stratus</SubType>
+					<SubType>DM</SubType>
 				</Item>
 			</PlatingCells>
 			<CellPosition>13</CellPosition>

+ 21 - 2
PunkHPX8_RT/Devices/DeviceManager.cs

@@ -13,6 +13,7 @@ using PunkHPX8_RT.Devices.EFEM;
 using PunkHPX8_RT.Devices.Facilities;
 using PunkHPX8_RT.Devices.LinMot;
 using PunkHPX8_RT.Devices.PowerSupplier;
+using PunkHPX8_RT.Devices.Reservoir;
 using PunkHPX8_RT.Devices.Resistivity;
 using PunkHPX8_RT.Devices.Safety;
 using PunkHPX8_RT.Devices.SignalLight;
@@ -39,7 +40,6 @@ namespace PunkHPX8_RT.Instances
     public class DeviceManager : DeviceManagerBase
     {
         #region 常量
-        private const string STRATUS = "Stratus";
         #endregion
         /// <summary>
         /// 初始化
@@ -67,6 +67,7 @@ namespace PunkHPX8_RT.Instances
             InitializeTemperature();
             InitializePowerSuppliers();
             InitializeVpw();
+            InitializeReservoir();
             SystemFacilities systemFacilities = new SystemFacilities();
             AddCustomModuleDevice(systemFacilities);
 
@@ -129,7 +130,25 @@ namespace PunkHPX8_RT.Instances
         /// </summary>
         private void InitializeReservoir()
         {
-
+            foreach (string item in ReservoirItemManager.Instance.InstalledModules)
+            {
+                ReservoirItem reservoirItem = ReservoirItemManager.Instance.GetReservoirItem(item);
+                if (reservoirItem.SubType == "DM")
+                {
+                    DMReservoirDevice reservoirDevice = new DMReservoirDevice(item);
+                    AddCustomDevice(reservoirDevice);
+                }
+                else if(reservoirItem.SubType == "HS")
+                {
+                    HSReservoirDevice reservoirDevice = new HSReservoirDevice(item);
+                    AddCustomDevice(reservoirDevice);
+                }
+                else
+                {
+                    DIReservoirDevice reservoirDevice = new DIReservoirDevice(item);
+                    AddCustomDevice(reservoirDevice);
+                }
+            }
         }
         /// <summary>
         /// 初始化LinMotAxis

+ 26 - 4
PunkHPX8_RT/Devices/Reservoir/ReservoirDevice.cs

@@ -236,7 +236,8 @@ namespace PunkHPX8_RT.Devices.Reservoir
         private void SubscribeData()
         {
             DATA.Subscribe($"{Module}.ReservoirData", () => _reservoirData, SubscriptionAttribute.FLAG.IgnoreSaveDB);
-
+            DATA.Subscribe($"{Module}.PersistentValue", () => _persistentValue, SubscriptionAttribute.FLAG.IgnoreSaveDB);
+            DATA.Subscribe($"{Module}.CurrentRecipe", () => _resRecipe, SubscriptionAttribute.FLAG.IgnoreSaveDB);
         }
         /// <summary>
         /// 初始化Operation
@@ -251,6 +252,7 @@ namespace PunkHPX8_RT.Devices.Reservoir
             OP.Subscribe($"{Module}.CAPumpOn", CAPumpOn);
             OP.Subscribe($"{Module}.CAPumpSpeed", CAPumpSpeedOperation);
             OP.Subscribe($"{Module}.CAPumpOff", CAPumpOff);
+            OP.Subscribe($"{Module}.LoadRecipe", LoadRecipeOperation);
         }
         /// <summary>
         /// 订阅变量数值发生变化
@@ -311,9 +313,9 @@ namespace PunkHPX8_RT.Devices.Reservoir
         /// <returns></returns>
         protected virtual bool OnTimer()
         {
-            CalculateCALevel();
-            WaterLevelMonitor();
-            DireplenMonitor();
+            //CalculateCALevel();
+            //WaterLevelMonitor();
+            //DireplenMonitor();
             return true;
         }
         #region timer
@@ -574,6 +576,26 @@ namespace PunkHPX8_RT.Devices.Reservoir
             ReservoirsPersistentManager.Instance.UpdatePersistentValue(Module);
             return true;
         }
+        /// <summary>
+        /// 加载Recipe
+        /// </summary>
+        /// <param name="cmd"></param>
+        /// <param name="args"></param>
+        /// <returns></returns>
+        private bool LoadRecipeOperation(string cmd, object[] args)
+        {
+            _persistentValue.Recipe = args[0].ToString();
+            string[] fileRoute = _persistentValue.Recipe.Split('\\');
+            string recipeRoute = "";
+            if (fileRoute.Length > 2)
+            {
+                recipeRoute = fileRoute[fileRoute.Length - 2];
+            }
+            _resRecipe = RecipeFileManager.Instance.LoadGenericityRecipe<ResRecipe>(_persistentValue.Recipe);
+            ReservoirsPersistentManager.Instance.UpdatePersistentValue(Module.ToString());
+            LOG.WriteLog(eEvent.INFO_RESERVOIR, Module.ToString(), $"Load {recipeRoute} Recipe {_resRecipe.Ppid} Success");
+            return true;
+        }
         #endregion
 
         /// <summary>

+ 4 - 1
PunkHPX8_RT/Modules/Reservoir/ReservoirEntity.cs

@@ -1,6 +1,8 @@
-using Aitex.Core.RT.Fsm;
+using Aitex.Core.RT.DataCenter;
+using Aitex.Core.RT.Fsm;
 using Aitex.Core.RT.Log;
 using Aitex.Core.RT.RecipeCenter;
+using Aitex.Core.Util;
 using Aitex.Core.Utilities;
 using MECF.Framework.Common.Equipment;
 using MECF.Framework.Common.Persistent.Reservoirs;
@@ -178,6 +180,7 @@ namespace PunkHPX8_RT.Modules.Reservoir
         /// </summary>
         private void InitializeDATA()
         {
+            DATA.Subscribe($"{Module}.FsmState", () => ((ReservoirState)fsm.State).ToString(), SubscriptionAttribute.FLAG.IgnoreSaveDB);
         }
         /// <summary>
         /// 初始化Operation

+ 4 - 4
PunkHPX8_Themes/UserControls/DMReservoirUIControl.xaml

@@ -147,13 +147,13 @@
                 <Label Content="CA Level" FontSize="12" FontWeight="Bold" VerticalContentAlignment="Center" HorizontalContentAlignment="Left" VerticalAlignment="Center" HorizontalAlignment="Center"/>
             </Grid>
             <Border Grid.Row="1" Grid.Column="0" Margin="5,0,15,5" Background="Black" Width="100">
-                <TextBlock Text="{Binding ElementName=self,Path=CALevel, StringFormat={}{0:F2} L}" Foreground="Lime" FontSize="12" FontWeight="Bold" HorizontalAlignment="Left" VerticalAlignment="Center"/>
+                <TextBlock Text="{Binding ElementName=self,Path=CALevel, StringFormat={}{0:F2} L}" Foreground="Lime" FontSize="12" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center"/>
             </Border>
             <Grid Grid.Row="2" Grid.Column="0">
                 <Label Content="CA LevelRaw" FontSize="12" FontWeight="Bold" VerticalContentAlignment="Center" HorizontalContentAlignment="Left" VerticalAlignment="Center" HorizontalAlignment="Center"/>
             </Grid>
             <Border Grid.Row="3" Grid.Column="0" Margin="5,0,15,5" Background="Black" Width="100">
-                <TextBlock Text="{Binding ElementName=self,Path=CALevelRaw, StringFormat={}{0:F2} %}" Foreground="Lime" FontSize="12" FontWeight="Bold" HorizontalAlignment="Left" VerticalAlignment="Center"/>
+                <TextBlock Text="{Binding ElementName=self,Path=CALevelRaw, StringFormat={}{0:F2} %}" Foreground="Lime" FontSize="12" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center"/>
             </Border>
             <Grid Grid.Row="4" Grid.Column="0">
                 <Label Content="High" FontSize="12" FontWeight="Bold" HorizontalContentAlignment="Left" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,0,25,0"/>
@@ -165,8 +165,8 @@
                 <Ellipse Margin="61,2,20,2"  Width="16" Height="16" Fill="{Binding ElementName=self,Path=IsCALevelLow,Converter={StaticResource boolToRedGreenColor}}"  Stroke="Gray"/>
             </Grid>
         </Grid>
-        <ctrls:TextboxWithLabel  Canvas.Top="368" Canvas.Left="274" LabelValue="AN Flow"   TextBoxValue="{Binding ANFlow, StringFormat={}{0:F2} L/min}" TextBoxColor="Black" HorizontalAlignment="Center" VerticalAlignment="Top" />
-        <ctrls:TextboxWithLabel  Canvas.Top="268" Canvas.Left="474" LabelValue="CA Flow"   TextBoxValue="{Binding ANFlow, StringFormat={}{0:F2} L/min}" TextBoxColor="Black" HorizontalAlignment="Center" VerticalAlignment="Top" />
+        <ctrls:TextboxWithLabel  Canvas.Top="368" Canvas.Left="274" LabelValue="AN Flow"   TextBoxValue="{Binding ANFlow, StringFormat={}{0:F2} L/min,ElementName=self}" TextBoxColor="Black" HorizontalAlignment="Center" VerticalAlignment="Top" />
+        <ctrls:TextboxWithLabel  Canvas.Top="268" Canvas.Left="474" LabelValue="CA Flow"   TextBoxValue="{Binding CAFlow, StringFormat={}{0:F2} L/min,ElementName=self}" TextBoxColor="Black" HorizontalAlignment="Center" VerticalAlignment="Top" />
 
         <Ellipse Canvas.Left="100" Canvas.Top="20" Width="16" Height="16"  Fill="{Binding IsANLevelHigh, Converter={StaticResource boolToRedColor}}" Stroke="Silver"/>
         <Ellipse Canvas.Left="100" Canvas.Top="120" Width="16" Height="16"  Fill="{Binding IsANLevelLow, Converter={StaticResource boolToRedColor}}" Stroke="Silver"/>

+ 5 - 3
PunkHPX8_Themes/UserControls/RecipeModeControl.xaml.cs

@@ -76,9 +76,9 @@ namespace PunkHPX8_Themes.UserControls
             }
         }
         public static readonly DependencyProperty RecipeModeValueProperty = DependencyProperty.Register(
-           "RecipeModeValue", typeof(string), typeof(RecipeModeControl), new FrameworkPropertyMetadata("", new PropertyChangedCallback(OnItemsSourceChanged)));
+           "RecipeModeValue", typeof(string), typeof(RecipeModeControl), new FrameworkPropertyMetadata(null, new PropertyChangedCallback(OnRecipeModeValueChanged)));
         /// <summary>
-        /// OpertationModeValue
+        /// RecipeModeValue
         /// </summary>
         public string RecipeModeValue
         {
@@ -92,8 +92,10 @@ namespace PunkHPX8_Themes.UserControls
             }
         }
 
-        private static void OnItemsSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+        private static void OnRecipeModeValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
         {
+            string moduleName = (string)d.GetValue(ModuleNameProperty);
+            RecipeModeControl control = (RecipeModeControl)d;
             if (e.NewValue != null)
             {
                 string currentMode = (string)e.NewValue;