Browse Source

1. 代码格式化。2.恢复注释。

JXJAgvReake
ZhaoGang 1 year ago
parent
commit
88014f7cf2
17 changed files with 173 additions and 264 deletions
  1. +12
    -11
      BPASmartClient.MaxWokControl/MainWindow.xaml
  2. +1
    -3
      BPASmartClient.MorkCL/BPASmartClient.MorkCL.csproj
  3. +13
    -11
      BPASmartClient.MorkCL/Control_MorkCL.cs
  4. +1
    -1
      BPASmartClient.MorkCL/Server/OtherServer.cs
  5. +1
    -1
      BPASmartClient.MorkCL/Server/PressureCookerServer.cs
  6. +1
    -1
      BPASmartClient.MorkCL/Server/RobotServer.cs
  7. +2
    -1
      BPASmartClient.MorkCL/View/Test.xaml
  8. +8
    -24
      BPASmartClient.MorkCL/ViewModel/AddRawMaterialViewModel.cs
  9. +53
    -73
      BPASmartClient.MorkCL/ViewModel/DebugViewModel.cs
  10. +5
    -7
      BPASmartClient.MorkCL/ViewModel/EditFunctionParamViewModel.cs
  11. +5
    -15
      BPASmartClient.MorkCL/ViewModel/EditRawMaterialViewModel.cs
  12. +16
    -38
      BPASmartClient.MorkCL/ViewModel/EditRecipeViewModel.cs
  13. +8
    -15
      BPASmartClient.MorkCL/ViewModel/FryPanSelectViewModel.cs
  14. +20
    -35
      BPASmartClient.MorkCL/ViewModel/ItemStorageViewModel.cs
  15. +18
    -10
      BPASmartClient.MorkCL/ViewModel/RecipeManageViewModel.cs
  16. +3
    -11
      BPASmartClient.MorkCL/ViewModel/testViewModel.cs
  17. +6
    -7
      BPASmartClient.ScreenALL/App.xaml

+ 12
- 11
BPASmartClient.MaxWokControl/MainWindow.xaml View File

@@ -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> </Window>

+ 1
- 3
BPASmartClient.MorkCL/BPASmartClient.MorkCL.csproj View File

@@ -6,9 +6,7 @@
<UseWPF>true</UseWPF> <UseWPF>true</UseWPF>
</PropertyGroup> </PropertyGroup>


<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>$(DefineConstants);FORMAL</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'" />


<ItemGroup> <ItemGroup>
<Compile Remove="Model\Recipe\LocalRecipeData.cs" /> <Compile Remove="Model\Recipe\LocalRecipeData.cs" />


+ 13
- 11
BPASmartClient.MorkCL/Control_MorkCL.cs View File

@@ -348,16 +348,18 @@ namespace BPASmartClient.MorkCL
device.DiningOutStart = false; device.DiningOutStart = false;
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置机器人取空盆。"); DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置机器人取空盆。");
//TODO:暂时修改,后期优化。 //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()}-设置机器人取空盆完成,等待机器人到出菜位置。"); DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置机器人取空盆完成,等待机器人到出菜位置。");


robot.DiningOutRequest[index].Wait(Cts: TaskList[et].Cts);//等待机器人到出菜位置 robot.DiningOutRequest[index].Wait(Cts: TaskList[et].Cts);//等待机器人到出菜位置
@@ -561,7 +563,7 @@ namespace BPASmartClient.MorkCL


void ManualActionRegiester() void ManualActionRegiester()
{ {
//主料入库委托。
ActionManage.GetInstance.Register((object o) => ActionManage.GetInstance.Register((object o) =>
{ {
if (!morkCL.CanItemStorage) if (!morkCL.CanItemStorage)


+ 1
- 1
BPASmartClient.MorkCL/Server/OtherServer.cs View File

@@ -46,7 +46,7 @@ namespace BPASmartClient.MorkCL.Server


public void WriteValue<T>(string address, T value) public void WriteValue<T>(string address, T value)
{ {
throw new NotImplementedException();
} }
} }
} }

+ 1
- 1
BPASmartClient.MorkCL/Server/PressureCookerServer.cs View File

@@ -26,7 +26,7 @@ namespace BPASmartClient.MorkCL.Server


public void WriteValue<T>(string address, T value) public void WriteValue<T>(string address, T value)
{ {
throw new NotImplementedException();
} }
} }
} }

