Browse Source

炒菜系统添加机器人维护位置功能

煮面机(新)
ZhaoGang 1 year ago
parent
commit
3662bb90f6
6 changed files with 91 additions and 34 deletions
  1. +41
    -18
      BPASmartClient.MorkCL/Control_MorkCL.cs
  2. +13
    -0
      BPASmartClient.MorkCL/Model/Control/RobotSet.cs
  3. +13
    -5
      BPASmartClient.MorkCL/View/Debug.xaml
  4. +5
    -4
      BPASmartClient.MorkCL/View/EditRecipeView.xaml
  5. +3
    -3
      BPASmartClient.MorkCL/View/ParSet.xaml
  6. +16
    -4
      BPASmartClient.MorkCL/ViewModel/DebugViewModel.cs

+ 41
- 18
BPASmartClient.MorkCL/Control_MorkCL.cs View File

@@ -580,8 +580,8 @@ namespace BPASmartClient.MorkCL
break;
case EFunc.添加辅料:
#region 根据配置文件选择每个炒锅的最大最小辅料位置,暂时没使用。
var minloc = -1;
var maxloc = -1;
var minloc = 1;
var maxloc = 8;
if (morkCL.IsUseSplitStorage)
{
if (et == EDeviceType.炒锅1)
@@ -713,22 +713,23 @@ namespace BPASmartClient.MorkCL
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.FryingPanToSeasoningLoc = true;
DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-设置炒锅到调料投料位置完成,等待回到调料投料位置。");

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

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.炒锅回调料投料位置:
// device.FryingPanToSeasoningLoc = false;

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

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

// 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);
@@ -1002,6 +1003,28 @@ namespace BPASmartClient.MorkCL

}, NotifyTopic.ItemStorage, true);

ActionManage.GetInstance.Register(() =>
{
if (ActionManage.GetInstance.SendResult("SystemIsBusy") is bool isBusy)
{
if (isBusy == true)
{
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, Application.Current.MainWindow, "失败", $"当前还有配方任务在排队制作,请稍后后再试。");
return;
}
Task.Run(() =>
{
var robot = (RobotServer)devices[EDeviceType.机器人];
robot.GoCleanLoc();
Application.Current.Dispatcher.Invoke(() =>
{
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, Application.Current.MainWindow, "设置成功", $"设置机器人去清洗位置成功。");
});
});

}
}, "RobotGoCleanLoc", true);

#region 暂时弃用
ActionManage.GetInstance.Register((object location) =>
{


+ 13
- 0
BPASmartClient.MorkCL/Model/Control/RobotSet.cs View File

@@ -48,6 +48,19 @@ namespace BPASmartClient.MorkCL.Model.Control
}
}
}
/// <summary>
/// 去夹爪清洗维护位。
/// </summary>
/// <param name="Cts"></param>
public void GoCleanLoc(CancellationTokenSource Cts = null)
{
if (MyModbus is null || !MyModbus.IsConnected())
{
return;
}
IsIdle.Wait(Cts: Cts);
MyModbus.Write("GI0".ToModbusAdd(), 45);
}

/// <summary>
/// 机器人到位允许倒菜到炒锅


+ 13
- 5
BPASmartClient.MorkCL/View/Debug.xaml View File

@@ -55,11 +55,6 @@
Margin="10,0"
Command="{Binding InitalDeviceCommand}"
Content="初始化设备" />
<!--<Button
Width="100"
Margin="10,0"
Command="{Binding ResetDeviceCommand}"
Content="复位" />-->
<Button
Width="100"
Margin="10,0"
@@ -168,6 +163,12 @@
HorizontalAlignment="Left"
Command="{Binding FryPanCleanCommand}"
Content="炒锅清洗" />

<!--<Button
Width="100"
Margin="10,0"
Command="{Binding GoCleanLocCommand}"
Content="去洗锅位" />-->
</WrapPanel>
</StackPanel>

