taoye 2 anni fa
parent
commit
ddb2a58002
100 ha cambiato i file con 2895 aggiunte e 805 eliminazioni
  1. +0
    -4
      BPASmartClient.Compiler/BPASmartClient.Compiler.csproj
  2. +5
    -0
      BPASmartClient.Compiler/Config.cs
  3. +1
    -1
      BPASmartClient.Compiler/IExecutable.cs
  4. +38
    -0
      BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
  5. BIN
     
  6. BIN
     
  7. BIN
     
  8. BIN
     
  9. BIN
     
  10. BIN
     
  11. BIN
     
  12. BIN
     
  13. BIN
     
  14. BIN
     
  15. BIN
     
  16. BIN
     
  17. BIN
     
  18. BIN
     
  19. BIN
     
  20. BIN
     
  21. BIN
     
  22. BIN
     
  23. BIN
     
  24. +1
    -1
      BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs
  25. +2
    -2
      BPASmartClient.CustomResource/UserControls/Cylinder.xaml
  26. +96
    -0
      BPASmartClient.CustomResource/UserControls/ImageBorder.xaml
  27. +67
    -0
      BPASmartClient.CustomResource/UserControls/ImageBorder.xaml.cs
  28. +6
    -2
      BPASmartClient.MessageName/DataName.cs
  29. +29
    -0
      BPASmartClient.MessageName/Enum/物料仓/SilosRunEnum.cs
  30. +39
    -0
      BPASmartClient.MessageName/Enum/运行状态/RunEnum.cs
  31. +59
    -8
      BPASmartClient.MessageName/MessageName.cs
  32. +2
    -1
      BPASmartClient.SCADAControl/ArcGauge.cs
  33. +2
    -0
      BPASmartClient.SCADAControl/BPASmartClient.SCADAControl.csproj
  34. +146
    -76
      BPASmartClient.SCADAControl/NewConveyorBelt.xaml.cs
  35. +52
    -11
      BPASmartClient.SCADAControl/Silos.xaml
  36. +264
    -13
      BPASmartClient.SCADAControl/Silos.xaml.cs
  37. +9
    -0
      BPASmartClient.SCADAControl/TheButton.xaml
  38. +73
    -0
      BPASmartClient.SCADAControl/TheButton.xaml.cs
  39. +13
    -0
      BPASmartClient.SCADAControl/Themes/Generic.xaml
  40. +17
    -0
      DosingSystem/Model/ConveyorServer.cs
  41. +27
    -0
      DosingSystem/Model/CylinderStatusModel.cs
  42. +2
    -3
      DosingSystem/Model/DeviceInquire.cs
  43. +4
    -2
      DosingSystem/View/DeviceListView.xaml
  44. +2
    -1
      DosingSystem/View/DeviceMaterialParView.xaml
  45. +317
    -124
      DosingSystem/View/ManualControlView.xaml
  46. +552
    -299
      DosingSystem/View/RecipeControlView.xaml
  47. +187
    -240
      DosingSystem/View/RecipeSettingsView.xaml
  48. +14
    -11
      DosingSystem/ViewModel/ChangeDeviceNameViewModel.cs
  49. +1
    -1
      DosingSystem/ViewModel/DeviceListViewModel.cs
  50. +48
    -2
      DosingSystem/ViewModel/ManualControlViewModel.cs
  51. +3
    -3
      DosingSystem/ViewModel/NewRecipeViewModel.cs
  52. +9
    -0
      SCADA.Test/App.xaml
  53. +17
    -0
      SCADA.Test/App.xaml.cs
  54. +10
    -0
      SCADA.Test/AssemblyInfo.cs
  55. +32
    -0
      SCADA.Test/Converters/ZoomConverter.cs
  56. +61
    -0
      SCADA.Test/MainWindow.xaml
  57. +137
    -0
      SCADA.Test/MainWindow.xaml.cs
  58. +32
    -0
      SCADA.Test/RunCanvas.xaml
  59. +132
    -0
      SCADA.Test/RunCanvas.xaml.cs
  60. +17
    -0
      SCADA.Test/SCADA.Test.csproj
  61. BIN
     
  62. BIN
     
  63. BIN
     
  64. BIN
     
  65. BIN
     
  66. BIN
     
  67. +355
    -0
      SCADA.Test/组态软件1.0/BeDesignerSCADA.deps.json
  68. BIN
     
  69. BIN
     
  70. +15
    -0
      SCADA.Test/组态软件1.0/BeDesignerSCADA.runtimeconfig.json
  71. BIN
     
  72. BIN
     
  73. BIN
     
  74. BIN
     
  75. BIN
     
  76. BIN
     
  77. BIN
     
  78. BIN
     
  79. BIN
     
  80. BIN
     
  81. BIN
     
  82. BIN
     
  83. BIN
     
  84. BIN
     
  85. BIN
     
  86. BIN
     
  87. BIN
     
  88. BIN
     
  89. BIN
     
  90. BIN
     
  91. BIN
     
  92. BIN
     
  93. BIN
     
  94. BIN
     
  95. BIN
     
  96. BIN
     
  97. BIN
     
  98. BIN
     
  99. BIN
     
  100. BIN
     

+ 0
- 4
BPASmartClient.Compiler/BPASmartClient.Compiler.csproj Vedi File

@@ -6,10 +6,6 @@
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<Folder Include="Hepler\" />
</ItemGroup>

<ItemGroup>
<Reference Include="Antlr3.Runtime">
<HintPath>DLL\Antlr3.Runtime.dll</HintPath>


+ 5
- 0
BPASmartClient.Compiler/Config.cs Vedi File

@@ -8,6 +8,11 @@ using Unvell.ReoScript;

namespace BPASmartClient.Compiler
{
/// <summary>
/// 编译器
/// 创建人:奉友福
/// 创建时间:20220824
/// </summary>
public class Config
{
#region 单例模式


BPASmartClient.SCADAControl/IExecutable.cs → BPASmartClient.Compiler/IExecutable.cs Vedi File

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

namespace BPASmartClient.SCADAControl
namespace BPASmartClient.Compiler
{
public interface IExecutable
{

+ 38
- 0
BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj Vedi File

@@ -87,6 +87,7 @@
<None Remove="Image\上箭头.png" />
<None Remove="Image\不规则矩形.png" />
<None Remove="Image\个人信息.png" />
<None Remove="Image\中间.png" />
<None Remove="Image\临时模板.png" />
<None Remove="Image\产品制作.png" />
<None Remove="Image\光柱.png" />
@@ -113,6 +114,8 @@
<None Remove="Image\圆角矩形 30 拷贝.png" />
<None Remove="Image\圆角矩形 4.png" />
<None Remove="Image\圆角矩形.png" />
<None Remove="Image\外边框1.png" />
<None Remove="Image\容器边框2.png" />
<None Remove="Image\工艺流程.jpg" />
<None Remove="Image\工艺流程.png" />
<None Remove="Image\底部背景.png" />
@@ -122,6 +125,10 @@
<None Remove="Image\按钮\停用.png" />
<None Remove="Image\按钮\添加.png" />
<None Remove="Image\弹窗.png" />
<None Remove="Image\按钮\组 7.png" />
<None Remove="Image\按钮\组 8.png" />
<None Remove="Image\按钮背景蓝色.png" />
<None Remove="Image\按钮背景黄.png" />
<None Remove="Image\搜索按钮.png" />
<None Remove="Image\搜索框.png" />
<None Remove="Image\文字.png" />
@@ -131,6 +138,7 @@
<None Remove="Image\智慧城市科技风登录页面边框.png" />
<None Remove="Image\有告警.png" />
<None Remove="Image\权限背景.png" />
<None Remove="Image\标签.png" />
<None Remove="Image\标题背景.png" />
<None Remove="Image\浅色背景.jpeg" />
<None Remove="Image\环形切图\内圈\未选中.png" />
@@ -141,9 +149,12 @@
<None Remove="Image\界面2.png" />
<None Remove="Image\登录界面背景.jpg" />
<None Remove="Image\登录界面背景1.jpg" />
<None Remove="Image\直线.png" />
<None Remove="Image\矩形.png" />
<None Remove="Image\矩形1.png" />
<None Remove="Image\矩形2.png" />
<None Remove="Image\矩形样式.png" />
<None Remove="Image\矩形边框.png" />
<None Remove="Image\窗体样式\datagrid\data_标题栏背景.png" />
<None Remove="Image\窗体样式\datagrid\data_行背景.png" />
<None Remove="Image\窗体样式\From\内部背景.png" />
@@ -186,12 +197,14 @@
<None Remove="Image\背景2.png" />
<None Remove="Image\背景3.jpg" />
<None Remove="Image\背景图片.png" />
<None Remove="Image\背景框.png" />
<None Remove="Image\背景矢量\内部.png" />
<None Remove="Image\背景矢量\右上.png" />
<None Remove="Image\背景矢量\右下.png" />
<None Remove="Image\背景矢量\左上.png" />
<None Remove="Image\背景矢量\左下.png" />
<None Remove="Image\背景矢量\矢量智能对象.png" />
<None Remove="Image\背景边框4.png" />
<None Remove="Image\营销额.png" />
<None Remove="Image\蓝色背景.png" />
<None Remove="Image\蓝边框.png" />
@@ -212,6 +225,12 @@
<None Remove="Image\退出.png" />
<None Remove="Image\退出按钮.png" />
<None Remove="Image\透明背景.png" />
<None Remove="Image\配方背景\圆角矩形.png" />
<None Remove="Image\配方背景\竖背景框.png" />
<None Remove="Image\配方背景\组 5.png" />
<None Remove="Image\配方背景\蓝色背景.png" />
<None Remove="Image\配方背景\蓝色背景2.png" />
<None Remove="Image\配方背景\黄色背景.png" />
<None Remove="Image\阴影边框.png" />
<None Remove="Image\顶部.png" />
<None Remove="Image\顶部切图\Button_No.png" />
@@ -278,6 +297,7 @@
<Resource Include="Image\textBox.png" />
<Resource Include="Image\WindowImages.png" />
<Resource Include="Image\上箭头.png" />
<Resource Include="Image\中间.png" />
<Resource Include="Image\临时模板.png" />
<Resource Include="Image\产品制作.png" />
<Resource Include="Image\光柱.png" />
@@ -288,6 +308,8 @@
<Resource Include="Image\告警\无告警.png" />
<Resource Include="Image\告警\无告警1.png" />
<Resource Include="Image\告警\轻微告警.png" />
<Resource Include="Image\外边框1.png" />
<Resource Include="Image\容器边框2.png" />
<Resource Include="Image\工艺流程.jpg" />
<Resource Include="Image\工艺流程.png" />
<Resource Include="Image\弹窗2.png" />
@@ -296,9 +318,14 @@
<Resource Include="Image\按钮\停用.png" />
<Resource Include="Image\按钮\添加.png" />
<Resource Include="Image\弹窗.png" />
<Resource Include="Image\按钮\组 7.png" />
<Resource Include="Image\按钮\组 8.png" />
<Resource Include="Image\按钮背景蓝色.png" />
<Resource Include="Image\按钮背景黄.png" />
<Resource Include="Image\智慧城市科技风登录页面.png" />
<Resource Include="Image\智慧城市科技风登录页面边框.png" />
<Resource Include="Image\权限背景.png" />
<Resource Include="Image\标签.png" />
<Resource Include="Image\浅色背景.jpeg" />
<Resource Include="Image\界面2.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@@ -306,6 +333,9 @@
<Resource Include="Image\圆角矩形 30 拷贝.png" />
<Resource Include="Image\登录界面背景.jpg" />
<Resource Include="Image\登录界面背景1.jpg" />
<Resource Include="Image\直线.png" />
<Resource Include="Image\矩形2.png" />
<Resource Include="Image\矩形边框.png" />
<Resource Include="Image\系统名称.png" />
<Resource Include="Image\红色圆角矩形背景.png" />
<Resource Include="Image\纹理背景.jpeg" />
@@ -314,6 +344,8 @@
<Resource Include="Image\组合边框1.png" />
<Resource Include="Image\背景2.png" />
<Resource Include="Image\背景3.jpg" />
<Resource Include="Image\背景框.png" />
<Resource Include="Image\背景边框4.png" />
<Resource Include="Image\蓝色背景.png" />
<Resource Include="Image\蓝边框.png" />
<Resource Include="Image\调味品.jpeg" />
@@ -326,6 +358,12 @@
<Resource Include="Image\告警\Wifi_NO.ico" />
<Resource Include="Image\告警\Wifi_OK.ico" />
<Resource Include="Image\透明背景.png" />
<Resource Include="Image\配方背景\圆角矩形.png" />
<Resource Include="Image\配方背景\竖背景框.png" />
<Resource Include="Image\配方背景\组 5.png" />
<Resource Include="Image\配方背景\蓝色背景.png" />
<Resource Include="Image\配方背景\蓝色背景2.png" />
<Resource Include="Image\配方背景\黄色背景.png" />
<Resource Include="Image\阴影边框.png" />
<Resource Include="Image\顶部切图\Button_No.png" />
<Resource Include="Image\顶部切图\Button_Select.png" />


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


+ 1
- 1
BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs Vedi File

@@ -42,7 +42,7 @@ namespace BPASmartClient.CustomResource.Pages.Model
}
}
Thread.Sleep(100);
}), $"{typeof(AlarmT)},报警通用模块监听");
}), $"{typeof(AlarmT).Name},报警通用模块监听");

}