+ 1
- 1
BPASmartClient.MorkCL/Server/RobotServer.cs View File

@@ -44,7 +44,7 @@ namespace BPASmartClient.MorkCL.Server


public void WriteValue<T>(string address, T value) public void WriteValue<T>(string address, T value)
{ {
throw new NotImplementedException();
} }


private void RobotInit() private void RobotInit()


+ 2
- 1
BPASmartClient.MorkCL/View/Test.xaml View File

@@ -112,7 +112,8 @@
CanUserSortColumns="False" CanUserSortColumns="False"
IsHitTestVisible="False" IsHitTestVisible="False"
IsReadOnly="True" IsReadOnly="True"
ItemsSource="{Binding TBS}">
ItemsSource="{Binding TBS}"
RowHeaderWidth="0">
<DataGrid.Columns> <DataGrid.Columns>
<DataGridTextColumn <DataGridTextColumn
Width="350" Width="350"


+ 8
- 24
BPASmartClient.MorkCL/ViewModel/AddRawMaterialViewModel.cs View File

@@ -105,47 +105,31 @@ namespace BPASmartClient.MorkCL.ViewModel
Seasonings = new ObservableCollection<SeasoningTB>(SqliteHelper.GetInstance.GetSeasoning().OrderBy(tb => tb.Loc)); Seasonings = new ObservableCollection<SeasoningTB>(SqliteHelper.GetInstance.GetSeasoning().OrderBy(tb => tb.Loc));
} }


/// <summary>
/// 辅料信息集合
/// </summary>
/// <summary>辅料信息集合</summary>
public ObservableCollection<AccessoriesTB> Accessories public ObservableCollection<AccessoriesTB> Accessories
{ get => accessories; set { accessories = value; OnPropertyChanged(); } } { get => accessories; set { accessories = value; OnPropertyChanged(); } }


/// <summary>
/// 主料信息集合
/// </summary>
/// <summary>主料信息集合</summary>
public ObservableCollection<IngredientsTB> Ingredients public ObservableCollection<IngredientsTB> Ingredients
{ get => ingredients; set { ingredients = value; OnPropertyChanged(); } } { get => ingredients; set { ingredients = value; OnPropertyChanged(); } }


/// <summary>
/// 调料信息集合
/// </summary>
/// <summary>调料信息集合</summary>
public ObservableCollection<SeasoningTB> Seasonings public ObservableCollection<SeasoningTB> Seasonings
{ get => seasonings; set { seasonings = value; OnPropertyChanged(); } } { get => seasonings; set { seasonings = value; OnPropertyChanged(); } }


/// <summary>
/// 删除辅料信息
/// </summary>
/// <summary>删除辅料信息</summary>
public BPARelayCommand<string> RemoveAccessoryCommand { get; set; } public BPARelayCommand<string> RemoveAccessoryCommand { get; set; }


/// <summary>
/// 删除主料信息
/// </summary>
/// <summary>删除主料信息</summary>
public BPARelayCommand<string> RemoveIngreditentCommand { get; set; } public BPARelayCommand<string> RemoveIngreditentCommand { get; set; }


/// <summary>
/// 删除调料信息
/// </summary>
/// <summary>删除调料信息</summary>
public BPARelayCommand<string> RemoveSeasoningCommand { get; set; } public BPARelayCommand<string> RemoveSeasoningCommand { get; set; }


/// <summary>
/// 添加物料信息。
/// </summary>
/// <summary>添加物料信息。</summary>
public BPARelayCommand<string> AddMaterialCommand { get; set; } public BPARelayCommand<string> AddMaterialCommand { get; set; }


/// <summary>
/// 编辑物料信息。
/// </summary>
/// <summary>编辑物料信息。</summary>
public BPARelayCommand<object> EditCommand { get; set; } public BPARelayCommand<object> EditCommand { get; set; }
} }
} }

+ 53
- 73
BPASmartClient.MorkCL/ViewModel/DebugViewModel.cs View File

