pengliangyang 1 year ago
parent
commit
1596f8b68c
44 changed files with 3431 additions and 1984 deletions
  1. +33
    -3
      BPASmartClient.CustomResource/Pages/Model/MessageNotify.cs
  2. +22
    -0
      BPASmartClient.CustomResource/Pages/Model/RecipeCompleteLog.cs
  3. +26
    -25
      BPASmartClient.CustomResource/Pages/View/MainView.xaml
  4. +340
    -0
      BPASmartClient.CustomResource/Pages/View/RecipeCompleteView.xaml
  5. +28
    -0
      BPASmartClient.CustomResource/Pages/View/RecipeCompleteView.xaml.cs
  6. +13
    -10
      BPASmartClient.CustomResource/Pages/View/RunLogView.xaml
  7. +1
    -1
      BPASmartClient.CustomResource/Pages/View/UserLogView.xaml
  8. +126
    -0
      BPASmartClient.CustomResource/Pages/ViewModel/RecipeCompleteViewModel.cs
  9. +15
    -6
      BPASmartClient.CustomResource/Pages/ViewModel/RunLogViewModel.cs
  10. +6
    -2
      BPASmartClient.Helper/Sqlite.cs
  11. +6
    -1
      BPASmartClient.Helper/ThreadManage.cs
  12. +12
    -4
      BPASmartClient.JXJFoodSmallStation/App.xaml.cs
  13. +65
    -14
      BPASmartClient.JXJFoodSmallStation/Model/GVL_SmallStation.cs
  14. +0
    -41
      BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/DataComm.cs
  15. +71
    -26
      BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/HKDeviceStatus.cs
  16. +58
    -163
      BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/PlcReadAddressDB3.cs
  17. +0
    -13
      BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/PlcWriteAddressDB7.cs
  18. +460
    -807
      BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs
  19. +5
    -0
      BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DeviceAddress.cs
  20. +124
    -47
      BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DeviceInquire.cs
  21. +3
    -0
      BPASmartClient.JXJFoodSmallStation/Model/Siemens/RemoteRecipeRawMaterial.cs
  22. +5
    -1
      BPASmartClient.JXJFoodSmallStation/Model/Siemens/SiemensDeviceStatus.cs
  23. +113
    -0
      BPASmartClient.JXJFoodSmallStation/Resource/MyStyle.xaml
  24. +170
    -43
      BPASmartClient.JXJFoodSmallStation/View/BomOfMaterialView.xaml
  25. +15
    -114
      BPASmartClient.JXJFoodSmallStation/View/DeviceMaterialParView.xaml
  26. +150
    -93
      BPASmartClient.JXJFoodSmallStation/View/ManualControlView.xaml
  27. +362
    -70
      BPASmartClient.JXJFoodSmallStation/View/ManualFlowView.xaml
  28. +2
    -6
      BPASmartClient.JXJFoodSmallStation/View/ManualFlowView.xaml.cs
  29. +67
    -55
      BPASmartClient.JXJFoodSmallStation/View/NewLocalRecipeView.xaml
  30. +148
    -50
      BPASmartClient.JXJFoodSmallStation/View/PlcVarMonitorView.xaml
  31. +131
    -44
      BPASmartClient.JXJFoodSmallStation/View/ProcessMonitorView.xaml
  32. +125
    -37
      BPASmartClient.JXJFoodSmallStation/View/RecipeInfosView.xaml
  33. +16
    -18
      BPASmartClient.JXJFoodSmallStation/View/RecipeReceiveView.xaml
  34. +2
    -2
      BPASmartClient.JXJFoodSmallStation/View/RecipeReceiveView.xaml.cs
  35. +9
    -5
      BPASmartClient.JXJFoodSmallStation/View/RobotView.xaml
  36. +3
    -3
      BPASmartClient.JXJFoodSmallStation/View/SiemensRecipeReceiveView.xaml
  37. +119
    -86
      BPASmartClient.JXJFoodSmallStation/View/StockBinRawMaterialView.xaml
  38. +110
    -36
      BPASmartClient.JXJFoodSmallStation/View/SystemParView.xaml
  39. +125
    -43
      BPASmartClient.JXJFoodSmallStation/View/WindSendParView.xaml
  40. +78
    -16
      BPASmartClient.JXJFoodSmallStation/ViewModel/ManualControlViewModel.cs
  41. +190
    -26
      BPASmartClient.JXJFoodSmallStation/ViewModel/ManualFlowViewModel.cs
  42. +5
    -12
      BPASmartClient.JXJFoodSmallStation/ViewModel/RecipeReceiveViewModel.cs
  43. +58
    -52
      BPASmartClient.JXJFoodSmallStation/ViewModel/RobotViewModel.cs
  44. +14
    -9
      BPASmartClient.Modbus/ModbusTcp.cs

+ 33
- 3
BPASmartClient.CustomResource/Pages/Model/MessageNotify.cs View File

@@ -20,6 +20,7 @@ namespace BPASmartClient.CustomResource.Pages.Model
public static readonly object runLock = new object();
public static readonly object userlock = new object();
public static readonly object alarmlock = new object();
public static readonly object recipeLogslock = new object();
private MessageNotify() { }

public Action<string> UserLog { get; set; }
@@ -28,17 +29,46 @@ namespace BPASmartClient.CustomResource.Pages.Model

public Action<string> AlarmLog { get; set; }

public ObservableCollection<RunLog> runLogs { get; set; } = new ObservableCollection<RunLog>();
public Action<string> RecipeCompleteLogs { get; set; }

public ObservableCollection<UserLog> userLogs { get; set; } = new ObservableCollection<UserLog>();
public ObservableCollection<RunLog> runLogs { get; set; } = new();

public ObservableCollection<Alarm> alarmLogs { get; set; } = new ObservableCollection<Alarm>();
public ObservableCollection<UserLog> userLogs { get; set; } = new();

public ObservableCollection<Alarm> alarmLogs { get; set; } = new();

public ObservableCollection<RecipeCompleteLog> recipeLogs { get; set; } = new();

public void LogSave()
{
Sqlite<UserLog>.GetInstance.Save();
Sqlite<RunLog>.GetInstance.Save();
Sqlite<Alarm>.GetInstance.Save();
Sqlite<RecipeCompleteLog>.GetInstance.Save();
}

public void ShowRecipeLog(string info)
{
lock (recipeLogslock)
{
try
{
RecipeCompleteLog runLog = new RecipeCompleteLog()
{
Date = DateTime.Now.ToString("yyyy-MM-dd"),
Time = DateTime.Now.ToString("HH:mm:ss"),
RecipeName = info
};
Sqlite<RecipeCompleteLog>.GetInstance.Base.Add(runLog);
Application.Current.Dispatcher.Invoke(new Action(() => { recipeLogs.Insert(0, runLog); }));
RecipeCompleteLogs?.Invoke(info);
}
catch (Exception)
{

// throw;
}
}
}

public void ShowUserLog(string info)


+ 22
- 0
BPASmartClient.CustomResource/Pages/Model/RecipeCompleteLog.cs View File

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

namespace BPASmartClient.CustomResource.Pages.Model
{
public class RecipeCompleteLog : ObservableObject
{
[Key]
public int Id { get; set; }

public string Date { get; set; }

public string Time { get; set; }

public string RecipeName { get; set; }
}
}

+ 26
- 25
BPASmartClient.CustomResource/Pages/View/MainView.xaml View File

@@ -21,7 +21,7 @@
</Window.DataContext>

<Window.Resources>

<!--#region 静态资源-->
<ImageBrush x:Key="leftImage" ImageSource="../../Image/leftImage.png" />
@@ -376,33 +376,33 @@
<ControlTemplate TargetType="ToggleButton">
<Grid Cursor="Hand">
<Border
x:Name="bd1"
Width="25"
Height="13"
Margin="0,-10,-5,0"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Panel.ZIndex="100"
Background="#2600CAFF"
CornerRadius="3"
Cursor="Hand"
Visibility="Collapsed">
x:Name="bd1"
Width="25"
Height="13"
Margin="0,-10,-5,0"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Panel.ZIndex="100"
Background="#2600CAFF"
CornerRadius="3"
Cursor="Hand"
Visibility="Collapsed">
<TextBlock
HorizontalAlignment="Center"
FontSize="8"
Foreground="#FF00E6F7"
Text="{Binding ListNum, Mode=TwoWay}" />
HorizontalAlignment="Center"
FontSize="8"
Foreground="#FF00E6F7"
Text="{Binding ListNum, Mode=TwoWay}" />
<!-- -->
</Border>
<Image
x:Name="image1"
Width="{TemplateBinding Width}"
Height="{TemplateBinding Height}"
Panel.ZIndex="0"
RenderOptions.BitmapScalingMode="HighQuality"
SnapsToDevicePixels="True"
Source="/BPASmartClient.CustomResource;component/Image/告警/无告警.png"
UseLayoutRounding="True" />
x:Name="image1"
Width="{TemplateBinding Width}"
Height="{TemplateBinding Height}"
Panel.ZIndex="0"
RenderOptions.BitmapScalingMode="HighQuality"
SnapsToDevicePixels="True"
Source="/BPASmartClient.CustomResource;component/Image/告警/无告警.png"
UseLayoutRounding="True" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="true">
@@ -581,12 +581,13 @@
</Grid.RowDefinitions>
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
<ToggleButton
Margin="0,0,8,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Cursor="Hand"
IsChecked="{Binding IsAlarm}"
Style="{DynamicResource StatusBtnStyle告警}"
ToolTip="心跳检测报警" Margin="0,0,8,0"/>
ToolTip="心跳检测报警" />
<CheckBox
Margin="5,0,8,0"
Content="开机启动"


+ 340
- 0
BPASmartClient.CustomResource/Pages/View/RecipeCompleteView.xaml View File

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

<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary>
<!--<convert:TextDisplayConvert x:Key="textDisplayConvert" />
<convert:IsEnableConvert x:Key="isEnableConvert" />
<convert:AnalogAlarmConvert x:Key="analogAlarmConvert" />
<convert:DiscreteAlarmConvert x:Key="discreteAlarmConvert" />
<convert:AlarmTypeTextConvert x:Key="alarmTypeTextConvert" />-->
<SolidColorBrush x:Key="BorderSolid" Color="#5523CACA" />
<SolidColorBrush x:Key="FontColor" Color="#FF2AB2E7" />
<SolidColorBrush x:Key="TitleFontColor" Color="#FF2AB2E7" />
<SolidColorBrush x:Key="CursorColor" Color="Aqua" />
<SolidColorBrush x:Key="TitleBorderColor" Color="#332AB2E7" />

<Style x:Key="TextBlockStyle" TargetType="TextBlock">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="18" />
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>

<Style x:Key="TextBoxStyle" TargetType="TextBox">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="22" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" />
<Setter Property="BorderBrush" Value="#FF23CACA" />
<Setter Property="CaretBrush" Value="Aqua" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>

<Style x:Key="DataTextBlockStyle" TargetType="TextBlock">
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="#FF2BD06F" />
<Setter Property="FontSize" Value="14" />
</Style>

<ControlTemplate x:Key="ButTemplate" TargetType="Button">
<Border
x:Name="br"
Background="Transparent"
BorderBrush="#FF19B7EC"
BorderThickness="2">
<StackPanel
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Horizontal">
<ContentControl
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="{TemplateBinding Content}"
Foreground="{TemplateBinding Foreground}" />
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="br" Property="Background" Value="#2219B7EC" />
</Trigger>

<Trigger Property="IsPressed" Value="true">
<Setter TargetName="br" Property="Background" Value="#2219B7EC" />
</Trigger>

</ControlTemplate.Triggers>
</ControlTemplate>

</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>

<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition Height="30" />
<RowDefinition />
</Grid.RowDefinitions>
<StackPanel
Margin="0,8"
HorizontalAlignment="Right"
Orientation="Horizontal">

<DatePicker
Background="Transparent"
BorderBrush="#aa3aa7f3"
BorderThickness="2"
SelectedDate="{Binding StartDateTime}"
Style="{StaticResource PickerStyle}"
Text="请输入开始时间"
Visibility="{Binding IsVisibility}" />

<DatePicker
Margin="20,0,20,0"
Background="Transparent"
BorderBrush="#aa3aa7f3"
BorderThickness="2"
SelectedDate="{Binding EndDateTime}"
Style="{StaticResource PickerStyle}"
Text="请输入结束时间"
Visibility="{Binding IsVisibility}" />

<Button
Width="140"
Height="30"
Background="#FF19B7EC"
Command="{Binding ControlCommand}"
Content="{Binding ControlButText}"
FontFamily="楷体"
FontSize="18"
Template="{StaticResource ButTemplate}"
Visibility="{Binding IsVisibility}">
<Button.Foreground>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Color="#FFBB662A" />
<GradientStop Offset="1" Color="White" />
</LinearGradientBrush>
</Button.Foreground>
</Button>

<Button
Width="140"
Height="30"
Margin="20,0,0,0"
Background="#FF19B7EC"
Command="{Binding SwitchCommand}"
Content="{Binding ButContent}"
FontFamily="楷体"
FontSize="18"
Template="{StaticResource ButTemplate}">
<Button.Foreground>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Color="#FFBB662A" />
<GradientStop Offset="1" Color="White" />
</LinearGradientBrush>
</Button.Foreground>
</Button>

</StackPanel>

<!--#region 表格标题栏设置-->
<Grid
Grid.Row="1"
Margin="0,0,17,0"
Background="#ff0C255F">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.2*" />
<ColumnDefinition Width="0.2*" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="日期" />

<Grid Grid.Column="1">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="时间" />
<Border
BorderBrush="{StaticResource TitleBorderColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBlock
Grid.Column="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="配方名称" />

<!--<Grid Grid.Column="3">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="报警信息" />
<Border
BorderBrush="{StaticResource TitleBorderColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>-->

<!--<TextBlock
Grid.Column="4"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="报警值" />

<Grid Grid.Column="5">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="报警等级" />
<Border
BorderBrush="{StaticResource TitleBorderColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>-->
</Grid>
<!--#endregion-->

<!--#region 表格数据显示-->
<ScrollViewer
Grid.Row="2"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Visible">

<Grid>
<!--#region 实时报警信息-->
<ItemsControl ItemsSource="{Binding Log}" Visibility="{Binding CurrentDataVis}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid x:Name="gr" Height="30">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.2*" />
<ColumnDefinition Width="0.2*" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="0"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Date}" />

<Grid Grid.Column="1">
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Time}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<TextBlock
Grid.Column="2"
Margin="10,0,0,0"
HorizontalAlignment="Left"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding RunLogInfo}"
TextWrapping="Wrap" />

<Border
Grid.ColumnSpan="6"
BorderBrush="{StaticResource BorderSolid}"
BorderThickness="1" />

</Grid>

<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" />
</Trigger>
</DataTemplate.Triggers>

</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<!--#endregion-->

<!--#region 历史报警信息-->
<ItemsControl ItemsSource="{Binding HistoryRunLog}" Visibility="{Binding HistoryDataVis}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid x:Name="gr" Height="30">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.2*" />
<ColumnDefinition Width="0.2*" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="0"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Date}" />

<Grid Grid.Column="1">
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Time}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<TextBlock
Grid.Column="2"
Margin="10,0,0,0"
HorizontalAlignment="Left"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding RunLogInfo}" />

<Border
Grid.ColumnSpan="6"
BorderBrush="{StaticResource BorderSolid}"
BorderThickness="1" />

</Grid>

<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" />
</Trigger>
</DataTemplate.Triggers>

</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<!--#endregion-->
</Grid>
</ScrollViewer>
<!--#endregion-->


</Grid>
</UserControl>

+ 28
- 0
BPASmartClient.CustomResource/Pages/View/RecipeCompleteView.xaml.cs View File

@@ -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.CustomResource.Pages.View
{
/// <summary>
/// RecipeCompleteView.xaml 的交互逻辑
/// </summary>
public partial class RecipeCompleteView : UserControl
{
public RecipeCompleteView()
{
InitializeComponent();
}
}
}

+ 13
- 10
BPASmartClient.CustomResource/Pages/View/RunLogView.xaml View File

@@ -158,10 +158,13 @@
</StackPanel>

<!--#region 表格标题栏设置-->
<Grid Grid.Row="1" Background="#ff0C255F">
<Grid
Grid.Row="1"
Margin="0,0,17,0"
Background="#ff0C255F">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.2*" />
<ColumnDefinition Width="0.2*" />
<ColumnDefinition Width="150" />
<ColumnDefinition Width="150" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

@@ -241,10 +244,10 @@
<ItemsControl ItemsSource="{Binding Log}" Visibility="{Binding CurrentDataVis}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid x:Name="gr" Height="30">
<Grid x:Name="gr" MinHeight="30">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.2*" />
<ColumnDefinition Width="0.2*" />
<ColumnDefinition Width="150" />
<ColumnDefinition Width="150" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

@@ -264,7 +267,7 @@
HorizontalAlignment="Left"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding RunLogInfo}"
TextWrapping="Wrap"/>
TextWrapping="Wrap" />

<Border
Grid.ColumnSpan="6"
@@ -288,10 +291,10 @@
<ItemsControl ItemsSource="{Binding HistoryRunLog}" Visibility="{Binding HistoryDataVis}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid x:Name="gr" Height="30">
<Grid x:Name="gr" MinHeight="30">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.2*" />
<ColumnDefinition Width="0.2*" />
<ColumnDefinition Width="150" />
<ColumnDefinition Width="150" />
<ColumnDefinition />
</Grid.ColumnDefinitions>



+ 1
- 1
BPASmartClient.CustomResource/Pages/View/UserLogView.xaml View File

@@ -240,7 +240,7 @@
</StackPanel>

<!--#region 表格标题栏设置-->
<Grid Grid.Row="1" Background="#ff0C255F">
<Grid Grid.Row="1" Margin="0 0 17 0" Background="#ff0C255F">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.3*" />
<ColumnDefinition Width="0.3*" />


+ 126
- 0
BPASmartClient.CustomResource/Pages/ViewModel/RecipeCompleteViewModel.cs View File

@@ -0,0 +1,126 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using System.Collections.ObjectModel;
using BPASmartClient.CustomResource.Pages.Model;
using System.Windows;
using BPASmartClient.Helper;

namespace BPASmartClient.CustomResource.Pages.ViewModel
{
public class RecipeCompleteViewModel : ObservableObject
{
public RecipeCompleteViewModel()
{
Sqlite<RecipeCompleteLog>.GetInstance.Save();
SwitchCommand = new RelayCommand(() =>
{
if (ButContent == "历史日志")
{
GetHistoryRunLog();
CurrentDataVis = Visibility.Hidden;
HistoryDataVis = Visibility.Visible;
IsVisibility = Visibility.Visible;
ControlButText = "开始查询";
ButContent = "实时日志";
return;
}

if (ButContent == "实时日志")
{
HistoryDataVis = Visibility.Hidden;
CurrentDataVis = Visibility.Visible;
IsVisibility = Visibility.Hidden;
ButContent = "历史日志";
return;
}

});

ControlCommand = new RelayCommand(() =>
{

if (ControlButText == "报警复位") return;
if (ControlButText == "开始查询")
{
var lists = Sqlite<RecipeCompleteLog>.GetInstance.GetData();
var res = lists.Where(p => Convert.ToDateTime(p.Date) >= StartDateTime && Convert.ToDateTime(p.Date) <= EndDateTime).ToList();
if (res != null)
{
HistoryRunLog.Clear();
foreach (var item in res)
{
HistoryRunLog.Add(item);
}
}
}

});
}

private void GetHistoryRunLog()
{
var data = Sqlite<RecipeCompleteLog>.GetInstance.GetData();
if (data != null)
{
HistoryRunLog.Clear();
foreach (var item in data)
{
int day = DateTime.Now.Subtract(Convert.ToDateTime(item.Date)).Days;
if (day == 0)
{
HistoryRunLog.Add(item);
}
}
}
}

public RelayCommand SwitchCommand { get; set; }

public RelayCommand ControlCommand { get; set; }

public Visibility CurrentDataVis { get { return _mCurrentDataVis; } set { _mCurrentDataVis = value; OnPropertyChanged(); } }
private Visibility _mCurrentDataVis = Visibility.Visible;

public Visibility HistoryDataVis { get { return _mHistoryDataVis; } set { _mHistoryDataVis = value; OnPropertyChanged(); } }
private Visibility _mHistoryDataVis = Visibility.Hidden;

/// <summary>
/// 是否显示
/// </summary>
public Visibility IsVisibility { get { return _mIsVisibility; } set { _mIsVisibility = value; OnPropertyChanged(); } }
private Visibility _mIsVisibility = Visibility.Hidden;

/// <summary>
/// 文字显示
/// </summary>
public string ButContent { get { return _mButContent; } set { _mButContent = value; OnPropertyChanged(); } }
private string _mButContent = "历史日志";

/// <summary>
/// 控制按钮文本显示
/// </summary>
public string ControlButText { get { return _mControlButText; } set { _mControlButText = value; OnPropertyChanged(); } }
private string _mControlButText = "报警复位";

/// <summary>
/// 开始时间
/// </summary>
public DateTime StartDateTime { get { return _mStartDateTime; } set { _mStartDateTime = value; OnPropertyChanged(); } }
private DateTime _mStartDateTime = DateTime.Now;

/// <summary>
/// 结束时间
/// </summary>
public DateTime EndDateTime { get { return _mEndDateTime; } set { _mEndDateTime = value; OnPropertyChanged(); } }
private DateTime _mEndDateTime = DateTime.Now;

public ObservableCollection<RecipeCompleteLog> HistoryRunLog { get; set; } = new ObservableCollection<RecipeCompleteLog>();

public ObservableCollection<RecipeCompleteLog> Log { get; set; } = MessageNotify.GetInstance.recipeLogs;
}
}

