@@ -236,6 +236,12 @@ | |||
<ItemGroup> | |||
<PackageReference Include="BPA.Message" Version="1.0.45" /> | |||
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\BPASmartClient.Helper\BPASmartClient.Helper.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.Model\BPASmartClient.Model.csproj" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
@@ -0,0 +1,34 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.CustomResource.Pages.Model | |||
{ | |||
[AttributeUsage(AttributeTargets.Property)] | |||
public class AlarmAttribute : Attribute | |||
{ | |||
public AlarmAttribute(string Info, AlarmTriggerType alarmTriggerType = AlarmTriggerType.Rising, AlarmLevel alarmLevel = AlarmLevel.一般报警) | |||
{ | |||
AlarmInfo = Info; | |||
AlarmType = alarmTriggerType; | |||
@AlarmLevel = alarmLevel; | |||
} | |||
/// <summary> | |||
/// 报警信息 | |||
/// </summary> | |||
public string AlarmInfo { get; set; } | |||
/// <summary> | |||
/// 告警类型 | |||
/// </summary> | |||
public AlarmTriggerType AlarmType { get; set; } | |||
/// <summary> | |||
/// 告警级别 | |||
/// </summary> | |||
public AlarmLevel @AlarmLevel { get; set; } | |||
} | |||
} |
@@ -0,0 +1,126 @@ | |||
using BPASmartClient.Helper; | |||
using BPASmartClient.Message; | |||
using BPASmartClient.Model; | |||
using System; | |||
using System.Collections.Concurrent; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Reflection; | |||
using System.Text; | |||
using System.Threading; | |||
using System.Threading.Tasks; | |||
using System.Collections.ObjectModel; | |||
using System.Windows; | |||
namespace BPASmartClient.CustomResource.Pages.Model | |||
{ | |||
public class AlarmHelper<AlarmT> where AlarmT : class, new() | |||
{ | |||
public static ObservableCollection<Alarm> Alarms { get; set; } = new ObservableCollection<Alarm>(); | |||
public static List<Alarm> HistoryAlarms { get; set; } = new List<Alarm>(); | |||
static ConcurrentDictionary<string, bool> flagbit = new ConcurrentDictionary<string, bool>(); | |||
static ConcurrentDictionary<string, Delay> delays = new ConcurrentDictionary<string, Delay>(); | |||
public static Action<string> AddAction { get; set; } | |||
public static Action<string> RemoveAction { get; set; } | |||
public static Action ChangeAction { get; set; } | |||
public static AlarmT Alarm { get; set; } = new AlarmT(); | |||
public static void Init() | |||
{ | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
foreach (var item in Alarm.GetType().GetProperties()) | |||
{ | |||
if (item.CustomAttributes.Count() > 0) | |||
{ | |||
var AlarmModel = item.GetCustomAttribute<AlarmAttribute>(); | |||
if (AlarmModel != null) | |||
{ | |||
bool value = Convert.ToBoolean(Alarm.GetType().GetProperty(item.Name)?.GetValue(Alarm)); | |||
EdgeAlarm(value, AlarmModel.AlarmInfo, 1, AlarmModel.AlarmLevel, AlarmModel.AlarmType); | |||
} | |||
} | |||
} | |||
Thread.Sleep(100); | |||
}), "报警通用模块监听"); | |||
} | |||
/// <summary> | |||
/// 沿报警检测 | |||
/// </summary> | |||
/// <param name="Trigger">触发变量</param> | |||
/// <param name="text">报警信息</param> | |||
/// <param name="edgeType">触发类型,上升沿 或 下降沿</param> | |||
private static void EdgeAlarm(bool Trigger, string text, int delay = 2, AlarmLevel alarmLevel = AlarmLevel.一般报警, AlarmTriggerType edgeType = AlarmTriggerType.Rising) | |||
{ | |||
if (!flagbit.ContainsKey(text)) flagbit.TryAdd(text, false); | |||
if (!delays.ContainsKey(text)) delays.TryAdd(text, Delay.GetInstance(text)); | |||
if (edgeType == AlarmTriggerType.Rising ? delays[text].Start(Trigger, delay) : delays[text].Start(!Trigger, delay)) | |||
{ | |||
if (edgeType == AlarmTriggerType.Rising ? !flagbit[text] : flagbit[text]) | |||
{ | |||
AddAlarm(Trigger, text, alarmLevel); | |||
flagbit[text] = edgeType == AlarmTriggerType.Rising ? true : false; | |||
} | |||
} | |||
else RemoveAlarm(text); | |||
if (edgeType == AlarmTriggerType.Rising ? flagbit[text] : !flagbit[text]) flagbit[text] = Trigger; | |||
} | |||
/// <summary> | |||
/// 添加报警信息 | |||
/// </summary> | |||
/// <param name="AlarmInfo">报警信息</param> | |||
private static void AddAlarm(object value, string AlarmInfo, AlarmLevel alarmLevel) | |||
{ | |||
Alarm tempAlarm = new Alarm() | |||
{ | |||
NumId = Alarms.Count + 1, | |||
Date = DateTime.Now.ToString("yyyy/MM/dd"), | |||
Grade = alarmLevel.ToString(), | |||
Info = AlarmInfo, | |||
Value = value.ToString(), | |||
Time = DateTime.Now.ToString("HH:mm:ss"), | |||
}; | |||
var res = Sqlite<Alarm>.GetInstance.Base.Add(tempAlarm); | |||
Sqlite<Alarm>.GetInstance.Save(); | |||
if (Alarms.FirstOrDefault(p => p.Info == AlarmInfo) == null) | |||
{ | |||
Application.Current.Dispatcher.Invoke(new Action(() => | |||
{ | |||
Alarms.Insert(0, tempAlarm); | |||
for (int i = 0; i < Alarms.Count; i++) { Alarms.ElementAt(i).NumId = i + 1; } | |||
})); | |||
AddAction?.Invoke(AlarmInfo);//添加报警通知 | |||
ChangeAction?.Invoke();//更改报警通知 | |||
MessageLog.GetInstance.AddDeviceAlarmLogShow(tempAlarm.Info, Guid.NewGuid().ToString()); | |||
} | |||
} | |||
/// <summary> | |||
/// 移除报警信息 | |||
/// </summary> | |||
/// <param name="AlarmInfo">报警信息</param> | |||
private static void RemoveAlarm(string AlarmInfo) | |||
{ | |||
var result = Alarms.FirstOrDefault(p => p.Info == AlarmInfo); | |||
if (result != null) | |||
{ | |||
Application.Current.Dispatcher.Invoke(new Action(() => | |||
{ | |||
Alarms.Remove(result); | |||
for (int i = 0; i < Alarms.Count; i++) { Alarms.ElementAt(i).NumId = i + 1; } | |||
})); | |||
if (RemoveAction != null) RemoveAction(AlarmInfo); | |||
if (ChangeAction != null) ChangeAction(); | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,14 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.CustomResource.Pages.Model | |||
{ | |||
public enum AlarmLevel | |||
{ | |||
一般报警, | |||
严重报警 | |||
} | |||
} |
@@ -0,0 +1,20 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.CustomResource.Pages.Model | |||
{ | |||
public enum AlarmTriggerType | |||
{ | |||
/// <summary> | |||
/// 上升沿 | |||
/// </summary> | |||
Rising, | |||
/// <summary> | |||
/// 下降沿 | |||
/// </summary> | |||
Falling | |||
} | |||
} |
@@ -0,0 +1,379 @@ | |||
<UserControl | |||
x:Class="BPASmartClient.CustomResource.Pages.View.AlarmView" | |||
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.Pages.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel" | |||
d:DesignHeight="450" | |||
d:DesignWidth="800" | |||
mc:Ignorable="d"> | |||
<UserControl.DataContext> | |||
<vm:AlarmViewModel /> | |||
</UserControl.DataContext> | |||
<UserControl.Resources> | |||
<ResourceDictionary> | |||
<ResourceDictionary.MergedDictionaries> | |||
<ResourceDictionary> | |||
<!--<convert:TextDisplayConvert x:Key="textDisplayConvert" /> | |||
<convert:IsEnableConvert x:Key="isEnableConvert" /> | |||
<convert:AnalogAlarmConvert x:Key="analogAlarmConvert" /> | |||
<convert:DiscreteAlarmConvert x:Key="discreteAlarmConvert" /> | |||
<convert:AlarmTypeTextConvert x:Key="alarmTypeTextConvert" />--> | |||
<SolidColorBrush x:Key="BorderSolid" Color="#5523CACA" /> | |||
<SolidColorBrush x:Key="FontColor" Color="#FF2AB2E7" /> | |||
<SolidColorBrush x:Key="TitleFontColor" Color="#ddd" /> | |||
<SolidColorBrush x:Key="CursorColor" Color="Aqua" /> | |||
<SolidColorBrush x:Key="TitleBorderColor" Color="#FF2AB2E7" /> | |||
<Style x:Key="TextBlockStyle" TargetType="TextBlock"> | |||
<Setter Property="FontFamily" Value="楷体" /> | |||
<Setter Property="FontSize" Value="18" /> | |||
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" /> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
<Setter Property="HorizontalAlignment" Value="Center" /> | |||
</Style> | |||
<Style x:Key="TextBoxStyle" TargetType="TextBox"> | |||
<Setter Property="FontFamily" Value="楷体" /> | |||
<Setter Property="FontSize" Value="22" /> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" /> | |||
<Setter Property="BorderBrush" Value="#FF23CACA" /> | |||
<Setter Property="CaretBrush" Value="Aqua" /> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
</Style> | |||
<Style x:Key="DataTextBlockStyle" TargetType="TextBlock"> | |||
<Setter Property="HorizontalAlignment" Value="Center" /> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="Foreground" Value="Red" /> | |||
<Setter Property="FontSize" Value="14" /> | |||
</Style> | |||
<ControlTemplate x:Key="ButTemplate" TargetType="Button"> | |||
<Border | |||
x:Name="br" | |||
Background="Transparent" | |||
BorderBrush="#FF19B7EC" | |||
BorderThickness="2"> | |||
<StackPanel | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Orientation="Horizontal"> | |||
<ContentControl | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Content="{TemplateBinding Content}" | |||
Foreground="{TemplateBinding Foreground}" /> | |||
</StackPanel> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter TargetName="br" Property="Background" Value="#2219B7EC" /> | |||
</Trigger> | |||
<Trigger Property="IsPressed" Value="true"> | |||
<Setter TargetName="br" Property="Background" Value="#2219B7EC" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</ResourceDictionary> | |||
</ResourceDictionary.MergedDictionaries> | |||
</ResourceDictionary> | |||
</UserControl.Resources> | |||
<Grid Margin="10"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="50" /> | |||
<RowDefinition Height="30" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<StackPanel | |||
Margin="0,8" | |||
HorizontalAlignment="Right" | |||
Orientation="Horizontal"> | |||
<DatePicker | |||
Background="Transparent" | |||
BorderBrush="#aa3aa7f3" | |||
BorderThickness="2" | |||
SelectedDate="{Binding StartDateTime}" | |||
Style="{StaticResource PickerStyle}" | |||
Text="请输入开始时间" | |||
Visibility="{Binding IsVisibility}" /> | |||
<DatePicker | |||
Margin="20,0,20,0" | |||
Background="Transparent" | |||
BorderBrush="#aa3aa7f3" | |||
BorderThickness="2" | |||
SelectedDate="{Binding EndDateTime}" | |||
Style="{StaticResource PickerStyle}" | |||
Text="请输入结束时间" | |||
Visibility="{Binding IsVisibility}" /> | |||
<Button | |||
Width="140" | |||
Height="30" | |||
Background="#FF19B7EC" | |||
Command="{Binding ControlCommand}" | |||
Content="{Binding ControlButText}" | |||
FontFamily="楷体" | |||
FontSize="18" | |||
Template="{StaticResource ButTemplate}"> | |||
<Button.Foreground> | |||
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> | |||
<GradientStop Color="#FFBB662A" /> | |||
<GradientStop Offset="1" Color="White" /> | |||
</LinearGradientBrush> | |||
</Button.Foreground> | |||
</Button> | |||
<Button | |||
Width="140" | |||
Height="30" | |||
Margin="20,0,0,0" | |||
Background="#FF19B7EC" | |||
Command="{Binding SwitchCommand}" | |||
Content="{Binding ButContent}" | |||
FontFamily="楷体" | |||
FontSize="18" | |||
Template="{StaticResource ButTemplate}"> | |||
<Button.Foreground> | |||
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> | |||
<GradientStop Color="#FFBB662A" /> | |||
<GradientStop Offset="1" Color="White" /> | |||
</LinearGradientBrush> | |||
</Button.Foreground> | |||
</Button> | |||
</StackPanel> | |||
<!--#region 表格标题栏设置--> | |||
<Grid Grid.Row="1" Background="#dd2AB2E7"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.3*" /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0.5*" /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="ID" /> | |||
<Grid Grid.Column="1"> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="报警日期" /> | |||
<Border | |||
BorderBrush="{StaticResource TitleBorderColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="2" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="报警时间" /> | |||
<Grid Grid.Column="3"> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="报警信息" /> | |||
<Border | |||
BorderBrush="{StaticResource TitleBorderColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="4" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="报警值" /> | |||
<Grid Grid.Column="5"> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="报警等级" /> | |||
<Border | |||
BorderBrush="{StaticResource TitleBorderColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
</Grid> | |||
<!--#endregion--> | |||
<!--#region 表格数据显示--> | |||
<ScrollViewer | |||
Grid.Row="2" | |||
HorizontalScrollBarVisibility="Hidden" | |||
VerticalScrollBarVisibility="Hidden"> | |||
<Grid> | |||
<!--#region 实时报警信息--> | |||
<ItemsControl ItemsSource="{Binding AlarmInfos}" Visibility="{Binding CurrentDataVis}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid x:Name="gr" Height="30"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.3*" /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0.5*" /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="0" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding NumId}" /> | |||
<Grid Grid.Column="1"> | |||
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Date}" /> | |||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="2" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding Time}" /> | |||
<Grid Grid.Column="3"> | |||
<TextBlock | |||
Margin="10,0,0,0" | |||
HorizontalAlignment="Left" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding Info}" /> | |||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="4" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding Value}" /> | |||
<Grid Grid.Column="5"> | |||
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Grade}" /> | |||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<Border | |||
Grid.ColumnSpan="6" | |||
BorderBrush="{StaticResource BorderSolid}" | |||
BorderThickness="1" /> | |||
</Grid> | |||
<DataTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" /> | |||
</Trigger> | |||
</DataTemplate.Triggers> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
<!--#endregion--> | |||
<!--#region 历史报警信息--> | |||
<ItemsControl ItemsSource="{Binding HistoryAlarm}" Visibility="{Binding HistoryDataVis}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid x:Name="gr" Height="30"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.3*" /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0.5*" /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="0" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding Id}" /> | |||
<Grid Grid.Column="1"> | |||
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Date}" /> | |||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="2" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding Time}" /> | |||
<Grid Grid.Column="3"> | |||
<TextBlock | |||
Margin="10,0,0,0" | |||
HorizontalAlignment="Left" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding Info}" /> | |||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="4" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding Value}" /> | |||
<Grid Grid.Column="5"> | |||
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Grade}" /> | |||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<Border | |||
Grid.ColumnSpan="6" | |||
BorderBrush="{StaticResource BorderSolid}" | |||
BorderThickness="1" /> | |||
</Grid> | |||
<DataTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" /> | |||
</Trigger> | |||
</DataTemplate.Triggers> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
<!--#endregion--> | |||
</Grid> | |||
</ScrollViewer> | |||
<!--#endregion--> | |||
</Grid> | |||
</UserControl> |
@@ -0,0 +1,28 @@ | |||
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.Pages.View | |||
{ | |||
/// <summary> | |||
/// AlarmView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class AlarmView : UserControl | |||
{ | |||
public AlarmView() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,35 @@ | |||
<Window | |||
x:Class="BPASmartClient.CustomResource.Pages.View.LoginView" | |||
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.Pages.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel" | |||
Title="LoginView" | |||
Width="800" | |||
Height="450" | |||
AllowsTransparency="True" | |||
Background="{x:Null}" | |||
WindowStartupLocation="CenterScreen" | |||
WindowStyle="None" | |||
mc:Ignorable="d"> | |||
<Window.DataContext> | |||
<vm:LoginViewModel /> | |||
</Window.DataContext> | |||
<Window.Resources> | |||
<Style x:Key="TxLogin" TargetType="TextBlock"> | |||
<Setter Property="FontSize" Value="20" /> | |||
<Setter Property="Foreground" Value="#ddd" /> | |||
<Setter Property="HorizontalAlignment" Value="Center" /> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
</Style> | |||
</Window.Resources> | |||
<Grid /> | |||
</Window> |
@@ -0,0 +1,27 @@ | |||
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.Shapes; | |||
namespace BPASmartClient.CustomResource.Pages.View | |||
{ | |||
/// <summary> | |||
/// LoginView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class LoginView : Window | |||
{ | |||
public LoginView() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,140 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System.Collections.Concurrent; | |||
using System.Collections.ObjectModel; | |||
using System.Windows; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPASmartClient.Model; | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
namespace BPASmartClient.CustomResource.Pages.ViewModel | |||
{ | |||
public class AlarmViewModel : ObservableObject | |||
{ | |||
public AlarmViewModel() | |||
{ | |||
ControlCommand = new RelayCommand(() => | |||
{ | |||
if (ControlButText == "报警复位") | |||
{ | |||
return; | |||
} | |||
if (ControlButText == "开始查询") | |||
{ | |||
var lists = Sqlite<Alarm>.GetInstance.GetData(); | |||
var res = lists.Where(p => Convert.ToDateTime(p.Date) >= StartDateTime && Convert.ToDateTime(p.Date) <= EndDateTime).ToList(); | |||
if (res != null) | |||
{ | |||
HistoryAlarm.Clear(); | |||
foreach (var item in res) | |||
{ | |||
HistoryAlarm.Add(item); | |||
} | |||
} | |||
} | |||
}); | |||
SwitchCommand = new RelayCommand(() => | |||
{ | |||
if (ButContent == "历史报警") | |||
{ | |||
GetHistoryAlarm(); | |||
CurrentDataVis = Visibility.Hidden; | |||
HistoryDataVis = Visibility.Visible; | |||
IsVisibility = Visibility.Visible; | |||
ControlButText = "开始查询"; | |||
ButContent = "实时报警"; | |||
return; | |||
} | |||
if (ButContent == "实时报警") | |||
{ | |||
HistoryDataVis = Visibility.Hidden; | |||
CurrentDataVis = Visibility.Visible; | |||
IsVisibility = Visibility.Hidden; | |||
ControlButText = "报警复位"; | |||
ButContent = "历史报警"; | |||
return; | |||
} | |||
}); | |||
//AlarmInfos = AlarmHelper<tt>.Alarms; | |||
//AlarmHelper<tt>.Init(); | |||
} | |||
private void GetHistoryAlarm() | |||
{ | |||
var data = Sqlite<Alarm>.GetInstance.GetData(); | |||
if (data != null) | |||
{ | |||
HistoryAlarm.Clear(); | |||
foreach (var item in data) | |||
{ | |||
int day = DateTime.Now.Subtract(Convert.ToDateTime(item.Date)).Days; | |||
if (day == 0) | |||
{ | |||
HistoryAlarm.Add(item); | |||
} | |||
} | |||
} | |||
} | |||
public RelayCommand SwitchCommand { get; set; } | |||
public RelayCommand ControlCommand { get; set; } | |||
public Visibility CurrentDataVis { get { return _mCurrentDataVis; } set { _mCurrentDataVis = value; OnPropertyChanged(); } } | |||
private Visibility _mCurrentDataVis = Visibility.Visible; | |||
public Visibility HistoryDataVis { get { return _mHistoryDataVis; } set { _mHistoryDataVis = value; OnPropertyChanged(); } } | |||
private Visibility _mHistoryDataVis = Visibility.Hidden; | |||
/// <summary> | |||
/// 是否显示 | |||
/// </summary> | |||
public Visibility IsVisibility { get { return _mIsVisibility; } set { _mIsVisibility = value; OnPropertyChanged(); } } | |||
private Visibility _mIsVisibility = Visibility.Hidden; | |||
/// <summary> | |||
/// 文字显示 | |||
/// </summary> | |||
public string ButContent { get { return _mButContent; } set { _mButContent = value; OnPropertyChanged(); } } | |||
private string _mButContent = "历史报警"; | |||
/// <summary> | |||
/// 控制按钮文本显示 | |||
/// </summary> | |||
public string ControlButText { get { return _mControlButText; } set { _mControlButText = value; OnPropertyChanged(); } } | |||
private string _mControlButText = "报警复位"; | |||
/// <summary> | |||
/// 开始时间 | |||
/// </summary> | |||
public DateTime StartDateTime { get { return _mStartDateTime; } set { _mStartDateTime = value; OnPropertyChanged(); } } | |||
private DateTime _mStartDateTime = DateTime.Now; | |||
/// <summary> | |||
/// 结束时间 | |||
/// </summary> | |||
public DateTime EndDateTime { get { return _mEndDateTime; } set { _mEndDateTime = value; OnPropertyChanged(); } } | |||
private DateTime _mEndDateTime = DateTime.Now; | |||
public ObservableCollection<Alarm> AlarmInfos { get; set; } | |||
public ObservableCollection<Alarm> HistoryAlarm { get; set; } = new ObservableCollection<Alarm>(); | |||
} | |||
} |
@@ -0,0 +1,18 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
namespace BPASmartClient.CustomResource.Pages.ViewModel | |||
{ | |||
public class LoginViewModel : ObservableObject | |||
{ | |||
public LoginViewModel() | |||
{ | |||
} | |||
} | |||
} |
@@ -1,57 +0,0 @@ | |||
//using System; | |||
//using System.Collections.Generic; | |||
//using System.ComponentModel.DataAnnotations; | |||
//using System.Linq; | |||
//using System.Text; | |||
//using System.Threading.Tasks; | |||
//namespace BPASmartClient.Device | |||
//{ | |||
// public class Alarm | |||
// { | |||
// /// <summary> | |||
// /// ID | |||
// /// </summary> | |||
// [Key] | |||
// public int Id { get { return _mId; } set { _mId = value; } } | |||
// private int _mId; | |||
// /// <summary> | |||
// /// 编号ID | |||
// /// </summary> | |||
// public int NumId { get { return _mNumId; } set { _mNumId = value; } } | |||
// private int _mNumId; | |||
// /// <summary> | |||
// /// 日期 | |||
// /// </summary> | |||
// public string Date { get { return _mDate; } set { _mDate = value; } } | |||
// private string _mDate; | |||
// /// <summary> | |||
// /// 时间 | |||
// /// </summary> | |||
// public string Time { get { return _mTime; } set { _mTime = value; } } | |||
// private string _mTime; | |||
// /// <summary> | |||
// /// 报警信息 | |||
// /// </summary> | |||
// public string Info { get { return _mInfo; } set { _mInfo = value; } } | |||
// private string _mInfo; | |||
// /// <summary> | |||
// /// 报警值 | |||
// /// </summary> | |||
// public string Value { get { return _mValue; } set { _mValue = value; } } | |||
// private string _mValue; | |||
// /// <summary> | |||
// /// 报警等级 | |||
// /// </summary> | |||
// public string Grade { get { return _mGrade; } set { _mGrade = value; } } | |||
// private string _mGrade; | |||
// } | |||
//} |
@@ -13,6 +13,7 @@ | |||
<Lcid>0</Lcid> | |||
<Isolated>false</Isolated> | |||
<EmbedInteropTypes>true</EmbedInteropTypes> | |||
<UseWindowsForms>true</UseWindowsForms> | |||
</COMReference> | |||
</ItemGroup> | |||
@@ -6,72 +6,80 @@ using System.Reflection; | |||
using System.Runtime.InteropServices; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.ComponentModel; | |||
using System.IO; | |||
namespace BPASmartClient.Helper | |||
{ | |||
public class SystemUtils | |||
{ | |||
//private static ILogger logger = NLog.LogManager.GetCurrentClassLogger(); | |||
public static bool isShowNumBoard = false; | |||
[DllImport("kernel32.dll", SetLastError = true)] | |||
public static extern bool Wow64DisableWow64FsRedirection(ref IntPtr ptr); | |||
[DllImport("kernel32.dll", SetLastError = true)] | |||
public static extern bool Wow64RevertWow64FsRedirection(IntPtr ptr); | |||
public static IntPtr ptr = new IntPtr(); | |||
public static void ShowScreenKeyboard() | |||
{ | |||
try | |||
//获得当前登录的Windows用户标示 | |||
System.Security.Principal.WindowsIdentity identity = System.Security.Principal.WindowsIdentity.GetCurrent(); | |||
System.Security.Principal.WindowsPrincipal principal = new System.Security.Principal.WindowsPrincipal(identity); | |||
//判断当前登录用户是否为管理员 | |||
if (principal.IsInRole(System.Security.Principal.WindowsBuiltInRole.Administrator)) | |||
{ | |||
//ProcessStartInfo psi = new ProcessStartInfo(); | |||
//psi.FileName = @"C:\Windows\System32\osk.exe"; | |||
//psi.UseShellExecute = false; | |||
//psi.CreateNoWindow = true; | |||
//Process.Start(psi); | |||
Process kbpr = System.Diagnostics.Process.Start(@"C:\Windows\System32\osk.exe"); // 打开系统键盘 | |||
////判断软键盘是否进程是否已经存在,如果不存在进行调用 | |||
//Process[] pro = Process.GetProcessesByName("osk"); | |||
//bool isWow64FsRedirectionDisabled = Wow64DisableWow64FsRedirection(ref ptr); | |||
////键盘如果已经打开则重新打开,防止最小化无法显示 | |||
//if (pro != null && pro.Length > 0) | |||
//{ | |||
// Process kbpr = pro[0]; | |||
// kbpr.Kill(); | |||
// if (isWow64FsRedirectionDisabled) | |||
// { | |||
// Process.Start(@"C:WINDOWSsystem32osk.exe"); | |||
// Wow64RevertWow64FsRedirection(ptr); | |||
// } | |||
// return; | |||
//} | |||
////if (isWow64FsRedirectionDisabled) | |||
////{ | |||
//Process.Start(@"C:WINDOWSsystem32osk.exe"); | |||
//Wow64RevertWow64FsRedirection(ptr); | |||
//} | |||
try | |||
{ | |||
Process[] pros = Process.GetProcessesByName("TabTip"); | |||
string path = "C:/Program Files/Common Files/microsoft shared/ink/TabTip.exe"; | |||
if (File.Exists(path)) Process.Start(path); | |||
else | |||
{ | |||
Process[] pro = Process.GetProcessesByName("osk");//判断软键盘是否进程是否已经存在,如果不存在进行调用 | |||
if (pro != null && pro.Length > 0) return;//说明已经存在,不再进行调用 | |||
IntPtr ptr = new IntPtr(); | |||
bool isWow64FsRedirectionDisabled = Wow64DisableWow64FsRedirection(ref ptr); | |||
if (isWow64FsRedirectionDisabled) | |||
{ | |||
Process.Start(@"C:\WINDOWS\system32\osk.exe"); | |||
bool isWow64FsRedirectionReverted = Wow64RevertWow64FsRedirection(ptr); | |||
} | |||
} | |||
} | |||
catch (Exception) | |||
{ | |||
throw; | |||
} | |||
} | |||
catch (Exception ex) | |||
else | |||
{ | |||
//logger.Error(ex.Message); | |||
} | |||
} | |||
//创建启动对象 | |||
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(); | |||
startInfo.FileName = "";//Application.ExecutablePath;//设置运行文件 | |||
startInfo.Arguments = "";// String.Join(" ", args); //设置启动参数 | |||
startInfo.Verb = "runas"; //设置启动动作,确保以管理员身份运行 | |||
System.Diagnostics.Process.Start(startInfo); //如果不是管理员,则启动UAC | |||
//退出应用程序 | |||
} | |||
} | |||
} | |||
} | |||
@@ -79,110 +87,111 @@ namespace BPASmartClient.Helper | |||
//[DllImport("kernel32.dll", SetLastError = true)] | |||
//private static extern bool Wow64DisableWow64FsRedirection(ref IntPtr ptr); | |||
//[DllImport("kernel32.dll", SetLastError = true)] | |||
//public static extern bool Wow64RevertWow64FsRedirection(IntPtr ptr); | |||
//private const UInt32 WM_SYSCOMMAND = 0x112; | |||
//private const UInt32 SC_RESTORE = 0xf120; | |||
//[DllImport("user32.dll", CharSet = CharSet.Auto)] | |||
//static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam); | |||
//private const string OnScreenKeyboadApplication = "osk.exe"; | |||
///// <summary> | |||
///// 启用系统软键盘 | |||
///// </summary> | |||
//public static void OpenKeyBoardFun() | |||
//{ | |||
// try | |||
// { | |||
// //判断软键盘是否进程是否已经存在,如果不存在进行调用 | |||
// Process[] pro = Process.GetProcessesByName("osk"); | |||
// //如果键盘已打开,则进行关闭操作 | |||
// if (pro != null && pro.Length > 0) | |||
// { | |||
// CloseKeyBoardFun(); | |||
// return; | |||
// } | |||
// // Get the name of the On screen keyboard | |||
// string processName = System.IO.Path.GetFileNameWithoutExtension(OnScreenKeyboadApplication); | |||
// // Check whether the application is not running | |||
// var query = from process in Process.GetProcesses() | |||
// where process.ProcessName == processName | |||
// select process; | |||
// var keyboardProcess = query.FirstOrDefault(); | |||
//[DllImport("kernel32.dll", SetLastError = true)] | |||
//private static extern bool Wow64DisableWow64FsRedirection(ref IntPtr ptr); | |||
//[DllImport("kernel32.dll", SetLastError = true)] | |||
//public static extern bool Wow64RevertWow64FsRedirection(IntPtr ptr); | |||
//private const UInt32 WM_SYSCOMMAND = 0x112; | |||
//private const UInt32 SC_RESTORE = 0xf120; | |||
//[DllImport("user32.dll", CharSet = CharSet.Auto)] | |||
//static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam); | |||
//private const string OnScreenKeyboadApplication = "osk.exe"; | |||
// // launch it if it doesn't exist | |||
// if (keyboardProcess == null) | |||
// { | |||
// IntPtr ptr = new IntPtr(); ; | |||
// bool sucessfullyDisabledWow64Redirect = false; | |||
// // Disable x64 directory virtualization if we're on x64, | |||
// // otherwise keyboard launch will fail. | |||
// if (System.Environment.Is64BitOperatingSystem) | |||
// { | |||
// sucessfullyDisabledWow64Redirect = Wow64DisableWow64FsRedirection(ref ptr); | |||
// } | |||
///// <summary> | |||
///// 启用系统软键盘 | |||
///// </summary> | |||
//public static void OpenKeyBoardFun() | |||
//{ | |||
// try | |||
// { | |||
// //判断软键盘是否进程是否已经存在,如果不存在进行调用 | |||
// Process[] pro = Process.GetProcessesByName("osk"); | |||
// //如果键盘已打开,则进行关闭操作 | |||
// if (pro != null && pro.Length > 0) | |||
// { | |||
// CloseKeyBoardFun(); | |||
// return; | |||
// } | |||
// // osk.exe is in windows/system folder. So we can directky call it without path | |||
// using (Process osk = new Process()) | |||
// { | |||
// osk.StartInfo.FileName = OnScreenKeyboadApplication; | |||
// osk.Start(); | |||
// //osk.WaitForInputIdle(2000); | |||
// } | |||
// // Get the name of the On screen keyboard | |||
// string processName = System.IO.Path.GetFileNameWithoutExtension(OnScreenKeyboadApplication); | |||
// // Re-enable directory virtualisation if it was disabled. | |||
// if (System.Environment.Is64BitOperatingSystem) | |||
// if (sucessfullyDisabledWow64Redirect) | |||
// Wow64RevertWow64FsRedirection(ptr); | |||
// } | |||
// else | |||
// { | |||
// // Bring keyboard to the front if it's already running | |||
// var windowHandle = keyboardProcess.MainWindowHandle; | |||
// SendMessage(windowHandle, WM_SYSCOMMAND, new IntPtr(SC_RESTORE), new IntPtr(0)); | |||
// } | |||
// // Check whether the application is not running | |||
// var query = from process in Process.GetProcesses() | |||
// where process.ProcessName == processName | |||
// select process; | |||
// } | |||
// catch (Exception ex) | |||
// { | |||
// //LogUtil.WriteLog(MethodBase.GetCurrentMethod().Name, LogUtil.ERROE, ex.Message); | |||
// //LogUtil.WriteLog(MethodBase.GetCurrentMethod().Name, LogUtil.ERROE, ex.StackTrace); | |||
// } | |||
// var keyboardProcess = query.FirstOrDefault(); | |||
//} | |||
// // launch it if it doesn't exist | |||
// if (keyboardProcess == null) | |||
// { | |||
// IntPtr ptr = new IntPtr(); ; | |||
// bool sucessfullyDisabledWow64Redirect = false; | |||
// // Disable x64 directory virtualization if we're on x64, | |||
// // otherwise keyboard launch will fail. | |||
// if (System.Environment.Is64BitOperatingSystem) | |||
// { | |||
// sucessfullyDisabledWow64Redirect = Wow64DisableWow64FsRedirection(ref ptr); | |||
// } | |||
///// <summary> | |||
///// 关闭系统软键盘 | |||
///// </summary> | |||
//public static void CloseKeyBoardFun() | |||
//{ | |||
// try | |||
// { | |||
// Process[] pros = Process.GetProcessesByName("osk"); | |||
// foreach (Process p in pros) | |||
// { | |||
// p.Kill(); | |||
// } | |||
// } | |||
// catch (Exception ex) | |||
// { | |||
// //LogUtil.WriteLog(MethodBase.GetCurrentMethod().Name, LogUtil.ERROE, ex.Message); | |||
// //LogUtil.WriteLog(MethodBase.GetCurrentMethod().Name, LogUtil.ERROE, ex.StackTrace); | |||
// } | |||
//} | |||
// // osk.exe is in windows/system folder. So we can directky call it without path | |||
// using (Process osk = new Process()) | |||
// { | |||
// osk.StartInfo.FileName = OnScreenKeyboadApplication; | |||
// osk.Start(); | |||
// //osk.WaitForInputIdle(2000); | |||
// } | |||
// // Re-enable directory virtualisation if it was disabled. | |||
// if (System.Environment.Is64BitOperatingSystem) | |||
// if (sucessfullyDisabledWow64Redirect) | |||
// Wow64RevertWow64FsRedirection(ptr); | |||
// } | |||
// else | |||
// { | |||
// // Bring keyboard to the front if it's already running | |||
// var windowHandle = keyboardProcess.MainWindowHandle; | |||
// SendMessage(windowHandle, WM_SYSCOMMAND, new IntPtr(SC_RESTORE), new IntPtr(0)); | |||
// } | |||
} | |||
// } | |||
// catch (Exception ex) | |||
// { | |||
// //LogUtil.WriteLog(MethodBase.GetCurrentMethod().Name, LogUtil.ERROE, ex.Message); | |||
// //LogUtil.WriteLog(MethodBase.GetCurrentMethod().Name, LogUtil.ERROE, ex.StackTrace); | |||
// } | |||
//} | |||
///// <summary> | |||
///// 关闭系统软键盘 | |||
///// </summary> | |||
//public static void CloseKeyBoardFun() | |||
//{ | |||
// try | |||
// { | |||
// Process[] pros = Process.GetProcessesByName("osk"); | |||
// foreach (Process p in pros) | |||
// { | |||
// p.Kill(); | |||
// } | |||
// } | |||
// catch (Exception ex) | |||
// { | |||
// //LogUtil.WriteLog(MethodBase.GetCurrentMethod().Name, LogUtil.ERROE, ex.Message); | |||
// //LogUtil.WriteLog(MethodBase.GetCurrentMethod().Name, LogUtil.ERROE, ex.StackTrace); | |||
// } | |||
//} | |||
} |
@@ -52,6 +52,9 @@ namespace BPASmartClient.JAKA | |||
case "JaKaProgramName": | |||
if (par?.Value is string stringvalue) jaKaHelper.JaKaProgramName(stringvalue); | |||
break; | |||
case "JakaDOutput": | |||
if (par?.Value is bool DO_value && par?.DO_Index is int DO_Index) jaKaHelper.Set_RobotDO(DO_Index, DO_value); | |||
break; | |||
default: | |||
break; | |||
} | |||
@@ -6,6 +6,7 @@ | |||
<ItemGroup> | |||
<PackageReference Include="NModbus" Version="3.0.72" /> | |||
<PackageReference Include="System.Text.Encoding.CodePages" Version="6.0.0" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
@@ -3,6 +3,7 @@ using BPASmartClient.Message; | |||
using NModbus; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Diagnostics; | |||
using System.Linq; | |||
using System.Net.Sockets; | |||
using System.Text; | |||
@@ -21,6 +22,7 @@ namespace BPASmartClient.Modbus | |||
private ModbusFactory modbusFactory; | |||
private IModbusMaster master; | |||
private TcpClient tcpClient; | |||
private ManualResetEvent mre = new ManualResetEvent(false); | |||
public string IPAdress; | |||
public int Port; | |||
@@ -78,6 +80,11 @@ namespace BPASmartClient.Modbus | |||
try | |||
{ | |||
tcpClient = new TcpClient(IPAdress, Port); | |||
//mre.Reset(); | |||
//tcpClient.BeginConnect(IPAdress, Port, (res) => { mre.Set(); }, null); | |||
//if (!mre.WaitOne(1500, false)) break; | |||
master = modbusFactory.CreateMaster(tcpClient); | |||
} | |||
catch (Exception ex) | |||
@@ -127,6 +134,14 @@ namespace BPASmartClient.Modbus | |||
return (tempAddress / 2) + 100; | |||
} | |||
} | |||
else if (address.ToUpper().Contains("LW") && address.Length >= 3) | |||
{ | |||
var res = address.Substring(2); | |||
if (res != null && int.TryParse(res, out int LwAddress)) | |||
{ | |||
return LwAddress; | |||
} | |||
} | |||
} | |||
return -1; | |||
} | |||
@@ -156,7 +171,7 @@ namespace BPASmartClient.Modbus | |||
commandType = CommandType.Coils; | |||
return master.ReadCoils(slaveAddress, startAddress, len); | |||
} | |||
else if (address.ToUpper().Contains("VW")) | |||
else if (address.ToUpper().Contains("VW") || address.ToUpper().Contains("LW")) | |||
{ | |||
commandType = CommandType.HoldingRegisters; | |||
return master.ReadHoldingRegisters(slaveAddress, startAddress, len); | |||
@@ -261,7 +276,7 @@ namespace BPASmartClient.Modbus | |||
else if (value is bool[] boolsValue) | |||
master.WriteMultipleCoils(slaveAddress, startAddress, boolsValue); | |||
} | |||
else if (address.ToUpper().Contains("VW")) | |||
else if (address.ToUpper().Contains("VW") || address.ToUpper().Contains("LW")) | |||
{ | |||
commandType = CommandType.HoldingRegisters; | |||
if (value is ushort ushortValue) | |||
@@ -316,7 +331,10 @@ namespace BPASmartClient.Modbus | |||
/// <returns></returns> | |||
public void SetString(string StartAddress, string value) | |||
{ | |||
var bytes = Encoding.UTF8.GetBytes(value); | |||
//获取指定的编码不存在的时候需要安装 System.Text.Encoding.CodePages nuget包 | |||
//然后使用下面的代码就可以获取了 | |||
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); | |||
var bytes = Encoding.GetEncoding("gb2312")?.GetBytes(value); | |||
Write(StartAddress, bytes.BytesToUshorts()); | |||
} | |||
@@ -331,7 +349,8 @@ namespace BPASmartClient.Modbus | |||
var res = Read(StartAddress, len); | |||
if (res != null && res is ushort[] ushorts) | |||
{ | |||
return Encoding.UTF8.GetString(ushorts.UshortsToBytes()).Trim(new char[] { '\0' }); | |||
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); | |||
return Encoding.GetEncoding("gb2312")?.GetString(ushorts.UshortsToBytes()).Trim(new char[] { '\0' }); | |||
} | |||
return String.Empty; | |||
} | |||
@@ -366,6 +385,34 @@ namespace BPASmartClient.Modbus | |||
} | |||
#endregion | |||
#region 整数数据读写 | |||
/// <summary> | |||
/// 赋值Real类型数据 | |||
/// </summary> | |||
/// <param name="StartAddress"></param> | |||
/// <param name="value"></param> | |||
public void SetUint(string StartAddress, uint value) | |||
{ | |||
var bytes = BitConverter.GetBytes(value); | |||
Write(StartAddress, bytes.BytesToUshorts()); | |||
} | |||
/// <summary> | |||
/// 获取float类型数据 | |||
/// </summary> | |||
/// <param name="StartAddress"></param> | |||
/// <returns></returns> | |||
public uint GetUint(string StartAddress) | |||
{ | |||
var res = Read(StartAddress, 2); | |||
if (res != null && res is ushort[] ushorts) | |||
{ | |||
return BitConverter.ToUInt32(ushorts.UshortsToBytes(), 0); | |||
} | |||
return 0; | |||
} | |||
#endregion | |||
#region 批量数据读取 | |||
/// <summary> | |||
/// 读取多个线圈 | |||
@@ -39,6 +39,7 @@ namespace BPASmartClient.Model | |||
{ | |||
public string Address { get; set; } | |||
public object Value { get; set; } | |||
public int DO_Index { get; set; } | |||
} | |||
public class ReadJaka : BaseEvent | |||
@@ -47,5 +48,6 @@ namespace BPASmartClient.Model | |||
public ushort Length { get; set; } | |||
public object ReadPar { get; set; } | |||
} | |||
} | |||
@@ -53,6 +53,8 @@ namespace BPASmartClient.MorkTLebaiJC | |||
IsHealth = true; | |||
serverInit(); | |||
DataParse(); | |||
ActionManage.GetInstance.Register(new Action<object>((o) => { SimOrder(o); }), "SimOrder");//模拟订单委托注册 | |||
} | |||
private void serverInit() | |||
@@ -188,7 +190,7 @@ namespace BPASmartClient.MorkTLebaiJC | |||
bFirstTrig_Coffee = true; | |||
delayTimeOut_Coffee = DateTime.Now; | |||
} | |||
if (DateTime.Now.Subtract(delayTimeOut_Coffee).TotalSeconds > 180 ) | |||
else if (DateTime.Now.Subtract(delayTimeOut_Coffee).TotalSeconds > 180 && bFirstTrig_Coffee == true) | |||
{ | |||
bFirstTrig_Coffee = false; | |||
if (morkTLebaiJC.IsHaveCoffeeCup) | |||
@@ -217,7 +219,7 @@ namespace BPASmartClient.MorkTLebaiJC | |||
bFirstTrig_Juice = true; | |||
delayTimeOut_Juice = DateTime.Now; | |||
} | |||
if (DateTime.Now.Subtract(delayTimeOut_Juice).TotalSeconds > 30) | |||
else if (DateTime.Now.Subtract(delayTimeOut_Juice).TotalSeconds > 30 && bFirstTrig_Juice == true) | |||
{ | |||
bFirstTrig_Juice = false; | |||
morkTLebaiJC.MakeJuiceEnd = true; | |||
@@ -230,7 +232,7 @@ namespace BPASmartClient.MorkTLebaiJC | |||
bFirstTrig_TeaWater = true; | |||
delayTimeOut = DateTime.Now; | |||
} | |||
if (DateTime.Now.Subtract(delayTimeOut).TotalSeconds >= 50) | |||
else if (DateTime.Now.Subtract(delayTimeOut).TotalSeconds >= 50 && bFirstTrig_TeaWater == true) | |||
{ | |||
bFirstTrig_TeaWater = false; | |||
morkTLebaiJC.MakeTeaEnd = true; | |||
@@ -241,15 +243,6 @@ namespace BPASmartClient.MorkTLebaiJC | |||
DoBoiledTea(); | |||
DoBoiledWater(); | |||
} | |||
public void Main() | |||
{ | |||
//开始心跳刷新,根据咖啡机及冰淇淋机来判断 | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
IsHealth = true; | |||
Thread.Sleep(100); | |||
}), "MORK-IC心跳刷新"); | |||
} | |||
/// <summary> | |||
/// 订单状态改变 | |||
@@ -850,7 +843,22 @@ namespace BPASmartClient.MorkTLebaiJC | |||
public void SimOrder<T>(T simOrder) | |||
{ | |||
if (simOrder != null) | |||
{ | |||
if (simOrder is List<ushort> locs) | |||
{ | |||
List<OrderLocInfo> orders = new List<OrderLocInfo>(); | |||
string subId = Guid.NewGuid().ToString(); | |||
foreach (var item in locs) | |||
{ | |||
if (true) | |||
{ | |||
orders.Add(new OrderLocInfo() { Loc = item, SuborderId = subId }); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
public override void Stop() | |||
@@ -151,21 +151,47 @@ namespace BPASmartClient.MorkTLebaiJC.ViewModel; | |||
public bool MCU_DO_Value { get { return _mcu_DO_Valuer; } set { _mcu_DO_Valuer = value; OnPropertyChanged(); } } | |||
private bool _mcu_DO_Valuer = true; | |||
private void Button_McuOutput() | |||
public bool MCU_DI0 { get { return _mcu_DI0; }set { _mcu_DI0 = value;OnPropertyChanged(); } } | |||
private bool _mcu_DI0 = true; | |||
public bool MCU_DI1 { get { return _mcu_DI1; } set { _mcu_DI1 = value; OnPropertyChanged(); } } | |||
private bool _mcu_DI1 = true; | |||
public bool MCU_DI2 { get { return _mcu_DI2; } set { _mcu_DI2 = value; OnPropertyChanged(); } } | |||
private bool _mcu_DI2 = true; | |||
public bool MCU_DI3 { get { return _mcu_DI3; } set { _mcu_DI3 = value; OnPropertyChanged(); } } | |||
private bool _mcu_DI3 = true; | |||
public bool MCU_DI4 { get { return _mcu_DI4; } set { _mcu_DI4 = value; OnPropertyChanged(); } } | |||
private bool _mcu_DI4 = true; | |||
public bool MCU_DI5 { get { return _mcu_DI5; } set { _mcu_DI5 = value; OnPropertyChanged(); } } | |||
private bool _mcu_DI5 = true; | |||
public bool MCU_DI6 { get { return _mcu_DI6; } set { _mcu_DI6 = value; OnPropertyChanged(); } } | |||
private bool _mcu_DI6 = true; | |||
public bool MCU_DI7 { get { return _mcu_DI7; } set { _mcu_DI7 = value; OnPropertyChanged(); } } | |||
private bool _mcu_DI7 = true; | |||
/// <summary> | |||
/// 单片机舵机输出 | |||
/// </summary> | |||
private void Button_McuOutput() | |||
{ | |||
string sChoosePWM =Convert.ToString(MCU_PWM_CH+1); | |||
new WriteMcu() { TagName = "ServoControl", Address = sChoosePWM, Value = PWMInputNumber }.Publish(); | |||
} | |||
/// <summary> | |||
/// 单片机DO输出 | |||
/// </summary> | |||
private void Button_McuDOutput() | |||
{ | |||
string sChooseDO = Convert.ToString(MCU_DO_CH + 1); | |||
new WriteMcu() { TagName = "OutputControl", Address = sChooseDO, Value = MCU_DO_Value }.Publish(); | |||
} | |||
/// <summary> | |||
/// 乐白的DO输出 | |||
/// </summary> | |||
private void Button_LebaiDOutput() | |||
{ | |||
string sChooseDO = Convert.ToString(Lebai_DO_CH + 1); | |||
int sChooseDO = Convert.ToInt16(Lebai_DO_CH); | |||
bool lebai_DO_Value = Convert.ToInt16(Lebai_DO_Value) == 0; | |||
new LebaiRobot_SetOutPutEvent { DeviceId = DeviceId, Pin = sChooseDO, Value = lebai_DO_Value }.Publish(); | |||
} | |||
#endregion | |||
@@ -205,7 +231,7 @@ namespace BPASmartClient.MorkTLebaiJC.ViewModel; | |||
; | |||
}); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
@@ -230,6 +256,7 @@ namespace BPASmartClient.MorkTLebaiJC.ViewModel; | |||
} | |||
Thread.Sleep(500); | |||
}), "MorkT-状态刷新"); | |||
} | |||
} | |||
@@ -0,0 +1,19 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<TargetFramework>net6.0</TargetFramework> | |||
<ImplicitUsings>enable</ImplicitUsings> | |||
<Nullable>enable</Nullable> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\BPASmartClient.Business\BPASmartClient.Business.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.Device\BPASmartClient.Device.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.DRCoffee\BPASmartClient.DRCoffee.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.GSIceCream\BPASmartClient.GSIceCream.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.Juicer\BPASmartClient.Juicer.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.Lebai\BPASmartClient.Lebai.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.MCU\BPASmartClient.MCU.csproj" /> | |||
</ItemGroup> | |||
</Project> |
@@ -0,0 +1,851 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Configuration; | |||
using System.Linq; | |||
using System.Threading; | |||
using System.Collections.Concurrent; | |||
using System.Diagnostics; | |||
using System.Threading.Tasks; | |||
using BPASmartClient.Device; | |||
using BPA.Message.Enum; | |||
using BPA.Message; | |||
using BPASmartClient.Helper; | |||
using BPASmartClient.Model.咖啡机.Enum; | |||
using BPASmartClient.Model; | |||
using BPASmartClient.EventBus; | |||
using static BPASmartClient.EventBus.EventBus; | |||
using BPASmartClient.Message; | |||
using BPASmartClient.Model.乐白机器人; | |||
using BPASmartClient.Model.单片机; | |||
using BPASmartClient.Model.PLC; | |||
namespace BPASmartClient.MorkT_Show | |||
{ | |||
/* | |||
* 冰淇淋咖啡机组合套装 | |||
* 物料位置: | |||
* 1:冰淇料 | |||
* 2:冰淇淋杯 | |||
* 5:咖啡 | |||
* 6:咖啡杯 | |||
* 9: 茶 | |||
* 10: 茶杯 | |||
*/ | |||
public class Control_MORKJC_Show : BaseDevice | |||
{ | |||
private Dictionary<string, PolymerBatching> batchings = new Dictionary<string, PolymerBatching>(); | |||
//容器位置 | |||
private string holderLoc; | |||
//主料位置 | |||
private string mainMaterialLoc; | |||
public override global::BPA.Message.Enum.DeviceClientType DeviceType { get { return BPA.Message.Enum.DeviceClientType.MORKT; } } | |||
GVL_MorkTLebaiJC morkTLebaiJC =new GVL_MorkTLebaiJC(); | |||
/// <summary> | |||
/// 果汁机做法,true:热饮,false:冷饮 | |||
/// </summary> | |||
private bool GuMake = false; | |||
public override void DoMain() | |||
{ | |||
if (Json<KeepDataBase>.Data.IsVerify) | |||
{ | |||
IsHealth = true; | |||
} | |||
IsHealth = true; | |||
serverInit(); | |||
DataParse(); | |||
ActionManage.GetInstance.Register(new Action<object>((o) => { SimOrder(o); }), "SimOrder");//模拟订单委托注册 | |||
} | |||
private void serverInit() | |||
{ | |||
EventBus.EventBus.GetInstance().Subscribe<MaterialDeliveryEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||
{ | |||
if (@event == null) return; | |||
if (@event is MaterialDeliveryEvent material) | |||
{ | |||
orderMaterialDelivery = material.orderMaterialDelivery; | |||
} | |||
}); | |||
} | |||
private void DataParse() | |||
{ | |||
EventBus.EventBus.GetInstance().Subscribe<DoOrderEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBackHandle) | |||
{ | |||
if (@event == null) return; | |||
if (@event is DoOrderEvent order) | |||
{ | |||
if (order.MorkOrder.GoodBatchings == null) return; | |||
OrderCount++; | |||
DeviceProcessLogShow($"接收到{OrderCount}次订单"); | |||
batchings = PolymerBatching.BuildAll(); | |||
//商品类型 | |||
GOODS_TYPE currentGoodsType = GOODS_TYPE.NEITHER; | |||
foreach (var item in order.MorkOrder.GoodBatchings) | |||
{ | |||
var res = orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId); | |||
if (res != null) | |||
{ | |||
//验证商品是做的某种饮料 | |||
if (ValidateGoodsByBatching(res.BatchingLoc) != GOODS_TYPE.NEITHER) | |||
{ | |||
//获取当前物料所属商品类型 | |||
currentGoodsType = ValidateGoodsByBatching(res.BatchingLoc); | |||
} | |||
// | |||
switch (batchings[res.BatchingLoc].BatchingClass) | |||
{ | |||
case BATCHING_CLASS.HOLDER: | |||
holderLoc = res.BatchingLoc; | |||
break; | |||
case BATCHING_CLASS.MAIN_MATERIAL: | |||
mainMaterialLoc = res.BatchingLoc; | |||
break; | |||
} | |||
//根据商品类型执行具体制作流程 | |||
switch (currentGoodsType) | |||
{ | |||
case GOODS_TYPE.COFFEE: | |||
if (morkTLebaiJC.morkOrderPushesCoffee.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) | |||
{ | |||
morkTLebaiJC.morkOrderPushesCoffee.Enqueue(new OrderLocInfo() | |||
{ | |||
SuborderId = order.MorkOrder.SuborderId, | |||
BatchingId = res.BatchingId, | |||
Loc = ushort.Parse( mainMaterialLoc), | |||
GoodName = order.MorkOrder.GoodsName, | |||
}); | |||
} | |||
break; | |||
case GOODS_TYPE.JUICE: | |||
GuMake = order.MorkOrder.MakeID == "2";//判断果汁的冷热 | |||
if (morkTLebaiJC.morkOrderPushesJuicer.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) | |||
{ | |||
morkTLebaiJC.morkOrderPushesJuicer.Enqueue(new OrderLocInfo() | |||
{ | |||
SuborderId = order.MorkOrder.SuborderId, | |||
BatchingId = res.BatchingId, | |||
Loc = ushort.Parse(mainMaterialLoc), | |||
GoodName = order.MorkOrder.GoodsName, | |||
}); | |||
} | |||
break; | |||
case GOODS_TYPE.TEA: | |||
if (morkTLebaiJC.morkOrderPushesTea.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) | |||
{ | |||
morkTLebaiJC.morkOrderPushesTea.Enqueue(new OrderLocInfo() | |||
{ | |||
SuborderId = order.MorkOrder.SuborderId, | |||
BatchingId = res.BatchingId, | |||
Loc = ushort.Parse(mainMaterialLoc), | |||
GoodName = order.MorkOrder.GoodsName, | |||
}); | |||
} | |||
break; | |||
case GOODS_TYPE.WATER: | |||
if (morkTLebaiJC.morkOrderPushesWater.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) | |||
{ | |||
morkTLebaiJC.morkOrderPushesWater.Enqueue(new OrderLocInfo() | |||
{ | |||
SuborderId = order.MorkOrder.SuborderId, | |||
BatchingId = res.BatchingId, | |||
Loc = ushort.Parse(mainMaterialLoc), | |||
GoodName = order.MorkOrder.GoodsName, | |||
}); | |||
} | |||
break; | |||
case GOODS_TYPE.NEITHER: | |||
DeviceProcessLogShow("未知的商品类型"); | |||
break; | |||
} | |||
} | |||
} | |||
} | |||
}); | |||
} | |||
/// <summary> | |||
/// 将空杯放好到接饮料的地方的标志位 | |||
/// </summary> | |||
private bool bFirstTrig_TeaWater = false; | |||
private bool bFirstTrig_Coffee = false; | |||
private bool bFirstTrig_Juice = false; | |||
/// <summary> | |||
/// 延迟的超时时间 | |||
/// </summary> | |||
DateTime delayTimeOut_Water; | |||
DateTime delayTimeOut_Coffee; | |||
DateTime delayTimeOut_Juice; | |||
public override void MainTask() | |||
{ | |||
EventBus.EventBus.GetInstance().Subscribe<DRCoffee_CoffeEndCookEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||
{ | |||
if (morkTLebaiJC.IsHaveCoffeeCup) | |||
morkTLebaiJC.MakeCoffeeEnd = true; | |||
}); | |||
if (pickUpCoffeeHaveCup) | |||
{ | |||
if (!bFirstTrig_Coffee) | |||
{ | |||
bFirstTrig_Coffee = true; | |||
delayTimeOut_Coffee = DateTime.Now; | |||
} | |||
else if (DateTime.Now.Subtract(delayTimeOut_Coffee).TotalSeconds > 180 && bFirstTrig_Coffee == true) | |||
{ | |||
bFirstTrig_Coffee = false; | |||
if (morkTLebaiJC.IsHaveCoffeeCup) | |||
morkTLebaiJC.MakeCoffeeEnd = true; | |||
} | |||
} | |||
if (morkTLebaiJC.IsHaveJuiceCup) | |||
{ | |||
var Juicestate = GetStatus<int[]>("GetDeviceStatus"); | |||
if (Juicestate != null) | |||
{ | |||
if (Juicestate.Length > 0) | |||
{ | |||
var Juicestate1 = Convert.ToString(Juicestate[0], 2); | |||
var Juicestate2 = Juicestate[1]; | |||
if (Juicestate1.IndexOf("0") == 1 && Juicestate2 == 0) | |||
{ | |||
morkTLebaiJC.MakeJuiceEnd = true; | |||
} | |||
} | |||
} | |||
//若无状态返回 则加延迟 | |||
if (!bFirstTrig_Juice) | |||
{ | |||
bFirstTrig_Juice = true; | |||
delayTimeOut_Juice = DateTime.Now; | |||
} | |||
else if (DateTime.Now.Subtract(delayTimeOut_Juice).TotalSeconds > 30 && bFirstTrig_Juice==true) | |||
{ | |||
bFirstTrig_Juice = false; | |||
morkTLebaiJC.MakeJuiceEnd = true; | |||
} | |||
} | |||
if (morkTLebaiJC.IsHaveTeaWaterCup) | |||
{ | |||
if (!bFirstTrig_TeaWater) | |||
{ | |||
bFirstTrig_TeaWater = true; | |||
delayTimeOut_Water = DateTime.Now;//开启接水信号后,记录当前时间 | |||
} | |||
else if (DateTime.Now.Subtract(delayTimeOut_Water).TotalSeconds >= 50 && bFirstTrig_TeaWater == true)//接水超过50s后,启动接水完成标志,开启接水程序 | |||
{ | |||
bFirstTrig_TeaWater = false; | |||
morkTLebaiJC.MakeTeaEnd = true; | |||
} | |||
} | |||
DoCoffee(); | |||
DoJuice(); | |||
DoBoiledTea(); | |||
DoBoiledWater(); | |||
} | |||
/// <summary> | |||
/// 订单状态改变 | |||
/// </summary> | |||
/// <param name="subid"></param> | |||
/// <param name="oRDER_STATUS"></param> | |||
private void OrderChange(string subid, ORDER_STATUS oRDER_STATUS) | |||
{ | |||
EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent() { Status = oRDER_STATUS, SubOrderId = subid, deviceClientType = DeviceType }); | |||
} | |||
/// <summary> | |||
/// 验证商品是做的某种饮料 | |||
/// </summary> | |||
/// <param name="batchingLoc">物料位置</param> | |||
private GOODS_TYPE ValidateGoodsByBatching(string batchingLoc) | |||
{ | |||
if (batchings.ContainsKey(batchingLoc)) | |||
return batchings[batchingLoc].GoodsType; | |||
return GOODS_TYPE.NEITHER; | |||
} | |||
/// <summary> | |||
/// 乐白的场景结束等待 | |||
/// </summary> | |||
/// <param name="value"></param> | |||
private void Wait(int value = 101) | |||
{ | |||
while (!((bool)peripheralStatus["RobotOK"] && (int)peripheralStatus["RobotValue"] == value)) | |||
{ | |||
Thread.Sleep(5); | |||
} | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
} | |||
/// <summary> | |||
/// 乐白的场景 | |||
/// </summary> | |||
/// <param name="sen"></param> | |||
private void Sence(int sen) | |||
{ | |||
new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = sen }.Publish(); | |||
} | |||
/// <summary> | |||
/// 乐白的数字量输出 | |||
/// </summary> | |||
/// <param name="value"></param> | |||
/// <param name="pin"></param> | |||
private void Output(bool value,int pin) | |||
{ | |||
new LebaiRobot_SetOutPutEvent { DeviceId = DeviceId, Pin = pin,Value=value }.Publish(); | |||
} | |||
private T GetStatus<T>(string key) | |||
{ | |||
if (peripheralStatus.ContainsKey(key)) | |||
{ | |||
if (peripheralStatus[key] != null) | |||
{ | |||
return (T)(peripheralStatus[key]); | |||
} | |||
} | |||
return default; | |||
} | |||
int[] devStatusBy = new int[2] { 0, 0 }; | |||
bool outCupCheck = false;//放纸杯位置有无判断 | |||
/// <summary> | |||
/// 判断接咖啡的位置是否有杯子 | |||
/// </summary> | |||
bool pickUpCoffeeHaveCup = false; | |||
/// <summary> | |||
/// 判断接果汁的位置是否有杯子 | |||
/// </summary> | |||
bool pickUpJuiceHaveCup = false; | |||
/// <summary> | |||
/// 判断接开水的位置是否有杯子 | |||
/// </summary> | |||
bool pickUpHotWaterHaveCup = false; | |||
/// <summary> | |||
/// 传感器的输入信号 0:无意义 1:有信号 2:无信号 3:信号不正确 | |||
/// </summary> | |||
int bSensorInput; | |||
private bool IsMakeCoffee() | |||
{ | |||
bool bMake = (IsHealth && morkTLebaiJC.morkOrderPushesCoffee.Count > 0 && !morkTLebaiJC.IsHaveCoffeeCup) ? true : false; | |||
return bMake; | |||
} | |||
private bool IsMakeJuice() | |||
{ | |||
bool bMake = (IsHealth && morkTLebaiJC.morkOrderPushesJuicer.Count > 0 && !morkTLebaiJC.IsHaveJuiceCup) ? true : false; | |||
return bMake; | |||
} | |||
private bool IsMakeTeaWater() | |||
{ | |||
bool bMake = (IsHealth && morkTLebaiJC.morkOrderPushesTea.Count > 0 && !morkTLebaiJC.IsHaveTeaWaterCup) ? true : false; | |||
return bMake; | |||
} | |||
private bool IsMakeWater() | |||
{ | |||
bool bMake = (IsHealth && morkTLebaiJC.morkOrderPushesWater.Count > 0 && !morkTLebaiJC.IsHaveTeaWaterCup) ? true : false; | |||
return bMake; | |||
} | |||
/// <summary> | |||
/// 做咖啡流程 | |||
/// </summary> | |||
private void DoCoffee() | |||
{ | |||
if (IsMakeCoffee()) | |||
{ | |||
if (morkTLebaiJC.morkOrderPushesCoffee.TryDequeue(out OrderLocInfo orderLoc)) | |||
{ | |||
PickUpCoffee();//接咖啡 | |||
morkTLebaiJC.IsHaveCoffeeCup = true; | |||
} | |||
} | |||
else if(morkTLebaiJC.MakeCoffeeEnd) | |||
{ | |||
PutCoffeeCup(); | |||
pickUpCoffeeHaveCup = false; | |||
morkTLebaiJC.IsHaveCoffeeCup = false; | |||
} | |||
} | |||
private void DoJuice() | |||
{ | |||
if (IsMakeJuice()) | |||
{ | |||
if (morkTLebaiJC.morkOrderPushesJuicer.TryDequeue(out OrderLocInfo orderLoc)) | |||
{ | |||
PickUpJuicer(); | |||
morkTLebaiJC.IsHaveJuiceCup = true; | |||
} | |||
} | |||
else if (morkTLebaiJC.MakeJuiceEnd) | |||
{ | |||
Thread.Sleep(5000);//延迟五秒,防止接饮料口滴饮料 | |||
putJuice(); | |||
pickUpJuiceHaveCup = false; | |||
morkTLebaiJC.IsHaveJuiceCup = false; | |||
morkTLebaiJC.MakeJuiceEnd = false; | |||
} | |||
} | |||
private void DoBoiledTea() | |||
{ | |||
if (IsMakeTeaWater()) | |||
{ | |||
if (morkTLebaiJC.morkOrderPushesTea.TryDequeue(out OrderLocInfo orderLoc)) | |||
{ | |||
PickUpTea(); | |||
morkTLebaiJC.IsHaveTeaWaterCup = true; | |||
} | |||
} | |||
else if(morkTLebaiJC.MakeTeaEnd) | |||
{ | |||
PutWaterCup(); | |||
pickUpHotWaterHaveCup = false; | |||
morkTLebaiJC.IsHaveTeaWaterCup = false ; | |||
morkTLebaiJC.MakeTeaEnd = false; | |||
} | |||
} | |||
private void DoBoiledWater() | |||
{ | |||
if (IsMakeWater()) | |||
{ | |||
if (morkTLebaiJC.morkOrderPushesWater.TryDequeue(out OrderLocInfo orderLoc)) | |||
{ | |||
PickUpWater(); | |||
} | |||
} | |||
else if (morkTLebaiJC.MakeTeaEnd) | |||
{ | |||
PutWaterCup(); | |||
pickUpHotWaterHaveCup = false; | |||
morkTLebaiJC.IsHaveTeaWaterCup = false; | |||
morkTLebaiJC.MakeTeaEnd = false; | |||
} | |||
} | |||
#region 做咖啡流程 | |||
/// <summary> | |||
/// 接咖啡 | |||
/// </summary> | |||
private void PickUpCoffee() | |||
{ | |||
//while (GetStatus<bool>("RobotValue1"))//判断放杯位置是否有物品 | |||
//{ | |||
// if (!outCupCheck) | |||
// DeviceProcessLogShow("成品处有纸杯存在,请取走!!"); | |||
// outCupCheck = true; | |||
//} | |||
if (!pickUpCoffeeHaveCup) | |||
{ | |||
outCupCheck = false; | |||
OrderChange(morkTLebaiJC.morkOrderPushesCoffee.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||
int resultTakeCup = takeCup(); | |||
if (resultTakeCup == 1) | |||
{ | |||
DeviceProcessLogShow("咖啡杯取杯完成"); | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_接咖啡); | |||
Wait(); | |||
pickUpCoffeeHaveCup = true; | |||
new DRCoffee_MakeCoffeeEvent() { DrinkCode = (DrCoffeeDrinksCode)int.Parse(mainMaterialLoc) }.Publish(); //接咖啡控制 //DrCoffeeDrinksCode.热水 | |||
} | |||
else | |||
{ | |||
DeviceProcessLogShow("取杯失败 回到初始位,请及时处理!!"); | |||
Sence(JuicerModel.JUICE2_初始位); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 咖啡杯接好,放咖啡杯 | |||
/// </summary> | |||
private void PutCoffeeCup() | |||
{ | |||
while (GetStatus<bool>("RobotValue1"))//判断放杯位置是否有物品 | |||
{ | |||
if (!outCupCheck) | |||
DeviceProcessLogShow("成品处有纸杯存在,请取走!!"); | |||
outCupCheck = true; | |||
} | |||
outCupCheck = false; | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_放咖啡杯); | |||
Wait(); | |||
OrderChange(morkTLebaiJC.morkOrderPushesCoffee.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); | |||
DeviceProcessLogShow("咖啡制作完成"); | |||
} | |||
#endregion | |||
#region 做开水流程 | |||
/// <summary> | |||
/// 接开水 | |||
/// </summary> | |||
private void PickUpWater() | |||
{ | |||
#region 接水流程 | |||
if (!pickUpHotWaterHaveCup) | |||
{ | |||
OrderChange(morkTLebaiJC.morkOrderPushesWater.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||
int resultTakeCup = takeCup(); | |||
if (resultTakeCup == 1) | |||
{ | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_接开水); | |||
Wait(); | |||
Output(false, 1); | |||
Output(false, 0); | |||
Thread.Sleep(100); | |||
Output(true, 0); | |||
Thread.Sleep(3000); | |||
Output(false, 0); | |||
Thread.Sleep(100); | |||
Output(false, 1); | |||
Thread.Sleep(100); | |||
Output(true, 1); | |||
Thread.Sleep(500); | |||
Output(false, 1); | |||
} | |||
else | |||
{ | |||
return; | |||
} | |||
} | |||
#endregion | |||
} | |||
#endregion | |||
#region 做茶流程 | |||
/// <summary> | |||
/// 做茶 | |||
/// </summary> | |||
private void PickUpTea() | |||
{ | |||
#region 接茶流程 | |||
if (!pickUpHotWaterHaveCup) | |||
{ | |||
OrderChange(morkTLebaiJC.morkOrderPushesTea.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||
int resultTakeCup = takeCup(); | |||
if (resultTakeCup == 1) | |||
{ | |||
DeviceProcessLogShow("取茶杯完成"); | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_接茶叶); | |||
Wait(); | |||
new WriteMcu() { TagName = "ServoControl", Address = "1", Value = 90 }.Publish(); | |||
Thread.Sleep(1000); | |||
new WriteMcu() { TagName = "ServoControl", Address = "1", Value = 150 }.Publish(); | |||
Thread.Sleep(1000); | |||
new WriteMcu() { TagName = "ServoControl", Address = "1", Value = 90 }.Publish(); | |||
Thread.Sleep(3000); | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_接茶水); | |||
Wait(); | |||
Output(false, 1); | |||
Output(false, 0); | |||
Thread.Sleep(100); | |||
Output(true, 0); | |||
Thread.Sleep(3000); | |||
Output(false, 0); | |||
Thread.Sleep(100); | |||
Output(false, 1); | |||
Thread.Sleep(100); | |||
Output(true, 1); | |||
Thread.Sleep(500); | |||
Output(false, 1); | |||
pickUpHotWaterHaveCup = true; | |||
} | |||
else | |||
{ | |||
return; | |||
} | |||
} | |||
#endregion | |||
} | |||
/// <summary> | |||
/// 放水杯流程 | |||
/// </summary> | |||
private void PutWaterCup() | |||
{ | |||
while (GetStatus<bool>("RobotValue1"))//判断放杯位置是否有物品 | |||
{ | |||
if (!outCupCheck) | |||
DeviceProcessLogShow("成品处有纸杯存在,请取走!!"); | |||
outCupCheck = true; | |||
} | |||
outCupCheck = false; | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_放水杯); | |||
Wait(); | |||
OrderChange(morkTLebaiJC.morkOrderPushesWater.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); | |||
DeviceProcessLogShow("茶水制作完成"); | |||
} | |||
#endregion | |||
#region 做果汁流程 | |||
/// <summary> | |||
/// 果汁机控制信号 | |||
/// </summary> | |||
private byte JuicerNum; | |||
private int JuiceCH; | |||
/// <summary> | |||
/// 接果汁 | |||
/// </summary> | |||
private void PickUpJuicer() | |||
{ | |||
#region 接果汁流程 | |||
if (!pickUpJuiceHaveCup) | |||
{ | |||
OrderChange(morkTLebaiJC.morkOrderPushesJuicer.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||
int resultTakeCup = takeCup(); | |||
JuiceCH = int.Parse(mainMaterialLoc); | |||
if (resultTakeCup == 1) | |||
{ | |||
switch (JuiceCH) | |||
{ | |||
case 52: | |||
if (GuMake) | |||
JuicerNum = 0x00; | |||
else | |||
JuicerNum = 0x01; | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_接果汁1); | |||
Wait(); | |||
break; | |||
case 53: | |||
if (GuMake) | |||
JuicerNum = 0x02; | |||
else | |||
JuicerNum = 0x03; | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_接果汁2); | |||
Wait(); | |||
break; | |||
case 54: | |||
if (GuMake) | |||
JuicerNum = 0x04; | |||
else | |||
JuicerNum = 0x05; | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_接果汁3); | |||
Wait(); | |||
break; | |||
case 55: | |||
if (GuMake) | |||
JuicerNum = 0x06; | |||
else | |||
JuicerNum = 0x07; | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_接果汁4); | |||
Wait(); | |||
break; | |||
default: | |||
JuicerNum = 0x00; | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_接果汁1); | |||
Wait(); | |||
break; | |||
} | |||
new WriteJuicer() { Value = JuicerNum }.Publish(); | |||
pickUpJuiceHaveCup = true; | |||
} | |||
else | |||
{ | |||
return; | |||
} | |||
} | |||
#endregion | |||
} | |||
/// <summary> | |||
/// 取接好果汁杯 | |||
/// </summary> | |||
private void putJuice() | |||
{ | |||
while (GetStatus<bool>("RobotValue1"))//判断放杯位置是否有物品 | |||
{ | |||
if (!outCupCheck) | |||
DeviceProcessLogShow("成品处有纸杯存在,请取走!!"); | |||
outCupCheck = true; | |||
} | |||
outCupCheck = false; | |||
switch (JuiceCH) | |||
{ | |||
case 52: | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_放果汁杯1); | |||
Wait(); | |||
break; | |||
case 53: | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_放果汁杯2); | |||
Wait(); | |||
break; | |||
case 54: | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_放果汁杯3); | |||
Wait(); | |||
break; | |||
case 55: | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_放果汁杯4); | |||
Wait(); | |||
break; | |||
default: | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_放果汁杯1); | |||
Wait(); | |||
break; | |||
} | |||
OrderChange(morkTLebaiJC.morkOrderPushesJuicer.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); | |||
DeviceProcessLogShow("果汁制作完成"); | |||
} | |||
#endregion | |||
/// <summary> | |||
/// 取杯的次数 | |||
/// </summary> | |||
private int nCnt; | |||
/// <summary> | |||
/// 传感器的检测次数 | |||
/// </summary> | |||
private int checkCnt; | |||
/// <summary> | |||
/// 取杯流程 | |||
/// </summary> | |||
/// <returns>0:无意义,1:取杯成功 2:取杯失败</returns> | |||
private int takeCup() | |||
{ | |||
try | |||
{ | |||
nCnt = 0; | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_初始位); | |||
Wait(); | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_取纸杯); | |||
Wait(); | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_取纸杯检测); | |||
Wait(); | |||
nCnt++; | |||
Thread.Sleep(2000); | |||
while (checkCnt < 3) | |||
{ | |||
if (!GetStatus<bool>("GetInput")) | |||
{ | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_再检测); | |||
Wait(); | |||
} | |||
else | |||
{ | |||
break; | |||
} | |||
checkCnt++; | |||
} | |||
checkCnt = 0; | |||
while (!GetStatus<bool>("GetInput")) //读取传感器的值 | |||
{ | |||
if (nCnt > 3) | |||
{ | |||
nCnt = 0; | |||
DeviceProcessLogShow("三次取杯失败,回原点"); | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_检测位回原点); | |||
Wait(); | |||
return 2; | |||
} | |||
else | |||
{ | |||
nCnt++; | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_二次取杯); | |||
Wait(); | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_取纸杯检测); | |||
Wait(); | |||
checkCnt = 0; | |||
while (checkCnt < 3) | |||
{ | |||
if (!GetStatus<bool>("GetInput")) | |||
{ | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(JuicerModel.JUICE2_再检测); | |||
Wait(); | |||
} | |||
else | |||
{ | |||
checkCnt = 0; | |||
return 1; | |||
} | |||
checkCnt++; | |||
} | |||
} | |||
Thread.Sleep(1000); | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
DeviceProcessLogShow(ex.ToString()); | |||
} | |||
return 2; | |||
} | |||
/// <summary> | |||
/// 放杯 | |||
/// </summary> | |||
/// <returns>0:无意义 1:放杯成功 2:执行失败(传感器还有信号) 3:放杯异常</returns> | |||
private int putCup() | |||
{ | |||
try | |||
{ | |||
if (GetStatus<bool>("RobotValue1")) return 2; | |||
Sence(JuicerModel.JUICE_放杯); | |||
Wait(); | |||
new LebaiRobot_SetValueEvent() { RobotSetValue = 1 }.Publish(); | |||
Sence(JuicerModel.JUICE_放杯检测); | |||
Wait(); | |||
new LebaiRobot_SetValueEvent() { RobotSetValue = 1 }.Publish(); | |||
if (GetStatus<bool>("GetInput2")) | |||
{ | |||
return 1; | |||
} | |||
else | |||
{ | |||
return 3; | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
DeviceProcessLogShow(ex.ToString()); | |||
return 0; | |||
} | |||
} | |||
public void SimOrder<T>(T simOrder) | |||
{ | |||
} | |||
#region PLC 控制函数 | |||
private void WritePLCData(string address, object value) | |||
{ | |||
EventBus.EventBus.GetInstance().Publish(new WriteModel() { DeviceId = DeviceId, Address = address, Value = value }); | |||
} | |||
public override void Stop() | |||
{ | |||
} | |||
public override void ReadData() | |||
{ | |||
} | |||
public override void ResetProgram() | |||
{ | |||
} | |||
public override void SimOrder() | |||
{ | |||
} | |||
} | |||
} |
@@ -0,0 +1,76 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using BPASmartClient.Device; | |||
using System.Collections.Concurrent; | |||
namespace BPASmartClient.MorkT_Show | |||
{ | |||
public class GVL_MorkTLebaiJC : IStatus | |||
{ | |||
/// <summary> | |||
/// <summary> | |||
/// 咖啡订单队列 | |||
/// </summary> | |||
public ConcurrentQueue<OrderLocInfo> morkOrderPushesCoffee = new ConcurrentQueue<OrderLocInfo>(); | |||
/// <summary> | |||
/// 是否有咖啡杯 | |||
/// </summary> | |||
public bool IsHaveCoffeeCup = false; | |||
/// <summary> | |||
/// 咖啡是否制作完成 | |||
/// </summary> | |||
public bool MakeCoffeeEnd = false; | |||
/// <summary> | |||
/// 果汁订单队列 | |||
/// </summary> | |||
public ConcurrentQueue<OrderLocInfo> morkOrderPushesJuicer = new ConcurrentQueue<OrderLocInfo>(); | |||
/// <summary> | |||
/// 果汁是否在制作中 | |||
/// </summary> | |||
public bool IsHaveJuiceCup = false; | |||
/// <summary> | |||
/// 咖啡是否制作完成 | |||
/// </summary> | |||
public bool MakeJuiceEnd = false; | |||
/// <summary> | |||
/// 做茶订单队列 | |||
/// </summary> | |||
public ConcurrentQueue<OrderLocInfo> morkOrderPushesTea = new ConcurrentQueue<OrderLocInfo>(); | |||
/// <summary> | |||
/// 茶或水是否在制作中 | |||
/// </summary> | |||
public bool IsHaveTeaWaterCup = false; | |||
/// <summary> | |||
/// 咖啡是否制作完成 | |||
/// </summary> | |||
public bool MakeTeaEnd = false; | |||
/// <summary> | |||
/// 做开水订单队列 | |||
/// </summary> | |||
public ConcurrentQueue<OrderLocInfo> morkOrderPushesWater = new ConcurrentQueue<OrderLocInfo>(); | |||
/// <summary> | |||
/// 等待取餐订单 | |||
/// </summary> | |||
public OrderLocInfo waitMorkOrder = new OrderLocInfo(); | |||
/// <summary> | |||
/// 当前正在制作咖啡 | |||
/// </summary> | |||
public OrderLocInfo MakeCoffeeOrder = new OrderLocInfo(); | |||
/// <summary> | |||
/// 订单ID | |||
/// </summary> | |||
public string SuborderId = null; | |||
} | |||
} |
@@ -0,0 +1,17 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MorkT_Show | |||
{ | |||
public class OrderLocInfo | |||
{ | |||
public string SuborderId { get; set; } | |||
public ushort Loc { get; set; } | |||
public ushort RecipeNumber { get; set; } | |||
public int BatchingId { get; set; } | |||
public string GoodName { get; set; } | |||
} | |||
} |
@@ -0,0 +1,152 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MorkT_Show | |||
{ | |||
internal enum GOODS_TYPE | |||
{ | |||
/// <summary> | |||
/// 未知 | |||
/// </summary> | |||
NEITHER, | |||
/// <summary> | |||
/// 咖啡 | |||
/// </summary> | |||
COFFEE, | |||
/// <summary> | |||
/// 果汁 | |||
/// </summary> | |||
JUICE, | |||
/// <summary> | |||
/// 茶水 | |||
/// </summary> | |||
TEA, | |||
/// <summary> | |||
/// 水 | |||
/// </summary> | |||
WATER, | |||
/// <summary> | |||
/// 杯子 | |||
/// </summary> | |||
CUP | |||
} | |||
internal enum BATCHING_CLASS | |||
{ | |||
HOLDER, | |||
MAIN_MATERIAL, | |||
} | |||
internal class PolymerBatching | |||
{ | |||
internal const string Juicer_MAIN_BATCHIN1_LOC = "52"; | |||
internal const string Juicer_MAIN_BATCHIN2_LOC = "53"; | |||
internal const string Juicer_MAIN_BATCHIN3_LOC = "54"; | |||
internal const string Juicer_MAIN_BATCHIN4_LOC = "55"; | |||
//internal const string Juicer_MAIN_BATCHIN5_LOC = "56"; | |||
//internal const string Juicer_MAIN_BATCHIN6_LOC = "57"; | |||
//internal const string Juicer_MAIN_BATCHIN7_LOC = "58"; | |||
//internal const string Juicer_MAIN_BATCHIN8_LOC = "59"; | |||
internal const string COFFEE_HOLDER_LOC = "30"; | |||
internal const string TEA_HOLDER_LOC = "51"; | |||
public static Dictionary<string, GOODS_TYPE> GOODS_TYPES = new Dictionary<string, GOODS_TYPE>() { | |||
{"1", GOODS_TYPE.COFFEE}, | |||
{"2", GOODS_TYPE.COFFEE}, | |||
{"3", GOODS_TYPE.COFFEE}, | |||
{"4", GOODS_TYPE.COFFEE}, | |||
{"5", GOODS_TYPE.COFFEE}, | |||
{"6", GOODS_TYPE.COFFEE}, | |||
{"7", GOODS_TYPE.COFFEE}, | |||
{"8", GOODS_TYPE.COFFEE}, | |||
{"9", GOODS_TYPE.COFFEE}, | |||
{"10",GOODS_TYPE.COFFEE}, | |||
{"11",GOODS_TYPE.COFFEE}, | |||
{"12",GOODS_TYPE.COFFEE}, | |||
{"13",GOODS_TYPE.COFFEE}, | |||
{"14",GOODS_TYPE.COFFEE}, | |||
{"15",GOODS_TYPE.COFFEE}, | |||
{"16",GOODS_TYPE.COFFEE}, | |||
{"17",GOODS_TYPE.COFFEE}, | |||
{"18",GOODS_TYPE.COFFEE}, | |||
{"19",GOODS_TYPE.COFFEE}, | |||
{"20",GOODS_TYPE.COFFEE}, | |||
{"21",GOODS_TYPE.COFFEE}, | |||
{"22",GOODS_TYPE.COFFEE}, | |||
{"23",GOODS_TYPE.COFFEE}, | |||
{"24",GOODS_TYPE.COFFEE}, | |||
{"25",GOODS_TYPE.COFFEE}, | |||
{ COFFEE_HOLDER_LOC,GOODS_TYPE.CUP}, | |||
{"56",GOODS_TYPE.TEA }, | |||
{"61",GOODS_TYPE.WATER }, | |||
{Juicer_MAIN_BATCHIN1_LOC,GOODS_TYPE.JUICE}, | |||
{Juicer_MAIN_BATCHIN2_LOC,GOODS_TYPE.JUICE}, | |||
{Juicer_MAIN_BATCHIN3_LOC,GOODS_TYPE.JUICE}, | |||
{Juicer_MAIN_BATCHIN4_LOC,GOODS_TYPE.JUICE}, | |||
//{Juicer_MAIN_BATCHIN5_LOC,GOODS_TYPE.JUICE}, | |||
//{Juicer_MAIN_BATCHIN6_LOC,GOODS_TYPE.JUICE}, | |||
//{Juicer_MAIN_BATCHIN7_LOC,GOODS_TYPE.JUICE}, | |||
//{Juicer_MAIN_BATCHIN8_LOC,GOODS_TYPE.JUICE}, | |||
}; | |||
public GOODS_TYPE GoodsType { get; set; } | |||
public BATCHING_CLASS BatchingClass { get; set; } | |||
private string loc; | |||
public string Loc | |||
{ | |||
get { return loc; } | |||
set | |||
{ | |||
loc = value; | |||
if (GOODS_TYPES.ContainsKey(loc)) | |||
GoodsType = GOODS_TYPES[loc]; | |||
switch (loc) | |||
{ | |||
case COFFEE_HOLDER_LOC: | |||
case TEA_HOLDER_LOC: | |||
BatchingClass = BATCHING_CLASS.HOLDER; | |||
break; | |||
default: | |||
BatchingClass = BATCHING_CLASS.MAIN_MATERIAL; | |||
break; | |||
} | |||
} | |||
} | |||
internal static Dictionary<string, PolymerBatching> BuildAll() | |||
{ | |||
Dictionary<string, PolymerBatching> temp = new Dictionary<string, PolymerBatching>(); | |||
foreach (var item in GOODS_TYPES) | |||
{ | |||
temp.Add(item.Key, new PolymerBatching() { Loc = item.Key }); | |||
} | |||
return temp; | |||
} | |||
//internal static IC_SE GetIceCreamSE(string loc, out string sence) | |||
//{ | |||
// switch (loc) | |||
// { | |||
// case Juicer_MAIN_BATCHIN1_LOC: | |||
// sence = JaKaHelper.SENCE_接果汁1; | |||
// return IC_SE.SE_1; | |||
// case Juicer_MAIN_BATCHIN2_LOC: | |||
// sence = JaKaHelper.SENCE_接果汁2; | |||
// return IC_SE.SE_2; | |||
// case Juicer_MAIN_BATCHIN3_LOC: | |||
// sence = JaKaHelper.SENCE_接果汁3; | |||
// return IC_SE.SE_3; | |||
// default: | |||
// sence = JaKaHelper.SENCE_接果汁1; | |||
// return IC_SE.SE_1; | |||
// } | |||
//} | |||
} | |||
} |
@@ -1,4 +1,4 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<TargetFramework>net6.0-windows</TargetFramework> | |||
@@ -22,19 +22,14 @@ namespace BPASmartClient.MorktJAKAJC | |||
{ | |||
public class Control_MORKJC : BaseDevice | |||
{ | |||
GVL_MORKJC mORKD = new GVL_MORKJC(); | |||
GVL_MORKJC morkTJakaJC = new GVL_MORKJC(); | |||
//物料存放位置 | |||
private Dictionary<string, PolymerBatching> batchings = new Dictionary<string, PolymerBatching>(); | |||
//容器位置 | |||
private string holderLoc; | |||
//主料位置 | |||
private string mainMaterialLoc; | |||
//子订单ID | |||
private string subOrderId; | |||
private bool enableFunny = false; | |||
private DateTime lastRecvdOrder = DateTime.Now; | |||
private bool working = false; | |||
public override global::BPA.Message.Enum.DeviceClientType DeviceType { get { return BPA.Message.Enum.DeviceClientType.MORKT; } } | |||
/// <summary> | |||
/// 果汁机做法,true:热饮,false:冷饮 | |||
/// </summary> | |||
@@ -44,119 +39,209 @@ namespace BPASmartClient.MorktJAKAJC | |||
{ | |||
EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent() { Status = oRDER_STATUS, SubOrderId = subid, deviceClientType = DeviceType }); | |||
} | |||
//private SerialPortClient commProxy; | |||
public void ConnectOk() | |||
public override void DoMain() | |||
{ | |||
if (Json<KeepDataBase>.Data.IsVerify) | |||
{ | |||
IsHealth = true; | |||
} | |||
IsHealth = true; | |||
serverInit(); | |||
DataParse(); | |||
} | |||
ConcurrentQueue<MorkOrderPush> morkOrderPushes = new ConcurrentQueue<MorkOrderPush>(); | |||
public void Init() | |||
private void serverInit() | |||
{ | |||
ActionManage.GetInstance.Register(new Action<object>((s) => | |||
EventBus.EventBus.GetInstance().Subscribe<MaterialDeliveryEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||
{ | |||
if (s is DrCoffeeDrinksCode cf) | |||
if (@event == null) return; | |||
if (@event is MaterialDeliveryEvent material) | |||
{ | |||
mainMaterialLoc = ((int)cf).ToString(); | |||
DoCoffee(); | |||
orderMaterialDelivery = material.orderMaterialDelivery; | |||
} | |||
}), "SimCoffee"); | |||
}); | |||
} | |||
//构建所有商品物料信息 | |||
batchings = PolymerBatching.BuildAll(); | |||
EventBus.EventBus.GetInstance().Subscribe<DRCoffee_CoffeEndCookEvent>(DeviceId, DRCoffee_CoffeEndCookEventHandle); | |||
Main(); | |||
ReadData(); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
while (morkOrderPushes.Count > 0) | |||
{ | |||
while (enableFunny) { Thread.Sleep(10); } | |||
DeviceProcessLogShow("当前非自嗨模式,允许开工"); | |||
working = true; | |||
if (morkOrderPushes.TryDequeue(out MorkOrderPush order)) | |||
private void DataParse() | |||
{ | |||
EventBus.EventBus.GetInstance().Subscribe<DoOrderEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBackHandle) | |||
{ | |||
if (@event == null) return; | |||
if (@event is DoOrderEvent order) | |||
{ | |||
if (order.MorkOrder.GoodBatchings == null) return; | |||
OrderCount++; | |||
DeviceProcessLogShow($"接收到{OrderCount}次订单"); | |||
batchings = PolymerBatching.BuildAll(); | |||
//商品类型 | |||
GOODS_TYPE currentGoodsType = GOODS_TYPE.NEITHER; | |||
foreach (var item in order.MorkOrder.GoodBatchings) | |||
{ | |||
DeviceProcessLogShow($"开始制作订单[{order.SortNum}]"); | |||
//商品类型 | |||
GOODS_TYPE currentGoodsType = GOODS_TYPE.NEITHER; | |||
//子订单ID | |||
subOrderId = order.SuborderId; | |||
//遍历物料 | |||
foreach (var item in order.GoodBatchings) | |||
var res = orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId); | |||
if (res != null) | |||
{ | |||
var res = Json<BatchingInfoPar>.Data.orderMaterialDelivery.BatchingInfo.FirstOrDefault(p => p.BatchingId == item.BatchingId); | |||
if (res != null) | |||
//验证商品是做的某种饮料 | |||
if (ValidateGoodsByBatching(res.BatchingLoc) != GOODS_TYPE.NEITHER) | |||
{ | |||
//获取当前物料所属商品类型 | |||
currentGoodsType = ValidateGoodsByBatching(res.BatchingLoc); | |||
} | |||
// | |||
switch (batchings[res.BatchingLoc].BatchingClass) | |||
{ | |||
case BATCHING_CLASS.HOLDER: | |||
holderLoc = res.BatchingLoc; | |||
break; | |||
case BATCHING_CLASS.MAIN_MATERIAL: | |||
mainMaterialLoc = res.BatchingLoc; | |||
break; | |||
} | |||
//根据商品类型执行具体制作流程 | |||
switch (currentGoodsType) | |||
{ | |||
//获取主料和容器位置 | |||
switch (batchings[res.BatchingLoc].BatchingClass) | |||
{ | |||
case BATCHING_CLASS.HOLDER: | |||
holderLoc = res.BatchingLoc; | |||
break; | |||
case BATCHING_CLASS.MAIN_MATERIAL: | |||
// mainMaterialLoc ="1"; | |||
mainMaterialLoc = res.BatchingLoc; | |||
//验证商品是咖啡还是冰淇淋 | |||
if (ValidateGoodsByBatching(res.BatchingLoc) != GOODS_TYPE.NEITHER) | |||
case GOODS_TYPE.COFFEE: | |||
if (morkTJakaJC.morkOrderPushesCoffee.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) | |||
{ | |||
morkTJakaJC.morkOrderPushesCoffee.Enqueue(new OrderLocInfo() | |||
{ | |||
SuborderId = order.MorkOrder.SuborderId, | |||
BatchingId = res.BatchingId, | |||
Loc = ushort.Parse(mainMaterialLoc), | |||
GoodName = order.MorkOrder.GoodsName, | |||
}); | |||
} | |||
break; | |||
case GOODS_TYPE.JUICE: | |||
GuMake = order.MorkOrder.MakeID == "2";//判断果汁的冷热 | |||
if (morkTJakaJC.morkOrderPushesJuicer.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) | |||
{ | |||
morkTJakaJC.morkOrderPushesJuicer.Enqueue(new OrderLocInfo() | |||
{ | |||
SuborderId = order.MorkOrder.SuborderId, | |||
BatchingId = res.BatchingId, | |||
Loc = ushort.Parse(mainMaterialLoc), | |||
GoodName = order.MorkOrder.GoodsName, | |||
}); | |||
} | |||
break; | |||
case GOODS_TYPE.TEA: | |||
if (morkTJakaJC.morkOrderPushesTea.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) | |||
{ | |||
morkTJakaJC.morkOrderPushesTea.Enqueue(new OrderLocInfo() | |||
{ | |||
SuborderId = order.MorkOrder.SuborderId, | |||
BatchingId = res.BatchingId, | |||
Loc = ushort.Parse(mainMaterialLoc), | |||
GoodName = order.MorkOrder.GoodsName, | |||
}); | |||
} | |||
break; | |||
case GOODS_TYPE.WATER: | |||
if (morkTJakaJC.morkOrderPushesWater.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) | |||
{ | |||
morkTJakaJC.morkOrderPushesWater.Enqueue(new OrderLocInfo() | |||
{ | |||
//获取当前物料所属商品类型 | |||
currentGoodsType = ValidateGoodsByBatching(res.BatchingLoc); | |||
} | |||
break; | |||
} | |||
SuborderId = order.MorkOrder.SuborderId, | |||
BatchingId = res.BatchingId, | |||
Loc = ushort.Parse(mainMaterialLoc), | |||
GoodName = order.MorkOrder.GoodsName, | |||
}); | |||
} | |||
break; | |||
case GOODS_TYPE.NEITHER: | |||
DeviceProcessLogShow("未知的商品类型"); | |||
break; | |||
} | |||
} | |||
//根据商品类型执行具体制作流程 | |||
switch (currentGoodsType) | |||
{ | |||
case GOODS_TYPE.COFFEE: | |||
DoCoffee(); | |||
break; | |||
case GOODS_TYPE.JUICE: | |||
GuMake = order.MakeID == "2"; | |||
DoJuicer(); | |||
break; | |||
case GOODS_TYPE.TEA: | |||
DoTea(); | |||
break; | |||
case GOODS_TYPE.WATER: | |||
DoWater(); | |||
break; | |||
case GOODS_TYPE.NEITHER: | |||
DeviceProcessLogShow("未知的商品类型"); | |||
break; | |||
} | |||
} | |||
working = false; | |||
lastRecvdOrder = DateTime.Now; | |||
} | |||
Thread.Sleep(1000); | |||
}), "订单制作"); | |||
}); | |||
} | |||
public void Main() | |||
private bool bFirstTrig_TeaWater = false; | |||
private bool bFirstTrig_Coffee = false; | |||
DateTime delayTimeOut_Coffee; | |||
private bool bFirstTrig_Juice = false; | |||
DateTime delayTimeOut_Juice; | |||
/// <summary> | |||
/// 判断接咖啡的位置是否有杯子 | |||
/// </summary> | |||
bool pickUpCoffeeHaveCup = false; | |||
/// <summary> | |||
/// 判断接果汁的位置是否有杯子 | |||
/// </summary> | |||
bool pickUpJuiceHaveCup = false; | |||
/// <summary> | |||
/// 判断接开水的位置是否有杯子 | |||
/// </summary> | |||
bool pickUpHotWaterHaveCup = false; | |||
public override void MainTask() | |||
{ | |||
//开始心跳刷新,根据咖啡机及冰淇淋机来判断 | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
EventBus.EventBus.GetInstance().Subscribe<DRCoffee_CoffeEndCookEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||
{ | |||
//IsHealth = | |||
// Write.IsConnected && | |||
// MorkCStatus.GetInstance().CanDo && | |||
// JuicerHelper.GetInstance.IsOpen && | |||
// MCUSerialHelper.GetInstance.IsOpen; | |||
//GeneralConfig.Healthy = true; | |||
Thread.Sleep(100); | |||
}), "MORK-IC心跳刷新"); | |||
} | |||
public void DataParse<T>(T order) | |||
{ | |||
if (order is MorkOrderPush morkOrderPush) | |||
if (morkTJakaJC.IsHaveCoffeeCup) | |||
morkTJakaJC.MakeCoffeeEnd = true; | |||
}); | |||
if (pickUpCoffeeHaveCup) | |||
{ | |||
morkOrderPushes.Enqueue(morkOrderPush); | |||
if (!bFirstTrig_Coffee) | |||
{ | |||
bFirstTrig_Coffee = true; | |||
delayTimeOut_Coffee = DateTime.Now; | |||
} | |||
else if (DateTime.Now.Subtract(delayTimeOut_Coffee).TotalSeconds > 180 && bFirstTrig_Coffee == true) | |||
{ | |||
bFirstTrig_Coffee = false; | |||
if (morkTJakaJC.IsHaveCoffeeCup) | |||
morkTJakaJC.MakeCoffeeEnd = true; | |||
} | |||
} | |||
if (morkTJakaJC.IsHaveJuiceCup) | |||
{ | |||
var Juicestate = GetStatus<int[]>("GetDeviceStatus"); | |||
if (Juicestate != null) | |||
{ | |||
if (Juicestate.Length > 0) | |||
{ | |||
var Juicestate1 = Convert.ToString(Juicestate[0], 2); | |||
var Juicestate2 = Juicestate[1]; | |||
if (Juicestate1.IndexOf("0") == 1 && Juicestate2 == 0) | |||
{ | |||
morkTJakaJC.MakeJuiceEnd = true; | |||
} | |||
} | |||
} | |||
//若无状态返回 则加延迟 | |||
if (!bFirstTrig_Juice) | |||
{ | |||
bFirstTrig_Juice = true; | |||
delayTimeOut_Juice = DateTime.Now; | |||
} | |||
else if (DateTime.Now.Subtract(delayTimeOut_Juice).TotalSeconds > 30 && bFirstTrig_Juice == true) | |||
{ | |||
bFirstTrig_Juice = false; | |||
morkTJakaJC.MakeJuiceEnd = true; | |||
} | |||
} | |||
if (morkTJakaJC.IsHaveTeaWaterCup) | |||
{ | |||
if (!bFirstTrig_TeaWater) | |||
{ | |||
bFirstTrig_TeaWater = true; | |||
delayTimeOut = DateTime.Now; | |||
} | |||
else if (DateTime.Now.Subtract(delayTimeOut).TotalSeconds >= 50 && bFirstTrig_TeaWater == true) | |||
{ | |||
bFirstTrig_TeaWater = false; | |||
morkTJakaJC.MakeTeaEnd = true; | |||
} | |||
} | |||
DoCoffee(); | |||
DoJuice(); | |||
DoBoiledTea(); | |||
DoBoiledWater(); | |||
} | |||
/// <summary> | |||
/// 验证当前是做咖啡还是做冰淇淋 | |||
/// </summary> | |||
@@ -190,7 +275,26 @@ namespace BPASmartClient.MorktJAKAJC | |||
} | |||
} | |||
int[] devStatusBy = new int[2] { 0, 0 }; | |||
private bool IsMakeCoffee() | |||
{ | |||
bool bMake = (IsHealth && morkTJakaJC.morkOrderPushesCoffee.Count > 0 && !morkTJakaJC.IsHaveCoffeeCup) ? true : false; | |||
return bMake; | |||
} | |||
private bool IsMakeJuice() | |||
{ | |||
bool bMake = (IsHealth && morkTJakaJC.morkOrderPushesJuicer.Count > 0 && !morkTJakaJC.IsHaveJuiceCup) ? true : false; | |||
return bMake; | |||
} | |||
private bool IsMakeTeaWater() | |||
{ | |||
bool bMake = (IsHealth && morkTJakaJC.morkOrderPushesTea.Count > 0 && !morkTJakaJC.IsHaveTeaWaterCup) ? true : false; | |||
return bMake; | |||
} | |||
private bool IsMakeWater() | |||
{ | |||
bool bMake = (IsHealth && morkTJakaJC.morkOrderPushesWater.Count > 0 && !morkTJakaJC.IsHaveTeaWaterCup) ? true : false; | |||
return bMake; | |||
} | |||
/// <summary> | |||
/// 传感器的输入信号 0:无意义 1:有信号 2:无信号 3:信号不正确 | |||
/// </summary> | |||
@@ -204,26 +308,88 @@ namespace BPASmartClient.MorktJAKAJC | |||
/// </summary> | |||
private void DoCoffee() | |||
{ | |||
#region 接咖啡流程 | |||
are.Reset(); | |||
OrderChange(subOrderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||
int resultTakeCup = takeCup(); | |||
if (resultTakeCup == 1) | |||
{ | |||
DeviceProcessLogShow("咖啡杯取杯完成"); | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_接咖啡 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_接咖啡)); | |||
new DRCoffee_MakeCoffeeEvent() { DeviceId = DeviceId, DrinkCode = (DrCoffeeDrinksCode)int.Parse(mainMaterialLoc) }.Publish(); //接咖啡控制 //DrCoffeeDrinksCode.热水 | |||
are.WaitOne(1000 * 180); | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_放咖啡杯 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_放咖啡杯)); | |||
int resultputCup = putCup(); | |||
if (resultputCup == 1) | |||
{ | |||
//订单状态改变:完成 | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_初始位 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_初始位)); | |||
OrderChange(subOrderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); | |||
if (IsMakeCoffee()) | |||
{ | |||
if (morkTJakaJC.morkOrderPushesCoffee.TryDequeue(out OrderLocInfo orderLoc)) | |||
{ | |||
PickUpCoffee();//接咖啡 | |||
morkTJakaJC.IsHaveCoffeeCup = true; | |||
} | |||
} | |||
else if (morkTJakaJC.MakeCoffeeEnd) | |||
{ | |||
PutCoffeeCup(); | |||
pickUpCoffeeHaveCup = false; | |||
morkTJakaJC.IsHaveCoffeeCup = false; | |||
} | |||
} | |||
private void DoJuice() | |||
{ | |||
if (IsMakeJuice()) | |||
{ | |||
if (morkTJakaJC.morkOrderPushesJuicer.TryDequeue(out OrderLocInfo orderLoc)) | |||
{ | |||
PickUpJuicer(); | |||
morkTJakaJC.IsHaveJuiceCup = true; | |||
} | |||
} | |||
else if (morkTJakaJC.MakeJuiceEnd) | |||
{ | |||
Thread.Sleep(5000);//延迟五秒,防止接饮料口滴饮料 | |||
putJuice(); | |||
pickUpJuiceHaveCup = false; | |||
morkTJakaJC.IsHaveJuiceCup = false; | |||
morkTJakaJC.MakeJuiceEnd = false; | |||
} | |||
} | |||
private void DoBoiledTea() | |||
{ | |||
if (IsMakeTeaWater()) | |||
{ | |||
if (morkTJakaJC.morkOrderPushesTea.TryDequeue(out OrderLocInfo orderLoc)) | |||
{ | |||
PickUpTea(); | |||
morkTJakaJC.IsHaveTeaWaterCup = true; | |||
} | |||
} | |||
else if (morkTJakaJC.MakeTeaEnd) | |||
{ | |||
PutWaterCup(); | |||
pickUpHotWaterHaveCup = false; | |||
morkTJakaJC.IsHaveTeaWaterCup = false; | |||
morkTJakaJC.MakeTeaEnd = false; | |||
} | |||
} | |||
private void DoBoiledWater() | |||
{ | |||
if (IsMakeWater()) | |||
{ | |||
if (morkTJakaJC.morkOrderPushesWater.TryDequeue(out OrderLocInfo orderLoc)) | |||
{ | |||
PickUpWater(); | |||
} | |||
} | |||
else if (morkTJakaJC.MakeTeaEnd) | |||
{ | |||
PutWaterCup(); | |||
pickUpHotWaterHaveCup = false; | |||
morkTJakaJC.IsHaveTeaWaterCup = false; | |||
morkTJakaJC.MakeTeaEnd = false; | |||
} | |||
} | |||
private void PickUpCoffee() | |||
{ | |||
if (!pickUpCoffeeHaveCup) | |||
{ | |||
OrderChange(morkTJakaJC.morkOrderPushesCoffee.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||
int resultTakeCup = takeCup(); | |||
if (resultTakeCup == 1) | |||
{ | |||
DeviceProcessLogShow("咖啡杯取杯完成"); | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_接咖啡 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_接咖啡)); | |||
new DRCoffee_MakeCoffeeEvent() { DeviceId = DeviceId, DrinkCode = (DrCoffeeDrinksCode)int.Parse(mainMaterialLoc) }.Publish(); //接咖啡控制 //DrCoffeeDrinksCode.热水 | |||
are.WaitOne(1000 * 180); | |||
} | |||
else | |||
{ | |||
@@ -231,309 +397,253 @@ namespace BPASmartClient.MorktJAKAJC | |||
Wait(int.Parse(JakaModel.SENCE_初始位)); | |||
} | |||
} | |||
else if (resultTakeCup == 2 || resultTakeCup == 3) | |||
} | |||
private void PutCoffeeCup() | |||
{ | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_放咖啡杯 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_放咖啡杯)); | |||
int resultputCup = putCup(); | |||
if (resultputCup == 1) | |||
{ | |||
//订单状态改变:完成 | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_初始位 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_初始位)); | |||
OrderChange(morkTJakaJC.morkOrderPushesCoffee.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); | |||
} | |||
else | |||
{ | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_初始位 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_初始位)); | |||
} | |||
#endregion | |||
} | |||
/// <summary> | |||
/// 做茶 | |||
/// 接开水 | |||
/// </summary> | |||
private void DoTea() | |||
private void PickUpWater() | |||
{ | |||
#region 接茶流程 | |||
OrderChange(subOrderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||
int resultTakeCup = takeCup(); | |||
if (resultTakeCup == 1) | |||
#region 接水流程 | |||
if (!pickUpHotWaterHaveCup) | |||
{ | |||
DeviceProcessLogShow("取茶杯完成"); | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_接茶 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_接茶)); | |||
new WriteMcu() { TagName = "ServoControl", Address = "1", Value = 105 }.Publish(); | |||
Thread.Sleep(1000); | |||
new WriteMcu() { TagName = "ServoControl", Address = "1", Value = 130 }.Publish(); | |||
Thread.Sleep(1000); | |||
new WriteMcu() { TagName = "ServoControl", Address = "1", Value = 105 }.Publish(); | |||
Thread.Sleep(3000); | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_接茶_接水 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_接茶_接水)); | |||
new WriteMcu() { TagName = "OutputControl", Value = false, Address = "4" }.Publish(); | |||
new WriteMcu() { TagName = "OutputControl", Value = false, Address = "3" }.Publish(); | |||
OrderChange(morkTJakaJC.morkOrderPushesWater.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||
int resultTakeCup = takeCup(); | |||
if (resultTakeCup == 1) | |||
{ | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_接水 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_接水)); | |||
Thread.Sleep(100); | |||
new WriteMcu() { TagName = "OutputControl", Value = true, Address = "3" }.Publish(); | |||
Thread.Sleep(3000); | |||
new WriteMcu() { TagName = "OutputControl", Value = false, Address = "3" }.Publish(); | |||
Thread.Sleep(100); | |||
new WriteMcu() { TagName = "OutputControl", Value = false, Address = "4" }.Publish(); | |||
new WriteMcu() { TagName = "OutputControl", Value = false, Address = "4" }.Publish(); | |||
Thread.Sleep(100); | |||
new WriteMcu() { TagName = "OutputControl", Value = true, Address = "4" }.Publish(); | |||
Thread.Sleep(500); | |||
new WriteMcu() { TagName = "OutputControl", Value = false, Address = "4" }.Publish(); | |||
Thread.Sleep(50000); | |||
new WriteMcu() { TagName = "OutputControl", Value = false, Address = "3" }.Publish(); | |||
Thread.Sleep(100); | |||
new WriteMcu() { TagName = "OutputControl", Value = true, Address = "3" }.Publish(); | |||
Thread.Sleep(3000); | |||
new WriteMcu() { TagName = "OutputControl", Value = false, Address = "3" }.Publish(); | |||
Thread.Sleep(100); | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_放茶水杯 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_放茶水杯)); | |||
int resultputCup = putCup(); | |||
if (resultputCup == 1) | |||
{ | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_初始位 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_初始位)); | |||
OrderChange(subOrderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); | |||
new WriteMcu() { TagName = "OutputControl", Value = false, Address = "4" }.Publish(); | |||
Thread.Sleep(100); | |||
new WriteMcu() { TagName = "OutputControl", Value = true, Address = "4" }.Publish(); | |||
Thread.Sleep(500); | |||
new WriteMcu() { TagName = "OutputControl", Value = false, Address = "4" }.Publish(); | |||
} | |||
else | |||
else if (resultTakeCup == 2 || resultTakeCup == 3) | |||
{ | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_初始位 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_初始位)); | |||
} | |||
} | |||
else if (resultTakeCup == 2 || resultTakeCup == 3) | |||
#endregion | |||
} | |||
/// <summary> | |||
/// 放水杯 | |||
/// </summary> | |||
private void PutWaterCup() | |||
{ | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_放茶水杯 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_放茶水杯)); | |||
int resultputCup = putCup(); | |||
if (resultputCup == 1) | |||
{ | |||
//订单状态改变:完成 | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_初始位 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_初始位)); | |||
OrderChange(morkTJakaJC.morkOrderPushesCoffee.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); | |||
} | |||
else | |||
{ | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_初始位 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_初始位)); | |||
} | |||
#endregion | |||
} | |||
/// <summary> | |||
/// 接开水 | |||
/// 做茶 | |||
/// </summary> | |||
private void DoWater() | |||
private void PickUpTea() | |||
{ | |||
#region 接水流程 | |||
OrderChange(subOrderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||
int resultTakeCup = takeCup(); | |||
if (resultTakeCup == 1) | |||
#region 接茶流程 | |||
if (!pickUpHotWaterHaveCup) | |||
{ | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_接水 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_接水)); | |||
OrderChange(morkTJakaJC.morkOrderPushesTea.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||
int resultTakeCup = takeCup(); | |||
if (resultTakeCup == 1) | |||
{ | |||
DeviceProcessLogShow("取茶杯完成"); | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_接茶 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_接茶)); | |||
new WriteMcu() { TagName = "OutputControl", Value = false, Address = "4" }.Publish(); | |||
new WriteMcu() { TagName = "ServoControl", Address = "1", Value = 105 }.Publish(); | |||
Thread.Sleep(1000); | |||
new WriteMcu() { TagName = "ServoControl", Address = "1", Value = 130 }.Publish(); | |||
Thread.Sleep(1000); | |||
new WriteMcu() { TagName = "ServoControl", Address = "1", Value = 105 }.Publish(); | |||
Thread.Sleep(3000); | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_接茶_接水 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_接茶_接水)); | |||
new WriteMcu() { TagName = "OutputControl", Value = false, Address = "3" }.Publish(); | |||
Thread.Sleep(100); | |||
new WriteMcu() { TagName = "OutputControl", Value = true, Address = "3" }.Publish(); | |||
Thread.Sleep(3000); | |||
new WriteMcu() { TagName = "OutputControl", Value = false, Address = "3" }.Publish(); | |||
Thread.Sleep(100); | |||
new WriteMcu() { TagName = "OutputControl", Value = false, Address = "4" }.Publish(); | |||
Thread.Sleep(100); | |||
new WriteMcu() { TagName = "OutputControl", Value = true, Address = "4" }.Publish(); | |||
Thread.Sleep(500); | |||
new WriteMcu() { TagName = "OutputControl", Value = false, Address = "4" }.Publish(); | |||
new WriteMcu() { TagName = "OutputControl", Value = false, Address = "4" }.Publish(); | |||
new WriteMcu() { TagName = "OutputControl", Value = false, Address = "3" }.Publish(); | |||
Thread.Sleep(50000); | |||
//添加控制接水机构程序 | |||
Thread.Sleep(100); | |||
new WriteMcu() { TagName = "OutputControl", Value = true, Address = "3" }.Publish(); | |||
Thread.Sleep(3000); | |||
new WriteMcu() { TagName = "OutputControl", Value = false, Address = "3" }.Publish(); | |||
Thread.Sleep(100); | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_放茶水杯 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_放茶水杯)); | |||
int resultputCup = putCup(); | |||
if (resultputCup == 1) | |||
{ | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_初始位 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_初始位)); | |||
OrderChange(subOrderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); | |||
new WriteMcu() { TagName = "OutputControl", Value = false, Address = "4" }.Publish(); | |||
Thread.Sleep(100); | |||
new WriteMcu() { TagName = "OutputControl", Value = true, Address = "4" }.Publish(); | |||
Thread.Sleep(500); | |||
new WriteMcu() { TagName = "OutputControl", Value = false, Address = "4" }.Publish(); | |||
} | |||
else | |||
else if (resultTakeCup == 2 || resultTakeCup == 3) | |||
{ | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_初始位 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_初始位)); | |||
} | |||
} | |||
else if (resultTakeCup == 2 || resultTakeCup == 3) | |||
{ | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_初始位 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_初始位)); | |||
} | |||
#endregion | |||
} | |||
/// <summary> | |||
/// 果汁机控制信号 | |||
/// </summary> | |||
private byte JuicerNum; | |||
/// <summary> | |||
/// 做果汁 | |||
/// </summary> | |||
private void DoJuicer() | |||
private int JuiceCH; | |||
private void PickUpJuicer() | |||
{ | |||
#region 接果汁流程 | |||
are.Reset(); | |||
OrderChange(subOrderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||
int resultTakeCup = takeCup(); | |||
if (resultTakeCup == 1) | |||
if (!pickUpJuiceHaveCup) | |||
{ | |||
int JuicerNum1 = int.Parse(mainMaterialLoc); | |||
switch (JuicerNum1) | |||
OrderChange(morkTJakaJC.morkOrderPushesWater.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||
int resultTakeCup = takeCup(); | |||
JuiceCH = int.Parse(mainMaterialLoc); | |||
if (resultTakeCup == 1) | |||
{ | |||
case 52: | |||
if (GuMake) | |||
{ | |||
JuicerNum = 0x00; | |||
} | |||
else | |||
{ | |||
JuicerNum = 0x01; | |||
} | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_接果汁1 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_接果汁1)); | |||
break; | |||
case 53: | |||
if (GuMake) | |||
{ | |||
JuicerNum = 0x02; | |||
} | |||
else | |||
{ | |||
JuicerNum = 0x03; | |||
} | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_接果汁2 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_接果汁2)); | |||
break; | |||
case 54: | |||
if (GuMake) | |||
{ | |||
JuicerNum = 0x04; | |||
} | |||
else | |||
{ | |||
JuicerNum = 0x05; | |||
} | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_接果汁3 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_接果汁3)); | |||
break; | |||
case 55: | |||
if (GuMake) | |||
{ | |||
JuicerNum = 0x06; | |||
} | |||
else | |||
{ | |||
JuicerNum = 0x07; | |||
} | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_接果汁4 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_接果汁4)); | |||
break; | |||
default: | |||
JuicerNum = 0x00; | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_接果汁1 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_接果汁1)); | |||
break; | |||
} | |||
var devStatus = GetStatus<int[]>("GetDeviceStatus"); | |||
var devStatus1 = Convert.ToString(devStatus[0], 2); | |||
var devStatus2 = devStatus[1]; | |||
if (devStatus1.IndexOf("0") == 1 && devStatus2 == 0) | |||
{ | |||
if (sensor_Sign(1) == 1) | |||
{ | |||
new WriteJuicer() { Value = JuicerNum }.Publish(); | |||
} | |||
Thread.Sleep(100); | |||
devStatusBy = GetStatus<int[]>("GetDeviceStatus"); | |||
while (!(devStatusBy[1] == 0)) | |||
{ | |||
Thread.Sleep(100); | |||
devStatusBy = GetStatus<int[]>("GetDeviceStatus"); | |||
while (devStatusBy.Length != 2) | |||
{ | |||
Thread.Sleep(100); | |||
devStatusBy = GetStatus<int[]>("GetDeviceStatus"); | |||
} | |||
} | |||
devStatusBy = GetStatus<int[]>("GetDeviceStatus"); | |||
Thread.Sleep(5000); | |||
switch (JuicerNum1) | |||
switch (JuiceCH) | |||
{ | |||
case 52: | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_放果汁杯1 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_放果汁杯1)); | |||
if (GuMake) | |||
{ | |||
JuicerNum = 0x00; | |||
} | |||
else | |||
{ | |||
JuicerNum = 0x01; | |||
} | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_接果汁1 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_接果汁1)); | |||
break; | |||
case 53: | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_放果汁杯2 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_放果汁杯2)); | |||
if (GuMake) | |||
{ | |||
JuicerNum = 0x02; | |||
} | |||
else | |||
{ | |||
JuicerNum = 0x03; | |||
} | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_接果汁2 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_接果汁2)); | |||
break; | |||
case 54: | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_放果汁杯3 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_放果汁杯3)); | |||
if (GuMake) | |||
{ | |||
JuicerNum = 0x04; | |||
} | |||
else | |||
{ | |||
JuicerNum = 0x05; | |||
} | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_接果汁3 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_接果汁3)); | |||
break; | |||
case 55: | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_放果汁杯4 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_放果汁杯4)); | |||
if (GuMake) | |||
{ | |||
JuicerNum = 0x06; | |||
} | |||
else | |||
{ | |||
JuicerNum = 0x07; | |||
} | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_接果汁4 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_接果汁4)); | |||
break; | |||
default: | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_放果汁杯1 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_放果汁杯1)); | |||
JuicerNum = 0x00; | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_接果汁1 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_接果汁1)); | |||
break; | |||
} | |||
int resultputCup = putCup(); | |||
if (resultputCup == 1) | |||
{ | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_初始位 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_初始位)); | |||
OrderChange(subOrderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); | |||
} | |||
else | |||
{ | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_初始位 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_初始位)); | |||
} | |||
new WriteJuicer() { Value = JuicerNum }.Publish(); | |||
pickUpJuiceHaveCup = true; | |||
} | |||
else | |||
{ | |||
switch (JuicerNum1) | |||
{ | |||
case 52: | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_放果汁杯1 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_放果汁杯1)); | |||
break; | |||
case 53: | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_放果汁杯2 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_放果汁杯2)); | |||
break; | |||
case 54: | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_放果汁杯3 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_放果汁杯3)); | |||
break; | |||
case 55: | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_放果汁杯4 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_放果汁杯4)); | |||
break; | |||
default: | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_放果汁杯1 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_放果汁杯1)); | |||
break; | |||
} | |||
int resultputCup = putCup(); | |||
if (resultputCup == 1) | |||
{ | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_初始位 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_初始位)); | |||
OrderChange(subOrderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); | |||
} | |||
else | |||
{ | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_初始位 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_初始位)); | |||
} | |||
return; | |||
} | |||
} | |||
else if (resultTakeCup == 2 || resultTakeCup == 3) | |||
#endregion | |||
} | |||
private void putJuice() | |||
{ | |||
switch (JuiceCH) | |||
{ | |||
case 52: | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_放果汁杯1 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_放果汁杯1)); | |||
break; | |||
case 53: | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_放果汁杯2 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_放果汁杯2)); | |||
break; | |||
case 54: | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_放果汁杯3 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_放果汁杯3)); | |||
break; | |||
case 55: | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_放果汁杯4 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_放果汁杯4)); | |||
break; | |||
default: | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_放果汁杯1 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_放果汁杯1)); | |||
break; | |||
} | |||
int resultputCup = putCup(); | |||
if (resultputCup == 1) | |||
{ | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_初始位 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_初始位)); | |||
OrderChange(morkTJakaJC.morkOrderPushesWater.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); | |||
} | |||
else | |||
{ | |||
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_初始位 }.Publish(); | |||
Wait(int.Parse(JakaModel.SENCE_初始位)); | |||
} | |||
#endregion | |||
} | |||
private int getCup_cnt; | |||
/// <summary> | |||
@@ -656,9 +766,6 @@ namespace BPASmartClient.MorktJAKAJC | |||
} | |||
} | |||
private int cnt_Check; | |||
public override DeviceClientType DeviceType => throw new NotImplementedException(); | |||
/// <summary> | |||
/// 检测放杯位,是否有杯子 | |||
/// </summary> | |||
@@ -730,7 +837,6 @@ namespace BPASmartClient.MorktJAKAJC | |||
{ | |||
break; | |||
} | |||
} | |||
if (cnt_Check >= 0) | |||
{ | |||
@@ -750,14 +856,11 @@ namespace BPASmartClient.MorktJAKAJC | |||
public void SimOrder<T>(T simOrder) | |||
{ | |||
} | |||
public override void DoMain() | |||
{ | |||
} | |||
public override void Stop() | |||
{ | |||
@@ -765,13 +868,9 @@ namespace BPASmartClient.MorktJAKAJC | |||
public override void ReadData() | |||
{ | |||
} | |||
public override void MainTask() | |||
{ | |||
} | |||
public override void ResetProgram() | |||
{ | |||
@@ -1,8 +1,69 @@ | |||
using BPASmartClient.Device; | |||
using System.Collections.Concurrent; | |||
namespace BPASmartClient.MorktJAKAJC | |||
{ | |||
public class GVL_MORKJC : IStatus | |||
{ | |||
/// <summary> | |||
/// <summary> | |||
/// 咖啡订单队列 | |||
/// </summary> | |||
public ConcurrentQueue<OrderLocInfo> morkOrderPushesCoffee = new ConcurrentQueue<OrderLocInfo>(); | |||
/// <summary> | |||
/// 是否有咖啡杯 | |||
/// </summary> | |||
public bool IsHaveCoffeeCup = false; | |||
/// <summary> | |||
/// 咖啡是否制作完成 | |||
/// </summary> | |||
public bool MakeCoffeeEnd = false; | |||
/// <summary> | |||
/// 果汁订单队列 | |||
/// </summary> | |||
public ConcurrentQueue<OrderLocInfo> morkOrderPushesJuicer = new ConcurrentQueue<OrderLocInfo>(); | |||
/// <summary> | |||
/// 果汁是否在制作中 | |||
/// </summary> | |||
public bool IsHaveJuiceCup = false; | |||
/// <summary> | |||
/// 咖啡是否制作完成 | |||
/// </summary> | |||
public bool MakeJuiceEnd = false; | |||
/// <summary> | |||
/// 做茶订单队列 | |||
/// </summary> | |||
public ConcurrentQueue<OrderLocInfo> morkOrderPushesTea = new ConcurrentQueue<OrderLocInfo>(); | |||
/// <summary> | |||
/// 茶或水是否在制作中 | |||
/// </summary> | |||
public bool IsHaveTeaWaterCup = false; | |||
/// <summary> | |||
/// 咖啡是否制作完成 | |||
/// </summary> | |||
public bool MakeTeaEnd = false; | |||
/// <summary> | |||
/// 做开水订单队列 | |||
/// </summary> | |||
public ConcurrentQueue<OrderLocInfo> morkOrderPushesWater = new ConcurrentQueue<OrderLocInfo>(); | |||
/// <summary> | |||
/// 等待取餐订单 | |||
/// </summary> | |||
public OrderLocInfo waitMorkOrder = new OrderLocInfo(); | |||
/// <summary> | |||
/// 当前正在制作咖啡 | |||
/// </summary> | |||
public OrderLocInfo MakeCoffeeOrder = new OrderLocInfo(); | |||
/// <summary> | |||
/// 订单ID | |||
/// </summary> | |||
public string SuborderId = null; | |||
} | |||
} |
@@ -0,0 +1,17 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MorktJAKAJC | |||
{ | |||
public class OrderLocInfo | |||
{ | |||
public string SuborderId { get; set; } | |||
public ushort Loc { get; set; } | |||
public ushort RecipeNumber { get; set; } | |||
public int BatchingId { get; set; } | |||
public string GoodName { get; set; } | |||
} | |||
} |
@@ -18,7 +18,7 @@ | |||
</ResourceDictionary.MergedDictionaries> | |||
</ResourceDictionary> | |||
</UserControl.Resources> | |||
<Grid> | |||
<Grid Grid.ColumnSpan="2"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="10*"/> | |||
<ColumnDefinition Width="10*"/> | |||
@@ -26,7 +26,7 @@ | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="10*"/> | |||
<RowDefinition Height="10*"/> | |||
<RowDefinition Height="20*"/> | |||
<RowDefinition Height="15*"/> | |||
</Grid.RowDefinitions> | |||
<GroupBox Grid.ColumnSpan="2" | |||
@@ -50,7 +50,7 @@ | |||
<TextBlock Text="连接状态" /> | |||
<TextBlock Text="{Binding RobotConnected}" | |||
Margin="120,0,0,0"/> | |||
<ListBox Grid.Row="2" Background="Transparent" Margin="0,0,0,-9"> | |||
<ListBox.Template> | |||
<ControlTemplate TargetType="{x:Type ListBox}"> | |||
@@ -119,6 +119,10 @@ | |||
FontSize="20" | |||
Header=" 果汁机 "> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="47*"/> | |||
<ColumnDefinition Width="75*"/> | |||
</Grid.ColumnDefinitions> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="3*"/> | |||
<RowDefinition Height="3*"/> | |||
@@ -127,7 +131,7 @@ | |||
<TextBlock Text="连接状态" /> | |||
<TextBlock Text="{Binding JuicerConnected}" | |||
Margin="120,0,0,0"/> | |||
<Grid Grid.Row="1"> | |||
<Grid Grid.ColumnSpan="2" Margin="0,71,0,71" Grid.RowSpan="3"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition></RowDefinition> | |||
</Grid.RowDefinitions> | |||
@@ -157,7 +161,7 @@ | |||
</Grid> | |||
<StackPanel Grid.Row="2" Orientation="Vertical"> | |||
<StackPanel Grid.Row="2" Orientation="Vertical" Grid.ColumnSpan="2"> | |||
<StackPanel Margin="0,10,0,0" Orientation="Horizontal"> | |||
<TextBlock>果汁</TextBlock> | |||
<ComboBox Margin="100,0,0,0" | |||
@@ -1,10 +1,9 @@ | |||
<Application | |||
x:Class="DosingSystem.App" | |||
x:Class="BPASmartClient.DosingSystem.App" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:con="clr-namespace:BPASmartClient.CustomResource.Converters;assembly=BPASmartClient.CustomResource" | |||
xmlns:local="clr-namespace:DosingSystem" | |||
StartupUri="View/MainWindow.xaml"> | |||
xmlns:local="clr-namespace:BPASmartClient.DosingSystem"> | |||
<Application.Resources> | |||
<ResourceDictionary> | |||
<ResourceDictionary.MergedDictionaries> | |||
@@ -5,13 +5,25 @@ using System.Data; | |||
using System.Linq; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using BPASmartClient.CustomResource.Pages.View; | |||
using BPASmartClient.DosingSystem.View; | |||
namespace DosingSystem | |||
namespace BPASmartClient.DosingSystem | |||
{ | |||
/// <summary> | |||
/// Interaction logic for App.xaml | |||
/// </summary> | |||
public partial class App : Application | |||
{ | |||
MainWindow mw = new MainWindow(); | |||
protected override void OnStartup(StartupEventArgs e) | |||
{ | |||
base.OnStartup(e); | |||
mw.Show(); | |||
//LoginView lv = new LoginView(); | |||
//var res = lv.ShowDialog(); | |||
//if (res != null && res == true) mw.Show(); | |||
} | |||
} | |||
} |
@@ -7,6 +7,7 @@ | |||
<UseWPF>true</UseWPF> | |||
<ApplicationManifest>app.manifest</ApplicationManifest> | |||
<ApplicationIcon>hbl.ico</ApplicationIcon> | |||
<PlatformTarget>AnyCPU</PlatformTarget> | |||
</PropertyGroup> | |||
<ItemGroup> |
@@ -6,7 +6,7 @@ using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
namespace DosingSystem.Model | |||
namespace BPASmartClient.DosingSystem.Model | |||
{ | |||
public class ActionMenu : ObservableObject | |||
{ | |||
@@ -19,5 +19,10 @@ namespace DosingSystem.Model | |||
public string MenuName { get { return _mMenuName; } set { _mMenuName = value; OnPropertyChanged(); } } | |||
private string _mMenuName; | |||
//public string NameSpace { get { return _mNameSpace; } set { _mNameSpace = value; OnPropertyChanged(); } } | |||
//private string _mNameSpace; | |||
} | |||
} |
@@ -7,7 +7,7 @@ using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace DosingSystem.Model | |||
namespace BPASmartClient.DosingSystem.Model | |||
{ | |||
public class Config | |||
{ | |||
@@ -0,0 +1,44 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.DosingSystem.Model | |||
{ | |||
public class DeviceAddress | |||
{ | |||
/// <summary> | |||
/// 设备名称起始地址 | |||
/// </summary> | |||
public static string DeviceName { get; set; } = "LW0"; | |||
/// <summary> | |||
/// 料仓重量反馈起始地址 | |||
/// </summary> | |||
public static string WeightFeedback { get; set; } = "LW204"; | |||
/// <summary> | |||
/// 重量设置地址 | |||
/// </summary> | |||
public static string WeightSet { get; set; } = "LW200"; | |||
/// <summary> | |||
/// 启动信号地址 | |||
/// </summary> | |||
public static string Start { get; set; } = "LW210"; | |||
/// <summary> | |||
/// 下料重量反馈地址 | |||
/// </summary> | |||
public static string CutWeightFeedback { get; set; } = "LW202"; | |||
/// <summary> | |||
/// 设备运行状态地址 | |||
/// </summary> | |||
public static string RunStatus { get; set; } = "LW206"; | |||
} | |||
} |
@@ -1,17 +1,18 @@ | |||
using BPASmartClient.Helper; | |||
using BPASmartClient.Message; | |||
using BPASmartClient.Modbus; | |||
using DosingSystem.ViewModel; | |||
using BPASmartClient.DosingSystem.ViewModel; | |||
using System; | |||
using System.Collections.Concurrent; | |||
using System.Collections.Generic; | |||
using System.Diagnostics; | |||
using System.Linq; | |||
using System.Net.NetworkInformation; | |||
using System.Text; | |||
using System.Threading; | |||
using System.Threading.Tasks; | |||
namespace DosingSystem.Model | |||
namespace BPASmartClient.DosingSystem.Model | |||
{ | |||
public class DeviceInquire | |||
{ | |||
@@ -19,26 +20,29 @@ namespace DosingSystem.Model | |||
public static DeviceInquire GetInstance => _Instance ?? (_Instance = new DeviceInquire()); | |||
private DeviceInquire() { } | |||
string IPSegment = "192.168.1."; | |||
string NameAddress = "VW0"; | |||
int count = 0; | |||
private static readonly object _lock = new object(); | |||
ConcurrentDictionary<string, DeviceStatus> DeviceLists = new ConcurrentDictionary<string, DeviceStatus>(); | |||
List<string> InvalidIP = new List<string>(); | |||
string IPSegment = "192.168.0."; | |||
//List<TaskFactory> | |||
ConcurrentDictionary<string, DeviceStatus> DeviceLists = new ConcurrentDictionary<string, DeviceStatus>(); | |||
List<string> InvalidIP = new List<string>();//无效 IP 集合 | |||
List<string> IPLists = new List<string>();//启动 Ping 任务IP集合 | |||
ConcurrentQueue<string> IPQueues = new ConcurrentQueue<string>();//pincomplete 完成队列 | |||
public void Init() | |||
{ | |||
IpAddressLines(); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
if (count >= 255) | |||
if (IPQueues.Count >= IPLists.Count) | |||
IpAddressLines(); | |||
Thread.Sleep(5000); | |||
}), "配料机设备上线监听", true); | |||
} | |||
public void Rescan() | |||
{ | |||
InvalidIP.Clear(); | |||
} | |||
public DeviceStatus GetDevice(string ip) | |||
{ | |||
if (ip != null) | |||
@@ -51,26 +55,22 @@ namespace DosingSystem.Model | |||
private void IpAddressLines() | |||
{ | |||
IPLists.Clear(); | |||
IPQueues.Clear(); | |||
for (int i = 1; i <= 255; i++) | |||
{ | |||
if (!InvalidIP.Contains($"{IPSegment}{i}")) | |||
if (!InvalidIP.Contains($"{IPSegment}{i}") && !DeviceLists.ContainsKey($"{IPSegment}{i}")) | |||
{ | |||
Ping myPing = new Ping(); | |||
myPing.PingCompleted += new PingCompletedEventHandler(_myPing_PingCompleted); | |||
string pingIP = $"{IPSegment}{i}"; | |||
myPing.SendAsync(pingIP, 1000, null); | |||
IPLists.Add($"{IPSegment}{i}"); | |||
} | |||
} | |||
count = 0; | |||
} | |||
private void CompleteCount() | |||
{ | |||
lock (_lock) | |||
IPLists.ForEach((item) => | |||
{ | |||
count++; | |||
} | |||
Ping myPing = new Ping(); | |||
myPing.PingCompleted += new PingCompletedEventHandler(_myPing_PingCompleted); | |||
myPing.SendAsync(item, 1000, null); | |||
}); | |||
} | |||
private void _myPing_PingCompleted(object sender, PingCompletedEventArgs e) | |||
@@ -83,10 +83,9 @@ namespace DosingSystem.Model | |||
DeviceStatus DS = new DeviceStatus(); | |||
DS.modbusTcp.IsReconnect = false; | |||
Task.Run(new Action(() => { DS.modbusTcp.ModbusTcpConnect(ip, 508); })); | |||
DS.modbusTcp.ConnectOk = new Action(() => | |||
{ | |||
string DeviceName = DS.modbusTcp.GetString(NameAddress, 20); | |||
string DeviceName = DS.modbusTcp.GetString(DeviceAddress.DeviceName, 20); | |||
if (DeviceName.Length > 0) | |||
{ | |||
DeviceLists.TryAdd(ip, DS); | |||
@@ -142,17 +141,35 @@ namespace DosingSystem.Model | |||
if (DeviceLists.ContainsKey(ip)) DeviceLists[ip].Dispose(); | |||
}); | |||
Task.Run(new Action(() => | |||
{ | |||
DS.modbusTcp.ModbusTcpConnect(ip, 502); | |||
IPQueues.Enqueue(e.Reply.Address.ToString()); | |||
})); | |||
} | |||
else IPQueues.Enqueue(e.Reply.Address.ToString()); | |||
} | |||
CompleteCount(); | |||
else IPQueues.Enqueue(e.Reply.Address.ToString()); | |||
} | |||
} | |||
public class DeviceStatus | |||
{ | |||
#region 对象属性声明 | |||
public string DeviceName = String.Empty; | |||
public string IpAddress => modbusTcp.IPAdress; | |||
/// <summary> | |||
/// 设备状态 | |||
/// </summary> | |||
public RawMaterialDeviceStatus deviceStatus { get; set; } = new RawMaterialDeviceStatus(); | |||
public ModbusTcp modbusTcp = new ModbusTcp(); | |||
public bool IsConnected => modbusTcp.Connected; | |||
#endregion | |||
public void Init(string DeviceName) | |||
{ | |||
this.DeviceName = DeviceName; | |||
@@ -160,11 +177,16 @@ namespace DosingSystem.Model | |||
{ | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
var res = this.modbusTcp.Read("VW100"); | |||
//获取设备运行状态 | |||
var res = this.modbusTcp.Read(DeviceAddress.RunStatus); | |||
if (res != null && res is ushort[] ushortValue) | |||
{ | |||
if (ushortValue.Length >= 1) RunStatus = ushortValue[0]; | |||
if (ushortValue.Length >= 1) deviceStatus.RunStatus = ushortValue[0]; | |||
} | |||
//获取设备料仓剩余重量 | |||
deviceStatus.WeightFeedback = this.modbusTcp.GetUint(DeviceAddress.WeightFeedback) * 10; | |||
Thread.Sleep(100); | |||
}), $"{DeviceName} 开始监听", true); | |||
} | |||
@@ -172,13 +194,13 @@ namespace DosingSystem.Model | |||
public void SetDeviceName(string name) | |||
{ | |||
this.modbusTcp.Write("VW0", new ushort[20]); | |||
this.modbusTcp.SetString("VW0", name); | |||
this.modbusTcp.Write(DeviceAddress.DeviceName, new ushort[20]); | |||
this.modbusTcp.SetString(DeviceAddress.DeviceName, name); | |||
} | |||
public void StatusReset() | |||
{ | |||
this.modbusTcp.Write("VW100", (ushort)1); | |||
this.modbusTcp.Write(DeviceAddress.RunStatus, (ushort)0); | |||
} | |||
public void Dispose() | |||
@@ -186,18 +208,12 @@ namespace DosingSystem.Model | |||
ThreadManage.GetInstance().StopTask($"{DeviceName} 开始监听"); | |||
} | |||
public bool IsConnected => modbusTcp.Connected; | |||
/// <summary> | |||
/// 配料系统运行状态 | |||
/// </summary> | |||
public ushort RunStatus { get; private set; } | |||
public void Start(float Value) | |||
public void Start(uint Value) | |||
{ | |||
if (modbusTcp.Connected) | |||
{ | |||
modbusTcp.SetReal("VW40", Value);//写入配方量 | |||
modbusTcp.Write("M0.0", true);//设备启动写入 | |||
modbusTcp.SetUint(DeviceAddress.WeightSet, Value);//写入配方量 | |||
modbusTcp.Write(DeviceAddress.Start, (ushort)1);//设备启动写入 | |||
} | |||
} | |||
} | |||
@@ -4,7 +4,7 @@ using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace DosingSystem.Model | |||
namespace BPASmartClient.DosingSystem.Model | |||
{ | |||
public class Global | |||
{ | |||
@@ -4,9 +4,9 @@ using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Collections.ObjectModel; | |||
using DosingSystem.ViewModel; | |||
using BPASmartClient.DosingSystem.ViewModel; | |||
namespace DosingSystem.Model | |||
namespace BPASmartClient.DosingSystem.Model | |||
{ | |||
public class LocaPar | |||
{ | |||
@@ -0,0 +1,45 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.DosingSystem.Model | |||
{ | |||
public class RawMaterialDeviceStatus | |||
{ | |||
/// <summary> | |||
/// 原料类型 | |||
/// 1:液体 | |||
/// 2:膏体 | |||
/// 3:粉体 | |||
/// </summary> | |||
public ushort RawMaterialType { get; set; } | |||
/// <summary> | |||
/// 料仓重量反馈 | |||
/// </summary> | |||
public float WeightFeedback { get; set; } | |||
/// <summary> | |||
/// 上限反馈 | |||
/// </summary> | |||
public bool UpLimitFeedback { get; set; } | |||
/// <summary> | |||
/// 下限反馈 | |||
/// </summary> | |||
public bool DownLimitFeedback { get; set; } | |||
/// <summary> | |||
/// 下料重量反馈 | |||
/// </summary> | |||
public float CutWeightFeedback { get; set; } | |||
/// <summary> | |||
/// 设备运行状态 | |||
/// </summary> | |||
public ushort RunStatus { get; set; } | |||
} | |||
} |
@@ -5,7 +5,7 @@ using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace DosingSystem.Model | |||
namespace BPASmartClient.DosingSystem.Model | |||
{ | |||
/// <summary> | |||
/// 原料模块 | |||
@@ -24,10 +24,10 @@ namespace DosingSystem.Model | |||
public string DeviceIp { get; set; } | |||
/// <summary> | |||
/// 原料重量 | |||
/// 原料重量设置 | |||
/// </summary> | |||
public float RawMaterialWeight { get { return _mRawMaterialWeight; } set { _mRawMaterialWeight = value; OnPropertyChanged(); } } | |||
private float _mRawMaterialWeight; | |||
public uint RawMaterialWeight { get { return _mRawMaterialWeight; } set { _mRawMaterialWeight = value; OnPropertyChanged(); } } | |||
private uint _mRawMaterialWeight; | |||
/// <summary> | |||
/// 原料类型 MW18 | |||
@@ -35,30 +35,35 @@ namespace DosingSystem.Model | |||
/// 2:膏体 | |||
/// 3:粉体 | |||
/// </summary> | |||
[Newtonsoft.Json.JsonIgnore] | |||
public ushort RawMaterialType { get { return _mRawMaterialType; } set { _mRawMaterialType = value; OnPropertyChanged(); } } | |||
private ushort _mRawMaterialType; | |||
/// <summary> | |||
/// 料仓重量反馈 MD40 | |||
/// </summary> | |||
[Newtonsoft.Json.JsonIgnore] | |||
public float WeightFeedback { get { return _mWeightFeedback; } set { _mWeightFeedback = value; OnPropertyChanged(); } } | |||
private float _mWeightFeedback; | |||
/// <summary> | |||
/// 上限反馈 | |||
/// </summary> | |||
[Newtonsoft.Json.JsonIgnore] | |||
public bool UpLimtFeedback { get { return _mUpLimtFeedback; } set { _mUpLimtFeedback = value; OnPropertyChanged(); } } | |||
private bool _mUpLimtFeedback; | |||
/// <summary> | |||
/// 下限反馈 | |||
/// </summary> | |||
[Newtonsoft.Json.JsonIgnore] | |||
public bool DownLimtFeedback { get { return _mDownLimtFeedback; } set { _mDownLimtFeedback = value; OnPropertyChanged(); } } | |||
private bool _mDownLimtFeedback; | |||
/// <summary> | |||
/// 下料重量反馈 MD52 | |||
/// </summary> | |||
[Newtonsoft.Json.JsonIgnore] | |||
public float UpLimtWeightFeedback { get { return _mUpLimtWeightFeedback; } set { _mUpLimtWeightFeedback = value; OnPropertyChanged(); } } | |||
private float _mUpLimtWeightFeedback; | |||
@@ -71,10 +76,9 @@ namespace DosingSystem.Model | |||
/// <summary> | |||
/// 原料设备执行状态 | |||
/// 1:准备就绪 | |||
/// 2:等待接料 | |||
/// 3:接料完成 | |||
/// 4:设备异常 | |||
/// 1:空闲状态 | |||
/// 2:下料中 | |||
/// 3:下料完成 | |||
/// </summary> | |||
[Newtonsoft.Json.JsonIgnore] | |||
public ushort RecipeStatus { get { return _mRecipeStatus; } set { _mRecipeStatus = value; OnPropertyChanged(); } } | |||
@@ -3,11 +3,12 @@ using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading; | |||
using System.Threading.Tasks; | |||
using DosingSystem.ViewModel; | |||
using BPASmartClient.DosingSystem.ViewModel; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
namespace DosingSystem.Model | |||
namespace BPASmartClient.DosingSystem.Model | |||
{ | |||
/// <summary> | |||
/// 配方模块 | |||
@@ -35,6 +36,9 @@ namespace DosingSystem.Model | |||
public string RecipCode { get { return _mRecipCode; } set { _mRecipCode = value; OnPropertyChanged(); } } | |||
private string _mRecipCode; | |||
[Newtonsoft.Json.JsonIgnore] | |||
public AutoResetEvent Are { get; set; } = new AutoResetEvent(false); | |||
/// <summary> | |||
/// 原料集合 | |||
/// </summary> | |||
@@ -4,7 +4,7 @@ using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace DosingSystem.Model | |||
namespace BPASmartClient.DosingSystem.Model | |||
{ | |||
public class UserManager | |||
{ | |||
@@ -24,7 +24,7 @@ namespace DosingSystem.Model | |||
管理员 = 1, | |||
操作员 = 2, | |||
观察员 = 3, | |||
技术员=4 | |||
技术员 = 4 | |||
} | |||
} |
@@ -1,20 +1,22 @@ | |||
<UserControl | |||
x:Class="DosingSystem.View.AdminstratorsView" | |||
x:Class="BPASmartClient.DosingSystem.View.AdminstratorsView" | |||
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:helper="clr-namespace:DosingSystem.View.Helper" | |||
xmlns:local="clr-namespace:DosingSystem.View" | |||
xmlns:helper="clr-namespace:BPASmartClient.DosingSystem.View.Helper" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingSystem.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:uc="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:vm="clr-namespace:DosingSystem.ViewModel" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel" | |||
d:DesignHeight="600" | |||
d:DesignWidth="800" | |||
Loaded="UserControl_Loaded" | |||
mc:Ignorable="d"> | |||
<UserControl.DataContext> | |||
<vm:AdminstratorsViewModel /> | |||
</UserControl.DataContext> | |||
<UserControl.Resources> | |||
<Style x:Key="TxLogin" TargetType="TextBlock"> | |||
<Setter Property="FontSize" Value="20" /> | |||
@@ -14,7 +14,7 @@ using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
using static BPASmartClient.CustomResource.UserControls.UserKeyBoard; | |||
namespace DosingSystem.View | |||
namespace BPASmartClient.DosingSystem.View | |||
{ | |||
/// <summary> | |||
/// AdministratorsView.xaml 的交互逻辑 | |||
@@ -1,27 +1,380 @@ | |||
<UserControl | |||
x:Class="DosingSystem.View.AlarmRecordView" | |||
x:Class="BPASmartClient.DosingSystem.View.AlarmRecordView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:control="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:DosingSystem.View" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingSystem.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:vm="clr-namespace:DosingSystem.ViewModel" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel" | |||
d:DesignHeight="450" | |||
d:DesignWidth="800" | |||
mc:Ignorable="d"> | |||
<UserControl.DataContext> | |||
<vm:AlarmRecordViewModel/> | |||
<vm:AlarmRecordViewModel /> | |||
</UserControl.DataContext> | |||
<Grid> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="40" | |||
Foreground="Wheat" | |||
Text="报警记录" /> | |||
<UserControl.Resources> | |||
<ResourceDictionary> | |||
<ResourceDictionary.MergedDictionaries> | |||
<ResourceDictionary> | |||
<!--<convert:TextDisplayConvert x:Key="textDisplayConvert" /> | |||
<convert:IsEnableConvert x:Key="isEnableConvert" /> | |||
<convert:AnalogAlarmConvert x:Key="analogAlarmConvert" /> | |||
<convert:DiscreteAlarmConvert x:Key="discreteAlarmConvert" /> | |||
<convert:AlarmTypeTextConvert x:Key="alarmTypeTextConvert" />--> | |||
<SolidColorBrush x:Key="BorderSolid" Color="#5523CACA" /> | |||
<SolidColorBrush x:Key="FontColor" Color="#FF2AB2E7" /> | |||
<SolidColorBrush x:Key="TitleFontColor" Color="#ddd" /> | |||
<SolidColorBrush x:Key="CursorColor" Color="Aqua" /> | |||
<SolidColorBrush x:Key="TitleBorderColor" Color="#FF2AB2E7" /> | |||
<Style x:Key="TextBlockStyle" TargetType="TextBlock"> | |||
<Setter Property="FontFamily" Value="楷体" /> | |||
<Setter Property="FontSize" Value="18" /> | |||
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" /> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
<Setter Property="HorizontalAlignment" Value="Center" /> | |||
</Style> | |||
<Style x:Key="TextBoxStyle" TargetType="TextBox"> | |||
<Setter Property="FontFamily" Value="楷体" /> | |||
<Setter Property="FontSize" Value="22" /> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" /> | |||
<Setter Property="BorderBrush" Value="#FF23CACA" /> | |||
<Setter Property="CaretBrush" Value="Aqua" /> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
</Style> | |||
<Style x:Key="DataTextBlockStyle" TargetType="TextBlock"> | |||
<Setter Property="HorizontalAlignment" Value="Center" /> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="Foreground" Value="Red" /> | |||
<Setter Property="FontSize" Value="14" /> | |||
</Style> | |||
<ControlTemplate x:Key="ButTemplate" TargetType="Button"> | |||
<Border | |||
x:Name="br" | |||
Background="Transparent" | |||
BorderBrush="#FF19B7EC" | |||
BorderThickness="2"> | |||
<StackPanel | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Orientation="Horizontal"> | |||
<ContentControl | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Content="{TemplateBinding Content}" | |||
Foreground="{TemplateBinding Foreground}" /> | |||
</StackPanel> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter TargetName="br" Property="Background" Value="#2219B7EC" /> | |||
</Trigger> | |||
<Trigger Property="IsPressed" Value="true"> | |||
<Setter TargetName="br" Property="Background" Value="#2219B7EC" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</ResourceDictionary> | |||
</ResourceDictionary.MergedDictionaries> | |||
</ResourceDictionary> | |||
</UserControl.Resources> | |||
<Grid Margin="10"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="50" /> | |||
<RowDefinition Height="30" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<StackPanel | |||
Margin="0,8" | |||
HorizontalAlignment="Right" | |||
Orientation="Horizontal"> | |||
<DatePicker | |||
Background="Transparent" | |||
BorderBrush="#aa3aa7f3" | |||
BorderThickness="2" | |||
SelectedDate="{Binding StartDateTime}" | |||
Style="{StaticResource PickerStyle}" | |||
Text="请输入开始时间" | |||
Visibility="{Binding IsVisibility}" /> | |||
<DatePicker | |||
Margin="20,0,20,0" | |||
Background="Transparent" | |||
BorderBrush="#aa3aa7f3" | |||
BorderThickness="2" | |||
SelectedDate="{Binding EndDateTime}" | |||
Style="{StaticResource PickerStyle}" | |||
Text="请输入结束时间" | |||
Visibility="{Binding IsVisibility}" /> | |||
<Button | |||
Width="140" | |||
Height="30" | |||
Background="#FF19B7EC" | |||
Command="{Binding ControlCommand}" | |||
Content="{Binding ControlButText}" | |||
FontFamily="楷体" | |||
FontSize="18" | |||
Template="{StaticResource ButTemplate}"> | |||
<Button.Foreground> | |||
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> | |||
<GradientStop Color="#FFBB662A" /> | |||
<GradientStop Offset="1" Color="White" /> | |||
</LinearGradientBrush> | |||
</Button.Foreground> | |||
</Button> | |||
<Button | |||
Width="140" | |||
Height="30" | |||
Margin="20,0,0,0" | |||
Background="#FF19B7EC" | |||
Command="{Binding SwitchCommand}" | |||
Content="{Binding ButContent}" | |||
FontFamily="楷体" | |||
FontSize="18" | |||
Template="{StaticResource ButTemplate}"> | |||
<Button.Foreground> | |||
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> | |||
<GradientStop Color="#FFBB662A" /> | |||
<GradientStop Offset="1" Color="White" /> | |||
</LinearGradientBrush> | |||
</Button.Foreground> | |||
</Button> | |||
</StackPanel> | |||
<!--#region 表格标题栏设置--> | |||
<Grid Grid.Row="1" Background="#dd2AB2E7"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.3*" /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0.5*" /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="ID" /> | |||
<Grid Grid.Column="1"> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="报警日期" /> | |||
<Border | |||
BorderBrush="{StaticResource TitleBorderColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="2" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="报警时间" /> | |||
<Grid Grid.Column="3"> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="报警信息" /> | |||
<Border | |||
BorderBrush="{StaticResource TitleBorderColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="4" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="报警值" /> | |||
<Grid Grid.Column="5"> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="报警等级" /> | |||
<Border | |||
BorderBrush="{StaticResource TitleBorderColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
</Grid> | |||
<!--#endregion--> | |||
<!--#region 表格数据显示--> | |||
<ScrollViewer | |||
Grid.Row="2" | |||
HorizontalScrollBarVisibility="Hidden" | |||
VerticalScrollBarVisibility="Hidden"> | |||
<Grid> | |||
<!--#region 实时报警信息--> | |||
<ItemsControl ItemsSource="{Binding AlarmInfos}" Visibility="{Binding CurrentDataVis}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid x:Name="gr" Height="30"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.3*" /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0.5*" /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="0" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding NumId}" /> | |||
<Grid Grid.Column="1"> | |||
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Date}" /> | |||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="2" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding Time}" /> | |||
<Grid Grid.Column="3"> | |||
<TextBlock | |||
Margin="10,0,0,0" | |||
HorizontalAlignment="Left" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding Info}" /> | |||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="4" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding Value}" /> | |||
<Grid Grid.Column="5"> | |||
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Grade}" /> | |||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<Border | |||
Grid.ColumnSpan="6" | |||
BorderBrush="{StaticResource BorderSolid}" | |||
BorderThickness="1" /> | |||
</Grid> | |||
<DataTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" /> | |||
</Trigger> | |||
</DataTemplate.Triggers> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
<!--#endregion--> | |||
<!--#region 历史报警信息--> | |||
<ItemsControl ItemsSource="{Binding HistoryAlarm}" Visibility="{Binding HistoryDataVis}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid x:Name="gr" Height="30"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.3*" /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0.5*" /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="0" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding Id}" /> | |||
<Grid Grid.Column="1"> | |||
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Date}" /> | |||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="2" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding Time}" /> | |||
<Grid Grid.Column="3"> | |||
<TextBlock | |||
Margin="10,0,0,0" | |||
HorizontalAlignment="Left" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding Info}" /> | |||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="4" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding Value}" /> | |||
<Grid Grid.Column="5"> | |||
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Grade}" /> | |||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<Border | |||
Grid.ColumnSpan="6" | |||
BorderBrush="{StaticResource BorderSolid}" | |||
BorderThickness="1" /> | |||
</Grid> | |||
<DataTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" /> | |||
</Trigger> | |||
</DataTemplate.Triggers> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
<!--#endregion--> | |||
</Grid> | |||
</ScrollViewer> | |||
<!--#endregion--> | |||
</Grid> | |||
</UserControl> |
@@ -13,7 +13,7 @@ using System.Windows.Media.Imaging; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
namespace DosingSystem.View | |||
namespace BPASmartClient.DosingSystem.View | |||
{ | |||
/// <summary> | |||
/// AlarmRecordView.xaml 的交互逻辑 | |||
@@ -1,11 +1,11 @@ | |||
<Window | |||
x:Class="DosingSystem.View.ChangeDeviceNameView" | |||
x:Class="BPASmartClient.DosingSystem.View.ChangeDeviceNameView" | |||
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:DosingSystem.View" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingSystem.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:vm="clr-namespace:DosingSystem.ViewModel" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel" | |||
Title="ChangeDeviceNameView" | |||
Width="400" | |||
Height="200" | |||
@@ -13,7 +13,7 @@ using System.Windows.Media; | |||
using System.Windows.Media.Imaging; | |||
using System.Windows.Shapes; | |||
namespace DosingSystem.View | |||
namespace BPASmartClient.DosingSystem.View | |||
{ | |||
/// <summary> | |||
/// ChangeDeviceNameView.xaml 的交互逻辑 | |||
@@ -1,13 +1,13 @@ | |||
<UserControl | |||
x:Class="DosingSystem.View.DeviceListView" | |||
x:Class="BPASmartClient.DosingSystem.View.DeviceListView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:control="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:DosingSystem.View" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingSystem.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:vm="clr-namespace:DosingSystem.ViewModel" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel" | |||
d:DesignHeight="450" | |||
d:DesignWidth="800" | |||
mc:Ignorable="d"> | |||
@@ -13,7 +13,7 @@ using System.Windows.Media.Imaging; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
namespace DosingSystem.View | |||
namespace BPASmartClient.DosingSystem.View | |||
{ | |||
/// <summary> | |||
/// DeviceListView.xaml 的交互逻辑 | |||
@@ -1,13 +1,13 @@ | |||
<UserControl | |||
x:Class="DosingSystem.View.HardwareStatusView" | |||
x:Class="BPASmartClient.DosingSystem.View.HardwareStatusView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:control="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:DosingSystem.View" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingSystem.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:vm="clr-namespace:DosingSystem.ViewModel" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel" | |||
d:DesignHeight="450" | |||
d:DesignWidth="800" | |||
mc:Ignorable="d"> | |||
@@ -13,7 +13,7 @@ using System.Windows.Media.Imaging; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
namespace DosingSystem.View | |||
namespace BPASmartClient.DosingSystem.View | |||
{ | |||
/// <summary> | |||
/// HardwareStatusView.xaml 的交互逻辑 | |||
@@ -6,7 +6,7 @@ using System.Threading.Tasks; | |||
using System.Windows; | |||
using System.Windows.Controls; | |||
namespace DosingSystem.View.Helper | |||
namespace BPASmartClient.DosingSystem.View.Helper | |||
{ | |||
/// <summary> | |||
/// 为PasswordBox控件的Password增加绑定功能 | |||
@@ -1,13 +1,13 @@ | |||
<Window | |||
x:Class="DosingSystem.View.MainWindow" | |||
x:Class="BPASmartClient.DosingSystem.View.MainWindow" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:control="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:DosingSystem" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingSystem" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:vm="clr-namespace:DosingSystem.ViewModel" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel" | |||
Title="MainWindow" | |||
Width="1300" | |||
Height="800" | |||
@@ -13,7 +13,7 @@ using System.Windows.Media.Imaging; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
namespace DosingSystem.View | |||
namespace BPASmartClient.DosingSystem.View | |||
{ | |||
/// <summary> | |||
/// Interaction logic for MainWindow.xaml | |||
@@ -40,5 +40,9 @@ namespace DosingSystem.View | |||
if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); | |||
}; | |||
} | |||
} | |||
} |
@@ -1,11 +1,11 @@ | |||
<Window | |||
x:Class="DosingSystem.View.NewRecipeView" | |||
x:Class="BPASmartClient.DosingSystem.View.NewRecipeView" | |||
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:DosingSystem.View" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingSystem.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:vm="clr-namespace:DosingSystem.ViewModel" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel" | |||
Title="NewRecipeView" | |||
Width="550" | |||
Height="450" | |||
@@ -13,7 +13,7 @@ using System.Windows.Media; | |||
using System.Windows.Media.Imaging; | |||
using System.Windows.Shapes; | |||
namespace DosingSystem.View | |||
namespace BPASmartClient.DosingSystem.View | |||
{ | |||
/// <summary> | |||
/// NewRecipeView.xaml 的交互逻辑 | |||
@@ -1,13 +1,13 @@ | |||
<UserControl | |||
x:Class="DosingSystem.View.RecipeControlView" | |||
x:Class="BPASmartClient.DosingSystem.View.RecipeControlView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:control="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:DosingSystem.View" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingSystem.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:vm="clr-namespace:DosingSystem.ViewModel" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel" | |||
d:DesignHeight="450" | |||
d:DesignWidth="800" | |||
mc:Ignorable="d"> | |||
@@ -13,7 +13,7 @@ using System.Windows.Media.Imaging; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
namespace DosingSystem.View | |||
namespace BPASmartClient.DosingSystem.View | |||
{ | |||
/// <summary> | |||
/// RecipeControlView.xaml 的交互逻辑 | |||
@@ -1,13 +1,13 @@ | |||
<UserControl | |||
x:Class="DosingSystem.View.RecipeSettingsView" | |||
x:Class="BPASmartClient.DosingSystem.View.RecipeSettingsView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:control="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:DosingSystem.View" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingSystem.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:vm="clr-namespace:DosingSystem.ViewModel" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel" | |||
d:DesignHeight="450" | |||
d:DesignWidth="800" | |||
mc:Ignorable="d"> | |||
@@ -13,7 +13,7 @@ using System.Windows.Media.Imaging; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
namespace DosingSystem.View | |||
namespace BPASmartClient.DosingSystem.View | |||
{ | |||
/// <summary> | |||
/// RecipeSettingsView.xaml 的交互逻辑 | |||
@@ -8,7 +8,7 @@ using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Collections.ObjectModel; | |||
namespace DosingSystem.ViewModel | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
public class AdminstratorsViewModel : ObservableObject | |||
{ | |||
@@ -33,7 +33,7 @@ namespace DosingSystem.ViewModel | |||
{ | |||
AdminLoginCommand = new RelayCommand(() => | |||
{ | |||
var rest = ActionManage.GetInstance.SendResult("LoginDosingSystem", $"{Admin}-={Password}-={SelectText}"); | |||
var rest = ActionManage.GetInstance.SendResult("LoginBPASmartClient.DosingSystem", $"{Admin}-={Password}-={SelectText}"); | |||
if (rest != null && rest is string str) | |||
{ | |||
ErrorMessage = str; | |||
@@ -10,7 +10,7 @@ using System.Windows; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
namespace DosingSystem.ViewModel | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
public class AlarmRecordViewModel : ObservableObject | |||
{ | |||
@@ -4,11 +4,11 @@ using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using BPASmartClient.Helper; | |||
using DosingSystem.Model; | |||
using BPASmartClient.DosingSystem.Model; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
namespace DosingSystem.ViewModel | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
public class ChangeDeviceNameViewModel : ObservableObject | |||
{ | |||
@@ -9,9 +9,9 @@ using System.Collections.ObjectModel; | |||
using System.Windows; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using DosingSystem.View; | |||
using BPASmartClient.DosingSystem.View; | |||
namespace DosingSystem.ViewModel | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
public class DeviceListViewModel : ObservableObject | |||
{ | |||
@@ -10,7 +10,7 @@ using System.Windows; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
namespace DosingSystem.ViewModel | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
public class HardwareStatusViewModel : ObservableObject | |||
{ | |||
@@ -9,11 +9,12 @@ using System.Collections.ObjectModel; | |||
using System.Windows; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using DosingSystem.Model; | |||
using BPASmartClient.DosingSystem.Model; | |||
using Newtonsoft.Json; | |||
using System.IO; | |||
using System.Reflection; | |||
namespace DosingSystem.ViewModel | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
public class MainViewModel : ObservableObject | |||
{ | |||
@@ -40,7 +41,7 @@ namespace DosingSystem.ViewModel | |||
{ | |||
Json<LocaPar>.Read(); | |||
TogglePag = new RelayCommand<object>(DoNavChanged); | |||
Login = new RelayCommand(() => { DoNavChanged("AdminstratorsView.用户登录"); UserManagement = false; }); | |||
Login = new RelayCommand(() => { DoNavChanged("BPASmartClient.DosingSystem.View.AdminstratorsView_用户登录"); UserManagement = false; }); | |||
PasswordChange = new RelayCommand(() => | |||
{ | |||
//DoNavChanged("PasswordChangeView.密码修改"); | |||
@@ -48,6 +49,7 @@ namespace DosingSystem.ViewModel | |||
}); | |||
ExitLogin = new RelayCommand(() => | |||
{ | |||
//SystemUtils.ShowScreenKeyboard(); | |||
//DoNavChanged("LoginView.退出登录"); | |||
UserManagement = false; | |||
}); | |||
@@ -78,7 +80,7 @@ namespace DosingSystem.ViewModel | |||
} | |||
} | |||
return "用户名或密码错误"; | |||
}), "LoginDosingSystem"); | |||
}), "LoginBPASmartClient.DosingSystem"); | |||
} | |||
private void MenuInit() | |||
@@ -86,31 +88,31 @@ namespace DosingSystem.ViewModel | |||
menus.Add(new ActionMenu() | |||
{ | |||
MenuName = "配方设置", | |||
CommandParameter = "RecipeSettingsView.配方设置", | |||
CommandParameter = "BPASmartClient.DosingSystem.View.RecipeSettingsView_配方设置", | |||
permission = new Permission[] { Permission.管理员, Permission.技术员 }, | |||
}); | |||
menus.Add(new ActionMenu() | |||
{ | |||
MenuName = "设备列表", | |||
CommandParameter = "DeviceListView.设备列表", | |||
CommandParameter = "BPASmartClient.DosingSystem.View.DeviceListView_设备列表", | |||
permission = new Permission[] { Permission.管理员, Permission.技术员 }, | |||
}); | |||
menus.Add(new ActionMenu() | |||
{ | |||
MenuName = "硬件状态", | |||
CommandParameter = "HardwareStatusView.硬件状态", | |||
CommandParameter = "BPASmartClient.DosingSystem.View.HardwareStatusView_硬件状态", | |||
permission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 }, | |||
}); | |||
menus.Add(new ActionMenu() | |||
{ | |||
MenuName = "报警记录", | |||
CommandParameter = "AlarmRecordView.报警记录", | |||
CommandParameter = "BPASmartClient.CustomResource.Pages.View.AlarmView_报警记录", | |||
permission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 }, | |||
}); | |||
menus.Add(new ActionMenu() | |||
{ | |||
MenuName = "配方下发", | |||
CommandParameter = "RecipeControlView.配方控制", | |||
CommandParameter = "BPASmartClient.DosingSystem.View.RecipeControlView_配方控制", | |||
permission = new Permission[] { Permission.管理员, Permission.操作员 }, | |||
}); | |||
} | |||
@@ -119,10 +121,15 @@ namespace DosingSystem.ViewModel | |||
{ | |||
if (obj != null && obj is string stobj) | |||
{ | |||
var strs = stobj.Split('.'); | |||
var strs = stobj.Split('_'); | |||
if (strs != null && strs.Length == 2) | |||
{ | |||
Type type = Type.GetType($"DosingSystem.View.{strs[0]}"); | |||
Type type; | |||
if (!stobj.Contains("BPASmartClient.DosingSystem")) | |||
{ | |||
type = Assembly.Load("BPASmartClient.CustomResource").GetType(strs[0]); | |||
} | |||
else type = Type.GetType(strs[0]); | |||
var res = type?.GetConstructor(System.Type.EmptyTypes)?.Invoke(null); | |||
if (res != null && res is FrameworkElement fe) MyWindow = fe; | |||
WindowTitleName = strs[1]; | |||
@@ -7,9 +7,9 @@ using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System.Collections.ObjectModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPASmartClient.Helper; | |||
using DosingSystem.Model; | |||
using BPASmartClient.DosingSystem.Model; | |||
namespace DosingSystem.ViewModel | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
public class NewRecipeViewModel : ObservableObject | |||
{ | |||
@@ -9,13 +9,15 @@ using System.Collections.ObjectModel; | |||
using System.Windows; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using DosingSystem.Model; | |||
using BPASmartClient.DosingSystem.Model; | |||
using System.Threading; | |||
namespace DosingSystem.ViewModel | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
public class RecipeControlViewModel : ObservableObject | |||
{ | |||
ConcurrentQueue<string> devices = new ConcurrentQueue<string>(); | |||
public RecipeControlViewModel() | |||
{ | |||
Recipes = Json<LocaPar>.Data.Recipes; | |||
@@ -23,20 +25,43 @@ namespace DosingSystem.ViewModel | |||
{ | |||
if (o != null && o is string deviceName) | |||
{ | |||
Task.Run(new Action(() => | |||
//Task.Run(new Action(() => | |||
//{ | |||
int index = Array.FindIndex(Recipes.ToArray(), p => p.RecipeName == deviceName); | |||
if (index >= 0 && index < Recipes.Count) | |||
{ | |||
Recipes.ElementAt(index).IsEnable = false; | |||
//foreach (var item in Recipes.ElementAt(index).RawMaterials) | |||
//{ | |||
// DeviceInquire.GetInstance.GetDevice(item.DeviceIp)?.Start(item.RawMaterialWeight);//启动写入 | |||
//} | |||
} | |||
//})); | |||
devices.Enqueue(deviceName); | |||
} | |||
}); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
if (devices.Count > 0) | |||
{ | |||
int index = Array.FindIndex(Recipes.ToArray(), p => p.RecipeName == devices.ElementAt(0)); | |||
if (index >= 0 && index < Recipes.Count) | |||
{ | |||
int index = Array.FindIndex(Recipes.ToArray(), p => p.RecipeName == deviceName); | |||
if (index >= 0 && index < Recipes.Count) | |||
Recipes.ElementAt(index).Are.Reset(); | |||
Recipes.ElementAt(index).IsEnable = false; | |||
foreach (var item in Recipes.ElementAt(index).RawMaterials) | |||
{ | |||
Recipes.ElementAt(index).IsEnable = false; | |||
foreach (var item in Recipes.ElementAt(index).RawMaterials) | |||
{ | |||
DeviceInquire.GetInstance.GetDevice(item.DeviceIp)?.Start(item.RawMaterialWeight);//启动写入 | |||
} | |||
DeviceInquire.GetInstance.GetDevice(item.DeviceIp)?.Start(item.RawMaterialWeight);//启动写入 | |||
} | |||
})); | |||
Recipes.ElementAt(index).Are.WaitOne(); | |||
devices.TryDequeue(out string deviceName); | |||
} | |||
} | |||
}); | |||
Thread.Sleep(100); | |||
}), "启动配发下发"); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
@@ -45,7 +70,7 @@ namespace DosingSystem.ViewModel | |||
{ | |||
for (int m = 0; m < Recipes.ElementAt(i).RawMaterials.Count; m++) | |||
{ | |||
var RunStatus = DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(m).DeviceIp).RunStatus; | |||
var RunStatus = DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(m).DeviceIp).deviceStatus.RunStatus; | |||
Recipes.ElementAt(i).RawMaterials.ElementAt(m).RecipeStatus = RunStatus; | |||
var res = Recipes.ElementAt(i).RawMaterials.Where(p => p.RecipeStatus == 3).ToList(); | |||
if (res != null && res.Count == Recipes.ElementAt(i).RawMaterials.Count) | |||
@@ -55,6 +80,7 @@ namespace DosingSystem.ViewModel | |||
DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(r).DeviceIp).StatusReset(); | |||
} | |||
Recipes.ElementAt(i).IsEnable = true; | |||
Recipes.ElementAt(i).Are.Set(); | |||
} | |||
} | |||
} | |||
@@ -9,10 +9,10 @@ using System.Collections.ObjectModel; | |||
using System.Windows; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using DosingSystem.Model; | |||
using DosingSystem.View; | |||
using BPASmartClient.DosingSystem.Model; | |||
using BPASmartClient.DosingSystem.View; | |||
namespace DosingSystem.ViewModel | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
public class RecipeSettingsViewModel : ObservableObject | |||
{ | |||
@@ -94,13 +94,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.Juicer", "BP | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MorkT_HQ", "BPASmartClient.MorkT_HQ\BPASmartClient.MorkT_HQ.csproj", "{00C17D87-A323-4A97-BC21-7039E55614DE}" | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DosingSystem", "DosingSystem\DosingSystem.csproj", "{4E0B01AD-CFD0-4BD5-BBE6-AD2A4183B4DB}" | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.DosingSystem", "DosingSystem\BPASmartClient.DosingSystem.csproj", "{4E0B01AD-CFD0-4BD5-BBE6-AD2A4183B4DB}" | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MorkTJuicer", "BPASmartClient.MorkTJuicer\BPASmartClient.MorkTJuicer.csproj", "{724087A3-E7E7-4494-B844-414FF5CD1D40}" | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.AGV", "BPASmartClient.AGV\BPASmartClient.AGV.csproj", "{507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8}" | |||
EndProject | |||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FryPot_DosingSystem", "FryPot_DosingSystem\FryPot_DosingSystem.csproj", "{BF0BCA66-BAE3-4293-9C3A-51537AB8580E}" | |||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.MorkT_Show", "BPASmartClient.MorkT_Show\BPASmartClient.MorkT_Show.csproj", "{3653724D-3683-4722-B978-EB88DD4AE5DB}" | |||
EndProject | |||
Global | |||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | |||
@@ -916,26 +916,26 @@ Global | |||
{507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8}.Release|x64.Build.0 = Release|Any CPU | |||
{507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8}.Release|x86.ActiveCfg = Release|Any CPU | |||
{507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8}.Release|x86.Build.0 = Release|Any CPU | |||
{BF0BCA66-BAE3-4293-9C3A-51537AB8580E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{BF0BCA66-BAE3-4293-9C3A-51537AB8580E}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{BF0BCA66-BAE3-4293-9C3A-51537AB8580E}.Debug|ARM.ActiveCfg = Debug|Any CPU | |||
{BF0BCA66-BAE3-4293-9C3A-51537AB8580E}.Debug|ARM.Build.0 = Debug|Any CPU | |||
{BF0BCA66-BAE3-4293-9C3A-51537AB8580E}.Debug|ARM64.ActiveCfg = Debug|Any CPU | |||
{BF0BCA66-BAE3-4293-9C3A-51537AB8580E}.Debug|ARM64.Build.0 = Debug|Any CPU | |||
{BF0BCA66-BAE3-4293-9C3A-51537AB8580E}.Debug|x64.ActiveCfg = Debug|Any CPU | |||
{BF0BCA66-BAE3-4293-9C3A-51537AB8580E}.Debug|x64.Build.0 = Debug|Any CPU | |||
{BF0BCA66-BAE3-4293-9C3A-51537AB8580E}.Debug|x86.ActiveCfg = Debug|Any CPU | |||
{BF0BCA66-BAE3-4293-9C3A-51537AB8580E}.Debug|x86.Build.0 = Debug|Any CPU | |||
{BF0BCA66-BAE3-4293-9C3A-51537AB8580E}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{BF0BCA66-BAE3-4293-9C3A-51537AB8580E}.Release|Any CPU.Build.0 = Release|Any CPU | |||
{BF0BCA66-BAE3-4293-9C3A-51537AB8580E}.Release|ARM.ActiveCfg = Release|Any CPU | |||
{BF0BCA66-BAE3-4293-9C3A-51537AB8580E}.Release|ARM.Build.0 = Release|Any CPU | |||
{BF0BCA66-BAE3-4293-9C3A-51537AB8580E}.Release|ARM64.ActiveCfg = Release|Any CPU | |||
{BF0BCA66-BAE3-4293-9C3A-51537AB8580E}.Release|ARM64.Build.0 = Release|Any CPU | |||
{BF0BCA66-BAE3-4293-9C3A-51537AB8580E}.Release|x64.ActiveCfg = Release|Any CPU | |||
{BF0BCA66-BAE3-4293-9C3A-51537AB8580E}.Release|x64.Build.0 = Release|Any CPU | |||
{BF0BCA66-BAE3-4293-9C3A-51537AB8580E}.Release|x86.ActiveCfg = Release|Any CPU | |||
{BF0BCA66-BAE3-4293-9C3A-51537AB8580E}.Release|x86.Build.0 = Release|Any CPU | |||
{3653724D-3683-4722-B978-EB88DD4AE5DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{3653724D-3683-4722-B978-EB88DD4AE5DB}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{3653724D-3683-4722-B978-EB88DD4AE5DB}.Debug|ARM.ActiveCfg = Debug|Any CPU | |||
{3653724D-3683-4722-B978-EB88DD4AE5DB}.Debug|ARM.Build.0 = Debug|Any CPU | |||
{3653724D-3683-4722-B978-EB88DD4AE5DB}.Debug|ARM64.ActiveCfg = Debug|Any CPU | |||
{3653724D-3683-4722-B978-EB88DD4AE5DB}.Debug|ARM64.Build.0 = Debug|Any CPU | |||
{3653724D-3683-4722-B978-EB88DD4AE5DB}.Debug|x64.ActiveCfg = Debug|Any CPU | |||
{3653724D-3683-4722-B978-EB88DD4AE5DB}.Debug|x64.Build.0 = Debug|Any CPU | |||
{3653724D-3683-4722-B978-EB88DD4AE5DB}.Debug|x86.ActiveCfg = Debug|Any CPU | |||
{3653724D-3683-4722-B978-EB88DD4AE5DB}.Debug|x86.Build.0 = Debug|Any CPU | |||
{3653724D-3683-4722-B978-EB88DD4AE5DB}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{3653724D-3683-4722-B978-EB88DD4AE5DB}.Release|Any CPU.Build.0 = Release|Any CPU | |||
{3653724D-3683-4722-B978-EB88DD4AE5DB}.Release|ARM.ActiveCfg = Release|Any CPU | |||
{3653724D-3683-4722-B978-EB88DD4AE5DB}.Release|ARM.Build.0 = Release|Any CPU | |||
{3653724D-3683-4722-B978-EB88DD4AE5DB}.Release|ARM64.ActiveCfg = Release|Any CPU | |||
{3653724D-3683-4722-B978-EB88DD4AE5DB}.Release|ARM64.Build.0 = Release|Any CPU | |||
{3653724D-3683-4722-B978-EB88DD4AE5DB}.Release|x64.ActiveCfg = Release|Any CPU | |||
{3653724D-3683-4722-B978-EB88DD4AE5DB}.Release|x64.Build.0 = Release|Any CPU | |||
{3653724D-3683-4722-B978-EB88DD4AE5DB}.Release|x86.ActiveCfg = Release|Any CPU | |||
{3653724D-3683-4722-B978-EB88DD4AE5DB}.Release|x86.Build.0 = Release|Any CPU | |||
EndGlobalSection | |||
GlobalSection(SolutionProperties) = preSolution | |||
HideSolutionNode = FALSE | |||
@@ -981,7 +981,7 @@ Global | |||
{4E0B01AD-CFD0-4BD5-BBE6-AD2A4183B4DB} = {8712125E-14CD-4E1B-A1CE-4BDE03805942} | |||
{724087A3-E7E7-4494-B844-414FF5CD1D40} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F} | |||
{507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8} = {3D1D0E04-03FD-480A-8CF8-6E01A2E28625} | |||
{BF0BCA66-BAE3-4293-9C3A-51537AB8580E} = {8712125E-14CD-4E1B-A1CE-4BDE03805942} | |||
{3653724D-3683-4722-B978-EB88DD4AE5DB} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F} | |||
EndGlobalSection | |||
GlobalSection(ExtensibilityGlobals) = postSolution | |||
SolutionGuid = {9AEC9B81-0222-4DE9-B642-D915C29222AC} | |||