@@ -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 namespace BPASmartClient.MorkCL.ViewModel
{ {
@@ -15,7 +9,7 @@ namespace BPASmartClient.MorkCL.ViewModel


public DebugViewModel() public DebugViewModel()
{ {
WriteAgitaParamCommand = new(async() =>
WriteAgitaParamCommand = new(async () =>
{ {
ActionManage.GetInstance.Send("WriteUshort", new WriteModel<ushort>(FryingPanSelect, "LW1", AgitaFrequency)); 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)); 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)); ActionManage.GetInstance.Send("WriteUshort", new WriteModel<ushort>(FryingPanSelect, "LW0", HeatGear));


@@ -49,13 +43,13 @@ namespace BPASmartClient.MorkCL.ViewModel
await SendWriteRequest($"LB{LBOffset[channelIndex]}"); await SendWriteRequest($"LB{LBOffset[channelIndex]}");
}); });


GoFryLocCommand = new(async() =>
GoFryLocCommand = new(async () =>
{ {
var loc = StirFryLocSelect + 17; var loc = StirFryLocSelect + 17;


await SendWriteRequest($"LB{loc}"); await SendWriteRequest($"LB{loc}");
}); });
GoHomeCommand = new(async() =>
GoHomeCommand = new(async () =>
{ {
await SendWriteRequest("LB12"); await SendWriteRequest("LB12");
}); });
@@ -76,6 +70,7 @@ namespace BPASmartClient.MorkCL.ViewModel
} }


#region 私有方法 #region 私有方法

private async Task SendWriteRequest(string address) private async Task SendWriteRequest(string address)
{ {
ActionManage.GetInstance.Send("WriteBool", new WriteModel<bool>(FryingPanSelect, address, false)); ActionManage.GetInstance.Send("WriteBool", new WriteModel<bool>(FryingPanSelect, address, false));
@@ -84,20 +79,21 @@ namespace BPASmartClient.MorkCL.ViewModel
await Task.Delay(50); await Task.Delay(50);
ActionManage.GetInstance.Send("WriteBool", new WriteModel<bool>(FryingPanSelect, address, false)); 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 public EDeviceType FryingPanSelect
{ {
get { return fryingPanSelect; } get { return fryingPanSelect; }
set { fryingPanSelect = value; OnPropertyChanged(); } set { fryingPanSelect = value; OnPropertyChanged(); }
} }
/// <summary>
/// 搅拌频率
/// </summary>

/// <summary>搅拌频率</summary>
public ushort AgitaFrequency public ushort AgitaFrequency
{ {
get => agitaFrequency; set get => agitaFrequency; set
@@ -112,14 +108,11 @@ namespace BPASmartClient.MorkCL.ViewModel
} }
} }


