taoye преди 2 години
родител
ревизия
6586f8e129
променени са 31 файла, в които са добавени 2679 реда и са изтрити 349 реда
  1. +15
    -0
      BPASmartClient.CustomResource/Pages/Model/PlcVariableInfoManage.cs
  2. +20
    -0
      BPASmartClient.CustomResource/Pages/Model/PlcVariableInfoModel.cs
  3. +129
    -0
      BPASmartClient.CustomResource/Pages/View/VariableConfigView.xaml
  4. +35
    -0
      BPASmartClient.CustomResource/Pages/View/VariableConfigView.xaml.cs
  5. +35
    -0
      BPASmartClient.CustomResource/Pages/ViewModel/VariableViewModel.cs
  6. +4
    -1
      BPASmartClient.Helper/Sqlite.cs
  7. +28
    -2
      FryPot_DosingSystem/App.xaml.cs
  8. +30
    -0
      FryPot_DosingSystem/Attributes/VariableAttribute.cs
  9. +80
    -50
      FryPot_DosingSystem/Control/DeviceOperate.cs
  10. +505
    -205
      FryPot_DosingSystem/Control/DosingLogicControl.cs
  11. +88
    -37
      FryPot_DosingSystem/Control/GlobalVariable.cs
  12. +76
    -0
      FryPot_DosingSystem/FryPotStatus/PotFiveStatus.cs
  13. +76
    -0
      FryPot_DosingSystem/FryPotStatus/PotFourStatus.cs
  14. +76
    -0
      FryPot_DosingSystem/FryPotStatus/PotOneStatus.cs
  15. +76
    -0
      FryPot_DosingSystem/FryPotStatus/PotThreeStatus.cs
  16. +76
    -0
      FryPot_DosingSystem/FryPotStatus/PotTwoStatus.cs
  17. +77
    -0
      FryPot_DosingSystem/Model/FryPotInfoManage.cs
  18. +29
    -0
      FryPot_DosingSystem/Model/FryPotMonitorManage.cs
  19. +2
    -1
      FryPot_DosingSystem/Model/Global.cs
  20. +34
    -0
      FryPot_DosingSystem/Model/VariableMonitorModel.cs
  21. +4
    -0
      FryPot_DosingSystem/View/DebugView.xaml
  22. +128
    -0
      FryPot_DosingSystem/View/FryPotMonitorView.xaml
  23. +29
    -0
      FryPot_DosingSystem/View/FryPotMonitorView.xaml.cs
  24. +702
    -0
      FryPot_DosingSystem/View/SqliteDataView.xaml
  25. +30
    -0
      FryPot_DosingSystem/View/SqliteDataView.xaml.cs
  26. +30
    -28
      FryPot_DosingSystem/View/UserManageView.xaml
  27. +16
    -1
      FryPot_DosingSystem/ViewModel/DebugViewModel.cs
  28. +73
    -0
      FryPot_DosingSystem/ViewModel/FryPotMonitorViewModel.cs
  29. +176
    -0
      FryPot_DosingSystem/ViewModel/SqliteDataViewModel.cs
  30. +0
    -1
      FryPot_DosingSystem/ViewModel/UserManageViewModel.cs
  31. +0
    -23
      SmartClient.sln

+ 15
- 0
BPASmartClient.CustomResource/Pages/Model/PlcVariableInfoManage.cs Целия файл

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

namespace BPASmartClient.CustomResource.Pages.Model
{
public class PlcVariableInfoManage:ObservableObject
{
public ObservableCollection<PlcVariableInfoModel> VariablesInfo { get; set; } = new ObservableCollection<PlcVariableInfoModel>();
}
}

+ 20
- 0
BPASmartClient.CustomResource/Pages/Model/PlcVariableInfoModel.cs Целия файл

@@ -0,0 +1,20 @@

using Microsoft.Toolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.CustomResource.Pages.Model
{
public class PlcVariableInfoModel : ObservableObject
{
//public int Id { get { return _id; } set { _id = value;OnPropertyChanged(); } }
//private int _id;
public string PlcAddress { get { return plcAddress; } set { plcAddress = value; OnPropertyChanged(); } }
private string plcAddress;
public int? Length { get { return length; } set { length = value; OnPropertyChanged(); } }
private int? length;
}
}

+ 129
- 0
BPASmartClient.CustomResource/Pages/View/VariableConfigView.xaml Целия файл

@@ -0,0 +1,129 @@
<UserControl x:Class="BPASmartClient.CustomResource.Pages.View.VariableConfigView"
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.CustomResource.Pages.View"
xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.DataContext>
<vm:VariableViewModel/>
</UserControl.DataContext>
<UserControl.Resources>
<Style x:Key="dataGrid" TargetType="DataGrid" >
<Setter Property="HorizontalGridLinesBrush" Value="#FF2AB2E7"/>
<Setter Property="VerticalGridLinesBrush" Value="#FF2AB2E7"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderBrush" Value="#FF2AB2E7"/>
<Setter Property="CanUserResizeColumns" Value="False"/>
<Setter Property="HeadersVisibility" Value="Column"/>
<Setter Property="HorizontalScrollBarVisibility" Value="Hidden"/>
<Setter Property="VerticalScrollBarVisibility" Value="Hidden"/>
</Style>
<Style x:Key="ColumHeaderStyle" TargetType="DataGridColumnHeader">
<Setter Property="HorizontalContentAlignment" Value="Center"></Setter>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Background" Value="#FF2AB2E7"></Setter>
<Setter Property="Foreground" Value="White"></Setter>
<Setter Property="BorderThickness" Value="1"></Setter>
<Setter Property="BorderBrush" Value="white"></Setter>
<Setter Property="Height" Value="30"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="FontWeight" Value="Heavy"/>
<Setter Property="Margin" Value="-1,-1,-1,-1"/>
</Style>

<Style x:Key="rowStyle" TargetType="DataGridRow">
<Setter Property="Height" Value="35"/>
<Setter Property="Foreground" Value="#FF2AB2E7"/>
<Style.Triggers>
<Trigger Property="AlternationIndex" Value="0">
<Setter Property="Background" Value="Transparent" />
</Trigger>
<Trigger Property="AlternationIndex" Value="1">
<Setter Property="Background" Value="Transparent" />
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#000066" />
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="textboxStyle" TargetType="TextBox">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="SkyBlue"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="CaretBrush" Value="LightBlue"/>
<Style.Triggers>
<Trigger Property="IsFocused" Value="True">
<Setter Property="Cursor" Value="Arrow"/>
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="cellStyle" TargetType="DataGridCell">
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground"
Value="SkyBlue"/>
</Trigger>
<Trigger Property="IsSelected" Value="false">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground"
Value="SkyBlue"/>
</Trigger>

</Style.Triggers>
</Style>
<Style x:Key="dgCellstyle" TargetType="TextBlock">
<Setter Property="HorizontalAlignment" Value="Center"></Setter>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="FontSize" Value="16"/>
</Style>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="0.12*"/>
<RowDefinition/>
</Grid.RowDefinitions>

<Button HorizontalAlignment="Right" Width="120" Height="40" Margin="0,0,10,0" Background="Transparent" Content="保存配置" Foreground="#FF2AB2E7" FontSize="20" BorderBrush="LightSkyBlue" BorderThickness="2" Command="{Binding SaveDataCommand}" ></Button>
<!--变量配置-->
<DataGrid Grid.Row="1" ItemsSource="{Binding Variables}" GridLinesVisibility="All" Background="Transparent"
AutoGenerateColumns="False" IsReadOnly="False" Style="{StaticResource dataGrid}"
LoadingRow="DataGrid_LoadingRow" ColumnHeaderStyle="{StaticResource ColumHeaderStyle}" RowStyle="{StaticResource rowStyle}" CellStyle="{StaticResource cellStyle}">
<DataGrid.Columns>
<DataGridTemplateColumn IsReadOnly="True" Width="0.1*" Header="ID">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}}, Path=Header}" IsReadOnly="False" Style="{StaticResource textboxStyle}"></TextBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="PLC地址" Binding="{Binding PlcAddress}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="地址长度" Binding="{Binding Length}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding PlcAddress}" Style="{StaticResource textboxStyle}"></TextBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>-->
<!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址长度">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding Length}" Style="{StaticResource textboxStyle}"></TextBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>-->
</DataGrid.Columns>
</DataGrid>
</Grid>
</UserControl>

+ 35
- 0
BPASmartClient.CustomResource/Pages/View/VariableConfigView.xaml.cs Целия файл

@@ -0,0 +1,35 @@
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>
/// VariableConfigView.xaml 的交互逻辑
/// </summary>
public partial class VariableConfigView : UserControl
{
public VariableConfigView()
{
InitializeComponent();
}

private void DataGrid_LoadingRow(object sender, DataGridRowEventArgs e)
{
e.Row.Header = e.Row.GetIndex() + 1;
}

}
}

+ 35
- 0
BPASmartClient.CustomResource/Pages/ViewModel/VariableViewModel.cs Целия файл

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

namespace BPASmartClient.CustomResource.Pages.ViewModel
{
public class VariableViewModel : ObservableObject
{
public ObservableCollection<PlcVariableInfoModel> Variables { get; set; } = new ObservableCollection<PlcVariableInfoModel>();
public RelayCommand SaveDataCommand { get; set; }
public VariableViewModel()
{
Json<PlcVariableInfoManage>.Read();
Variables = Json<PlcVariableInfoManage>.Data.VariablesInfo;
SaveDataCommand = new RelayCommand(() =>
{
Json<PlcVariableInfoManage>.Save();
MessageBox.Show("保存成功","提示",MessageBoxButton.OK,MessageBoxImage.Information);
});
}

}
}

+ 4
- 1
BPASmartClient.Helper/Sqlite.cs Целия файл

@@ -31,7 +31,10 @@ namespace BPASmartClient.Helper
return $"{AppDomain.CurrentDomain.BaseDirectory}AccessFile\\DB\\{typeof(T).Name}.db";
}
}

public bool DataBaseExist()
{
return Database.EnsureCreated();
}

public void Save()
{


+ 28
- 2
FryPot_DosingSystem/App.xaml.cs Целия файл

@@ -12,6 +12,7 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Configuration;
using System.Data;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
@@ -29,7 +30,7 @@ namespace FryPot_DosingSystem
base.OnStartup(e);
MenuInite();
LoginDataInite();
MainView mv = new MainView();
LoginView lv = new LoginView();
var res = lv.ShowDialog();
@@ -58,6 +59,9 @@ namespace FryPot_DosingSystem

}


protected override void OnExit(ExitEventArgs e)
{
base.OnExit(e);
@@ -119,6 +123,13 @@ namespace FryPot_DosingSystem
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.AlarmView"
});
InfoLog.Add(new SubMenumodel()
{
SubMenuName = "炒锅状态记录",
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
AssemblyName = "FryPot_DosingSystem",
ToggleWindowPath = "View.SqliteDataView"
});

MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
@@ -139,6 +150,13 @@ namespace FryPot_DosingSystem
AssemblyName = "FryPot_DosingSystem",
ToggleWindowPath = "View.DeviceListVIew"
});
DeviceMonitor.Add(new SubMenumodel()
{
SubMenuName = "PLC变量配置",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.VariableConfigView"
});

DeviceMonitor.Add(new SubMenumodel()
{
@@ -147,6 +165,14 @@ namespace FryPot_DosingSystem
AssemblyName = "FryPot_DosingSystem",
ToggleWindowPath = "View.HardWareStatusView"

});
DeviceMonitor.Add(new SubMenumodel()
{
SubMenuName = "炒锅状态监控",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员, Permission.观察员 },
AssemblyName = "FryPot_DosingSystem",
ToggleWindowPath = "View.FryPotMonitorView"

});

DeviceMonitor.Add(new SubMenumodel()
@@ -156,7 +182,7 @@ namespace FryPot_DosingSystem
AssemblyName = "FryPot_DosingSystem",
ToggleWindowPath = "View.AgvView"
});
MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "&#xe603;",


+ 30
- 0
FryPot_DosingSystem/Attributes/VariableAttribute.cs Целия файл

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

namespace FryPot_DosingSystem.Attributes
{
internal class VariableAttribute:Attribute
{
public string VarName { get; set; }
public string Notes { get; set; }
public string PLCAddress { get; set; }
public string ModbusTcpAddress { get; set; }
/// <summary>
///
/// </summary>
/// <param name="name">变量名</param>
/// <param name="notes">描述</param>
/// <param name="plcaddress">plc地址</param>
/// <param name="modbustcpaddress">modbustcp地址</param>
public VariableAttribute(string name,string notes,string plcaddress,string modbustcpaddress)
{
VarName = name;
Notes = notes;
PLCAddress = plcaddress;
ModbusTcpAddress = modbustcpaddress;
}
}
}

+ 80
- 50
FryPot_DosingSystem/Control/DeviceOperate.cs Целия файл

@@ -1,4 +1,6 @@
using BPASmartClient.Helper;

using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.Helper;
using BPASmartClient.Message;
using BPASmartClient.Modbus;
using FryPot_DosingSystem.Model;
@@ -16,7 +18,8 @@ namespace FryPot_DosingSystem.Control
internal class DeviceOperate
{
private static DeviceOperate _instance;
public static DeviceOperate GetInstance=>_instance ??= new DeviceOperate();
public static DeviceOperate GetInstance => _instance ??= new DeviceOperate();
public bool IsConfig { get; set; }//设备plc数据是否配置
ModbusTcp modbus = new ModbusTcp();
private string Ip { get; set; }
private string Port { get; set; }
@@ -25,7 +28,7 @@ namespace FryPot_DosingSystem.Control
private string DeviceName { get; set; }

public ConcurrentDictionary<string, object> Data { get; set; } = new ConcurrentDictionary<string, object>();
public ObservableCollection<PlcVariableModel> Variables { get; set; }=new ObservableCollection<PlcVariableModel>();
public ObservableCollection<PlcVariableModel> Variables { get; set; } = new ObservableCollection<PlcVariableModel>();
public DeviceOperate()
{
Init();
@@ -38,67 +41,94 @@ namespace FryPot_DosingSystem.Control
{
Variables.Clear();
}
Variables.Add(new PlcVariableModel() { Address = "D2001", Length = 8 });//1号线体滚筒工位号
Variables.Add(new PlcVariableModel() { Address = "D2011", Length = 8 });//2号线体滚筒工位号
Variables.Add(new PlcVariableModel() { Address = "D2021", Length = 8 });//3号线体滚筒工位号
Variables.Add(new PlcVariableModel() { Address = "D2031", Length = 9 });//输送线出料状态
Variables.Add(new PlcVariableModel() { Address = "D2040", Length = 5 });//炒锅1-5进料滚筒运行
Variables.Add(new PlcVariableModel() { Address = "D2045", Length = 5 });//炒锅1-5进料到位信号
Variables.Add(new PlcVariableModel() { Address = "D2050", Length = 5 });//炒锅1-5空桶到位信号
Variables.Add(new PlcVariableModel() { Address = "D2055", Length = 5 });//炒锅1-5空桶呼叫AGV
Variables.Add(new PlcVariableModel() { Address = "D2060", Length = 5 });//炒锅1空桶洗桶呼叫AGV
Variables.Add(new PlcVariableModel() { Address = "D2065", Length = 5 });//炒锅1-5空桶滚筒运行
Variables.Add(new PlcVariableModel() { Address = "D2070", Length = 5 });//炒锅1-5滚筒故障信号
Variables.Add(new PlcVariableModel() { Address = "D2075", Length = 1 });//洗桶进桶滚筒运行信号
Variables.Add(new PlcVariableModel() { Address = "D2076", Length = 1 });//洗桶出桶呼叫AGV
Variables.Add(new PlcVariableModel() { Address = "D2077", Length = 1 });// 洗桶出桶滚筒运行信号
Variables.Add(new PlcVariableModel() { Address = "D2078", Length = 3 });//1-3滚筒线体配方完成信号
}
public void Connect()
{
Json<DeviceManage>.Read();
DeviceManage devices = Json<DeviceManage>.Data;
if (devices != null)
Json<PlcVariableInfoManage>.Read();
if (Json<PlcVariableInfoManage>.Data.VariablesInfo.Count > 0)
{
if (devices.Devices.Count > 0)
try
{
Ip = devices.Devices[0].Ip;
Port = devices.Devices[0].Port;
DeviceName = devices.Devices[0].DeviceName;
Task.Run(() => { modbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); });
foreach (var item in Json<PlcVariableInfoManage>.Data.VariablesInfo)
{
Variables.Add(new PlcVariableModel { Address = item.PlcAddress, Length = (ushort)(item.Length == null ? 0 : item.Length) });
}
IsConfig = true;
}
catch (Exception)
{
IsConfig = false;
//throw;
}
}
else
{
IsConfig= false;
}
//Variables.Add(new PlcVariableModel() { Address = "D2001", Length = 8 });//1号线体滚筒工位号
//Variables.Add(new PlcVariableModel() { Address = "D2011", Length = 8 });//2号线体滚筒工位号
//Variables.Add(new PlcVariableModel() { Address = "D2021", Length = 8 });//3号线体滚筒工位号
//Variables.Add(new PlcVariableModel() { Address = "D2031", Length = 9 });//输送线出料状态
//Variables.Add(new PlcVariableModel() { Address = "D2040", Length = 5 });//炒锅1-5进料滚筒运行
//Variables.Add(new PlcVariableModel() { Address = "D2045", Length = 5 });//炒锅1-5进料到位信号
//Variables.Add(new PlcVariableModel() { Address = "D2050", Length = 5 });//炒锅1-5空桶到位信号
//Variables.Add(new PlcVariableModel() { Address = "D2055", Length = 5 });//炒锅1-5空桶呼叫AGV
//Variables.Add(new PlcVariableModel() { Address = "D2060", Length = 5 });//炒锅1空桶洗桶呼叫AGV
//Variables.Add(new PlcVariableModel() { Address = "D2065", Length = 5 });//炒锅1-5空桶滚筒运行
//Variables.Add(new PlcVariableModel() { Address = "D2070", Length = 5 });//炒锅1-5滚筒故障信号
//Variables.Add(new PlcVariableModel() { Address = "D2075", Length = 1 });//洗桶进桶滚筒运行信号
//Variables.Add(new PlcVariableModel() { Address = "D2076", Length = 1 });//洗桶出桶呼叫AGV
//Variables.Add(new PlcVariableModel() { Address = "D2077", Length = 1 });// 洗桶出桶滚筒运行信号
//Variables.Add(new PlcVariableModel() { Address = "D2078", Length = 3 });//1-3滚筒线体配方完成信号
}
public void ReadData()
public void Connect()
{
ThreadManage.GetInstance().StartLong(new Action(() =>
if (IsConfig)
{
Connected = modbus.Connected;
while (Connected)
Json<DeviceManage>.Read();
DeviceManage devices = Json<DeviceManage>.Data;
if (devices != null)
{
foreach (var item in Variables)
if (devices.Devices.Count > 0)
{
var res = modbus.Read(item.Address, item.Length);
if (Data.ContainsKey(item.Address))
{
Data[item.Address] = res;
}
else
{
Data.TryAdd(item.Address, res);
}
Ip = devices.Devices[0].Ip;
Port = devices.Devices[0].Port;
DeviceName = devices.Devices[0].DeviceName;
Task.Run(() => { modbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); });
}
Thread.Sleep(500);
}
Thread.Sleep(1000);
}),$"设备【{DeviceName}】PLC实时数据读取线程");
}
}
}
public void ReadData()
{
if (IsConfig)
{
ThreadManage.GetInstance().StartLong(new Action(() =>
{
Connected = modbus.Connected;
while (Connected)
{
foreach (var item in Variables)
{
var res = modbus.Read(item.Address, item.Length);//读取plc数据
if (Data.ContainsKey(item.Address))
{
Data[item.Address] = res;
}
else
{
Data.TryAdd(item.Address, res);
}
}
Thread.Sleep(500);

}
Thread.Sleep(1000);
}), $"设备【{DeviceName}】PLC实时数据读取线程");
}
}
public void WritePlcData(string address,ushort value)
public void WritePlcData(string address, ushort value)
{
lock (this)
{
modbus.Write(address, value);
modbus.Write(address, value);
}
}
public ConcurrentDictionary<string, object> GetAllData()