+ 15
- 6
BPASmartClient.CustomResource/Pages/ViewModel/RunLogViewModel.cs View File

@@ -9,6 +9,7 @@ using System.Collections.ObjectModel;
using BPASmartClient.CustomResource.Pages.Model;
using System.Windows;
using BPASmartClient.Helper;
using System.Diagnostics;

namespace BPASmartClient.CustomResource.Pages.ViewModel
{
@@ -67,15 +68,23 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
var data = Sqlite<RunLog>.GetInstance.GetData();
if (data != null)
{
HistoryRunLog.Clear();
foreach (var item in data)
var res = data.Where(p => p.Date == DateTime.Now.ToString("yyyy-MM-dd")).ToList();
if (res != null)
{
int day = DateTime.Now.Subtract(Convert.ToDateTime(item.Date)).Days;
if (day == 0)
HistoryRunLog.Clear();
res.ForEach(item =>
{
HistoryRunLog.Add(item);
}
});
}
//foreach (var item in data)
//{
// int day = DateTime.Now.Subtract(Convert.ToDateTime(item.Date)).Days;
// if (day == 0)
// {
// HistoryRunLog.Add(item);
// }
//}
}
}

@@ -106,7 +115,7 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
/// </summary>
public string ControlButText { get { return _mControlButText; } set { _mControlButText = value; OnPropertyChanged(); } }
private string _mControlButText = "报警复位";
/// <summary>
/// 开始时间
/// </summary>


+ 6
- 2
BPASmartClient.Helper/Sqlite.cs View File

@@ -27,8 +27,10 @@ namespace BPASmartClient.Helper
{
get
{
Directory.CreateDirectory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"AccessFile\\DB"));
return $"{AppDomain.CurrentDomain.BaseDirectory}AccessFile\\DB\\{typeof(T).Name}.db";
int Year = DateTime.Now.Year;
int Month = DateTime.Now.Month;
Directory.CreateDirectory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"AccessFile\\DB\\{Year}-{Month}"));
return $"{AppDomain.CurrentDomain.BaseDirectory}AccessFile\\DB\\{Year}-{Month}\\{typeof(T).Name}.db";
}
}
public bool DataBaseExist()
@@ -48,5 +50,7 @@ namespace BPASmartClient.Helper
return Base.ToList();
}



}
}

+ 6
- 1
BPASmartClient.Helper/ThreadManage.cs View File

@@ -197,8 +197,13 @@ namespace BPASmartClient.Helper
/// <returns></returns>
public bool IsCanncel(string key)
{
if(CancellationTokenSources.ContainsKey(guid + key)) return CancellationTokenSources[guid + key].IsCancellationRequested;
if (CancellationTokenSources.ContainsKey(guid + key)) return CancellationTokenSources[guid + key].IsCancellationRequested;
return false;
}

public bool IsContainsKey(string key)
{
return Threads.ContainsKey(guid + key);
}
}
}

+ 12
- 4
BPASmartClient.JXJFoodSmallStation/App.xaml.cs View File

@@ -37,7 +37,7 @@ namespace BPASmartClient.JXJFoodSmallStation
}
BPASmartClient.Helper.SystemHelper.GetInstance.CreateDesktopShortcut();
base.OnStartup(e);
MenuInit();
DataInit();
Init();
@@ -53,7 +53,7 @@ namespace BPASmartClient.JXJFoodSmallStation
mv.Close();
MainWindow = mv;
}
private async void Init()
private async void Init()
{
await Task.Run(new Action(() =>
{
@@ -153,7 +153,7 @@ namespace BPASmartClient.JXJFoodSmallStation
AssemblyName = "BPASmartClient.JXJFoodSmallStation",
ToggleWindowPath = "View.BomOfMaterialView"
});
MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "&#xe62d;",
@@ -187,7 +187,7 @@ namespace BPASmartClient.JXJFoodSmallStation
AssemblyName = "BPASmartClient.JXJFoodSmallStation",
ToggleWindowPath = "View.ManualFlowView"

});
});
ManualControl.Add(new SubMenumodel()
{
SubMenuName = "机器人设备控制",
@@ -224,6 +224,14 @@ namespace BPASmartClient.JXJFoodSmallStation
ToggleWindowPath = "Pages.View.RunLogView"
});

InfoLog.Add(new SubMenumodel()
{
SubMenuName = "配方日志",
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.RecipeCompleteView"
});

InfoLog.Add(new SubMenumodel()
{
SubMenuName = "报警记录",


+ 65
- 14
BPASmartClient.JXJFoodSmallStation/Model/GVL_SmallStation.cs View File

@@ -27,14 +27,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
/// </summary>
public const int Max_PowderSotckBinNum = 5;


[VarComm("Global", "订单取消")]
/// <summary>
/// 订单取消
/// </summary>
public bool NotUseSmallDosing { get; set; }


[VarComm("Global", "订单取消")]
/// <summary>
/// 订单取消
@@ -47,6 +39,28 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
/// </summary>
public string Order_CancelRecipeCode { get; set; } = "";

[VarComm("Global", "柔性配料料仓配料下发情况")]
/// <summary>
/// 料仓配料情况
/// </summary>
public bool[] PlcAllowIssueRecipe { get; set; } = new bool[5] { false, false, false, false,false };

[VarComm("Global", "柔性配料料仓,气缸顶起状态")]
/// <summary>
/// 柔性配料料仓,气缸顶起状态
/// </summary>
public ushort StockBinCylinderStatus { get; set; }

[VarComm("Global", "柔性配料料仓配料下发情况")]
/// <summary>
/// 料仓配料情况
/// </summary>
public ushort[] StockBinDosingIssue { get; set; } = new ushort[5] { 0, 0, 0, 0, 0 };
[VarComm("Global", "柔性配料料仓配料下发情况")]
/// <summary>
/// 料仓配料情况
/// </summary>
public ushort[] RecipeStockBinDosing { get; set; } = new ushort[5] { 0, 0, 0, 0, 0 };

[VarComm("Global", "柔性配料料仓配料情况")]
/// <summary>
@@ -60,6 +74,12 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
/// </summary>
public int Tray1LogicFinish { get; set; } = 0;

[VarComm("Global", "托盘1托盘到位情况0:未到位,1=AGV到位,2=托盘有货架,3=AGV取托盘完成")]
/// <summary>
/// 托盘1托盘到位情况
/// </summary>
public int[] Tray_AGVLogic { get; set; } = new int[5] { 0, 0, 0, 0, 0 };

[VarComm("Global", "托盘2托盘到位情况0:未到位,1=AGV到位,2=托盘有货架,3=AGV取托盘完成")]
/// <summary>
/// 托盘2托盘到位 逻辑完成
@@ -142,6 +162,13 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
public bool HeartBeatToPlc { get; set; } = false;

[VarComm("Global", "来自plc的心跳")]


public bool DisEnableStockAlarm { get; set; } = false;

[VarComm("Global", "来自plc的心跳")]


/// <summary>
/// 来自plc的心跳
/// </summary>
@@ -165,14 +192,25 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
/// </summary>
public int RecipeStatusIDTray1 { get; set; } = 0;


[VarComm("Global", "配方2下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料")]
[VarComm("Global", "配方1下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料")]
/// <summary>
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料
/// </summary>
public int[] RecipeProcessStatus { get; set; } = new int[5] { 0, 0, 0, 0, 0 };


[VarComm("Global", "配方1下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料")]
/// <summary>
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料
/// </summary>
public bool AGVIsGetTray { get; set; } = false;

[VarComm("Global", "配方2下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料")]
/// <summary>
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料
/// </summary>
public int RecipeStatusIDTray2 { get; set; } = 0;

[VarComm("Global", "当前配方正在配料位置")]
/// <summary>
/// 当前料仓的位置
@@ -180,11 +218,13 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
public int StockInIsWork { get; set; } = 0;


[VarComm("Global", "是否使用粉仓配料")]


[VarComm("Global", "设置料仓配料完成")]
/// <summary>
/// 是否使用粉仓配料
/// 当前料仓的位置
/// </summary>
public bool RequestOrder { get; set; } = false;
public bool[] StockInDosingComple { get; set; } = new bool[15];


[VarComm("Global", "是否使用粉仓配料")]
@@ -213,11 +253,22 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
/// </summary>
public bool IsUseLocalRecipe { get; set; }

[VarComm("Global", "是否使用本地模拟配方")]
/// <summary>
/// 是否使用本地模拟配方
/// </summary>
public bool NotUseSmallStation { get; set; }

/// <summary>
/// 配料时间
/// </summary>
public DateTime time1;

/// <summary>
/// 配料时间
/// </summary>
public DateTime[] DosingTime = new DateTime[5] { DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now };

/// <summary>
/// 原料的名称和原料编号对应,Mes提供的信息
/// </summary>
@@ -263,7 +314,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
/// <summary>
/// 延迟采集料仓的配料完成重量
/// </summary>
public int Time { get; set; } = 1000;
public int Time { get; set; } = 2000;

[VarComm("Global", "取消订单的步骤号")]
/// <summary>


+ 0
- 41
BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/DataComm.cs View File

@@ -1,41 +0,0 @@
using BPASmartClient.Helper;
using BPASmartClient.Modbus;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC
{
public class DataComm
{
public volatile static DataComm Instance;
public static DataComm GetInstance => Instance ?? (new DataComm());
public DataComm() { }
/// <summary>
/// 是否允许配料
/// </summary>
public bool IsAllowDosing { get { return _mIsAllowDosing; } set { _mIsAllowDosing = value; } }
private bool _mIsAllowDosing;

public bool DosingFinishToPLC { get { return _mDosingFinishToPLC; } set { _mDosingFinishToPLC = value; } }
private bool _mDosingFinishToPLC;

private int _mStockBinLocationToPLC;
public int StockBinLocationToPLC { get { return _mStockBinLocationToPLC; } set { _mStockBinLocationToPLC = value; } }

public bool StatusSignToBPA { get { return _mStatusSignToBPA; } set { _mStatusSignToBPA = value; } }
private bool _mStatusSignToBPA;

private int _mStockBinLocationToBPA;
public int StockBinLocationToBPA { get { return _mStockBinLocationToBPA; } set { _mStockBinLocationToBPA = value; } }

private int _mBarrelNumToPLC;
public int BarrelNumToPLC { get { return _mBarrelNumToPLC; } set { _mBarrelNumToPLC = value; } }
/*public ConcurrentDictionary<int, StockBinLocations> DeviceLists = new ConcurrentDictionary<int, StockBinLocations>();*/
}
}

+ 71
- 26
BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/HKDeviceStatus.cs View File

@@ -192,38 +192,83 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC

public void IssueRecipeToPlc(ObservableCollection<RemoteRecipeRawMaterial> rawMaterials,int recipeLoction)
{
if (IsConnected)
bool[] barrel = new bool[16];
bool[] barrel1 = new bool[16];
bool[] barrel2 = new bool[16];
bool[] barrel3 = new bool[16];
ushort barrel1_short = 0;
ushort barrel2_short = 0;
ushort barrel3_short = 0;

foreach (var item in rawMaterials)
{
switch (item.RawMaterialBarrelNum)
{
case 6:
barrel[item.RawMaterialLocation-1] = true;
barrel1[item.RawMaterialLocation - 1] = true;
break;
case 7:
barrel[item.RawMaterialLocation - 1] = true;
barrel2[item.RawMaterialLocation - 1] = true;
break;
case 8:
barrel[item.RawMaterialLocation - 1] = true;
barrel3[item.RawMaterialLocation - 1] = true;
break;
default:
break;
}
}
for (int i = 0; i < 16; i++)
{
ushort barrel1 = 0;
ushort barrel2 = 0;
ushort barrel3 = 0;
foreach (var item in rawMaterials)
if (recipeLoction == 0)
{
switch (item.RawMaterialBarrelNum)
if (i >= 8)
{
HK_PLC_S7.Write<bool>("DB4.DBX15." + (i - 8), barrel1[i]);
HK_PLC_S7.Write<bool>("DB4.DBX17." + (i - 8), barrel2[i]);
HK_PLC_S7.Write<bool>("DB4.DBX19." + (i - 8), barrel3[i]);
}
else
{
case 1:
barrel1 = barrel1.SetBitValue((byte)item.RawMaterialLocation, true);
break;
case 2:
barrel2 = barrel2.SetBitValue((byte)item.RawMaterialLocation, true);
break;
case 3:
barrel3 = barrel3.SetBitValue((byte)item.RawMaterialLocation, true);
break;
default:
break;
HK_PLC_S7.Write<bool>("DB4.DBX14." + i, barrel1[i]);
HK_PLC_S7.Write<bool>("DB4.DBX16." + i, barrel2[i]);
HK_PLC_S7.Write<bool>("DB4.DBX18." + i, barrel3[i]);
}
barrel1_short = barrel1_short.SetBitValue((byte)(i + 1), barrel1[i]);
barrel2_short = barrel2_short.SetBitValue((byte)(i + 1), barrel2[i]);
barrel3_short = barrel3_short.SetBitValue((byte)(i + 1), barrel3[i]);
GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeLoction] = GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeLoction].SetBitValue((byte)(i + 1), barrel[i]);
}
else if (recipeLoction == 1)
{
if (i >= 8)
{
HK_PLC_S7.Write<bool>("DB4.DBX21." + (i - 8), barrel1[i]);
HK_PLC_S7.Write<bool>("DB4.DBX23." + (i - 8), barrel2[i]);
HK_PLC_S7.Write<bool>("DB4.DBX25." + (i - 8), barrel3[i]);
}
else
{
HK_PLC_S7.Write<bool>("DB4.DBX20." + i, barrel1[i]);
HK_PLC_S7.Write<bool>("DB4.DBX22." + i, barrel2[i]);
HK_PLC_S7.Write<bool>("DB4.DBX24." + i, barrel3[i]);
}
barrel1_short = barrel1_short.SetBitValue((byte)(i + 1), barrel1[i]);
barrel2_short = barrel2_short.SetBitValue((byte)(i + 1), barrel2[i]);
barrel3_short = barrel3_short.SetBitValue((byte)(i + 1), barrel3[i]);
GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeLoction] = GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeLoction].SetBitValue((byte)(i + 1), barrel[i]);
}
string AddresBarrel1 = "DB4.DBW" + (12 + (recipeLoction - 1) * 6);
string AddresBarrel2 = "DB4.DBW" + (14 + (recipeLoction - 1) * 6);
string AddresBarrel3 = "DB4.DBW" + (16 + (recipeLoction - 1) * 6);
HK_PLC_S7.Write<ushort>(AddresBarrel1, barrel1);
HK_PLC_S7.Write<ushort>(AddresBarrel2, barrel2);
HK_PLC_S7.Write<ushort>(AddresBarrel3, barrel3);
MessageNotify.GetInstance.ShowRunLog($"配方下发,plc配方位置{recipeLoction},桶1料仓配料{barrel1.ToBinString}");
MessageNotify.GetInstance.ShowRunLog($"配方下发,plc配方位置{recipeLoction},桶2料仓配料{barrel1.ToBinString}");
MessageNotify.GetInstance.ShowRunLog($"配方下发,plc配方位置{recipeLoction},桶3料仓配料{barrel1.ToBinString}");
}
//HK_PLC_S7.Write<bool[]>(AddresBarrel1, barrel1);
//HK_PLC_S7.Write<bool[]>(AddresBarrel2, barrel2);
//HK_PLC_S7.Write<bool[]>(AddresBarrel3, barrel3);
MessageNotify.GetInstance.ShowRunLog($"配方下发,plc配方位置{recipeLoction},桶1料仓配料{barrel1_short},配料位置{barrel1_short.ToBinString()}");
MessageNotify.GetInstance.ShowRunLog($"配方下发,plc配方位置{recipeLoction},桶2料仓配料{barrel2_short},配料位置{barrel2_short.ToBinString()}");
MessageNotify.GetInstance.ShowRunLog($"配方下发,plc配方位置{recipeLoction},桶3料仓配料{barrel3_short},配料位置{barrel3_short.ToBinString()}");
MessageNotify.GetInstance.ShowRunLog($"配方下发,plc配方位置{recipeLoction},料仓配料{GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeLoction]},配料位置{GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeLoction].ToBinString()}");

}
}
}

+ 58
- 163
BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/PlcReadAddressDB3.cs View File