@@ -180,6 +181,13 @@
Grid.Row="1"
Margin="15"
Orientation="Vertical">
<Button
Width="200"
Height="50"
Margin="5"
HorizontalAlignment="Left"
Command="{Binding RobotGoCleanLocCommand}"
Content="机器人去清洗位置" />
<Button
Width="200"
Height="50"


+ 5
- 4
BPASmartClient.MorkCL/View/EditRecipeView.xaml View File

@@ -65,7 +65,8 @@
FontSize="18"
Foreground="DeepSkyBlue"
Text="{Binding Name}" />
<TextBlock
<!-- 只有炒菜,没有炖菜 -->
<!--<TextBlock
Margin="10,0"
DockPanel.Dock="Left"
Text="菜品类型:" />
@@ -75,7 +76,7 @@
FontSize="18"
IsReadOnly="True"
ItemsSource="{Binding AllDishType}"
Text="{Binding DishType}" />
Text="{Binding DishType}" />-->
<Button
Margin="10,0"
Click="Button_Click"
@@ -106,7 +107,7 @@

<Grid.ColumnDefinitions>
<ColumnDefinition Width="50" />
<ColumnDefinition Width="230"/>
<ColumnDefinition Width="230" />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
@@ -175,7 +176,7 @@
<Grid Name="gr" Height="30">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50" />
<ColumnDefinition Width="230"/>
<ColumnDefinition Width="230" />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />


+ 3
- 3
BPASmartClient.MorkCL/View/ParSet.xaml View File

@@ -74,8 +74,8 @@
FontSize="16"
IsChecked="{Binding Param.OtherDeviceConnect}" />
</StackPanel>
<StackPanel Grid.Row="1" Grid.Column="2">
<!--分位逻辑有问题,暂时不开放 -->
<!--<StackPanel Grid.Row="1" Grid.Column="2" >
<CheckBox
Margin="5"
Content="辅料库位根据炒锅区分位置" IsChecked="{Binding Param.IsUseSplitStorage}"
@@ -120,7 +120,7 @@
FontSize="22"
Text="{Binding Param.FryPanAccessoriesMax_2}" />
</StackPanel>
</StackPanel>
</StackPanel>-->
<!--<StackPanel Grid.Row="2" Margin="5">
<StackPanel Orientation="Horizontal">
<TextBlock Text="主料重量偏差值(Kg):"/>


+ 16
- 4
BPASmartClient.MorkCL/ViewModel/DebugViewModel.cs View File

@@ -241,8 +241,9 @@ namespace BPASmartClient.MorkCL.ViewModel
await SendWriteRequest("LB22");
ShowNotify($"设置设备停止成功。");
});

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

CancelFryPanTaskCommand = new((string device) =>
@@ -278,6 +279,15 @@ namespace BPASmartClient.MorkCL.ViewModel
ActionManage.GetInstance.Send("InitRobotAllVar");
});
});

RobotGoCleanLocCommand = new(() =>
{
if (!MessageNotify.GetInstance.ShowDialog("确认是否将机械手移动到清洗位?"))
{
return;
}
ActionManage.GetInstance.Send("RobotGoCleanLoc");
});
}

#region 私有方法
@@ -456,9 +466,9 @@ namespace BPASmartClient.MorkCL.ViewModel
/// </summary>
public BPARelayCommand StopDeviceCommand { get; set; }
/// <summary>
/// 设备复位
/// 设备去洗锅位置
/// </summary>
public BPARelayCommand ResetDeviceCommand { get; set; }
public BPARelayCommand GoCleanLocCommand { get; set; }
/// <summary>
/// 取消指定炒锅当前任务。
/// </summary>
@@ -476,6 +486,8 @@ namespace BPASmartClient.MorkCL.ViewModel
/// </summary>
public BPARelayCommand InitRobotVarCommand { get; set; }

public BPARelayCommand RobotGoCleanLocCommand { get; set; }

#endregion 命令
}
}

Loading…
Cancel
Save