@@ -56,8 +56,10 @@ namespace BPASmartClient.Business | |||
foreach (var device in deviceMgr.GetDevices()) | |||
{ | |||
wholeDeviceStatus[device.DeviceId] = device.Status.GetStatus(); | |||
deviceStatus.Healthy = device.IsHealth ? BPA.Message.Enum.DeviceHealthy.Health : BPA.Message.Enum.DeviceHealthy.UnHealth; | |||
deviceStatus.DeviceType = device.DeviceType; | |||
deviceStatus.BatchingInfo = device.BatchingInfos; | |||
var msg = BPAPackage.Make(deviceStatus, device.DeviceId, device.DeviceType); | |||
mqttMgr.Publish(TopicDefine.GetInstance().PushHeartbeatTopics[device.DeviceType], msg.Serialize()); | |||
} | |||
@@ -238,8 +238,12 @@ | |||
VerticalScrollBarVisibility="Hidden"> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="139*"/> | |||
<ColumnDefinition Width="641*"/> | |||
</Grid.ColumnDefinitions> | |||
<!--#region 实时报警信息--> | |||
<ItemsControl ItemsSource="{Binding AlarmInfos}" Visibility="{Binding CurrentDataVis}"> | |||
<ItemsControl ItemsSource="{Binding AlarmInfos}" Visibility="{Binding CurrentDataVis}" Grid.ColumnSpan="2"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid x:Name="gr" Height="30"> | |||
@@ -305,7 +309,7 @@ | |||
<!--#endregion--> | |||
<!--#region 历史报警信息--> | |||
<ItemsControl ItemsSource="{Binding HistoryAlarm}" Visibility="{Binding HistoryDataVis}"> | |||
<ItemsControl ItemsSource="{Binding HistoryAlarm}" Visibility="{Binding HistoryDataVis}" Grid.ColumnSpan="2"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid x:Name="gr" Height="30"> | |||
@@ -15,6 +15,7 @@ using System.Threading.Tasks; | |||
using System.Collections.ObjectModel; | |||
using BPASmartClient.Model.单片机; | |||
using BPASmartClient.EventBus; | |||
using BPA.Models; | |||
namespace BPASmartClient.Device | |||
{ | |||
@@ -88,6 +89,11 @@ namespace BPASmartClient.Device | |||
/// </summary> | |||
public List<object> Error { get; set; } = new List<object>(); | |||
/// <summary> | |||
/// mork_F暂用余量列表 | |||
/// </summary> | |||
public List<BatchingInfo> BatchingInfos { get; set; } = new List<BatchingInfo>(); | |||
/// <summary> | |||
/// 设备变量监控 | |||
/// </summary> | |||
@@ -9,6 +9,7 @@ using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Collections.ObjectModel; | |||
using BPA.Models; | |||
namespace BPASmartClient.Device | |||
{ | |||
@@ -53,6 +54,10 @@ namespace BPASmartClient.Device | |||
/// </summary> | |||
public List<object> Error { get; set; } | |||
/// <summary> | |||
/// mork_F暂用余量列表 | |||
/// </summary> | |||
public List<BatchingInfo> BatchingInfos { get; set; } | |||
/// <summary> | |||
/// 设备变量信息 | |||
/// </summary> | |||
ObservableCollection<VariableMonitor> variableMonitors { get; set; } | |||
@@ -116,6 +121,7 @@ namespace BPASmartClient.Device | |||
/// <param name="field"></param> | |||
object GetPropertyValue(object info, string field); | |||
Action<int, object> AddErrorAction { get; set; } | |||
Action<int, object> DeleteErrorAction { get; set; } | |||
} | |||
@@ -40,7 +40,7 @@ namespace BPASmartClient.PLC | |||
} | |||
} | |||
} | |||
Thread.Sleep(500); | |||
Thread.Sleep(100); | |||
} | |||
Thread.Sleep(1000); | |||
}), $"设备[{DeviceId}][{modbusTcp.IPAdress}]PLC读取线程", true); | |||
@@ -0,0 +1,13 @@ | |||
<?xml version="1.0" encoding="utf-8" ?> | |||
<configuration> | |||
<appSettings> | |||
<!--MQTT配置--> | |||
<add key="MQTTConnection" value="171.221.208.23,11883,admin,public1"/> | |||
<!--订阅主题设置:大炒,小炒,分餐机,煮面机--> | |||
<add key="DeviceMC" value="大炒"/> | |||
<add key="GgAdder" value="https://stream7.iqilu.com/10339/upload_transcode/202002/18/20200218114723HDu3hhxqIT.mp4"/> | |||
<add key="SaasRoute" value="https://witt.black-pa.com/kitchen/api/StoreHelper/GeBasisGateList?StoreId=0c32b2e2-0dc9-4941-b73d-3dc91f7268ab"/> | |||
<!--显示窗体:0 广告 1 地球--> | |||
<add key="ShowForm" value="1"/> | |||
</appSettings> | |||
</configuration> |
@@ -0,0 +1,8 @@ | |||
<Application x:Class="BPASmartClient.MaxWokControl.App" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:local="clr-namespace:BPASmartClient.MaxWokControl"> | |||
<Application.Resources> | |||
</Application.Resources> | |||
</Application> |
@@ -0,0 +1,27 @@ | |||
using BPASmartClient.ScreenLib; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Configuration; | |||
using System.Data; | |||
using System.Linq; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
namespace BPASmartClient.MaxWokControl | |||
{ | |||
/// <summary> | |||
/// Interaction logic for App.xaml | |||
/// </summary> | |||
public partial class App : Application | |||
{ | |||
protected override void OnStartup(StartupEventArgs e) | |||
{ | |||
base.OnStartup(e); | |||
AppMain appMain = new AppMain(MainWindow, this.GetType()); | |||
} | |||
protected override void OnExit(ExitEventArgs e) | |||
{ | |||
base.OnExit(e); | |||
} | |||
} | |||
} |
@@ -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,20 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<OutputType>WinExe</OutputType> | |||
<TargetFramework>net6.0-windows</TargetFramework> | |||
<Nullable>enable</Nullable> | |||
<UseWPF>true</UseWPF> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\BPASmartClient.ScreenLib\BPASmartClient.ScreenLib.csproj" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<None Update="App.config"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</None> | |||
</ItemGroup> | |||
</Project> |
@@ -0,0 +1,30 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<OutputType>WinExe</OutputType> | |||
<TargetFramework>net6.0-windows</TargetFramework> | |||
<Nullable>enable</Nullable> | |||
<UseWPF>true</UseWPF> | |||
<AssemblyName>海科食堂大炒控制终端</AssemblyName> | |||
<ApplicationIcon>hbl.ico</ApplicationIcon> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<None Remove="hbl.ico" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Content Include="hbl.ico" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\BPASmartClient.ScreenLib\BPASmartClient.ScreenLib.csproj" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<None Update="App.config"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</None> | |||
</ItemGroup> | |||
</Project> |
@@ -0,0 +1,12 @@ | |||
<Window x:Class="BPASmartClient.MaxWokControl.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:BPASmartClient.MaxWokControl" | |||
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 BPASmartClient.MaxWokControl | |||
{ | |||
/// <summary> | |||
/// Interaction logic for MainWindow.xaml | |||
/// </summary> | |||
public partial class MainWindow : Window | |||
{ | |||
public MainWindow() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -59,8 +59,8 @@ namespace BPASmartClient.Modbus | |||
Connect(); | |||
if (Connected) | |||
{ | |||
master.Transport.ReadTimeout = 2000;//读取超时时间 | |||
master.Transport.WriteTimeout = 2000;//写入超时时间 | |||
master.Transport.ReadTimeout = 3000;//读取超时时间 | |||
master.Transport.WriteTimeout = 3000;//写入超时时间 | |||
master.Transport.Retries = 10;//重试次数 | |||
ConnectOk?.Invoke(); | |||
Show?.Invoke($"设备【{ip}:{port}】连接成功"); | |||
@@ -38,8 +38,27 @@ namespace BPASmartClient.MorkF.Model | |||
} | |||
} | |||
} | |||
//dicSpecificMaterialCoordinate.Add("MaterialHeight",new Coordinate() { X = 0,Y=0}); | |||
//dicSpecificMaterialCoordinate.Add("Fry1", new Coordinate() { X = 0, Y = 0 }); | |||
//dicSpecificMaterialCoordinate.Add("Fry2", new Coordinate() { X = 0, Y = 0 }); | |||
} | |||
public Coordinate frying1 { get; set; } = new Coordinate() { X = 0, Y = 0 }; | |||
public Coordinate frying2 { get; set; } = new Coordinate() { X = 0, Y = 0 }; | |||
public Coordinate materialHeight { get; set; } = new Coordinate() { X = 0, Y = 0 }; | |||
public int MaterialOneX { get; set; } = -1; | |||
public int MaterialTwoX { get; set; } = -1; | |||
public int MaterialThreeX { get; set; } = -1; | |||
public int distance_1 { get; set; } = 0; | |||
public int distance_2 { get; set; } = 0; | |||
public int distance_3 { get; set; } = 0; | |||
/// <summary> | |||
/// 更新键值对 | |||
/// </summary> | |||
@@ -63,6 +82,10 @@ namespace BPASmartClient.MorkF.Model | |||
/// 每个取菜点的编号与坐标字典 | |||
/// </summary> | |||
public Dictionary<string, Coordinate> dicNoMaterialCoordinate { get; set; } = new Dictionary<string, Coordinate>(); | |||
/// <summary> | |||
/// 每个取菜点的编号与坐标字典 | |||
/// </summary> | |||
//public Dictionary<string, Coordinate> dicSpecificMaterialCoordinate { get; set; } = new Dictionary<string, Coordinate>(); | |||
//{ | |||
// {"A1",new Coordinate(){ X = 34500,Y=0} }, | |||
// {"A2",new Coordinate(){ X = 34500,Y=9000} }, | |||
@@ -116,6 +116,26 @@ namespace BPASmartClient.MorkF | |||
} | |||
} | |||
/// <summary> | |||
/// 余量减少 | |||
/// </summary> | |||
/// <param name="loc">菜品位置</param> | |||
/// <param name="count">菜品减少数量</param> | |||
/// <returns></returns> | |||
public bool ReduceSurplus(string loc,int count) | |||
{ | |||
MaterialInfo materialInfo = materialSurplus.dicSurplus.Find(t => t.Loc == loc); | |||
if (materialInfo != null) | |||
{ | |||
materialInfo.Qty -= count; | |||
return true; | |||
} | |||
else | |||
{ | |||
return false; | |||
} | |||
} | |||
/// <summary> | |||
/// 余量增加 | |||
/// </summary> | |||
@@ -192,7 +212,7 @@ namespace BPASmartClient.MorkF | |||
/// <summary> | |||
/// 余量字典,key:菜品库编号,value:余量 | |||
/// </summary> | |||
public List<MaterialInfo> dicSurplus = new List<MaterialInfo>(); | |||
public List<MaterialInfo> dicSurplus { get; set; } = new List<MaterialInfo>(); | |||
//public MaterialSurplus() | |||
//{ | |||
@@ -59,6 +59,7 @@ | |||
<Button Content="本地模拟流程配置" Click="Button_Click"/> | |||
<Button Content="本地模拟流程下单" Margin="10,0" Command="{Binding StartLocalOrder}" Cursor="Hand"/> | |||
<Button Content="停止炒菜" Margin="10,0" Command="{Binding StopLocalOrder}" Cursor="Hand"/> | |||
<Button Content="{Binding ModeButten}" Margin="10,0" Command="{Binding ModeChange}" Cursor="Hand"/> | |||
</WrapPanel> | |||
</Grid> | |||
@@ -140,57 +141,45 @@ | |||
</WrapPanel> | |||
</GroupBox> | |||
<GroupBox Header="炒锅" FontSize="15" Foreground="Aqua" VerticalAlignment="Center" Height="140"> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="*"/> | |||
<RowDefinition Height="*"/> | |||
</Grid.RowDefinitions> | |||
<WrapPanel VerticalAlignment="Top" Margin="0,5,0,0"> | |||
<Button Content="注油" Command="{Binding AddOil}" Margin="10,0,10,0"></Button> | |||
<Button Content="加热启动" Command="{Binding StartFire}" Margin="10,0,10,0"></Button> | |||
<Button Content="加热停止" Command="{Binding StopFire}" Margin="10,0,10,0"></Button> | |||
<Button Content="搅拌启动" Command="{Binding StartStir}" Margin="10,0,10,0" Cursor="Hand"></Button> | |||
<Button Content="搅拌停止" Command="{Binding StopStir}" Margin="10,0,15,0" Cursor="Hand"></Button> | |||
<Button Content="倒菜启动" Command="{Binding OutFood}" Margin="10,0,15,0" Cursor="Hand"/> | |||
<Button Content="搅拌臂去原点位" Command="{Binding StirArmGoOrigin}" Margin="10,0,10,0"></Button> | |||
<Button Content="搅拌臂去炒制位" Command="{Binding StirArmGoWork}" Margin="10,0,10,0"></Button> | |||
<Button Content="HBOT放盒子到位" Command="{Binding HBOTGoWork}" Margin="10,0,10,0"></Button> | |||
<Button Content="出餐启动" Command="{Binding OutMeal}" Margin="10,0,10,0"></Button> | |||
</WrapPanel> | |||
<GroupBox Header="炒锅" FontSize="15" Foreground="Aqua" VerticalAlignment="Center" Height="140"> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="*"/> | |||
<RowDefinition Height="*"/> | |||
<RowDefinition Height="*"/> | |||
</Grid.RowDefinitions> | |||
<WrapPanel VerticalAlignment="Top" Margin="0,5,0,0"> | |||
<Button Content="注油" Command="{Binding AddOil}" Margin="10,0,10,0"></Button> | |||
<Button Content="倒菜启动" Command="{Binding OutFood}" Margin="10,0,15,0" Cursor="Hand"/> | |||
<Button Content="搅拌臂去原点位" Command="{Binding StirArmGoOrigin}" Margin="10,0,10,0"></Button> | |||
<Button Content="搅拌臂去炒制位" Command="{Binding StirArmGoWork}" Margin="10,0,10,0"></Button> | |||
<Button Content="HBOT放盒子到位" Command="{Binding HBOTGoWork}" Margin="10,0,10,0"></Button> | |||
<Button Content="出餐启动" Command="{Binding OutMeal}" Margin="10,0,10,0"></Button> | |||
</WrapPanel> | |||
<WrapPanel Grid.Row="1" VerticalAlignment="Top" Margin="0,5,0,0"> | |||
<Button Content="加热启动" Command="{Binding StartFire}" Margin="10,0,10,0"></Button> | |||
<Button Content="加热停止" Command="{Binding StopFire}" Margin="10,0,10,0"></Button> | |||
<Button Content="搅拌启动" Command="{Binding StartStir}" Margin="10,0,10,0" Cursor="Hand"></Button> | |||
<Button Content="搅拌停止" Command="{Binding StopStir}" Margin="10,0,15,0" Cursor="Hand"></Button> | |||
<Button Content="开启磁吸" Command="{Binding MagnetOn}" Margin="10,0,15,0" Cursor="Hand"></Button> | |||
<Button Content="关闭磁吸" Command="{Binding MagnetOff}" Margin="10,0,15,0" Cursor="Hand"></Button> | |||
</WrapPanel> | |||
<WrapPanel Grid.Row="2"> | |||
<TextBlock Text="加热挡位:" Margin="10,0,0,0" /> | |||
<ComboBox ItemsSource="{Binding lstFire}" Width="80" Margin="10,0,10,0" HorizontalAlignment="Center" VerticalAlignment="Center" | |||
<WrapPanel Grid.Row="2"> | |||
<TextBlock Text="加热挡位:" Margin="10,0,0,0" /> | |||
<ComboBox ItemsSource="{Binding lstFire}" Width="80" Margin="10,0,10,0" HorizontalAlignment="Center" VerticalAlignment="Center" | |||
SelectedValue="{Binding FireGear}"/> | |||
<Button Content="设定" Margin="0,0,30,0" Command="{Binding SetFire}"/> | |||
<TextBlock Text="搅拌挡位:" Margin="10,0,0,0" /> | |||
<ComboBox ItemsSource="{Binding lstStir}" Width="80" Margin="10,0,10,0" HorizontalAlignment="Center" VerticalAlignment="Center" | |||
<Button Content="设定" Margin="0,0,30,0" Command="{Binding SetFire}"/> | |||
<TextBlock Text="搅拌挡位:" Margin="10,0,0,0" /> | |||
<ComboBox ItemsSource="{Binding lstStir}" Width="80" Margin="10,0,10,0" HorizontalAlignment="Center" VerticalAlignment="Center" | |||
SelectedValue="{Binding StirGear}"/> | |||
<Button Content="设定" Margin="0,0,30,0" Command="{Binding SetStir}"/> | |||
</WrapPanel> | |||
</Grid> | |||
<Button Content="设定" Margin="0,0,30,0" Command="{Binding SetStir}"/> | |||
</WrapPanel> | |||
</Grid> | |||
</GroupBox> | |||
<GroupBox Header="炒锅" FontSize="15" Foreground="Aqua" VerticalAlignment="Center" Height="140"> | |||
<WrapPanel VerticalAlignment="Top" Margin="0,5,0,0"> | |||
<Button Content="注油" Command="{Binding SecAddOil}" Margin="10,0,10,0"></Button> | |||
<Button Content="加热关闭" Command="{Binding SecTempTurnOff}" Margin="10,0,10,0"></Button> | |||
<Button Content="加热1挡" Command="{Binding SecOneBlock}" Margin="10,0,10,0"></Button> | |||
<Button Content="加热2挡" Command="{Binding SecTwoBlock}" Margin="10,0,10,0"></Button> | |||
<Button Content="加热3挡" Command="{Binding SecThreeBlock}" Margin="10,0,10,0"></Button> | |||
<Button Content="翻炒机关闭" Command="{Binding SecOverTurnOff}" Margin="10,0,10,0" Cursor="Hand"></Button> | |||
<Button Content="翻炒机上升" Command="{Binding SecOverGoOn}" Margin="10,0,15,0" Cursor="Hand"></Button> | |||
<Button Content="翻炒机下降" Command="{Binding SecOverGoDown}" Margin="10,0,10,0"></Button> | |||
<Button Content="翻炒机1挡" Command="{Binding SecOverOneBlock}" Margin="10,0,10,0"></Button> | |||
<Button Content="翻炒机2挡" Command="{Binding SecOverTwoBlock}" Margin="10,0,10,0"></Button> | |||
<Button Content="翻炒机3挡" Command="{Binding SecOverThreeBlock}" Margin="10,0,10,0"></Button> | |||
</WrapPanel> | |||
</GroupBox> | |||
</GroupBox> | |||
</StackPanel> | |||
</StackPanel> | |||
</Grid> | |||
</ScrollViewer> | |||
@@ -30,9 +30,9 @@ namespace BPASmartClient.MorkF.View | |||
} | |||
LocalMenu localMenu = new LocalMenu(); | |||
private void Button_Click(object sender, RoutedEventArgs e) | |||
{ | |||
LocalMenu localMenu = new LocalMenu(); | |||
localMenu.ShowDialog(); | |||
} | |||
} | |||
@@ -3,6 +3,7 @@ | |||
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:i="http://schemas.microsoft.com/expression/2010/interactivity" | |||
xmlns:local="clr-namespace:BPASmartClient.MorkF.View" | |||
xmlns:vm="clr-namespace:BPASmartClient.MorkF.ViewModel" | |||
mc:Ignorable="d" | |||
@@ -49,9 +50,15 @@ | |||
<RowDefinition Height="*"/> | |||
</Grid.RowDefinitions> | |||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center"> | |||
<Button Content="增加步骤" Command="{Binding AddFryTime}" Width="120" Height="40" Margin="10,0"/> | |||
<Button Content="保存" Command="{Binding Save}" Width="120" Height="40" Margin="10,0"/> | |||
<Button Content="退出" Click="Button_Click" Width="120" Height="40" Margin="10,0"/> | |||
<ComboBox Name="Materials" SelectionChanged="Materials_SelectionChanged" ItemsSource="{Binding MaterialNames}" HorizontalAlignment="Center" VerticalAlignment="Center"/> | |||
<TextBox Text="{Binding MaterialName}" Width="80" Height="40" Margin="10,0"/> | |||
<Button Content="增加菜谱" Command="{Binding AddMaterial}" Width="80" Height="40" Margin="10,0"/> | |||
<Button Content="下单" Command="{Binding NewStartLocalMaterial}" Width="80" Height="40" Margin="10,0"/> | |||
<!--<Button Content="菜谱重命名" Command="{Binding RenameMaterial}" Width="80" Height="40" Margin="10,0"/> | |||
<Button Content="删除菜谱" Command="{Binding DeleteMaterial}" Width="80" Height="40" Margin="10,0"/>--> | |||
<Button Content="增加步骤" Command="{Binding AddFryTime}" Width="80" Height="40" Margin="10,0"/> | |||
<Button Content="保存" Command="{Binding Save}" Width="80" Height="40" Margin="10,0"/> | |||
<Button Content="退出" Click="Button_Click" Width="80" Height="40" Margin="10,0"/> | |||
</StackPanel> | |||
<Grid Grid.Row="1" Width="600" HorizontalAlignment="Center" VerticalAlignment="Center"> | |||
@@ -46,13 +46,13 @@ namespace BPASmartClient.MorkF.View | |||
ActionManage.GetInstance.CancelRegister ("LocalMenuClose"); | |||
ActionManage.GetInstance.Register(new Action(() => | |||
{ | |||
this.Close(); | |||
this.Hide(); | |||
}), "LocalMenuClose"); | |||
} | |||
private void Button_Click(object sender, RoutedEventArgs e) | |||
{ | |||
this.Close(); | |||
this.Hide(); | |||
} | |||
private int GetCurrentIndex(GetPositionDelegate getPosition) | |||
@@ -231,7 +231,16 @@ namespace BPASmartClient.MorkF.View | |||
this.DragMove(); | |||
} | |||
private void Materials_SelectionChanged(object sender, SelectionChangedEventArgs e) | |||
{ | |||
string str = Materials.SelectedValue.ToString(); | |||
if(str != string.Empty) | |||
{ | |||
ActionManage.GetInstance.Send("LoacMenuSelectMaterial", str); | |||
} | |||
} | |||
/// <summary> | |||
/// 移动效果 | |||
@@ -35,6 +35,7 @@ namespace BPASmartClient.MorkF.ViewModel | |||
public RelayCommand StartOrder { get; set; } | |||
public RelayCommand StartLocalOrder { get; set; } | |||
public RelayCommand StopLocalOrder { get; set; } | |||
public RelayCommand ModeChange { get; set; } | |||
#endregion | |||
@@ -83,7 +84,9 @@ namespace BPASmartClient.MorkF.ViewModel | |||
public string ArmButtonName { get { return _ArmButtonName; } set { _ArmButtonName = value; OnPropertyChanged(); } } | |||
private string _ArmButtonName = "启动"; | |||
public string ModeButten { get { return _ModeButten; } set { _ModeButten = value; OnPropertyChanged(); } } | |||
private string _ModeButten = "联网模式"; | |||
public RelayCommand SetNowPosition { get; set; }//设置机械臂当前坐标 | |||
public RelayCommand FoodLibInit { get; set; }//初始化 | |||
public RelayCommand SurplusCheck { get; set; }//初始化 | |||
@@ -136,6 +139,8 @@ namespace BPASmartClient.MorkF.ViewModel | |||
public RelayCommand StopFire { get; set; } | |||
public RelayCommand StartStir { get; set; } | |||
public RelayCommand StopStir { get; set; } | |||
public RelayCommand MagnetOn { get; set; } | |||
public RelayCommand MagnetOff { get; set; } | |||
public RelayCommand OutFood { get; set; } | |||
public RelayCommand StirArmGoOrigin { get; set; } | |||
public RelayCommand StirArmGoWork { get; set; } | |||
@@ -202,6 +207,17 @@ namespace BPASmartClient.MorkF.ViewModel | |||
StartOrder = new RelayCommand(() => { ActionManage.GetInstance.Send("StartOrder", FoodMenuID); }); | |||
StartLocalOrder = new RelayCommand(() => { ActionManage.GetInstance.Send("StartLocalOrder"); }); | |||
StopLocalOrder = new RelayCommand(() => { ActionManage.GetInstance.Send("StopLocalOrder"); }); | |||
ModeChange = new RelayCommand(() => { | |||
ActionManage.GetInstance.Send("ModeChange"); | |||
if(ModeButten == "联网模式") | |||
{ | |||
ModeButten = "本地模式"; | |||
} | |||
else | |||
{ | |||
ModeButten = "联网模式"; | |||
} | |||
}); | |||
#endregion | |||
#region 菜品控制 | |||
@@ -269,6 +285,8 @@ namespace BPASmartClient.MorkF.ViewModel | |||
StopFire = new RelayCommand(() => { ActionManage.GetInstance.Send("StopFire"); });//加热停止 | |||
StartStir = new RelayCommand(() => { ActionManage.GetInstance.Send("StartStir"); });//搅拌启动 | |||
StopStir = new RelayCommand(() => { ActionManage.GetInstance.Send("StopStir"); });//搅拌停止 | |||
MagnetOn = new RelayCommand(() => { ActionManage.GetInstance.Send("MagnetOn"); });//磁吸开启 | |||
MagnetOff = new RelayCommand(() => { ActionManage.GetInstance.Send("MagnetOff"); });//磁吸开启 | |||
OutFood = new RelayCommand(() => { ActionManage.GetInstance.Send("OutFood"); });//倒菜启动 | |||
StirArmGoOrigin = new RelayCommand(() => { ActionManage.GetInstance.Send("StirArmGoOrigin"); });//搅拌臂去原点位 | |||
StirArmGoWork = new RelayCommand(() => { ActionManage.GetInstance.Send("StirArmGoWork"); });//搅拌臂去炒制位 | |||
@@ -9,21 +9,35 @@ using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using System.Windows.Threading; | |||
namespace BPASmartClient.MorkF.ViewModel | |||
{ | |||
partial class LocalMenuViewModel:ObservableObject | |||
{ | |||
public ObservableCollection<PotActions> PotActionStep { get; set; } = new ObservableCollection<PotActions>(); | |||
public ObservableCollection<PotActions> PotActionStep { get { return _PotActionStep; } | |||
set { _PotActionStep = value; OnPropertyChanged(); } } | |||
private ObservableCollection<PotActions> _PotActionStep = new ObservableCollection<PotActions>(); | |||
public ObservableCollection<string> strPotActions { get; set; } = new ObservableCollection<string>(); | |||
public string MaterialName { get; set; } | |||
public string SelectMaterialName { get; set; } | |||
public ObservableCollection<string> MaterialNames { get; set; } = new ObservableCollection<string>(); | |||
public ObservableCollection<string> strPotActions { get; set; } = new ObservableCollection<string>(); | |||
public MaterialAndFryingTime materialAndFryingTime { get; set; } = new MaterialAndFryingTime(); | |||
public RelayCommand<object> Delete { get; set; } | |||
public RelayCommand AddFryTime { get; set; } | |||
public RelayCommand NewStartLocalMaterial { get; set; } | |||
public RelayCommand AddMaterial { get; set; } | |||
public RelayCommand DeleteMaterial { get; set; } | |||
public RelayCommand RenameMaterial { get; set; } | |||
public RelayCommand Save { get; set; } | |||
private void Deleted(object o) | |||
@@ -42,30 +56,108 @@ namespace BPASmartClient.MorkF.ViewModel | |||
public LocalMenuViewModel() | |||
{ | |||
if(Json<LocalPotStep>.Data.LocalstirFryGoods.StirPotActions.Count > 0) | |||
//if (Json<LocalPotStep>.Data.LocalstirFryGoods.StirPotActions.Count > 0) | |||
//{ | |||
// PotActionStep.Clear(); | |||
// PotActionStep = new ObservableCollection<PotActions>(Json<LocalPotStep>.Data.LocalstirFryGoods.StirPotActions); | |||
//} | |||
Json<MaterialAndFryingTime>.Read(); | |||
if (Json<MaterialAndFryingTime>.Data.materials.Count > 0) | |||
{ | |||
PotActionStep.Clear(); | |||
PotActionStep = new ObservableCollection<PotActions>(Json<LocalPotStep>.Data.LocalstirFryGoods.StirPotActions); | |||
MaterialNames.Clear(); | |||
materialAndFryingTime.materials = Json<MaterialAndFryingTime>.Data.materials; | |||
foreach (var item in materialAndFryingTime.materials) | |||
{ | |||
MaterialNames.Add(item.Key); | |||
//if (MaterialNames.Count == 1) | |||
//{ | |||
// MaterialName = item.Key; | |||
// PotActionStep.Clear(); | |||
// foreach (var item2 in item.Value) | |||
// { | |||
// PotActionStep.Add(item2); | |||
// } | |||
//} | |||
} | |||
} | |||
Delete = new RelayCommand<object>(Deleted); | |||
AddFryTime = new RelayCommand(() => | |||
{ | |||
List<SeasoningList> seasoningLists = new List<SeasoningList>(); | |||
seasoningLists.Add(new SeasoningList { Loc = 0,Qty = 0}); | |||
PotActionStep.Add(new BPA.Models.PotActions | |||
seasoningLists.Add(new SeasoningList { Loc = 0, Qty = 0 }); | |||
PotActionStep.Add(new BPA.Models.PotActions | |||
{ | |||
FryTime = PotActionStep.Count +1, | |||
During =0, | |||
FryTime = PotActionStep.Count + 1, | |||
During = 0, | |||
SeasoningLists = seasoningLists, | |||
}); | |||
}); | |||
NewStartLocalMaterial = new RelayCommand(() => | |||
{ | |||
ActionManage.GetInstance.Send("NewStartLocalOrder", SelectMaterialName); | |||
}); | |||
AddMaterial = new RelayCommand(() => | |||
{ | |||
//尝试是否能找到 | |||
if(MaterialNames.FirstOrDefault(o=>o == MaterialName) == MaterialName) | |||
{ | |||
MessageBox.Show("该菜品已经添加"); | |||
} | |||
else | |||
{ | |||
MaterialNames.Add(MaterialName); | |||
} | |||
}); | |||
DeleteMaterial = new RelayCommand(() => | |||
{ | |||
//尝试是否能找到 | |||
if (MaterialNames.FirstOrDefault(o => o == SelectMaterialName) == SelectMaterialName) | |||
{ | |||
MaterialNames.Remove(SelectMaterialName); | |||
if(materialAndFryingTime.materials.ContainsKey(SelectMaterialName)) | |||
{ | |||
materialAndFryingTime.materials.Remove(SelectMaterialName); | |||
} | |||
} | |||
}); | |||
RenameMaterial = new RelayCommand(() => | |||
{ | |||
//尝试是否能找到 | |||
if (MaterialNames.FirstOrDefault(o => o == SelectMaterialName) == SelectMaterialName) | |||
{ | |||
MaterialNames.Remove(SelectMaterialName); | |||
MaterialNames.Add(MaterialName); | |||
if (materialAndFryingTime.materials.ContainsKey(SelectMaterialName)) | |||
{ | |||
materialAndFryingTime.materials.Add(MaterialName, materialAndFryingTime.materials[SelectMaterialName]); | |||
materialAndFryingTime.materials.Remove(SelectMaterialName); | |||
} | |||
} | |||
}); | |||
Save = new RelayCommand(new Action(() => | |||
{ | |||
Json<LocalPotStep>.Data.LocalstirFryGoods.GoodsKey = 11; | |||
Json<LocalPotStep>.Data.LocalstirFryGoods.StirPotActions = new List<PotActions>(PotActionStep); | |||
Json<LocalPotStep>.Save(); | |||
ActionManage.GetInstance.Send("LocalMenuClose"); | |||
if(PotActionStep.Count > 0) | |||
{ | |||
ObservableCollection<PotActions> newPotActionSteps = new ObservableCollection<PotActions>(); | |||
foreach (var step in PotActionStep) | |||
{ | |||
newPotActionSteps.Add(step); | |||
} | |||
if (materialAndFryingTime.materials.ContainsKey(SelectMaterialName)) | |||
{ | |||
materialAndFryingTime.materials[SelectMaterialName] = newPotActionSteps; | |||
} | |||
else | |||
{ | |||
materialAndFryingTime.materials.Add(SelectMaterialName, newPotActionSteps); | |||
} | |||
} | |||
//Json<LocalPotStep>.Data.LocalstirFryGoods.GoodsKey = 11; | |||
//Json<LocalPotStep>.Data.LocalstirFryGoods.StirPotActions = new List<PotActions>(PotActionStep); | |||
//Json<LocalPotStep>.Save(); | |||
Json<MaterialAndFryingTime>.Data.materials = materialAndFryingTime.materials; | |||
Json<MaterialAndFryingTime>.Save(); | |||
//ActionManage.GetInstance.Send("LocalMenuClose"); | |||
})); | |||
foreach(var pot in Enum.GetNames(typeof(StirFryPotActionEnum))) | |||
@@ -98,7 +190,27 @@ namespace BPASmartClient.MorkF.ViewModel | |||
}), "PotActionStep"); | |||
ActionManage.GetInstance.Register(new Action<object>(o => | |||
{ | |||
if (o is string str) | |||
{ | |||
SelectMaterialName = str; | |||
PotActionStep.Clear(); | |||
if (materialAndFryingTime.materials.ContainsKey(str)) | |||
{ | |||
foreach (var item2 in materialAndFryingTime.materials[str]) | |||
{ | |||
PotActionStep.Add(item2); | |||
} | |||
} | |||
} | |||
}), "LoacMenuSelectMaterial",true); | |||
} | |||
} | |||
partial class MaterialAndFryingTime | |||
{ | |||
public Dictionary<string, ObservableCollection<PotActions>> materials { get; set; } = new Dictionary<string, ObservableCollection<PotActions>>(); | |||
} | |||
} |
@@ -231,7 +231,56 @@ namespace BPASmartClient.MorkF.ViewModel | |||
public int TwentySevenY { get { return _TwentySevenY; } set { _TwentySevenY = value; OnPropertyChanged(); } } | |||
private int _TwentySevenY; | |||
#endregion | |||
#region 菜品库高度测距点位 | |||
public bool PositionMaterialHeight { get { return _PositionMaterialHeight; } set { _PositionMaterialHeight = value; OnPropertyChanged(); } } | |||
private bool _PositionMaterialHeight; | |||
public int MaterialHeightX { get { return _MaterialHeightX; } set { _MaterialHeightX = value; OnPropertyChanged(); } } | |||
private int _MaterialHeightX; | |||
public int MaterialHeightY { get { return _MaterialHeightY; } set { _MaterialHeightY = value; OnPropertyChanged(); } } | |||
private int _MaterialHeightY; | |||
#endregion | |||
#region 炒锅1菜品交互位置 | |||
public bool PositionFrying1 { get { return _PositionFrying1; } set { _PositionFrying1 = value; OnPropertyChanged(); } } | |||
private bool _PositionFrying1; | |||
public int Frying1X { get { return _Frying1X; } set { _Frying1X = value; OnPropertyChanged(); } } | |||
private int _Frying1X; | |||
public int Frying1Y { get { return _Frying1Y; } set { _Frying1Y = value; OnPropertyChanged(); } } | |||
private int _Frying1Y; | |||
#endregion | |||
#region 炒锅2菜品交互位置 | |||
public bool PositionFrying2 { get { return _PositionFrying2; } set { _PositionFrying2 = value; OnPropertyChanged(); } } | |||
private bool _PositionFrying2; | |||
public int Frying2X { get { return _Frying2X; } set { _Frying2X = value; OnPropertyChanged(); } } | |||
private int _Frying2X; | |||
public int Frying2Y { get { return _Frying2Y; } set { _Frying2Y = value; OnPropertyChanged(); } } | |||
private int _Frying2Y; | |||
#endregion | |||
#region 第一层菜品库出菜位置 | |||
public bool PositionMaterialOne { get { return _PositionMaterialOne; } set { _PositionMaterialOne = value; OnPropertyChanged(); } } | |||
private bool _PositionMaterialOne; | |||
public int MaterialOneX { get { return _MaterialOneX; } set { _MaterialOneX = value; OnPropertyChanged(); } } | |||
private int _MaterialOneX; | |||
#endregion | |||
#region 第二层菜品库出菜位置 | |||
public bool PositionMaterialTwo { get { return _PositionMaterialTwo; } set { _PositionMaterialTwo = value; OnPropertyChanged(); } } | |||
private bool _PositionMaterialTwo; | |||
public int MaterialTwoX { get { return _MaterialTwoX; } set { _MaterialTwoX = value; OnPropertyChanged(); } } | |||
private int _MaterialTwoX; | |||
#endregion | |||
#region 第三层菜品库出菜位置 | |||
public bool PositionMaterialThree { get { return _PositionMaterialThree; } set { _PositionMaterialThree = value; OnPropertyChanged(); } } | |||
private bool _PositionMaterialThree; | |||
public int MaterialThreeX { get { return _MaterialThreeX; } set { _MaterialThreeX = value; OnPropertyChanged(); } } | |||
private int _MaterialThreeX; | |||
#endregion | |||
#region 菜品库各传感器高度临时值 | |||
public int Distance_1 { get { return _Distance_1; } set { _Distance_1 = value; OnPropertyChanged(); } } | |||
private int _Distance_1; | |||
public int Distance_2 { get { return _Distance_2; } set { _Distance_2 = value; OnPropertyChanged(); } } | |||
private int _Distance_2; | |||
public int Distance_3 { get { return _Distance_3; } set { _Distance_3 = value; OnPropertyChanged(); } } | |||
private int _Distance_3; | |||
#endregion | |||
public bool Up { get { return _Up; } set { _Up = value; OnPropertyChanged(); } } | |||
private bool _Up; | |||
@@ -251,14 +300,6 @@ namespace BPASmartClient.MorkF.ViewModel | |||
private string _str; | |||
public RelayCommand FoodLibInit { get; set; }//初始化 | |||
public RelayCommand StartElectromagnetism { get; set; }//电磁阀启动 | |||
public RelayCommand StopElectromagnetism { get; set; } | |||
public RelayCommand PawTurnFront { get; set; }//夹爪正转 | |||
public RelayCommand PawTurnBack { get; set; }//夹爪反转 | |||
public RelayCommand PawToPoint1 { get; set; }//感应测距1 | |||
public RelayCommand PawToPoint2 { get; set; }//感应测距2 | |||
public RelayCommand PawToPoint3 { get; set; }//感应测距3 | |||
/// <summary> | |||
/// 操作时,x轴移动的距离 | |||
/// </summary> | |||
@@ -309,6 +350,18 @@ namespace BPASmartClient.MorkF.ViewModel | |||
public RelayCommand SetNowDownPosition { get; set; }//设置机械臂基于当前坐标往下移动 | |||
public RelayCommand FoodLibInit { get; set; }//初始化 | |||
public RelayCommand StartElectromagnetism { get; set; }//电磁阀启动 | |||
public RelayCommand StopElectromagnetism { get; set; } | |||
public RelayCommand PawTurnFront { get; set; }//夹爪正转 | |||
public RelayCommand PawTurnBack { get; set; }//夹爪反转 | |||
public RelayCommand PawToPoint1 { get; set; }//感应测距1 | |||
public RelayCommand PawToPoint2 { get; set; }//感应测距2 | |||
public RelayCommand PawToPoint3 { get; set; }//感应测距3 | |||
public RelayCommand GetDistance_1 { get; set; }//感应测距1 | |||
public RelayCommand GetDistance_2 { get; set; }//感应测距2 | |||
public RelayCommand GetDistance_3 { get; set; }//感应测距3 | |||
private static object saveMaterialCoordinateLock = new object(); | |||
/// <summary> | |||
/// 保存当前的坐标系 | |||
@@ -411,7 +464,7 @@ namespace BPASmartClient.MorkF.ViewModel | |||
break; | |||
case "23": | |||
dicNoMaterialCoordinate.Value.X = TwentyThreeX; | |||
dicNoMaterialCoordinate.Value.Y = TwentyThreeX; | |||
dicNoMaterialCoordinate.Value.Y = TwentyThreeY; | |||
break; | |||
case "24": | |||
dicNoMaterialCoordinate.Value.X = TwentyFourX; | |||
@@ -434,8 +487,29 @@ namespace BPASmartClient.MorkF.ViewModel | |||
} | |||
} | |||
materialCoordinate.frying1.X = Frying1X; | |||
materialCoordinate.frying1.Y = Frying1Y; | |||
materialCoordinate.frying2.X = Frying2X; | |||
materialCoordinate.frying2.Y = Frying2Y; | |||
materialCoordinate.materialHeight.X = MaterialHeightX; | |||
materialCoordinate.materialHeight.Y = MaterialHeightY; | |||
materialCoordinate.distance_1 = Distance_1; | |||
materialCoordinate.distance_2 = Distance_2; | |||
materialCoordinate.distance_3 = Distance_3; | |||
materialCoordinate.MaterialOneX = MaterialOneX; | |||
materialCoordinate.MaterialTwoX = MaterialTwoX; | |||
materialCoordinate.MaterialThreeX = MaterialThreeX; | |||
Json<MaterialCoordinate>.Data = materialCoordinate; | |||
Json<MaterialCoordinate>.Save(); | |||
//更新当前的菜品库数据 | |||
MaterialCoordinate.GetInstance().frying1 = materialCoordinate.frying1; | |||
MaterialCoordinate.GetInstance().frying2 = materialCoordinate.frying2; | |||
MaterialCoordinate.GetInstance().materialHeight = materialCoordinate.materialHeight; | |||
MaterialCoordinate.GetInstance().dicNoMaterialCoordinate = materialCoordinate.dicNoMaterialCoordinate; | |||
MaterialCoordinate.GetInstance().MaterialOneX = materialCoordinate.MaterialOneX; | |||
MaterialCoordinate.GetInstance().MaterialTwoX = materialCoordinate.MaterialTwoX; | |||
MaterialCoordinate.GetInstance().MaterialThreeX = materialCoordinate.MaterialThreeX; | |||
} | |||
/// <summary> | |||
@@ -463,6 +537,11 @@ namespace BPASmartClient.MorkF.ViewModel | |||
{ | |||
MaterialCoordinate materialCoordinate = ReadMaterialCoordinate(); | |||
if(materialCoordinate == null) | |||
{ | |||
return; | |||
} | |||
if (materialCoordinate.dicNoMaterialCoordinate.Count == 27) | |||
{ | |||
foreach (var dicNoMaterialCoordinate in materialCoordinate.dicNoMaterialCoordinate) | |||
@@ -577,12 +656,36 @@ namespace BPASmartClient.MorkF.ViewModel | |||
TwentySevenX = dicNoMaterialCoordinate.Value.X; | |||
TwentySevenY = dicNoMaterialCoordinate.Value.Y; | |||
break; | |||
case "MaterialHeight": | |||
MaterialHeightX = materialCoordinate.materialHeight.X; | |||
MaterialHeightY = materialCoordinate.materialHeight.Y; | |||
break; | |||
case "Frying1": | |||
Frying1X = materialCoordinate.frying1.X; | |||
Frying1Y = materialCoordinate.frying1.Y; | |||
break; | |||
case "Frying2": | |||
Frying2X = materialCoordinate.frying2.X; | |||
Frying2Y = materialCoordinate.frying2.Y; | |||
break; | |||
default: | |||
break; | |||
} | |||
} | |||
} | |||
MaterialOneX = materialCoordinate.MaterialOneX; | |||
MaterialTwoX = materialCoordinate.MaterialTwoX; | |||
MaterialThreeX = materialCoordinate.MaterialThreeX; | |||
MaterialHeightX = materialCoordinate.materialHeight.X; | |||
MaterialHeightY = materialCoordinate.materialHeight.Y; | |||
Frying1X = materialCoordinate.frying1.X; | |||
Frying1Y = materialCoordinate.frying1.Y; | |||
Frying2X = materialCoordinate.frying2.X; | |||
Frying2Y = materialCoordinate.frying2.Y; | |||
Distance_1 = materialCoordinate.distance_1; | |||
Distance_2 = materialCoordinate.distance_2; | |||
Distance_3 = materialCoordinate.distance_3; | |||
} | |||
/// <summary> | |||
@@ -701,6 +804,27 @@ namespace BPASmartClient.MorkF.ViewModel | |||
TwentySevenX = TwentySevenX + OperationX; | |||
TwentySevenY = TwentySevenY + OperationY; | |||
break; | |||
case "MaterialHeight": | |||
MaterialHeightX = MaterialHeightX + OperationX; | |||
MaterialHeightY = MaterialHeightY + OperationY; | |||
break; | |||
case "Frying1": | |||
Frying1X = Frying1X + OperationX; | |||
Frying1Y = Frying1Y + OperationY; | |||
break; | |||
case "Frying2": | |||
Frying2X = Frying2X + OperationX; | |||
Frying2Y = Frying2Y + OperationY; | |||
break; | |||
case "MaterialOne": | |||
MaterialOneX = MaterialOneX + OperationX; | |||
break; | |||
case "MaterialTwo": | |||
MaterialTwoX = MaterialTwoX + OperationX; | |||
break; | |||
case "MaterialThree": | |||
MaterialThreeX = MaterialThreeX + OperationX; | |||
break; | |||
default: | |||
break; | |||
} | |||
@@ -713,7 +837,8 @@ namespace BPASmartClient.MorkF.ViewModel | |||
//判断是否有选择下发的设备 | |||
if (!PositionOne && !PositionTwo && !PositionThree && !PositionFour && !PositionFive && !PositionSix && !PositionSeven && !PositionEight && !PositionNine | |||
&& !PositionTen && !PositionEleven && !PositionTwelve && !PositionThirteen && !PositionFourteen && !PositionFifteen && !PositionSixteen && !PositionSeventeen && !PositionEighteen | |||
&& !PositionNineteen && !PositionTwenty && !PositionTwentyOne && !PositionTwentyTwo && !PositionTwentyThree && !PositionTwentyFour && !PositionTwentyFive && !PositionTwentySix && !PositionTwentySeven) | |||
&& !PositionNineteen && !PositionTwenty && !PositionTwentyOne && !PositionTwentyTwo && !PositionTwentyThree && !PositionTwentyFour && !PositionTwentyFive && !PositionTwentySix && !PositionTwentySeven | |||
&& !PositionMaterialHeight && !PositionFrying1 && !PositionFrying2 && !PositionMaterialOne && !PositionMaterialThree &&!PositionMaterialTwo) | |||
{ | |||
MessageBox.Show("未选择点位"); | |||
return; | |||
@@ -827,6 +952,30 @@ namespace BPASmartClient.MorkF.ViewModel | |||
{ | |||
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "27", TwentySevenX + OperationX, TwentySevenY + OperationY });//设定机械臂当前位置 | |||
} | |||
if (PositionMaterialHeight) | |||
{ | |||
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "MaterialHeight", MaterialHeightX + OperationX, MaterialHeightY + OperationY });//设定机械臂当前位置 | |||
} | |||
if (PositionFrying1) | |||
{ | |||
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "Frying1", Frying1X + OperationX, Frying1Y + OperationY });//设定机械臂当前位置 | |||
} | |||
if (PositionFrying2) | |||
{ | |||
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "Frying2", Frying2X + OperationX, Frying2Y + OperationY });//设定机械臂当前位置 | |||
} | |||
if(PositionMaterialOne) | |||
{ | |||
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "MaterialOne", MaterialOneX + OperationX, 0 });//设定机械臂当前位置 | |||
} | |||
if (PositionMaterialTwo) | |||
{ | |||
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "MaterialTwo", MaterialTwoX + OperationX, 0 });//设定机械臂当前位置 | |||
} | |||
if (PositionMaterialThree) | |||
{ | |||
ActionManage.GetInstance.Send("CalibrationCoordination", new List<object> { "MaterialThree", MaterialThreeX + OperationX, 0 });//设定机械臂当前位置 | |||
} | |||
} | |||
public MaterialCalibrationViewModel() | |||
@@ -840,6 +989,9 @@ namespace BPASmartClient.MorkF.ViewModel | |||
PawToPoint3 = new RelayCommand(() => { ActionManage.GetInstance.Send("PawToPoint3"); });//爪子去3号位 | |||
PawTurnFront = new RelayCommand(() => { ActionManage.GetInstance.Send("PawTurnFront"); });//夹爪正转 | |||
PawTurnBack = new RelayCommand(() => { ActionManage.GetInstance.Send("PawTurnBack"); });//夹爪反转 | |||
GetDistance_1 = new RelayCommand(() => { ActionManage.GetInstance.Send("GetDistance_1"); });//感应距离1 | |||
GetDistance_2 = new RelayCommand(() => { ActionManage.GetInstance.Send("GetDistance_2"); });//感应距离2 | |||
GetDistance_3 = new RelayCommand(() => { ActionManage.GetInstance.Send("GetDistance_3"); });//感应距离3 | |||
PhysicalMaterialCoordinate(); | |||
ActionManage.GetInstance.Register(new Action<object>((o) => | |||
@@ -852,6 +1004,31 @@ namespace BPASmartClient.MorkF.ViewModel | |||
} | |||
}), "CalibrationCallBack"); | |||
}), "CalibrationCallBack"); | |||
ActionManage.GetInstance.Register(new Action<object>((o) => | |||
{ | |||
ThreadManage.GetInstance().Start(new Action(() => | |||
{ | |||
if (o is List<string> nums) | |||
{ | |||
int distance = 0; | |||
bool ret = false; | |||
ret = int.TryParse(nums[1], out distance); | |||
if (ret == false) { return; } | |||
if (nums[0] == "1") | |||
{ | |||
Distance_1= distance; | |||
} | |||
else if (nums[0] == "2") | |||
{ | |||
Distance_2 = distance; | |||
} | |||
else if (nums[0] == "3") | |||
{ | |||
Distance_3 = distance; | |||
} | |||
} | |||
}), "GetDistanceCallBack"); | |||
}), "GetDistanceCallBack"); | |||
SetNowPosition = new RelayCommand(() => | |||
{ | |||
if(!Point && !Left && !Right && !Down && !Up) | |||
@@ -1,4 +1,5 @@ | |||
using BPA.CustomResource.UserControls; | |||
using BPASmartClient.ScreenLib.炒锅; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
@@ -15,7 +16,6 @@ namespace BPASmartClient.ScreenLib | |||
public AppMain(Window window, Type type) | |||
{ | |||
//启动Redis数据读取 | |||
Main.GetInstance.Start(); | |||
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; | |||
FSystemHelper.GetInstance.CreateDesktopShortcut(); | |||
// FSystemHelper.GetInstance.AutoStart(true); | |||
@@ -28,15 +28,19 @@ namespace BPASmartClient.ScreenLib | |||
{ | |||
case "BPASmartClient.ScreenALL.App": | |||
windowLarge.Init(TitleName, new ScreenALLControl()); windowLarge.Show(); | |||
Main.GetInstance.Start(); | |||
break; | |||
case "BPASmartClient.ScreenMaxWok.App": | |||
windowLarge.Init(TitleName, new ScreenMaxWokControl()); windowLarge.Show(); | |||
Main.GetInstance.Start(); | |||
break; | |||
case "BPASmartClient.ScreenMinWok.App": | |||
windowLarge.Init(TitleName, new ScreenMinWokControl()); windowLarge.Show(); | |||
Main.GetInstance.Start(); | |||
break; | |||
case "BPASmartClient.ScreenMorks.App": | |||
windowLarge.Init(TitleName, new ScreenMorksControl()); windowLarge.Show(); | |||
Main.GetInstance.Start(); | |||
break; | |||
case "BPASmartClient.ScreenSplitMeals.App": | |||
ScreenSplitMealsControl1 ScreenSplit = new ScreenSplitMealsControl1(); | |||
@@ -89,6 +93,8 @@ namespace BPASmartClient.ScreenLib | |||
} | |||
} | |||
Main.GetInstance.StartServer(); | |||
#region 不需要代码 | |||
//foreach (System.Windows.Forms.Screen scr in System.Windows.Forms.Screen.AllScreens) | |||
//{ | |||
@@ -139,6 +145,10 @@ namespace BPASmartClient.ScreenLib | |||
//} | |||
#endregion | |||
windowLarge.Show();windowLarge2.Show(); windowLarge3.Show(); | |||
Main.GetInstance.Start(); | |||
break; | |||
case "BPASmartClient.MaxWokControl.App": | |||
windowLarge.Init(TitleName, new MaxWokMonitorControl()); windowLarge.Show(); | |||
break; | |||
} | |||
#endregion | |||
@@ -5,6 +5,10 @@ | |||
<Nullable>enable</Nullable> | |||
<UseWPF>true</UseWPF> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<None Remove="炒锅.png" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<COMReference Include="IWshRuntimeLibrary"> | |||
@@ -19,8 +23,11 @@ | |||
</COMReference> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<PackageReference Include="BPA.CustomResource" Version="1.0.19" /> | |||
<PackageReference Include="BPA.CustomResource" Version="1.0.23" /> | |||
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.1418.22" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Resource Include="炒锅.png" /> | |||
</ItemGroup> | |||
</Project> |
@@ -7,6 +7,7 @@ using Newtonsoft.Json; | |||
using System; | |||
using System.Collections.Concurrent; | |||
using System.Collections.Generic; | |||
using System.Diagnostics; | |||
using System.Drawing; | |||
using System.IO; | |||
using System.Linq; | |||
@@ -161,6 +162,25 @@ namespace BPASmartClient.ScreenLib | |||
MessageLog.GetInstance.ShowEx($"{Name}:MQTT或者Redis启动时,连接失败,原因:{ex.Message}"); | |||
} | |||
} | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
public void StartServer() | |||
{ | |||
try | |||
{ | |||
string path = System.Configuration.ConfigurationManager.AppSettings["StartServer"].ToString(); | |||
if (System.IO.File.Exists(path)) | |||
{ | |||
Process.Start(path); | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
} | |||
} | |||
/// <summary> | |||
/// 停止服务 | |||
/// </summary> | |||
@@ -0,0 +1,278 @@ | |||
<UserControl x:Class="BPASmartClient.ScreenLib.炒锅.MaxWokMonitorControl" | |||
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.ScreenLib.炒锅" | |||
mc:Ignorable="d" | |||
d:DesignHeight="1080" d:DesignWidth="1920"> | |||
<UserControl.Resources> | |||
<ResourceDictionary> | |||
<ResourceDictionary.MergedDictionaries> | |||
<ResourceDictionary Source="/BPA.CustomResource;component/Themes/ProlineStyle.xaml" /> | |||
</ResourceDictionary.MergedDictionaries> | |||
</ResourceDictionary> | |||
</UserControl.Resources> | |||
<Grid Margin="10,10,10,10"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="2*"/> | |||
<ColumnDefinition Width="1*"/> | |||
</Grid.ColumnDefinitions> | |||
<GroupBox Margin="0,0,10,0" Header="状态监控" Style="{DynamicResource from}" Tag="Start"> | |||
<Image Source="/BPASmartClient.ScreenLib;component/炒锅.png" ></Image> | |||
</GroupBox> | |||
<Grid Margin="0,0,0,0" Grid.Column="1" > | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="2*"/> | |||
<RowDefinition Height="0.7*"/> | |||
</Grid.RowDefinitions> | |||
<GroupBox Margin="0,0,0,10" Header="设备调试" Style="{DynamicResource from}" Tag="Start"> | |||
<Grid Margin="10"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="1.8*"/> | |||
<RowDefinition Height="*"/> | |||
</Grid.RowDefinitions> | |||
<GroupBox Header="炒锅模拟调试"> | |||
<GroupBox Margin="0,10,0,0" Style="{DynamicResource fromNoTitle}" HorizontalAlignment="Stretch" > | |||
<Grid > | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition/> | |||
<ColumnDefinition/> | |||
</Grid.ColumnDefinitions> | |||
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Width="2"></Border> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="30"/> | |||
<RowDefinition/> | |||
</Grid.RowDefinitions> | |||
<TextBlock>一号炒锅控制</TextBlock> | |||
<Border Style="{DynamicResource borderSplider}" VerticalAlignment="Bottom" Height="2" Margin="10,0,10,0"></Border> | |||
<WrapPanel Grid.Row="1" Margin="0,0,0,10"> | |||
<TextBlock Margin="20,10,0,0" FontSize="14" >设定加热档位:</TextBlock> | |||
<ComboBox Margin="20,10,0,0" Width="85" FontSize="14"> | |||
<ComboBoxItem>1挡</ComboBoxItem> | |||
<ComboBoxItem>2挡</ComboBoxItem> | |||
<ComboBoxItem>3挡</ComboBoxItem> | |||
<ComboBoxItem>4挡</ComboBoxItem> | |||
<ComboBoxItem>5挡</ComboBoxItem> | |||
</ComboBox> | |||
<Button Margin="20,10,0,0" Content="设置" Width="40" Height="24" FontSize="14"></Button> | |||
<TextBlock Margin="20,10,0,0" FontSize="14" >搅拌频率设定:</TextBlock> | |||
<ComboBox Margin="20,10,0,0" Width="85" FontSize="14"> | |||
<ComboBoxItem>1挡</ComboBoxItem> | |||
<ComboBoxItem>2挡</ComboBoxItem> | |||
<ComboBoxItem>3挡</ComboBoxItem> | |||
<ComboBoxItem>4挡</ComboBoxItem> | |||
<ComboBoxItem>5挡</ComboBoxItem> | |||
</ComboBox> | |||
<Button Margin="20,10,0,0" Content="设置" Width="40" Height="24" FontSize="14"></Button> | |||
<TextBlock Margin="20,10,0,0" FontSize="14" >翻转频率设定:</TextBlock> | |||
<TextBox Margin="20,10,0,0" Width="85" FontSize="14" Text="100"/> | |||
<Button Margin="20,10,0,0" Content="设置" Width="40" Height="24" FontSize="14"></Button> | |||
<TextBlock Margin="20,10,0,0" FontSize="14" >炒锅角度设定:</TextBlock> | |||
<ComboBox Margin="20,10,0,0" Width="85" FontSize="14"> | |||
<ComboBoxItem>1挡</ComboBoxItem> | |||
<ComboBoxItem>2挡</ComboBoxItem> | |||
<ComboBoxItem>3挡</ComboBoxItem> | |||
<ComboBoxItem>4挡</ComboBoxItem> | |||
</ComboBox> | |||
<Button Margin="20,10,0,0" Content="设置" Width="40" Height="24" FontSize="14"></Button> | |||
<TextBlock Margin="20,10,0,0" FontSize="14" >通道出料控制:</TextBlock> | |||
<ComboBox Margin="20,10,0,0" Width="85" FontSize="14"> | |||
<ComboBoxItem>通道1</ComboBoxItem> | |||
<ComboBoxItem>通道2</ComboBoxItem> | |||
<ComboBoxItem>通道3</ComboBoxItem> | |||
<ComboBoxItem>通道4</ComboBoxItem> | |||
<ComboBoxItem>通道5</ComboBoxItem> | |||
<ComboBoxItem>通道6</ComboBoxItem> | |||
<ComboBoxItem>通道7</ComboBoxItem> | |||
<ComboBoxItem>通道8</ComboBoxItem> | |||
</ComboBox> | |||
<Button Margin="20,10,0,0" Content="出料" Width="40" Height="24" FontSize="14"></Button> | |||
<Button Margin="30,10,0,0" Content="加热启动" Width="100" Height="24" FontSize="14"></Button> | |||
<Button Margin="30,10,0,0" Content="搅拌启动" Width="100" Height="24" FontSize="14"></Button> | |||
<Button Margin="30,10,0,0" Content="炒锅回原点" Width="100" Height="24" FontSize="14"></Button> | |||
<Button Margin="30,10,0,0" Content="出餐启动" Width="100" Height="24" FontSize="14"></Button> | |||
<Button Margin="30,10,0,0" Content="炒锅清洗" Width="100" Height="24" FontSize="14"></Button> | |||
<Button Margin="30,10,0,0" Content="抽洗锅水启动" Width="100" Height="24" FontSize="14"></Button> | |||
</WrapPanel> | |||
</Grid> | |||
<Grid Grid.Column="1"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="30"/> | |||
<RowDefinition/> | |||
</Grid.RowDefinitions> | |||
<TextBlock>二号炒锅控制</TextBlock> | |||
<Border Style="{DynamicResource borderSplider}" VerticalAlignment="Bottom" Height="2" Margin="10,0,10,0"></Border> | |||
<WrapPanel Grid.Row="1" Margin="0,0,0,10"> | |||
<TextBlock Margin="20,10,0,0" FontSize="14" >设定加热档位:</TextBlock> | |||
<ComboBox Margin="20,10,0,0" Width="85" FontSize="14"> | |||
<ComboBoxItem>1挡</ComboBoxItem> | |||
<ComboBoxItem>2挡</ComboBoxItem> | |||
<ComboBoxItem>3挡</ComboBoxItem> | |||
<ComboBoxItem>4挡</ComboBoxItem> | |||
<ComboBoxItem>5挡</ComboBoxItem> | |||
</ComboBox> | |||
<Button Margin="20,10,0,0" Content="设置" Width="40" Height="24" FontSize="14"></Button> | |||
<TextBlock Margin="20,10,0,0" FontSize="14" >搅拌频率设定:</TextBlock> | |||
<ComboBox Margin="20,10,0,0" Width="85" FontSize="14"> | |||
<ComboBoxItem>1挡</ComboBoxItem> | |||
<ComboBoxItem>2挡</ComboBoxItem> | |||
<ComboBoxItem>3挡</ComboBoxItem> | |||
<ComboBoxItem>4挡</ComboBoxItem> | |||
<ComboBoxItem>5挡</ComboBoxItem> | |||
</ComboBox> | |||
<Button Margin="20,10,0,0" Content="设置" Width="40" Height="24" FontSize="14"></Button> | |||
<TextBlock Margin="20,10,0,0" FontSize="14" >翻转频率设定:</TextBlock> | |||
<TextBox Margin="20,10,0,0" Width="85" FontSize="14" Text="100"/> | |||
<Button Margin="20,10,0,0" Content="设置" Width="40" Height="24" FontSize="14"></Button> | |||
<TextBlock Margin="20,10,0,0" FontSize="14" >炒锅角度设定:</TextBlock> | |||
<ComboBox Margin="20,10,0,0" Width="85" FontSize="14"> | |||
<ComboBoxItem>1挡</ComboBoxItem> | |||
<ComboBoxItem>2挡</ComboBoxItem> | |||
<ComboBoxItem>3挡</ComboBoxItem> | |||
<ComboBoxItem>4挡</ComboBoxItem> | |||
</ComboBox> | |||
<Button Margin="20,10,0,0" Content="设置" Width="40" Height="24" FontSize="14"></Button> | |||
<TextBlock Margin="20,10,0,0" FontSize="14" >通道出料控制:</TextBlock> | |||
<ComboBox Margin="20,10,0,0" Width="85" FontSize="14"> | |||
<ComboBoxItem>通道1</ComboBoxItem> | |||
<ComboBoxItem>通道2</ComboBoxItem> | |||
<ComboBoxItem>通道3</ComboBoxItem> | |||
<ComboBoxItem>通道4</ComboBoxItem> | |||
<ComboBoxItem>通道5</ComboBoxItem> | |||
<ComboBoxItem>通道6</ComboBoxItem> | |||
<ComboBoxItem>通道7</ComboBoxItem> | |||
<ComboBoxItem>通道8</ComboBoxItem> | |||
</ComboBox> | |||
<Button Margin="20,10,0,0" Content="出料" Width="40" Height="24" FontSize="14"></Button> | |||
<Button Margin="30,10,0,0" Content="加热启动" Width="100" Height="24" FontSize="14"></Button> | |||
<Button Margin="30,10,0,0" Content="搅拌启动" Width="100" Height="24" FontSize="14"></Button> | |||
<Button Margin="30,10,0,0" Content="炒锅回原点" Width="100" Height="24" FontSize="14"></Button> | |||
<Button Margin="30,10,0,0" Content="出餐启动" Width="100" Height="24" FontSize="14"></Button> | |||
<Button Margin="30,10,0,0" Content="炒锅清洗" Width="100" Height="24" FontSize="14"></Button> | |||
<Button Margin="30,10,0,0" Content="抽洗锅水启动" Width="100" Height="24" FontSize="14"></Button> | |||
</WrapPanel> | |||
</Grid> | |||
</Grid> | |||
</GroupBox> | |||
</GroupBox> | |||
<GroupBox Header="机器人模拟调试" Grid.Row="1"> | |||
<WrapPanel Grid.Row="1" Margin="0,0,0,10"> | |||
<TextBlock Margin="20,10,0,0" FontSize="14" >设模式:</TextBlock> | |||
<ComboBox Margin="20,10,0,0" Width="105" FontSize="14"> | |||
<ComboBoxItem>无任务</ComboBoxItem> | |||
<ComboBoxItem>机器人炒制任务</ComboBoxItem> | |||
<ComboBoxItem>机器人补料任务</ComboBoxItem> | |||
</ComboBox> | |||
<Button Margin="20,10,0,0" Content="设置" Width="60" Height="24" FontSize="14"></Button> | |||
<TextBlock Margin="40,10,0,0" FontSize="14" >取菜盆:</TextBlock> | |||
<ComboBox Margin="20,10,0,0" Width="105" FontSize="14"> | |||
<ComboBoxItem>无任务</ComboBoxItem> | |||
<ComboBoxItem>1号</ComboBoxItem> | |||
<ComboBoxItem>2号</ComboBoxItem> | |||
<ComboBoxItem>3号</ComboBoxItem> | |||
<ComboBoxItem>4号</ComboBoxItem> | |||
<ComboBoxItem>5号</ComboBoxItem> | |||
<ComboBoxItem>6号</ComboBoxItem> | |||
<ComboBoxItem>7号</ComboBoxItem> | |||
<ComboBoxItem>8号</ComboBoxItem> | |||
<ComboBoxItem>9号</ComboBoxItem> | |||
</ComboBox> | |||
<Button Margin="20,10,0,0" Content="取菜盆" Width="60" Height="24" FontSize="14"></Button> | |||
<TextBlock Margin="20,10,0,0" FontSize="14" >取调料:</TextBlock> | |||
<ComboBox Margin="20,10,0,0" Width="105" FontSize="14"> | |||
<ComboBoxItem>无任务</ComboBoxItem> | |||
<ComboBoxItem>1号</ComboBoxItem> | |||
<ComboBoxItem>2号</ComboBoxItem> | |||
<ComboBoxItem>3号</ComboBoxItem> | |||
<ComboBoxItem>4号</ComboBoxItem> | |||
<ComboBoxItem>5号</ComboBoxItem> | |||
<ComboBoxItem>6号</ComboBoxItem> | |||
</ComboBox> | |||
<Button Margin="20,10,0,0" Content="取调料" Width="60" Height="24" FontSize="14"></Button> | |||
<TextBlock Margin="40,10,0,0" FontSize="14" >取空盆:</TextBlock> | |||
<ComboBox Margin="20,10,0,0" Width="105" FontSize="14"> | |||
<ComboBoxItem>无任务</ComboBoxItem> | |||
<ComboBoxItem>1号</ComboBoxItem> | |||
<ComboBoxItem>2号</ComboBoxItem> | |||
<ComboBoxItem>3号</ComboBoxItem> | |||
<ComboBoxItem>4号</ComboBoxItem> | |||
</ComboBox> | |||
<Button Margin="20,10,0,0" Content="取空盆" Width="60" Height="24" FontSize="14"></Button> | |||
<TextBlock Margin="20,10,0,0" FontSize="14" >到--料:</TextBlock> | |||
<ComboBox Margin="20,10,0,0" Width="105" FontSize="14"> | |||
<ComboBoxItem>无任务</ComboBoxItem> | |||
<ComboBoxItem>倒料至一号锅</ComboBoxItem> | |||
<ComboBoxItem>倒料至二号销</ComboBoxItem> | |||
</ComboBox> | |||
<Button Margin="20,10,0,0" Content="运行" Width="60" Height="24" FontSize="14"></Button> | |||
<TextBlock Margin="40,10,0,0" FontSize="14" >放菜盆:</TextBlock> | |||
<ComboBox Margin="20,10,0,0" Width="105" FontSize="14"> | |||
<ComboBoxItem>无任务</ComboBoxItem> | |||
<ComboBoxItem>放菜盆至1号库位</ComboBoxItem> | |||
<ComboBoxItem>放菜盆至2号库位</ComboBoxItem> | |||
<ComboBoxItem>放菜盆至3号库位</ComboBoxItem> | |||
<ComboBoxItem>放菜盆至4号库位</ComboBoxItem> | |||
<ComboBoxItem>放菜盆至5号库位</ComboBoxItem> | |||
<ComboBoxItem>放菜盆至6号库位</ComboBoxItem> | |||
<ComboBoxItem>放菜盆至7号库位</ComboBoxItem> | |||
</ComboBox> | |||
<Button Margin="20,10,0,0" Content="运行" Width="60" Height="24" FontSize="14"></Button> | |||
<Button Margin="35,20,0,0" Content="机器人上使能" Width="100" Height="40" FontSize="14"></Button> | |||
<Button Margin="35,20,0,0" Content="机器人复位" Width="100" Height="40" FontSize="14"></Button> | |||
<Button Margin="35,20,0,0" Content="机器人启动" Width="100" Height="40" FontSize="14"></Button> | |||
<Button Margin="35,20,0,0" Content="机器人停止" Width="100" Height="40" FontSize="14"></Button> | |||
</WrapPanel> | |||
</GroupBox> | |||
</Grid> | |||
</GroupBox> | |||
<GroupBox Header="订单控制" Grid.Row="1" Style="{DynamicResource from}" Tag="Start"> | |||
<WrapPanel Margin="20,10,0,0"> | |||
<Button Margin="20,10,0,0" Content="青椒炒肉" Width="120" Height="40"></Button> | |||
<Button Margin="20,10,0,0" Content="回锅肉" Width="120" Height="40"></Button> | |||
<Button Margin="20,10,0,0" Content="木耳肉片" Width="120" Height="40"></Button> | |||
<Button Margin="20,10,0,0" Content="香炒菜脯" Width="120" Height="40"></Button> | |||
<Button Margin="20,10,0,0" Content="培根炒菜豆" Width="120" Height="40"></Button> | |||
<Button Margin="20,10,0,0" Content="蒜蓉炒菜芯" Width="120" Height="40"></Button> | |||
<Button Margin="20,10,0,0" Content="腊肠炒菜椒" Width="120" Height="40"></Button> | |||
<Button Margin="20,10,0,0" Content="茄子炒菜豆" Width="120" Height="40"></Button> | |||
<Button Margin="20,10,0,0" Content="大酱炒菜梗" Width="120" Height="40"></Button> | |||
<Button Margin="20,10,0,0" Content="芹菜炒菜脯" Width="120" Height="40"></Button> | |||
<Button Margin="20,10,0,0" Content="蒜炒菜豆" Width="120" Height="40"></Button> | |||
<Button Margin="20,10,0,0" Content="酸辣莴笋" Width="120" Height="40"></Button> | |||
</WrapPanel> | |||
</GroupBox> | |||
</Grid> | |||
</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.ScreenLib.炒锅 | |||
{ | |||
/// <summary> | |||
/// MaxWokMonitorControl.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class MaxWokMonitorControl : UserControl | |||
{ | |||
public MaxWokMonitorControl() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -8,7 +8,8 @@ | |||
<add key="GgAdder" value="https://stream7.iqilu.com/10339/upload_transcode/202002/18/20200218114723HDu3hhxqIT.mp4"/> | |||
<add key="SaasRoute" value="https://witt.black-pa.com/kitchen/api/StoreHelper/GeBasisGateList?StoreId=0c32b2e2-0dc9-4941-b73d-3dc91f7268ab"/> | |||
<!--显示窗体:0 广告 1 地球--> | |||
<add key="ShowForm" value="0"/> | |||
<add key="ShowForm" value="1"/> | |||
<add key="StartServer" value="D:\fengyoufu\代码\Code\C#项目\收银系统\Pos\bin\Debug\net6.0-windows\黑菠萝收银系统.exe"/> | |||
<!--<add key="一号屏" value="0"/> | |||
<add key="二号屏" value="1"/> | |||
<add key="三号屏" value="2"/>--> | |||
@@ -232,7 +232,7 @@ | |||
<icon:Material Kind="FileCode"/> | |||
</ToggleButton> | |||
<Slider DockPanel.Dock="Right" x:Name="slikl" Width="100" Maximum="16" Minimum="1" Margin="4 0 0 0" | |||
<Slider DockPanel.Dock="Right" x:Name="slikl" Width="100" Maximum="50" Minimum="4" Margin="4 0 0 0" | |||
HorizontalContentAlignment="Center" Value="{Binding ElementName=cav,Path=GridPxiel}" /> | |||
<TextBlock DockPanel.Dock="Right" Text="对齐:" VerticalAlignment="Center" Margin="16 0 0 0"/> | |||
@@ -254,31 +254,6 @@ | |||
<ScrollViewer VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Visible"> | |||
<Grid> | |||
<Compiler:CanvasPanel x:Name="cav" Width="1920" Height="1080" Visibility="{Binding CanvasPanelVisibility}" SelectedItem="{Binding CanSelectedItem,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" AllowDrop="True" RenderTransformOrigin="0.5,0.5" ClipToBounds="True" UseLayoutRounding="True" Focusable="True" SnapsToDevicePixels="True"> | |||
<Compiler:CanvasPanel.Background> | |||
<VisualBrush TileMode="Tile" Viewport="0,0,20,20" ViewportUnits="Absolute"> | |||
<VisualBrush.Visual> | |||
<Rectangle Width="20" Height="20" StrokeDashArray="5,5" StrokeThickness="0.4" Stroke="#CBCBCB"> | |||
<Rectangle.Style> | |||
<Style TargetType="{x:Type Rectangle}"> | |||
<Style.Triggers> | |||
<DataTrigger Binding="{Binding UseAutoAlignment, RelativeSource={RelativeSource AncestorType={x:Type Compiler:CanvasPanel}, Mode=FindAncestor}}" Value="True"> | |||
<Setter Property="Visibility" Value="Visible"/> | |||
</DataTrigger> | |||
<DataTrigger Binding="{Binding UseAutoAlignment, RelativeSource={RelativeSource AncestorType={x:Type Compiler:CanvasPanel}, Mode=FindAncestor}}" Value="False"> | |||
<Setter Property="Visibility" Value="Collapsed"/> | |||
</DataTrigger> | |||
</Style.Triggers> | |||
</Style> | |||
</Rectangle.Style> | |||
</Rectangle> | |||
</VisualBrush.Visual> | |||
</VisualBrush> | |||
</Compiler:CanvasPanel.Background> | |||
<Compiler:CanvasPanel.RenderTransform> | |||
<TransformGroup> | |||
<TranslateTransform x:Name="CanvasTranslate"/> | |||
</TransformGroup> | |||
</Compiler:CanvasPanel.RenderTransform> | |||
</Compiler:CanvasPanel> | |||
<ctl:RunCanvas x:Name="runCanvas" Visibility="{Binding DataContext.RunCanvasVisibility, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}}" /> | |||
</Grid> | |||
@@ -404,14 +404,6 @@ namespace BeDesignerSCADA.Controls | |||
{ | |||
cav.Load(ofd.FileName); | |||
} | |||
DoubleAnimation da = new DoubleAnimation(-200, 0, new Duration(TimeSpan.FromMilliseconds(250))); | |||
da.EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseOut }; | |||
CanvasTranslate.BeginAnimation(TranslateTransform.XProperty, da); | |||
DoubleAnimation daop = new DoubleAnimation(0, 1, new Duration(TimeSpan.FromMilliseconds(250))); | |||
daop.EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseOut }; | |||
cav.BeginAnimation(OpacityProperty, daop); | |||
} | |||
/// <summary> | |||
/// 保存 | |||
@@ -2123,7 +2123,7 @@ namespace FryPot_DosingSystem.Control | |||
// throw; | |||
} | |||
})); | |||
GetFryTwoData("D3302", new Action<ushort[]>(data => | |||
GetFryTwoData("D3301", new Action<ushort[]>(data => | |||
{ | |||
try | |||
{ | |||
@@ -2245,7 +2245,7 @@ namespace FryPot_DosingSystem.Control | |||
// throw; | |||
} | |||
})); | |||
GetFryThreeData("D3303", new Action<ushort[]>(data => | |||
GetFryThreeData("D3301", new Action<ushort[]>(data => | |||
{ | |||
try | |||
{ | |||
@@ -2367,7 +2367,7 @@ namespace FryPot_DosingSystem.Control | |||
//throw; | |||
} | |||
})); | |||
GetFryFourData("D3304", new Action<ushort[]>(data => | |||
GetFryFourData("D3301", new Action<ushort[]>(data => | |||
{ | |||
try | |||
{ | |||
@@ -2489,7 +2489,7 @@ namespace FryPot_DosingSystem.Control | |||
// throw; | |||
} | |||
})); | |||
GetFryFiveData("D3305", new Action<ushort[]>(data => | |||
GetFryFiveData("D3301", new Action<ushort[]>(data => | |||
{ | |||
try | |||
{ | |||
@@ -3723,7 +3723,7 @@ namespace FryPot_DosingSystem.Control | |||
materialType = result.materialCollection[i], | |||
materialId = result.RecipeId | |||
}); | |||
RollerThreeDataWrite(i, result.materialCollection[i].MaterialLoc, (ushort)(result.materialCollection[i].MaterialWeight + RollerNetweight), result.materialCollection[i].MaterialOffset);//3号滚筒线桶号以及重量数据、偏差量下发 | |||
RollerThreeDataWrite(i, result.materialCollection[i].MaterialLoc, (ushort)(result.materialCollection[i].MaterialWeight + RollerNetweight), result.materialCollection[i].MaterialOffset * 10);//3号滚筒线桶号以及重量数据、偏差量下发 | |||
@@ -3854,7 +3854,6 @@ namespace FryPot_DosingSystem.Control | |||
if (RTrig.GetInstance("炒锅5配方完成").Start(Convert.ToBoolean(globalVar.fryPotFive.RecipeCompleteSingle))) | |||
{ | |||
ResetPotData(5); | |||
Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.workflows.Add(new WorkflowModel { id = globalVar.LFiveCurrentCookingStep + 1, Name = "配方制作完成!", isBool = IsBool.Yes }); })); | |||
ActionManage.GetInstance.Send("炒锅工艺流程更新", 5); | |||
MessageNotify.GetInstance.ShowRunLog("炒锅5配方制作完成"); | |||
@@ -3930,7 +3929,7 @@ namespace FryPot_DosingSystem.Control | |||
materialType = result.materialCollection[i], | |||
materialId = result.RecipeId | |||
}); | |||
RollerTwoDataWrite(i, result.materialCollection[i].MaterialLoc, (ushort)(result.materialCollection[i].MaterialWeight + RollerNetweight), result.materialCollection[i].MaterialOffset);//2号滚筒线桶号以及重量、偏差量数据下发 | |||
RollerTwoDataWrite(i, result.materialCollection[i].MaterialLoc, (ushort)(result.materialCollection[i].MaterialWeight + RollerNetweight), result.materialCollection[i].MaterialOffset*10);//2号滚筒线桶号以及重量、偏差量数据下发 | |||
@@ -4156,7 +4155,7 @@ namespace FryPot_DosingSystem.Control | |||
materialType = result.materialCollection[i], | |||
materialId = result.RecipeId | |||
}); | |||
RollerOneDataWrite(i, result.materialCollection[i].MaterialLoc, (ushort)(result.materialCollection[i].MaterialWeight + RollerNetweight), result.materialCollection[i].MaterialOffset);//1号滚筒线桶号以及重量、偏差量数据下发 | |||
RollerOneDataWrite(i, result.materialCollection[i].MaterialLoc, (ushort)(result.materialCollection[i].MaterialWeight + RollerNetweight), result.materialCollection[i].MaterialOffset*10);//1号滚筒线桶号以及重量、偏差量数据下发 | |||
@@ -6382,23 +6381,23 @@ namespace FryPot_DosingSystem.Control | |||
DeviceOperate.GetInstance.WriteRealPlcData("D1244", 0.0F); | |||
DeviceOperate.GetInstance.WriteRealPlcData("D1246", 0.0F); | |||
} | |||
/// <summary> | |||
/// 累加重量计算 | |||
/// </summary> | |||
/// <param name="collect"></param> | |||
public ushort SumAllTargetWeight(ObservableCollection<FlowProcessModel> collect,int length) | |||
{ | |||
ushort total = 0; | |||
if (collect.Count >= length) | |||
{ | |||
for (int i = 0; i < length; i++) | |||
{ | |||
total += collect.ElementAt(i).TargeWeight; | |||
///// <summary> | |||
///// 累加重量计算 | |||
///// </summary> | |||
///// <param name="collect"></param> | |||
//public ushort SumAllTargetWeight(ObservableCollection<FlowProcessModel> collect,int length) | |||
//{ | |||
// ushort total = 0; | |||
// if (collect.Count >= length) | |||
// { | |||
// for (int i = 0; i < length; i++) | |||
// { | |||
// total += collect.ElementAt(i).TargeWeight; | |||
} | |||
} | |||
return total; | |||
} | |||
// } | |||
// } | |||
// return total; | |||
//} | |||
/// <summary> | |||
@@ -6414,6 +6413,8 @@ namespace FryPot_DosingSystem.Control | |||
#region 炒锅工艺下发 | |||
int length = 0; | |||
WritePotData(potNum,"D3920",Convert.ToUInt16(result.FlowProcess.targetWeightOffset*10));//目标重量偏差下发 | |||
WritePotData(potNum, "D3143", Convert.ToUInt16(result.FlowProcess.StirTime));//秘制配方搅拌时间下发 | |||
if (result.FlowProcess.fpModels.FirstOrDefault(p => p.FryMaterialNum == "清洗") != null) | |||
{ | |||
WritePotData(potNum, "D3120", Convert.ToUInt16(result.FlowProcess.fpModels.Count - 1));//工序数量 | |||
@@ -6421,7 +6422,7 @@ namespace FryPot_DosingSystem.Control | |||
{ | |||
length = result.FlowProcess.fpModels.Count - 1; | |||
WritePotData(potNum, "D3112", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(result.FlowProcess.fpModels.Count - 1).FryTemperature * 10)); | |||
WritePotData(potNum, "D3113", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(result.FlowProcess.fpModels.Count - 1).FryPeriodTime * 600)); | |||
WritePotData(potNum, "D3113", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(result.FlowProcess.fpModels.Count - 1).FryPeriodTime)); | |||
WritePotData(potNum, "D3114", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(result.FlowProcess.fpModels.Count - 1).FryWeight * 10));//炒制重量 | |||
WritePotData(potNum, "D3115", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(result.FlowProcess.fpModels.Count - 1).SmallFirePercent)); | |||
WritePotData(potNum, "D3116", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(result.FlowProcess.fpModels.Count - 1).MidFirePercent)); | |||
@@ -6431,7 +6432,7 @@ namespace FryPot_DosingSystem.Control | |||
WritePotData(potNum, "D4121", Convert.ToUInt16((result.FlowProcess.fpModels.ElementAt(result.FlowProcess.fpModels.Count - 1).TargeWeight*10)));//清洗目标重量 | |||
} | |||
else | |||
else | |||
{ | |||
length = result.FlowProcess.fpModels.Count; | |||
} | |||
@@ -6476,7 +6477,7 @@ namespace FryPot_DosingSystem.Control | |||
} | |||
WritePotData(potNum, "D3002", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10)); | |||
WritePotData(potNum, "D3003", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600)); | |||
WritePotData(potNum, "D3003", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime)); | |||
WritePotData(potNum, "D3005", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent)); | |||
WritePotData(potNum, "D3006", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent)); | |||
WritePotData(potNum, "D3007", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent)); | |||
@@ -6515,7 +6516,7 @@ namespace FryPot_DosingSystem.Control | |||
} | |||
WritePotData(potNum, "D3012", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10)); | |||
WritePotData(potNum, "D3013", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600)); | |||
WritePotData(potNum, "D3013", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime)); | |||
WritePotData(potNum, "D3015", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent)); | |||
WritePotData(potNum, "D3016", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent)); | |||
WritePotData(potNum, "D3017", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent)); | |||
@@ -6554,7 +6555,7 @@ namespace FryPot_DosingSystem.Control | |||
} | |||
WritePotData(potNum, "D3022", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10)); | |||
WritePotData(potNum, "D3023", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600)); | |||
WritePotData(potNum, "D3023", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime)); | |||
WritePotData(potNum, "D3025", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent)); | |||
WritePotData(potNum, "D3026", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent)); | |||
WritePotData(potNum, "D3027", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent)); | |||
@@ -6593,7 +6594,7 @@ namespace FryPot_DosingSystem.Control | |||
} | |||
WritePotData(potNum, "D3032", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10)); | |||
WritePotData(potNum, "D3033", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600)); | |||
WritePotData(potNum, "D3033", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime)); | |||
WritePotData(potNum, "D3035", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent)); | |||
WritePotData(potNum, "D3036", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent)); | |||
WritePotData(potNum, "D3037", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent)); | |||
@@ -6632,7 +6633,7 @@ namespace FryPot_DosingSystem.Control | |||
} | |||
WritePotData(potNum, "D3042", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10)); | |||
WritePotData(potNum, "D3043", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600)); | |||
WritePotData(potNum, "D3043", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime)); | |||
WritePotData(potNum, "D3045", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent)); | |||
WritePotData(potNum, "D3046", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent)); | |||
WritePotData(potNum, "D3047", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent)); | |||
@@ -6671,7 +6672,7 @@ namespace FryPot_DosingSystem.Control | |||
} | |||
WritePotData(potNum, "D3052", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10)); | |||
WritePotData(potNum, "D3053", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600)); | |||
WritePotData(potNum, "D3053", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime)); | |||
WritePotData(potNum, "D3055", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent)); | |||
WritePotData(potNum, "D3056", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent)); | |||
WritePotData(potNum, "D3057", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent)); | |||
@@ -6710,7 +6711,7 @@ namespace FryPot_DosingSystem.Control | |||
} | |||
WritePotData(potNum, "D3062", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10)); | |||
WritePotData(potNum, "D3063", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600)); | |||
WritePotData(potNum, "D3063", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime)); | |||
WritePotData(potNum, "D3065", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent)); | |||
WritePotData(potNum, "D3066", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent)); | |||
WritePotData(potNum, "D3067", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent)); | |||
@@ -6749,7 +6750,7 @@ namespace FryPot_DosingSystem.Control | |||
} | |||
WritePotData(potNum, "D3072", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10)); | |||
WritePotData(potNum, "D3073", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600)); | |||
WritePotData(potNum, "D3073", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime)); | |||
WritePotData(potNum, "D3075", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent)); | |||
WritePotData(potNum, "D3076", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent)); | |||
WritePotData(potNum, "D3077", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent)); | |||
@@ -6788,7 +6789,7 @@ namespace FryPot_DosingSystem.Control | |||
} | |||
WritePotData(potNum, "D3082", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10)); | |||
WritePotData(potNum, "D3083", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600)); | |||
WritePotData(potNum, "D3083", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime)); | |||
WritePotData(potNum, "D3085", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent)); | |||
WritePotData(potNum, "D3086", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent)); | |||
WritePotData(potNum, "D3087", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent)); | |||
@@ -6826,7 +6827,7 @@ namespace FryPot_DosingSystem.Control | |||
} | |||
WritePotData(potNum, "D3092", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10)); | |||
WritePotData(potNum, "D3093", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600)); | |||
WritePotData(potNum, "D3093", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime)); | |||
WritePotData(potNum, "D3095", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent)); | |||
WritePotData(potNum, "D3096", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent)); | |||
WritePotData(potNum, "D3097", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).BigFirePercent)); | |||
@@ -6865,7 +6866,7 @@ namespace FryPot_DosingSystem.Control | |||
} | |||
WritePotData(potNum, "D3102", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10)); | |||
WritePotData(potNum, "D3103", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600)); | |||
WritePotData(potNum, "D3103", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime)); | |||
WritePotData(potNum, "D3105", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent)); | |||
WritePotData(potNum, "D3106", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent)); | |||
@@ -6905,7 +6906,7 @@ namespace FryPot_DosingSystem.Control | |||
if (result.FlowProcess.fpModels.ElementAt(i).FryMaterialNum == "清洗") | |||
{ | |||
WritePotData(potNum, "D3112", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryTemperature * 10)); | |||
WritePotData(potNum, "D3113", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime * 600)); | |||
WritePotData(potNum, "D3113", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryPeriodTime)); | |||
WritePotData(potNum, "D3114", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).FryWeight * 10));//炒制重量 | |||
WritePotData(potNum, "D3115", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).SmallFirePercent)); | |||
WritePotData(potNum, "D3116", Convert.ToUInt16(result.FlowProcess.fpModels.ElementAt(i).MidFirePercent)); | |||
@@ -6997,7 +6998,7 @@ namespace FryPot_DosingSystem.Control | |||
#endregion | |||
WritePotData(PotNum, "D3120", 0); | |||
WritePotData(PotNum,"D3920",0);//目标重量清零 | |||
WritePotData(PotNum, "D3143", 0);//秘制配方搅拌时间清零 | |||
} | |||
} | |||
@@ -13,6 +13,17 @@ namespace FryPot_DosingSystem.Model | |||
public string RecipeName { get; set; } | |||
public float targetWeightOffset { get { return _targetWeightOffset; } set { _targetWeightOffset = value;OnPropertyChanged(); }} | |||
private float _targetWeightOffset; | |||
private ushort _stirTime; | |||
/// <summary> | |||
/// 秘制配方搅拌时间 | |||
/// </summary> | |||
public ushort StirTime | |||
{ | |||
get { return _stirTime; } | |||
set { _stirTime = value; OnPropertyChanged(); } | |||
} | |||
public ObservableCollection<FlowProcessModel> fpModels { get; set; } = new ObservableCollection<FlowProcessModel>(); | |||
} | |||
} |
@@ -7,7 +7,7 @@ using System.Threading.Tasks; | |||
namespace FryPot_DosingSystem.Model | |||
{ | |||
internal class FlowProcessModel:ObservableObject | |||
internal class FlowProcessModel:ObservableObject,ICloneable | |||
{ | |||
///// <summary> | |||
///// 工艺步骤对应名称 | |||
@@ -37,8 +37,8 @@ namespace FryPot_DosingSystem.Model | |||
/// <summary> | |||
/// 目标重量 | |||
/// </summary> | |||
public ushort TargeWeight { get { return _targetWeight; }set { _targetWeight = value;OnPropertyChanged(); } } | |||
private ushort _targetWeight; | |||
public double TargeWeight { get { return _targetWeight; }set { _targetWeight = value;OnPropertyChanged(); } } | |||
private double _targetWeight; | |||
/// <summary> | |||
/// 炒制温度 | |||
/// </summary> | |||
@@ -72,5 +72,10 @@ namespace FryPot_DosingSystem.Model | |||
/// </summary> | |||
public double StrongFirePercent { get { return _strongFilePercent; } set { _strongFilePercent = value; OnPropertyChanged(); } } | |||
private double _strongFilePercent; | |||
public object Clone() | |||
{ | |||
return MemberwiseClone(); | |||
} | |||
} | |||
} |
@@ -7,7 +7,7 @@ using System.Threading.Tasks; | |||
namespace FryPot_DosingSystem.Model | |||
{ | |||
internal class MaterialType:ObservableObject | |||
internal class MaterialType:ObservableObject,ICloneable | |||
{ | |||
/// <summary> | |||
/// 原料名称 | |||
@@ -22,8 +22,8 @@ namespace FryPot_DosingSystem.Model | |||
/// <summary> | |||
/// 原料重量 | |||
/// </summary> | |||
private ushort _materialWeight; | |||
public ushort MaterialWeight { get { return _materialWeight; }set { _materialWeight = value;OnPropertyChanged(); } } | |||
private double _materialWeight; | |||
public double MaterialWeight { get { return _materialWeight; }set { _materialWeight = value;OnPropertyChanged(); } } | |||
/// <summary> | |||
/// 原料偏差 | |||
@@ -36,6 +36,9 @@ namespace FryPot_DosingSystem.Model | |||
private ushort _materialLoc; | |||
public ushort MaterialLoc { get { return _materialLoc; } set { _materialLoc = value; OnPropertyChanged(); } } | |||
public object Clone() | |||
{ | |||
return MemberwiseClone(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,47 @@ | |||
<Window x:Class="FryPot_DosingSystem.View.CopyInfoView" | |||
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:vm="clr-namespace:FryPot_DosingSystem.ViewModel" | |||
xmlns:local="clr-namespace:FryPot_DosingSystem.View" | |||
mc:Ignorable="d" | |||
Title="CopyInfoView" Height="250" Width="600" WindowStartupLocation="CenterScreen" WindowStyle="None" AllowsTransparency="True"> | |||
<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> | |||
<Window.DataContext> | |||
<vm:CopyInfoViewModel/> | |||
</Window.DataContext> | |||
<Border x:Name="br" BorderThickness="1" BorderBrush="Aqua"> | |||
<Border.Background> | |||
<SolidColorBrush Color="#FF0B2F5F"/> | |||
</Border.Background> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition/> | |||
<RowDefinition/> | |||
</Grid.RowDefinitions> | |||
<!--<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" > | |||
<TextBlock Text="名称:" Foreground="#FF2AB2E7" FontSize="18" VerticalAlignment="Center"/> | |||
<TextBox Text="{Binding MaterialName}" FontSize="18" Width="300" Height="50" /> | |||
</StackPanel>--> | |||
<StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Center" > | |||
<TextBlock Text="炒锅编号:" Foreground="#FF2AB2E7" FontSize="18" VerticalAlignment="Center"/> | |||
<TextBox Text="{Binding FryNum}" FontSize="18" Width="300" Height="50"/> | |||
</StackPanel> | |||
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center" > | |||
<Button Content="确定" Background="Transparent" Foreground="#FF2AB2E7" FontSize="18" Margin="40,0,20,0" Width="100" Height="50" Command="{Binding ConfimCommand}"/> | |||
<Button Content="取消" FontSize="18" Margin="40,0,20,0" Width="100" Height="50" Click="Button_Click"/> | |||
</StackPanel> | |||
</Grid> | |||
</Border> | |||
</Window> |
@@ -0,0 +1,36 @@ | |||
using BPASmartClient.Helper; | |||
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 FryPot_DosingSystem.View | |||
{ | |||
/// <summary> | |||
/// CopyInfoView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class CopyInfoView : Window | |||
{ | |||
public CopyInfoView() | |||
{ | |||
InitializeComponent(); | |||
this.br.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); }; | |||
ActionManage.GetInstance.CancelRegister("CloseCopyInfoView"); | |||
ActionManage.GetInstance.Register(new Action(() => { this.Close(); }), "CloseCopyInfoView"); | |||
} | |||
private void Button_Click(object sender, RoutedEventArgs e) | |||
{ | |||
this.Close(); | |||
} | |||
} | |||
} |
@@ -450,6 +450,11 @@ | |||
<TextBox Background="Transparent" BorderBrush="#FF2AB2E7" Foreground="#e69519" Cursor="Hand" Text="{Binding targetWeightOffset}" FontSize="18" Width="200" TextChanged="TextBox_TextChanged_10" Height="35" VerticalContentAlignment="Center"/> | |||
<TextBlock Text="Kg" FontSize="20" Foreground="#FF2AB2E7" VerticalAlignment="Center"/> | |||
</StackPanel> | |||
<StackPanel Grid.Row="3" VerticalAlignment="Center" Orientation="Horizontal" Margin="500,0,0,5"> | |||
<TextBlock Text="秘制配方搅拌时间设置:" FontSize="20" Foreground="#FF2AB2E7" VerticalAlignment="Center"/> | |||
<TextBox Background="Transparent" BorderBrush="#FF2AB2E7" Foreground="#e69519" Cursor="Hand" Text="{Binding StirTime}" FontSize="18" Width="200" TextChanged="TextBox_TextChanged_10" Height="35" VerticalContentAlignment="Center"/> | |||
<TextBlock Text="分钟" FontSize="20" Foreground="#FF2AB2E7" VerticalAlignment="Center"/> | |||
</StackPanel> | |||
<ScrollViewer Grid.Row="4" VerticalScrollBarVisibility="Hidden"> | |||
<ItemsControl x:Name="itemcontrols" AlternationCount="{Binding flowProcessModels.Count}" ItemsSource="{Binding flowProcessModels}" Margin="0,1,0,-1"> | |||
<ItemsControl.ItemsPanel> | |||
@@ -468,7 +473,7 @@ RelativeSource TemplatedParent}}" Foreground="SkyBlue" Width="87" Height="40" V | |||
<TextBox Text="{Binding TargeWeight}" Width="112" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,0.5,1" TextChanged="TextBox_TextChanged_8"/> | |||
<TextBox Text="{Binding FryTemperature}" Width="92" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,0.5,1" TextChanged="TextBox_TextChanged_2"/> | |||
<TextBox Text="{Binding FryPeriodTime}" Width="92" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,1,1" TextChanged="TextBox_TextChanged_3"/> | |||
<TextBox FontSize="18" > | |||
<TextBox.Template> | |||
@@ -480,10 +485,10 @@ RelativeSource TemplatedParent}}" Foreground="SkyBlue" Width="87" Height="40" V | |||
</StackPanel> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</TextBox.Template> | |||
</TextBox> | |||
<TextBox FontSize="18" > | |||
@@ -106,9 +106,19 @@ namespace FryPot_DosingSystem.View | |||
private void TextBox_TextChanged_1(object sender, TextChangedEventArgs e) | |||
{ | |||
if (sender is TextBox txt) | |||
if (sender is TextBox txtbox) | |||
{ | |||
txt.Text = TextLimit(txt.Text); | |||
if (Regex.IsMatch(txtbox.Text, @"^[0-9]+(.[0-9]{0,1})?$"))//验证整数或1位小数 | |||
{ | |||
txtbox.Text = txtbox.Text.Trim(); | |||
} | |||
else | |||
{ | |||
// MessageBox.Show("原料重量非法输入", "警告", MessageBoxButton.OKCancel, MessageBoxImage.Warning); | |||
txtbox.Text = string.Empty; | |||
} | |||
} | |||
} | |||
@@ -162,9 +172,19 @@ namespace FryPot_DosingSystem.View | |||
private void TextBox_TextChanged_8(object sender, TextChangedEventArgs e) | |||
{ | |||
if (sender is TextBox txt) | |||
if (sender is TextBox txtbox) | |||
{ | |||
txt.Text = TextLimit(txt.Text); | |||
if (Regex.IsMatch(txtbox.Text, @"^[0-9]+(.[0-9]{0,1})?$"))//验证整数或1位小数 | |||
{ | |||
txtbox.Text = txtbox.Text.Trim(); | |||
} | |||
else | |||
{ | |||
// MessageBox.Show("原料重量非法输入", "警告", MessageBoxButton.OKCancel, MessageBoxImage.Warning); | |||
txtbox.Text = string.Empty; | |||
} | |||
} | |||
} | |||
@@ -162,22 +162,36 @@ namespace FryPot_DosingSystem.View | |||
private void TextBox_TextChanged_1(object sender, TextChangedEventArgs e) | |||
{ | |||
//if (sender is TextBox txtbox) | |||
//{ | |||
// if (txtbox != null) | |||
// { | |||
// if (Regex.IsMatch(txtbox.Text, @"^\+?[0-9][0-9]*$"))//非零正整数 | |||
// { | |||
// txtbox.Text = txtbox.Text.Trim(); | |||
// } | |||
// else | |||
// { | |||
// // MessageBox.Show("原料重量非法输入", "警告", MessageBoxButton.OKCancel, MessageBoxImage.Warning); | |||
// txtbox.Text = string.Empty; | |||
// } | |||
// } | |||
//} | |||
if (sender is TextBox txtbox) | |||
{ | |||
if (txtbox != null) | |||
if (Regex.IsMatch(txtbox.Text, @"^[0-9]+(.[0-9]{0,1})?$"))//验证整数或1位小数 | |||
{ | |||
if (Regex.IsMatch(txtbox.Text, @"^\+?[0-9][0-9]*$"))//非零正整数 | |||
{ | |||
txtbox.Text = txtbox.Text.Trim(); | |||
txtbox.Text = txtbox.Text.Trim(); | |||
} | |||
else | |||
{ | |||
// MessageBox.Show("原料重量非法输入", "警告", MessageBoxButton.OKCancel, MessageBoxImage.Warning); | |||
txtbox.Text = string.Empty; | |||
} | |||
} | |||
else | |||
{ | |||
// MessageBox.Show("原料重量非法输入", "警告", MessageBoxButton.OKCancel, MessageBoxImage.Warning); | |||
txtbox.Text = string.Empty; | |||
} | |||
} | |||
} | |||
@@ -150,7 +150,9 @@ | |||
<TextBlock Text="操作:" Foreground="White" FontSize="18"></TextBlock> | |||
<Button Style="{DynamicResource ButtonStyle1}" Content="编辑" Cursor="Hand" Foreground="Orange" FontSize="18" Background="Transparent" BorderThickness="0" Command="{Binding DataContext.EditRecipeCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}" | |||
CommandParameter="{Binding RecipeId}"/> | |||
<Button Margin="60,0,0,0" Style="{DynamicResource ButtonStyle1}" Content="炒制工艺" Cursor="Hand" Foreground="Orange" FontSize="18" Background="Transparent" BorderThickness="0" Command="{Binding DataContext.OperateFlowProcess,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}" CommandParameter="{Binding RecipeName}"/> | |||
<Button Style="{DynamicResource ButtonStyle1}" Margin="15,0,0,0" Content="复制" Cursor="Hand" Foreground="Orange" FontSize="18" Background="Transparent" BorderThickness="0" Command="{Binding DataContext.CopyRecipeCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}" | |||
CommandParameter="{Binding RecipeId}"/> | |||
<Button Margin="15,0,0,0" Style="{DynamicResource ButtonStyle1}" Content="炒制工艺" Cursor="Hand" Foreground="Orange" FontSize="18" Background="Transparent" BorderThickness="0" Command="{Binding DataContext.OperateFlowProcess,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}" CommandParameter="{Binding RecipeName}"/> | |||
</StackPanel> | |||
<StackPanel Orientation="Horizontal" Margin="0,5"> | |||
<TextBlock Text="创建时间:" FontSize="18" Foreground="White"></TextBlock> | |||
@@ -0,0 +1,33 @@ | |||
| |||
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 FryPot_DosingSystem.ViewModel | |||
{ | |||
internal class CopyInfoViewModel:ObservableObject | |||
{ | |||
private string _fryNum; | |||
public string FryNum { get { return _fryNum; } set { _fryNum = value;OnPropertyChanged(); } } | |||
public RelayCommand ConfimCommand { get; set; } | |||
public CopyInfoViewModel() | |||
{ | |||
ConfimCommand = new RelayCommand(() => { | |||
if (FryNum != null && FryNum != "" && int.TryParse(FryNum.Trim(), out int Num)) | |||
{ | |||
ActionManage.GetInstance.Send("CopyPotNum",Num); | |||
ActionManage.GetInstance.Send("CloseCopyInfoView"); | |||
} | |||
}); | |||
} | |||
} | |||
} |
@@ -26,6 +26,18 @@ namespace FryPot_DosingSystem.ViewModel | |||
/// </summary> | |||
public string targetWeightOffset { get { return _targetWeightOffset; } set { _targetWeightOffset = value;OnPropertyChanged(); } } | |||
private string _targetWeightOffset="0"; | |||
private string _stirTime="0"; | |||
/// <summary> | |||
/// 秘制配方搅拌时间 | |||
/// </summary> | |||
public string StirTime | |||
{ | |||
get { return _stirTime; } | |||
set { _stirTime = value; OnPropertyChanged(); } | |||
} | |||
public string currentRecipeName { get; set; } | |||
public static int currentItemId { get; set; } | |||
public RelayCommand CloseWindowCommand { get; set; } | |||
@@ -72,6 +84,7 @@ namespace FryPot_DosingSystem.ViewModel | |||
if (res != null && res is NewRecipeModel recipe) //编辑已有工艺 | |||
{ | |||
targetWeightOffset = recipe.FlowProcess.targetWeightOffset.ToString(); | |||
StirTime=recipe.FlowProcess.StirTime.ToString(); | |||
foreach (var item in recipe.materialCollection) | |||
{ | |||
if (!FlowItems.Contains(item.MaterialLoc.ToString())) | |||
@@ -81,7 +94,6 @@ namespace FryPot_DosingSystem.ViewModel | |||
{ | |||
flowProcessModels.Add(new FlowProcessModel { FryMaterialNum = item.FryMaterialNum, FrySpeed = item.FrySpeed, FryWeight = item.FryWeight, TargeWeight=item.TargeWeight, FryTemperature = item.FryTemperature, FryPeriodTime = item.FryPeriodTime, SmallFirePercent = item.SmallFirePercent, MidFirePercent = item.MidFirePercent, BigFirePercent = item.BigFirePercent, StrongFirePercent = item.StrongFirePercent }); | |||
} | |||
// ActionManage.GetInstance.Send("MaterialNum", recipe.materialCollection.Count); | |||
} | |||
else//创建新工艺 | |||
@@ -127,6 +139,16 @@ namespace FryPot_DosingSystem.ViewModel | |||
name.FlowProcess.targetWeightOffset = 0.0F; | |||
return; | |||
} | |||
if (ushort.TryParse(StirTime.Trim(), out ushort time)) | |||
{ | |||
name.FlowProcess.StirTime = time;//秘制配方搅拌时间 | |||
} | |||
else | |||
{ | |||
MessageBox.Show("非法秘制配方搅拌时间设置", "提示", MessageBoxButton.OK, MessageBoxImage.Error); | |||
name.FlowProcess.StirTime = 0; | |||
return; | |||
} | |||
//工艺桶号重复性检测 | |||
foreach (var item in name.materialCollection) | |||
{ | |||
@@ -13,6 +13,7 @@ using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using System.Windows.Media.Media3D; | |||
namespace FryPot_DosingSystem.ViewModel | |||
{ | |||
@@ -28,6 +29,11 @@ namespace FryPot_DosingSystem.ViewModel | |||
///// </summary> | |||
//private string _recipeName; | |||
//public string RecipeName { get { return _recipeName; } set { _recipeName = value; OnPropertyChanged(); } } | |||
/// <summary> | |||
/// 复制配方的Id | |||
/// </summary> | |||
public static string CopyRecipeId { get; set; } | |||
public ObservableCollection<NewRecipeModel> recipeModels { get; set; } = new ObservableCollection<NewRecipeModel>(); | |||
@@ -43,10 +49,15 @@ namespace FryPot_DosingSystem.ViewModel | |||
/// </summary> | |||
public RelayCommand<object> EditRecipeCommand { get; set; } | |||
/// <summary> | |||
/// 复制配方 | |||
/// </summary> | |||
public RelayCommand<object> CopyRecipeCommand { get; set; } | |||
/// <summary> | |||
/// 删除配方 | |||
/// </summary> | |||
public RelayCommand<object> DeleteRecipeCommand { get; set; } | |||
public RecipeSetViewModel() | |||
{ | |||
// Json<RecipeManage>.Read(); | |||
@@ -76,6 +87,81 @@ namespace FryPot_DosingSystem.ViewModel | |||
} | |||
}), "RecipeIsChange"); | |||
//复制指定炒锅配方 | |||
ActionManage.GetInstance.Register<object>(new Action<object>((Num) => { | |||
if (Num != null&& CopyRecipeId!=null) | |||
{ | |||
var res= Json<RecipeManage>.Data.Recipes.FirstOrDefault(p=>p.RecipeId==CopyRecipeId); | |||
if (res != null) | |||
{ | |||
prop: string recipeID = Guid.NewGuid().ToString();//配方唯一ID,后期根据实际要求更改 | |||
var res1 = Json<RecipeManage>.Data.Recipes.FirstOrDefault(p => p.RecipeId == recipeID); | |||
if (res1 == null) | |||
{ | |||
string recipeNamec = string.Empty; | |||
if (res.RecipeName.Contains('(')) | |||
{ | |||
recipeNamec = res.RecipeName.Split('(')[0] + $"({Num}号锅)"; | |||
} | |||
else | |||
{ | |||
recipeNamec= res.RecipeName+$"({Num}号锅)"; | |||
} | |||
//复制料筒配方 | |||
ObservableCollection<MaterialType> collect = new ObservableCollection<MaterialType>(); | |||
//浅拷贝 | |||
foreach (var item in res.materialCollection) | |||
{ | |||
var clone=(MaterialType)item.Clone(); | |||
collect.Add(clone); | |||
} | |||
foreach (var item in collect) | |||
{ | |||
if (ushort.TryParse((Num.ToString() + item.MaterialLoc.ToString().Substring(1, 2)), out ushort loc)) | |||
{ | |||
item.MaterialLoc = loc; | |||
} | |||
else | |||
{ | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"复制配方失败"); | |||
return; | |||
} | |||
} | |||
//复制炒锅工艺配方 | |||
FlowProcessManage FryFlow = new FlowProcessManage(); | |||
FryFlow.StirTime=res.FlowProcess.StirTime; | |||
FryFlow.RecipeName = recipeNamec; | |||
FryFlow.targetWeightOffset = res.FlowProcess.targetWeightOffset; | |||
ObservableCollection<FlowProcessModel> flowCollect = new ObservableCollection<FlowProcessModel>(); | |||
//浅拷贝 | |||
foreach (var item in res.FlowProcess.fpModels) | |||
{ | |||
var clone = (FlowProcessModel)item.Clone(); | |||
flowCollect.Add(clone); | |||
} | |||
foreach (var item in flowCollect) | |||
{ | |||
if (ushort.TryParse(item.FryMaterialNum, out ushort rollerNum)) | |||
{ | |||
item.FryMaterialNum = Num.ToString() + item.FryMaterialNum.ToString().Substring(1, 2); | |||
} | |||
} | |||
FryFlow.fpModels = flowCollect; | |||
Json<RecipeManage>.Data.Recipes.Add(new NewRecipeModel { RecipeId = recipeID, DataTime = DateTime.Now.ToShortDateString(), RecipeName = recipeNamec, materialCollection = collect, FlowProcess = FryFlow });//配方添加 | |||
//Json<RecipeManage>.Save(); | |||
} | |||
else | |||
{ | |||
goto prop; | |||
} | |||
MessageNotify.GetInstance.ShowUserLog("复制配方成功"); | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"复制配方成功"); | |||
} | |||
} | |||
}), "CopyPotNum"); | |||
NewRecipe =new RelayCommand( new Action(() => | |||
{ | |||
NewRecipeView nrv = new NewRecipeView(); | |||
@@ -124,6 +210,13 @@ namespace FryPot_DosingSystem.ViewModel | |||
} | |||
}); | |||
//复制配方 | |||
CopyRecipeCommand = new RelayCommand<object>((Id) => { | |||
CopyInfoView copyInfoView = new CopyInfoView(); | |||
CopyRecipeId = Id.ToString() ; | |||
copyInfoView.Show(); | |||
}); | |||
} | |||
} | |||
} |
@@ -198,7 +198,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WpfApp1", "WpfApp1\WpfApp1. | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MorkMW", "BPASmartClient.MorkMW\BPASmartClient.MorkMW.csproj", "{C763BF70-2416-4A64-9011-8EF8549473FD}" | |||
EndProject | |||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.DosingSystemSingle", "BPASmartClient.DosingSystemSingle\BPASmartClient.DosingSystemSingle.csproj", "{B79914B9-3A81-426B-88FF-8ABAF5C92AB5}" | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.DosingSystemSingle", "BPASmartClient.DosingSystemSingle\BPASmartClient.DosingSystemSingle.csproj", "{B79914B9-3A81-426B-88FF-8ABAF5C92AB5}" | |||
EndProject | |||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "设备监控", "设备监控", "{106E84C1-CAC5-4F14-9E31-201D3202C9FD}" | |||
EndProject | |||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.MaxWokControl", "BPASmartClient.MaxWokControl\BPASmartClient.MaxWokControl.csproj", "{888382C0-6750-4E81-BED3-0F38775DCCCB}" | |||
EndProject | |||
Global | |||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | |||
@@ -1874,6 +1878,26 @@ Global | |||
{B79914B9-3A81-426B-88FF-8ABAF5C92AB5}.Release|x64.Build.0 = Release|Any CPU | |||
{B79914B9-3A81-426B-88FF-8ABAF5C92AB5}.Release|x86.ActiveCfg = Release|Any CPU | |||
{B79914B9-3A81-426B-88FF-8ABAF5C92AB5}.Release|x86.Build.0 = Release|Any CPU | |||
{888382C0-6750-4E81-BED3-0F38775DCCCB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{888382C0-6750-4E81-BED3-0F38775DCCCB}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{888382C0-6750-4E81-BED3-0F38775DCCCB}.Debug|ARM.ActiveCfg = Debug|Any CPU | |||
{888382C0-6750-4E81-BED3-0F38775DCCCB}.Debug|ARM.Build.0 = Debug|Any CPU | |||
{888382C0-6750-4E81-BED3-0F38775DCCCB}.Debug|ARM64.ActiveCfg = Debug|Any CPU | |||
{888382C0-6750-4E81-BED3-0F38775DCCCB}.Debug|ARM64.Build.0 = Debug|Any CPU | |||
{888382C0-6750-4E81-BED3-0F38775DCCCB}.Debug|x64.ActiveCfg = Debug|Any CPU | |||
{888382C0-6750-4E81-BED3-0F38775DCCCB}.Debug|x64.Build.0 = Debug|Any CPU | |||
{888382C0-6750-4E81-BED3-0F38775DCCCB}.Debug|x86.ActiveCfg = Debug|Any CPU | |||
{888382C0-6750-4E81-BED3-0F38775DCCCB}.Debug|x86.Build.0 = Debug|Any CPU | |||
{888382C0-6750-4E81-BED3-0F38775DCCCB}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{888382C0-6750-4E81-BED3-0F38775DCCCB}.Release|Any CPU.Build.0 = Release|Any CPU | |||
{888382C0-6750-4E81-BED3-0F38775DCCCB}.Release|ARM.ActiveCfg = Release|Any CPU | |||
{888382C0-6750-4E81-BED3-0F38775DCCCB}.Release|ARM.Build.0 = Release|Any CPU | |||
{888382C0-6750-4E81-BED3-0F38775DCCCB}.Release|ARM64.ActiveCfg = Release|Any CPU | |||
{888382C0-6750-4E81-BED3-0F38775DCCCB}.Release|ARM64.Build.0 = Release|Any CPU | |||
{888382C0-6750-4E81-BED3-0F38775DCCCB}.Release|x64.ActiveCfg = Release|Any CPU | |||
{888382C0-6750-4E81-BED3-0F38775DCCCB}.Release|x64.Build.0 = Release|Any CPU | |||
{888382C0-6750-4E81-BED3-0F38775DCCCB}.Release|x86.ActiveCfg = Release|Any CPU | |||
{888382C0-6750-4E81-BED3-0F38775DCCCB}.Release|x86.Build.0 = Release|Any CPU | |||
EndGlobalSection | |||
GlobalSection(SolutionProperties) = preSolution | |||
HideSolutionNode = FALSE | |||
@@ -1966,6 +1990,8 @@ Global | |||
{81D03688-7361-45B8-A3EB-9B0A9222A338} = {8712125E-14CD-4E1B-A1CE-4BDE03805942} | |||
{C763BF70-2416-4A64-9011-8EF8549473FD} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F} | |||
{B79914B9-3A81-426B-88FF-8ABAF5C92AB5} = {8712125E-14CD-4E1B-A1CE-4BDE03805942} | |||
{106E84C1-CAC5-4F14-9E31-201D3202C9FD} = {7BE13E55-D8B1-4232-AE63-8BF122633297} | |||
{888382C0-6750-4E81-BED3-0F38775DCCCB} = {106E84C1-CAC5-4F14-9E31-201D3202C9FD} | |||
EndGlobalSection | |||
GlobalSection(ExtensibilityGlobals) = postSolution | |||
SolutionGuid = {9AEC9B81-0222-4DE9-B642-D915C29222AC} | |||