Mr_z vor 1 Jahr
Ursprung
Commit
c87ce04206
46 geänderte Dateien mit 1314 neuen und 1161 gelöschten Zeilen
  1. +7
    -7
      BPASmartClient.AgvApi/Properties/launchSettings.json
  2. +4
    -2
      BPASmartClient.DosingSystemSingle/Model/DeviceInquire.cs
  3. +17
    -1
      BPASmartClient.JXJFoodBigStation/App.xaml.cs
  4. +7
    -0
      BPASmartClient.JXJFoodBigStation/BPASmartClient.JXJFoodBigStation.csproj
  5. +1
    -1
      BPASmartClient.JXJFoodBigStation/Model/HK_PLC/DB_Write.cs
  6. +1
    -2
      BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs
  7. +149
    -0
      BPASmartClient.JXJFoodBigStation/View/StockBinRawMaterialView.xaml
  8. +28
    -0
      BPASmartClient.JXJFoodBigStation/View/StockBinRawMaterialView.xaml.cs
  9. +42
    -0
      BPASmartClient.JXJFoodBigStation/ViewModel/StockBinRawMaterialViewModel.cs
  10. +10
    -2
      BPASmartClient.JXJFoodSmallStation/App.xaml.cs
  11. +4
    -0
      BPASmartClient.JXJFoodSmallStation/BPASmartClient.JXJFoodSmallStation.csproj
  12. +12
    -10
      BPASmartClient.JXJFoodSmallStation/Model/GVL_SmallStation.cs
  13. +30
    -0
      BPASmartClient.JXJFoodSmallStation/Model/Par/ConnectParMode.cs
  14. +83
    -53
      BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs
  15. +7
    -49
      BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DeviceInquire.cs
  16. +4
    -1
      BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DevicePar.cs
  17. +3
    -0
      BPASmartClient.JXJFoodSmallStation/Model/Siemens/RemoteRecipeRawMaterial.cs
  18. +39
    -29
      BPASmartClient.JXJFoodSmallStation/View/ManualControlView.xaml
  19. +9
    -0
      BPASmartClient.JXJFoodSmallStation/View/ManualFlowView.xaml
  20. +29
    -18
      BPASmartClient.JXJFoodSmallStation/View/NewLocalRecipeView.xaml
  21. +224
    -0
      BPASmartClient.JXJFoodSmallStation/View/SystemParView.xaml
  22. +28
    -0
      BPASmartClient.JXJFoodSmallStation/View/SystemParView.xaml.cs
  23. +88
    -12
      BPASmartClient.JXJFoodSmallStation/ViewModel/ManualControlViewModel.cs
  24. +15
    -2
      BPASmartClient.JXJFoodSmallStation/ViewModel/ManualFlowViewModel.cs
  25. +82
    -48
      BPASmartClient.JXJFoodSmallStation/ViewModel/NewLocalRecipeViewModel.cs
  26. +6
    -5
      BPASmartClient.JXJFoodSmallStation/ViewModel/RecipeReceiveViewModel.cs
  27. +80
    -0
      BPASmartClient.JXJFoodSmallStation/ViewModel/SystemParViewModel.cs
  28. +5
    -5
      BPASmartClient.Lebai/LebaiRobot.cs
  29. +15
    -1
      BPASmartClient.Modbus/ModbusTcp.cs
  30. +34
    -16
      BPASmartClient.MorkF/Control_MorkF.cs
  31. +4
    -0
      BPASmartClient.MorkF/ML_MorkF.cs
  32. +1
    -1
      BPASmartClient.MorkS/Control_Morks.cs
  33. +60
    -769
      BPASmartClient.MorkT_Container/Control_MorkT_Container.cs
  34. +8
    -51
      BPASmartClient.MorkT_Container/GVL_MorkT.cs
  35. +0
    -11
      BPASmartClient.MorkT_Container/PolymerBatching.cs
  36. +1
    -1
      BPASmartClient.ScreenLib/AppMain.cs
  37. +66
    -2
      BPASmartClient.ScreenLib/Helper/Main.cs
  38. +1
    -1
      BPASmartClient.ScreenSplitMeals/App.config
  39. +10
    -0
      DosingSystem/App.xaml.cs
  40. +44
    -47
      DosingSystem/Model/DeviceInquire.cs
  41. +2
    -0
      DosingSystem/Service/SiemensDevice.cs
  42. +22
    -1
      DosingSystem/View/ManualControlView.xaml
  43. +0
    -1
      DosingSystem/ViewModel/CommparSetViewModel.cs
  44. +14
    -7
      DosingSystem/ViewModel/ManualControlViewModel.cs
  45. +18
    -4
      DosingSystem/ViewModel/RecipeControlViewModel.cs
  46. +0
    -1
      DosingSystem/ViewModel/StockControViewModel.cs

+ 7
- 7
BPASmartClient.AgvApi/Properties/launchSettings.json Datei anzeigen

@@ -1,23 +1,23 @@
{
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:38659",
"sslPort": 0
"applicationUrl": "http://localhost:50969/",
"sslPort": 44385
}
},
"profiles": {
"BPASmartClient.AgvApi": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "http://localhost:5175",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"applicationUrl": "http://localhost:5175",
"dotnetRunMessages": true
},
"IIS Express": {
"commandName": "IISExpress",
@@ -28,4 +28,4 @@
}
}
}
}
}

+ 4
- 2
BPASmartClient.DosingSystemSingle/Model/DeviceInquire.cs Datei anzeigen

@@ -120,7 +120,7 @@ namespace BPASmartClient.DosingSystemSingle
ThreadManage.GetInstance().StartLong(new Action(() =>
{
if (IPQueues.Count >= IPLists.Count)
IpAddressLines();
//IpAddressLines();
Thread.Sleep(5000);
}), "配料机设备上线监听", true);
}
@@ -372,9 +372,11 @@ namespace BPASmartClient.DosingSystemSingle
var Value5 = this.modbusTcp.GetUint(DeviceAddress.ServoManualSpeed);
if (Value5 != null && Value5.ToString() != res.ServoManualSpeed.ToString()) goto prop5;
prop6:
res.SiloUpperLimitWeight = (int)res.SiloUpperLimitWeight + 1;
modbusTcp.SetUint(DeviceAddress.SiloUpperLimitWeight, (uint)res.SiloUpperLimitWeight);
var Value6 = this.modbusTcp.GetUint(DeviceAddress.SiloUpperLimitWeight);
if (Value6 != null && Value6.ToString() != res.SiloUpperLimitWeight.ToString()) goto prop6;
Thread.Sleep(1000);
/*if (Value6 != null && Value6.ToString() != res.SiloUpperLimitWeight.ToString())*/ goto prop6;
prop7:
modbusTcp.SetUint(DeviceAddress.LowerLimitWeightOfSilo, (uint)res.LowerLimitWeightOfSilo);
var Value7 = this.modbusTcp.GetUint(DeviceAddress.LowerLimitWeightOfSilo);


+ 17
- 1
BPASmartClient.JXJFoodBigStation/App.xaml.cs Datei anzeigen

@@ -91,7 +91,23 @@ namespace BPASmartClient.JXJFoodBigStation
subMenumodels = RecipeManage,
});
#endregion

#region 料仓管理
ObservableCollection<SubMenumodel> StockBinManage = new ObservableCollection<SubMenumodel>();
StockBinManage.Add(new SubMenumodel()
{
SubMenuName = "料仓原料配置",
SubMenuPermission = new Permission[] { Permission.管理员 },
AssemblyName = "BPASmartClient.JXJFoodBigStation",
ToggleWindowPath = "View.StockBinRawMaterialView"
});
MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "&#xe683;",
MainMenuName = "料仓管理",
Alias = "Recipe Management",
subMenumodels = StockBinManage,
});
#endregion
#region 消息日志
ObservableCollection<SubMenumodel> InfoLog = new ObservableCollection<SubMenumodel>();
InfoLog.Add(new SubMenumodel()


+ 7
- 0
BPASmartClient.JXJFoodBigStation/BPASmartClient.JXJFoodBigStation.csproj Datei anzeigen

@@ -31,6 +31,9 @@
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<Compile Update="View\StockBinRawMaterialView.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="View\ManualFlowView.xaml.cs">
<SubType>Code</SubType>
</Compile>
@@ -48,6 +51,10 @@
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
</Page>
<Page Update="View\StockBinRawMaterialView.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
</Page>
<Page Update="View\ManualFlowView.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>


+ 1
- 1
BPASmartClient.JXJFoodBigStation/Model/HK_PLC/DB_Write.cs Datei anzeigen

@@ -13,7 +13,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC
/// </summary>
public bool HeartBeat { get; set; }
/// <summary>
/// 配方锁定(暂时不使用)
/// 订单类型(false:正常工单执行 true:洗桶)
/// </summary>
public bool RecipeLock { get; set; }
/// <summary>


+ 1
- 2
BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs Datei anzeigen

@@ -231,7 +231,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}), "西门子配方执行流程", true);
}
private void LocalRecipeRecevice()
{
{
if (LocalRecipes.Count > 0)
{
foreach (var data in LocalRecipes)
@@ -1504,7 +1504,6 @@ namespace BPASmartClient.JXJFoodBigStation.Model
RawMaterialsInfo.Clear();
if (GVL_BigStation.IsUseLocalName)
{

RawMaterialsInfo.Add(new RawMaterial() { RawMaterialName = "0007", RawMaterialLocation = 1 });//香菇丁
RawMaterialsInfo.Add(new RawMaterial() { RawMaterialName = "0015", RawMaterialLocation = 2 });//竹笋丁
RawMaterialsInfo.Add(new RawMaterial() { RawMaterialName = "0005", RawMaterialLocation = 3 });//卤牛肉丁


+ 149
- 0
BPASmartClient.JXJFoodBigStation/View/StockBinRawMaterialView.xaml Datei anzeigen

@@ -0,0 +1,149 @@
<UserControl x:Class="BPASmartClient.JXJFoodBigStation.View.StockBinRawMaterialView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:vm="clr-namespace:BPASmartClient.JXJFoodBigStation.ViewModel"
mc:Ignorable="d"
d:DesignHeight="1080" d:DesignWidth="1920">
<UserControl.DataContext>
<vm:StockBinRawMaterialViewModel />
</UserControl.DataContext>
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="60" />
<RowDefinition Height="40" />
<RowDefinition />
</Grid.RowDefinitions>
<!--#region 表格标题栏设置-->
<Grid>
<StackPanel HorizontalAlignment="Right" VerticalAlignment="Center" Orientation="Horizontal">
<pry:IcoButton
Margin="10"
Command="{Binding UpdateRawMaterial}"
IcoText="&#xe68e;"
Content="新增数据"
FontSize="28"
Foreground="Aqua"
Style="{StaticResource IcoButtonStyle}" />
<pry:IcoButton
Margin="10"
Command="{Binding SaveRawMaterialPara}"
Content="保存参数"
FontSize="28"
Foreground="Aqua"
Style="{StaticResource IcoButtonStyle}" />
</StackPanel>
</Grid>
<Grid
Grid.Row="1"
Margin="0,10,0,0"
Background="#ff0C255F">

<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<TextBlock Text="序号" FontSize="24" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"/>
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" />
</Grid>
<TextBlock Grid.Column="1" FontSize="24" Text="料仓位置" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua" />
<TextBlock Grid.Column="2" FontSize="24" Text="原料编号" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua" />
<TextBlock Grid.Column="3" FontSize="24" Text="编辑" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua" />
</Grid>
<Grid Grid.Row="2">
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" >
<ItemsControl ItemsSource="{Binding RawMaterialInfo}" Foreground="Aqua">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Name="gr" >
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid Grid.Column="0" Margin="5">
<TextBlock
FontSize="16"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="{Binding RawMaterialCount}" />
<Border
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>
<Grid Grid.Column="1" Margin="5">
<TextBlock
FontSize="16"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="{Binding RawMaterialLocation}" />
<Border
BorderThickness="1,0,1,0"
Cursor="SizeWE" />

</Grid>
<Grid Grid.Column="2" Margin="5">
<TextBlock
FontSize="16"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="{Binding RawMaterialName}" />
<Border
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>
<Grid Grid.Column="3">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<pry:IcoButton
Margin="3,4,4,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="#112AB2E7"
BorderThickness="0"
Command="{Binding DataContext.DetailsCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}"
CommandParameter="{Binding RawMaterialLocation}"
Content="编辑"
EnterBackground="#222AB2E7"
Foreground="#FF2AB2E7"
IcoText="&#xe636;"
Style="{StaticResource IcoButtonStyle}" />
<pry:IcoButton
Margin="3,4,4,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="#11F53F62"
BorderThickness="0"
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}"
CommandParameter="{Binding RawMaterialLocation}"
Content="删除"
EnterBackground="#22F53F62"
Foreground="#FFF53F62"
IcoText="&#xe68e;"
Style="{StaticResource IcoButtonStyle}" />
</StackPanel>
</Grid>
</Grid>
<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" />
</Trigger>
</DataTemplate.Triggers>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Grid>
</Grid>
</UserControl>

+ 28
- 0
BPASmartClient.JXJFoodBigStation/View/StockBinRawMaterialView.xaml.cs Datei anzeigen

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.JXJFoodBigStation.View
{
/// <summary>
/// HKPlcCommMonitor.xaml 的交互逻辑
/// </summary>
public partial class StockBinRawMaterialView : UserControl
{
public StockBinRawMaterialView()
{
InitializeComponent();
}
}
}

+ 42
- 0
BPASmartClient.JXJFoodBigStation/ViewModel/StockBinRawMaterialViewModel.cs Datei anzeigen

@@ -0,0 +1,42 @@
using BPASmartClient.Helper;
using BPASmartClient.JXJFoodBigStation.Model;
using BPASmartClient.JXJFoodBigStation.Model.HK_PLC;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace BPASmartClient.JXJFoodBigStation.ViewModel
{
public class StockBinRawMaterialViewModel : ObservableObject
{
public StockBinRawMaterialViewModel()
{
RawMaterialInfo = ProcessControl.GetInstance.RawMaterialsInfo;
int serialNum = 0;
foreach (var rawMaterialInfo in RawMaterialInfo)
{
serialNum = serialNum + 1;
rawMaterialInfo.RawMaterialCount = (short)serialNum;
}
RemoveCommand = new RelayCommand<int>((loc) =>
{
var res = RawMaterialInfo.FirstOrDefault(p => p.RawMaterialLocation == loc);
if(res!= null) RawMaterialInfo.Remove(res);
});
}
public ObservableCollection<RawMaterial> RawMaterialInfo { get; set; } = new ObservableCollection<RawMaterial>();

public RelayCommand<int> DetailsCommand { get; set; }
public RelayCommand<int> RemoveCommand { get; set; }
public RelayCommand SaveRawMaterialPara { get; set; }
public RelayCommand UpdateMaterial { get; set; }
}
}

+ 10
- 2
BPASmartClient.JXJFoodSmallStation/App.xaml.cs Datei anzeigen

@@ -124,6 +124,14 @@ namespace BPASmartClient.JXJFoodSmallStation
AssemblyName = "BPASmartClient.JXJFoodSmallStation",
ToggleWindowPath = "View.WindSendParView"
});
ParSet.Add(new SubMenumodel()
{
SubMenuName = "系统参数设置",
SubMenuPermission = new Permission[] { Permission.管理员 },
AssemblyName = "BPASmartClient.JXJFoodSmallStation",
ToggleWindowPath = "View.SystemParView"
});
MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "&#xe62d;",
@@ -142,14 +150,14 @@ namespace BPASmartClient.JXJFoodSmallStation
AssemblyName = "BPASmartClient.JXJFoodSmallStation",
ToggleWindowPath = "View.ManualControlView"
});
ManualControl.Add(new SubMenumodel()
/*ManualControl.Add(new SubMenumodel()
{
SubMenuName = "手动控制信号",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
AssemblyName = "BPASmartClient.JXJFoodSmallStation",
ToggleWindowPath = "View.ManualCommView"

});
});*/
ManualControl.Add(new SubMenumodel()
{
SubMenuName = "手动控制流程",


+ 4
- 0
BPASmartClient.JXJFoodSmallStation/BPASmartClient.JXJFoodSmallStation.csproj Datei anzeigen

@@ -50,6 +50,10 @@
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
</Page>
<Page Update="View\SystemParView.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
</Page>
<Page Update="View\WindSendParView.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>


+ 12
- 10
BPASmartClient.JXJFoodSmallStation/Model/GVL_SmallStation.cs Datei anzeigen

@@ -60,15 +60,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
/// </summary>
public static int SiemensSendRecipeStatus { get; set; } = 0;
/// <summary>
/// 往输送带下发配方完成
/// </summary>
public bool IssueRecipeFinishStation1 { get; set; } = false;

/// <summary>
/// 往输送带下发配方完成
/// </summary>
public bool IssueRecipeFinishStation2 { get; set; } = false;
/// <summary>
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方
/// </summary>
public int RecipeStatusID { get; set; } = 0;
@@ -136,7 +127,18 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
/// 粉料仓配料完成
/// </summary>
public static bool WindSendDosingComple { get; set; } = false;
/// <summary>
/// 系统模式
/// </summary>
public static bool SystemMode { get; set; } = false;
/// <summary>
/// 系统状态
/// </summary>
public static bool SystemStatus { get; set; } = false;
/// <summary>
/// 系统运行状态
/// </summary>
public static bool SystemRunStatus { get; set; } = false;
#endregion
}
}

+ 30
- 0
BPASmartClient.JXJFoodSmallStation/Model/Par/ConnectParMode.cs Datei anzeigen

@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;

namespace BPASmartClient.JXJFoodSmallStation.Model.Par
{
public class ConnectParMode: ObservableObject
{
public bool SiemensConnect { get { return _mSiemensConnect; } set { _mSiemensConnect = value; OnPropertyChanged(); } }
private bool _mSiemensConnect;
public bool WindSendConnect { get { return _mWindSendConnect; } set { _mWindSendConnect = value; OnPropertyChanged(); } }
private bool _mWindSendConnect;
public bool HKPlcConnect { get { return _mHKPlcConnect; } set { _mHKPlcConnect = value; OnPropertyChanged(); } }
private bool _mHKPlcConnect;

public short AxisLoadSpeed { get { return _mAxisLoadSpeed; } set { _mAxisLoadSpeed = value; OnPropertyChanged(); } }
private short _mAxisLoadSpeed;
public short AxisMidSpeed { get { return _mAxisMidSpeed; } set { _mAxisMidSpeed = value; OnPropertyChanged(); } }
private short _mAxisMidSpeed;
public short AxisUnLoadSpeed { get { return _mAxisUnLoadSpeed; } set { _mAxisUnLoadSpeed = value; OnPropertyChanged(); } }
private short _mAxisUnLoadSpeed;
public float Axis1Speed { get { return _mAxis1Speed; } set { _mAxis1Speed = value; OnPropertyChanged(); } }
private float _mAxis1Speed;
public float Axis2Speed { get { return _mAxis2Speed; } set { _mAxis2Speed = value; OnPropertyChanged(); } }
private float _mAxis2Speed;
}
}

+ 83
- 53
BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs Datei anzeigen

@@ -172,9 +172,18 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
try
{
HKDevice.HK_PLC_S7.Connect(S7.Net.CpuType.S71200, HK_PLC_IP);
SiemensDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71500, Siemens_PLC_IP);
WindSendDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71200, WindSend_PLC_IP);
if (Json<DevicePar>.Data.deviceConnectPar.HKPlcConnect)
{
HKDevice.HK_PLC_S7.Connect(S7.Net.CpuType.S71200, HK_PLC_IP);
}
if (Json<DevicePar>.Data.deviceConnectPar.SiemensConnect)
{
SiemensDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71500, Siemens_PLC_IP);
}
if (Json<DevicePar>.Data.deviceConnectPar.WindSendConnect)
{
WindSendDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71200, WindSend_PLC_IP);
}
if (HKDevice.IsConnected)
{
HKDevice.Init();
@@ -196,67 +205,84 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
ThreadManage.GetInstance().StartLong(new Action(() =>
{
if (!HKDevice.IsConnected)
if (!HKDevice.IsConnected && Json<DevicePar>.Data.deviceConnectPar.HKPlcConnect)
{
HKDevice.HK_PLC_S7.Connect(S7.Net.CpuType.S71200, HK_PLC_IP);
MessageNotify.GetInstance.ShowRunLog("海科PLC重新连接");
if (HKDevice.IsConnected) MessageNotify.GetInstance.ShowRunLog("海科PLC重新连接成功");
}
if (!SiemensDevice.IsConnected)
if (!SiemensDevice.IsConnected && Json<DevicePar>.Data.deviceConnectPar.SiemensConnect)
{
SiemensDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71500, Siemens_PLC_IP);
MessageNotify.GetInstance.ShowRunLog("海科PLC重新连接");
if (SiemensDevice.IsConnected) MessageNotify.GetInstance.ShowRunLog("海科PLC重新连接成功");
}
if (!WindSendDevice.IsConnected)
if (!WindSendDevice.IsConnected && Json<DevicePar>.Data.deviceConnectPar.WindSendConnect)
{
WindSendDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71200, WindSend_PLC_IP);
MessageNotify.GetInstance.ShowRunLog("风送plc重新连接成功");
}
Thread.Sleep(50);
}), "设备连接", true);
ActionManage.GetInstance.CancelRegister("SystemStart");
ActionManage.GetInstance.Register(new Action(() =>
{
HKDevice.HK_PLC_S7.Write<bool>("DB44.DBX0.0", true);
}), "SystemStart", true);
ActionManage.GetInstance.CancelRegister("SystemStop");
ActionManage.GetInstance.Register(new Action(() =>
{
HKDevice.HK_PLC_S7.Write<bool>("DB44.DBX0.0", false);
}), "SystemStop", true);
ActionManage.GetInstance.CancelRegister("SystemPause");
ActionManage.GetInstance.Register(new Action(() =>
{
HKDevice.HK_PLC_S7.Write<bool>("DB44.DBX0.2", true);
}), "SystemPause", true);
ActionManage.GetInstance.CancelRegister("ManualSystemReset");
ActionManage.GetInstance.Register(new Action(() =>
RecipeQueue.Clear();
//手动控制系统模式
ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write<bool>("DB44.DBX0.0", true); }), "SystemStart", true);
ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write<bool>("DB44.DBX0.0", false); }), "SystemStop", true);
ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write<bool>("DB44.DBX0.2", true); }), "SystemPause", true);
ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write<bool>("DB44.DBX0.2", false); }), "SystemReset", true);
ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write<bool>("DB44.DBX0.1", false); }), "SystemAutoMode", true);
ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write<bool>("DB44.DBX0.1", true); }), "SystemDebugMode", true);
//流程控制
ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write<bool>("DB44.DBX0.3", true); }), "ManualSystemReset", true);
ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write<bool>("DB44.DBX0.4", true); }), "CLearRecipeInfo", true);
ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write<bool>("DB4.DBX0.7", true); }), "AGVPutTrayFinish", true);
//手动控制电机轴
ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX4.6", true); }), "StartAxisLoadCommand", true);
ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX4.6", false); }), "StopAxisLoadCommand", true);
ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX4.7", true); }), "StartAxisMidCommand", true);
ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX4.7", false); }), "StopAxisMidCommand", true);
ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX5.0", true); }), "StartAxisUnLoadCommand", true);
ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX5.0", false); }), "StopAxisUnLoadCommand", true);
ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX5.1", true); }), "StartAxis1Command", true);
ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX5.1", false); }), "StopAxis1Command", true);
ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX5.2", true); }), "StartAxis2Command", true);
ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX5.2", false); }), "StopAxis2Command", true);
//电机速度
ActionManage.GetInstance.Register(new Action<object>((o) =>
{
HKDevice.HK_PLC_S7.Write<bool>("DB44.DBX0.2", false);
//DeviceInquire.GetInstance.GetDevice((int)8)?.Start((float)100.1);
}), "ManualSystemReset", true);

