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

海科调试修改。

JXJAgvReake
ZhaoGang преди 1 година
родител
ревизия
db149553ba
променени са 13 файла, в които са добавени 295 реда и са изтрити 84 реда
  1. +1
    -3
      BPASmartClient.MorkCL/BPASmartClient.MorkCL.csproj
  2. +117
    -41
      BPASmartClient.MorkCL/Control_MorkCL.cs
  3. +42
    -6
      BPASmartClient.MorkCL/GVL_MorkCL.cs
  4. +14
    -1
      BPASmartClient.MorkCL/Model/Control/FryingPanGet.cs
  5. +22
    -6
      BPASmartClient.MorkCL/Model/Control/FryingPanSet.cs
  6. +2
    -2
      BPASmartClient.MorkCL/Model/Control/RobotGet.cs
  7. +21
    -1
      BPASmartClient.MorkCL/Model/Control/RobotSet.cs
  8. +22
    -10
      BPASmartClient.MorkCL/Model/Json/ConnectPar.cs
  9. +5
    -1
      BPASmartClient.MorkCL/Server/FryingPanServer.cs
  10. +6
    -6
      BPASmartClient.MorkCL/Server/RobotServer.cs
  11. +21
    -3
      BPASmartClient.MorkCL/View/Debug.xaml
  12. +18
    -0
      BPASmartClient.MorkCL/ViewModel/DebugViewModel.cs
  13. +4
    -4
      BPASmartClient.MorkCL/ViewModel/ItemStorageViewModel.cs

+ 1
- 3
BPASmartClient.MorkCL/BPASmartClient.MorkCL.csproj Целия файл

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

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

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


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

@@ -8,6 +8,7 @@ using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.WebSockets;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
@@ -63,10 +64,10 @@ namespace BPASmartClient.MorkCL

#if !FORMAL
devices[EDeviceType.炒锅1].Init(Json<ConnectPar>.Data.FryingPanIP1);
devices[EDeviceType.炒锅2].Init(Json<ConnectPar>.Data.FryingPanIP2);
//devices[EDeviceType.炒锅2].Init(Json<ConnectPar>.Data.FryingPanIP2);
devices[EDeviceType.机器人].Init(Json<ConnectPar>.Data.RobotIP);
devices[EDeviceType.压力锅].Init(Json<ConnectPar>.Data.PressureCookerIP);
devices[EDeviceType.外部设备].Init(Json<ConnectPar>.Data.PPortName);
//devices[EDeviceType.压力锅].Init(Json<ConnectPar>.Data.PressureCookerIP);
//devices[EDeviceType.外部设备].Init(Json<ConnectPar>.Data.PPortName);

ManualActionRegiester();
#endif
@@ -98,7 +99,7 @@ namespace BPASmartClient.MorkCL
if (TaskList.ContainsKey(res)) TaskList.TryRemove(res, out _);
}

