Просмотр исходного кода

10L反应釜界面修改

HK研究所反应釜三屏显示
ZhaoGang 1 неделю назад
Родитель
Сommit
3dc8f3ab21
9 измененных файлов: 459 добавлений и 583 удалений
  1. +3
    -1
      BPASmartClient.Academy/50L/AddData.cs
  2. +3
    -1
      BPASmartClient.Academy/50L/BoolAddEnum.cs
  3. +3
    -1
      BPASmartClient.Academy/50L/FloatAddEnum.cs
  4. +88
    -0
      BPASmartClient.Academy/Model/Enum_10L/BoolAddr_10L.cs
  5. +41
    -2
      BPASmartClient.Academy/Model/Simens_PLC.cs
  6. +1
    -1
      BPASmartClient.Academy/ShareModel/AddAttribute.cs
  7. +226
    -563
      BPASmartClient.Academy/View/DeviceMotion_2View.xaml
  8. +52
    -1
      BPASmartClient.Academy/View/DeviceMotion_2View.xaml.cs
  9. +42
    -13
      BPASmartClient.Academy/View/ReactionKettle50LView.xaml

+ 3
- 1
BPASmartClient.Academy/50L/AddData.cs Просмотреть файл

@@ -1,4 +1,6 @@
using System;
using BPASmartClient.Academy.ShareModel;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;


+ 3
- 1
BPASmartClient.Academy/50L/BoolAddEnum.cs Просмотреть файл

@@ -1,4 +1,6 @@
using System;
using BPASmartClient.Academy.ShareModel;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


+ 3
- 1
BPASmartClient.Academy/50L/FloatAddEnum.cs Просмотреть файл

@@ -1,4 +1,6 @@
using System;
using BPASmartClient.Academy.ShareModel;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


+ 88
- 0
BPASmartClient.Academy/Model/Enum_10L/BoolAddr_10L.cs Просмотреть файл

@@ -0,0 +1,88 @@
using BPASmartClient.Academy.ShareModel;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.Academy.Model.Enums_10L
{
public enum BoolAddr_10L
{
[Add("DB1.DBX1000.0")]
配料罐搅拌电机,
[Add("DB1.DBX1000.1")]
反应釜搅拌电机,
[Add("DB1.DBX1000.2")]
真空泵,
[Add("DB1.DBX1000.3")]
进料阀,
[Add("DB1.DBX1000.4")]
蒸馏阀,
[Add("DB1.DBX1000.5")]
回油阀,
[Add("DB1.DBX1000.6")]
回水阀,
[Add("DB1.DBX1000.7")]
汇馏阀,
[Add("DB1.DBX1001.0")]
排馏阀,
[Add("DB1.DBX1001.1")]
冷凝器冷却阀,
[Add("DB1.DBX1001.2")]
配料釜蒸汽阀,
[Add("DB1.DBX1001.3")]
反应釜蒸汽阀,
[Add("DB1.DBX1001.4")]
反应釜蒸汽疏水阀,
[Add("DB1.DBX1001.5")]
反应釜冷却水阀,
[Add("DB1.DBX1001.6")]
配料罐自动升温,
[Add("DB1.DBX1001.7")]
反应釜自动升温,
[Add("DB1.DBX1002.0")]
系统启动,
[Add("DB1.DBX1002.1")]
手自动,
[Add("DB1.DBX1002.2")]
反应釜冷却水排水阀,
[Add("DB1.DBX1002.3")]
分馏真空阀,
[Add("DB1.DBX1002.4")]
蒸馏真空阀,
[Add("DB1.DBX1002.5")]
空压机启动,
[Add("DB1.DBX1002.6")]
备用_1,
[Add("DB1.DBX1002.7")]
水罐重量清零,
[Add("DB1.DBX1003.0")]
反应釜自动降温,
[Add("DB1.DBX1003.1")]
反应釜出料阀,
[Add("DB1.DBX1003.2")]
反应釜排空阀,
[Add("DB1.DBX1003.3")]
配料釜蒸汽输水旁通阀,
[Add("DB1.DBX1003.4")]
反应釜蒸汽输水旁通阀,
[Add("DB1.DBX1003.5")]
备用_2,
[Add("DB1.DBX1003.6")]
备用_3,
[Add("DB1.DBX1003.7")]
心跳,
[Add("DB1.DBX3000.0")]
闪蒸,
[Add("DB1.DBX3000.1")]
真空蒸馏,
[Add("DB1.DBX3000.2")]
真空下料,
[Add("DB1.DBX3000.3")]
二次闪蒸,
[Add("DB1.DBX3000.4")]
排空阀,
}
}

+ 41
- 2
BPASmartClient.Academy/Model/Simens_PLC.cs Просмотреть файл