@@ -9,170 +9,65 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC
{
public class PlcReadAddressDB3
{
[VarComm("DB3.DBX0.0","心跳")]
[VarComm("DB3.DBX0.0", "心跳")]
public bool HeartBeat { get; set; }
[VarComm("DB3.DBX0.1", "备用1")]
public bool Standby1 { get; set; }
[VarComm("DB3.DBX0.2", "备用2")]
public bool Standby2 { get; set; }
[VarComm("DB3.DBX0.3", "备用3")]
public bool Standby3 { get; set; }
[VarComm("DB3.DBX0.4", "备用4")]
public bool Standby4 { get; set; }
[VarComm("DB3.DBX0.5", "备用5")]
public bool Standby5 { get; set; }
[VarComm("DB3.DBX0.6", "备用6")]
public bool Standby6 { get; set; }
[VarComm("DB3.DBX0.7", "工站1有托盘")]
public bool WorkStation1HaveTray { get; set; }

[VarComm("DB3.DBX1.0", "工站2有托盘")]
public bool WorkStation2HaveTray { get; set; }
[VarComm("DB3.DBX1.1", "工站1配料完成")]
public bool WorkStation1DosingComplete { get; set; }
[VarComm("DB3.DBX1.2", "工站2配料完成")]
public bool WorkStation2DosingComplete { get; set; }
[VarComm("DB3.DBX1.3", "工站1接收配方完成")]
public bool WorkStation1ReceviceRecipeComplete { get; set; }
[VarComm("DB3.DBX1.4", "工站2接收配方完成")]
public bool WorkStation2ReceviceRecipeComplete { get; set; }
[VarComm("DB3.DBX1.5", "工站1气缸报警")]
public bool WorkStation1CylinderAlarm { get; set; }
[VarComm("DB3.DBX1.6", "工站2气缸报警")]
public bool WorkStation2CylinderAlarm { get; set; }
[VarComm("DB3.DBX1.7", "允许配方1下发配方")]
public bool AllowRecipe1Issue { get; set; }

[VarComm("DB3.DBX2.0", "允许配方2下发配方")]
public bool AllowRecipe2Issue { get; set; }
[VarComm("DB3.DBX2.1", "工站1传感器信号")]
public bool WorkStation1Sensor { get; set; }
[VarComm("DB3.DBX2.2", "工站2传感器信号")]
public bool WorkStation2Sensor { get; set; }
[VarComm("DB3.DBX2.3", "工站1气缸信号,false=伸出")]
public bool WorkStation1Cylinder { get; set; }
[VarComm("DB3.DBX2.4", "工站2气缸信号,false=伸出")]
public bool WorkStation2Cylinder { get; set; }
[VarComm("DB3.DBX2.5", "工站1取消订单")]
public bool WorkStation1OrderCancel { get; set; }
[VarComm("DB3.DBX2.6", "工站2取消订单")]
public bool WorkStation2OrderCancel { get; set; }
[VarComm("DB3.DBX2.7", "备用7")]
public bool Standby7 { get; set; }
[VarComm("DB3.DBB3", "备用")]
public byte Standby81 { get; set; }
[VarComm("DB3.DBB4", "备用")]
public byte Standby82 { get; set; }
[VarComm("DB3.DBB5", "备用")]
public byte Standby83 { get; set; }
[VarComm("DB3.DBW6", "备用")]
public int Standby9 { get; set; }

[VarComm("DB3.DBD10", "工站1_1号桶的位置")]
public float WorkStation1Barrel1Pos { get; set; }
[VarComm("DB3.DBD14", "工站1_2号桶的位置")]
public float WorkStation1Barrel2Pos { get; set; }
[VarComm("DB3.DBD18", "工站1_3号桶的位置")]
public float WorkStation1Barrel3Pos { get; set; }
[VarComm("DB3.DBD22", "工站1_4号桶的位置")]
public float WorkStation1Barrel4Pos { get; set; }
[VarComm("DB3.DBD26", "工站2_1号桶的位置")]
public float WorkStation2Barrel1Pos { get; set; }
[VarComm("DB3.DBD30", "工站2_2号桶的位置")]
public float WorkStation2Barrel2Pos { get; set; }
[VarComm("DB3.DBD34", "工站2_3号桶的位置")]
public float WorkStation2Barrel3Pos { get; set; }
[VarComm("DB3.DBD38", "工站2_4号桶的位置")]
public float WorkStation2Barrel4Pos { get; set; }

[VarComm("DB3.DBD42", "备用")]
public int StandBy42 { get; set; }
[VarComm("DB3.DBD46", "备用")]
public int StandBy46 { get; set; }

[VarComm("DB3.DBX50.0", "工站1_1号桶允许配料")]
public bool WorkStation1Barrel1AllowDosing { get; set; }
[VarComm("DB3.DB50.1", "工站1_2号桶允许配料")]
public bool WorkStation1Barrel2AllowDosing { get; set; }
[VarComm("DB3.DB50.2", "工站1_3号桶允许配料")]
public bool WorkStation1Barrel3AllowDosing { get; set; }
[VarComm("DB3.DB50.3", "工站1_4号桶允许配料")]
public bool WorkStation1Barrel4AllowDosing { get; set; }
[VarComm("DB3.DB50.4", "工站2_1号桶允许配料")]
public bool WorkStation2Barrel1AllowDosing { get; set; }
[VarComm("DB3.DB50.5", "工站2_2号桶允许配料")]
public bool WorkStation2Barrel2AllowDosing { get; set; }
[VarComm("DB3.DB50.6", "工站2_3号桶允许配料")]
public bool WorkStation2Barrel3AllowDosing { get; set; }
[VarComm("DB3.DB50.7", "工站2_4号桶允许配料")]
public bool WorkStation2Barrel4AllowDosing { get; set; }

[VarComm("DB3.DBD52", "备用")]
public int Standby15 { get; set; }
[VarComm("DB3.DBD56", "备用")]
public int Standby16 { get; set; }
[VarComm("DB3.DBD60", "备用")]
public int Standby17 { get; set; }
[VarComm("DB3.DBD64", "备用")]
public int Standby18 { get; set; }
[VarComm("DB3.DBD68", "备用")]
public int Standby19 { get; set; }
[VarComm("DB3.DBD72", "备用")]
public int Standby20 { get; set; }
[VarComm("DB3.DBD76", "备用")]
public int Standby21 { get; set; }
[VarComm("DB3.DBD80", "备用")]
public int Standby22 { get; set; }
[VarComm("DB3.DBD84", "备用")]
public int Standby23 { get; set; }
[VarComm("DB3.DBD88", "备用")]
public int Standby24 { get; set; }
[VarComm("DB3.DBD92", "备用")]
public int Standby25 { get; set; }
[VarComm("DB3.DBD96", "备用")]
public int Standby26 { get; set; }

[VarComm("DB3.DBX100.0", "机器人运行模式")]
public bool RobotRunMode { get; set; }
[VarComm("DB3.DBX100.1", "机器人自动运行")]
public bool RobotAutoRun { get; set; }
[VarComm("DB3.DBX100.2", "机器人停止")]
public bool RobotStop { get; set; }
[VarComm("DB3.DBX100.3", "机器人运行")]
public bool RobotRun { get; set; }
[VarComm("DB3.DBX100.4", "机器人运行报警")]
public bool RobotRunAlarm { get; set; }
[VarComm("DB3.DBX100.5", "机器人在原点")]

[VarComm("DB3.DBX0.1", "机器人自动运行模式")]
public bool RobotAutoRunMode { get; set; }

[VarComm("DB3.DBX0.2", "机器人正在自动运行")]
public bool RobotAutoRunning { get; set; }

[VarComm("DB3.DBX0.3", "机器人停止运行")]
public bool RobotStopped { get; set; }

[VarComm("DB3.DBX0.4", "机器人正常运行")]
public bool RobotRunning { get; set; }

[VarComm("DB3.DBX0.5", "机器人运行故障")]
public bool RobotAlarm { get; set; }

[VarComm("DB3.DBX0.6", "机器人在Home点")]
public bool RobotInHomed { get; set; }
[VarComm("DB3.DBX100.6", "机器人备用")]
public bool Standby30 { get; set; }
[VarComm("DB3.DBX100.7", "机器人取空桶完成")]
public bool RobotGetEmptyBarrelComplete { get; set; }

[VarComm("DB3.DBX101.0", "机器人放空桶完成")]
public bool RobotPutEmptyBarrelComplete { get; set; }
[VarComm("DB3.DBX101.1", "机器人取满桶完成")]
public bool RobotGetFullBarrelComplete { get; set; }
[VarComm("DB3.DBX101.2", "机器人放满桶完成")]
public bool RobotPutFullBarrelComplete { get; set; }
[VarComm("DB3.DBX101.3", "备用")]
public bool Standby31 { get; set; }
[VarComm("DB3.DBX101.4", "备用")]
public bool Standby32 { get; set; }
[VarComm("DB3.DBX101.5", "备用")]
public bool Standby33 { get; set; }
[VarComm("DB3.DBX101.6", "备用")]
public bool Standby34 { get; set; }
[VarComm("DB3.DBX101.7", "备用")]
public bool Standby35 { get; set; }

[VarComm("DB3.DBB102", "机器人运行的程序号")]
public byte RobotProgramNum { get; set; }
[VarComm("DB3.DBB103", "备用")]
public byte Standby36 { get; set; }
[VarComm("DB3.DBB104", "备用")]
public byte Standby37 { get; set; }
[VarComm("DB3.DBB105", "备用")]
public byte Standby38 { get; set; }

[VarComm("DB3.DBX1.0", "机器人执行程序号")]
public byte RobotRunProgram{ get; set; }

[VarComm("DB3.DBX2.0", "Plc允许工单下发")]
public bool[] RecipeAllowIssue { get; set; }=new bool[16];

[VarComm("DB3.DBX4.0", "Plc工单接收完成")]
public bool[] RecipeReceviceComple { get; set; } = new bool[16];

[VarComm("DB3.DBX6.0", "工单配料完成")]
public bool[] RecipeDosingComple { get; set; } = new bool[16];

[VarComm("DB3.DBX8.0", "允许单个料仓下料")]
public bool[] StockBinAllowIssue { get; set; } = new bool[16];

[VarComm("DB3.DBW10", "配方1桶位置反馈")]
public ushort[] Recipe1BarrelPosReserve { get; set; } = new ushort[3];

[VarComm("DB3.DBW16", "配方2桶位置反馈")]
public ushort[] Recipe2BarrelPosReserve { get; set; } = new ushort[3];

[VarComm("DB3.DBW22", "配方3桶位置反馈")]
public ushort[] Recipe3BarrelPosReserve { get; set; } = new ushort[3];

[VarComm("DB3.DBW28", "配方4桶位置反馈")]
public ushort[] Recipe4BarrelPosReserve { get; set; } = new ushort[3];

[VarComm("DB3.DBW34", "配方5桶位置反馈")]
public ushort[] Recipe5BarrelPosReserve { get; set; } = new ushort[3];

[VarComm("DB3.DBX40.0", "工站1有无托盘")]
public bool Station1HaveTray { get; set; }

[VarComm("DB3.DBX40.1", "工站1传感器信号")]
public bool Station1Sensor { get; set; }

[VarComm("DB3.DBX40.2", "工站1气缸信号")]
public bool Station1Cylinder { get; set; }

}
}

+ 0
- 13
BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/PlcWriteAddressDB7.cs View File

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

namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC
{
public class PlcWriteAddressDB7
{
}
}

+ 460
- 807
BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs
File diff suppressed because it is too large
View File


+ 5
- 0
BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DeviceAddress.cs View File

@@ -94,6 +94,11 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
/// </summary>
public static string LowerLimitWeightOfSilo { get; set; } = "LW35";

/// <summary>
/// 配料信号反馈
/// </summary>
public static string DosingStatusFeedback { get; set; } = "LW62";

/// <summary>
/// 搅拌速度
/// </summary>


+ 124
- 47
BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DeviceInquire.cs View File

@@ -12,6 +12,7 @@ using System.Net.NetworkInformation;
using System.Threading;
using System.Threading.Tasks;
using System.Configuration;
using System.Diagnostics;

namespace BPASmartClient.JXJFoodSmallStation.Model
{
@@ -21,9 +22,9 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
public static DeviceInquire GetInstance => _Instance ?? (_Instance = new DeviceInquire());
private DeviceInquire() { }

string IPSegment = "107.107.2.";
string IPSegment = "107.107.2.";

ConcurrentDictionary<string, DeviceStatus> DeviceLists = new ConcurrentDictionary<string, DeviceStatus>();
ConcurrentDictionary<string, DeviceStatus> DeviceLists = new ConcurrentDictionary<string, DeviceStatus>();
List<string> InvalidIP = new List<string>();//无效 IP 集合
List<string> IPLists = new List<string>();//启动 Ping 任务IP集合
ConcurrentQueue<string> IPQueues = new ConcurrentQueue<string>();//pincomplete 完成队列
@@ -57,9 +58,14 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
{
devices.ElementAt(deviceIndex).DeviceName = DeviceLists.ElementAt(i).Value.DeviceName;
}
if (!ThreadManage.GetInstance().IsContainsKey($"{deviceName} 开始监听"))
{
DeviceLists[DeviceLists.ElementAt(i).Key].Init(deviceName);
}
}

Thread.Sleep(200);
}), "设备状态监听",true);
}), "设备状态监听", true);
}
private void TestData()
{
@@ -164,7 +170,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
{
IPLists.Add($"{IPSegment}{i + 69}");
}

IPLists.ForEach((item) =>
{
@@ -234,14 +240,29 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
else
{
if (!InvalidIP.Contains(ip)) InvalidIP.Add(ip);
//if (!InvalidIP.Contains(ip)) InvalidIP.Add(ip);

if (DeviceLists.ContainsKey(ip))
{
DeviceLists[ip].Dispose();
var res11 = DeviceLists[ip];
DeviceLists.TryRemove(ip, out res11);
}
}
});

DS.modbusTcp.ConnectFail = new Action(() =>
{
if (!InvalidIP.Contains(ip)) InvalidIP.Add(ip);
//if (!InvalidIP.Contains(ip)) InvalidIP.Add(ip);
//MessageLog.GetInstance.ShowAlarmLog($"设备{ip}连接失败");


if (DeviceLists.ContainsKey(ip))
{
DeviceLists[ip].Dispose();
var res11 = DeviceLists[ip];
DeviceLists.TryRemove(ip, out res11);
}
});

DS.modbusTcp.Disconnect = new Action(() =>
@@ -277,7 +298,10 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
IPQueues.Enqueue(e.Reply.Address.ToString());
}));
}
else IPQueues.Enqueue(e.Reply.Address.ToString());
else
{
IPQueues.Enqueue(e.Reply.Address.ToString());
}
}
else
{
@@ -317,23 +341,40 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
if (s != null) MessageNotify.GetInstance.ShowRunLog(s);
});
this.DeviceName = DeviceName;
AlarmHelper<AlarmInfo>.Init();
//AlarmHelper<AlarmInfo>.Init();
if (modbusTcp.Connected)
{
ThreadManage.GetInstance().StartLong(new Action(() =>
{
deviceStatus.RunStatus = (ushort)this.modbusTcp.ReadShort(DeviceAddress.RunStatus); //获取设备运行状态
deviceStatus.WeightFeedback = this.modbusTcp.ReadShort(DeviceAddress.WeightFeedback);//获取设备料仓剩余重量
deviceStatus.NowWeightFeedback = this.modbusTcp.GetReal(DeviceAddress.CutWeightFeedback);//获取下料重量
deviceStatus.DeviceNum = (ushort)this.modbusTcp.ReadShort(DeviceAddress.DeviceNum);//获取设备编号
deviceStatus.DeviceAlarmCode = (ushort)this.modbusTcp.ReadShort(DeviceAddress.DeviceAlarmCode);//获取设备故障编码
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).EStop1 = deviceStatus.DeviceAlarmCode.Get16bitValue(1);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).Servo = deviceStatus.DeviceAlarmCode.Get16bitValue(2);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).Inverter = deviceStatus.DeviceAlarmCode.Get16bitValue(3);
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);
if (modbusTcp.Connected)
{
deviceStatus.RunStatus = (ushort)this.modbusTcp.ReadShort(DeviceAddress.RunStatus); //获取设备运行状态
deviceStatus.WeightFeedback = this.modbusTcp.ReadShort(DeviceAddress.WeightFeedback);//获取设备料仓剩余重量
deviceStatus.NowWeightFeedback = this.modbusTcp.GetReal(DeviceAddress.CutWeightFeedback);//获取下料重量
deviceStatus.DeviceNum = (ushort)this.modbusTcp.ReadShort(DeviceAddress.DeviceNum);//获取设备编号
deviceStatus.DeviceAlarmCode = (ushort)this.modbusTcp.ReadShort(DeviceAddress.DeviceAlarmCode);//获取设备故障编码
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).EStop1 = deviceStatus.DeviceAlarmCode.Get16bitValue(1);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).Servo = deviceStatus.DeviceAlarmCode.Get16bitValue(2);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).Inverter = deviceStatus.DeviceAlarmCode.Get16bitValue(3);
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);
//允许配料即产线气缸抬起,发送给味魔方
if (deviceStatus.DeviceNum >= 1 && deviceStatus.DeviceNum <= 15)
{
if (GVL_SmallStation.GetInstance.plcReadDataDB3.StockBinAllowIssue[deviceStatus.DeviceNum - 1])
{
this.modbusTcp.Write("LW41", (ushort)1);
GVL_SmallStation.GetInstance.StockBinCylinderStatus.SetBitValue((byte)(deviceStatus.DeviceNum), true);
}
else
{
this.modbusTcp.Write("LW41", (ushort)0);
GVL_SmallStation.GetInstance.StockBinCylinderStatus.SetBitValue((byte)(deviceStatus.DeviceNum), false);
}
}
Thread.Sleep(10);
}
}), $"{DeviceName} 开始监听", true);
}
}
@@ -355,52 +396,88 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
ThreadManage.GetInstance().StopTask($"{DeviceName} 开始监听");
}


public void Start(float Value)
{
//if (modbusTcp.Connected)
//{
// 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:
// var Value8 = this.modbusTcp.GetUint(DeviceAddress.StirringSpeed);
// 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},参数下发完成");
// }
// int Count = 0;
//Start:
// Count++;
// modbusTcp.SetReal(DeviceAddress.WeightSet, Value);//写入原料重量
// modbusTcp.Write(DeviceAddress.Start, (ushort)1);//设备启动写入
// MessageNotify.GetInstance.ShowRunLog($"{DeviceName},设置重量:{Value},下发次数{Count},柔性味魔方开始配料");
// Thread.Sleep(200);
// if (this.modbusTcp.ReadShort(DeviceAddress.DosingStatusFeedback) == (short)0 && Count <=10) goto Start;
//}



if (modbusTcp.Connected)
{
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:
var Value8 = this.modbusTcp.GetUint(DeviceAddress.StirringSpeed);
if (Value8 != null && Value8.ToString() != num.ToString()) goto prop8;*/
uint num = (uint)res.StirringSpeed * 100;
modbusTcp.SetUint(DeviceAddress.StirringSpeed, num);
modbusTcp.SetUint(DeviceAddress.StirringSpeed, (uint)res.StirringSpeed * 100);
MessageNotify.GetInstance.ShowRunLog($"{res.MaterialName},参数下发完成");
}
modbusTcp.SetReal(DeviceAddress.WeightSet, Value);//写入原料重量
modbusTcp.Write(DeviceAddress.Start, (ushort)1);//设备启动写入
if (!modbusTcp.Write(DeviceAddress.Start, (ushort)1))//设备启动写入
{
MessageNotify.GetInstance.ShowRunLog($"{DeviceName},设置重量:{Value},启动信号写入失败");
}
MessageNotify.GetInstance.ShowRunLog($"{DeviceName},设置重量:{Value},柔性味魔方开始配料");
}





}
}
}

+ 3
- 0
BPASmartClient.JXJFoodSmallStation/Model/Siemens/RemoteRecipeRawMaterial.cs View File

@@ -47,5 +47,8 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
/// </summary>
public int RawMaterialLocation { get { return _mRawMaterialLocation; } set { _mRawMaterialLocation = value;OnPropertyChanged(); } }
private int _mRawMaterialLocation;

public bool IsDosingComple { get { return _mIsDosingComple; } set { _mIsDosingComple = value; OnPropertyChanged(); } }
private bool _mIsDosingComple;
}
}

+ 5
- 1
BPASmartClient.JXJFoodSmallStation/Model/Siemens/SiemensDeviceStatus.cs View File