+ 2
- 2
BPASmartClient.CustomResource/UserControls/Cylinder.xaml Vedi File

@@ -291,21 +291,21 @@
StrokeThickness="4" />

<ToggleButton
IsEnabled="False"
Name="LeftTog"
Width="30"
Height="30"
Margin="120,35,0,0"
HorizontalAlignment="Left"
IsEnabled="False"
Style="{StaticResource toggleButtonStyle}" />

<ToggleButton
IsEnabled="False"
Name="RightTog"
Width="30"
Height="30"
Margin="325,35,0,0"
HorizontalAlignment="Left"
IsEnabled="False"
Style="{StaticResource toggleButtonStyle}" />

<!--<Ellipse


+ 96
- 0
BPASmartClient.CustomResource/UserControls/ImageBorder.xaml Vedi File

@@ -0,0 +1,96 @@
<UserControl
x:Class="BPASmartClient.CustomResource.UserControls.ImageBorder"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.CustomResource.UserControls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">

<UserControl.Resources>
<SolidColorBrush x:Key="borderColor" Color="#552AB2E7" />
</UserControl.Resources>

<Grid Name="gr">
<Viewbox Width="auto" Height="auto">
<Canvas Width="{Binding ElementName=gr, Path=ActualWidth}" Height="{Binding ElementName=gr, Path=ActualHeight}">
<Canvas.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/矩形2.png" Stretch="Fill" />
</Canvas.Background>
<Grid>
<Border
Width="{Binding ElementName=gr, Path=ActualWidth}"
BorderBrush="{StaticResource borderColor}"
BorderThickness="0.5" />
<Border
Width="{Binding ElementName=gr, Path=ActualWidth}"
VerticalAlignment="Bottom"
BorderBrush="{StaticResource borderColor}"
BorderThickness="0.5" />

<Border
Height="{Binding ElementName=gr, Path=ActualHeight}"
BorderBrush="{StaticResource borderColor}"
BorderThickness="0.5" />

<Border
Height="{Binding ElementName=gr, Path=ActualHeight}"
HorizontalAlignment="Right"
BorderBrush="{StaticResource borderColor}"
BorderThickness="0.5" />

<!--<Image
Width="{Binding ElementName=gr, Path=ActualWidth}"
VerticalAlignment="Top"
Source="/BPASmartClient.CustomResource;component/Image/直线.png"
Stretch="Fill" />

<Image
Width="{Binding ElementName=gr, Path=ActualWidth}"
VerticalAlignment="Bottom"
Source="/BPASmartClient.CustomResource;component/Image/直线.png" />

<Image
Width="{Binding ElementName=gr, Path=ActualHeight}"
HorizontalAlignment="Left"
VerticalAlignment="Top"
RenderTransformOrigin="0,0.1"
Source="/BPASmartClient.CustomResource;component/Image/直线.png">
<Image.RenderTransform>
<TransformGroup>
<ScaleTransform />
<SkewTransform />
<RotateTransform Angle="90" />
<TranslateTransform />
</TransformGroup>
</Image.RenderTransform>
</Image>

<Image
Width="{Binding ElementName=gr, Path=ActualHeight}"
HorizontalAlignment="Right"
VerticalAlignment="Bottom"
RenderTransformOrigin="1,0"
Source="/BPASmartClient.CustomResource;component/Image/直线.png">
<Image.RenderTransform>
<TransformGroup>
<ScaleTransform />
<SkewTransform />
<RotateTransform Angle="90" />
<TranslateTransform />
</TransformGroup>
</Image.RenderTransform>
</Image>-->

<Path Name="leftTop" Stroke="Aqua" />
<Path Name="rightTop" Stroke="Aqua" />
<Path Name="leftBottom" Stroke="Aqua" />
<Path Name="rightBottom" Stroke="Aqua" />
</Grid>

</Canvas>
</Viewbox>
</Grid>
</UserControl>

+ 67
- 0
BPASmartClient.CustomResource/UserControls/ImageBorder.xaml.cs Vedi File

@@ -0,0 +1,67 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.CustomResource.UserControls
{
/// <summary>
/// ImageBorder.xaml 的交互逻辑
/// </summary>
public partial class ImageBorder : UserControl
{
public ImageBorder()
{
InitializeComponent();
this.SizeChanged += ImageBorder_SizeChanged;
}

private void ImageBorder_SizeChanged(object sender, SizeChangedEventArgs e)
{
double min = Math.Min(this.Width, this.Height);

PathGeometry geometry = new PathGeometry();
PathFigure pathFigure = new PathFigure();
pathFigure.StartPoint = new Point(15, 0);
pathFigure.Segments.Add(new LineSegment(new Point(0, 0), true));
pathFigure.Segments.Add(new LineSegment(new Point(0, 15), true));
geometry.Figures.Add(pathFigure);
this.leftTop.Data = geometry;

geometry = new PathGeometry();
pathFigure = new PathFigure();
pathFigure.StartPoint = new Point(this.Width - 15, 0);
pathFigure.Segments.Add(new LineSegment(new Point(this.Width, 0), true));
pathFigure.Segments.Add(new LineSegment(new Point(this.Width, 15), true));
geometry.Figures.Add(pathFigure);
this.rightTop.Data = geometry;

geometry = new PathGeometry();
pathFigure = new PathFigure();
pathFigure.StartPoint = new Point(0, this.Height - 15);
pathFigure.Segments.Add(new LineSegment(new Point(0, this.Height), true));
pathFigure.Segments.Add(new LineSegment(new Point(15, this.Height), true));
geometry.Figures.Add(pathFigure);
this.leftBottom.Data = geometry;

geometry = new PathGeometry();
pathFigure = new PathFigure();
pathFigure.StartPoint = new Point(this.Width - 15, this.Height);
pathFigure.Segments.Add(new LineSegment(new Point(this.Width, this.Height), true));
pathFigure.Segments.Add(new LineSegment(new Point(this.Width, this.Height - 15), true));
geometry.Figures.Add(pathFigure);
this.rightBottom.Data = geometry;

}
}
}

+ 6
- 2
BPASmartClient.MessageName/DataName.cs Vedi File

@@ -15,10 +15,14 @@ namespace BPASmartClient.MessageName
#region XX数据
/// <summary>
/// xxx消息
///
/// </summary>
[Description("消息备注"), Browsable(true)]
[Category("测试"), Description("消息备注"), Browsable(true)]
public static string xxx = "xxx";
/// <summary>
/// xxx消息
/// </summary>
[Category("测试"), Description("消息备注1"), Browsable(true)]
public static string 测试 = "测试";
#endregion

}


+ 29
- 0
BPASmartClient.MessageName/Enum/物料仓/SilosRunEnum.cs Vedi File

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MessageName.Enum.物料仓
{
/// <summary>
/// 物料仓数据设置-Model
/// </summary>
public class SilosMessageModel
{
/// <summary>
/// 物料仓:仓号
/// </summary>
public string id { get; set; }
/// <summary>
/// 物料仓:标题
/// </summary>
public string Title { get; set; }
/// <summary>
/// 物料仓:重量(G) 35.23
/// </summary>
public string Value { get; set; }
}


}

+ 39
- 0
BPASmartClient.MessageName/Enum/运行状态/RunEnum.cs Vedi File

@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MessageName.Enum.运行状态
{
/// <summary>
/// 运行状态-枚举
/// </summary>
public enum RunEnum
{
/// <summary>
/// 运行(滚动线默认右转)
/// </summary>
Run,
/// <summary>
/// 运行-左转(滚动线独有)
/// </summary>
Run_Left,
/// <summary>
/// 停止
/// </summary>
Stop
}

public class RunEnumModel
{
/// <summary>
/// 运行状态
/// </summary>
public RunEnum Run { get; set; }
/// <summary>
/// ID号
/// </summary>
public string ID { get; set; }
}
}

+ 59
- 8
BPASmartClient.MessageName/MessageName.cs Vedi File

@@ -3,7 +3,7 @@
namespace BPASmartClient.MessageName
{
/// <summary>
/// 消息名称管理中心
/// 消息名称管理中心---不在使用
/// 特性:Category,消息分组
/// Description,消息备注
/// Browsable,是否使用
@@ -13,15 +13,66 @@ namespace BPASmartClient.MessageName
/// Class_InnerMessageBus.GetInstance().ListenMessage(this, MessageName.xxx, "xxnameHandler");
/// public void xxnameHandler(object sender, InnerMessageEventArgs e) { }
/// </summary>
public class MessageName
//public class MessageName
//{
// #region XX消息
// /// <summary>
// /// xxx消息
// /// </summary>
// [Category("消息分组"),Description("消息备注"),Browsable(true)]
// public static string xxx = "xxx";
// #endregion


// #region 滚动线消息事件管理中心
// /// <summary>
// /// 滚动线控制滚动消息
// /// </summary>
// [Category("滚动线"), Description("滚动线控制滚动"), Browsable(true)]
// public static string ConveyorBeltIsRun = "ConveyorBeltIsRun";
// /// <summary>
// /// 滚动线控制左转
// /// </summary>
// [Category("滚动线"), Description("滚动线控制左转"), Browsable(true)]
// public static string ConveyorBeltLeft = "ConveyorBeltLeft";
// /// <summary>
// /// 滚动线控制右转
// /// </summary>
// [Category("滚动线"), Description("滚动线控制右转"), Browsable(true)]
// public static string ConveyorBeltRight = "ConveyorBeltRight";
// /// <summary>
// /// 滚动线控制停止
// /// </summary>
// [Category("滚动线"), Description("滚动线控制停止"), Browsable(true)]
// public static string ConveyorBeltStop = "ConveyorBeltStop";
// #endregion
//}


/// <summary>
/// 消息名称管理中心-枚举
/// </summary>
public enum MessageNameEnum
{
#region XX消息
/// <summary>
/// xxx消息
///
/// 无
/// </summary>
Null,
/// <summary>
/// 物料仓运行状态
/// </summary>
[Category("消息分组"),Description("消息备注"),Browsable(true)]
public static string xxx = "xxx";
#endregion
SilosRunStatus,
/// <summary>
/// 物料仓数据设置
/// </summary>
SilosSetData,

/// <summary>
/// 滚动线运行状态
/// </summary>
ConveyorBeltRunStatus,



}
}

+ 2
- 1
BPASmartClient.SCADAControl/ArcGauge.cs Vedi File

@@ -1,4 +1,5 @@
using System;
using BPASmartClient.Compiler;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;


+ 2
- 0
BPASmartClient.SCADAControl/BPASmartClient.SCADAControl.csproj Vedi File

@@ -12,6 +12,8 @@

<ItemGroup>
<ProjectReference Include="..\BPASmartClient.Compiler\BPASmartClient.Compiler.csproj" />
<ProjectReference Include="..\BPASmartClient.MessageCommunication\BPASmartClient.MessageCommunication.csproj" />
<ProjectReference Include="..\BPASmartClient.MessageName\BPASmartClient.MessageName.csproj" />
</ItemGroup>

<ItemGroup>


+ 146
- 76
BPASmartClient.SCADAControl/NewConveyorBelt.xaml.cs Vedi File

@@ -1,5 +1,11 @@
using System;
using BPASmartClient.Compiler;
using BPASmartClient.MessageCommunication;
using BPASmartClient.MessageCommunication.MsgControl;
using BPASmartClient.MessageName;
using BPASmartClient.MessageName.Enum.运行状态;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
@@ -22,10 +28,14 @@ namespace BPASmartClient.SCADAControl
/// </summary>
public partial class NewConveyorBelt : UserControl, IExecutable
{
#region 临时变量
Path Path_mp = null;
Path Path_cb = null;
Storyboard storyboard = new Storyboard();
Storyboard storyboard1 = new Storyboard();
#endregion


public NewConveyorBelt()
{
InitializeComponent();
@@ -41,7 +51,6 @@ namespace BPASmartClient.SCADAControl
}

public string ControlType => "滚动线";

private bool isExecuteState;
public bool IsExecuteState
{
@@ -58,10 +67,7 @@ namespace BPASmartClient.SCADAControl
}
}

public void Register()
{
}

#region 内部函数
public void VisualStateManagerData()
{
storyboard.RepeatBehavior = RepeatBehavior.Forever;
@@ -112,56 +118,42 @@ namespace BPASmartClient.SCADAControl
VisualStateManagerData();
}