/// <summary>
/// 加热档位
/// </summary>
/// <summary>加热档位</summary>
public ushort HeatGear public ushort HeatGear
{ {
get => heatGear; set get => heatGear; set
{ {

if (value >= 8) if (value >= 8)
heatGear = 8; heatGear = 8;
else if (value <= 1) else if (value <= 1)
@@ -131,9 +124,8 @@ namespace BPASmartClient.MorkCL.ViewModel
} }


private float weight; private float weight;
/// <summary>
/// 下料重量
/// </summary>

/// <summary>下料重量</summary>
public float Weight public float Weight
{ {
get { return weight; } get { return weight; }
@@ -141,9 +133,8 @@ namespace BPASmartClient.MorkCL.ViewModel
} }


private int channelSelect; private int channelSelect;
/// <summary>
/// 下料通道选择。
/// </summary>

/// <summary>下料通道选择。</summary>
public int ChannelSelect public int ChannelSelect
{ {
get { return channelSelect; } get { return channelSelect; }
@@ -151,67 +142,56 @@ namespace BPASmartClient.MorkCL.ViewModel
} }


private int stirFryLocSelect; private int stirFryLocSelect;
/// <summary>
/// 炒制位选择。
/// </summary>

/// <summary>炒制位选择。</summary>
public int StirFryLocSelect public int StirFryLocSelect
{ {
get { return stirFryLocSelect; } get { return stirFryLocSelect; }
set { stirFryLocSelect = value; OnPropertyChanged(); } 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 命令 #region 命令


/// <summary>
/// 写入搅拌参数。
/// </summary>
/// <summary>写入搅拌参数。</summary>
public BPARelayCommand WriteAgitaParamCommand { get; set; } public BPARelayCommand WriteAgitaParamCommand { get; set; }
/// <summary>
/// 开始搅拌。
/// </summary>

/// <summary>开始搅拌。</summary>
public BPARelayCommand StartAgitateCommand { get; set; } public BPARelayCommand StartAgitateCommand { get; set; }
/// <summary>
/// 停止搅拌。
/// </summary>

/// <summary>停止搅拌。</summary>
public BPARelayCommand StopAgitateCommand { get; set; } public BPARelayCommand StopAgitateCommand { get; set; }
/// <summary>
/// 写入加热参数。
/// </summary>

/// <summary>写入加热参数。</summary>
public BPARelayCommand WriteHeatParamCommand { get; set; } public BPARelayCommand WriteHeatParamCommand { get; set; }
/// <summary>
/// 开始加热。
/// </summary>

/// <summary>开始加热。</summary>
public BPARelayCommand StartHeatCommand { get; set; } public BPARelayCommand StartHeatCommand { get; set; }
/// <summary>
/// 停止加热。
/// </summary>

/// <summary>停止加热。</summary>
public BPARelayCommand StopHeatCommand { get; set; } public BPARelayCommand StopHeatCommand { get; set; }
/// <summary>
/// 通道下料启动。
/// </summary>

/// <summary>通道下料启动。</summary>
public BPARelayCommand ChannelCuttingCommand { get; set; } public BPARelayCommand ChannelCuttingCommand { get; set; }
/// <summary>
/// 去炒制位。
/// </summary>

/// <summary>去炒制位。</summary>
public BPARelayCommand GoFryLocCommand { get; set; } public BPARelayCommand GoFryLocCommand { get; set; }
/// <summary>
/// 回原点/投料位置。
/// </summary>

/// <summary>回原点/投料位置。</summary>
public BPARelayCommand GoHomeCommand { get; set; } public BPARelayCommand GoHomeCommand { get; set; }
/// <summary>
/// 去调料投料位。
/// </summary>

/// <summary>去调料投料位。</summary>
public BPARelayCommand GoSeasoningFeddLocCommand { get; set; } public BPARelayCommand GoSeasoningFeddLocCommand { get; set; }
/// <summary>
/// 出餐启动。
/// </summary>

/// <summary>出餐启动。</summary>
public BPARelayCommand OutDiningStartCommand { get; set; } public BPARelayCommand OutDiningStartCommand { get; set; }
/// <summary>
/// 炒锅清洗。
/// </summary>

/// <summary>炒锅清洗。</summary>
public BPARelayCommand FryPanCleanCommand { get; set; } public BPARelayCommand FryPanCleanCommand { get; set; }
#endregion

#endregion 命令
} }
}
}

+ 5
- 7
BPASmartClient.MorkCL/ViewModel/EditFunctionParamViewModel.cs View File

@@ -53,17 +53,19 @@ namespace BPASmartClient.MorkCL.ViewModel
case EFunc.添加调料: case EFunc.添加调料:
item.Id = SqliteHelper.GetInstance.GetSeasoning().FirstOrDefault(material => material.Name == item.ParValue.ToString()).Id; item.Id = SqliteHelper.GetInstance.GetSeasoning().FirstOrDefault(material => material.Name == item.ParValue.ToString()).Id;
break; break;

case EFunc.添加主料: case EFunc.添加主料:
item.Id = SqliteHelper.GetInstance.GetIngredients().FirstOrDefault(material => material.Name == item.ParValue.ToString()).Id; item.Id = SqliteHelper.GetInstance.GetIngredients().FirstOrDefault(material => material.Name == item.ParValue.ToString()).Id;
break; break;

case EFunc.添加辅料: case EFunc.添加辅料:
item.Id = SqliteHelper.GetInstance.GetAccessories().FirstOrDefault(material => material.Name == item.ParValue.ToString()).Id; item.Id = SqliteHelper.GetInstance.GetAccessories().FirstOrDefault(material => material.Name == item.ParValue.ToString()).Id;
break; break;

default: default:
break; break;
} }
} }
} }
//关闭视图窗口。 //关闭视图窗口。
ActionManage.GetInstance.Send("CloseFuncParmEditView", true); ActionManage.GetInstance.Send("CloseFuncParmEditView", true);
@@ -87,16 +89,12 @@ namespace BPASmartClient.MorkCL.ViewModel
} }
} }