+ 505
- 205
FryPot_DosingSystem/Control/DosingLogicControl.cs Целия файл

@@ -18,6 +18,7 @@ using System.Threading.Tasks;
using System.Windows.Media;
using System.Windows;
using FryPot_DosingSystem.AGV;
using FryPot_DosingSystem.FryPotStatus;

namespace FryPot_DosingSystem.Control
{
@@ -70,6 +71,26 @@ namespace FryPot_DosingSystem.Control
/// 线体状态对象声明
/// </summary>
HardWareStatusViewModel hardWareStatusModel;
///// <summary>
///// 炒锅1状态
///// </summary>
//PotOneStatus fryOne;
///// <summary>
///// 炒锅2状态
///// </summary>
//PotTwoStatus fryTwo;
///// <summary>
///// 炒锅3状态
///// </summary>
//PotThreeStatus fryThree;
///// <summary>
///// 炒锅4状态
///// </summary>
//PotFourStatus fryFour;
///// <summary>
///// 炒锅5状态
///// </summary>
//PotFiveStatus fryFive;
/// <summary>
/// 报警信息对象声明
/// </summary>
@@ -218,12 +239,23 @@ namespace FryPot_DosingSystem.Control
public DosingLogicControl()
{
globalVar = new GlobalVariable();
//fryOne = new PotOneStatus();
//fryTwo = new PotTwoStatus();
//fryThree = new PotThreeStatus();
//fryFour = new PotFourStatus();
//fryFive = new PotFiveStatus();
hardWareStatusModel = HardWareStatusViewModel.GetInstance;
DateTimeJudge();
ActionManage.GetInstance.Register(new Action<object[]>(RecipeDataParse), "RecipeSetDown");
ActionManage.GetInstance.Register(new Action(() => { RecipeQuene.Clear(); InputMaterialQuene.Clear(); OutputMaterialQuene.Clear(); LTwoInputMaterialQuene.Clear(); LTwoOutputMaterialQuene.Clear(); LThreeInputMaterialQuene.Clear(); LThreeOutputMaterialQuene.Clear(); }), "ClearRecipes");
//ActionManage.GetInstance.Register(new Action(() => { RecipeQuene.Clear(); InputMaterialQuene.Clear(); OutputMaterialQuene.Clear(); LTwoInputMaterialQuene.Clear(); LTwoOutputMaterialQuene.Clear(); LThreeInputMaterialQuene.Clear(); LThreeOutputMaterialQuene.Clear(); }), "ClearRecipes");
ActionManage.GetInstance.Register(new Action(() => { RecipeQuene.Clear(); InputMaterialQuene.Clear(); OutputMaterialQuene.Clear(); }), "ClearOneRecipes");
ActionManage.GetInstance.Register(new Action(() => { LTwoRecipeQuene.Clear(); LTwoInputMaterialQuene.Clear(); LTwoOutputMaterialQuene.Clear(); }), "ClearTwoRecipes");
ActionManage.GetInstance.Register(new Action(() => { LThreeRecipeQuene.Clear(); LThreeInputMaterialQuene.Clear(); LThreeOutputMaterialQuene.Clear(); }), "ClearThreeRecipes");
ActionManage.GetInstance.Register(new Action(() => { globalVar.PlcInite = 1; }), "StartPlcInite");
ActionManage.GetInstance.Register(new Action(() => { globalVar.PlcInite = 0; }), "EndPlcInite");
ActionManage.GetInstance.Register(new Action(() => { globalVar.ExitMainTask = true; }), "FryPotDosingMainTaskExit");
ActionManage.GetInstance.Register(new Action(() => { globalVar.ExitLineOneTask = true; LineOneTaskRestart(); }), "LineOneTaskExit");
ActionManage.GetInstance.Register(new Action(() => { globalVar.ExitLineTwoTask = true; LineTwoTaskRestart(); }), "LineTwoTaskExit");
ActionManage.GetInstance.Register(new Action(() => { globalVar.ExitLineThreeTask = true; LineThreeTaskRestart(); }), "LineThreeTaskExit");
HubHelper.GetInstance.Report = new Action<object>(AgvTaskUpReportDataAnalysis);
HubHelper.GetInstance.Upstreamrequest = new Action<object>(AgvFeedBackUpReportDataAnalysis);
// ResetProgram();
@@ -231,6 +263,58 @@ namespace FryPot_DosingSystem.Control
MainTask();
CommandRegist();
}
/// <summary>
/// 时间判断,数据处理
/// </summary>
private void DateTimeJudge()
{
if (Sqlite<PotOneStatus>.GetInstance.GetData().Count > 0)
{
string time1 = Sqlite<PotOneStatus>.GetInstance.GetData().Last().Time;
if (time1.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
{
FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy = Sqlite<PotOneStatus>.GetInstance.GetData().Last().TotalOilCapactiy;
FryPotMonitorManage.GetInstance.fryOne.TotalProduct = Sqlite<PotOneStatus>.GetInstance.GetData().Last().TotalProduct;
}
}
if (Sqlite<PotTwoStatus>.GetInstance.GetData().Count > 0)
{
string time2 = Sqlite<PotTwoStatus>.GetInstance.GetData().Last().Time;
if (time2.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
{
FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy = Sqlite<PotTwoStatus>.GetInstance.GetData().Last().TotalOilCapactiy;
FryPotMonitorManage.GetInstance.fryTwo.TotalProduct = Sqlite<PotTwoStatus>.GetInstance.GetData().Last().TotalProduct;
}
}
if (Sqlite<PotThreeStatus>.GetInstance.GetData().Count > 0)
{
string time3 = Sqlite<PotThreeStatus>.GetInstance.GetData().Last().Time;
if (time3.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
{
FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy = Sqlite<PotThreeStatus>.GetInstance.GetData().Last().TotalOilCapactiy;
FryPotMonitorManage.GetInstance.fryThree.TotalProduct = Sqlite<PotThreeStatus>.GetInstance.GetData().Last().TotalProduct;
}
}
if (Sqlite<PotFourStatus>.GetInstance.GetData().Count > 0)
{
string time4 = Sqlite<PotFourStatus>.GetInstance.GetData().Last().Time;
if (time4.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
{
FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy = Sqlite<PotFourStatus>.GetInstance.GetData().Last().TotalOilCapactiy;
FryPotMonitorManage.GetInstance.fryFour.TotalProduct = Sqlite<PotFourStatus>.GetInstance.GetData().Last().TotalProduct;
}
}

if (Sqlite<PotFiveStatus>.GetInstance.GetData().Count > 0)
{
string time5 = Sqlite<PotFiveStatus>.GetInstance.GetData().Last().Time;
if (time5.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
{
FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy = Sqlite<PotFiveStatus>.GetInstance.GetData().Last().TotalOilCapactiy;
FryPotMonitorManage.GetInstance.fryFive.TotalProduct = Sqlite<PotFiveStatus>.GetInstance.GetData().Last().TotalProduct;
}
}
}

/// <summary>
/// AGV上下料上报数据解析
@@ -518,9 +602,9 @@ namespace FryPot_DosingSystem.Control

ThreadManage.GetInstance().StopTask("MainViewReadPlcData", new Action(() =>
{
ActionManage.GetInstance.CancelRegister("RecipeSetDown");
ActionManage.GetInstance.Register(new Action<object>(RecipeDataParse), "RecipeSetDown");
ActionManage.GetInstance.Send("ClearRecipes");
//ActionManage.GetInstance.CancelRegister("RecipeSetDown");
//ActionManage.GetInstance.Register(new Action<object>(RecipeDataParse), "RecipeSetDown");
// ActionManage.GetInstance.Send("ClearRecipes");
ThreadManage.GetInstance().StopTask("滚筒线1任务线程", new Action(() =>
{
ThreadManage.GetInstance().StopTask("滚筒线2任务线程", new Action(() =>
@@ -533,7 +617,6 @@ namespace FryPot_DosingSystem.Control
ReadPlcData();
MainTask();
MessageLog.GetInstance.ShowUserLog("主任务重启完成");

}));
}));

@@ -544,6 +627,98 @@ namespace FryPot_DosingSystem.Control
Thread.Sleep(10);
}), "ResetProgram");
}

public void LineOneTaskRestart()
{
ThreadManage.GetInstance().StopTask("滚筒线1任务线程", new Action(() =>
{
ActionManage.GetInstance.Send("ClearOneRecipes");
globalVar.rollerLineOne = null;
globalVar.rollerLineOne = new RollerLineOne();
globalVar.fryPotOne = null;
globalVar.fryPotOne = new FryPotOne();
globalVar.fryPotFour = null;
globalVar.fryPotFour = new FryPotFour();
globalVar.ExitLineOneTask = false;
globalVar.AllowAgvToLineLoadRoller = true;
globalVar.InOrOutputLock = false;
globalVar.LOneCurrentRecipeName = string.Empty;
globalVar.LoadRoller = false;
globalVar.AgvToFryPot = false;
globalVar.PotOneInputMaterialArrive = false;
globalVar.PotOneOutputRollerArrive = false;
globalVar.AgvArrivePot = false;
globalVar.LOneMaterialNum = 0;
globalVar.LOneFryPotSerial = 1;
globalVar.LOneCurrentCookingStep = 0;
globalVar.agvArriveUpLoad = false;
globalVar.agvArriveUnLoad = false;
globalVar.agvFryPotEmptyRollerArrive = false;
globalVar.EmptyRollerUnLoadcCom = false;
ThreadManage.GetInstance().StartLong(new Action(() => { LineOneProcessExecute(); Thread.Sleep(10); }), "滚筒线1任务线程");
MessageLog.GetInstance.ShowUserLog("滚筒线【1】任务重启成功");
}));
}
public void LineTwoTaskRestart()
{
ThreadManage.GetInstance().StopTask("滚筒线2任务线程", new Action(() =>
{
ActionManage.GetInstance.Send("ClearTwoRecipes");
globalVar.rollerLineTwo = null;
globalVar.rollerLineTwo = new RollerLineTwo();
globalVar.fryPotTwo = null;
globalVar.fryPotTwo = new FryPotTwo();
globalVar.fryPotFive = null;
globalVar.fryPotFive = new FryPotFive();
globalVar.ExitLineTwoTask = false;
globalVar.AllowAgvToLineTwoLoadRoller = true;
globalVar.LTwoInOrOutputLock = false;
globalVar.LTwoCurrentRecipeName = string.Empty;
globalVar.LTwoLoadRoller = false;
globalVar.LTwoAgvToFryPot = false;
globalVar.LTwoPotInputMaterialArrive = false;
globalVar.LTwoPotOutputRollerArrive = false;
globalVar.LTwoAgvArrivePot = false;
globalVar.LTwoMaterialNum = 0;
globalVar.LTwoFryPotSerial = 2;
globalVar.LTwoCurrentCookingStep = 0;
globalVar.agvArriveLTwoUpLoad = false;
globalVar.LTwoagvArriveUnLoad = false;
globalVar.LTwoagvFryPotEmptyRollerArrive = false;
globalVar.LTwoEmptyRollerUnLoadcCom = false;
ThreadManage.GetInstance().StartLong(new Action(() => { LineTwoProcessExecute(); Thread.Sleep(10); }), "滚筒线2任务线程");
MessageLog.GetInstance.ShowUserLog("滚筒线【2】任务重启成功");
}));
}
public void LineThreeTaskRestart()
{
ThreadManage.GetInstance().StopTask("滚筒线3任务线程", new Action(() =>
{
ActionManage.GetInstance.Send("ClearThreeRecipes");
globalVar.rollerLineThree = null;
globalVar.rollerLineThree = new RollerLineThree();
globalVar.fryPotThree = null;
globalVar.fryPotThree = new FryPotThree();
globalVar.ExitLineThreeTask = false;
globalVar.AllowAgvToLineThreeLoadRoller = true;
globalVar.LThreeInOrOutputLock = false;
globalVar.LThreeCurrentRecipeName = string.Empty;
globalVar.LThreeLoadRoller = false;
globalVar.LThreeAgvToFryPot = false;
globalVar.LThreePotInputMaterialArrive = false;
globalVar.LThreePotOutputRollerArrive = false;
globalVar.LThreeAgvArrivePot = false;
globalVar.LThreeMaterialNum = 0;
globalVar.LThreeFryPotSerial = 3;
globalVar.LThreeCurrentCookingStep = 0;
globalVar.agvArriveLThreeUpLoad = false;
globalVar.LThreeagvArriveUnLoad = false;
globalVar.LThreeagvFryPotEmptyRollerArrive = false;
globalVar.LThreeEmptyRollerUnLoadcCom = false;
ThreadManage.GetInstance().StartLong(new Action(() => { LineThreeProcessExecute(); Thread.Sleep(10); }), "滚筒线3任务线程");
MessageLog.GetInstance.ShowUserLog("滚筒线【3】任务重启成功");
}));
}
/// <summary>
/// 实时获取plc数据
/// </summary>
@@ -658,16 +833,86 @@ namespace FryPot_DosingSystem.Control

globalVar.CleadBarrelExitSingle = data[0];
}));
//globalVar.rollerLineOne.OutMaterialingSingle = 0;
//globalVar.rollerLineOne.StationOne = 401;
//globalVar.rollerLineOne.StationTwo = 402;
//globalVar.rollerLineOne.OutMaterialingTroubleSingle = 1;
// AlarmHelper<AlarmInfo>.Alarm.LOneRollerTrouble =1;
if (globalVar.fryPotOne.OilConfirm == 1)
{
FryPotMonitorManage.GetInstance.fryOne.OilCapacity = globalVar.fryPotOne.OilCapacity;
FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy += globalVar.fryPotOne.OilCapacity;
}
if (globalVar.fryPotTwo.OilConfirm == 1)
{
FryPotMonitorManage.GetInstance.fryTwo.OilCapacity = globalVar.fryPotTwo.OilCapacity;
FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy += globalVar.fryPotTwo.OilCapacity;
}
if (globalVar.fryPotThree.OilConfirm == 1)
{
FryPotMonitorManage.GetInstance.fryThree.OilCapacity = globalVar.fryPotThree.OilCapacity;
FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy += globalVar.fryPotThree.OilCapacity;
}
if (globalVar.fryPotFour.OilConfirm == 1)
{
FryPotMonitorManage.GetInstance.fryFour.OilCapacity = globalVar.fryPotFour.OilCapacity;
FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy += globalVar.fryPotFour.OilCapacity;
}
if (globalVar.fryPotFive.OilConfirm == 1)
{
FryPotMonitorManage.GetInstance.fryFive.OilCapacity = globalVar.fryPotFive.OilCapacity;
FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy += globalVar.fryPotFive.OilCapacity;
}
//炒锅状态实时显示
FryPotStatusDisplay();

RollerLineStatusDisplay();

Thread.Sleep(10);
}), "MainViewReadPlcData");

}

private void FryPotStatusDisplay()
{
FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneTemp").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.Temperature.ToString();
FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOnePower").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.HotPower.ToString();
FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneSpeed").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.Speed.ToString();
FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneWeight").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.FryPotWeight.ToString();
FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneOil").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.OilCapacity.ToString();
FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneTotalOil").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy.ToString();
FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneTotalProduct").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.TotalProduct.ToString();

FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoTemp").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.Temperature.ToString();
FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoPower").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.HotPower.ToString();
FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoSpeed").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.Speed.ToString();
FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoWeight").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.FryPotWeight.ToString();
FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoOil").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.OilCapacity.ToString();
FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoTotalOil").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy.ToString();
FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoTotalProduct").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.TotalProduct.ToString();

FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeTemp").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.Temperature.ToString();
FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreePower").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.HotPower.ToString();
FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeSpeed").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.Speed.ToString();
FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeWeight").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.FryPotWeight.ToString();
FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeOil").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.OilCapacity.ToString();
FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeTotalOil").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy.ToString();
FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeTotalProduct").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.TotalProduct.ToString();

FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourTemp").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.Temperature.ToString();
FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourPower").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.HotPower.ToString();
FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourSpeed").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.Speed.ToString();
FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourWeight").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.FryPotWeight.ToString();
FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourOil").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.OilCapacity.ToString();
FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourTotalOil").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy.ToString();
FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourTotalProduct").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.TotalProduct.ToString();

FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveTemp").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.Temperature.ToString();
FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFivePower").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.HotPower.ToString();
FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveSpeed").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.Speed.ToString();
FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveWeight").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.FryPotWeight.ToString();
FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveOil").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.OilCapacity.ToString();
FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveTotalOil").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy.ToString();
FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveTotalProduct").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.TotalProduct.ToString();

}

/// <summary>
/// 滚筒线运行状态显示
/// </summary>
@@ -853,12 +1098,12 @@ namespace FryPot_DosingSystem.Control
//if (!globalVar.LOneTaskLock)
//{
// globalVar.LOneTaskLock = true;
LOneRecipeDataToPlc();
LOneLoadRoller();
LOneFryPotInputMaterial();
LOneFallMaterial();
LOneFryPotOutputMaterial();
LOneEmptyOperate();
LOneRecipeDataToPlc();
LOneLoadRoller();
LOneFryPotInputMaterial();
LOneFallMaterial();
LOneFryPotOutputMaterial();
LOneEmptyOperate();
// globalVar.LOneTaskLock = false;
//}