@@ -37,9 +37,13 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens
this.Siemens_PLC_S7.Write("DB2201.DBX450.0", true);
GVL_SmallStation.GetInstance.SiemensSendRecipeStatus = 1;
}
else
{
this.Siemens_PLC_S7.Write("DB2201.DBX450.0", false);
}
break;
case 1:
if (Start.Order_Request_ACK)
if (st.Order_Request_ACK)
{
if (!string.IsNullOrEmpty(st.RecipeCode))
{


+ 113
- 0
BPASmartClient.JXJFoodSmallStation/Resource/MyStyle.xaml View File

@@ -0,0 +1,113 @@
<ResourceDictionary
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">

<SolidColorBrush x:Key="tabColor" Color="#FF2AB2E7" />
<!--<SolidColorBrush x:Key="bordColor" Color="#33ffffff" />-->
<SolidColorBrush x:Key="bordColor" Color="#552AB2E7" />
<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>


</ResourceDictionary>

+ 170
- 43
BPASmartClient.JXJFoodSmallStation/View/BomOfMaterialView.xaml View File

@@ -1,19 +1,32 @@
<UserControl x:Class="BPASmartClient.JXJFoodSmallStation.View.BomOfMaterialView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:con="clr-namespace:BPASmartClient.JXJFoodSmallStation.Converter"
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.JXJFoodSmallStation.ViewModel"
mc:Ignorable="d"
d:DesignHeight="1080" d:DesignWidth="1920">
<UserControl
x:Class="BPASmartClient.JXJFoodSmallStation.View.BomOfMaterialView"
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
xmlns:vm="clr-namespace:BPASmartClient.JXJFoodSmallStation.ViewModel"
d:DesignHeight="1080"
d:DesignWidth="1920"
mc:Ignorable="d">
<UserControl.DataContext>
<vm:BomOfMaterialViewModel />
</UserControl.DataContext>

<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.JXJFoodSmallStation;component/Resource/MyStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>

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

@@ -117,108 +130,222 @@
<Setter Property="FontWeight" Value="SemiBold" />
</Style>

</UserControl.Resources>
</UserControl.Resources>-->
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="60" />
<RowDefinition Height="40" />
<RowDefinition Height="50" />
<RowDefinition />
</Grid.RowDefinitions>
<!--#region 表格标题栏设置-->
<Grid>
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
<StackPanel
Margin="0,0,10,0"
HorizontalAlignment="Right"
Orientation="Horizontal">
<Button
Width="200"
Height="50"
Margin="5"
Command="{Binding GetBomMaterialData}"
Content="拉取本地数据"
FontSize="28"
Foreground="Aqua"
Foreground="DeepSkyBlue"
Style="{StaticResource ImageButtonStyle}" />
<Button
Width="200"
Height="50"
Margin="5"
Command="{Binding DeleteAllMaterial}"
Content="删除所有数据"
FontSize="28"
Foreground="Aqua"
Foreground="DeepSkyBlue"
Style="{StaticResource ImageButtonStyle}" />
<Button
Width="200"
Height="50"
Margin="5"
Command="{Binding AddMaterial}"
Content="新增数据"
FontSize="28"
Foreground="Aqua"
Foreground="DeepSkyBlue"
Style="{StaticResource ImageButtonStyle}" />
<Button
Width="200"
Height="50"
Margin="5"
Command="{Binding SaveMaterials}"
Content="保存参数"
FontSize="28"
Foreground="Aqua"
Foreground="DeepSkyBlue"
Style="{StaticResource ImageButtonStyle}" />
</StackPanel>
</Grid>
<Grid
Grid.Row="1"
Margin="0,10,0,0"
Margin="0,10,17,0"
Background="#ff0C255F">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<TextBlock Text="序号" FontSize="24" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"/>
<!--<Border BorderThickness="1,1,1,1" Cursor="SizeWE"

<TextBlock
Grid.Column="0"
FontSize="24"
Style="{StaticResource TitleTextblockStyle}"
Text="序号" />

<TextBlock
Grid.Column="1"
FontSize="24"
Style="{StaticResource TitleTextblockStyle}"
Text="原料编号" />

<TextBlock
Grid.Column="2"
FontSize="24"
Style="{StaticResource TitleTextblockStyle}"
Text="原料名称" />

<TextBlock
Grid.Column="3"
FontSize="24"
Style="{StaticResource TitleTextblockStyle}"
Text="操作" />

<Border
Grid.Column="0"
Grid.ColumnSpan="4"
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,1,1,1" />
<Border
Grid.Column="1"
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0" />
<Border
Grid.Column="3"
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0" />



<!--<Grid Grid.Column="0">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="24"
Foreground="Aqua"
Text="序号" />
-->
<!--<Border BorderThickness="1,1,1,1" Cursor="SizeWE"
BorderBrush="{StaticResource bordColor}" />-->
<!--
</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" />
<TextBlock
Grid.Column="1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="24"
Foreground="Aqua"
Text="原料编号" />
<TextBlock
Grid.Column="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="24"
Foreground="Aqua"
Text="原料名称" />
<TextBlock
Grid.Column="3"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="24"
Foreground="Aqua"
Text="操作" />-->
</Grid>
<Grid Grid.Row="2">
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Visible" >
<ItemsControl ItemsSource="{Binding RawMaterialInfo}" Foreground="Aqua">
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Visible">
<ItemsControl Foreground="DeepSkyBlue" ItemsSource="{Binding RawMaterialInfo}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Name="gr" >
<Grid Name="gr">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid Grid.Column="0" Margin="5">

<TextBlock
Grid.Column="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Text="{Binding Count}" />

<TextBox
Grid.Column="1"
Style="{StaticResource InputTextboxStyle}"
Text="{Binding MaterialCode}" />

<TextBox
Grid.Column="2"
Style="{StaticResource InputTextboxStyle}"
Text="{Binding MaterialName}" />

<Button
Grid.Column="3"
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding RawMaterialLocation}"
Content="删除"
FontSize="16"
Style="{StaticResource ControlButtonStyle}" />

<Border
Grid.Column="0"
Grid.ColumnSpan="4"
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,1" />
<Border
Grid.Column="1"
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0" />
<Border
Grid.Column="3"
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0" />


<!--<Grid Grid.Column="0" Margin="5">
<TextBlock
FontSize="16"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Text="{Binding Count}" />
</Grid>
<Grid Grid.Column="1" Margin="5">
<TextBox
Width="50"
FontSize="16"
HorizontalAlignment="Center"
VerticalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Text="{Binding MaterialCode}" />
</Grid>
<Grid Grid.Column="2" Margin="5">
<TextBox
Width="200"
FontSize="16"
HorizontalAlignment="Center"
VerticalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Text="{Binding MaterialName}" />
</Grid>
<Grid Grid.Column="3" Margin="5">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
<pry:IcoButton
Margin="3,4,4,0"
HorizontalAlignment="Center"
@@ -233,9 +360,9 @@
IcoText="&#xe68e;"
Style="{StaticResource IcoButtonStyle}" />
</StackPanel>
</Grid>
</Grid>-->
</Grid>
<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" />


+ 15
- 114
BPASmartClient.JXJFoodSmallStation/View/DeviceMaterialParView.xaml View File

@@ -16,111 +16,11 @@
</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>

<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.JXJFoodSmallStation;component/Resource/MyStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>

<Grid Margin="10">
@@ -342,9 +242,9 @@
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}"
Style="{StaticResource InputTextboxStyle}"
Text="{Binding StirringSpeed}" />
<Grid Grid.Column="9">
<TextBox
<TextBox
Foreground="Red"
Style="{StaticResource InputTextboxStyle}"
Text="{Binding ErrorRange}" />
@@ -354,13 +254,14 @@
Cursor="SizeWE" />
</Grid>

<Button Grid.Column="10"
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding MaterialName}"
Content="删除"
FontSize="16"
Style="{StaticResource ControlButtonStyle}" />
<Button
Grid.Column="10"
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding MaterialName}"
Content="删除"
FontSize="16"
Style="{StaticResource ControlButtonStyle}" />

<Border
Grid.ColumnSpan="11"
BorderBrush="{StaticResource bordColor}"


+ 150
- 93
BPASmartClient.JXJFoodSmallStation/View/ManualControlView.xaml View File

@@ -55,10 +55,10 @@

<Grid Margin="8">
<Grid.RowDefinitions>
<RowDefinition Height="2*"/>
<RowDefinition Height="2*"/>
<RowDefinition Height="3*"/>
<RowDefinition Height="2*"/>
<RowDefinition Height="2*" />
<RowDefinition Height="2*" />
<RowDefinition Height="3*" />
<RowDefinition Height="2*" />
</Grid.RowDefinitions>
<Grid
Name="jiu"
@@ -85,73 +85,102 @@
Text="总控制" />
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="5*"/>
<ColumnDefinition Width="5*"/>
<ColumnDefinition Width="5*" />
<ColumnDefinition Width="5*" />
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<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 HorizontalAlignment="Center" VerticalAlignment="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}"/>
<Grid Grid.Row="1" Grid.Column="0">
<WrapPanel HorizontalAlignment="Center" VerticalAlignment="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 Grid.Column="1" Grid.Row="1" Content="Debug模式" IsChecked="false" Margin="15" FontSize="20" VerticalAlignment="Center" HorizontalAlignment="Center"
Foreground="Aqua" Command="{Binding DebugMode}"></RadioButton>
<RadioButton
Grid.Row="0"
Grid.Column="1"
Margin="15"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Command="{Binding AutoMode}"
Content="Auto模式"
FontSize="20"
Foreground="Aqua"
IsChecked="{Binding AutoModeStatus}" />
<RadioButton
Grid.Row="1"
Grid.Column="1"
Margin="15"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Command="{Binding DebugMode}"
Content="Debug模式"
FontSize="20"
Foreground="Aqua"
IsChecked="{Binding ManualMode}" />
</Grid>
<Grid
Grid.Column="3" >

<Grid Grid.Column="3">
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<pry:IcoButton
Command="{Binding SystemStartCommand}"
<pry:IcoButton
Grid.Column="0"
Margin="5,30"
Command="{Binding SystemStartCommand}"
Content="启动"
FontSize="40"
Foreground="Aqua"
Style="{StaticResource IcoButtonStyle}" />
<pry:IcoButton
Command="{Binding SystemStopCommand}"
<pry:IcoButton
Grid.Column="1"
Margin="5,30"
Command="{Binding SystemStopCommand}"
Content="停止"
FontSize="40"
Foreground="Aqua"
Style="{StaticResource IcoButtonStyle}" />
<pry:IcoButton
Command="{Binding SystemPauseCommand}"
<pry:IcoButton
Grid.Column="2"
Margin="5,30"
Command="{Binding SystemPauseCommand}"
Content="暂停"
FontSize="40"
Foreground="Aqua"
Style="{StaticResource IcoButtonStyle}" />
<pry:IcoButton
Command="{Binding SystemResetCommand}"
<pry:IcoButton
Grid.Column="3"
Margin="5,30"
Command="{Binding SystemResetCommand}"
Content="恢复"
FontSize="40"
Foreground="Aqua"
@@ -182,38 +211,44 @@
FontSize="16"
Foreground="Aqua"
Text="线体控制" />
<Grid Grid.Row="1">
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"></ColumnDefinition>
<ColumnDefinition Width="1*"></ColumnDefinition>
<ColumnDefinition Width="1*"></ColumnDefinition>
<ColumnDefinition Width="1*"></ColumnDefinition>
<ColumnDefinition Width="1*"></ColumnDefinition>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition />
</Grid.RowDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Grid.ColumnSpan="2" Margin="0,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Center"
FontSize="16" Foreground="Aqua" Text="进桶侧调速电机"/>
<pry:IcoButton
Margin="10"
<TextBlock
Grid.ColumnSpan="2"
Margin="0,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="Aqua"
Text="进桶侧调速电机" />
<pry:IcoButton
Grid.Row="1"
Grid.Column="0"
Margin="10"
Command="{Binding StartAxisLoadCommand}"
Content="启动"
FontSize="16"
Foreground="Aqua"
Style="{StaticResource IcoButtonStyle}" />
<pry:IcoButton
<pry:IcoButton
Grid.Row="1"
Grid.Column="1"
Margin="10"
@@ -225,29 +260,34 @@
</Grid>


<Border
BorderThickness="1,0,1,0" />
<Border BorderThickness="1,0,1,0" />
<Grid Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Grid.ColumnSpan="2" Margin="0,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Center"
FontSize="16" Foreground="Aqua" Text="过渡段调速电机"/>
<pry:IcoButton
Margin="10"
<TextBlock
Grid.ColumnSpan="2"
Margin="0,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="Aqua"
Text="过渡段调速电机" />
<pry:IcoButton
Grid.Row="1"
Grid.Column="0"
Margin="10"
Command="{Binding StartAxisMidCommand}"
Content="启动"
FontSize="16"
Foreground="Aqua"
Style="{StaticResource IcoButtonStyle}" />
<pry:IcoButton
<pry:IcoButton
Grid.Row="1"
Grid.Column="1"
Margin="10"
@@ -259,25 +299,31 @@
</Grid>
<Grid Grid.Column="2">
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Grid.ColumnSpan="2" Margin="0,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Center"
FontSize="16" Foreground="Aqua" Text="出桶侧调速电机"/>
<pry:IcoButton
Margin="10"
<TextBlock
Grid.ColumnSpan="2"
Margin="0,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="Aqua"
Text="出桶侧调速电机" />
<pry:IcoButton
Grid.Row="1"
Grid.Column="0"
Margin="10"
Command="{Binding StartAxisUnLoadCommand}"
Content="启动"
FontSize="16"
Foreground="Aqua"
Style="{StaticResource IcoButtonStyle}" />
<pry:IcoButton
<pry:IcoButton
Grid.Row="1"
Grid.Column="1"
Margin="10"
@@ -287,29 +333,34 @@
Foreground="Aqua"
Style="{StaticResource IcoButtonStyle}" />
</Grid>
<Border
BorderThickness="1,0,1,0" />
<Border BorderThickness="1,0,1,0" />
<Grid Grid.Column="3">
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Grid.ColumnSpan="2" Margin="0,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Center"
FontSize="16" Foreground="Aqua" Text="伺服1调速电机"/>
<pry:IcoButton
Margin="10"
<TextBlock
Grid.ColumnSpan="2"
Margin="0,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="Aqua"
Text="伺服1调速电机" />
<pry:IcoButton
Grid.Row="1"
Grid.Column="0"
Margin="10"
Command="{Binding StartAxis1Command}"
Content="启动"
FontSize="16"
Foreground="Aqua"
Style="{StaticResource IcoButtonStyle}" />
<pry:IcoButton
<pry:IcoButton
Grid.Row="1"
Grid.Column="1"
Margin="10"
@@ -321,25 +372,31 @@
</Grid>
<Grid Grid.Column="4">
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Grid.ColumnSpan="2" Margin="0,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Center"
FontSize="16" Foreground="Aqua" Text="伺服2调速电机"/>
<pry:IcoButton
Margin="10"
<TextBlock
Grid.ColumnSpan="2"
Margin="0,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="Aqua"
Text="伺服2调速电机" />
<pry:IcoButton
Grid.Row="1"
Grid.Column="0"
Margin="10"
Command="{Binding StartAxis2Command}"
Content="启动"
FontSize="16"
Foreground="Aqua"
Style="{StaticResource IcoButtonStyle}" />
<pry:IcoButton
<pry:IcoButton
Grid.Row="1"
Grid.Column="1"
Margin="10"
@@ -454,7 +511,7 @@
<!--#endregion-->

<!--#region 阻挡气缸-->
<!--#endregion-->

<!--#region 托盘气缸-->


+ 362
- 70
BPASmartClient.JXJFoodSmallStation/View/ManualFlowView.xaml View File

@@ -1,12 +1,14 @@
<UserControl x:Class="BPASmartClient.JXJFoodSmallStation.View.ManualFlowView"
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.JXJFoodSmallStation.ViewModel"
mc:Ignorable="d"
d:DesignHeight="1080" d:DesignWidth="1920">
<UserControl
x:Class="BPASmartClient.JXJFoodSmallStation.View.ManualFlowView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
xmlns:vm="clr-namespace:BPASmartClient.JXJFoodSmallStation.ViewModel"
d:DesignHeight="1080"
d:DesignWidth="1920"
mc:Ignorable="d">
<UserControl.DataContext>
<vm:ManualFlowViewModel />

@@ -20,61 +22,59 @@
</Grid.RowDefinitions>
<!--#region 表格标题栏设置-->
<Grid>
<StackPanel Orientation="Horizontal" HorizontalAlignment="left" VerticalAlignment="Center">
<StackPanel
HorizontalAlignment="left"
VerticalAlignment="Center"
Orientation="Horizontal">
<Button
Name="test1"
Width="200"
Height="40"
Margin="5"
Panel.ZIndex="0"
Command="{Binding Test1Command}"
Content="AGV送托盘完成"
FontSize="20"
Panel.ZIndex="0"
Style="{StaticResource ImageButtonStyle}"></Button>
Style="{StaticResource ImageButtonStyle}"
Visibility="{Binding VisibilityBtn1}" />
<Button
Name="test2"
Width="200"
Height="40"
Margin="5"
Panel.ZIndex="0"
Command="{Binding Test2Command}"
Content="粉料仓配料完成"
FontSize="20"
Panel.ZIndex="0"
Style="{StaticResource ImageButtonStyle}"></Button>
Style="{StaticResource ImageButtonStyle}"
Visibility="{Binding VisibilityBtn2}" />
<Button
Name="test3"
Width="200"
Height="40"
Margin="5"
Panel.ZIndex="0"
Command="{Binding Test3Command}"
Content="AGV取托盘完成"
FontSize="20"
Panel.ZIndex="0"
Style="{StaticResource ImageButtonStyle}"></Button>
Style="{StaticResource ImageButtonStyle}"
Visibility="{Binding VisibilityBtn3}" />
<TextBlock
Width="100"
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7" />
<Button
Width="200"
Height="40"
Margin="5"
Command="{Binding Test4Command}"
Content="气缸收紧错位复位"
FontSize="20"
Panel.ZIndex="0"
Style="{StaticResource ImageButtonStyle}"></Button>
<Button
Width="200"
Height="40"
Margin="5"
Command="{Binding Test5Command}"
Content="粉料仓提升到位"
FontSize="20"
Panel.ZIndex="0"
Style="{StaticResource ImageButtonStyle}"></Button>
<Button
Width="200"
Height="40"
Margin="5"
Command="{Binding Test6Command}"
Content="AGV放货架流程完成"
FontSize="20"
Panel.ZIndex="0"
Style="{StaticResource ImageButtonStyle}"></Button>
Style="{StaticResource ImageButtonStyle}" />
<Button
Width="200"
Height="40"
@@ -82,29 +82,32 @@
Command="{Binding BPAResetCommand}"
Content="上位机初始化"
FontSize="20"
Style="{StaticResource ImageButtonStyle}"></Button>
Style="{StaticResource ImageButtonStyle}" />
</StackPanel>
</Grid>
<Grid Grid.Row="1">
<StackPanel Orientation="Horizontal" HorizontalAlignment="left" VerticalAlignment="Center">
<StackPanel
HorizontalAlignment="left"
VerticalAlignment="Center"
Orientation="Horizontal">
<Button
Width="200"
Height="40"
Margin="5,0,5,0"
Panel.ZIndex="0"
Command="{Binding SystemReset}"
Content="PLC系统复位"
FontSize="20"
Panel.ZIndex="0"
Style="{StaticResource ImageButtonStyle}"></Button>
Style="{StaticResource ImageButtonStyle}" />
<Button
Width="200"
Height="40"
Margin="5,0,5,0"
Panel.ZIndex="0"
Command="{Binding CLearRecipeInfo}"
Content="PLC配方清零"
FontSize="20"
Panel.ZIndex="0"
Style="{StaticResource ImageButtonStyle}"></Button>
Style="{StaticResource ImageButtonStyle}" />
</StackPanel>


@@ -118,49 +121,338 @@
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>

<WrapPanel Grid.Column="1">
<TextBlock Text="海科plc心跳:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding Heartbeat}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock>
</WrapPanel>
<StackPanel Grid.Column="1" Orientation="Vertical">
<StackPanel Orientation="Horizontal">
<TextBlock
Margin="10,0,5,0"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="海科plc心跳:" />
<TextBlock
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="{Binding Heartbeat}" />
</StackPanel>
</StackPanel>
<WrapPanel Grid.Row="0">
<TextBlock Text="西门子 连接状态:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding SiemensIsConnect}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock>
<TextBlock Text="海科plc连接状态:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding HKPlcIsConnect}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock>
<TextBlock Text="风送plc连接状态:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding WindSendIsConnect}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock>
<TextBlock
Margin="10,0,5,0"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="西门子 连接状态:" />
<TextBlock
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="{Binding SiemensIsConnect}" />
<TextBlock
Margin="10,0,5,0"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="海科plc连接状态:" />
<TextBlock
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="{Binding HKPlcIsConnect}" />
<TextBlock
Margin="10,0,5,0"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="风送plc连接状态:" />
<TextBlock
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="{Binding WindSendIsConnect}" />
</WrapPanel>
<WrapPanel Grid.Row="2">
<TextBlock Text="当前下发配方状态:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding OrderStatus}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock>
<TextBlock Text="当前配料状态:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding OrderDosingStatus}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock>
<TextBlock
Margin="10,0,5,0"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="当前下发配方状态:" />
<TextBlock
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="{Binding OrderStatus}" />
</WrapPanel>
<WrapPanel Grid.Row="4">
<TextBlock Text="柔性味魔方配料完成,延迟复位时间:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBox Text="{Binding time}" Width="150" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBox>
<TextBlock Text="ms" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock>
<WrapPanel Grid.Row="0" Grid.Column="2">
<TextBlock
Margin="10,0,5,0"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="柔性味魔方配料完成,延迟复位时间:" />
<TextBox
Width="150"
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="{Binding time}" />
<TextBlock
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="ms" />
<Button
Width="100"
Height="40"
Margin="5,0,5,0"
Panel.ZIndex="0"
Command="{Binding TimeSet}"
Content="设置"
FontSize="20"
Panel.ZIndex="0"
Style="{StaticResource ImageButtonStyle}"></Button>
Style="{StaticResource ImageButtonStyle}" />
</WrapPanel>

