Преглед на файлове

1. 精简配方工艺。2.修改调试界面使得更方便。

煮面机(新)
ZhaoGang преди 1 година
родител
ревизия
4abe039c18
променени са 15 файла, в които са добавени 952 реда и са изтрити 259 реда
  1. +125
    -88
      BPASmartClient.MorkCL/Control_MorkCL.cs
  2. +13
    -13
      BPASmartClient.MorkCL/Model/Func/EFunc.cs
  3. +21
    -12
      BPASmartClient.MorkCL/Model/Func/InitData.cs
  4. +4
    -0
      BPASmartClient.MorkCL/Server/FryingPanServer.cs
  5. +4
    -0
      BPASmartClient.MorkCL/Server/OtherServer.cs
  6. +4
    -0
      BPASmartClient.MorkCL/Server/PressureCookerServer.cs
  7. +5
    -0
      BPASmartClient.MorkCL/Server/RobotServer.cs
  8. +196
    -12
      BPASmartClient.MorkCL/View/Debug.xaml
  9. +19
    -14
      BPASmartClient.MorkCL/View/EditFunctionParamView.xaml
  10. +2
    -2
      BPASmartClient.MorkCL/View/EditRecipeView.xaml
  11. +5
    -5
      BPASmartClient.MorkCL/View/ParSet.xaml
  12. +10
    -10
      BPASmartClient.MorkCL/View/RecipeManageView.xaml
  13. +435
    -57
      BPASmartClient.MorkCL/ViewModel/DebugViewModel.cs
  14. +98
    -38
      BPASmartClient.MorkCL/ViewModel/EditRecipeViewModel.cs
  15. +11
    -8
      BPASmartClient.MorkCL/ViewModel/RecipeManageViewModel.cs

+ 125
- 88
BPASmartClient.MorkCL/Control_MorkCL.cs Целия файл

@@ -452,28 +452,31 @@ namespace BPASmartClient.MorkCL
{
switch (fm.eFunc)
{
#region 搅拌启动与停止

case EFunc.搅拌启动:
device.StirStartOrStop = false;

//DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-写入搅拌频率-{fm.funcPars.ElementAt(0).ParValue.ToString()}HZ。");
device.MixingFrequencySet(fm.funcPars.ElementAt(0).ParValue.ToString());
DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-写入搅拌频率-{fm.funcPars.ElementAt(0).ParValue.ToString()}HZ完成。");
await Task.Delay(400);
//DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-写入开始搅拌。");
device.StirStartOrStop = true;
DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-写入开始搅拌完成。");

break;
case EFunc.搅拌停止:
//DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-写入停止搅拌。");
device.StirStartOrStop = false;
DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-写入停止搅拌完成。");
break;
break;

#endregion

#region 加热启动与停止

case EFunc.加热启动:
device.HeatStartOrStop = false;
await Task.Delay(400);

//DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-设置加热挡位-【{fm.funcPars.ElementAt(0).ParValue.ToString()}】。");
device.HeatingGearSet(fm.funcPars.ElementAt(0).ParValue.ToString());
DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-设置加热挡位-【{fm.funcPars.ElementAt(0).ParValue.ToString()}】完成,等待设置加热启动。");

@@ -481,10 +484,12 @@ namespace BPASmartClient.MorkCL
DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-设置加热启动完成。");
break;
case EFunc.加热停止:
//DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-设置加热停止。");
device.HeatStartOrStop = false;
DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-设置加热停止完成。");
break;
break;
#endregion

#region 添加调料
case EFunc.添加调料:
DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-查找调料【{fm.funcPars.ElementAt(0).Id}】。");
var Seasoning = SqliteHelper.GetInstance.GetSeasoning().FirstOrDefault(p => p.Id == fm.funcPars.ElementAt(0).Id);
@@ -493,7 +498,6 @@ namespace BPASmartClient.MorkCL
device.FryingPanToSeasoningLoc = false;
await Task.Delay(400);

//DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-设置炒锅到调料投料位置。");
device.FryingPanToSeasoningLoc = true;
DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-设置炒锅到调料投料位置完成,等待炒锅到达调料投料位置。");

@@ -507,6 +511,16 @@ namespace BPASmartClient.MorkCL

device.CuttingControl(Seasoning.Loc.ToString(), fm.funcPars.ElementAt(1).ParValue.ToString(), TaskList[et].Cts);
DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-执行下料,下料位置:{Seasoning.Loc.ToString()},下料重量:【{fm.funcPars.ElementAt(1).ParValue.ToString()}】。");

//去炒制位
string stirFryLoc = fm.funcPars.ElementAt(2).ParValue.ToString();
GoStirFryLoc(stirFryLoc);

//炒制
if (int.TryParse(fm.funcPars.ElementAt(3).ParValue.ToString(), out int time))
{
StirFry(time);
}
}
else
{
@@ -515,7 +529,10 @@ namespace BPASmartClient.MorkCL
TaskList[et].Cts.Cancel();
}

break;
break;
#endregion

#region 添加主料
case EFunc.添加主料:
DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-查找主料【{fm.funcPars.ElementAt(0).Id}】。");

@@ -527,23 +544,19 @@ namespace BPASmartClient.MorkCL
item => item.MaterialID == fm.funcPars.ElementAt(0).Id/* && item.Weight == weight*/);
if (ingre_index >= 0)
{
//device.CuttingControl(Seasoning.Loc.ToString(), fm.funcPars.ElementAt(1).ParValue.ToString());
var ingredientes = Json<ItemStorageInfo>.Data.IngredientsStorage[ingre_index];

DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-执行下料,控制取{ingre_index + 1}库物料,下料名称:{ingredientes.Name.ToString()},下料重量:【{fm.funcPars.ElementAt(1).ParValue.ToString()}】。");
device.FryingPanHome = false;

//DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-设置机器人任务【{(ingre_index + 1).ToString()}】,子任务【{et}】。");

robot.RobotTaskControl((ingre_index + 1).ToString(), et);
DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-设置机器人任务【{(ingre_index + 1).ToString()}】,子任务【{et}】完成。");
await Task.Delay(400);

//DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-设置炒锅回投料位置。");
device.FryingPanHome = true;
DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-设置炒锅回投料位置完成,等待炒锅回到主料辅料投料位置");

//DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-等待炒锅到投料位置。");
device.FeedingLocFB.Wait(Cts: TaskList[et].Cts);//等待炒锅到投料位置
await Task.Delay(400);

@@ -553,12 +566,6 @@ namespace BPASmartClient.MorkCL

DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-等待机器人到投料位置。");
robot.MaterialPouringRequest[index].Wait(Cts: TaskList[et].Cts); //等待机器人到投料位置也就是发出倒料请求。
//DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-等待机器人到投料位置完成。");

//目前程序在炒锅在投料位置时,会自动发出允许倒料信息。
//DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-设置允许机器人开始投料。");
//robot.AllowPourVegetables(et);//允许机器人开始投料
//DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-设置允许机器人开始投料完成。");

DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-机器人已到达投料位置,等待机器人投料完成。");
robot.MaterialPouringComplete[index].Wait(Cts: TaskList[et].Cts); //等待机器人投料完成
@@ -567,6 +574,16 @@ namespace BPASmartClient.MorkCL
Json<ItemStorageInfo>.Data.IngredientsStorage[ingre_index] = new ItemStorage();
Json<ItemStorageInfo>.Save();
ActionManage.GetInstance.Send("RefreshItemStorage");

//去炒制位
string stirFryLoc = fm.funcPars.ElementAt(2).ParValue.ToString();
GoStirFryLoc(stirFryLoc);

//炒制
if (int.TryParse(fm.funcPars.ElementAt(3).ParValue.ToString(), out int time))
{
StirFry(time);
}
}
else
{
@@ -577,7 +594,10 @@ namespace BPASmartClient.MorkCL
TaskList[et].Cts.Cancel();
}
}
break;
break;
#endregion

#region 添加辅料
case EFunc.添加辅料:
#region 根据配置文件选择每个炒锅的最大最小辅料位置,暂时没使用。
var minloc = 1;
@@ -610,33 +630,34 @@ namespace BPASmartClient.MorkCL
//先复位变量。防止上一次是异常结束,设为True时,不会响应。
device.FryingPanHome = false;

//DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-设置机器人任务【{(mb.Loc + 12).ToString()}】,子任务【{et}】。");
robot.RobotTaskControl((mb.Loc + 12).ToString(), et);
DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-设置机器人任务【{(mb.Loc + 12).ToString()}】,子任务【{et}】完成。");

//DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-设置炒锅回投料位置。");
await Task.Delay(400);
device.FryingPanHome = true;
DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-设置炒锅回投料位置完成,开始等待炒锅到投料位置。");

//DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-等待炒锅到投料位置。");
device.FeedingLocFB.Wait(Cts: TaskList[et].Cts);//等待炒锅到投料位置
await Task.Delay(400);
device.FryingPanHome = false;
DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-等待炒锅到投料位置完成,等待机器人到投料位置。");

//DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-等待机器人到投料位置。");
robot.MaterialPouringRequest[index].Wait(Cts: TaskList[et].Cts); //等待机器人到投料位置
DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-机器人到达投料位置完成,开始等待机器人投料完成。");

//DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-设置允许机器人开始投料。");
//robot.AllowPourVegetables(et);//允许机器人开始投料
//DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-设置允许机器人开始投料完成。");

//DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-开始等待机器人投料完成。");
robot.MaterialPouringComplete[index].Wait(Cts: TaskList[et].Cts); //等待机器人投料完成
DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-机器人投料完成。");

//去炒制位
string stirFryLoc = fm.funcPars.ElementAt(1).ParValue.ToString();
GoStirFryLoc(stirFryLoc);

//炒制
if (int.TryParse(fm.funcPars.ElementAt(2).ParValue.ToString(), out int time))
{
StirFry(time);
}

}
else
{
@@ -645,25 +666,16 @@ namespace BPASmartClient.MorkCL
TaskList[et].Cts.Cancel();
}
break;
case EFunc.炒锅回原点位:
device.FryingPanFeedingLoc = false;
device.FryingPanHome = false;
//DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-设置炒锅回原点。");
await Task.Delay(400);
device.FryingPanHome = true;
DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-设置炒锅回原点完成,等待炒锅回原点。");
#endregion
//case EFunc.炒锅回原点位:

//DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-等待回原点完成。");
device.FeedingLocFB.Wait(Cts: TaskList[et].Cts);
await Task.Delay(400);
device.FryingPanHome = false;
DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-炒锅回原点完成。");
break;
// break;
#region 出餐启动
case EFunc.出餐启动:

device.DiningOutStart = false;
DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-设置机器人取空盆。");
robot.IsIdle.Wait(Cts: TaskList[et].Cts);
//TODO:暂时修改,后期优化。
while (!TaskList[et].Cts.IsCancellationRequested)
@@ -699,62 +711,88 @@ namespace BPASmartClient.MorkCL
await Task.Delay(400);
device.DiningOutStart = false;
break;
case EFunc.炒锅清洗:
device.FryingPanClear = false;

//DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-设置炒锅清洗。");
await Task.Delay(400);
device.FryingPanClear = true;
DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-炒锅清洗已写入,等待炒锅清洗完成。");
#endregion
#region 炒锅清洗--基本没用
//case EFunc.炒锅清洗:
// device.FryingPanClear = false;

Thread.Sleep(500);
device.CleanFinish.Wait(Cts: TaskList[et].Cts);
await Task.Delay(400);
device.FryingPanClear = false;
DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-炒锅清洗完成。");
break;
//该功能废弃,添加调料时,自动回到调料投料位置。
//case EFunc.炒锅回调料投料位置:
// device.FryingPanToSeasoningLoc = false;
// //DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-设置炒锅清洗。");
// await Task.Delay(400);
// device.FryingPanClear = true;
// DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-炒锅清洗已写入,等待炒锅清洗完成。");

// //DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-设置炒锅到调料投料位置。");
// Thread.Sleep(500);
// device.CleanFinish.Wait(Cts: TaskList[et].Cts);
// await Task.Delay(400);
// device.FryingPanToSeasoningLoc = true;
// DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-设置炒锅到调料投料位置完成,等待回到调料投料位置。");
// device.FryingPanClear = false;
// DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-炒锅清洗完成。");
// break;
#endregion

// //回到投料位置就复位。
#region 2023-11-16改进 废弃代码
//case EFunc.去指定炒制位:
// //DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-设置去指定炒制位。");
// string loc = fm.funcPars.ElementAt(0).ParValue.ToString();
// GoStirFryLoc(loc);

// Thread.Sleep(50);
// device.FeedingSeasoningLocFB.Wait(Cts: TaskList[et].Cts);
// await Task.Delay(400);
// device.FryingPanToSeasoningLoc = false;
// DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-炒锅回到调料投料位置完成。");
// break;
case EFunc.去指定炒制位:
//DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-设置去指定炒制位。");
device.SetStirFryingLoc(fm.funcPars.ElementAt(0).ParValue.ToString(), TaskList[et].Cts);
DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-设置去指定炒制位【{fm.funcPars.ElementAt(0).ParValue.ToString()}】完成。");

//TODO:根据情况看是否需要等待反馈变量。
//device.StirFryingLocFB[int.Parse(fm.funcPars.ElementAt(0).ParValue.ToString())].Wait();
//DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-炒锅到达炒制位【{fm.funcPars.ElementAt(0).ParValue.ToString()}】。");
break;
case EFunc.炒制:

if (int.TryParse(fm.funcPars.ElementAt(0).ParValue.ToString(), out int time))
{
DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-等待炒制【{time}】秒。");
// break;
//case EFunc.炒制:

Task.Delay(time * 1000).Wait(TaskList[et].Cts.Token);
DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-炒制完成。");
}
// if (int.TryParse(fm.funcPars.ElementAt(0).ParValue.ToString(), out int time))
// {
// StirFry(time);
// }

break;
// break;
#endregion
default:
break;
}
}

#region 回原点
void GoHome()
{
device.FryingPanFeedingLoc = false;
device.FryingPanHome = false;
//DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-设置炒锅回原点。");
Task.Delay(400).Wait();
device.FryingPanHome = true;
DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-设置炒锅回原点完成,等待炒锅回原点。");

//DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-等待回原点完成。");
device.FeedingLocFB.Wait(Cts: TaskList[et].Cts);
Task.Delay(400).Wait();
device.FryingPanHome = false;
DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-炒锅回原点完成。");
}
#endregion

#region 去指定炒制位
//去指定炒制位
void GoStirFryLoc(string loc)
{
device.SetStirFryingLoc(loc, TaskList[et].Cts);
DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-设置去指定炒制位【{fm.funcPars.ElementAt(0).ParValue.ToString()}】完成。");

//TODO:根据情况看是否需要等待反馈变量。
//device.StirFryingLocFB[int.Parse(fm.funcPars.ElementAt(0).ParValue.ToString())].Wait();
//DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-炒锅到达炒制位【{fm.funcPars.ElementAt(0).ParValue.ToString()}】。");
}
#endregion

#region 炒制延时
//炒制延时。
void StirFry(int time)
{
DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-等待炒制【{time}】秒。");

Task.Delay(time * 1000).Wait(TaskList[et].Cts.Token);
DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-炒制完成。");
}
#endregion

}
catch (TaskCanceledException)
{
DeviceProcessLogShow($"{cd.Name}-【{et}#】任务被取消。");
@@ -1219,7 +1257,6 @@ namespace BPASmartClient.MorkCL
}
return false;
};

}
}

+ 13
- 13
BPASmartClient.MorkCL/Model/Func/EFunc.cs Целия файл

@@ -11,18 +11,18 @@ namespace BPASmartClient.MorkCL.Model.Func
/// </summary>
public enum EFunc
{
搅拌启动,
搅拌停止,
加热启动,
加热停止,
添加调料,
添加主料,
添加辅料,
炒锅回原点位,
出餐启动,
炒锅清洗,
炒锅回调料投料位置,
去指定炒制位,
炒制
搅拌启动=0,
搅拌停止=1,
加热启动=2,
加热停止=3,
添加调料=4,
添加主料=5,
添加辅料=6,
//炒锅回原点位=7,
出餐启动=8,
//炒锅清洗=9,
//炒锅回调料投料位置=10,
//去指定炒制位=11,
//炒制=12
}
}

+ 21
- 12
BPASmartClient.MorkCL/Model/Func/InitData.cs Целия файл