@@ -871,12 +1116,12 @@ namespace FryPot_DosingSystem.Control
//if (!globalVar.LTwoTaskLock)
//{
// globalVar.LTwoTaskLock = true;
LTwoRecipeDataToPlc();
LTwoAgvLoadRoller();
LTwoFryPotInputMaterial();
LTwoFallMaterial();
LTwoFryPotOutputMaterial();
LTwoEmptyOperate();
LTwoRecipeDataToPlc();
LTwoAgvLoadRoller();
LTwoFryPotInputMaterial();
LTwoFallMaterial();
LTwoFryPotOutputMaterial();
LTwoEmptyOperate();
// globalVar.LTwoTaskLock = false;

//}
@@ -889,12 +1134,12 @@ namespace FryPot_DosingSystem.Control
//if (!globalVar.LThreeTaskLock)
//{
// globalVar.LThreeTaskLock = true;
LThreeRecipeDataToPlc();
LThreeAgvLoadRoller();
LThreeFryPotInputMaterial();
LThreeFallMaterial();
LThreeFryPotOutputMaterial();
LThreeEmptyOperate();
LThreeRecipeDataToPlc();
LThreeAgvLoadRoller();
LThreeFryPotInputMaterial();
LThreeFallMaterial();
LThreeFryPotOutputMaterial();
LThreeEmptyOperate();
// globalVar.LThreeTaskLock = false;