<WrapPanel Grid.Column="1" Grid.Row="2">
<TextBlock Text="配料情况:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding DosingComplete}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock>
<WrapPanel
Grid.Row="3"
Grid.RowSpan="2"
Grid.Column="0">
<TextBlock
Width="200"
Margin="10,0,5,0"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="当前配料状态:" />
<WrapPanel>
<TextBlock
Margin="10,0,5,0"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="配方1:" />
<TextBlock
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="{Binding Recipe1DosingStatus}" />
</WrapPanel>
<WrapPanel>
<TextBlock
Margin="10,0,5,0"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="配方2:" />
<TextBlock
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="{Binding Recipe2DosingStatus}" />
</WrapPanel>
<WrapPanel>
<TextBlock
Margin="10,0,5,0"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="配方3:" />
<TextBlock
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="{Binding Recipe3DosingStatus}" />
</WrapPanel>
<WrapPanel>
<TextBlock
Margin="10,0,5,0"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="配方4:" />
<TextBlock
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="{Binding Recipe4DosingStatus}" />
</WrapPanel>
<WrapPanel>
<TextBlock
Margin="10,0,5,0"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="配方5:" />
<TextBlock
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="{Binding Recipe5DosingStatus}" />
</WrapPanel>
</WrapPanel>
<WrapPanel
Grid.Row="3"
Grid.RowSpan="2"
Grid.Column="1">
<TextBlock
Margin="10,0,5,0"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="配料情况:" />
<WrapPanel>
<TextBlock
Margin="10,0,5,0"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="配方1:" />
<TextBlock
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="{Binding Recipe1DosingComplete}" />
</WrapPanel>
<WrapPanel>
<TextBlock
Margin="10,0,5,0"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="配方2:" />
<TextBlock
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="{Binding Recipe2DosingComplete}" />
</WrapPanel>
<WrapPanel>
<TextBlock
Margin="10,0,5,0"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="配方3:" />
<TextBlock
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="{Binding Recipe3DosingComplete}" />
</WrapPanel>
<WrapPanel>
<TextBlock
Margin="10,0,5,0"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="配方4:" />
<TextBlock
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="{Binding Recipe4DosingComplete}" />
</WrapPanel>
<WrapPanel>
<TextBlock
Margin="10,0,5,0"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="配方5:" />
<TextBlock
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="{Binding Recipe5DosingComplete}" />
</WrapPanel>
</WrapPanel>
<WrapPanel Grid.Row="1" Grid.Column="2">
<!--<ComboBox
x:Name="cmbList"
Width="70"
VerticalAlignment="Center"
BorderBrush="#FF074B92"
BorderThickness="1"
FontFamily="楷体"
FontSize="14"
Foreground="LightGray"
IsEditable="False"
MouseLeave="ComboBox_MouseLeave"
Style="{StaticResource ComboBoxStyle}"
Text="{Binding RawMaterialName}"/>-->
<TextBlock
Margin="10,0,5,0"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="料仓号:" />
<TextBox
Width="50"
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="{Binding StockbinDosingCompleNum}" />
<Button
Width="200"
Height="40"
Margin="5,0,5,0"
Panel.ZIndex="0"
Command="{Binding StockbinDosingComple}"
Content="小料料仓配料完成"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
<Button
Width="400"
Height="40"
Margin="10"
HorizontalAlignment="Right"
Panel.ZIndex="0"
Command="{Binding StockbinDosingCompleClear}"
Content="清除所有小料料仓配料完成信号"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
</WrapPanel>
</Grid>
</Grid>


+ 2
- 6
BPASmartClient.JXJFoodSmallStation/View/ManualFlowView.xaml.cs View File

@@ -1,4 +1,5 @@
using System;
using BPASmartClient.JXJFoodSmallStation.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -24,10 +25,5 @@ namespace BPASmartClient.JXJFoodSmallStation.View
{
InitializeComponent();
}

private void Button_Click(object sender, RoutedEventArgs e)
{

}
}
}

+ 67
- 55
BPASmartClient.JXJFoodSmallStation/View/NewLocalRecipeView.xaml View File

@@ -11,7 +11,7 @@
Height="645"
AllowsTransparency="True"
Background="{x:Null}"
Topmost="false"
Topmost="True"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
mc:Ignorable="d">
@@ -69,10 +69,13 @@
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<StackPanel VerticalAlignment="Center" Grid.Column="0" Orientation="Horizontal">
<StackPanel
Grid.Column="0"
VerticalAlignment="Center"
Orientation="Horizontal">
<TextBlock
Width="100"
Margin="10,0,10,0"
@@ -86,7 +89,10 @@
FontSize="16"
Text="{Binding RecipeName}" />
</StackPanel>
<WrapPanel VerticalAlignment="Center" Grid.Column="1" HorizontalAlignment="Left">
<WrapPanel
Grid.Column="1"
HorizontalAlignment="Left"
VerticalAlignment="Center">
<TextBlock
Width="100"
Margin="2,0,10,0"
@@ -106,7 +112,7 @@
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<WrapPanel VerticalAlignment="Center" Grid.Column="0">
<WrapPanel Grid.Column="0" VerticalAlignment="Center">
<TextBlock
Width="100"
Margin="10,0,10,0"
@@ -120,7 +126,10 @@
FontSize="16"
Text="{Binding TrayNum}" />
</WrapPanel>
<WrapPanel HorizontalAlignment="Left" Orientation="Horizontal" Grid.Column="1">
<WrapPanel
Grid.Column="1"
HorizontalAlignment="Left"
Orientation="Horizontal">
<Button
Width="80"
Height="40"
@@ -146,7 +155,7 @@
FontSize="16"
Style="{StaticResource ImageButtonStyle}" />
<Button
Name ="Close"
Name="Close"
Width="80"
Height="40"
Margin="2,0,2,0"
@@ -159,35 +168,55 @@

<!--#region 表格标题栏设置-->
<Grid
Grid.Row="2"
Margin="0,10,0,0"
Background="#ff0C255F">
Grid.Row="2"
Margin="0,10,0,0"
Background="#ff0C255F">

<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<TextBlock Text="原料名称" HorizontalAlignment="Center" FontSize="16"/>
<TextBlock
HorizontalAlignment="Center"
FontSize="16"
Text="原料名称" />
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" />
</Grid>
<Grid Grid.Column="1">
<TextBlock Text="原料类型" HorizontalAlignment="Center" FontSize="16"/>
<TextBlock
HorizontalAlignment="Center"
FontSize="16"
Text="原料类型" />
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" />
</Grid>
<TextBlock Grid.Column="2" Text="原料位置" HorizontalAlignment="Center" FontSize="16"/>
<TextBlock
Grid.Column="2"
HorizontalAlignment="Center"
FontSize="16"
Text="原料位置" />
<Grid Grid.Column="3">
<TextBlock Text="原料桶号" HorizontalAlignment="Center" FontSize="16"/>
<TextBlock
HorizontalAlignment="Center"
FontSize="16"
Text="原料桶号" />
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" />
</Grid>
<TextBlock Grid.Column="4" Text="原料重量(kg)" HorizontalAlignment="Center" FontSize="16" />
<TextBlock
Grid.Column="4"
HorizontalAlignment="Center"
FontSize="16"
Text="原料重量(kg)" />
<Grid Grid.Column="5">
<TextBlock Text="功能操作" HorizontalAlignment="Center" FontSize="16" />
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" />
<TextBlock
HorizontalAlignment="Center"
FontSize="16"
Text="功能操作" />
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" />
</Grid>
<Border Grid.ColumnSpan="10" BorderThickness="1,0,1,0" />
</Grid>
@@ -206,49 +235,32 @@
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<TextBox
Text="{Binding RawMaterialName}" />
<Border
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
<TextBox Text="{Binding RawMaterialName}" />
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" />
</Grid>
<Grid Grid.Column="1">
<TextBox
Text="{Binding RawMaterialType}" />
<Border
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
<TextBox Text="{Binding RawMaterialType}" />
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" />
</Grid>
<TextBox
Grid.Column="2"
Text="{Binding RawMaterialLocation }" />
<TextBox Grid.Column="2" Text="{Binding RawMaterialLocation}" />

<Grid Grid.Column="3">
<TextBox
Text="{Binding RawMaterialBarrelNum}" />
<Border
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
<TextBox Text="{Binding RawMaterialBarrelNum}" />
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" />
</Grid>

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

<Grid Grid.Column="5">
<Button
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding RawMaterialLocation}"
Content="删除"
FontSize="16" />
<Border
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding RawMaterialLocation}"
Content="删除"
FontSize="16" />
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" />
</Grid>

<Border
Grid.ColumnSpan="10"
BorderThickness="1,0,1,1" />
<Border Grid.ColumnSpan="10" BorderThickness="1,0,1,1" />

</Grid>
<DataTemplate.Triggers>


+ 148
- 50
BPASmartClient.JXJFoodSmallStation/View/PlcVarMonitorView.xaml View File

@@ -1,92 +1,190 @@
<UserControl x:Class="BPASmartClient.JXJFoodSmallStation.View.PlcVarMonitorView"
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:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:vm="clr-namespace:BPASmartClient.JXJFoodSmallStation.ViewModel"
mc:Ignorable="d"
d:DesignHeight="1080" d:DesignWidth="1920">
<UserControl
x:Class="BPASmartClient.JXJFoodSmallStation.View.PlcVarMonitorView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.JXJFoodSmallStation.ViewModel"
d:DesignHeight="1080"
d:DesignWidth="1920"
mc:Ignorable="d">
<UserControl.DataContext>
<vm:PlcVarMonitorViewModel />
</UserControl.DataContext>
<Border BorderThickness="0" BorderBrush="{StaticResource bordColor}">
<Border BorderBrush="{StaticResource bordColor}" BorderThickness="0">
<Grid Margin="0,10">
<Grid.RowDefinitions>
<RowDefinition Height="60"></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition Height="60" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*"></ColumnDefinition>
<ColumnDefinition Width="8*"></ColumnDefinition>
<ColumnDefinition Width="4*"></ColumnDefinition>
<ColumnDefinition Width="4*"></ColumnDefinition>
<ColumnDefinition Width="10*"></ColumnDefinition>
<ColumnDefinition Width="3*"></ColumnDefinition>
<ColumnDefinition Width="17"></ColumnDefinition>
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="8*" />
<ColumnDefinition Width="4*" />
<ColumnDefinition Width="4*" />
<ColumnDefinition Width="8*" />
<ColumnDefinition Width="5*" />
<ColumnDefinition Width="17" />
</Grid.ColumnDefinitions>
<Grid>
<TextBlock Text="序号" FontSize="32" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"></TextBlock>
<Border BorderThickness="1,1,0,0" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border>
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="32"
Foreground="Aqua"
Text="序号" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,1,0,0"
Cursor="SizeWE" />
</Grid>
<Grid Grid.Column="1">
<TextBlock Text="名称" FontSize="32" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"></TextBlock>
<Border BorderThickness="1,1,0,0" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border>
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="32"
Foreground="Aqua"
Text="名称" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,1,0,0"
Cursor="SizeWE" />
</Grid>
<Grid Grid.Column="2">
<TextBlock Text="地址" FontSize="32" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"></TextBlock>
<Border BorderThickness="1,1,0,0" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border>
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="32"
Foreground="Aqua"
Text="地址" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,1,0,0"
Cursor="SizeWE" />
</Grid>
<Grid Grid.Column="3">
<TextBlock Text="类型" FontSize="32" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"></TextBlock>
<Border BorderThickness="1,1,0,0" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border>
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="32"
Foreground="Aqua"
Text="类型" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,1,0,0"
Cursor="SizeWE" />
</Grid>
<Grid Grid.Column="4">
<TextBlock Text="描述" FontSize="32" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"></TextBlock>
<Border BorderThickness="1,1,0,0" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border>
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="32"
Foreground="Aqua"
Text="描述" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,1,0,0"
Cursor="SizeWE" />
</Grid>
<Grid Grid.Column="5">
<TextBlock Text="当前值" FontSize="32" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"></TextBlock>
<Border BorderThickness="1,1,0,0" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border>
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="32"
Foreground="Aqua"
Text="当前值" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,1,0,0"
Cursor="SizeWE" />
</Grid>
</Grid>
<Grid Grid.Row="1">
<ScrollViewer>
<ItemsControl ItemsSource="{Binding plcInfos}" Foreground="Aqua">
<ItemsControl Foreground="Aqua" ItemsSource="{Binding plcInfos}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Name="gr">
<Grid Name="gr" Height="30">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*"></ColumnDefinition>
<ColumnDefinition Width="8*"></ColumnDefinition>
<ColumnDefinition Width="4*"></ColumnDefinition>
<ColumnDefinition Width="4*"></ColumnDefinition>
<ColumnDefinition Width="10*"></ColumnDefinition>
<ColumnDefinition Width="3*"></ColumnDefinition>
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="8*" />
<ColumnDefinition Width="4*" />
<ColumnDefinition Width="4*" />
<ColumnDefinition Width="8*" />
<ColumnDefinition Width="5*" />
</Grid.ColumnDefinitions>
<Grid>
<TextBlock Text="{Binding Count}" FontSize="16" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"></TextBlock>
<Border BorderThickness="1" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border>
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="Aqua"
Text="{Binding Count}" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1"
Cursor="SizeWE" />
</Grid>
<Grid Grid.Column="1">
<TextBlock Text="{Binding Name}" FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="Aqua"></TextBlock>
<Border BorderThickness="1" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border>
<TextBlock
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="16"
Foreground="Aqua"
Text="{Binding Name}" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1"
Cursor="SizeWE" />
</Grid>
<Grid Grid.Column="2">
<TextBlock Text="{Binding Address}" FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="Aqua"></TextBlock>
<Border BorderThickness="1" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border>
<TextBlock
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="16"
Foreground="Aqua"
Text="{Binding Address}" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1"
Cursor="SizeWE" />
</Grid>
<Grid Grid.Column="3">
<TextBlock Text="{Binding Type}" FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="Aqua"></TextBlock>
<Border BorderThickness="1" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border>
<TextBlock
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="16"
Foreground="Aqua"
Text="{Binding Type}" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1"
Cursor="SizeWE" />
</Grid>
<Grid Grid.Column="4">
<TextBlock Text="{Binding Describe}" FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="Aqua"></TextBlock>
<Border BorderThickness="1" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border>
<TextBlock
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="16"
Foreground="Aqua"
Text="{Binding Describe}" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1"
Cursor="SizeWE" />
</Grid>
<Grid Grid.Column="5">
<TextBlock Text="{Binding Value}" FontSize="16" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"></TextBlock>
<Border BorderThickness="1" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border>
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="Aqua"
Text="{Binding Value}" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1"
Cursor="SizeWE" />
</Grid>
</Grid>
<DataTemplate.Triggers>


+ 131
- 44
BPASmartClient.JXJFoodSmallStation/View/ProcessMonitorView.xaml View File

@@ -1,83 +1,170 @@
<UserControl x:Class="BPASmartClient.JXJFoodSmallStation.View.ProcessMonitorView"
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:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.JXJFoodSmallStation.View"
xmlns:vm="clr-namespace:BPASmartClient.JXJFoodSmallStation.ViewModel"
mc:Ignorable="d"
d:DesignHeight="1080" d:DesignWidth="1920">
<UserControl
x:Class="BPASmartClient.JXJFoodSmallStation.View.ProcessMonitorView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
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="1080"
d:DesignWidth="1920"
mc:Ignorable="d">
<UserControl.DataContext>
<vm:ProcessMonitorViewModel />
</UserControl.DataContext>
<Border BorderThickness="0" BorderBrush="{StaticResource bordColor}">
<Border BorderBrush="{StaticResource bordColor}" BorderThickness="0">
<Grid Margin="0,10">
<Grid.RowDefinitions>
<RowDefinition Height="60"></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition Height="60" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"></ColumnDefinition>
<ColumnDefinition Width="4*"></ColumnDefinition>
<ColumnDefinition Width="4*"></ColumnDefinition>
<ColumnDefinition Width="14*"></ColumnDefinition>
<ColumnDefinition Width="4*"></ColumnDefinition>
<ColumnDefinition Width="17"></ColumnDefinition>
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="4*" />
<ColumnDefinition Width="4*" />
<ColumnDefinition Width="12*" />
<ColumnDefinition Width="6*" />
<ColumnDefinition Width="17" />
</Grid.ColumnDefinitions>
<Grid>
<TextBlock Text="序号" FontSize="32" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"></TextBlock>
<Border BorderThickness="1,1,0,0" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border>
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="32"
Foreground="Aqua"
Text="序号" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,1,0,0"
Cursor="SizeWE" />
</Grid>
<Grid Grid.Column="1">
<TextBlock Text="名称" FontSize="32" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"></TextBlock>
<Border BorderThickness="1,1,0,0" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border>
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="32"
Foreground="Aqua"
Text="名称" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,1,0,0"
Cursor="SizeWE" />
</Grid>
<Grid Grid.Column="2">
<TextBlock Text="类型" FontSize="32" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"></TextBlock>
<Border BorderThickness="1,1,0,0" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border>
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="32"
Foreground="Aqua"
Text="类型" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,1,0,0"
Cursor="SizeWE" />
</Grid>
<Grid Grid.Column="3">
<TextBlock Text="描述" FontSize="32" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"></TextBlock>
<Border BorderThickness="1,1,0,0" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border>
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="32"
Foreground="Aqua"
Text="描述" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,1,0,0"
Cursor="SizeWE" />
</Grid>
<Grid Grid.Column="4">
<TextBlock Text="当前值" FontSize="32" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"></TextBlock>
<Border BorderThickness="1,1,0,0" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border>
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="32"
Foreground="Aqua"
Text="当前值" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,1,0,0"
Cursor="SizeWE" />
</Grid>
</Grid>
<Grid Grid.Row="1">
<ScrollViewer>
<ItemsControl ItemsSource="{Binding plcInfos}" Foreground="Aqua">
<ItemsControl Foreground="Aqua" ItemsSource="{Binding plcInfos}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"></ColumnDefinition>
<ColumnDefinition Width="4*"></ColumnDefinition>
<ColumnDefinition Width="4*"></ColumnDefinition>
<ColumnDefinition Width="14*"></ColumnDefinition>
<ColumnDefinition Width="4*"></ColumnDefinition>
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="4*" />
<ColumnDefinition Width="4*" />
<ColumnDefinition Width="12*" />
<ColumnDefinition Width="6*" />
</Grid.ColumnDefinitions>
<Grid>
<TextBlock Margin="5" Text="{Binding Count}" FontSize="16" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"></TextBlock>
<Border BorderThickness="1" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border>
<TextBlock
Margin="5"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="Aqua"
Text="{Binding Count}" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1"
Cursor="SizeWE" />
</Grid>
<Grid Grid.Column="1">
<TextBlock Margin="5" Text="{Binding Name}" FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="Aqua"></TextBlock>
<Border BorderThickness="1" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border>
<TextBlock
Margin="5"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="16"
Foreground="Aqua"
Text="{Binding Name}" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1"
Cursor="SizeWE" />
</Grid>
<Grid Grid.Column="2">
<TextBlock Margin="5" Text="{Binding Type}" FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="Aqua"></TextBlock>
<Border BorderThickness="1" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border>
<TextBlock
Margin="5"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="16"
Foreground="Aqua"
Text="{Binding Type}" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1"
Cursor="SizeWE" />
</Grid>
<Grid Grid.Column="3">
<TextBlock Margin="5" Text="{Binding Describe}" FontSize="14" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="Aqua"></TextBlock>
<Border BorderThickness="1" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border>
<TextBlock
Margin="5"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="14"
Foreground="Aqua"
Text="{Binding Describe}" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1"
Cursor="SizeWE" />
</Grid>
<Grid Grid.Column="4">
<TextBlock Margin="5" Text="{Binding Value}" FontSize="16" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"></TextBlock>
<Border BorderThickness="1" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border>
<TextBlock
Margin="5"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="Aqua"
Text="{Binding Value}" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1"
Cursor="SizeWE" />
</Grid>
</Grid>
</DataTemplate>


