Ver código fonte

模拟工艺添加

JXJAgvReake
pry 1 ano atrás
pai
commit
449897d2ac
4 arquivos alterados com 136 adições e 130 exclusões
  1. +5
    -75
      BPASmartClient.Tourism/Control_MorkCL.cs
  2. +6
    -0
      BPASmartClient.Tourism/Model/ControlData.cs
  3. +14
    -0
      BPASmartClient.Tourism/Model/Recipe/EDishType.cs
  4. +111
    -55
      BPASmartClient.Tourism/ViewModel/testViewModel.cs

+ 5
- 75
BPASmartClient.Tourism/Control_MorkCL.cs Ver arquivo

@@ -44,11 +44,11 @@ namespace BPASmartClient.MorkCL
devices.TryAdd(EDeviceType.压力锅, new PressureCookerServer());
devices.TryAdd(EDeviceType.外部设备, new OtherServer());

devices[EDeviceType.炒锅1].Init(ConnectPar.FryingPanIP1);
devices[EDeviceType.炒锅2].Init(ConnectPar.FryingPanIP2);
devices[EDeviceType.机器人].Init(ConnectPar.RobotIP);
devices[EDeviceType.压力锅].Init(ConnectPar.PressureCookerIP);
devices[EDeviceType.外部设备].Init(ConnectPar.PPortName);
//devices[EDeviceType.炒锅1].Init(ConnectPar.FryingPanIP1);
//devices[EDeviceType.炒锅2].Init(ConnectPar.FryingPanIP2);
//devices[EDeviceType.机器人].Init(ConnectPar.RobotIP);
//devices[EDeviceType.压力锅].Init(ConnectPar.PressureCookerIP);
//devices[EDeviceType.外部设备].Init(ConnectPar.PPortName);

#region 读取本地文件数据
Json<RecipesInfo>.Read();
@@ -147,76 +147,6 @@ namespace BPASmartClient.MorkCL
}
}


//for (int i = 0; i < cd.ControlFuncs.Count; i++)
//{
// if (TaskList.ContainsKey(et) && TaskList[et].Cts.IsCancellationRequested) return;
// var device = (FryingPanServer)devices[et];
// var robot = (RobotServer)devices[EDeviceType.机器人];
// var keyValues = cd.ControlFuncs.ElementAt(i);
// int index = (ushort)et - 1;
// DeviceProcessLogShow($"{cd.Name}-任务执行-{keyValues.Key.ToString()}-步骤");
// switch (keyValues.Key)
// {
// case EFunc.搅拌启动:
// device.MixingFrequencySet(keyValues.Value[0].ParValue);
// device.StirStartOrStop = true;
// break;
// case EFunc.搅拌停止:
// device.StirStartOrStop = false;
// break;
// case EFunc.加热启动:
// device.HeatingGearSet(keyValues.Value[0].ParValue);
// device.HeatStartOrStop = true;
// break;
// case EFunc.加热停止:
// device.HeatStartOrStop = false;
// break;
// case EFunc.添加调料:
// var Seasoning = SqliteHelper.GetInstance.GetSeasoning().FirstOrDefault(p => p.Id == keyValues.Value[0].Id);
// if (Seasoning != null)
// {
// device.CuttingControl(Seasoning.Loc.ToString(), keyValues.Value[1].ParValue);
// }
// break;
// case EFunc.添加主料:
// case EFunc.添加辅料:
// MaterialBase mb = new MaterialBase();
// if (keyValues.Key == EFunc.添加辅料)
// mb = SqliteHelper.GetInstance.GetAccessories().FirstOrDefault(p => p.Id == keyValues.Value[0].Id);
// else mb = SqliteHelper.GetInstance.GetIngredients().FirstOrDefault(p => p.Id == keyValues.Value[0].Id);
// robot.RobotTaskControl(mb.Loc.ToString(), et);
// device.FeedingLocFB.Wait(Cts: TaskList[et].Cts);//等待炒锅到投料位置
// robot.MaterialPouringRequest[index].Wait(Cts: TaskList[et].Cts); //等待机器人到投料位置
// robot.AllowPourVegetables(et);//允许机器人开始投料
// robot.MaterialPouringComplete[index].Wait(Cts: TaskList[et].Cts); //等待机器人投料完成
// break;
// case EFunc.炒锅回原点位:
// device.FryingPanHome = true;
// break;
// case EFunc.出餐启动:
// robot.RobotTaskControl("1", et);//取空盆
// robot.DiningOutRequest[index].Wait(Cts: TaskList[et].Cts);//等待机器人到出菜位置
// device.DiningOutStart = true;
// break;
// case EFunc.炒锅清洗:
// device.FryingPanClear = true;
// break;
// case EFunc.炒锅回投料位置:
// device.FryingPanFeedingLoc = true;
// break;
// case EFunc.去指定炒制位:
// device.SetStirFryingLoc(keyValues.Value[0].ParValue);
// break;
// case EFunc.炒制:
// if (int.TryParse(keyValues.Value[0].ParValue, out int time))
// Task.Delay(time * 1000).Wait(TaskList[et].Cts.Token);
// break;
// default:
// break;
// }