@@ -15,6 +15,10 @@ using System.Text;
using System.Threading.Tasks;
using static Org.BouncyCastle.Asn1.Cmp.Challenge;
using Org.BouncyCastle.Asn1.Crmf;
using BPASmartClient.Academy.Model.Enums_10L;
using BPASmartClient.Academy.ShareModel;
using System.Reflection;
using BPA.Communication.Interfaces;

namespace BPASmartClient.Academy.Model
{
@@ -23,7 +27,7 @@ namespace BPASmartClient.Academy.Model
private static Simens_PLC _instance;
public static Simens_PLC GetInstance { get; set; } = _instance ??= new Simens_PLC();
private Simens_PLC() { }
protected Dictionary<BoolAddr_10L, string> boolAdds { get;private set; } = new Dictionary<BoolAddr_10L, string>();
public DataFeedback dataFeedback { get; set; } = new DataFeedback();
public PipeLineMode PipeLine { get; set; } = new PipeLineMode();
public string id { get; set; } = "";
@@ -69,6 +73,7 @@ namespace BPASmartClient.Academy.Model
public void Init()
{
AlarmInfoGet();
boolAdds = GetAdd<BoolAddr_10L>();
}
public void AlarmInfoGet()
{
@@ -474,6 +479,40 @@ namespace BPASmartClient.Academy.Model

Thread.Sleep(3000);
}

public OperateResult Write(BoolAddr_10L add, bool value)
{
if (boolAdds.ContainsKey(add))
{
return siemens.Write(boolAdds[add], value);
}
else
{
return OperateResult.Failed($"未查找到该地址{add.ToString()}");
}
}
private Dictionary<T, string> GetAdd<T>() where T : Enum
{
Dictionary<T, string> result = new Dictionary<T, string>();
Type type = typeof(T);
Enum.GetNames(typeof(T)).ToList().ForEach(x =>
{
MemberInfo[] memberInfo = type.GetMember(x);
if (memberInfo != null && memberInfo.Length > 0)
{
var attribute = memberInfo[0].GetCustomAttribute<AddAttribute>();
if (attribute != null)
{
if (x.TryToEnum<T>(out T eu))
{
if (!result.ContainsKey(eu))
{
result.Add(eu, attribute.Add);
}
}
}
}
});
return result;
}
}
}

BPASmartClient.Academy/50L/AddAttribute.cs → BPASmartClient.Academy/ShareModel/AddAttribute.cs Просмотреть файл

@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.Academy._50L
namespace BPASmartClient.Academy.ShareModel
{
public class AddAttribute : Attribute
{

+ 226
- 563
BPASmartClient.Academy/View/DeviceMotion_2View.xaml
Разница между файлами не показана из-за своего большого размера
Просмотреть файл


+ 52
- 1
BPASmartClient.Academy/View/DeviceMotion_2View.xaml.cs Просмотреть файл

@@ -1,4 +1,7 @@
using BPASmartClient.CustomResource.UserControls.MessageShow;
using BPASmartClient.Academy.CustomControls;
using BPASmartClient.Academy.Dialogs.Views;
using BPASmartClient.Academy.Model.Enums_10L;
using BPASmartClient.CustomResource.UserControls.MessageShow;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -394,5 +397,53 @@ namespace BPASmartClient.Academy.View
}

}

private void Notify(EnumPromptType promptType, string title, string msg)
{
App.Current.Dispatcher.Invoke(new Action(() =>
{
NoticeDemoViewModel.OpenMsg(promptType, App.Current.MainWindow, title, msg);
}));
MessageNotify.GetInstance.ShowRunLog($"人工介入:" + msg);
}

private void ValveWithCommandState_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
if (e.Source is ValveWithCommandState valve)
{
if (Simens_PLC.GetInstance.IsConnected && valve.Tag != null && !string.IsNullOrWhiteSpace(valve.Tag.ToString().Trim()))
{
var tag = valve.Tag.ToString().Trim();
BoolAddr_10L addr = (BoolAddr_10L)Enum.Parse(typeof(BoolAddr_10L), tag);
DeviceControlView.Show(tag, "未知", valve.OpenEnable ? "打开" : "关闭", new Action(() =>
{
var result = Simens_PLC.GetInstance.Write(addr, true);
if (result != null && result.IsSuccess)
{
Notify(EnumPromptType.Success, $"写入成功", $"成功:写入{tag}:True");
}
else
{
Notify(EnumPromptType.Error, $"写入失败", $"失败:写入{tag}:True\n{result.Message}");
}
}), new Action(() =>
{
var result = Simens_PLC.GetInstance.Write(addr, false);
if (result != null && result.IsSuccess)
{
Notify(EnumPromptType.Success, $"写入成功", $"成功:写入{tag}:False");
}
else
{
Notify(EnumPromptType.Error, $"写入失败", $"失败:写入{tag}:False\n{result.Message}");
}
}));
}
else
{
Notify(EnumPromptType.Error, "失败", "设备未连接,不可进行控制。");
}
}
}
}
}