ActionManage.GetInstance.CancelRegister("SystemAutoMode");
ActionManage.GetInstance.Register(new Action(() =>
if (o != null && o is short value)
{
HKDevice.HK_PLC_S7.Write("DB47.DBD8", value);
}
}), "AxisLoadSpeedSet", true);
ActionManage.GetInstance.Register(new Action<object>((o) =>
{
HKDevice.HK_PLC_S7.Write<bool>("DB44.DBX0.1", false);
}), "SystemAutoMode", true);
ActionManage.GetInstance.CancelRegister("SystemDebugMode");
ActionManage.GetInstance.Register(new Action(() =>
if (o != null && o is short value)
{
HKDevice.HK_PLC_S7.Write("DB47.DBD10", value);
}
}), "AxisMidSpeedSet", true);
ActionManage.GetInstance.Register(new Action<object>((o) =>
{
HKDevice.HK_PLC_S7.Write<bool>("DB44.DBX0.1", true);
}), "SystemDebugMode", true);
RecipeQueue.Clear();
ActionManage.GetInstance.Register(new Action(() =>
if (o != null && o is short value)
{
HKDevice.HK_PLC_S7.Write("DB47.DBD12", value);
}
}), "AxisUnLoadSpeedSet", true);
ActionManage.GetInstance.Register(new Action<object>((o) =>
{
HKDevice.HK_PLC_S7.Write<bool>("DB44.DBX0.3", true);
}), "SystemReset", true);
RecipeQueue.Clear();
ActionManage.GetInstance.Register(new Action(() =>
if (o != null && o is float value)
{
HKDevice.HK_PLC_S7.Write("DB47.DBD0", value);
}
}), "Axis1SpeedSet", true);
ActionManage.GetInstance.Register(new Action<object>((o) =>
{
HKDevice.HK_PLC_S7.Write<bool>("DB44.DBX0.4", true);
}), "CLearRecipeInfo", true);
if (o != null && o is float value)
{
HKDevice.HK_PLC_S7.Write("DB47.DBD4", value);
}
}), "Axis2SpeedSet", true);
RecipeQueue.Clear();
//Json<RemoteRecipeDataColl>.Data.Recipes = TestData.GetInstance.Recipes;//添加测试数据
ThreadManage.GetInstance().StartLong(new Action(() =>
@@ -266,6 +292,10 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
GVL_SmallStation.GetInstance.HeartBeatToPlc = !GVL_SmallStation.GetInstance.HeartBeatToPlc;
HKDevice.HK_PLC_S7.Write("DB4.DBX0.0", GVL_SmallStation.GetInstance.HeartBeatToPlc);
GVL_SmallStation.GetInstance.HeartBeatFromPlc = HKDevice.HK_PLC_S7.Read<bool>("DB45.DBX0.0");
//获取系统状态
GVL_SmallStation.SystemStatus = HKDevice.HK_PLC_S7.Read<bool>("DB44.DBX0.0");//系统启停
GVL_SmallStation.SystemMode = HKDevice.HK_PLC_S7.Read<bool>("DB44.DBX0.1");//系统模式
GVL_SmallStation.SystemRunStatus = HKDevice.HK_PLC_S7.Read<bool>("DB44.DBX0.2");//系统暂停
}
Thread.Sleep(200);
}), "通信心跳", true);
@@ -413,7 +443,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
else if (o.ToString().Contains("进料桶顶升气缸"))
{
HKDevice.HK_PLC_S7.Write("DB5.DBX3.6", true);
HKDevice.HK_PLC_S7.Write("DB5.DBX3.6", false);//默认顶升
}
else if (o.ToString().Contains("出料桶顶升气缸1"))
{
@@ -429,19 +459,19 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
else if (o.ToString().Contains("托盘气缸1_1"))
{
HKDevice.HK_PLC_S7.Write("DB5.DBX4.2", true);
HKDevice.HK_PLC_S7.Write("DB5.DBX4.2", false);//默认伸出
}
else if (o.ToString().Contains("托盘气缸1_2"))
{
HKDevice.HK_PLC_S7.Write("DB5.DBX4.3", true);
HKDevice.HK_PLC_S7.Write("DB5.DBX4.3", false);
}
else if (o.ToString().Contains("托盘气缸2_1"))
{
HKDevice.HK_PLC_S7.Write("DB5.DBX4.4", true);
HKDevice.HK_PLC_S7.Write("DB5.DBX4.4", false);
}
else if (o.ToString().Contains("托盘气缸2_2"))
{
HKDevice.HK_PLC_S7.Write("DB5.DBX4.5", true);
HKDevice.HK_PLC_S7.Write("DB5.DBX4.5", false);
}
}
}), "ManualOpen", true);//根据下发的配方ID将 托盘的位置信息添加到配方中
@@ -564,7 +594,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
else if (o.ToString().Contains("进料桶顶升气缸"))
{
HKDevice.HK_PLC_S7.Write("DB5.DBX3.6", false);
HKDevice.HK_PLC_S7.Write("DB5.DBX3.6", true);
}
else if (o.ToString().Contains("出料桶顶升气缸1"))
{
@@ -580,19 +610,19 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
else if (o.ToString().Contains("托盘气缸1_1"))
{
HKDevice.HK_PLC_S7.Write("DB5.DBX4.2", false);
HKDevice.HK_PLC_S7.Write("DB5.DBX4.2", true);
}
else if (o.ToString().Contains("托盘气缸1_2"))
{
HKDevice.HK_PLC_S7.Write("DB5.DBX4.3", false);
HKDevice.HK_PLC_S7.Write("DB5.DBX4.3", true);
}
else if (o.ToString().Contains("托盘气缸2_1"))
{
HKDevice.HK_PLC_S7.Write("DB5.DBX4.4", false);
HKDevice.HK_PLC_S7.Write("DB5.DBX4.4", true);
}
else if (o.ToString().Contains("托盘气缸2_2"))
{
HKDevice.HK_PLC_S7.Write("DB5.DBX4.5", false);
HKDevice.HK_PLC_S7.Write("DB5.DBX4.5", true);
}

}


+ 7
- 49
BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DeviceInquire.cs Datei anzeigen