private void FryingPanControl(EDeviceType et, ControlData cd)
private async void FryingPanControl(EDeviceType et, ControlData cd)
{
DeviceProcessLogShow($"开始执行-{cd.Name} 任务");
if (TaskList.ContainsKey(et) && TaskList[et].Cts.IsCancellationRequested) return;
@@ -106,35 +107,38 @@ namespace BPASmartClient.MorkCL
{
if (cd.ControlFuncs.TryDequeue(out FuncModel fm))
{
//var device = (FryingPanServer)devices[et];
//var robot = (RobotServer)devices[EDeviceType.机器人];
var device = (FryingPanServer)devices[et];
var robot = (RobotServer)devices[EDeviceType.机器人];
int index = (ushort)et - 1;
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}。");
switch (fm.eFunc)
{
case EFunc.搅拌启动:
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-写入搅拌频率-{fm.funcPars.ElementAt(0).ParValue.ToString()}HZ。");
//device.MixingFrequencySet(fm.funcPars.ElementAt(0).ParValue.ToString());
device.MixingFrequencySet(fm.funcPars.ElementAt(0).ParValue.ToString());
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-写入搅拌频率-{fm.funcPars.ElementAt(0).ParValue.ToString()}HZ完成。");

DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-写入开始搅拌。");
//device.StirStartOrStop = true;
device.StirStartOrStop = true;
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-写入开始搅拌完成。");

break;
case EFunc.搅拌停止:
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-写入停止搅拌。");
//device.StirStartOrStop = false;
device.StirStartOrStop = false;
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-写入停止搅拌完成。");
break;
case EFunc.加热启动:
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置加热挡位-【{fm.funcPars.ElementAt(0).ParValue.ToString()}】。");
//device.HeatingGearSet(fm.funcPars.ElementAt(0).ParValue.ToString());
device.HeatingGearSet(fm.funcPars.ElementAt(0).ParValue.ToString());
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置加热挡位完成,设置加热启动。");
//device.HeatStartOrStop = true;

device.HeatStartOrStop = true;
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置加热启动完成。");
break;
case EFunc.加热停止:
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置加热停止。");
//device.HeatStartOrStop = false;
device.HeatStartOrStop = false;
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置加热停止完成。");
break;
case EFunc.添加调料:
@@ -142,8 +146,10 @@ namespace BPASmartClient.MorkCL
var Seasoning = SqliteHelper.GetInstance.GetSeasoning().FirstOrDefault(p => p.Id == fm.funcPars.ElementAt(0).Id);
if (Seasoning != null)
{
//device.CuttingControl(Seasoning.Loc.ToString(), fm.funcPars.ElementAt(1).ParValue.ToString());
//TODO:应该为下料完成就关闭。
device.CuttingControl(Seasoning.Loc.ToString(), fm.funcPars.ElementAt(1).ParValue.ToString());
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-执行下料,下料位置:{Seasoning.Loc.ToString()},下料重量:【{fm.funcPars.ElementAt(1).ParValue.ToString()}】。");
}
else
{
@@ -164,26 +170,33 @@ namespace BPASmartClient.MorkCL
//device.CuttingControl(Seasoning.Loc.ToString(), fm.funcPars.ElementAt(1).ParValue.ToString());
var ingredientes = Json<ItemStorageInfo>.Data.IngredientsStorage[ingre_index];
//TODO:机器人下发取料
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-执行下料,控制取{ingre_index}库物料,下料名称:{ingredientes.Name.ToString()},下料重量:【{fm.funcPars.ElementAt(1).ParValue.ToString()}】。");
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-执行下料,控制取{ingre_index+1}库物料,下料名称:{ingredientes.Name.ToString()},下料重量:【{fm.funcPars.ElementAt(1).ParValue.ToString()}】。");
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置机器人任务【{ingre_index.ToString()}】,子任务【{et}】。");
//robot.RobotTaskControl(ingre_index.ToString(), et);
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置机器人任务【{ingre_index.ToString()}】,子任务【{et}】完成。");
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置机器人任务【{ingre_index+1.ToString()}】,子任务【{et}】。");
robot.RobotTaskControl(ingre_index+1.ToString(), et);
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置机器人任务【{ingre_index+1.ToString()}】,子任务【{et}】完成。");

DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置炒锅回原点。");
device.FryingPanHome = true;
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置炒锅回原点完成。");

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

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

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

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

Json<ItemStorageInfo>.Data.IngredientsStorage[ingre_index] = new ItemStorage();
@@ -197,20 +210,22 @@ namespace BPASmartClient.MorkCL
}
break;
case EFunc.添加辅料:
MaterialBase mb = new MaterialBase();
if (fm.eFunc == EFunc.添加辅料)
mb = SqliteHelper.GetInstance.GetAccessories().FirstOrDefault(p => p.Id == fm.funcPars.ElementAt(0).Id);
else mb = SqliteHelper.GetInstance.GetIngredients().FirstOrDefault(p => p.Id == fm.funcPars.ElementAt(0).Id);
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置机器人任务【{mb.Loc.ToString()}】,子任务【{et}】。");
//robot.RobotTaskControl(mb.Loc.ToString(), et);
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置机器人任务【{mb.Loc.ToString()}】,子任务【{et}】完成。");
MaterialBase mb = SqliteHelper.GetInstance.GetAccessories().FirstOrDefault(p => p.Id == fm.funcPars.ElementAt(0).Id);
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置机器人任务【{(mb.Loc+12).ToString()}】,子任务【{et}】。");
robot.RobotTaskControl((mb.Loc+12).ToString(), et);
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置机器人任务【{(mb.Loc+12).ToString()}】,子任务【{et}】完成。");

DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置炒锅回原点。");
device.FryingPanHome = true;
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置炒锅回原点完成。");

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

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

DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置允许机器人开始投料。");
@@ -218,36 +233,69 @@ namespace BPASmartClient.MorkCL
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置允许机器人开始投料完成。");

DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-开始等待机器人投料完成。");
//robot.MaterialPouringComplete[index].Wait(Cts: TaskList[et].Cts); //等待机器人投料完成
robot.MaterialPouringComplete[index].Wait(Cts: TaskList[et].Cts); //等待机器人投料完成
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-机器人投料完成。");
break;
case EFunc.炒锅回原点位:


DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置炒锅回原点。");
//device.FryingPanHome = true;
device.FryingPanHome = true;
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置炒锅回原点完成。");

DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-等待回原点完成。");
device.FeedingLocFB.Wait(Cts: TaskList[et].Cts);
device.FryingPanHome = false;

break;
case EFunc.出餐启动:

device.DiningOutStart = false;
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置机器人取空盆。");
//robot.RobotTaskControl("1", et);//取空盆
//TODO:正常应该是哪个有空盆取哪个。
robot.RobotTaskControl("21", et);//取空盆
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置机器人取空盆完成,等待机器人到出菜位置。");
//robot.DiningOutRequest[index].Wait(Cts: TaskList[et].Cts);//等待机器人到出菜位置
robot.DiningOutRequest[index].Wait(Cts: TaskList[et].Cts);//等待机器人到出菜位置
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-机器人已到出餐位置,出餐启动。");
//device.DiningOutStart = true;
device.DiningOutStart = true;

device.OutDinningSlowDownFlag.Wait(Cts: TaskList[et].Cts) ;
robot.ModerateInPlace(et);
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-到达出餐减速位。");

device.OutDinningFinsh.Wait(Cts: TaskList[et].Cts);
robot.DiningOutComplete(et);

DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-出餐完成。");
//回到投料位置就复位。
Thread.Sleep(500);
device.FeedingLocFB.Wait(Cts: TaskList[et].Cts);
device.DiningOutStart = false;
break;
case EFunc.炒锅清洗:
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置超过清洗。");
//device.FryingPanClear = true;
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置炒锅清洗。");
device.FryingPanClear = true;
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-炒锅清洗已写入。");

Thread.Sleep(500);
device.CleanFinish.Wait(Cts: TaskList[et].Cts);
device.FryingPanClear = false;
break;
case EFunc.炒锅回投料位置:
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置炒锅到调料位置。");
//device.FryingPanFeedingLoc = true;
device.FryingPanFeedingLoc = true;
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置炒锅到调料位置完成。");

//回到投料位置就复位。

Thread.Sleep(500);
device.FeedingLocFB.Wait(Cts: TaskList[et].Cts);
device.DiningOutStart = false;
break;
case EFunc.去指定炒制位:
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置去指定炒制位。");
//device.SetStirFryingLoc(fm.funcPars.ElementAt(0).ParValue.ToString());
device.SetStirFryingLoc(fm.funcPars.ElementAt(0).ParValue.ToString());
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置去指定炒制位【{fm.funcPars.ElementAt(0).ParValue.ToString()}】完成。");
break;
case EFunc.炒制:
@@ -280,6 +328,31 @@ namespace BPASmartClient.MorkCL
//这两个是字段。直接赋值
morkCL.FeedingLocFB1 = fryingPan1.FeedingLocFB;
morkCL.FeedingLocFB2=fryingPan2.FeedingLocFB;
morkCL.CleanFinish1 = fryingPan1.CleanFinish;
morkCL.CleanFinish2 = fryingPan2.CleanFinish;
morkCL.OutDinningFinsh1 = fryingPan1.OutDinningFinsh;
morkCL.OutDinningFinsh2 = fryingPan2.OutDinningFinsh;
morkCL.OutDinningSlowDownFlag1 = fryingPan1.OutDinningSlowDownFlag;
morkCL.OutDinningSlowDownFlag2 = fryingPan2.OutDinningSlowDownFlag;

if (fryingPan1.FeedingLocFB)
{
robot.AllowPourVegetables(EDeviceType.炒锅1);
}
else
{
robot.DisablePourVegetables(EDeviceType.炒锅1);
}

if (fryingPan2.FeedingLocFB)
{
robot.AllowPourVegetables(EDeviceType.炒锅2);
}
else
{
robot.DisablePourVegetables(EDeviceType.炒锅2);
}


foreach (var property in propertyInfos)
{
@@ -358,10 +431,13 @@ namespace BPASmartClient.MorkCL
{
ActionManage.GetInstance.Register((object location) =>
{
if (String.IsNullOrEmpty(location.ToString()) &&location.ToString().Length>=0)
var loc = location.ToString();
if (!String.IsNullOrEmpty(loc) && loc.Length>=0)
{
var robot = (RobotServer)devices[EDeviceType.机器人];
robot.WarehousingControl(location.ToString());
robot.WarehousingControl(loc);
//会卡死。
//robot.WarehousingComplete[(Convert.ToInt32(loc)-1)].Wait();
}
},"ItemStorage",true);



+ 42
- 6
BPASmartClient.MorkCL/GVL_MorkCL.cs Целия файл

@@ -59,6 +59,23 @@ namespace BPASmartClient.MorkCL
[VariableMonitor("1号炒锅-通道出料完成反馈(1-3)", "LB110")]
public bool[] ChannelDisCom1 { get; set; } = new bool[3];

/// <summary>
/// 清洗完成
/// </summary>
[VariableMonitor("1号炒锅-清洗完成", "LB113")]
public bool CleanFinish1 { get; set; }

/// <summary>
/// 倒菜出餐完成。
/// </summary>
[VariableMonitor("1号炒锅-倒菜出餐完成", "LB114")]
public bool OutDinningFinsh1 { get; set; }
/// <summary>
/// 炒锅倒菜减速位
/// </summary>
[VariableMonitor("1号炒锅-倒菜减速位", "LB115")]
public bool OutDinningSlowDownFlag1 { get; set; }

/// <summary>
/// 当前锅底温度
/// </summary>
@@ -127,6 +144,24 @@ namespace BPASmartClient.MorkCL
[VariableMonitor("2号炒锅-通道出料完成反馈(1-3)", "LB110")]
public bool[] ChannelDisCom2 { get; set; } = new bool[3];


/// <summary>
/// 清洗完成
/// </summary>
[VariableMonitor("2号炒锅-清洗完成", "LB113")]
public bool CleanFinish2 { get; set; }

/// <summary>
/// 倒菜出餐完成。
/// </summary>
[VariableMonitor("2号炒锅-倒菜出餐完成", "LB114")]
public bool OutDinningFinsh2 { get; set; }

/// <summary>
/// 炒锅倒菜减速位
/// </summary>
[VariableMonitor("2号炒锅-倒菜减速位", "LB115")]
public bool OutDinningSlowDownFlag2 { get; set; }
/// <summary>
/// 当前锅底温度
/// </summary>
@@ -154,19 +189,19 @@ namespace BPASmartClient.MorkCL
/// <summary>
/// 倒料请求
/// </summary>
[VariableMonitor("机器人-倒料请求-[1:1号炒锅,2:2号炒锅,3:高压锅]", "LW22")]
public bool[] MaterialPouringRequest = new bool[3];
[VariableMonitor("机器人-倒料请求-[1,2:炒锅,3:高压锅]", "LW22")]
public bool[] MaterialPouringRequest { get; set; } = new bool[3];

/// <summary>
/// 倒料完成
/// </summary>
[VariableMonitor("机器人-倒料完成-[1:1号炒锅,2:2号炒锅,3:高压锅]", "LW22")]
public bool[] MaterialPouringComplete = new bool[3];
[VariableMonitor("机器人-倒料完成-[1,2:炒锅,3:高压锅]", "LW22")]
public bool[] MaterialPouringComplete { get; set; } = new bool[3];

/// <summary>
/// 出餐请求,机器人到位请求炒锅出餐
/// </summary>
[VariableMonitor("机器人-出餐请求-[1:1号炒锅,2:2号炒锅,3:高压锅]", "LW22")]
[VariableMonitor("机器人-出餐请求-[1,2:炒锅,3:高压锅]", "LW22")]
public bool[] DiningOutRequest { get; set; } = new bool[3];

/// <summary>
@@ -212,12 +247,13 @@ namespace BPASmartClient.MorkCL
/// </summary>
[VariableMonitor("电子秤当前重量", "0")]
public float CurrentWeight { get; set; }
//TODO:正式使用解除注释。
#if !FORMAL
/// <summary>
/// 空箱子检测
/// </summary>
//[VariableMonitor("出餐箱子在位检测", "0")]
//public bool[] BoxDetection { get; set; } = new bool[4];
#endif
#endregion
}
}

+ 14
- 1
BPASmartClient.MorkCL/Model/Control/FryingPanGet.cs Целия файл

@@ -29,7 +29,7 @@ namespace BPASmartClient.MorkCL.Model.Control
public bool[] StirFryingLocFB { get; set; } = new bool[4];

/// <summary>
/// 炒锅在出餐位置反馈
/// 炒锅在出餐位置反馈,投料位置和原点在同一个点。
/// </summary>
public bool DiningOutLocFB { get; set; }

@@ -47,7 +47,20 @@ namespace BPASmartClient.MorkCL.Model.Control
/// 通道出料完成反馈(1-3)
/// </summary>
public bool[] ChannelDisCom { get; set; } = new bool[3];
/// <summary>
/// 清洗完成
/// </summary>
public bool CleanFinish;

/// <summary>
/// 倒菜出餐完成。
/// </summary>
public bool OutDinningFinsh;

/// <summary>
/// 炒锅倒菜减速位
/// </summary>
public bool OutDinningSlowDownFlag;
/// <summary>
/// 当前锅底温度
/// </summary>


+ 22
- 6
BPASmartClient.MorkCL/Model/Control/FryingPanSet.cs Целия файл

@@ -19,6 +19,11 @@ namespace BPASmartClient.MorkCL.Model.Control
/// </summary>
public bool HeatStartOrStop { get { return default; } set { MyModbus.Write("LB3".ToModbusAdd(), value); } }

/// <summary>
/// 通道下料启动
/// </summary>
//public bool ChnnelDisStart { get { return default; } set { MyModbus.Write("LB3".ToModbusAdd(), value); } }

/// <summary>
/// 通道下料启动控制(1-3)
/// </summary>
@@ -26,13 +31,18 @@ namespace BPASmartClient.MorkCL.Model.Control
/// <param name="demandValue">通道需求值</param>
public void CuttingControl(string Num, string demandValue)
{

if (ushort.TryParse(Num, out ushort ChannelNum) && ushort.TryParse(demandValue, out ushort value))
if (ChannelNum >= 1 && ChannelNum <= 3)
{
byte[] VWOffset = new byte[3] { 6, 8, 10 };
byte[] LBOffset = new byte[3] { 6, 7, 0 };
MyModbus.Write($"VW10{VWOffset[ChannelNum - 1]}".ToModbusAdd(), value);
byte[] VWOffset = new byte[3] { 3, 4, 5 };
byte[] LBOffset = new byte[3] { 6, 7, 8 };
MyModbus.Write($"LW{VWOffset[ChannelNum - 1]}".ToModbusAdd(), value);
MyModbus.Write($"LB{LBOffset[ChannelNum - 1]}".ToModbusAdd(), true);
//扫描周期较短,不等下料完成读为0,就已经过了,添加一个延时。
Thread.Sleep(500);
ChannelDisCom[ChannelNum - 1].Wait();
MyModbus.Write($"LB{LBOffset[ChannelNum - 1]}".ToModbusAdd(), false);
}
}

@@ -45,8 +55,9 @@ namespace BPASmartClient.MorkCL.Model.Control
if (ushort.TryParse(value, out ushort Gear))
if (Gear >= 1 && Gear <= 8)
{
MyModbus.Write($"VW100".ToModbusAdd(), Gear);
MyModbus.Write($"LW0".ToModbusAdd(), Gear);
MyModbus.Write($"LB9".ToModbusAdd(), true);
MyModbus.Write($"LB9".ToModbusAdd(), false);
}
}

@@ -59,8 +70,9 @@ namespace BPASmartClient.MorkCL.Model.Control
if (ushort.TryParse(value, out ushort Frequency))
if (Frequency >= 0 && Frequency <= 50)
{
MyModbus.Write($"VW102".ToModbusAdd(), Frequency);
MyModbus.Write($"LW1".ToModbusAdd(), Frequency*100);
MyModbus.Write($"LB10".ToModbusAdd(), true);
MyModbus.Write($"LB10".ToModbusAdd(), false);
}
}

@@ -73,8 +85,9 @@ namespace BPASmartClient.MorkCL.Model.Control
if (ushort.TryParse(value, out ushort Frequency))
if (Frequency >= 0 && Frequency <= 50)
{
MyModbus.Write($"VW104".ToModbusAdd(), Frequency);
MyModbus.Write($"LW2".ToModbusAdd(), Frequency);
MyModbus.Write($"LB11".ToModbusAdd(), true);
MyModbus.Write($"LB11".ToModbusAdd(), false);
}
}