//}
}

public override void ReadData()


+ 6
- 0
BPASmartClient.Tourism/Model/ControlData.cs Ver arquivo

@@ -6,6 +6,7 @@ using System.Text;
using System.Threading.Tasks;
using BPASmartClient.MorkCL.Model.DataInfo;
using BPASmartClient.MorkCL.Model.Func;
using BPASmartClient.MorkCL.Model.Recipe;

namespace BPASmartClient.MorkCL.Model
{
@@ -16,6 +17,11 @@ namespace BPASmartClient.MorkCL.Model
/// </summary>
public EDeviceType DeviceType { get; set; }

/// <summary>
/// 菜品类型
/// </summary>
public EDishType DishType { get; set; }

/// <summary>
/// 功能配方
/// </summary>


+ 14
- 0
BPASmartClient.Tourism/Model/Recipe/EDishType.cs Ver arquivo

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MorkCL.Model.Recipe
{
public enum EDishType
{
炒菜,
炖菜
}
}

+ 111
- 55
BPASmartClient.Tourism/ViewModel/testViewModel.cs Ver arquivo

@@ -1,5 +1,6 @@
using BPASmartClient.MorkCL.Model.DB;
using BPASmartClient.MorkCL.Server;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -14,72 +15,127 @@ namespace BPASmartClient.MorkCL.ViewModel
{
testCommand = new BPARelayCommand(() =>
{
SqliteHelper.GetInstance.Init();
ControlData cd = new ControlData();
cd.Name = "莲白回锅";
cd.DeviceType = EDeviceType.炒锅1;

for (int i = 0; i < 10; i++)
cd.ControlFuncs.Enqueue(new FuncModel()
{
SqliteHelper.GetInstance.AddAccessories(new Model.DB.AccessoriesTB()
{
Description = "AccessoriesTB",
Loc = 1,
Name = $"AccessoriesTB{i}"
});

SqliteHelper.GetInstance.AddIngredients(new Model.DB.IngredientsTB()
{
Description = "IngredientsTB",
Loc = 1,
Name = $"IngredientsTB{i}"
});

SqliteHelper.GetInstance.AddSeasoning(new Model.DB.SeasoningTB()
{
Description = "SeasoningTB",
Loc = 1,
Name = $"SeasoningTB{i}"
});
}

var Accessories = SqliteHelper.GetInstance.GetAccessories();
var Ingredients = SqliteHelper.GetInstance.GetIngredients();
var Seasoning = SqliteHelper.GetInstance.GetSeasoning();

Accessories?.ForEach(x =>
eFunc = EFunc.加热启动,
funcPars = new FuncPar[1] { new FuncPar() { ParValue = 1 } }.ToList()
});

cd.ControlFuncs.Enqueue(new FuncModel()
{
eFunc = EFunc.炒制,
funcPars = new FuncPar[1] { new FuncPar() { ParValue = 10 } }.ToList()
});

cd.ControlFuncs.Enqueue(new FuncModel()
{
eFunc = EFunc.搅拌启动,
funcPars = new FuncPar[1] { new FuncPar() { ParValue = 30 } }.ToList()
});

cd.ControlFuncs.Enqueue(new FuncModel()
{
eFunc = EFunc.添加调料,
funcPars = new FuncPar[1] { new FuncPar() { ParValue = 30, Id = "" } }.ToList()
});

cd.ControlFuncs.Enqueue(new FuncModel()
{
SqliteHelper.GetInstance.EditAccessories(new Model.DB.AccessoriesTB()
{
Description = "AccessoriesTB1111",
Loc = x.Loc,
Name = x.Name,
Id = x.Id
});
eFunc = EFunc.添加调料,
funcPars = new FuncPar[1] { new FuncPar() { ParValue = 30, Id = "" } }.ToList()
});

Ingredients?.ForEach(x =>
cd.ControlFuncs.Enqueue(new FuncModel()
{
SqliteHelper.GetInstance.EditIngredients(new Model.DB.IngredientsTB()
{
Description = "IngredientsTB1111",
Loc = x.Loc,
Name = x.Name,
Id = x.Id
});
eFunc = EFunc.添加调料,
funcPars = new FuncPar[1] { new FuncPar() { ParValue = 30, Id = "" } }.ToList()
});

Seasoning?.ForEach(x =>
cd.ControlFuncs.Enqueue(new FuncModel()
{
SqliteHelper.GetInstance.EditSeasoning(new Model.DB.SeasoningTB()
{
Description = "SeasoningTB1111",
Loc = x.Loc,
Name = x.Name,
Id = x.Id
});
eFunc = EFunc.添加辅料,
funcPars = new FuncPar[1] { new FuncPar() { ParValue = 30, Id = "" } }.ToList()
});

var Accessories1 = SqliteHelper.GetInstance.GetAccessories();
var Ingredients1 = SqliteHelper.GetInstance.GetIngredients();
var Seasoning1 = SqliteHelper.GetInstance.GetSeasoning();
ActionManage.GetInstance.Send(NotifyTopic.FormulaDistribution, cd);
//ActionManage.GetInstance.Register(new Action<object>(o =>
//{
// if (o != null && o is ControlData cd) morkCL.cds.Enqueue(cd);
//}), NotifyTopic.FormulaDistribution);




//SqliteHelper.GetInstance.Init();

//for (int i = 0; i < 10; i++)
//{
// SqliteHelper.GetInstance.AddAccessories(new Model.DB.AccessoriesTB()
// {
// Description = "AccessoriesTB",
// Loc = 1,
// Name = $"AccessoriesTB{i}"
// });

// SqliteHelper.GetInstance.AddIngredients(new Model.DB.IngredientsTB()
// {
// Description = "IngredientsTB",
// Loc = 1,
// Name = $"IngredientsTB{i}"
// });

// SqliteHelper.GetInstance.AddSeasoning(new Model.DB.SeasoningTB()
// {
// Description = "SeasoningTB",
// Loc = 1,
// Name = $"SeasoningTB{i}"
// });
//}

//var Accessories = SqliteHelper.GetInstance.GetAccessories();
//var Ingredients = SqliteHelper.GetInstance.GetIngredients();
//var Seasoning = SqliteHelper.GetInstance.GetSeasoning();

//Accessories?.ForEach(x =>
//{
// SqliteHelper.GetInstance.EditAccessories(new Model.DB.AccessoriesTB()
// {
// Description = "AccessoriesTB1111",
// Loc = x.Loc,
// Name = x.Name,
// Id = x.Id
// });
//});

//Ingredients?.ForEach(x =>
//{
// SqliteHelper.GetInstance.EditIngredients(new Model.DB.IngredientsTB()
// {
// Description = "IngredientsTB1111",
// Loc = x.Loc,
// Name = x.Name,
// Id = x.Id
// });
//});

//Seasoning?.ForEach(x =>
//{
// SqliteHelper.GetInstance.EditSeasoning(new Model.DB.SeasoningTB()
// {
// Description = "SeasoningTB1111",
// Loc = x.Loc,
// Name = x.Name,
// Id = x.Id
// });
//});

//var Accessories1 = SqliteHelper.GetInstance.GetAccessories();
//var Ingredients1 = SqliteHelper.GetInstance.GetIngredients();
//var Seasoning1 = SqliteHelper.GetInstance.GetSeasoning();


});


Carregando…
Cancelar
Salvar