@@ -160,6 +160,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
IPLists.Add($"{IPSegment}{i}");
}
}*/
//吉香居特定IP
for (int i = 0; i < 15; i++)
{
IPLists.Add($"{IPSegment}{i + 69}");
@@ -247,14 +248,11 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
DS.modbusTcp.Disconnect = new Action(() =>
{
if (InvalidIP.Contains(ip)) InvalidIP.Remove(ip);
//var res = DeviceListViewModel.devices.FirstOrDefault(P => P.IpAddress == ip);
var res = devices.FirstOrDefault(P => P.IpAddress == ip);
//if (res != null && DeviceListViewModel.devices.Contains(res))
if (res != null && devices.Contains(res))
{
App.Current.Dispatcher.Invoke(new Action(() =>
{
//DeviceListViewModel.devices.Remove(res);
devices.Remove(res);
var item = Global.DeviceRawMaterials.FirstOrDefault(P => P.RawMaterialName == res.DeviceName);
if (item != null) Global.DeviceRawMaterials.Remove(item);
@@ -321,12 +319,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
{
ThreadManage.GetInstance().StartLong(new Action(() =>
{
//获取设备运行状态
//var res = this.modbusTcp.Read(DeviceAddress.RunStatus);
//if (res != null && res is ushort[] ushortValue)
//{
// if (ushortValue.Length >= 1) deviceStatus.RunStatus = ushortValue[0];
//}
deviceStatus.RunStatus = (ushort)this.modbusTcp.ReadShort(DeviceAddress.RunStatus); //获取设备运行状态
deviceStatus.WeightFeedback = this.modbusTcp.ReadShort(DeviceAddress.WeightFeedback);//获取设备料仓剩余重量
deviceStatus.NowWeightFeedback = this.modbusTcp.GetReal(DeviceAddress.CutWeightFeedback);//获取下料重量
@@ -338,7 +330,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).EStop2 = deviceStatus.DeviceAlarmCode.Get16bitValue(7);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).SiloUpperLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(8);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).SiloLowerLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(9);

Thread.Sleep(10);
}), $"{DeviceName} 开始监听", true);
}
@@ -365,31 +356,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
{
if (modbusTcp.Connected)
{
/*//配料设备参数写入
var res = Json<DevicePar>.Data.deviceParModels.FirstOrDefault(p => p.MaterialName == DeviceName);
if (res != null)
{
modbusTcp.SetReal(DeviceAddress.SlowlyAddWeight, res.SlowlyAddWeight);
modbusTcp.SetReal(DeviceAddress.PreCloseValveWeight, res.PreCloseValveWeight);
modbusTcp.SetUint(DeviceAddress.RapidAcceleration, (uint)res.RapidAcceleration);
modbusTcp.SetUint(DeviceAddress.SlowAcceleration, (uint)res.SlowAcceleration);
modbusTcp.SetUint(DeviceAddress.ServoManualSpeed, (uint)res.ServoManualSpeed);
modbusTcp.SetUint(DeviceAddress.SiloUpperLimitWeight, (uint)res.SiloUpperLimitWeight);
modbusTcp.SetUint(DeviceAddress.LowerLimitWeightOfSilo, (uint)res.LowerLimitWeightOfSilo);
modbusTcp.SetUint(DeviceAddress.StirringSpeed, (uint)res.StirringSpeed * 100);
MessageNotify.GetInstance.ShowRunLog($"{res.MaterialName},参数下发完成");
}
Thread.Sleep(100);
modbusTcp.SetReal(DeviceAddress.WeightSet, Value);//写入配方量
bool returnValue = modbusTcp.Write(DeviceAddress.Start, (ushort)1);//设备启动写入
if (returnValue)
{
MessageNotify.GetInstance.ShowRunLog($"发送成功" + DeviceAddress.Start);
}
else
{
MessageNotify.GetInstance.ShowRunLog($"发送失败" + DeviceAddress.Start);
}*/
var res = Json<DevicePar>.Data.deviceParModels.FirstOrDefault(p => p.MaterialName == DeviceName);
if (res != null)
{
@@ -421,24 +387,16 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
modbusTcp.SetUint(DeviceAddress.LowerLimitWeightOfSilo, (uint)res.LowerLimitWeightOfSilo);
var Value7 = this.modbusTcp.GetUint(DeviceAddress.LowerLimitWeightOfSilo);
if (Value7 != null && Value7.ToString() != res.LowerLimitWeightOfSilo.ToString()) goto prop7;
prop8:
modbusTcp.SetUint(DeviceAddress.StirringSpeed, (uint)res.StirringSpeed);
/*prop8:
var Value8 = this.modbusTcp.GetUint(DeviceAddress.StirringSpeed);
if (Value8 != null && Value8.ToString() != res.StirringSpeed.ToString()) goto prop8;
if (Value8 != null && Value8.ToString() != num.ToString()) goto prop8;*/
uint num = (uint)res.StirringSpeed * 100;
modbusTcp.SetUint(DeviceAddress.StirringSpeed, num);
MessageNotify.GetInstance.ShowRunLog($"{res.MaterialName},参数下发完成");
}
prop9:
modbusTcp.SetReal(DeviceAddress.WeightSet, Value);//写入配方量
var Value9 = this.modbusTcp.GetReal("LW65");
MessageNotify.GetInstance.ShowRunLog($"{DeviceName},读取设置重量:{Value9}");
if (Value9 != null && Value9.ToString() != Value.ToString()) goto prop9;

/*prop10:
modbusTcp.Write(DeviceAddress.Start, (ushort)1);//设备启动写入
var Value10 = (short[])this.modbusTcp.Read(DeviceAddress.Start);
if (Value10 != null && Value10[0] != 1) goto prop10;*/
modbusTcp.SetReal(DeviceAddress.WeightSet, Value);//写入原料重量
modbusTcp.Write(DeviceAddress.Start, (ushort)1);//设备启动写入
MessageNotify.GetInstance.ShowRunLog($"{DeviceName},设置重量:{Value},味魔方启动");
MessageNotify.GetInstance.ShowRunLog($"{DeviceName},设置重量:{Value},柔性味魔方开始配料");
}
}
}


+ 4
- 1
BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DevicePar.cs Datei anzeigen

@@ -5,11 +5,14 @@ using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System.Collections.ObjectModel;
using BPASmartClient.JXJFoodSmallStation.Model.Par;

namespace BPASmartClient.JXJFoodSmallStation.Model
{
public class DevicePar
public class DevicePar:ObservableObject
{
public ObservableCollection<DeviceParMode> deviceParModels { get; set; } = new ObservableCollection<DeviceParMode>();
public ConnectParMode deviceConnectPar { get { return _mdeviceConnectPar; } set { _mdeviceConnectPar = value; OnPropertyChanged(); } }
private ConnectParMode _mdeviceConnectPar = new ConnectParMode();
}
}

+ 3
- 0
BPASmartClient.JXJFoodSmallStation/Model/Siemens/RemoteRecipeRawMaterial.cs Datei anzeigen

@@ -21,6 +21,9 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
public short RawMaterialBarrelNum { get { return _mRawMaterialBarrelNum; } set { _mRawMaterialBarrelNum = value; OnPropertyChanged(); } }
private short _mRawMaterialBarrelNum;

public string RawMaterialType { get { return _mRawMaterialType; } set { _mRawMaterialType = value; OnPropertyChanged(); } }
private string _mRawMaterialType;

/// <summary>
/// 需要原料重量
/// </summary>


+ 39
- 29
BPASmartClient.JXJFoodSmallStation/View/ManualControlView.xaml Datei anzeigen

@@ -85,17 +85,37 @@
Text="总控制" />
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="6*"/>
<ColumnDefinition Width="4*"/>
<ColumnDefinition Width="5*"/>
<ColumnDefinition Width="5*"/>
</Grid.ColumnDefinitions>
<WrapPanel VerticalAlignment="Center" HorizontalAlignment="Center" >
<TextBlock Margin="0,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Center"
FontSize="24" Foreground="Aqua" Text="当前系统模式:"/>
<RadioButton Content="Auto模式" IsChecked="True" Margin="15" FontSize="16"
<Grid Grid.Column="0">
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid>
<WrapPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock FontSize="24" Foreground="Aqua" Text="当前系统模式:"/>
<TextBlock FontSize="24" Foreground="Aqua" Text="{Binding SystemMode}"/>
</WrapPanel>
</Grid>
<Grid Grid.Column="0" Grid.Row="1">
<WrapPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock FontSize="24" Foreground="Aqua" Text="当前系统状态:"/>
<TextBlock FontSize="24" Foreground="Aqua" Text="{Binding SystemStatus}"/>
</WrapPanel>
</Grid>

<RadioButton Grid.Column="1" Grid.Row="0" Content="Auto模式" IsChecked="True" Margin="15" FontSize="20" VerticalAlignment="Center" HorizontalAlignment="Center"
Foreground="Aqua" Command="{Binding AutoMode}"></RadioButton>
<RadioButton Content="Debug模式" IsChecked="false" Margin="15" FontSize="16"
<RadioButton Grid.Column="1" Grid.Row="1" Content="Debug模式" IsChecked="false" Margin="15" FontSize="20" VerticalAlignment="Center" HorizontalAlignment="Center"
Foreground="Aqua" Command="{Binding DebugMode}"></RadioButton>
</WrapPanel>
</Grid>
<Grid
Grid.Column="3" >
<Grid.ColumnDefinitions>
@@ -132,7 +152,7 @@
Command="{Binding SystemResetCommand}"
Grid.Column="3"
Margin="5,30"
Content="复"
Content="复"
FontSize="40"
Foreground="Aqua"
Style="{StaticResource IcoButtonStyle}" />
@@ -188,8 +208,7 @@
Margin="10"
Grid.Row="1"
Grid.Column="0"
Command="{Binding StartCommand}"
CommandParameter="{Binding }"
Command="{Binding StartAxisLoadCommand}"
Content="启动"
FontSize="16"
Foreground="Aqua"
@@ -198,8 +217,7 @@
Grid.Row="1"
Grid.Column="1"
Margin="10"
Command="{Binding CloseCommand}"
CommandParameter="{Binding }"
Command="{Binding StopAxisLoadCommand}"
Content="停止"
FontSize="16"
Foreground="Aqua"
@@ -224,8 +242,7 @@
Margin="10"
Grid.Row="1"
Grid.Column="0"
Command="{Binding StartCommand}"
CommandParameter="{Binding }"
Command="{Binding StartAxisMidCommand}"
Content="启动"
FontSize="16"
Foreground="Aqua"
@@ -234,8 +251,7 @@
Grid.Row="1"
Grid.Column="1"
Margin="10"
Command="{Binding StopCommand}"
CommandParameter="{Binding }"
Command="{Binding StopAxisMidCommand}"
Content="停止"
FontSize="16"
Foreground="Aqua"
@@ -256,8 +272,7 @@
Margin="10"
Grid.Row="1"
Grid.Column="0"
Command="{Binding StartCommand}"
CommandParameter="{Binding }"
Command="{Binding StartAxisUnLoadCommand}"
Content="启动"
FontSize="16"
Foreground="Aqua"
@@ -266,8 +281,7 @@
Grid.Row="1"
Grid.Column="1"
Margin="10"
Command="{Binding CloseCommand}"
CommandParameter="{Binding }"
Command="{Binding StopAxisUnLoadCommand}"
Content="停止"
FontSize="16"
Foreground="Aqua"
@@ -290,8 +304,7 @@
Margin="10"
Grid.Row="1"
Grid.Column="0"
Command="{Binding StartCommand}"
CommandParameter="{Binding }"
Command="{Binding StartAxis1Command}"
Content="启动"
FontSize="16"
Foreground="Aqua"
@@ -300,8 +313,7 @@
Grid.Row="1"
Grid.Column="1"
Margin="10"
Command="{Binding CloseCommand}"
CommandParameter="{Binding }"
Command="{Binding StopAxis1Command}"
Content="停止"
FontSize="16"
Foreground="Aqua"
@@ -322,8 +334,7 @@
Margin="10"
Grid.Row="1"
Grid.Column="0"
Command="{Binding StartCommand}"
CommandParameter="{Binding }"
Command="{Binding StartAxis2Command}"
Content="启动"
FontSize="16"
Foreground="Aqua"
@@ -332,8 +343,7 @@
Grid.Row="1"
Grid.Column="1"
Margin="10"
Command="{Binding CloseCommand}"
CommandParameter="{Binding }"
Command="{Binding StopAxis2Command}"
Content="停止"
FontSize="16"
Foreground="Aqua"


+ 9
- 0
BPASmartClient.JXJFoodSmallStation/View/ManualFlowView.xaml Datei anzeigen

@@ -65,6 +65,15 @@
FontSize="20"
Panel.ZIndex="0"
Style="{StaticResource ImageButtonStyle}"></Button>
<Button
Width="200"
Height="40"
Margin="5,0,5,0"
Command="{Binding Test6Command}"
Content="AGV放货架流程完成"
FontSize="20"
Panel.ZIndex="0"
Style="{StaticResource ImageButtonStyle}"></Button>
</StackPanel>


+ 29
- 18
BPASmartClient.JXJFoodSmallStation/View/NewLocalRecipeView.xaml Datei anzeigen

@@ -7,8 +7,8 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.JXJFoodSmallStation.ViewModel"
Title="NewRemoteRecipeView"
Width="700"
Height="520"
Width="900"
Height="645"
AllowsTransparency="True"
Background="{x:Null}"
Topmost="false"
@@ -86,7 +86,7 @@
FontSize="16"
Text="{Binding RecipeName}" />
</StackPanel>
<WrapPanel VerticalAlignment="Center" Grid.Column="1">
<WrapPanel VerticalAlignment="Center" Grid.Column="1" HorizontalAlignment="Left">
<TextBlock
Width="100"
Margin="2,0,10,0"
@@ -120,7 +120,7 @@
FontSize="16"
Text="{Binding TrayNum}" />
</WrapPanel>
<WrapPanel HorizontalAlignment="Right" Orientation="Horizontal" Grid.Column="1">
<WrapPanel HorizontalAlignment="Left" Orientation="Horizontal" Grid.Column="1">
<Button
Width="80"
Height="40"
@@ -169,26 +169,31 @@
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<TextBlock Text="原料名称" HorizontalAlignment="Center" />
<TextBlock Text="原料名称" HorizontalAlignment="Center" FontSize="16"/>
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" />
</Grid>
<Grid Grid.Column="1">
<TextBlock Text="原料类型" HorizontalAlignment="Center" FontSize="16"/>
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" />
</Grid>
<TextBlock Grid.Column="1" Text="原料位置" HorizontalAlignment="Center" />
<Grid Grid.Column="2">
<TextBlock Text="原料桶号" HorizontalAlignment="Center" />
<TextBlock Grid.Column="2" Text="原料位置" HorizontalAlignment="Center" FontSize="16"/>
<Grid Grid.Column="3">
<TextBlock Text="原料桶号" HorizontalAlignment="Center" FontSize="16"/>
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" />
</Grid>
<TextBlock Grid.Column="3" Text="原料重量(kg)" HorizontalAlignment="Center" />
<Grid Grid.Column="4">
<TextBlock Text="功能操作" HorizontalAlignment="Center" />
<TextBlock Grid.Column="4" Text="原料重量(kg)" HorizontalAlignment="Center" FontSize="16" />
<Grid Grid.Column="5">
<TextBlock Text="功能操作" HorizontalAlignment="Center" FontSize="16" />
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" />
</Grid>
<Border Grid.ColumnSpan="10" BorderThickness="1,0,1,0" />
</Grid>
<Grid Grid.Row="3">
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding RawMaterial}">
<ItemsControl ItemsSource="{Binding AllRawMaterial}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Name="gr">
@@ -198,6 +203,7 @@
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<TextBox
@@ -206,11 +212,18 @@
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>
<Grid Grid.Column="1">
<TextBox
Text="{Binding RawMaterialType}" />
<Border
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>
<TextBox
Grid.Column="1"
Grid.Column="2"
Text="{Binding RawMaterialLocation }" />

<Grid Grid.Column="2">
<Grid Grid.Column="3">
<TextBox
Text="{Binding RawMaterialBarrelNum}" />
<Border
@@ -219,10 +232,10 @@
</Grid>

<TextBox
Grid.Column="3"
Grid.Column="4"
Text="{Binding RawMaterialWeight}" />

<Grid Grid.Column="4">
<Grid Grid.Column="5">
<Button
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding RawMaterialLocation}"
@@ -248,8 +261,6 @@
</ItemsControl>
</ScrollViewer>
</Grid>


</Grid>
</Border>
</Window>

+ 224
- 0
BPASmartClient.JXJFoodSmallStation/View/SystemParView.xaml Datei anzeigen

@@ -0,0 +1,224 @@
<UserControl
x:Class="BPASmartClient.JXJFoodSmallStation.View.SystemParView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:con="clr-namespace:BPASmartClient.JXJFoodSmallStation.Converter"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.JXJFoodSmallStation.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.JXJFoodSmallStation.ViewModel"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">

<UserControl.DataContext>
<vm:SystemParViewModel />
</UserControl.DataContext>

<UserControl.Resources>
<SolidColorBrush x:Key="tabColor" Color="#FF2AB2E7" />
<!--<SolidColorBrush x:Key="bordColor" Color="#33ffffff" />-->
<SolidColorBrush x:Key="bordColor" Color="#332AB2E7" />
<con:DataTableRedundantConverter x:Key="tabConvert" />

<Style x:Key="RowRadioButtonStyle" TargetType="{x:Type RadioButton}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RadioButton}">
<Border
x:Name="NvaBor"
Background="Transparent"
BorderBrush="#FF2AB2E7"
BorderThickness="0">
<ContentControl
Margin="10,4"
HorizontalAlignment="Center"
VerticalAlignment="Center"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Content="{TemplateBinding Content}"
FontSize="16" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="NvaBor" Property="Background" Value="#22ffffff" />
<Setter TargetName="NvaBor" Property="BorderThickness" Value="0" />
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsChecked" Value="false" />
<Condition Property="IsMouseOver" Value="True" />
</MultiTrigger.Conditions>
<MultiTrigger.Setters>
<Setter TargetName="NvaBor" Property="Background" Value="#22ffffff" />
</MultiTrigger.Setters>
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style x:Key="InputTextboxStyle" TargetType="TextBox">
<Setter Property="Margin" Value="5,0,0,0" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="Width" Value="150" />
<Setter Property="Height" Value="40" />
<Setter Property="CaretBrush" Value="{StaticResource TitleBorderColor}" />
<Setter Property="Foreground" Value="{StaticResource TitleBorderColor}" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>

<Style x:Key="ControlButtonStyle" TargetType="Button">
<Setter Property="Margin" Value="0" />
<Setter Property="FontSize" Value="18" />
<Setter Property="Foreground" Value="#FFF53F62" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border
Name="TitleBarBr"
BorderBrush="#00c2f4"
BorderThickness="0"
CornerRadius="0"
Opacity="0.8">

<ContentPresenter
Margin="{TemplateBinding Margin}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
<Border.Background>
<ImageBrush
ImageSource="/BPASmartClient.CustomResource;component/Image/组合边框1.1.png"
Opacity="0.8"
Stretch="Fill" />
</Border.Background>

</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="TitleBarBr" Property="Opacity" Value="1" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style x:Key="TitleTextblockStyle" TargetType="TextBlock">
<Setter Property="FontSize" Value="16" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Foreground" Value="{StaticResource tabColor}" />
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontWeight" Value="SemiBold" />
</Style>

</UserControl.Resources>

<Grid>

<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition />
</Grid.RowDefinitions>

<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>

<Button
Width="140"
Height="30"
Margin="10,0,10,0"
HorizontalAlignment="Left"
Command="{Binding SaveCommand}"
Content="保存参数"
FontSize="24"
Style="{StaticResource ImageButtonStyle}" />
<Button
Grid.Column="1"
Width="140"
Height="30"
Margin="10,0,10,0"
HorizontalAlignment="Left"
Command="{Binding SetParCommand}"
Content="下发参数"
FontSize="24"
Style="{StaticResource ImageButtonStyle}" />
<StackPanel Orientation="Vertical" HorizontalAlignment="Left" Grid.Row="1"
Margin="10,0,10,0" >
<CheckBox
Margin="0,10,10,0"
Content="西门子设备连接"
FontFamily="楷体"
VerticalAlignment="Center"
FontSize="20"
Foreground="Aqua"
IsChecked="{Binding SiemensConnect}" />
<CheckBox
Margin="0,10,10,0"
Content="粉料仓设备连接"
FontFamily="楷体"
FontSize="20"
VerticalAlignment="Center"
Foreground="Aqua"
IsChecked="{Binding WindSendConnect}"/>
<CheckBox
Margin="0,10,10,0"
Content="小料站产线PLC设备连接"
FontFamily="楷体"
FontSize="20"
VerticalAlignment="Center"
Foreground="Aqua"
IsChecked="{Binding HKPlcConnect}"/>

</StackPanel>
<Grid Grid.Row="1" Grid.Column="1" VerticalAlignment="Top">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="37*" ></ColumnDefinition>
<ColumnDefinition Width="163*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<WrapPanel Grid.ColumnSpan="2" Margin="0,0,0,38">
<TextBlock Margin="10" FontSize="16" Foreground="Aqua" Text="调速电机速度(进桶侧)" />
<TextBox Width="50" Margin="10" FontSize="16" Text="{Binding AxisLoadSpeed}"/>
<TextBlock FontSize="16" Foreground="Aqua" Text="" />
</WrapPanel>
<WrapPanel Grid.ColumnSpan="2" Margin="0,42,0,75" Grid.RowSpan="2">
<TextBlock Margin="10" FontSize="16" Foreground="Aqua" Text="调速电机速度(过渡侧)" />
<TextBox Width="50" Margin="10" FontSize="16" Text="{Binding AxisMidSpeed}" />
<TextBlock FontSize="16" Foreground="Aqua" Text="" />
</WrapPanel>
<WrapPanel Grid.Row="1" Grid.ColumnSpan="2" Margin="0,5,0,33">
<TextBlock Margin="10" FontSize="16" Foreground="Aqua" Text="调速电机速度(出桶侧)" />
<TextBox Width="50" Margin="10" FontSize="16" Text="{Binding AxisUnLoadSpeed}" />
<TextBlock FontSize="16" Foreground="Aqua" Text="" />
</WrapPanel>
<WrapPanel Grid.Row="1" Grid.ColumnSpan="2" Margin="0,47,0,71" Grid.RowSpan="2">
<TextBlock Margin="10" FontSize="16" Foreground="Aqua" Text="伺服1速度(进桶侧)" />
<TextBox Width="50" Margin="10" FontSize="16" Text="{Binding Axis1Speed}" />
<TextBlock FontSize="16" Foreground="Aqua" Text="" />
</WrapPanel>
<WrapPanel Grid.Row="2" Grid.ColumnSpan="2" Margin="0,9,0,28" >
<TextBlock Margin="10" FontSize="16" Foreground="Aqua" Text="伺服2速度(出桶侧)" />
<TextBox Width="50" Margin="10" FontSize="16" Text="{Binding Axis2Speed}" />
<TextBlock FontSize="16" Foreground="Aqua" Text="" />
</WrapPanel>
</Grid>
</Grid>
</UserControl>

+ 28
- 0
BPASmartClient.JXJFoodSmallStation/View/SystemParView.xaml.cs Datei anzeigen

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.JXJFoodSmallStation.View
{
/// <summary>
/// DeviceMaterialParView.xaml 的交互逻辑
/// </summary>
public partial class SystemParView : UserControl
{
public SystemParView()
{
InitializeComponent();
}
}
}

+ 88
- 12
BPASmartClient.JXJFoodSmallStation/ViewModel/ManualControlViewModel.cs Datei anzeigen

@@ -7,6 +7,10 @@ using Microsoft.Toolkit.Mvvm.ComponentModel;
using System.Collections.ObjectModel;
using Microsoft.Toolkit.Mvvm.Input;
using BPASmartClient.Helper;
using BPASmartClient.JXJFoodSmallStation.Model;
using System.Threading;
using System.ComponentModel;
using System.Runtime.CompilerServices;

namespace BPASmartClient.JXJFoodSmallStation.ViewModel
{
@@ -14,6 +18,26 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
{
public ManualControlViewModel()
{
ThreadManage.GetInstance().StartLong(new Action(() =>
{
SystemMode = GVL_SmallStation.SystemMode ? "自动" : "手动";
if (GVL_SmallStation.SystemStatus)
{
if (GVL_SmallStation.SystemRunStatus)
{
SystemStatus = "暂停";
}
else
{
SystemStatus = "运行";
}
}
else
{
SystemStatus = "停止";
}
Thread.Sleep(200);
}), "获取系统状态", true);
for (int i = 0; i < 15; i++)
{
cylinderModels.Add(new CylinderModel()
@@ -30,7 +54,6 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
RightTog = false,
});
}

for (int i = 1; i < 3; i++)
{
PalletCylinders.Add(new CylinderModel()
@@ -40,7 +63,6 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
RightTog = false,
});
}

for (int i = 1; i < 3; i++)
{
PalletCylinders.Add(new CylinderModel()
@@ -50,14 +72,12 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
RightTog = false,
});
}

PalletCylinders.Add(new CylinderModel()
{
Name = $"进料桶顶升气缸",
LeftTog = false,
RightTog = false,
});
for (int i = 0; i < 3; i++)
{
PalletCylinders.Add(new CylinderModel()
@@ -67,17 +87,55 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
RightTog = false,
});
}