//传送带外边框绘制
PathGeometry geometry = new PathGeometry();
PathFigure pathFigure = new PathFigure();
pathFigure.StartPoint = new Point(this.Height / 2, 0);
pathFigure.Segments.Add(new ArcSegment(new Point(this.Height / 2, this.Height), new Size(this.Height / 2, this.Height / 2), 0, false, SweepDirection.Counterclockwise, true));
pathFigure.Segments.Add(new LineSegment(new Point(this.Width, this.Height), true));
pathFigure.Segments.Add(new LineSegment(new Point(this.Width, this.Height - ConveyorBeltWidth), true));
double innerCircle = (this.Height - (ConveyorBeltWidth * 2)) / 2;//内圆半径
pathFigure.Segments.Add(new LineSegment(new Point(ConveyorBeltWidth + innerCircle, this.Height - ConveyorBeltWidth), true));
pathFigure.Segments.Add(new ArcSegment(new Point(ConveyorBeltWidth + innerCircle, ConveyorBeltWidth), new Size(innerCircle, innerCircle), 0, false, SweepDirection.Clockwise, true));
pathFigure.Segments.Add(new LineSegment(new Point(this.Width, ConveyorBeltWidth), true));
pathFigure.Segments.Add(new LineSegment(new Point(this.Width, 0), true));
pathFigure.Segments.Add(new LineSegment(new Point(this.Height / 2, 0), true));
geometry.Figures.Add(pathFigure);
Path_cb.Data = geometry;

//传送带内部皮带绘制
PathGeometry geometry1 = new PathGeometry();
PathFigure pathFigure1 = new PathFigure();
pathFigure1.StartPoint = new Point(this.Width, ConveyorBeltWidth / 2);
double innerCircle1 = (this.Height - ConveyorBeltWidth) / 2;//内圆半径
pathFigure1.Segments.Add(new LineSegment(new Point(innerCircle1 + ConveyorBeltWidth / 2, ConveyorBeltWidth / 2), true));
pathFigure1.Segments.Add(new ArcSegment(new Point(innerCircle1 + ConveyorBeltWidth / 2, this.Height - ConveyorBeltWidth / 2), new Size(innerCircle1, innerCircle1), 0, false, SweepDirection.Counterclockwise, true));
pathFigure1.Segments.Add(new LineSegment(new Point(this.Width, this.Height - ConveyorBeltWidth / 2), true));
geometry1.Figures.Add(pathFigure1);
Path_mp.Data = geometry1;
}
/// <summary>
/// 搜索指定名称的子元素
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="obj"></param>
/// <param name="name"></param>
/// <returns></returns>
public static T FindChild<T>(DependencyObject obj, string name) where T : FrameworkElement
{
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++)
if (this.Height > 0 && this.Width > 0)
{
DependencyObject child = VisualTreeHelper.GetChild(obj, i);
if (child != null && child is T && (child as T).Name.Equals(name))
return (T)child;
else
try
{
T childOfChild = FindChild<T>(child, name);
if (childOfChild != null)
return childOfChild;
//传送带外边框绘制
PathGeometry geometry = new PathGeometry();
PathFigure pathFigure = new PathFigure();
pathFigure.StartPoint = new Point(this.Height / 2, 0);
pathFigure.Segments.Add(new ArcSegment(new Point(this.Height / 2, this.Height), new Size(this.Height / 2, this.Height / 2), 0, false, SweepDirection.Counterclockwise, true));
pathFigure.Segments.Add(new LineSegment(new Point(this.Width, this.Height), true));
pathFigure.Segments.Add(new LineSegment(new Point(this.Width, this.Height - ConveyorBeltWidth), true));
double innerCircle = (this.Height - (ConveyorBeltWidth * 2)) / 2;//内圆半径
pathFigure.Segments.Add(new LineSegment(new Point(ConveyorBeltWidth + innerCircle, this.Height - ConveyorBeltWidth), true));
pathFigure.Segments.Add(new ArcSegment(new Point(ConveyorBeltWidth + innerCircle, ConveyorBeltWidth), new Size(innerCircle, innerCircle), 0, false, SweepDirection.Clockwise, true));
pathFigure.Segments.Add(new LineSegment(new Point(this.Width, ConveyorBeltWidth), true));
pathFigure.Segments.Add(new LineSegment(new Point(this.Width, 0), true));
pathFigure.Segments.Add(new LineSegment(new Point(this.Height / 2, 0), true));
geometry.Figures.Add(pathFigure);
Path_cb.Data = geometry;

//传送带内部皮带绘制
PathGeometry geometry1 = new PathGeometry();
PathFigure pathFigure1 = new PathFigure();
pathFigure1.StartPoint = new Point(this.Width, ConveyorBeltWidth / 2);
double innerCircle1 = (this.Height - ConveyorBeltWidth) / 2;//内圆半径
pathFigure1.Segments.Add(new LineSegment(new Point(innerCircle1 + ConveyorBeltWidth / 2, ConveyorBeltWidth / 2), true));
pathFigure1.Segments.Add(new ArcSegment(new Point(innerCircle1 + ConveyorBeltWidth / 2, this.Height - ConveyorBeltWidth / 2), new Size(innerCircle1, innerCircle1), 0, false, SweepDirection.Counterclockwise, true));
pathFigure1.Segments.Add(new LineSegment(new Point(this.Width, this.Height - ConveyorBeltWidth / 2), true));
geometry1.Figures.Add(pathFigure1);
Path_mp.Data = geometry1;
}
catch (Exception ex)
{

}
}
return null;
}

public static IEnumerable<T> FindVisualChildren<T>(DependencyObject depObj) where T : DependencyObject
@@ -183,35 +175,13 @@ namespace BPASmartClient.SCADAControl
}
}
}
#endregion

#region 属性
private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
(d as NewConveyorBelt)?.Refursh();
}

private void Refursh()
{
if (Direction == 1)
{
storyboard.Begin();
storyboard1.Stop();
// VisualStateManager.GoToState(this, "Left", false);
}
else if (Direction == 2)
{
storyboard.Stop();
storyboard1.Begin();
//VisualStateManager.GoToState(this, "Right", false);
}
else
{
storyboard.Stop();
storyboard1.Stop();
//VisualStateManager.GoToState(this, "Stop", false);
}
}


public DoubleCollection StrokeDashArray
{
get { return (DoubleCollection)GetValue(StrokeDashArrayProperty); }
@@ -271,7 +241,107 @@ namespace BPASmartClient.SCADAControl
public static readonly DependencyProperty DirectionProperty =
DependencyProperty.Register("Direction", typeof(int), typeof(NewConveyorBelt),
new PropertyMetadata(0, new PropertyChangedCallback(OnPropertyChanged)));
[Category("值设定")]
public string Text
{
get { return (string)GetValue(TextProperty); }
set { SetValue(TextProperty, value); }
}
public static readonly DependencyProperty TextProperty =
DependencyProperty.Register("Text", typeof(string), typeof(NewConveyorBelt), new PropertyMetadata(string.Empty));

[Category("主题订阅")]
public string ConveyorBeltLeft
{
get { return (string)GetValue(ConveyorBeltLeftProperty); }
set { SetValue(ConveyorBeltLeftProperty, value); }
}
public static readonly DependencyProperty ConveyorBeltLeftProperty =
DependencyProperty.Register("ConveyorBeltLeft", typeof(string), typeof(NewConveyorBelt), new PropertyMetadata(string.Empty));
[Category("主题订阅")]
public string ConveyorBeltRight
{
get { return (string)GetValue(ConveyorBeltRightProperty); }
set { SetValue(ConveyorBeltRightProperty, value); }
}
public static readonly DependencyProperty ConveyorBeltRightProperty =
DependencyProperty.Register("ConveyorBeltRight", typeof(string), typeof(NewConveyorBelt), new PropertyMetadata(string.Empty));
[Category("主题订阅")]
public string ConveyorBeltStop
{
get { return (string)GetValue(ConveyorBeltStopProperty); }
set { SetValue(ConveyorBeltStopProperty, value); }
}
public static readonly DependencyProperty ConveyorBeltStopProperty =
DependencyProperty.Register("ConveyorBeltStop", typeof(string), typeof(NewConveyorBelt), new PropertyMetadata(string.Empty));


[Category("消息名称")]
public MessageNameEnum EventRunName
{
get { return (MessageNameEnum)GetValue(EventRunNameProperty); }
set { SetValue(EventRunNameProperty, value); }
}
public static readonly DependencyProperty EventRunNameProperty =
DependencyProperty.Register("EventRunName", typeof(MessageNameEnum), typeof(NewConveyorBelt), new PropertyMetadata(MessageNameEnum.Null, onEventRunNameChanged));
private static void onEventRunNameChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => (d as NewConveyorBelt)?.RunNameRefresh();
#endregion

#region 属性变更事件
public void Register()
{
if (EventRunName != MessageNameEnum.Null) Class_InnerMessageBus.GetInstance().ListenMessage(this, EventRunName.ToString(), "EventRunNameHandler");

}

public void EventRunNameHandler(object sender, InnerMessageEventArgs e)
{
try
{
if (IsExecuteState = true)
{
if (e.obj_MessageObj is RunEnumModel)
{

RunEnumModel runEnum = (RunEnumModel)e.obj_MessageObj;
//if (runEnum.ID == Text)
{
Direction = runEnum.Run == RunEnum.Run ? 1 : ((runEnum.Run == RunEnum.Run_Left) ? 2 : 0);
}
}
}
}
catch (Exception ex)
{

}
}

private void Refursh()
{
if (Direction == 1)
{
storyboard.Begin();
storyboard1.Stop();
}
else if (Direction == 2)
{
storyboard.Stop();
storyboard1.Begin();
}
else
{
storyboard.Stop();
storyboard1.Stop();
}
}

public void RunNameRefresh()
{
}
#endregion
}


}

+ 52
- 11
BPASmartClient.SCADAControl/Silos.xaml Vedi File

@@ -11,32 +11,73 @@ d:DesignHeight="270" d:DesignWidth="180" >
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Top"
Margin="0 10 0 35"
FontSize="20"
Foreground="#FF1FD622"
Tag="出料控制"
Text="出料中..." Visibility="Collapsed" />
<Ellipse Grid.Row="0" Tag="出料圆" Margin="0,40,0,0" Visibility="Collapsed" StrokeThickness="60" Width="150" Height="70" RenderTransformOrigin="0.5,0.5" VerticalAlignment="Top">
<Ellipse.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform AngleY="0"/>
<RotateTransform Angle="0"/>
<TranslateTransform/>
</TransformGroup>
</Ellipse.RenderTransform>
<Ellipse.Stroke>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" Opacity="0.4">
<GradientStop Color="#CCA48E42"/>
<GradientStop Color="#CC2D48DA" Offset="1"/>
<GradientStop Color="#FF3FD256" Offset="0.305"/>
<!--<GradientStop Color="#FFB12C87" Offset="0.67"/>-->
</LinearGradientBrush>
</Ellipse.Stroke>
</Ellipse>
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
Margin="0 0 0 35"
FontSize="25"
Foreground="#FFCCD61F"
FontSize="45"
Foreground="#FFCCD61F" Tag="Title"
Text="{Binding Title,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" />
<TextBlock
Grid.Row="1"
Margin="0,25,0,0"
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center">
<TextBlock
Margin="0,20,0,0"
HorizontalAlignment="Center"
FontSize="20"
Foreground="#FF0084FF"
Foreground="#FF00FFF9" Tag="Value"
Text="{Binding Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" />
<TextBlock
Margin="0,20,0,0"
HorizontalAlignment="Center"
FontSize="20"
Foreground="#FF00FFF9"
Text="(g)" />
</StackPanel>

<TextBlock
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center">
<TextBlock
Margin="0,50,0,0"
HorizontalAlignment="Center"
FontSize="50"
Foreground="#FFFFA400" Tag="Text"
Text="{Binding Text,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" />
<TextBlock
Grid.Row="1"
Margin="0,70,0,0"
HorizontalAlignment="Center"
FontSize="20"
Foreground="#FF0084FF"
Text="{Binding Text,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" />
FontSize="25"
Foreground="#FFFFA400"
Text=" 号仓" />
</StackPanel>
<Image
Grid.RowSpan="2"
Source="/BPASmartClient.SCADAControl;component/Images/光柱.png"
Stretch="Fill" />

</Grid>
</UserControl>

+ 264
- 13
BPASmartClient.SCADAControl/Silos.xaml.cs Vedi File