@@ -14,25 +14,34 @@ namespace BPASmartClient.MorkCL.Model.Func
{ EFunc.搅拌停止,new FuncPar[0] },
{ EFunc.加热启动,new FuncPar[] { new FuncPar() { ParName="加热档位", ParUnit ="挡", ParDescribe="请输入 1 -- 8 挡的档位"} } },
{ EFunc.加热停止,new FuncPar[0] },
{ EFunc.添加调料,new FuncPar[]
{
new FuncPar() { ParName="调料名称", ParDescribe="请选择一种调料"} ,
new FuncPar() { ParName="调料需求值", ParUnit ="g", ParDescribe="请输入调料的需求量"} ,
}
},
{ EFunc.添加主料,new FuncPar[]
{
new FuncPar() { ParName="主料名称", ParDescribe="请选择一种主料"} ,
new FuncPar() { ParName="主料份量", ParUnit ="KG", ParDescribe="请输入主料的份量"} ,
new FuncPar() { ParName="设置炒制位", ParDescribe="请输入 1--3 选择一个合适的炒制位置"},
new FuncPar() { ParName="设置炒制时间",ParUnit="秒", ParDescribe="请设置一个合适的炒制时间"}
}
},
{ EFunc.添加辅料,new FuncPar[] { new FuncPar() { ParName= "辅料名称", ParDescribe= "请选择一种辅料" } } },
{ EFunc.炒锅回原点位,new FuncPar[0] },
{ EFunc.添加调料,new FuncPar[]
{
new FuncPar() { ParName="调料名称", ParDescribe="请选择一种调料"} ,
new FuncPar() { ParName="调料需求值", ParUnit ="g", ParDescribe="请输入调料的需求量"} ,
new FuncPar() { ParName="设置炒制位", ParDescribe="请输入 1--3 选择一个合适的炒制位置"},
new FuncPar() { ParName="设置炒制时间",ParUnit="秒", ParDescribe="请设置一个合适的炒制时间"}
}
},

{ EFunc.添加辅料,new FuncPar[] {
new FuncPar() { ParName="辅料名称", ParDescribe= "请选择一种辅料" },
new FuncPar() { ParName="设置炒制位", ParDescribe="请输入 1--3 选择一个合适的炒制位置"},
new FuncPar() { ParName="设置炒制时间",ParUnit="秒", ParDescribe="请设置一个合适的炒制时间"}
} },
//{ EFunc.炒锅回原点位,new FuncPar[0] },
{ EFunc.出餐启动,new FuncPar[0] },
{ EFunc.炒锅清洗,new FuncPar[0] },
{ EFunc.炒锅回调料投料位置,new FuncPar[0] },
{ EFunc.去指定炒制位,new FuncPar[] { new FuncPar() { ParName="设置炒制位", ParDescribe="请输入 1--3 选择一个合适的炒制位置"} } },
{ EFunc.炒制,new FuncPar[] { new FuncPar() { ParName="设置炒制时间",ParUnit="秒", ParDescribe="请设置一个合适的炒制时间"} } },
//{ EFunc.炒锅清洗,new FuncPar[0] },
//{ EFunc.炒锅回调料投料位置,new FuncPar[0] },
//{ EFunc.去指定炒制位,new FuncPar[] { } },
//{ EFunc.炒制,new FuncPar[] { } },
};
}
}

+ 4
- 0
BPASmartClient.MorkCL/Server/FryingPanServer.cs Целия файл

