@@ -22,6 +22,9 @@ namespace HBLConsole.Business | |||||
{ | { | ||||
IOTDev.GetInstance().Set(InternetInfo.ProductKey, InternetInfo.DeviceName, InternetInfo.DeviceSecret); | IOTDev.GetInstance().Set(InternetInfo.ProductKey, InternetInfo.DeviceName, InternetInfo.DeviceSecret); | ||||
iSLinks = IOTDev.GetInstance().CreateLinks(); | iSLinks = IOTDev.GetInstance().CreateLinks(); | ||||
//订阅设备控制主题 | |||||
IOTDev.GetInstance().IOT_Subscribe("/" + InternetInfo.ProductKey + "/" + InternetInfo.DeviceName + "/user/SetDevice"); | |||||
IOTDev.actionIOT += actionIOTHandler;//消息数据回调 | |||||
if (iSLinks) MessageLog.GetInstance.Show($"设备{InternetInfo.DeviceName}阿里云连接成功."); | if (iSLinks) MessageLog.GetInstance.Show($"设备{InternetInfo.DeviceName}阿里云连接成功."); | ||||
else MessageLog.GetInstance.Show($"设备{InternetInfo.DeviceName}阿里云连接失败.不能上报业务信息"); | else MessageLog.GetInstance.Show($"设备{InternetInfo.DeviceName}阿里云连接失败.不能上报业务信息"); | ||||
@@ -155,5 +158,10 @@ namespace HBLConsole.Business | |||||
Thread.Sleep(5000); | Thread.Sleep(5000); | ||||
}), "设备IOT上报云端"); | }), "设备IOT上报云端"); | ||||
} | } | ||||
private void actionIOTHandler(string topic, string message) | |||||
{ | |||||
} | |||||
} | } | ||||
} | } |
@@ -39,18 +39,48 @@ namespace HBLConsole.Communication | |||||
Thread.Sleep(3000); | Thread.Sleep(3000); | ||||
} | } | ||||
} | } | ||||
StartRobot(); | |||||
MessageLog.GetInstance.Show("乐百机器人连接成功!"); | MessageLog.GetInstance.Show("乐百机器人连接成功!"); | ||||
GetSpeed(); | |||||
//GetSpeed(); | |||||
//ActionOperate.GetInstance.Send($"{GVL.GeneralConfig.DeviceType.ToString()}/ConnectOk"); | //ActionOperate.GetInstance.Send($"{GVL.GeneralConfig.DeviceType.ToString()}/ConnectOk"); | ||||
} | } | ||||
public void GetSpeed() | |||||
public void GetSpeed() | |||||
{ | { | ||||
//client.StartSys().GetAwaiter(); | //client.StartSys().GetAwaiter(); | ||||
//var aa = client.GetActualTcpSpeed().GetAwaiter(); | |||||
var aa = client.GetActualTcpSpeed().GetAwaiter(); | |||||
//robotData.RobotMode.Mode | |||||
} | } | ||||
/// <summary> | |||||
/// 启动机器人 | |||||
/// </summary> | |||||
public async void StartRobot() | |||||
{ | |||||
if (robotData != null) | |||||
{ | |||||
await client.StartSys(); | |||||
await client.Sync(); | |||||
MessageLog.GetInstance.Show("机器人启动成功"); | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 获取抓手重量 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
public double GetClawWdight() | |||||
{ | |||||
if (robotData != null) | |||||
{ | |||||
return client.GetClawWeight().Result.Weight_; | |||||
} | |||||
return 0; | |||||
} | |||||
/// <summary> | /// <summary> | ||||
/// 获取信号量 | /// 获取信号量 | ||||
@@ -176,16 +176,16 @@ | |||||
Style="{StaticResource ButtonStyle}" /> | Style="{StaticResource ButtonStyle}" /> | ||||
<ComboBox | <ComboBox | ||||
Margin="5" | |||||
Width="150" | Width="150" | ||||
Margin="5" | |||||
ItemsSource="{Binding IceCreamModes}" | ItemsSource="{Binding IceCreamModes}" | ||||
SelectedItem="{Binding SelecteIceCreamdMode}" /> | SelectedItem="{Binding SelecteIceCreamdMode}" /> | ||||
<Button | <Button | ||||
s:View.ActionTarget="{Binding}" | s:View.ActionTarget="{Binding}" | ||||
Command="{s:Action SetIceCreamModel}" | Command="{s:Action SetIceCreamModel}" | ||||
Style="{StaticResource ButtonStyle}" | |||||
Content="设置模式" /> | |||||
Content="设置模式" | |||||
Style="{StaticResource ButtonStyle}" /> | |||||
</StackPanel> | </StackPanel> | ||||
</Grid> | </Grid> | ||||
@@ -20,7 +20,7 @@ | |||||
<ItemGroup> | <ItemGroup> | ||||
<Reference Include="BPA.Utility"> | <Reference Include="BPA.Utility"> | ||||
<HintPath>..\..\..\..\BPACommon_output\net5.0\BPA.Utility.dll</HintPath> | |||||
<HintPath>D:\BPACommon_output\net5.0\BPA.Utility.dll</HintPath> | |||||
</Reference> | </Reference> | ||||
</ItemGroup> | </ItemGroup> | ||||
</Project> | </Project> |
@@ -12,10 +12,10 @@ | |||||
<ItemGroup> | <ItemGroup> | ||||
<Reference Include="BPA.Message"> | <Reference Include="BPA.Message"> | ||||
<HintPath>..\..\..\..\..\..\BPACommon_output\net5.0\BPA.Message.dll</HintPath> | |||||
<HintPath>D:\BPACommon_output\net5.0\BPA.Message.dll</HintPath> | |||||
</Reference> | </Reference> | ||||
<Reference Include="BPA.Models"> | <Reference Include="BPA.Models"> | ||||
<HintPath>..\..\..\..\..\..\BPACommon_output\net5.0\BPA.Models.dll</HintPath> | |||||
<HintPath>D:\BPACommon_output\net5.0\BPA.Models.dll</HintPath> | |||||
</Reference> | </Reference> | ||||
</ItemGroup> | </ItemGroup> | ||||
@@ -155,16 +155,10 @@ namespace HBLConsole.MORKIC | |||||
public void DataParse<T>(T order) | public void DataParse<T>(T order) | ||||
{ | { | ||||
if (order is MorkOrderPush morkOrderPush) | if (order is MorkOrderPush morkOrderPush) | ||||
{ | { | ||||
morkOrderPushes.Enqueue(morkOrderPush); | morkOrderPushes.Enqueue(morkOrderPush); | ||||
} | } | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
@@ -19,13 +19,13 @@ | |||||
<ItemGroup> | <ItemGroup> | ||||
<Reference Include="BPA.Message"> | <Reference Include="BPA.Message"> | ||||
<HintPath>..\..\..\..\..\..\BPACommon_output\net5.0\BPA.Message.dll</HintPath> | |||||
<HintPath>D:\BPACommon_output\net5.0\BPA.Message.dll</HintPath> | |||||
</Reference> | </Reference> | ||||
<Reference Include="BPA.Models"> | <Reference Include="BPA.Models"> | ||||
<HintPath>..\..\..\..\..\..\BPACommon_output\net5.0\BPA.Models.dll</HintPath> | |||||
<HintPath>D:\BPACommon_output\net5.0\BPA.Models.dll</HintPath> | |||||
</Reference> | </Reference> | ||||
<Reference Include="BPA.Utility"> | <Reference Include="BPA.Utility"> | ||||
<HintPath>..\..\..\..\..\..\BPACommon_output\net5.0\BPA.Utility.dll</HintPath> | |||||
<HintPath>D:\BPACommon_output\net5.0\BPA.Utility.dll</HintPath> | |||||
</Reference> | </Reference> | ||||
</ItemGroup> | </ItemGroup> | ||||
@@ -34,6 +34,7 @@ namespace HBLConsole.MainConsole | |||||
Json<MorkOrderPushPar>.Read(); | Json<MorkOrderPushPar>.Read(); | ||||
Json<BatchingInfoPar>.Read(); | Json<BatchingInfoPar>.Read(); | ||||
Json<SimOrderConfig>.Read(); | Json<SimOrderConfig>.Read(); | ||||
Json<KeepDataBase>.Read(); | |||||
MessageLog.GetInstance.Show($"启动【{GeneralConfig.DeviceType}】设备"); | MessageLog.GetInstance.Show($"启动【{GeneralConfig.DeviceType}】设备"); | ||||
} | } | ||||
@@ -44,6 +45,7 @@ namespace HBLConsole.MainConsole | |||||
Json<BatchingInfoPar>.Save(); | Json<BatchingInfoPar>.Save(); | ||||
Json<SetPar>.Save(); | Json<SetPar>.Save(); | ||||
Json<SimOrderConfig>.Save(); | Json<SimOrderConfig>.Save(); | ||||
Json<KeepDataBase>.Save(); | |||||
TextHelper.GetInstance.SaveLogInfo(MessageLog.GetInstance.LogInfo, "LogInfo"); | TextHelper.GetInstance.SaveLogInfo(MessageLog.GetInstance.LogInfo, "LogInfo"); | ||||
} | } | ||||
@@ -64,7 +66,7 @@ namespace HBLConsole.MainConsole | |||||
MqttHelper.GetInstance.MqttSubscriptionAsync(Topics.ToArray());//主题订阅 | MqttHelper.GetInstance.MqttSubscriptionAsync(Topics.ToArray());//主题订阅 | ||||
//IotReport.GetInstance.Init();//IOT 上报 | |||||
//w IotReport.GetInstance.Init();//IOT 上报 | |||||
HeartbeatReport.GetInstance.Init();//心跳上报 | HeartbeatReport.GetInstance.Init();//心跳上报 | ||||
@@ -0,0 +1,22 @@ | |||||
| |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
using HBLConsole.Service; | |||||
using System.Collections.ObjectModel; | |||||
using System.Collections.Concurrent; | |||||
namespace HBLConsole.Model | |||||
{ | |||||
public class KeepDataBase | |||||
{ | |||||
/// <summary> | |||||
/// 模拟订单数据的配置 | |||||
/// </summary> | |||||
public ObservableCollection<SimOrderVisibleData> simOrderConfig { get; set; } = new ObservableCollection<SimOrderVisibleData>(); | |||||
} | |||||
} |
@@ -165,7 +165,6 @@ | |||||
Text="{Binding devcieManagerResult.DeviceName}" /> | Text="{Binding devcieManagerResult.DeviceName}" /> | ||||
<TextBlock | <TextBlock | ||||
TextWrapping="Wrap" | |||||
Grid.Row="2" | Grid.Row="2" | ||||
Grid.ColumnSpan="2" | Grid.ColumnSpan="2" | ||||
Margin="20,0,0,0" | Margin="20,0,0,0" | ||||
@@ -173,7 +172,8 @@ | |||||
FontFamily="楷体" | FontFamily="楷体" | ||||
FontSize="16" | FontSize="16" | ||||
Foreground="#FFE2415C" | Foreground="#FFE2415C" | ||||
Text="{Binding LogInfo}" /> | |||||
Text="{Binding LogInfo}" | |||||
TextWrapping="Wrap" /> | |||||
<Button | <Button | ||||
Grid.Row="3" | Grid.Row="3" | ||||
@@ -5,6 +5,7 @@ | |||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||||
xmlns:local="clr-namespace:HBLConsole.DialogWindow.View" | xmlns:local="clr-namespace:HBLConsole.DialogWindow.View" | ||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||||
xmlns:vm="clr-namespace:HBLConsole.DialogWindow.ViewModel" | |||||
Title="SimOrderConfitView" | Title="SimOrderConfitView" | ||||
Width="400" | Width="400" | ||||
Height="275" | Height="275" | ||||
@@ -15,6 +16,11 @@ | |||||
WindowStartupLocation="CenterScreen" | WindowStartupLocation="CenterScreen" | ||||
WindowStyle="None" | WindowStyle="None" | ||||
mc:Ignorable="d"> | mc:Ignorable="d"> | ||||
<Window.DataContext> | |||||
<vm:SimOrderConfitViewModel /> | |||||
</Window.DataContext> | |||||
<Window.Resources> | <Window.Resources> | ||||
<ResourceDictionary Source="../../Resources/ResourceDictionarys/BasicStyle.xaml"> | <ResourceDictionary Source="../../Resources/ResourceDictionarys/BasicStyle.xaml"> | ||||
<ResourceDictionary.MergedDictionaries> | <ResourceDictionary.MergedDictionaries> | ||||
@@ -104,7 +110,7 @@ | |||||
<!--#endregion--> | <!--#endregion--> | ||||
<!--#region 内容显示区--> | <!--#region 内容显示区--> | ||||
<Grid Grid.Row="1" Margin="20"> | |||||
<Grid Grid.Row="1" Margin="10"> | |||||
<Grid.RowDefinitions> | <Grid.RowDefinitions> | ||||
<RowDefinition /> | <RowDefinition /> | ||||
<RowDefinition /> | <RowDefinition /> | ||||
@@ -120,22 +126,20 @@ | |||||
HorizontalAlignment="Right" | HorizontalAlignment="Right" | ||||
VerticalAlignment="Center" | VerticalAlignment="Center" | ||||
FontFamily="楷体" | FontFamily="楷体" | ||||
FontSize="20" | |||||
FontSize="18" | |||||
Foreground="#FF34F7F7" | Foreground="#FF34F7F7" | ||||
Text="请选择设备类型:" /> | |||||
<ComboBox | |||||
Text="请输入模拟数据名称:" /> | |||||
<TextBox | |||||
Grid.Column="1" | Grid.Column="1" | ||||
Margin="0,10" | |||||
VerticalAlignment="Center" | VerticalAlignment="Center" | ||||
Background="Transparent" | |||||
BorderBrush="#FF23CACA" | BorderBrush="#FF23CACA" | ||||
BorderThickness="1" | |||||
CaretBrush="Aqua" | |||||
FontFamily="楷体" | FontFamily="楷体" | ||||
FontSize="20" | |||||
Foreground="#ff23caca" | |||||
IsEditable="False" | |||||
ItemsSource="{Binding DeviceType}" | |||||
SelectedIndex="0" | |||||
Style="{StaticResource ComboBoxStyle}" | |||||
Text="{Binding devcieManagerResult.DeviceType}" /> | |||||
FontSize="21" | |||||
Foreground="#ff34f7f7" | |||||
Text="{Binding Name}" /> | |||||
<TextBlock | <TextBlock | ||||
Grid.Row="1" | Grid.Row="1" | ||||
@@ -144,7 +148,7 @@ | |||||
FontFamily="楷体" | FontFamily="楷体" | ||||
FontSize="20" | FontSize="20" | ||||
Foreground="#FF34F7F7" | Foreground="#FF34F7F7" | ||||
Text="请输入设备名称:" /> | |||||
Text="模拟位置最小值:" /> | |||||
<TextBox | <TextBox | ||||
Grid.Row="1" | Grid.Row="1" | ||||
Grid.Column="1" | Grid.Column="1" | ||||
@@ -156,18 +160,29 @@ | |||||
FontFamily="楷体" | FontFamily="楷体" | ||||
FontSize="21" | FontSize="21" | ||||
Foreground="#ff34f7f7" | Foreground="#ff34f7f7" | ||||
Text="{Binding devcieManagerResult.DeviceName}" /> | |||||
Text="{Binding Min}" /> | |||||
<TextBlock | <TextBlock | ||||
Grid.Row="2" | Grid.Row="2" | ||||
Grid.ColumnSpan="2" | |||||
Margin="20,0,0,0" | |||||
HorizontalAlignment="Right" | |||||
VerticalAlignment="Center" | VerticalAlignment="Center" | ||||
FontFamily="楷体" | FontFamily="楷体" | ||||
FontSize="16" | |||||
Foreground="#FFE2415C" | |||||
Text="{Binding LogInfo}" | |||||
TextWrapping="Wrap" /> | |||||
FontSize="20" | |||||
Foreground="#FF34F7F7" | |||||
Text="模拟位置最大值:" /> | |||||
<TextBox | |||||
Grid.Row="2" | |||||
Grid.Column="1" | |||||
Margin="0,10" | |||||
VerticalAlignment="Center" | |||||
Background="Transparent" | |||||
BorderBrush="#FF23CACA" | |||||
CaretBrush="Aqua" | |||||
FontFamily="楷体" | |||||
FontSize="21" | |||||
Foreground="#ff34f7f7" | |||||
Text="{Binding Max}" /> | |||||
<Button | <Button | ||||
Grid.Row="3" | Grid.Row="3" | ||||
@@ -1,4 +1,5 @@ | |||||
using System; | |||||
using HBLConsole.Service; | |||||
using System; | |||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Linq; | using System.Linq; | ||||
using System.Text; | using System.Text; | ||||
@@ -22,6 +23,20 @@ namespace HBLConsole.DialogWindow.View | |||||
public SimOrderConfitView() | public SimOrderConfitView() | ||||
{ | { | ||||
InitializeComponent(); | InitializeComponent(); | ||||
this.MoveBorder.MouseLeftButtonDown += (o, e) => { this.DragMove(); }; | |||||
this.ButMin.Click += (o, e) => { this.WindowState = WindowState.Minimized; }; | |||||
this.ButMax.Click += (o, e) => { this.WindowState = this.WindowState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized; }; | |||||
this.ButClose.Click += (o, e) => { this.DialogResult = false; }; | |||||
this.MaxWidth = SystemParameters.WorkArea.Width; | |||||
this.MaxHeight = SystemParameters.WorkArea.Height; | |||||
ActionOperate.GetInstance.Register(new Action(() => | |||||
{ | |||||
this.DialogResult = true; | |||||
this.Close(); | |||||
ActionOperate.GetInstance.CancelRegister("SimOrderConfitViewModelExit"); | |||||
}), "SimOrderConfitViewModelExit"); | |||||
} | } | ||||
} | } | ||||
} | } |
@@ -1,12 +1,51 @@ | |||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Collections.ObjectModel; | |||||
using System.Linq; | using System.Linq; | ||||
using System.Text; | using System.Text; | ||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
using HBLConsole.Model; | |||||
using HBLConsole.Service; | |||||
using HBLConsole.ViewModel; | |||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
namespace HBLConsole.DialogWindow.ViewModel | namespace HBLConsole.DialogWindow.ViewModel | ||||
{ | { | ||||
public class SimOrderConfitViewModel | |||||
public class SimOrderConfitViewModel : ViewModelBase | |||||
{ | { | ||||
public SimOrderConfitViewModel() | |||||
{ | |||||
ConfirmCommand = new RelayCommand(() => | |||||
{ | |||||
Json<KeepDataBase>.Data.simOrderConfig.Add(new SimOrderVisibleData() | |||||
{ | |||||
ClientDeviceType = GVL.GeneralConfig.DeviceType.ToString(), | |||||
IsEnable = true, | |||||
IsSelected = true, | |||||
Text = Name, | |||||
Loc = Min, | |||||
MaxValue = Max, | |||||
MinValue = Min, | |||||
}); | |||||
ActionOperate.GetInstance.Send("SimOrderConfitViewModelExit"); | |||||
}); | |||||
CancelCommand = new RelayCommand(() => { ActionOperate.GetInstance.Send("SimOrderConfitViewModelExit"); }); | |||||
} | |||||
public RelayCommand ConfirmCommand { get; set; } | |||||
public RelayCommand CancelCommand { get; set; } | |||||
public string Name { get { return _mName; } set { _mName = value; OnPropertyChanged(); } } | |||||
private string _mName; | |||||
public ushort Min { get { return _mMin; } set { _mMin = value; OnPropertyChanged(); } } | |||||
private ushort _mMin; | |||||
public ushort Max { get { return _mMax; } set { _mMax = value; OnPropertyChanged(); } } | |||||
private ushort _mMax; | |||||
} | } | ||||
} | } |
@@ -1,19 +1,21 @@ | |||||
<UserControl x:Class="HBLConsole.View.DebugContainer" | |||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||||
xmlns:local="clr-namespace:HBLConsole.View" | |||||
mc:Ignorable="d" | |||||
xmlns:vm="clr-namespace:HBLConsole.ViewModel" | |||||
d:DesignHeight="450" d:DesignWidth="800"> | |||||
<UserControl | |||||
x:Class="HBLConsole.View.DebugContainer" | |||||
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:HBLConsole.View" | |||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||||
xmlns:vm="clr-namespace:HBLConsole.ViewModel" | |||||
d:DesignHeight="450" | |||||
d:DesignWidth="800" | |||||
mc:Ignorable="d"> | |||||
<UserControl.DataContext> | <UserControl.DataContext> | ||||
<vm:DebugContainerViewModel /> | <vm:DebugContainerViewModel /> | ||||
</UserControl.DataContext> | </UserControl.DataContext> | ||||
<Grid> | <Grid> | ||||
<ContentControl | <ContentControl | ||||
Grid.Row="1" | |||||
Margin="15" | |||||
Content="{Binding DebugContent}" /> | |||||
Grid.Row="1" | |||||
Margin="15" | |||||
Content="{Binding DebugContent}" /> | |||||
</Grid> | </Grid> | ||||
</UserControl> | </UserControl> |
@@ -22,7 +22,6 @@ | |||||
<ResourceDictionary Source="../Resources/ResourceDictionarys/BasicStyle.xaml"> | <ResourceDictionary Source="../Resources/ResourceDictionarys/BasicStyle.xaml"> | ||||
<Style x:Key="TextBoxStyle" TargetType="TextBox"> | <Style x:Key="TextBoxStyle" TargetType="TextBox"> | ||||
<Setter Property="Width" Value="60" /> | |||||
<Setter Property="FontFamily" Value="楷体" /> | <Setter Property="FontFamily" Value="楷体" /> | ||||
<Setter Property="FontSize" Value="22" /> | <Setter Property="FontSize" Value="22" /> | ||||
<Setter Property="Background" Value="Transparent" /> | <Setter Property="Background" Value="Transparent" /> | ||||
@@ -36,7 +35,7 @@ | |||||
<Style x:Key="ButtonStyle" TargetType="Button"> | <Style x:Key="ButtonStyle" TargetType="Button"> | ||||
<Setter Property="Foreground" Value="#00c2f4" /> | <Setter Property="Foreground" Value="#00c2f4" /> | ||||
<Setter Property="FontSize" Value="18" /> | <Setter Property="FontSize" Value="18" /> | ||||
<Setter Property="Width" Value="100" /> | |||||
<Setter Property="Margin" Value="10 0"/> | |||||
<Setter Property="Template"> | <Setter Property="Template"> | ||||
<Setter.Value> | <Setter.Value> | ||||
<ControlTemplate TargetType="Button"> | <ControlTemplate TargetType="Button"> | ||||
@@ -153,112 +152,133 @@ | |||||
</UserControl.Resources> | </UserControl.Resources> | ||||
<Grid> | <Grid> | ||||
<Grid.RowDefinitions> | |||||
<RowDefinition Height="40" /> | |||||
<RowDefinition Height="10" /> | |||||
<RowDefinition Height="40" /> | |||||
<RowDefinition Height="40" /> | |||||
<RowDefinition /> | |||||
</Grid.RowDefinitions> | |||||
<StackPanel Orientation="Horizontal"> | |||||
<ListBox | |||||
x:Name="lstEnt" | |||||
Margin="0,3,0,0" | |||||
Background="{x:Null}" | |||||
BorderBrush="{x:Null}" | |||||
BorderThickness="0" | |||||
ItemContainerStyle="{StaticResource ResourceKey=ListBoxItemStyle1}" | |||||
ItemsSource="{Binding simOrderVisibleDatas}"> | |||||
<ListBox.ItemsPanel> | |||||
<ItemsPanelTemplate> | |||||
<StackPanel Orientation="Horizontal" /> | |||||
</ItemsPanelTemplate> | |||||
</ListBox.ItemsPanel> | |||||
<ListBox.ItemTemplate> | |||||
<DataTemplate> | |||||
<StackPanel Orientation="Horizontal"> | |||||
<TextBlock | |||||
Margin="10,0,0,0" | |||||
VerticalAlignment="Center" | |||||
FontSize="16" | |||||
Foreground="#00c2f4" | |||||
Text="{Binding Text}" /> | |||||
<TextBox | |||||
Margin="0,0,10,0" | |||||
IsEnabled="{Binding IsEnable}" | |||||
Style="{StaticResource TextBoxStyle}" | |||||
Text="{Binding Loc}" /> | |||||
<CheckBox | |||||
Height="20" | |||||
Margin="0,0,30,0" | |||||
VerticalAlignment="Center" | |||||
Background="#FF2AB2E7" | |||||
Content="启用随机数" | |||||
FontSize="16" | |||||
Foreground="#00c2f4" | |||||
IsChecked="{Binding IsSelected}" | |||||
Template="{StaticResource CbTemplate}" /> | |||||
</StackPanel> | |||||
</DataTemplate> | |||||
</ListBox.ItemTemplate> | |||||
</ListBox> | |||||
<!--#region 控制按钮--> | |||||
<Button | |||||
Margin="10,0,10,0" | |||||
Command="{Binding SimOrderCommand}" | |||||
Content="模拟订单" | |||||
Style="{StaticResource ButtonStyle}" /> | |||||
<Button Margin="0,0,10,0" x:Name="button_loop" | |||||
Command="{Binding LoopSimOrderCommand}" | |||||
CommandParameter="{Binding ElementName=button_loop,Path=Content}" | |||||
Content="{Binding LoopButton,Mode=TwoWay,NotifyOnTargetUpdated=True}" | |||||
Foreground="{Binding LoopColor, Mode=TwoWay, NotifyOnTargetUpdated=True}" | |||||
Style="{StaticResource ButtonStyle}" /> | |||||
<Button | |||||
Margin="0,0,10,0" | |||||
Command="{Binding InitCommand}" | |||||
Content="初始化" | |||||
Style="{StaticResource ButtonStyle}" /> | |||||
<Button | |||||
Command="{Binding InitCommand}" | |||||
Content="停止" | |||||
Style="{StaticResource ButtonStyle}" /> | |||||
<!--#endregion--> | |||||
</StackPanel> | |||||
<StackPanel Grid.Row="2" Orientation="Horizontal"> | |||||
<TextBlock | |||||
Margin="10,0,0,0" | |||||
HorizontalAlignment="Center" | |||||
VerticalAlignment="Center" | |||||
FontSize="16" | |||||
Foreground="Red" | |||||
Text="注意:【取面位置范围是:1 -- 5】, 【取浇头位置范围是:6 -- 10】, 【取碗位置范围是:11 -- 12】" /> | |||||
</StackPanel> | |||||
<StackPanel Grid.Row="3" Orientation="Horizontal"> | |||||
<Button | |||||
Margin="10,0,10,0" | |||||
Width="200" | |||||
Command="{Binding bql}" | |||||
Content="冰淇淋模拟" | |||||
Style="{StaticResource ButtonStyle}" /> | |||||
<Button | |||||
Margin="10,0,10,0" | |||||
Width="200" | |||||
Command="{Binding cfj}" | |||||
Content="咖啡机模拟" | |||||
Style="{StaticResource ButtonStyle}" /> | |||||
</StackPanel> | |||||
<Grid.ColumnDefinitions> | |||||
<ColumnDefinition Width="400" /> | |||||
<ColumnDefinition /> | |||||
</Grid.ColumnDefinitions> | |||||
<Grid Grid.Column="0"> | |||||
<Grid.RowDefinitions> | |||||
<RowDefinition /> | |||||
<RowDefinition Height="40" /> | |||||
</Grid.RowDefinitions> | |||||
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"> | |||||
<ItemsControl ItemsSource="{Binding simOrderConfig}"> | |||||
<ItemsControl.ItemTemplate> | |||||
<DataTemplate> | |||||
<Grid Margin="0 10"> | |||||
<Grid.ColumnDefinitions> | |||||
<ColumnDefinition /> | |||||
<ColumnDefinition /> | |||||
<ColumnDefinition Width="150"/> | |||||
</Grid.ColumnDefinitions> | |||||
<TextBlock | |||||
HorizontalAlignment="Right" | |||||
VerticalAlignment="Center" | |||||
FontSize="16" | |||||
Foreground="#00c2f4" | |||||
Text="{Binding Text}" /> | |||||
<TextBox | |||||
Grid.Column="1" | |||||
Margin="10 0" | |||||
IsEnabled="{Binding IsEnable}" | |||||
Style="{StaticResource TextBoxStyle}" | |||||
Text="{Binding Loc}" /> | |||||
<CheckBox | |||||
Grid.Column="2" | |||||
Height="20" | |||||
VerticalAlignment="Center" | |||||
Background="#FF2AB2E7" | |||||
Content="启用随机数" | |||||
FontSize="16" | |||||
Foreground="#00c2f4" | |||||
IsChecked="{Binding IsSelected}" | |||||
Template="{StaticResource CbTemplate}" /> | |||||
</Grid> | |||||
</DataTemplate> | |||||
</ItemsControl.ItemTemplate> | |||||
</ItemsControl> | |||||
</ScrollViewer> | |||||
<UniformGrid Columns="2" Grid.Row="1"> | |||||
<Button | |||||
Grid.Column="1" | |||||
Command="{Binding bql}" | |||||
Content="模拟订单" | |||||
Style="{StaticResource ButtonStyle}" /> | |||||
<Button | |||||
Command="{Binding AddSimDataCommand}" | |||||
Content="新增模拟数据" | |||||
Style="{StaticResource ButtonStyle}" /> | |||||
</UniformGrid> | |||||
</Grid> | |||||
<Grid Grid.Column="1"> | |||||
<Grid.RowDefinitions> | |||||
<RowDefinition Height="40" /> | |||||
<RowDefinition Height="10" /> | |||||
<RowDefinition Height="40" /> | |||||
<RowDefinition Height="40" /> | |||||
<RowDefinition /> | |||||
</Grid.RowDefinitions> | |||||
<StackPanel Orientation="Horizontal"> | |||||
<!--#region 控制按钮--> | |||||
<Button | |||||
x:Name="button_loop" | |||||
Margin="0,0,10,0" | |||||
Command="{Binding LoopSimOrderCommand}" | |||||
CommandParameter="{Binding ElementName=button_loop, Path=Content}" | |||||
Content="{Binding LoopButton, Mode=TwoWay, NotifyOnTargetUpdated=True}" | |||||
Foreground="{Binding LoopColor, Mode=TwoWay, NotifyOnTargetUpdated=True}" | |||||
Style="{StaticResource ButtonStyle}" /> | |||||
<Button | |||||
Margin="0,0,10,0" | |||||
Command="{Binding InitCommand}" | |||||
Content="初始化" | |||||
Style="{StaticResource ButtonStyle}" /> | |||||
<Button | |||||
Command="{Binding InitCommand}" | |||||
Content="停止" | |||||
Style="{StaticResource ButtonStyle}" /> | |||||
<!--#endregion--> | |||||
</StackPanel> | |||||
<StackPanel Grid.Row="3" Orientation="Horizontal"> | |||||
<Button | |||||
Width="200" | |||||
Margin="10,0,10,0" | |||||
Command="{Binding bql}" | |||||
Content="冰淇淋模拟" | |||||
Style="{StaticResource ButtonStyle}" /> | |||||
<Button | |||||
Width="200" | |||||
Margin="10,0,10,0" | |||||
Command="{Binding cfj}" | |||||
Content="咖啡机模拟" | |||||
Style="{StaticResource ButtonStyle}" /> | |||||
</StackPanel> | |||||
</Grid> | |||||
@@ -13,7 +13,7 @@ | |||||
Height="850" | Height="850" | ||||
AllowsTransparency="True" | AllowsTransparency="True" | ||||
Background="{x:Null}" | Background="{x:Null}" | ||||
Topmost="False" | |||||
Topmost="True" | |||||
WindowStartupLocation="CenterScreen" | WindowStartupLocation="CenterScreen" | ||||
WindowStyle="None" | WindowStyle="None" | ||||
mc:Ignorable="d"> | mc:Ignorable="d"> | ||||
@@ -15,6 +15,7 @@ using System.Collections.Concurrent; | |||||
using HBLConsole.Attributes; | using HBLConsole.Attributes; | ||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
using System.Windows.Media; | using System.Windows.Media; | ||||
using HBLConsole.DialogWindow.View; | |||||
namespace HBLConsole.ViewModel | namespace HBLConsole.ViewModel | ||||
{ | { | ||||
@@ -23,26 +24,44 @@ namespace HBLConsole.ViewModel | |||||
public DebugViewModel() | public DebugViewModel() | ||||
{ | { | ||||
WindowName = "调试模式"; | WindowName = "调试模式"; | ||||
bql = new RelayCommand(() => { ActionOperate.GetInstance.Send("bql"); }); | |||||
cfj = new RelayCommand(() => { ActionOperate.GetInstance.Send("cfj"); }); | |||||
AddSimDataCommand = new RelayCommand(() => | |||||
{ | |||||
SimOrderConfitView simOrderConfitView = new SimOrderConfitView(); | |||||
simOrderConfitView.ShowDialog(); | |||||
}); | |||||
bql = new RelayCommand(() => { ActionOperate.GetInstance.Send("bql"); }); | |||||
cfj = new RelayCommand(() => { ActionOperate.GetInstance.Send("cfj"); }); | |||||
SimOrderCommand = new RelayCommand(() => | SimOrderCommand = new RelayCommand(() => | ||||
{ | { | ||||
if (simOrderVisibleDatas.ElementAt(0).IsSelected) | |||||
simOrderVisibleDatas.ElementAt(0).Loc = (ushort)(new Random().Next(1, 6)); | |||||
List<ushort> locs = new List<ushort>(); | |||||
foreach (var item in simOrderConfig) | |||||
{ | |||||
if (item.IsSelected) | |||||
locs.Add((ushort)(new Random().Next(item.MinValue, item.MaxValue + 1))); | |||||
else | |||||
locs.Add(item.Loc); | |||||
} | |||||
if (simOrderVisibleDatas.ElementAt(1).IsSelected) | |||||
simOrderVisibleDatas.ElementAt(1).Loc = (ushort)(new Random().Next(6, 11)); | |||||
ActionOperate.GetInstance.Send("SimOrder", locs); | |||||
if (simOrderVisibleDatas.ElementAt(2).IsSelected) | |||||
simOrderVisibleDatas.ElementAt(2).Loc = (ushort)(new Random().Next(11, 12)); | |||||
//if (simOrderVisibleDatas.ElementAt(0).IsSelected) | |||||
// simOrderVisibleDatas.ElementAt(0).Loc = (ushort)(new Random().Next(1, 6)); | |||||
ActionOperate.GetInstance.Send("SimOrder", new SimOrderData() | |||||
{ | |||||
NoodleLoc = simOrderVisibleDatas.ElementAt(0).Loc, | |||||
SoupLoc = simOrderVisibleDatas.ElementAt(1).Loc, | |||||
BowlLoc = simOrderVisibleDatas.ElementAt(2).Loc, | |||||
}); | |||||
//if (simOrderVisibleDatas.ElementAt(1).IsSelected) | |||||
// simOrderVisibleDatas.ElementAt(1).Loc = (ushort)(new Random().Next(6, 11)); | |||||
//if (simOrderVisibleDatas.ElementAt(2).IsSelected) | |||||
// simOrderVisibleDatas.ElementAt(2).Loc = (ushort)(new Random().Next(11, 12)); | |||||
//ActionOperate.GetInstance.Send("SimOrder", new SimOrderData() | |||||
//{ | |||||
// NoodleLoc = simOrderVisibleDatas.ElementAt(0).Loc, | |||||
// SoupLoc = simOrderVisibleDatas.ElementAt(1).Loc, | |||||
// BowlLoc = simOrderVisibleDatas.ElementAt(2).Loc, | |||||
//}); | |||||
}); | }); | ||||
InitCommand = new RelayCommand(() => | InitCommand = new RelayCommand(() => | ||||
@@ -87,13 +106,17 @@ namespace HBLConsole.ViewModel | |||||
//}), "循环订单"); | //}), "循环订单"); | ||||
} | } | ||||
static DebugViewModel() | |||||
{ | |||||
simOrderVisibleDatas.Add(new SimOrderVisibleData() { Text = "取面位置:", IsEnable = false, IsSelected = true, Loc = 1 }); | |||||
simOrderVisibleDatas.Add(new SimOrderVisibleData() { Text = "取浇头位置:", IsEnable = false, IsSelected = true, Loc = 6 }); | |||||
simOrderVisibleDatas.Add(new SimOrderVisibleData() { Text = "取碗位置:", IsEnable = false, IsSelected = true, Loc = 11 }); | |||||
} | |||||
//static DebugViewModel() | |||||
//{ | |||||
// simOrderVisibleDatas.Add(new SimOrderVisibleData() { Text = "取面位置:", IsEnable = false, IsSelected = true, Loc = 1 }); | |||||
// simOrderVisibleDatas.Add(new SimOrderVisibleData() { Text = "取浇头位置:", IsEnable = false, IsSelected = true, Loc = 6 }); | |||||
// simOrderVisibleDatas.Add(new SimOrderVisibleData() { Text = "取碗位置:", IsEnable = false, IsSelected = true, Loc = 11 }); | |||||
//} | |||||
public ObservableCollection<SimOrderVisibleData> simOrderConfig { get; set; } = Json<KeepDataBase>.Data.simOrderConfig; | |||||
public static event EventHandler<PropertyChangedEventArgs> StaticPropertyChanged; | public static event EventHandler<PropertyChangedEventArgs> StaticPropertyChanged; | ||||
private static void OnStaticPropertyChanged([CallerMemberName] string PropName = "") | private static void OnStaticPropertyChanged([CallerMemberName] string PropName = "") | ||||
@@ -101,6 +124,8 @@ namespace HBLConsole.ViewModel | |||||
StaticPropertyChanged?.Invoke(null, new PropertyChangedEventArgs(PropName)); | StaticPropertyChanged?.Invoke(null, new PropertyChangedEventArgs(PropName)); | ||||
} | } | ||||
public RelayCommand AddSimDataCommand { get; set; } | |||||
public RelayCommand SimOrderCommand { get; set; } | public RelayCommand SimOrderCommand { get; set; } | ||||
public RelayCommand InitCommand { get; set; } | public RelayCommand InitCommand { get; set; } | ||||
@@ -111,7 +136,7 @@ namespace HBLConsole.ViewModel | |||||
public RelayCommand cfj { get; set; } | public RelayCommand cfj { get; set; } | ||||
public static ObservableCollection<SimOrderVisibleData> simOrderVisibleDatas { get; set; } = new ObservableCollection<SimOrderVisibleData>(); | |||||
//public static ObservableCollection<SimOrderVisibleData> simOrderVisibleDatas { get; set; } = new ObservableCollection<SimOrderVisibleData>(); | |||||
public static bool IsLoop = false; | public static bool IsLoop = false; | ||||
public static bool IsLoopzc = false; | public static bool IsLoopzc = false; | ||||
@@ -10,7 +10,7 @@ | |||||
<ItemGroup> | <ItemGroup> | ||||
<Reference Include="BPA.Utility"> | <Reference Include="BPA.Utility"> | ||||
<HintPath>..\..\..\..\..\..\BPACommon_output\net5.0\BPA.Utility.dll</HintPath> | |||||
<HintPath>D:\BPACommon_output\net5.0\BPA.Utility.dll</HintPath> | |||||
</Reference> | </Reference> | ||||
</ItemGroup> | </ItemGroup> | ||||
@@ -10,7 +10,7 @@ | |||||
<ItemGroup> | <ItemGroup> | ||||
<Reference Include="BPA.Utility"> | <Reference Include="BPA.Utility"> | ||||
<HintPath>..\..\..\..\..\..\BPACommon_output\net5.0\BPA.Utility.dll</HintPath> | |||||
<HintPath>D:\BPACommon_output\net5.0\BPA.Utility.dll</HintPath> | |||||
</Reference> | </Reference> | ||||
</ItemGroup> | </ItemGroup> | ||||