@@ -1,4 +1,10 @@
using System;
using BPASmartClient.Compiler;
using BPASmartClient.MessageCommunication;
using BPASmartClient.MessageCommunication.MsgControl;
using BPASmartClient.MessageName;
using BPASmartClient.MessageName.Enum.物料仓;
using BPASmartClient.MessageName.Enum.运行状态;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
@@ -10,6 +16,7 @@ using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
@@ -22,19 +29,36 @@ namespace BPASmartClient.SCADAControl
/// </summary>
public partial class Silos : UserControl, IExecutable
{
#region 临时变量
TextBlock textBlockCLKZ = null;
TextBlock textBlockValue=null;
TextBlock textBlockText = null;
TextBlock textBlockTitle = null;


Ellipse ellipseControl = null;
Storyboard storyboard = new Storyboard();
#endregion

public Silos()
{
InitializeComponent();
this.DataContext = this;
Width = 180;
Height = 270;
Value = 25.23;
Title = "香料";
Text = "1 号仓";
//Value = "25.23";
//Title = "香料";
//Text = "1";
//this.SizeChanged += Silos_SizeChanged; ;
this.Loaded += Silos_Loaded;
}

public string ControlType => "物料仓";
private void Silos_Loaded(object sender, RoutedEventArgs e)
{
Silos_SizeChanged(null, null);
}

public string ControlType => "物料仓";
private bool isExecuteState;
public bool IsExecuteState
{
@@ -51,18 +75,109 @@ namespace BPASmartClient.SCADAControl
}
}

#region 动画
/// <summary>
/// 字节改变
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Silos_SizeChanged(object sender, SizeChangedEventArgs e)
{
//查找
if (ellipseControl == null)
{
foreach (Ellipse tb in FindVisualChildren<Ellipse>(this))
{
// do something with tb here
if (tb.Tag != null)
{
if (tb.Tag.ToString() == "出料圆")
{
ellipseControl = tb;
}
}
}

foreach (TextBlock tb in FindVisualChildren<TextBlock>(this))
{
// do something with tb here
if (tb.Tag != null)
{
if (tb.Tag.ToString() == "出料控制")
{
textBlockCLKZ = tb;
}else if (tb.Tag.ToString() == "Value")
{
textBlockValue = tb;
}
else if (tb.Tag.ToString() == "Text")
{
textBlockText = tb;
}
else if (tb.Tag.ToString() == "Title")
{
textBlockTitle = tb;
}
}
}
}
storyboard.RepeatBehavior = RepeatBehavior.Forever;
DoubleAnimationUsingKeyFrames animation = new DoubleAnimationUsingKeyFrames();
Storyboard.SetTarget(animation, ellipseControl);
Storyboard.SetTargetProperty(animation, new PropertyPath("(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)"));
animation.KeyFrames.Add(new EasingDoubleKeyFrame(0, KeyTime.FromTimeSpan(TimeSpan.FromSeconds(0))));
animation.KeyFrames.Add(new EasingDoubleKeyFrame(180, KeyTime.FromTimeSpan(TimeSpan.FromSeconds(1))));
animation.KeyFrames.Add(new EasingDoubleKeyFrame(360, KeyTime.FromTimeSpan(TimeSpan.FromSeconds(2))));
storyboard.Children.Add(animation);
}
public static IEnumerable<T> FindVisualChildren<T>(DependencyObject depObj) where T : DependencyObject
{
if (depObj != null)
{
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(depObj); i++)
{
DependencyObject child = VisualTreeHelper.GetChild(depObj, i);
if (child != null && child is T)
{
yield return (T)child;
}

foreach (T childOfChild in FindVisualChildren<T>(child))
{
yield return childOfChild;
}
}
}
}
#endregion

#region 属性
//private string _变量;
//public string ym_value
//{
// get
// {
// return _变量;
// }
// set
// {
// if (_变量 == value)
// return;
// _变量 = value;
// OnPropertyChanged("ym_value");
// }
//}

[Category("值设定")]
public double Value
public string Value
{
get { return (double)GetValue(ValueProperty); }
get { return (string)GetValue(ValueProperty); }
set { SetValue(ValueProperty, value); }
}
public static readonly DependencyProperty ValueProperty =
DependencyProperty.Register("Value", typeof(double), typeof(Silos), new PropertyMetadata(0d, OnValueChanged));

private static void OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => (d as Silos)?.Refresh();

DependencyProperty.Register("Value", typeof(string), typeof(Silos), new PropertyMetadata(new PropertyChangedCallback(onTargetChanged)));
private static void onTargetChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => (d as Silos)?.TargetRefresh();
[Category("值设定")]
public string Text
{
@@ -70,7 +185,7 @@ namespace BPASmartClient.SCADAControl
set { SetValue(TextProperty, value); }
}
public static readonly DependencyProperty TextProperty =
DependencyProperty.Register("Text", typeof(string), typeof(Silos), new PropertyMetadata(string.Empty));
DependencyProperty.Register("Text", typeof(string), typeof(Silos), new PropertyMetadata(new PropertyChangedCallback(onTargetChanged)));

[Category("值设定")]
public string Title
@@ -79,18 +194,154 @@ namespace BPASmartClient.SCADAControl
set { SetValue(TitleProperty, value); }
}
public static readonly DependencyProperty TitleProperty =
DependencyProperty.Register("Title", typeof(string), typeof(Silos), new PropertyMetadata(string.Empty));
DependencyProperty.Register("Title", typeof(string), typeof(Silos), new PropertyMetadata(new PropertyChangedCallback(onTargetChanged)));

[Category("消息名称")]
public MessageNameEnum EventRunName
{
get { return (MessageNameEnum)GetValue(EventRunNameProperty); }
set { SetValue(EventRunNameProperty, value); }
}
public static readonly DependencyProperty EventRunNameProperty =
DependencyProperty.Register("EventRunName", typeof(MessageNameEnum), typeof(Silos), new PropertyMetadata(MessageNameEnum.Null, onEventRunNameChanged));
private static void onEventRunNameChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => (d as Silos)?.RunNameRefresh();
[Category("消息名称")]
public MessageNameEnum EventDataName
{
get { return (MessageNameEnum)GetValue(EventDataNameProperty); }
set { SetValue(EventDataNameProperty, value); }
}
public static readonly DependencyProperty EventDataNameProperty =
DependencyProperty.Register("EventDataName", typeof(MessageNameEnum), typeof(Silos), new PropertyMetadata(MessageNameEnum.Null, onEventDataNameChanged));
private static void onEventDataNameChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => (d as Silos)?.DataNameRefresh();
[Category("值设定")]
public int Direction
{
get { return (int)GetValue(DirectionProperty); }
set { SetValue(DirectionProperty, value); }
}
public static readonly DependencyProperty DirectionProperty =
DependencyProperty.Register("Direction", typeof(int), typeof(Silos),
new PropertyMetadata(0, new PropertyChangedCallback(OnPropertyChanged)));
private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
(d as Silos)?.Refresh();
}
#endregion

#region 函数
/// <summary>
/// 目标属性刷新
/// </summary>
public void TargetRefresh()
{
if (textBlockValue != null && textBlockText != null && textBlockTitle != null)
{
textBlockValue.Text = Value;
textBlockText.Text = Text;
textBlockTitle.Text = Title;

}
}


/// <summary>
/// 值变化刷新
/// </summary>
public void Refresh()
{
if (ellipseControl != null)
{
if (Direction == 1)
{
ellipseControl.Visibility = Visibility.Visible;
textBlockCLKZ.Visibility = Visibility.Visible;
storyboard.Begin();
}
else if (Direction == 2)
{
ellipseControl.Visibility = Visibility.Collapsed;
textBlockCLKZ.Visibility = Visibility.Collapsed;
storyboard.Stop();
}
else
{
ellipseControl.Visibility = Visibility.Collapsed;
textBlockCLKZ.Visibility = Visibility.Collapsed;
storyboard.Stop();
}
}
}
/// <summary>
/// 运行名称变化事件
/// </summary>
public void RunNameRefresh()
{
}
/// <summary>
/// 数据名称变化事件
/// </summary>
public void DataNameRefresh()
{

}
#endregion

#region 运行事件
public void Register()
{
if (EventRunName != MessageNameEnum.Null) Class_InnerMessageBus.GetInstance().ListenMessage(this, EventRunName.ToString(), "EventRunNameHandler");
if (EventDataName != MessageNameEnum.Null) Class_InnerMessageBus.GetInstance().ListenMessage(this, EventDataName.ToString(), "EventDataNameHandler");
}

public void EventRunNameHandler(object sender, InnerMessageEventArgs e)
{
try
{
if (IsExecuteState = true)
{
if (e.obj_MessageObj is RunEnumModel)
{

RunEnumModel runEnum = (RunEnumModel)e.obj_MessageObj;
if (runEnum.ID == Text)
{
Direction = runEnum.Run == RunEnum.Run ? 1 : 2;
}
}
}
}
catch (Exception ex)
{

}
}

public void EventDataNameHandler(object sender, InnerMessageEventArgs e)
{
try
{
if (IsExecuteState = true)
{
if (e.obj_MessageObj is SilosMessageModel)
{
SilosMessageModel silosMessageModel = (SilosMessageModel)e.obj_MessageObj;
if (silosMessageModel.id == Text)
{
Title=silosMessageModel.Title;
Value= silosMessageModel.Value;
}
}
}
}
catch (Exception ex)
{

}
}
#endregion

}
}

+ 9
- 0
BPASmartClient.SCADAControl/TheButton.xaml Vedi File

@@ -0,0 +1,9 @@
<Button x:Class="BPASmartClient.SCADAControl.TheButton"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.SCADAControl"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
</Button>

+ 73
- 0
BPASmartClient.SCADAControl/TheButton.xaml.cs Vedi File

@@ -0,0 +1,73 @@
using BPASmartClient.Compiler;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.SCADAControl
{
/// <summary>
/// TheButton.xaml 的交互逻辑
/// </summary>
public partial class TheButton : Button, IExecutable
{
public TheButton()
{
InitializeComponent();
Content = "按钮";
Width = 80;
Height = 30;
Style = Application.Current.Resources["DesignButton"] as Style;//FindResource("DesignButton") as Style;
}

public string ControlType => "控件";

private bool isExecuteState;
public bool IsExecuteState
{
get { return isExecuteState; }
set
{
isExecuteState = value;
if (IsExecuteState)
{
Style = null;
Register();
}
}
}

[Category("事件")]
public string ClickExec
{
get { return (string)GetValue(ClickExecProperty); }
set { SetValue(ClickExecProperty, value); }
}
public static readonly DependencyProperty ClickExecProperty =
DependencyProperty.Register("ClickExec", typeof(string), typeof(TheButton), new PropertyMetadata(string.Empty));

/// <summary>
/// 注册需要处理的事件
/// </summary>
public void Register()
{
this.Click += MyButton_Click;
}

private void MyButton_Click(object sender, RoutedEventArgs e)
{
Config.GetInstance().RunJsScipt(ClickExec);
}
}
}

+ 13
- 0
BPASmartClient.SCADAControl/Themes/Generic.xaml Vedi File

@@ -132,4 +132,17 @@
</Setter>
</Style>

<Style TargetType="Button" x:Key="DesignButton">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border BorderThickness="1" BorderBrush="{StaticResource ControlBorderBrush}" Background="{StaticResource ControlBackground}">
<TextBlock Text="{TemplateBinding Content}" FontSize="{TemplateBinding FontSize}"
FontWeight="{TemplateBinding FontWeight}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

</ResourceDictionary>

+ 17
- 0
DosingSystem/Model/ConveyorServer.cs Vedi File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;

namespace BPASmartClient.DosingSystem.Model
{
public class ConveyorServer
{
public ConveyorServer()
{

}
}
}

+ 27
- 0
DosingSystem/Model/CylinderStatusModel.cs Vedi File

@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;

namespace BPASmartClient.DosingSystem.Model
{
public class CylinderStatusModel : ObservableObject
{
/// <summary>
/// 气缸原点信号
/// </summary>
public bool HomeStatus { get { return _mHomeStatus; } set { _mHomeStatus = value; OnPropertyChanged(); } }
private bool _mHomeStatus;

/// <summary>
/// 气缸到位信号
/// </summary>
public bool InPlace { get { return _mInPlace; } set { _mInPlace = value; OnPropertyChanged(); } }
private bool _mInPlace;



}
}

+ 2
- 3
DosingSystem/Model/DeviceInquire.cs Vedi File

@@ -54,10 +54,10 @@ namespace BPASmartClient.DosingSystem.Model
BottomDeviceCurrentStatuses.ElementAt(BottomIndex).DeviceNum = DeviceLists.ElementAt(i).Value.deviceStatus.DeviceNum;
}

int deviceIndex = Array.FindIndex(devices.ToArray(), p => p.IpAddress == DeviceLists.ElementAt(i).Key);
int deviceIndex = Array.FindIndex(devices.ToArray(), p => p.IpAddress == DeviceLists.ElementAt(i).Key && p.DeviceName != DeviceLists.ElementAt(i).Value.DeviceName);
if (deviceIndex >= 0 && deviceIndex < devices.Count)
{
devices.ElementAt(i).DeviceName = DeviceLists.ElementAt(i).Value.DeviceName;
devices.ElementAt(deviceIndex).DeviceName = DeviceLists.ElementAt(i).Value.DeviceName;
}
}
Thread.Sleep(200);
@@ -66,7 +66,6 @@ namespace BPASmartClient.DosingSystem.Model

