@@ -17,16 +17,9 @@ | |||||
<ProjectReference Include="..\BPASmartClient.Model\BPASmartClient.Model.csproj" /> | <ProjectReference Include="..\BPASmartClient.Model\BPASmartClient.Model.csproj" /> | ||||
</ItemGroup> | </ItemGroup> | ||||
<ItemGroup> | |||||
<Compile Update="View\DebugView.xaml.cs"> | |||||
<SubType>Code</SubType> | |||||
</Compile> | |||||
</ItemGroup> | |||||
<ItemGroup> | <ItemGroup> | ||||
<Page Update="View\DebugView.xaml"> | <Page Update="View\DebugView.xaml"> | ||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | <XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | ||||
<SubType>Designer</SubType> | |||||
</Page> | </Page> | ||||
</ItemGroup> | </ItemGroup> | ||||
@@ -34,7 +34,6 @@ namespace BPASmartClient.MorkT | |||||
DateTime morkTime = DateTime.Now; | DateTime morkTime = DateTime.Now; | ||||
public override void DoMain() | public override void DoMain() | ||||
{ | { | ||||
if (Json<KeepDataBase>.Data.IsVerify) | if (Json<KeepDataBase>.Data.IsVerify) | ||||
@@ -52,7 +51,6 @@ namespace BPASmartClient.MorkT | |||||
int i = 0; | int i = 0; | ||||
EventBus.EventBus.GetInstance().Publish(new GSIceCream_ModeSetEvent { DeviceId = DeviceId, Mode = MORKI_MODE.制冷模式 }); | EventBus.EventBus.GetInstance().Publish(new GSIceCream_ModeSetEvent { DeviceId = DeviceId, Mode = MORKI_MODE.制冷模式 }); | ||||
PreventSleep.SleepControl(true);//防止电脑休眠 | PreventSleep.SleepControl(true);//防止电脑休眠 | ||||
MessageLog.GetInstance.Show("MORKT 设备初始化完成"); | MessageLog.GetInstance.Show("MORKT 设备初始化完成"); | ||||
} | } | ||||
@@ -62,7 +60,6 @@ namespace BPASmartClient.MorkT | |||||
morkT = new GLV_MorkT(); | morkT = new GLV_MorkT(); | ||||
} | } | ||||
private void GetStatus(string key, Action<object> action) | private void GetStatus(string key, Action<object> action) | ||||
{ | { | ||||
if (peripheralStatus.ContainsKey(key)) | if (peripheralStatus.ContainsKey(key)) | ||||
@@ -88,39 +85,38 @@ namespace BPASmartClient.MorkT | |||||
// EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | // EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | ||||
// Thread.Sleep(50); | // Thread.Sleep(50); | ||||
// } | // } | ||||
//} | //} | ||||
//else if (morkTime.AddMinutes(Global.TimeInterval) < DateTime.Now) morkTime = DateTime.Now; | //else if (morkTime.AddMinutes(Global.TimeInterval) < DateTime.Now) morkTime = DateTime.Now; | ||||
#region morkt流程 | #region morkt流程 | ||||
//if (morkT.waitMorkOrder != null)//更新订单取走状态 | |||||
//{ | |||||
// EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetInputEvent() { DeviceId = DeviceId, Pin = 0 }, (o) => | |||||
// { | |||||
// if (o != null && o.Length > 0 && o[0] is bool res) | |||||
// { | |||||
// if (!res) | |||||
// { | |||||
// OrderChange(morkT.waitMorkOrder.SuborderId, ORDER_STATUS.COMPLETED_TAKE); | |||||
// DeviceProcessLogShow("订单取餐完成"); | |||||
// morkT.waitMorkOrder = null; | |||||
// } | |||||
// } | |||||
// }); | |||||
//} | |||||
//MakeCoffeeProcess(); | |||||
//EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetInputEvent { DeviceId = DeviceId, Pin = 0 }, (o) => | |||||
// { | |||||
// if (o != null && o.Length > 0 && o[0] is bool resultValue) | |||||
// { | |||||
// if (!resultValue)//取餐口有空余位置 | |||||
// { | |||||
// MakeIceCreamProcess(); | |||||
// MakeCoffeeComplete(); | |||||
// } | |||||
// } | |||||
// }); | |||||
#endregion | |||||
if (morkT.waitMorkOrder != null)//更新订单取走状态 | |||||
{ | |||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetInputEvent() { DeviceId = DeviceId, Pin = 0 }, (o) => | |||||
{ | |||||
if (o != null && o.Length > 0 && o[0] is bool res) | |||||
{ | |||||
if (!res) | |||||
{ | |||||
OrderChange(morkT.waitMorkOrder.SuborderId, ORDER_STATUS.COMPLETED_TAKE); | |||||
DeviceProcessLogShow("订单取餐完成"); | |||||
morkT.waitMorkOrder = null; | |||||
} | |||||
} | |||||
}); | |||||
} | |||||
MakeCoffeeProcess(); | |||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetInputEvent { DeviceId = DeviceId, Pin = 0 }, (o) => | |||||
{ | |||||
if (o != null && o.Length > 0 && o[0] is bool resultValue) | |||||
{ | |||||
if (!resultValue)//取餐口有空余位置 | |||||
{ | |||||
//MakeIceCreamProcess(); | |||||
MakeCoffeeComplete(); | |||||
} | |||||
} | |||||
}); | |||||
#endregion | |||||
} | } | ||||
public override void ReadData() | public override void ReadData() | ||||
@@ -577,7 +573,6 @@ namespace BPASmartClient.MorkT | |||||
} | } | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 做冰淇淋 | /// 做冰淇淋 | ||||
/// </summary> | /// </summary> | ||||
@@ -3,7 +3,7 @@ | |||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||||
xmlns:vm ="clr-namespace:BPASmartClient.MorkT.ViewModel" | |||||
xmlns:vm="clr-namespace:BPASmartClient.MorkT.ViewModel" | |||||
mc:Ignorable="d" | mc:Ignorable="d" | ||||
Name="调试界面" | Name="调试界面" | ||||
d:DesignHeight="500" d:DesignWidth="1000" Unloaded="Dubug_Unloaded"> | d:DesignHeight="500" d:DesignWidth="1000" Unloaded="Dubug_Unloaded"> | ||||
@@ -24,12 +24,12 @@ | |||||
<ColumnDefinition Width="10*"/> | <ColumnDefinition Width="10*"/> | ||||
</Grid.ColumnDefinitions> | </Grid.ColumnDefinitions> | ||||
<Grid.RowDefinitions> | <Grid.RowDefinitions> | ||||
<RowDefinition Height="384*"/> | |||||
<RowDefinition Height="111*"/> | |||||
<RowDefinition Height="5*"/> | |||||
<RowDefinition Height="10*"/> | |||||
<RowDefinition Height="10*"/> | |||||
<RowDefinition Height="20*"/> | |||||
</Grid.RowDefinitions> | </Grid.RowDefinitions> | ||||
<GroupBox Grid.ColumnSpan="2" Visibility="Collapsed" | |||||
<GroupBox Grid.ColumnSpan="2" | |||||
FontFamily="楷体" | FontFamily="楷体" | ||||
FontSize="20" | FontSize="20" | ||||
Header=" 乐白机器人 "> | Header=" 乐白机器人 "> | ||||
@@ -46,17 +46,12 @@ | |||||
<TextBlock Text="机器人模式:"/> | <TextBlock Text="机器人模式:"/> | ||||
<TextBlock Text="{Binding RobotMode}" | <TextBlock Text="{Binding RobotMode}" | ||||
Margin="40,0"/> | Margin="40,0"/> | ||||
<TextBlock Text="机器人自嗨时间间隔:"/> | |||||
<TextBox Text="{Binding TimeInterval}" Width="40" Margin="10,0,5,0"/> | |||||
<TextBlock Text="分"/> | |||||
</StackPanel> | </StackPanel> | ||||
<TextBlock Text="连接状态" /> | <TextBlock Text="连接状态" /> | ||||
<TextBlock Text="{Binding RobotConnected}" | <TextBlock Text="{Binding RobotConnected}" | ||||
Margin="120,0,0,0"/> | Margin="120,0,0,0"/> | ||||
<TextBlock Text="乐白机器人控制" | |||||
Grid.Row="1" | |||||
VerticalAlignment="Center" HorizontalAlignment="Center"/> | |||||
<ListBox Grid.Row="2" Background="Transparent"> | |||||
<ListBox Grid.Row="2" Background="Transparent" Margin="0,0,0,-9"> | |||||
<ListBox.Template> | <ListBox.Template> | ||||
<ControlTemplate TargetType="{x:Type ListBox}"> | <ControlTemplate TargetType="{x:Type ListBox}"> | ||||
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto"> | <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto"> | ||||
@@ -65,167 +60,128 @@ | |||||
</ControlTemplate> | </ControlTemplate> | ||||
</ListBox.Template> | </ListBox.Template> | ||||
<Button Content="机器人启动" | <Button Content="机器人启动" | ||||
Margin="20,5" Width="150" Height="60" | |||||
Margin="20,5" Width="80" Height="40" | |||||
Command="{Binding Button_RobotControlCommand}" | Command="{Binding Button_RobotControlCommand}" | ||||
CommandParameter="机器人启动" Cursor="Hand"> | |||||
CommandParameter="机器人启动"> | |||||
</Button> | </Button> | ||||
<Button Content="启动示教" | <Button Content="启动示教" | ||||
Margin="20,5" Width="150" Height="60" | |||||
Margin="20,5" Width="80" Height="40" | |||||
Command="{Binding Button_RobotControlCommand}" | Command="{Binding Button_RobotControlCommand}" | ||||
CommandParameter="启动示教"/> | CommandParameter="启动示教"/> | ||||
<Button Content="停止示教" | <Button Content="停止示教" | ||||
Margin="20,5" Width="150" Height="60" | |||||
Margin="20,5" Width="80" Height="40" | |||||
Command="{Binding Button_RobotControlCommand}" | Command="{Binding Button_RobotControlCommand}" | ||||
CommandParameter="停止示教"/> | CommandParameter="停止示教"/> | ||||
<Button Content="机器人急停" | <Button Content="机器人急停" | ||||
Margin="20,5" Width="110" Height="60" | |||||
Margin="20,5" Width="80" Height="40" | |||||
Command="{Binding Button_RobotControlCommand}" | Command="{Binding Button_RobotControlCommand}" | ||||
CommandParameter="机器人急停"/> | CommandParameter="机器人急停"/> | ||||
<!--<Button Content="机器人回原点" | |||||
Margin="20,5" Width="110" Height="60" | |||||
Command="{Binding Button_GoToHomeCommand}" | |||||
CommandParameter="机器人急停">--> | |||||
<!--</Button>--> | |||||
<Button Content="暂停" | |||||
Margin="10,5" Width="40" Height="40" | |||||
Command="{Binding Button_RobotControlCommand}" | |||||
CommandParameter="暂停"/> | |||||
<Button Content="恢复" | |||||
Margin="10,5" Width="40" Height="40" | |||||
Command="{Binding Button_RobotControlCommand}" | |||||
CommandParameter="恢复"/> | |||||
</ListBox> | </ListBox> | ||||
<Grid Margin="629,-24,19,0" Grid.RowSpan="3"> | |||||
<Grid.RowDefinitions> | |||||
<RowDefinition></RowDefinition> | |||||
<RowDefinition></RowDefinition> | |||||
</Grid.RowDefinitions> | |||||
<Grid Grid.Row="0"> | |||||
<TextBlock>DI</TextBlock> | |||||
<CheckBox Margin="50,0,0,0" IsEnabled="false" Name="Robot_DI0">DI0</CheckBox> | |||||
<CheckBox Margin="120,0,0,0" IsEnabled="false" Name="Robot_DI1">DI1</CheckBox> | |||||
<CheckBox Margin="190,0,0,0" IsEnabled="false" Name="Robot_DI2">DI2</CheckBox> | |||||
<CheckBox Margin="260,0,0,0" IsEnabled="false" Name="Robot_DI3">DI3</CheckBox> | |||||
</Grid> | |||||
<Grid Grid.Row="1"> | |||||
<TextBlock Width="50">DO</TextBlock> | |||||
<ComboBox Width="70" Margin="50,12,268,10" SelectedIndex="{Binding Lebai_DO_CH}"> | |||||
<ComboBoxItem IsSelected="true">DO0</ComboBoxItem> | |||||
<ComboBoxItem>DO1</ComboBoxItem> | |||||
<ComboBoxItem>DO2</ComboBoxItem> | |||||
<ComboBoxItem>DO3</ComboBoxItem> | |||||
</ComboBox> | |||||
<ComboBox Margin="142,12,108,10" Width="70" SelectedIndex="{Binding Lebai_DO_Value}"> | |||||
<ComboBoxItem IsSelected="true">true</ComboBoxItem> | |||||
<ComboBoxItem>false</ComboBoxItem> | |||||
</ComboBox> | |||||
<Button Width="50" Margin="260,12,10,10" Command="{Binding Button_LebaiDOuputCommand}" >输出</Button> | |||||
</Grid> | |||||
</Grid> | |||||
</Grid> | </Grid> | ||||
</GroupBox> | </GroupBox> | ||||
<GroupBox Grid.Row="0" | |||||
<GroupBox Grid.Row="2" | |||||
FontFamily="楷体" | FontFamily="楷体" | ||||
FontSize="20" | FontSize="20" | ||||
Header=" 冰淇淋机器 "> | |||||
Header=" 果汁机 "> | |||||
<Grid> | <Grid> | ||||
<Grid.RowDefinitions> | <Grid.RowDefinitions> | ||||
<RowDefinition Height="30"/> | |||||
<RowDefinition Height="10*" /> | |||||
<RowDefinition Height="10*"/> | |||||
<RowDefinition Height="3*"/> | |||||
<RowDefinition Height="3*"/> | |||||
<RowDefinition Height="3*"/> | |||||
</Grid.RowDefinitions> | </Grid.RowDefinitions> | ||||
<TextBlock Text="连接状态" /> | <TextBlock Text="连接状态" /> | ||||
<TextBlock Text="{Binding IceCreamConnected}" | |||||
<TextBlock Text="{Binding JuicerConnected}" | |||||
Margin="120,0,0,0"/> | Margin="120,0,0,0"/> | ||||
<Grid Grid.Row="1"> | <Grid Grid.Row="1"> | ||||
<Grid.RowDefinitions> | <Grid.RowDefinitions> | ||||
<RowDefinition /> | |||||
<RowDefinition /> | |||||
<RowDefinition /> | |||||
<RowDefinition /> | |||||
<RowDefinition></RowDefinition> | |||||
</Grid.RowDefinitions> | </Grid.RowDefinitions> | ||||
<Grid.ColumnDefinitions> | <Grid.ColumnDefinitions> | ||||
<ColumnDefinition Width="100" /> | |||||
<ColumnDefinition Width="80" /> | |||||
<ColumnDefinition Width="120" /> | |||||
<ColumnDefinition Width="100" /> | |||||
<ColumnDefinition Width="120"/> | |||||
<ColumnDefinition></ColumnDefinition> | |||||
</Grid.ColumnDefinitions> | </Grid.ColumnDefinitions> | ||||
<TextBlock Text="设备状态" /> | |||||
<Grid Grid.Column="1"> | |||||
<Grid.RowDefinitions> | |||||
<RowDefinition></RowDefinition> | |||||
</Grid.RowDefinitions> | |||||
<Grid.ColumnDefinitions> | |||||
<ColumnDefinition></ColumnDefinition> | |||||
<ColumnDefinition></ColumnDefinition> | |||||
<ColumnDefinition></ColumnDefinition> | |||||
<ColumnDefinition></ColumnDefinition> | |||||
<ColumnDefinition></ColumnDefinition> | |||||
</Grid.ColumnDefinitions> | |||||
<TextBlock Grid.Column="0" Name="Heating" HorizontalAlignment="Center">制热</TextBlock> | |||||
<TextBlock Grid.Column="1" Name="cooling" HorizontalAlignment="Center">制冷</TextBlock> | |||||
<TextBlock Grid.Column="2" Name="LackOfWater" HorizontalAlignment="Center">缺水</TextBlock> | |||||
<TextBlock Grid.Column="3" Name="ChildLocks" HorizontalAlignment="Center">童锁</TextBlock> | |||||
<TextBlock Grid.Column="4" Name="Use" HorizontalAlignment="Center">使用</TextBlock> | |||||
</Grid> | |||||
<TextBlock Grid.Row="0" Grid.Column="0">预冷温度</TextBlock> | |||||
<TextBlock | |||||
Grid.Row="0" | |||||
Grid.Column="1" | |||||
Text="{Binding YLWD}" /> | |||||
<TextBlock Grid.Row="0" Grid.Column="2">回气温度</TextBlock> | |||||
<TextBlock | |||||
Grid.Row="0" | |||||
Grid.Column="3" | |||||
Text="{Binding HQWD}" /> | |||||
</Grid> | |||||
<TextBlock Grid.Row="1" Grid.Column="0">环境温度</TextBlock> | |||||
<TextBlock | |||||
Grid.Row="1" | |||||
Grid.Column="1" | |||||
Text="{Binding HJWD}" /> | |||||
<TextBlock Grid.Row="1" Grid.Column="2">当前模式</TextBlock> | |||||
<TextBlock | |||||
Grid.Row="1" | |||||
Grid.Column="3" | |||||
Text="{Binding CurrentMode}" /> | |||||
<TextBlock Grid.Row="2" Grid.Column="0">电流</TextBlock> | |||||
<TextBlock | |||||
Grid.Row="2" | |||||
Grid.Column="1" | |||||
Text="{Binding DL}" /> | |||||
<TextBlock Grid.Row="2" Grid.Column="2">电压</TextBlock> | |||||
<TextBlock | |||||
Grid.Row="2" | |||||
Grid.Column="3" | |||||
Text="{Binding DY}" /> | |||||
<TextBlock Grid.Row="3" Grid.Column="0">成型比</TextBlock> | |||||
<TextBlock | |||||
Grid.Row="3" | |||||
Grid.Column="1" | |||||
Text="{Binding CXB}" /> | |||||
<TextBlock Grid.Row="3" Grid.Column="2">故障</TextBlock> | |||||
<TextBlock | |||||
Grid.Row="3" | |||||
Grid.Column="3" | |||||
Text="{Binding IceCreamFault}" /> | |||||
</Grid> | |||||
<StackPanel Grid.Row="2" Orientation="Vertical"> | <StackPanel Grid.Row="2" Orientation="Vertical"> | ||||
<StackPanel Margin="0,10,0,0" Orientation="Horizontal"> | <StackPanel Margin="0,10,0,0" Orientation="Horizontal"> | ||||
<TextBlock>冰淇淋</TextBlock> | |||||
<TextBlock>果汁</TextBlock> | |||||
<ComboBox Margin="100,0,0,0" | |||||
Width="100" > | |||||
<ComboBoxItem IsSelected="true">饮品1</ComboBoxItem> | |||||
<ComboBoxItem>饮品2</ComboBoxItem> | |||||
<ComboBoxItem>饮品3</ComboBoxItem> | |||||
<ComboBoxItem>饮品4</ComboBoxItem> | |||||
</ComboBox> | |||||
<ComboBox Margin="20,0,0,0" Width="100"> | |||||
<ComboBoxItem IsSelected="true">冷饮</ComboBoxItem> | |||||
<ComboBoxItem>热饮</ComboBoxItem> | |||||
</ComboBox> | |||||
<Button Command="{Binding Button_MakeIceCreamCommand}" | <Button Command="{Binding Button_MakeIceCreamCommand}" | ||||
Margin="40,5" Height="50" Width="170" | |||||
Margin="20,0" | |||||
Content="制作" /> | Content="制作" /> | ||||
</StackPanel> | </StackPanel> | ||||
<StackPanel Margin="0,10,0,0" Orientation="Horizontal" Height="70"> | |||||
<TextBlock >模式</TextBlock> | |||||
<ComboBox Width="100" Height="40" FontSize="22" | |||||
Margin="20,0" | |||||
ItemsSource="{Binding IceCreamModes}" | |||||
SelectedItem="{Binding SelecteIceCreamdMode}" /> | |||||
<Button Command="{Binding Button_SetIceCreamModelCommand}" | |||||
Margin="20,0" Height="50" Width="150" | |||||
Content="设置" /> | |||||
<StackPanel Margin="0,10,0,0" Orientation="Horizontal"> | |||||
</StackPanel> | </StackPanel> | ||||
</StackPanel> | </StackPanel> | ||||
</Grid> | </Grid> | ||||
</GroupBox> | </GroupBox> | ||||
<!--<GroupBox Grid.Row="2" Grid.Column="0" | |||||
FontSize="20" FontFamily="楷体" | |||||
Header="单片机冰淇淋" > | |||||
<Grid> | |||||
<Grid.RowDefinitions> | |||||
<RowDefinition Height="*"/> | |||||
<RowDefinition Height="*"/> | |||||
<RowDefinition Height="5*"/> | |||||
</Grid.RowDefinitions> | |||||
<TextBlock Text="连接状态" /> | |||||
<TextBlock Text="{Binding SCChipIsConnect}" | |||||
Margin="120,0,0,0"/> | |||||
<TextBlock Grid.Row="1" Text="单片机控制" VerticalAlignment="Center" HorizontalAlignment="Center"/> | |||||
<ListBox Grid.Row="2" Background="Transparent"> | |||||
<ListBox.Template> | |||||
<ControlTemplate TargetType="{x:Type ListBox}"> | |||||
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto"> | |||||
<WrapPanel Orientation="Horizontal" IsItemsHost="True" ScrollViewer.CanContentScroll="True"/> | |||||
</ScrollViewer> | |||||
</ControlTemplate> | |||||
</ListBox.Template> | |||||
<Button Content="咖啡杯落杯" Height="40" Width="120" | |||||
Command="{Binding Button_CupControlCommand}" | |||||
CommandParameter="CUP_COFFEE" | |||||
Margin="10,10,50,10" Cursor="Hand"/> | |||||
<Button Content="冰淇淋杯落杯" Height="40" Width="120" | |||||
Command="{Binding Button_CupControlCommand}" | |||||
CommandParameter="CUP_ICECREAM" Margin="10,10,50,10" | |||||
/> | |||||
<Button Content="单片机冰淇淋制冷" Height="40" Width="120" | |||||
Command="{Binding Button_SCChipRefrigerationCommand}" Cursor="Hand" | |||||
Margin="10,10,50,10" | |||||
/> | |||||
<Button Content="单片机冰淇淋打料" Height="40" Width="120" Margin="10,10,50,10" | |||||
Command="{Binding Button_SCChipDischargeCommand}" Cursor="Hand" /> | |||||
<Button Content="单片机冰淇淋模拟" Height="40" Width="120" | |||||
Command="{Binding Button_SCChipTestCommand}" Cursor="Hand" | |||||
Margin="10,10,50,10"/> | |||||
</ListBox> | |||||
</Grid> | |||||
</GroupBox>--> | |||||
<GroupBox Grid.Row="0" Grid.Column="1" | |||||
<GroupBox Grid.Row="2" Grid.Column="1" | |||||
FontFamily="楷体" | FontFamily="楷体" | ||||
FontSize="20" | FontSize="20" | ||||
Header=" 咖啡机"> | Header=" 咖啡机"> | ||||
@@ -275,25 +231,26 @@ | |||||
Text="{Binding CaffeeFault}" Height="22" Width="60" /> | Text="{Binding CaffeeFault}" Height="22" Width="60" /> | ||||
</Grid> | </Grid> | ||||
<StackPanel Grid.Row="2" Orientation="Vertical"> | <StackPanel Grid.Row="2" Orientation="Vertical"> | ||||
<StackPanel Margin="0,10,0,0" Orientation="Horizontal" Height="60"> | |||||
<StackPanel Margin="0,10,0,0" Orientation="Horizontal"> | |||||
<TextBlock>饮品</TextBlock> | <TextBlock>饮品</TextBlock> | ||||
<ComboBox Margin="10,0" Height="40" FontSize="20" | |||||
Width="120" | |||||
<ComboBox Margin="10,0" | |||||
Width="100" | |||||
ItemsSource="{Binding Coffees}" | ItemsSource="{Binding Coffees}" | ||||
SelectedItem="{Binding SelectedCoffee}" /> | SelectedItem="{Binding SelectedCoffee}" /> | ||||
<Button Margin="10,0" Height="40" Width="120" | |||||
<Button Margin="10,0" | |||||
Command="{}" | Command="{}" | ||||
Content="制作"/> | Content="制作"/> | ||||
<Button Margin="10,0" Height="40" Width="120" | |||||
<Button Margin="10,0" | |||||
Command="{}" | Command="{}" | ||||
Content="停止制作" Cursor="Hand"/> | |||||
Content="停止制作"/> | |||||
</StackPanel> | </StackPanel> | ||||
<StackPanel Margin="0,10,0,0" Orientation="Horizontal" Height="60"> | |||||
<StackPanel Margin="0,10,0,0" Orientation="Horizontal"> | |||||
<TextBlock>模式</TextBlock> | <TextBlock>模式</TextBlock> | ||||
<ComboBox Margin="10,0" Height="40" Width="120" FontSize="20" | |||||
<ComboBox Margin="10,0" | |||||
Width="100" | |||||
ItemsSource="{Binding CoffeeCmds}" | ItemsSource="{Binding CoffeeCmds}" | ||||
SelectedItem="{Binding SelectedCoffeeCmd}"/> | SelectedItem="{Binding SelectedCoffeeCmd}"/> | ||||
<Button Margin="10,0" Height="40" Width="120" | |||||
<Button Margin="10,0" | |||||
Command="{}" | Command="{}" | ||||
Content="设置" Cursor="Hand"/> | Content="设置" Cursor="Hand"/> | ||||
</StackPanel> | </StackPanel> | ||||
@@ -303,20 +260,140 @@ | |||||
<GroupBox Header="单片机控制" | <GroupBox Header="单片机控制" | ||||
FontSize="18" | FontSize="18" | ||||
Grid.Row="1" Grid.ColumnSpan="2" | Grid.Row="1" Grid.ColumnSpan="2" | ||||
Margin="0,0,0,10" HorizontalAlignment="Left" Width="1000"> | |||||
<StackPanel Orientation="Horizontal" | |||||
VerticalAlignment="Center" > | |||||
<Button Content="咖啡杯落杯" Height="40" Width="170" | |||||
Command="{Binding Button_CupControlCommand}" | |||||
CommandParameter="CUP_COFFEE" | |||||
Margin="10,10,50,10" Cursor="Hand"/> | |||||
<Button Content="冰淇淋杯落杯" Height="40" Width="170" | |||||
Command="{Binding Button_CupControlCommand}" | |||||
CommandParameter="CUP_ICECREAM" Margin="10,10,50,10" | |||||
/> | |||||
Margin="0,0,0,10"> | |||||
<Grid> | |||||
<Grid.RowDefinitions> | |||||
<RowDefinition></RowDefinition> | |||||
</Grid.RowDefinitions> | |||||
<Grid.ColumnDefinitions> | |||||
<ColumnDefinition Width="5*"/> | |||||
<ColumnDefinition Width="5*"/> | |||||
<ColumnDefinition Width="13*"/> | |||||
<ColumnDefinition Width="7*"/> | |||||
</Grid.ColumnDefinitions> | |||||
<Grid Grid.Column="0" > | |||||
<TextBlock FontSize="12">连接状态</TextBlock> | |||||
<TextBlock Text="{Binding MCUConnected}" | |||||
Margin="70,0,0,0"/> | |||||
<TextBlock FontSize="12"></TextBlock> | |||||
</Grid> | |||||
<Grid Grid.Column="1" > | |||||
<Grid> | |||||
<Grid.RowDefinitions> | |||||
<RowDefinition></RowDefinition> | |||||
<RowDefinition></RowDefinition> | |||||
</Grid.RowDefinitions> | |||||
<Grid.ColumnDefinitions> | |||||
<ColumnDefinition></ColumnDefinition> | |||||
<ColumnDefinition></ColumnDefinition> | |||||
</Grid.ColumnDefinitions> | |||||
<Grid Grid.Row="0" Grid.Column="0" > | |||||
<TextBlock FontSize="12" HorizontalAlignment="Center">舵机控制</TextBlock> | |||||
</StackPanel> | |||||
</GroupBox> | |||||
</Grid> | |||||
<Grid Grid.Row="0" Grid.Column="1"> | |||||
<ComboBox Margin="0,0,0,0" FontSize="12" Width="60" SelectedIndex="{Binding MCU_PWM_CH}"> | |||||
<ComboBoxItem IsSelected="true">舵机1</ComboBoxItem> | |||||
<ComboBoxItem>舵机2</ComboBoxItem> | |||||
<ComboBoxItem>舵机3</ComboBoxItem> | |||||
<ComboBoxItem>舵机4</ComboBoxItem> | |||||
</ComboBox> | |||||
</Grid> | |||||
<Grid Grid.Row="1" Grid.Column="0"> | |||||
<Button FontSize="15" HorizontalAlignment="Center" Command="{Binding Button_MCUOuputCommand}">输出</Button> | |||||
</Grid> | |||||
<Grid Grid.Row="1" Grid.Column="1" Width="60" > | |||||
<TextBox Text="{Binding PWMInputNumber}"></TextBox> | |||||
</Grid> | |||||
</Grid> | |||||
</Grid> | |||||
<Grid Grid.Column="2" > | |||||
<Grid> | |||||
<Grid.RowDefinitions> | |||||
<RowDefinition></RowDefinition> | |||||
<RowDefinition></RowDefinition> | |||||
</Grid.RowDefinitions> | |||||
<Grid.ColumnDefinitions> | |||||
<ColumnDefinition></ColumnDefinition> | |||||
</Grid.ColumnDefinitions> | |||||
<Grid Grid.Row="0" Grid.Column="0" > | |||||
<TextBlock FontSize="12" HorizontalAlignment="Center">DI输入</TextBlock> | |||||
</Grid> | |||||
<Grid Grid.Row="1" Grid.Column="0" Width="400"> | |||||
<Grid> | |||||
<Grid.ColumnDefinitions> | |||||
<ColumnDefinition></ColumnDefinition> | |||||
<ColumnDefinition></ColumnDefinition> | |||||
<ColumnDefinition></ColumnDefinition> | |||||
<ColumnDefinition></ColumnDefinition> | |||||
<ColumnDefinition></ColumnDefinition> | |||||
<ColumnDefinition></ColumnDefinition> | |||||
<ColumnDefinition></ColumnDefinition> | |||||
<ColumnDefinition></ColumnDefinition> | |||||
</Grid.ColumnDefinitions> | |||||
<Grid Grid.Column="0"> | |||||
<CheckBox FontSize="12" IsEnabled="false" IsChecked="{Binding CH0}">DI0</CheckBox> | |||||
</Grid> | |||||
<Grid Grid.Column="1"> | |||||
<CheckBox FontSize="12" IsEnabled="false" Name="CH1">DI1</CheckBox> | |||||
</Grid> | |||||
<Grid Grid.Column="2"> | |||||
<CheckBox FontSize="12" IsEnabled="false" Name="CH2">DI2</CheckBox> | |||||
</Grid> | |||||
<Grid Grid.Column="3"> | |||||
<CheckBox FontSize="12" IsEnabled="false" Name="CH3">DI3</CheckBox> | |||||
</Grid> | |||||
<Grid Grid.Column="4"> | |||||
<CheckBox FontSize="12" IsEnabled="false" Name="CH4">DI4</CheckBox> | |||||
</Grid> | |||||
<Grid Grid.Column="5"> | |||||
<CheckBox FontSize="12" IsEnabled="false" Name="CH5">DI5</CheckBox> | |||||
</Grid> | |||||
<Grid Grid.Column="6"> | |||||
<CheckBox FontSize="12" IsEnabled="false" Name="CH6">DI6</CheckBox> | |||||
</Grid> | |||||
<Grid Grid.Column="7"> | |||||
<CheckBox FontSize="12" IsEnabled="false" Name="CH7">DI7</CheckBox> | |||||
</Grid> | |||||
</Grid> | |||||
</Grid> | |||||
</Grid> | |||||
</Grid> | |||||
<Grid Grid.Column="3" > | |||||
<Grid.RowDefinitions> | |||||
<RowDefinition></RowDefinition> | |||||
<RowDefinition></RowDefinition> | |||||
</Grid.RowDefinitions> | |||||
<Grid.ColumnDefinitions> | |||||
<ColumnDefinition></ColumnDefinition> | |||||
<ColumnDefinition></ColumnDefinition> | |||||
</Grid.ColumnDefinitions> | |||||
<Grid Grid.Column="0"> | |||||
<TextBlock FontSize="12" HorizontalAlignment="Center">DO输出</TextBlock> | |||||
</Grid> | |||||
<Grid Grid.Column="1" Grid.Row="0"> | |||||
<ComboBox Width="50" FontSize="12" HorizontalAlignment="Center" SelectedIndex="{Binding MCU_DO_CH}"> | |||||
<ComboBoxItem IsSelected="true">DO0</ComboBoxItem> | |||||
<ComboBoxItem>DO1</ComboBoxItem> | |||||
<ComboBoxItem>DO2</ComboBoxItem> | |||||
<ComboBoxItem>DO3</ComboBoxItem> | |||||
<ComboBoxItem>DO4</ComboBoxItem> | |||||
<ComboBoxItem>DO5</ComboBoxItem> | |||||
<ComboBoxItem>DO6</ComboBoxItem> | |||||
<ComboBoxItem>DO7</ComboBoxItem> | |||||
</ComboBox> | |||||
</Grid> | |||||
<Grid Grid.Column="0" Grid.Row="1"> | |||||
<Button Width="50" Command="{Binding Button_MCUDOuputCommand}">输出</Button> | |||||
</Grid> | |||||
<Grid Grid.Column="1" Grid.Row="1"> | |||||
<RadioButton FontSize="12" IsChecked="{Binding MCU_DO_Value}">True</RadioButton> | |||||
<RadioButton Margin="50,0,0,0" FontSize="12">false</RadioButton> | |||||
</Grid> | |||||
</Grid> | |||||
</Grid> | |||||
</GroupBox> | |||||
</Grid> | </Grid> | ||||
</UserControl> | </UserControl> |
@@ -17,7 +17,7 @@ using System.Windows.Shapes; | |||||
namespace BPASmartClient.MorkT.View | namespace BPASmartClient.MorkT.View | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// MorkT_DebugView.xaml 的交互逻辑 | |||||
/// DebugView.xaml 的交互逻辑 | |||||
/// </summary> | /// </summary> | ||||
public partial class DebugView : UserControl | public partial class DebugView : UserControl | ||||
{ | { | ||||
@@ -28,8 +28,10 @@ namespace BPASmartClient.MorkT.View | |||||
private void Dubug_Unloaded(object sender, RoutedEventArgs e) | private void Dubug_Unloaded(object sender, RoutedEventArgs e) | ||||
{ | { | ||||
//ThreadManage.GetInstance().StopTask("MorkT-状态刷新"); | |||||
//ThreadManage.GetInstance().StopTask("MorkT-传感器监视"); | |||||
ThreadManage.GetInstance().StopTask("MorkT-状态刷新"); | |||||
ThreadManage.GetInstance().StopTask("MorkT-传感器监视"); | |||||
} | } | ||||
} | } | ||||
} | } |
@@ -8,12 +8,10 @@ using BPASmartClient.LebaiRobot; | |||||
using BPASmartClient.Message; | using BPASmartClient.Message; | ||||
using BPASmartClient.Model; | using BPASmartClient.Model; | ||||
using BPASmartClient.Model.乐白机器人; | using BPASmartClient.Model.乐白机器人; | ||||
using BPASmartClient.Model.乐白机器人.Enum; | |||||
using BPASmartClient.Model.冰淇淋.Enum; | using BPASmartClient.Model.冰淇淋.Enum; | ||||
using BPASmartClient.Model.单片机; | using BPASmartClient.Model.单片机; | ||||
using BPASmartClient.Model.单片机.Enum; | using BPASmartClient.Model.单片机.Enum; | ||||
using BPASmartClient.Model.咖啡机.Enum; | using BPASmartClient.Model.咖啡机.Enum; | ||||
using BPASmartClient.MorkT.Model; | |||||
using Microsoft.Toolkit.Mvvm.ComponentModel; | using Microsoft.Toolkit.Mvvm.ComponentModel; | ||||
using Microsoft.Toolkit.Mvvm.Input; | using Microsoft.Toolkit.Mvvm.Input; | ||||
using System; | using System; | ||||
@@ -21,9 +19,7 @@ using System.Collections.Generic; | |||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
using System.Linq; | using System.Linq; | ||||
using System.Threading; | using System.Threading; | ||||
namespace BPASmartClient.MorkT.ViewModel | |||||
{ | |||||
namespace BPASmartClient.MorkT.ViewModel; | |||||
public class DebugViewModel : ObservableObject | public class DebugViewModel : ObservableObject | ||||
{ | { | ||||
@@ -38,12 +34,6 @@ namespace BPASmartClient.MorkT.ViewModel | |||||
/// </summary> | /// </summary> | ||||
public string RobotMode { get { return _robotMode; } set { _robotMode = value; OnPropertyChanged(); } } | public string RobotMode { get { return _robotMode; } set { _robotMode = value; OnPropertyChanged(); } } | ||||
private string _robotMode { get; set; } | private string _robotMode { get; set; } | ||||
/// <summary> | |||||
/// 乐白机器人自嗨时间间隔 | |||||
/// </summary> | |||||
public int TimeInterval { get { return Global.TimeInterval; } set { Global.TimeInterval = value; OnPropertyChanged(); } } | |||||
//private int _timeInterval { get; set; } = Global.TimeInterval; | |||||
/// <summary> | /// <summary> | ||||
/// 机器人控制指令 | /// 机器人控制指令 | ||||
/// </summary> | /// </summary> | ||||
@@ -52,110 +42,32 @@ namespace BPASmartClient.MorkT.ViewModel | |||||
/// 机器人控制 | /// 机器人控制 | ||||
/// </summary> | /// </summary> | ||||
/// <param name="o"></param> | /// <param name="o"></param> | ||||
public RelayCommand Button_SetValueCommand { get; set; } | |||||
public RelayCommand Button_GoToHomeCommand { get; set; } | |||||
private void Button_SetValue() | |||||
{ | |||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }); | |||||
} | |||||
private void Button_RobotControl(object o) | private void Button_RobotControl(object o) | ||||
{ | { | ||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiControlEvent { DeviceId = DeviceId, LebaiControl = o.ToString() }); | EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiControlEvent { DeviceId = DeviceId, LebaiControl = o.ToString() }); | ||||
} | } | ||||
private void Button_GoToHome() | |||||
{ | |||||
//EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }, (o) => { }); | |||||
//MessageLog.GetInstance.Show("开始执行乐白机器人回原点"); | |||||
//EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_机器人回原点 }); | |||||
//MessageLog.GetInstance.Show("开始执行乐白机器人回原点-----"); | |||||
} | |||||
#endregion | #endregion | ||||
#region 冰淇淋机器 | |||||
/// <summary> | |||||
/// 制作冰淇淋 | |||||
/// </summary> | |||||
public RelayCommand Button_MakeIceCreamCommand { get; set; } | |||||
/// <summary> | |||||
/// 选择冰淇淋模式 | |||||
/// </summary> | |||||
public RelayCommand Button_SetIceCreamModelCommand { get; set; } | |||||
#region 果汁机 | |||||
/// <summary> | /// <summary> | ||||
/// 冰淇淋连接状态 | |||||
/// 果汁机的连接状态 | |||||
/// </summary> | /// </summary> | ||||
public string IceCreamConnected { get { return _iceCreamConnected; } set { _iceCreamConnected = value; OnPropertyChanged(); } } | |||||
private string _iceCreamConnected { get; set; } | |||||
/// <summary> | |||||
/// 预冷温度 | |||||
/// </summary> | |||||
public string YLWD { get { return _yLWD; } set { _yLWD = value; OnPropertyChanged(); } } | |||||
private string _yLWD { get; set; } | |||||
/// <summary> | |||||
/// 回气温度 | |||||
/// </summary> | |||||
public string HQWD { get { return _hQWD; } set { _hQWD = value; OnPropertyChanged(); } } | |||||
private string _hQWD { get; set; } | |||||
/// <summary> | |||||
/// 环境温度 | |||||
/// </summary> | |||||
public string HJWD { get { return _hJWD; } set { _hJWD = value; OnPropertyChanged(); } } | |||||
private string _hJWD { get; set; } | |||||
/// <summary> | |||||
/// 电流 | |||||
/// </summary> | |||||
public string DL { get { return _DL; } set { _DL = value; OnPropertyChanged(); } } | |||||
private string _DL { get; set; } | |||||
/// <summary> | |||||
/// 电压 | |||||
/// </summary> | |||||
public string DY { get { return _dy; } set { _dy = value; OnPropertyChanged(); } } | |||||
private string _dy { get; set; } | |||||
/// <summary> | |||||
/// 当前模式 | |||||
/// </summary> | |||||
public string CurrentMode { get { return _CurrentMode; } set { _CurrentMode = value; OnPropertyChanged(); } } | |||||
private string _CurrentMode; | |||||
/// <summary> | |||||
/// 故障 | |||||
/// </summary> | |||||
public string IceCreamFault { get { return _IceCreamFault; } set { _IceCreamFault = value; OnPropertyChanged(); } } | |||||
private string _IceCreamFault { get; set; } | |||||
/// <summary> | |||||
/// 成型比 | |||||
/// </summary> | |||||
public string CXB { get { return _cXB; } set { _cXB = value; OnPropertyChanged(); } } | |||||
private string _cXB { get; set; } | |||||
public string JuicerConnected { get { return _JuicerConnected; } set { _JuicerConnected = value; OnPropertyChanged(); } } | |||||
private string _JuicerConnected { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// 打料完成状态 | |||||
/// 果汁机的状态 | |||||
/// </summary> | /// </summary> | ||||
public string DLCompleted { get { return _dLCompleted; } set { _dLCompleted = value; OnPropertyChanged(); } } | |||||
private string _dLCompleted { get; set; } | |||||
public List<string> IceCreamModes { get; set; } = new List<string>(); | |||||
public string SelecteIceCreamdMode { get; set; } | |||||
private void Button_MakeIceCream() | |||||
{ | |||||
EventBus.EventBus.GetInstance().Publish(new GSIceCream_DischargeEvent { DeviceId = DeviceId }); | |||||
} | |||||
private void Button_SetIceCreamModel() | |||||
{ | |||||
MORKI_MODE mORKI_MODE = (MORKI_MODE)Enum.Parse(typeof(MORKI_MODE), SelecteIceCreamdMode); | |||||
EventBus.EventBus.GetInstance().Publish(new GSIceCream_ModeSetEvent { DeviceId = DeviceId, Mode = mORKI_MODE }); | |||||
} | |||||
public string JuicerState { get { return _JuicerState; } set { _JuicerState = value; OnPropertyChanged(); } } | |||||
private string _JuicerState { get; set; } | |||||
#endregion | #endregion | ||||
#region 咖啡机 | #region 咖啡机 | ||||
/// <summary> | /// <summary> | ||||
/// 咖啡机连接状态 | /// 咖啡机连接状态 | ||||
/// </summary> | |||||
/// </summary> | |||||
public string CoffeeConnected { get { return _coffeeConnected; } set { _coffeeConnected = value; OnPropertyChanged(); } } | public string CoffeeConnected { get { return _coffeeConnected; } set { _coffeeConnected = value; OnPropertyChanged(); } } | ||||
private string _coffeeConnected { get; set; } | private string _coffeeConnected { get; set; } | ||||
/// <summary> | /// <summary> | ||||
@@ -212,55 +124,81 @@ namespace BPASmartClient.MorkT.ViewModel | |||||
#endregion | #endregion | ||||
#region 单片机 | #region 单片机 | ||||
/// <summary> | |||||
/// 单片机连接状态 | |||||
/// </summary> | |||||
public string SCChipIsConnect { get { return _sCChipIsConnect; } set { _sCChipIsConnect = value; OnPropertyChanged(); } } | |||||
private string _sCChipIsConnect { get; set; } | |||||
/// <summary> | |||||
/// 咖啡杯或冰淇淋杯落杯 | |||||
/// </summary> | |||||
public RelayCommand<object> Button_CupControlCommand { get; set; } | |||||
/// <summary> | |||||
/// 单片机冰淇淋机器制冷 | |||||
/// </summary> | |||||
public RelayCommand Button_SCChipRefrigerationCommand { get; set; } | |||||
/// <summary> | |||||
/// 单片机冰淇淋机器打料 | |||||
/// </summary> | |||||
public RelayCommand Button_SCChipDischargeCommand { get; set; } | |||||
/// <summary> | |||||
/// 模拟测试 | |||||
/// </summary> | |||||
public RelayCommand Button_SCChipTestCommand { get; set; } | |||||
private void Button_CupControl(object CupType) | |||||
public string MCUConnected { get { return _mcuConnected; } set { _mcuConnected = value; OnPropertyChanged(); } } | |||||
private string _mcuConnected { get; set; } | |||||
public RelayCommand Button_MCUOuputCommand { get; set; } | |||||
public RelayCommand Button_MCUDOuputCommand { get; set; } | |||||
public RelayCommand Button_LebaiDOuputCommand { get; set; } | |||||
public int PWMInputNumber { get { return _pwmInputNumber; } set { _pwmInputNumber = value; OnPropertyChanged(); } } | |||||
private int _pwmInputNumber = 1; | |||||
public int MCU_PWM_CH { get { return _choosePWM; } set { _choosePWM = value; OnPropertyChanged(); } } | |||||
private int _choosePWM = 1; | |||||
public int MCU_DO_CH { get { return _mcuDO_CH; } set { _mcuDO_CH = value; OnPropertyChanged(); } } | |||||
private int _mcuDO_CH = 1; | |||||
public int Lebai_DO_CH { get { return _lebaiDO_CH; } set { _lebaiDO_CH = value; OnPropertyChanged(); } } | |||||
private int _lebaiDO_CH = 1; | |||||
public int Lebai_DO_Value { get { return _lebaiDO_Value; } set { _lebaiDO_Value = value; OnPropertyChanged(); } } | |||||
private int _lebaiDO_Value = 1; | |||||
private int[] DICH { get { return _diCH; } set { _diCH = value; OnPropertyChanged(); } } | |||||
private int[] _diCH = new int[8]; | |||||
public bool MCU_DO_Value { get { return _mcu_DO_Valuer; } set { _mcu_DO_Valuer = value; OnPropertyChanged(); } } | |||||
private bool _mcu_DO_Valuer = true; | |||||
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() | |||||
{ | { | ||||
EventBus.EventBus.GetInstance().Publish(new SCChip_TakeCupEvent() { DeviceId = DeviceId, Cup = (IC_CUP)Enum.Parse(typeof(IC_CUP), CupType.ToString()) }); | |||||
string sChoosePWM =Convert.ToString(MCU_PWM_CH+1); | |||||
new WriteMcu() { TagName = "ServoControl", Address = sChoosePWM, Value = PWMInputNumber }.Publish(); | |||||
} | } | ||||
private void Button_SCChipRefrigeration() | |||||
/// <summary> | |||||
/// 单片机DO输出 | |||||
/// </summary> | |||||
private void Button_McuDOutput() | |||||
{ | { | ||||
//EventBus.EventBus.GetInstance().Publish(new SCChip_RotorSwitchEvent { DeviceId = DeviceId, TurnOn = true }); | |||||
//Thread.Sleep(500); | |||||
//EventBus.EventBus.GetInstance().Publish(new SCChip_RotorSwitchEvent { DeviceId = DeviceId, TurnOn = false }); | |||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetOutPutEvent { DeviceId = DeviceId, Value = true, Pin = 1 }); | |||||
Thread.Sleep(500); | |||||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetOutPutEvent { DeviceId = DeviceId, Value = false, Pin = 1 }); | |||||
string sChooseDO = Convert.ToString(MCU_DO_CH + 1); | |||||
new WriteMcu() { TagName = "OutputControl", Address = sChooseDO, Value = MCU_DO_Value }.Publish(); | |||||
} | } | ||||
private void Button_SCChipDischarge() | |||||
/// <summary> | |||||
/// 乐白的DO输出 | |||||
/// </summary> | |||||
private void Button_LebaiDOutput() | |||||
{ | { | ||||
EventBus.EventBus.GetInstance().Publish(new SCChip_MakeIceCreamEvent { DeviceId = DeviceId, SteeringEngine = IC_SE.SE_2 }); | |||||
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 | |||||
#endregion | |||||
/// <summary> | |||||
/// 设备ID | |||||
/// </summary> | |||||
public int DeviceId { get; set; } | |||||
/// <summary> | |||||
/// 设备ID | |||||
/// </summary> | |||||
public int DeviceId { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// 设备数据 | /// 设备数据 | ||||
/// </summary> | /// </summary> | ||||
@@ -269,27 +207,14 @@ namespace BPASmartClient.MorkT.ViewModel | |||||
public DebugViewModel() | public DebugViewModel() | ||||
{ | { | ||||
Button_RobotControlCommand = new RelayCommand<object>(Button_RobotControl); | Button_RobotControlCommand = new RelayCommand<object>(Button_RobotControl); | ||||
Button_SetValueCommand = new RelayCommand(Button_SetValue); | |||||
Button_GoToHomeCommand = new RelayCommand(Button_GoToHome); | |||||
Button_MakeIceCreamCommand = new RelayCommand(Button_MakeIceCream); | |||||
Button_SetIceCreamModelCommand = new RelayCommand(Button_SetIceCreamModel); | |||||
Button_MakeCoffeeCommand = new RelayCommand(Button_MakeCoffee); | Button_MakeCoffeeCommand = new RelayCommand(Button_MakeCoffee); | ||||
Button_StopMakeCoffeCommand = new RelayCommand(Button_StopMakeCoffe); | Button_StopMakeCoffeCommand = new RelayCommand(Button_StopMakeCoffe); | ||||
Button_CoffeeModeSetCommand = new RelayCommand(Button_CoffeeModeSet); | Button_CoffeeModeSetCommand = new RelayCommand(Button_CoffeeModeSet); | ||||
Button_CupControlCommand = new RelayCommand<object>(Button_CupControl); | |||||
Button_SCChipRefrigerationCommand = new RelayCommand(Button_SCChipRefrigeration); | |||||
Button_SCChipDischargeCommand = new RelayCommand(Button_SCChipDischarge); | |||||
Button_SCChipTestCommand = new RelayCommand(() => | |||||
{ | |||||
Button_SCChipRefrigeration(); | |||||
Thread.Sleep(50); | |||||
Button_SCChipDischarge(); | |||||
}); | |||||
foreach (DrCoffeeDrinksCode code in Enum.GetValues(typeof(DrCoffeeDrinksCode))) | |||||
Button_MCUOuputCommand = new RelayCommand(Button_McuOutput); | |||||
Button_MCUDOuputCommand = new RelayCommand(Button_McuDOutput); | |||||
Button_LebaiDOuputCommand = new RelayCommand(Button_LebaiDOutput); | |||||
foreach (DrCoffeeDrinksCode code in Enum.GetValues(typeof(DrCoffeeDrinksCode))) | |||||
{ | { | ||||
Coffees.Add(code.ToString()); | Coffees.Add(code.ToString()); | ||||
} | } | ||||
@@ -300,17 +225,14 @@ namespace BPASmartClient.MorkT.ViewModel | |||||
} | } | ||||
SelectedCoffeeCmd = CoffeeCmds[0]; | SelectedCoffeeCmd = CoffeeCmds[0]; | ||||
foreach (MORKI_MODE code in Enum.GetValues(typeof(MORKI_MODE))) | |||||
{ | |||||
IceCreamModes.Add(code.ToString()); | |||||
} | |||||
SelecteIceCreamdMode = IceCreamModes[0]; | |||||
Plugin.GetInstance()?.GetPlugin<DeviceMgr>()?.GetDevices().ForEach(device => | Plugin.GetInstance()?.GetPlugin<DeviceMgr>()?.GetDevices().ForEach(device => | ||||
{ | { | ||||
if (device.Name == "MorkT") DeviceId = device.DeviceId | if (device.Name == "MorkT") DeviceId = device.DeviceId | ||||
; | ; | ||||
}); | }); | ||||
ThreadManage.GetInstance().StartLong(new Action(() => | ThreadManage.GetInstance().StartLong(new Action(() => | ||||
{ | { | ||||
@@ -318,10 +240,10 @@ namespace BPASmartClient.MorkT.ViewModel | |||||
if (variableMonitors != null && variableMonitors.Count > 0) | if (variableMonitors != null && variableMonitors.Count > 0) | ||||
{ | { | ||||
RobotConnected = variableMonitors.FirstOrDefault(p=>p.Notes == "机器人连接状态").CurrentValue == "True" ? "已连接" : "未连接"; | |||||
IceCreamConnected = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋连接状态").CurrentValue == "True" ? "已连接" : "未连接"; | |||||
RobotConnected = variableMonitors.FirstOrDefault(p=>p.Notes == "机器人连接状态").CurrentValue == "True" ? "已连接" : "未连接"; | |||||
CoffeeConnected = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机连接状态").CurrentValue == "True" ? "已连接" : "未连接"; | CoffeeConnected = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机连接状态").CurrentValue == "True" ? "已连接" : "未连接"; | ||||
SCChipIsConnect = variableMonitors.FirstOrDefault(p => p.Notes == "单片机连接状态").CurrentValue == "True" ? "已连接" : "未连接"; | |||||
JuicerConnected = variableMonitors.FirstOrDefault(p => p.Notes == "果汁机连接状态").CurrentValue == "True" ? "已连接" : "未连接"; | |||||
MCUConnected = variableMonitors.FirstOrDefault(p => p.Notes == "单片机连接状态").CurrentValue == "True" ? "已连接" : "未连接"; | |||||
RobotMode = variableMonitors.FirstOrDefault(p => p.Notes == "机器人状态").CurrentValue; | RobotMode = variableMonitors.FirstOrDefault(p => p.Notes == "机器人状态").CurrentValue; | ||||
@@ -330,19 +252,11 @@ namespace BPASmartClient.MorkT.ViewModel | |||||
Warning = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机告警").CurrentValue; | Warning = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机告警").CurrentValue; | ||||
CaffeeFault = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机故障").CurrentValue; | CaffeeFault = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机故障").CurrentValue; | ||||
YLWD = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器预冷温度").CurrentValue; | |||||
HQWD = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器回气温度").CurrentValue; | |||||
HJWD = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器环境温度").CurrentValue; | |||||
DL = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器电流").CurrentValue; | |||||
DY = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器电压").CurrentValue; | |||||
CurrentMode = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器模式").CurrentValue; | |||||
IceCreamFault = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器异常").CurrentValue; | |||||
CXB = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器成型比").CurrentValue; | |||||
DLCompleted = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器打料完成")?.CurrentValue == "True" ? "打料完成" : "打料中"; | |||||
} | } | ||||
Thread.Sleep(500); | Thread.Sleep(500); | ||||
}), "MorkT-状态刷新"); | }), "MorkT-状态刷新"); | ||||
} | |||||
} | |||||
} | } | ||||
} | |||||