@@ -13,6 +13,10 @@ namespace BPASmartClient.MorkCL.Server
/// </summary>
internal class FryingPanServer : FryingPanSet, IModbus
{
public FryingPanServer()
{
MyModbus = new ModbusTcp();
}
public void Init(string IP = "", int Port = 502, string PortName = "")
{
MyModbus = new ModbusTcp();


+ 4
- 0
BPASmartClient.MorkCL/Server/OtherServer.cs Целия файл

@@ -12,6 +12,10 @@ namespace BPASmartClient.MorkCL.Server
/// </summary>
internal class OtherServer : OtherDeviceSet, IModbus
{
public OtherServer()
{
MyModbus = new ModbusRtu();
}
public void Init(string IP = "", int Port = 502, string PortName = "")
{
MyModbus = new ModbusRtu();


+ 4
- 0
BPASmartClient.MorkCL/Server/PressureCookerServer.cs Целия файл

@@ -11,6 +11,10 @@ namespace BPASmartClient.MorkCL.Server
/// </summary>
internal class PressureCookerServer : PressureCookerSet, IModbus
{
public PressureCookerServer()
{
MyModbus = new ModbusTcp();
}
public void Init(string IP = "", int Port = 502, string PortName = "")
{
MyModbus = new ModbusTcp();


+ 5
- 0
BPASmartClient.MorkCL/Server/RobotServer.cs Целия файл

@@ -12,6 +12,11 @@ namespace BPASmartClient.MorkCL.Server
/// </summary>
internal class RobotServer : RobotSet, IModbus
{

public RobotServer()
{
MyModbus = new ModbusTcp();
}
public void Init(string IP = "", int Port = 502, string PortName = "")
{
MyModbus = new ModbusTcp();


+ 196
- 12
BPASmartClient.MorkCL/View/Debug.xaml Целия файл

@@ -29,38 +29,42 @@
<RowDefinition Height="0.25*" />
<RowDefinition Height="0.25*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>

<!--#region 炒锅控制-->
<!--#region 1#炒锅控制-->
<pry:ImageBorder Margin="10" />
<StackPanel Margin="15" Orientation="Vertical">
<StackPanel Margin="0,0,0,20" Orientation="Horizontal">
<TextBlock Text="炒锅控制" />
<ComboBox
<StackPanel Margin="30" Orientation="Vertical">
<StackPanel Margin="0,0,0,20" Orientation="Horizontal" HorizontalAlignment="Center">
<TextBlock Text="1#炒锅控制" FontSize="26" />
<!--<ComboBox
Width="150"
Height="50"
Margin="25,0"
FontSize="25"
ItemsSource="{Binding DeviceTypes}"
SelectedItem="{Binding FryingPanSelect}" />
SelectedItem="{Binding FryingPanSelect}" />-->
</StackPanel>
<StackPanel Margin="5" Orientation="Horizontal">
<Button
Height="50"
Height="50" Width="150"
Margin="0,0,20,0"
Command="{Binding SetAutoModeCommand}"
Content="设为自动模式" />
<Button
Height="50"
Height="50" Width="150"
Margin="10,0"
Command="{Binding SetManualModeCommand}"
Content="设为手动模式" />
<Button
Height="50"
Height="50" Width="150"
Margin="10,0"
Command="{Binding InitalDeviceCommand}"
Content="初始化设备" />
<Button
Width="100"
Width="150"
Height="50"
Margin="10,0"
Command="{Binding StopDeviceCommand}"
@@ -179,6 +183,8 @@
HorizontalAlignment="Left"
Command="{Binding GoSeasoningFeddLocCommand}"
Content="炒锅去调料投料位置" />
</WrapPanel>
<WrapPanel Margin="0,5">
<Button
Width="200"
Height="50"
@@ -203,13 +209,190 @@
</StackPanel>


<!--#endregion-->

<!--#region 2#炒锅控制-->
<pry:ImageBorder Margin="10" Grid.Column="1"/>
<StackPanel Margin="30" Orientation="Vertical" Grid.Column="1" >
<StackPanel Margin="0,0,0,20" Orientation="Horizontal" HorizontalAlignment="Center">
<TextBlock Text="2#炒锅控制" FontSize="26"/>
<!--<ComboBox
Width="150"
Height="50"
Margin="25,0"
FontSize="25"
ItemsSource="{Binding DeviceTypes}"
SelectedItem="{Binding FryingPanSelect}" />-->
</StackPanel>
<StackPanel Margin="5" Orientation="Horizontal">
<Button
Height="50" Width="150"
Margin="0,0,20,0"
Command="{Binding SetAutoModeCommand2}"
Content="设为自动模式" />
<Button
Height="50" Width="150"
Margin="10,0"
Command="{Binding SetManualModeCommand2}"
Content="设为手动模式" />
<Button
Height="50" Width="150"
Margin="10,0"
Command="{Binding InitalDeviceCommand2}"
Content="初始化设备" />
<Button
Width="150"
Height="50"
Margin="10,0"
Command="{Binding StopDeviceCommand2}"
Content="停止" />
</StackPanel>
<StackPanel Margin="5" Orientation="Horizontal">
<TextBlock Text="搅拌设定:" />
<TextBox
Width="150"
Height="50"
Margin="5,0"
FontSize="25"
Text="{Binding AgitaFrequency2}" />
<Button
Width="120"
Height="50"
Margin="5,0"
Command="{Binding WriteAgitaParamCommand2}"
Content="写入参数" />
<Button
Width="120"
Height="50"
Margin="5,0"
Command="{Binding StartAgitateCommand2}"
Content="开始搅拌" />
<Button
Width="120"
Height="50"
Margin="5,0"
Command="{Binding StopAgitateCommand2}"
Content="停止搅拌" />
</StackPanel>
<StackPanel Margin="5" Orientation="Horizontal">
<TextBlock Text="加热设定:" />
<TextBox
Width="150"
Height="50"
Margin="5,0"
FontSize="25"
Text="{Binding HeatGear2}" />
<Button
Width="120"
Height="50"
Margin="5,0"
Command="{Binding WriteHeatParamCommand2}"
Content="写入参数" />
<Button
Width="120"
Height="50"
Margin="5,0"
Command="{Binding StartHeatCommand2}"
Content="开始加热" />
<Button
Width="120"
Height="50"
Margin="5,0"
Command="{Binding StopHeatCommand2}"
Content="停止加热" />
</StackPanel>
<StackPanel Margin="5" Orientation="Horizontal">
<TextBlock Text="通道下料:" />
<TextBox
Width="150"
Height="50"
Margin="5,0"
FontSize="25"
Text="{Binding Weight2}" />
<ComboBox
Width="120"
Height="50"
Margin="5,0"
FontSize="25"
SelectedIndex="{Binding ChannelSelect2}">
<ComboBoxItem Content="1#通道" />
<ComboBoxItem Content="2#通道" />
<ComboBoxItem Content="3#通道" />
</ComboBox>
<Button
Width="120"
Height="50"
Margin="5,0"
Command="{Binding ChannelCuttingCommand2}"
Content="开始下料" />
</StackPanel>
<StackPanel Margin="5" Orientation="Horizontal">
<TextBlock Text="去炒制位:" />
<ComboBox
Width="150"
Height="50"
Margin="5,0"
FontSize="25"
SelectedIndex="{Binding StirFryLocSelect2}">
<ComboBoxItem Content="1#炒制位" />
<ComboBoxItem Content="2#炒制位" />
<ComboBoxItem Content="3#炒制位" />
</ComboBox>
<Button
Width="120"
Height="50"
Margin="5,0"
Command="{Binding GoFryLocCommand2}"
Content="写入位置" />
</StackPanel>
<WrapPanel Margin="0,5">
<Button
Width="200"
Height="50"
Margin="5,0"
HorizontalAlignment="Left"
Command="{Binding GoHomeCommand2}"
Content="炒锅回原点(投料位置)" />
<Button
Width="200"
Height="50"
Margin="5,0"
HorizontalAlignment="Left"
Command="{Binding GoSeasoningFeddLocCommand2}"
Content="炒锅去调料投料位置" />
</WrapPanel>
<WrapPanel Margin="0,5">
<Button
Width="200"
Height="50"
Margin="5,0"
HorizontalAlignment="Left"
Command="{Binding OutDiningStartCommand2}"
Content="出餐启动" />
<Button
Width="200"
Height="50"
Margin="5,0"
HorizontalAlignment="Left"
Command="{Binding FryPanCleanCommand2}"
Content="炒锅清洗" />
<!--<Button
Width="100"
Margin="10,0"
Command="{Binding GoCleanLocCommand}"
Content="去洗锅位" />-->
</WrapPanel>
</StackPanel>


<!--#endregion-->

<!--#region 机器人控制-->
<pry:ImageBorder Grid.Row="1" Margin="10" />
<pry:ImageBorder Grid.Row="1" Margin="10" Grid.ColumnSpan="2"/>
<StackPanel
Grid.Row="1"
Margin="15"
Grid.ColumnSpan="2"
Orientation="Horizontal">
<Button
Width="200"
@@ -238,10 +421,11 @@
<!--#endregion-->

<!--#region 系统任务控制-->
<pry:ImageBorder Grid.Row="2" Margin="10" />
<pry:ImageBorder Grid.Row="2" Margin="10" Grid.ColumnSpan="2"/>
<StackPanel
Grid.Row="2"
Margin="15"
Grid.ColumnSpan="2"
Orientation="Horizontal">
<Button
Width="150"


+ 19
- 14
BPASmartClient.MorkCL/View/EditFunctionParamView.xaml Целия файл

@@ -8,8 +8,8 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.MorkCL.ViewModel"
Title="EditFunctionView"
Width="450"
Height="350"
Width="500"
Height="500"
AllowsTransparency="True"
Background="{x:Null}"
Topmost="True"
@@ -79,25 +79,30 @@
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition Height="40" />
<RowDefinition Height="25" />
</Grid.RowDefinitions>
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
<TextBlock Style="{StaticResource TextBlockStyle}" Text="{Binding ParName, StringFormat={}{0}:}" />
<TextBox
Height="30"
<Grid.ColumnDefinitions>
<ColumnDefinition Width="130" />
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<!--<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">-->
<TextBlock Style="{StaticResource TextBlockStyle}" Text="{Binding ParName, StringFormat={}{0}:}" Grid.Column="0" HorizontalAlignment="Left"/>
<TextBox Grid.Column="1"
Height="40" Width="200" FontSize="24"
BorderBrush="DeepSkyBlue"
BorderThickness="1"
Style="{StaticResource InputTextboxStyle}"
Text="{Binding ParValue}"
Visibility="{Binding IsUseComboBox, Converter={StaticResource Bool2VisibilityReverseConverter}}" />
<ComboBox
Width="155"
Height="30"
<ComboBox Grid.Column="1"
Width="200"
Height="40"
BorderBrush="DeepSkyBlue"
BorderThickness="1"
DisplayMemberPath="Name"
FontSize="18"
FontSize="24"
IsEditable="False" ScrollViewer.VerticalScrollBarVisibility="Auto"
ItemsSource="{Binding ComboBoxItemsSource}"
Text="{Binding ParValue}"
@@ -114,13 +119,13 @@
</ComboBox.ItemTemplateSelector>-->

</ComboBox>
<TextBlock
<TextBlock Grid.Column="2"
Margin="5,0"
HorizontalAlignment="Left"
Style="{StaticResource TextBlockStyle}"
Text="{Binding ParUnit}" />
</StackPanel>
<TextBlock
<!--</StackPanel>-->
<TextBlock Grid.ColumnSpan="3"
Grid.Row="1"
HorizontalAlignment="Left"
FontSize="12"


+ 2
- 2
BPASmartClient.MorkCL/View/EditRecipeView.xaml Целия файл

@@ -173,7 +173,7 @@
ItemsSource="{Binding Functions}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Name="gr" Height="30">
<Grid Name="gr" Height="40" Margin="0,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50" />
<ColumnDefinition Width="230" />
@@ -198,7 +198,7 @@

<Grid Grid.Column="1">
<ComboBox
Height="30"
Height="40"
FontSize="18"
IsReadOnly="True"
ItemsSource="{Binding DataContext.AllFunc, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"


+ 5
- 5
BPASmartClient.MorkCL/View/ParSet.xaml Целия файл

@@ -52,26 +52,26 @@
FontSize="16" />
</StackPanel>

<StackPanel Grid.Row="1" Margin="5">
<StackPanel Grid.Row="1" Margin="20,0,0,0">
<CheckBox
Margin="5"
Content="连接炒锅1#"
FontSize="16"
FontSize="24"
IsChecked="{Binding Param.FryPanConnect_1}" />
<CheckBox
Margin="5"
Content="连接炒锅2#"
FontSize="16"
FontSize="24"
IsChecked="{Binding Param.FryPanConnect_2}" />
<CheckBox
Margin="5"
Content="连接机器人"
FontSize="16"
FontSize="24"
IsChecked="{Binding Param.RobotConnet}" />
<CheckBox
Margin="5"
Content="连接外部设备(电子秤以及空盘仓位传感器)"
FontSize="16"
FontSize="24"
IsChecked="{Binding Param.OtherDeviceConnect}" />
</StackPanel>
<!--分位逻辑有问题,暂时不开放 -->


+ 10
- 10
BPASmartClient.MorkCL/View/RecipeManageView.xaml Целия файл

@@ -113,7 +113,7 @@
<Grid Margin="0,10,17,0" Background="#ff0C255F">

<Grid.ColumnDefinitions>
<ColumnDefinition Width="200" />
<ColumnDefinition Width="400" />
<ColumnDefinition Width="100" />
<ColumnDefinition />
<ColumnDefinition Width="200" />
@@ -178,7 +178,7 @@
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200" />
<ColumnDefinition Width="400" />
<ColumnDefinition Width="100" />
<ColumnDefinition />
<ColumnDefinition Width="200" />
@@ -187,21 +187,21 @@
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="0"
Grid.Column="0" FontSize="26"
HorizontalAlignment="Center"
Style="{StaticResource TextBlockStyle}"
Text="{Binding Name}"
TextAlignment="Center" />

<Grid Grid.Column="1">
<TextBox
<TextBox FontSize="26"
MinWidth="400"
Style="{StaticResource DataShowTextBoxStyle}"
Text="{Binding DishType}"
TextAlignment="Center" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
BorderThickness="2,0,2,0"
Cursor="SizeWE" />
</Grid>

@@ -213,7 +213,7 @@
TextAlignment="Center" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
BorderThickness="2,0,2,0"
Cursor="SizeWE" />
</Grid>

@@ -226,7 +226,7 @@
Style="{StaticResource IssueRecipeButtonStyle}" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
BorderThickness="2,0,2,0"
Cursor="SizeWE" />
</Grid>

@@ -239,7 +239,7 @@
Style="{StaticResource IssueRecipeButtonStyle}" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
BorderThickness="2,0,2,0"
Cursor="SizeWE" />
</Grid>

@@ -252,14 +252,14 @@
Style="{StaticResource ControlButtonStyle}" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
BorderThickness="2,0,2,0"
Cursor="SizeWE" />
</Grid>

<Border
Grid.ColumnSpan="10"
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,1" />
BorderThickness="2,0,2,2" />
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>


+ 435
- 57
BPASmartClient.MorkCL/ViewModel/DebugViewModel.cs Целия файл

@@ -13,9 +13,10 @@ namespace BPASmartClient.MorkCL.ViewModel

public DebugViewModel()
{
#region 炒锅1#命令实例
WriteAgitaParamCommand = new(async () =>
{
//if (!GetDeviceIsIdle(FryingPanSelect))
//if (!GetDeviceIsIdle(EDeviceType.炒锅1))
//{
// return;
//}
@@ -23,16 +24,16 @@ namespace BPASmartClient.MorkCL.ViewModel
{
return;
}
ActionManage.GetInstance.Send("WriteUshort", new WriteModel<ushort>(FryingPanSelect, "LW1", (ushort)(AgitaFrequency*100)));
ActionManage.GetInstance.Send("WriteUshort", new WriteModel<ushort>(EDeviceType.炒锅1, "LW1", (ushort)(AgitaFrequency*100)));

await SendWriteRequest("LB10");
await SendWriteRequest("LB10",EDeviceType.炒锅1);

ShowNotify($"写入搅拌参数成功。");
});

StartAgitateCommand = new(() =>
{
if (!GetDeviceIsIdle(FryingPanSelect))
if (!GetDeviceIsIdle(EDeviceType.炒锅1))
{
return;
}
@@ -40,12 +41,12 @@ namespace BPASmartClient.MorkCL.ViewModel
{
return;
}
ActionManage.GetInstance.Send("WriteBool", new WriteModel<bool>(FryingPanSelect, "LB0", true));
ActionManage.GetInstance.Send("WriteBool", new WriteModel<bool>(EDeviceType.炒锅1, "LB0", true));
ShowNotify($"写入搅拌启动成功。");
});
StopAgitateCommand = new(() =>
{
//if (!GetDeviceIsIdle(FryingPanSelect))
//if (!GetDeviceIsIdle(EDeviceType.炒锅1))
//{
// return;
//}
@@ -53,13 +54,13 @@ namespace BPASmartClient.MorkCL.ViewModel
{
return;
}
ActionManage.GetInstance.Send("WriteBool", new WriteModel<bool>(FryingPanSelect, "LB0", false));
ActionManage.GetInstance.Send("WriteBool", new WriteModel<bool>(EDeviceType.炒锅1, "LB0", false));
ShowNotify($"写入搅拌停止成功。");
});

WriteHeatParamCommand = new(async () =>
{
//if (!GetDeviceIsIdle(FryingPanSelect))
//if (!GetDeviceIsIdle(EDeviceType.炒锅1))
//{
// return;
//}
@@ -67,15 +68,15 @@ namespace BPASmartClient.MorkCL.ViewModel
{
return;
}
ActionManage.GetInstance.Send("WriteUshort", new WriteModel<ushort>(FryingPanSelect, "LW0", HeatGear));
ActionManage.GetInstance.Send("WriteUshort", new WriteModel<ushort>(EDeviceType.炒锅1, "LW0", HeatGear));

await SendWriteRequest("LB9");
await SendWriteRequest("LB9", EDeviceType.炒锅1);
ShowNotify($"写入加热参数成功。");
});

StartHeatCommand = new(() =>
{
if (!GetDeviceIsIdle(FryingPanSelect))
if (!GetDeviceIsIdle(EDeviceType.炒锅1))
{
return;
}
@@ -83,13 +84,13 @@ namespace BPASmartClient.MorkCL.ViewModel
{
return;
}
ActionManage.GetInstance.Send("WriteBool", new WriteModel<bool>(FryingPanSelect, "LB3", true));
ActionManage.GetInstance.Send("WriteBool", new WriteModel<bool>(EDeviceType.炒锅1, "LB3", true));
ShowNotify($"写入加热启动成功。");
});

StopHeatCommand = new(() =>
{
//if (!GetDeviceIsIdle(FryingPanSelect))
//if (!GetDeviceIsIdle(EDeviceType.炒锅1))
//{
// return;
//}
@@ -97,7 +98,7 @@ namespace BPASmartClient.MorkCL.ViewModel
{
return;
}
ActionManage.GetInstance.Send("WriteBool", new WriteModel<bool>(FryingPanSelect, "LB3", false));
ActionManage.GetInstance.Send("WriteBool", new WriteModel<bool>(EDeviceType.炒锅1, "LB3", false));
ShowNotify($"写入加热停止成功。");
});

@@ -108,9 +109,9 @@ namespace BPASmartClient.MorkCL.ViewModel
//byte[] LWOffset = new byte[3] { 3, 4, 5 };
//byte[] LBOffset = new byte[3] { 6, 7, 8 };

//ActionManage.GetInstance.Send("WriteUshort", new WriteModel<ushort>(FryingPanSelect, $"LW{LWOffset[channelIndex]}", weight));
//ActionManage.GetInstance.Send("WriteUshort", new WriteModel<ushort>(EDeviceType.炒锅1, $"LW{LWOffset[channelIndex]}", weight));
//await SendWriteRequest($"LB{LBOffset[channelIndex]}");
if (!GetDeviceIsIdle(FryingPanSelect))
if (!GetDeviceIsIdle(EDeviceType.炒锅1))
{
return;
}
@@ -119,7 +120,7 @@ namespace BPASmartClient.MorkCL.ViewModel
return;
}
object[] para = new object[3];
para[0]= FryingPanSelect;
para[0]= EDeviceType.炒锅1;
para[1] = ChannelSelect+1;
para[2] = Convert.ToUInt16(Weight);

@@ -129,7 +130,7 @@ namespace BPASmartClient.MorkCL.ViewModel

GoFryLocCommand = new(async () =>
{
if (!GetDeviceIsIdle(FryingPanSelect))
if (!GetDeviceIsIdle(EDeviceType.炒锅1))
{
return;
}
@@ -139,12 +140,12 @@ namespace BPASmartClient.MorkCL.ViewModel
}
var loc = StirFryLocSelect + 17;

await SendWriteRequest($"LB{loc}");
await SendWriteRequest($"LB{loc}", EDeviceType.炒锅1);
ShowNotify($"写入去炒制位成功。");
});
GoHomeCommand = new(async () =>
{
if (!GetDeviceIsIdle(FryingPanSelect))
if (!GetDeviceIsIdle(EDeviceType.炒锅1))
{
return;
}
@@ -152,12 +153,12 @@ namespace BPASmartClient.MorkCL.ViewModel
{
return;
}
await SendWriteRequest("LB12");
await SendWriteRequest("LB12", EDeviceType.炒锅1);
ShowNotify($"写入回原点成功。");
});
GoSeasoningFeddLocCommand = new(async () =>
{
if (!GetDeviceIsIdle(FryingPanSelect))
if (!GetDeviceIsIdle(EDeviceType.炒锅1))
{
return;
}
@@ -165,13 +166,13 @@ namespace BPASmartClient.MorkCL.ViewModel
{
return;
}
await SendWriteRequest("LB16");
await SendWriteRequest("LB16", EDeviceType.炒锅1);
ShowNotify($"写入去调料投料位成功。");
});

OutDiningStartCommand = new(async () =>
{
if (!GetDeviceIsIdle(FryingPanSelect))
if (!GetDeviceIsIdle(EDeviceType.炒锅1))
{
return;
}
@@ -179,13 +180,13 @@ namespace BPASmartClient.MorkCL.ViewModel
{
return;
}
await SendWriteRequest("LB13");
await SendWriteRequest("LB13", EDeviceType.炒锅1);
ShowNotify($"写入出餐启动成功。");
});

FryPanCleanCommand = new(async () =>
{
if (!GetDeviceIsIdle(FryingPanSelect))
if (!GetDeviceIsIdle(EDeviceType.炒锅1))
{
return;
}
@@ -193,28 +194,28 @@ namespace BPASmartClient.MorkCL.ViewModel
{
return;
}
await SendWriteRequest("LB14");
await SendWriteRequest("LB14", EDeviceType.炒锅1);
ShowNotify($"写入炒锅清洗成功。");
});

SetAutoModeCommand = new(() =>
{
ActionManage.GetInstance.Send("WriteBool", new WriteModel<bool>(FryingPanSelect, "LB20", true));
ActionManage.GetInstance.Send("WriteBool", new WriteModel<bool>(EDeviceType.炒锅1, "LB20", true));
ShowNotify($"设置设备自动模式成功。");
});

SetManualModeCommand = new(() =>
{
if (!GetDeviceIsIdle(FryingPanSelect))
if (!GetDeviceIsIdle(EDeviceType.炒锅1))
{
return;
}
ActionManage.GetInstance.Send("WriteBool", new WriteModel<bool>(FryingPanSelect, "LB20", false));
ActionManage.GetInstance.Send("WriteBool", new WriteModel<bool>(EDeviceType.炒锅1, "LB20", false));
ShowNotify($"设置设备手动模式成功。");
});
InitalDeviceCommand = new(async () =>
{
if (!GetDeviceIsIdle(FryingPanSelect))
if (!GetDeviceIsIdle(EDeviceType.炒锅1))
{
return;
}
@@ -223,14 +224,14 @@ namespace BPASmartClient.MorkCL.ViewModel
{
return;
}
ResetFryPanVariable(FryingPanSelect);
await SendWriteRequest("LB21");
ResetFryPanVariable(EDeviceType.炒锅1);
await SendWriteRequest("LB21", EDeviceType.炒锅1);
ShowNotify($"设置设备初始化成功。");
});

StopDeviceCommand = new(async () =>
{
//if (!GetDeviceIsIdle(FryingPanSelect))
//if (!GetDeviceIsIdle(EDeviceType.炒锅1))
//{
// return;
//}
@@ -238,14 +239,14 @@ namespace BPASmartClient.MorkCL.ViewModel
{
return;
}
await SendWriteRequest("LB22");
await SendWriteRequest("LB22", EDeviceType.炒锅1);
ShowNotify($"设置设备停止成功。");
});

//炒锅那边复位变量没有使用。
GoCleanLocCommand = new(async () =>
{
if (!GetDeviceIsIdle(FryingPanSelect))
if (!GetDeviceIsIdle(EDeviceType.炒锅1))
{
return;
}
@@ -253,10 +254,260 @@ namespace BPASmartClient.MorkCL.ViewModel
{
return;
}
await SendWriteRequest("LB23");
await SendWriteRequest("LB23", EDeviceType.炒锅1);
ShowNotify($"设置设备去洗锅位成功。");
});

#endregion

#region 炒锅2#命令实例
WriteAgitaParamCommand2 = new(async () =>
{
//if (!GetDeviceIsIdle(EDeviceType.炒锅2))
//{
// return;
//}
if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?"))
{
return;
}
ActionManage.GetInstance.Send("WriteUshort", new WriteModel<ushort>(EDeviceType.炒锅2, "LW1", (ushort)(AgitaFrequency * 100)));

await SendWriteRequest("LB10", EDeviceType.炒锅2);

ShowNotify($"写入搅拌参数成功。");
});

StartAgitateCommand2 = new(() =>
{
if (!GetDeviceIsIdle(EDeviceType.炒锅2))
{
return;
}
if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?"))
{
return;
}
ActionManage.GetInstance.Send("WriteBool", new WriteModel<bool>(EDeviceType.炒锅2, "LB0", true));
ShowNotify($"写入搅拌启动成功。");
});
StopAgitateCommand2 = new(() =>
{
//if (!GetDeviceIsIdle(EDeviceType.炒锅2))
//{
// return;
//}
if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?"))
{
return;
}
ActionManage.GetInstance.Send("WriteBool", new WriteModel<bool>(EDeviceType.炒锅2, "LB0", false));
ShowNotify($"写入搅拌停止成功。");
});

WriteHeatParamCommand2 = new(async () =>
{
//if (!GetDeviceIsIdle(EDeviceType.炒锅2))
//{
// return;
//}
if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?"))
{
return;
}
ActionManage.GetInstance.Send("WriteUshort", new WriteModel<ushort>(EDeviceType.炒锅2, "LW0", HeatGear));

await SendWriteRequest("LB9", EDeviceType.炒锅2);
ShowNotify($"写入加热参数成功。");
});

StartHeatCommand2 = new(() =>
{
if (!GetDeviceIsIdle(EDeviceType.炒锅2))
{
return;
}
if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?"))
{
return;
}
ActionManage.GetInstance.Send("WriteBool", new WriteModel<bool>(EDeviceType.炒锅2, "LB3", true));
ShowNotify($"写入加热启动成功。");
});

StopHeatCommand2 = new(() =>
{
//if (!GetDeviceIsIdle(EDeviceType.炒锅2))
//{
// return;
//}
if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?"))
{
return;
}
ActionManage.GetInstance.Send("WriteBool", new WriteModel<bool>(EDeviceType.炒锅2, "LB3", false));
ShowNotify($"写入加热停止成功。");
});

ChannelCuttingCommand2 = new(async () =>
{
//var channelIndex = ChannelSelect;
//var weight = Convert.ToUInt16(Weight);
//byte[] LWOffset = new byte[3] { 3, 4, 5 };
//byte[] LBOffset = new byte[3] { 6, 7, 8 };

//ActionManage.GetInstance.Send("WriteUshort", new WriteModel<ushort>(EDeviceType.炒锅2, $"LW{LWOffset[channelIndex]}", weight));
//await SendWriteRequest($"LB{LBOffset[channelIndex]}");
if (!GetDeviceIsIdle(EDeviceType.炒锅2))
{
return;
}
if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?"))
{
return;
}
object[] para = new object[3];
para[0] = EDeviceType.炒锅2;
para[1] = ChannelSelect + 1;
para[2] = Convert.ToUInt16(Weight);

await Task.Run(() => ActionManage.GetInstance.Send("DeviceCuttingControl", para));
ShowNotify($"写入通道下料控制成功。");
});

GoFryLocCommand2 = new(async () =>
{
if (!GetDeviceIsIdle(EDeviceType.炒锅2))
{
return;
}
if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?"))
{
return;
}
var loc = StirFryLocSelect + 17;

await SendWriteRequest($"LB{loc}", EDeviceType.炒锅2);
ShowNotify($"写入去炒制位成功。");
});
GoHomeCommand2 = new(async () =>
{
if (!GetDeviceIsIdle(EDeviceType.炒锅2))
{
return;
}
if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?"))
{
return;
}
await SendWriteRequest("LB12", EDeviceType.炒锅2);
ShowNotify($"写入回原点成功。");
});
GoSeasoningFeddLocCommand2 = new(async () =>
{
if (!GetDeviceIsIdle(EDeviceType.炒锅2))
{
return;
}
if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?"))
{
return;
}
await SendWriteRequest("LB16", EDeviceType.炒锅2);
ShowNotify($"写入去调料投料位成功。");
});

OutDiningStartCommand2 = new(async () =>
{
if (!GetDeviceIsIdle(EDeviceType.炒锅2))
{
return;
}
if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?"))
{
return;
}
await SendWriteRequest("LB13", EDeviceType.炒锅2);
ShowNotify($"写入出餐启动成功。");
});

FryPanCleanCommand2 = new(async () =>
{
if (!GetDeviceIsIdle(EDeviceType.炒锅2))
{
return;
}
if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?"))
{
return;
}
await SendWriteRequest("LB14", EDeviceType.炒锅2);
ShowNotify($"写入炒锅清洗成功。");
});

SetAutoModeCommand2 = new(() =>
{
ActionManage.GetInstance.Send("WriteBool", new WriteModel<bool>(EDeviceType.炒锅2, "LB20", true));
ShowNotify($"设置设备自动模式成功。");
});

SetManualModeCommand2 = new(() =>
{
if (!GetDeviceIsIdle(EDeviceType.炒锅2))
{
return;
}
ActionManage.GetInstance.Send("WriteBool", new WriteModel<bool>(EDeviceType.炒锅2, "LB20", false));
ShowNotify($"设置设备手动模式成功。");
});
InitalDeviceCommand2 = new(async () =>
{
if (!GetDeviceIsIdle(EDeviceType.炒锅2))
{
return;
}
//复位所有变量。
if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?"))
{
return;
}
ResetFryPanVariable(EDeviceType.炒锅2);
await SendWriteRequest("LB21", EDeviceType.炒锅2);
ShowNotify($"设置设备初始化成功。");
});

StopDeviceCommand2 = new(async () =>
{
//if (!GetDeviceIsIdle(EDeviceType.炒锅2))
//{
// return;
//}
if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?"))
{
return;
}
await SendWriteRequest("LB22", EDeviceType.炒锅2);
ShowNotify($"设置设备停止成功。");
});

//炒锅那边复位变量没有使用。
GoCleanLocCommand2 = new(async () =>
{
if (!GetDeviceIsIdle(EDeviceType.炒锅2))
{
return;
}
if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?"))
{
return;
}
await SendWriteRequest("LB23", EDeviceType.炒锅2);
ShowNotify($"设置设备去洗锅位成功。");
});

#endregion


CancelFryPanTaskCommand = new((string device) =>
{
ActionManage.GetInstance.Send("CancelFryPanTask", device);
@@ -301,13 +552,13 @@ namespace BPASmartClient.MorkCL.ViewModel

#region 私有方法

private async Task SendWriteRequest(string address)
private async Task SendWriteRequest(string address,EDeviceType device)
{
ActionManage.GetInstance.Send("WriteBool", new WriteModel<bool>(FryingPanSelect, address, false));
ActionManage.GetInstance.Send("WriteBool", new WriteModel<bool>(device, address, false));
await Task.Delay(400);
ActionManage.GetInstance.Send("WriteBool", new WriteModel<bool>(FryingPanSelect, address, true));
ActionManage.GetInstance.Send("WriteBool", new WriteModel<bool>(device, address, true));
await Task.Delay(400);
ActionManage.GetInstance.Send("WriteBool", new WriteModel<bool>(FryingPanSelect, address, false));
ActionManage.GetInstance.Send("WriteBool", new WriteModel<bool>(device, address, false));
}

private void ShowNotify(string info)
@@ -317,7 +568,7 @@ namespace BPASmartClient.MorkCL.ViewModel

private bool GetDeviceIsIdle(EDeviceType device)
{
if (ActionManage.GetInstance.SendResult("GetDeviceIsIdle", FryingPanSelect) is bool frypanisIdle)
if (ActionManage.GetInstance.SendResult("GetDeviceIsIdle", device) is bool frypanisIdle)
{
if (frypanisIdle)
{
@@ -349,7 +600,6 @@ namespace BPASmartClient.MorkCL.ViewModel
}
#endregion 私有方法

#region 属性

private EDeviceType fryingPanSelect = EDeviceType.炒锅1;

@@ -359,6 +609,10 @@ namespace BPASmartClient.MorkCL.ViewModel
get { return fryingPanSelect; }
set { fryingPanSelect = value; OnPropertyChanged(); }
}
public ObservableCollection<EDeviceType> DeviceTypes { get; set; } = new ObservableCollection<EDeviceType>() { EDeviceType.炒锅1, EDeviceType.炒锅2 };


#region 属性_1#炒锅

/// <summary>搅拌频率</summary>
public ushort AgitaFrequency
@@ -416,13 +670,97 @@ namespace BPASmartClient.MorkCL.ViewModel
get { return stirFryLocSelect; }
set { stirFryLocSelect = value; OnPropertyChanged(); }
}
#endregion 属性

public ObservableCollection<EDeviceType> DeviceTypes { get; set; } = new ObservableCollection<EDeviceType>() { EDeviceType.炒锅1, EDeviceType.炒锅2 };

#endregion 属性
#region 属性_2#炒锅

private ushort heatGear2;
private ushort agitaFrequency2;
/// <summary>搅拌频率</summary>
public ushort AgitaFrequency2
{
get => agitaFrequency2; set
{
if (value >= 50)
agitaFrequency2 = 50;
else if (value <= 1)
agitaFrequency2 = 1;
else
agitaFrequency2 = value;
OnPropertyChanged();
}
}

/// <summary>加热档位</summary>
public ushort HeatGear2
{
get => heatGear2; set
{
if (value >= 8)
heatGear2 = 8;
else if (value <= 1)
heatGear2 = 1;
else
heatGear2 = value;
OnPropertyChanged();
}
}

private float weight2;

/// <summary>下料重量</summary>
public float Weight2
{
get { return weight2; }
set { weight2 = value; }
}

private int channelSelect2;

/// <summary>下料通道选择。</summary>
public int ChannelSelect2
{
get { return channelSelect2; }
set { channelSelect2 = value; OnPropertyChanged(); }
}

private int stirFryLocSelect2;

/// <summary>炒制位选择。</summary>
public int StirFryLocSelect2
{
get { return stirFryLocSelect2; }
set { stirFryLocSelect2 = value; OnPropertyChanged(); }
}
#endregion

#region 命令

/// <summary>
/// 取消指定炒锅当前任务。
/// </summary>
public BPARelayCommand<string> CancelFryPanTaskCommand { get; set; }
/// <summary>
/// 清空1#炒锅所有任务。
/// </summary>
public BPARelayCommand ClearFryPanTaskCommand_1 { get; set; }
/// <summary>
/// 清空2#炒锅所有任务。
/// </summary>
public BPARelayCommand ClearFryPanTaskCommand_2 { get; set; }
/// <summary>
/// 复位机器人所有由上位机下发的变量。
/// </summary>
public BPARelayCommand InitRobotVarCommand { get; set; }

public BPARelayCommand RobotGoCleanLocCommand { get; set; }

public BPARelayCommand CleanFinishCommand { get; set; }
#endregion

#region 命令_1#炒锅

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

@@ -478,26 +816,66 @@ namespace BPASmartClient.MorkCL.ViewModel
/// 设备去洗锅位置。
/// </summary>
public BPARelayCommand GoCleanLocCommand { get; set; }

#endregion 命令

#region 命令_2#炒锅

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

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

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

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

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

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

/// <summary>通道下料启动。</summary>
public BPARelayCommand ChannelCuttingCommand2 { get; set; }

/// <summary>去炒制位。</summary>
public BPARelayCommand GoFryLocCommand2 { get; set; }

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

/// <summary>去调料投料位。</summary>
public BPARelayCommand GoSeasoningFeddLocCommand2 { get; set; }

/// <summary>出餐启动。</summary>
public BPARelayCommand OutDiningStartCommand2 { get; set; }

/// <summary>炒锅清洗。</summary>
public BPARelayCommand FryPanCleanCommand2 { get; set; }
/// <summary>
/// 取消指定炒锅当前任务。
/// 设为自动模式
/// </summary>
public BPARelayCommand<string> CancelFryPanTaskCommand { get; set; }
public BPARelayCommand SetAutoModeCommand2 { get; set; }
/// <summary>
/// 清空1#炒锅所有任务。
/// 设为手动模式
/// </summary>
public BPARelayCommand ClearFryPanTaskCommand_1 { get; set; }
public BPARelayCommand SetManualModeCommand2 { get; set; }
/// <summary>
/// 清空2#炒锅所有任务。
/// 初始化设备
/// </summary>
public BPARelayCommand ClearFryPanTaskCommand_2 { get; set; }
public BPARelayCommand InitalDeviceCommand2 { get; set; }
/// <summary>
/// 复位机器人所有由上位机下发的变量。
/// 设备停止
/// </summary>
public BPARelayCommand InitRobotVarCommand { get; set; }

public BPARelayCommand RobotGoCleanLocCommand { get; set; }

public BPARelayCommand CleanFinishCommand { get; set; }
public BPARelayCommand StopDeviceCommand2 { get; set; }
/// <summary>
/// 设备去洗锅位置。
/// </summary>
public BPARelayCommand GoCleanLocCommand2 { get; set; }

#endregion 命令
}

+ 98
- 38
BPASmartClient.MorkCL/ViewModel/EditRecipeViewModel.cs Целия файл

@@ -2,6 +2,9 @@
using BPASmartClient.CustomResource.UserControls.MessageShow;
using BPASmartClient.MorkCL.Model.Json;
using BPASmartClient.MorkCL.Model.Recipe;
using System.Windows.Controls;
using System.Windows.Media.Animation;
using System.Windows.Media;

namespace BPASmartClient.MorkCL.ViewModel
{
@@ -112,6 +115,7 @@ namespace BPASmartClient.MorkCL.ViewModel
MessageNotify.GetInstance.ShowDialog($"{item.eFunc}功能的加热档位不是整数,请修改验证后重试!", DialogType.Error);
return;
}
break;

case EFunc.加热停止:
@@ -131,6 +135,11 @@ namespace BPASmartClient.MorkCL.ViewModel
MessageNotify.GetInstance.ShowDialog($"{item.eFunc}功能的调料需求值不是纯数字,请修改验证后重试!", DialogType.Error);
return;
}

if (!ValidateStirFryAndTime(item.funcPars[2].ParValue?.ToString(), item.funcPars[3].ParValue?.ToString()))
{
return;
}
break;

case EFunc.添加主料:
@@ -147,57 +156,102 @@ namespace BPASmartClient.MorkCL.ViewModel
MessageNotify.GetInstance.ShowDialog($"{item.eFunc}功能的主料份量不是纯数字,请修改验证后重试!", DialogType.Error);
return;
}

if (!ValidateStirFryAndTime(item.funcPars[2].ParValue?.ToString(), item.funcPars[3].ParValue?.ToString()))
{
return;
}

break;

case EFunc.添加辅料:
if (!ValidateStirFryAndTime(item.funcPars[1].ParValue?.ToString(), item.funcPars[2].ParValue?.ToString()))
{
return;
}
break;

case EFunc.炒锅回原点位:
break;
//case EFunc.炒锅回原点位:
// break;

case EFunc.出餐启动:
break;

case EFunc.炒锅清洗:
break;
#region 废弃代码
//case EFunc.炒锅清洗:
// break;

//case EFunc.炒锅回调料投料位置:
// break;

//case EFunc.去指定炒制位:
// if (int.TryParse(item.funcPars[0].ParValue?.ToString(), out int fryingPanLoc))
// {
// if (fryingPanLoc > 4 || fryingPanLoc <= 0)
// {
// MessageNotify.GetInstance.ShowDialog($"{item.eFunc}功能的设定炒制位限值1--4,请修改验证后重试!", DialogType.Error);
// return;
// }
// }
// else
// {
// MessageNotify.GetInstance.ShowDialog($"{item.eFunc}功能的设定炒制不是整数,请修改验证后重试!", DialogType.Error);
// return;
// }
// break;

//case EFunc.炒制:
// if (int.TryParse(item.funcPars[0].ParValue.ToString(), out int stirFryTime))
// {
// if (stirFryTime <= 0)
// {
// MessageNotify.GetInstance.ShowDialog($"{item.eFunc}功能的炒制时间设置小于0,请修改验证后重试!", DialogType.Error);
// return;
// }
// }
// else
// {
// MessageNotify.GetInstance.ShowDialog($"{item.eFunc}功能的炒制时间不是纯数字,请修改验证后重试!", DialogType.Error);
// return;
// }
// break;
#endregion

case EFunc.炒锅回调料投料位置:
default:
break;

case EFunc.去指定炒制位:
if (int.TryParse(item.funcPars[0].ParValue?.ToString(), out int fryingPanLoc))
{
if (fryingPanLoc > 4 || fryingPanLoc <= 0)
{
MessageNotify.GetInstance.ShowDialog($"{item.eFunc}功能的设定炒制位限值1--4,请修改验证后重试!", DialogType.Error);
return;
}
}
else
}
//校验炒制位置和时间
bool ValidateStirFryAndTime(string loc,string time)
{
if (int.TryParse(loc, out int fryingPanLoc))
{
if (fryingPanLoc > 4 || fryingPanLoc <= 0)
{
MessageNotify.GetInstance.ShowDialog($"{item.eFunc}功能的设定炒制不是整数,请修改验证后重试!", DialogType.Error);
return;
MessageNotify.GetInstance.ShowDialog($"{item.eFunc}功能的设定炒制位限值1--4,请修改验证后重试!", DialogType.Error);
return false;
}
break;
}
else
{
MessageNotify.GetInstance.ShowDialog($"{item.eFunc}功能的设定炒制不是整数,请修改验证后重试!", DialogType.Error);
return false;
}

case EFunc.炒制:
if (int.TryParse(item.funcPars[0].ParValue.ToString(), out int stirFryTime))
{
if (stirFryTime <= 0)
{
MessageNotify.GetInstance.ShowDialog($"{item.eFunc}功能的炒制时间设置小于0,请修改验证后重试!", DialogType.Error);
return;
}
}
else
if (int.TryParse(time, out int stirFryTime))
{
if (stirFryTime <= 0)
{
MessageNotify.GetInstance.ShowDialog($"{item.eFunc}功能的炒制时间不是纯数字,请修改验证后重试!", DialogType.Error);
return;
MessageNotify.GetInstance.ShowDialog($"{item.eFunc}功能的炒制时间设置小于0,请修改验证后重试!", DialogType.Error);
return false;
}
break;
}
else
{
MessageNotify.GetInstance.ShowDialog($"{item.eFunc}功能的炒制时间不是纯数字,请修改验证后重试!", DialogType.Error);
return false;
}

default:
break;
return true;
}
}

@@ -300,8 +354,12 @@ namespace BPASmartClient.MorkCL.ViewModel
if (index > 0)
{
int newIndex = index - 1;
Functions.RemoveAt(index);
Functions.Insert(newIndex, funcmodel);
//Functions.RemoveAt(index);
//Functions.Insert(newIndex, funcmodel);

Functions.Move(index, newIndex);
}
}
});
@@ -314,8 +372,10 @@ namespace BPASmartClient.MorkCL.ViewModel
if (index < Functions.Count - 1)
{
int newIndex = index + 1;
Functions.RemoveAt(index);
Functions.Insert(newIndex, funcmodel);
//Functions.RemoveAt(index);
//Functions.Insert(newIndex, funcmodel);

Functions.Move(index, newIndex);
}
}
});


