@@ -0,0 +1,9 @@ | |||
<Application x:Class="BPACommonClient.App" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:local="clr-namespace:BPACommonClient" | |||
StartupUri="MainWindow.xaml"> | |||
<Application.Resources> | |||
</Application.Resources> | |||
</Application> |
@@ -0,0 +1,17 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Configuration; | |||
using System.Data; | |||
using System.Linq; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
namespace BPACommonClient | |||
{ | |||
/// <summary> | |||
/// Interaction logic for App.xaml | |||
/// </summary> | |||
public partial class App : Application | |||
{ | |||
} | |||
} |
@@ -0,0 +1,10 @@ | |||
using System.Windows; | |||
[assembly: ThemeInfo( | |||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located | |||
//(used if a resource is not found in the page, | |||
// or application resource dictionaries) | |||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located | |||
//(used if a resource is not found in the page, | |||
// app, or any theme specific resource dictionaries) | |||
)] |
@@ -0,0 +1,10 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<OutputType>WinExe</OutputType> | |||
<TargetFramework>net6.0-windows</TargetFramework> | |||
<Nullable>enable</Nullable> | |||
<UseWPF>true</UseWPF> | |||
</PropertyGroup> | |||
</Project> |
@@ -0,0 +1,12 @@ | |||
<Window x:Class="BPACommonClient.MainWindow" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:local="clr-namespace:BPACommonClient" | |||
mc:Ignorable="d" | |||
Title="MainWindow" Height="450" Width="800"> | |||
<Grid> | |||
</Grid> | |||
</Window> |
@@ -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 BPACommonClient | |||
{ | |||
/// <summary> | |||
/// Interaction logic for MainWindow.xaml | |||
/// </summary> | |||
public partial class MainWindow : Window | |||
{ | |||
public MainWindow() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,176 @@ | |||
<UserControl x:Class="BPASmartClient.CustomResource.UserControls.UserKeyBoard" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.CustomResource.UserControls" | |||
mc:Ignorable="d" | |||
d:DesignHeight="180" d:DesignWidth="500" | |||
x:Name="Keyboard" Background="Transparent" > | |||
<UserControl.Resources> | |||
<Style x:Key="btnNum" TargetType="{x:Type Button}"> | |||
<Setter Property="HorizontalContentAlignment" Value="Center"/> | |||
<Setter Property="VerticalContentAlignment" Value="Center"/> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type Button}"> | |||
<Border x:Name="border" BorderBrush="#FF474747" BorderThickness="1" CornerRadius="6"> | |||
<Border.Background> | |||
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> | |||
<GradientStop Color="#002A5F"/> | |||
<GradientStop Color="#6495ED" Offset="1"/> | |||
</LinearGradientBrush> | |||
</Border.Background> | |||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" TextElement.Foreground="#4fade8" TextElement.FontSize="16" /> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsPressed" Value="True"> | |||
<Setter Property="Background" TargetName="border" > | |||
<Setter.Value> | |||
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> | |||
<GradientStop Color="#FFFF7500"/> | |||
<GradientStop Color="#FFFFC547" Offset="1"/> | |||
</LinearGradientBrush> | |||
</Setter.Value> | |||
</Setter> | |||
</Trigger> | |||
<Trigger Property="IsPressed" Value="False"> | |||
<Setter Property="Background" TargetName="border" > | |||
<Setter.Value> | |||
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> | |||
<GradientStop Color="#002A5F"/> | |||
<GradientStop Color="#6495ED" Offset="1"/> | |||
</LinearGradientBrush> | |||
</Setter.Value> | |||
</Setter> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style x:Key="btnFunc" TargetType="{x:Type Button}"> | |||
<Setter Property="HorizontalContentAlignment" Value="Center"/> | |||
<Setter Property="VerticalContentAlignment" Value="Center"/> | |||
<!--<Setter Property="Padding" Value="1"/>--> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type Button}"> | |||
<Border x:Name="border" BorderBrush="#FF565656" BorderThickness="1" CornerRadius="6"> | |||
<Border.Background> | |||
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> | |||
<GradientStop Color="#002A5F"/> | |||
<GradientStop Color="#6495ED" Offset="1"/> | |||
</LinearGradientBrush> | |||
</Border.Background> | |||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" TextElement.Foreground="White" TextElement.FontSize="18"/> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsPressed" Value="True"> | |||
<Setter Property="Background" TargetName="border"> | |||
<Setter.Value> | |||
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> | |||
<GradientStop Color="Gray" Offset="1"/> | |||
<GradientStop Color="#FF2D2D2D" Offset="0"/> | |||
</LinearGradientBrush> | |||
</Setter.Value> | |||
</Setter> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
</UserControl.Resources> | |||
<UserControl.Triggers> | |||
<EventTrigger SourceName="Keyboard" RoutedEvent="UserControl.Loaded"> | |||
<BeginStoryboard> | |||
<Storyboard> | |||
<DoubleAnimation Storyboard.TargetName="Keyboard" Storyboard.TargetProperty="Opacity" | |||
From="0" To="1" Duration="0:0:0.2"> | |||
</DoubleAnimation> | |||
</Storyboard> | |||
</BeginStoryboard> | |||
</EventTrigger> | |||
</UserControl.Triggers> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="*"/> | |||
</Grid.RowDefinitions> | |||
<Grid > | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="*" /> | |||
</Grid.RowDefinitions> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="10"/> | |||
<ColumnDefinition Width="*"/> | |||
<ColumnDefinition Width="10"/> | |||
</Grid.ColumnDefinitions> | |||
<Grid x:Name="ButtonGrid" Grid.Row="1" Grid.Column="1" ButtonBase.Click="ButtonGrid_Click"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="80*"/> | |||
<RowDefinition Height="80*"/> | |||
<RowDefinition Height="80*"/> | |||
<RowDefinition Height="80*"/> | |||
</Grid.RowDefinitions> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="120*"/> | |||
<ColumnDefinition Width="120*"/> | |||
<ColumnDefinition Width="120*"/> | |||
<ColumnDefinition Width="120*"/> | |||
<ColumnDefinition Width="120*"/> | |||
<ColumnDefinition Width="120*"/> | |||
<ColumnDefinition Width="120*"/> | |||
<ColumnDefinition Width="120*"/> | |||
<ColumnDefinition Width="120*"/> | |||
<ColumnDefinition Width="120*"/> | |||
</Grid.ColumnDefinitions> | |||
<Button Margin="2" Grid.Column="0" Grid.Row="0" Content="1" Style="{StaticResource btnNum}"/> | |||
<Button Margin="2" Grid.Column="1" Grid.Row="0" Content="2" Style="{StaticResource btnNum}"/> | |||
<Button Margin="2" Grid.Column="2" Grid.Row="0" Content="3" Style="{StaticResource btnNum}"/> | |||
<Button Margin="2" Grid.Column="3" Grid.Row="0" Content="4" Style="{StaticResource btnNum}"/> | |||
<Button Margin="2" Grid.Column="4" Grid.Row="0" Content="5" Style="{StaticResource btnNum}"/> | |||
<Button Margin="2" Grid.Column="5" Grid.Row="0" Content="6" Style="{StaticResource btnNum}"/> | |||
<Button Margin="2" Grid.Column="6" Grid.Row="0" Content="7" Style="{StaticResource btnNum}"/> | |||
<Button Margin="2" Grid.Column="7" Grid.Row="0" Content="8" Style="{StaticResource btnNum}"/> | |||
<Button Margin="2" Grid.Column="8" Grid.Row="0" Content="9" Style="{StaticResource btnNum}"/> | |||
<Button Margin="2" Grid.Column="9" Grid.Row="0" Content="0" Style="{StaticResource btnNum}"/> | |||
<Button Margin="2" Grid.Column="0" Grid.Row="1" Content="Q" Style="{StaticResource btnNum}"/> | |||
<Button Margin="2" Grid.Column="1" Grid.Row="1" Content="W" Style="{StaticResource btnNum}"/> | |||
<Button Margin="2" Grid.Column="2" Grid.Row="1" Content="E" Style="{StaticResource btnNum}"/> | |||
<Button Margin="2" Grid.Column="3" Grid.Row="1" Content="R" Style="{StaticResource btnNum}"/> | |||
<Button Margin="2" Grid.Column="4" Grid.Row="1" Content="T" Style="{StaticResource btnNum}"/> | |||
<Button Margin="2" Grid.Column="5" Grid.Row="1" Content="Y" Style="{StaticResource btnNum}"/> | |||
<Button Margin="2" Grid.Column="6" Grid.Row="1" Content="U" Style="{StaticResource btnNum}"/> | |||
<Button Margin="2" Grid.Column="7" Grid.Row="1" Content="I" Style="{StaticResource btnNum}"/> | |||
<Button Margin="2" Grid.Column="8" Grid.Row="1" Content="O" Style="{StaticResource btnNum}"/> | |||
<Button Margin="2" Grid.Column="9" Grid.Row="1" Content="P" Style="{StaticResource btnNum}"/> | |||
<Button Margin="2" Grid.Column="0" Grid.Row="2" Content="A" Style="{StaticResource btnNum}"/> | |||
<Button Margin="2" Grid.Column="1" Grid.Row="2" Content="S" Style="{StaticResource btnNum}"/> | |||
<Button Margin="2" Grid.Column="2" Grid.Row="2" Content="D" Style="{StaticResource btnNum}"/> | |||
<Button Margin="2" Grid.Column="3" Grid.Row="2" Content="F" Style="{StaticResource btnNum}"/> | |||
<Button Margin="2" Grid.Column="4" Grid.Row="2" Content="G" Style="{StaticResource btnNum}"/> | |||
<Button Margin="2" Grid.Column="5" Grid.Row="2" Content="H" Style="{StaticResource btnNum}"/> | |||
<Button Margin="2" Grid.Column="6" Grid.Row="2" Content="J" Style="{StaticResource btnNum}"/> | |||
<Button Margin="2" Grid.Column="7" Grid.Row="2" Content="K" Style="{StaticResource btnNum}"/> | |||
<Button Margin="2" Grid.Column="8" Grid.Row="2" Content="L" Style="{StaticResource btnNum}"/> | |||
<Button Margin="2" Grid.Column="0" Grid.Row="3" Content="Z" Style="{StaticResource btnNum}"/> | |||
<Button Margin="2" Grid.Column="1" Grid.Row="3" Content="X" Style="{StaticResource btnNum}"/> | |||
<Button Margin="2" Grid.Column="2" Grid.Row="3" Content="C" Style="{StaticResource btnNum}"/> | |||
<Button Margin="2" Grid.Column="3" Grid.Row="3" Content="V" Style="{StaticResource btnNum}"/> | |||
<Button Margin="2" Grid.Column="4" Grid.Row="3" Content="B" Style="{StaticResource btnNum}"/> | |||
<Button Margin="2" Grid.Column="5" Grid.Row="3" Content="N" Style="{StaticResource btnNum}"/> | |||
<Button Margin="2" Grid.Column="6" Grid.Row="3" Content="M" Style="{StaticResource btnNum}"/> | |||
<Button Margin="2" Grid.Column="9" Grid.Row="2" Content="A/a" Style="{StaticResource btnFunc}"/> | |||
<Button Margin="2" Grid.Column="7" Grid.Row="3" Content="DEL" Style="{StaticResource btnFunc}"/> | |||
<Button Margin="2" Grid.Column="8" Grid.Row="3" Content="AC" Style="{StaticResource btnFunc}"/> | |||
<Button Margin="2" Grid.Column="9" Grid.Row="3" Content="确认" Style="{StaticResource btnFunc}"/> | |||
</Grid> | |||
</Grid> | |||
</Grid> | |||
</UserControl> |
@@ -0,0 +1,74 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using System.Windows.Controls; | |||
using System.Windows.Data; | |||
using System.Windows.Documents; | |||
using System.Windows.Input; | |||
using System.Windows.Media; | |||
using System.Windows.Media.Imaging; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
namespace BPASmartClient.CustomResource.UserControls | |||
{ | |||
/// <summary> | |||
/// UserKeyBoard.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class UserKeyBoard : UserControl | |||
{ | |||
public Action<object> MyKeyDown; | |||
public UserKeyBoard() | |||
{ | |||
InitializeComponent(); | |||
} | |||
//通过判断按钮的content属性来做对应处理 | |||
private void ButtonGrid_Click(object sender, RoutedEventArgs e) | |||
{ | |||
Button clickedButton = (Button)e.OriginalSource; //获取click事件触发源,即按了的按钮 | |||
switch((String)clickedButton.Content) | |||
{ | |||
case "DEL": | |||
MyKeyDown(EKeyitem.DEL); | |||
break; | |||
case "AC": | |||
MyKeyDown(EKeyitem.AC); | |||
break; | |||
case "确认": | |||
MyKeyDown(EKeyitem.OK); | |||
break; | |||
case "A/a": | |||
UIElementCollection grd = ButtonGrid.Children; | |||
int count = grd.Count; | |||
for (int i = 0; i < count; i++) | |||
{ | |||
Button buttonTemp = grd[i] as Button; | |||
String contentTemp = buttonTemp.Content as String; | |||
if (contentTemp == "AC" || contentTemp == "A/a" || contentTemp == "确认" || contentTemp == "DEL") | |||
continue; | |||
buttonTemp.Content = contentTemp[0] > 90 ? contentTemp.ToUpper() : contentTemp.ToLower(); | |||
} | |||
break; | |||
default: | |||
MyKeyDown((String)clickedButton.Content); | |||
break; | |||
} | |||
} | |||
public enum EKeyitem | |||
{ | |||
DEL, | |||
AC, | |||
Shift, | |||
OK, | |||
A | |||
} | |||
} | |||
} |
@@ -69,7 +69,7 @@ namespace BPASmartClient.Lebai | |||
public const int SENCE_放冰淇淋位置 = 10043; | |||
//add 新加场景 | |||
public const int SENCE_接咖啡_新 = 10051; | |||
public const int SENCE_接咖啡后回原点 = 10051; | |||
public const int SENCE_咖啡杯回原点 = 10050; | |||
public const int SENCE_冰淇淋杯回原点 = 10049; | |||
public const int SENCE_取咖啡出餐 = 10052; | |||
@@ -6,6 +6,7 @@ | |||
<ItemGroup> | |||
<ProjectReference Include="..\BPASmartClient.Device\BPASmartClient.Device.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.GSIceCream\BPASmartClient.GSIceCream.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.Lebai\BPASmartClient.Lebai.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.Model\BPASmartClient.Model.csproj" /> | |||
</ItemGroup> | |||
@@ -1,13 +1,19 @@ | |||
using BPASmartClient.Device; | |||
using BPA.Message.Enum; | |||
using BPASmartClient.Device; | |||
using BPASmartClient.EventBus; | |||
using BPASmartClient.GSIceCream; | |||
using BPASmartClient.Lebai; | |||
using BPASmartClient.Message; | |||
using BPASmartClient.Model; | |||
using BPASmartClient.Model.冰淇淋.Enum; | |||
using BPASmartClient.Model.单片机; | |||
using BPASmartClient.Model.单片机.Enum; | |||
using BPASmartClient.Peripheral; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading; | |||
using System.Threading.Tasks; | |||
using static BPASmartClient.EventBus.EventBus; | |||
@@ -20,7 +26,6 @@ namespace BPASmartClient.MorkT | |||
GLV_MorkT morkT = new GLV_MorkT(); | |||
public override void DoMain() | |||
{ | |||
ServerInit(); | |||
@@ -30,7 +35,7 @@ namespace BPASmartClient.MorkT | |||
if (morkT.MakeCoffeeOrder != null) | |||
morkT.MakeCoffeeOrder.OrderStatus = 1; | |||
}); | |||
MessageLog.GetInstance.Show("MORKF 设备初始化完成"); | |||
MessageLog.GetInstance.Show("MORKT 设备初始化完成"); | |||
} | |||
public override void ResetProgram() | |||
@@ -41,6 +46,12 @@ namespace BPASmartClient.MorkT | |||
public override void MainTask() | |||
{ | |||
MakeCoffeeProcess(); | |||
if(!LebaiRobot.GetInstance.GetInput())//取餐口有空余位置 | |||
{ | |||
MakeIceCreamProcess(); | |||
MakeCoffeeComplete(); | |||
} | |||
} | |||
public override void ReadData() | |||
@@ -121,8 +132,10 @@ namespace BPASmartClient.MorkT | |||
{ | |||
SuborderId = order.MorkOrder.SuborderId, | |||
BatchingId = res.BatchingId, | |||
Loc = loc_Goods | |||
}); | |||
Loc = loc_Goods, | |||
GoodsName = order.MorkOrder.GoodsName, | |||
SortNum = order.MorkOrder.SortNum | |||
}) ; | |||
} | |||
break; | |||
case GOODS_TYPE.ICECREAM: | |||
@@ -132,7 +145,9 @@ namespace BPASmartClient.MorkT | |||
{ | |||
SuborderId = order.MorkOrder.SuborderId, | |||
BatchingId = res.BatchingId, | |||
Loc = loc_Goods | |||
Loc = loc_Goods, | |||
GoodsName = order.MorkOrder.GoodsName, | |||
SortNum = order.MorkOrder.SortNum | |||
}); | |||
} | |||
break; | |||
@@ -157,8 +172,307 @@ namespace BPASmartClient.MorkT | |||
return morkT.batchings[batchingLoc].GoodsType; | |||
return GOODS_TYPE.NEITHER; | |||
} | |||
private void OrderChange(string subid, ORDER_STATUS oRDER_STATUS) | |||
{ | |||
EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent() { Status = oRDER_STATUS, SubOrderId = subid, deviceClientType = DeviceType }); | |||
} | |||
private void Wait(int value = 101) | |||
{ | |||
while (!(morkT.lebai.Ok && morkT.lebai.Value == value)) | |||
{ | |||
Thread.Sleep(5); | |||
} | |||
} | |||
/// <summary> | |||
/// 是否可以开始制作咖啡 | |||
/// </summary> | |||
/// <returns></returns> | |||
private bool CoffeeCanMake() | |||
{ | |||
bool canMake = (IsHealth && morkT.morkOrderPushesCoffee.Count > 0 && !morkT.IsCoffeeMake) ? true : false; | |||
return canMake; | |||
} | |||
/// <summary> | |||
/// 制作咖啡流程 | |||
/// </summary> | |||
private void MakeCoffeeProcess() | |||
{ | |||
if(CoffeeCanMake()) | |||
{ | |||
if(morkT.morkOrderPushesCoffee.TryDequeue(out OrderLocInfo orderLoc)) | |||
{ | |||
DeviceProcessLogShow($"开始制作 [咖啡] 订单[{orderLoc.SortNum}]"); | |||
GetAndCheeckCoffe(orderLoc); | |||
LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_接咖啡后回原点);//把咖啡杯放到咖啡机机的位置后回原点 | |||
Wait(); | |||
LebaiRobot.GetInstance.SetValue(1); | |||
new DRCoffee_MakeCoffeeEvent() { DrinkCode = (Model.咖啡机.Enum.DrCoffeeDrinksCode)int.Parse(orderLoc.Loc) }.Publish(); //接咖啡控制 | |||
DeviceProcessLogShow($"发送咖啡机制作{orderLoc.Loc}!"); | |||
morkT.IsCoffeeMake = true; morkT.MakeCoffeeOrder = orderLoc; | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 咖啡机制作完咖啡,取走并放到取餐口,最后回原点 | |||
/// </summary> | |||
private void MakeCoffeeComplete() | |||
{ | |||
if (morkT.IsCoffeeMake&&IsHealth) | |||
{ | |||
if (morkT.MakeCoffeeOrder != null && morkT.MakeCoffeeOrder.OrderStatus == 1) | |||
{ | |||
DeviceProcessLogShow($"将咖啡移动到取餐位 [咖啡] 订单[{morkT.MakeCoffeeOrder.SortNum}]"); | |||
DoCoffeeQC(morkT.MakeCoffeeOrder); | |||
morkT.MakeCoffeeOrder = null; | |||
morkT.IsCoffeeMake = false; | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 将咖啡杯从咖啡机 取走到 取餐口 | |||
/// </summary> | |||
private void DoCoffeeQC(OrderLocInfo order) | |||
{ | |||
LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_取咖啡出餐); | |||
Wait(); | |||
LebaiRobot.GetInstance.SetValue(1); | |||
//订单状态改变:完成 | |||
OrderChange(order.SuborderId, ORDER_STATUS.COMPLETED_COOK); | |||
DeviceProcessLogShow($"{order.GoodsName}等待取餐"); | |||
//WaitTakeMealOrder.Enqueue(order); | |||
} | |||
/// <summary> | |||
/// 取咖啡杯&&咖啡杯检测 若检测失败机器人回原点 | |||
/// </summary> | |||
/// <param name="order"></param> | |||
private void GetAndCheeckCoffe(OrderLocInfo order) | |||
{ | |||
LebaiRobot.GetInstance.SetValue(0); | |||
OrderChange(order.SuborderId, ORDER_STATUS.COOKING); | |||
LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_取咖啡杯); | |||
Wait(); | |||
new SCChip_TakeCupEvent() { Cup = IC_CUP.CUP_COFFEE }.Publish();//落碗控制 | |||
Thread.Sleep(500); | |||
DeviceProcessLogShow("尝试取咖啡杯!"); | |||
LebaiRobot.GetInstance.SetValue(1); | |||
int count = 2; | |||
p: | |||
LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_咖啡杯检测); | |||
Wait(); | |||
LebaiRobot.GetInstance.SetValue(1); | |||
if (!LebaiRobot.GetInstance.GetInput()) | |||
{ | |||
if (count >= 3) | |||
{ | |||
//退出循环回到初始位置 | |||
DeviceProcessLogShow($"执行{count}次取咖啡杯,仍为成功,订单默认废弃,机器人回到初始位置!"); | |||
LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_咖啡杯回原点); | |||
Wait(); | |||
LebaiRobot.GetInstance.SetValue(1); | |||
return; | |||
} | |||
DeviceProcessLogShow("执行二次取咖啡杯"); | |||
LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_二次取咖啡杯); | |||
Wait(); | |||
new SCChip_TakeCupEvent() { Cup = IC_CUP.CUP_COFFEE }.Publish();//落碗控制 | |||
LebaiRobot.GetInstance.SetValue(1); | |||
count++; | |||
goto p; | |||
} | |||
DeviceProcessLogShow("取咖啡杯完成"); | |||
} | |||
/// <summary> | |||
/// 冰淇淋是否可以开始制作 | |||
/// </summary> | |||
/// <returns></returns> | |||
private bool IceCreamCanMake() | |||
{ | |||
bool canMake = (IsHealth && morkT.morkOrderPushesIceCream.Count > 0) ? true : false; | |||
return canMake; | |||
} | |||
/// <summary> | |||
/// 制作冰淇淋流程 | |||
/// </summary> | |||
private void MakeIceCreamProcess() | |||
{ | |||
if(IceCreamCanMake()) | |||
{ | |||
if (MorkIStatus.GetInstance().CurrentMode != MORKI_MODE.制冷模式) new GSIceCream_ModeSetEvent() { Mode = MORKI_MODE.制冷模式 }.Publish(); | |||
if (MorkIStatus.GetInstance().CXB >= 86 && morkT.morkOrderPushesIceCream.Count > 0)//成型比大于86才可以制作 | |||
{ | |||
if (LebaiRobot.GetInstance.GetInput(3)) | |||
{ | |||
if (morkT.IceIsOK) DeviceProcessLogShow("请检查冰淇淋出料口有无遮挡"); | |||
morkT.IceIsOK = false; | |||
} | |||
else if (morkT.morkOrderPushesIceCream.TryDequeue(out OrderLocInfo order)) | |||
{ | |||
morkT.IceIsOK = true; | |||
DeviceProcessLogShow($"开始制作 [冰淇淋] 订单[{order.SortNum}]"); | |||
DoIceCream(order); | |||
} | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 做冰淇淋 | |||
/// </summary> | |||
private void DoIceCream(OrderLocInfo order) | |||
{ | |||
GetIceCreamCup(); | |||
CheckICeCreaCup(); | |||
GetIceCream(order); | |||
PutIceCream(order); | |||
} | |||
/// <summary> | |||
/// 取冰淇淋杯 | |||
/// </summary> | |||
private void GetIceCreamCup() | |||
{ | |||
LebaiRobot.GetInstance.SetValue(0); | |||
LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_取冰淇淋杯); | |||
Wait(); | |||
new SCChip_TakeCupEvent() { Cup = IC_CUP.CUP_ICECREAM }.Publish();//落碗控制 | |||
Thread.Sleep(500); | |||
DeviceProcessLogShow("尝试取冰淇淋杯!"); | |||
} | |||
/// <summary> | |||
/// 冰淇淋杯检测,失败后机器人回到原点 | |||
/// </summary> | |||
private void CheckICeCreaCup() | |||
{ | |||
int count = 2; | |||
LebaiRobot.GetInstance.SetValue(1); | |||
p: | |||
LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_冰淇淋杯检测); | |||
Wait(); | |||
LebaiRobot.GetInstance.SetValue(1); | |||
if (!LebaiRobot.GetInstance.GetInput()) | |||
{ | |||
if (count >= 3) | |||
{ | |||
//退出循环回到初始位置 | |||
DeviceProcessLogShow($"执行{count}次取冰淇淋杯,仍未成功,订单默认废弃,机器人回到初始位置!"); | |||
LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_冰淇淋杯回原点); | |||
Wait(); | |||
LebaiRobot.GetInstance.SetValue(1); | |||
return; | |||
} | |||
DeviceProcessLogShow($"执行{count}次取冰淇淋杯!"); | |||
LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_二次取冰淇淋杯); | |||
new SCChip_TakeCupEvent() { Cup = IC_CUP.CUP_ICECREAM }.Publish();//落碗控制 | |||
Wait(); | |||
LebaiRobot.GetInstance.SetValue(1); | |||
count++; | |||
goto p; | |||
} | |||
DeviceProcessLogShow("冰淇淋杯检测完成"); | |||
} | |||
/// <summary> | |||
/// 机器人取接冰淇淋 | |||
/// </summary> | |||
/// <param name="order"></param> | |||
private void GetIceCream(OrderLocInfo order) | |||
{ | |||
//制冷模式 | |||
new GSIceCream_ModeSetEvent() { Mode = MORKI_MODE.制冷模式 }.Publish(); | |||
LebaiRobot.GetInstance.SetValue(0); | |||
OrderChange(order.SuborderId, ORDER_STATUS.COOKING); | |||
LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_接1号冰淇淋); | |||
Wait(); | |||
bool doItResult = true; | |||
//出料 | |||
new GSIceCream_DischargeEvent().Publish(delegate (object[] args) | |||
{ | |||
doItResult = (bool)args[0]; | |||
}); | |||
if (doItResult) | |||
{ | |||
IceCreamCookCheck(); | |||
} | |||
else | |||
{ | |||
int count_1 = 0; | |||
while (MorkIStatus.GetInstance().CXB <= 86) | |||
{ | |||
Thread.Sleep(5); | |||
count_1++; | |||
if (count_1 >= 2000) | |||
break; | |||
} | |||
IceCreamCookCheck(); | |||
} | |||
LebaiRobot.GetInstance.SetValue(1); | |||
} | |||
/// <summary> | |||
/// 把冰淇淋放到取餐位后回原点 | |||
/// </summary> | |||
/// <param name="order"></param> | |||
private void PutIceCream(OrderLocInfo order) | |||
{ | |||
while (LebaiRobot.GetInstance.GetInput()) | |||
{ | |||
Thread.Sleep(500); | |||
} | |||
LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_放冰淇淋位置); | |||
Wait(); | |||
LebaiRobot.GetInstance.SetValue(1); | |||
//订单状态改变:完成 | |||
OrderChange(order.SuborderId, ORDER_STATUS.COMPLETED_COOK); | |||
DeviceProcessLogShow($"{order.GoodsName}等待取餐"); | |||
//WaitTakeMealOrder.Enqueue(order); | |||
} | |||
/// <summary> | |||
/// 冰淇淋机器制作冰淇淋 | |||
/// </summary> | |||
public void IceCreamCookCheck() | |||
{ | |||
int retry = 3; | |||
DateTime beginTime = DateTime.Now; | |||
while (!LebaiRobot.GetInstance.GetInput(3)) | |||
{ | |||
if (retry <= 0 && DateTime.Now.Subtract(beginTime).TotalSeconds >= 10) | |||
{ | |||
DeviceProcessLogShow("超时未出料,重试次数用尽"); | |||
break; | |||
} | |||
if (DateTime.Now.Subtract(beginTime).TotalSeconds > 5) | |||
{ | |||
DeviceProcessLogShow("超时未出料,重新发送打料指令"); | |||
new GSIceCream_ModeSetEvent() { Mode = MORKI_MODE.打料 }.Publish(); | |||
beginTime = DateTime.Now; | |||
retry--; | |||
} | |||
Thread.Sleep(10); | |||
} | |||
DeviceProcessLogShow("开始等待6s"); | |||
Thread.Sleep(5000); | |||
} | |||
} | |||
} |
@@ -33,5 +33,14 @@ namespace BPASmartClient.MorkT | |||
/// 获取乐百机器人的数据 | |||
/// </summary> | |||
public SignalResult lebai = new SignalResult(); | |||
/// <summary> | |||
/// 咖啡机位置是否有咖啡在制作中 | |||
/// </summary> | |||
public bool IsCoffeeMake = false; | |||
/// <summary> | |||
/// 冰淇淋机器出料口传感器检测 | |||
/// </summary> | |||
public bool IceIsOK = true; | |||
} | |||
} |
@@ -9,11 +9,14 @@ namespace BPASmartClient.MorkT | |||
public class OrderLocInfo | |||
{ | |||
public string SuborderId { get; set; } | |||
public string GoodsName { get; set; } | |||
public string Loc { get; set; } | |||
public ushort RecipeNumber { get; set; } | |||
public int SortNum { get; set; } | |||
public int BatchingId { get; set; } | |||
public int OrderStatus { get; set; } | |||
public OrderLocInfo() | |||
{ | |||
OrderStatus = 0; | |||
@@ -0,0 +1,35 @@ | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.ViewModel | |||
{ | |||
public class AdminstratorsViewModel:ObservableObject | |||
{ | |||
public string Admin { get { return _admin; } set { _admin = value; OnPropertyChanged(); } } | |||
private string _admin; | |||
public string Password { get { return _password; } set { _password = value; OnPropertyChanged(); } } | |||
private string _password; | |||
public string ErrorMessage { get { return _errorMessage; } set { _errorMessage = value; OnPropertyChanged(); } } | |||
private string _errorMessage; | |||
public RelayCommand AdminLoginCommand { get; set; } | |||
public AdminstratorsViewModel() | |||
{ | |||
AdminLoginCommand = new RelayCommand(() => | |||
{ | |||
ActionManage.GetInstance.Send("Lonin"); | |||
}); | |||
} | |||
} | |||
} |
@@ -38,6 +38,12 @@ namespace BPASmartClient.ViewModel | |||
OnPropertyChanged("NetworkConnectState"); | |||
} | |||
} | |||
//状态隐藏 | |||
public Visibility VsMenuItem { get { return _vsMenuItem; } set { _vsMenuItem = value; OnPropertyChanged(); } } | |||
private Visibility _vsMenuItem; | |||
public RelayCommand LogoutCommand { get; set; } | |||
/// <summary> | |||
/// 是否告警 | |||
/// </summary> | |||
@@ -74,6 +80,16 @@ namespace BPASmartClient.ViewModel | |||
}; | |||
dispatcherTimer.Interval = TimeSpan.FromSeconds(1); | |||
dispatcherTimer.Start(); | |||
ActionManage.GetInstance.Register(new Action(() => | |||
{ | |||
VsMenuItem = Visibility.Hidden; | |||
}),"Lonin"); | |||
LogoutCommand = new RelayCommand(() => | |||
{ | |||
VsMenuItem = Visibility.Visible; | |||
}); | |||
} | |||
} | |||
@@ -3,7 +3,7 @@ | |||
<appSettings> | |||
<!--通用配置--> | |||
<!--1:且时且多冰淇淋咖啡机,2:且时且多煮面机,3:海科煮面机测试店铺--> | |||
<add key="ClientId" value="46"/> | |||
<add key="ClientId" value="777"/> | |||
<!--<add key="ApolloUri" value="http://10.2.1.21:28080"/> | |||
<add key="OrderServiceUri" value="http://10.2.1.26:21527/order/"/> | |||
<add key="StockServiceUri" value="http://10.2.1.26:21527/stock/"/>--> | |||
@@ -0,0 +1,84 @@ | |||
<UserControl x:Class="BPASmartClient.Control.AdminstratorsView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.Control" | |||
xmlns:uc="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:helper ="clr-namespace:BPASmartClient.Control.Helper" | |||
xmlns:vm ="clr-namespace:BPASmartClient.ViewModel;assembly=BPASmartClient.ViewModel" | |||
mc:Ignorable="d" | |||
d:DesignHeight="600" d:DesignWidth="800" Loaded="UserControl_Loaded"> | |||
<UserControl.DataContext> | |||
<vm:AdminstratorsViewModel/> | |||
</UserControl.DataContext> | |||
<UserControl.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> | |||
</UserControl.Resources> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="7*"/> | |||
<ColumnDefinition Width="10*"/> | |||
</Grid.ColumnDefinitions> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="10*"/> | |||
<RowDefinition Height="5*"/> | |||
<RowDefinition Height="4*"/> | |||
<RowDefinition Height="8*"/> | |||
<RowDefinition Height="20*"/> | |||
</Grid.RowDefinitions> | |||
<TextBlock Text="账号:" | |||
VerticalAlignment="Bottom" HorizontalAlignment="Right" | |||
Margin="20" | |||
Style="{StaticResource TxLogin}" | |||
/> | |||
<TextBlock Text="密码:" Grid.Row="1" | |||
VerticalAlignment="Top" HorizontalAlignment="Right" | |||
Margin="20" | |||
Style="{StaticResource TxLogin}"/> | |||
<TextBox x:Name="tbx_admin" Grid.Row="0" Grid.Column="1" | |||
Text="{Binding Admin, Mode=TwoWay}" | |||
Foreground="#F8F8FF" FontSize="20" | |||
Width="180" Height="28" | |||
VerticalAlignment="Bottom" HorizontalAlignment="Left" | |||
VerticalContentAlignment="Top" HorizontalContentAlignment="Center" | |||
Margin="20" | |||
Background="Transparent" | |||
BorderBrush="White" BorderThickness="0,0,0,1" | |||
GotFocus="TextBox_GotFocus"> | |||
</TextBox> | |||
<PasswordBox x:Name="password" Grid.Row="1" Grid.Column="1" | |||
FontSize="20" Foreground="#F8F8FF" | |||
Width="180" Margin="20" | |||
Background="Transparent" | |||
VerticalAlignment="Top" HorizontalAlignment="Left" | |||
VerticalContentAlignment="Top" HorizontalContentAlignment="Center" | |||
BorderBrush="White" BorderThickness="0,0,0,1" CaretBrush="White" | |||
helper:PasswordBoxHelper.PasswordContent="{Binding Password ,Mode=TwoWay}" | |||
GotFocus="Password_GotFocus"/> | |||
<TextBlock Text="{Binding ErrorMessage}" | |||
Grid.Row="2" Grid.ColumnSpan="2" | |||
VerticalAlignment="Top" HorizontalAlignment="Center" | |||
FontFamily="楷体" | |||
FontSize="16" | |||
Foreground="#FFE2415C" | |||
TextWrapping="Wrap" /> | |||
<Button Grid.Row="3" Grid.ColumnSpan="2" | |||
FontSize="28" Foreground="#9934F7F7" | |||
Width="120" Height="40" | |||
Background="Transparent" | |||
VerticalAlignment="Top" | |||
BorderBrush="#ff19b7ec" BorderThickness="2" | |||
Content="登 录" | |||
Command="{Binding AdminLoginCommand}" IsDefault="True"/> | |||
<uc:UserKeyBoard x:Name="myKeyboard" Grid.Row="4" Grid.ColumnSpan="2" Margin="100,10,100,50" Focusable="False"/> | |||
</Grid> | |||
</UserControl> |
@@ -0,0 +1,91 @@ | |||
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; | |||
using static BPASmartClient.CustomResource.UserControls.UserKeyBoard; | |||
namespace BPASmartClient.Control | |||
{ | |||
/// <summary> | |||
/// AdministratorsView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class AdminstratorsView : UserControl | |||
{ | |||
public AdminstratorsView() | |||
{ | |||
InitializeComponent(); | |||
} | |||
private void UserControl_Loaded(object sender, RoutedEventArgs e) | |||
{ | |||
this.tbx_admin.Focus(); | |||
} | |||
private void MyKeyDown_Admin(object _key) | |||
{ | |||
EKeyitem key = EKeyitem.A; | |||
if (_key.GetType() == typeof(EKeyitem)) key = (EKeyitem)_key; | |||
switch(key) | |||
{ | |||
case EKeyitem.DEL: | |||
if (tbx_admin.Text.Length > 0) | |||
{ | |||
tbx_admin.Text = tbx_admin.Text.Substring(0, tbx_admin.Text.Length - 1); | |||
} | |||
break; | |||
case EKeyitem.AC: | |||
tbx_admin.Text = string.Empty; | |||
break; | |||
case EKeyitem.OK: | |||
break; | |||
default: | |||
tbx_admin.Text += _key.ToString(); | |||
break; | |||
} | |||
this.tbx_admin.Focus(); | |||
} | |||
private void MyKeyDown_Password(object _key) | |||
{ | |||
EKeyitem key = EKeyitem.A; | |||
if (_key.GetType() == typeof(EKeyitem)) key = (EKeyitem)_key; | |||
switch (key) | |||
{ | |||
case EKeyitem.DEL: | |||
if (password.Password.Length > 0) | |||
{ | |||
password.Password = password.Password.Substring(0, password.Password.Length - 1); | |||
} | |||
break; | |||
case EKeyitem.AC: | |||
password.Password = string.Empty; | |||
break; | |||
case EKeyitem.OK: | |||
break; | |||
default: | |||
password.Password += _key.ToString(); | |||
break; | |||
} | |||
} | |||
private void TextBox_GotFocus(object sender, RoutedEventArgs e) | |||
{ | |||
myKeyboard.MyKeyDown = MyKeyDown_Admin; | |||
} | |||
private void Password_GotFocus(object sender, RoutedEventArgs e) | |||
{ | |||
myKeyboard.MyKeyDown = MyKeyDown_Password; | |||
} | |||
} | |||
} |
@@ -0,0 +1,40 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using System.Windows.Controls; | |||
namespace BPASmartClient.Control.Helper | |||
{ | |||
/// <summary> | |||
/// 为PasswordBox控件的Password增加绑定功能 | |||
/// </summary> | |||
public static class PasswordBoxHelper | |||
{ | |||
public static string GetPasswordContent(DependencyObject obj) => (string)obj.GetValue(PasswordContentProperty); | |||
public static void SetPasswordContent(DependencyObject obj, string value) => obj.SetValue(PasswordContentProperty, value); | |||
public static readonly DependencyProperty PasswordContentProperty = | |||
DependencyProperty.RegisterAttached("PasswordContent", typeof(string), typeof(PasswordBoxHelper), | |||
new PropertyMetadata(string.Empty, OnPasswordContentPropertyChanged)); | |||
private static void OnPasswordContentPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) | |||
{ | |||
var box = d as PasswordBox; | |||
box.PasswordChanged -= OnPasswordChanged; | |||
var password = (string)e.NewValue; | |||
if (box != null && box.Password != password) | |||
box.Password = password; | |||
box.PasswordChanged += OnPasswordChanged; | |||
} | |||
private static void OnPasswordChanged(object sender, RoutedEventArgs e) | |||
{ | |||
var box = sender as PasswordBox; | |||
SetPasswordContent(box, box.Password); | |||
} | |||
} | |||
} |
@@ -50,7 +50,7 @@ | |||
Margin="20,0,0,0" | |||
VerticalAlignment="Center" | |||
Style="{DynamicResource imagetop_Title}" /> | |||
<Grid Grid.Column="1"> | |||
<Grid Grid.Column="1" Visibility="{Binding VsMenuItem}" > | |||
<Menu> | |||
<MenuItem Header="功能列表"> | |||
<MenuItem | |||
@@ -271,6 +271,29 @@ | |||
Foreground="#feffff"> | |||
日志监控界面 | |||
</TextBlock> | |||
<Button | |||
Name="login" | |||
Grid.Row="0" | |||
Width="45" | |||
Margin="0,0,60,0" | |||
HorizontalAlignment="Right" | |||
VerticalAlignment="Top" | |||
Click="Button_Login" | |||
Content="登录" | |||
Cursor="Hand" | |||
Style="{DynamicResource CommonBtn_返回}" /> | |||
<Button | |||
Name="logout" | |||
Grid.Row="0" | |||
Width="45" | |||
Margin="350,0,0,0" | |||
HorizontalAlignment="Right" | |||
VerticalAlignment="Top" | |||
Click="Button_LogOut" | |||
Content="注销" | |||
Cursor="Hand" | |||
Style="{DynamicResource CommonBtn_返回}" | |||
Command="{Binding LogoutCommand}"/> | |||
</Grid> | |||
<!--#region 底部窗体栏--> | |||
@@ -1,5 +1,6 @@ | |||
using BPA.Message; | |||
using BPASmartClient.Business; | |||
using BPASmartClient.Control; | |||
using BPASmartClient.CustomResource.UserControls; | |||
using BPASmartClient.CustomResource.UserControls.MessageShow; | |||
using BPASmartClient.Device; | |||
@@ -196,5 +197,28 @@ namespace BPASmartClient | |||
{ | |||
ActionManage.GetInstance.Send("InitDevice"); | |||
} | |||
private void Button_Login(object sender, RoutedEventArgs e) | |||
{ | |||
try | |||
{ | |||
Type type = Type.GetType($"BPASmartClient.Control.AdminstratorsView"); | |||
if (type == null) { MenuClick((sender as MenuItem).Tag?.ToString()); return; } | |||
ConstructorInfo cti = type.GetConstructor(System.Type.EmptyTypes); | |||
contentRegion.Content = (FrameworkElement)cti.Invoke(null); | |||
Title.Text = "管理员登录界面"; | |||
} | |||
catch (Exception ex) | |||
{ | |||
MessageLog.GetInstance.ShowEx($"BPASmartClient 中引发错误,MainWindow.xaml.cs 类MenuItem_Click(),描述:[{ex.Message}]"); | |||
} | |||
} | |||
private void Button_LogOut(object sender, RoutedEventArgs e) | |||
{ | |||
} | |||
} | |||
} |
@@ -1,28 +1,25 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Configuration; | |||
using System.Linq; | |||
using System.Threading; | |||
using BPA.Message; | |||
using Robotc; | |||
using System.Collections.Concurrent; | |||
using System.Diagnostics; | |||
using BPA.Message; | |||
using BPA.Message.Enum; | |||
using BPA.Message.IOT; | |||
using System.Threading.Tasks; | |||
using BPASmartClient.Device; | |||
using BPA.Message.Enum; | |||
using BPASmartClient.DRCoffee; | |||
using BPASmartClient.EventBus; | |||
using BPASmartClient.GSIceCream; | |||
using BPASmartClient.Helper; | |||
using BPASmartClient.Lebai; | |||
using BPASmartClient.EventBus; | |||
using BPASmartClient.Model.咖啡机.Enum; | |||
using BPASmartClient.Message; | |||
using BPASmartClient.Model; | |||
using BPASmartClient.Model.冰淇淋.Enum; | |||
using BPASmartClient.Model.单片机; | |||
using BPASmartClient.Model.单片机.Enum; | |||
using BPASmartClient.Model.咖啡机.Enum; | |||
using BPASmartClient.SCChip; | |||
using BPASmartClient.Model; | |||
using BPASmartClient.Model.单片机; | |||
using Robotc; | |||
using System; | |||
using System.Collections.Concurrent; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Threading; | |||
using static BPASmartClient.EventBus.EventBus; | |||
namespace BPASmartClient.MORKIC | |||
@@ -53,7 +50,7 @@ namespace BPASmartClient.MORKIC | |||
/// <summary> | |||
/// 咖啡位置是否有东西 | |||
/// </summary> | |||
private bool IsCoffeeMake=false; | |||
private bool IsCoffeeMake = false; | |||
private bool enableFunny = false; | |||
private DateTime lastRecvdOrder = DateTime.Now; | |||
@@ -79,41 +76,41 @@ namespace BPASmartClient.MORKIC | |||
/// <summary> | |||
/// 等待取餐的订单,只有一个 | |||
/// </summary> | |||
ConcurrentQueue<SimOrderData> WaitTakeMealOrder= new ConcurrentQueue<SimOrderData>(); | |||
ConcurrentQueue<SimOrderData> WaitTakeMealOrder = new ConcurrentQueue<SimOrderData>(); | |||
public void Init() | |||
{ | |||
ActionManage.GetInstance.Register(new Action<object>((s) => | |||
{ | |||
if (s is DrCoffeeDrinksCode cf) | |||
{ | |||
DoCoffee(new SimOrderData { Loc = ((int)cf).ToString() }); | |||
} | |||
else if (s is Dictionary<string, string> ms) | |||
{ | |||
if (ms.ContainsKey("Button")) | |||
{ | |||
switch (ms["Button"]) | |||
{ | |||
case "启动示教": | |||
LebaiRobot.GetInstance.StartTeachMode(); | |||
break; | |||
case "停止示教": | |||
LebaiRobot.GetInstance.EndtTeachMode(); | |||
break; | |||
case "启动机器人": | |||
LebaiRobot.GetInstance.StartRobot(); | |||
break; | |||
case "急停": | |||
LebaiRobot.GetInstance.EStopRobot(); | |||
break; | |||
default: | |||
break; | |||
} | |||
} | |||
} | |||
}),"SimCoffee"); | |||
ActionManage.GetInstance.Register(new Action<object>((s) => | |||
{ | |||
if (s is DrCoffeeDrinksCode cf) | |||
{ | |||
DoCoffee(new SimOrderData { Loc = ((int)cf).ToString() }); | |||
} | |||
else if (s is Dictionary<string, string> ms) | |||
{ | |||
if (ms.ContainsKey("Button")) | |||
{ | |||
switch (ms["Button"]) | |||
{ | |||
case "启动示教": | |||
LebaiRobot.GetInstance.StartTeachMode(); | |||
break; | |||
case "停止示教": | |||
LebaiRobot.GetInstance.EndtTeachMode(); | |||
break; | |||
case "启动机器人": | |||
LebaiRobot.GetInstance.StartRobot(); | |||
break; | |||
case "急停": | |||
LebaiRobot.GetInstance.EStopRobot(); | |||
break; | |||
default: | |||
break; | |||
} | |||
} | |||
} | |||
}), "SimCoffee"); | |||
//构建所有商品物料信息 | |||
batchings = PolymerBatching.BuildAll(); | |||
@@ -162,13 +159,13 @@ namespace BPASmartClient.MORKIC | |||
{ | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
while (IsHealth &&(morkOrderPushesCoffee.Count > 0 || morkOrderPushesIceCream.Count>0 || IsCoffeeMake)) | |||
while (IsHealth && (morkOrderPushesCoffee.Count > 0 || morkOrderPushesIceCream.Count > 0 || IsCoffeeMake)) | |||
{ | |||
working = true; NoOrderTime = 0; | |||
//1.有咖啡订单 取杯去制作 | |||
if (!IsCoffeeMake)//位置无杯子 | |||
{ | |||
if (morkOrderPushesCoffee.Count>0 && morkOrderPushesCoffee.TryDequeue(out SimOrderData simOrder)) | |||
if (morkOrderPushesCoffee.Count > 0 && morkOrderPushesCoffee.TryDequeue(out SimOrderData simOrder)) | |||
{ | |||
IsCoffeeMake = true; MakeCoffeeOrder = simOrder; | |||
MessageLog.GetInstance.Show($"开始制作 [咖啡] 订单[{simOrder.morkOrder.SortNum}]"); | |||
@@ -180,20 +177,20 @@ namespace BPASmartClient.MORKIC | |||
{ | |||
//取餐位的订单完成 | |||
if (WaitTakeMealOrder.TryDequeue(out SimOrderData waitOrder)) OrderChange(waitOrder.morkOrder.SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); | |||
//1.制作冰淇淋 | |||
if (morkOrderPushesIceCream.Count>0 && MorkIStatus.GetInstance().CurrentMode!= MORKI_MODE.制冷模式) new GSIceCream_ModeSetEvent() { Mode = MORKI_MODE.制冷模式 }.Publish(); | |||
if (morkOrderPushesIceCream.Count > 0 && MorkIStatus.GetInstance().CurrentMode != MORKI_MODE.制冷模式) new GSIceCream_ModeSetEvent() { Mode = MORKI_MODE.制冷模式 }.Publish(); | |||
if (MorkIStatus.GetInstance().CXB >= 86 && morkOrderPushesIceCream.Count > 0)//成型比大于80 我才会制作 | |||
{ | |||
if (LebaiRobot.GetInstance.GetInput(3)) | |||
{ | |||
if(IceIsOK) MessageLog.GetInstance.Show("请擦拭冰淇淋机出口"); | |||
if (IceIsOK) MessageLog.GetInstance.Show("请擦拭冰淇淋机出口"); | |||
IceIsOK = false; | |||
} | |||
else if(morkOrderPushesIceCream.TryDequeue(out SimOrderData order)) | |||
else if (morkOrderPushesIceCream.TryDequeue(out SimOrderData order)) | |||
{ | |||
IceIsOK = true; | |||
MessageLog.GetInstance.Show($"开始制作 [冰淇淋] 订单[{order.morkOrder.SortNum}]"); | |||
@@ -216,7 +213,7 @@ namespace BPASmartClient.MORKIC | |||
working = false; | |||
lastRecvdOrder = DateTime.Now; | |||
} | |||
if (IsHealth == false && (morkOrderPushesCoffee.Count > 0 || morkOrderPushesIceCream.Count > 0 || IsCoffeeMake)) | |||
{ | |||
MessageLog.GetInstance.Show($"机器连接问题 订单,不允许制作,请检查设备连接后尝试," + | |||
@@ -237,8 +234,8 @@ namespace BPASmartClient.MORKIC | |||
} | |||
Thread.Sleep(1000); | |||
}),"订单制作"); | |||
Thread.Sleep(1000); | |||
}), "订单制作"); | |||
} | |||
private void OrderChange(string subid, ORDER_STATUS oRDER_STATUS) | |||
@@ -273,7 +270,7 @@ namespace BPASmartClient.MORKIC | |||
} | |||
//LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_欢迎); | |||
}), "MORK-IC欢迎"); | |||
} | |||
public void DataParse<T>(T order) | |||
@@ -313,10 +310,10 @@ namespace BPASmartClient.MORKIC | |||
switch (currentGoodsType) | |||
{ | |||
case GOODS_TYPE.COFFEE: | |||
morkOrderPushesCoffee.Enqueue(new SimOrderData { Loc = loc_coffe,morkOrder = morkOrderPush }); | |||
morkOrderPushesCoffee.Enqueue(new SimOrderData { Loc = loc_coffe, morkOrder = morkOrderPush }); | |||
break; | |||
case GOODS_TYPE.ICECREAM: | |||
morkOrderPushesIceCream.Enqueue(new SimOrderData { Loc = loc_coffe,morkOrder = morkOrderPush }); | |||
morkOrderPushesIceCream.Enqueue(new SimOrderData { Loc = loc_coffe, morkOrder = morkOrderPush }); | |||
break; | |||
case GOODS_TYPE.NEITHER: | |||
MessageLog.GetInstance.Show("未知的商品类型"); | |||
@@ -356,7 +353,7 @@ namespace BPASmartClient.MORKIC | |||
int checkeNum = 0; | |||
// are.Reset(); | |||
LebaiRobot.GetInstance.SetValue(0); | |||
OrderChange(order.morkOrder.SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||
OrderChange(order.morkOrder.SuborderId, ORDER_STATUS.COOKING); | |||
//SimpleFactory.GetInstance.OrderChanged(order.morkOrder.SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||
LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_取咖啡杯); | |||
Wait(); | |||
@@ -370,19 +367,19 @@ namespace BPASmartClient.MORKIC | |||
LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_咖啡杯检测); | |||
Wait(); | |||
LebaiRobot.GetInstance.SetValue(1); | |||
if (!LebaiRobot.GetInstance.GetInput()) | |||
{ | |||
if (count >= 3) | |||
{ | |||
//退出循环回到初始位置 | |||
MessageLog.GetInstance.Show($"执行{count}次取咖啡杯,仍为成功,订单默认废弃,机器人回到初始位置!"); | |||
DeviceProcessLogShow($"执行{count}次取咖啡杯,仍为成功,订单默认废弃,机器人回到初始位置!"); | |||
LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_咖啡杯回原点); | |||
Wait(); | |||
LebaiRobot.GetInstance.SetValue(1); | |||
return; | |||
} | |||
MessageLog.GetInstance.Show("执行二次取咖啡杯"); | |||
DeviceProcessLogShow("执行二次取咖啡杯"); | |||
LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_二次取咖啡杯); | |||
Wait(); | |||
new SCChip_TakeCupEvent() { Cup = IC_CUP.CUP_COFFEE }.Publish();//落碗控制 | |||
@@ -391,13 +388,13 @@ namespace BPASmartClient.MORKIC | |||
goto p; | |||
} | |||
MessageLog.GetInstance.Show("咖啡杯取杯完成"); | |||
LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_接咖啡_新); | |||
DeviceProcessLogShow("咖啡杯取杯完成"); | |||
LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_接咖啡后回原点); | |||
Wait(); | |||
LebaiRobot.GetInstance.SetValue(1); | |||
//加场景 回初始位置 | |||
new DRCoffee_MakeCoffeeEvent() { DrinkCode = (Model.咖啡机.Enum.DrCoffeeDrinksCode)int.Parse(order.Loc) }.Publish(); //接咖啡控制 | |||
MessageLog.GetInstance.Show($"发送咖啡机制作{order.Loc}!"); | |||
DeviceProcessLogShow($"发送咖啡机制作{order.Loc}!"); | |||
#endregion | |||
} | |||
@@ -413,7 +410,7 @@ namespace BPASmartClient.MORKIC | |||
//订单状态改变:完成 | |||
OrderChange(order.morkOrder.SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_COOK); | |||
//SimpleFactory.GetInstance.OrderChanged(order.morkOrder.SuborderId,BPA.Message.Enum.ORDER_STATUS.COMPLETED_COOK); | |||
MessageLog.GetInstance.Show($"{order.morkOrder.GoodsName}等待取餐"); | |||
DeviceProcessLogShow($"{order.morkOrder.GoodsName}等待取餐"); | |||
WaitTakeMealOrder.Enqueue(order); | |||
} | |||
@@ -427,7 +424,7 @@ namespace BPASmartClient.MORKIC | |||
// MessageLog.GetInstance.Show("请擦拭冰淇淋机出口"); | |||
// return; | |||
//} | |||
#region 且时且多入场设备程序 | |||
int checkeNum = 0; | |||
//are.Reset(); | |||
@@ -443,7 +440,7 @@ namespace BPASmartClient.MORKIC | |||
p: | |||
LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_冰淇淋杯检测); | |||
Wait(); | |||
LebaiRobot.GetInstance.SetValue(1); | |||
if (!LebaiRobot.GetInstance.GetInput()) | |||
{ | |||
@@ -499,13 +496,13 @@ namespace BPASmartClient.MORKIC | |||
} | |||
LebaiRobot.GetInstance.SetValue(1); | |||
#endregion | |||
while (LebaiRobot.GetInstance.GetInput()) | |||
{ | |||
Thread.Sleep(500); | |||
} | |||
LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_放冰淇淋位置); | |||
Wait(); | |||
LebaiRobot.GetInstance.SetValue(1); | |||
//订单状态改变:完成 | |||
@@ -514,7 +511,7 @@ namespace BPASmartClient.MORKIC | |||
MessageLog.GetInstance.Show($"{order.morkOrder.GoodsName}等待取餐"); | |||
WaitTakeMealOrder.Enqueue(order); | |||
#endregion | |||
} | |||
/// <summary> | |||
@@ -568,7 +565,7 @@ namespace BPASmartClient.MORKIC | |||
public void SimOrder<T>(T simOrder) | |||
{ | |||
} | |||
/// <summary> | |||
@@ -603,7 +600,7 @@ namespace BPASmartClient.MORKIC | |||
public override void DoMain() | |||
{ | |||
} | |||
public override void Stop() | |||
@@ -641,7 +638,7 @@ namespace BPASmartClient.MORKIC | |||
public SimOrderData() | |||
{ | |||
id = Guid.NewGuid().ToString(); | |||
OrderStatus=0; | |||
OrderStatus = 0; | |||
} | |||
} | |||
} |