public void Init()
{
devices.Add(new Devices() { DeviceName = "测试", IpAddress = "192.168.0.1" });
IpAddressLines();
DeviceDataInit();
ThreadManage.GetInstance().StartLong(new Action(() =>


+ 4
- 2
DosingSystem/View/DeviceListView.xaml Vedi File

@@ -60,7 +60,7 @@
<UniformGrid
HorizontalAlignment="Left"
VerticalAlignment="Top"
Columns="4" />
Columns="8" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>

@@ -68,7 +68,9 @@
<DataTemplate>
<Border
Name="ShadowElement"
Width="200"
Height="150"
Margin="10"
VerticalAlignment="Top"
BorderBrush="#00BEFA"
BorderThickness="0"
@@ -125,8 +127,8 @@
Grid.Row="2"
Width="130"
Height="30"
VerticalAlignment="Top"
Margin="0,0,0,0"
VerticalAlignment="Top"
Command="{Binding DataContext.ChangeNameCommand, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}"
CommandParameter="{Binding IpAddress}"
Content="修改原料名称"


+ 2
- 1
DosingSystem/View/DeviceMaterialParView.xaml Vedi File

@@ -17,7 +17,8 @@

<UserControl.Resources>
<SolidColorBrush x:Key="tabColor" Color="#FF2AB2E7" />
<SolidColorBrush x:Key="bordColor" Color="#33ffffff" />
<!--<SolidColorBrush x:Key="bordColor" Color="#33ffffff" />-->
<SolidColorBrush x:Key="bordColor" Color="#332AB2E7" />
<con:DataTableRedundantConverter x:Key="tabConvert" />

<Style x:Key="RowRadioButtonStyle" TargetType="{x:Type RadioButton}">


+ 317
- 124
DosingSystem/View/ManualControlView.xaml Vedi File

@@ -53,131 +53,324 @@
<vm:ManualControlViewModel />
</UserControl.DataContext>

<Grid>


<ListView
Grid.Column="1"
Margin="10"
Background="Transparent"
BorderBrush="#00BEFA"
BorderThickness="0"
ItemsSource="{Binding cylinderModels}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid
HorizontalAlignment="Left"
VerticalAlignment="Top"
Columns="8" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>

<ListView.ItemTemplate>
<DataTemplate>
<Grid
Margin="0 0 0 15"
Width="200"
Height="100"
Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition />
<RowDefinition Height="30" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*" />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="1"
Grid.ColumnSpan="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="Aqua"
Text="{Binding Name}" />

<pry:Cylinder
Grid.Row="1"
Grid.ColumnSpan="3"
<Grid Margin="8">

<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>

<!--#region 升降气缸-->
<Grid
Name="cy"
Grid.Row="0"
Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition />
</Grid.RowDefinitions>
<pry:ImageBorder
Grid.RowSpan="2"
Width="{Binding ElementName=cy, Path=ActualWidth}"
Height="{Binding ElementName=cy, Path=ActualHeight}" />

<Image
Margin="2,3,0,0"
HorizontalAlignment="Left"
Source="/BPASmartClient.CustomResource;component/Image/标签.png" />
<TextBlock
Margin="10,0,0,0"
VerticalAlignment="Center"
FontSize="16"
Foreground="Aqua"
Text="升降气缸控制" />
<ListView
Grid.Row="1"
Background="Transparent"
BorderBrush="#00BEFA"
BorderThickness="0"
ItemsSource="{Binding cylinderModels}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid
HorizontalAlignment="Left"
VerticalAlignment="Top"
Columns="8" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>

<ListView.ItemTemplate>
<DataTemplate>
<Grid
Width="200"
Height="100"
Margin="0,0,0,15"
Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition />
<RowDefinition Height="30" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*" />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="1"
Grid.ColumnSpan="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="Aqua"
Text="{Binding Name}" />

<pry:Cylinder
Grid.Row="1"
Grid.ColumnSpan="3"
Width="200"
Height="50"
HorizontalAlignment="Center"
VerticalAlignment="Center"
LeftTogIsChecked="{Binding LeftTog}"
RightTogIsChecked="{Binding RightTog}" />

<RadioButton
Grid.Row="2"
Grid.Column="1"
Command="{Binding DataContext.Open, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}"
CommandParameter="{Binding Name}"
Content="伸出"
Foreground="Aqua"
IsChecked="True"
Style="{StaticResource radioButtonStyle}" />

<RadioButton
Grid.Row="2"
Grid.Column="2"
Command="{Binding DataContext.Close, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}"
CommandParameter="{Binding Name}"
Content="缩回"
Foreground="Aqua"
IsChecked="False"
Style="{StaticResource radioButtonStyle}" />
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
<!--#endregion-->

<!--#region 阻挡气缸-->
<Grid
Name="zd"
Grid.Row="1"
Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition />
</Grid.RowDefinitions>
<pry:ImageBorder
Grid.RowSpan="2"
Width="{Binding ElementName=zd, Path=ActualWidth}"
Height="{Binding ElementName=zd, Path=ActualHeight}" />

<Image
Margin="2,3,0,0"
HorizontalAlignment="Left"
Source="/BPASmartClient.CustomResource;component/Image/标签.png" />
<TextBlock
Margin="10,0,0,0"
VerticalAlignment="Center"
FontSize="16"
Foreground="Aqua"
Text="阻挡气缸控制" />
<ListView
Grid.Row="1"
Margin="10"
Background="Transparent"
BorderBrush="#00BEFA"
BorderThickness="0"
ItemsSource="{Binding BlockCylinders}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid
HorizontalAlignment="Left"
VerticalAlignment="Top"
Columns="8" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>

<ListView.ItemTemplate>
<DataTemplate>
<Grid
Width="200"
Height="100"
Margin="0,0,0,15"
Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition />
<RowDefinition Height="30" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*" />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="1"
Grid.ColumnSpan="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="Aqua"
Text="{Binding Name}" />

<pry:Cylinder
Grid.Row="1"
Grid.ColumnSpan="3"
Width="200"
Height="50"
HorizontalAlignment="Center"
VerticalAlignment="Center"
LeftTogIsChecked="{Binding LeftTog}"
RightTogIsChecked="{Binding RightTog}" />

<RadioButton
Grid.Row="2"
Grid.Column="1"
Command="{Binding DataContext.Open, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}"
CommandParameter="{Binding Name}"
Content="伸出"
Foreground="Aqua"
IsChecked="True"
Style="{StaticResource radioButtonStyle}" />
<RadioButton
Grid.Row="2"
Grid.Column="2"
Command="{Binding DataContext.Close, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}"
CommandParameter="{Binding Name}"
Content="缩回"
Foreground="Aqua"
IsChecked="False"
Style="{StaticResource radioButtonStyle}" />
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
<!--#endregion-->

<!--#region 托盘气缸-->
<Grid
Name="tp"
Grid.Row="2"
Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition />
</Grid.RowDefinitions>
<pry:ImageBorder
Grid.RowSpan="2"
Width="{Binding ElementName=tp, Path=ActualWidth}"
Height="{Binding ElementName=tp, Path=ActualHeight}" />

<Image
Margin="2,3,0,0"
HorizontalAlignment="Left"
Source="/BPASmartClient.CustomResource;component/Image/标签.png" />
<TextBlock
Margin="10,0,0,0"
VerticalAlignment="Center"
FontSize="16"
Foreground="Aqua"
Text="托盘气缸控制" />
<ListView
Grid.Row="2"
Margin="10"
Background="Transparent"
BorderBrush="#00BEFA"
BorderThickness="0"
ItemsSource="{Binding PalletCylinders}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid
HorizontalAlignment="Left"
VerticalAlignment="Top"
Columns="8" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>

<ListView.ItemTemplate>
<DataTemplate>
<Grid
Width="200"
Height="50"
HorizontalAlignment="Center"
VerticalAlignment="Center"
LeftTogIsChecked="{Binding LeftTog}"
RightTogIsChecked="{Binding RightTog}" />

<RadioButton
Grid.Row="2"
Grid.Column="1"
Content="打开"
Foreground="Aqua"
IsChecked="True"
Style="{StaticResource radioButtonStyle}" />
<RadioButton
Grid.Row="2"
Grid.Column="2"
Content="关闭"
Foreground="Aqua"
IsChecked="False"
Style="{StaticResource radioButtonStyle}" />
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>

<!--<UniformGrid Columns="7" Rows="5">
<Grid
Width="200"
Height="100"
Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition />
<RowDefinition Height="30" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*" />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="1"
Grid.ColumnSpan="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="Aqua"
Text="设备1" />

<pry:Cylinder
Grid.Row="1"
Grid.ColumnSpan="3"
Width="200"
Height="50"
HorizontalAlignment="Center"
VerticalAlignment="Center" />

<RadioButton
Grid.Row="2"
Grid.Column="1"
Content="打开"
Foreground="Aqua"
IsChecked="True"
Style="{StaticResource radioButtonStyle}" />
<RadioButton
Grid.Row="2"
Grid.Column="2"
Content="关闭"
Foreground="Aqua"
IsChecked="False"
Style="{StaticResource radioButtonStyle}" />
</Grid>


</UniformGrid>-->
Height="100"
Margin="0,0,0,15"
Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition />
<RowDefinition Height="30" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*" />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="1"
Grid.ColumnSpan="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="Aqua"
Text="{Binding Name}" />

<pry:Cylinder
Grid.Row="1"
Grid.ColumnSpan="3"
Width="200"
Height="50"
HorizontalAlignment="Center"
VerticalAlignment="Center"
LeftTogIsChecked="{Binding LeftTog}"
RightTogIsChecked="{Binding RightTog}" />

<RadioButton
Grid.Row="2"
Grid.Column="1"
Command="{Binding DataContext.Open, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}"
CommandParameter="{Binding Name}"
Content="伸出"
Foreground="Aqua"
IsChecked="True"
Style="{StaticResource radioButtonStyle}" />

<RadioButton
Grid.Row="2"
Grid.Column="2"
Command="{Binding DataContext.Close, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}"
CommandParameter="{Binding Name}"
Content="缩回"
Foreground="Aqua"
IsChecked="False"
Style="{StaticResource radioButtonStyle}" />
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
<!--#endregion-->









+ 552
- 299
DosingSystem/View/RecipeControlView.xaml
File diff soppresso perché troppo grande
Vedi File


+ 187
- 240
DosingSystem/View/RecipeSettingsView.xaml Vedi File

@@ -24,7 +24,6 @@
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="20" />
<Setter Property="Background" Value="Transparent" />
<!--<Setter Property="Foreground" Value="{StaticResource FontColor}" />-->
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>
@@ -37,6 +36,8 @@
<Setter Property="BorderThickness" Value="0" />
</Style>

<Style x:Key="ListViewStyle" TargetType="ListView" />

</UserControl.Resources>

<UserControl.DataContext>
@@ -90,253 +91,199 @@
</StackPanel>
<!--#endregion-->

<ScrollViewer Grid.Row="2">
<ListView
Margin="5"
VerticalAlignment="Top"
Background="Transparent"
BorderThickness="0"
ItemsSource="{Binding Recipes}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid
HorizontalAlignment="Left"
<ListBox
Grid.Row="2"
Margin="5"
VerticalAlignment="Top"
Background="Transparent"
BorderThickness="0"
ItemsSource="{Binding Recipes}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid
HorizontalAlignment="Left"
VerticalAlignment="Top"
Columns="8" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>

<ListBox.ItemTemplate>
<DataTemplate>

<Grid
Name="tt"
Height="220"
Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition Height="20" />
<RowDefinition Height="128" />
<RowDefinition Height="2" />
<RowDefinition Height="40" />
</Grid.RowDefinitions>

<Image
Grid.RowSpan="5"
Source="/BPASmartClient.CustomResource;component/Image/配方背景/竖背景框.png"
Stretch="Fill" />

<TextBlock
Grid.Row="0"
Margin="2,5,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Top"
Columns="8" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
FontSize="18"
Foreground="#FF2AB2E7"
Text="{Binding RecipeName}" />

<ListView.ItemTemplate>
<DataTemplate>
<Border Margin="5" Background="LightSkyBlue">
<TextBlock
Grid.Row="1"
Margin="5,0,0,0"
VerticalAlignment="Top"
Foreground="#FF2AB2E7"
Text="配方信息:" />

<ScrollViewer
Grid.Row="2"
VerticalAlignment="Top"
Background="Transparent"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="0.25*" />
<RowDefinition Height="0.2*" />
</Grid.RowDefinitions>

<Image Source="/BPASmartClient.CustomResource;component/Image/AGV/炒锅.png" />

<TextBlock
Grid.Row="1"
Margin="2,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="#dd000000"
Text="{Binding RecipeName}" />

<Grid
Name="gr"
Grid.Row="2"
Height="30">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<pry:IcoButton
Width="{Binding ElementName=gr, Path=ActualWidth}"
Height="{Binding ElementName=gr, Path=ActualHeight}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
BorderThickness="0"
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}"
CommandParameter="{Binding RecipCode}"
Content="删除"
EnterBackground="Red"
FontStyle="Normal"
Foreground="#dd000000"
IcoText="&#xe68e;"
Style="{StaticResource IcoButtonStyle}" />

<pry:IcoButton
Grid.Column="1"
Width="{Binding ElementName=gr, Path=ActualWidth}"
Height="{Binding ElementName=gr, Path=ActualHeight}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
BorderThickness="0"
Command="{Binding DataContext.DetailsCommand, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}"
CommandParameter="{Binding RecipCode}"
Content="编辑"
EnterBackground="#FF2AB2E7"
Foreground="#dd000000"
IcoText="&#xe636;"
Style="{StaticResource IcoButtonStyle}" />

</Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<ItemsControl ItemsSource="{Binding RawMaterials}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid>
<TextBlock
Grid.Row="1"
Margin="5,0,0,0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Foreground="#aa2AB2E7"
Text="{Binding RawMaterialName}" />
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>

<ItemsControl Grid.Column="1" ItemsSource="{Binding RawMaterials}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">

<TextBlock
Margin="5,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="#aa2AB2E7"
Text=":" />

<TextBlock
Margin="5,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="#aa2AB2E7"
Text="{Binding RawMaterialWeight}" />

<TextBlock
Margin="5,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="#aa2AB2E7"
Text="g" />

</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>

</Grid>
</Border>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</ScrollViewer>



<!--<UniformGrid
Grid.Row="2"
Height="200"
VerticalAlignment="Top"
Columns="10">
<Border
Margin="10"
Background="LightSkyBlue"
BorderThickness="1">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="0.25*" />
<RowDefinition Height="0.2*" />
</Grid.RowDefinitions>

<Image Source="/BPASmartClient.CustomResource;component/Image/AGV/炒锅.png" />

<TextBlock
Grid.Row="1"
Margin="2,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="#dd000000"
Text="配方名称" />

<Grid Name="gr" Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<pry:IcoButton
Width="{Binding ElementName=gr, Path=ActualWidth}"
Height="{Binding ElementName=gr, Path=ActualHeight}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
BorderThickness="0"
Content="删除"
EnterBackground="Red"
FontStyle="Normal"
Foreground="#dd000000"
IcoText="&#xe68e;"
Style="{StaticResource IcoButtonStyle}" />

<pry:IcoButton
Grid.Column="1"
Width="{Binding ElementName=gr, Path=ActualWidth}"
Height="{Binding ElementName=gr, Path=ActualHeight}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
BorderThickness="0"
Content="编辑"
EnterBackground="#FF2AB2E7"
Foreground="#dd000000"
IcoText="&#xe68e;"
Style="{StaticResource IcoButtonStyle}" />

</ScrollViewer>

<!--<Grid
Grid.Row="3"
Height="2"
VerticalAlignment="Bottom">
<Grid.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/直线.png" Stretch="Fill" />
</Grid.Background>
</Grid>-->

<Image
Grid.Row="3"
Width="{Binding ElementName=tt, Path=ActualWidth}"
Height="2"
VerticalAlignment="Bottom"
Source="/BPASmartClient.CustomResource;component/Image/直线.png"
Stretch="Fill" />

<Grid
Name="gr"
Grid.Row="4"
Height="30"
Margin="0,0,0,10"
VerticalAlignment="Bottom"
Background="Transparent">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<!--<Image
Height="2"
Grid.ColumnSpan="2"
Width="{Binding ElementName=gr, Path=ActualWidth}"
VerticalAlignment="Top"
Source="/BPASmartClient.CustomResource;component/Image/直线.png" />-->

<pry:IcoButton
Width="{Binding ElementName=gr, Path=ActualWidth}"
Height="{Binding ElementName=gr, Path=ActualHeight}"
Margin="4,4,3,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="#11F53F62"
BorderThickness="0"
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}"
CommandParameter="{Binding RecipCode}"
Content="删除"
EnterBackground="#22F53F62"
FontStyle="Normal"
Foreground="#FFF53F62"
IcoText="&#xe68e;"
Style="{StaticResource IcoButtonStyle}" />

<pry:IcoButton
Grid.Column="1"
Width="{Binding ElementName=gr, Path=ActualWidth}"
Height="{Binding ElementName=gr, Path=ActualHeight}"
Margin="3,4,4,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="#112AB2E7"
BorderThickness="0"
Command="{Binding DataContext.DetailsCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}"
CommandParameter="{Binding RecipCode}"
Content="编辑"
EnterBackground="#222AB2E7"
Foreground="#FF2AB2E7"
IcoText="&#xe636;"
Style="{StaticResource IcoButtonStyle}" />

</Grid>
<!--</StackPanel>-->
</Grid>

</Grid>
</Border>
</UniformGrid>-->

</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>

<!--#region 表格数据显示-->
<!--<ScrollViewer
Grid.Row="2"
Visibility="Collapsed"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding Recipes}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<RadioButton Background="Transparent" GroupName="all">
<RadioButton.Template>
<ControlTemplate TargetType="RadioButton">