+ 11
- 8
BPASmartClient.MorkCL/ViewModel/RecipeManageViewModel.cs Целия файл

@@ -69,12 +69,12 @@ namespace BPASmartClient.MorkCL.ViewModel
case EFunc.搅拌停止:
case EFunc.加热启动:
case EFunc.加热停止:
case EFunc.炒锅回原点位:
//case EFunc.炒锅回原点位:
case EFunc.出餐启动:
case EFunc.炒锅清洗:
case EFunc.炒锅回调料投料位置:
case EFunc.去指定炒制位:
case EFunc.炒制:
//case EFunc.炒锅清洗:
//case EFunc.炒锅回调料投料位置:
//case EFunc.去指定炒制位:
//case EFunc.炒制:
break;

case EFunc.添加主料:
@@ -82,7 +82,8 @@ namespace BPASmartClient.MorkCL.ViewModel
var weight = Convert.ToSingle(item.funcPars[1].ParValue);
if (!Json<ItemStorageInfo>.Data.IngredientsStorage.Any(i => i.MaterialID == Id/* && i.Weight ==weight*/))
{
MessageNotify.GetInstance.ShowDialog($"未在主料库查找到配方所需的主料【{Id}】,下发失败。", DialogType.Error);
string name = item.funcPars[0].ParValue.ToString();
MessageNotify.GetInstance.ShowDialog($"未在主料库查找到配方所需的主料【{name}】,下发失败。", DialogType.Error);
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, Application.Current.MainWindow, "提示", $"下发订单{data.Name}失败!");
return;
}
@@ -91,7 +92,8 @@ namespace BPASmartClient.MorkCL.ViewModel
case EFunc.添加辅料:
if (SqliteHelper.GetInstance.GetAccessoriesInfo(item.funcPars[0].Id) == null)
{
MessageNotify.GetInstance.ShowDialog($"未在辅料信息查找到配方所需的辅料【{item.funcPars[0].Id}】,下发失败。", DialogType.Error);
string name = item.funcPars[0].ParValue.ToString();
MessageNotify.GetInstance.ShowDialog($"未在辅料信息查找到配方所需的辅料【{name}】,下发失败。", DialogType.Error);
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, Application.Current.MainWindow, "提示", $"下发订单{data.Name}失败!");
return;
}
@@ -100,7 +102,8 @@ namespace BPASmartClient.MorkCL.ViewModel
case EFunc.添加调料:
if (SqliteHelper.GetInstance.GetSeasoningInfo(item.funcPars[0].Id) == null)
{
MessageNotify.GetInstance.ShowDialog($"未在调料信息查找到配方所需的调料【{item.funcPars[0].Id}】,下发失败。", DialogType.Error);
string name = item.funcPars[0].ParValue.ToString();
MessageNotify.GetInstance.ShowDialog($"未在调料信息查找到配方所需的调料【{name}】,下发失败。", DialogType.Error);
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, Application.Current.MainWindow, "提示", $"下发订单{data.Name}失败!");
return;
}


Зареждане…
Отказ
Запис