+ 125
- 37
BPASmartClient.JXJFoodSmallStation/View/RecipeInfosView.xaml View File

@@ -52,9 +52,10 @@
</ResourceDictionary>
</Window.Resources>

<Border Name="br"
<Border
Name="br"
BorderBrush="#0CADF5"
BorderThickness="1" >
BorderThickness="1">
<Border.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/bg.png" />
</Border.Background>
@@ -69,63 +70,150 @@
</Grid.RowDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<WrapPanel>
<TextBlock Margin="10,10" Background="Transparent" FontSize="16" Foreground="#FF2AB2E7" Text="配方名称:" />
<TextBlock Margin="10,10" Background="Transparent" FontSize="16" Foreground="#FF2AB2E7" Text="{Binding RecipeName}" />
<TextBlock
Margin="10,10"
Background="Transparent"
FontSize="16"
Foreground="#FF2AB2E7"
Text="配方名称:" />
<TextBlock
Margin="10,10"
Background="Transparent"
FontSize="16"
Foreground="#FF2AB2E7"
Text="{Binding RecipeName}" />
</WrapPanel>
<WrapPanel Grid.Column="1">
<TextBlock Margin="10,10" Background="Transparent" FontSize="16" Foreground="#FF2AB2E7" Text="配方编号:" />
<TextBlock Margin="10,10" Background="Transparent" FontSize="16" Foreground="#FF2AB2E7" Text="{Binding RecipeCode}" />
<TextBlock
Margin="10,10"
Background="Transparent"
FontSize="16"
Foreground="#FF2AB2E7"
Text="配方编号:" />
<TextBlock
Margin="10,10"
Background="Transparent"
FontSize="16"
Foreground="#FF2AB2E7"
Text="{Binding RecipeCode}" />
</WrapPanel>

<WrapPanel Grid.Row="1">
<TextBlock Margin="10,0,0,0" Background="Transparent" FontSize="16" Foreground="#FF2AB2E7" Text="托盘编号:" />
<TextBlock Grid.Row="1" Margin="10,10" Background="Transparent" FontSize="16" Foreground="#FF2AB2E7" Text="{Binding TrayCode}" />
<TextBlock
Margin="10,0,0,0"
Background="Transparent"
FontSize="16"
Foreground="#FF2AB2E7"
Text="托盘编号:" />
<TextBlock
Grid.Row="1"
Margin="10,10"
Background="Transparent"
FontSize="16"
Foreground="#FF2AB2E7"
Text="{Binding TrayCode}" />

</WrapPanel>
<Button Grid.Column="1" Grid.Row="1" Width="100" Command="{Binding ReturnPage}" HorizontalAlignment="Left" Margin="10,0,0,0">返回</Button>
<Button
Grid.Row="1"
Grid.Column="1"
Width="100"
Margin="10,0,0,0"
HorizontalAlignment="Left"
Command="{Binding ReturnPage}">
返回
</Button>
</Grid>
<Grid Grid.Row="3">
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="20"></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition Height="20" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid Grid.Row="0" >
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="2*" />
</Grid.ColumnDefinitions>
<TextBlock FontSize="16" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Top">原料名称</TextBlock>
<TextBlock FontSize="16" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Top">原料位置</TextBlock>
<TextBlock FontSize="16" Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Top">原料桶号</TextBlock>
<TextBlock FontSize="16" Grid.Column="3" HorizontalAlignment="Center" VerticalAlignment="Top">原料重量</TextBlock>
<TextBlock
Grid.Column="0"
HorizontalAlignment="Center"
VerticalAlignment="Top"
FontSize="16">
原料名称
</TextBlock>
<TextBlock
Grid.Column="1"
HorizontalAlignment="Center"
VerticalAlignment="Top"
FontSize="16">
原料位置
</TextBlock>
<TextBlock
Grid.Column="2"
HorizontalAlignment="Center"
VerticalAlignment="Top"
FontSize="16">
原料桶号
</TextBlock>
<TextBlock
Grid.Column="3"
HorizontalAlignment="Center"
VerticalAlignment="Top"
FontSize="16">
原料重量
</TextBlock>
</Grid>
<ScrollViewer Grid.Row="1" HorizontalScrollBarVisibility="Hidden" >
<ItemsControl ItemsSource="{Binding RawMaterialsInfo}" Width="548" >
<ScrollViewer Grid.Row="1" HorizontalScrollBarVisibility="Hidden">
<ItemsControl Width="548" ItemsSource="{Binding RawMaterialsInfo}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid x:Name="grb" Height="25" >
<Grid x:Name="grb" Height="25">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="2*" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Top" FontSize="20" Foreground="#FF2AB2E7" Text="{Binding RawMaterialName}"></TextBlock>
<TextBlock Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Top" FontSize="20" Foreground="#FF2AB2E7" Text="{Binding RawMaterialLocation}"></TextBlock>
<TextBlock Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Top" FontSize="20" Foreground="#FF2AB2E7" Text="{Binding RawMaterialBarrelNum}"></TextBlock>
<TextBlock Grid.Column="3" HorizontalAlignment="Center" VerticalAlignment="Top" FontSize="20" Foreground="#FF2AB2E7" Text="{Binding RawMaterialWeight}"></TextBlock>
<TextBlock
Grid.Column="0"
HorizontalAlignment="Center"
VerticalAlignment="Top"
FontSize="20"
Foreground="#FF2AB2E7"
Text="{Binding RawMaterialName}" />
<TextBlock
Grid.Column="1"
HorizontalAlignment="Center"
VerticalAlignment="Top"
FontSize="20"
Foreground="#FF2AB2E7"
Text="{Binding RawMaterialLocation}" />
<TextBlock
Grid.Column="2"
HorizontalAlignment="Center"
VerticalAlignment="Top"
FontSize="20"
Foreground="#FF2AB2E7"
Text="{Binding RawMaterialBarrelNum}" />
<TextBlock
Grid.Column="3"
HorizontalAlignment="Center"
VerticalAlignment="Top"
FontSize="20"
Foreground="#FF2AB2E7"
Text="{Binding RawMaterialWeight}" />
</Grid>
<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">


+ 16
- 18
BPASmartClient.JXJFoodSmallStation/View/RecipeReceiveView.xaml View File

@@ -45,42 +45,40 @@

<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition Height="50" />
<RowDefinition />
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<CheckBox
x:Name="AskRecipeFormSiemens"
Margin="0,0,10,0"
Content="向西门子请求订单"
FontFamily="楷体"
VerticalAlignment="Center"
Foreground="Aqua"
IsChecked="{Binding AskRecipeFormSiemens}" />
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
<CheckBox
x:Name="NotUseSmallDosing"
Margin="0,0,10,0"
Content="不使用小料仓配料"
FontFamily="楷体"
VerticalAlignment="Center"
VerticalContentAlignment="Center"
Content="不使用小料站配料"
FontFamily="楷体"
FontSize="20"
Foreground="Aqua"
IsChecked="{Binding NotUseSmallDosing}" />
<CheckBox
x:Name="IsUseWindSend"
Margin="0,0,10,0"
VerticalAlignment="Center"
VerticalContentAlignment="Center"
Content="使用粉料仓配料"
FontFamily="楷体"
VerticalAlignment="Center"
FontSize="20"
Foreground="Aqua"
IsChecked="{Binding IsUseWindSendDosing}" />
<CheckBox
x:Name="IsUseStockBin"
VerticalAlignment="Center"
VerticalContentAlignment="Center"
Content="本地小料仓配方配料"
FontFamily="楷体"
VerticalAlignment="Center"
FontSize="20"
Foreground="Aqua"
IsChecked="{Binding IsUseLocalRecipe}"/>
<pry:IcoButton
IsChecked="{Binding IsUseLocalRecipe}" />
<pry:IcoButton
Width="140"
Margin="10"
HorizontalAlignment="Right"
@@ -90,7 +88,7 @@
Foreground="Aqua"
IcoText="&#xe626;"
Style="{StaticResource IcoButtonStyle}" />
<pry:IcoButton
<pry:IcoButton
Width="140"
Margin="10"
HorizontalAlignment="Right"
@@ -101,7 +99,7 @@
IcoText="&#xe626;"
Style="{StaticResource IcoButtonStyle}" />

<pry:IcoButton
<pry:IcoButton
Width="140"
Margin="10"
HorizontalAlignment="Right"


+ 2
- 2
BPASmartClient.JXJFoodSmallStation/View/RecipeReceiveView.xaml.cs View File

@@ -25,10 +25,10 @@ namespace BPASmartClient.JXJFoodSmallStation.View
public RecipeReceiveView()
{
InitializeComponent();
this.AskRecipeFormSiemens.Click += (o, e) => { GVL_SmallStation.GetInstance.RequestOrder = (bool)AskRecipeFormSiemens.IsChecked; };
this.IsUseWindSend.Click += (o, e) => { GVL_SmallStation.GetInstance.IsUseWindSend = (bool)IsUseWindSend.IsChecked; };
this.IsUseStockBin.Click += (o, e) => { GVL_SmallStation.GetInstance.IsUseLocalRecipe = (bool)IsUseStockBin.IsChecked; };
this.NotUseSmallDosing.Click += (o, e) => { GVL_SmallStation.GetInstance.NotUseSmallDosing = (bool)NotUseSmallDosing.IsChecked; };
this.NotUseSmallDosing.Click += (o, e) => { GVL_SmallStation.GetInstance.NotUseSmallStation = (bool)NotUseSmallDosing.IsChecked; };
}
}
}

+ 9
- 5
BPASmartClient.JXJFoodSmallStation/View/RobotView.xaml View File

@@ -82,6 +82,10 @@
<TextBlock Margin="5" FontSize="22" Foreground="Aqua" Text="{Binding RobotIsHomed}"></TextBlock>
</WrapPanel>
<WrapPanel>
<TextBlock Margin="5" FontSize="22" Foreground="Aqua" Text="机器人运行的程序号:"></TextBlock>
<TextBlock Margin="5" FontSize="22" Foreground="Aqua" Text="{Binding IsRunProgramNum}"></TextBlock>
</WrapPanel>
<!--<WrapPanel>
<TextBlock Margin="5" FontSize="22" Foreground="Aqua" Text="抓空桶完成:"></TextBlock>
<TextBlock Margin="5" FontSize="22" Foreground="Aqua" Text="{Binding RobotGetEmptyBarrelComplete}"></TextBlock>
</WrapPanel>
@@ -96,7 +100,7 @@
<WrapPanel>
<TextBlock Margin="5" FontSize="22" Foreground="Aqua" Text="放满桶完成:"></TextBlock>
<TextBlock Margin="5" FontSize="22" Foreground="Aqua" Text="{Binding RobotPutFullBarrelComplete}"></TextBlock>
</WrapPanel>
</WrapPanel>-->
</StackPanel>
</Grid>
<Grid Grid.Column="1">
@@ -134,7 +138,7 @@
Background="DodgerBlue"></Button>
</Grid>
</Grid>
<Grid Grid.Column="2">
<!--<Grid Grid.Column="2">
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
@@ -186,7 +190,7 @@
FontSize="32"
Style="{StaticResource ImageButtonStyle}"></Button>
</Grid>
<!--<ListView
--><!--<ListView
Grid.Row="1"
Background="Transparent"
BorderBrush="#00BEFA"
@@ -260,7 +264,7 @@
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>-->
</ListView>--><!--
<Grid Grid.Row="1" Visibility="Hidden">
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
@@ -299,6 +303,6 @@
Style="{StaticResource ImageButtonStyle}"></Button>
</Grid>
</Grid>
</Grid>
</Grid>-->
</Grid>
</UserControl>

+ 3
- 3
BPASmartClient.JXJFoodSmallStation/View/SiemensRecipeReceiveView.xaml View File

@@ -45,10 +45,10 @@

<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition Height="50" />
<RowDefinition />
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
<pry:IcoButton
Grid.Column="3"
Width="140"
@@ -115,7 +115,7 @@
Foreground="#dd000000"
Text="{Binding TrayCode}" />
</WrapPanel>
<Grid
Name="gr"
Grid.Row="2"


+ 119
- 86
BPASmartClient.JXJFoodSmallStation/View/StockBinRawMaterialView.xaml View File

@@ -1,43 +1,58 @@
<UserControl x:Class="BPASmartClient.JXJFoodSmallStation.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.JXJFoodSmallStation.ViewModel"
mc:Ignorable="d"
d:DesignHeight="1080" d:DesignWidth="1920">
<UserControl
x:Class="BPASmartClient.JXJFoodSmallStation.View.StockBinRawMaterialView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
xmlns:vm="clr-namespace:BPASmartClient.JXJFoodSmallStation.ViewModel"
d:DesignHeight="1080"
d:DesignWidth="1920"
mc:Ignorable="d">
<UserControl.DataContext>
<vm:StockBinRawMaterialViewModel />
</UserControl.DataContext>

<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.JXJFoodSmallStation;component/Resource/MyStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>

<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="60" />
<RowDefinition Height="40" />
<RowDefinition Height="50" />
<RowDefinition />
</Grid.RowDefinitions>
<!--#region 表格标题栏设置-->
<Grid>
<StackPanel HorizontalAlignment="Right" VerticalAlignment="Center" Orientation="Horizontal">
<StackPanel
HorizontalAlignment="Right"
VerticalAlignment="Center"
Orientation="Horizontal">
<Button
Width="150"
Height="50"
Margin="5"
Command="{Binding UpdateRawMaterial}"
Content="新增数据"
FontSize="28"
Foreground="Aqua"
Style="{StaticResource ImageButtonStyle}" />
Foreground="DeepSkyBlue"
Style="{StaticResource ImageButtonStyle}" />
<Button
Width="150"
Height="50"
Margin="5"
Command="{Binding SaveRawMaterialPara}"
Content="保存参数"
FontSize="28"
Foreground="Aqua"
Style="{StaticResource ImageButtonStyle}"/>
Foreground="DeepSkyBlue"
Style="{StaticResource ImageButtonStyle}" />
</StackPanel>
</Grid>
<Grid
Grid.Row="1"
@@ -45,87 +60,105 @@
Background="#ff0C255F">

<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</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" />

<TextBlock
Grid.Column="0"
FontSize="24"
Style="{StaticResource TitleTextblockStyle}"
Text="序号" />

<TextBlock
Grid.Column="1"
FontSize="24"
Style="{StaticResource TitleTextblockStyle}"
Text="料仓位置" />

<TextBlock
Grid.Column="2"
FontSize="24"
Style="{StaticResource TitleTextblockStyle}"
Text="原料编号" />

<TextBlock
Grid.Column="3"
FontSize="24"
Style="{StaticResource TitleTextblockStyle}"
Text="编辑" />

<Border
Grid.Column="0"
Grid.ColumnSpan="4"
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,1,1,1" />
<Border
Grid.Column="1"
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0" />
<Border
Grid.Column="3"
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0" />


</Grid>
<Grid Grid.Row="2">
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" >
<ItemsControl ItemsSource="{Binding RawMaterialInfo}" Foreground="Aqua">
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<ItemsControl Foreground="DeepSkyBlue" ItemsSource="{Binding RawMaterialInfo}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Name="gr" >
<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">
<TextBox
Width="50"
FontSize="16"
TextAlignment="Center"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="{Binding RawMaterialLocation}" />
<Border
BorderThickness="1,0,1,0"
Cursor="SizeWE" />

</Grid>
<Grid Grid.Column="2" Margin="5">
<TextBox
Width="50"
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="#11F53F62"
BorderThickness="0"
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding RawMaterialLocation}"
Content="删除"
EnterBackground="#22F53F62"
Foreground="#FFF53F62"
IcoText="&#xe68e;"
Style="{StaticResource IcoButtonStyle}" />
</StackPanel>
</Grid>

<TextBlock
Grid.Column="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Text="{Binding RawMaterialCount}" />

<TextBox
Grid.Column="1"
Style="{StaticResource InputTextboxStyle}"
Text="{Binding RawMaterialLocation}" />

<TextBox
Grid.Column="2"
Style="{StaticResource InputTextboxStyle}"
Text="{Binding RawMaterialName}" />

<Button
Grid.Column="3"
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding RawMaterialLocation}"
Content="删除"
FontSize="16"
Style="{StaticResource ControlButtonStyle}" />

<Border
Grid.Column="0"
Grid.ColumnSpan="4"
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,1" />
<Border
Grid.Column="1"
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0" />
<Border
Grid.Column="3"
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0" />
</Grid>

<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" />


+ 110
- 36
BPASmartClient.JXJFoodSmallStation/View/SystemParView.xaml View File

@@ -131,8 +131,8 @@
</Grid.RowDefinitions>

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

<Button
@@ -154,70 +154,144 @@
Content="下发参数"
FontSize="24"
Style="{StaticResource ImageButtonStyle}" />
<StackPanel Orientation="Vertical" HorizontalAlignment="Left" Grid.Row="1"
Margin="10,0,10,0" >
<StackPanel
Grid.Row="1"
Margin="10,0,10,0"
HorizontalAlignment="Left"
Orientation="Vertical">
<CheckBox
Margin="0,10,10,0"
VerticalAlignment="Center"
Content="西门子设备连接"
FontFamily="楷体"
VerticalAlignment="Center"
FontSize="20"
Foreground="Aqua"
IsChecked="{Binding SiemensConnect}" />
<CheckBox
Margin="0,10,10,0"
VerticalAlignment="Center"
Content="粉料仓设备连接"
FontFamily="楷体"
FontSize="20"
VerticalAlignment="Center"
Foreground="Aqua"
IsChecked="{Binding WindSendConnect}"/>
IsChecked="{Binding WindSendConnect}" />
<CheckBox
Margin="0,10,10,0"
VerticalAlignment="Center"
Content="小料站产线PLC设备连接"
FontFamily="楷体"
FontSize="20"
VerticalAlignment="Center"
Foreground="Aqua"
IsChecked="{Binding HKPlcConnect}"/>
IsChecked="{Binding HKPlcConnect}" />

</StackPanel>
<Grid Grid.Row="1" Grid.Column="1" VerticalAlignment="Top">
<Grid
Grid.Row="1"
Grid.Column="1"
VerticalAlignment="Top">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="37*" ></ColumnDefinition>
<ColumnDefinition Width="163*"/>
<ColumnDefinition Width="37*" />
<ColumnDefinition Width="163*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></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="" />
<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
Grid.RowSpan="2"
Grid.ColumnSpan="2"
Margin="0,42,0,75">
<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
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
Grid.Row="1"
Grid.RowSpan="2"
Grid.ColumnSpan="2"
Margin="0,47,0,71">
<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.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>


+ 125
- 43
BPASmartClient.JXJFoodSmallStation/View/WindSendParView.xaml View File

@@ -6,8 +6,8 @@
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"
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
xmlns:vm="clr-namespace:BPASmartClient.JXJFoodSmallStation.ViewModel"
d:DesignHeight="1080"
d:DesignWidth="1920"
mc:Ignorable="d">
@@ -16,6 +16,14 @@
<vm:WindSendParViewModel />
</UserControl.DataContext>

<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.JXJFoodSmallStation;component/Resource/MyStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>

