@@ -1,12 +1,13 @@ | |||
<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 | |||
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:local="clr-namespace:BPASmartClient.MaxWokControl" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
Title="MainWindow" | |||
Width="800" | |||
Height="450" | |||
mc:Ignorable="d"> | |||
<Grid /> | |||
</Window> |
@@ -6,9 +6,7 @@ | |||
<UseWPF>true</UseWPF> | |||
</PropertyGroup> | |||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> | |||
<DefineConstants>$(DefineConstants);FORMAL</DefineConstants> | |||
</PropertyGroup> | |||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'" /> | |||
<ItemGroup> | |||
<Compile Remove="Model\Recipe\LocalRecipeData.cs" /> | |||
@@ -85,10 +85,10 @@ namespace BPASmartClient.MorkCL | |||
#if !FORMAL | |||
devices[EDeviceType.炒锅1].Init(Json<ConnectPar>.Data.FryingPanIP1); | |||
//devices[EDeviceType.炒锅2].Init(Json<ConnectPar>.Data.FryingPanIP2); | |||
devices[EDeviceType.炒锅2].Init(Json<ConnectPar>.Data.FryingPanIP2); | |||
devices[EDeviceType.机器人].Init(Json<ConnectPar>.Data.RobotIP); | |||
//devices[EDeviceType.压力锅].Init(Json<ConnectPar>.Data.PressureCookerIP); | |||
//devices[EDeviceType.外部设备].Init(PortName:Json<ConnectPar>.Data.ESPortName); | |||
devices[EDeviceType.外部设备].Init(PortName:Json<ConnectPar>.Data.ESPortName); | |||
@@ -348,16 +348,18 @@ namespace BPASmartClient.MorkCL | |||
device.DiningOutStart = false; | |||
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置机器人取空盆。"); | |||
//TODO:暂时修改,后期优化。 | |||
//while (true) | |||
//{ | |||
// var emptyPanIndex = Array.FindIndex(otherDevice.BoxDetection, i => i == true); | |||
// if (emptyPanIndex >= 0) | |||
// { | |||
// robot.RobotTaskControl((21 + emptyPanIndex).ToString(), et);//取空盆 | |||
// break; | |||
// } | |||
//} | |||
robot.RobotTaskControl("21", et);//取空盆 | |||
while (true) | |||
{ | |||
var emptyPanIndex = Array.FindIndex(otherDevice.BoxDetection, i => i == true); | |||
if (emptyPanIndex >= 0) | |||
{ | |||
robot.RobotTaskControl((21 + emptyPanIndex).ToString(), et);//取空盆 | |||
break; | |||
} | |||
await Task.Delay(3000); | |||
DeviceProcessLogShow("无空盆,请添加空盆!"); | |||
} | |||
//robot.RobotTaskControl("21", et);//取空盆 | |||
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置机器人取空盆完成,等待机器人到出菜位置。"); | |||
robot.DiningOutRequest[index].Wait(Cts: TaskList[et].Cts);//等待机器人到出菜位置 | |||
@@ -561,7 +563,7 @@ namespace BPASmartClient.MorkCL | |||
void ManualActionRegiester() | |||
{ | |||
//主料入库委托。 | |||
ActionManage.GetInstance.Register((object o) => | |||
{ | |||
if (!morkCL.CanItemStorage) | |||
@@ -46,7 +46,7 @@ namespace BPASmartClient.MorkCL.Server | |||
public void WriteValue<T>(string address, T value) | |||
{ | |||
throw new NotImplementedException(); | |||
} | |||
} | |||
} |
@@ -26,7 +26,7 @@ namespace BPASmartClient.MorkCL.Server | |||
public void WriteValue<T>(string address, T value) | |||
{ | |||
throw new NotImplementedException(); | |||
} | |||
} | |||
} |
@@ -44,7 +44,7 @@ namespace BPASmartClient.MorkCL.Server | |||
public void WriteValue<T>(string address, T value) | |||
{ | |||
throw new NotImplementedException(); | |||
} | |||
private void RobotInit() | |||
@@ -112,7 +112,8 @@ | |||
CanUserSortColumns="False" | |||
IsHitTestVisible="False" | |||
IsReadOnly="True" | |||
ItemsSource="{Binding TBS}"> | |||
ItemsSource="{Binding TBS}" | |||
RowHeaderWidth="0"> | |||
<DataGrid.Columns> | |||
<DataGridTextColumn | |||
Width="350" | |||
@@ -105,47 +105,31 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
Seasonings = new ObservableCollection<SeasoningTB>(SqliteHelper.GetInstance.GetSeasoning().OrderBy(tb => tb.Loc)); | |||
} | |||
/// <summary> | |||
/// 辅料信息集合 | |||
/// </summary> | |||
/// <summary>辅料信息集合</summary> | |||
public ObservableCollection<AccessoriesTB> Accessories | |||
{ get => accessories; set { accessories = value; OnPropertyChanged(); } } | |||
/// <summary> | |||
/// 主料信息集合 | |||
/// </summary> | |||
/// <summary>主料信息集合</summary> | |||
public ObservableCollection<IngredientsTB> Ingredients | |||
{ get => ingredients; set { ingredients = value; OnPropertyChanged(); } } | |||
/// <summary> | |||
/// 调料信息集合 | |||
/// </summary> | |||
/// <summary>调料信息集合</summary> | |||
public ObservableCollection<SeasoningTB> Seasonings | |||
{ get => seasonings; set { seasonings = value; OnPropertyChanged(); } } | |||
/// <summary> | |||
/// 删除辅料信息 | |||
/// </summary> | |||
/// <summary>删除辅料信息</summary> | |||
public BPARelayCommand<string> RemoveAccessoryCommand { get; set; } | |||
/// <summary> | |||
/// 删除主料信息 | |||
/// </summary> | |||
/// <summary>删除主料信息</summary> | |||
public BPARelayCommand<string> RemoveIngreditentCommand { get; set; } | |||
/// <summary> | |||
/// 删除调料信息 | |||
/// </summary> | |||
/// <summary>删除调料信息</summary> | |||
public BPARelayCommand<string> RemoveSeasoningCommand { get; set; } | |||
/// <summary> | |||
/// 添加物料信息。 | |||
/// </summary> | |||
/// <summary>添加物料信息。</summary> | |||
public BPARelayCommand<string> AddMaterialCommand { get; set; } | |||
/// <summary> | |||
/// 编辑物料信息。 | |||
/// </summary> | |||
/// <summary>编辑物料信息。</summary> | |||
public BPARelayCommand<object> EditCommand { get; set; } | |||
} | |||
} |
@@ -1,10 +1,4 @@ | |||
| |||
using BPASmartClient.MorkCL.HelpClass; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using BPASmartClient.MorkCL.HelpClass; | |||
namespace BPASmartClient.MorkCL.ViewModel | |||
{ | |||
@@ -15,7 +9,7 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
public DebugViewModel() | |||
{ | |||
WriteAgitaParamCommand = new(async() => | |||
WriteAgitaParamCommand = new(async () => | |||
{ | |||
ActionManage.GetInstance.Send("WriteUshort", new WriteModel<ushort>(FryingPanSelect, "LW1", AgitaFrequency)); | |||
@@ -31,7 +25,7 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
ActionManage.GetInstance.Send("WriteBool", new WriteModel<bool>(FryingPanSelect, "LB0", false)); | |||
}); | |||
WriteHeatParamCommand = new(async() => | |||
WriteHeatParamCommand = new(async () => | |||
{ | |||
ActionManage.GetInstance.Send("WriteUshort", new WriteModel<ushort>(FryingPanSelect, "LW0", HeatGear)); | |||
@@ -49,13 +43,13 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
await SendWriteRequest($"LB{LBOffset[channelIndex]}"); | |||
}); | |||
GoFryLocCommand = new(async() => | |||
GoFryLocCommand = new(async () => | |||
{ | |||
var loc = StirFryLocSelect + 17; | |||
await SendWriteRequest($"LB{loc}"); | |||
}); | |||
GoHomeCommand = new(async() => | |||
GoHomeCommand = new(async () => | |||
{ | |||
await SendWriteRequest("LB12"); | |||
}); | |||
@@ -76,6 +70,7 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
} | |||
#region 私有方法 | |||
private async Task SendWriteRequest(string address) | |||
{ | |||
ActionManage.GetInstance.Send("WriteBool", new WriteModel<bool>(FryingPanSelect, address, false)); | |||
@@ -84,20 +79,21 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
await Task.Delay(50); | |||
ActionManage.GetInstance.Send("WriteBool", new WriteModel<bool>(FryingPanSelect, address, false)); | |||
} | |||
#endregion | |||
#region 属性 | |||
private EDeviceType fryingPanSelect=EDeviceType.炒锅1; | |||
/// <summary> | |||
/// 炒锅选择。 | |||
/// </summary> | |||
#endregion 私有方法 | |||
#region 属性 | |||
private EDeviceType fryingPanSelect = EDeviceType.炒锅1; | |||
/// <summary>炒锅选择。</summary> | |||
public EDeviceType FryingPanSelect | |||
{ | |||
get { return fryingPanSelect; } | |||
set { fryingPanSelect = value; OnPropertyChanged(); } | |||
} | |||
/// <summary> | |||
/// 搅拌频率 | |||
/// </summary> | |||
/// <summary>搅拌频率</summary> | |||
public ushort AgitaFrequency | |||
{ | |||
get => agitaFrequency; set | |||
@@ -112,14 +108,11 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
} | |||
} | |||
/// <summary> | |||
/// 加热档位 | |||
/// </summary> | |||
/// <summary>加热档位</summary> | |||
public ushort HeatGear | |||
{ | |||
get => heatGear; set | |||
{ | |||
if (value >= 8) | |||
heatGear = 8; | |||
else if (value <= 1) | |||
@@ -131,9 +124,8 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
} | |||
private float weight; | |||
/// <summary> | |||
/// 下料重量 | |||
/// </summary> | |||
/// <summary>下料重量</summary> | |||
public float Weight | |||
{ | |||
get { return weight; } | |||
@@ -141,9 +133,8 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
} | |||
private int channelSelect; | |||
/// <summary> | |||
/// 下料通道选择。 | |||
/// </summary> | |||
/// <summary>下料通道选择。</summary> | |||
public int ChannelSelect | |||
{ | |||
get { return channelSelect; } | |||
@@ -151,67 +142,56 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
} | |||
private int stirFryLocSelect; | |||
/// <summary> | |||
/// 炒制位选择。 | |||
/// </summary> | |||
/// <summary>炒制位选择。</summary> | |||
public int StirFryLocSelect | |||
{ | |||
get { return stirFryLocSelect; } | |||
set { stirFryLocSelect = value; OnPropertyChanged(); } | |||
} | |||
public ObservableCollection<EDeviceType> DeviceTypes { get; set; }=new ObservableCollection<EDeviceType>() {EDeviceType.炒锅1,EDeviceType.炒锅2 }; | |||
#endregion | |||
public ObservableCollection<EDeviceType> DeviceTypes { get; set; } = new ObservableCollection<EDeviceType>() { EDeviceType.炒锅1, EDeviceType.炒锅2 }; | |||
#endregion 属性 | |||
#region 命令 | |||
/// <summary> | |||
/// 写入搅拌参数。 | |||
/// </summary> | |||
/// <summary>写入搅拌参数。</summary> | |||
public BPARelayCommand WriteAgitaParamCommand { get; set; } | |||
/// <summary> | |||
/// 开始搅拌。 | |||
/// </summary> | |||
/// <summary>开始搅拌。</summary> | |||
public BPARelayCommand StartAgitateCommand { get; set; } | |||
/// <summary> | |||
/// 停止搅拌。 | |||
/// </summary> | |||
/// <summary>停止搅拌。</summary> | |||
public BPARelayCommand StopAgitateCommand { get; set; } | |||
/// <summary> | |||
/// 写入加热参数。 | |||
/// </summary> | |||
/// <summary>写入加热参数。</summary> | |||
public BPARelayCommand WriteHeatParamCommand { get; set; } | |||
/// <summary> | |||
/// 开始加热。 | |||
/// </summary> | |||
/// <summary>开始加热。</summary> | |||
public BPARelayCommand StartHeatCommand { get; set; } | |||
/// <summary> | |||
/// 停止加热。 | |||
/// </summary> | |||
/// <summary>停止加热。</summary> | |||
public BPARelayCommand StopHeatCommand { get; set; } | |||
/// <summary> | |||
/// 通道下料启动。 | |||
/// </summary> | |||
/// <summary>通道下料启动。</summary> | |||
public BPARelayCommand ChannelCuttingCommand { get; set; } | |||
/// <summary> | |||
/// 去炒制位。 | |||
/// </summary> | |||
/// <summary>去炒制位。</summary> | |||
public BPARelayCommand GoFryLocCommand { get; set; } | |||
/// <summary> | |||
/// 回原点/投料位置。 | |||
/// </summary> | |||
/// <summary>回原点/投料位置。</summary> | |||
public BPARelayCommand GoHomeCommand { get; set; } | |||
/// <summary> | |||
/// 去调料投料位。 | |||
/// </summary> | |||
/// <summary>去调料投料位。</summary> | |||
public BPARelayCommand GoSeasoningFeddLocCommand { get; set; } | |||
/// <summary> | |||
/// 出餐启动。 | |||
/// </summary> | |||
/// <summary>出餐启动。</summary> | |||
public BPARelayCommand OutDiningStartCommand { get; set; } | |||
/// <summary> | |||
/// 炒锅清洗。 | |||
/// </summary> | |||
/// <summary>炒锅清洗。</summary> | |||
public BPARelayCommand FryPanCleanCommand { get; set; } | |||
#endregion | |||
#endregion 命令 | |||
} | |||
} | |||
} |
@@ -53,17 +53,19 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
case EFunc.添加调料: | |||
item.Id = SqliteHelper.GetInstance.GetSeasoning().FirstOrDefault(material => material.Name == item.ParValue.ToString()).Id; | |||
break; | |||
case EFunc.添加主料: | |||
item.Id = SqliteHelper.GetInstance.GetIngredients().FirstOrDefault(material => material.Name == item.ParValue.ToString()).Id; | |||
break; | |||
case EFunc.添加辅料: | |||
item.Id = SqliteHelper.GetInstance.GetAccessories().FirstOrDefault(material => material.Name == item.ParValue.ToString()).Id; | |||
break; | |||
default: | |||
break; | |||
} | |||
} | |||
} | |||
//关闭视图窗口。 | |||
ActionManage.GetInstance.Send("CloseFuncParmEditView", true); | |||
@@ -87,16 +89,12 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
} | |||
} | |||
/// <summary> | |||
/// 保存参数。 | |||
/// </summary> | |||
/// <summary>保存参数。</summary> | |||
public BPARelayCommand SaveParamCommand { get; set; } | |||
private EFunc _FuncName; | |||
/// <summary> | |||
/// 功能名称。 | |||
/// </summary> | |||
/// <summary>功能名称。</summary> | |||
public EFunc FuncName | |||
{ | |||
get { return _FuncName; } | |||
@@ -197,9 +197,7 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
private string _CurrentMaterialType; | |||
/// <summary> | |||
/// 物料类型 | |||
/// </summary> | |||
/// <summary>物料类型</summary> | |||
public string CurrentMaterialType | |||
{ | |||
get { return _CurrentMaterialType; } | |||
@@ -218,9 +216,7 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
private string _MaterialName; | |||
/// <summary> | |||
/// 物料名称 | |||
/// </summary> | |||
/// <summary>物料名称</summary> | |||
public string MaterialName | |||
{ | |||
get { return _MaterialName; } | |||
@@ -229,9 +225,7 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
private int _MaterialLoc; | |||
/// <summary> | |||
/// 物料位置 | |||
/// </summary> | |||
/// <summary>物料位置</summary> | |||
public int MaterialLoc | |||
{ | |||
get { return _MaterialLoc; } | |||
@@ -248,9 +242,7 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
private Visibility _MaterialTypeVis; | |||
/// <summary> | |||
/// 是否新增,如果是新增,则显示主料类型框。反之,则不显示。 | |||
/// </summary> | |||
/// <summary>是否新增,如果是新增,则显示主料类型框。反之,则不显示。</summary> | |||
public Visibility MaterialTypeVis | |||
{ | |||
get { return _MaterialTypeVis; } | |||
@@ -259,9 +251,7 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
private Visibility _LocationVis; | |||
/// <summary> | |||
/// 是否显示位置框,如果为主料,则不显示。反之,则显示。 | |||
/// </summary> | |||
/// <summary>是否显示位置框,如果为主料,则不显示。反之,则显示。</summary> | |||
public Visibility LocationVis | |||
{ | |||
get { return _LocationVis; } | |||
@@ -294,10 +294,10 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
}); | |||
MoveUpCommand = new((o) => | |||
{ | |||
if (o !=null && o is FuncModel funcmodel) | |||
if (o != null && o is FuncModel funcmodel) | |||
{ | |||
var index= Functions.IndexOf(funcmodel); | |||
if (index>0) | |||
var index = Functions.IndexOf(funcmodel); | |||
if (index > 0) | |||
{ | |||
int newIndex = index - 1; | |||
Functions.RemoveAt(index); | |||
@@ -311,7 +311,7 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
if (o != null && o is FuncModel funcmodel) | |||
{ | |||
var index = Functions.IndexOf(funcmodel); | |||
if (index < Functions.Count-1) | |||
if (index < Functions.Count - 1) | |||
{ | |||
int newIndex = index + 1; | |||
Functions.RemoveAt(index); | |||
@@ -334,40 +334,26 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
//} | |||
} | |||
/// <summary> | |||
/// 保存参数。 | |||
/// </summary> | |||
/// <summary>保存参数。</summary> | |||
public BPARelayCommand SaveParamCommand { get; set; } | |||
/// <summary> | |||
/// 添加功能 | |||
/// </summary> | |||
/// <summary>添加功能</summary> | |||
public BPARelayCommand AddFuncCommand { get; set; } | |||
/// <summary> | |||
/// 删除功能。 | |||
/// </summary> | |||
/// <summary>删除功能。</summary> | |||
public BPARelayCommand<object> RemoveCommand { get; set; } | |||
/// <summary> | |||
/// 功能选择改变。 | |||
/// </summary> | |||
/// <summary>功能选择改变。</summary> | |||
public BPARelayCommand<object> FuncChangeCommand { get; set; } | |||
/// <summary> | |||
/// 编辑功能。 | |||
/// </summary> | |||
/// <summary>编辑功能。</summary> | |||
public BPARelayCommand<object> EditCommand { get; set; } | |||
/// <summary> | |||
/// 功能上移。 | |||
/// </summary> | |||
/// <summary>功能上移。</summary> | |||
public BPARelayCommand<object> MoveUpCommand { get; set; } | |||
/// <summary> | |||
/// 功能下移。 | |||
/// </summary> | |||
public BPARelayCommand<object> MoveDownCommand { get; set; } | |||
/// <summary>功能下移。</summary> | |||
public BPARelayCommand<object> MoveDownCommand { get; set; } | |||
private ObservableCollection<FuncModel> _Functions; | |||
@@ -379,9 +365,7 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
private string _Name; | |||
/// <summary> | |||
/// 配方名称 | |||
/// </summary> | |||
/// <summary>配方名称</summary> | |||
public string Name | |||
{ | |||
get { return _Name; } | |||
@@ -390,9 +374,7 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
private string _ID; | |||
/// <summary> | |||
/// 配方ID。 | |||
/// </summary> | |||
/// <summary>配方ID。</summary> | |||
public string ID | |||
{ | |||
get { return _ID; } | |||
@@ -401,9 +383,7 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
private ObservableCollection<string> _AllFunc; | |||
/// <summary> | |||
/// 所有功能集合。 | |||
/// </summary> | |||
/// <summary>所有功能集合。</summary> | |||
public ObservableCollection<string> AllFunc | |||
{ | |||
get { return _AllFunc; } | |||
@@ -412,9 +392,7 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
private ObservableCollection<string> _AllDishType; | |||
/// <summary> | |||
/// 所有菜品集合。 | |||
/// </summary> | |||
/// <summary>所有菜品集合。</summary> | |||
public ObservableCollection<string> AllDishType | |||
{ | |||
get { return _AllDishType; } | |||
@@ -1,10 +1,4 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MorkCL.ViewModel | |||
namespace BPASmartClient.MorkCL.ViewModel | |||
{ | |||
public class FryPanSelectViewModel : NotifyBase | |||
{ | |||
@@ -12,16 +6,18 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
{ | |||
SelectFryPanCommand = new((object i) => | |||
{ | |||
if (int.TryParse(i.ToString(),out int res)) | |||
if (int.TryParse(i.ToString(), out int res)) | |||
{ | |||
switch (res) | |||
{ | |||
case 1: | |||
DeviceType = EDeviceType.炒锅1; | |||
break; | |||
case 2: | |||
DeviceType = EDeviceType.炒锅2; | |||
break; | |||
default: | |||
DeviceType = EDeviceType.无; | |||
break; | |||
@@ -29,22 +25,19 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
ActionManage.GetInstance.Send("CloseFryPanSelectView", true); | |||
} | |||
}); | |||
CloseCommand = new(() => | |||
{ | |||
ActionManage.GetInstance.Send("CloseFryPanSelectView",false); | |||
ActionManage.GetInstance.Send("CloseFryPanSelectView", false); | |||
}); | |||
} | |||
/// <summary> | |||
/// 选择命令。 | |||
/// </summary> | |||
/// <summary>选择命令。</summary> | |||
public BPARelayCommand<object> SelectFryPanCommand { get; set; } | |||
public BPARelayCommand CloseCommand { get; set; } | |||
public static EDeviceType DeviceType { get; set; } | |||
} | |||
} | |||
} |
@@ -1,11 +1,6 @@ | |||
using BPA.Helper; | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
using BPASmartClient.CustomResource.UserControls.MessageShow; | |||
using BPASmartClient.MorkCL.Model.DB; | |||
using BPASmartClient.MorkCL.Model.DB; | |||
using BPASmartClient.MorkCL.Model.Json; | |||
using BPASmartClient.MorkCL.Server; | |||
using S7.Net.Protocol; | |||
using System.Transactions; | |||
namespace BPASmartClient.MorkCL.ViewModel | |||
{ | |||
@@ -20,19 +15,16 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
{ | |||
IngredientsItorage = new ObservableCollection<ItemStorage>(Json<ItemStorageInfo>.Data.IngredientsStorage); | |||
AccessoriesItorage = new ObservableCollection<ItemStorage>(Json<ItemStorageInfo>.Data.AccessoriesStorage); | |||
},"RefreshItemStorage",true); | |||
}, "RefreshItemStorage", true); | |||
ActionManage.GetInstance.Register((() => | |||
{ | |||
Ingredients = new ObservableCollection<IngredientsTB>(SqliteHelper.GetInstance.GetIngredients()); | |||
}), "RefreshIngredients", true); | |||
ActionManage.GetInstance.Register((object o) => | |||
{ | |||
if (o!=null) | |||
if (o != null) | |||
{ | |||
#if !FORMAL | |||
ScaleCurrentWeight = (float)o; | |||
@@ -42,8 +34,8 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
} | |||
}, "SendCurrentWeight"); | |||
ActionManage.GetInstance.Register((object o) => { | |||
ActionManage.GetInstance.Register((object o) => | |||
{ | |||
CanItemStorage = (bool)o; | |||
}, "RefreshCanItemStorage", true); | |||
@@ -56,6 +48,7 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
ActionManage.GetInstance.Send(NotifyTopic.ItemStorage, o); | |||
#region 暂时弃用 | |||
//if (!CanItemStorage) | |||
//{ | |||
// MessageNotify.GetInstance.ShowDialog("当前有炒菜任务正在排队,为避免影响菜品口味,不可入库,请稍后再试。", DialogType.Warning); | |||
@@ -66,7 +59,6 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
//{ | |||
// if (o != null && o is IngredientsTB ingredients) | |||
// { | |||
// foreach (ItemStorage item in Json<ItemStorageInfo>.Data.IngredientsStorage) | |||
// { | |||
// if (item.IsEmploy == false) | |||
@@ -76,14 +68,14 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
// item.IsEmploy = true; | |||
// item.Weight = ScaleCurrentWeight; | |||
// ActionManage.GetInstance.Send("ItemStorage", IngredientsItorage.IndexOf(item) + 1); | |||
// Json<ItemStorageInfo>.Save(); | |||
// ActionManage.GetInstance.Send("ItemStorage", IngredientsItorage.IndexOf(item) + | |||
// 1); Json<ItemStorageInfo>.Save(); | |||
// IngredientsItorage = new ObservableCollection<ItemStorage>(Json<ItemStorageInfo>.Data.IngredientsStorage); | |||
// IngredientsItorage = new ObservableCollection<ItemStorage>(Json<ItemStorageInfo>.Data.IngredientsStorage); | |||
// Application.Current.Dispatcher.Invoke(() => | |||
// { | |||
// NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, Application.Current.MainWindow, "入库成功", $"物料{ingredients.Name}入库成功。"); | |||
// Application.Current.Dispatcher.Invoke(() => { | |||
// NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, | |||
// Application.Current.MainWindow, "入库成功", $"物料{ingredients.Name}入库成功。"); | |||
// }); | |||
// return; | |||
@@ -101,9 +93,9 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
// NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, Application.Current.MainWindow, "入库失败", $"物料入库失败。"); | |||
// }); | |||
// } | |||
//}, "ItemStorageTask"); | |||
#endregion | |||
//}, "ItemStorageTask"); | |||
#endregion 暂时弃用 | |||
}); | |||
} | |||
@@ -126,6 +118,7 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
public BPARelayCommand<object> InStorageCommand { get; set; } | |||
private float _ScaleCurrentWeight; | |||
public float ScaleCurrentWeight | |||
{ get { return _ScaleCurrentWeight; } set { _ScaleCurrentWeight = value; OnPropertyChanged(); } } | |||
@@ -139,9 +132,7 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
private ObservableCollection<ItemStorage> _IngredientsItorage; | |||
/// <summary> | |||
/// 主料库位。 | |||
/// </summary> | |||
/// <summary>主料库位。</summary> | |||
public ObservableCollection<ItemStorage> IngredientsItorage | |||
{ | |||
get { return _IngredientsItorage; } | |||
@@ -150,9 +141,7 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
private ObservableCollection<ItemStorage> _AccessoriesItorage; | |||
/// <summary> | |||
/// 辅料库位 | |||
/// </summary> | |||
/// <summary>辅料库位</summary> | |||
public ObservableCollection<ItemStorage> AccessoriesItorage | |||
{ | |||
get { return _AccessoriesItorage; } | |||
@@ -161,9 +150,7 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
private ObservableCollection<IngredientsTB> _Ingredients; | |||
/// <summary> | |||
/// 所有的主料数据。作为ComboBox的数据源。 | |||
/// </summary> | |||
/// <summary>所有的主料数据。作为ComboBox的数据源。</summary> | |||
public ObservableCollection<IngredientsTB> Ingredients | |||
{ | |||
get { return _Ingredients; } | |||
@@ -171,14 +158,12 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
} | |||
private bool _CanItemStorage; | |||
/// <summary> | |||
/// 入库许可。 | |||
/// </summary> | |||
/// <summary>入库许可。</summary> | |||
public bool CanItemStorage | |||
{ | |||
get { return _CanItemStorage; } | |||
set { _CanItemStorage = value; OnPropertyChanged(); } | |||
} | |||
} | |||
} |
@@ -51,14 +51,16 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
}); | |||
IssueCommand = new((o) => | |||
{ | |||
//参数为ControlData,可能需要转换。 | |||
if (MessageNotify.GetInstance.ShowDialog("请确认,是否下发订单?")) | |||
{ | |||
if (o != null && o is ControlData) | |||
//参数为ControlData,可能需要转换。 | |||
if (MessageNotify.GetInstance.ShowDialog("请确认,是否下发订单?")) | |||
{ | |||
if (o != null && o is ControlData) | |||
{ | |||
var jsonString = o.ToJSON(); | |||
var data = JsonConvert.DeserializeObject<ControlData>(jsonString); | |||
#region 查询主料,调料,辅料是否在信息中。 | |||
foreach (var item in data.ControlFuncs) | |||
{ | |||
switch (item.eFunc) | |||
@@ -74,6 +76,7 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
case EFunc.去指定炒制位: | |||
case EFunc.炒制: | |||
break; | |||
case EFunc.添加主料: | |||
var Id = item.funcPars[0].Id; | |||
var weight = Convert.ToSingle(item.funcPars[1].ParValue); | |||
@@ -84,6 +87,7 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
return; | |||
} | |||
break; | |||
case EFunc.添加辅料: | |||
if (SqliteHelper.GetInstance.GetAccessoriesInfo(item.funcPars[0].Id) == null) | |||
{ | |||
@@ -92,6 +96,7 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
return; | |||
} | |||
break; | |||
case EFunc.添加调料: | |||
if (SqliteHelper.GetInstance.GetSeasoningInfo(item.funcPars[0].Id) == null) | |||
{ | |||
@@ -102,27 +107,35 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
break; | |||
} | |||
} | |||
#endregion | |||
#endregion 查询主料,调料,辅料是否在信息中。 | |||
var tempDeviceType = EDeviceType.无; | |||
FryPanSelectView selectView = new(); | |||
if (selectView.ShowDialog() == true) | |||
if (data.DishType == Model.Recipe.EDishType.炒菜) | |||
{ | |||
switch (FryPanSelectViewModel.DeviceType) | |||
FryPanSelectView selectView = new(); | |||
if (selectView.ShowDialog() == true) | |||
{ | |||
case EDeviceType.炒锅1: | |||
case EDeviceType.炒锅2: | |||
tempDeviceType = FryPanSelectViewModel.DeviceType; | |||
break; | |||
switch (FryPanSelectViewModel.DeviceType) | |||
{ | |||
case EDeviceType.炒锅1: | |||
case EDeviceType.炒锅2: | |||
tempDeviceType = FryPanSelectViewModel.DeviceType; | |||
break; | |||
default: | |||
return; | |||
default: | |||
return; | |||
} | |||
} | |||
else | |||
return; | |||
} | |||
else | |||
return; | |||
data.DeviceType= tempDeviceType; | |||
{ | |||
tempDeviceType = EDeviceType.压力锅; | |||
} | |||
data.DeviceType = tempDeviceType; | |||
ActionManage.GetInstance.Send(NotifyTopic.FormulaDistribution, data); | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, Application.Current.MainWindow, "提示", $"下发订单{data.Name}成功!"); | |||
} | |||
@@ -136,34 +149,22 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
}); | |||
} | |||
/// <summary> | |||
/// 配方类,里面应该包含配方数据。 | |||
/// </summary> | |||
/// <summary>配方类,里面应该包含配方数据。</summary> | |||
public ObservableCollection<ControlData> Recipes { get; set; } | |||
/// <summary> | |||
/// 保存参数。 | |||
/// </summary> | |||
/// <summary>保存参数。</summary> | |||
//public BPARelayCommand SaveParamCommand { get; set; } | |||
/// <summary> | |||
/// 添加配方。 | |||
/// </summary> | |||
/// <summary>添加配方。</summary> | |||
public BPARelayCommand AddRecipeCommand { get; set; } | |||
/// <summary> | |||
/// 移除配方。 | |||
/// </summary> | |||
/// <summary>移除配方。</summary> | |||
public BPARelayCommand<object> RemoveCommand { get; set; } | |||
/// <summary> | |||
/// 下发配方。 | |||
/// </summary> | |||
/// <summary>下发配方。</summary> | |||
public BPARelayCommand<object> IssueCommand { get; set; } | |||
/// <summary> | |||
/// 编辑配方。 | |||
/// </summary> | |||
/// <summary>编辑配方。</summary> | |||
public BPARelayCommand<object> EditCommand { get; set; } | |||
public BPARelayCommand ClearAllRecipeCommand { get; set; } | |||
@@ -8,14 +8,10 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
{ | |||
public testViewModel() | |||
{ | |||
TBS = new(SqliteHelper.GetInstance.GetAccessories()); | |||
testCommand = new BPARelayCommand(() => | |||
{ | |||
ControlData cd = new ControlData(); | |||
cd.Name = "莲白回锅"; | |||
cd.DeviceType = EDeviceType.炒锅1; | |||
@@ -109,12 +105,8 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
// Name = $"AccessoriesTB{i}" | |||
// }); | |||
// SqliteHelper.GetInstance.AddIngredients(new Model.DB.IngredientsTB() | |||
// { | |||
// Description = "IngredientsTB", | |||
// Loc = 1, | |||
// Name = $"IngredientsTB{i}" | |||
// }); | |||
// SqliteHelper.GetInstance.AddIngredients(new Model.DB.IngredientsTB() { | |||
// Description = "IngredientsTB", Loc = 1, Name = $"IngredientsTB{i}" }); | |||
// SqliteHelper.GetInstance.AddSeasoning(new Model.DB.SeasoningTB() | |||
// { | |||
@@ -169,6 +161,6 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
public BPARelayCommand testCommand { get; set; } | |||
public ObservableCollection<AccessoriesTB> TBS { get; set; } | |||
public ObservableCollection<AccessoriesTB> TBS { get; set; } | |||
} | |||
} |
@@ -1,8 +1,7 @@ | |||
<Application x:Class="BPASmartClient.ScreenALL.App" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:local="clr-namespace:BPASmartClient.ScreenALL"> | |||
<Application.Resources> | |||
</Application.Resources> | |||
<Application | |||
x:Class="BPASmartClient.ScreenALL.App" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:local="clr-namespace:BPASmartClient.ScreenALL"> | |||
<Application.Resources /> | |||
</Application> |