@@ -108,6 +121,9 @@ namespace BPASmartClient.MorkCL.Model.Control
if (loc >= 1 && loc <= 4)
{
MyModbus.Write($"LB{loc + 15}".ToModbusAdd(), true);
Thread.Sleep(500);
StirFryingLocFB[loc - 1].Wait();
MyModbus.Write($"LB{loc + 15}".ToModbusAdd(), false);
}
}



+ 2
- 2
BPASmartClient.MorkCL/Model/Control/RobotGet.cs Целия файл

@@ -14,12 +14,12 @@ namespace BPASmartClient.MorkCL.Model.Control
/// <summary>
/// 倒料请求
/// </summary>
public bool[] MaterialPouringRequest = new bool[3];
public bool[] MaterialPouringRequest { get; set; } = new bool[3];

/// <summary>
/// 倒料完成
/// </summary>
public bool[] MaterialPouringComplete = new bool[3];
public bool[] MaterialPouringComplete { get; set; } = new bool[3];

/// <summary>
/// 出餐请求,机器人到位请求炒锅出餐


+ 21
- 1
BPASmartClient.MorkCL/Model/Control/RobotSet.cs Целия файл

@@ -54,7 +54,27 @@ namespace BPASmartClient.MorkCL.Model.Control
break;
}
}