Open = new RelayCommand<object>((o) =>
{
ActionManage.GetInstance.Send("ManualOpen", o);
});


Close = new RelayCommand<object>((o) =>
{
ActionManage.GetInstance.Send("ManualClose", o);
});
StartAxisLoadCommand = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("StartAxisLoadCommand");
});
StopAxisLoadCommand = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("StopAxisLoadCommand");
});
StartAxisMidCommand = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("StartAxisMidCommand");
});
StopAxisMidCommand = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("StopAxisMidCommand");
});
StartAxisUnLoadCommand = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("StartAxisUnLoadCommand");
});
StopAxisUnLoadCommand = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("StopAxisUnLoadCommand");
});
StartAxis1Command = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("StartAxis1Command");
});
StopAxis1Command = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("StopAxis1Command");
});
StartAxis2Command = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("StartAxis2Command");
});
StopAxis2Command = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("StopAxis2Command");
});

SystemStartCommand = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("SystemStart");
@@ -94,7 +152,6 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
{
ActionManage.GetInstance.Send("SystemReset");
});

DebugMode = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("SystemDebugMode");
@@ -119,16 +176,39 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
/// 托盘气缸
/// </summary>
public ObservableCollection<CylinderModel> PalletCylinders { get; set; } = new ObservableCollection<CylinderModel>();
public static string SystemMode { get { return _mSystemMode; } set { _mSystemMode = value; OnStaticPropertyChanged(); } }
private static string _mSystemMode =String.Empty;


public static string SystemStatus { get { return _mSystemStatus; } set { _mSystemStatus = value; OnStaticPropertyChanged(); } }
private static string _mSystemStatus;
public static event EventHandler<PropertyChangedEventArgs> StaticPropertyChanged;
private static void OnStaticPropertyChanged([CallerMemberName] string PropName = "")
{
StaticPropertyChanged?.Invoke(null, new PropertyChangedEventArgs(PropName));
}
public RelayCommand<object> Open { get; set; }

public RelayCommand<object> Close { get; set; }

//五个电机手动控制
public RelayCommand StartAxisLoadCommand { get; set; }
public RelayCommand StopAxisLoadCommand { get; set; }
public RelayCommand StartAxisMidCommand { get; set; }
public RelayCommand StopAxisMidCommand { get; set; }
public RelayCommand StartAxisUnLoadCommand { get; set; }
public RelayCommand StopAxisUnLoadCommand { get; set; }
public RelayCommand StartAxis1Command { get; set; }
public RelayCommand StopAxis1Command { get; set; }
public RelayCommand StartAxis2Command { get; set; }
public RelayCommand StopAxis2Command { get; set; }

public RelayCommand SystemStartCommand { get; set; }
public RelayCommand SystemStopCommand { get; set; }
public RelayCommand SystemPauseCommand { get; set; }


public RelayCommand SystemResetCommand { get; set; }

public RelayCommand AutoMode { get; set; }
@@ -138,7 +218,6 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel

public class CylinderModel : ObservableObject
{

public bool LeftTog { get { return _mLeftTog; } set { _mLeftTog = value; OnPropertyChanged(); } }
private bool _mLeftTog;

@@ -147,8 +226,5 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel

public string Name { get { return _mName; } set { _mName = value; OnPropertyChanged(); } }
private string _mName;



}
}

+ 15
- 2
BPASmartClient.JXJFoodSmallStation/ViewModel/ManualFlowViewModel.cs Datei anzeigen

@@ -14,6 +14,8 @@ using System.Diagnostics;
using BPASmartClient.JXJFoodSmallStation.Model.Siemens;
using BPASmartClient.JXJFoodSmallStation.Model.HK_PLC;
using System.Threading;
using System.ComponentModel;
using System.Runtime.CompilerServices;

namespace BPASmartClient.JXJFoodSmallStation.ViewModel
{
@@ -41,6 +43,10 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
{
GVL_SmallStation.WindSendAllowAGVPutGet = true;
});
Test6Command = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("AGVPutTrayFinish");
});
CLearRecipeInfo = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("CLearRecipeInfo");
@@ -60,9 +66,16 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
public RelayCommand Test3Command { get; set; }
public RelayCommand Test4Command { get; set; }
public RelayCommand Test5Command { get; set; }
public bool Heartbeat { get { return _mHeartbeat; } set { _mHeartbeat = value; OnPropertyChanged(); } }
private bool _mHeartbeat;

public RelayCommand Test6Command { get; set; }
public static bool Heartbeat { get { return _mHeartbeat; } set { _mHeartbeat = value; OnStaticPropertyChanged(); } }
private static bool _mHeartbeat;

public static event EventHandler<PropertyChangedEventArgs> StaticPropertyChanged;
public static void OnStaticPropertyChanged([CallerMemberName] string PropName = "")
{
StaticPropertyChanged?.Invoke(null, new PropertyChangedEventArgs(PropName));
}
public RelayCommand CLearRecipeInfo { get; set; }
public RelayCommand SystemReset { get; set; }
}


+ 82
- 48
BPASmartClient.JXJFoodSmallStation/ViewModel/NewLocalRecipeViewModel.cs Datei anzeigen

@@ -29,28 +29,40 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
TrayNum = rm.TrayCode;
foreach (var item in rm.RawMaterial)
{
RawMaterial.Add(item);
AllRawMaterial.Add(item);
}
foreach (var item1 in rm.WindSend)
{
AllRawMaterial.Add(new RemoteRecipeRawMaterial()
{
RawMaterialType = "粉料",
RawMaterialName = item1.RawMaterialName,
RawMaterialWeight = item1.RawMaterialWeight,
RawMaterialBarrelNum = 3,
});
}
}
}), "LocalRecipeEdit");
RemoveCommand = new RelayCommand<object>((o) =>
{
var res = RawMaterial.FirstOrDefault(p => p.RawMaterialLocation == (int)o);
if (res != null) RawMaterial.Remove(res);
var res = AllRawMaterial.FirstOrDefault(p => p.RawMaterialLocation == (int)o);
if (res != null) AllRawMaterial.Remove(res);
//NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"{o.ToString()}:原料删除成功!");
});

AddCommand = new RelayCommand(() =>
{
int MaxRawMaterial = 15;
if (RawMaterial.Count < MaxRawMaterial)
var res = AllRawMaterial.Where(p => p.RawMaterialType == "小料").ToList();
if (res.Count < MaxRawMaterial)
{
RawMaterial.Add(new RemoteRecipeRawMaterial()
AllRawMaterial.Add(new RemoteRecipeRawMaterial()
{
RawMaterialName = "原料" + (RawMaterial.Count + 1),
RawMaterialLocation = RawMaterial.Count + 1,
RawMaterialBarrelNum = 1,
RawMaterialWeight = 1
RawMaterialType = "小料",
RawMaterialName = "小料" + (res.Count + 1),
RawMaterialLocation = res.Count + 1,
RawMaterialBarrelNum = (short)new Random().Next(6,9),
RawMaterialWeight = (float)(new Random().Next(100, 300)*0.001),
});
}
else
@@ -62,20 +74,22 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
AddFLCommand = new RelayCommand(() =>
{
int MaxRawMaterial = 5;
if (WindSendRawMaterial.Count < MaxRawMaterial)
var res = AllRawMaterial.Where(p => p.RawMaterialType == "粉料").ToList();
if (res.Count < MaxRawMaterial)
{
WindSendRawMaterial.Add(new WindSendRawMaterial()
AllRawMaterial.Add(new RemoteRecipeRawMaterial()
{
RawMaterialName = "粉料" + (RawMaterial.Count + 1 ),
RawMaterialWeight = 1
RawMaterialType = "粉料",
RawMaterialName = "粉料" + (res.Count + 1),
RawMaterialLocation = res.Count + 1,
RawMaterialWeight = new Random().Next(1, 5),
RawMaterialBarrelNum = 3,
});
}
else
{
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"料最多添加{MaxRawMaterial}种");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"料最多添加{MaxRawMaterial}种");
}

});
SaveCommand = new RelayCommand(() =>
{
@@ -95,41 +109,56 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
}
ObservableCollection<RemoteRecipeRawMaterial> RawMaterials = new ObservableCollection<RemoteRecipeRawMaterial>();
ObservableCollection<WindSendRawMaterial> WindSendRawMaterials = new ObservableCollection<WindSendRawMaterial>();
if (RawMaterial == null || RawMaterial.Count <= 0)
if (AllRawMaterial == null || AllRawMaterial.Count <= 0)
{
NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", $"没有可保存的参数!");
return;
}
for (int i = 0; i < RawMaterial.Count; i++)
var res = AllRawMaterial.Where(p => p.RawMaterialType == "小料").ToList();
for (int i = 0; i < res.Count; i++)
{
if (RawMaterial.Where(p => p.RawMaterialLocation == RawMaterial.ElementAt(i).RawMaterialLocation)?.ToList()?.Count >= 2)
if (res.Where(p => p.RawMaterialLocation == res.ElementAt(i).RawMaterialLocation)?.ToList()?.Count >= 2)
{
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "错误", $"原料位置冲突,请检查后重试!");
return;
}
}
var res1 = AllRawMaterial.Where(p => p.RawMaterialType == "粉料").ToList();
for (int i = 0; i < res1.Count; i++)
{
if (res1.Where(p => p.RawMaterialLocation == res1.ElementAt(i).RawMaterialLocation)?.ToList()?.Count >= 2)
{
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "错误", $"粉料位置冲突,请检查后重试!");
return;
}
}
int index = Array.FindIndex(Json<LocalRecipeDataColl>.Data.Recipes.ToArray(), p => p.RecipeCode == RecipeCode);
if (index >= 0)
{
foreach (var item in RawMaterial)
foreach (var item in AllRawMaterial)
{
RawMaterials.Add(new RemoteRecipeRawMaterial()
if (item.RawMaterialType == "小料")
{
RawMaterialLocation = item.RawMaterialLocation,
RawMaterialBarrelNum = item.RawMaterialBarrelNum,
RawMaterialWeight = item.RawMaterialWeight,
});
RawMaterials.Add(new RemoteRecipeRawMaterial()
{
RawMaterialName = item.RawMaterialName,
RawMaterialType = item.RawMaterialType,
RawMaterialLocation = item.RawMaterialLocation,
RawMaterialBarrelNum = item.RawMaterialBarrelNum,
RawMaterialWeight = item.RawMaterialWeight,
});
}
}
foreach (var item in WindSendRawMaterial)
foreach (var item in AllRawMaterial)
{
WindSendRawMaterials.Add(new WindSendRawMaterial()
if (item.RawMaterialType == "粉料")
{
RawMaterialName = item.RawMaterialName,
RawMaterialWeight=item.RawMaterialWeight,
});

WindSendRawMaterials.Add(new WindSendRawMaterial()
{
RawMaterialName = item.RawMaterialName,
RawMaterialWeight = item.RawMaterialWeight,
});
}
}
Json<LocalRecipeDataColl>.Data.Recipes.ElementAt(index).RecipeName= RecipeName;
Json<LocalRecipeDataColl>.Data.Recipes.ElementAt(index).TrayCode = TrayNum;
@@ -140,23 +169,30 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
}
else
{
foreach (var item in RawMaterial)
foreach (var item in AllRawMaterial)
{
RawMaterials.Add(new RemoteRecipeRawMaterial()
if (item.RawMaterialType == "小料")
{
RawMaterialLocation = item.RawMaterialLocation,
RawMaterialBarrelNum = item.RawMaterialBarrelNum,
RawMaterialWeight = item.RawMaterialWeight,
});
RawMaterials.Add(new RemoteRecipeRawMaterial()
{
RawMaterialName = item.RawMaterialName,
RawMaterialType = item.RawMaterialType,
RawMaterialLocation = item.RawMaterialLocation,
RawMaterialBarrelNum = item.RawMaterialBarrelNum,
RawMaterialWeight = item.RawMaterialWeight,
});
}
}
foreach (var item in WindSendRawMaterial)
foreach (var item in AllRawMaterial)
{
WindSendRawMaterials.Add(new WindSendRawMaterial()
if (item.RawMaterialType == "粉料")
{
RawMaterialName = item.RawMaterialName,
RawMaterialWeight = item.RawMaterialWeight,
});

WindSendRawMaterials.Add(new WindSendRawMaterial()
{
RawMaterialName = item.RawMaterialName,
RawMaterialWeight = item.RawMaterialWeight,
});
}
}
Json<LocalRecipeDataColl>.Data.Recipes.Add(new RemoteRecipeData()
{
@@ -183,9 +219,7 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } }
private string _mErrorInfo;

public ObservableCollection<RemoteRecipeRawMaterial> RawMaterial { get; set; } = new ObservableCollection<RemoteRecipeRawMaterial>();

public ObservableCollection<WindSendRawMaterial> WindSendRawMaterial { get; set; } = new ObservableCollection<WindSendRawMaterial>();
public ObservableCollection<RemoteRecipeRawMaterial> AllRawMaterial { get; set; } = new ObservableCollection<RemoteRecipeRawMaterial>();

public RelayCommand<object> RemoveCommand { get; set; }



+ 6
- 5
BPASmartClient.JXJFoodSmallStation/ViewModel/RecipeReceiveViewModel.cs Datei anzeigen

@@ -29,7 +29,6 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
{
IsUseLocalRecipe = GVL_SmallStation.GetInstance.IsUseLocalRecipe;
IsUseWindSendDosing = GVL_SmallStation.GetInstance.IsUseWindSend;
//Json<LocaPar>.Read();
Recipes = Json<LocalRecipeDataColl>.Data.Recipes;
NewRecipe = new RelayCommand(() =>
@@ -104,14 +103,15 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
goto go;
}
}
int trayCode = new Random().Next(1, 3);
int trayCode = new Random().Next(1, 2);
for (int i = 1; i < 16; i++)
{
RawMaterials.Add(new RemoteRecipeRawMaterial()
{
RawMaterialName = "原料" + i,
RawMaterialType = "小料",
RawMaterialWeight = (float)Math.Round(new Random().Next(200, 300) * 0.001 ,3),
RawMaterialBarrelNum = (short)new Random().Next(1, 4),
RawMaterialBarrelNum = (short)new Random().Next(6, 9),
RawMaterialLocation = i,
});
}
@@ -122,9 +122,10 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
RawMaterials.Add(new RemoteRecipeRawMaterial()
{
RawMaterialName = "粉料" + i,
RawMaterialWeight = new Random().Next(200, 300),
RawMaterialType = "粉料",
RawMaterialWeight = new Random().Next(1, 6),
RawMaterialLocation = i,
RawMaterialBarrelNum = 7
RawMaterialBarrelNum = 3
});
}
}


+ 80
- 0
BPASmartClient.JXJFoodSmallStation/ViewModel/SystemParViewModel.cs Datei anzeigen