<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="60" />
@@ -24,7 +32,10 @@
</Grid.RowDefinitions>
<!--#region 表格标题栏设置-->
<Grid>
<StackPanel HorizontalAlignment="Right" VerticalAlignment="Center" Orientation="Horizontal">
<StackPanel
HorizontalAlignment="Right"
VerticalAlignment="Center"
Orientation="Horizontal">
<!--<pry:IcoButton
Margin="10"
Command="{Binding UpdateRawMaterial}"
@@ -32,13 +43,22 @@
FontSize="28"
Foreground="Aqua"
Style="{StaticResource IcoButtonStyle}" />-->
<pry:IcoButton
<Button
Width="150"
Height="50"
Margin="5"
Command="{Binding SaveRawMaterialPara}"
Content="保存参数"
FontSize="28"
Foreground="DeepSkyBlue"
Style="{StaticResource ImageButtonStyle}" />
<!--<pry:IcoButton
Margin="10"
Command="{Binding SaveRawMaterialPara}"
Content="保存参数"
FontSize="28"
Foreground="Aqua"
Style="{StaticResource IcoButtonStyle}" />
Style="{StaticResource IcoButtonStyle}" />-->
</StackPanel>

</Grid>
@@ -48,79 +68,141 @@
Background="#ff0C255F">

<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</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="0"
FontSize="24"
Style="{StaticResource TitleTextblockStyle}"
Text="序号" />

<TextBlock
Grid.Column="1"
FontSize="24"
Style="{StaticResource TitleTextblockStyle}"
Text="料仓位置" />

<TextBlock
Grid.Column="2"
FontSize="24"
Style="{StaticResource TitleTextblockStyle}"
Text="原料编号" />

<TextBlock
Grid.Column="3"
FontSize="24"
Style="{StaticResource TitleTextblockStyle}"
Text="原料名称" />

<TextBlock Grid.Column="3" FontSize="24" Text="原料名称" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua" />
<Border
Grid.Column="0"
Grid.ColumnSpan="4"
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,1,1,1" />
<Border
Grid.Column="1"
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0" />
<Border
Grid.Column="3"
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0" />
</Grid>
<Grid Grid.Row="2">
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" >
<ItemsControl ItemsSource="{Binding WindSendRawMaterial}" Foreground="Aqua">
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<ItemsControl Foreground="DeepSkyBlue" ItemsSource="{Binding WindSendRawMaterial}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Name="gr" >
<Grid Name="gr">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid Grid.Column="0" Margin="5">

<TextBlock
Grid.Column="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Text="{Binding Location}" />

<TextBlock
Grid.Column="1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Text="{Binding Location}" />

<TextBox
Grid.Column="2"
Style="{StaticResource InputTextboxStyle}"
Text="{Binding RawMaterialName}" />

<TextBlock
Grid.Column="3"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Text="{Binding RawMaterialChineseName}" />

<Border
Grid.Column="0"
Grid.ColumnSpan="4"
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,1" />
<Border
Grid.Column="1"
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0" />
<Border
Grid.Column="3"
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0" />

<!--<Grid Grid.Column="0" Margin="5">
<TextBlock
FontSize="16"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="{Binding Location}" />
<Border
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
FontSize="16"
Text="{Binding Location}" />
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" />

</Grid>
<Grid Grid.Column="1" Margin="5">
<TextBlock
Width="50"
FontSize="16"
TextAlignment="Center"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="{Binding Location}" />
<Border
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
FontSize="16"
Text="{Binding Location}"
TextAlignment="Center" />
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" />

</Grid>
<Grid Grid.Column="2" Margin="5">
<TextBox
Name="name"
Width="50"
FontSize="16"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="{Binding RawMaterialName}"/>
<Border
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
VerticalAlignment="Center"
FontSize="16"
Text="{Binding RawMaterialName}" />
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" />
</Grid>
<Grid Grid.Column="3" Margin="5">
<TextBlock
FontSize="16"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="{Binding RawMaterialChineseName}" />
<Border
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>
VerticalAlignment="Center"
FontSize="16"
Text="{Binding RawMaterialChineseName}" />
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" />
</Grid>-->
</Grid>
<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">


+ 78
- 16
BPASmartClient.JXJFoodSmallStation/ViewModel/ManualControlViewModel.cs View File

@@ -22,17 +22,21 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
{
ThreadManage.GetInstance().StartLong(new Action(() =>
{
SystemMode = GVL_SmallStation.GetInstance.PlcSystemMode ? "手动" : "自动";
PlcSystemMode = GVL_SmallStation.GetInstance.PlcSystemMode;
//SystemMode = GVL_SmallStation.GetInstance.PlcSystemMode ? "手动" : "自动";
//if (GVL_SmallStation.GetInstance.PlcSystemMode) ManualMode = true;
//else AutoModeStatus = true;
if (GVL_SmallStation.GetInstance.PlcSystemIsAutoRun)
{
if (GVL_SmallStation.GetInstance.PlcSystemIsPause)
{
SystemStatus = "暂停";
}
else
{
SystemStatus = "运行";
}
SystemStatus = GVL_SmallStation.GetInstance.PlcSystemIsPause ? "暂停" : "运行";
//if (GVL_SmallStation.GetInstance.PlcSystemIsPause)
//{
// SystemStatus = "暂停";
//}
//else
//{
// SystemStatus = "运行";
//}
}
else
{
@@ -230,7 +234,7 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
StopAxisLoadCommand = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("StopAxisLoadCommand");
});
});
StartAxisMidCommand = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("StartAxisMidCommand");
@@ -264,7 +268,7 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
ActionManage.GetInstance.Send("StopAxis2Command");
});

SystemStartCommand = new RelayCommand(() =>
SystemStartCommand = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("SystemStart");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"系统启动!");
@@ -286,11 +290,11 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
});
DebugMode = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("SystemDebugMode");
// ActionManage.GetInstance.Send("SystemDebugMode");
});
AutoMode = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("SystemAutoMode");
// ActionManage.GetInstance.Send("SystemAutoMode");
});
}

@@ -309,7 +313,7 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
/// </summary>
public static 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;
private static string _mSystemMode = String.Empty;


public static string SystemStatus { get { return _mSystemStatus; } set { _mSystemStatus = value; OnStaticPropertyChanged(); } }
@@ -339,15 +343,73 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
public RelayCommand SystemStopCommand { get; set; }
public RelayCommand SystemPauseCommand { get; set; }


public RelayCommand SystemResetCommand { get; set; }

public RelayCommand AutoMode { get; set; }
public RelayCommand DebugMode { get; set; }

/// <summary>
/// 系统模式改变
/// </summary>
public static bool PlcSystemMode
{
get { return _mPlcSystemMode; }
set
{
if (_mPlcSystemMode != value || string.IsNullOrEmpty(SystemMode))
{
_mPlcSystemMode = value;
SystemMode = value ? "手动" : "自动";
if (value) ManualMode = true;
else AutoModeStatus = true;
}

}
}
private static bool _mPlcSystemMode;


/// <summary>
/// 自动模式
/// </summary>
public static bool AutoModeStatus
{
get { return _mAutoModeStatus; }
set
{
if (_mAutoModeStatus != value || (!_mAutoModeStatus && !_mManualMode))
{
if (value)
ProcessControl.GetInstance.HKDevice.HK_PLC_S7.Write<bool>("DB44.DBX0.1", false);
_mAutoModeStatus = value;
OnStaticPropertyChanged();
}
}
}
private static bool _mAutoModeStatus;

/// <summary>
/// 手动模式
/// </summary>
public static bool ManualMode
{
get { return _mManualMode; }
set
{
if (_mManualMode != value || (!_mAutoModeStatus && !_mManualMode))
{
if (value)
ProcessControl.GetInstance.HKDevice.HK_PLC_S7.Write<bool>("DB44.DBX0.1", true);
_mManualMode = value;
OnStaticPropertyChanged();
}
}
}
private static bool _mManualMode;
}



public class CylinderModel : ObservableObject
{
public bool LeftTog { get { return _mLeftTog; } set { _mLeftTog = value; OnPropertyChanged(); } }


+ 190
- 26
BPASmartClient.JXJFoodSmallStation/ViewModel/ManualFlowViewModel.cs View File

@@ -17,33 +17,52 @@ using System.Threading;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using BPASmartClient.CustomResource.Pages.Model;
using System.Windows;

namespace BPASmartClient.JXJFoodSmallStation.ViewModel
{
public class ManualFlowViewModel:ObservableObject
public class ManualFlowViewModel : ObservableObject
{
public ManualFlowViewModel()
{
time = GVL_SmallStation.GetInstance.Time;
Test1Command = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("PLCWrite", new HKDeviceWrite() { Address = "DB4.DBX0.7", PlcVarType = PlcVarType.Bool, Value = true });
ActionManage.GetInstance.Send("PLCWrite", new HKDeviceWrite() { Address = "DB4.DBX8.0", PlcVarType = PlcVarType.Bool, Value = true });
//Thread.Sleep(200);
//ActionManage.GetInstance.Send("PLCWrite", new HKDeviceWrite() { Address = "DB4.DBX8.0", PlcVarType = PlcVarType.Bool, Value = false });
//GVL_SmallStation.GetInstance.AGV_PutTray1Finish = true;
MessageNotify.GetInstance.ShowUserLog("手动点击按钮,AGV送托盘完成");
MessageNotify.GetInstance.ShowUserLog("手动点击按钮,AGV送托盘完成");

VisibilityBtn1 = Visibility.Hidden;
VisibilityBtn2 = Visibility.Visible;
VisibilityBtn3 = Visibility.Hidden;
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"手动点击按钮,AGV送托盘完成");
});
Test2Command = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("PLCWrite", new HKDeviceWrite() { Address = "DB4.DBX1.7", PlcVarType = PlcVarType.Bool, Value = true });
ActionManage.GetInstance.Send("PLCWrite", new HKDeviceWrite() { Address = "DB4.DBX4.0", PlcVarType = PlcVarType.Bool, Value = true });
//Thread.Sleep(200);
//ActionManage.GetInstance.Send("PLCWrite", new HKDeviceWrite() { Address = "DB4.DBX4.0", PlcVarType = PlcVarType.Bool, Value = false });
//GVL_SmallStation.GetInstance.WindSendDosingComple = true;
MessageNotify.GetInstance.ShowUserLog("手动点击按钮,粉料仓配料完成");

VisibilityBtn1 = Visibility.Hidden;
VisibilityBtn2 = Visibility.Hidden;
VisibilityBtn3 = Visibility.Visible;
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"手动点击按钮,粉料仓配料完成");
});
Test3Command = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("PLCWrite", new HKDeviceWrite() { Address = "DB4.DBX1.1", PlcVarType = PlcVarType.Bool, Value = true });
ActionManage.GetInstance.Send("PLCWrite", new HKDeviceWrite() { Address = "DB4.DBX10.0", PlcVarType = PlcVarType.Bool, Value = true });
//Thread.Sleep(200);
//ActionManage.GetInstance.Send("PLCWrite", new HKDeviceWrite() { Address = "DB4.DBX10.0", PlcVarType = PlcVarType.Bool, Value = false });
//GVL_SmallStation.GetInstance.AGV_GetTray1Finish = true;
MessageNotify.GetInstance.ShowUserLog("手动点击按钮,AGV取托盘完成");

VisibilityBtn1 = Visibility.Visible;
VisibilityBtn2 = Visibility.Hidden;
VisibilityBtn3 = Visibility.Hidden;
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"手动点击按钮,AGV取托盘完成");
});
Test4Command = new RelayCommand(() =>
@@ -63,26 +82,80 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
ActionManage.GetInstance.Send("AGVPutTrayFinish");
MessageNotify.GetInstance.ShowUserLog("手动点击按钮,AGV放货架流程完成");
});
CLearRecipeInfo = new RelayCommand(() =>
CLearRecipeInfo = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("CLearRecipeInfo");
MessageNotify.GetInstance.ShowUserLog("手动点击按钮,配方清零");
App.Current.Dispatcher.Invoke(() =>
{
if (MessageNotify.GetInstance.ShowDialog("请确认,是否进行【PLC配方清零】操作"))
{
ActionManage.GetInstance.Send("CLearRecipeInfo");
MessageNotify.GetInstance.ShowUserLog("手动点击按钮,PLC配方清零");
}
});
});
SystemReset = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("ManualSystemReset");
MessageNotify.GetInstance.ShowUserLog("手动点击按钮,PLC系统复位");
App.Current.Dispatcher.Invoke(() =>
{
if (MessageNotify.GetInstance.ShowDialog("请确认,是否进行【PLC系统复位】操作"))
{
ActionManage.GetInstance.Send("ManualSystemReset");
MessageNotify.GetInstance.ShowUserLog("手动点击按钮,PLC系统复位");
}
});
});
BPAResetCommand = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("BPASystemReset");
MessageNotify.GetInstance.ShowUserLog("手动点击按钮,上位机初始化");
App.Current.Dispatcher.Invoke(() =>
{
if (MessageNotify.GetInstance.ShowDialog("请确认,是否进行【上位机初始化】操作"))
{
ActionManage.GetInstance.Send("BPASystemReset");
MessageNotify.GetInstance.ShowUserLog("手动点击按钮,上位机初始化");
}
});
});
StockbinDosingComple = new RelayCommand(() =>
{
int loc = StockbinDosingCompleNum;
if (loc >= 1 && loc <= 8)
{
ActionManage.GetInstance.Send("PLCWrite", new HKDeviceWrite() { Address = "DB4.DBX12." + (loc - 1), PlcVarType = PlcVarType.Bool, Value = true });

MessageNotify.GetInstance.ShowUserLog($"手动点击按钮,给plc料仓{loc}配料完成信号");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"手动点击按钮,手动设置料仓{loc}配料完成");
}
else if (loc >= 9 && loc <= 15)
{
ActionManage.GetInstance.Send("PLCWrite", new HKDeviceWrite() { Address = "DB4.DBX13." + (loc - 9), PlcVarType = PlcVarType.Bool, Value = true });

MessageNotify.GetInstance.ShowUserLog($"手动点击按钮,给plc料仓{loc}配料完成信号");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"手动点击按钮,手动设置料仓{loc}配料完成");
}
else
{
MessageNotify.GetInstance.ShowUserLog("料仓编号不正确");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"手动点击按钮,手动设置料仓{loc}配料,料仓编号不正确");
}
});
StockbinDosingCompleClear = new RelayCommand(() =>
{
//for (int i = 0; i < GVL_SmallStation.GetInstance.StockInDosingComple.Length; i++)
//{
// GVL_SmallStation.GetInstance.StockInDosingComple[i] = false;
//}
//MessageNotify.GetInstance.ShowUserLog($"手动点击按钮,清除所有手动配料完成信号");
//NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"清除所有手动配料完成信号");
});
ThreadManage.GetInstance().StartLong(new Action(() =>
{
DosingComplete = GVL_SmallStation.GetInstance.StockBinDosing.ToBinString();
Recipe1DosingComplete = GVL_SmallStation.GetInstance.RecipeStockBinDosing[0].ToBinString();
Recipe2DosingComplete = GVL_SmallStation.GetInstance.RecipeStockBinDosing[1].ToBinString();
Recipe3DosingComplete = GVL_SmallStation.GetInstance.RecipeStockBinDosing[2].ToBinString();
Recipe4DosingComplete = GVL_SmallStation.GetInstance.RecipeStockBinDosing[3].ToBinString();
Recipe5DosingComplete = GVL_SmallStation.GetInstance.RecipeStockBinDosing[4].ToBinString();
Heartbeat = GVL_SmallStation.GetInstance.HeartBeatFromPlc;
switch (GVL_SmallStation.GetInstance.SiemensSendRecipeStatus)
switch (GVL_SmallStation.GetInstance.SiemensSendRecipeStatus)
{
case 0:
OrderStatus = IssueRecipeCondition.等待小料站PLC允许下配方.ToString();
@@ -109,22 +182,78 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
OrderStatus = "无意义";
break;
}
switch (GVL_SmallStation.GetInstance.RecipeStatusIDTray1)
switch (GVL_SmallStation.GetInstance.RecipeProcessStatus[0])
{
case 0:
Recipe1DosingStatus = ProcessCondition.等待AGV到位.ToString();
break;
case 1:
Recipe1DosingStatus = ProcessCondition.等待小料站PLC接受配方完成.ToString();
break;
case 2:
Recipe1DosingStatus = ProcessCondition.等待配方配料完成.ToString();
break;
default:
break;
}
switch (GVL_SmallStation.GetInstance.RecipeProcessStatus[1])
{
case 0:
Recipe2DosingStatus = ProcessCondition.等待AGV到位.ToString();
break;
case 1:
Recipe2DosingStatus = ProcessCondition.等待小料站PLC接受配方完成.ToString();
break;
case 2:
Recipe2DosingStatus = ProcessCondition.等待配方配料完成.ToString();
break;
default:
break;
}
switch (GVL_SmallStation.GetInstance.RecipeProcessStatus[2])
{
case 0:
Recipe3DosingStatus = ProcessCondition.等待AGV到位.ToString();
break;
case 1:
Recipe3DosingStatus = ProcessCondition.等待小料站PLC接受配方完成.ToString();
break;
case 2:
Recipe3DosingStatus = ProcessCondition.等待配方配料完成.ToString();
break;
default:
break;
}
switch (GVL_SmallStation.GetInstance.RecipeProcessStatus[3])
{
case 0:
Recipe4DosingStatus = ProcessCondition.等待AGV到位.ToString();
break;
case 1:
Recipe4DosingStatus = ProcessCondition.等待小料站PLC接受配方完成.ToString();
break;
case 2:
Recipe4DosingStatus = ProcessCondition.等待配方配料完成.ToString();
break;
default:
break;
}
switch (GVL_SmallStation.GetInstance.RecipeProcessStatus[4])
{
case 0:
OrderDosingStatus = ProcessCondition.等待AGV到位.ToString();
Recipe5DosingStatus = ProcessCondition.等待AGV到位.ToString();
break;
case 1:
OrderDosingStatus = ProcessCondition.等待小料站PLC接受配方完成.ToString();
Recipe5DosingStatus = ProcessCondition.等待小料站PLC接受配方完成.ToString();
break;
case 2:
OrderDosingStatus = ProcessCondition.等待配方配料完成.ToString();
Recipe5DosingStatus = ProcessCondition.等待配方配料完成.ToString();
break;
default:
break;
}
Thread.Sleep(100);
}), "流程手动设备状态读取",true);
}), "流程手动设备状态读取", true);
TimeSet = new RelayCommand(() =>
{
GVL_SmallStation.GetInstance.Time = time;
@@ -144,13 +273,23 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
public RelayCommand TimeSet { get; set; }
public static bool Heartbeat { get { return _mHeartbeat; } set { _mHeartbeat = value; OnStaticPropertyChanged(); } }
private static bool _mHeartbeat;
public int time { get { return _mtime; } set { _mtime = value; OnStaticPropertyChanged(); } }
private int _mtime;
public static string OrderStatus { get { return _mOrderStatus; } set { _mOrderStatus = value; OnStaticPropertyChanged(); } }
private static string _mOrderStatus = "无意义";
public static string OrderDosingStatus { get { return _mOrderDosingStatus; } set { _mOrderDosingStatus = value; OnStaticPropertyChanged(); } }
private static string _mOrderDosingStatus = "无意义";
public static string Recipe1DosingStatus { get { return _mRecipe1DosingStatus; } set { _mRecipe1DosingStatus = value; OnStaticPropertyChanged(); } }
private static string _mRecipe1DosingStatus = "无意义";
public static string Recipe2DosingStatus { get { return _mRecipe2DosingStatus; } set { _mRecipe2DosingStatus = value; OnStaticPropertyChanged(); } }
private static string _mRecipe2DosingStatus = "无意义";
public static string Recipe3DosingStatus { get { return _mRecipe3DosingStatus; } set { _mRecipe3DosingStatus = value; OnStaticPropertyChanged(); } }
private static string _mRecipe3DosingStatus = "无意义";
public static string Recipe4DosingStatus { get { return _mRecipe4DosingStatus; } set { _mRecipe4DosingStatus = value; OnStaticPropertyChanged(); } }
private static string _mRecipe4DosingStatus = "无意义";
public static string Recipe5DosingStatus { get { return _mRecipe5DosingStatus; } set { _mRecipe5DosingStatus = value; OnStaticPropertyChanged(); } }
private static string _mRecipe5DosingStatus = "无意义";


public static event EventHandler<PropertyChangedEventArgs> StaticPropertyChanged;
public static void OnStaticPropertyChanged([CallerMemberName] string PropName = "")
{
@@ -159,14 +298,39 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
public RelayCommand CLearRecipeInfo { get; set; }
public RelayCommand SystemReset { get; set; }
public RelayCommand BPAResetCommand { get; set; }
private bool _SiemensIsConnect { get; set; }
public bool SiemensIsConnect { get { return _SiemensIsConnect; } set { _SiemensIsConnect = value; OnPropertyChanged(); } }
private bool _SiemensIsConnect { get; set; }
public bool SiemensIsConnect { get { return _SiemensIsConnect; } set { _SiemensIsConnect = value; OnPropertyChanged(); } }
private bool _HKPlcIsConnect { get; set; }
public bool HKPlcIsConnect { get { return _HKPlcIsConnect; } set { _HKPlcIsConnect = value; OnPropertyChanged(); } }
private bool _WindSendIsConnect { get; set; }
public bool WindSendIsConnect { get { return _WindSendIsConnect; } set { _WindSendIsConnect = value; OnPropertyChanged(); } }

private static string _DosingComplete { get; set; }
public static string DosingComplete { get { return _DosingComplete; } set { _DosingComplete = value; OnStaticPropertyChanged(); } }

private static string _Recipe1DosingComplete { get; set; }
public static string Recipe1DosingComplete { get { return _Recipe1DosingComplete; } set { _Recipe1DosingComplete = value; OnStaticPropertyChanged(); } }

private static string _Recipe2DosingComplete { get; set; }
public static string Recipe2DosingComplete { get { return _Recipe2DosingComplete; } set { _Recipe2DosingComplete = value; OnStaticPropertyChanged(); } }

private static string _Recipe3DosingComplete { get; set; }
public static string Recipe3DosingComplete { get { return _Recipe3DosingComplete; } set { _Recipe3DosingComplete = value; OnStaticPropertyChanged(); } }
private static string _Recipe4DosingComplete { get; set; }
public static string Recipe4DosingComplete { get { return _Recipe4DosingComplete; } set { _Recipe4DosingComplete = value; OnStaticPropertyChanged(); } }
private static string _Recipe5DosingComplete { get; set; }
public static string Recipe5DosingComplete { get { return _Recipe5DosingComplete; } set { _Recipe5DosingComplete = value; OnStaticPropertyChanged(); } }


public RelayCommand StockbinDosingComple { get; set; }
public RelayCommand StockbinDosingCompleClear { get; set; }
private static int _StockbinDosingCompleNum { get; set; }
public static int StockbinDosingCompleNum { get { return _StockbinDosingCompleNum; } set { _StockbinDosingCompleNum = value; OnStaticPropertyChanged(); } }


public static Visibility VisibilityBtn1 { get { return _VisibilityBtn1; } set { _VisibilityBtn1 = value; OnStaticPropertyChanged(); } }
private static Visibility _VisibilityBtn1 = Visibility.Visible;
public static Visibility VisibilityBtn2 { get { return _VisibilityBtn2; } set { _VisibilityBtn2 = value; OnStaticPropertyChanged(); } }
private static Visibility _VisibilityBtn2 = Visibility.Hidden;
public static Visibility VisibilityBtn3 { get { return _VisibilityBtn3; } set { _VisibilityBtn3 = value; OnStaticPropertyChanged(); } }
private static Visibility _VisibilityBtn3 = Visibility.Hidden;
}
}

+ 5
- 12
BPASmartClient.JXJFoodSmallStation/ViewModel/RecipeReceiveViewModel.cs View File

@@ -27,8 +27,7 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
//ObservableCollection<RemoteRecipeRawMaterial> RawMaterials { get; set; } = new ObservableCollection<RemoteRecipeRawMaterial>();
public RecipeReceiveViewModel()
{
AskRecipeFormSiemens = GVL_SmallStation.GetInstance.RequestOrder;
NotUseSmallDosing = GVL_SmallStation.GetInstance.NotUseSmallDosing;
NotUseSmallDosing = GVL_SmallStation.GetInstance.NotUseSmallStation;
IsUseLocalRecipe = GVL_SmallStation.GetInstance.IsUseLocalRecipe;
IsUseWindSendDosing = GVL_SmallStation.GetInstance.IsUseWindSend;
Recipes = Json<LocalRecipeDataColl>.Data.Recipes;
@@ -148,23 +147,17 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
{
Json<LocalRecipeDataColl>.Data.Recipes.Clear();
});
}
public bool IsUseLocalRecipe { get { return _mIsUseLocalRecipe; }set { _mIsUseLocalRecipe = value; OnPropertyChanged(); } }
private bool _mIsUseLocalRecipe ;

}