/// <summary>
/// 禁止机器人倒菜到炒锅。
/// </summary>
/// <param name="num">炒锅类型</param>
public void DisablePourVegetables(EDeviceType num)
{
switch (num)
{
case EDeviceType.炒锅1:
MyModbus.Write("GM500".ToModbusAdd(), false);
break;
case EDeviceType.炒锅2:
MyModbus.Write("GM501".ToModbusAdd(), false);
break;
case EDeviceType.压力锅:
MyModbus.Write("GM502".ToModbusAdd(), false);
break;
default:
break;
}
}
/// <summary>
/// 出餐减速到位
/// </summary>


+ 22
- 10
BPASmartClient.MorkCL/Model/Json/ConnectPar.cs Целия файл

@@ -8,26 +8,38 @@ namespace BPASmartClient.MorkCL.Model.Json
{
public class ConnectPar
{
//1号炒锅
public string FryingPanIP1 { get; } = "192.168.0.1";
/// <summary>
/// 1号炒锅
/// </summary>
public string FryingPanIP1 { get; } = "192.168.6.100";
public string FryingPanPort1 { get; } = "502";

//2号炒锅
public string FryingPanIP2 { get; } = "192.168.0.2";
/// <summary>
/// 2号炒锅
/// </summary>
public string FryingPanIP2 { get; } = "192.168.6.101";
public string FryingPanPort2 { get; } = "502";

//压力锅
public string PressureCookerIP { get; } = "192.168.0.3";
/// <summary>
/// 压力锅
/// </summary>
public string PressureCookerIP { get; } = "192.168.6.102";
public string PressureCookerPort { get; } = "502";

//机器人
public string RobotIP { get; } = "192.168.0.4";
/// <summary>
/// 机器人
/// </summary>
public string RobotIP { get; } = "192.168.6.103";
public string RobotPort { get; } = "502";

//电子秤端口号
/// <summary>
/// 电子秤端口号
/// </summary>
public string ESPortName { get; } = "COM1";

//外设端口号
/// <summary>
/// 外设端口号
/// </summary>
public string PPortName { get; } = "COM2";
}
}

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