<Grid Name="gr" Height="30">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.3*" />
<ColumnDefinition />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.5*" />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="0"
Foreground="#ff00ccff"
Style="{StaticResource TextBlockStyle}"
Text="{Binding SerialNum}" />

<Grid Grid.Column="1">
<TextBlock
Margin="5,0,0,0"
HorizontalAlignment="Left"
Foreground="#ff00ccff"
Style="{StaticResource TextBlockStyle}"
Text="{Binding RecipeName}" />
</Grid>


<TextBlock
Grid.Column="2"
Foreground="#ff00ccff"
Style="{StaticResource TextBlockStyle}"
Text="{Binding RecipCode}" />

-->
<!--<Grid Grid.Column="3">

<Button
Command="{Binding DataContext.EditCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding RecipCode}"
Content="编辑"
Style="{StaticResource buttonStyle}" />
</Grid>-->
<!--


<Grid Grid.Column="5">
<Button
Command="{Binding DataContext.DetailsCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding RecipCode}"
Content="详情"
Style="{StaticResource buttonStyle}" />
</Grid>

<Grid Grid.Column="6">
<Button
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding RecipCode}"
Content="删除"
Style="{StaticResource buttonStyle}" />
</Grid>

</Grid>

<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="gr" Property="Background" Value="#3300ccff" />
</Trigger>

<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="gr" Property="Background" Value="#3300ccff" />
</Trigger>

</ControlTemplate.Triggers>
</ControlTemplate>
</RadioButton.Template>
</RadioButton>


</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>-->
<!--#endregion-->
</Grid>
</UserControl>

+ 14
- 11
DosingSystem/ViewModel/ChangeDeviceNameViewModel.cs Vedi File

@@ -28,25 +28,28 @@ namespace BPASmartClient.DosingSystem.ViewModel
ErrorInfo = "设备名称不能为空";
return;
}
int index = Array.FindIndex(DeviceListViewModel.devices.ToArray(), p => p.IpAddress == IpAddress);
if (index >= 0 && index < DeviceListViewModel.devices.Count)
int index = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.IpAddress == IpAddress);
if (index >= 0 && index < DeviceInquire.GetInstance.devices.Count)
{
if (DeviceListViewModel.devices.FirstOrDefault(p => p.DeviceName == DeviceName) != null)
if (DeviceInquire.GetInstance.devices.FirstOrDefault(p => p.DeviceName == DeviceName) != null)
ErrorInfo = "设备名称已存在";
else
{
var res = Global.DeviceRawMaterials.FirstOrDefault(p => p.RawMaterialName == DeviceListViewModel.devices.ElementAt(index).DeviceName);
res.RawMaterialName = DeviceName;
DeviceListViewModel.devices.ElementAt(index).DeviceName = DeviceName;
DeviceInquire.GetInstance.GetDevice(IpAddress).SetDeviceName(DeviceName);//设置PLC名称
for (int i = 0; i < Json<LocaPar>.Data.Recipes.Count; i++)
var res = Global.DeviceRawMaterials.FirstOrDefault(p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(index).DeviceName);
if (res != null)
{
for (int m = 0; m < Json<LocaPar>.Data.Recipes.ElementAt(i).RawMaterials.Count; m++)
res.RawMaterialName = DeviceName;
DeviceInquire.GetInstance.devices.ElementAt(index).DeviceName = DeviceName;
DeviceInquire.GetInstance.GetDevice(IpAddress).SetDeviceName(DeviceName);//设置PLC名称
for (int i = 0; i < Json<LocaPar>.Data.Recipes.Count; i++)
{
Json<LocaPar>.Data.Recipes.ElementAt(i).RawMaterials.ElementAt(m).RawMaterialName = DeviceName;
for (int m = 0; m < Json<LocaPar>.Data.Recipes.ElementAt(i).RawMaterials.Count; m++)
{
Json<LocaPar>.Data.Recipes.ElementAt(i).RawMaterials.ElementAt(m).RawMaterialName = DeviceName;
}
}
ActionManage.GetInstance.Send("ChangeDeviceNameViewClose");
}
ActionManage.GetInstance.Send("ChangeDeviceNameViewClose");
}
}



+ 1
- 1
DosingSystem/ViewModel/DeviceListViewModel.cs Vedi File

@@ -33,7 +33,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
public RelayCommand<object> ChangeNameCommand { get; set; }

//public static ObservableCollection<Devices> devices { get; set; } = new ObservableCollection<Devices>();
public static ObservableCollection<Devices> devices { get; set; }
public ObservableCollection<Devices> devices { get; set; }
}

public class Devices : ObservableObject


+ 48
- 2
DosingSystem/ViewModel/ManualControlViewModel.cs Vedi File

@@ -5,6 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System.Collections.ObjectModel;
using Microsoft.Toolkit.Mvvm.Input;

namespace BPASmartClient.DosingSystem.ViewModel
{
@@ -12,19 +13,64 @@ namespace BPASmartClient.DosingSystem.ViewModel
{
public ManualControlViewModel()
{
for (int i = 0; i < 40; i++)
for (int i = 0; i < 15; i++)
{
cylinderModels.Add(new CylinderModel()
{
Name = $"设备 {i.ToString()}",
Name = $"升降气缸 {i + 1}",
LeftTog = false,
RightTog = false,
});

BlockCylinders.Add(new CylinderModel()
{
Name = $"阻挡气缸 {i + 1}",
LeftTog = false,
RightTog = false,
});
}

for (int i = 0; i < 4; i++)
{
PalletCylinders.Add(new CylinderModel()
{
Name = $"托盘气缸 {i + 1}",
LeftTog = false,
RightTog = false,
});
}

Open = new RelayCommand<object>((o) =>
{

});


Close = new RelayCommand<object>((o) =>
{

});
}

/// <summary>
/// 升降气缸
/// </summary>
public ObservableCollection<CylinderModel> cylinderModels { get; set; } = new ObservableCollection<CylinderModel>();

/// <summary>
/// 阻挡气缸
/// </summary>
public ObservableCollection<CylinderModel> BlockCylinders { get; set; } = new ObservableCollection<CylinderModel>();

/// <summary>
/// 托盘气缸
/// </summary>
public ObservableCollection<CylinderModel> PalletCylinders { get; set; } = new ObservableCollection<CylinderModel>();

public RelayCommand<object> Open { get; set; }

public RelayCommand<object> Close { get; set; }

}

public class CylinderModel : ObservableObject


+ 3
- 3
DosingSystem/ViewModel/NewRecipeViewModel.cs Vedi File

@@ -59,14 +59,14 @@ namespace BPASmartClient.DosingSystem.ViewModel
if (RecipeName == String.Empty) { ErrorInfo = "配方名称未填写"; return; }
for (int i = 0; i < RawMaterials.Count; i++)
{
var res = DeviceListViewModel.devices.FirstOrDefault(p => p.DeviceName == RawMaterials.ElementAt(i).RawMaterialName);
var res = DeviceInquire.GetInstance.devices.FirstOrDefault(p => p.DeviceName == RawMaterials.ElementAt(i).RawMaterialName);
if (res != null)
{
RawMaterials.ElementAt(i).DeviceIp = res.IpAddress;//根据设备名称和原料名称的唯一匹配关系,给原料配置IP
RawMaterials.ElementAt(i).RawMaterialSource = 1;
}
var su = Global.DeviceRawMaterials.FirstOrDefault(p => p.RawMaterialName == RawMaterials.ElementAt(i).RawMaterialName);
if(su != null)
if (su != null)
{
RawMaterials.ElementAt(i).RawMaterialSource = su.RawMaterialSource;
}
@@ -179,7 +179,7 @@ namespace BPASmartClient.DosingSystem.ViewModel

public RelayCommand SaveCommand { get; set; }

public ObservableCollection<RawMaterialModel> RawMaterials { get; set; } = new ObservableCollection<RawMaterialModel> ();
public ObservableCollection<RawMaterialModel> RawMaterials { get; set; } = new ObservableCollection<RawMaterialModel>();


public ObservableCollection<string> RawMaterialNames { get; set; } = new ObservableCollection<string>();


+ 9
- 0
SCADA.Test/App.xaml Vedi File

@@ -0,0 +1,9 @@
<Application x:Class="SCADA.Test.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:SCADA.Test"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>

+ 17
- 0
SCADA.Test/App.xaml.cs Vedi File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace SCADA.Test
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}

+ 10
- 0
SCADA.Test/AssemblyInfo.cs Vedi File

@@ -0,0 +1,10 @@
using System.Windows;

[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]

+ 32
- 0
SCADA.Test/Converters/ZoomConverter.cs Vedi File

@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;


namespace SCADA.Test.Converters
{
public class ZoomConverter : IValueConverter
{
public bool IsHeight { get; set; }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (double.TryParse(value.ToString(), out double zoom))
{
return IsHeight ? zoom * 1080 : zoom * 1920;
}
else
{
return IsHeight ? 1080 : 1920;
}
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return value;
}
}
}