+ 42
- 13
BPASmartClient.Academy/View/ReactionKettle50LView.xaml Просмотреть файл

@@ -170,7 +170,7 @@
<Storyboard AutoReverse="False" RepeatBehavior="Forever">
<DoubleAnimation
AutoReverse="False" RepeatBehavior="Forever" Storyboard.TargetName="rotateTransform"
Storyboard.TargetProperty="Angle" From="0" To="360" Duration="0:0:0.6" />
Storyboard.TargetProperty="Angle" From="360" To="0" Duration="0:0:0.6" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
@@ -303,9 +303,9 @@
<bpa:PipeLineH
Canvas.Left="133" Canvas.Top="69" Width="152" Height="10"
HorizontalAlignment="Left" VerticalAlignment="Center" d:Direction="1"
Direction="{Binding DeviceStatus.ColdWaterTankVacuumValve, ConverterParameter=1, Converter={StaticResource deviceConvert}}"
Direction="{Binding DeviceStatus.ColdWaterTankVacuumValve, ConverterParameter=5, Converter={StaticResource deviceConvert}}"
Fill="{Binding DeviceStatus.ColdWaterTankVacuumValve, ConverterParameter=2, Converter={StaticResource deviceConvert}}"
LineWidth="1" />
LineWidth="2" />
<!--#region 开关控制按钮-->
<bpa:PipeLineH
Canvas.Left="115" Canvas.Top="456" Canvas.Right="257.5" Width="95"
@@ -729,18 +729,19 @@
<bpa:PipeLineH
Canvas.Left="601" Canvas.Top="215" Canvas.Right="339.4" Width="78"
Height="10" HorizontalAlignment="Left" VerticalAlignment="Center"
Direction="{Binding DeviceStatus.HotGasEmptyValve, ConverterParameter=1, Converter={StaticResource deviceConvert}}"
Direction="{Binding DeviceStatus.HotGasEmptyValve, ConverterParameter=5, Converter={StaticResource deviceConvert}}"
Fill="{Binding DeviceStatus.HotGasEmptyValve, ConverterParameter=2, Converter={StaticResource deviceConvert}}"
LineWidth="1" Speed="0.23" />
LineWidth="2" Speed="0.23" />
<cc:ValveWithCommandState
Canvas.Left="636" Canvas.Top="200" Canvas.Right="343.4" Width="32"
Height="32" HorizontalAlignment="Center" VerticalAlignment="Top"
Canvas.Left="627" Canvas.Top="200" Canvas.Right="343.4" Width="32"
Height="32" HorizontalAlignment="Left" VerticalAlignment="Center"
CommandColor="{Binding DeviceStatus.IsSetHotGasEmptyValve, Converter={StaticResource BoolToColorConverter}}"
EdgeColor="{Binding DeviceStatus.HotGasEmptyValve, ConverterParameter=2, Converter={StaticResource deviceConvert}}"
OpenEnable="{Binding DeviceStatus.HotGasEmptyValve}"
Tag="热气排空阀" />
<TextBlock
Canvas.Left="639" Canvas.Top="192" Canvas.Right="312.8" d:Visibility="Visible"
Canvas.Left="619" Canvas.Top="188" Canvas.Right="312.8" HorizontalAlignment="Left"
d:Visibility="Visible"
Style="{StaticResource ValveAnnotationTextStyle}"
Text="热气排空阀" />
<!--#region 抽真空阀-->
@@ -749,7 +750,7 @@
Height="10" HorizontalAlignment="Center" VerticalAlignment="Top" d:Direction="2"
Direction="{Binding DeviceStatus.ReactOutHotGasValve, ConverterParameter=5, Converter={StaticResource deviceConvert}}"
Fill="{Binding DeviceStatus.ReactOutHotGasValve, ConverterParameter=2, Converter={StaticResource deviceConvert}}"
LineWidth="1" />
LineWidth="2" />
<bpa:PipeLineTR
Canvas.Left="591" Canvas.Top="290.5" Canvas.Right="399.2" Width="20"
Height="20" HorizontalAlignment="Center" VerticalAlignment="Top"
@@ -834,6 +835,10 @@
Canvas.Left="388" Canvas.Top="322" d:Visibility="Visible"
Style="{StaticResource ValveAnnotationTextStyle}"
Text="冷却水、疏水" />
<TextBlock
Canvas.Left="304" Canvas.Top="349"
Visibility="Visible" Foreground="White"
Text="排水" />
<!--#region 进清水阀、进卤水阀、压缩空气进气阀进连接处-->
<bpa:PipeLineV
Canvas.Left="751.7" Canvas.Top="224.571" Canvas.Right="243.3" Width="10"
@@ -977,15 +982,15 @@
<bpa:PipeLineBL
Canvas.Left="285" Canvas.Top="69" Width="20" Height="20"
HorizontalAlignment="Left" VerticalAlignment="Center"
Direction="{Binding DeviceStatus.ColdWaterTankVacuumValve, ConverterParameter=1, Converter={StaticResource deviceConvert}}"
Direction="{Binding DeviceStatus.ColdWaterTankVacuumValve, ConverterParameter=5, Converter={StaticResource deviceConvert}}"
Fill="{Binding DeviceStatus.ColdWaterTankVacuumValve, ConverterParameter=2, Converter={StaticResource deviceConvert}}"
LineWidth="10" Speed="1" />
<bpa:PipeLineH
Canvas.Left="74" Canvas.Top="69" Width="54" Height="10"
HorizontalAlignment="Left" VerticalAlignment="Center" d:Direction="1"
Direction="{Binding DeviceStatus.Fans, ConverterParameter=1, Converter={StaticResource deviceConvert}}"
Direction="{Binding DeviceStatus.Fans, ConverterParameter=5, Converter={StaticResource deviceConvert}}"
Fill="{Binding DeviceStatus.Fans, ConverterParameter=2, Converter={StaticResource deviceConvert}}"
LineWidth="1" />
LineWidth="2" Speed="2" />
<CheckBox
Canvas.Left="-1" Canvas.Top="49" Width="92" Height="81"
HorizontalAlignment="Left" VerticalAlignment="Top"
@@ -1287,7 +1292,7 @@
<bpa:PipeLineTR
Canvas.Left="591" Canvas.Top="210" Canvas.Right="399.2" Width="20"
Height="20" HorizontalAlignment="Center" VerticalAlignment="Top" d:Direction="1"
Direction="{Binding DeviceStatus.HotGasEmptyValve, ConverterParameter=1, Converter={StaticResource deviceConvert}}"
Direction="{Binding DeviceStatus.HotGasEmptyValve, ConverterParameter=5, Converter={StaticResource deviceConvert}}"
Fill="{Binding DeviceStatus.HotGasEmptyValve, ConverterParameter=2, Converter={StaticResource deviceConvert}}"
LineWidth="10" Speed="1.5" />
<TextBlock
@@ -1345,6 +1350,30 @@
Direction="{Binding DeviceStatus.ColdWaterTankInWaterValve, ConverterParameter=1, Converter={StaticResource deviceConvert}}"
Fill="{Binding DeviceStatus.ColdWaterTankInWaterValve, ConverterParameter=6, Converter={StaticResource deviceConvert}}"
LineWidth="10" Speed="2" />
<bpa:PipeLineTR
Canvas.Left="679" Canvas.Top="205" Canvas.Right="399.2" Width="20"
Height="20" HorizontalAlignment="Center" VerticalAlignment="Top" d:Direction="2"
Direction="{Binding DeviceStatus.HotGasEmptyValve, ConverterParameter=5, Converter={StaticResource deviceConvert}}"
Fill="{Binding DeviceStatus.HotGasEmptyValve, ConverterParameter=2, Converter={StaticResource deviceConvert}}"
LineWidth="10" RenderTransformOrigin="0.5,0.5" Speed="1.5">
<bpa:PipeLineTR.RenderTransform>
<TransformGroup>
<RotateTransform Angle="-90" />
</TransformGroup>
</bpa:PipeLineTR.RenderTransform>
</bpa:PipeLineTR>
<bpa:PipeLineTR
Canvas.Left="689" Canvas.Top="185" Canvas.Right="399.2" Width="20"
Height="20" HorizontalAlignment="Left" VerticalAlignment="Top" d:Direction="1"
Direction="{Binding DeviceStatus.HotGasEmptyValve, ConverterParameter=1, Converter={StaticResource deviceConvert}}"
Fill="{Binding DeviceStatus.HotGasEmptyValve, ConverterParameter=2, Converter={StaticResource deviceConvert}}"
LineWidth="10" RenderTransformOrigin="0.5,0.5" Speed="1.5">
<bpa:PipeLineTR.RenderTransform>
<TransformGroup>
<RotateTransform Angle="-270" />
</TransformGroup>
</bpa:PipeLineTR.RenderTransform>
</bpa:PipeLineTR>
<!--#endregion-->
</Canvas>
</Viewbox>


Загрузка…
Отмена
Сохранить