@@ -19,7 +19,7 @@ namespace BPASmartClient.MorkCL.Server
{
TaskManage.GetInstance.StartLong(new Action(() =>
{
MyModbus.Read<bool[]>("LB100".ToModbusAdd(), 13).OnSuccess(s =>
MyModbus.Read<bool[]>("LB100".ToModbusAdd(), 16).OnSuccess(s =>
{
InitComplete = s[0];
StatusMode = s[1];
@@ -32,6 +32,10 @@ namespace BPASmartClient.MorkCL.Server
WashingPotLocFB = s[9];

for (byte i = 0; i < 3; i++) ChannelDisCom[i] = s[i + 10];

CleanFinish = s[13];
OutDinningFinsh = s[14];
OutDinningSlowDownFlag = s[15];
});




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

@@ -19,9 +19,9 @@ namespace BPASmartClient.MorkCL.Server
{
TaskManage.GetInstance.StartLong(new Action(() =>
{
MyModbus.Read<bool[]>("M600".ToModbusAdd(), 9).OnSuccess(s =>
{
for (byte i = 0; i < 3; i++)
MyModbus.Read<bool[]>("GM600".ToModbusAdd(), 9).OnSuccess(s =>
{
for (byte i = 0; i < 3; i++)
{
MaterialPouringRequest[i] = s[i * 3];
MaterialPouringComplete[i] = s[i * 3 + 1];
@@ -29,9 +29,9 @@ namespace BPASmartClient.MorkCL.Server
}
});

MyModbus.Read<bool[]>("M630".ToModbusAdd(), 12).OnSuccess(s =>
{
for (byte i = 0; i < s.Length; i++) WarehousingComplete[i] = s[i];
MyModbus.Read<bool[]>("GM630".ToModbusAdd(), 12).OnSuccess(s =>
{
for (byte i = 0; i < s.Length; i++) WarehousingComplete[i] = s[i];
});

MyModbus.Read<ushort>("GI5".ToModbusAdd(), 1).OnSuccess(s => { TaskFeedback = (RobotMainTask)s; });


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

@@ -5,16 +5,34 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.MorkCL.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.MorkCL.ViewModel"
d:DesignHeight="450"
d:DesignWidth="800" Name="调试界面"
mc:Ignorable="d">
<UserControl.DataContext>
<vm:DebugViewModel/>
</UserControl.DataContext>
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.MorkCL;component/CustomStyle/CustomStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid />
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
</Grid.RowDefinitions>

<!--#region 炒锅控制 -->
<StackPanel Orientation="Vertical" Margin="5">
<TextBlock Text="加热档位设定:"/>
<TextBox Text="{Binding HeatGear}"/>
<Button Content="写入"/>
</StackPanel>
<!--#endregion-->
</Grid>
</UserControl>

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

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

namespace BPASmartClient.MorkCL.ViewModel
{
public class DebugViewModel:NotifyBase
{
public DebugViewModel()
{
}

public int HeatGear { get; set; }
}
}

+ 4
- 4
BPASmartClient.MorkCL/ViewModel/ItemStorageViewModel.cs Целия файл

@@ -10,13 +10,13 @@ namespace BPASmartClient.MorkCL.ViewModel
public ItemStorageViewModel()
{
//加载读取数据。
//AddTestData();
AddTestData();

ActionManage.GetInstance.Register(() =>
{
IngredientsItorage = new ObservableCollection<ItemStorage>(Json<ItemStorageInfo>.Data.IngredientsStorage);
AccessoriesItorage = new ObservableCollection<ItemStorage>(Json<ItemStorageInfo>.Data.AccessoriesStorage);
},"RefreshItemStorage");
},"RefreshItemStorage",true);

ActionManage.GetInstance.Register((() =>
@@ -31,7 +31,7 @@ namespace BPASmartClient.MorkCL.ViewModel
if (o!=null)
{
#if !FORMAL
ScaleCurrentWeight = (float)o;
// ScaleCurrentWeight = (float)o;
#else
ScaleCurrentWeight = 1.23f;
#endif
@@ -55,7 +55,7 @@ namespace BPASmartClient.MorkCL.ViewModel
item.Name = ingredients.Name;
item.IsEmploy = true;
item.Weight = ScaleCurrentWeight;
ActionManage.GetInstance.Send("ItemStorage", IngredientsItorage.IndexOf(item));
ActionManage.GetInstance.Send("ItemStorage", IngredientsItorage.IndexOf(item)+1);
Json<ItemStorageInfo>.Data.IngredientsStorage = IngredientsItorage.ToArray();
Json<ItemStorageInfo>.Save();


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