+ 61
- 0
SCADA.Test/MainWindow.xaml Vedi File

@@ -0,0 +1,61 @@
<Window x:Class="SCADA.Test.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
WindowState="Maximized"
WindowStartupLocation="CenterScreen"
xmlns:local="clr-namespace:SCADA.Test"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="200"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="40"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Button Click="Button_Click">加载文件</Button>

<local:RunCanvas Grid.Row="1" x:Name="runCanvas"/>

<Grid Grid.Column="1" Grid.RowSpan="2">

<Border BorderBrush="AntiqueWhite" BorderThickness="3">
<StackPanel>
<TextBlock Margin="10,0,0,10" FontSize="24" HorizontalAlignment="Center">运行消息发送</TextBlock>

<TextBlock Margin="10,0,0,10" FontSize="16">消息名称</TextBlock>
<ComboBox x:Name="mlname"></ComboBox>

<TextBlock Margin="10,0,0,10" FontSize="16">号</TextBlock>
<TextBox x:Name="hm">1</TextBox>

<TextBlock Margin="10,0,0,10" FontSize="16">消息</TextBlock>
<ComboBox x:Name="xx"></ComboBox>

<Button Margin="10,10,0,10" Width="100" Height="40" Click="Button_Click_1">发送</Button>


<TextBlock Margin="10,0,0,10" FontSize="24" HorizontalAlignment="Center">数据发送</TextBlock>

<TextBlock Margin="10,0,0,10" FontSize="16">消息名称</TextBlock>
<ComboBox x:Name="xxnc"></ComboBox>

<TextBlock Margin="10,0,0,10" FontSize="16">仓号</TextBlock>
<TextBox x:Name="ch">1</TextBox>

<TextBlock Margin="10,0,0,10" FontSize="16">标题</TextBlock>
<TextBox x:Name="bt">标题</TextBox>

<TextBlock Margin="10,0,0,10" FontSize="16">重量</TextBlock>
<TextBox x:Name="zl">35.23</TextBox>

<Button Margin="10,10,0,10" Width="100" Height="40" Click="Button_Click_2" >发送</Button>
</StackPanel>
</Border>
</Grid>
</Grid>
</Window>

+ 137
- 0
SCADA.Test/MainWindow.xaml.cs Vedi File

@@ -0,0 +1,137 @@
using BPASmartClient.MessageCommunication;
using BPASmartClient.MessageName;
using BPASmartClient.MessageName.Enum.物料仓;
using BPASmartClient.MessageName.Enum.运行状态;
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace SCADA.Test
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
List<FrameworkElement> Children = new List<FrameworkElement>();

public MainWindow()
{
InitializeComponent();
xxnc.ItemsSource = System.Enum.GetNames(typeof(MessageNameEnum))?.ToList();
mlname.ItemsSource = System.Enum.GetNames(typeof(MessageNameEnum))?.ToList();
xx.ItemsSource = System.Enum.GetNames(typeof(RunEnum))?.ToList();
}

#region 加载数据
/// <summary>
/// 加载数据
/// </summary>
public void LoadingData(string path)
{
//加载控件
Children.Clear();
FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
using (StreamReader sr = new StreamReader(fs, System.Text.Encoding.Unicode))
{
while (sr.Peek() > -1)
{
string str = sr.ReadLine();
//if (!str.Contains("NewConveyorBelt"))
{
var ele = XamlReader.Parse(str) as FrameworkElement;
Children.Add(ele);
}

}
}
if (Children.Count > 0)
{
runCanvas.Run(Children);
}
}
#endregion

private void Button_Click(object sender, RoutedEventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "布局文件|*.lay";
if (ofd.ShowDialog() ==true)
{
LoadingData(ofd.FileName);
}

}

private void Button_Click_1(object sender, RoutedEventArgs e)
{
if (string.IsNullOrEmpty(mlname.Text))
{
MessageBox.Show("消息名称不能为空!");
return;
}
if (string.IsNullOrEmpty(xx.Text))
{
MessageBox.Show("命令不能为空!");
return;
}
RunEnumModel runEnumModel = new RunEnumModel();
runEnumModel.Run = ToEnumValue<RunEnum>(xx.Text);
runEnumModel.ID = hm.Text;
Class_InnerMessageBus.GetInstance().PostMessage(this, mlname.Text, runEnumModel);
}

/// <summary>
/// 根据枚举名称获取枚举值
/// </summary>
public T ToEnumValue<T>(string name)
{
return (T)Enum.Parse(typeof(T), name);
}

private void Button_Click_2(object sender, RoutedEventArgs e)
{
if (string.IsNullOrEmpty(xxnc.Text))
{
MessageBox.Show("消息名称不能为空!");
return;
}
if (string.IsNullOrEmpty(ch.Text))
{
MessageBox.Show("仓号不能为空!");
return;
}
if (string.IsNullOrEmpty(bt.Text))
{
MessageBox.Show("标题不能为空!");
return;
}
if (string.IsNullOrEmpty(zl.Text))
{
MessageBox.Show("重量不能为空!");
return;
}
SilosMessageModel silosMessage = new SilosMessageModel();
silosMessage.id= ch.Text;
silosMessage.Value = zl.Text;
silosMessage.Title = bt.Text;
Class_InnerMessageBus.GetInstance().PostMessage(this, xxnc.Text, silosMessage);

}
}
}

+ 32
- 0
SCADA.Test/RunCanvas.xaml Vedi File

@@ -0,0 +1,32 @@
<UserControl x:Class="SCADA.Test.RunCanvas"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:con="clr-namespace:SCADA.Test.Converters"
xmlns:local="clr-namespace:SCADA.Test"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<con:ZoomConverter x:Key="ZoomX" IsHeight="False"/>
<con:ZoomConverter x:Key="ZoomY" IsHeight="True"/>
</UserControl.Resources>
<Grid ClipToBounds="True">
<Canvas x:Name="RootCanvas" ClipToBounds="True" Background="Transparent" MouseLeftButtonUp="RootCanvas_MouseLeftButtonUp"
MouseMove="RootCanvas_MouseMove" MouseLeftButtonDown="RootCanvas_MouseLeftButtoDown" MouseWheel="RootCanvas_MouseWheel">
<Canvas.RenderTransform>
<TransformGroup>
<ScaleTransform x:Name="Scale"/>
<TranslateTransform x:Name="Translate"/>
</TransformGroup>
</Canvas.RenderTransform>
</Canvas>

<Grid VerticalAlignment="Bottom" Background="#4B959595">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="8 0">
<CheckBox x:Name="DragEnable" Content="拖动" Margin="4"/>
<CheckBox x:Name="ZoomEnable" Content="缩放" Margin="4"/>
</StackPanel>
</Grid>
</Grid>
</UserControl>

+ 132
- 0
SCADA.Test/RunCanvas.xaml.cs Vedi File

@@ -0,0 +1,132 @@
using BPASmartClient.Compiler;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace SCADA.Test
{
/// <summary>
/// RunCanvas.xaml 的交互逻辑
/// </summary>
public partial class RunCanvas : UserControl
{
public RunCanvas()
{
InitializeComponent();
Unloaded += (s, e) => Destory();
}

/// <summary>
/// Dispose子集
/// </summary>
public void Destory()
{
foreach (var item in RootCanvas.Children)
{
if (item is IDisposable disposable)
{
disposable.Dispose();
}
}
}

public void Run(List<FrameworkElement> canvas)
{
RootCanvas.Children.Clear();
foreach (FrameworkElement element in canvas)
{
if (element.GetType().GetInterface("IExecutable") != null)
{
element.GetType().GetProperty("IsExecuteState").SetValue(element, true);
}

if (element is IExecutable executable)
executable.IsExecuteState = true;

RootCanvas.Children.Add(element);
RegisterJsName(element);
}
}

// 注册名称到Js
static void RegisterJsName(FrameworkElement element)
{
Config.GetInstance().SetVariable(element.Name, element);
if (element is Panel panel)
{
foreach (var item in panel.Children)
{
RegisterJsName(item as FrameworkElement);
}
}
}

#region 拖动与缩放
private void RootCanvas_MouseMove(object sender, MouseEventArgs e)
{
if (DragEnable.IsChecked == false)
{
return;
}

if (e.LeftButton == MouseButtonState.Pressed && isPressed)
{
Point point = e.GetPosition(this);
var movex = (point.X - last.X);
var movey = (point.Y - last.Y);

Translate.X += movex;
Translate.Y += movey;
last = point;

}
}

bool isPressed = false;
Point last;//记录上次鼠标坐标位置
private void RootCanvas_MouseLeftButtoDown(object sender, MouseButtonEventArgs e)
{
last = e.GetPosition(this);
isPressed = true;
}

private void RootCanvas_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
isPressed = false;
}

// 缩放
private void RootCanvas_MouseWheel(object sender, MouseWheelEventArgs e)
{
if (ZoomEnable.IsChecked == false)
{
return;
}
var zoomS = (e.Delta / 960d);
var zoom = zoomS + Scale.ScaleX;
if (zoom > 3 || zoom < 0.8)
{
return;
}
Scale.ScaleX = Scale.ScaleY = zoom;

Point mouse = e.GetPosition(RootCanvas);
Point newMouse = new Point(mouse.X * zoomS, mouse.Y * zoomS);

Translate.X -= newMouse.X;
Translate.Y -= newMouse.Y;
}
#endregion
}
}

+ 17
- 0
SCADA.Test/SCADA.Test.csproj Vedi File

@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\BPASmartClient.Compiler\BPASmartClient.Compiler.csproj" />
<ProjectReference Include="..\BPASmartClient.MessageCommunication\BPASmartClient.MessageCommunication.csproj" />
<ProjectReference Include="..\BPASmartClient.MessageName\BPASmartClient.MessageName.csproj" />
<ProjectReference Include="..\BPASmartClient.SCADAControl\BPASmartClient.SCADAControl.csproj" />
</ItemGroup>

</Project>

BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


+ 355
- 0
SCADA.Test/组态软件1.0/BeDesignerSCADA.deps.json Vedi File