public bool NotUseSmallDosing { get { return _mNotUseSmallDosing; } set { _mNotUseSmallDosing = value; OnPropertyChanged(); } }
private bool _mNotUseSmallDosing;

public bool IsUseLocalRecipe { get { return _mIsUseLocalRecipe; }set { _mIsUseLocalRecipe = value; OnPropertyChanged(); } }
private bool _mIsUseLocalRecipe ;

public bool IsUseWindSendDosing { get { return _mIsUseWindSendDosing; } set { _mIsUseWindSendDosing = value;OnPropertyChanged(); } }
private bool _mIsUseWindSendDosing ;


public bool AskRecipeFormSiemens { get { return _mAskRecipeFormSiemens; } set { _mAskRecipeFormSiemens = value; OnPropertyChanged(); } }
private bool _mAskRecipeFormSiemens;


public RelayCommand<object> DetailsCommand { get; set; }
public RelayCommand<object> IssueRecipe { get; set; }
public RelayCommand<object> RemoveRecipe { get; set; }


+ 58
- 52
BPASmartClient.JXJFoodSmallStation/ViewModel/RobotViewModel.cs View File

@@ -16,6 +16,7 @@ using BPASmartClient.JXJFoodSmallStation.Model.HK_PLC;
using System.Threading;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using BPASmartClient.CustomResource.Pages.Model;

namespace BPASmartClient.JXJFoodSmallStation.ViewModel
{
@@ -26,57 +27,62 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
ThreadManage.GetInstance().StartLong(() =>
{
IsRunProgramNum = GVL_SmallStation.GetInstance.RobotProgramNum;
RobotIsAutoMode = GVL_SmallStation.GetInstance.RobotStatus.GetBitValue(1);
RobotIsAutoRun = GVL_SmallStation.GetInstance.RobotStatus.GetBitValue(2);
RobotIsStop = GVL_SmallStation.GetInstance.RobotStatus.GetBitValue(3);
RobotIsRun = GVL_SmallStation.GetInstance.RobotStatus.GetBitValue(4);
RobotIsAlarm = GVL_SmallStation.GetInstance.RobotStatus.GetBitValue(5);
RobotIsHomed = GVL_SmallStation.GetInstance.RobotStatus.GetBitValue(6);
RobotGetEmptyBarrelComplete = GVL_SmallStation.GetInstance.RobotStatus.GetBitValue(8);
RobotPutEmptyBarrelComplete = GVL_SmallStation.GetInstance.RobotStatus.GetBitValue(9);
RobotGetFullBarrelComplete = GVL_SmallStation.GetInstance.RobotStatus.GetBitValue(10);
RobotPutFullBarrelComplete = GVL_SmallStation.GetInstance.RobotStatus.GetBitValue(11);
RobotIsAutoMode = GVL_SmallStation.GetInstance.RobotStatus.GetBitValue(2);
RobotIsAutoRun = GVL_SmallStation.GetInstance.RobotStatus.GetBitValue(3);
RobotIsStop = GVL_SmallStation.GetInstance.RobotStatus.GetBitValue(4);
RobotIsRun = GVL_SmallStation.GetInstance.RobotStatus.GetBitValue(5);
RobotIsAlarm = GVL_SmallStation.GetInstance.RobotStatus.GetBitValue(6);
RobotIsHomed = GVL_SmallStation.GetInstance.RobotStatus.GetBitValue(7);
//RobotGetEmptyBarrelComplete = GVL_SmallStation.GetInstance.RobotStatus.GetBitValue(8);
//RobotPutEmptyBarrelComplete = GVL_SmallStation.GetInstance.RobotStatus.GetBitValue(9);
//RobotGetFullBarrelComplete = GVL_SmallStation.GetInstance.RobotStatus.GetBitValue(10);
//RobotPutFullBarrelComplete = GVL_SmallStation.GetInstance.RobotStatus.GetBitValue(11);

Thread.Sleep(10);

},"机器人状态",true);
SystemStart = new RelayCommand(() => {
ActionManage.GetInstance.Send("RobotSendTrueCommand", "DB4.DBX100.0");
ActionManage.GetInstance.Send("RobotSendTrueCommand", "DB4.DBX0.1");
MessageNotify.GetInstance.ShowUserLog($"手动控制,机器人启动");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"机器人启动,操作完成!");
});
SystemStop = new RelayCommand(() => {
ActionManage.GetInstance.Send("RobotSendTrueCommand", "DB4.DBX100.1");
ActionManage.GetInstance.Send("RobotSendTrueCommand", "DB4.DBX0.2");
MessageNotify.GetInstance.ShowUserLog($"手动控制,机器人停止");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"机器人停止,操作完成!");
});
EStopReset = new RelayCommand(() => {
ActionManage.GetInstance.Send("RobotSendTrueCommand", "DB4.DBX100.2");
ActionManage.GetInstance.Send("RobotSendTrueCommand", "DB4.DBX0.3");
MessageNotify.GetInstance.ShowUserLog($"手动控制,机器人急停复位");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"机器人急停复位,操作完成!");
});

TestRobotRun = new RelayCommand(() => {
ActionManage.GetInstance.Send("RobotSendTrueCommand", "DB4.DBX100.4");
});
AutoMode = new RelayCommand(() => {
ActionManage.GetInstance.Send("RobotSendFalseCommand", "DB4.DBX100.3");
});
TestMode = new RelayCommand(() => {
ActionManage.GetInstance.Send("RobotSendTrueCommand", "DB4.DBX100.3");
});
//TestRobotRun = new RelayCommand(() => {
// ActionManage.GetInstance.Send("RobotSendTrueCommand", "DB4.DBX100.4");
//});
//AutoMode = new RelayCommand(() => {
// ActionManage.GetInstance.Send("RobotSendFalseCommand", "DB4.DBX100.3");
//});
//TestMode = new RelayCommand(() => {
// ActionManage.GetInstance.Send("RobotSendTrueCommand", "DB4.DBX100.3");
//});

RobotGetEmptyBarrel = new RelayCommand(() => {
ActionManage.GetInstance.Send("RobotSendTrueCommand", "DB4.DBX100.7");
});
RobotPutEmptyBarrel = new RelayCommand(() => {
ActionManage.GetInstance.Send("RobotSendTrueCommand", "DB4.DBX101.0");
});
RobotGetFullBarrel = new RelayCommand(() => {
ActionManage.GetInstance.Send("RobotSendTrueCommand", "DB4.DBX101.1");
});
RobotPutFullBarrel = new RelayCommand(() => {
ActionManage.GetInstance.Send("RobotSendTrueCommand", "DB4.DBX101.2");
});
SetProgramNumCommand = new RelayCommand(() =>{
ActionManage.GetInstance.Send("RobotSetProgramNum", SetProgramNum);
});
//RobotGetEmptyBarrel = new RelayCommand(() => {
// ActionManage.GetInstance.Send("RobotSendTrueCommand", "DB4.DBX100.7");
//});
//RobotPutEmptyBarrel = new RelayCommand(() => {
// ActionManage.GetInstance.Send("RobotSendTrueCommand", "DB4.DBX101.0");
//});
//RobotGetFullBarrel = new RelayCommand(() => {
// ActionManage.GetInstance.Send("RobotSendTrueCommand", "DB4.DBX101.1");
//});
//RobotPutFullBarrel = new RelayCommand(() => {
// ActionManage.GetInstance.Send("RobotSendTrueCommand", "DB4.DBX101.2");
//});
//SetProgramNumCommand = new RelayCommand(() =>{
// ActionManage.GetInstance.Send("RobotSetProgramNum", SetProgramNum);
//});
}

public RelayCommand SystemStart { get; set; }
public RelayCommand SystemStop { get; set; }
public RelayCommand EStopReset { get; set; }
@@ -91,23 +97,23 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
public RelayCommand RobotPutFullBarrel { get; set; }
public RelayCommand SetProgramNumCommand { get; set; }

public short IsRunProgramNum { get { return _runProgramNum; } set { _runProgramNum = value;OnPropertyChanged(); } }
private short _runProgramNum;
public static short IsRunProgramNum { get { return _runProgramNum; } set { _runProgramNum = value; OnStaticPropertyChanged(); } }
private static short _runProgramNum;
public short SetProgramNum { get { return _SetProgramNum; } set { _SetProgramNum = value; OnPropertyChanged(); } }
private short _SetProgramNum;

public bool RobotIsAutoMode { get { return _RobotIsAutoMode; } set { _RobotIsAutoMode = value; OnPropertyChanged(); } }
private bool _RobotIsAutoMode;
public bool RobotIsAutoRun { get { return _RobotIsAutoRun; } set { _RobotIsAutoRun = value; OnPropertyChanged(); } }
private bool _RobotIsAutoRun;
public bool RobotIsStop { get { return _RobotIsStop; } set { _RobotIsStop = value; OnPropertyChanged(); } }
private bool _RobotIsStop;
public bool RobotIsRun { get { return _RobotIsRun; } set { _RobotIsRun = value; OnPropertyChanged(); } }
private bool _RobotIsRun;
public bool RobotIsAlarm { get { return _RobotIsAlarm; } set { _RobotIsAlarm = value; OnPropertyChanged(); } }
private bool _RobotIsAlarm;
public bool RobotIsHomed { get { return _RobotIsHomed; } set { _RobotIsHomed = value; OnPropertyChanged(); } }
private bool _RobotIsHomed;
public static bool RobotIsAutoMode { get { return _RobotIsAutoMode; } set { _RobotIsAutoMode = value; OnStaticPropertyChanged(); } }
private static bool _RobotIsAutoMode;
public static bool RobotIsAutoRun { get { return _RobotIsAutoRun; } set { _RobotIsAutoRun = value; OnStaticPropertyChanged(); } }
private static bool _RobotIsAutoRun;
public static bool RobotIsStop { get { return _RobotIsStop; } set { _RobotIsStop = value; OnStaticPropertyChanged(); } }
private static bool _RobotIsStop;
public static bool RobotIsRun { get { return _RobotIsRun; } set { _RobotIsRun = value; OnStaticPropertyChanged(); } }
private static bool _RobotIsRun;
public static bool RobotIsAlarm { get { return _RobotIsAlarm; } set { _RobotIsAlarm = value; OnStaticPropertyChanged(); } }
private static bool _RobotIsAlarm;
public static bool RobotIsHomed { get { return _RobotIsHomed; } set { _RobotIsHomed = value; OnStaticPropertyChanged(); } }
private static bool _RobotIsHomed;
public bool RobotGetEmptyBarrelComplete { get { return _RobotGetEmptyBarrelComplete; } set { _RobotGetEmptyBarrelComplete = value; OnPropertyChanged(); } }
private bool _RobotGetEmptyBarrelComplete;
public bool RobotPutEmptyBarrelComplete { get { return _RobotPutEmptyBarrelComplete; } set { _RobotPutEmptyBarrelComplete = value; OnPropertyChanged(); } }


+ 14
- 9
BPASmartClient.Modbus/ModbusTcp.cs View File

@@ -56,7 +56,7 @@ namespace BPASmartClient.Modbus
IPAdress = ip;
Port = port;
modbusFactory = new ModbusFactory();
Connect();
Connect();
if (Connected)
{
master.Transport.ReadTimeout = 3000;//读取超时时间
@@ -150,7 +150,7 @@ namespace BPASmartClient.Modbus
{
if (ExitAddress >= 0 && ExitAddress <= 7)
{
return (firstAddress * 8) + ExitAddress;
return (firstAddress * 8) + ExitAddress;
}
}
}
@@ -163,12 +163,12 @@ namespace BPASmartClient.Modbus
return int.Parse(res);
}
}
else if(address.ToUpper().Contains("LB") && address.Length >= 3)
else if (address.ToUpper().Contains("LB") && address.Length >= 3)
{
var res = address.Substring(2);
if (res != null && res.Length > 0)
{
if(int.TryParse(res, out int firstAddress))
if (int.TryParse(res, out int firstAddress))
{
return firstAddress;
}
@@ -272,7 +272,7 @@ namespace BPASmartClient.Modbus
CommandType commandType = CommandType.Coils;
try
{
if (address.ToUpper().Contains("M") || address.ToUpper().Contains("GM"))
if (address.ToUpper().Contains("M") || address.ToUpper().Contains("GM"))
{
commandType = CommandType.Coils;
return master.ReadCoils(slaveAddress, startAddress, len);
@@ -297,7 +297,7 @@ namespace BPASmartClient.Modbus
{
commandType = CommandType.HoldingRegisters;
var var1 = master.ReadHoldingRegisters(slaveAddress, startAddress, len);
var var2 = master.ReadHoldingRegisters(slaveAddress, (ushort)(startAddress+2), len);
var var2 = master.ReadHoldingRegisters(slaveAddress, (ushort)(startAddress + 2), len);
int dest = 0;
dest |= (var2[0] & 0x0000ffff);
dest = (dest << 16) | (var1[0] & 0x0000ffff);
@@ -377,6 +377,7 @@ namespace BPASmartClient.Modbus
master.WriteSingleCoil(slaveAddress, startAddress, boolValue);
else if (value is bool[] boolsValue)
master.WriteMultipleCoils(slaveAddress, startAddress, boolsValue);
else return false;
}
if (address.ToUpper().Contains("GM") && address.Length >= 3)
{
@@ -385,14 +386,16 @@ namespace BPASmartClient.Modbus
master.WriteSingleCoil(slaveAddress, startAddress, boolValue);
else if (value is bool[] boolsValue)
master.WriteMultipleCoils(slaveAddress, startAddress, boolsValue);
else return false;
}
else if(address.ToUpper().Contains("LB"))
else if (address.ToUpper().Contains("LB"))
{
commandType = CommandType.Coils;
if (value is bool boolValue)
master.WriteSingleCoil(slaveAddress, startAddress, boolValue);
else if (value is bool[] boolsValue)
master.WriteMultipleCoils(slaveAddress, startAddress, boolsValue);
else return false;
}
else if (address.ToUpper().Contains("VD"))
{
@@ -405,6 +408,7 @@ namespace BPASmartClient.Modbus
master.WriteSingleRegister(slaveAddress, startAddress, val1);
master.WriteSingleRegister(slaveAddress, (ushort)(startAddress + 1), val2);
}
else return false;

}
else if (address.ToUpper().Contains("VW") || address.ToUpper().Contains("LW") || address.ToUpper().Contains("D"))
@@ -439,6 +443,7 @@ namespace BPASmartClient.Modbus
master.WriteMultipleRegisters(slaveAddress, startAddress, ushortsValue);
}
}
else return false;
}
else if (address.ToUpper().Contains("I"))
{
@@ -497,10 +502,10 @@ namespace BPASmartClient.Modbus
/// </summary>
/// <param name="StartAddress"></param>
/// <param name="value"></param>
public void SetReal(string StartAddress, float value,int Retries = 1)
public bool SetReal(string StartAddress, float value, int Retries = 1)
{
var bytes = BitConverter.GetBytes(value);
Write(StartAddress, bytes.BytesToUshorts(), Retries);
return Write(StartAddress, bytes.BytesToUshorts(), Retries);
}

/// <summary>


Loading…
Cancel
Save