/// <summary>
/// 保存参数。
/// </summary>
/// <summary>保存参数。</summary>
public BPARelayCommand SaveParamCommand { get; set; } public BPARelayCommand SaveParamCommand { get; set; }


private EFunc _FuncName; private EFunc _FuncName;


/// <summary>
/// 功能名称。
/// </summary>
/// <summary>功能名称。</summary>
public EFunc FuncName public EFunc FuncName
{ {
get { return _FuncName; } get { return _FuncName; }


+ 5
- 15
BPASmartClient.MorkCL/ViewModel/EditRawMaterialViewModel.cs View File

@@ -197,9 +197,7 @@ namespace BPASmartClient.MorkCL.ViewModel


private string _CurrentMaterialType; private string _CurrentMaterialType;


/// <summary>
/// 物料类型
/// </summary>
/// <summary>物料类型</summary>
public string CurrentMaterialType public string CurrentMaterialType
{ {
get { return _CurrentMaterialType; } get { return _CurrentMaterialType; }
@@ -218,9 +216,7 @@ namespace BPASmartClient.MorkCL.ViewModel


private string _MaterialName; private string _MaterialName;


/// <summary>
/// 物料名称
/// </summary>
/// <summary>物料名称</summary>
public string MaterialName public string MaterialName
{ {
get { return _MaterialName; } get { return _MaterialName; }
@@ -229,9 +225,7 @@ namespace BPASmartClient.MorkCL.ViewModel


private int _MaterialLoc; private int _MaterialLoc;


/// <summary>
/// 物料位置
/// </summary>
/// <summary>物料位置</summary>
public int MaterialLoc public int MaterialLoc
{ {
get { return _MaterialLoc; } get { return _MaterialLoc; }
@@ -248,9 +242,7 @@ namespace BPASmartClient.MorkCL.ViewModel


private Visibility _MaterialTypeVis; private Visibility _MaterialTypeVis;


/// <summary>
/// 是否新增,如果是新增,则显示主料类型框。反之,则不显示。
/// </summary>
/// <summary>是否新增,如果是新增,则显示主料类型框。反之,则不显示。</summary>
public Visibility MaterialTypeVis public Visibility MaterialTypeVis
{ {
get { return _MaterialTypeVis; } get { return _MaterialTypeVis; }
@@ -259,9 +251,7 @@ namespace BPASmartClient.MorkCL.ViewModel


private Visibility _LocationVis; private Visibility _LocationVis;


/// <summary>
/// 是否显示位置框,如果为主料,则不显示。反之,则显示。
/// </summary>
/// <summary>是否显示位置框,如果为主料,则不显示。反之,则显示。</summary>
public Visibility LocationVis public Visibility LocationVis
{ {
get { return _LocationVis; } get { return _LocationVis; }


+ 16
- 38
BPASmartClient.MorkCL/ViewModel/EditRecipeViewModel.cs View File

@@ -294,10 +294,10 @@ namespace BPASmartClient.MorkCL.ViewModel
}); });
MoveUpCommand = new((o) => 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; int newIndex = index - 1;
Functions.RemoveAt(index); Functions.RemoveAt(index);
@@ -311,7 +311,7 @@ namespace BPASmartClient.MorkCL.ViewModel
if (o != null && o is FuncModel funcmodel) if (o != null && o is FuncModel funcmodel)
{ {
var index = Functions.IndexOf(funcmodel); var index = Functions.IndexOf(funcmodel);
if (index < Functions.Count-1)
if (index < Functions.Count - 1)
{ {
int newIndex = index + 1; int newIndex = index + 1;
Functions.RemoveAt(index); Functions.RemoveAt(index);
@@ -334,40 +334,26 @@ namespace BPASmartClient.MorkCL.ViewModel
//} //}
} }


/// <summary>
/// 保存参数。
/// </summary>
/// <summary>保存参数。</summary>
public BPARelayCommand SaveParamCommand { get; set; } public BPARelayCommand SaveParamCommand { get; set; }


/// <summary>
/// 添加功能
/// </summary>
/// <summary>添加功能</summary>
public BPARelayCommand AddFuncCommand { get; set; } public BPARelayCommand AddFuncCommand { get; set; }


/// <summary>
/// 删除功能。
/// </summary>
/// <summary>删除功能。</summary>
public BPARelayCommand<object> RemoveCommand { get; set; } public BPARelayCommand<object> RemoveCommand { get; set; }


/// <summary>
/// 功能选择改变。
/// </summary>
/// <summary>功能选择改变。</summary>
public BPARelayCommand<object> FuncChangeCommand { get; set; } public BPARelayCommand<object> FuncChangeCommand { get; set; }


/// <summary>
/// 编辑功能。
/// </summary>
/// <summary>编辑功能。</summary>
public BPARelayCommand<object> EditCommand { get; set; } public BPARelayCommand<object> EditCommand { get; set; }


/// <summary>
/// 功能上移。
/// </summary>
/// <summary>功能上移。</summary>
public BPARelayCommand<object> MoveUpCommand { get; set; } 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; private ObservableCollection<FuncModel> _Functions;


@@ -379,9 +365,7 @@ namespace BPASmartClient.MorkCL.ViewModel


private string _Name; private string _Name;


/// <summary>
/// 配方名称
/// </summary>
/// <summary>配方名称</summary>
public string Name public string Name
{ {
get { return _Name; } get { return _Name; }
@@ -390,9 +374,7 @@ namespace BPASmartClient.MorkCL.ViewModel


private string _ID; private string _ID;


/// <summary>
/// 配方ID。
/// </summary>
/// <summary>配方ID。</summary>
public string ID public string ID
{ {
get { return _ID; } get { return _ID; }
@@ -401,9 +383,7 @@ namespace BPASmartClient.MorkCL.ViewModel


private ObservableCollection<string> _AllFunc; private ObservableCollection<string> _AllFunc;


/// <summary>
/// 所有功能集合。
/// </summary>
/// <summary>所有功能集合。</summary>
public ObservableCollection<string> AllFunc public ObservableCollection<string> AllFunc
{ {
get { return _AllFunc; } get { return _AllFunc; }
@@ -412,9 +392,7 @@ namespace BPASmartClient.MorkCL.ViewModel


private ObservableCollection<string> _AllDishType; private ObservableCollection<string> _AllDishType;


/// <summary>
/// 所有菜品集合。
/// </summary>
/// <summary>所有菜品集合。</summary>
public ObservableCollection<string> AllDishType public ObservableCollection<string> AllDishType
{ {
get { return _AllDishType; } get { return _AllDishType; }


+ 8
- 15
BPASmartClient.MorkCL/ViewModel/FryPanSelectViewModel.cs View File

@@ -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 public class FryPanSelectViewModel : NotifyBase
{ {
@@ -12,16 +6,18 @@ namespace BPASmartClient.MorkCL.ViewModel
{ {
SelectFryPanCommand = new((object i) => SelectFryPanCommand = new((object i) =>
{ {
if (int.TryParse(i.ToString(),out int res))
if (int.TryParse(i.ToString(), out int res))
{ {
switch (res) switch (res)
{ {
case 1: case 1:
DeviceType = EDeviceType.炒锅1; DeviceType = EDeviceType.炒锅1;
break; break;

case 2: case 2:
DeviceType = EDeviceType.炒锅2; DeviceType = EDeviceType.炒锅2;
break; break;

default: default:
DeviceType = EDeviceType.无; DeviceType = EDeviceType.无;
break; break;
@@ -29,22 +25,19 @@ namespace BPASmartClient.MorkCL.ViewModel


ActionManage.GetInstance.Send("CloseFryPanSelectView", true); ActionManage.GetInstance.Send("CloseFryPanSelectView", true);
} }
}); });



CloseCommand = new(() => CloseCommand = new(() =>
{ {
ActionManage.GetInstance.Send("CloseFryPanSelectView",false);
ActionManage.GetInstance.Send("CloseFryPanSelectView", false);
}); });
} }
/// <summary>
/// 选择命令。
/// </summary>

/// <summary>选择命令。</summary>
public BPARelayCommand<object> SelectFryPanCommand { get; set; } public BPARelayCommand<object> SelectFryPanCommand { get; set; }


public BPARelayCommand CloseCommand { get; set; } public BPARelayCommand CloseCommand { get; set; }


public static EDeviceType DeviceType { get; set; } public static EDeviceType DeviceType { get; set; }
} }
}
}

+ 20
- 35
BPASmartClient.MorkCL/ViewModel/ItemStorageViewModel.cs View File

@@ -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.Model.Json;
using BPASmartClient.MorkCL.Server; using BPASmartClient.MorkCL.Server;
using S7.Net.Protocol;
using System.Transactions;


namespace BPASmartClient.MorkCL.ViewModel namespace BPASmartClient.MorkCL.ViewModel
{ {
@@ -20,19 +15,16 @@ namespace BPASmartClient.MorkCL.ViewModel
{ {
IngredientsItorage = new ObservableCollection<ItemStorage>(Json<ItemStorageInfo>.Data.IngredientsStorage); IngredientsItorage = new ObservableCollection<ItemStorage>(Json<ItemStorageInfo>.Data.IngredientsStorage);
AccessoriesItorage = new ObservableCollection<ItemStorage>(Json<ItemStorageInfo>.Data.AccessoriesStorage); AccessoriesItorage = new ObservableCollection<ItemStorage>(Json<ItemStorageInfo>.Data.AccessoriesStorage);
},"RefreshItemStorage",true);
}, "RefreshItemStorage", true);


ActionManage.GetInstance.Register((() => ActionManage.GetInstance.Register((() =>
{ {
Ingredients = new ObservableCollection<IngredientsTB>(SqliteHelper.GetInstance.GetIngredients()); Ingredients = new ObservableCollection<IngredientsTB>(SqliteHelper.GetInstance.GetIngredients());
}), "RefreshIngredients", true); }), "RefreshIngredients", true);



ActionManage.GetInstance.Register((object o) => ActionManage.GetInstance.Register((object o) =>
{ {
if (o!=null)
if (o != null)
{ {
#if !FORMAL #if !FORMAL
ScaleCurrentWeight = (float)o; ScaleCurrentWeight = (float)o;
@@ -42,8 +34,8 @@ namespace BPASmartClient.MorkCL.ViewModel
} }
}, "SendCurrentWeight"); }, "SendCurrentWeight");


ActionManage.GetInstance.Register((object o) => {
ActionManage.GetInstance.Register((object o) =>
{
CanItemStorage = (bool)o; CanItemStorage = (bool)o;
}, "RefreshCanItemStorage", true); }, "RefreshCanItemStorage", true);


@@ -56,6 +48,7 @@ namespace BPASmartClient.MorkCL.ViewModel
ActionManage.GetInstance.Send(NotifyTopic.ItemStorage, o); ActionManage.GetInstance.Send(NotifyTopic.ItemStorage, o);


#region 暂时弃用 #region 暂时弃用

//if (!CanItemStorage) //if (!CanItemStorage)
//{ //{
// MessageNotify.GetInstance.ShowDialog("当前有炒菜任务正在排队,为避免影响菜品口味,不可入库,请稍后再试。", DialogType.Warning); // MessageNotify.GetInstance.ShowDialog("当前有炒菜任务正在排队,为避免影响菜品口味,不可入库,请稍后再试。", DialogType.Warning);
@@ -66,7 +59,6 @@ namespace BPASmartClient.MorkCL.ViewModel
//{ //{
// if (o != null && o is IngredientsTB ingredients) // if (o != null && o is IngredientsTB ingredients)
// { // {

// foreach (ItemStorage item in Json<ItemStorageInfo>.Data.IngredientsStorage) // foreach (ItemStorage item in Json<ItemStorageInfo>.Data.IngredientsStorage)
// { // {
// if (item.IsEmploy == false) // if (item.IsEmploy == false)
@@ -76,14 +68,14 @@ namespace BPASmartClient.MorkCL.ViewModel
// item.IsEmploy = true; // item.IsEmploy = true;
// item.Weight = ScaleCurrentWeight; // 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; // return;
@@ -101,9 +93,9 @@ namespace BPASmartClient.MorkCL.ViewModel
// NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, Application.Current.MainWindow, "入库失败", $"物料入库失败。"); // 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; } public BPARelayCommand<object> InStorageCommand { get; set; }


private float _ScaleCurrentWeight; private float _ScaleCurrentWeight;

public float ScaleCurrentWeight public float ScaleCurrentWeight
{ get { return _ScaleCurrentWeight; } set { _ScaleCurrentWeight = value; OnPropertyChanged(); } } { get { return _ScaleCurrentWeight; } set { _ScaleCurrentWeight = value; OnPropertyChanged(); } }


@@ -139,9 +132,7 @@ namespace BPASmartClient.MorkCL.ViewModel


private ObservableCollection<ItemStorage> _IngredientsItorage; private ObservableCollection<ItemStorage> _IngredientsItorage;


/// <summary>
/// 主料库位。
/// </summary>
/// <summary>主料库位。</summary>
public ObservableCollection<ItemStorage> IngredientsItorage public ObservableCollection<ItemStorage> IngredientsItorage
{ {
get { return _IngredientsItorage; } get { return _IngredientsItorage; }
@@ -150,9 +141,7 @@ namespace BPASmartClient.MorkCL.ViewModel


private ObservableCollection<ItemStorage> _AccessoriesItorage; private ObservableCollection<ItemStorage> _AccessoriesItorage;


/// <summary>
/// 辅料库位
/// </summary>
/// <summary>辅料库位</summary>
public ObservableCollection<ItemStorage> AccessoriesItorage public ObservableCollection<ItemStorage> AccessoriesItorage
{ {
get { return _AccessoriesItorage; } get { return _AccessoriesItorage; }
@@ -161,9 +150,7 @@ namespace BPASmartClient.MorkCL.ViewModel


private ObservableCollection<IngredientsTB> _Ingredients; private ObservableCollection<IngredientsTB> _Ingredients;


/// <summary>
/// 所有的主料数据。作为ComboBox的数据源。
/// </summary>
/// <summary>所有的主料数据。作为ComboBox的数据源。</summary>
public ObservableCollection<IngredientsTB> Ingredients public ObservableCollection<IngredientsTB> Ingredients
{ {
get { return _Ingredients; } get { return _Ingredients; }
@@ -171,14 +158,12 @@ namespace BPASmartClient.MorkCL.ViewModel
} }


private bool _CanItemStorage; private bool _CanItemStorage;
/// <summary>
/// 入库许可。
/// </summary>

/// <summary>入库许可。</summary>
public bool CanItemStorage public bool CanItemStorage
{ {
get { return _CanItemStorage; } get { return _CanItemStorage; }
set { _CanItemStorage = value; OnPropertyChanged(); } set { _CanItemStorage = value; OnPropertyChanged(); }
} }

} }
} }

+ 18
- 10
BPASmartClient.MorkCL/ViewModel/RecipeManageViewModel.cs View File

@@ -105,22 +105,30 @@ namespace BPASmartClient.MorkCL.ViewModel
#endregion #endregion


var tempDeviceType = EDeviceType.无; 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 else
return;
{
tempDeviceType = EDeviceType.压力锅;
}
data.DeviceType= tempDeviceType; data.DeviceType= tempDeviceType;
ActionManage.GetInstance.Send(NotifyTopic.FormulaDistribution, data); ActionManage.GetInstance.Send(NotifyTopic.FormulaDistribution, data);


+ 3
- 11
BPASmartClient.MorkCL/ViewModel/testViewModel.cs View File

@@ -8,14 +8,10 @@ namespace BPASmartClient.MorkCL.ViewModel
{ {
public testViewModel() public testViewModel()
{ {

TBS = new(SqliteHelper.GetInstance.GetAccessories()); TBS = new(SqliteHelper.GetInstance.GetAccessories());



testCommand = new BPARelayCommand(() => testCommand = new BPARelayCommand(() =>
{ {


ControlData cd = new ControlData(); ControlData cd = new ControlData();
cd.Name = "莲白回锅"; cd.Name = "莲白回锅";
cd.DeviceType = EDeviceType.炒锅1; cd.DeviceType = EDeviceType.炒锅1;
@@ -109,12 +105,8 @@ namespace BPASmartClient.MorkCL.ViewModel
// Name = $"AccessoriesTB{i}" // 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() // SqliteHelper.GetInstance.AddSeasoning(new Model.DB.SeasoningTB()
// { // {
@@ -169,6 +161,6 @@ namespace BPASmartClient.MorkCL.ViewModel


public BPARelayCommand testCommand { get; set; } public BPARelayCommand testCommand { get; set; }


public ObservableCollection<AccessoriesTB> TBS { get; set; }
public ObservableCollection<AccessoriesTB> TBS { get; set; }
} }
} }

+ 6
- 7
BPASmartClient.ScreenALL/App.xaml View File

@@ -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> </Application>

Loading…
Cancel
Save