Просмотр исходного кода

1. 添加修改变量。2. 修改配方功能。

JXJAgvReake
ZhaoGang 1 год назад
Родитель
Сommit
85b638fd9e
15 измененных файлов: 77 добавлений и 81 удалений
  1. +3
    -1
      BPASmartClient.MorkCL/BPASmartClient.MorkCL.csproj
  2. +6
    -5
      BPASmartClient.MorkCL/Control_MorkCL.cs
  3. +23
    -11
      BPASmartClient.MorkCL/GVL_MorkCL.cs
  4. +0
    -28
      BPASmartClient.MorkCL/HelpClass/FuncSet.cs
  5. +8
    -3
      BPASmartClient.MorkCL/Model/Control/FryingPanGet.cs
  6. +12
    -12
      BPASmartClient.MorkCL/Model/Control/FryingPanSet.cs
  7. +3
    -1
      BPASmartClient.MorkCL/Model/Control/RobotGet.cs
  8. +1
    -1
      BPASmartClient.MorkCL/Model/Func/EFunc.cs
  9. +2
    -2
      BPASmartClient.MorkCL/Model/Func/InitData.cs
  10. +10
    -10
      BPASmartClient.MorkCL/Model/Json/ConnectPar.cs
  11. +2
    -2
      BPASmartClient.MorkCL/Server/FryingPanServer.cs
  12. +1
    -1
      BPASmartClient.MorkCL/Server/RobotServer.cs
  13. +3
    -1
      BPASmartClient.MorkCL/View/EditRecipeView.xaml
  14. +2
    -2
      BPASmartClient.MorkCL/View/RecipeManageView.xaml
  15. +1
    -1
      BPASmartClient.MorkCL/ViewModel/EditRecipeViewModel.cs

+ 3
- 1
BPASmartClient.MorkCL/BPASmartClient.MorkCL.csproj Просмотреть файл

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

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

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


+ 6
- 5
BPASmartClient.MorkCL/Control_MorkCL.cs Просмотреть файл

@@ -34,6 +34,7 @@ namespace BPASmartClient.MorkCL
public override void DoMain()
{
MonitorViewModel.DeviceId = DeviceId;

#region 读取本地文件数据
Json<RecipesInfo>.Read();
Json<ItemStorageInfo>.Read();
@@ -282,10 +283,10 @@ namespace BPASmartClient.MorkCL
device.CleanFinish.Wait(Cts: TaskList[et].Cts);
device.FryingPanClear = false;
break;
case EFunc.炒锅回投料位置:
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置炒锅到调料位置。");
case EFunc.炒锅回调料投料位置:
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置炒锅到调料投料位置。");
device.FryingPanFeedingLoc = true;
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置炒锅到调料位置完成。");
DeviceProcessLogShow($"{cd.Name}-任务执行-{fm.eFunc.ToString()}-设置炒锅到调料投料位置完成。");

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

@@ -334,7 +335,7 @@ namespace BPASmartClient.MorkCL
morkCL.OutDinningFinsh2 = fryingPan2.OutDinningFinsh;
morkCL.OutDinningSlowDownFlag1 = fryingPan1.OutDinningSlowDownFlag;
morkCL.OutDinningSlowDownFlag2 = fryingPan2.OutDinningSlowDownFlag;
#if !FORMAL
if (fryingPan1.FeedingLocFB)
{
robot.AllowPourVegetables(EDeviceType.炒锅1);
@@ -409,7 +410,7 @@ namespace BPASmartClient.MorkCL
}
}

#endif
}

public override void ResetProgram()


+ 23
- 11
BPASmartClient.MorkCL/GVL_MorkCL.cs Просмотреть файл

@@ -29,11 +29,17 @@ namespace BPASmartClient.MorkCL
[VariableMonitor("1号炒锅-急停", "LB102")]
public bool EStop1 { get; set; }

/// <summary>
/// 炒锅在调料投料位置反馈。
/// </summary>
[VariableMonitor("1号炒锅-在辅料投料位置反馈", "LB103")]
public bool FeedingSeasoningLocFB1 { get; set; }

