@@ -127,6 +127,22 @@ namespace BPASmartClient.Device | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 多设备分开写控制 | |||
/// </summary> | |||
/// <param name="address"></param> | |||
/// <param name="value"></param> | |||
public void WriteControlExact(string address, object value,int i) | |||
{ | |||
if (peripherals != null) | |||
{ | |||
if (peripherals.Count > i) | |||
{ | |||
peripherals.ElementAt(i).WriteData(address, value); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 设备过程日志显示 | |||
@@ -43,6 +43,8 @@ namespace BPASmartClient.MilkWithTea.View | |||
private void Button_Click(object sender, RoutedEventArgs e) | |||
{ | |||
this.Close(); | |||
} | |||
@@ -69,7 +71,7 @@ namespace BPASmartClient.MilkWithTea.View | |||
private bool IsMouseOverTarget(Visual target, GetPositionDelegate getPosition) | |||
{ | |||
Rect bounds = VisualTreeHelper.GetDescendantBounds(target); | |||
Point mousePos = getPosition((IInputElement)target); | |||
Point mousePos = getPosition((IInputElement)target); | |||
return bounds.Contains(mousePos); | |||
} | |||
@@ -0,0 +1,17 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<TargetFramework>net6.0-windows</TargetFramework> | |||
<Nullable>enable</Nullable> | |||
<UseWPF>true</UseWPF> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<Folder Include="ViewModel\" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\BPASmartClient.Device\BPASmartClient.Device.csproj" /> | |||
</ItemGroup> | |||
</Project> |
@@ -0,0 +1,8 @@ | |||
using System; | |||
namespace BPASmartClient.MorkBF | |||
{ | |||
public class Class1 | |||
{ | |||
} | |||
} |
@@ -0,0 +1,136 @@ | |||
using BPA.Message.Enum; | |||
using BPASmartClient.Device; | |||
using BPASmartClient.EventBus; | |||
using BPASmartClient.Helper; | |||
using BPASmartClient.Model; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading; | |||
using System.Threading.Tasks; | |||
using static BPASmartClient.EventBus.EventBus; | |||
namespace BPASmartClient.MorkBF | |||
{ | |||
public class Control_MorkBF : BaseDevice | |||
{ | |||
GVL_MorkBF morkBF = new GVL_MorkBF(); | |||
public override DeviceClientType DeviceType => DeviceClientType.MORKCS; | |||
public override void DoMain() | |||
{ | |||
CommandRegist();//调试 | |||
ServerInit(); | |||
DataParse();//数据解析 | |||
DeviceProcessLogShow("MORKF 设备初始化完成"); | |||
} | |||
private void DataParse() | |||
{ | |||
EventBus.EventBus.GetInstance().Subscribe<DoOrderEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBackHandle) | |||
{ | |||
if (@event == null) return; | |||
if (@event is DoOrderEvent order) | |||
{ | |||
if (order.MorkOrder.GoodBatchings == null) return; | |||
OrderCount++; | |||
DeviceProcessLogShow($"接收到{OrderCount}次订单"); | |||
} | |||
}); | |||
} | |||
private void ServerInit() | |||
{ | |||
//物料信息 | |||
EventBus.EventBus.GetInstance().Subscribe<MaterialDeliveryEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||
{ | |||
if (@event == null) return; | |||
if (@event is MaterialDeliveryEvent material) | |||
{ | |||
orderMaterialDelivery = material.orderMaterialDelivery; | |||
} | |||
}); | |||
//配方数据信息 | |||
EventBus.EventBus.GetInstance().Subscribe<RecipeBomEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||
{ | |||
if (@event == null) return; | |||
if (@event is RecipeBomEvent recipe) | |||
{ | |||
recipeBoms = recipe.recipeBoms; | |||
} | |||
}); | |||
} | |||
/// <summary> | |||
/// 调试 | |||
/// </summary> | |||
/// <exception cref="NotImplementedException"></exception> | |||
private void CommandRegist() | |||
{ | |||
} | |||
public override void MainTask() | |||
{ | |||
if(morkBF.FirePan1_Order.Count == 0&&!morkBF.FirePan1_Busy) | |||
{ | |||
ThreadManage.GetInstance().Start(FirePot1_Process, "炒锅1主进程"); | |||
} | |||
if (morkBF.FirePan2_Order.Count == 0 && !morkBF.FirePan2_Busy) | |||
{ | |||
ThreadManage.GetInstance().Start(FirePot2_Process, "炒锅2主进程"); | |||
} | |||
} | |||
private void FirePot1_Process() | |||
{ | |||
morkBF.FirePan1_Busy = true; | |||
morkBF.FirePan1_Date = DateTime.Now; | |||
while (morkBF.FirePan1_Date.AddMinutes(1)> DateTime.Now) | |||
{ | |||
Thread.Sleep(500); | |||
} | |||
ThreadManage.GetInstance().StopTask("炒锅1主进程"); | |||
} | |||
private void FirePot2_Process() | |||
{ | |||
morkBF.FirePan2_Busy = true; | |||
morkBF.FirePan2_Date = DateTime.Now; | |||
while (morkBF.FirePan2_Date.AddMinutes(1) > DateTime.Now) | |||
{ | |||
Thread.Sleep(500); | |||
} | |||
ThreadManage.GetInstance().StopTask("炒锅2主进程"); | |||
} | |||
public override void ReadData() | |||
{ | |||
} | |||
public override void ResetProgram() | |||
{ | |||
morkBF = null; | |||
morkBF = new GVL_MorkBF(); | |||
} | |||
public override void SimOrder() | |||
{ | |||
} | |||
public override void Stop() | |||
{ | |||
} | |||
} | |||
} |
@@ -0,0 +1,33 @@ | |||
using BPASmartClient.MorkBF.Model; | |||
using System; | |||
using System.Collections.Concurrent; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MorkBF | |||
{ | |||
internal class GVL_MorkBF | |||
{ | |||
/// <summary> | |||
/// 炒锅1订单队列 | |||
/// </summary> | |||
public ConcurrentQueue<BF_Food> FirePan1_Order { get; set; } = new ConcurrentQueue<BF_Food>(); | |||
/// <summary> | |||
/// 炒锅2订单队列 | |||
/// </summary> | |||
public ConcurrentQueue<BF_Food> FirePan2_Order { get; set; } = new ConcurrentQueue<BF_Food>(); | |||
/// <summary> | |||
/// 炒锅1忙碌 | |||
/// </summary> | |||
public bool FirePan1_Busy = false; | |||
/// <summary> | |||
/// 炒锅2忙碌 | |||
/// </summary> | |||
public bool FirePan2_Busy = false; | |||
public DateTime FirePan1_Date; | |||
public DateTime FirePan2_Date; | |||
} | |||
} |
@@ -0,0 +1,65 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MorkBF.Model | |||
{ | |||
public class BF_Food | |||
{ | |||
/// <summary> | |||
/// 菜品名称 | |||
/// </summary> | |||
public string FoodName { get; set; } | |||
/// <summary> | |||
/// 菜品ID | |||
/// </summary> | |||
public string FoodID { get; set; } | |||
} | |||
public class BF_PotAction | |||
{ | |||
/// <summary> | |||
/// 步骤 | |||
/// </summary> | |||
public int FryTime | |||
{ | |||
get; | |||
set; | |||
} | |||
/// <summary> | |||
/// 时间 | |||
/// </summary> | |||
public int During | |||
{ | |||
get; | |||
set; | |||
} | |||
/// <summary> | |||
/// 动作 | |||
/// </summary> | |||
public string Actions | |||
{ | |||
get; | |||
set; | |||
} | |||
/// <summary> | |||
/// 调料 | |||
/// </summary> | |||
public List<int> SeasoningLists | |||
{ | |||
get; | |||
set; | |||
} | |||
/// <summary> | |||
/// 菜品 | |||
/// </summary> | |||
public List<int> MaterialLists | |||
{ | |||
get; | |||
set; | |||
} | |||
} | |||
} |
@@ -0,0 +1,12 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MorkBF | |||
{ | |||
internal class OrderLocInfo | |||
{ | |||
} | |||
} |
@@ -0,0 +1,46 @@ | |||
<UserControl x:Class="BPASmartClient.MorkBF.VIew.DebugView" | |||
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.MorkBF.VIew" | |||
mc:Ignorable="d" | |||
d:DesignHeight="900" d:DesignWidth="1600"> | |||
<UserControl.Resources> | |||
<ResourceDictionary> | |||
<ResourceDictionary.MergedDictionaries> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" /> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" /> | |||
</ResourceDictionary.MergedDictionaries> | |||
</ResourceDictionary> | |||
</UserControl.Resources> | |||
<Grid> | |||
<GroupBox Header="本地菜品" FontSize="22"> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40"/> | |||
<RowDefinition Height="*"/> | |||
</Grid.RowDefinitions> | |||
<Button Content="添加新菜谱" Width="120" HorizontalAlignment="Right" Margin="20,0"/> | |||
<ListBox Grid.Row="1"> | |||
<ListBox.ItemTemplate> | |||
<DataTemplate> | |||
<Border> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="200"/> | |||
<ColumnDefinition Width="200"/> | |||
<ColumnDefinition Width="200"/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Text="{Binding FoodName}"/> | |||
<Button Grid.Column="1" Content="编辑" Command="EditFood"/> | |||
<Button Grid.Column="2" Content="删除" Command="EditFood"/> | |||
</Grid> | |||
</Border> | |||
</DataTemplate> | |||
</ListBox.ItemTemplate> | |||
</ListBox> | |||
</Grid> | |||
</GroupBox> | |||
</Grid> | |||
</UserControl> |
@@ -0,0 +1,28 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using System.Windows.Controls; | |||
using System.Windows.Data; | |||
using System.Windows.Documents; | |||
using System.Windows.Input; | |||
using System.Windows.Media; | |||
using System.Windows.Media.Imaging; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
namespace BPASmartClient.MorkBF.VIew | |||
{ | |||
/// <summary> | |||
/// DebugView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class DebugView : UserControl | |||
{ | |||
public DebugView() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,50 @@ | |||
<Window x:Class="BPASmartClient.MorkBF.VIew.FoodManagerView" | |||
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:BPASmartClient.MorkBF.VIew" | |||
mc:Ignorable="d" | |||
Title="FoodManagerView" Height="450" Width="800" WindowStartupLocation="CenterScreen" ResizeMode="NoResize" WindowStyle="None" AllowsTransparency="True" Background="Transparent"> | |||
<Window.Resources> | |||
<ResourceDictionary> | |||
<ResourceDictionary.MergedDictionaries> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" /> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" /> | |||
</ResourceDictionary.MergedDictionaries> | |||
</ResourceDictionary> | |||
</Window.Resources> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="50"/> | |||
<RowDefinition Height="*"/> | |||
</Grid.RowDefinitions> | |||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Height="45"> | |||
<TextBlock Text="菜品名称:" Margin="10,0"/> | |||
<TextBox Text="{Binding FoodName}" Width="160" Margin="10,0" FontSize="16"/> | |||
<Button Content="添加新步骤" Margin="10,0" Style="{StaticResource ButtonStyle}" Height="36" /> | |||
<Button Content="保存" Margin="10,0" Style="{StaticResource ButtonStyle}" Height="36" Width="80"/> | |||
<Button Content="退出" Margin="10,0" Style="{StaticResource ButtonStyle}" Height="36" Width="80"/> | |||
</StackPanel> | |||
<Grid Grid.Row="1"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="2*"/> | |||
<ColumnDefinition Width="*"/> | |||
</Grid.ColumnDefinitions> | |||
<ListBox > | |||
<ListBox.ItemTemplate> | |||
<DataTemplate> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="*"/> | |||
<ColumnDefinition Width="*"/> | |||
</Grid.ColumnDefinitions> | |||
<ComboBox /> | |||
<Button Content="删除"/> | |||
</Grid> | |||
</DataTemplate> | |||
</ListBox.ItemTemplate> | |||
</ListBox> | |||
</Grid> | |||
</Grid> | |||
</Window> |
@@ -0,0 +1,27 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using System.Windows.Controls; | |||
using System.Windows.Data; | |||
using System.Windows.Documents; | |||
using System.Windows.Input; | |||
using System.Windows.Media; | |||
using System.Windows.Media.Imaging; | |||
using System.Windows.Shapes; | |||
namespace BPASmartClient.MorkBF.VIew | |||
{ | |||
/// <summary> | |||
/// FoodManagerView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class FoodManagerView : Window | |||
{ | |||
public FoodManagerView() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -36,8 +36,6 @@ namespace BPASmartClient.MorkF | |||
{ | |||
#region 设备控制 | |||
ActionManage.GetInstance.Register(PLCInite, "InitCommand"); | |||
ActionManage.GetInstance.Register(FoodPlcInite, "FoodPlcInite"); | |||
ActionManage.GetInstance.Register(InitialData, "SimultaorOrder"); | |||
ActionManage.GetInstance.Register(StartOrder, "StartOrder"); | |||
ActionManage.GetInstance.Register(StartLocalOrder, "StartLocalOrder"); | |||
#endregion | |||
@@ -45,7 +43,6 @@ namespace BPASmartClient.MorkF | |||
#region 菜品库 | |||
ActionManage.GetInstance.Register(FoodLibInit, "FoodLibInit"); | |||
ActionManage.GetInstance.Register(Electromagnetism, "Electromagnetism"); | |||
ActionManage.GetInstance.Register(Electromagnetism, "Electromagnetism"); | |||
ActionManage.GetInstance.Register(GetDistance_1, "GetDistance_1"); | |||
ActionManage.GetInstance.Register(GetDistance_2, "GetDistance_2"); | |||
ActionManage.GetInstance.Register(GetDistance_3, "GetDistance_3"); | |||
@@ -78,38 +75,53 @@ namespace BPASmartClient.MorkF | |||
} | |||
#region 菜品库 | |||
/// <summary> | |||
/// 菜品库数据写入 | |||
/// </summary> | |||
/// <param name="address"></param> | |||
/// <param name="value"></param> | |||
private void MaterailLibrary_Write(string address,object value) | |||
{ | |||
WriteControlExact(address, value, 1); | |||
} | |||
/// <summary> | |||
/// 菜品库初始化 | |||
/// </summary> | |||
public void FoodLibInit() | |||
{ | |||
WriteControl("", true); | |||
MaterailLibrary_Write("", true); | |||
} | |||
/// <summary> | |||
/// 电磁阀启停 | |||
/// </summary> | |||
/// <param name="o"></param> | |||
public void Electromagnetism(object o) | |||
{ | |||
if (o == null) return; | |||
if (o is List<bool> bs && bs.Count == 1) | |||
{ | |||
WriteControl("", bs[0]); | |||
MaterailLibrary_Write("", bs[0]); | |||
} | |||
} | |||
public void GetDistance_1() | |||
{ | |||
WriteControl("", true); | |||
MaterailLibrary_Write("", true); | |||
} | |||
public void GetDistance_2() | |||
{ | |||
WriteControl("", true); | |||
MaterailLibrary_Write("", true); | |||
} | |||
public void GetDistance_3() | |||
{ | |||
WriteControl("", true); | |||
MaterailLibrary_Write("", true); | |||
} | |||
public void PawTurnFront() | |||
{ | |||
WriteControl("", true); | |||
MaterailLibrary_Write("", true); | |||
} | |||
public void PawTurnBack() | |||
{ | |||
WriteControl("", true); | |||
MaterailLibrary_Write("", true); | |||
} | |||
/// <summary> | |||
/// 设定机械臂的位置 | |||
@@ -118,10 +130,12 @@ namespace BPASmartClient.MorkF | |||
/// <param name="y"></param> | |||
public void SetArmPosition(int X, int y) | |||
{ | |||
WriteControl("", true); | |||
MaterailLibrary_Write("", true); | |||
} | |||
#endregion | |||
/// <summary> | |||
/// 出调料 | |||
/// </summary> | |||
@@ -131,9 +145,9 @@ namespace BPASmartClient.MorkF | |||
if (o == null) return; | |||
if (o is List<int> ints && ints.Count == 2) | |||
{ | |||
WriteControl(morkF.PassWayValue[ints[0]], (ushort)ints[1]);//写入通道值 | |||
FirePot1_Write(morkF.PassWayValue[ints[0]], (ushort)ints[1]);//写入通道值 | |||
Thread.Sleep(400); | |||
WriteControl(morkF.StartPassWay[ints[0]], true);//开启通道 | |||
FirePot1_Write(morkF.StartPassWay[ints[0]], true);//开启通道 | |||
Thread.Sleep(400); | |||
} | |||
} | |||
@@ -144,43 +158,51 @@ namespace BPASmartClient.MorkF | |||
{ | |||
foreach (SeasoningList seasoning in seasoningLists) | |||
{ | |||
WriteControl(morkF.PassWayValue[seasoning.Loc], (ushort)seasoning.Qty); | |||
FirePot1_Write(morkF.PassWayValue[seasoning.Loc], (ushort)seasoning.Qty); | |||
Thread.Sleep(300); | |||
} | |||
foreach (SeasoningList seasoning in seasoningLists) | |||
{ | |||
WriteControl(morkF.StartPassWay[seasoning.Loc], true); | |||
FirePot1_Write(morkF.StartPassWay[seasoning.Loc], true); | |||
Thread.Sleep(300); | |||
} | |||
} | |||
#region 炒锅1 | |||
private void FirePot1_Write(string address,object value) | |||
{ | |||
WriteControlExact(address, value, 0); | |||
} | |||
/// <summary> | |||
/// 复位 | |||
/// </summary> | |||
public void Plc1Reset() | |||
{ | |||
StopFire(); | |||
Thread.Sleep(200); | |||
StopStir(); | |||
Thread.Sleep(200); | |||
WriteControl("LB5", false); | |||
Thread.Sleep(200); | |||
WriteControl("LB3", false); | |||
Thread.Sleep(200); | |||
WriteControl("LB6", false); | |||
Thread.Sleep(200); | |||
WriteControl("LB7", false); | |||
Thread.Sleep(200); | |||
WriteControl("LB4", false); | |||
Thread.Sleep(200); | |||
WriteControl("LB53", false); | |||
foreach (var item in morkF.StartPassWay.Values) | |||
ThreadManage.GetInstance().Start(new Action(() => | |||
{ | |||
StopFire(); | |||
Thread.Sleep(200); | |||
WriteControl(item, false); | |||
} | |||
StopStir(); | |||
Thread.Sleep(200); | |||
FirePot1_Write("LB5", false); | |||
Thread.Sleep(200); | |||
FirePot1_Write("LB3", false); | |||
Thread.Sleep(200); | |||
FirePot1_Write("LB6", false); | |||
Thread.Sleep(200); | |||
FirePot1_Write("LB7", false); | |||
Thread.Sleep(200); | |||
FirePot1_Write("LB4", false); | |||
Thread.Sleep(200); | |||
FirePot1_Write("LB53", false); | |||
foreach (var item in morkF.StartPassWay.Values) | |||
{ | |||
Thread.Sleep(200); | |||
FirePot1_Write(item, false); | |||
} | |||
}),"炒锅1初始化"); | |||
} | |||
//加油 | |||
public void AddOil() | |||
@@ -190,50 +212,50 @@ namespace BPASmartClient.MorkF | |||
//加热启动 | |||
public void StartFire() | |||
{ | |||
WriteControl("LB1", true); | |||
FirePot1_Write("LB1", true); | |||
Thread.Sleep(200); | |||
} | |||
//加热停止 | |||
public void StopFire() | |||
{ | |||
WriteControl("LB1", false); | |||
FirePot1_Write("LB1", false); | |||
Thread.Sleep(200); | |||
} | |||
//搅拌启动 | |||
public void StartStir() | |||
{ | |||
WriteControl("LB2", true); | |||
FirePot1_Write("LB2", true); | |||
Thread.Sleep(200); | |||
} | |||
//搅拌启停止 | |||
public void StopStir() | |||
{ | |||
WriteControl("LB2", false); | |||
FirePot1_Write("LB2", false); | |||
Thread.Sleep(200); | |||
} | |||
//倒菜 | |||
public void OutFood() | |||
{ | |||
WriteControl("LB3", true); | |||
FirePot1_Write("LB3", true); | |||
MessageLog.GetInstance.Show("倒菜启动"); | |||
while (!morkF.FryPot1_MaterialIntoPot) | |||
{ | |||
Thread.Sleep(200); | |||
} | |||
WriteControl("LB3", false); | |||
FirePot1_Write("LB3", false); | |||
Thread.Sleep(200); | |||
MessageLog.GetInstance.Show("倒菜完成"); | |||
} | |||
//搅拌臂去原点位 | |||
public void StirArmGoOrigin() | |||
{ | |||
WriteControl("LB5", true); | |||
FirePot1_Write("LB5", true); | |||
MessageLog.GetInstance.Show("搅拌臂去原点位"); | |||
while (!morkF.ArmOnOrigin) | |||
{ | |||
Thread.Sleep(200); | |||
} | |||
WriteControl("LB5", false); | |||
FirePot1_Write("LB5", false); | |||
Thread.Sleep(200); | |||
MessageLog.GetInstance.Show("搅拌臂到达原点位"); | |||
@@ -244,14 +266,14 @@ namespace BPASmartClient.MorkF | |||
{ | |||
if (!morkF.ArmOnWorking) | |||
{ | |||
WriteControl("LB6", true); | |||
FirePot1_Write("LB6", true); | |||
MessageLog.GetInstance.Show("搅拌臂去工作位"); | |||
while (!morkF.ArmOnWorking) | |||
{ | |||
Thread.Sleep(200); | |||
} | |||
WriteControl("LB6", false); | |||
FirePot1_Write("LB6", false); | |||
Thread.Sleep(200); | |||
MessageLog.GetInstance.Show("搅拌臂到达工作位"); | |||
} | |||
@@ -260,16 +282,16 @@ namespace BPASmartClient.MorkF | |||
//HBOT放盒子到位 | |||
public void HBOTGoWork() | |||
{ | |||
WriteControl("LB7", true); | |||
FirePot1_Write("LB7", true); | |||
Thread.Sleep(400); | |||
WriteControl("LB7", false); | |||
FirePot1_Write("LB7", false); | |||
} | |||
//出餐启动 | |||
public void OutMeal() | |||
{ | |||
WriteControl("LB4", true); | |||
FirePot1_Write("LB4", true); | |||
Thread.Sleep(200); | |||
WriteControl("LB4", false); | |||
FirePot1_Write("LB4", false); | |||
} | |||
//加热挡位设定 | |||
public void SetFire(object o) | |||
@@ -277,7 +299,7 @@ namespace BPASmartClient.MorkF | |||
if (o == null) return; | |||
if (o is List<int> ints && ints.Count == 1) | |||
{ | |||
WriteControl("LW14", (ushort)ints[0]); | |||
FirePot1_Write("LW14", (ushort)ints[0]); | |||
Thread.Sleep(200); | |||
} | |||
@@ -293,8 +315,9 @@ namespace BPASmartClient.MorkF | |||
if (o == null) return; | |||
if (o is List<int> ints && ints.Count == 1) | |||
{ | |||
WriteControl("LW15", (ushort)ints[0]); | |||
FirePot1_Write("LW15", (ushort)ints[0]); | |||
Thread.Sleep(200); | |||
} | |||
} | |||
@@ -302,33 +325,7 @@ namespace BPASmartClient.MorkF | |||
/// <summary> | |||
/// 订单初始化 | |||
/// </summary> | |||
private void InitialData() | |||
{ | |||
string subId = Guid.NewGuid().ToString(); | |||
//单个订单 | |||
//string subId = Guid.NewGuid().ToString(); | |||
//morkF.TakeMaterialQueue.Enqueue(new OrderLocInfo() { SuborderId = subId, MaterialLoc = new List<int>() { 1 } });//A料 | |||
//morkF.TakeMaterialQueue.Enqueue(new OrderLocInfo() { SuborderId = subId, MaterialLoc = new List<int>() { 2 } });//B料 | |||
//morkF.TakeMaterialQueue.Enqueue(new OrderLocInfo() { SuborderId = subId, MaterialLoc = new List<int>() { 3 } });//C料 | |||
//morkF.TakePlateQueue.Enqueue(new OrderLocInfo() { SuborderId = subId }); | |||
//resultorder.AddRange(new int[] { 1, 2, 3 }); | |||
//for (int i = 0; i < morkF.listStirBom.Count; i++) | |||
//{ | |||
// morkF.TakeMaterialQueue.Enqueue(new OrderLocInfo() { SuborderId = subId+i, MaterialLoc = new List<int>() { 1 } });//A料 | |||
// morkF.TakeMaterialQueue.Enqueue(new OrderLocInfo() { SuborderId = subId+i, MaterialLoc = new List<int>() { 2 } });//B料 | |||
// morkF.TakeMaterialQueue.Enqueue(new OrderLocInfo() { SuborderId = subId+i, MaterialLoc = new List<int>() { 3 } });//C料 | |||
// morkF.TakePlateQueue.Enqueue(new OrderLocInfo() { SuborderId = subId+i }); | |||
// //resultorder.AddRange(new int[] { 1, 2, 3 }); | |||
//} | |||
} | |||
/// <summary> | |||
/// 本地菜单下单 | |||
/// </summary> | |||
@@ -852,15 +849,15 @@ namespace BPASmartClient.MorkF | |||
action((bool[])peripheralStatus[key]);//获取PLC指定地址的状态值 | |||
} | |||
} | |||
/// <summary> | |||
/// 写数据 | |||
/// </summary> | |||
/// <param name="address"></param> | |||
/// <param name="value"></param> | |||
private void WriteData(string address, object value) | |||
{ | |||
EventBus.EventBus.GetInstance().Publish(new WriteModel() { DeviceId = DeviceId, Address = address, Value = value }); | |||
} | |||
///// <summary> | |||
///// 写数据 | |||
///// </summary> | |||
///// <param name="address"></param> | |||
///// <param name="value"></param> | |||
//private void WriteData(string address, object value) | |||
//{ | |||
// EventBus.EventBus.GetInstance().Publish(new WriteModel() { DeviceId = DeviceId, Address = address, Value = value }); | |||
//} | |||
/// <summary> | |||
/// 炒锅初始化 | |||
@@ -868,21 +865,15 @@ namespace BPASmartClient.MorkF | |||
public void PLCInite() | |||
{ | |||
WriteData("LB0", true); | |||
FirePot1_Write("LB0", true); | |||
while(!morkF.FryPot1_InitialComplete) | |||
{ | |||
Thread.Sleep(500); | |||
} | |||
WriteData("LB0", false); | |||
FirePot1_Write("LB0", false); | |||
} | |||
/// <summary> | |||
/// 菜品库初始化 | |||
/// </summary> | |||
public void FoodPlcInite() | |||
{ | |||
WriteData("", true); | |||
} | |||
/// <summary> | |||
@@ -898,98 +889,98 @@ namespace BPASmartClient.MorkF | |||
private void morkSim(object o) | |||
{ | |||
if (o == null) return; | |||
if(o is List<int> ins) | |||
{ | |||
ThreadManage.GetInstance().Start(new Action(() => | |||
{ | |||
if (morkF.FryPot1_InitialComplete && morkF.AutoMode)//初始化完成&&自动模式&& 锅在原点位置 | |||
{ | |||
if (!morkF.ArmOnWorking)//搅拌臂是否在工作位 | |||
{ | |||
StirArmGoWork(); | |||
while (!morkF.ArmOnWorking) | |||
{ | |||
Thread.Sleep(500); | |||
} | |||
OutSeasoning(new List<int> { 1, 100 });//加油500g | |||
while (!morkF.PassWay1_1Compelete) | |||
{ | |||
Thread.Sleep(1000); | |||
} | |||
WriteControl(morkF.StartPassWay[ 1], false);//开启通道关闭 | |||
Thread.Sleep(500); | |||
SetFire(new List<int> { ins[1] });//加热三档 | |||
StartFire();//开始加热 | |||
Thread.Sleep(500); | |||
SetStir(new List<int> { ins[2] });//搅拌二挡 | |||
Thread.Sleep(500); | |||
StartStir();//开始搅拌 | |||
Thread.Sleep(ins[0]*1000);//加热10s | |||
OutSeasoning(new List<int> { 11, 30 });//加调料1 50g | |||
Thread.Sleep(400); | |||
OutSeasoning(new List<int> { 12, 30 });//加调料2 30g | |||
while (!morkF.PassWay1_11Compelete&& !morkF.PassWay1_12Compelete) | |||
{ | |||
Thread.Sleep(1000); | |||
} | |||
//if (o == null) return; | |||
//if(o is List<int> ins) | |||
//{ | |||
// ThreadManage.GetInstance().Start(new Action(() => | |||
// { | |||
// if (morkF.FryPot1_InitialComplete && morkF.AutoMode)//初始化完成&&自动模式&& 锅在原点位置 | |||
// { | |||
// if (!morkF.ArmOnWorking)//搅拌臂是否在工作位 | |||
// { | |||
// StirArmGoWork(); | |||
// while (!morkF.ArmOnWorking) | |||
// { | |||
// Thread.Sleep(500); | |||
// } | |||
// OutSeasoning(new List<int> { 1, 100 });//加油500g | |||
// while (!morkF.PassWay1_1Compelete) | |||
// { | |||
// Thread.Sleep(1000); | |||
// } | |||
// WriteControlExact(morkF.StartPassWay[ 1], false);//开启通道关闭 | |||
// Thread.Sleep(500); | |||
// SetFire(new List<int> { ins[1] });//加热三档 | |||
// StartFire();//开始加热 | |||
// Thread.Sleep(500); | |||
// SetStir(new List<int> { ins[2] });//搅拌二挡 | |||
// Thread.Sleep(500); | |||
// StartStir();//开始搅拌 | |||
// Thread.Sleep(ins[0]*1000);//加热10s | |||
// OutSeasoning(new List<int> { 11, 30 });//加调料1 50g | |||
// Thread.Sleep(400); | |||
// OutSeasoning(new List<int> { 12, 30 });//加调料2 30g | |||
// while (!morkF.PassWay1_11Compelete&& !morkF.PassWay1_12Compelete) | |||
// { | |||
// Thread.Sleep(1000); | |||
// } | |||
WriteControl(morkF.StartPassWay[11], false);//开启通道关闭 | |||
Thread.Sleep(500); | |||
WriteControl(morkF.StartPassWay[12], false);//开启通道信号关闭 | |||
// WriteControlExact(morkF.StartPassWay[11], false);//开启通道关闭 | |||
// Thread.Sleep(500); | |||
// WriteControlExact(morkF.StartPassWay[12], false);//开启通道信号关闭 | |||
Thread.Sleep(500); | |||
OutFood();//倒菜品1 | |||
while (!morkF.FryPot1_MaterialIntoPot)//菜品1倒菜完成 | |||
{ | |||
Thread.Sleep(500); | |||
} | |||
WriteControl("LB53", false); | |||
Thread.Sleep(500); | |||
SetFire(new List<int> { ins[4] });//菜品1加热档 | |||
Thread.Sleep(500); | |||
SetStir(new List<int>() { ins[5] });//菜品1搅拌挡 | |||
Thread.Sleep(ins[3]*1000);//菜品1炒制时间 | |||
OutSeasoning(new List<int> {3, 8 });//加调料3 20g | |||
while (!morkF.PassWay1_3Compelete) | |||
{ | |||
Thread.Sleep(1000); | |||
} | |||
WriteControl(morkF.StartPassWay[3], false);//开启通道信号关闭 | |||
Thread.Sleep(500); | |||
OutFood();//倒菜菜品2 | |||
while (!morkF.FryPot1_MaterialIntoPot)//菜品2倒菜完成 | |||
{ | |||
Thread.Sleep(500); | |||
} | |||
WriteControl("LB53", false); | |||
Thread.Sleep(500); | |||
SetFire(new List<int> { ins[7] });//菜品2加热档 | |||
Thread.Sleep(500); | |||
SetStir(new List<int>() { ins[8] });//菜品2搅拌挡 | |||
Thread.Sleep(ins[6] * 1000);//菜品2炒制时间 | |||
StopStir();//停止搅拌 | |||
Thread.Sleep(500); | |||
StopFire();//停止加热 | |||
Thread.Sleep(2000); | |||
StirArmGoOrigin();//搅拌臂回原点位 | |||
} | |||
} | |||
}), "模拟炒锅1订单"); | |||
} | |||
// Thread.Sleep(500); | |||
// OutFood();//倒菜品1 | |||
// while (!morkF.FryPot1_MaterialIntoPot)//菜品1倒菜完成 | |||
// { | |||
// Thread.Sleep(500); | |||
// } | |||
// WriteControlExact("LB53", false); | |||
// Thread.Sleep(500); | |||
// SetFire(new List<int> { ins[4] });//菜品1加热档 | |||
// Thread.Sleep(500); | |||
// SetStir(new List<int>() { ins[5] });//菜品1搅拌挡 | |||
// Thread.Sleep(ins[3]*1000);//菜品1炒制时间 | |||
// OutSeasoning(new List<int> {3, 8 });//加调料3 20g | |||
// while (!morkF.PassWay1_3Compelete) | |||
// { | |||
// Thread.Sleep(1000); | |||
// } | |||
// WriteControlExact(morkF.StartPassWay[3], false);//开启通道信号关闭 | |||
// Thread.Sleep(500); | |||
// OutFood();//倒菜菜品2 | |||
// while (!morkF.FryPot1_MaterialIntoPot)//菜品2倒菜完成 | |||
// { | |||
// Thread.Sleep(500); | |||
// } | |||
// WriteControlExact("LB53", false); | |||
// Thread.Sleep(500); | |||
// SetFire(new List<int> { ins[7] });//菜品2加热档 | |||
// Thread.Sleep(500); | |||
// SetStir(new List<int>() { ins[8] });//菜品2搅拌挡 | |||
// Thread.Sleep(ins[6] * 1000);//菜品2炒制时间 | |||
// StopStir();//停止搅拌 | |||
// Thread.Sleep(500); | |||
// StopFire();//停止加热 | |||
// Thread.Sleep(2000); | |||
// StirArmGoOrigin();//搅拌臂回原点位 | |||
// } | |||
// } | |||
// }), "模拟炒锅1订单"); | |||
//} | |||
} | |||
@@ -170,7 +170,6 @@ namespace BPASmartClient.MorkF.ViewModel | |||
{ | |||
#region 设备控制 | |||
PlcInite = new RelayCommand(() => { ActionManage.GetInstance.Send("InitCommand"); }); | |||
FoodPlcInite = new RelayCommand(() => { ActionManage.GetInstance.Send("FoodPlcInite"); }); | |||
Plc1Reset = new RelayCommand(() => { ActionManage.GetInstance.Send("Plc1Reset"); }); | |||
StartOrder = new RelayCommand(() => { ActionManage.GetInstance.Send("StartOrder", FoodMenuID); }); | |||
StartLocalOrder = new RelayCommand(() => { ActionManage.GetInstance.Send("StartLocalOrder"); }); | |||
@@ -29,6 +29,7 @@ | |||
<ProjectReference Include="..\BPASmartClient.IoT\BPASmartClient.IoT.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.KLMCoffee\BPASmartClient.KLMCoffee.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.Lebai\BPASmartClient.Lebai.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.MorkBF\BPASmartClient.MorkBF.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.MorkD\BPASmartClient.MorkD.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.MorkF\BPASmartClient.MorkF.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.MorkM\BPASmartClient.MorkM.csproj" /> | |||
@@ -172,6 +172,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MorkMOC", "B | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmart.MenuLoad", "BPASmart.MenuLoad\BPASmart.MenuLoad.csproj", "{7A7547D3-F2EF-4DA4-AD45-D1B49210082B}" | |||
EndProject | |||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.MorkBF", "BPASmartClient.MorkBF\BPASmartClient.MorkBF.csproj", "{CD0FBCF1-9C49-4032-96AD-B9E25F86F2A7}" | |||
EndProject | |||
Global | |||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | |||
Debug|Any CPU = Debug|Any CPU | |||
@@ -1626,6 +1628,26 @@ Global | |||
{7A7547D3-F2EF-4DA4-AD45-D1B49210082B}.Release|x64.Build.0 = Release|Any CPU | |||
{7A7547D3-F2EF-4DA4-AD45-D1B49210082B}.Release|x86.ActiveCfg = Release|Any CPU | |||
{7A7547D3-F2EF-4DA4-AD45-D1B49210082B}.Release|x86.Build.0 = Release|Any CPU | |||
{CD0FBCF1-9C49-4032-96AD-B9E25F86F2A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{CD0FBCF1-9C49-4032-96AD-B9E25F86F2A7}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{CD0FBCF1-9C49-4032-96AD-B9E25F86F2A7}.Debug|ARM.ActiveCfg = Debug|Any CPU | |||
{CD0FBCF1-9C49-4032-96AD-B9E25F86F2A7}.Debug|ARM.Build.0 = Debug|Any CPU | |||
{CD0FBCF1-9C49-4032-96AD-B9E25F86F2A7}.Debug|ARM64.ActiveCfg = Debug|Any CPU | |||
{CD0FBCF1-9C49-4032-96AD-B9E25F86F2A7}.Debug|ARM64.Build.0 = Debug|Any CPU | |||
{CD0FBCF1-9C49-4032-96AD-B9E25F86F2A7}.Debug|x64.ActiveCfg = Debug|Any CPU | |||
{CD0FBCF1-9C49-4032-96AD-B9E25F86F2A7}.Debug|x64.Build.0 = Debug|Any CPU | |||
{CD0FBCF1-9C49-4032-96AD-B9E25F86F2A7}.Debug|x86.ActiveCfg = Debug|Any CPU | |||
{CD0FBCF1-9C49-4032-96AD-B9E25F86F2A7}.Debug|x86.Build.0 = Debug|Any CPU | |||
{CD0FBCF1-9C49-4032-96AD-B9E25F86F2A7}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{CD0FBCF1-9C49-4032-96AD-B9E25F86F2A7}.Release|Any CPU.Build.0 = Release|Any CPU | |||
{CD0FBCF1-9C49-4032-96AD-B9E25F86F2A7}.Release|ARM.ActiveCfg = Release|Any CPU | |||
{CD0FBCF1-9C49-4032-96AD-B9E25F86F2A7}.Release|ARM.Build.0 = Release|Any CPU | |||
{CD0FBCF1-9C49-4032-96AD-B9E25F86F2A7}.Release|ARM64.ActiveCfg = Release|Any CPU | |||
{CD0FBCF1-9C49-4032-96AD-B9E25F86F2A7}.Release|ARM64.Build.0 = Release|Any CPU | |||
{CD0FBCF1-9C49-4032-96AD-B9E25F86F2A7}.Release|x64.ActiveCfg = Release|Any CPU | |||
{CD0FBCF1-9C49-4032-96AD-B9E25F86F2A7}.Release|x64.Build.0 = Release|Any CPU | |||
{CD0FBCF1-9C49-4032-96AD-B9E25F86F2A7}.Release|x86.ActiveCfg = Release|Any CPU | |||
{CD0FBCF1-9C49-4032-96AD-B9E25F86F2A7}.Release|x86.Build.0 = Release|Any CPU | |||
EndGlobalSection | |||
GlobalSection(SolutionProperties) = preSolution | |||
HideSolutionNode = FALSE | |||
@@ -1705,6 +1727,7 @@ Global | |||
{BA588F22-87FB-4124-AF62-CA8DC492ED7D} = {8712125E-14CD-4E1B-A1CE-4BDE03805942} | |||
{D5081D7B-3EBB-42C7-8FB9-A889870D08C2} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F} | |||
{7A7547D3-F2EF-4DA4-AD45-D1B49210082B} = {06F0B369-0483-46DD-82D2-70431FB505C1} | |||
{CD0FBCF1-9C49-4032-96AD-B9E25F86F2A7} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F} | |||
EndGlobalSection | |||
GlobalSection(ExtensibilityGlobals) = postSolution | |||
SolutionGuid = {9AEC9B81-0222-4DE9-B642-D915C29222AC} | |||