//}
@@ -912,6 +1157,12 @@ namespace FryPot_DosingSystem.Control
{
MessageLog.GetInstance.ShowUserLog($"【3】号滚筒线【{globalVar.LThreeCurrentRecipeName}】 配方制作完成");
globalVar.LThreeCurrentRecipeName = string.Empty;
if (globalVar.LThreeFryPotSerial == 3)
{
FryPotMonitorManage.GetInstance.fryThree.TotalProduct++;
Sqlite<PotThreeStatus>.GetInstance.Base.Add(new PotThreeStatus { Temperature = FryPotMonitorManage.GetInstance.fryThree.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryThree.HotPower, Speed = FryPotMonitorManage.GetInstance.fryThree.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryThree.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryThree.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryThree.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
Sqlite<PotThreeStatus>.GetInstance.Save();//保存数据
}
}
}
if (LThreeRecipeQuene.Count > 0 && LThreeOutputMaterialQuene.Count == 0 && LThreeInputMaterialQuene.Count == 0)//后续添加其它限制条件
@@ -919,8 +1170,8 @@ namespace FryPot_DosingSystem.Control
Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.goodsName = string.Empty; }));
Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.workflows = new ObservableCollection<WorkflowModel>(); }));
AgvViewModel.GetInstance().Set启动或停止炒锅(3, IsRun.Stop);
if (globalVar.LThreeCurrentRecipeName != string.Empty)
MessageLog.GetInstance.ShowUserLog($"【3】号滚筒线【{globalVar.LThreeCurrentRecipeName}】 配方制作完成");
//if (globalVar.LThreeCurrentRecipeName != string.Empty)
// MessageLog.GetInstance.ShowUserLog($"【3】号滚筒线【{globalVar.LThreeCurrentRecipeName}】 配方制作完成");
if (LThreeRecipeQuene.TryDequeue(out NewRecipeModel result))
{
LThreeErrorRecipe = false;
@@ -971,6 +1222,18 @@ namespace FryPot_DosingSystem.Control
{
MessageLog.GetInstance.ShowUserLog($"【2】号滚筒线【{globalVar.LTwoCurrentRecipeName}】 配方制作完成");
globalVar.LTwoCurrentRecipeName = string.Empty;
if (globalVar.LTwoFryPotSerial == 2)
{
FryPotMonitorManage.GetInstance.fryTwo.TotalProduct++;
Sqlite<PotTwoStatus>.GetInstance.Base.Add(new PotTwoStatus { Temperature = FryPotMonitorManage.GetInstance.fryTwo.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryTwo.HotPower, Speed = FryPotMonitorManage.GetInstance.fryTwo.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryTwo.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryTwo.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryTwo.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
Sqlite<PotTwoStatus>.GetInstance.Save();//保存数据
}
if (globalVar.LTwoFryPotSerial == 5)
{
FryPotMonitorManage.GetInstance.fryFive.TotalProduct++;
Sqlite<PotFiveStatus>.GetInstance.Base.Add(new PotFiveStatus { Temperature = FryPotMonitorManage.GetInstance.fryFive.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFive.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFive.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFive.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFive.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFive.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
Sqlite<PotFiveStatus>.GetInstance.Save();//保存数据
}
}
}

@@ -988,8 +1251,8 @@ namespace FryPot_DosingSystem.Control
Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.workflows = new ObservableCollection<WorkflowModel>(); }));
AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LTwoFryPotSerial, IsRun.Stop);
}
if (globalVar.LTwoCurrentRecipeName != string.Empty)
MessageLog.GetInstance.ShowUserLog($"【2】号滚筒线【{globalVar.LTwoCurrentRecipeName}】 配方制作完成");
//if (globalVar.LTwoCurrentRecipeName != string.Empty)
// MessageLog.GetInstance.ShowUserLog($"【2】号滚筒线【{globalVar.LTwoCurrentRecipeName}】 配方制作完成");
if (LTwoRecipeQuene.TryDequeue(out NewRecipeModel result))
{
LTwoErrorRecipe = false;
@@ -1047,6 +1310,18 @@ namespace FryPot_DosingSystem.Control
{
MessageLog.GetInstance.ShowUserLog($"【1】号滚筒线【{globalVar.LOneCurrentRecipeName}】 配方制作完成");
globalVar.LOneCurrentRecipeName = string.Empty;
if (globalVar.LOneFryPotSerial == 1)
{
FryPotMonitorManage.GetInstance.fryOne.TotalProduct++;
Sqlite<PotOneStatus>.GetInstance.Base.Add(new PotOneStatus { Temperature = FryPotMonitorManage.GetInstance.fryOne.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryOne.HotPower, Speed = FryPotMonitorManage.GetInstance.fryOne.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryOne.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryOne.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryOne.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
Sqlite<PotOneStatus>.GetInstance.Save();//保存数据
}
if (globalVar.LOneFryPotSerial == 4)
{
FryPotMonitorManage.GetInstance.fryFour.TotalProduct++;
Sqlite<PotFourStatus>.GetInstance.Base.Add(new PotFourStatus { Temperature = FryPotMonitorManage.GetInstance.fryFour.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFour.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFour.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFour.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFour.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFour.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
Sqlite<PotFourStatus>.GetInstance.Save();//保存数据
}

}
}
@@ -1278,6 +1553,16 @@ namespace FryPot_DosingSystem.Control
{
if (!globalVar.InOrOutputLock && (globalVar.fryPotOne.InputMaterialArrivedSingle == 1 || globalVar.fryPotFour.InputMaterialArrivedSingle == 1) && globalVar.PotOneInputMaterialArrive && OutputMaterialQuene.Count > 0 && !globalVar.PotOneOutputRollerArrive)
{
if (globalVar.LOneFryPotSerial == 1)
{
Sqlite<PotOneStatus>.GetInstance.Base.Add(new PotOneStatus {Temperature= FryPotMonitorManage.GetInstance.fryOne.Temperature,HotPower= FryPotMonitorManage.GetInstance.fryOne.HotPower,Speed=FryPotMonitorManage.GetInstance.fryOne.Speed,FryPotWeight=FryPotMonitorManage.GetInstance.fryOne.FryPotWeight,OilCapacity=FryPotMonitorManage.GetInstance.fryOne.OilCapacity,TotalOilCapactiy=FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy,TotalProduct=FryPotMonitorManage.GetInstance.fryOne.TotalProduct,Time=DateTime.Now.ToShortDateString() });//向表中新增数据
Sqlite<PotOneStatus>.GetInstance.Save();//保存数据
}
else
{
Sqlite<PotFourStatus>.GetInstance.Base.Add(new PotFourStatus { Temperature = FryPotMonitorManage.GetInstance.fryFour.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFour.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFour.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFour.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFour.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFour.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
Sqlite<PotFourStatus>.GetInstance.Save();//保存数据
}
FryPotOneRollerTroubleCheck();
if (FryPotAlarm == 1 || FryPotFourAlarm == 1)//炒锅滚筒无故障
{
@@ -1289,6 +1574,7 @@ namespace FryPot_DosingSystem.Control
}
else
{

Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_4.workflows.Add(new WorkflowModel { id = globalVar.LOneCurrentCookingStep, Name = OutputMaterialQuene.ElementAt(0).materialType.MaterialName, isBool = IsBool.Yes }); }));
}
AgvViewModel.GetInstance().Set小车是否承载物品(1, IsBool.No);
@@ -1326,6 +1612,16 @@ namespace FryPot_DosingSystem.Control
{
if (!globalVar.LTwoInOrOutputLock && (globalVar.fryPotTwo.InputMaterialArrivedSingle == 1 || globalVar.fryPotFive.InputMaterialArrivedSingle == 1) && globalVar.LTwoPotInputMaterialArrive && LTwoOutputMaterialQuene.Count > 0 && !globalVar.LTwoPotOutputRollerArrive)
{
if (globalVar.LTwoFryPotSerial == 2)
{
Sqlite<PotTwoStatus>.GetInstance.Base.Add(new PotTwoStatus { Temperature = FryPotMonitorManage.GetInstance.fryTwo.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryTwo.HotPower, Speed = FryPotMonitorManage.GetInstance.fryTwo.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryTwo.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryTwo.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryTwo.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
Sqlite<PotTwoStatus>.GetInstance.Save();//保存数据
}
else
{
Sqlite<PotFiveStatus>.GetInstance.Base.Add(new PotFiveStatus { Temperature = FryPotMonitorManage.GetInstance.fryFive.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFive.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFive.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFive.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFive.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFive.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
Sqlite<PotFiveStatus>.GetInstance.Save();//保存数据
}
FryPotTwoRollerTroubleCheck();
if (FryPotTwoAlarm == 1 || FryPotFiveAlarm == 1)//炒锅滚筒无故障
{
@@ -1337,6 +1633,7 @@ namespace FryPot_DosingSystem.Control
}
else
{

Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.workflows.Add(new WorkflowModel { id = globalVar.LTwoCurrentCookingStep, Name = LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialName, isBool = IsBool.Yes }); }));
}
AgvViewModel.GetInstance().Set小车是否承载物品(2, IsBool.No);
@@ -1368,9 +1665,12 @@ namespace FryPot_DosingSystem.Control
{
if (!globalVar.LThreeInOrOutputLock && globalVar.fryPotThree.InputMaterialArrivedSingle == 1 && globalVar.LThreePotInputMaterialArrive && LThreeOutputMaterialQuene.Count > 0 && !globalVar.LThreePotOutputRollerArrive)
{
Sqlite<PotThreeStatus>.GetInstance.Base.Add(new PotThreeStatus { Temperature = FryPotMonitorManage.GetInstance.fryThree.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryThree.HotPower, Speed = FryPotMonitorManage.GetInstance.fryThree.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryThree.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryThree.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryThree.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
Sqlite<PotThreeStatus>.GetInstance.Save();//保存数据
FryPotThreeRollerTroubleCheck();
if (FryPotThreeAlarm == 1)//炒锅滚筒无故障
{

Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.workflows.Add(new WorkflowModel { id = globalVar.LThreeCurrentCookingStep, Name = LThreeOutputMaterialQuene.ElementAt(0).materialType.MaterialName, isBool = IsBool.Yes }); }));
AgvViewModel.GetInstance().Set小车是否承载物品(3, IsBool.No);
//炒锅滚筒进料运行到位处理
@@ -1631,48 +1931,48 @@ namespace FryPot_DosingSystem.Control
/// <summary>
/// 炒锅滚筒进料运行到位处理
/// </summary>
public void FryPotInputMaterialRollerOperate(ConcurrentQueue<MaterialInfo> queue)
{
switch (queue.ElementAt(0).materialType.MaterialLoc / 100)
{
case 1:
while (globalVar.fryPotOne.InputMaterialArrivedSingle == 0)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
}
MessageLog.GetInstance.ShowRunLog($"炒锅【1】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
case 2:
while (globalVar.fryPotTwo.InputMaterialArrivedSingle == 0)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
}
MessageLog.GetInstance.ShowRunLog($"炒锅【2】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
case 3:
while (globalVar.fryPotThree.InputMaterialArrivedSingle == 0)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
}
MessageLog.GetInstance.ShowRunLog($"炒锅【3】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
case 4:
while (globalVar.fryPotFour.InputMaterialArrivedSingle == 0)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
}
MessageLog.GetInstance.ShowRunLog($"炒锅【4】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
case 5:
while (globalVar.fryPotFive.InputMaterialArrivedSingle == 0)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
}
MessageLog.GetInstance.ShowRunLog($"炒锅【5】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
}
//public void FryPotInputMaterialRollerOperate(ConcurrentQueue<MaterialInfo> queue)
//{
// switch (queue.ElementAt(0).materialType.MaterialLoc / 100)
// {
// case 1:
// while (globalVar.fryPotOne.InputMaterialArrivedSingle == 0)
// {
// Thread.Sleep(5); if (globalVar.ExitMainTask)
// return;
// }
// MessageLog.GetInstance.ShowRunLog($"炒锅【1】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
// case 2:
// while (globalVar.fryPotTwo.InputMaterialArrivedSingle == 0)
// {
// Thread.Sleep(5); if (globalVar.ExitMainTask)
// return;
// }
// MessageLog.GetInstance.ShowRunLog($"炒锅【2】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
// case 3:
// while (globalVar.fryPotThree.InputMaterialArrivedSingle == 0)
// {
// Thread.Sleep(5); if (globalVar.ExitMainTask)
// return;
// }
// MessageLog.GetInstance.ShowRunLog($"炒锅【3】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
// case 4:
// while (globalVar.fryPotFour.InputMaterialArrivedSingle == 0)
// {
// Thread.Sleep(5); if (globalVar.ExitMainTask)
// return;
// }
// MessageLog.GetInstance.ShowRunLog($"炒锅【4】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
// case 5:
// while (globalVar.fryPotFive.InputMaterialArrivedSingle == 0)
// {
// Thread.Sleep(5); if (globalVar.ExitMainTask)
// return;
// }
// MessageLog.GetInstance.ShowRunLog($"炒锅【5】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
// }

}
//}
/// <summary>
/// 炒锅1,4滚筒进料运行到位处理
/// </summary>
@@ -1704,75 +2004,75 @@ namespace FryPot_DosingSystem.Control
switch (LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
{
case 2:
while (globalVar.fryPotTwo.InputMaterialArrivedSingle == 0)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
}
//while (globalVar.fryPotTwo.InputMaterialArrivedSingle == 0)
//{
// Thread.Sleep(5); if (globalVar.ExitMainTask)
// return;
//}
MessageLog.GetInstance.ShowRunLog($"炒锅【2】原料:{LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
case 5:
while (globalVar.fryPotFive.InputMaterialArrivedSingle == 0)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
}
//while (globalVar.fryPotFive.InputMaterialArrivedSingle == 0)
//{
// Thread.Sleep(5); if (globalVar.ExitMainTask)
// return;
//}
MessageLog.GetInstance.ShowRunLog($"炒锅【5】原料:{LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
}
}
public void FryPotThreeInputMaterialRollerOperate()
{
while (globalVar.fryPotThree.InputMaterialArrivedSingle == 0)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
}
//while (globalVar.fryPotThree.InputMaterialArrivedSingle == 0)
//{
// Thread.Sleep(5); if (globalVar.ExitMainTask)
// return;
//}
MessageLog.GetInstance.ShowRunLog($"炒锅【3】原料:{LThreeOutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料");
}
/// <summary>
/// 炒锅滚筒空桶出桶处理
/// </summary>
public void FryPotOutEmpetyRollerOperate(ConcurrentQueue<MaterialInfo> queue)
{
switch (queue.ElementAt(0).materialType.MaterialLoc / 100)
{
case 1:
while (globalVar.fryPotOne.EmptyBarrelArrivedSingle == 0)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
}
MessageLog.GetInstance.ShowRunLog($"炒锅【1】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break;
case 2:
while (globalVar.fryPotTwo.EmptyBarrelArrivedSingle == 0)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
}
MessageLog.GetInstance.ShowRunLog($"炒锅【2】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break;
case 3:
while (globalVar.fryPotThree.EmptyBarrelArrivedSingle == 0)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
}
MessageLog.GetInstance.ShowRunLog($"炒锅【3】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break;
case 4:
while (globalVar.fryPotFour.EmptyBarrelArrivedSingle == 0)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
}
MessageLog.GetInstance.ShowRunLog($"炒锅【4】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break;
case 5:
while (globalVar.fryPotFive.EmptyBarrelArrivedSingle == 0)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
}
MessageLog.GetInstance.ShowRunLog($"炒锅【5】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break;
//public void FryPotOutEmpetyRollerOperate(ConcurrentQueue<MaterialInfo> queue)
//{
// switch (queue.ElementAt(0).materialType.MaterialLoc / 100)
// {
// case 1:
// while (globalVar.fryPotOne.EmptyBarrelArrivedSingle == 0)
// {
// Thread.Sleep(5); if (globalVar.ExitMainTask)
// return;
// }
// MessageLog.GetInstance.ShowRunLog($"炒锅【1】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break;
// case 2:
// while (globalVar.fryPotTwo.EmptyBarrelArrivedSingle == 0)
// {
// Thread.Sleep(5); if (globalVar.ExitMainTask)
// return;
// }
// MessageLog.GetInstance.ShowRunLog($"炒锅【2】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break;
// case 3:
// while (globalVar.fryPotThree.EmptyBarrelArrivedSingle == 0)
// {
// Thread.Sleep(5); if (globalVar.ExitMainTask)
// return;
// }
// MessageLog.GetInstance.ShowRunLog($"炒锅【3】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break;
// case 4:
// while (globalVar.fryPotFour.EmptyBarrelArrivedSingle == 0)
// {
// Thread.Sleep(5); if (globalVar.ExitMainTask)
// return;
// }
// MessageLog.GetInstance.ShowRunLog($"炒锅【4】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break;
// case 5:
// while (globalVar.fryPotFive.EmptyBarrelArrivedSingle == 0)
// {
// Thread.Sleep(5); if (globalVar.ExitMainTask)
// return;
// }
// MessageLog.GetInstance.ShowRunLog($"炒锅【5】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break;

}
}
// }
//}
/// <summary>
/// 炒锅1,4滚筒空桶出桶处理
/// </summary>
@@ -1804,18 +2104,18 @@ namespace FryPot_DosingSystem.Control
switch (LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
{
case 2:
while (globalVar.fryPotTwo.EmptyBarrelArrivedSingle == 0)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
}
//while (globalVar.fryPotTwo.EmptyBarrelArrivedSingle == 0)
//{
// Thread.Sleep(5); if (globalVar.ExitMainTask)
// return;
//}
MessageLog.GetInstance.ShowRunLog($"炒锅【2】原料:【{LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialName}】空桶上料完成"); break;
case 5:
while (globalVar.fryPotFive.EmptyBarrelArrivedSingle == 0)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
}
//while (globalVar.fryPotFive.EmptyBarrelArrivedSingle == 0)
//{
// Thread.Sleep(5); if (globalVar.ExitMainTask)
// return;
//}
MessageLog.GetInstance.ShowRunLog($"炒锅【5】原料:【{LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialName}】空桶上料完成"); break;
}
}
@@ -1824,11 +2124,11 @@ namespace FryPot_DosingSystem.Control
/// </summary>
public void FryPotThreeOutEmpetyRollerOperate()
{
while (globalVar.fryPotThree.EmptyBarrelArrivedSingle == 0)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
}
//while (globalVar.fryPotThree.EmptyBarrelArrivedSingle == 0)
//{
// Thread.Sleep(5); if (globalVar.ExitMainTask)
// return;
//}
MessageLog.GetInstance.ShowRunLog($"炒锅【3】原料:【{LThreeOutputMaterialQuene.ElementAt(0).materialType.MaterialName}】空桶上料完成");
}
/// <summary>
@@ -2066,7 +2366,7 @@ namespace FryPot_DosingSystem.Control
while (AlarmHelper<AlarmInfo>.Alarm.LOneRollerTrouble == 1)
{
Thread.Sleep(5);
if (globalVar.ExitMainTask)
if (globalVar.ExitLineOneTask)
return;
}
MessageLog.GetInstance.ShowRunLog("线体【1】滚筒故障解除,继续运行");
@@ -2106,7 +2406,7 @@ namespace FryPot_DosingSystem.Control
while (AlarmHelper<AlarmInfo>.Alarm.LTwoRollerTrouble == 1)
{
Thread.Sleep(5);
if (globalVar.ExitMainTask)
if (globalVar.ExitLineTwoTask)
return;
}
MessageLog.GetInstance.ShowRunLog("线体【2】滚筒故障解除,继续运行");
@@ -2146,7 +2446,7 @@ namespace FryPot_DosingSystem.Control
while (AlarmHelper<AlarmInfo>.Alarm.LThreeRollerTrouble == 1)
{
Thread.Sleep(5);
if (globalVar.ExitMainTask)
if (globalVar.ExitLineThreeTask)
return;
}
MessageLog.GetInstance.ShowRunLog("线体【3】滚筒故障解除,继续运行");
@@ -2171,7 +2471,7 @@ namespace FryPot_DosingSystem.Control
}
else if (errorCode == "Analysis Error")
{
MessageLog.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线API调用失败,请检查");
MessageLog.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线API调用失败,请检查请求报文");
}
else
{
@@ -2444,58 +2744,58 @@ namespace FryPot_DosingSystem.Control
/// <summary>
/// 炒锅滚筒信号检测
/// </summary>
public void FryPotRollerTroubleCheck()
{
FryPotAlarm = 0;
FryPotTwoAlarm = 0;
FryPotThreeAlarm = 0;
FryPotFourAlarm = 0;
FryPotFiveAlarm = 0;
switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
{
case 1:
if (AlarmHelper<AlarmInfo>.Alarm.FryPotOneRollerTrouble == 1) { FryPotAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【1】输送滚筒发生故障"); } else { FryPotAlarm = 1; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotOneRollerTrouble == 1)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
}
MessageLog.GetInstance.ShowRunLog("炒锅【1】输送滚筒故障解除,继续运行");
FryPotAlarm = 1; break;
case 2:
if (AlarmHelper<AlarmInfo>.Alarm.FryPotTwoRollerTrouble == 1) { FryPotTwoAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【2】输送滚筒发生故障"); } else { FryPotTwoAlarm = 1; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotTwoRollerTrouble == 1)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
}
MessageLog.GetInstance.ShowRunLog("炒锅【2】输送滚筒故障解除,继续运行");
FryPotTwoAlarm = 1; break;
case 3:
if (AlarmHelper<AlarmInfo>.Alarm.FryPotThreeRollerTrouble == 1) { FryPotThreeAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【3】输送滚筒发生故障"); } else { FryPotThreeAlarm = 1; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotThreeRollerTrouble == 1)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
}
MessageLog.GetInstance.ShowRunLog("炒锅【3】输送滚筒故障解除,继续运行");
FryPotThreeAlarm = 1; break;
case 4:
if (AlarmHelper<AlarmInfo>.Alarm.FryPotFourRollerTrouble == 1) { FryPotFourAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【4】输送滚筒发生故障"); } else { FryPotFourAlarm = 1; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotFourRollerTrouble == 1)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
}
MessageLog.GetInstance.ShowRunLog("炒锅【4】输送滚筒故障解除,继续运行");
FryPotFourAlarm = 1; break;
case 5:
if (AlarmHelper<AlarmInfo>.Alarm.FryPotFiveRollerTrouble == 1) { FryPotFiveAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【5】输送滚筒发生故障"); } else { FryPotFiveAlarm = 1; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotFiveRollerTrouble == 1)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
return;
}
MessageLog.GetInstance.ShowRunLog("炒锅【5】输送滚筒故障解除,继续运行");
FryPotFiveAlarm = 1; break;
//public void FryPotRollerTroubleCheck()
//{
// FryPotAlarm = 0;
// FryPotTwoAlarm = 0;
// FryPotThreeAlarm = 0;
// FryPotFourAlarm = 0;
// FryPotFiveAlarm = 0;
// switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100)
// {
// case 1:
// if (AlarmHelper<AlarmInfo>.Alarm.FryPotOneRollerTrouble == 1) { FryPotAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【1】输送滚筒发生故障"); } else { FryPotAlarm = 1; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotOneRollerTrouble == 1)
// {
// Thread.Sleep(5); if (globalVar.ExitMainTask)
// return;
// }
// MessageLog.GetInstance.ShowRunLog("炒锅【1】输送滚筒故障解除,继续运行");
// FryPotAlarm = 1; break;
// case 2:
// if (AlarmHelper<AlarmInfo>.Alarm.FryPotTwoRollerTrouble == 1) { FryPotTwoAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【2】输送滚筒发生故障"); } else { FryPotTwoAlarm = 1; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotTwoRollerTrouble == 1)
// {
// Thread.Sleep(5); if (globalVar.ExitMainTask)
// return;
// }
// MessageLog.GetInstance.ShowRunLog("炒锅【2】输送滚筒故障解除,继续运行");
// FryPotTwoAlarm = 1; break;
// case 3:
// if (AlarmHelper<AlarmInfo>.Alarm.FryPotThreeRollerTrouble == 1) { FryPotThreeAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【3】输送滚筒发生故障"); } else { FryPotThreeAlarm = 1; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotThreeRollerTrouble == 1)
// {
// Thread.Sleep(5); if (globalVar.ExitMainTask)
// return;
// }
// MessageLog.GetInstance.ShowRunLog("炒锅【3】输送滚筒故障解除,继续运行");
// FryPotThreeAlarm = 1; break;
// case 4:
// if (AlarmHelper<AlarmInfo>.Alarm.FryPotFourRollerTrouble == 1) { FryPotFourAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【4】输送滚筒发生故障"); } else { FryPotFourAlarm = 1; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotFourRollerTrouble == 1)
// {
// Thread.Sleep(5); if (globalVar.ExitMainTask)
// return;
// }
// MessageLog.GetInstance.ShowRunLog("炒锅【4】输送滚筒故障解除,继续运行");
// FryPotFourAlarm = 1; break;
// case 5:
// if (AlarmHelper<AlarmInfo>.Alarm.FryPotFiveRollerTrouble == 1) { FryPotFiveAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【5】输送滚筒发生故障"); } else { FryPotFiveAlarm = 1; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotFiveRollerTrouble == 1)
// {
// Thread.Sleep(5); if (globalVar.ExitMainTask)
// return;
// }
// MessageLog.GetInstance.ShowRunLog("炒锅【5】输送滚筒故障解除,继续运行");
// FryPotFiveAlarm = 1; break;

}
}
// }
//}
/// <summary>
/// 炒锅1,4滚筒信号检测
/// </summary>
@@ -2508,7 +2808,7 @@ namespace FryPot_DosingSystem.Control
case 1:
if (AlarmHelper<AlarmInfo>.Alarm.FryPotOneRollerTrouble == 1) { FryPotAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【1】输送滚筒发生故障"); } else { FryPotAlarm = 1; return; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotOneRollerTrouble == 1)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
Thread.Sleep(5); if (globalVar.ExitLineOneTask)
return;
}
MessageLog.GetInstance.ShowRunLog("炒锅【1】输送滚筒故障解除,继续运行");
@@ -2516,7 +2816,7 @@ namespace FryPot_DosingSystem.Control
case 4:
if (AlarmHelper<AlarmInfo>.Alarm.FryPotFourRollerTrouble == 1) { FryPotFourAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【4】输送滚筒发生故障"); } else { FryPotFourAlarm = 1; return; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotFourRollerTrouble == 1)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
Thread.Sleep(5); if (globalVar.ExitLineOneTask)
return;
}
MessageLog.GetInstance.ShowRunLog("炒锅【4】输送滚筒故障解除,继续运行");
@@ -2536,7 +2836,7 @@ namespace FryPot_DosingSystem.Control
case 2:
if (AlarmHelper<AlarmInfo>.Alarm.FryPotTwoRollerTrouble == 1) { FryPotTwoAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【1】输送滚筒发生故障"); } else { FryPotTwoAlarm = 1; return; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotTwoRollerTrouble == 1)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
Thread.Sleep(5); if (globalVar.ExitLineTwoTask)
return;
}
MessageLog.GetInstance.ShowRunLog("炒锅【1】输送滚筒故障解除,继续运行");
@@ -2544,7 +2844,7 @@ namespace FryPot_DosingSystem.Control
case 5:
if (AlarmHelper<AlarmInfo>.Alarm.FryPotFiveRollerTrouble == 1) { FryPotFiveAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【4】输送滚筒发生故障"); } else { FryPotFiveAlarm = 1; return; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotFiveRollerTrouble == 1)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
Thread.Sleep(5); if (globalVar.ExitLineTwoTask)
return;
}
MessageLog.GetInstance.ShowRunLog("炒锅【4】输送滚筒故障解除,继续运行");
@@ -2559,7 +2859,7 @@ namespace FryPot_DosingSystem.Control
FryPotThreeAlarm = 0;
if (AlarmHelper<AlarmInfo>.Alarm.FryPotThreeRollerTrouble == 1) { FryPotThreeAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【3】输送滚筒发生故障"); } else { FryPotThreeAlarm = 1; return; } while (AlarmHelper<AlarmInfo>.Alarm.FryPotThreeRollerTrouble == 1)
{
Thread.Sleep(5); if (globalVar.ExitMainTask)
Thread.Sleep(5); if (globalVar.ExitLineThreeTask)
return;
}
MessageLog.GetInstance.ShowRunLog("炒锅【3】输送滚筒故障解除,继续运行");


+ 88
- 37
FryPot_DosingSystem/Control/GlobalVariable.cs Целия файл

@@ -59,9 +59,17 @@ namespace FryPot_DosingSystem.Control
public ushort PlcInite { get; set; }
#region 上位机内部逻辑条件
/// <summary>
/// 退出主任务循环
/// 退出线体1任务
/// </summary>
public bool ExitMainTask { get; set; }
public bool ExitLineOneTask { get; set; }
/// <summary>
/// 退出线体2任务
/// </summary>
public bool ExitLineTwoTask { get; set; }
/// <summary>
/// 退出线体3任务
/// </summary>
public bool ExitLineThreeTask { get; set; }
/// <summary>
/// 允许AGV去线体1装桶条件
/// </summary>
@@ -74,10 +82,10 @@ namespace FryPot_DosingSystem.Control
/// 允许AGV去线体3装桶条件
/// </summary>
public bool AllowAgvToLineThreeLoadRoller { get; set; } = true;
/// <summary>
/// 配方唯一ID
/// </summary>
public string RecipeId { get; set; }
///// <summary>
///// 配方唯一ID
///// </summary>
//public string RecipeId { get; set; }
/// <summary>
/// 线体1对应的进桶出桶互锁
/// </summary>
@@ -90,18 +98,18 @@ namespace FryPot_DosingSystem.Control
/// 线体3对应的进桶出桶互锁
/// </summary>
public bool LThreeInOrOutputLock { get; set; }
/// <summary>
/// 线体1任务执行锁
/// </summary>
public bool LOneTaskLock { get; set; }
/// <summary>
/// 线体2任务执行锁
/// </summary>
public bool LTwoTaskLock { get; set; }
/// <summary>
/// 线体3任务执行锁
/// </summary>
public bool LThreeTaskLock { get; set; }
///// <summary>
///// 线体1任务执行锁
///// </summary>
//public bool LOneTaskLock { get; set; }
///// <summary>
///// 线体2任务执行锁
///// </summary>
//public bool LTwoTaskLock { get; set; }
///// <summary>
///// 线体3任务执行锁
///// </summary>
//public bool LThreeTaskLock { get; set; }
/// <summary>
/// 线体1当前正在制作的配方名称
/// </summary>
@@ -146,31 +154,31 @@ namespace FryPot_DosingSystem.Control
public bool LThreeAgvArrivePot { get; set; }
#endregion
#region AGV视图显示变量
public int LOneMaterialNum = 0;
public int LOneFryPotSerial = 1;
public int LOneCurrentCookingStep = 0;
public bool agvArriveUpLoad;
public bool agvArriveUnLoad;
public bool agvFryPotEmptyRollerArrive;
public int LOneMaterialNum { get; set; } = 0;
public int LOneFryPotSerial { get; set; } = 1;
public int LOneCurrentCookingStep { get; set; } = 0;
public bool agvArriveUpLoad { get; set; }
public bool agvArriveUnLoad { get; set; }
public bool agvFryPotEmptyRollerArrive { get; set; }
public bool EmptyRollerUnLoadcCom { get; set; }//AGV空桶4号线体下料完成

public int LTwoMaterialNum = 0;
public int LTwoFryPotSerial = 2;
public int LTwoCurrentCookingStep = 0;
public bool agvArriveLTwoUpLoad;
public bool LTwoagvArriveUnLoad;
public bool LTwoagvFryPotEmptyRollerArrive;
public int LTwoMaterialNum { get; set; } = 0;
public int LTwoFryPotSerial { get; set; } = 2;
public int LTwoCurrentCookingStep { get; set; } = 0;
public bool agvArriveLTwoUpLoad { get; set; }
public bool LTwoagvArriveUnLoad { get; set; }
public bool LTwoagvFryPotEmptyRollerArrive { get; set; }
public bool LTwoEmptyRollerUnLoadcCom { get; set; }//AGV空桶4号线体下料完成

public int LThreeMaterialNum = 0;
public int LThreeFryPotSerial = 3;
public int LThreeCurrentCookingStep = 0;
public bool agvArriveLThreeUpLoad;
public bool LThreeagvArriveUnLoad;
public bool LThreeagvFryPotEmptyRollerArrive;
public int LThreeMaterialNum { get; set; } = 0;
public int LThreeFryPotSerial { get; set; } = 3;
public int LThreeCurrentCookingStep { get; set; } = 0;
public bool agvArriveLThreeUpLoad { get; set; }
public bool LThreeagvArriveUnLoad { get; set; }
public bool LThreeagvFryPotEmptyRollerArrive { get; set; }
public bool LThreeEmptyRollerUnLoadcCom { get; set; }//AGV空桶4号线体下料完成

public int LFourRollerNum = 0;
public int LFourRollerNum { get; set; } = 0;
#endregion
}
/// <summary>
@@ -374,6 +382,8 @@ namespace FryPot_DosingSystem.Control
/// 当前线体配方完成信号
/// </summary>
public ushort RecipeCompleteSingle { get; set; }

}
/// <summary>
/// 炒锅1相关变量
@@ -400,6 +410,15 @@ namespace FryPot_DosingSystem.Control
/// 滚筒故障信号
/// </summary>
public ushort RollerTroubleSingle { get; set; }

/// <summary>
/// 用油量确认信号
/// </summary>
public ushort OilConfirm { get; set; }
/// <summary>
/// 当前配方用油量
/// </summary>
public double OilCapacity { get; set; }
}
/// <summary>
/// 炒锅2相关变量
@@ -426,6 +445,14 @@ namespace FryPot_DosingSystem.Control
/// 滚筒故障信号
/// </summary>
public ushort RollerTroubleSingle { get; set; }
/// <summary>
/// 用油量确认信号
/// </summary>
public ushort OilConfirm { get; set; }
/// <summary>
/// 当前配方用油量
/// </summary>
public double OilCapacity { get; set; }
}
/// <summary>
/// 炒锅3相关变量
@@ -452,6 +479,14 @@ namespace FryPot_DosingSystem.Control
/// 滚筒故障信号
/// </summary>
public ushort RollerTroubleSingle { get; set; }
/// <summary>
/// 用油量确认信号
/// </summary>
public ushort OilConfirm { get; set; }
/// <summary>
/// 当前配方用油量
/// </summary>
public double OilCapacity { get; set; }
}
/// <summary>
/// 炒锅4相关变量
@@ -478,6 +513,14 @@ namespace FryPot_DosingSystem.Control
/// 滚筒故障信号
/// </summary>
public ushort RollerTroubleSingle { get; set; }
/// <summary>
/// 用油量确认信号
/// </summary>
public ushort OilConfirm { get; set; }
/// <summary>
/// 当前配方用油量
/// </summary>
public double OilCapacity { get; set; }
}
/// <summary>
/// 炒锅5相关变量
@@ -504,5 +547,13 @@ namespace FryPot_DosingSystem.Control
/// 滚筒故障信号
/// </summary>
public ushort RollerTroubleSingle { get; set; }
/// <summary>
/// 用油量确认信号
/// </summary>
public ushort OilConfirm { get; set; }
/// <summary>
/// 当前配方用油量
/// </summary>
public double OilCapacity { get; set; }
}
}

+ 76
- 0
FryPot_DosingSystem/FryPotStatus/PotFiveStatus.cs Целия файл

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