@@ -0,0 +1,80 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System.Collections.ObjectModel;
using BPASmartClient.JXJFoodSmallStation.Model;
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.Input;
using BPASmartClient.CustomResource.UserControls.MessageShow;
using BPASmartClient.CustomResource.UserControls;
using System.Diagnostics;
using BPASmartClient.JXJFoodSmallStation.Model.WindSend;
using BPASmartClient.JXJFoodSmallStation.Model.Par;

namespace BPASmartClient.JXJFoodSmallStation.ViewModel
{
public class SystemParViewModel : ObservableObject
{
public SystemParViewModel()
{
SiemensConnect = Json<DevicePar>.Data.deviceConnectPar.SiemensConnect;
WindSendConnect = Json<DevicePar>.Data.deviceConnectPar.WindSendConnect;
HKPlcConnect = Json<DevicePar>.Data.deviceConnectPar.HKPlcConnect;
AxisLoadSpeed = Json<DevicePar>.Data.deviceConnectPar.AxisLoadSpeed;
AxisMidSpeed = Json<DevicePar>.Data.deviceConnectPar.AxisMidSpeed;
AxisUnLoadSpeed = Json<DevicePar>.Data.deviceConnectPar.AxisUnLoadSpeed;
AxisMidSpeed = Json<DevicePar>.Data.deviceConnectPar.AxisMidSpeed;
Axis1Speed = Json<DevicePar>.Data.deviceConnectPar.Axis1Speed;
Axis2Speed = Json<DevicePar>.Data.deviceConnectPar.Axis2Speed;
SaveCommand = new RelayCommand(() =>
{
Json<DevicePar>.Data.deviceConnectPar.SiemensConnect = SiemensConnect;
Json<DevicePar>.Data.deviceConnectPar.WindSendConnect = WindSendConnect;
Json<DevicePar>.Data.deviceConnectPar.HKPlcConnect = HKPlcConnect;
Json<DevicePar>.Data.deviceConnectPar.AxisLoadSpeed = AxisLoadSpeed;
Json<DevicePar>.Data.deviceConnectPar.AxisMidSpeed = AxisMidSpeed;
Json<DevicePar>.Data.deviceConnectPar.AxisUnLoadSpeed = AxisUnLoadSpeed;
Json<DevicePar>.Data.deviceConnectPar.AxisMidSpeed = AxisMidSpeed;
Json<DevicePar>.Data.deviceConnectPar.Axis1Speed = Axis1Speed;
Json<DevicePar>.Data.deviceConnectPar.Axis2Speed = Axis2Speed;
Json<DevicePar>.Save();
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"参数保存成功!");
});
SetParCommand = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("AxisLoadSpeedSet", AxisLoadSpeed);
ActionManage.GetInstance.Send("AxisMidSpeedSet", AxisMidSpeed);
ActionManage.GetInstance.Send("AxisUnLoadSpeedSet", AxisUnLoadSpeed);
ActionManage.GetInstance.Send("Axis1SpeedSet", Axis1Speed);
ActionManage.GetInstance.Send("Axis2SpeedSet", Axis2Speed);
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"参数设置成功!");
});
}

public ConnectParMode CommBaseParModel { get { return Json<DevicePar>.Data.deviceConnectPar; } set { Json<DevicePar>.Data.deviceConnectPar = value; OnPropertyChanged(); } }

public bool SiemensConnect { get { return _mSiemensConnect; } set { _mSiemensConnect = value; OnPropertyChanged(); } }
private bool _mSiemensConnect;
public bool WindSendConnect { get { return _mWindSendConnect; } set { _mWindSendConnect = value; OnPropertyChanged(); } }
private bool _mWindSendConnect;
public bool HKPlcConnect { get { return _mHKPlcConnect; } set { _mHKPlcConnect = value; OnPropertyChanged(); } }
private bool _mHKPlcConnect;

public short AxisLoadSpeed { get { return _mAxisLoadSpeed; } set { _mAxisLoadSpeed = value; OnPropertyChanged(); } }
private short _mAxisLoadSpeed;
public short AxisMidSpeed { get { return _mAxisMidSpeed; } set { _mAxisMidSpeed = value; OnPropertyChanged(); } }
private short _mAxisMidSpeed;
public short AxisUnLoadSpeed { get { return _mAxisUnLoadSpeed; } set { _mAxisUnLoadSpeed = value; OnPropertyChanged(); } }
private short _mAxisUnLoadSpeed;
public float Axis1Speed { get { return _mAxis1Speed; } set { _mAxis1Speed = value; OnPropertyChanged(); } }
private float _mAxis1Speed;
public float Axis2Speed { get { return _mAxis2Speed; } set { _mAxis2Speed = value; OnPropertyChanged(); } }
private float _mAxis2Speed;
public RelayCommand SaveCommand { get; set; }
public RelayCommand SetParCommand { get; set; }
}
}

+ 5
- 5
BPASmartClient.Lebai/LebaiRobot.cs Datei anzeigen

@@ -50,11 +50,11 @@ namespace BPASmartClient.Lebai
status["RobotValue"] = LebaiHelper.GetInstance().GetValueAsync().Value;
if (LebaiHelper.GetInstance().robotData != null) status["RobotMode"] =(ELebaiRModel)LebaiHelper.GetInstance().robotData.RobotMode.Mode;
status["RobotValue1"] = LebaiHelper.GetInstance().GetValueAsync(1).Value;
status["LeibaiGetTcpInput"] = LebaiHelper.GetInstance().GetTcpInput();
status["LeibaiGetInput1"] = LebaiHelper.GetInstance().GetInput(1);
status["LeibaiGetInput2"] = LebaiHelper.GetInstance().GetInput(2);
status["LeibaiGetInput3"] = LebaiHelper.GetInstance().GetInput(3);
status["LeibaiGetInput4"] = LebaiHelper.GetInstance().GetInput(4);
status["LeibaiGetTcpInput"] = LebaiHelper.GetInstance().GetTcpInput(0);
status["LeibaiGetInput1"] = LebaiHelper.GetInstance().GetInput(0);
status["LeibaiGetInput2"] = LebaiHelper.GetInstance().GetInput(1);
status["LeibaiGetInput3"] = LebaiHelper.GetInstance().GetInput(2);
status["LeibaiGetInput4"] = LebaiHelper.GetInstance().GetInput(3);
if (LebaiHelper.GetInstance().robotData != null) status["RobotMode"] = LebaiHelper.GetInstance().robotData.RobotMode.Mode;
LebaiHelper.GetInstance().GetRobotModeStatus();
Thread.Sleep(10);


+ 15
- 1
BPASmartClient.Modbus/ModbusTcp.cs Datei anzeigen

@@ -140,7 +140,21 @@ namespace BPASmartClient.Modbus
}
}
}

else if (address.ToUpper().Contains("I") && address.Length >= 2)
{
var res = address.Substring(1).Split('.');
if (res != null && res.Length == 2)
{
if (int.TryParse(res[0], out int firstAddress) && int.TryParse(res[1], out int ExitAddress))
{
if (ExitAddress >= 0 && ExitAddress <= 7)
{
return (firstAddress * 8) + ExitAddress;
}
}
}
}
else if (address.ToUpper().Contains("GI") && address.Length >= 3)
{
var res = address.Remove(0, 2);


+ 34
- 16
BPASmartClient.MorkF/Control_MorkF.cs Datei anzeigen

@@ -161,7 +161,7 @@ namespace BPASmartClient.MorkF
/// <summary>
/// 是否为本地炒菜模式,默认为联网的
/// </summary>
private bool isLocalFryingMode { get; set; } = false;
private bool isLocalFryingMode { get; set; } = true;

/// <summary>
/// 入口
@@ -201,7 +201,7 @@ namespace BPASmartClient.MorkF
MaterialCoordinate.GetInstance().frying2 = materialCoordinate.frying2;
MaterialCoordinate.GetInstance().materialHeight = materialCoordinate.materialHeight;
MaterialCoordinate.GetInstance().MaterialOneX = materialCoordinate.MaterialOneX;
MaterialCoordinate.GetInstance().MaterialTwoX = materialCoordinate.MaterialTwoX;
MaterialCoordinate.GetInstance().MaterialTwoX = materialCoordinate.MaterialTwoX;
MaterialCoordinate.GetInstance().MaterialThreeX = materialCoordinate.MaterialThreeX;
}
////菜品库编号与坐标系对象存储
@@ -371,6 +371,17 @@ namespace BPASmartClient.MorkF
}
}), 2);

//抓手初始化完成
GetStatus("I0.1", new Action<object>((objects) =>
{
if (objects is bool[] bools && bools.Length > 2)
{
ml_morkf.PawPositon_1 = bools[0];
ml_morkf.PawPositon_2 = bools[1];
ml_morkf.PawPositon_3 = bools[2];
}
}), 2);

}

public override void Stop()
@@ -1041,8 +1052,9 @@ namespace BPASmartClient.MorkF
return false;
}

//MessageLog.GetInstance.Show("爪子去到2号位");
MaterailLibrary_Write("M1.1", true);
//MessageLog.GetInstance.Show("爪子去到2号位");


Thread.Sleep(500);

@@ -1055,7 +1067,7 @@ namespace BPASmartClient.MorkF
return false;
}
}
Thread.Sleep(300);

//MessageLog.GetInstance.Show("爪子去到2号位完成");
@@ -1084,7 +1096,11 @@ namespace BPASmartClient.MorkF
return false;
}
}

if (!ml_morkf.PawPositon_3)
{
MaterailLibrary_Write("M1.2", true);
Thread.Sleep(3000);
}
Thread.Sleep(300);

//MessageLog.GetInstance.Show("爪子去到3号位完成");
@@ -1358,8 +1374,9 @@ namespace BPASmartClient.MorkF
Thread.Sleep(1000);

//获取传感器的距离,转换成坐标系的点
int laserHigh = ml_morkf.LaserDistance;
//int laserHigh = ml_morkf.LaserDistance;

int laserHigh = 400;
//秦工要求读取后置0
WriteDistance(0);

@@ -1379,7 +1396,7 @@ namespace BPASmartClient.MorkF
}

//设置到传感器感应的距离处
if (!SetArmPosition(x - moveX, y))
if (!SetArmPosition(x, y))
{
return false;
}
@@ -1436,6 +1453,7 @@ namespace BPASmartClient.MorkF
MessageLog.GetInstance.ShowEx("错误:未设置当前菜品库出菜位置");
return false;
}

//爪子去2号位放菜
if (!PawToPoint2())
@@ -1444,12 +1462,12 @@ namespace BPASmartClient.MorkF
}

WriteSpeed(50000);
ThreadManage.GetInstance().Start(new Action(() =>
{
//收缩爪子
PawShrink();
}), "GetMaterialPawShrink");
//ThreadManage.GetInstance().Start(new Action(() =>
//{
// //收缩爪子
// PawShrink();
//}), "GetMaterialPawShrink");
PawShrink();

//判断炒锅是否可以放盒
for (int i = 0; materialSleepCount > i && !morkFs[fryIndex].FryPot1_HOBTPut; i++)
@@ -1465,7 +1483,7 @@ namespace BPASmartClient.MorkF
//关闭启磁吸
MagnetOff(fryNum);

Thread.Sleep(200);
//Thread.Sleep(2000);

//根据炒锅不同设置不同的出菜处
if (fryNum % 2 == 0)
@@ -1494,7 +1512,7 @@ namespace BPASmartClient.MorkF
//开启磁吸
MagnetOn(fryNum);

Thread.Sleep(200);
Thread.Sleep(500);

//设置到炒锅1出菜处
if (!SetArmPosition(x, y))
@@ -1962,7 +1980,7 @@ namespace BPASmartClient.MorkF
//搅拌设置为1档
SetStir(new List<int> { 1 }, i);
//火力设置为2档
SetFire(new List<int> { 1 }, num);
SetFire(new List<int> { 3 }, num);
}
Thread.Sleep(materialSleepTime);
if (i >= materialSleepCount * 2 - 1)


+ 4
- 0
BPASmartClient.MorkF/ML_MorkF.cs Datei anzeigen

@@ -109,6 +109,10 @@ namespace BPASmartClient.MorkF
_PawArrivePortThree = value;
}
}

public bool PawPositon_1 { get; set; }
public bool PawPositon_2 { get; set; }
public bool PawPositon_3 { get; set; }
#endregion

#region


+ 1
- 1
BPASmartClient.MorkS/Control_Morks.cs Datei anzeigen

@@ -34,7 +34,7 @@ namespace BPASmartClient.MorkS