@@ -0,0 +1,355 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v6.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v6.0": {
"BeDesignerSCADA/1.0.0": {
"dependencies": {
"AvalonEdit": "6.1.3.50",
"Extended.Wpf.Toolkit": "4.4.0",
"MahApps.Metro.IconPacks": "4.11.0",
"Microsoft.Toolkit.Mvvm": "7.1.2",
"Antlr3.Runtime": "3.4.1.9004",
"BPASmartClient.Compiler": "1.0.0.0",
"BPASmartClient.MessageCommunication": "1.0.0.0",
"BPASmartClient.MessageName": "1.0.0.0",
"BPASmartClient.SCADAControl": "1.0.0.0",
"Unvell.ReoScript": "1.3.1.0"
},
"runtime": {
"BeDesignerSCADA.dll": {}
}
},
"AvalonEdit/6.1.3.50": {
"runtime": {
"lib/net6.0-windows7.0/ICSharpCode.AvalonEdit.dll": {
"assemblyVersion": "6.1.3.50",
"fileVersion": "6.1.3.50"
}
}
},
"Extended.Wpf.Toolkit/4.4.0": {
"runtime": {
"lib/net5.0/Xceed.Wpf.AvalonDock.NET5.dll": {
"assemblyVersion": "4.4.0.0",
"fileVersion": "4.4.0.0"
},
"lib/net5.0/Xceed.Wpf.AvalonDock.Themes.Aero.NET5.dll": {
"assemblyVersion": "4.4.0.0",
"fileVersion": "4.4.0.0"
},
"lib/net5.0/Xceed.Wpf.AvalonDock.Themes.Metro.NET5.dll": {
"assemblyVersion": "4.4.0.0",
"fileVersion": "4.4.0.0"
},
"lib/net5.0/Xceed.Wpf.AvalonDock.Themes.VS2010.NET5.dll": {
"assemblyVersion": "4.4.0.0",
"fileVersion": "4.4.0.0"
},
"lib/net5.0/Xceed.Wpf.Toolkit.NET5.dll": {
"assemblyVersion": "4.4.0.0",
"fileVersion": "4.4.0.0"
}
},
"resources": {
"lib/net5.0/cs-CZ/Xceed.Wpf.AvalonDock.NET5.resources.dll": {
"locale": "cs-CZ"
},
"lib/net5.0/de/Xceed.Wpf.AvalonDock.NET5.resources.dll": {
"locale": "de"
},
"lib/net5.0/es/Xceed.Wpf.AvalonDock.NET5.resources.dll": {
"locale": "es"
},
"lib/net5.0/fr/Xceed.Wpf.AvalonDock.NET5.resources.dll": {
"locale": "fr"
},
"lib/net5.0/hu/Xceed.Wpf.AvalonDock.NET5.resources.dll": {
"locale": "hu"
},
"lib/net5.0/it/Xceed.Wpf.AvalonDock.NET5.resources.dll": {
"locale": "it"
},
"lib/net5.0/ja-JP/Xceed.Wpf.AvalonDock.NET5.resources.dll": {
"locale": "ja-JP"
},
"lib/net5.0/pt-BR/Xceed.Wpf.AvalonDock.NET5.resources.dll": {
"locale": "pt-BR"
},
"lib/net5.0/ro/Xceed.Wpf.AvalonDock.NET5.resources.dll": {
"locale": "ro"
},
"lib/net5.0/ru/Xceed.Wpf.AvalonDock.NET5.resources.dll": {
"locale": "ru"
},
"lib/net5.0/sv/Xceed.Wpf.AvalonDock.NET5.resources.dll": {
"locale": "sv"
},
"lib/net5.0/zh-Hans/Xceed.Wpf.AvalonDock.NET5.resources.dll": {
"locale": "zh-Hans"
}
}
},
"MahApps.Metro.IconPacks/4.11.0": {
"runtime": {
"lib/net5.0-windows7.0/MahApps.Metro.IconPacks.BootstrapIcons.dll": {
"assemblyVersion": "4.0.0.0",
"fileVersion": "4.11.0.12"
},
"lib/net5.0-windows7.0/MahApps.Metro.IconPacks.BoxIcons.dll": {
"assemblyVersion": "4.0.0.0",
"fileVersion": "4.11.0.12"
},
"lib/net5.0-windows7.0/MahApps.Metro.IconPacks.Codicons.dll": {
"assemblyVersion": "4.0.0.0",
"fileVersion": "4.11.0.12"
},
"lib/net5.0-windows7.0/MahApps.Metro.IconPacks.Coolicons.dll": {
"assemblyVersion": "4.0.0.0",
"fileVersion": "4.11.0.12"
},
"lib/net5.0-windows7.0/MahApps.Metro.IconPacks.Core.dll": {
"assemblyVersion": "4.0.0.0",
"fileVersion": "4.11.0.12"
},
"lib/net5.0-windows7.0/MahApps.Metro.IconPacks.Entypo.dll": {
"assemblyVersion": "4.0.0.0",
"fileVersion": "4.11.0.12"
},
"lib/net5.0-windows7.0/MahApps.Metro.IconPacks.EvaIcons.dll": {
"assemblyVersion": "4.0.0.0",
"fileVersion": "4.11.0.12"
},
"lib/net5.0-windows7.0/MahApps.Metro.IconPacks.FeatherIcons.dll": {
"assemblyVersion": "4.0.0.0",
"fileVersion": "4.11.0.12"
},
"lib/net5.0-windows7.0/MahApps.Metro.IconPacks.FileIcons.dll": {
"assemblyVersion": "4.0.0.0",
"fileVersion": "4.11.0.12"
},
"lib/net5.0-windows7.0/MahApps.Metro.IconPacks.FontAwesome.dll": {
"assemblyVersion": "4.0.0.0",
"fileVersion": "4.11.0.12"
},
"lib/net5.0-windows7.0/MahApps.Metro.IconPacks.Fontaudio.dll": {
"assemblyVersion": "4.0.0.0",
"fileVersion": "4.11.0.12"
},
"lib/net5.0-windows7.0/MahApps.Metro.IconPacks.Fontisto.dll": {
"assemblyVersion": "4.0.0.0",
"fileVersion": "4.11.0.12"
},
"lib/net5.0-windows7.0/MahApps.Metro.IconPacks.ForkAwesome.dll": {
"assemblyVersion": "4.0.0.0",
"fileVersion": "4.11.0.12"
},
"lib/net5.0-windows7.0/MahApps.Metro.IconPacks.Ionicons.dll": {
"assemblyVersion": "4.0.0.0",
"fileVersion": "4.11.0.12"
},
"lib/net5.0-windows7.0/MahApps.Metro.IconPacks.JamIcons.dll": {
"assemblyVersion": "4.0.0.0",
"fileVersion": "4.11.0.12"
},
"lib/net5.0-windows7.0/MahApps.Metro.IconPacks.Material.dll": {
"assemblyVersion": "4.0.0.0",
"fileVersion": "4.11.0.12"
},
"lib/net5.0-windows7.0/MahApps.Metro.IconPacks.MaterialDesign.dll": {
"assemblyVersion": "4.0.0.0",
"fileVersion": "4.11.0.12"
},
"lib/net5.0-windows7.0/MahApps.Metro.IconPacks.MaterialLight.dll": {
"assemblyVersion": "4.0.0.0",
"fileVersion": "4.11.0.12"
},
"lib/net5.0-windows7.0/MahApps.Metro.IconPacks.Microns.dll": {
"assemblyVersion": "4.0.0.0",
"fileVersion": "4.11.0.12"
},
"lib/net5.0-windows7.0/MahApps.Metro.IconPacks.Modern.dll": {
"assemblyVersion": "4.0.0.0",
"fileVersion": "4.11.0.12"
},
"lib/net5.0-windows7.0/MahApps.Metro.IconPacks.Octicons.dll": {
"assemblyVersion": "4.0.0.0",
"fileVersion": "4.11.0.12"
},
"lib/net5.0-windows7.0/MahApps.Metro.IconPacks.PicolIcons.dll": {
"assemblyVersion": "4.0.0.0",
"fileVersion": "4.11.0.12"
},
"lib/net5.0-windows7.0/MahApps.Metro.IconPacks.PixelartIcons.dll": {
"assemblyVersion": "4.0.0.0",
"fileVersion": "4.11.0.12"
},
"lib/net5.0-windows7.0/MahApps.Metro.IconPacks.RPGAwesome.dll": {
"assemblyVersion": "4.0.0.0",
"fileVersion": "4.11.0.12"
},
"lib/net5.0-windows7.0/MahApps.Metro.IconPacks.RadixIcons.dll": {
"assemblyVersion": "4.0.0.0",
"fileVersion": "4.11.0.12"
},
"lib/net5.0-windows7.0/MahApps.Metro.IconPacks.RemixIcon.dll": {
"assemblyVersion": "4.0.0.0",
"fileVersion": "4.11.0.12"
},
"lib/net5.0-windows7.0/MahApps.Metro.IconPacks.SimpleIcons.dll": {
"assemblyVersion": "4.0.0.0",
"fileVersion": "4.11.0.12"
},
"lib/net5.0-windows7.0/MahApps.Metro.IconPacks.Typicons.dll": {
"assemblyVersion": "4.0.0.0",
"fileVersion": "4.11.0.12"
},
"lib/net5.0-windows7.0/MahApps.Metro.IconPacks.Unicons.dll": {
"assemblyVersion": "4.0.0.0",
"fileVersion": "4.11.0.12"
},
"lib/net5.0-windows7.0/MahApps.Metro.IconPacks.VaadinIcons.dll": {
"assemblyVersion": "4.0.0.0",
"fileVersion": "4.11.0.12"
},
"lib/net5.0-windows7.0/MahApps.Metro.IconPacks.WeatherIcons.dll": {
"assemblyVersion": "4.0.0.0",
"fileVersion": "4.11.0.12"
},
"lib/net5.0-windows7.0/MahApps.Metro.IconPacks.Zondicons.dll": {
"assemblyVersion": "4.0.0.0",
"fileVersion": "4.11.0.12"
},
"lib/net5.0-windows7.0/MahApps.Metro.IconPacks.dll": {
"assemblyVersion": "4.0.0.0",
"fileVersion": "4.11.0.12"
}
}
},
"Microsoft.Toolkit.Mvvm/7.1.2": {
"runtime": {
"lib/net5.0/Microsoft.Toolkit.Mvvm.dll": {
"assemblyVersion": "7.1.0.0",
"fileVersion": "7.1.2.1"
}
}
},
"Antlr3.Runtime/3.4.1.9004": {
"runtime": {
"Antlr3.Runtime.dll": {
"assemblyVersion": "3.4.1.9004",
"fileVersion": "3.4.1.9004"
}
}
},
"BPASmartClient.Compiler/1.0.0.0": {
"runtime": {
"BPASmartClient.Compiler.dll": {
"assemblyVersion": "1.0.0.0",
"fileVersion": "1.0.0.0"
}
}
},
"BPASmartClient.MessageCommunication/1.0.0.0": {
"runtime": {
"BPASmartClient.MessageCommunication.dll": {
"assemblyVersion": "1.0.0.0",
"fileVersion": "1.0.0.0"
}
}
},
"BPASmartClient.MessageName/1.0.0.0": {
"runtime": {
"BPASmartClient.MessageName.dll": {
"assemblyVersion": "1.0.0.0",
"fileVersion": "1.0.0.0"
}
}
},
"BPASmartClient.SCADAControl/1.0.0.0": {
"runtime": {
"BPASmartClient.SCADAControl.dll": {
"assemblyVersion": "1.0.0.0",
"fileVersion": "1.0.0.0"
}
}
},
"Unvell.ReoScript/1.3.1.0": {
"runtime": {
"Unvell.ReoScript.dll": {
"assemblyVersion": "1.3.1.0",
"fileVersion": "1.3.1.0"
}
}
}
}
},
"libraries": {
"BeDesignerSCADA/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"AvalonEdit/6.1.3.50": {
"type": "package",
"serviceable": true,
"sha512": "sha512-PtR4iPGu965DMSaDs0RyGi1LK94kUwWIZUGx1Jpg5vJr52KKQPR+KMwIthcpgoQR6xJWKM2MkZ41setJXuzMWA==",
"path": "avalonedit/6.1.3.50",
"hashPath": "avalonedit.6.1.3.50.nupkg.sha512"
},
"Extended.Wpf.Toolkit/4.4.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-EAG/XbjY+m9x1zHj2OE62C8X/Nm09gHyrhi3wnbT/8L06CTW4jtaz4RwN/nupx3sV5U3xsNmeRDILvRw3WO9Ew==",
"path": "extended.wpf.toolkit/4.4.0",
"hashPath": "extended.wpf.toolkit.4.4.0.nupkg.sha512"
},
"MahApps.Metro.IconPacks/4.11.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-hanveh4ZZLYZ00ONrwjyzDJnekxWcgFQ7rHHrmC7GppO3js3tAEhmW+lo0rNgG4naxkggEYZFLeH+rxeJLMSuQ==",
"path": "mahapps.metro.iconpacks/4.11.0",
"hashPath": "mahapps.metro.iconpacks.4.11.0.nupkg.sha512"
},
"Microsoft.Toolkit.Mvvm/7.1.2": {
"type": "package",
"serviceable": true,
"sha512": "sha512-tUQn6ar9oP7kmYaZ6pWabxpQaqw95Bsf+GG7prEL0y5MV5F60z76lI/Ppps9zcTqwd7e5CrdZBcdfor9WuvohA==",
"path": "microsoft.toolkit.mvvm/7.1.2",
"hashPath": "microsoft.toolkit.mvvm.7.1.2.nupkg.sha512"
},
"Antlr3.Runtime/3.4.1.9004": {
"type": "reference",
"serviceable": false,
"sha512": ""
},
"BPASmartClient.Compiler/1.0.0.0": {
"type": "reference",
"serviceable": false,
"sha512": ""
},
"BPASmartClient.MessageCommunication/1.0.0.0": {
"type": "reference",
"serviceable": false,
"sha512": ""
},
"BPASmartClient.MessageName/1.0.0.0": {
"type": "reference",
"serviceable": false,
"sha512": ""
},
"BPASmartClient.SCADAControl/1.0.0.0": {
"type": "reference",
"serviceable": false,
"sha512": ""
},
"Unvell.ReoScript/1.3.1.0": {
"type": "reference",
"serviceable": false,
"sha512": ""
}
}
}

BIN
Vedi File


BIN
Vedi File


+ 15
- 0
SCADA.Test/组态软件1.0/BeDesignerSCADA.runtimeconfig.json Vedi File

@@ -0,0 +1,15 @@
{
"runtimeOptions": {
"tfm": "net6.0",
"frameworks": [
{
"name": "Microsoft.NETCore.App",
"version": "6.0.0"
},
{
"name": "Microsoft.WindowsDesktop.App",
"version": "6.0.0"
}
]
}
}

BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


Dato che sono stati cambiati molti file in questo diff, alcuni di essi non verranno mostrati

Caricamento…
Annulla
Salva