namespace FryPot_DosingSystem.FryPotStatus
{
[Table("TbfryPotFive")]
internal class PotFiveStatus:ObservableObject
{
[Key]
[Column("Id")]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]//自增
public int Id { get; set; }
[Column("Temperature")]
[Variable("FryPotFiveTemp","5号炒锅温度","","")]
/// <summary>
/// 温度
/// </summary>
public double? Temperature { get { return temperature; } set { temperature = value; OnPropertyChanged(); } }
private double? temperature=0;
[Column("HotPower")]
[Variable("FryPotFivePower", "5号炒锅火力", "", "")]
/// <summary>
/// 火力
/// </summary>
public string? HotPower { get { return hotPower; } set { hotPower = value; OnPropertyChanged(); } }
private string? hotPower="0";
[Column("Speed")]
[Variable("FryPotFiveSpeed", "5号炒锅搅拌速度", "", "")]
/// <summary>
/// 搅拌速度
/// </summary>
public double? Speed { get { return speed; } set { speed = value; OnPropertyChanged(); } }
private double? speed=0;
[Column("FryPotWeight")]
[Variable("FryPotFiveWeight", "5号炒锅载重", "", "")]
/// <summary>
/// 炒锅重量
/// </summary>
public double? FryPotWeight { get { return fryPotWeight; } set { fryPotWeight = value; OnPropertyChanged(); } }
private double? fryPotWeight=0;
[Column("OilCapacity")]
[Variable("FryPotFiveOil", "5号炒锅当前配方用油量", "", "")]
/// <summary>
/// 单次配方用油量
/// </summary>
public double? OilCapacity { get { return oilCapacity; } set { oilCapacity = value; OnPropertyChanged(); } }
private double? oilCapacity=0;
[Column("TotalOilCapactiy")]
[Variable("FryPotFiveTotalOil", "5号炒锅总用油量", "", "")]
/// <summary>
/// 一天总用油量
/// </summary>
public double? TotalOilCapactiy { get { return totalOilCapactiy; } set { totalOilCapactiy = value; OnPropertyChanged(); } }
private double? totalOilCapactiy=0;

[Column("TotalProduct")]
[Variable("FryPotFiveTotalProduct", "5号炒锅总产量", "", "")]
/// <summary>
/// 一天配方生产总量
/// </summary>
public int? TotalProduct { get { return totalProduct; } set { totalProduct = value; OnPropertyChanged(); } }
private int? totalProduct=0;
[Column("Time")]
/// <summary>
/// 时间
/// </summary>
public string Time { get; set; } = DateTime.Now.ToShortTimeString();
}
}

+ 76
- 0
FryPot_DosingSystem/FryPotStatus/PotFourStatus.cs Целия файл

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

namespace FryPot_DosingSystem.FryPotStatus
{
[Table("TbfryPotOne")]
internal class PotFourStatus:ObservableObject
{
[Key]
[Column("Id")]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]//自增
public int Id { get; set; }
[Column("Temperature")]
[Variable("FryPotFourTemp", "4号炒锅温度", "", "")]
/// <summary>
/// 温度
/// </summary>
public double? Temperature { get { return temperature; } set { temperature = value; OnPropertyChanged(); } }
private double? temperature=0;
[Column("HotPower")]
[Variable("FryPotFourPower", "4号炒锅火力", "", "")]
/// <summary>
/// 火力
/// </summary>
public string? HotPower { get { return hotPower; } set { hotPower = value; OnPropertyChanged(); } }
private string? hotPower="0";
[Column("Speed")]
[Variable("FryPotFourSpeed", "4号炒锅搅拌速度", "", "")]
/// <summary>
/// 搅拌速度
/// </summary>
public double? Speed { get { return speed; } set { speed = value; OnPropertyChanged(); } }
private double? speed=0;
[Column("FryPotWeight")]
[Variable("FryPotFourWeight", "4号炒锅载重", "", "")]
/// <summary>
/// 炒锅重量
/// </summary>
public double? FryPotWeight { get { return fryPotWeight; } set { fryPotWeight = value; OnPropertyChanged(); } }
private double? fryPotWeight=0;
[Column("OilCapacity")]
[Variable("FryPotFourOil", "4号炒锅当前配方用油量", "", "")]
/// <summary>
/// 单次配方用油量
/// </summary>
public double? OilCapacity { get { return oilCapacity; } set { oilCapacity = value; OnPropertyChanged(); } }
private double? oilCapacity=0;
[Column("TotalOilCapactiy")]
[Variable("FryPotFourTotalOil", "4号炒锅总用油量", "", "")]
/// <summary>
/// 一天总用油量
/// </summary>
public double? TotalOilCapactiy { get { return totalOilCapactiy; } set { totalOilCapactiy = value; OnPropertyChanged(); } }
private double? totalOilCapactiy=0;

[Column("TotalProduct")]
[Variable("FryPotFourTotalProduct", "4号炒锅总产量", "", "")]
/// <summary>
/// 一天配方生产总量
/// </summary>
public int? TotalProduct { get { return totalProduct; } set { totalProduct = value; OnPropertyChanged(); } }
private int? totalProduct=0;
[Column("Time")]
/// <summary>
/// 时间
/// </summary>
public string Time { get; set; } = DateTime.Now.ToShortTimeString();
}
}

+ 76
- 0
FryPot_DosingSystem/FryPotStatus/PotOneStatus.cs Целия файл

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

namespace FryPot_DosingSystem.FryPotStatus
{
[Table("TbfryPotOne")]
internal class PotOneStatus:ObservableObject
{
[Key]
[Column("Id")]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]//自增
public int Id { get; set; }
[Column("Temperature")]
[Variable("FryPotOneTemp", "1号炒锅温度", "", "")]
/// <summary>
/// 温度
/// </summary>
public double? Temperature { get { return temperature; } set { temperature = value; OnPropertyChanged(); } }
private double? temperature=0;
[Column("HotPower")]
[Variable("FryPotOnePower", "1号炒锅火力", "", "")]
/// <summary>
/// 火力
/// </summary>
public string? HotPower { get { return hotPower; } set { hotPower = value; OnPropertyChanged(); } }
private string? hotPower="0";
[Column("Speed")]
[Variable("FryPotOneSpeed", "1号炒锅搅拌速度", "", "")]
/// <summary>
/// 搅拌速度
/// </summary>
public double? Speed { get { return speed; } set { speed = value; OnPropertyChanged(); } }
private double? speed = 0;
[Column("FryPotWeight")]
[Variable("FryPotOneWeight", "1号炒锅载重", "", "")]
/// <summary>
/// 炒锅重量
/// </summary>
public double? FryPotWeight { get { return fryPotWeight; } set { fryPotWeight = value; OnPropertyChanged(); } }
private double? fryPotWeight = 0;
[Column("OilCapacity")]
[Variable("FryPotOneOil", "1号炒锅当前配方用油量", "", "")]
/// <summary>
/// 单次配方用油量
/// </summary>
public double? OilCapacity { get { return oilCapacity; } set { oilCapacity = value; OnPropertyChanged(); } }
private double? oilCapacity = 0;
[Column("TotalOilCapactiy")]
[Variable("FryPotOneTotalOil", "1号炒锅总用油量", "", "")]
/// <summary>
/// 一天总用油量
/// </summary>
public double? TotalOilCapactiy { get { return totalOilCapactiy; } set { totalOilCapactiy = value; OnPropertyChanged(); } }
private double? totalOilCapactiy = 0;

[Column("TotalProduct")]
[Variable("FryPotOneTotalProduct", "1号炒锅总产量", "", "")]
/// <summary>
/// 一天配方生产总量
/// </summary>
public int? TotalProduct { get { return totalProduct; } set { totalProduct = value; OnPropertyChanged(); } }
private int? totalProduct = 0;
[Column("Time")]
/// <summary>
/// 时间
/// </summary>
public string Time { get; set; } = DateTime.Now.ToShortTimeString();
}
}

+ 76
- 0
FryPot_DosingSystem/FryPotStatus/PotThreeStatus.cs Целия файл

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

namespace FryPot_DosingSystem.FryPotStatus
{
[Table("TbfryPotThree")]
internal class PotThreeStatus:ObservableObject
{
[Key]
[Column("Id")]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]//自增
public int Id { get; set; }
[Column("Temperature")]
[Variable("FryPotThreeTemp", "3号炒锅温度", "", "")]
/// <summary>
/// 温度
/// </summary>
public double? Temperature { get { return temperature; } set { temperature = value; OnPropertyChanged(); } }
private double? temperature=0;
[Column("HotPower")]
[Variable("FryPotThreePower", "3号炒锅火力", "", "")]
/// <summary>
/// 火力
/// </summary>
public string? HotPower { get { return hotPower; } set { hotPower = value; OnPropertyChanged(); } }
private string? hotPower="0";
[Column("Speed")]
[Variable("FryPotThreeSpeed", "3号炒锅搅拌速度", "", "")]
/// <summary>
/// 搅拌速度
/// </summary>
public double? Speed { get { return speed; } set { speed = value; OnPropertyChanged(); } }
private double? speed=0;
[Column("FryPotWeight")]
[Variable("FryPotThreeWeight", "3号炒锅载重", "", "")]
/// <summary>
/// 炒锅重量
/// </summary>
public double? FryPotWeight { get { return fryPotWeight; } set { fryPotWeight = value; OnPropertyChanged(); } }
private double? fryPotWeight=0;
[Column("OilCapacity")]
[Variable("FryPotThreeOil", "3号炒锅当前配方用油量", "", "")]
/// <summary>
/// 单次配方用油量
/// </summary>
public double? OilCapacity { get { return oilCapacity; } set { oilCapacity = value; OnPropertyChanged(); } }
private double? oilCapacity=0;
[Column("TotalOilCapactiy")]
[Variable("FryPotThreeTotalOil", "3号炒锅总用油量", "", "")]
/// <summary>
/// 一天总用油量
/// </summary>
public double? TotalOilCapactiy { get { return totalOilCapactiy; } set { totalOilCapactiy = value; OnPropertyChanged(); } }
private double? totalOilCapactiy=0;

[Column("TotalProduct")]
[Variable("FryPotThreeTotalProduct", "3号炒锅总产量", "", "")]
/// <summary>
/// 一天配方生产总量
/// </summary>
public int? TotalProduct { get { return totalProduct; } set { totalProduct = value; OnPropertyChanged(); } }
private int? totalProduct=0;
[Column("Time")]
/// <summary>
/// 时间
/// </summary>
public string Time { get; set; } = DateTime.Now.ToShortTimeString();
}
}

+ 76
- 0
FryPot_DosingSystem/FryPotStatus/PotTwoStatus.cs Целия файл

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

namespace FryPot_DosingSystem.FryPotStatus
{
[Table("TbfryPotTwo")]
internal class PotTwoStatus:ObservableObject
{
[Key]
[Column("Id")]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]//自增
public int Id { get; set; }
[Column("Temperature")]
[Variable("FryPotTwoTemp", "2号炒锅温度", "", "")]
/// <summary>
/// 温度
/// </summary>
public double? Temperature { get { return temperature; } set { temperature = value; OnPropertyChanged(); } }
private double? temperature=0;
[Column("HotPower")]
[Variable("FryPotTwoPower", "2号炒锅火力", "", "")]
/// <summary>
/// 火力
/// </summary>
public string? HotPower { get { return hotPower; } set { hotPower = value; OnPropertyChanged(); } }
private string? hotPower="0";
[Column("Speed")]
[Variable("FryPotTwoSpeed", "2号炒锅搅拌速度", "", "")]
/// <summary>
/// 搅拌速度
/// </summary>
public double? Speed { get { return speed; } set { speed = value; OnPropertyChanged(); } }
private double? speed=0;
[Column("FryPotWeight")]
[Variable("FryPotTwoWeight", "2号炒锅载重", "", "")]
/// <summary>
/// 炒锅重量
/// </summary>
public double? FryPotWeight { get { return fryPotWeight; } set { fryPotWeight = value; OnPropertyChanged(); } }
private double? fryPotWeight=0;
[Column("OilCapacity")]
[Variable("FryPotTwoOil", "2号炒锅当前配方用油量", "", "")]
/// <summary>
/// 单次配方用油量
/// </summary>
public double? OilCapacity { get { return oilCapacity; } set { oilCapacity = value; OnPropertyChanged(); } }
private double? oilCapacity=0;
[Column("TotalOilCapactiy")]
[Variable("FryPotTwoTotalOil", "2号炒锅总用油量", "", "")]
/// <summary>
/// 一天总用油量
/// </summary>
public double? TotalOilCapactiy { get { return totalOilCapactiy; } set { totalOilCapactiy = value; OnPropertyChanged(); } }
private double? totalOilCapactiy=0;

[Column("TotalProduct")]
[Variable("FryPotTwoTotalProduct", "2号炒锅总产量", "", "")]
/// <summary>
/// 一天配方生产总量
/// </summary>
public int? TotalProduct { get { return totalProduct; } set { totalProduct = value; OnPropertyChanged(); } }
private int? totalProduct=0;
[Column("Time")]
/// <summary>
/// 时间
/// </summary>
public string Time { get; set; } = DateTime.Now.ToShortTimeString();
}
}

+ 77
- 0
FryPot_DosingSystem/Model/FryPotInfoManage.cs Целия файл

@@ -0,0 +1,77 @@
using FryPot_DosingSystem.Attributes;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace FryPot_DosingSystem.Model
{
internal class FryPotInfoManage:ObservableObject
{
public static FryPotInfoManage GetInstance => _instance ?? (_instance = new FryPotInfoManage());
private static FryPotInfoManage _instance;
public int id { get; set; }
public ObservableCollection<VariableMonitorModel> variableInfos { get; set; } = new ObservableCollection<VariableMonitorModel>();
public FryPotInfoManage()
{
if (variableInfos.Count > 0)
{
variableInfos.Clear();
}
PropertyInfo[] pros = FryPotMonitorManage.GetInstance.fryOne.GetType().GetProperties();
foreach (var item in pros)
{
var monitor = item.GetCustomAttribute<VariableAttribute>();
if (monitor != null)
{
variableInfos.Add(new VariableMonitorModel { Id = id + 1, VarName = monitor.VarName, PLCAddress = monitor.PLCAddress, Notes = monitor.Notes, ModbusTcpAddress = monitor.ModbusTcpAddress });
id++;
}
}
PropertyInfo[] pros2 = FryPotMonitorManage.GetInstance.fryTwo.GetType().GetProperties();
foreach (var item in pros2)
{
var monitor = item.GetCustomAttribute<VariableAttribute>();
if (monitor != null)
{
variableInfos.Add(new VariableMonitorModel { Id = id + 1, VarName = monitor.VarName, PLCAddress = monitor.PLCAddress, Notes = monitor.Notes, ModbusTcpAddress = monitor.ModbusTcpAddress });
id++;
}
}
PropertyInfo[] pros3 = FryPotMonitorManage.GetInstance.fryThree.GetType().GetProperties();
foreach (var item in pros3)
{
var monitor = item.GetCustomAttribute<VariableAttribute>();
if (monitor != null)
{
variableInfos.Add(new VariableMonitorModel { Id = id + 1, VarName = monitor.VarName, PLCAddress = monitor.PLCAddress, Notes = monitor.Notes, ModbusTcpAddress = monitor.ModbusTcpAddress });
id++;
}
}
PropertyInfo[] pros4 = FryPotMonitorManage.GetInstance.fryFour.GetType().GetProperties();
foreach (var item in pros4)
{
var monitor = item.GetCustomAttribute<VariableAttribute>();
if (monitor != null)
{
variableInfos.Add(new VariableMonitorModel { Id = id + 1, VarName = monitor.VarName, PLCAddress = monitor.PLCAddress, Notes = monitor.Notes, ModbusTcpAddress = monitor.ModbusTcpAddress });
id++;
}
}
PropertyInfo[] pros5 = FryPotMonitorManage.GetInstance.fryFive.GetType().GetProperties();
foreach (var item in pros5)
{
var monitor = item.GetCustomAttribute<VariableAttribute>();
if (monitor != null)
{
variableInfos.Add(new VariableMonitorModel { Id = id + 1, VarName = monitor.VarName, PLCAddress = monitor.PLCAddress, Notes = monitor.Notes, ModbusTcpAddress = monitor.ModbusTcpAddress });
id++;
}
}
}
}
}

+ 29
- 0
FryPot_DosingSystem/Model/FryPotMonitorManage.cs Целия файл

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

namespace FryPot_DosingSystem.Model
{
internal class FryPotMonitorManage
{
public static FryPotMonitorManage GetInstance=>_instance ?? (_instance = new FryPotMonitorManage());
private static FryPotMonitorManage _instance;
public PotOneStatus fryOne;
public PotTwoStatus fryTwo;
public PotThreeStatus fryThree;
public PotFourStatus fryFour;
public PotFiveStatus fryFive;
public FryPotMonitorManage()
{
fryOne = new PotOneStatus();
fryTwo = new PotTwoStatus();
fryThree = new PotThreeStatus();
fryFour = new PotFourStatus();
fryFive = new PotFiveStatus();
}

}
}

+ 2
- 1
FryPot_DosingSystem/Model/Global.cs Целия файл

@@ -1,4 +1,5 @@
using System;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


+ 34
- 0
FryPot_DosingSystem/Model/VariableMonitorModel.cs Целия файл

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

namespace FryPot_DosingSystem.Model
{
internal class VariableMonitorModel:ObservableObject
{
public int Id { get { return _mId; } set { _mId = value; OnPropertyChanged(); } }
private int _mId;


public string VarName { get { return _mVarName; } set { _mVarName = value; OnPropertyChanged(); } }
private string _mVarName;


public string PLCAddress { get { return _mPLCAddress; } set { _mPLCAddress = value; OnPropertyChanged(); } }
private string _mPLCAddress;


public string Notes { get { return _mNotes; } set { _mNotes = value; OnPropertyChanged(); } }
private string _mNotes;


public string ModbusTcpAddress { get { return _mModbusTcpAddress; } set { _mModbusTcpAddress = value; OnPropertyChanged(); } }
private string _mModbusTcpAddress;

public string CurrentValue { get { return _currentValue; }set { _currentValue = value;OnPropertyChanged(); } }
private string _currentValue;
}
}

+ 4
- 0
FryPot_DosingSystem/View/DebugView.xaml Целия файл