public override void DoMain()
{
MonitorViewModel.DeviceId = DeviceId;
MonitorViewModel.DeviceId = DeviceId;
ServerInit();
DataParse();
Json<MorksPar>.Read();


+ 60
- 769
BPASmartClient.MorkT_Container/Control_MorkT_Container.cs Datei anzeigen

@@ -24,16 +24,6 @@ using System.Text.RegularExpressions;

namespace BPASmartClient.MorkT_Container
{
/*
* 冰淇淋咖啡机组合套装
* 物料位置:
* 1:冰淇料
* 2:冰淇淋杯
* 5:咖啡
* 6:咖啡杯
* 9: 茶
* 10: 茶杯
*/
public class Control_MorkT_Container : BaseDevice
{
private Dictionary<string, PolymerBatching> batchings = new Dictionary<string, PolymerBatching>();
@@ -44,14 +34,6 @@ namespace BPASmartClient.MorkT_Container
public override global::BPA.Message.Enum.DeviceClientType DeviceType { get { return BPA.Message.Enum.DeviceClientType.MORKT; } }

GVL_MorkT morkTLebaiJC =new GVL_MorkT();
/// <summary>
/// 果汁机做法,true:热饮,false:冷饮
/// </summary>
private bool GuMake = false;
/// <summary>
/// 订单是否加冰
/// </summary>
private bool IsAddIce = false;
public override void DoMain()
{
if (Json<KeepDataBase>.Data.IsVerify)
@@ -77,7 +59,6 @@ namespace BPASmartClient.MorkT_Container
}
private void DataParse()
{
EventBus.EventBus.GetInstance().Subscribe<DoOrderEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBackHandle)
{
if (@event == null) return;
@@ -125,44 +106,6 @@ namespace BPASmartClient.MorkT_Container
});
}
break;
case GOODS_TYPE.JUICE:
if (morkTLebaiJC.morkOrderPushesJuicer.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null)
{
morkTLebaiJC.morkOrderPushesJuicer.Enqueue(new OrderLocInfo()
{
SuborderId = order.MorkOrder.SuborderId,
BatchingId = res.BatchingId,
Loc = ushort.Parse(mainMaterialLoc),
GoodName = order.MorkOrder.GoodsName,
makeID = order.MorkOrder.MakeID,
});
}
break;
case GOODS_TYPE.TEA:
if (morkTLebaiJC.morkOrderPushesTea.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null)
{
morkTLebaiJC.morkOrderPushesTea.Enqueue(new OrderLocInfo()
{
SuborderId = order.MorkOrder.SuborderId,
BatchingId = res.BatchingId,
Loc = ushort.Parse(mainMaterialLoc),
GoodName = order.MorkOrder.GoodsName,
});
}
break;
case GOODS_TYPE.WATER:
if (morkTLebaiJC.morkOrderPushesWater.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null)
{
morkTLebaiJC.morkOrderPushesWater.Enqueue(new OrderLocInfo()
{
SuborderId = order.MorkOrder.SuborderId,
BatchingId = res.BatchingId,
Loc = ushort.Parse(mainMaterialLoc),
GoodName = order.MorkOrder.GoodsName,
});
}
break;
case GOODS_TYPE.NEITHER:
DeviceProcessLogShow("未知的商品类型");
break;
@@ -175,19 +118,15 @@ namespace BPASmartClient.MorkT_Container
/// <summary>
/// 将空杯放好到接饮料的地方的标志位
/// </summary>
private bool bFirstTrig_TeaWater = false;
private bool bFirstTrig_Coffee = false;
private bool bFirstTrig_Juice = false;
/// <summary>
/// 延迟的超时时间
/// </summary>
DateTime delayTimeOut_Water;
DateTime delayTimeOut_Coffee;
DateTime delayTimeOut_Juice;
public override void MainTask()
{
if (morkTLebaiJC.morkOrderPushesCoffee.Count > 0 && morkTLebaiJC.IsHaveCoffeeCup)
{
{
EventBus.EventBus.GetInstance().Subscribe<DRCoffee_CoffeEndCookEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
{
if (morkTLebaiJC.IsHaveCoffeeCup && morkTLebaiJC.MakeCoffeeEnd != true)
@@ -207,67 +146,12 @@ namespace BPASmartClient.MorkT_Container
{
DeviceProcessLogShow("接咖啡超时,接咖啡结束,等待取咖啡");
bFirstTrig_Coffee = false;
if (morkTLebaiJC.IsHaveCoffeeCup)
morkTLebaiJC.MakeCoffeeEnd = true;
}
}
}
if (morkTLebaiJC.morkOrderPushesJuicer.Count > 0 && morkTLebaiJC.IsHaveJuiceCup)
{
if (morkTLebaiJC.IsHaveJuiceCup && morkTLebaiJC.MakeJuiceEnd != true)
{
var Juicestate = GetStatus<int[]>("GetDeviceStatus");
if (Juicestate != null)
{
if (Juicestate.Length > 0)
{
var Juicestate1 = Convert.ToString(Juicestate[0], 2);
var Juicestate2 = Juicestate[1];
if (Juicestate1.IndexOf("0") == 1 && Juicestate2 == 0)
{
morkTLebaiJC.MakeJuiceEnd = true;
bFirstTrig_Juice = false;
}
}
}
if (!morkTLebaiJC.MakeJuiceEnd)
{
//若无状态返回 则加延迟
if (!bFirstTrig_Juice)
{
bFirstTrig_Juice = true;
delayTimeOut_Juice = DateTime.Now;
}
else if (DateTime.Now.Subtract(delayTimeOut_Juice).TotalSeconds > 15 && bFirstTrig_Juice == true)
{
DeviceProcessLogShow("接果汁超时,接果汁结束,等待取果汁");
bFirstTrig_Juice = false;
morkTLebaiJC.MakeJuiceEnd = true;
}
}
}
}
if ((morkTLebaiJC.morkOrderPushesTea.Count > 0 || morkTLebaiJC.morkOrderPushesWater.Count > 0) && morkTLebaiJC.IsHaveTeaWaterCup)
{
if (morkTLebaiJC.IsHaveTeaWaterCup && morkTLebaiJC.MakeTeaEnd != true)
{
if (!bFirstTrig_TeaWater)
{
bFirstTrig_TeaWater = true;
delayTimeOut_Water = DateTime.Now;//开启接水信号后,记录当前时间
}
else if (DateTime.Now.Subtract(delayTimeOut_Water).TotalSeconds >= 50 && bFirstTrig_TeaWater == true)//接水超过50s后,启动接水完成标志,开启接水程序
{
DeviceProcessLogShow("接茶或水延迟时间结束");
bFirstTrig_TeaWater = false;
morkTLebaiJC.MakeTeaEnd = true;
morkTLebaiJC.MakeCoffeeEnd = true;
}
}
}
DoCoffee();
DoJuice();
DoBoiledTea();
DoBoiledWater();
}

/// <summary>
@@ -299,7 +183,8 @@ namespace BPASmartClient.MorkT_Container
{
Thread.Sleep(5);
}
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();

EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }, (o) => { });
}
/// <summary>
/// 乐白的场景
@@ -318,23 +203,7 @@ namespace BPASmartClient.MorkT_Container
{
new LebaiRobot_SetOutPutEvent { DeviceId = DeviceId, Pin = pin,Value=value }.Publish();
}
private T GetStatus<T>(string key)
{
if (peripheralStatus.ContainsKey(key))
{
if (peripheralStatus[key] != null)
{
return (T)(peripheralStatus[key]);
}
}
return default;
}
int[] devStatusBy = new int[2] { 0, 0 };
bool outCupCheck = false;//放纸杯位置有无判断
/// <summary>
/// 传感器的输入信号 0:无意义 1:有信号 2:无信号 3:信号不正确
/// </summary>
int bSensorInput;
/// <summary>
/// 判断是否有咖啡订单
@@ -346,33 +215,6 @@ namespace BPASmartClient.MorkT_Container
return bMake;
}
/// <summary>
/// 判断是否有果汁订单
/// </summary>
/// <returns></returns>
private bool IsMakeJuice()
{
bool bMake = (IsHealth && morkTLebaiJC.morkOrderPushesJuicer.Count > 0 && !morkTLebaiJC.IsHaveJuiceCup) ? true : false;
return bMake;
}
/// <summary>
/// 判断是否有茶订单
/// </summary>
/// <returns></returns>
private bool IsMakeTeaWater()
{
bool bMake = (IsHealth && morkTLebaiJC.morkOrderPushesTea.Count > 0 && !morkTLebaiJC.IsHaveTeaWaterCup) ? true : false;
return bMake;
}
/// <summary>
/// 判断是否有开水订单
/// </summary>
/// <returns></returns>
private bool IsMakeWater()
{
bool bMake = (IsHealth && morkTLebaiJC.morkOrderPushesWater.Count > 0 && !morkTLebaiJC.IsHaveTeaWaterCup) ? true : false;
return bMake;
}
/// <summary>
/// 做咖啡流程
/// </summary>
private void DoCoffee()
@@ -397,97 +239,7 @@ namespace BPASmartClient.MorkT_Container
}
}
}
private void DoJuice()
{
if (IsMakeJuice())
{
switch (morkTLebaiJC.morkOrderPushesJuicer.ElementAt(0).makeID)
{
case "1":
GuMake = true;
IsAddIce = false;
break;
case "2":
GuMake = false;
IsAddIce = false;
break;
case "3":
GuMake = false;
IsAddIce = true;
break;
default:
break;
}
PickUpJuicer();
morkTLebaiJC.IsHaveJuiceCup = true;
}
else if (morkTLebaiJC.MakeJuiceEnd)
{
try
{
Thread.Sleep(5000);//延迟五秒,防止饮料口滴饮料
putJuice();
morkTLebaiJC.IsHaveJuiceCup = false;
morkTLebaiJC.MakeJuiceEnd = false;
morkTLebaiJC.morkOrderPushesJuicer.TryDequeue(out OrderLocInfo orderLoc);
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx(ex.ToString());
}
}
}
public bool DoTeaOrWater;
private void DoBoiledTea()
{
if (IsMakeTeaWater())
{
PickUpTea();
morkTLebaiJC.IsHaveTeaWaterCup = true;
DoTeaOrWater = true;
}
else if (morkTLebaiJC.MakeTeaEnd && morkTLebaiJC.morkOrderPushesTea.Count > 0 && DoTeaOrWater)
{
try
{
PutWaterCup();
OrderChange(morkTLebaiJC.morkOrderPushesTea.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE);
DeviceProcessLogShow("-------------茶 制作完成------------");
morkTLebaiJC.IsHaveTeaWaterCup = false;
morkTLebaiJC.MakeTeaEnd = false;
morkTLebaiJC.morkOrderPushesTea.TryDequeue(out OrderLocInfo orderLoc);
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx(ex.ToString());
}
}
}
private void DoBoiledWater()
{
if (IsMakeWater())
{
PickUpWater();
morkTLebaiJC.IsHaveTeaWaterCup = true;
DoTeaOrWater = false;
}
else if (morkTLebaiJC.MakeTeaEnd && morkTLebaiJC.morkOrderPushesWater.Count > 0 && DoTeaOrWater == false)
{
try
{
PutWaterCup();
OrderChange(morkTLebaiJC.morkOrderPushesWater.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE);
DeviceProcessLogShow("-------------开水 制作完成------------");
morkTLebaiJC.IsHaveTeaWaterCup = false;
morkTLebaiJC.MakeTeaEnd = false;
morkTLebaiJC.morkOrderPushesWater.TryDequeue(out OrderLocInfo orderLoc);
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx(ex.ToString());
}
}
}


#region 做咖啡流程
@@ -500,28 +252,20 @@ namespace BPASmartClient.MorkT_Container
{
outCupCheck = false;
OrderChange(morkTLebaiJC.morkOrderPushesCoffee.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING);
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }, (o) => { });
int resultTakeCup = takeCup();
if (resultTakeCup == 1)
{
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
Sence(GVL_MorkT.机器人安全位);
//Wait();

WritePLCData("",2);//将轴移动到接咖啡的位置
DeviceProcessLogShow("伺服电机移动到接咖啡的位置");

DeviceProcessLogShow("咖啡杯取杯完成");
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
Sence(GVL_MorkT.接咖啡);
//Wait();
new DRCoffee_MakeCoffeeEvent() { DeviceId=DeviceId, DrinkCode = (DrCoffeeDrinksCode)(morkTLebaiJC.morkOrderPushesCoffee.ElementAt(0).Loc)}.Publish(); //接咖啡控制 //DrCoffeeDrinksCode.热水
Sence(GVL_MorkT.攀华_接咖啡);
Wait();
new DRCoffee_MakeCoffeeEvent() { DeviceId=DeviceId, DrinkCode = (DrCoffeeDrinksCode)(morkTLebaiJC.morkOrderPushesCoffee.ElementAt(0).Loc)}.Publish();
}
else
{
DeviceProcessLogShow("取杯失败 回到初始位,请及时处理!!");
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
Sence(GVL_MorkT.机器人初始位);
//Wait();
/*new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
Sence(GVL_MorkT.攀华_初始位);
Wait();*/
}
}
}
@@ -530,282 +274,28 @@ namespace BPASmartClient.MorkT_Container
/// </summary>
private void PutCoffeeCup()
{
while (GetStatus<bool>("RobotValue1"))//判断放杯位置是否有物品
while (morkTLebaiJC.RobotGetInput0)//判断放杯位置是否有物品
{
if (!outCupCheck)
DeviceProcessLogShow("成品处有纸杯存在,请取走!!");
outCupCheck = true;
}
outCupCheck = false;
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
Sence(GVL_MorkT.机器人安全位);
//Wait();

WritePLCData("", 2);//将轴移动到接咖啡的位置
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
Sence(GVL_MorkT.放咖啡杯);
//Wait();
OrderChange(morkTLebaiJC.morkOrderPushesCoffee.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE);
DeviceProcessLogShow($"-------------{Regex.Replace(morkTLebaiJC.morkOrderPushesCoffee.ElementAt(0).GoodName, @"[\r\n]", "")}制作完成------------");
}
#endregion
#region 做开水流程
/// <summary>
/// 接开水
/// </summary>
private void PickUpWater()
{
#region 接水流程
if (!morkTLebaiJC.IsHaveTeaWaterCup)
{
OrderChange(morkTLebaiJC.morkOrderPushesWater.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING);
int resultTakeCup = takeCup();
if (resultTakeCup == 1)
{
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
Sence(GVL_MorkT.接开水);
//Wait();
Output(false, 1);
Output(false, 0);
Thread.Sleep(100);
Output(true, 0);
Thread.Sleep(3000);
Output(false, 0);
Thread.Sleep(100);

Output(false, 1);
Thread.Sleep(100);
Output(true, 1);
Thread.Sleep(500);
Output(false, 1);
}
else
{
return;
}
}
#endregion
}
#endregion
#region 做茶流程
/// <summary>
/// 做茶
/// </summary>
private void PickUpTea()
{
#region 接茶流程
if (!morkTLebaiJC.IsHaveTeaWaterCup)
Sence(GVL_MorkT.攀华_放杯);
Wait();
while (!morkTLebaiJC.RobotGetInput0)
{
OrderChange(morkTLebaiJC.morkOrderPushesTea.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING);
int resultTakeCup = takeCup();
if (resultTakeCup == 1)
{
DeviceProcessLogShow("取茶杯完成");
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
Sence(GVL_MorkT.接茶叶);
//Wait();

new WriteMcu() { TagName = "ServoControl", Address = "1", Value = 90 }.Publish();
Thread.Sleep(1000);
new WriteMcu() { TagName = "ServoControl", Address = "1", Value = 150 }.Publish();
Thread.Sleep(1000);
new WriteMcu() { TagName = "ServoControl", Address = "1", Value = 90 }.Publish();

Thread.Sleep(3000);
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
Sence(GVL_MorkT.接茶水);
//Wait();
Output(false, 1);
Output(false, 0);
Thread.Sleep(100);
Output(true, 0);
Thread.Sleep(3000);
Output(false, 0);
Thread.Sleep(100);

Output(false, 1);
Thread.Sleep(100);
Output(true, 1);
Thread.Sleep(500);
Output(false, 1);
morkTLebaiJC.IsHaveTeaWaterCup = true;
}
else
{
return;
}
DeviceProcessLogShow("咖啡杯未安全放置在放杯位");
}
#endregion
}
/// <summary>
/// 放水杯流程
/// </summary>
private void PutWaterCup()
{
while (GetStatus<bool>("RobotValue1"))//判断放杯位置是否有物品
Sence(GVL_MorkT.攀华_初始位);
Wait();
while (morkTLebaiJC.RobotGetTcpInput)
{
if (!outCupCheck)
DeviceProcessLogShow("成品处有纸杯存在,请取走!!");
outCupCheck = true;
DeviceProcessLogShow("咖啡杯仍在夹爪上");
}
outCupCheck = false;
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
Sence(GVL_MorkT.放水杯);
}

#endregion
#region 做果汁流程
/// <summary>
/// 果汁机控制信号
/// </summary>
private byte JuicerNum;

private void getIce()
{
IsAddIceNow = IsAddIce;
if (IsAddIce)
{
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
Sence(GVL_MorkT.取杯位_机器人安全位);
//Wait();

WritePLCData("",3);//将模组移动到接冰的位置

new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
Sence(GVL_MorkT.接冰块);
//Wait();
if (Math.Pow(1, GetStatus<byte>("GetMakeIceDeviceStatus")) == 0)//制冰机在待机状态才可以制作冰
{
new StartMakeIce() { }.Publish();
}
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
Sence(GVL_MorkT.接冰_机器人安全位);
//Wait();
}
}
/// <summary>
/// 当前订单是否加冰
/// </summary>
private bool IsAddIceNow = false;
private int JuiceCH;
/// <summary>
/// 接果汁
/// </summary>
private void PickUpJuicer()
{
#region 接果汁流程
if (!morkTLebaiJC.IsHaveJuiceCup)
{
OrderChange(morkTLebaiJC.morkOrderPushesJuicer.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING);
int resultTakeCup = takeCup();
JuiceCH = morkTLebaiJC.morkOrderPushesJuicer.ElementAt(0).Loc;
if (resultTakeCup == 1)
{
getIce();
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
Sence(GVL_MorkT.机器人安全位);
//Wait();
WritePLCData("", 3);//将模组移动到接冰的位置
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
Sence(GVL_MorkT.接果汁过渡位);
//Wait();
switch (JuiceCH)
{
case 52:
if (GuMake)
JuicerNum = 0x00;
else
JuicerNum = 0x01;
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
Sence(GVL_MorkT.接果汁1);
//Wait();
break;
case 53:
if (GuMake)
JuicerNum = 0x02;
else
JuicerNum = 0x03;
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
Sence(GVL_MorkT.接果汁2);
//Wait();
break;
case 54:
if (GuMake)
JuicerNum = 0x04;
else
JuicerNum = 0x05;
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
Sence(GVL_MorkT.接果汁3);
//Wait();
break;
case 55:
if (GuMake)
JuicerNum = 0x06;
else
JuicerNum = 0x07;
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
Sence(GVL_MorkT.接果汁4);
//Wait();
break;
default:
JuicerNum = 0x00;
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
Sence(GVL_MorkT.接果汁1);
//Wait();
break;
}
new WriteJuicer() { Value = JuicerNum }.Publish();
morkTLebaiJC.IsHaveJuiceCup = true;
}
else
{
return;
}
}
#endregion
}
/// <summary>
/// 取接好果汁杯
/// </summary>
private void putJuice()
{
while (GetStatus<bool>("RobotValue1"))//判断放杯位置是否有物品
{
if (!outCupCheck)
DeviceProcessLogShow("成品处有纸杯存在,请取走!!");
outCupCheck = true;
}
outCupCheck = false;
switch (JuiceCH)
{
case 52:
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
Sence(GVL_MorkT.放果汁杯1);
//Wait();
break;
case 53:
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
Sence(GVL_MorkT.放果汁杯2);
//Wait();
break;
case 54:
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
Sence(GVL_MorkT.放果汁杯3);
//Wait();
break;
case 55:
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
Sence(GVL_MorkT.放果汁杯4);
//Wait();
break;
default:
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
Sence(GVL_MorkT.放果汁杯1);
//Wait();
break;
}
OrderChange(morkTLebaiJC.morkOrderPushesJuicer.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE);
DeviceProcessLogShow($"-------------{morkTLebaiJC.morkOrderPushesJuicer.ElementAt(0).GoodName}果汁 制作完成------------");
OrderChange(morkTLebaiJC.morkOrderPushesCoffee.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE);
DeviceProcessLogShow($"-------------{Regex.Replace(morkTLebaiJC.morkOrderPushesCoffee.ElementAt(0).GoodName, @"[\r\n]", "")}制作完成------------");
}
#endregion

@@ -822,54 +312,62 @@ namespace BPASmartClient.MorkT_Container
try
{
nCnt = 0;
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
Sence(GVL_MorkT.机器人初始位);
//Wait();

new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
Sence(GVL_MorkT.机器人安全位);
//Wait();
Sence(GVL_MorkT.攀华_初始位);
Wait();

Sence(GVL_MorkT.攀华_取杯);
Wait();

WritePLCData("", 1);
Sence(GVL_MorkT.攀华_落杯);
Wait();//落杯使用机器人控制
/*new LebaiRobot_SetOutPutEvent { DeviceId = DeviceId, Value = true, Pin = 1 }.Publish();//落杯器电机转动

new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
Sence(GVL_MorkT.取纸杯);
//Wait();
while (true)
{
if (GetStatus<bool>("LeibaiGetInput2"))
{
break;
}
}
while (true)
{
if (!GetStatus<bool>("LeibaiGetInput2"))
{
break;
}
}
new LebaiRobot_SetOutPutEvent { DeviceId = DeviceId, Value = true, Pin = 0 }.Publish();//落杯器电机转动*/

new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
Sence(GVL_MorkT.取纸杯检测);
//Wait();
nCnt++;
Thread.Sleep(2000);
while (!GetStatus<bool>("GetInput")) //读取传感器的值
while (!morkTLebaiJC.RobotGetTcpInput) //读取传感器的值
{
if (nCnt > 3)
{
nCnt = 0;
DeviceProcessLogShow("三次取杯失败,回原点");
Sence(GVL_MorkT.攀华_安全位);
Wait();
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
Sence(GVL_MorkT.机器人安全位);
//Wait();
Sence(GVL_MorkT.攀华_初始位);
Wait();
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
Sence(GVL_MorkT.机器人初始位);
//Wait();
return 2;
}
else
{
nCnt++;
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
Sence(GVL_MorkT.二次取杯);
//Wait();
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
Sence(GVL_MorkT.取纸杯检测);
//Wait();
Sence(GVL_MorkT.攀华_二次取杯);
Wait();
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }, (o) => { });

Sence(GVL_MorkT.攀华_落杯);
Wait();
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }, (o) => { });
}
Thread.Sleep(100);
}
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
Sence(GVL_MorkT.取杯位_机器人安全位);
//Wait();
return 1;
}
catch (Exception ex)
@@ -878,46 +376,12 @@ namespace BPASmartClient.MorkT_Container
}
return 2;
}
/// <summary>
/// 放杯
/// </summary>
/// <returns>0:无意义 1:放杯成功 2:执行失败(传感器还有信号) 3:放杯异常</returns>
private int putCup()
{
try
{
if (GetStatus<bool>("GetInput2")) return 2;
Sence(GVL_MorkT.JUICE_放杯);
//Wait();
new LebaiRobot_SetValueEvent() { RobotSetValue = 1 }.Publish();
Sence(GVL_MorkT.JUICE_放杯检测);
//Wait();
new LebaiRobot_SetValueEvent() { RobotSetValue = 1 }.Publish();
if (GetStatus<bool>("GetInput2"))
{
return 1;
}
else
{
return 3;
}
}
catch (Exception ex)
{
DeviceProcessLogShow(ex.ToString());
return 0;
}
}
public void SimOrder<T>(T simOrder)
{
}
#region PLC 控制函数
#region 流程控制