/// <summary>
/// 炒制位置反馈(1-4)
/// </summary>
[VariableMonitor("1号炒锅-炒制位置反馈(1-4)", "LB103")]
public bool[] StirFryingLocFB1 { get; set; } = new bool[4];
[VariableMonitor("1号炒锅-炒制位置反馈(1-3)", "LB104")]
public bool[] StirFryingLocFB1 { get; set; } = new bool[3];

/// <summary>
/// 炒锅在出餐位置反馈
@@ -114,11 +120,17 @@ namespace BPASmartClient.MorkCL
[VariableMonitor("2号炒锅-急停", "LB102")]
public bool EStop2 { get; set; }

/// <summary>
/// 炒锅在调料投料位置反馈。
/// </summary>
[VariableMonitor("2号炒锅-在辅料投料位置反馈", "LB103")]
public bool FeedingSeasoningLocFB2 { get; set; }

/// <summary>
/// 炒制位置反馈(1-4)
/// </summary>
[VariableMonitor("2号炒锅-炒制位置反馈(1-4)", "LB103")]
public bool[] StirFryingLocFB2 { get; set; } = new bool[4];
[VariableMonitor("2号炒锅-炒制位置反馈(1-3)", "LB104")]
public bool[] StirFryingLocFB2 { get; set; } = new bool[3];

/// <summary>
/// 炒锅在出餐位置反馈
@@ -189,31 +201,31 @@ namespace BPASmartClient.MorkCL
/// <summary>
/// 倒料请求
/// </summary>
[VariableMonitor("机器人-倒料请求-[1,2:炒锅,3:高压锅]", "LW22")]
[VariableMonitor("机器人-倒料请求-[1,2:炒锅,3:高压锅]", "GM600")]
public bool[] MaterialPouringRequest { get; set; } = new bool[3];

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

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

/// <summary>
/// 入库完成
/// </summary>
[VariableMonitor("机器人-入库完成", "LW22")]
[VariableMonitor("机器人-入库完成", "GM630")]
public bool[] WarehousingComplete { get; set; } = new bool[12];

/// <summary>
/// 机器人原点状态
/// </summary>
[VariableMonitor("机器人-机器人原点状态", "LW22")]
[VariableMonitor("机器人-机器人原点状态", "GM620")]
public bool Home { get; set; }

/// <summary>
@@ -231,13 +243,13 @@ namespace BPASmartClient.MorkCL
/// <summary>
/// 机器人程序运行中
/// </summary>
[VariableMonitor("机器人-机器人程序运行中", "LW22")]
[VariableMonitor("机器人-机器人程序运行中")]
public bool ProgramRuning { get; set; }

/// <summary>
/// 机器人任务反馈
/// </summary>
[VariableMonitor("机器人-机器人任务反馈", "LW22")]
[VariableMonitor("机器人-机器人任务反馈", "GI5")]
public RobotMainTask TaskFeedback { get; set; }
#endregion



+ 0
- 28
BPASmartClient.MorkCL/HelpClass/FuncSet.cs Просмотреть файл

@@ -1,28 +0,0 @@
using BPASmartClient.MorkCL.Model.Func;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MorkCL.HelpClass
{
/// <summary>
/// 该类是对FuncPar的包装类。
/// </summary>
//public class FuncSet
//{
//public int Step { get; set; }

//private string _FuncName;
//public string FuncName
//{
// get { return _FuncName; }
// set { _FuncName = value;
// FuncPars = InitData.FunParInit[(EFunc)Enum.Parse(typeof(EFunc),value)]?.ToList();
// }
//}

//public List<FuncPar> FuncPars { get; set; }
//}
}

+ 8
- 3
BPASmartClient.MorkCL/Model/Control/FryingPanGet.cs Просмотреть файл

@@ -24,12 +24,17 @@ namespace BPASmartClient.MorkCL.Model.Control
public bool EStop { get; set; }

/// <summary>
/// 炒制位置反馈(1-4)
/// 炒锅在调料投料位置反馈。
/// </summary>
public bool[] StirFryingLocFB { get; set; } = new bool[4];
public bool FeedingSeasoningLocFB;