@@ -39,6 +39,7 @@
<ComboBox SelectionChanged="ComboBox_SelectionChanged" ItemsSource="{Binding LineOneRollerCode}" Background="Transparent" Width="100" Height="34" Margin="3,3"/>
<Button Content="炒锅进料就位" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding FryPotInputArrive}"/>
<Button Content="炒锅空桶就位" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding FryPotEmptyRollerArrive}"/>
<Button Content="线体1任务重置" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding LineOneTaskExit}"></Button>
</WrapPanel>
</GroupBox>
<GroupBox Grid.Column="2" Header="AGV信号" Foreground="Aqua">
@@ -48,6 +49,7 @@
</Button>
<Button Content="AGV炒锅空桶上料就位" Style="{StaticResource buttonStyle}" Width="139" Command="{Binding AGVFryPotUpArrive}"/>
<Button Content="AGV拿到空桶信号" Style="{StaticResource buttonStyle}" Width="114" Command="{Binding AGVFryPotGetEmptyRoller}"/>
</WrapPanel>
</GroupBox>
</UniformGrid>
@@ -59,6 +61,7 @@
<ComboBox SelectionChanged="ComboBox_SelectionChanged_1" ItemsSource="{Binding LineTwoRollerCode}" Background="Transparent" Width="100" Height="34" Margin="3,3"/>
<Button Content="炒锅进料就位" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding FryPotTwoInputArrive}"/>
<Button Content="炒锅空桶就位" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding FryPotTwoEmptyRollerArrive}"/>
<Button Content="线体2任务重置" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding LineTwoTaskExit}"></Button>
</WrapPanel>
</GroupBox>
<GroupBox Grid.Column="2" Header="AGV信号" Foreground="Aqua">
@@ -79,6 +82,7 @@
<ComboBox SelectionChanged="ComboBox_SelectionChanged_2" ItemsSource="{Binding LineThreeRollerCode}" Background="Transparent" Width="100" Height="34" Margin="3,3"/>
<Button Content="炒锅进料就位" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding FryPotThreeInputArrive}"/>
<Button Content="炒锅空桶就位" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding FryPotThreeEmptyRollerArrive}"/>
<Button Content="线体3任务重置" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding LineThreeTaskExit}"></Button>
</WrapPanel>
</GroupBox>
<GroupBox Grid.Column="2" Header="AGV信号" Foreground="Aqua">


+ 128
- 0
FryPot_DosingSystem/View/FryPotMonitorView.xaml Целия файл

@@ -0,0 +1,128 @@
<UserControl x:Class="FryPot_DosingSystem.View.FryPotMonitorView"
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:FryPot_DosingSystem.View"
xmlns:vm="clr-namespace:FryPot_DosingSystem.ViewModel"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.DataContext>
<vm:FryPotMonitorViewModel/>
</UserControl.DataContext>
<UserControl.Resources>
<Style x:Key="dataGrid" TargetType="DataGrid" >
<Setter Property="HorizontalGridLinesBrush" Value="#FF2AB2E7"/>
<Setter Property="VerticalGridLinesBrush" Value="#FF2AB2E7"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderBrush" Value="#FF2AB2E7"/>
<Setter Property="CanUserResizeColumns" Value="False"/>
<Setter Property="HeadersVisibility" Value="Column"/>
<Setter Property="HorizontalScrollBarVisibility" Value="Hidden"/>
<Setter Property="VerticalScrollBarVisibility" Value="Hidden"/>
</Style>
<Style x:Key="ColumHeaderStyle" TargetType="DataGridColumnHeader">
<Setter Property="HorizontalContentAlignment" Value="Center"></Setter>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Background" Value="#FF2AB2E7"></Setter>
<Setter Property="Foreground" Value="White"></Setter>
<Setter Property="BorderThickness" Value="1"></Setter>
<Setter Property="BorderBrush" Value="White"></Setter>
<Setter Property="Height" Value="30"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="FontWeight" Value="Heavy"/>
<Setter Property="Margin" Value="-1,-1,-1,-1"/>
</Style>

<Style x:Key="rowStyle" TargetType="DataGridRow">
<Setter Property="Height" Value="35"/>
<Setter Property="Foreground" Value="SkyBlue"/>
<Style.Triggers>
<Trigger Property="AlternationIndex" Value="0">
<Setter Property="Background" Value="Transparent" />
</Trigger>
<Trigger Property="AlternationIndex" Value="1">
<Setter Property="Background" Value="Transparent" />
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#000066" />
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="textboxStyle" TargetType="TextBox">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="SkyBlue"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="CaretBrush" Value="LightBlue"/>
<Style.Triggers>
<Trigger Property="IsFocused" Value="True">
<Setter Property="Cursor" Value="Arrow"/>
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="cellStyle" TargetType="DataGridCell">
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground"
Value="SkyBlue"/>
</Trigger>
<Trigger Property="IsSelected" Value="false">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground"
Value="SkyBlue"/>
</Trigger>

</Style.Triggers>
</Style>
<Style x:Key="dgCellstyle" TargetType="TextBlock">
<Setter Property="HorizontalAlignment" Value="Center"></Setter>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="FontSize" Value="16"/>
</Style>
</UserControl.Resources>
<DataGrid Grid.Row="1" ItemsSource="{Binding variableMonitorModels}" GridLinesVisibility="All" Background="Transparent"
AutoGenerateColumns="False" IsReadOnly="True" Style="{StaticResource dataGrid}"
ColumnHeaderStyle="{StaticResource ColumHeaderStyle}" RowStyle="{StaticResource rowStyle}" CellStyle="{StaticResource cellStyle}">
<DataGrid.Columns>
<DataGridTemplateColumn IsReadOnly="True" Width="0.1*" Header="ID">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding Id}" IsReadOnly="False" Style="{StaticResource textboxStyle}"></TextBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Width="0.2*" Header="变量名" Binding="{Binding VarName}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="描述" Binding="{Binding Notes}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="实时状态值" Binding="{Binding CurrentValue}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="PLC地址" Binding="{Binding PLCAddress}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="ModbusTcp地址" Binding="{Binding ModbusTcpAddress}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding PlcAddress}" Style="{StaticResource textboxStyle}"></TextBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>-->
<!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址长度">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding Length}" Style="{StaticResource textboxStyle}"></TextBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>-->
</DataGrid.Columns>
</DataGrid>


</UserControl>

+ 29
- 0
FryPot_DosingSystem/View/FryPotMonitorView.xaml.cs Целия файл

@@ -0,0 +1,29 @@
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 FryPot_DosingSystem.View
{
/// <summary>
/// FryPotMonitorView.xaml 的交互逻辑
/// </summary>
public partial class FryPotMonitorView : UserControl
{
public FryPotMonitorView()
{
InitializeComponent();
}
}
}

+ 702
- 0
FryPot_DosingSystem/View/SqliteDataView.xaml Целия файл

@@ -0,0 +1,702 @@
<UserControl x:Class="FryPot_DosingSystem.View.SqliteDataView"
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:FryPot_DosingSystem.View"
xmlns:vm="clr-namespace:FryPot_DosingSystem.ViewModel"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
xmlns:theme="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero2">
<UserControl.DataContext>
<vm:SqliteDataViewModel/>
</UserControl.DataContext>
<UserControl.Resources>
<Style x:Key="dataGrid" TargetType="DataGrid" >
<Setter Property="HorizontalGridLinesBrush" Value="#FF2AB2E7"/>
<Setter Property="VerticalGridLinesBrush" Value="#FF2AB2E7"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderBrush" Value="#FF2AB2E7"/>
<Setter Property="CanUserResizeColumns" Value="False"/>
<Setter Property="HeadersVisibility" Value="Column"/>
<Setter Property="HorizontalScrollBarVisibility" Value="Hidden"/>
<Setter Property="VerticalScrollBarVisibility" Value="Hidden"/>
</Style>
<Style x:Key="ColumHeaderStyle" TargetType="DataGridColumnHeader">
<Setter Property="HorizontalContentAlignment" Value="Center"></Setter>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Background" Value="#FF2AB2E7"></Setter>
<Setter Property="Foreground" Value="white"></Setter>
<Setter Property="BorderThickness" Value="0.6"></Setter>
<Setter Property="BorderBrush" Value="White"></Setter>
<Setter Property="Height" Value="30"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="FontWeight" Value="Heavy"/>
<Setter Property="Margin" Value="-1,-1,-1,-1" />
</Style>

<Style x:Key="rowStyle" TargetType="DataGridRow">
<Setter Property="Height" Value="35"/>
<Setter Property="Foreground" Value="#FF2AB2E7"/>
<Style.Triggers>
<Trigger Property="AlternationIndex" Value="0">
<Setter Property="Background" Value="Transparent" />
</Trigger>
<Trigger Property="AlternationIndex" Value="1">
<Setter Property="Background" Value="Transparent" />
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#000066" />
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="textboxStyle" TargetType="TextBox">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="#FF2AB2E7"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="CaretBrush" Value="LightBlue"/>
<Style.Triggers>
<Trigger Property="IsFocused" Value="True">
<Setter Property="Cursor" Value="Arrow"/>
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="cellStyle" TargetType="DataGridCell">
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground"
Value="#FF2AB2E7"/>
</Trigger>
<Trigger Property="IsSelected" Value="false">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground"
Value="#FF2AB2E7"/>
</Trigger>