private void WritePLCData(string address, object value)
{
EventBus.EventBus.GetInstance().Publish(new WriteModel() { DeviceId = DeviceId, Address = address, Value = value });
}
private void GetStatus(string key, Action<object> action)
{
if (peripheralStatus.ContainsKey(key))
@@ -983,167 +447,6 @@ namespace BPASmartClient.MorkT_Container
}));

#endregion
#region 制冰机状态
GetStatus("MakeIceConnected", new Action<object>((o) =>
{
if (o is bool bt)
{
morkTLebaiJC.IceMakerConnect = bt;
}
}));
GetStatus("MakeIceDeviceStatus", new Action<object>((o) =>
{
if (o is byte bt)
{
morkTLebaiJC.IceMakerState = bt;
}
}));
#endregion
#region 咖啡机状态
GetStatus("CoffeeIsConnected", new Action<object>((o) =>
{
if (o is bool b)
{
morkTLebaiJC.CoffeeIsConnected = b;
}
}));

GetStatus("CoffeeStatus", new Action<object>((o) =>
{
if (o is DrCoffeeStatus coffeeStatus)
{
morkTLebaiJC.DrCoffeeStatus = coffeeStatus;
}
}));

GetStatus("CoffeeAppStatus", new Action<object>((o) =>
{
if (o is DrCoffeeAppStatus appStatus)
{
morkTLebaiJC.CoffeeAppStatus = appStatus;
}
}));

GetStatus("CoffeeWarning", new Action<object>((o) =>
{
if (o is DrCoffeeWarning coffeeWarning)
{
morkTLebaiJC.CoffeeWarning = coffeeWarning;
}
}));
GetStatus("CoffeeFault", new Action<object>((o) =>
{
if (o is DrCoffeeFault coffeeFault)
{
morkTLebaiJC.CaffeeFault = coffeeFault;
}
}));
#endregion
#region 单片机状态
EventBus.EventBus.GetInstance().Publish(new ReadMcu() { DeviceId = DeviceId, ReadPar = 0, TagName = "SCChipGetInput0" });
EventBus.EventBus.GetInstance().Publish(new ReadMcu() { DeviceId = DeviceId, ReadPar = 0, TagName = "SCChipGetInput1" });
EventBus.EventBus.GetInstance().Publish(new ReadMcu() { DeviceId = DeviceId, ReadPar = 0, TagName = "SCChipGetInput2" });
EventBus.EventBus.GetInstance().Publish(new ReadMcu() { DeviceId = DeviceId, ReadPar = 0, TagName = "SCChipGetInput3" });
EventBus.EventBus.GetInstance().Publish(new ReadMcu() { DeviceId = DeviceId, ReadPar = 0, TagName = "SCChipGetInput4" });
EventBus.EventBus.GetInstance().Publish(new ReadMcu() { DeviceId = DeviceId, ReadPar = 0, TagName = "SCChipGetInput5" });
EventBus.EventBus.GetInstance().Publish(new ReadMcu() { DeviceId = DeviceId, ReadPar = 0, TagName = "SCChipGetInput6" });
EventBus.EventBus.GetInstance().Publish(new ReadMcu() { DeviceId = DeviceId, ReadPar = 0, TagName = "SCChipGetInput7" });
GetStatus("SCChipIsConnect", new Action<object>((o) =>
{
if (o is bool b)
{
morkTLebaiJC.SCChipIsConnect = b;
}
}));
GetStatus("SCChipGetInput0", new Action<object>((o) =>
{
if (o is bool b)
{
morkTLebaiJC.SCChipInput0 = b;
}
}));
GetStatus("SCChipGetInput1", new Action<object>((o) =>
{
if (o is bool b)
{
morkTLebaiJC.SCChipInput1 = b;
}
}));
GetStatus("SCChipGetInput2", new Action<object>((o) =>
{
if (o is bool b)
{
morkTLebaiJC.SCChipInput2 = b;
}
}));
GetStatus("SCChipGetInput3", new Action<object>((o) =>
{
if (o is bool b)
{
morkTLebaiJC.SCChipInput3 = b;
}
}));
GetStatus("SCChipGetInput4", new Action<object>((o) =>
{
if (o is bool b)
{
morkTLebaiJC.SCChipInput4 = b;
}
}));
GetStatus("SCChipGetInput5", new Action<object>((o) =>
{
if (o is bool b)
{
morkTLebaiJC.SCChipInput5 = b;
}
}));
GetStatus("SCChipGetInput6", new Action<object>((o) =>
{
if (o is bool b)
{
morkTLebaiJC.SCChipInput6 = b;
}
}));
GetStatus("SCChipGetInput7", new Action<object>((o) =>
{
if (o is bool b)
{
morkTLebaiJC.SCChipInput7 = b;
}
}));

#endregion
#region 果汁机
GetStatus("GetJuicerConnected", new Action<object>((o) =>
{
if (o is bool b)
{
morkTLebaiJC.JuicerConnected = b;
}
}));
GetStatus("GetJuicerDeviceStatus", new Action<object>(async (o) =>
{
if (o is int[] b)
{
morkTLebaiJC.JuicerState = b;
}
if (morkTLebaiJC.JuicerState != null && morkTLebaiJC.JuicerState.Length>0)
{
if ((morkTLebaiJC.JuicerState[0] >> 7 & 1) == 1)
{
morkTLebaiJC.JuiceState_Using = true;
}
if ((morkTLebaiJC.JuicerState[0] >> 6 & 1) == 1)
{
morkTLebaiJC.JuiceState_LackOfWater = true;
}
if ((morkTLebaiJC.JuicerState[0] >> 5 & 1) == 1)
{
morkTLebaiJC.JuiceState_Heating = true;
}
}
}));
#endregion
}
#endregion
public override void Stop()
@@ -1168,18 +471,6 @@ namespace BPASmartClient.MorkT_Container
{
morkTLebaiJC.morkOrderPushesCoffee.Enqueue(new OrderLocInfo() { Loc =(ushort)msm.DrinkCode, SuborderId = guid, GoodName="模拟咖啡订单" });
}
else if (msm.OrderNum == 2)
{
morkTLebaiJC.morkOrderPushesJuicer.Enqueue(new OrderLocInfo() { Loc = (ushort) (msm.JuiceList + 51), makeID = msm.JuiceMakeID, SuborderId = guid, GoodName = "模拟果汁订单" });
}
else if (msm.OrderNum == 3)
{
morkTLebaiJC.morkOrderPushesTea.Enqueue(new OrderLocInfo() { SuborderId = guid, GoodName = "模拟茶水订单" });
}
else if (msm.OrderNum == 4)
{
morkTLebaiJC.morkOrderPushesWater.Enqueue(new OrderLocInfo() { SuborderId = guid, GoodName = "模拟开水订单" });
}
}
});
}


+ 8
- 51
BPASmartClient.MorkT_Container/GVL_MorkT.cs Datei anzeigen

@@ -12,65 +12,22 @@ namespace BPASmartClient.MorkT_Container
{
public class GVL_MorkT : IStatus
{
#region 果汁机设备MORKT2 Lebai机器人
public const int 机器人安全位 = 10000;//一个位置(模组可移动,机器人不发生碰撞)
#region 攀华MorkT

public const int 机器人初始位 = 10001;
public const int 初始位_机器人安全位 = 10002;//初始位---安全位
public const int 攀华_初始位 = 10023;

public const int 取纸杯 = 10005;//安全位---取杯位
public const int 二次取杯 = 10008;//取纸杯检测位---二次取杯位
public const int 取纸杯检测 = 10006;//取杯位---取杯检测位
public const int 取杯位_机器人安全位 = 10002;//取杯检测位---模组移动安全位
public const int 攀华_安全位 = 10024;

public const int 接咖啡 = 10010;//安全位---接咖啡位
public const int 攀华_取杯 = 10025;

public const int 接果汁过渡位 = 10002;//安全位---接果汁过渡位
public const int 接果汁1 = 10011;//接果汁过渡位---果汁1位
public const int 接果汁2 = 10012;//接果汁过渡位---果汁2位
public const int 接果汁3 = 10013;//接果汁过渡位---果汁3位
public const int 接果汁4 = 10014;//接果汁过渡位---果汁4位
public const int 接果汁_机器人安全位 = 10002;//接果汁过渡位---模组移动安全位
public const int 攀华_落杯 = 10026;

public const int 接茶叶 = 10015;
public const int 接茶水 = 10016;
public const int 接开水 = 10017;
public const int 接水_机器人安全位 = 10002;
public const int 攀华_二次取杯 = 10027;

public const int 接冰块 = 10018;
public const int 接冰_机器人安全位 = 10002;
public const int 攀华_接咖啡 = 10028;

public const int 放咖啡杯 = 10020;
public const int 放果汁杯1 = 10021;
public const int 放果汁杯2 = 10022;
public const int 放果汁杯3 = 10023;
public const int 放果汁杯4 = 10024;
public const int 放水杯 = 10025;
public const int 攀华_放杯 = 10029;

public const int 放杯 = 10001;
public const int 放杯_机器人安全位 = 10001;

#endregion

#region 果汁机设备 MORKT1 JAKA机器人
public const int JUICE_初始位 = 20000;
public const int JUICE_取杯 = 20001;
public const int JUICE_取杯检测 = 20010;
public const int JUICE_接咖啡 = 20020;
public const int JUICE_接1号果汁 = 20030;
public const int JUICE_接2号果汁 = 20040;
public const int JUICE_接3号果汁 = 20050;
public const int JUICE_接4号果汁 = 20060;
public const int JUICE_接茶 = 20070;
public const int JUICE_接茶水 = 20075;
public const int JUICE_接水 = 20080;

public const int JUICE_放咖啡杯 = 20090;
public const int JUICE_放果汁杯 = 20100;
public const int JUICE_放茶水杯 = 20110;

public const int JUICE_放杯 = 20120;
public const int JUICE_放杯检测 = 20120;
#endregion
/// <summary>
/// <summary>


+ 0
- 11
BPASmartClient.MorkT_Container/PolymerBatching.cs Datei anzeigen

@@ -79,17 +79,6 @@ namespace BPASmartClient.MorkT_Container
{"23",GOODS_TYPE.COFFEE},
{"24",GOODS_TYPE.COFFEE},
{"25",GOODS_TYPE.COFFEE},
{ COFFEE_HOLDER_LOC,GOODS_TYPE.CUP},
{"56",GOODS_TYPE.TEA },
{"61",GOODS_TYPE.WATER },
{Juicer_MAIN_BATCHIN1_LOC,GOODS_TYPE.JUICE},
{Juicer_MAIN_BATCHIN2_LOC,GOODS_TYPE.JUICE},
{Juicer_MAIN_BATCHIN3_LOC,GOODS_TYPE.JUICE},
{Juicer_MAIN_BATCHIN4_LOC,GOODS_TYPE.JUICE},
//{Juicer_MAIN_BATCHIN5_LOC,GOODS_TYPE.JUICE},
//{Juicer_MAIN_BATCHIN6_LOC,GOODS_TYPE.JUICE},
//{Juicer_MAIN_BATCHIN7_LOC,GOODS_TYPE.JUICE},
//{Juicer_MAIN_BATCHIN8_LOC,GOODS_TYPE.JUICE},
};

public GOODS_TYPE GoodsType { get; set; }


+ 1
- 1
BPASmartClient.ScreenLib/AppMain.cs Datei anzeigen

@@ -18,7 +18,7 @@ namespace BPASmartClient.ScreenLib
//启动Redis数据读取
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
FSystemHelper.GetInstance.CreateDesktopShortcut();
// FSystemHelper.GetInstance.AutoStart(true);
//FSystemHelper.GetInstance.AutoStart(true);
WindowLargeScreen windowLarge = new WindowLargeScreen();
#region 设置显示页面与标题
string TitleName = $"{type.Assembly.ManifestModule.Name.Replace(".dll", "")}";


+ 66
- 2
BPASmartClient.ScreenLib/Helper/Main.cs Datei anzeigen

@@ -5,6 +5,7 @@ using IWshRuntimeLibrary;
using Microsoft.Web.WebView2.Wpf;
using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
@@ -168,12 +169,35 @@ namespace BPASmartClient.ScreenLib
/// </summary>
public void StartServer()
{
string path = System.Configuration.ConfigurationManager.AppSettings["StartServer"].ToString();
string processName = "";
try
{
string path = System.Configuration.ConfigurationManager.AppSettings["StartServer"].ToString();
if (System.IO.File.Exists(path))
{
Process.Start(path);
processName = System.IO.Path.GetFileNameWithoutExtension(path);
if (!IsProcess(processName))
{
Process.Start(path);
}


ThreadManage.GetInstance().StartLong(new Action(() =>
{
try
{
if (!IsProcess(processName))
{
Process.Start(path);
}
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx($"{Name}:线程服务异常,原因:{ex.Message}");
}
Thread.Sleep(3000);
}), $"{Name},进程监控");
}
}
catch (Exception ex)
@@ -181,6 +205,46 @@ namespace BPASmartClient.ScreenLib

}
}

public bool IsProcess(string procName)
{
bool isProcess = false;
Process[] ps = Process.GetProcessesByName(procName);
if (ps.Length > 0)
{
isProcess=true;
}
return isProcess;
}
/// <summary>
/// 关闭进程
/// </summary>
/// <param name="procName"></param>
/// <returns></returns>
public bool CloseProc(string procName)
{
bool result = false;
ArrayList procList = new ArrayList();
string tempName;
int begpos;
int endpos;
foreach (Process thisProc in Process.GetProcesses())
{
tempName = thisProc.ToString();
begpos = tempName.IndexOf("(") + 1;
endpos = tempName.IndexOf(")");
tempName = tempName[begpos..endpos];
procList.Add(tempName);
if (tempName == procName)
{
if (!thisProc.CloseMainWindow())
// 当发送关闭窗口命令无效时强行结束进程
thisProc.Kill();
result = true;
}
}
return result;
}
/// <summary>
/// 停止服务
/// </summary>


+ 1
- 1
BPASmartClient.ScreenSplitMeals/App.config Datei anzeigen

@@ -9,7 +9,7 @@
<add key="SaasRoute" value="https://witt.black-pa.com/kitchen/api/StoreHelper/GeBasisGateList?StoreId=0c32b2e2-0dc9-4941-b73d-3dc91f7268ab"/>
<!--显示窗体:0 广告 1 地球-->
<add key="ShowForm" value="1"/>
<add key="StartServer" value="D:\fengyoufu\代码\Code\C#项目\收银系统\Pos\bin\Debug\net6.0-windows\黑菠萝收银系统.exe"/>
<add key="StartServer" value="D:\fengyoufu\代码\Code\C#项目\新上位机代码\BPASmart.MenuLoad\bin\Debug\net6.0-windows\可视化配置工具.exe"/>
<!--<add key="一号屏" value="0"/>
<add key="二号屏" value="1"/>
<add key="三号屏" value="2"/>-->


+ 10
- 0
DosingSystem/App.xaml.cs Datei anzeigen

@@ -22,8 +22,18 @@ namespace BPASmartClient.DosingSystem
public partial class App : Application
{
public static Window MainWindow;

public EventWaitHandle ProgramStarted { get; set; }
protected override void OnStartup(StartupEventArgs e)
{
bool createNew;
ProgramStarted = new EventWaitHandle(false, EventResetMode.AutoReset, "DosingSystem", out createNew);
if (!createNew)
{
MessageBox.Show("程序已启动");
App.Current.Shutdown();
Environment.Exit(0);
}
base.OnStartup(e);
BPASmartClient.Helper.SystemHelper.GetInstance.CreateDesktopShortcut();
MenuInit();


+ 44
- 47
DosingSystem/Model/DeviceInquire.cs Datei anzeigen

@@ -313,10 +313,6 @@ namespace BPASmartClient.DosingSystem
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).EStop2 = deviceStatus.DeviceAlarmCode.GetBitValue(7);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).SiloUpperLimit = deviceStatus.DeviceAlarmCode.GetBitValue(8);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).SiloLowerLimit = deviceStatus.DeviceAlarmCode.GetBitValue(9);