/// <summary>
/// 炒锅在出餐位置反馈,投料位置和原点在同一个点。
/// 炒制位置反馈(1-3)
/// </summary>
public bool[] StirFryingLocFB { get; set; } = new bool[3];

/// <summary>
/// 炒锅在出餐位置反馈。
/// </summary>
public bool DiningOutLocFB { get; set; }



+ 12
- 12
BPASmartClient.MorkCL/Model/Control/FryingPanSet.cs Просмотреть файл

@@ -19,11 +19,6 @@ 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>
@@ -40,7 +35,7 @@ namespace BPASmartClient.MorkCL.Model.Control
MyModbus.Write($"LW{VWOffset[ChannelNum - 1]}".ToModbusAdd(), value);
MyModbus.Write($"LB{LBOffset[ChannelNum - 1]}".ToModbusAdd(), true);
//扫描周期较短,不等下料完成读为0,就已经过了,添加一个延时。
Thread.Sleep(500);
Task.Delay(500).Wait();
ChannelDisCom[ChannelNum - 1].Wait();
MyModbus.Write($"LB{LBOffset[ChannelNum - 1]}".ToModbusAdd(), false);
}
@@ -107,23 +102,28 @@ namespace BPASmartClient.MorkCL.Model.Control
public bool FryingPanClear { get { return default; } set { MyModbus.Write("LB14".ToModbusAdd(), value); } }

/// <summary>
/// 炒锅到投料位置
/// 炒锅到主料调料投料位置
/// </summary>
public bool FryingPanFeedingLoc { get { return default; } set { MyModbus.Write("LB15".ToModbusAdd(), value); } }

/// <summary>
/// 炒锅到主料调料投料位置
/// </summary>
public bool FryingPanToSeasoningLoc { get { return default; } set { MyModbus.Write("LB16".ToModbusAdd(), value); } }

/// <summary>
/// 去炒制位控制
/// </summary>
/// <param name="value">炒锅位置,1-4</param>
/// <param name="value">炒锅位置,1-3</param>
public void SetStirFryingLoc(string value)
{
if (ushort.TryParse(value, out ushort loc))
if (loc >= 1 && loc <= 4)
if (loc >= 1 && loc <= 3)
{
MyModbus.Write($"LB{loc + 15}".ToModbusAdd(), true);
Thread.Sleep(500);
MyModbus.Write($"LB{loc + 16}".ToModbusAdd(), true);
Task.Delay(500).Wait();
StirFryingLocFB[loc - 1].Wait();
MyModbus.Write($"LB{loc + 15}".ToModbusAdd(), false);
MyModbus.Write($"LB{loc + 16}".ToModbusAdd(), false);
}
}



+ 3
- 1
BPASmartClient.MorkCL/Model/Control/RobotGet.cs Просмотреть файл

@@ -49,7 +49,9 @@ namespace BPASmartClient.MorkCL.Model.Control
/// <summary>
/// 机器人程序运行中
/// </summary>
public bool ProgramRuning { get; set; }
public bool ProgramRuning { get {
return TaskFeedback == RobotMainTask.无任务 && Home;
} }

/// <summary>
/// 机器人任务反馈


+ 1
- 1
BPASmartClient.MorkCL/Model/Func/EFunc.cs Просмотреть файл

@@ -21,7 +21,7 @@ namespace BPASmartClient.MorkCL.Model.Func
炒锅回原点位,
出餐启动,
炒锅清洗,
炒锅回投料位置,
炒锅回调料投料位置,
去指定炒制位,
炒制
}


+ 2
- 2
BPASmartClient.MorkCL/Model/Func/InitData.cs Просмотреть файл