</Style.Triggers>
</Style>
<Style x:Key="dgCellstyle" TargetType="TextBlock">
<Setter Property="HorizontalAlignment" Value="Center"></Setter>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="FontSize" Value="16"/>
</Style>
<Style x:Key="PickerStyle" TargetType="{x:Type DatePicker}">
<Setter Property="Foreground" Value="#FF2AB2E7" />
<Setter Property="IsTodayHighlighted" Value="True" />
<Setter Property="SelectedDateFormat" Value="Short" />
<Setter Property="Padding" Value="2" />
<Setter Property="BorderThickness" Value="2" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<!-- Set CalendarStyle to DatePickerCalendarStyle. -->
<Setter Property="CalendarStyle" Value="{DynamicResource DatePickerCalendarStyle}" />
<Setter Property="Width" Value="130" />
<Setter Property="FontSize" Value="12" />
<!--<Setter Property="Height" Value="30" />-->
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DatePicker}">
<Border
x:Name="br"
Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<Grid
x:Name="PART_Root"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Button
x:Name="PART_Button"
Grid.Column="1"
Height="20"
Margin="3,0,3,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Background="Transparent"
Focusable="False"
Foreground="{TemplateBinding Foreground}"
Style="{StaticResource DropDownButtonStyle}" />
<DatePickerTextBox
x:Name="PART_TextBox"
Grid.Column="0"
Margin="5,0,0,0"
VerticalAlignment="Center"
Foreground="{TemplateBinding Foreground}"
Style="{StaticResource DatePickerTextBoxStyle}"
Text="{TemplateBinding Text}" />
<Grid
x:Name="PART_DisabledVisual"
Grid.Row="0"
Grid.Column="0"
Grid.ColumnSpan="2"
IsHitTestVisible="False"
Opacity="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Rectangle
Grid.Row="0"
Grid.Column="0"
Fill="#A5FFFFFF"
RadiusX="1"
RadiusY="1" />
<Rectangle
Grid.Row="0"
Grid.Column="1"
Width="19"
Height="18"
Margin="3,0,3,0"
Fill="#A5FFFFFF"
RadiusX="1"
RadiusY="1" />
<Popup
x:Name="PART_Popup"
AllowsTransparency="True"
Placement="Bottom"
PlacementTarget="{Binding ElementName=br}"
PopupAnimation="Slide"
StaysOpen="False" />
</Grid>
</Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="Disabled">
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="PART_DisabledVisual"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="br" Property="BorderBrush" Value="#3aa7f3" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="FocusVisual">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle Margin="2" StrokeDashArray="1 2" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" SnapsToDevicePixels="true" StrokeThickness="1"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<SolidColorBrush x:Key="TextBox.Static.Background" Color="#FFFFFFFF"/>
<Style x:Key="ComboBoxEditableTextBox" TargetType="{x:Type TextBox}">
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="AllowDrop" Value="true"/>
<Setter Property="MinWidth" Value="0"/>
<Setter Property="MinHeight" Value="0"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TextBox}">
<ScrollViewer x:Name="PART_ContentHost" Background="Transparent" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<LinearGradientBrush x:Key="ComboBox.Static.Background" EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="Transparent" Offset="0.0"/>
<GradientStop Color="Transparent" Offset="1.0"/>
</LinearGradientBrush>
<SolidColorBrush x:Key="ComboBox.Static.Border" Color="#FFACACAC"/>
<SolidColorBrush x:Key="ComboBox.Static.Glyph" Color="#FF2AB2E7"/>
<SolidColorBrush x:Key="ComboBox.Static.Editable.Background" Color="Transparent"/>
<SolidColorBrush x:Key="ComboBox.Static.Editable.Border" Color="#FFABADB3"/>
<SolidColorBrush x:Key="ComboBox.Static.Editable.Button.Background" Color="Transparent"/>
<SolidColorBrush x:Key="ComboBox.Static.Editable.Button.Border" Color="Transparent"/>
<LinearGradientBrush x:Key="ComboBox.MouseOver.Background" EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="Transparent" Offset="0.0"/>
<GradientStop Color="Transparent" Offset="1.0"/>
</LinearGradientBrush>
<SolidColorBrush x:Key="ComboBox.MouseOver.Border" Color="#FF7EB4EA"/>
<SolidColorBrush x:Key="ComboBox.MouseOver.Glyph" Color="#FF000000"/>
<SolidColorBrush x:Key="ComboBox.MouseOver.Editable.Background" Color="Transparent"/>
<SolidColorBrush x:Key="ComboBox.MouseOver.Editable.Border" Color="#FF7EB4EA"/>
<LinearGradientBrush x:Key="ComboBox.MouseOver.Editable.Button.Background" EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="Transparent" Offset="0.0"/>
<GradientStop Color="Transparent" Offset="1.0"/>
</LinearGradientBrush>
<SolidColorBrush x:Key="ComboBox.MouseOver.Editable.Button.Border" Color="#FF7EB4EA"/>
<LinearGradientBrush x:Key="ComboBox.Pressed.Background" EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#FFDAECFC" Offset="0.0"/>
<GradientStop Color="#FFC4E0FC" Offset="1.0"/>
</LinearGradientBrush>
<SolidColorBrush x:Key="ComboBox.Pressed.Border" Color="#FF569DE5"/>
<SolidColorBrush x:Key="ComboBox.Pressed.Glyph" Color="#FF000000"/>
<SolidColorBrush x:Key="ComboBox.Pressed.Editable.Background" Color="#FFFFFFFF"/>
<SolidColorBrush x:Key="ComboBox.Pressed.Editable.Border" Color="#FF569DE5"/>
<LinearGradientBrush x:Key="ComboBox.Pressed.Editable.Button.Background" EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#FFDAEBFC" Offset="0.0"/>
<GradientStop Color="#FFC4E0FC" Offset="1.0"/>
</LinearGradientBrush>
<SolidColorBrush x:Key="ComboBox.Pressed.Editable.Button.Border" Color="#FF569DE5"/>
<SolidColorBrush x:Key="ComboBox.Disabled.Background" Color="#FFF0F0F0"/>
<SolidColorBrush x:Key="ComboBox.Disabled.Border" Color="#FFD9D9D9"/>
<SolidColorBrush x:Key="ComboBox.Disabled.Glyph" Color="#FFBFBFBF"/>
<SolidColorBrush x:Key="ComboBox.Disabled.Editable.Background" Color="#FFFFFFFF"/>
<SolidColorBrush x:Key="ComboBox.Disabled.Editable.Border" Color="#FFBFBFBF"/>
<SolidColorBrush x:Key="ComboBox.Disabled.Editable.Button.Background" Color="Transparent"/>
<SolidColorBrush x:Key="ComboBox.Disabled.Editable.Button.Border" Color="Transparent"/>
<Style x:Key="ComboBoxToggleButton" TargetType="{x:Type ToggleButton}">
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="IsTabStop" Value="false"/>
<Setter Property="Focusable" Value="false"/>
<Setter Property="ClickMode" Value="Press"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Border x:Name="templateRoot" Background="{StaticResource ComboBox.Static.Background}" BorderBrush="{StaticResource ComboBox.Static.Border}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="true">
<Border x:Name="splitBorder" BorderBrush="Transparent" BorderThickness="1" HorizontalAlignment="Right" Margin="0" SnapsToDevicePixels="true" Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}">
<Path x:Name="arrow" Data="F1 M 0,0 L 2.667,2.66665 L 5.3334,0 L 5.3334,-1.78168 L 2.6667,0.88501 L0,-1.78168 L0,0 Z" Fill="{StaticResource ComboBox.Static.Glyph}" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Center"/>
</Border>
</Border>
<ControlTemplate.Triggers>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true"/>
<Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="false"/>
<Condition Binding="{Binding IsPressed, RelativeSource={RelativeSource Self}}" Value="false"/>
<Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="true"/>
</MultiDataTrigger.Conditions>
<Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.Static.Editable.Background}"/>
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.Static.Editable.Border}"/>
<Setter Property="Background" TargetName="splitBorder" Value="{StaticResource ComboBox.Static.Editable.Button.Background}"/>
<Setter Property="BorderBrush" TargetName="splitBorder" Value="{StaticResource ComboBox.Static.Editable.Button.Border}"/>
</MultiDataTrigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Fill" TargetName="arrow" Value="{StaticResource ComboBox.MouseOver.Glyph}"/>
</Trigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true"/>
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="false"/>
</MultiDataTrigger.Conditions>
<Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.MouseOver.Background}"/>
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.MouseOver.Border}"/>
</MultiDataTrigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true"/>
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true"/>
</MultiDataTrigger.Conditions>
<Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.MouseOver.Editable.Background}"/>
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.MouseOver.Editable.Border}"/>
<Setter Property="Background" TargetName="splitBorder" Value="{StaticResource ComboBox.MouseOver.Editable.Button.Background}"/>
<Setter Property="BorderBrush" TargetName="splitBorder" Value="{StaticResource ComboBox.MouseOver.Editable.Button.Border}"/>
</MultiDataTrigger>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Fill" TargetName="arrow" Value="{StaticResource ComboBox.Pressed.Glyph}"/>
</Trigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsPressed, RelativeSource={RelativeSource Self}}" Value="true"/>
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="false"/>
</MultiDataTrigger.Conditions>
<Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.Pressed.Background}"/>
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.Pressed.Border}"/>
</MultiDataTrigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsPressed, RelativeSource={RelativeSource Self}}" Value="true"/>
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true"/>
</MultiDataTrigger.Conditions>
<Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.Pressed.Editable.Background}"/>
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.Pressed.Editable.Border}"/>
<Setter Property="Background" TargetName="splitBorder" Value="{StaticResource ComboBox.Pressed.Editable.Button.Background}"/>
<Setter Property="BorderBrush" TargetName="splitBorder" Value="{StaticResource ComboBox.Pressed.Editable.Button.Border}"/>
</MultiDataTrigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Fill" TargetName="arrow" Value="{StaticResource ComboBox.Disabled.Glyph}"/>
</Trigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="false"/>
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="false"/>
</MultiDataTrigger.Conditions>
<Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.Disabled.Background}"/>
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.Disabled.Border}"/>
</MultiDataTrigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="false"/>
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true"/>
</MultiDataTrigger.Conditions>
<Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.Disabled.Editable.Background}"/>
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.Disabled.Editable.Border}"/>
<Setter Property="Background" TargetName="splitBorder" Value="{StaticResource ComboBox.Disabled.Editable.Button.Background}"/>
<Setter Property="BorderBrush" TargetName="splitBorder" Value="{StaticResource ComboBox.Disabled.Editable.Button.Border}"/>
</MultiDataTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<ControlTemplate x:Key="ComboBoxEditableTemplate" TargetType="{x:Type ComboBox}">
<Grid x:Name="templateRoot" SnapsToDevicePixels="true">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" Width="0"/>
</Grid.ColumnDefinitions>
<Popup x:Name="PART_Popup" AllowsTransparency="true" Grid.ColumnSpan="2" IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}" Placement="Bottom" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}">
<theme:SystemDropShadowChrome x:Name="shadow" Color="Transparent" MinWidth="{Binding ActualWidth, ElementName=templateRoot}" MaxHeight="{TemplateBinding MaxDropDownHeight}">
<Border x:Name="dropDownBorder" Background="Transparent" BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" BorderThickness="1">
<ScrollViewer x:Name="DropDownScrollViewer">
<Grid x:Name="grid" RenderOptions.ClearTypeHint="Enabled">
<Canvas x:Name="canvas" HorizontalAlignment="Left" Height="0" VerticalAlignment="Top" Width="0">
<Rectangle x:Name="opaqueRect" Fill="{Binding Background, ElementName=dropDownBorder}" Height="{Binding ActualHeight, ElementName=dropDownBorder}" Width="{Binding ActualWidth, ElementName=dropDownBorder}"/>
</Canvas>
<ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</Grid>
</ScrollViewer>
</Border>
</theme:SystemDropShadowChrome>
</Popup>
<ToggleButton x:Name="toggleButton" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Grid.ColumnSpan="2" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Style="{StaticResource ComboBoxToggleButton}"/>
<Border x:Name="border" Background="{StaticResource TextBox.Static.Background}" Margin="{TemplateBinding BorderThickness}">
<TextBox x:Name="PART_EditableTextBox" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" IsReadOnly="{Binding IsReadOnly, RelativeSource={RelativeSource TemplatedParent}}" Margin="{TemplateBinding Padding}" Style="{StaticResource ComboBoxEditableTextBox}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Opacity" TargetName="border" Value="0.56"/>
</Trigger>
<Trigger Property="IsKeyboardFocusWithin" Value="true">
<Setter Property="Foreground" Value="Black"/>
</Trigger>
<Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="true">
<Setter Property="Margin" TargetName="shadow" Value="0,0,5,5"/>
<Setter Property="Color" TargetName="shadow" Value="#71000000"/>
</Trigger>
<Trigger Property="HasItems" Value="false">
<Setter Property="Height" TargetName="dropDownBorder" Value="95"/>
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsGrouping" Value="true"/>
<Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false"/>
</MultiTrigger.Conditions>
<Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
</MultiTrigger>
<Trigger Property="ScrollViewer.CanContentScroll" SourceName="DropDownScrollViewer" Value="false">
<Setter Property="Canvas.Top" TargetName="opaqueRect" Value="{Binding VerticalOffset, ElementName=DropDownScrollViewer}"/>
<Setter Property="Canvas.Left" TargetName="opaqueRect" Value="{Binding HorizontalOffset, ElementName=DropDownScrollViewer}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate x:Key="ComboBoxTemplate" TargetType="{x:Type ComboBox}">
<Grid x:Name="templateRoot" SnapsToDevicePixels="true">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" Width="0"/>
</Grid.ColumnDefinitions>
<Popup x:Name="PART_Popup" AllowsTransparency="true" Grid.ColumnSpan="2" IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Margin="1" Placement="Bottom" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}">
<theme:SystemDropShadowChrome x:Name="shadow" Color="Transparent" MinWidth="{Binding ActualWidth, ElementName=templateRoot}" MaxHeight="{TemplateBinding MaxDropDownHeight}">
<Border x:Name="dropDownBorder" Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" BorderThickness="1">
<ScrollViewer x:Name="DropDownScrollViewer">
<Grid x:Name="grid" RenderOptions.ClearTypeHint="Enabled">
<Canvas x:Name="canvas" HorizontalAlignment="Left" Height="0" VerticalAlignment="Top" Width="0">
<Rectangle x:Name="opaqueRect" Fill="{Binding Background, ElementName=dropDownBorder}" Height="{Binding ActualHeight, ElementName=dropDownBorder}" Width="{Binding ActualWidth, ElementName=dropDownBorder}"/>
</Canvas>
<ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</Grid>
</ScrollViewer>
</Border>
</theme:SystemDropShadowChrome>
</Popup>
<ToggleButton x:Name="toggleButton" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Grid.ColumnSpan="2" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Style="{StaticResource ComboBoxToggleButton}"/>
<ContentPresenter x:Name="contentPresenter" ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}" ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" Content="{TemplateBinding SelectionBoxItem}" ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" IsHitTestVisible="false" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="true">
<Setter Property="Margin" TargetName="shadow" Value="0,0,5,5"/>
<Setter Property="Color" TargetName="shadow" Value="#71000000"/>
</Trigger>
<Trigger Property="HasItems" Value="false">
<Setter Property="Height" TargetName="dropDownBorder" Value="95"/>
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsGrouping" Value="true"/>
<Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false"/>
</MultiTrigger.Conditions>
<Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
</MultiTrigger>
<Trigger Property="ScrollViewer.CanContentScroll" SourceName="DropDownScrollViewer" Value="false">
<Setter Property="Canvas.Top" TargetName="opaqueRect" Value="{Binding VerticalOffset, ElementName=DropDownScrollViewer}"/>
<Setter Property="Canvas.Left" TargetName="opaqueRect" Value="{Binding HorizontalOffset, ElementName=DropDownScrollViewer}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<Style x:Key="ComboBoxStyle1" TargetType="{x:Type ComboBox}">
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
<Setter Property="Background" Value="{StaticResource ComboBox.Static.Background}"/>
<Setter Property="BorderBrush" Value="{StaticResource ComboBox.Static.Border}"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="Padding" Value="6,3,5,3"/>
<Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
<Setter Property="ScrollViewer.PanningMode" Value="Both"/>
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
<Setter Property="Template" Value="{StaticResource ComboBoxTemplate}"/>
<Style.Triggers>
<Trigger Property="IsEditable" Value="true">
<Setter Property="IsTabStop" Value="false"/>
<Setter Property="Padding" Value="2"/>
<Setter Property="Template" Value="{StaticResource ComboBoxEditableTemplate}"/>
</Trigger>
</Style.Triggers>
</Style>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="0.1*"/>
<RowDefinition/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<DatePicker Margin="50,0" Height="35" Style="{StaticResource PickerStyle}" SelectedDate="{Binding SelectedDate}"></DatePicker>
<ComboBox Style="{DynamicResource ComboBoxStyle1}" ItemsSource="{Binding list}" Height="35" Width="150" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" FontSize="18" Foreground="#FF2AB2E7" SelectedValue="{Binding cboSelectedValue}" Margin="0,0,50,0"></ComboBox>
<Button Width="150" Height="35" Content="查询" FontSize="20" Foreground="#FF2AB2E7" Background="Transparent" BorderBrush="#FF2AB2E7" BorderThickness="1" Command="{Binding SelectCommand}"></Button>
</StackPanel>
<DataGrid Grid.Row="1" x:Name="fryOne" Visibility="{Binding fryOneDataVisible}" ItemsSource="{Binding StatusOne}" GridLinesVisibility="All" Background="Transparent"
AutoGenerateColumns="False" IsReadOnly="True" Style="{StaticResource dataGrid}"
ColumnHeaderStyle="{StaticResource ColumHeaderStyle}" RowStyle="{StaticResource rowStyle}" CellStyle="{StaticResource cellStyle}">
<DataGrid.Columns>
<DataGridTemplateColumn IsReadOnly="True" Width="0.1*" Header="ID">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding Id}" IsReadOnly="False" Style="{StaticResource textboxStyle}"></TextBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Width="0.2*" Header="温度" Binding="{Binding Temperature}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="火力" Binding="{Binding HotPower}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="搅拌速度" Binding="{Binding Speed}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="炒锅载重" Binding="{Binding FryPotWeight}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="配方用油量" Binding="{Binding OilCapacity}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="总用油量" Binding="{Binding TotalOilCapactiy}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="产量" Binding="{Binding TotalProduct}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="时间" Binding="{Binding Time}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding PlcAddress}" Style="{StaticResource textboxStyle}"></TextBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>-->
<!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址长度">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding Length}" Style="{StaticResource textboxStyle}"></TextBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>-->
</DataGrid.Columns>
</DataGrid>
<DataGrid x:Name="fryTwo" Grid.Row="1" Visibility="{Binding fryTwoDataVisible}" ItemsSource="{Binding StatusTwo}" GridLinesVisibility="All" Background="Transparent"
AutoGenerateColumns="False" IsReadOnly="True" Style="{StaticResource dataGrid}"
ColumnHeaderStyle="{StaticResource ColumHeaderStyle}" RowStyle="{StaticResource rowStyle}" CellStyle="{StaticResource cellStyle}">
<DataGrid.Columns>
<DataGridTemplateColumn IsReadOnly="True" Width="0.1*" Header="ID">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding Id}" IsReadOnly="False" Style="{StaticResource textboxStyle}"></TextBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Width="0.2*" Header="温度" Binding="{Binding Temperature}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="火力" Binding="{Binding HotPower}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="搅拌速度" Binding="{Binding Speed}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="炒锅载重" Binding="{Binding FryPotWeight}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="配方用油量" Binding="{Binding OilCapacity}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="总用油量" Binding="{Binding TotalOilCapactiy}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="产量" Binding="{Binding TotalProduct}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="时间" Binding="{Binding Time}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding PlcAddress}" Style="{StaticResource textboxStyle}"></TextBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>-->
<!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址长度">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding Length}" Style="{StaticResource textboxStyle}"></TextBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>-->
</DataGrid.Columns>
</DataGrid>
<DataGrid x:Name="fryThree" Grid.Row="1" Visibility="{Binding fryThreeDataVisible}" ItemsSource="{Binding StatusThree}" GridLinesVisibility="All" Background="Transparent"
AutoGenerateColumns="False" IsReadOnly="True" Style="{StaticResource dataGrid}"
ColumnHeaderStyle="{StaticResource ColumHeaderStyle}" RowStyle="{StaticResource rowStyle}" CellStyle="{StaticResource cellStyle}">
<DataGrid.Columns>
<DataGridTemplateColumn IsReadOnly="True" Width="0.1*" Header="ID">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding Id}" IsReadOnly="False" Style="{StaticResource textboxStyle}"></TextBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Width="0.2*" Header="温度" Binding="{Binding Temperature}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="火力" Binding="{Binding HotPower}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="搅拌速度" Binding="{Binding Speed}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="炒锅载重" Binding="{Binding FryPotWeight}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="配方用油量" Binding="{Binding OilCapacity}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="总用油量" Binding="{Binding TotalOilCapactiy}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="产量" Binding="{Binding TotalProduct}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="时间" Binding="{Binding Time}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding PlcAddress}" Style="{StaticResource textboxStyle}"></TextBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>-->
<!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址长度">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding Length}" Style="{StaticResource textboxStyle}"></TextBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>-->
</DataGrid.Columns>
</DataGrid>
<DataGrid x:Name="fryFour" Grid.Row="1" Visibility="{Binding fryFourDataVisible}" ItemsSource="{Binding StatusFour}" GridLinesVisibility="All" Background="Transparent"
AutoGenerateColumns="False" IsReadOnly="True" Style="{StaticResource dataGrid}"
ColumnHeaderStyle="{StaticResource ColumHeaderStyle}" RowStyle="{StaticResource rowStyle}" CellStyle="{StaticResource cellStyle}">
<DataGrid.Columns>
<DataGridTemplateColumn IsReadOnly="True" Width="0.1*" Header="ID">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding Id}" IsReadOnly="False" Style="{StaticResource textboxStyle}"></TextBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Width="0.2*" Header="温度" Binding="{Binding Temperature}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="火力" Binding="{Binding HotPower}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="搅拌速度" Binding="{Binding Speed}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="炒锅载重" Binding="{Binding FryPotWeight}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="配方用油量" Binding="{Binding OilCapacity}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="总用油量" Binding="{Binding TotalOilCapactiy}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="产量" Binding="{Binding TotalProduct}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="时间" Binding="{Binding Time}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding PlcAddress}" Style="{StaticResource textboxStyle}"></TextBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>-->
<!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址长度">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding Length}" Style="{StaticResource textboxStyle}"></TextBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>-->
</DataGrid.Columns>
</DataGrid>
<DataGrid x:Name="fryFive" Grid.Row="1" Visibility="{Binding fryFiveDataVisible}" ItemsSource="{Binding StatusFive}" GridLinesVisibility="All" Background="Transparent"
AutoGenerateColumns="False" IsReadOnly="True" Style="{StaticResource dataGrid}"
ColumnHeaderStyle="{StaticResource ColumHeaderStyle}" RowStyle="{StaticResource rowStyle}" CellStyle="{StaticResource cellStyle}">
<DataGrid.Columns>
<DataGridTemplateColumn IsReadOnly="True" Width="0.1*" Header="ID">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding Id}" IsReadOnly="False" Style="{StaticResource textboxStyle}"></TextBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Width="0.2*" Header="温度" Binding="{Binding Temperature}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="火力" Binding="{Binding HotPower}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="搅拌速度" Binding="{Binding Speed}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="炒锅载重" Binding="{Binding FryPotWeight}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="配方用油量" Binding="{Binding OilCapacity}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="总用油量" Binding="{Binding TotalOilCapactiy}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="产量" Binding="{Binding TotalProduct}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="时间" Binding="{Binding Time}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding PlcAddress}" Style="{StaticResource textboxStyle}"></TextBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>-->
<!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址长度">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding Length}" Style="{StaticResource textboxStyle}"></TextBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>-->
</DataGrid.Columns>
</DataGrid>
</Grid>
</UserControl>

+ 30
- 0
FryPot_DosingSystem/View/SqliteDataView.xaml.cs Целия файл

@@ -0,0 +1,30 @@
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 FryPot_DosingSystem.View
{
/// <summary>
/// SqliteDataView.xaml 的交互逻辑
/// </summary>
public partial class SqliteDataView : UserControl
{
public SqliteDataView()
{
InitializeComponent();
}

}
}

+ 30
- 28
FryPot_DosingSystem/View/UserManageView.xaml Целия файл

@@ -42,17 +42,17 @@
<Style TargetType="DataGrid" x:Key="dataGrid">
<!--网格线颜色-->
<Setter Property="CanUserResizeColumns" Value="false"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"></Setter>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"></Setter>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Hidden"></Setter>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Hidden"></Setter>
<Setter Property="HeadersVisibility" Value="Column"/>
<Setter Property="HorizontalGridLinesBrush">
<Setter.Value>
<SolidColorBrush Color="#03ffea"/>
<SolidColorBrush Color="#FF2AB2E7"/>
</Setter.Value>
</Setter>
<Setter Property="VerticalGridLinesBrush">
<Setter.Value>
<SolidColorBrush Color="#03ffea"/>
<SolidColorBrush Color="#FF2AB2E7"/>
</Setter.Value>
</Setter>

@@ -60,13 +60,15 @@

<Style x:Key="columsHeader" TargetType="DataGridColumnHeader">
<Setter Property="HorizontalContentAlignment" Value="Center"></Setter>
<Setter Property="Background" Value="Transparent"></Setter>
<Setter Property="Foreground" Value="#17acae"></Setter>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Foreground" Value="White"></Setter>
<Setter Property="Background" Value="#FF2AB2E7"/>
<Setter Property="BorderThickness" Value="1"></Setter>
<Setter Property="BorderBrush" Value="#03ffea"></Setter>
<Setter Property="Height" Value="45"/>
<Setter Property="FontSize" Value="22"/>
<Setter Property="BorderBrush" Value="white"></Setter>
<Setter Property="Height" Value="30"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="FontWeight" Value="Heavy"/>
<Setter Property="Margin" Value="-1,-1,-1,-1"/>

</Style>
<Style x:Key="rowStyle" TargetType="DataGridRow">
@@ -101,8 +103,8 @@
</Style>

<LinearGradientBrush x:Key="ComboBox.Static.Background" EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#8080ff" Offset="0.0"/>
<GradientStop Color="#000066" Offset="1.0"/>
<GradientStop Color="Transparent" Offset="0.0"/>
<GradientStop Color="Transparent" Offset="1.0"/>
</LinearGradientBrush>
<SolidColorBrush x:Key="ComboBox.Static.Border" Color="SkyBlue"/>
<SolidColorBrush x:Key="ComboBox.Static.Glyph" Color="SkyBlue"/>
@@ -245,7 +247,7 @@
</Grid.ColumnDefinitions>
<Popup x:Name="PART_Popup" AllowsTransparency="true" Grid.ColumnSpan="2" IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Margin="1" Placement="Bottom" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}">
<theme:SystemDropShadowChrome x:Name="shadow" Color="Transparent" MinWidth="{Binding ActualWidth, ElementName=templateRoot}" MaxHeight="{TemplateBinding MaxDropDownHeight}">
<Border x:Name="dropDownBorder" Background="SkyBlue" BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" BorderThickness="1">
<Border x:Name="dropDownBorder" Background="White" BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" BorderThickness="1">
<ScrollViewer x:Name="DropDownScrollViewer">
<Grid x:Name="grid" RenderOptions.ClearTypeHint="Enabled">
<Canvas x:Name="canvas" HorizontalAlignment="Left" Height="0" VerticalAlignment="Top" Width="0">
@@ -282,8 +284,8 @@
</ControlTemplate.Triggers>
</ControlTemplate>
<LinearGradientBrush x:Key="Button.Static.Background" EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#8080ff" Offset="0.0"/>
<GradientStop Color="#000066" Offset="1.0"/>
<GradientStop Color="Transparent" Offset="0.0"/>
<GradientStop Color="Transparent" Offset="1.0"/>
</LinearGradientBrush>
<SolidColorBrush x:Key="Button.MouseOver.Background" Color="#FFBEE6FD"/>
<SolidColorBrush x:Key="Button.MouseOver.Border" Color="#FF3C7FB1"/>
@@ -318,12 +320,12 @@
</UserControl.Resources>
<Grid>
<ScrollViewer VerticalScrollBarVisibility="Hidden">
<DataGrid Name="dataGrid" ItemsSource="{Binding usersInfo}" GridLinesVisibility="All" Background="Transparent"
<DataGrid ItemsSource="{Binding usersInfo}" GridLinesVisibility="All" Background="Transparent"
AutoGenerateColumns="False"
IsReadOnly="False" Style="{StaticResource dataGrid }"
ColumnHeaderStyle="{StaticResource columsHeader}" RowStyle="{StaticResource rowStyle}" CellStyle="{StaticResource cellStyle}">
<DataGrid.Columns>
<DataGridTemplateColumn Width="0.2*">
<!--<DataGridTemplateColumn Width="0.2*">