if (DeviceName=="A20") {
//MessageNotify.GetInstance.ShowRunLog($"{this.modbusTcp.GetReal(DeviceAddress.WeightSet)}");
}
Thread.Sleep(10);
}), $"{DeviceName} 开始监听", true);
}
@@ -346,50 +342,51 @@ namespace BPASmartClient.DosingSystem
var res = Json<DevicePar>.Data.deviceParModels.FirstOrDefault(p => p.MaterialName == DeviceName);
if (res != null)
{
prop1:
modbusTcp.SetReal(DeviceAddress.SlowlyAddWeight, res.SlowlyAddWeight);
var Value1 = (float)this.modbusTcp.GetReal(DeviceAddress.SlowlyAddWeight);
if (Value1 != null && Value1.ToString() != res.SlowlyAddWeight.ToString()) goto prop1;
prop2:
modbusTcp.SetReal(DeviceAddress.PreCloseValveWeight, res.PreCloseValveWeight);
var Value2 = (float)this.modbusTcp.GetReal(DeviceAddress.PreCloseValveWeight);
if (Value2 != null && Value2.ToString() != res.PreCloseValveWeight.ToString()) goto prop2;
prop3:
modbusTcp.SetUint(DeviceAddress.RapidAcceleration, (uint)res.RapidAcceleration);
var Value3 = this.modbusTcp.GetUint(DeviceAddress.RapidAcceleration);
if (Value3 != null && Value3.ToString() != res.RapidAcceleration.ToString()) goto prop3;
prop4:
modbusTcp.SetUint(DeviceAddress.SlowAcceleration, (uint)res.SlowAcceleration);
var Value4 = this.modbusTcp.GetUint(DeviceAddress.SlowAcceleration);
if (Value4 != null && Value4.ToString() != res.SlowAcceleration.ToString()) goto prop4;
prop5:
modbusTcp.SetUint(DeviceAddress.ServoManualSpeed, (uint)res.ServoManualSpeed);
var Value5 = this.modbusTcp.GetUint(DeviceAddress.ServoManualSpeed);
if (Value5 != null && Value5.ToString() != res.ServoManualSpeed.ToString()) goto prop5;
prop6:
modbusTcp.SetUint(DeviceAddress.SiloUpperLimitWeight, (uint)res.SiloUpperLimitWeight);
var Value6 = this.modbusTcp.GetUint(DeviceAddress.SiloUpperLimitWeight);
if (Value6 != null && Value6.ToString() != res.SiloUpperLimitWeight.ToString()) goto prop6;
prop7:
modbusTcp.SetUint(DeviceAddress.LowerLimitWeightOfSilo, (uint)res.LowerLimitWeightOfSilo);
var Value7 = this.modbusTcp.GetUint(DeviceAddress.LowerLimitWeightOfSilo);
if (Value7 != null && Value7.ToString() != res.LowerLimitWeightOfSilo.ToString()) goto prop7;
prop8:
modbusTcp.SetUint(DeviceAddress.StirringSpeed, (uint)res.StirringSpeed);
var Value8 = this.modbusTcp.GetUint(DeviceAddress.StirringSpeed);
if (Value8 != null && Value8.ToString() != res.StirringSpeed.ToString()) goto prop8;
MessageNotify.GetInstance.ShowRunLog($"{res.MaterialName},参数下发完成");
prop1:
modbusTcp.SetReal(DeviceAddress.SlowlyAddWeight, res.SlowlyAddWeight);
var Value1 = (float)this.modbusTcp.GetReal(DeviceAddress.SlowlyAddWeight);
if (Value1 != null && Value1.ToString() != res.SlowlyAddWeight.ToString()) goto prop1;
prop2:
modbusTcp.SetReal(DeviceAddress.PreCloseValveWeight, res.PreCloseValveWeight);
var Value2 = (float)this.modbusTcp.GetReal(DeviceAddress.PreCloseValveWeight);
if (Value2 != null && Value2.ToString() != res.PreCloseValveWeight.ToString()) goto prop2;
prop3:
modbusTcp.SetUint(DeviceAddress.RapidAcceleration, (uint)res.RapidAcceleration);
var Value3 = this.modbusTcp.GetUint(DeviceAddress.RapidAcceleration);
if (Value3 != null && Value3.ToString() != res.RapidAcceleration.ToString()) goto prop3;
prop4:
modbusTcp.SetUint(DeviceAddress.SlowAcceleration, (uint)res.SlowAcceleration);
var Value4 = this.modbusTcp.GetUint(DeviceAddress.SlowAcceleration);
if (Value4 != null && Value4.ToString() != res.SlowAcceleration.ToString()) goto prop4;
prop5:
modbusTcp.SetUint(DeviceAddress.ServoManualSpeed, (uint)res.ServoManualSpeed);
var Value5 = this.modbusTcp.GetUint(DeviceAddress.ServoManualSpeed);
if (Value5 != null && Value5.ToString() != res.ServoManualSpeed.ToString()) goto prop5;
prop6:
modbusTcp.SetUint(DeviceAddress.SiloUpperLimitWeight, (uint)res.SiloUpperLimitWeight);
var Value6 = this.modbusTcp.GetUint(DeviceAddress.SiloUpperLimitWeight);
if (Value6 != null && Value6.ToString() != res.SiloUpperLimitWeight.ToString()) goto prop6;
prop7:
modbusTcp.SetUint(DeviceAddress.LowerLimitWeightOfSilo, (uint)res.LowerLimitWeightOfSilo);
var Value7 = this.modbusTcp.GetUint(DeviceAddress.LowerLimitWeightOfSilo);
if (Value7 != null && Value7.ToString() != res.LowerLimitWeightOfSilo.ToString()) goto prop7;
prop8:
modbusTcp.SetUint(DeviceAddress.StirringSpeed, (uint)res.StirringSpeed);
var Value8 = this.modbusTcp.GetUint(DeviceAddress.StirringSpeed);
if (Value8 != null && Value8.ToString() != res.StirringSpeed.ToString()) goto prop8;
MessageNotify.GetInstance.ShowRunLog($"{res.MaterialName},配料参数下发完成");
}
prop9:
modbusTcp.SetReal(DeviceAddress.WeightSet, Value);//写入配方量
var Value9 = this.modbusTcp.GetReal(DeviceAddress.WeightSet);
if (Value9 != null && Value9.ToString() != Value.ToString()) goto prop9;
prop10:
modbusTcp.Write(DeviceAddress.Start, (ushort)1);//设备启动写入
var Value10 = (short[])this.modbusTcp.Read(DeviceAddress.Start);
if (Value10 != null && Value10[0] != 1) goto prop10;
//modbusTcp.Write(DeviceAddress.Start, (ushort)1);//设备启动写入
MessageNotify.GetInstance.ShowRunLog($"{DeviceName},设置重量:{Value},味魔方启动");
//prop9:
// modbusTcp.SetReal(DeviceAddress.WeightSet, Value);//写入配方重量
// var Value9 = this.modbusTcp.GetReal(DeviceAddress.WeightSet);
// if (Value9 != null && Value9.ToString() != Value.ToString()) goto prop9;
//prop10:
// modbusTcp.Write(DeviceAddress.Start, (ushort)1);//设备启动写入
// var Value10 = (short[])this.modbusTcp.Read(DeviceAddress.Start);
// if (Value10 != null && Value10[0] != 1) goto prop10;
modbusTcp.SetReal(DeviceAddress.WeightSet, Value);//写入配方重量
modbusTcp.Write(DeviceAddress.Start, (ushort)1);//设备启动写入
MessageNotify.GetInstance.ShowRunLog($"{DeviceName},设置重量:{Value},味魔方启动配料");
}
}
}


+ 2
- 0
DosingSystem/Service/SiemensDevice.cs Datei anzeigen

@@ -7,6 +7,7 @@ using System.Threading.Tasks;
using BPASmartClient.S7Net;
using BPA.Helper;
using S7.Net;
using BPASmartClient.CustomResource.Pages.Model;

namespace BPASmartClient.DosingSystem
{
@@ -39,6 +40,7 @@ namespace BPASmartClient.DosingSystem
{
if (IsConnect) MySiemens.Write("DB4.DBX0.0", tempValue);//设备心跳
tempValue = !tempValue;
//MessageNotify.GetInstance.ShowUserLog($"心跳发送{tempValue}");
Thread.Sleep(100);
}), "设备心跳", true);



+ 22
- 1
DosingSystem/View/ManualControlView.xaml Datei anzeigen

@@ -64,7 +64,28 @@
HorizontalAlignment="Right"
VerticalAlignment="Center"
Orientation="Horizontal">

<TextBlock
FontSize="16"
VerticalAlignment="Center"
Foreground="Aqua"
Text="当前系统模式:" />
<TextBlock
Width="50"
FontSize="20"
VerticalAlignment="Center"
Foreground="Aqua"
Text="{Binding SystemMode}" />
<TextBlock
FontSize="16"
VerticalAlignment="Center"
Foreground="Aqua"
Text="当前系统状态:" />
<TextBlock
Width="50"
FontSize="20"
VerticalAlignment="Center"
Foreground="Aqua"
Text="{Binding SystemStatus}" />
<ToggleButton
Width="100"
Height="30"


+ 0
- 1
DosingSystem/ViewModel/CommparSetViewModel.cs Datei anzeigen

@@ -30,7 +30,6 @@ namespace BPASmartClient.DosingSystem.ViewModel
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"参数保存成功!");
}
}

}
});
}


+ 14
- 7
DosingSystem/ViewModel/ManualControlViewModel.cs Datei anzeigen

@@ -103,14 +103,16 @@ namespace BPASmartClient.DosingSystem.ViewModel
SystemStart = new BPARelayCommand(() =>
{
SiemensDevice.GetInstance.MySiemens.Write("M10.0", SystemControlText == "停止" ? false : true);
/*var res = SiemensDevice.GetInstance.MySiemens.Read<bool>("M10.0");
SystemControlText = res ? "停止" : "启动";*/
Thread.Sleep(100);
var res = SiemensDevice.GetInstance.MySiemens.Read<bool>("M10.0");
SystemControlText = res ? "停止" : "启动";
});
ModelSwitch = new BPARelayCommand(() =>
{
SiemensDevice.GetInstance.MySiemens.Write("M10.1", ModelSwitchText == "手动" ? true : false);
/*var res = SiemensDevice.GetInstance.MySiemens.Read<bool>("M10.1");
ModelSwitchText = res ? "自动" : "手动";*/
Thread.Sleep(100);
var res = SiemensDevice.GetInstance.MySiemens.Read<bool>("M10.1");
ModelSwitchText = res ? "自动" : "手动";
});

ThreadManage.GetInstance().StartLong(new Action(() =>
@@ -130,8 +132,8 @@ namespace BPASmartClient.DosingSystem.ViewModel
OtherHandCylinders.ElementAt(1).RightTog = GlobalDevice.PlcData.UnderCylinderDetection.HomeSignal;
OtherHandCylinders.ElementAt(1).LeftTog = GlobalDevice.PlcData.UnderCylinderDetection.InPlaceSignal;

SystemControlText = GlobalDevice.PlcData.SystemStartOrStop ? "停止" : "启动";
ModelSwitchText = GlobalDevice.PlcData.HandOrAuto ? "自动" : "手动";
SystemStatus = GlobalDevice.PlcData.SystemStartOrStop ? "启动" : "停止";
SystemMode = GlobalDevice.PlcData.HandOrAuto ? "自动" : "手动";

Thread.Sleep(100);
}), "手动气缸状态监控");
@@ -141,9 +143,11 @@ namespace BPASmartClient.DosingSystem.ViewModel
{
var res = SiemensDevice.GetInstance.MySiemens.Read<bool>("M10.0");
SystemControlText = res ? "停止" : "启动";
SystemStatus = res ? "停止" : "启动";

var res1 = SiemensDevice.GetInstance.MySiemens.Read<bool>("M10.1");
ModelSwitchText = res1 ? "自动" : "手动";
SystemStatus = res ? "自动" : "手动";
}

/// <summary>
@@ -181,12 +185,15 @@ namespace BPASmartClient.DosingSystem.ViewModel
public string ModelSwitchText { get { return _mModelSwitchText; } set { _mModelSwitchText = value; OnPropertyChanged(); } }
private string _mModelSwitchText;

public string SystemMode { get { return _mSystemMode; } set { _mSystemMode = value; OnPropertyChanged(); } }
private string _mSystemMode;

public string SystemStatus { get { return _mSystemStatus; } set { _mSystemStatus = value; OnPropertyChanged(); } }
private string _mSystemStatus;
}

public class CylinderModel : NotifyBase
{

public bool LeftTog { get { return _mLeftTog; } set { _mLeftTog = value; OnPropertyChanged(); } }
private bool _mLeftTog;



+ 18
- 4
DosingSystem/ViewModel/RecipeControlViewModel.cs Datei anzeigen

@@ -52,12 +52,11 @@ namespace BPASmartClient.DosingSystem.ViewModel
Thread.Sleep(1000);
SiemensDevice.GetInstance.MySiemens.Write("M10.5", false);
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方 [{recipe.RecipeName}] 取消成功");
MessageNotify.GetInstance.ShowUserLog($"取消配方制作 {recipe.RecipeName}");
}));
}
}

}

}

/// <summary>
@@ -76,12 +75,18 @@ namespace BPASmartClient.DosingSystem.ViewModel
{
string ip = Recipes.ElementAt(index).RawMaterials.ElementAt(i).DeviceIp;
var device = DeviceInquire.GetInstance.GetDevice(ip);
if (ip == null && ip == "")
{
MessageNotify.GetInstance.ShowDialog($"原料 【{Recipes.ElementAt(index).RawMaterials.ElementAt(i).RawMaterialName}】配料系统无法配料,请人工配置此原料:原料{Recipes.ElementAt(index).RawMaterials.ElementAt(i).RawMaterialName},重量{Recipes.ElementAt(index).RawMaterials.ElementAt(i).RawMaterialWeight}", DialogType.Information);
return;
}
if (!device.IsConnected)
{
MessageNotify.GetInstance.ShowDialog($"设备 【{device.DeviceName}】 未连接,不允许下发此配方", DialogType.Error);
return;
}
}
}
Recipes.ElementAt(index).IsEnable = false;
Json<LocaPar>.Data.Recipes.ElementAt(index).IsEnable = false;
@@ -93,7 +98,6 @@ namespace BPASmartClient.DosingSystem.ViewModel
UserTreeWait.Add(new RecipeModel { RecipStatus = "等待制作", SerialNum = UserTreeWait.Count + 1, RecipeName = deviceName, RawMaterials = res.RawMaterials });
}
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方下发成功!");
MessageNotify.GetInstance.ShowUserLog($"下发工单 {Guid.NewGuid().ToString()}");
}

/// <summary>
@@ -308,6 +312,10 @@ namespace BPASmartClient.DosingSystem.ViewModel
{
int barrel = j + 1;//桶号
int cnt = GlobalDevice.PlcData.LocationFeedback[j];//允许配料的位置 0~6
if (RTrig.GetInstance("a").Start(GlobalDevice.PlcData.IsAllowIngredients[j]))
{
MessageNotify.GetInstance.ShowRunLog($"桶号:{barrel},位置:{cnt},允许配料");
}
int Location1 = 0;
int Location2 = 0;
if (cnt == -1)
@@ -537,6 +545,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
byte[] test1 = a.ToBytes(BPA.Helper.DataFormat.ABCD);
int item = test1.ToInt();
string res = SiemensDevice.GetInstance.MySiemens.Write("DB4.DBD130", item, 5);
recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(loc).UpLimtWeightFeedback = DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).deviceStatus.NowWeightFeedback;
MessageNotify.GetInstance.ShowRunLog($"{res}");
MessageNotify.GetInstance.ShowRunLog($"DB4.DBD130:{item.ToBinString()}");
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},出料完成,状态复位");
@@ -552,8 +561,13 @@ namespace BPASmartClient.DosingSystem.ViewModel
if (StockStatus.Count >= Recipes.ElementAt(i).RawMaterials.Count && Finish_Count >= Recipes.ElementAt(i).RawMaterials.Count) //配方配料完成
{
StockStatus.Clear();
MessageNotify.GetInstance.ShowUserLog($"配方:{recipeProcesses.ElementAt(recIndex).RecipeName},配料完成");
foreach (var item in recipeProcesses.ElementAt(recIndex).RawMaterials)
{
MessageNotify.GetInstance.ShowUserLog($"原料:{item.RawMaterialName},桶号:{item.Loc},设定配料重量{item.RawMaterialWeight}g,实际配料重量{item.UpLimtWeightFeedback}g");
}
SiemensDevice.GetInstance.MySiemens.Write("DB4.DBX202.1", true);//配料完成
MessageNotify.GetInstance.ShowRunLog($"配料完成");
MessageNotify.GetInstance.ShowRunLog($"配方:{CurrentRecipeName},配料完成");
int recipIndex = Array.FindIndex(Recipes.ToArray(), p => p.RecipeName == CurrentRecipeName);
App.Current.Dispatcher.Invoke(new Action(() => { recipeProcesses.Clear(); }));
Recipes.ElementAt(recipIndex).IsEnable = true;


+ 0
- 1
DosingSystem/ViewModel/StockControViewModel.cs Datei anzeigen

@@ -30,7 +30,6 @@ namespace BPASmartClient.DosingSystem.ViewModel
//});
statusTop = DeviceInquire.GetInstance.TopDeviceCurrentStatuses;
statusDown = DeviceInquire.GetInstance.BottomDeviceCurrentStatuses;

}

public bool ConveyerBeltWork { get { return _mConveyerBeltWork; } set { _mConveyerBeltWork = value; OnPropertyChanged(); } }


Laden…
Abbrechen
Speichern