@@ -30,8 +30,8 @@ namespace BPASmartClient.MorkCL.Model.Func
{ EFunc.炒锅回原点位,new FuncPar[0] },
{ EFunc.出餐启动,new FuncPar[0] },
{ EFunc.炒锅清洗,new FuncPar[0] },
{ EFunc.炒锅回投料位置,new FuncPar[0] },
{ EFunc.去指定炒制位,new FuncPar[] { new FuncPar() { ParName="设置炒制位", ParDescribe="请输入 1--4 选择一个合适的炒制位置"} } },
{ EFunc.炒锅回调料投料位置,new FuncPar[0] },
{ EFunc.去指定炒制位,new FuncPar[] { new FuncPar() { ParName="设置炒制位", ParDescribe="请输入 1--3 选择一个合适的炒制位置"} } },
{ EFunc.炒制,new FuncPar[] { new FuncPar() { ParName="设置炒制时间",ParUnit="秒", ParDescribe="请设置一个合适的炒制时间"} } },
};
}


+ 10
- 10
BPASmartClient.MorkCL/Model/Json/ConnectPar.cs Просмотреть файл

@@ -11,35 +11,35 @@ namespace BPASmartClient.MorkCL.Model.Json
/// <summary>
/// 1号炒锅
/// </summary>
public string FryingPanIP1 { get; } = "192.168.6.100";
public string FryingPanPort1 { get; } = "502";
public string FryingPanIP1 { get; set; } = "192.168.6.100";
public string FryingPanPort1 { get; set; } = "502";

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

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

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

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

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

+ 2
- 2
BPASmartClient.MorkCL/Server/FryingPanServer.cs Просмотреть файл

@@ -24,8 +24,8 @@ namespace BPASmartClient.MorkCL.Server
InitComplete = s[0];
StatusMode = s[1];
EStop = s[2];
for (byte i = 0; i < 4; i++) StirFryingLocFB[i] = s[i + 3];
FeedingSeasoningLocFB = s[3];
for (byte i = 0; i < 3; i++) StirFryingLocFB[i] = s[i + 4];

DiningOutLocFB = s[7];
FeedingLocFB = s[8];


+ 1
- 1
BPASmartClient.MorkCL/Server/RobotServer.cs Просмотреть файл

@@ -28,7 +28,7 @@ namespace BPASmartClient.MorkCL.Server
DiningOutRequest[i] = s[i * 3 + 2];
}
});
MyModbus.Read<bool>("GM620".ToModbusAdd()).OnSuccess((b)=> { Home = b; });
MyModbus.Read<bool[]>("GM630".ToModbusAdd(), 12).OnSuccess(s =>
{
for (byte i = 0; i < s.Length; i++) WarehousingComplete[i] = s[i];


+ 3
- 1
BPASmartClient.MorkCL/View/EditRecipeView.xaml Просмотреть файл

@@ -59,9 +59,10 @@
DockPanel.Dock="Left"
Text="配方名称:" />
<TextBox
Width="100"
Width="150"
DockPanel.Dock="Left"
FontSize="18"
Height="35"
Foreground="DeepSkyBlue"
Text="{Binding Name}" />
<TextBlock
@@ -71,6 +72,7 @@
<ComboBox
Width="150"
FontSize="18"
Height="35"
IsReadOnly="True"
ItemsSource="{Binding AllDishType}"
Text="{Binding DishType}" />


+ 2
- 2
BPASmartClient.MorkCL/View/RecipeManageView.xaml Просмотреть файл

@@ -110,7 +110,7 @@
</Grid.RowDefinitions>

<!--#region 标题栏设置-->
<Grid Margin="0,10,0,0" Background="#ff0C255F">
<Grid Margin="0,10,17,0" Background="#ff0C255F">

<Grid.ColumnDefinitions>
<ColumnDefinition Width="200" />
@@ -172,7 +172,7 @@

<!--#region 表格数据显示设置-->
<Grid Grid.Row="1">
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Visible">
<ItemsControl ItemsSource="{Binding Recipes}">
<ItemsControl.ItemTemplate>
<DataTemplate>


+ 1
- 1
BPASmartClient.MorkCL/ViewModel/EditRecipeViewModel.cs Просмотреть файл

@@ -161,7 +161,7 @@ namespace BPASmartClient.MorkCL.ViewModel
case EFunc.炒锅清洗:
break;

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

case EFunc.去指定炒制位:


Загрузка…
Отмена
Сохранить