<DataGridTemplateColumn.Header>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" >
@@ -336,8 +338,8 @@
<TextBox Text="{Binding UserName}" Style="{StaticResource textboxStyle}"></TextBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<!--<DataGridTextColumn FontSize="16" IsReadOnly="false" Width="0.2*" Binding="{Binding UserName}" ElementStyle="{StaticResource dgCell}">
</DataGridTemplateColumn>-->
<DataGridTextColumn FontSize="16" IsReadOnly="false" Width="0.2*" Binding="{Binding UserName}" ElementStyle="{StaticResource dgCell}">
<DataGridTextColumn.Header>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<TextBlock FontFamily="../Resources/fonts/#iconfont" Foreground="Orange" Text="&#xe6a0;" FontSize="24" VerticalAlignment="Center" Margin="0,0,8,0"/>
@@ -345,8 +347,8 @@
</StackPanel>
</DataGridTextColumn.Header>
</DataGridTextColumn>-->
<DataGridTemplateColumn Width="0.2*">
</DataGridTextColumn>
<!--<DataGridTemplateColumn Width="0.2*">

<DataGridTemplateColumn.Header>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" >
@@ -359,15 +361,15 @@
<TextBox Text="{Binding Password}" Style="{StaticResource textboxStyle}"></TextBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<!--<DataGridTextColumn FontSize="16" IsReadOnly="False" Width="0.2*" Binding="{Binding Password}" ElementStyle="{StaticResource dgCell}" >
</DataGridTemplateColumn>-->
<DataGridTextColumn FontSize="16" IsReadOnly="False" Width="0.2*" Binding="{Binding Password}" ElementStyle="{StaticResource dgCell}" >
<DataGridTextColumn.Header>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<TextBlock FontFamily="../Resources/fonts/#iconfont" Foreground="Orange" Text="&#xe62b;" VerticalAlignment="Center" Margin="0,0,8,0"/>
<TextBlock Text="Password"/>
</StackPanel>
</DataGridTextColumn.Header>
</DataGridTextColumn>-->
</DataGridTextColumn>
<DataGridTemplateColumn Width="0.2*">
<DataGridTemplateColumn.Header>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
@@ -377,12 +379,12 @@
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ComboBox Text="{Binding permission}" Template="{DynamicResource ComboBoxTemplate}" ItemsSource="{Binding DataContext.Authorities, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}, Mode=FindAncestor}}" IsEditable="False" Foreground="SkyBlue" VerticalContentAlignment="Center" Width="auto" FontSize="16" HorizontalContentAlignment="Center" >
<ComboBox Text="{Binding permission}" Template="{DynamicResource ComboBoxTemplate}" ItemsSource="{Binding DataContext.Authorities, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}, Mode=FindAncestor}}" IsEditable="False" Foreground="Cyan" VerticalContentAlignment="Center" Width="auto" FontSize="16" HorizontalContentAlignment="Center" >
<ComboBox.ItemContainerStyle>
<Style TargetType="{x:Type ComboBoxItem}">
<Setter Property="FontSize" Value="16"/>
<Setter Property="Background" Value="SkyBlue" />
<Setter Property="Foreground" Value="Aqua"/>
<Setter Property="Background" Value="White" />
<Setter Property="Foreground" Value="#FF2AB2E7"/>
</Style>
</ComboBox.ItemContainerStyle>
</ComboBox>
@@ -406,9 +408,9 @@
<!--<ColumnDefinition/>-->
</Grid.ColumnDefinitions>
<Button Command="{Binding DataContext.SaveCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}"
CommandParameter="{Binding Account}" Template="{DynamicResource ButtonTemplate1}" Style="{StaticResource btnStyle}" Content="Save" Margin="5,0"></Button>
CommandParameter="{Binding UserName}" Template="{DynamicResource ButtonTemplate1}" Style="{StaticResource btnStyle}" Foreground="Cyan" Content="Save" Margin="5,0"></Button>
<!--<Button Command="{Binding DataContext.UpdateCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" Template="{DynamicResource ButtonTemplate1}" Style="{StaticResource btnStyle}" Content="Update" Grid.Column="1" Margin="5,0"></Button>-->
<Button Command="{Binding DataContext.DeleteCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" CommandParameter="{Binding Account}" Template="{DynamicResource ButtonTemplate1}" Style="{StaticResource btnStyle}" Content="Delete" Grid.Column="1" Margin="5,0"></Button>
<Button Command="{Binding DataContext.DeleteCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" CommandParameter="{Binding Account}" Template="{DynamicResource ButtonTemplate1}" Style="{StaticResource btnStyle}" Content="Delete" Grid.Column="1" Foreground="Cyan" Margin="5,0"></Button>
</Grid>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>


+ 16
- 1
FryPot_DosingSystem/ViewModel/DebugViewModel.cs Целия файл

@@ -21,6 +21,7 @@ namespace FryPot_DosingSystem.ViewModel
public RelayCommand EightWorkLoc { get; set; }
public RelayCommand FryPotInputArrive { get; set; }
public RelayCommand FryPotEmptyRollerArrive { get; set; }
public RelayCommand LineOneTaskExit { get; set; }


public RelayCommand AGVLOneArrive { get; set; }
@@ -33,6 +34,7 @@ namespace FryPot_DosingSystem.ViewModel
//public RelayCommand EightWorkLoc { get; set; }
public RelayCommand FryPotTwoInputArrive { get; set; }
public RelayCommand FryPotTwoEmptyRollerArrive { get; set; }
public RelayCommand LineTwoTaskExit { get; set; }


public RelayCommand AGVLTwoArrive { get; set; }
@@ -44,7 +46,7 @@ namespace FryPot_DosingSystem.ViewModel
//public RelayCommand EightWorkLoc { get; set; }
public RelayCommand FryPotThreeInputArrive { get; set; }
public RelayCommand FryPotThreeEmptyRollerArrive { get; set; }
public RelayCommand LineThreeTaskExit { get; set; }

public RelayCommand AGVLThreeArrive { get; set; }
public RelayCommand AGVFryPotThreeDownArrive { get; set; }
@@ -160,6 +162,19 @@ namespace FryPot_DosingSystem.ViewModel
{
ActionManage.GetInstance.Send("AGVFryPotThreeGetEmptyRoller");
}));

LineOneTaskExit = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("LineOneTaskExit");
}));
LineTwoTaskExit = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("LineTwoTaskExit");
}));
LineThreeTaskExit = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("LineThreeTaskExit");
}));
}
}
}

+ 73
- 0
FryPot_DosingSystem/ViewModel/FryPotMonitorViewModel.cs Целия файл

@@ -0,0 +1,73 @@
using FryPot_DosingSystem.Attributes;
using FryPot_DosingSystem.Model;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace FryPot_DosingSystem.ViewModel
{
internal class FryPotMonitorViewModel:ObservableObject
{
public ObservableCollection<VariableMonitorModel> variableMonitorModels { get; set; } = new ObservableCollection<VariableMonitorModel>();
public int id { get; set; } = 0;
public FryPotMonitorViewModel()
{
variableMonitorModels = FryPotInfoManage.GetInstance.variableInfos;
// if (variableMonitorModels.Count > 0)
// {
// variableMonitorModels.Clear();
// }
//PropertyInfo[] pros= FryPotMonitorManage.GetInstance.fryOne.GetType().GetProperties();
// foreach (var item in pros)
// {
// var monitor = item.GetCustomAttribute<VariableAttribute>();
// if (monitor != null)
// {
// variableMonitorModels.Add(new VariableMonitorModel { Id=id+1,VarName=monitor.VarName,PLCAddress=monitor.PLCAddress,Notes=monitor.Notes,ModbusTcpAddress=monitor.ModbusTcpAddress });
// }
// }
// PropertyInfo[] pros2 = FryPotMonitorManage.GetInstance.fryTwo.GetType().GetProperties();
// foreach (var item in pros2)
// {
// var monitor = item.GetCustomAttribute<VariableAttribute>();
// if (monitor != null)
// {
// variableMonitorModels.Add(new VariableMonitorModel { Id = id + 1, VarName = monitor.VarName, PLCAddress = monitor.PLCAddress, Notes = monitor.Notes, ModbusTcpAddress = monitor.ModbusTcpAddress });
// }
// }
// PropertyInfo[] pros3 = FryPotMonitorManage.GetInstance.fryThree.GetType().GetProperties();
// foreach (var item in pros3)
// {
// var monitor = item.GetCustomAttribute<VariableAttribute>();
// if (monitor != null)
// {
// variableMonitorModels.Add(new VariableMonitorModel { Id = id + 1, VarName = monitor.VarName, PLCAddress = monitor.PLCAddress, Notes = monitor.Notes, ModbusTcpAddress = monitor.ModbusTcpAddress });
// }
// }
// PropertyInfo[] pros4 = FryPotMonitorManage.GetInstance.fryFour.GetType().GetProperties();
// foreach (var item in pros4)
// {
// var monitor = item.GetCustomAttribute<VariableAttribute>();
// if (monitor != null)
// {
// variableMonitorModels.Add(new VariableMonitorModel { Id = id + 1, VarName = monitor.VarName, PLCAddress = monitor.PLCAddress, Notes = monitor.Notes, ModbusTcpAddress = monitor.ModbusTcpAddress });
// }
// }
// PropertyInfo[] pros5 = FryPotMonitorManage.GetInstance.fryFive.GetType().GetProperties();
// foreach (var item in pros5)
// {
// var monitor = item.GetCustomAttribute<VariableAttribute>();
// if (monitor != null)
// {
// variableMonitorModels.Add(new VariableMonitorModel { Id = id + 1, VarName = monitor.VarName, PLCAddress = monitor.PLCAddress, Notes = monitor.Notes, ModbusTcpAddress = monitor.ModbusTcpAddress });
// }
// }

}
}
}

+ 176
- 0
FryPot_DosingSystem/ViewModel/SqliteDataViewModel.cs Целия файл

@@ -0,0 +1,176 @@
using BPASmartClient.Helper;
using FryPot_DosingSystem.FryPotStatus;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace FryPot_DosingSystem.ViewModel
{
internal class SqliteDataViewModel : ObservableObject
{
public ObservableCollection<PotOneStatus> StatusOne { get; set; } = new ObservableCollection<PotOneStatus>();
public ObservableCollection<PotTwoStatus> StatusTwo { get; set; } = new ObservableCollection<PotTwoStatus>();
public ObservableCollection<PotThreeStatus> StatusThree { get; set; } = new ObservableCollection<PotThreeStatus>();
public ObservableCollection<PotFourStatus> StatusFour { get; set; } = new ObservableCollection<PotFourStatus>();
public ObservableCollection<PotFiveStatus> StatusFive { get; set; } = new ObservableCollection<PotFiveStatus>();

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

public Visibility fryTwoDataVisible { get { return _fryTwoDataVisible; } set { _fryTwoDataVisible = value; OnPropertyChanged(); } }
private Visibility _fryTwoDataVisible=Visibility.Collapsed;

public Visibility fryThreeDataVisible { get { return _fryThreeDataVisible; } set { _fryThreeDataVisible = value; OnPropertyChanged(); } }
private Visibility _fryThreeDataVisible = Visibility.Collapsed;
public Visibility fryFourDataVisible { get { return _fryFourDataVisible; } set { _fryFourDataVisible = value; OnPropertyChanged(); } }
private Visibility _fryFourDataVisible = Visibility.Collapsed;
public Visibility fryFiveDataVisible { get { return _fryFiveDataVisible; } set { _fryFiveDataVisible = value; OnPropertyChanged(); } }
private Visibility _fryFiveDataVisible = Visibility.Collapsed;

public List<string> list { get; set; } = new List<string>() { "1号炒锅", "2号炒锅", "3号炒锅", "4号炒锅", "5号炒锅" };
public string SelectedDate { get; set; }
public string cboSelectedValue { get; set; }
public RelayCommand SelectCommand { get; set; }
public SqliteDataViewModel()
{
SelectCommand = new RelayCommand(() =>
{
if (SelectedDate != string.Empty && SelectedDate != "" && SelectedDate != null && cboSelectedValue != null && cboSelectedValue != string.Empty && cboSelectedValue != "")
{
if (cboSelectedValue == "1号炒锅")
{
List<PotOneStatus> listOne = Sqlite<PotOneStatus>.GetInstance.Base.ToList();
var list = listOne.Where(p => p.Time.Equals(Convert.ToDateTime(SelectedDate).ToShortDateString()));
if (list != null && list.Count() != 0)
{
if (StatusOne.Count > 0)
{
StatusOne.Clear();
}
foreach (var item in list)
{
StatusOne.Add(item);
}
fryOneDataVisible = Visibility.Visible;
fryTwoDataVisible = Visibility.Collapsed;
fryThreeDataVisible = Visibility.Collapsed;
fryFourDataVisible = Visibility.Collapsed;
fryFiveDataVisible = Visibility.Collapsed;
}
else
{
MessageBox.Show("未找到对应数据","提示",MessageBoxButton.OK,MessageBoxImage.Information);
}
}
if (cboSelectedValue == "2号炒锅")
{
List<PotTwoStatus> listTwo = Sqlite<PotTwoStatus>.GetInstance.Base.ToList();
var list = listTwo.Where(p => p.Time.Equals(Convert.ToDateTime(SelectedDate).ToShortDateString()));
if (list != null && list.Count() != 0)
{
if (StatusTwo.Count > 0)
{
StatusTwo.Clear();
}
foreach (var item in list)
{
StatusTwo.Add(item);
}
fryOneDataVisible = Visibility.Collapsed;
fryTwoDataVisible = Visibility.Visible;
fryThreeDataVisible = Visibility.Collapsed;
fryFourDataVisible = Visibility.Collapsed;
fryFiveDataVisible = Visibility.Collapsed;
}
else
{
MessageBox.Show("未找到对应数据", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
}
}
if (cboSelectedValue == "3号炒锅")
{
List<PotThreeStatus> listThree = Sqlite<PotThreeStatus>.GetInstance.Base.ToList();
var list = listThree.Where(p => p.Time.Equals(Convert.ToDateTime(SelectedDate).ToShortDateString()));
if (list != null && list.Count() != 0)
{
if (StatusThree.Count > 0)
{
StatusThree.Clear();
}
foreach (var item in list)
{
StatusThree.Add(item);
}
fryOneDataVisible = Visibility.Collapsed;
fryTwoDataVisible = Visibility.Collapsed;
fryThreeDataVisible = Visibility.Visible;
fryFourDataVisible = Visibility.Collapsed;
fryFiveDataVisible = Visibility.Collapsed;
}
else
{
MessageBox.Show("未找到对应数据", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
}
}
if (cboSelectedValue == "4号炒锅")
{
List<PotFourStatus> listFour = Sqlite<PotFourStatus>.GetInstance.Base.ToList();
var list = listFour.Where(p => p.Time.Equals(Convert.ToDateTime(SelectedDate).ToShortDateString()));
if (list != null&&list.Count()!=0)
{
if (StatusFour.Count > 0)
{
StatusFour.Clear();
}
foreach (var item in list)
{
StatusFour.Add(item);
}
fryOneDataVisible = Visibility.Collapsed;
fryTwoDataVisible = Visibility.Collapsed;
fryThreeDataVisible = Visibility.Collapsed;
fryFourDataVisible = Visibility.Visible;
fryFiveDataVisible = Visibility.Collapsed;
}
else
{
MessageBox.Show("未找到对应数据", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
}
}
if (cboSelectedValue == "5号炒锅")
{
List<PotFiveStatus> listFive = Sqlite<PotFiveStatus>.GetInstance.Base.ToList();
var list = listFive.Where(p => p.Time.Equals(Convert.ToDateTime(SelectedDate).ToShortDateString()));
if (list != null && list.Count() != 0)
{
if (StatusFive.Count > 0)
{
StatusFive.Clear();
}
foreach (var item in list)
{
StatusFive.Add(item);
}
fryOneDataVisible = Visibility.Collapsed;
fryTwoDataVisible = Visibility.Collapsed;
fryThreeDataVisible = Visibility.Collapsed;
fryFourDataVisible = Visibility.Collapsed;
fryFiveDataVisible = Visibility.Visible;
}
else
{
MessageBox.Show("未找到对应数据", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
}
}
}
});
}
}
}

+ 0
- 1
FryPot_DosingSystem/ViewModel/UserManageViewModel.cs Целия файл

@@ -22,7 +22,6 @@ namespace FryPot_DosingSystem.ViewModel
public List<string> Authorities { get; set; } = new List<string>();

public RelayCommand<string> SaveCommand { get; set; }
public RelayCommand<string> UpdateCommand { get; set; }
public RelayCommand<string> DeleteCommand { get; set; }
public UserManageViewModel()
{


+ 0
- 23
SmartClient.sln Целия файл

@@ -114,8 +114,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestDemo", "TestDemo\TestDe
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.HubHelper", "BPASmartClient.HubHelper\BPASmartClient.HubHelper.csproj", "{099E047C-F40E-47A3-A5BA-81FC1500D5E8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MorkTM", "BPASmartClient.MorkTM\BPASmartClient.MorkTM.csproj", "{76B6B333-0109-4EE8-A9B2-3E53A7421D92}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -1070,26 +1068,6 @@ Global
{099E047C-F40E-47A3-A5BA-81FC1500D5E8}.Release|x64.Build.0 = Release|Any CPU
{099E047C-F40E-47A3-A5BA-81FC1500D5E8}.Release|x86.ActiveCfg = Release|Any CPU
{099E047C-F40E-47A3-A5BA-81FC1500D5E8}.Release|x86.Build.0 = Release|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Debug|Any CPU.Build.0 = Debug|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Debug|ARM.ActiveCfg = Debug|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Debug|ARM.Build.0 = Debug|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Debug|ARM64.Build.0 = Debug|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Debug|x64.ActiveCfg = Debug|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Debug|x64.Build.0 = Debug|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Debug|x86.ActiveCfg = Debug|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Debug|x86.Build.0 = Debug|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Release|Any CPU.ActiveCfg = Release|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Release|Any CPU.Build.0 = Release|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Release|ARM.ActiveCfg = Release|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Release|ARM.Build.0 = Release|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Release|ARM64.ActiveCfg = Release|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Release|ARM64.Build.0 = Release|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Release|x64.ActiveCfg = Release|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Release|x64.Build.0 = Release|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Release|x86.ActiveCfg = Release|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -1142,7 +1120,6 @@ Global
{E7168B03-68E5-4285-BB95-5660F877577A} = {8712125E-14CD-4E1B-A1CE-4BDE03805942}
{A49E1C5A-9489-451C-9CE6-CEA586234B84} = {8712125E-14CD-4E1B-A1CE-4BDE03805942}
{099E047C-F40E-47A3-A5BA-81FC1500D5E8} = {3D1D0E04-03FD-480A-8CF8-6E01A2E28625}
{76B6B333-0109-4EE8-A9B2-3E53A7421D92} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9AEC9B81-0222-4DE9-B642-D915C29222AC}


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