@@ -44,17 +44,20 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||
{ | |||
lock (userlock) | |||
{ | |||
UserLog userLog = new UserLog() | |||
if (!string.IsNullOrEmpty(Global.userInfo.UserName) && !string.IsNullOrEmpty(Global.userInfo.permission.ToString())&& !string.IsNullOrEmpty(info)) | |||
{ | |||
Date = DateTime.Now.ToString("yyyy-MM-dd"), | |||
Time = DateTime.Now.ToString("HH:mm:ss"), | |||
Permission = Global.userInfo.permission.ToString(), | |||
UserName = Global.userInfo.UserName, | |||
LogInfo = info | |||
}; | |||
Sqlite<UserLog>.GetInstance.Base.Add(userLog); | |||
Application.Current.Dispatcher.Invoke(new Action(() => { userLogs.Insert(0, userLog); })); | |||
UserLog?.Invoke(info); | |||
UserLog userLog = new UserLog() | |||
{ | |||
Date = DateTime.Now.ToString("yyyy-MM-dd"), | |||
Time = DateTime.Now.ToString("HH:mm:ss"), | |||
Permission = Global.userInfo.permission.ToString(), | |||
UserName = Global.userInfo.UserName, | |||
LogInfo = info | |||
}; | |||
Sqlite<UserLog>.GetInstance.Base.Add(userLog); | |||
Application.Current.Dispatcher.Invoke(new Action(() => { userLogs.Insert(0, userLog); })); | |||
UserLog?.Invoke(info); | |||
} | |||
} | |||
} | |||
@@ -0,0 +1,6 @@ | |||
<?xml version="1.0" encoding="utf-8" ?> | |||
<configuration> | |||
<appSettings> | |||
<add key="HKPlc_IP" value="192.168.0.15"/> | |||
</appSettings> | |||
</configuration> |
@@ -0,0 +1,36 @@ | |||
<Application x:Class="BPASmartClient.DosingProject.App" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingProject" | |||
xmlns:con="clr-namespace:BPASmartClient.CustomResource.Converters;assembly=BPASmartClient.CustomResource"> | |||
<Application.Resources> | |||
<ResourceDictionary> | |||
<ResourceDictionary.MergedDictionaries> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecCheckBox.xaml" /> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecTitleBarButton.xaml" /> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/GlobalStyle.xaml" /> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecComboBox.xaml" /> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecIcoButtonStyle.xaml" /> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecToggleButton.xaml" /> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/BeveledRadioButtonStyle.xaml" /> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/DatePickeerDictionary.xaml" /> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecButtonStyle.xaml" /> | |||
<ResourceDictionary> | |||
<con:ColorConverter x:Key="ColorConverter" /> | |||
<con:TextConverter x:Key="TextConverter" /> | |||
<con:VisibleTypeConverter x:Key="VisibleTypeConverter" /> | |||
<con:StatusConverter x:Key="StatusConverter" /> | |||
<con:StringToIconConverter x:Key="StringToIconConverter" /> | |||
</ResourceDictionary> | |||
<ResourceDictionary> | |||
<ImageBrush x:Key="hbl" ImageSource="/BPASmartClient.CustomResource;component/Image/HBL.png" /> | |||
<ImageBrush x:Key="dbxt" ImageSource="/BPASmartClient.CustomResource;component/Image/顶部线条.png" /> | |||
</ResourceDictionary> | |||
</ResourceDictionary.MergedDictionaries> | |||
</ResourceDictionary> | |||
</Application.Resources> | |||
</Application> |
@@ -0,0 +1,252 @@ | |||
using BPASmartClient.CustomResource.Pages.Enums; | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
using BPASmartClient.CustomResource.Pages.View; | |||
using BPASmartClient.DosingHKProject.Model; | |||
using BPASmartClient.Helper; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Configuration; | |||
using System.Data; | |||
using System.Linq; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
namespace BPASmartClient.DosingProject | |||
{ | |||
/// <summary> | |||
/// Interaction logic for App.xaml | |||
/// </summary> | |||
public partial class App : Application | |||
{ | |||
public static Window MainWindow; | |||
protected override void OnStartup(StartupEventArgs e) | |||
{ | |||
base.OnStartup(e); | |||
MenuInit(); | |||
DataInit(); | |||
DeviceInquire.GetInstance.Init();//配料机设备上线监听,设备列表初始化 | |||
ProcessControl.GetInstance.Init(); | |||
MainView mv = new MainView(); | |||
LoginView lv = new LoginView(); | |||
var res = lv.ShowDialog(); | |||
if (res != null && res == true) | |||
{ | |||
MessageLog.GetInstance.ShowUserLog("用户登录"); | |||
mv.Show(); | |||
} | |||
else | |||
mv.Close(); | |||
MainWindow = mv; | |||
} | |||
protected override void OnExit(ExitEventArgs e) | |||
{ | |||
base.OnExit(e); | |||
Json<LocaPar>.Save(); | |||
MessageLog.GetInstance.LogSave(); | |||
ThreadManage.GetInstance().Dispose(); | |||
} | |||
private void MenuInit() | |||
{ | |||
//NfcServer.GetInstance.Init(); | |||
#region 配方管理菜单 | |||
ObservableCollection<SubMenumodel> RecipeManage = new ObservableCollection<SubMenumodel>(); | |||
RecipeManage.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "味魔方配方管理", | |||
SubMenuPermission = new Permission[] { Permission.管理员 }, | |||
AssemblyName = "BPASmartClient.DosingHKProject", | |||
ToggleWindowPath = "View.RecipeSettingsView" | |||
}); | |||
RecipeManage.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "味魔方配方下发", | |||
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员 }, | |||
AssemblyName = "BPASmartClient.DosingHKProject", | |||
ToggleWindowPath = "View.RecipeControlView" | |||
}); | |||
RecipeManage.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "本地配方管理", | |||
SubMenuPermission = new Permission[] { Permission.管理员 }, | |||
AssemblyName = "BPASmartClient.DosingHKProject", | |||
ToggleWindowPath = "View.RecipeReceiveView" | |||
}); | |||
RecipeManage.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "西门子配方管理", | |||
SubMenuPermission = new Permission[] { Permission.管理员 }, | |||
AssemblyName = "BPASmartClient.DosingHKProject", | |||
ToggleWindowPath = "View.SiemensRecipeReceiveView" | |||
}); | |||
MenuManage.GetInstance.menuModels.Add(new MenuModel() | |||
{ | |||
MainMenuIcon = "", | |||
MainMenuName = "配方管理", | |||
Alias = "Recipe Management", | |||
subMenumodels = RecipeManage, | |||
}); | |||
#endregion | |||
#region 参数设置 | |||
ObservableCollection<SubMenumodel> ParSet = new ObservableCollection<SubMenumodel>(); | |||
ParSet.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "柔性味魔方参数设置", | |||
SubMenuPermission = new Permission[] { Permission.管理员 }, | |||
AssemblyName = "BPASmartClient.DosingHKProject", | |||
ToggleWindowPath = "View.DeviceMaterialParView" | |||
}); | |||
MenuManage.GetInstance.menuModels.Add(new MenuModel() | |||
{ | |||
MainMenuIcon = "", | |||
MainMenuName = "参数设置", | |||
Alias = "Parameter Set", | |||
subMenumodels = ParSet, | |||
}); | |||
#endregion | |||
#region 手动控制 | |||
ObservableCollection<SubMenumodel> ManualControl = new ObservableCollection<SubMenumodel>(); | |||
ManualControl.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "手动控制", | |||
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 }, | |||
AssemblyName = "BPASmartClient.DosingHKProject", | |||
ToggleWindowPath = "View.ManualControlView" | |||
}); | |||
MenuManage.GetInstance.menuModels.Add(new MenuModel() | |||
{ | |||
MainMenuIcon = "", | |||
MainMenuName = "手动控制", | |||
Alias = "Parameter Set", | |||
subMenumodels = ManualControl, | |||
}); | |||
#endregion | |||
#region 消息日志 | |||
ObservableCollection<SubMenumodel> InfoLog = new ObservableCollection<SubMenumodel>(); | |||
InfoLog.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "操作日志", | |||
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 }, | |||
AssemblyName = "BPASmartClient.CustomResource", | |||
ToggleWindowPath = "Pages.View.UserLogView" | |||
}); | |||
InfoLog.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "运行日志", | |||
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 }, | |||
AssemblyName = "BPASmartClient.CustomResource", | |||
ToggleWindowPath = "Pages.View.RunLogView" | |||
}); | |||
InfoLog.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "报警记录", | |||
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 }, | |||
AssemblyName = "BPASmartClient.CustomResource", | |||
ToggleWindowPath = "Pages.View.AlarmView" | |||
}); | |||
InfoLog.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "调试日志", | |||
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员, Permission.技术员 }, | |||
AssemblyName = "BPASmartClient.CustomResource", | |||
ToggleWindowPath = "Pages.View.DebugLogView" | |||
}); | |||
MenuManage.GetInstance.menuModels.Add(new MenuModel() | |||
{ | |||
MainMenuIcon = "", | |||
MainMenuName = "消息日志", | |||
Alias = "Message Log", | |||
subMenumodels = InfoLog, | |||
}); | |||
#endregion | |||
#region 硬件设备监控 | |||
ObservableCollection<SubMenumodel> DeviceMonitor = new ObservableCollection<SubMenumodel>(); | |||
DeviceMonitor.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "原料设备列表", | |||
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 }, | |||
AssemblyName = "BPASmartClient.DosingHKProject", | |||
ToggleWindowPath = "View.DeviceListView" | |||
}); | |||
DeviceMonitor.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "设备状态", | |||
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 }, | |||
AssemblyName = "BPASmartClient.DosingHKProject", | |||
ToggleWindowPath = "View.HardwareStatusView" | |||
}); | |||
MenuManage.GetInstance.menuModels.Add(new MenuModel() | |||
{ | |||
MainMenuIcon = "", | |||
MainMenuName = "设备监控", | |||
Alias = "Device Monitor", | |||
subMenumodels = DeviceMonitor, | |||
}); | |||
#endregion | |||
#region 用户管理 | |||
ObservableCollection<SubMenumodel> UserManager = new ObservableCollection<SubMenumodel>(); | |||
UserManager.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "用户登录", | |||
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 }, | |||
AssemblyName = "BPASmartClient.CustomResource", | |||
ToggleWindowPath = "Pages.View.SubPagLoginView" | |||
}); | |||
UserManager.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "密码修改", | |||
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 }, | |||
AssemblyName = "BPASmartClient.CustomResource", | |||
ToggleWindowPath = "Pages.View.PasswordChangeView" | |||
}); | |||
UserManager.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "用户管理", | |||
SubMenuPermission = new Permission[] { Permission.管理员 }, | |||
AssemblyName = "BPASmartClient.CustomResource", | |||
ToggleWindowPath = "Pages.View.UserManagerView" | |||
}); | |||
/* UserManager.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "NFC登录设置", | |||
SubMenuPermission = new Permission[] { Permission.管理员 }, | |||
AssemblyName = "BPASmartClient.CustomResource", | |||
ToggleWindowPath = "Pages.View.NfcSetView" | |||
});*/ | |||
MenuManage.GetInstance.menuModels.Add(new MenuModel() | |||
{ | |||
MainMenuIcon = "", | |||
MainMenuName = "用户管理", | |||
Alias = "User Management", | |||
subMenumodels = UserManager, | |||
}); | |||
#endregion | |||
} | |||
private void DataInit() | |||
{ | |||
//Config.GetInstance.Init(); | |||
Json<LocaPar>.Read(); | |||
Json<DevicePar>.Read(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,10 @@ | |||
using System.Windows; | |||
[assembly: ThemeInfo( | |||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located | |||
//(used if a resource is not found in the page, | |||
// or application resource dictionaries) | |||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located | |||
//(used if a resource is not found in the page, | |||
// app, or any theme specific resource dictionaries) | |||
)] |
@@ -0,0 +1,76 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<OutputType>WinExe</OutputType> | |||
<TargetFramework>net6.0-windows</TargetFramework> | |||
<Nullable>enable</Nullable> | |||
<UseWPF>true</UseWPF> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<PackageReference Include="BPA.Message" Version="1.0.60" /> | |||
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\BPASmartClient.CustomResource\BPASmartClient.CustomResource.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.Modbus\BPASmartClient.Modbus.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.S7Net\BPASmartClient.S7Net.csproj" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Page Update="View\ChangeDeviceNameView.xaml"> | |||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | |||
<SubType>Designer</SubType> | |||
</Page> | |||
<Page Update="View\DeviceListView.xaml"> | |||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | |||
<SubType>Designer</SubType> | |||
</Page> | |||
<Page Update="View\DeviceMaterialParView.xaml"> | |||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | |||
<SubType>Designer</SubType> | |||
</Page> | |||
<Page Update="View\HardwareStatusView.xaml"> | |||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | |||
<SubType>Designer</SubType> | |||
</Page> | |||
<Page Update="View\ManualControlView.xaml"> | |||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | |||
<SubType>Designer</SubType> | |||
</Page> | |||
<Page Update="View\NewLocalRecipeView.xaml"> | |||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | |||
<SubType>Designer</SubType> | |||
</Page> | |||
<Page Update="View\NewMaterialView.xaml"> | |||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | |||
<SubType>Designer</SubType> | |||
</Page> | |||
<Page Update="View\NewRecipeView.xaml"> | |||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | |||
<SubType>Designer</SubType> | |||
</Page> | |||
<Page Update="View\RecipeControlView.xaml"> | |||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | |||
<SubType>Designer</SubType> | |||
</Page> | |||
<Page Update="View\RecipeInfosView.xaml"> | |||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | |||
<SubType>Designer</SubType> | |||
</Page> | |||
<Page Update="View\RecipeReceiveView.xaml"> | |||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | |||
<SubType>Designer</SubType> | |||
</Page> | |||
<Page Update="View\RecipeSettingsView.xaml"> | |||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | |||
<SubType>Designer</SubType> | |||
</Page> | |||
<Page Update="View\SiemensRecipeReceiveView.xaml"> | |||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | |||
<SubType>Designer</SubType> | |||
</Page> | |||
</ItemGroup> | |||
</Project> |
@@ -0,0 +1,12 @@ | |||
<Window x:Class="BPASmartClient.DosingProject.MainWindow" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingProject" | |||
mc:Ignorable="d" | |||
Title="MainWindow" Height="450" Width="800"> | |||
<Grid> | |||
</Grid> | |||
</Window> |
@@ -0,0 +1,28 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using System.Windows.Controls; | |||
using System.Windows.Data; | |||
using System.Windows.Documents; | |||
using System.Windows.Input; | |||
using System.Windows.Media; | |||
using System.Windows.Media.Imaging; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
namespace BPASmartClient.DosingProject | |||
{ | |||
/// <summary> | |||
/// Interaction logic for MainWindow.xaml | |||
/// </summary> | |||
public partial class MainWindow : Window | |||
{ | |||
public MainWindow() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,31 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Globalization; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows.Data; | |||
using System.Windows.Media; | |||
namespace BPASmartClient.DosingHKProject.Converter | |||
{ | |||
public class DataTableRedundantConverter : IValueConverter | |||
{ | |||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | |||
{ | |||
if (value != null && value is bool bit) | |||
{ | |||
if (bit) | |||
return new SolidColorBrush(Color.FromArgb(255, 245, 63, 98)); | |||
else | |||
return new SolidColorBrush(Color.FromArgb(255, 42, 178, 231)); | |||
} | |||
return default; | |||
} | |||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | |||
{ | |||
throw new NotImplementedException(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,68 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Globalization; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows.Data; | |||
namespace BPASmartClient.DosingHKProject.Converter | |||
{ | |||
public class RunStatusConvert : IValueConverter | |||
{ | |||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | |||
{ | |||
if (value is ushort tempValue) | |||
{ | |||
if (tempValue == 1) return "等待配料"; | |||
if (tempValue == 2) return "配料中"; | |||
if (tempValue == 3) return "配料完成"; | |||
} | |||
return "等待配料"; | |||
} | |||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | |||
{ | |||
throw new NotImplementedException(); | |||
} | |||
} | |||
public class EnbleConvert : IValueConverter | |||
{ | |||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | |||
{ | |||
if (value is ushort tempValue) | |||
{ | |||
if (tempValue == 0) return true; | |||
if (tempValue == 1) return false; | |||
} | |||
return true; | |||
} | |||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | |||
{ | |||
throw new NotImplementedException(); | |||
} | |||
} | |||
public class IntToSourceConvert : IValueConverter | |||
{ | |||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | |||
{ | |||
if (value is ushort tempValue) | |||
{ | |||
if (tempValue == 0) return "本地原料"; | |||
if (tempValue == 1) return "设备原料"; | |||
} | |||
return "未知"; | |||
} | |||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | |||
{ | |||
throw new NotImplementedException(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,12 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.DosingHKProject.Model.GVL | |||
{ | |||
public class GVL | |||
{ | |||
} | |||
} |
@@ -0,0 +1,117 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.DosingHKProject.Model.GVL | |||
{ | |||
public class ReadSmallMaterial | |||
{ | |||
/// <summary> | |||
/// PLC到上位机心跳 | |||
/// </summary> | |||
public bool Heart { get; set; } | |||
public bool Agv1 { get; set; } | |||
public bool Agv2 { get; set; } | |||
public bool Agv3 { get; set; } | |||
public bool Agv4 { get; set; } | |||
public bool Agv5 { get; set; } | |||
public bool Agv6 { get; set; } | |||
/// <summary> | |||
/// 1#托盘工位占用 | |||
/// </summary> | |||
public bool Tray1BeOccupied { get; set; } | |||
/// <summary> | |||
/// 2#托盘工位占用 | |||
/// </summary> | |||
public bool Tray2BeOccupied { get; set; } | |||
/// <summary> | |||
/// 1#托盘工位配料完成 | |||
/// </summary> | |||
public bool Tray1MaterialFinish { get; set; } | |||
/// <summary> | |||
/// 2#托盘工位配料完成 | |||
/// </summary> | |||
public bool Tray2MaterialFinish { get; set; } | |||
/// <summary> | |||
/// 接收托盘1配方数据完成 | |||
/// </summary> | |||
public bool Tray1ReceiveFinish { get; set; } | |||
/// <summary> | |||
/// 接收托盘2配方数据完成 | |||
/// </summary> | |||
public bool Tray2ReceiveFinish { get; set; } | |||
public int Reserve1 { get; set; } | |||
public int Receive2 { get; set; } | |||
/// <summary> | |||
/// 托盘1_1#桶位置反馈 | |||
/// </summary> | |||
public float Tray1Barrel1Location { get; set; } | |||
/// <summary> | |||
/// 托盘1_2#桶位置反馈 | |||
/// </summary> | |||
public float Tray1Barrel2Location { get; set; } | |||
/// <summary> | |||
/// 托盘1_3#桶位置反馈 | |||
/// </summary> | |||
public float Tray1Barrel3Location { get; set; } | |||
/// <summary> | |||
/// 托盘1_4#桶位置反馈 | |||
/// </summary> | |||
public float Tray1Barrel4Location { get; set; } | |||
/// <summary> | |||
/// 托盘2_1#桶位置反馈 | |||
/// </summary> | |||
public float Tray2Barrel1Location { get; set; } | |||
/// <summary> | |||
/// 托盘2_2#桶位置反馈 | |||
/// </summary> | |||
public float Tray2Barrel2Location { get; set; } | |||
/// <summary> | |||
/// 托盘2_3#桶位置反馈 | |||
/// </summary> | |||
public float Tray2Barrel3Location { get; set; } | |||
/// <summary> | |||
/// 托盘2_4#桶位置反馈 | |||
/// </summary> | |||
public float Tray2Barrel4Location { get; set; } | |||
public int Reserve3 { get; set; } | |||
public int Receive4 { get; set; } | |||
/// <summary> | |||
/// 托盘1_1#桶允许配料 | |||
/// </summary> | |||
public float Tray1Barrel1AllowDosing { get; set; } | |||
/// <summary> | |||
/// 托盘1_2#桶允许配料 | |||
/// </summary> | |||
public float Tray1Barrel2AllowDosing { get; set; } | |||
/// <summary> | |||
/// 托盘1_3#桶允许配料 | |||
/// </summary> | |||
public float Tray1Barrel3AllowDosing { get; set; } | |||
/// <summary> | |||
/// 托盘1_4#桶允许配料 | |||
/// </summary> | |||
public float Tray1Barrel4AllowDosing { get; set; } | |||
/// <summary> | |||
/// 托盘2_1#桶允许配料 | |||
/// </summary> | |||
public float Tray2Barrel1AllowDosing { get; set; } | |||
/// <summary> | |||
/// 托盘2_2#桶允许配料 | |||
/// </summary> | |||
public float Tray2Barrel2AllowDosing { get; set; } | |||
/// <summary> | |||
/// 托盘2_3#桶允许配料 | |||
/// </summary> | |||
public float Tray2Barrel3AllowDosing { get; set; } | |||
/// <summary> | |||
/// 托盘2_4#桶允许配料 | |||
/// </summary> | |||
public float Tray2Barrel4AllowDosing { get; set; } | |||
} | |||
} |
@@ -0,0 +1,185 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.DosingHKProject.Model.GVL | |||
{ | |||
public class WriteSmallMaterial | |||
{ | |||
/// <summary> | |||
/// PLC到上位机心跳 | |||
/// </summary> | |||
public bool Heart { get; set; } | |||
public bool Agv1 { get; set; } | |||
public bool Agv2 { get; set; } | |||
public bool Agv3 { get; set; } | |||
public bool Agv4{ get; set; } | |||
public bool Agv5 { get; set; } | |||
public bool Agv6 { get; set; } | |||
public bool Agv7 { get; set; } | |||
public bool Agv8 { get; set; } | |||
public bool Agv9 { get; set; } | |||
public bool Agv10 { get; set; } | |||
/// <summary> | |||
/// 下发配方到托盘1 | |||
/// </summary> | |||
public bool Tray1IssueRecipe { get; set; } | |||
/// <summary> | |||
/// 下发配方到托盘2 | |||
/// </summary> | |||
public bool Tray2IssueRecipe { get; set; } | |||
public int Reserve1 { get; set; } | |||
public int Receive2 { get; set; } | |||
public bool Tray1Barrel1IsDosing1; | |||
public bool Tray1Barrel1IsDosing2; | |||
public bool Tray1Barrel1IsDosing3; | |||
public bool Tray1Barrel1IsDosing4; | |||
public bool Tray1Barrel1IsDosing5; | |||
public bool Tray1Barrel1IsDosing6; | |||
public bool Tray1Barrel1IsDosing7; | |||
public bool Tray1Barrel1IsDosing8; | |||
public bool Tray1Barrel1IsDosing9; | |||
public bool Tray1Barrel1IsDosing10; | |||
public bool Tray1Barrel1IsDosing11; | |||
public bool Tray1Barrel1IsDosing12; | |||
public bool Tray1Barrel1IsDosing13; | |||
public bool Tray1Barrel1IsDosing14; | |||
public bool Tray1Barrel1IsDosing15; | |||
public bool Receive3; | |||
public bool Tray1Barrel2IsDosing1; | |||
public bool Tray1Barrel2IsDosing2; | |||
public bool Tray1Barrel2IsDosing3; | |||
public bool Tray1Barrel2IsDosing4; | |||
public bool Tray1Barrel2IsDosing5; | |||
public bool Tray1Barrel2IsDosing6; | |||
public bool Tray1Barrel2IsDosing7; | |||
public bool Tray1Barrel2IsDosing8; | |||
public bool Tray1Barrel2IsDosing9; | |||
public bool Tray1Barrel2IsDosing10; | |||
public bool Tray1Barrel2IsDosing11; | |||
public bool Tray1Barrel2IsDosing12; | |||
public bool Tray1Barrel2IsDosing13; | |||
public bool Tray1Barrel2IsDosing14; | |||
public bool Tray1Barrel2IsDosing15; | |||
public bool Receive4; | |||
public bool Tray1Barrel3IsDosing1; | |||
public bool Tray1Barrel3IsDosing2; | |||
public bool Tray1Barrel3IsDosing3; | |||
public bool Tray1Barrel3IsDosing4; | |||
public bool Tray1Barrel3IsDosing5; | |||
public bool Tray1Barrel3IsDosing6; | |||
public bool Tray1Barrel3IsDosing7; | |||
public bool Tray1Barrel3IsDosing8; | |||
public bool Tray1Barrel3IsDosing9; | |||
public bool Tray1Barrel3IsDosing10; | |||
public bool Tray1Barrel3IsDosing11; | |||
public bool Tray1Barrel3IsDosing12; | |||
public bool Tray1Barrel3IsDosing13; | |||
public bool Tray1Barrel3IsDosing14; | |||
public bool Tray1Barrel3IsDosing15; | |||
public bool Receive5; | |||
public bool Tray1Barrel4IsDosing1; | |||
public bool Tray1Barrel4IsDosing2; | |||
public bool Tray1Barrel4IsDosing3; | |||
public bool Tray1Barrel4IsDosing4; | |||
public bool Tray1Barrel4IsDosing5; | |||
public bool Tray1Barrel4IsDosing6; | |||
public bool Tray1Barrel4IsDosing7; | |||
public bool Tray1Barrel4IsDosing8; | |||
public bool Tray1Barrel4IsDosing9; | |||
public bool Tray1Barrel4IsDosing10; | |||
public bool Tray1Barrel4IsDosing11; | |||
public bool Tray1Barrel4IsDosing12; | |||
public bool Tray1Barrel4IsDosing13; | |||
public bool Tray1Barrel4IsDosing14; | |||
public bool Tray1Barrel4IsDosing15; | |||
public bool Receive6; | |||
public bool Tray2Barrel1IsDosing1; | |||
public bool Tray2Barrel1IsDosing2; | |||
public bool Tray2Barrel1IsDosing3; | |||
public bool Tray2Barrel1IsDosing4; | |||
public bool Tray2Barrel1IsDosing5; | |||
public bool Tray2Barrel1IsDosing6; | |||
public bool Tray2Barrel1IsDosing7; | |||
public bool Tray2Barrel1IsDosing8; | |||
public bool Tray2Barrel1IsDosing9; | |||
public bool Tray2Barrel1IsDosing10; | |||
public bool Tray2Barrel1IsDosing11; | |||
public bool Tray2Barrel1IsDosing12; | |||
public bool Tray2Barrel1IsDosing13; | |||
public bool Tray2Barrel1IsDosing14; | |||
public bool Tray2Barrel1IsDosing15; | |||
public bool Receive7; | |||
public bool Tray2Barrel2IsDosing1; | |||
public bool Tray2Barrel2IsDosing2; | |||
public bool Tray2Barrel2IsDosing3; | |||
public bool Tray2Barrel2IsDosing4; | |||
public bool Tray2Barrel2IsDosing5; | |||
public bool Tray2Barrel2IsDosing6; | |||
public bool Tray2Barrel2IsDosing7; | |||
public bool Tray2Barrel2IsDosing8; | |||
public bool Tray2Barrel2IsDosing9; | |||
public bool Tray2Barrel2IsDosing10; | |||
public bool Tray2Barrel2IsDosing11; | |||
public bool Tray2Barrel2IsDosing12; | |||
public bool Tray2Barrel2IsDosing13; | |||
public bool Tray2Barrel2IsDosing14; | |||
public bool Tray2Barrel2IsDosing15; | |||
public bool Receive8; | |||
public bool Tray2Barrel3IsDosing1; | |||
public bool Tray2Barrel3IsDosing2; | |||
public bool Tray2Barrel3IsDosing3; | |||
public bool Tray2Barrel3IsDosing4; | |||
public bool Tray2Barrel3IsDosing5; | |||
public bool Tray2Barrel3IsDosing6; | |||
public bool Tray2Barrel3IsDosing7; | |||
public bool Tray2Barrel3IsDosing8; | |||
public bool Tray2Barrel3IsDosing9; | |||
public bool Tray2Barrel3IsDosing10; | |||
public bool Tray2Barrel3IsDosing11; | |||
public bool Tray2Barrel3IsDosing12; | |||
public bool Tray2Barrel3IsDosing13; | |||
public bool Tray2Barrel3IsDosing14; | |||
public bool Tray2Barrel3IsDosing15; | |||
public bool Receive9; | |||
public bool Tray2Barrel4IsDosing1; | |||
public bool Tray2Barrel4IsDosing2; | |||
public bool Tray2Barrel4IsDosing3; | |||
public bool Tray2Barrel4IsDosing4; | |||
public bool Tray2Barrel4IsDosing5; | |||
public bool Tray2Barrel4IsDosing6; | |||
public bool Tray2Barrel4IsDosing7; | |||
public bool Tray2Barrel4IsDosing8; | |||
public bool Tray2Barrel4IsDosing9; | |||
public bool Tray2Barrel4IsDosing10; | |||
public bool Tray2Barrel4IsDosing11; | |||
public bool Tray2Barrel4IsDosing12; | |||
public bool Tray2Barrel4IsDosing13; | |||
public bool Tray2Barrel4IsDosing14; | |||
public bool Tray2Barrel4IsDosing15; | |||
public bool Receive10; | |||
public int Receive11; | |||
public bool StockIn1DosingFinish; | |||
public bool StockIn2DosingFinish; | |||
public bool StockIn3DosingFinish; | |||
public bool StockIn4DosingFinish; | |||
public bool StockIn5DosingFinish; | |||
public bool StockIn6DosingFinish; | |||
public bool StockIn7DosingFinish; | |||
public bool StockIn8DosingFinish; | |||
public bool StockIn9DosingFinish; | |||
public bool StockIn10DosingFinish; | |||
public bool StockIn11DosingFinish; | |||
public bool StockIn12DosingFinish; | |||
public bool StockIn13DosingFinish; | |||
public bool StockIn14DosingFinish; | |||
public bool StockIn15DosingFinish; | |||
public bool Receive12; | |||
} | |||
} |
@@ -0,0 +1,90 @@ | |||
using BPASmartClient.DosingHKProject.Model.Siemens; | |||
using System; | |||
using System.Collections.Concurrent; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.DosingHKProject.Model | |||
{ | |||
public class GVL_SmallStation | |||
{ | |||
private volatile static GVL_SmallStation SmallStation; | |||
public static GVL_SmallStation GetInstance => SmallStation ?? (SmallStation = new GVL_SmallStation()); | |||
private GVL_SmallStation() { } | |||
/// <summary> | |||
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方 | |||
/// </summary> | |||
public int RecipeStatusID { get; set; } = 0; | |||
/// <summary> | |||
/// Tray1的柔性味魔方配料标志(下发配方时,若柔性味魔方的状态=3,复位该状态) | |||
/// </summary> | |||
public bool DosingTray1 { get; set; } = true;//默认为true,初始时,判断柔性味魔方的状态。 | |||
/// <summary> | |||
/// Tray2的柔性味魔方配料标志 | |||
/// </summary> | |||
public bool DosingTray2 { get; set; } = true; | |||
/// <summary> | |||
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方 | |||
/// </summary> | |||
public int RecipeStatusIDTray2 { get; set; } = 0; | |||
/// <summary> | |||
/// 往输送带下发配方完成 | |||
/// </summary> | |||
public bool IssueRecipeFinishStation2 { get; set; } = false; | |||
public bool IsAllow { get; set; } = false; | |||
public bool IsAllowOut { set; get; } = false; | |||
/// <summary> | |||
/// 当前料仓的位置 | |||
/// </summary> | |||
public int StockInIsWork { get; set; } = 0; | |||
/// <summary> | |||
/// 单个配方执行完成标志 | |||
/// </summary> | |||
public bool RecipeFinish { get; set; } = false; | |||
/// <summary> | |||
/// 记录AGV进站送货的指令顺序 | |||
/// </summary> | |||
public int AgvDeliveryPosition { get; set; }= 0; | |||
/// <summary> | |||
/// 记录AGV进站取货的指令顺序 | |||
/// </summary> | |||
public int AgvPickUpPosition { get; set; } = 0; | |||
/// <summary> | |||
/// 是否使用粉仓 | |||
/// </summary> | |||
public bool IsUseWindSend; | |||
/// <summary> | |||
/// 风送配料完成标志 | |||
/// </summary> | |||
public bool WindSendDosingFinish; | |||
/// <summary> | |||
/// 是否占用托盘1 | |||
/// </summary> | |||
public bool IsOccupationTray1 { get; set; } = true; | |||
/// <summary> | |||
/// 是否占用托盘2 | |||
/// </summary> | |||
public bool IsOccupationTray2 { get; set; } = true; | |||
#region 本地模拟配方 | |||
/// <summary> | |||
/// 是否使用本地模拟配方 | |||
/// </summary> | |||
public bool IsUseLocalRecipe { get; set; } | |||
/// <summary> | |||
/// 是否使用本地模拟订单+风送配方 | |||
/// </summary> | |||
public bool IsUseWindSendDosing { get; set; } | |||
#endregion | |||
} | |||
} |
@@ -0,0 +1,28 @@ | |||
using BPASmartClient.Helper; | |||
using BPASmartClient.Modbus; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using BPASmartClient.S7Net; | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
namespace BPASmartClient.DosingHKProject.Model.HK_PLC | |||
{ | |||
public class HKDeviceStatus | |||
{ | |||
public SiemensHelper HK_PLC_S7 = new SiemensHelper(); | |||
public bool IsConnected => HK_PLC_S7.IsConnected; | |||
public void Init() | |||
{ | |||
if (IsConnected) | |||
{ | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
}),"信号交互"); | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,13 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.DosingHKProject.Model.HK_PLC | |||
{ | |||
public class HKPlcCommAddress | |||
{ | |||
} | |||
} |
@@ -0,0 +1,328 @@ | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
using BPASmartClient.Helper; | |||
using BPASmartClient.DosingHKProject.Model.HK_PLC; | |||
using BPASmartClient.DosingHKProject.Model.Siemens; | |||
using BPASmartClient.Modbus; | |||
using System; | |||
using System.Collections.Concurrent; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Configuration; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading; | |||
using System.Threading.Tasks; | |||
using BPASmartClient.DosingProject; | |||
namespace BPASmartClient.DosingHKProject.Model | |||
{ | |||
public class ProcessControl | |||
{ | |||
private volatile static ProcessControl _Instance; | |||
public static ProcessControl GetInstance => _Instance ?? (_Instance = new ProcessControl()); | |||
private ProcessControl() { } | |||
/// <summary> | |||
/// 配方数据 | |||
/// </summary> | |||
public ObservableCollection<RemoteRecipeData> RemoteRecipes = new ObservableCollection<RemoteRecipeData>(); | |||
/// <summary> | |||
/// 原料的名称和料仓的位置对应 | |||
/// </summary> | |||
public Dictionary<string, short> RawMaterialsNamePos = new Dictionary<string, short>(); | |||
/// <summary> | |||
/// 配方队列 | |||
/// </summary> | |||
public ConcurrentQueue<string> RecipeQueue = new ConcurrentQueue<string>(); | |||
public ConcurrentQueue<string> RecipeQueueTray2 = new ConcurrentQueue<string>(); | |||
public HKDeviceStatus HKDevice = new HKDeviceStatus(); | |||
public void Init() | |||
{ | |||
for (int i = 0; i < 16; i++) | |||
{ | |||
if (DeviceInquire.GetInstance.GetDevice(i).DeviceName != null) | |||
{ | |||
if (!RawMaterialsNamePos.ContainsKey(DeviceInquire.GetInstance.GetDevice(i).DeviceName)) | |||
{ | |||
RawMaterialsNamePos.Add(DeviceInquire.GetInstance.GetDevice(i).DeviceName, (short)DeviceInquire.GetInstance.GetDevice(i).deviceStatus.DeviceNum); | |||
} | |||
} | |||
} | |||
string HK_PLC_IP = ConfigurationManager.AppSettings["HKPlc_IP"]; | |||
try | |||
{ | |||
//HKDevice.HK_PLC_S7.Connect(S7.Net.CpuType.S71200, HK_PLC_IP); | |||
if (HKDevice.IsConnected) | |||
{ | |||
HKDevice.Init(); | |||
MessageLog.GetInstance.ShowUserLog("海科plc连接成功,并初始化完成"); | |||
} | |||
} | |||
catch(Exception ex) | |||
{ | |||
} | |||
RecipeQueue.Clear(); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
ReceviceData(); | |||
RecipeInfoToHKPLC(); | |||
Thread.Sleep(10); | |||
}), "流程处理", true); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
if (HKDevice.IsConnected) | |||
{ | |||
GetStatus(); | |||
ManualOpen(); | |||
ManualClose(); | |||
} | |||
Thread.Sleep(10); | |||
}), "手动操作", true); | |||
} | |||
private void GetStatus() | |||
{ | |||
for (int i = 0; i < 8; i++) | |||
{ | |||
HKDevice.HK_PLC_S7.Read<bool>("DB5.DBX0." + i); | |||
} | |||
for (int i = 0; i < 8; i++) | |||
{ | |||
HKDevice.HK_PLC_S7.Read<bool>("DB5.DBX1." + i); | |||
} | |||
} | |||
private void ManualOpen() | |||
{ | |||
ActionManage.GetInstance.Register(new Action<object>((o) => | |||
{ | |||
if (o != null) | |||
{ | |||
if (o.ToString().Contains("升降气缸")) | |||
{ | |||
int index = Convert.ToInt16(o.ToString().Substring(o.ToString().Length - 1)); | |||
switch (index) | |||
{ | |||
case 1: | |||
HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX0.0", true); | |||
break; | |||
case 2: | |||
HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX0.1", true); | |||
break; | |||
case 3: | |||
HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX0.2", true); | |||
break; | |||
case 4: | |||
HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX0.3", true); | |||
break; | |||
case 5: | |||
HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX0.4", true); | |||
break; | |||
case 6: | |||
HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX0.5", true); | |||
break; | |||
default: | |||
break; | |||
} | |||
} | |||
} | |||
}), "ManualOpen", true);//根据下发的配方ID将 托盘的位置信息添加到配方中 | |||
} | |||
private void ManualClose() | |||
{ | |||
ActionManage.GetInstance.Register(new Action<object>((o) => | |||
{ | |||
if (o != null) | |||
{ | |||
if (o.ToString().Contains("升降气缸")) | |||
{ | |||
int index = Convert.ToInt16(o.ToString().Substring(o.ToString().Length - 1)); | |||
switch (index) | |||
{ | |||
case 1: | |||
HKDevice.HK_PLC_S7.Write("DB5.DBX0.0", false); | |||
break; | |||
case 2: | |||
HKDevice.HK_PLC_S7.Write("DB5.DBX0.1", false); | |||
break; | |||
case 3: | |||
HKDevice.HK_PLC_S7.Write("DB5.DBX0.2", false); | |||
break; | |||
case 4: | |||
HKDevice.HK_PLC_S7.Write("DB5.DBX0.3", false); | |||
break; | |||
case 5: | |||
HKDevice.HK_PLC_S7.Write("DB5.DBX0.4", false); | |||
break; | |||
case 6: | |||
HKDevice.HK_PLC_S7.Write("DB5.DBX0.5", false); | |||
break; | |||
default: | |||
break; | |||
} | |||
} | |||
} | |||
}), "ManualClose", true);//根据下发的配方ID将 托盘的位置信息添加到配方中 | |||
} | |||
/// <summary> | |||
/// 将配方添加到配方队列中 | |||
/// </summary> | |||
private void ReceviceData() | |||
{ | |||
RemoteRecipes = Json<RemoteRecipeDataColl>.Data.Recipes; | |||
if (RemoteRecipes.Count > 0) | |||
{ | |||
foreach (var data in RemoteRecipes) | |||
{ | |||
if (!(RecipeQueue.Contains(data.RecipeCode))) | |||
{ | |||
RecipeQueue.Enqueue(data.RecipeCode); | |||
} | |||
} | |||
} | |||
else | |||
{ | |||
RecipeQueue.Clear(); | |||
GVL_SmallStation.GetInstance.RecipeStatusID = 0; | |||
} | |||
} | |||
/// <summary> | |||
/// 执行配方队列中的第一个配方 | |||
/// </summary> | |||
private void RecipeInfoToHKPLC() | |||
{ | |||
if (RecipeQueue.Count > 0) | |||
{ | |||
int index = Array.FindIndex(RemoteRecipes.ToArray(), p => p.RecipeCode == RecipeQueue.ElementAt(0)); | |||
if (index >= 0 && index < RemoteRecipes.Count) | |||
{ | |||
string code = RemoteRecipes.ElementAt(index).RecipeCode; | |||
int trayCode = RemoteRecipes.ElementAt(index).TrayCode; | |||
string recipeName = RemoteRecipes.ElementAt(index).RecipeName; | |||
string windSend = RemoteRecipes.ElementAt(index).ToString(); | |||
if (GVL_SmallStation.GetInstance.RecipeStatusID == 0) | |||
{ | |||
HKDevice.HK_PLC_S7.Write("DB4.DBX1.3", true); | |||
GVL_SmallStation.GetInstance.RecipeStatusID = 1; | |||
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},下发完成"); | |||
HKDevice.HK_PLC_S7.Write("DB3.DBX1.3", true); | |||
} | |||
if (HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX1.3") && GVL_SmallStation.GetInstance.RecipeStatusID == 1) | |||
{ | |||
HKDevice.HK_PLC_S7.Write("DB3.DBX1.3", false); | |||
GVL_SmallStation.GetInstance.RecipeStatusID = 2; | |||
MessageLog.GetInstance.ShowRunLog($"托盘1,{ recipeName}plc端 配方接收完成"); | |||
} | |||
if (GVL_SmallStation.GetInstance.RecipeStatusID == 2) | |||
{ | |||
if (RTrig.GetInstance("DB3.DBX50.0").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.0"))) | |||
{ | |||
var res = HKDevice.HK_PLC_S7.Read<float>("DB3.DBD10"); | |||
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},1号桶,{res}料仓,允许配料"); | |||
if (res > 0 && res is float loc) | |||
{ | |||
//int decimalNum = Convert.ToInt32(loc.ToString().Substring(loc.ToString().IndexOf(".") + 1)); | |||
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc); | |||
float weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(loc_index).RawMaterialWeight; | |||
if (loc_index >= 0) | |||
{ | |||
DeviceInquire.GetInstance.GetDevice((int)loc)?.Start(weight);//根据料仓编号 启动并写入每个原料重量 | |||
GVL_SmallStation.GetInstance.StockInIsWork = (int)loc; | |||
} | |||
GVL_SmallStation.GetInstance.DosingTray1 = true; | |||
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},1号桶,{(int)loc}号仓,配料完成"); | |||
} | |||
} | |||
else if(RTrig.GetInstance("DB3.DBX50.1").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.1"))) | |||
{ | |||
var res = HKDevice.HK_PLC_S7.Read<float>("DB3.DBD14"); | |||
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},2号桶,{res}料仓,允许配料"); | |||
if (res > 0 && res is float loc) | |||
{ | |||
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc); | |||
float weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(loc_index).RawMaterialWeight; | |||
if (loc_index >= 0) | |||
{ | |||
DeviceInquire.GetInstance.GetDevice((int)loc)?.Start(weight);//启动并写入每个原料重量 | |||
GVL_SmallStation.GetInstance.StockInIsWork = (int)loc; | |||
} | |||
GVL_SmallStation.GetInstance.DosingTray1 = true; | |||
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},2号桶,{(int)loc}号仓,配料完成"); | |||
} | |||
} | |||
else if (RTrig.GetInstance("DB3.DBX50.2").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.2"))) | |||
{ | |||
var res = HKDevice.HK_PLC_S7.Read<float>("DB3.DBD18"); | |||
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},3号桶,{res}料仓,允许配料"); | |||
if (res > 0 && res is float loc) | |||
{ | |||
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc); | |||
float weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(loc_index).RawMaterialWeight; | |||
if (loc_index >= 0) | |||
{ | |||
DeviceInquire.GetInstance.GetDevice((int)loc)?.Start(weight);//启动并写入每个原料重量 | |||
GVL_SmallStation.GetInstance.StockInIsWork = (int)loc; | |||
} | |||
GVL_SmallStation.GetInstance.DosingTray1 = true; | |||
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},3号桶,{(int)loc}号仓,配料完成"); | |||
} | |||
} | |||
else if (RTrig.GetInstance("DB3.DBX50.3").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.3"))) | |||
{ | |||
var res = HKDevice.HK_PLC_S7.Read<float>("DB3.DBD22"); | |||
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},4号桶,{res}料仓,允许配料"); | |||
if (res > 0 && res is float loc) | |||
{ | |||
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc); | |||
float weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(loc_index).RawMaterialWeight; | |||
if (loc_index >= 0) | |||
{ | |||
DeviceInquire.GetInstance.GetDevice((int)loc)?.Start(weight);//启动并写入每个原料重量 | |||
GVL_SmallStation.GetInstance.StockInIsWork = (int)loc; | |||
} | |||
GVL_SmallStation.GetInstance.DosingTray1 = true; | |||
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},4号桶,{(int)loc}号仓,配料完成"); | |||
} | |||
} | |||
if (GVL_SmallStation.GetInstance.DosingTray1) | |||
{ | |||
for (int i = 1; i < 16; i++) | |||
{ | |||
if (RTrig.GetInstance("GetDeviceRunStatus").Start(DeviceInquire.GetInstance.GetDevice(i).deviceStatus.RunStatus == 3)) | |||
{ | |||
MessageLog.GetInstance.ShowRunLog($"柔性味魔方,托盘1,配方:{recipeName},{i}号仓,配料完成"); | |||
int res = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == i); | |||
RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(res).Laying_Off_Weight = DeviceInquire.GetInstance.GetDevice(i).deviceStatus.CutWeightFeedback; | |||
DeviceInquire.GetInstance.GetDevice(i).StatusReset(); | |||
if (i >= 1 && i <= 8) | |||
{ | |||
HKDevice.HK_PLC_S7.Write("DB4.DBX30." + (i - 1), true); | |||
} | |||
else if (i >= 9 && i <= 15) | |||
{ | |||
HKDevice.HK_PLC_S7.Write("DB4.DBX31." + (i - 9), true); | |||
} | |||
GVL_SmallStation.GetInstance.DosingTray1 = false; | |||
} | |||
} | |||
} | |||
if (RTrig.GetInstance("配方配料完成").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX1.1")) && (GVL_SmallStation.GetInstance.WindSendDosingFinish || !GVL_SmallStation.GetInstance.IsUseWindSend)) | |||
{ | |||
var res = Json<RemoteRecipeDataColl>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == code); | |||
MessageLog.GetInstance.ShowRunLog($"托盘1,配方{res.RecipeName},配料完成"); | |||
App.Current.Dispatcher.Invoke(() => | |||
{ | |||
Json<RemoteRecipeDataColl>.Data.Recipes.Remove(res); | |||
}); | |||
RecipeQueue.TryDequeue(out code); | |||
HKDevice.HK_PLC_S7.Write("DB3.DBX1.1", false); | |||
GVL_SmallStation.GetInstance.RecipeStatusID = 0; | |||
} | |||
} | |||
} | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,28 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
namespace BPASmartClient.DosingHKProject.Model | |||
{ | |||
public class ActionMenu : ObservableObject | |||
{ | |||
public string CommandParameter { get { return _mCommandParameter; } set { _mCommandParameter = value; OnPropertyChanged(); } } | |||
private string _mCommandParameter; | |||
//public Permission[] permission { get { return _mpermission; } set { _mpermission = value; OnPropertyChanged(); } } | |||
//private Permission[] _mpermission; | |||
public string MenuName { get { return _mMenuName; } set { _mMenuName = value; OnPropertyChanged(); } } | |||
private string _mMenuName; | |||
//public string NameSpace { get { return _mNameSpace; } set { _mNameSpace = value; OnPropertyChanged(); } } | |||
//private string _mNameSpace; | |||
} | |||
} |
@@ -0,0 +1,48 @@ | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.DosingHKProject.Model | |||
{ | |||
public class AlarmInfo | |||
{ | |||
/// <summary> | |||
/// 1#急停 | |||
/// </summary> | |||
[Alarm("1#急停")] | |||
public bool EStop1 { get; set; } | |||
/// <summary> | |||
/// 伺服故障 | |||
/// </summary> | |||
[Alarm("伺服故障")] | |||
public bool Servo { get; set; } | |||
/// <summary> | |||
/// 变频器故障 | |||
/// </summary> | |||
[Alarm("变频器故障")] | |||
public bool Inverter { get; set; } | |||
/// <summary> | |||
/// 2#急停 | |||
/// </summary> | |||
[Alarm("2#急停")] | |||
public bool EStop2 { get; set; } | |||
/// <summary> | |||
/// 料仓上限 | |||
/// </summary> | |||
[Alarm("料仓上限")] | |||
public bool SiloUpperLimit { get; set; } | |||
/// <summary> | |||
/// 料仓下限 | |||
/// </summary> | |||
[Alarm("料仓下限")] | |||
public bool SiloLowerLimit { get; set; } | |||
} | |||
} |
@@ -0,0 +1,17 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
namespace BPASmartClient.DosingHKProject.Model | |||
{ | |||
public class ConveyorServer | |||
{ | |||
public ConveyorServer() | |||
{ | |||
} | |||
} | |||
} |
@@ -0,0 +1,27 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
namespace BPASmartClient.DosingHKProject.Model | |||
{ | |||
public class CylinderStatusModel : ObservableObject | |||
{ | |||
/// <summary> | |||
/// 气缸原点信号 | |||
/// </summary> | |||
public bool HomeStatus { get { return _mHomeStatus; } set { _mHomeStatus = value; OnPropertyChanged(); } } | |||
private bool _mHomeStatus; | |||
/// <summary> | |||
/// 气缸到位信号 | |||
/// </summary> | |||
public bool InPlace { get { return _mInPlace; } set { _mInPlace = value; OnPropertyChanged(); } } | |||
private bool _mInPlace; | |||
} | |||
} |
@@ -0,0 +1,105 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.DosingHKProject.Model | |||
{ | |||
public class DeviceAddress | |||
{ | |||
/// <summary> | |||
/// 设备名称起始地址 | |||
/// </summary> | |||
public static string DeviceName { get; set; } = "LW0"; | |||
/// <summary> | |||
/// 料仓重量反馈起始地址 | |||
/// </summary> | |||
public static string WeightFeedback { get; set; } = "LW52"; | |||
/// <summary> | |||
/// 重量设置地址 | |||
/// </summary> | |||
public static string WeightSet { get; set; } = "LW21"; | |||
/// <summary> | |||
/// 启动信号地址 | |||
/// </summary> | |||
public static string Start { get; set; } = "LW20"; | |||
/// <summary> | |||
/// 下料重量反馈地址 | |||
/// </summary> | |||
public static string CutWeightFeedback { get; set; } = "LW54"; | |||
/// <summary> | |||
/// 设备编号 | |||
/// </summary> | |||
public static string DeviceNum { get; set; } = "LW57"; | |||
/// <summary> | |||
/// 设备故障编码 | |||
/// </summary> | |||
public static string DeviceAlarmCode { get; set; } = "LW51"; | |||
/// <summary> | |||
/// 原料设备类型 | |||
/// 1:膏体,2:液体,3:粉体 | |||
/// </summary> | |||
public static string MaterialDeviceType { get; set; } = "LW56"; | |||
/// <summary> | |||
/// 设备运行状态地址 | |||
/// </summary> | |||
public static string RunStatus { get; set; } = "LW60"; | |||
/// <summary> | |||
/// 出料完成,置位该信号,plc复位运行状态 | |||
/// </summary> | |||
public static string FinfishStatus { get; set; } = "LW40"; | |||
/// <summary> | |||
/// 慢加重量 | |||
/// </summary> | |||
public static string SlowlyAddWeight { get; set; } = "LW23"; | |||
/// <summary> | |||
/// 提前关阀重量 | |||
/// </summary> | |||
public static string PreCloseValveWeight { get; set; } = "LW25"; | |||
/// <summary> | |||
/// 快加速度 | |||
/// </summary> | |||
public static string RapidAcceleration { get; set; } = "LW27"; | |||
/// <summary> | |||
/// 慢加速度 | |||
/// </summary> | |||
public static string SlowAcceleration { get; set; } = "LW29"; | |||
/// <summary> | |||
/// 伺服手动速度 | |||
/// </summary> | |||
public static string ServoManualSpeed { get; set; } = "LW31"; | |||
/// <summary> | |||
/// 料仓上限重量 | |||
/// </summary> | |||
public static string SiloUpperLimitWeight { get; set; } = "LW33"; | |||
/// <summary> | |||
/// 料仓下限重量 | |||
/// </summary> | |||
public static string LowerLimitWeightOfSilo { get; set; } = "LW35"; | |||
/// <summary> | |||
/// 搅拌速度 | |||
/// </summary> | |||
public static string StirringSpeed { get; set; } = "LW37"; | |||
} | |||
} |
@@ -0,0 +1,30 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
namespace BPASmartClient.DosingHKProject.Model | |||
{ | |||
public class DeviceCurrentStatus : ObservableObject | |||
{ | |||
public double Weight { get { return _mWeight; } set { _mWeight = value; OnPropertyChanged(); } } | |||
private double _mWeight; | |||
public bool RunStatus { get { return _mRunStatus; } set { _mRunStatus = value; OnPropertyChanged(); } } | |||
private bool _mRunStatus; | |||
public int DeviceNum { get { return _mDeviceNum; } set { _mDeviceNum = value; OnPropertyChanged(); } } | |||
private int _mDeviceNum; | |||
public string DeviceName { get { return _mDeviceName; } set { _mDeviceName = value; OnPropertyChanged(); } } | |||
private string _mDeviceName; | |||
} | |||
} |
@@ -0,0 +1,363 @@ | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
using BPASmartClient.DosingHKProject.ViewModel; | |||
using BPASmartClient.DosingProject; | |||
using BPASmartClient.Helper; | |||
using BPASmartClient.Modbus; | |||
using BPASmartClient.Model; | |||
using System; | |||
using System.Collections.Concurrent; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Net.NetworkInformation; | |||
using System.Threading; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.DosingHKProject.Model | |||
{ | |||
public class DeviceInquire | |||
{ | |||
private volatile static DeviceInquire _Instance; | |||
public static DeviceInquire GetInstance => _Instance ?? (_Instance = new DeviceInquire()); | |||
private DeviceInquire() { } | |||
string IPSegment = "192.168.0."; | |||
ConcurrentDictionary<string, DeviceStatus> DeviceLists = new ConcurrentDictionary<string, DeviceStatus>(); | |||
List<string> InvalidIP = new List<string>();//无效 IP 集合 | |||
List<string> IPLists = new List<string>();//启动 Ping 任务IP集合 | |||
ConcurrentQueue<string> IPQueues = new ConcurrentQueue<string>();//pincomplete 完成队列 | |||
public ObservableCollection<DeviceCurrentStatus> TopDeviceCurrentStatuses { get; set; } = new ObservableCollection<DeviceCurrentStatus>(); | |||
public ObservableCollection<DeviceCurrentStatus> BottomDeviceCurrentStatuses { get; set; } = new ObservableCollection<DeviceCurrentStatus>(); | |||
public ObservableCollection<Devices> devices { get; set; } = new ObservableCollection<Devices>(); | |||
private void DeviceDataInit() | |||
{ | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
for (int i = 0; i < DeviceLists.Count; i++) | |||
{ | |||
string deviceName = DeviceLists.ElementAt(i).Value.DeviceName; | |||
int TopIndex = Array.FindIndex(TopDeviceCurrentStatuses.ToArray(), p => p.DeviceName == deviceName); | |||
int BottomIndex = Array.FindIndex(BottomDeviceCurrentStatuses.ToArray(), p => p.DeviceName == deviceName); | |||
if (TopIndex >= 0 && TopIndex < TopDeviceCurrentStatuses.Count) | |||
{ | |||
TopDeviceCurrentStatuses.ElementAt(TopIndex).Weight = DeviceLists.ElementAt(i).Value.deviceStatus.WeightFeedback; | |||
TopDeviceCurrentStatuses.ElementAt(TopIndex).DeviceNum = DeviceLists.ElementAt(i).Value.deviceStatus.DeviceNum; | |||
} | |||
if (BottomIndex >= 0 && BottomIndex < BottomDeviceCurrentStatuses.Count) | |||
{ | |||
BottomDeviceCurrentStatuses.ElementAt(BottomIndex).Weight = DeviceLists.ElementAt(i).Value.deviceStatus.WeightFeedback; | |||
BottomDeviceCurrentStatuses.ElementAt(BottomIndex).DeviceNum = DeviceLists.ElementAt(i).Value.deviceStatus.DeviceNum; | |||
} | |||
int deviceIndex = Array.FindIndex(devices.ToArray(), p => p.IpAddress == DeviceLists.ElementAt(i).Key && p.DeviceName != DeviceLists.ElementAt(i).Value.DeviceName); | |||
if (deviceIndex >= 0 && deviceIndex < devices.Count) | |||
{ | |||
devices.ElementAt(deviceIndex).DeviceName = DeviceLists.ElementAt(i).Value.DeviceName; | |||
} | |||
} | |||
Thread.Sleep(200); | |||
}), "设备状态监听"); | |||
} | |||
private void TestData() | |||
{ | |||
for (int i = 0; i < 8; i++) | |||
{ | |||
TopDeviceCurrentStatuses.Add(new DeviceCurrentStatus() | |||
{ | |||
DeviceName = $"测试设备{i + 1}", | |||
DeviceNum = i + 1, | |||
Weight = new Random().Next(100, 10000) / 100.0 | |||
}); | |||
devices.Add(new Devices() | |||
{ | |||
DeviceName = $"测试设备{i + 1}", | |||
IpAddress = $"192.168.1.{i + 1}", | |||
}); | |||
} | |||
for (int i = 8; i < 16; i++) | |||
{ | |||
BottomDeviceCurrentStatuses.Add(new DeviceCurrentStatus() | |||
{ | |||
DeviceName = $"测试设备{i + 1}", | |||
DeviceNum = i + 1, | |||
Weight = new Random().Next(100, 10000) / 100.0 | |||
}); | |||
devices.Add(new Devices() | |||
{ | |||
DeviceName = $"测试设备{i + 1}", | |||
IpAddress = $"192.168.1.{i + 1}", | |||
}); | |||
} | |||
} | |||
public void Init() | |||
{ | |||
//TestData(); | |||
IpAddressLines(); | |||
DeviceDataInit(); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
if (IPQueues.Count >= IPLists.Count) | |||
IpAddressLines(); | |||
Thread.Sleep(5000); | |||
}), "配料机设备上线监听", true); | |||
} | |||
public void Rescan() | |||
{ | |||
InvalidIP.Clear(); | |||
} | |||
public DeviceStatus GetDevice(string ip) | |||
{ | |||
if (ip != null) | |||
{ | |||
var res = DeviceLists.Values.FirstOrDefault(p => p.IpAddress == ip); | |||
if (res != null) return res; | |||
} | |||
return new DeviceStatus(); | |||
} | |||
public DeviceStatus GetDevice(int location) | |||
{ | |||
if (location > 0 && location < 16) | |||
{ | |||
var res = DeviceLists.Values.FirstOrDefault(p => p.deviceStatus.DeviceNum == location); | |||
if (res != null) return res; | |||
} | |||
return new DeviceStatus(); | |||
} | |||
public List<DeviceStatus> GetDevice() | |||
{ | |||
List<DeviceStatus> deviceStatuses = new List<DeviceStatus>(); | |||
foreach (var device in DeviceLists) | |||
{ | |||
deviceStatuses.Add(device.Value); | |||
} | |||
return deviceStatuses; | |||
} | |||
private void IpAddressLines() | |||
{ | |||
IPLists.Clear(); | |||
IPQueues.Clear(); | |||
for (int i = 1; i <= 255; i++) | |||
{ | |||
if (!InvalidIP.Contains($"{IPSegment}{i}") && !DeviceLists.ContainsKey($"{IPSegment}{i}")) | |||
{ | |||
IPLists.Add($"{IPSegment}{i}"); | |||
} | |||
} | |||
IPLists.ForEach((item) => | |||
{ | |||
Ping myPing = new Ping(); | |||
myPing.PingCompleted += new PingCompletedEventHandler(_myPing_PingCompleted); | |||
myPing.SendAsync(item, 1000, null); | |||
}); | |||
} | |||
private void _myPing_PingCompleted(object sender, PingCompletedEventArgs e) | |||
{ | |||
if (e.Reply.Status == IPStatus.Success) | |||
{ | |||
string ip = e.Reply.Address.ToString(); | |||
if (!DeviceLists.ContainsKey(ip)) | |||
{ | |||
DeviceStatus DS = new DeviceStatus(); | |||
DS.modbusTcp.IsReconnect = false; | |||
DS.modbusTcp.ConnectOk = new Action(() => | |||
{ | |||
string DeviceName = DS.modbusTcp.GetString(DeviceAddress.DeviceName, 20).Trim()?.Replace(" ", "");//读取设备名称 | |||
if (DeviceName.Length > 0) | |||
{ | |||
DeviceLists.TryAdd(ip, DS); | |||
DeviceLists[ip].Init(DeviceName); | |||
DeviceLists[ip].modbusTcp.IsReconnect = false; | |||
App.Current.Dispatcher.Invoke(new Action(() => | |||
{ | |||
//DeviceListViewModel.devices.Add(new Devices() | |||
//{ | |||
// DeviceName = DeviceName, | |||
// IpAddress = ip | |||
//});//加入连接的(有名称的)设备列表 | |||
devices.Add(new Devices() { DeviceName = DeviceName, IpAddress = ip }); | |||
if (TopDeviceCurrentStatuses.Count <= 7) | |||
TopDeviceCurrentStatuses.Add(new DeviceCurrentStatus() { DeviceName = DeviceName }); | |||
else | |||
BottomDeviceCurrentStatuses.Add(new DeviceCurrentStatus() { DeviceName = DeviceName }); | |||
for (int i = 0; i < Json<LocaPar>.Data.Recipes.Count; i++) | |||
{ | |||
for (int m = 0; m < Json<LocaPar>.Data.Recipes.ElementAt(i).RawMaterials.Count; m++) | |||
{ | |||
if (Json<LocaPar>.Data.Recipes.ElementAt(i).RawMaterials.ElementAt(m).DeviceIp == ip) | |||
{ | |||
Json<LocaPar>.Data.Recipes.ElementAt(i).RawMaterials.ElementAt(m).RawMaterialName = DeviceName; | |||
} | |||
} | |||
} | |||
if (Global.DeviceRawMaterials.Count > 0) | |||
{ | |||
if (Global.DeviceRawMaterials.FirstOrDefault(p => p.RawMaterialName == DeviceName) == null) | |||
{ | |||
Global.DeviceRawMaterials.Add(new RawMaterialModel() { RawMaterialName = DeviceName, DeviceIp = ip, RawMaterialSource = 1}); | |||
} | |||
} | |||
else | |||
{ | |||
Global.DeviceRawMaterials.Add(new RawMaterialModel() { RawMaterialName = DeviceName, DeviceIp = ip, RawMaterialSource = 1 }); | |||
} | |||
})); | |||
} | |||
else | |||
{ | |||
if (!InvalidIP.Contains(ip)) InvalidIP.Add(ip); | |||
} | |||
}); | |||
DS.modbusTcp.ConnectFail = new Action(() => | |||
{ | |||
if (!InvalidIP.Contains(ip)) InvalidIP.Add(ip); | |||
//MessageLog.GetInstance.ShowAlarmLog($"设备{ip}连接失败"); | |||
}); | |||
DS.modbusTcp.Disconnect = new Action(() => | |||
{ | |||
if (InvalidIP.Contains(ip)) InvalidIP.Remove(ip); | |||
//var res = DeviceListViewModel.devices.FirstOrDefault(P => P.IpAddress == ip); | |||
var res = devices.FirstOrDefault(P => P.IpAddress == ip); | |||
//if (res != null && DeviceListViewModel.devices.Contains(res)) | |||
if (res != null && devices.Contains(res)) | |||
{ | |||
App.Current.Dispatcher.Invoke(new Action(() => | |||
{ | |||
//DeviceListViewModel.devices.Remove(res); | |||
devices.Remove(res); | |||
var item = Global.DeviceRawMaterials.FirstOrDefault(P => P.RawMaterialName == res.DeviceName); | |||
if (item != null) Global.DeviceRawMaterials.Remove(item); | |||
var topRes = TopDeviceCurrentStatuses.FirstOrDefault(p => p.DeviceName == res.DeviceName); | |||
var bottomRes = BottomDeviceCurrentStatuses.FirstOrDefault(p => p.DeviceName == res.DeviceName); | |||
if (topRes != null) TopDeviceCurrentStatuses.Remove(topRes); | |||
if (bottomRes != null) BottomDeviceCurrentStatuses.Remove(bottomRes); | |||
})); | |||
} | |||
if (DeviceLists.ContainsKey(ip)) DeviceLists[ip].Dispose(); | |||
}); | |||
Task.Run(new Action(() => | |||
{ | |||
DS.modbusTcp.ModbusTcpConnect(ip, 502);//PLC连接 | |||
IPQueues.Enqueue(e.Reply.Address.ToString()); | |||
})); | |||
} | |||
else IPQueues.Enqueue(e.Reply.Address.ToString()); | |||
} | |||
else IPQueues.Enqueue(e.Reply.Address.ToString()); | |||
} | |||
} | |||
public class DeviceStatus | |||
{ | |||
#region 对象属性声明 | |||
public string DeviceName = String.Empty; | |||
public string IpAddress => modbusTcp.IPAdress; | |||
/// <summary> | |||
/// 设备状态 | |||
/// </summary> | |||
public RawMaterialDeviceStatus deviceStatus { get; set; } = new RawMaterialDeviceStatus(); | |||
public ModbusTcp modbusTcp = new ModbusTcp(); | |||
public bool IsConnected => modbusTcp.Connected; | |||
#endregion | |||
public void Init(string DeviceName) | |||
{ | |||
this.DeviceName = DeviceName; | |||
AlarmHelper<AlarmInfo>.Init(); | |||
if (modbusTcp.Connected) | |||
{ | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
//获取设备运行状态 | |||
//var res = this.modbusTcp.Read(DeviceAddress.RunStatus); | |||
//if (res != null && res is ushort[] ushortValue) | |||
//{ | |||
// if (ushortValue.Length >= 1) deviceStatus.RunStatus = ushortValue[0]; | |||
//} | |||
deviceStatus.RunStatus = (ushort)this.modbusTcp.ReadShort(DeviceAddress.RunStatus); //获取设备运行状态 | |||
deviceStatus.WeightFeedback = (float)this.modbusTcp.GetUint(DeviceAddress.WeightFeedback);//获取设备料仓剩余重量 | |||
deviceStatus.NowWeightFeedback = (float)this.modbusTcp.GetUint(DeviceAddress.CutWeightFeedback);//获取下料重量 | |||
deviceStatus.DeviceNum = (ushort)this.modbusTcp.ReadShort(DeviceAddress.DeviceNum);//获取设备编号 | |||
deviceStatus.DeviceAlarmCode = (ushort)this.modbusTcp.ReadShort(DeviceAddress.DeviceAlarmCode);//获取设备故障编码 | |||
AlarmHelper<AlarmInfo>.Alarm.EStop1 = deviceStatus.DeviceAlarmCode.Get16bitValue(1); | |||
AlarmHelper<AlarmInfo>.Alarm.Servo = deviceStatus.DeviceAlarmCode.Get16bitValue(2); | |||
AlarmHelper<AlarmInfo>.Alarm.Inverter = deviceStatus.DeviceAlarmCode.Get16bitValue(3); | |||
AlarmHelper<AlarmInfo>.Alarm.EStop2 = deviceStatus.DeviceAlarmCode.Get16bitValue(7); | |||
AlarmHelper<AlarmInfo>.Alarm.SiloUpperLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(8); | |||
AlarmHelper<AlarmInfo>.Alarm.SiloLowerLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(9); | |||
AlarmHelper<AlarmInfo>.Alarm.EStop1 = true; | |||
Thread.Sleep(10); | |||
}), $"{DeviceName} 开始监听", true); | |||
} | |||
} | |||
public void SetDeviceName(string name) | |||
{ | |||
this.modbusTcp.Write(DeviceAddress.DeviceName, new ushort[20]); | |||
this.modbusTcp.SetString(DeviceAddress.DeviceName, name); | |||
} | |||
public void StatusReset() | |||
{ | |||
this.modbusTcp.Write(DeviceAddress.FinfishStatus, (ushort)1); | |||
//var res = modbusTcp.Read(DeviceAddress.RunStatus); | |||
} | |||
public void Dispose() | |||
{ | |||
ThreadManage.GetInstance().StopTask($"{DeviceName} 开始监听"); | |||
} | |||
public void Start(float Value) | |||
{ | |||
if (modbusTcp.Connected) | |||
{ | |||
modbusTcp.SetReal(DeviceAddress.WeightSet, Value);//写入配方量 | |||
modbusTcp.Write(DeviceAddress.Start, (ushort)1);//设备启动写入 | |||
MessageLog.GetInstance.ShowRunLog($"开始配料"); | |||
//配料设备参数写入 | |||
var res = Json<DevicePar>.Data.deviceParModels.FirstOrDefault(p => p.MaterialName == DeviceName); | |||
if (res != null) | |||
{ | |||
modbusTcp.SetReal(DeviceAddress.SlowlyAddWeight, res.SlowlyAddWeight); | |||
modbusTcp.SetReal(DeviceAddress.PreCloseValveWeight, res.PreCloseValveWeight); | |||
modbusTcp.SetUint(DeviceAddress.RapidAcceleration, (uint)res.RapidAcceleration); | |||
modbusTcp.SetUint(DeviceAddress.SlowAcceleration, (uint)res.SlowAcceleration); | |||
modbusTcp.SetUint(DeviceAddress.ServoManualSpeed, (uint)res.ServoManualSpeed); | |||
modbusTcp.SetUint(DeviceAddress.SiloUpperLimitWeight, (uint)res.SiloUpperLimitWeight); | |||
modbusTcp.SetUint(DeviceAddress.LowerLimitWeightOfSilo, (uint)res.LowerLimitWeightOfSilo); | |||
modbusTcp.SetUint(DeviceAddress.StirringSpeed, (uint)res.StirringSpeed * 100); | |||
MessageLog.GetInstance.ShowRunLog($"参数下发完成"); | |||
} | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,15 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System.Collections.ObjectModel; | |||
namespace BPASmartClient.DosingHKProject.Model | |||
{ | |||
public class DevicePar | |||
{ | |||
public ObservableCollection<DeviceParMode> deviceParModels { get; set; } = new ObservableCollection<DeviceParMode>(); | |||
} | |||
} |
@@ -0,0 +1,75 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
namespace BPASmartClient.DosingHKProject.Model | |||
{ | |||
public class DeviceParMode : ObservableObject | |||
{ | |||
/// <summary> | |||
/// 原料名称 | |||
/// </summary> | |||
public string MaterialName { get { return _mMaterialName; } set { _mMaterialName = value; OnPropertyChanged(); } } | |||
private string _mMaterialName = string.Empty; | |||
/// <summary> | |||
/// 慢加重量 | |||
/// </summary> | |||
public float SlowlyAddWeight { get { return _mSlowlyAddWeight; } set { _mSlowlyAddWeight = value; OnPropertyChanged(); } } | |||
private float _mSlowlyAddWeight; | |||
/// <summary> | |||
/// 提前关阀重量 | |||
/// </summary> | |||
public float PreCloseValveWeight { get { return _mPreCloseValveWeight; } set { _mPreCloseValveWeight = value; OnPropertyChanged(); } } | |||
private float _mPreCloseValveWeight; | |||
/// <summary> | |||
/// 快加速度 | |||
/// </summary> | |||
public int RapidAcceleration { get { return _mRapidAcceleration; } set { _mRapidAcceleration = value; OnPropertyChanged(); } } | |||
private int _mRapidAcceleration; | |||
/// <summary> | |||
/// 慢加速度 | |||
/// </summary> | |||
public int SlowAcceleration { get { return _mSlowAcceleration; } set { _mSlowAcceleration = value; OnPropertyChanged(); } } | |||
private int _mSlowAcceleration; | |||
/// <summary> | |||
/// 伺服手动速度 | |||
/// </summary> | |||
public int ServoManualSpeed { get { return _mServoManualSpeed; } set { _mServoManualSpeed = value; OnPropertyChanged(); } } | |||
private int _mServoManualSpeed; | |||
/// <summary> | |||
/// 料仓上限重量 | |||
/// </summary> | |||
public int SiloUpperLimitWeight { get { return _mSiloUpperLimitWeight; } set { _mSiloUpperLimitWeight = value; OnPropertyChanged(); } } | |||
private int _mSiloUpperLimitWeight; | |||
/// <summary> | |||
/// 料仓下限重量 | |||
/// </summary> | |||
public int LowerLimitWeightOfSilo { get { return _mLowerLimitWeightOfSilo; } set { _mLowerLimitWeightOfSilo = value; OnPropertyChanged(); } } | |||
private int _mLowerLimitWeightOfSilo; | |||
/// <summary> | |||
/// 搅拌速度 | |||
/// </summary> | |||
public int StirringSpeed { get { return _mStirringSpeed; } set { _mStirringSpeed = value; OnPropertyChanged(); } } | |||
private int _mStirringSpeed; | |||
/// <summary> | |||
/// 是否重复 | |||
/// </summary> | |||
[Newtonsoft.Json.JsonIgnore] | |||
public bool IsRedundant { get { return _mIsRedundant; } set { _mIsRedundant = value; OnPropertyChanged(); } } | |||
private bool _mIsRedundant; | |||
} | |||
} |
@@ -0,0 +1,15 @@ | |||
using BPASmartClient.Model; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.DosingHKProject.Model | |||
{ | |||
public class GlobalData | |||
{ | |||
} | |||
} |
@@ -0,0 +1,16 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Collections.ObjectModel; | |||
using BPASmartClient.DosingHKProject.ViewModel; | |||
using BPASmartClient.Model; | |||
namespace BPASmartClient.DosingHKProject.Model | |||
{ | |||
public class LocaPar | |||
{ | |||
public ObservableCollection<RecipeModel> Recipes { get; set; } = new ObservableCollection<RecipeModel>(); | |||
} | |||
} |
@@ -0,0 +1,99 @@ | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.DosingHKProject.Model.RawMaterial | |||
{ | |||
public class RawMaterialColl : ObservableObject | |||
{ | |||
/// <summary> | |||
/// 原料设备IP | |||
/// </summary> | |||
public string DeviceIp { get; set; } | |||
/// <summary> | |||
/// 原料名称 | |||
/// </summary> | |||
public string RawMaterialName { get { return _mRawMaterialName; } set { _mRawMaterialName = value; OnPropertyChanged(); } } | |||
private string _mRawMaterialName; | |||
/// <summary> | |||
/// 原料重量设置 | |||
/// </summary> | |||
public uint RawMaterialWeight { get { return _mRawMaterialWeight; } set { _mRawMaterialWeight = value; OnPropertyChanged(); } } | |||
private uint _mRawMaterialWeight; | |||
/// <summary> | |||
/// 原料来源 | |||
/// 0:本地 | |||
/// 1:设备 | |||
/// </summary> | |||
public ushort RawMaterialSource { get { return _mRawMaterialSource; } set { _mRawMaterialSource = value; OnPropertyChanged(); } } | |||
private ushort _mRawMaterialSource; | |||
/// <summary> | |||
/// 原料类型 MW18 | |||
/// 1:液体 | |||
/// 2:膏体 | |||
/// 3:粉体 | |||
/// </summary> | |||
[Newtonsoft.Json.JsonIgnore] | |||
public ushort RawMaterialType { get { return _mRawMaterialType; } set { _mRawMaterialType = value; OnPropertyChanged(); } } | |||
private ushort _mRawMaterialType; | |||
/// <summary> | |||
/// 料仓重量反馈 MD40 | |||
/// </summary> | |||
[Newtonsoft.Json.JsonIgnore] | |||
public float WeightFeedback { get { return _mWeightFeedback; } set { _mWeightFeedback = value; OnPropertyChanged(); } } | |||
private float _mWeightFeedback; | |||
/// <summary> | |||
/// 上限反馈 | |||
/// </summary> | |||
[Newtonsoft.Json.JsonIgnore] | |||
public bool UpLimtFeedback { get { return _mUpLimtFeedback; } set { _mUpLimtFeedback = value; OnPropertyChanged(); } } | |||
private bool _mUpLimtFeedback; | |||
/// <summary> | |||
/// 下限反馈 | |||
/// </summary> | |||
[Newtonsoft.Json.JsonIgnore] | |||
public bool DownLimtFeedback { get { return _mDownLimtFeedback; } set { _mDownLimtFeedback = value; OnPropertyChanged(); } } | |||
private bool _mDownLimtFeedback; | |||
/// <summary> | |||
/// 下料重量反馈 MD52 | |||
/// </summary> | |||
[Newtonsoft.Json.JsonIgnore] | |||
public float UpLimtWeightFeedback { get { return _mUpLimtWeightFeedback; } set { _mUpLimtWeightFeedback = value; OnPropertyChanged(); } } | |||
private float _mUpLimtWeightFeedback; | |||
/// <summary> | |||
/// 原料ID | |||
/// </summary> | |||
public string RawMaterialId { get { return _mRawMaterialId; } set { _mRawMaterialId = value; OnPropertyChanged(); } } | |||
private string _mRawMaterialId; | |||
/// <summary> | |||
/// 原料设备执行状态 | |||
/// 1:等待配料 | |||
/// 2:下料中 | |||
/// 3:下料完成 | |||
/// </summary> | |||
[Newtonsoft.Json.JsonIgnore] | |||
public ushort RecipeStatus { get { return _mRecipeStatus; } set { _mRecipeStatus = value; OnPropertyChanged(); } } | |||
private ushort _mRecipeStatus = 1; | |||
/// <summary> | |||
/// 原料对应的桶号 | |||
/// </summary> | |||
public ushort BarrelNum { get { return _mBarrelNum; } set { _mBarrelNum = value; OnPropertyChanged(); } } | |||
private ushort _mBarrelNum = 1; | |||
} | |||
} |
@@ -0,0 +1,65 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.DosingHKProject.Model | |||
{ | |||
public class RawMaterialDeviceStatus | |||
{ | |||
/// <summary> | |||
/// 原料类型 | |||
/// 1:膏体 | |||
/// 2:液体 | |||
/// 3:粉体 | |||
/// </summary> | |||
public ushort RawMaterialType { get; set; } | |||
/// <summary> | |||
/// 料仓重量反馈 | |||
/// </summary> | |||
public float WeightFeedback { get; set; } | |||
/// <summary> | |||
/// 当前出料重量反馈 | |||
/// </summary> | |||
public float NowWeightFeedback { get; set; } | |||
/// <summary> | |||
/// 上限反馈 | |||
/// </summary> | |||
public bool UpLimitFeedback { get; set; } | |||
/// <summary> | |||
/// 下限反馈 | |||
/// </summary> | |||
public bool DownLimitFeedback { get; set; } | |||
/// <summary> | |||
/// 下料重量反馈 | |||
/// </summary> | |||
public float CutWeightFeedback { get; set; } | |||
/// <summary> | |||
/// 设备运行状态 | |||
/// 0:未知 | |||
/// 1:等待配料 | |||
/// 2:配料中 | |||
/// 3:配料完成 | |||
/// </summary> | |||
public ushort RunStatus { get; set; } | |||
/// <summary> | |||
/// 设备故障编码 | |||
/// </summary> | |||
public ushort DeviceAlarmCode { get; set; } | |||
/// <summary> | |||
/// 设备料仓编号 | |||
/// </summary> | |||
public ushort DeviceNum { get; set; } | |||
} | |||
} |
@@ -0,0 +1,56 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading; | |||
using System.Threading.Tasks; | |||
using BPASmartClient.DosingHKProject.Model.RawMaterial; | |||
using BPASmartClient.Model; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
namespace BPASmartClient.DosingHKProject.Model | |||
{ | |||
/// <summary> | |||
/// 配方模块 | |||
/// </summary> | |||
public class RecipeModel : ObservableObject | |||
{ | |||
[Newtonsoft.Json.JsonIgnore] | |||
public bool IsEnable { get { return _mIsEnable; } set { _mIsEnable = value; OnPropertyChanged(); } } | |||
private bool _mIsEnable = true; | |||
/// <summary> | |||
/// 序号 | |||
/// </summary> | |||
public int SerialNum { get { return _mSerialNum; } set { _mSerialNum = value; OnPropertyChanged(); } } | |||
private int _mSerialNum; | |||
/// <summary> | |||
/// 配方名称 | |||
/// </summary> | |||
public string RecipeName { get { return _mRecipeName; } set { _mRecipeName = value; OnPropertyChanged(); } } | |||
private string _mRecipeName; | |||
/// <summary> | |||
/// 配方编码 | |||
/// </summary> | |||
public string RecipCode { get { return _mRecipCode; } set { _mRecipCode = value; OnPropertyChanged(); } } | |||
private string _mRecipCode; | |||
[Newtonsoft.Json.JsonIgnore] | |||
public AutoResetEvent Are { get; set; } = new AutoResetEvent(false); | |||
/// <summary> | |||
/// 托盘编号 | |||
/// </summary> | |||
public int TrayCode { get { return _mTrayCode; } set { _mTrayCode = value; OnPropertyChanged(); } } | |||
private int _mTrayCode; | |||
/// <summary> | |||
/// 原料集合 | |||
/// </summary> | |||
public ObservableCollection<RawMaterialModel> RawMaterials { get; set; } = new ObservableCollection<RawMaterialModel>(); | |||
} | |||
} |
@@ -0,0 +1,14 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.DosingHKProject.Model.Siemens | |||
{ | |||
internal class LocalRecipeDataColl | |||
{ | |||
public ObservableCollection<RemoteRecipeData> Recipes { get; set; } = new ObservableCollection<RemoteRecipeData>(); | |||
} | |||
} |
@@ -0,0 +1,38 @@ | |||
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.DosingHKProject.Model | |||
{ | |||
public class RemoteRecipeData:ObservableObject | |||
{ | |||
/// <summary> | |||
/// 配方名称 | |||
/// </summary> | |||
public string RecipeName { get { return _mRecipeName; } set { _mRecipeName = value; OnPropertyChanged(); } } | |||
private string _mRecipeName; | |||
/// <summary> | |||
/// 配方ID | |||
/// </summary> | |||
public string RecipeCode { get { return _mRecipeCode; } set { _mRecipeCode = value;OnPropertyChanged(); } } | |||
private string _mRecipeCode; | |||
/// <summary> | |||
/// 托盘编号 | |||
/// </summary> | |||
public int TrayCode { get { return _mTrayCode; } set { _mTrayCode = value; OnPropertyChanged(); } } | |||
private int _mTrayCode; | |||
/// <summary> | |||
/// 原料数据 | |||
/// </summary> | |||
public ObservableCollection<RemoteRecipeRawMaterial> RawMaterial { get; set; } = new ObservableCollection<RemoteRecipeRawMaterial>(); | |||
} | |||
} |
@@ -0,0 +1,14 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.DosingHKProject.Model.Siemens | |||
{ | |||
public class RemoteRecipeDataColl | |||
{ | |||
public ObservableCollection<RemoteRecipeData> Recipes { get; set; } = new ObservableCollection<RemoteRecipeData>(); | |||
} | |||
} |
@@ -0,0 +1,48 @@ | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.DosingHKProject.Model | |||
{ | |||
public class RemoteRecipeRawMaterial:ObservableObject | |||
{ | |||
public int DeviceIp { get { return _mIp; } set { _mIp = value; }} | |||
private int _mIp; | |||
public string RawMaterialName { get { return _mRawMaterialName; } set { _mRawMaterialName = value; OnPropertyChanged(); } } | |||
private string _mRawMaterialName; | |||
/// <summary> | |||
/// 原料对应的桶号 | |||
/// </summary> | |||
public short RawMaterialBarrelNum { get { return _mRawMaterialBarrelNum; } set { _mRawMaterialBarrelNum = value; OnPropertyChanged(); } } | |||
private short _mRawMaterialBarrelNum; | |||
/// <summary> | |||
/// 需要原料重量 | |||
/// </summary> | |||
public float RawMaterialWeight { get { return _mRawMaterialWeight; } set { _mRawMaterialWeight = value; OnPropertyChanged(); } } | |||
private float _mRawMaterialWeight; | |||
/// <summary> | |||
/// 实际的下料中重量 | |||
/// </summary> | |||
public float Laying_Off_Weight { get { return _mLaying_Off_Weight; } set { _mLaying_Off_Weight = value; } } | |||
private float _mLaying_Off_Weight; | |||
/// <summary> | |||
/// 料仓剩余重量 | |||
/// </summary> | |||
public float StockBinRemainingWeight { get { return _mStockBinRemainingWeight; } set { _mStockBinRemainingWeight = value; } } | |||
private float _mStockBinRemainingWeight; | |||
/// <summary> | |||
/// 原料对应料仓的位置 | |||
/// </summary> | |||
public int RawMaterialLocation { get { return _mRawMaterialLocation; } set { _mRawMaterialLocation = value;OnPropertyChanged(); } } | |||
private int _mRawMaterialLocation; | |||
} | |||
} |
@@ -0,0 +1,122 @@ | |||
<Window | |||
x:Class="BPASmartClient.DosingHKProject.View.ChangeDeviceNameView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingHKProject.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingHKProject.ViewModel" | |||
Title="ChangeDeviceNameView" | |||
Width="400" | |||
Height="200" | |||
AllowsTransparency="True" | |||
Background="{x:Null}" | |||
Topmost="True" | |||
WindowStartupLocation="CenterScreen" | |||
WindowStyle="None" | |||
mc:Ignorable="d"> | |||
<Window.DataContext> | |||
<vm:ChangeDeviceNameViewModel /> | |||
</Window.DataContext> | |||
<Window.Resources> | |||
<ResourceDictionary> | |||
<ResourceDictionary.MergedDictionaries> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" /> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" /> | |||
<ResourceDictionary> | |||
<!--#region ListBox样式--> | |||
<Style x:Key="ListBoxItemStyle1" TargetType="{x:Type ListBoxItem}"> | |||
<Setter Property="OverridesDefaultStyle" Value="True" /> | |||
<Setter Property="SnapsToDevicePixels" Value="True" /> | |||
<Setter Property="BorderBrush" Value="{x:Null}" /> | |||
<Setter Property="Foreground" Value="White" /> | |||
<Setter Property="FontSize" Value="20" /> | |||
<Setter Property="HorizontalContentAlignment" Value="Center" /> | |||
<Setter Property="VerticalContentAlignment" Value="Center" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type ListBoxItem}"> | |||
<Border x:Name="border" CornerRadius="8"> | |||
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" /> | |||
</Border> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<!--#endregion--> | |||
</ResourceDictionary> | |||
</ResourceDictionary.MergedDictionaries> | |||
</ResourceDictionary> | |||
</Window.Resources> | |||
<Border | |||
Name="br" | |||
Background="#FF0B2F5F" | |||
BorderThickness="1"> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition Height="0.5*" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<StackPanel | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Orientation="Horizontal"> | |||
<TextBlock | |||
Margin="10,0,0,0" | |||
Background="Transparent" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="请输入新设备名称:" /> | |||
<TextBox | |||
Grid.Column="1" | |||
Width="200" | |||
Height="30" | |||
Margin="0,0,7,0" | |||
FontSize="16" | |||
Text="{Binding DeviceName}" /> | |||
</StackPanel> | |||
<TextBlock | |||
Grid.Row="1" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Background="Transparent" | |||
FontSize="16" | |||
Foreground="Red" | |||
Text="{Binding ErrorInfo}" /> | |||
<Grid Grid.Row="2"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<Button | |||
Grid.Column="1" | |||
Width="148" | |||
Height="30" | |||
Margin="0,0,7,0" | |||
Command="{Binding ConfirmCommand}" | |||
Content="确认" /> | |||
<Button | |||
Name="btClose" | |||
Width="148" | |||
Height="30" | |||
Command="{Binding CancleCommand}" | |||
Content="取消" /> | |||
</Grid> | |||
</Grid> | |||
</Border> | |||
</Window> |
@@ -0,0 +1,31 @@ | |||
using BPASmartClient.Helper; | |||
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.Shapes; | |||
namespace BPASmartClient.DosingHKProject.View | |||
{ | |||
/// <summary> | |||
/// ChangeDeviceNameView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class ChangeDeviceNameView : Window | |||
{ | |||
public ChangeDeviceNameView() | |||
{ | |||
InitializeComponent(); | |||
ActionManage.GetInstance.CancelRegister("ChangeDeviceNameViewClose"); | |||
ActionManage.GetInstance.Register(new Action(() => { this.Close(); }), "ChangeDeviceNameViewClose"); | |||
this.br.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); }; | |||
} | |||
} | |||
} |
@@ -0,0 +1,168 @@ | |||
<UserControl | |||
x:Class="BPASmartClient.DosingHKProject.View.DeviceListView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:control="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingHKProject.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingHKProject.ViewModel" | |||
d:DesignHeight="450" | |||
d:DesignWidth="800" | |||
mc:Ignorable="d"> | |||
<UserControl.DataContext> | |||
<vm:DeviceListViewModel /> | |||
</UserControl.DataContext> | |||
<UserControl.Resources> | |||
<Style x:Key="UserItemContainerStyle" TargetType="ListBoxItem"> | |||
<Style.Resources> | |||
<!-- SelectedItem with focus --> | |||
<SolidColorBrush | |||
x:Key="{x:Static SystemColors.HighlightBrushKey}" | |||
Opacity=".4" | |||
Color="White" /> | |||
<!-- SelectedItem without focus --> | |||
<SolidColorBrush | |||
x:Key="{x:Static SystemColors.ControlBrushKey}" | |||
Opacity=".4" | |||
Color="White" /> | |||
</Style.Resources> | |||
<!-- 设置触发器 --> | |||
<Style.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter Property="Background" Value="White" /> | |||
<Setter Property="Foreground" Value="White" /> | |||
</Trigger> | |||
<Trigger Property="IsFocused" Value="true"> | |||
<Setter Property="Background" Value="White" /> | |||
<Setter Property="Foreground" Value="White" /> | |||
</Trigger> | |||
</Style.Triggers> | |||
</Style> | |||
</UserControl.Resources> | |||
<Grid Margin="-5,0,5,0"> | |||
<Grid> | |||
<ListView | |||
Grid.Column="1" | |||
Margin="10" | |||
Background="Transparent" | |||
BorderBrush="#00BEFA" | |||
BorderThickness="0" | |||
ItemsSource="{Binding devices}" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListView.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<!--<UniformGrid | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
Columns="8" />--> | |||
<WrapPanel Orientation="Horizontal" /> | |||
</ItemsPanelTemplate> | |||
</ListView.ItemsPanel> | |||
<ListView.ItemTemplate> | |||
<DataTemplate> | |||
<Border | |||
Name="ShadowElement" | |||
Width="180" | |||
Height="150" | |||
Margin="10" | |||
VerticalAlignment="Top" | |||
BorderBrush="#00BEFA" | |||
BorderThickness="0" | |||
ClipToBounds="True" | |||
CornerRadius="0"> | |||
<Border.Background> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/蓝色背景.png" /> | |||
</Border.Background> | |||
<Grid Margin="20,0,20,0"> | |||
<!--<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions>--> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<TextBlock | |||
Grid.Row="0" | |||
Grid.ColumnSpan="2" | |||
Margin="0,10,0,0" | |||
VerticalAlignment="Center" | |||
FontSize="20" | |||
Foreground="#00BEFA" | |||
Text="{Binding DeviceName}" /> | |||
<StackPanel | |||
Grid.Row="1" | |||
VerticalAlignment="Center" | |||
Orientation="Horizontal"> | |||
<TextBlock | |||
Grid.Row="1" | |||
FontSize="14" | |||
Foreground="#aa00BEFA" | |||
Text="设备IP:" /> | |||
<TextBlock | |||
Grid.Row="1" | |||
FontSize="14" | |||
Foreground="#aa00BEFA" | |||
Text="{Binding IpAddress}" /> | |||
</StackPanel> | |||
<Button | |||
Grid.Row="2" | |||
Width="130" | |||
Height="30" | |||
Margin="0,0,0,0" | |||
VerticalAlignment="Top" | |||
Command="{Binding DataContext.ChangeNameCommand, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding IpAddress}" | |||
Content="修改原料名称" | |||
FontSize="16" | |||
IsEnabled="{Binding IsEnable}" | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
<!--<Button | |||
Grid.Row="1" | |||
Grid.Column="0" | |||
Grid.ColumnSpan="2" | |||
Foreground="#00BEFA" | |||
Width="130" | |||
Height="30" | |||
Margin="0,0,0,10" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Bottom" | |||
Command="{Binding DataContext.ChangeNameCommand, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding IpAddress}" | |||
Content="修改原料名称" | |||
IsEnabled="{Binding IsEnable}"> | |||
<Button.Background> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/系统名称.png" /> | |||
</Button.Background> | |||
</Button>--> | |||
</Grid> | |||
</Border> | |||
</DataTemplate> | |||
</ListView.ItemTemplate> | |||
</ListView> | |||
</Grid> | |||
</Grid> | |||
</UserControl> |
@@ -0,0 +1,28 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using System.Windows.Controls; | |||
using System.Windows.Data; | |||
using System.Windows.Documents; | |||
using System.Windows.Input; | |||
using System.Windows.Media; | |||
using System.Windows.Media.Imaging; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
namespace BPASmartClient.DosingHKProject.View | |||
{ | |||
/// <summary> | |||
/// DeviceListView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class DeviceListView : UserControl | |||
{ | |||
public DeviceListView() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,370 @@ | |||
<UserControl | |||
x:Class="BPASmartClient.DosingHKProject.View.DeviceMaterialParView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:con="clr-namespace:BPASmartClient.DosingHKProject.Converter" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingHKProject.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingHKProject.ViewModel" | |||
d:DesignHeight="1080" | |||
d:DesignWidth="1920" | |||
mc:Ignorable="d"> | |||
<UserControl.DataContext> | |||
<vm:DeviceMaterialParViewModel /> | |||
</UserControl.DataContext> | |||
<UserControl.Resources> | |||
<SolidColorBrush x:Key="tabColor" Color="#FF2AB2E7" /> | |||
<!--<SolidColorBrush x:Key="bordColor" Color="#33ffffff" />--> | |||
<SolidColorBrush x:Key="bordColor" Color="#332AB2E7" /> | |||
<con:DataTableRedundantConverter x:Key="tabConvert" /> | |||
<Style x:Key="RowRadioButtonStyle" TargetType="{x:Type RadioButton}"> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type RadioButton}"> | |||
<Border | |||
x:Name="NvaBor" | |||
Background="Transparent" | |||
BorderBrush="#FF2AB2E7" | |||
BorderThickness="0"> | |||
<ContentControl | |||
Margin="10,4" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
HorizontalContentAlignment="Center" | |||
VerticalContentAlignment="Center" | |||
Content="{TemplateBinding Content}" | |||
FontSize="16" /> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsChecked" Value="True"> | |||
<Setter TargetName="NvaBor" Property="Background" Value="#22ffffff" /> | |||
<Setter TargetName="NvaBor" Property="BorderThickness" Value="0" /> | |||
</Trigger> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<Condition Property="IsChecked" Value="false" /> | |||
<Condition Property="IsMouseOver" Value="True" /> | |||
</MultiTrigger.Conditions> | |||
<MultiTrigger.Setters> | |||
<Setter TargetName="NvaBor" Property="Background" Value="#22ffffff" /> | |||
</MultiTrigger.Setters> | |||
</MultiTrigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style x:Key="InputTextboxStyle" TargetType="TextBox"> | |||
<Setter Property="Margin" Value="5,0,0,0" /> | |||
<Setter Property="BorderThickness" Value="0" /> | |||
<Setter Property="HorizontalAlignment" Value="Left" /> | |||
<Setter Property="Width" Value="150" /> | |||
<Setter Property="Height" Value="40" /> | |||
<Setter Property="CaretBrush" Value="{StaticResource TitleBorderColor}" /> | |||
<Setter Property="Foreground" Value="{StaticResource TitleBorderColor}" /> | |||
<Setter Property="VerticalContentAlignment" Value="Center" /> | |||
<Setter Property="FontSize" Value="14" /> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
</Style> | |||
<Style x:Key="ControlButtonStyle" TargetType="Button"> | |||
<Setter Property="Margin" Value="0" /> | |||
<Setter Property="FontSize" Value="18" /> | |||
<Setter Property="Foreground" Value="#FFF53F62" /> | |||
<Setter Property="FontWeight" Value="SemiBold" /> | |||
<Setter Property="FontFamily" Value="楷体" /> | |||
<Setter Property="VerticalContentAlignment" Value="Center" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="Button"> | |||
<Border | |||
Name="TitleBarBr" | |||
BorderBrush="#00c2f4" | |||
BorderThickness="0" | |||
CornerRadius="0" | |||
Opacity="0.8"> | |||
<ContentPresenter | |||
Margin="{TemplateBinding Margin}" | |||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" | |||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" /> | |||
<Border.Background> | |||
<ImageBrush | |||
ImageSource="/BPASmartClient.CustomResource;component/Image/组合边框1.1.png" | |||
Opacity="0.8" | |||
Stretch="Fill" /> | |||
</Border.Background> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter TargetName="TitleBarBr" Property="Opacity" Value="1" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style x:Key="TitleTextblockStyle" TargetType="TextBlock"> | |||
<Setter Property="FontSize" Value="16" /> | |||
<Setter Property="HorizontalAlignment" Value="Center" /> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
<Setter Property="Foreground" Value="{StaticResource tabColor}" /> | |||
<Setter Property="FontFamily" Value="楷体" /> | |||
<Setter Property="FontWeight" Value="SemiBold" /> | |||
</Style> | |||
</UserControl.Resources> | |||
<Grid Margin="10"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40" /> | |||
<RowDefinition Height="40" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal"> | |||
<Button | |||
Width="150" | |||
Height="40" | |||
Margin="10,0,10,0" | |||
Command="{Binding AddCommand}" | |||
Content="添加原料参数" | |||
FontSize="20" | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
<Button | |||
Width="150" | |||
Height="40" | |||
Margin="10,0,10,0" | |||
Command="{Binding SaveCommand}" | |||
Content="保存参数" | |||
FontSize="20" | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
</StackPanel> | |||
<!--#region 表格标题栏设置--> | |||
<Grid | |||
Grid.Row="1" | |||
Margin="0,10,0,0" | |||
Background="#ff0C255F"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="0" | |||
Style="{StaticResource TitleTextblockStyle}" | |||
Text="原料名称" /> | |||
<Grid Grid.Column="1"> | |||
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="慢加重量(g)" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="2" | |||
Style="{StaticResource TitleTextblockStyle}" | |||
Text="提前关阀重量" /> | |||
<Grid Grid.Column="3"> | |||
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="快加速度" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="4" | |||
Style="{StaticResource TitleTextblockStyle}" | |||
Text="慢加速度" /> | |||
<Grid Grid.Column="5"> | |||
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="伺服手动速度" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="6" | |||
Style="{StaticResource TitleTextblockStyle}" | |||
Text="料仓上限重量" /> | |||
<Grid Grid.Column="7"> | |||
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="料仓下限重量" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="8" | |||
Style="{StaticResource TitleTextblockStyle}" | |||
Text="搅拌速度" /> | |||
<Grid Grid.Column="9"> | |||
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="功能操作" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<Border | |||
Grid.ColumnSpan="10" | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<!--#endregion--> | |||
<Grid Grid.Row="2"> | |||
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"> | |||
<ItemsControl ItemsSource="{Binding deviceParModels}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid Name="gr" Height="30"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBox | |||
Grid.Column="0" | |||
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}" | |||
Style="{StaticResource InputTextboxStyle}" | |||
Text="{Binding MaterialName}" /> | |||
<Grid Grid.Column="1"> | |||
<TextBox | |||
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}" | |||
Style="{StaticResource InputTextboxStyle}" | |||
Text="{Binding SlowlyAddWeight}" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBox | |||
Grid.Column="2" | |||
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}" | |||
Style="{StaticResource InputTextboxStyle}" | |||
Text="{Binding PreCloseValveWeight}" /> | |||
<Grid Grid.Column="3"> | |||
<TextBox | |||
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}" | |||
Style="{StaticResource InputTextboxStyle}" | |||
Text="{Binding RapidAcceleration}" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBox | |||
Grid.Column="4" | |||
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}" | |||
Style="{StaticResource InputTextboxStyle}" | |||
Text="{Binding SlowAcceleration}" /> | |||
<Grid Grid.Column="5"> | |||
<TextBox | |||
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}" | |||
Style="{StaticResource InputTextboxStyle}" | |||
Text="{Binding ServoManualSpeed}" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBox | |||
Grid.Column="6" | |||
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}" | |||
Style="{StaticResource InputTextboxStyle}" | |||
Text="{Binding SiloUpperLimitWeight}" /> | |||
<Grid Grid.Column="7"> | |||
<TextBox | |||
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}" | |||
Style="{StaticResource InputTextboxStyle}" | |||
Text="{Binding LowerLimitWeightOfSilo}" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBox | |||
Grid.Column="8" | |||
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}" | |||
Style="{StaticResource InputTextboxStyle}" | |||
Text="{Binding StirringSpeed}" /> | |||
<Grid Grid.Column="9"> | |||
<Button | |||
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
CommandParameter="{Binding MaterialName}" | |||
Content="删除" | |||
FontSize="16" | |||
Style="{StaticResource ControlButtonStyle}" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<Border | |||
Grid.ColumnSpan="10" | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,1" /> | |||
</Grid> | |||
<DataTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" /> | |||
</Trigger> | |||
</DataTemplate.Triggers> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</ScrollViewer> | |||
</Grid> | |||
</Grid> | |||
</UserControl> |
@@ -0,0 +1,28 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using System.Windows.Controls; | |||
using System.Windows.Data; | |||
using System.Windows.Documents; | |||
using System.Windows.Input; | |||
using System.Windows.Media; | |||
using System.Windows.Media.Imaging; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
namespace BPASmartClient.DosingHKProject.View | |||
{ | |||
/// <summary> | |||
/// DeviceMaterialParView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class DeviceMaterialParView : UserControl | |||
{ | |||
public DeviceMaterialParView() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,205 @@ | |||
<UserControl | |||
x:Class="BPASmartClient.DosingHKProject.View.HardwareStatusView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:control="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingHKProject.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingHKProject.ViewModel" | |||
d:DesignHeight="1080" | |||
d:DesignWidth="1920" | |||
mc:Ignorable="d"> | |||
<UserControl.DataContext> | |||
<vm:HardwareStatusViewModel /> | |||
</UserControl.DataContext> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="0.5*" /> | |||
<RowDefinition /> | |||
<RowDefinition Height="0.5*" /> | |||
</Grid.RowDefinitions> | |||
<!--#region 顶部料仓--> | |||
<Grid Name="TopGrid"> | |||
<ListView | |||
Height="{Binding ElementName=TopGrid, Path=ActualHeight}" | |||
VerticalAlignment="Center" | |||
Background="Transparent" | |||
BorderThickness="0" | |||
ItemsSource="{Binding TopDeviceCurrentStatuses}" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListView.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<!--<WrapPanel Orientation="Horizontal" IsItemsHost="True"/>--> | |||
<UniformGrid | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
Columns="8" | |||
Rows="1" /> | |||
</ItemsPanelTemplate> | |||
</ListView.ItemsPanel> | |||
<ListView.ItemTemplate> | |||
<DataTemplate> | |||
<Border Margin="5" Background="Transparent"> | |||
<Grid Height="220"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<TextBlock | |||
Margin="0,0,0,35" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Bottom" | |||
FontSize="25" | |||
Foreground="#ffccd61f" | |||
Text="{Binding DeviceName}" /> | |||
<StackPanel | |||
Grid.Row="1" | |||
Margin="0,25,0,0" | |||
HorizontalAlignment="Center" | |||
Orientation="Horizontal"> | |||
<TextBlock | |||
FontSize="20" | |||
Foreground="#FF0084FF" | |||
Text="{Binding Weight}" /> | |||
<TextBlock | |||
FontSize="20" | |||
Foreground="#FF0084FF" | |||
Text=" kg" /> | |||
</StackPanel> | |||
<StackPanel | |||
Grid.Row="1" | |||
Margin="0,70,0,0" | |||
HorizontalAlignment="Center" | |||
Orientation="Horizontal"> | |||
<TextBlock | |||
FontSize="20" | |||
Foreground="#FF0084FF" | |||
Text="{Binding DeviceNum}" /> | |||
<TextBlock | |||
FontSize="20" | |||
Foreground="#FF0084FF" | |||
Text=" 号仓" /> | |||
</StackPanel> | |||
<Image | |||
Grid.RowSpan="2" | |||
Source="/BPASmartClient.CustomResource;component/Image/光柱.png" | |||
Stretch="Fill" /> | |||
</Grid> | |||
</Border> | |||
</DataTemplate> | |||
</ListView.ItemTemplate> | |||
</ListView> | |||
</Grid> | |||
<!--#endregion--> | |||
<Grid x:Name="gr" Grid.Row="1"> | |||
<pry:ConveyorBelt | |||
Grid.Row="1" | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
Margin="10,0,400,0" | |||
ConveyorBeltWidth="70" | |||
Direction="0" | |||
StrokeBrush="#00BEFA" | |||
StrokeDashArray="1.5 1.5" | |||
StrokeFillBrush="#00BEFA" | |||
StrokeThickness="2" /> | |||
</Grid> | |||
<!--#region 底部料仓--> | |||
<Grid Grid.Row="2"> | |||
<ListView | |||
VerticalAlignment="Center" | |||
Background="Transparent" | |||
BorderThickness="0" | |||
ItemsSource="{Binding BottomDeviceCurrentStatuses}" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListView.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<UniformGrid | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
Columns="8" | |||
Rows="1" /> | |||
</ItemsPanelTemplate> | |||
</ListView.ItemsPanel> | |||
<ListView.ItemTemplate> | |||
<DataTemplate> | |||
<Border Margin="5" Background="Transparent"> | |||
<Grid Height="220"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<TextBlock | |||
Margin="0,0,0,35" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Bottom" | |||
FontSize="25" | |||
Foreground="#ffccd61f" | |||
Text="{Binding DeviceName}" /> | |||
<StackPanel | |||
Grid.Row="1" | |||
Margin="0,25,0,0" | |||
HorizontalAlignment="Center" | |||
Orientation="Horizontal"> | |||
<TextBlock | |||
FontSize="20" | |||
Foreground="#FF0084FF" | |||
Text="{Binding Weight}" /> | |||
<TextBlock | |||
FontSize="20" | |||
Foreground="#FF0084FF" | |||
Text=" kg" /> | |||
</StackPanel> | |||
<StackPanel | |||
Grid.Row="1" | |||
Margin="0,70,0,0" | |||
HorizontalAlignment="Center" | |||
Orientation="Horizontal"> | |||
<TextBlock | |||
FontSize="20" | |||
Foreground="#FF0084FF" | |||
Text="{Binding DeviceNum}" /> | |||
<TextBlock | |||
FontSize="20" | |||
Foreground="#FF0084FF" | |||
Text=" 号仓" /> | |||
</StackPanel> | |||
<Image | |||
Grid.RowSpan="2" | |||
Source="/BPASmartClient.CustomResource;component/Image/光柱.png" | |||
Stretch="Fill" /> | |||
</Grid> | |||
</Border> | |||
</DataTemplate> | |||
</ListView.ItemTemplate> | |||
</ListView> | |||
</Grid> | |||
<!--#endregion--> | |||
</Grid> | |||
</UserControl> |
@@ -0,0 +1,28 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using System.Windows.Controls; | |||
using System.Windows.Data; | |||
using System.Windows.Documents; | |||
using System.Windows.Input; | |||
using System.Windows.Media; | |||
using System.Windows.Media.Imaging; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
namespace BPASmartClient.DosingHKProject.View | |||
{ | |||
/// <summary> | |||
/// HardwareStatusView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class HardwareStatusView : UserControl | |||
{ | |||
public HardwareStatusView() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,450 @@ | |||
<UserControl | |||
x:Class="BPASmartClient.DosingHKProject.View.ManualControlView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingHKProject.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingHKProject.ViewModel" | |||
d:DesignHeight="850" | |||
d:DesignWidth="1200" | |||
mc:Ignorable="d"> | |||
<UserControl.Resources> | |||
<Style x:Key="radioButtonStyle" TargetType="RadioButton"> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="RadioButton"> | |||
<Grid Name="gr" Opacity="0.8"> | |||
<ContentControl | |||
Margin="{TemplateBinding Margin}" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
HorizontalContentAlignment="Center" | |||
VerticalContentAlignment="Center" | |||
Content="{TemplateBinding Content}" | |||
FontSize="{TemplateBinding FontSize}" | |||
Foreground="{TemplateBinding Foreground}" /> | |||
<Image | |||
Name="image" | |||
Source="/BPASmartClient.CustomResource;component/Image/边框线.png" | |||
Stretch="Fill" /> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsChecked" Value="False"> | |||
<Setter TargetName="image" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/边框线.png" /> | |||
</Trigger> | |||
<Trigger Property="IsChecked" Value="True"> | |||
<Setter TargetName="image" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/透明背景.png" /> | |||
</Trigger> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter TargetName="gr" Property="Opacity" Value="1" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
</UserControl.Resources> | |||
<UserControl.DataContext> | |||
<vm:ManualControlViewModel /> | |||
</UserControl.DataContext> | |||
<Grid Margin="8"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="3*"/> | |||
<RowDefinition Height="3*"/> | |||
<RowDefinition Height="3*"/> | |||
<!--<RowDefinition Height="2*"/>--> | |||
</Grid.RowDefinitions> | |||
<Grid | |||
Name="jiu" | |||
Grid.Row="0" | |||
Margin="5"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="20" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<pry:ImageBorder | |||
Grid.RowSpan="2" | |||
Width="{Binding ElementName=tp, Path=ActualWidth}" | |||
Height="{Binding ElementName=tp, Path=ActualHeight}" /> | |||
<Image | |||
Margin="2,3,0,0" | |||
HorizontalAlignment="Left" | |||
Source="/BPASmartClient.CustomResource;component/Image/标签.png" /> | |||
<TextBlock | |||
Margin="10,0,0,0" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="Aqua" | |||
Text="总控制" /> | |||
<Grid Grid.Row="1"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="1*"></ColumnDefinition> | |||
<ColumnDefinition Width="1*"></ColumnDefinition> | |||
<ColumnDefinition Width="1*"></ColumnDefinition> | |||
</Grid.ColumnDefinitions> | |||
<Grid.RowDefinitions> | |||
<RowDefinition></RowDefinition> | |||
<RowDefinition></RowDefinition> | |||
</Grid.RowDefinitions> | |||
<pry:IcoButton | |||
Grid.Row="0" | |||
Grid.Column="0" | |||
Margin="20" | |||
Command="{Binding StartCommand}" | |||
Content="启动" | |||
FontSize="32" | |||
Foreground="Aqua" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
<pry:IcoButton | |||
Grid.Row="1" | |||
Margin="20" | |||
Command="{Binding CloseCommand}" | |||
Content="停止" | |||
FontSize="32" | |||
Foreground="Aqua" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
<pry:IcoButton | |||
Grid.Row="0" | |||
Grid.Column="1" | |||
Margin="20" | |||
Command="{Binding StartCommand}" | |||
Content="暂停" | |||
FontSize="32" | |||
Foreground="Aqua" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
<pry:IcoButton | |||
Grid.Row="1" | |||
Grid.Column="1" | |||
Margin="20" | |||
Command="{Binding StartCommand}" | |||
Content="恢复" | |||
FontSize="32" | |||
Foreground="Aqua" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
</Grid> | |||
</Grid> | |||
<!--#region 升降气缸--> | |||
<Grid | |||
Name="cy" | |||
Grid.Row="1" | |||
Margin="5"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<pry:ImageBorder | |||
Grid.RowSpan="2" | |||
Width="{Binding ElementName=cy, Path=ActualWidth}" | |||
Height="{Binding ElementName=cy, Path=ActualHeight}" /> | |||
<Image | |||
Margin="2,3,0,0" | |||
HorizontalAlignment="Left" | |||
Source="/BPASmartClient.CustomResource;component/Image/标签.png" /> | |||
<TextBlock | |||
Margin="10,0,0,0" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="Aqua" | |||
Text="升降气缸控制" /> | |||
<ListView | |||
Grid.Row="1" | |||
Background="Transparent" | |||
BorderBrush="#00BEFA" | |||
BorderThickness="0" | |||
ItemsSource="{Binding cylinderModels}" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListView.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<UniformGrid | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
Columns="8" /> | |||
</ItemsPanelTemplate> | |||
</ListView.ItemsPanel> | |||
<ListView.ItemTemplate> | |||
<DataTemplate> | |||
<Grid | |||
Width="200" | |||
Height="100" | |||
Margin="0,0,0,15" | |||
Background="Transparent"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="30" /> | |||
<RowDefinition /> | |||
<RowDefinition Height="30" /> | |||
</Grid.RowDefinitions> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.5*" /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="1" | |||
Grid.ColumnSpan="2" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Foreground="Aqua" | |||
Text="{Binding Name}" /> | |||
<pry:Cylinder | |||
Grid.Row="1" | |||
Grid.ColumnSpan="3" | |||
Width="200" | |||
Height="50" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
LeftTogIsChecked="{Binding LeftTog}" | |||
RightTogIsChecked="{Binding RightTog}" /> | |||
<RadioButton | |||
Grid.Row="2" | |||
Grid.Column="1" | |||
Command="{Binding DataContext.Open, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding Name}" | |||
Content="伸出" | |||
Foreground="Aqua" | |||
IsChecked="True" | |||
Style="{StaticResource radioButtonStyle}" /> | |||
<RadioButton | |||
Grid.Row="2" | |||
Grid.Column="2" | |||
Command="{Binding DataContext.Close, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding Name}" | |||
Content="缩回" | |||
Foreground="Aqua" | |||
IsChecked="False" | |||
Style="{StaticResource radioButtonStyle}" /> | |||
</Grid> | |||
</DataTemplate> | |||
</ListView.ItemTemplate> | |||
</ListView> | |||
</Grid> | |||
<!--#endregion--> | |||
<!--#region 阻挡气缸--> | |||
<!--<Grid | |||
Name="zd" | |||
Grid.Row="2" | |||
Margin="5"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<pry:ImageBorder | |||
Grid.RowSpan="2" | |||
Width="{Binding ElementName=zd, Path=ActualWidth}" | |||
Height="{Binding ElementName=zd, Path=ActualHeight}" /> | |||
<Image | |||
Margin="2,3,0,0" | |||
HorizontalAlignment="Left" | |||
Source="/BPASmartClient.CustomResource;component/Image/标签.png" /> | |||
<TextBlock | |||
Margin="10,0,0,0" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="Aqua" | |||
Text="阻挡气缸控制" /> | |||
<ListView | |||
Grid.Row="1" | |||
Margin="10" | |||
Background="Transparent" | |||
BorderBrush="#00BEFA" | |||
BorderThickness="0" | |||
ItemsSource="{Binding BlockCylinders}" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListView.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<UniformGrid | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
Columns="8" /> | |||
</ItemsPanelTemplate> | |||
</ListView.ItemsPanel> | |||
<ListView.ItemTemplate> | |||
<DataTemplate> | |||
<Grid | |||
Width="200" | |||
Height="100" | |||
Margin="0,0,0,15" | |||
Background="Transparent"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="30" /> | |||
<RowDefinition /> | |||
<RowDefinition Height="30" /> | |||
</Grid.RowDefinitions> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.5*" /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="1" | |||
Grid.ColumnSpan="2" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Foreground="Aqua" | |||
Text="{Binding Name}" /> | |||
<pry:Cylinder | |||
Grid.Row="1" | |||
Grid.ColumnSpan="3" | |||
Width="200" | |||
Height="50" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
LeftTogIsChecked="{Binding LeftTog}" | |||
RightTogIsChecked="{Binding RightTog}" /> | |||
<RadioButton | |||
Grid.Row="2" | |||
Grid.Column="1" | |||
Command="{Binding DataContext.Open, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding Name}" | |||
Content="伸出" | |||
Foreground="Aqua" | |||
IsChecked="True" | |||
Style="{StaticResource radioButtonStyle}" /> | |||
<RadioButton | |||
Grid.Row="2" | |||
Grid.Column="2" | |||
Command="{Binding DataContext.Close, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding Name}" | |||
Content="缩回" | |||
Foreground="Aqua" | |||
IsChecked="False" | |||
Style="{StaticResource radioButtonStyle}" /> | |||
</Grid> | |||
</DataTemplate> | |||
</ListView.ItemTemplate> | |||
</ListView> | |||
</Grid>--> | |||
<!--#endregion--> | |||
<!--#region 托盘气缸--> | |||
<Grid | |||
Name="tp" | |||
Grid.Row="2" | |||
Margin="5"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<pry:ImageBorder | |||
Grid.RowSpan="2" | |||
Width="{Binding ElementName=tp, Path=ActualWidth}" | |||
Height="{Binding ElementName=tp, Path=ActualHeight}" /> | |||
<Image | |||
Margin="2,3,0,0" | |||
HorizontalAlignment="Left" | |||
Source="/BPASmartClient.CustomResource;component/Image/标签.png" /> | |||
<TextBlock | |||
Margin="10,0,0,0" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="Aqua" | |||
Text="其他气缸控制" /> | |||
<ListView | |||
Grid.Row="2" | |||
Margin="10" | |||
Background="Transparent" | |||
BorderBrush="#00BEFA" | |||
BorderThickness="0" | |||
ItemsSource="{Binding PalletCylinders}" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListView.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<UniformGrid | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
Columns="8" /> | |||
</ItemsPanelTemplate> | |||
</ListView.ItemsPanel> | |||
<ListView.ItemTemplate> | |||
<DataTemplate> | |||
<Grid | |||
Width="200" | |||
Height="100" | |||
Margin="0,0,0,15" | |||
Background="Transparent"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="30" /> | |||
<RowDefinition /> | |||
<RowDefinition Height="30" /> | |||
</Grid.RowDefinitions> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.5*" /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="1" | |||
Grid.ColumnSpan="2" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Foreground="Aqua" | |||
Text="{Binding Name}" /> | |||
<pry:Cylinder | |||
Grid.Row="1" | |||
Grid.ColumnSpan="3" | |||
Width="200" | |||
Height="50" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
LeftTogIsChecked="{Binding LeftTog}" | |||
RightTogIsChecked="{Binding RightTog}" /> | |||
<RadioButton | |||
Grid.Row="2" | |||
Grid.Column="1" | |||
Command="{Binding DataContext.Open, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding Name}" | |||
Content="伸出" | |||
Foreground="Aqua" | |||
IsChecked="True" | |||
Style="{StaticResource radioButtonStyle}" /> | |||
<RadioButton | |||
Grid.Row="2" | |||
Grid.Column="2" | |||
Command="{Binding DataContext.Close, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding Name}" | |||
Content="缩回" | |||
Foreground="Aqua" | |||
IsChecked="False" | |||
Style="{StaticResource radioButtonStyle}" /> | |||
</Grid> | |||
</DataTemplate> | |||
</ListView.ItemTemplate> | |||
</ListView> | |||
</Grid> | |||
<!--#endregion--> | |||
</Grid> | |||
</UserControl> |
@@ -0,0 +1,28 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using System.Windows.Controls; | |||
using System.Windows.Data; | |||
using System.Windows.Documents; | |||
using System.Windows.Input; | |||
using System.Windows.Media; | |||
using System.Windows.Media.Imaging; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
namespace BPASmartClient.DosingHKProject.View | |||
{ | |||
/// <summary> | |||
/// ManualControlView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class ManualControlView : UserControl | |||
{ | |||
public ManualControlView() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,236 @@ | |||
<Window | |||
x:Class="BPASmartClient.DosingHKProject.View.NewLocalRecipeView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingHKProject.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingHKProject.ViewModel" | |||
Title="NewRemoteRecipeView" | |||
Width="700" | |||
Height="520" | |||
AllowsTransparency="True" | |||
Background="{x:Null}" | |||
Topmost="True" | |||
WindowStartupLocation="CenterScreen" | |||
WindowStyle="None" | |||
mc:Ignorable="d"> | |||
<Window.DataContext> | |||
<vm:NewLocalRecipeViewModel /> | |||
</Window.DataContext> | |||
<Window.Resources> | |||
<ResourceDictionary> | |||
<ResourceDictionary.MergedDictionaries> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" /> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" /> | |||
<ResourceDictionary> | |||
<!--#region ListBox样式--> | |||
<Style x:Key="ListBoxItemStyle1" TargetType="{x:Type ListBoxItem}"> | |||
<Setter Property="OverridesDefaultStyle" Value="True" /> | |||
<Setter Property="SnapsToDevicePixels" Value="True" /> | |||
<Setter Property="BorderBrush" Value="{x:Null}" /> | |||
<Setter Property="Foreground" Value="White" /> | |||
<Setter Property="FontSize" Value="20" /> | |||
<Setter Property="HorizontalContentAlignment" Value="Center" /> | |||
<Setter Property="VerticalContentAlignment" Value="Center" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type ListBoxItem}"> | |||
<Border x:Name="border" CornerRadius="8"> | |||
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" /> | |||
</Border> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<!--#endregion--> | |||
</ResourceDictionary> | |||
</ResourceDictionary.MergedDictionaries> | |||
</ResourceDictionary> | |||
</Window.Resources> | |||
<Border | |||
Name="br" | |||
BorderBrush="#0CADF5" | |||
BorderThickness="2"> | |||
<Border.Background> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/bg.png" /> | |||
<!--<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/弹窗2.png" />--> | |||
</Border.Background> | |||
<Grid Margin="10"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40" /> | |||
<RowDefinition Height="40" /> | |||
<RowDefinition Height="40" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<Grid Grid.Row="0"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition></ColumnDefinition> | |||
<ColumnDefinition></ColumnDefinition> | |||
</Grid.ColumnDefinitions> | |||
<StackPanel VerticalAlignment="Center" Grid.Column="0" Orientation="Horizontal"> | |||
<TextBlock | |||
Width="100" | |||
Margin="10,0,10,0" | |||
Background="Transparent" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="配方名称:" /> | |||
<TextBox | |||
Width="120" | |||
Height="30" | |||
FontSize="16" | |||
Text="{Binding RecipeName}" /> | |||
</StackPanel> | |||
<WrapPanel VerticalAlignment="Center" Grid.Column="1"> | |||
</WrapPanel> | |||
</Grid> | |||
<Grid Grid.Row="1"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="1*" /> | |||
<ColumnDefinition Width="1*" /> | |||
</Grid.ColumnDefinitions> | |||
<WrapPanel VerticalAlignment="Center" Grid.Column="0"> | |||
<TextBlock | |||
Width="100" | |||
Margin="10,0,10,0" | |||
Background="Transparent" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="配方编码:" /> | |||
<TextBox | |||
Width="120" | |||
Height="30" | |||
FontSize="16" | |||
Text="{Binding RecipeCode}" /> | |||
</WrapPanel> | |||
<WrapPanel HorizontalAlignment="Right" Orientation="Horizontal" Grid.Column="1"> | |||
<Button | |||
Width="100" | |||
Height="40" | |||
Margin="5,0,5,0" | |||
Command="{Binding AddCommand}" | |||
Content="添加原料" | |||
FontSize="20" | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
<Button | |||
Width="100" | |||
Height="40" | |||
Margin="5,0,10,0" | |||
Command="{Binding SaveCommand}" | |||
Content="保存配方" | |||
FontSize="20" | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
<Button | |||
Name ="Close" | |||
Width="100" | |||
Height="40" | |||
Margin="5,0,5,0" | |||
Content="取消" | |||
FontSize="20" | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
</WrapPanel> | |||
</Grid> | |||
<!--#region 表格标题栏设置--> | |||
<Grid | |||
Grid.Row="2" | |||
Margin="0,10,0,0" | |||
Background="#ff0C255F"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="1*"/> | |||
<ColumnDefinition Width="1*"/> | |||
<ColumnDefinition Width="1*"/> | |||
<ColumnDefinition Width="1*"/> | |||
<ColumnDefinition Width="1*"/> | |||
</Grid.ColumnDefinitions> | |||
<Grid Grid.Column="0"> | |||
<TextBlock Text="原料名称" HorizontalAlignment="Center" /> | |||
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBlock Grid.Column="1" Text="原料位置" HorizontalAlignment="Center" /> | |||
<Grid Grid.Column="2"> | |||
<TextBlock Text="原料桶号" HorizontalAlignment="Center" /> | |||
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBlock Grid.Column="3" Text="原料重量" HorizontalAlignment="Center" /> | |||
<Grid Grid.Column="4"> | |||
<TextBlock Text="功能操作" HorizontalAlignment="Center" /> | |||
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" /> | |||
</Grid> | |||
<Border Grid.ColumnSpan="10" BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<Grid Grid.Row="3"> | |||
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"> | |||
<ItemsControl ItemsSource="{Binding RawMaterial}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid Name="gr"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<Grid Grid.Column="0"> | |||
<TextBox | |||
Text="{Binding RawMaterialName}" /> | |||
<Border | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBox | |||
Grid.Column="1" | |||
Text="{Binding RawMaterialLocation }" /> | |||
<Grid Grid.Column="2"> | |||
<TextBox | |||
Text="{Binding RawMaterialBarrelNum}" /> | |||
<Border | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBox | |||
Grid.Column="3" | |||
Text="{Binding RawMaterialWeight}" /> | |||
<Grid Grid.Column="4"> | |||
<Button | |||
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RawMaterialLocation}" | |||
Content="删除" | |||
FontSize="16" /> | |||
<Border | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<Border | |||
Grid.ColumnSpan="10" | |||
BorderThickness="1,0,1,1" /> | |||
</Grid> | |||
<DataTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" /> | |||
</Trigger> | |||
</DataTemplate.Triggers> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</ScrollViewer> | |||
</Grid> | |||
</Grid> | |||
</Border> | |||
</Window> |
@@ -0,0 +1,33 @@ | |||
using BPASmartClient.Helper; | |||
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.DosingHKProject.View | |||
{ | |||
/// <summary> | |||
/// DeviceMaterialParView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class NewLocalRecipeView : Window | |||
{ | |||
public NewLocalRecipeView() | |||
{ | |||
InitializeComponent(); | |||
this.Close.Click += (o, e) => { this.Close(); }; | |||
this.br.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); }; | |||
ActionManage.GetInstance.CancelRegister("CloseNewRemoteRecipeView"); | |||
ActionManage.GetInstance.Register(new Action(() => { this.Close(); }), "CloseNewRemoteRecipeView"); | |||
} | |||
} | |||
} |
@@ -0,0 +1,175 @@ | |||
<Window | |||
x:Class="BPASmartClient.DosingHKProject.View.NewMaterialView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingHKProject.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingHKProject.ViewModel" | |||
Title="NewMateritalView" | |||
Width="600" | |||
Height="600" | |||
AllowsTransparency="True" | |||
Background="{x:Null}" | |||
Topmost="True" | |||
WindowStartupLocation="CenterScreen" | |||
WindowStyle="None" | |||
mc:Ignorable="d"> | |||
<Window.DataContext> | |||
<vm:NewMaterialViewModel /> | |||
</Window.DataContext> | |||
<Window.Resources> | |||
<ResourceDictionary> | |||
<ResourceDictionary.MergedDictionaries> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" /> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" /> | |||
<ResourceDictionary> | |||
<!--#region ListBox样式--> | |||
<Style x:Key="ListBoxItemStyle1" TargetType="{x:Type ListBoxItem}"> | |||
<Setter Property="OverridesDefaultStyle" Value="True" /> | |||
<Setter Property="SnapsToDevicePixels" Value="True" /> | |||
<Setter Property="BorderBrush" Value="{x:Null}" /> | |||
<Setter Property="Foreground" Value="White" /> | |||
<Setter Property="FontSize" Value="20" /> | |||
<Setter Property="HorizontalContentAlignment" Value="Center" /> | |||
<Setter Property="VerticalContentAlignment" Value="Center" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type ListBoxItem}"> | |||
<Border x:Name="border" CornerRadius="8"> | |||
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" /> | |||
</Border> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<!--#endregion--> | |||
</ResourceDictionary> | |||
</ResourceDictionary.MergedDictionaries> | |||
</ResourceDictionary> | |||
</Window.Resources> | |||
<Border Name="br" BorderThickness="1"> | |||
<Border.Background> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/bg.png" /> | |||
</Border.Background> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="5" /> | |||
<RowDefinition Height="*" /> | |||
<RowDefinition Height="40" /> | |||
<RowDefinition Height="5" /> | |||
<RowDefinition Height="5*" /> | |||
</Grid.RowDefinitions> | |||
<StackPanel | |||
Grid.Row="1" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Orientation="Horizontal"> | |||
<TextBlock | |||
Margin="10,0,0,0" | |||
Background="Transparent" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="请输入原料名称:" /> | |||
<TextBox | |||
Grid.Column="1" | |||
Width="200" | |||
Height="30" | |||
Margin="10" | |||
FontSize="16" | |||
Text="{Binding MaterialName}" /> | |||
<Button | |||
Width="80" | |||
Height="30" | |||
Margin="10" | |||
Command="{Binding SaveCommand}" | |||
Content="保存" | |||
Cursor="Hand" /> | |||
<Button | |||
Name="btClose" | |||
Width="80" | |||
Height="30" | |||
Margin="10" | |||
Click="btClose_Click" | |||
Content="取消" /> | |||
</StackPanel> | |||
<TextBlock | |||
Grid.Row="2" | |||
Margin="0,0,5,0" | |||
HorizontalAlignment="Center" | |||
Background="Transparent" | |||
FontSize="16" | |||
Foreground="Red" | |||
Text="{Binding ErrorInfo}" /> | |||
<Grid Grid.Row="4"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40" /> | |||
<RowDefinition Height="*" /> | |||
</Grid.RowDefinitions> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
FontSize="25" | |||
Foreground="#FF2AB2E7" | |||
Text="本地原料" /> | |||
<Border | |||
Grid.Row="1" | |||
Margin="100,10" | |||
BorderBrush="#FF2AB2E7" | |||
BorderThickness="1"> | |||
<ScrollViewer | |||
Grid.Row="1" | |||
BorderBrush="#FF2AB2E7" | |||
BorderThickness="1"> | |||
<ItemsControl Margin="10" ItemsSource="{Binding Materials}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<RadioButton GroupName="all"> | |||
<RadioButton.Template> | |||
<ControlTemplate TargetType="RadioButton"> | |||
<Grid Name="gr" Height="40"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="2*" /> | |||
<ColumnDefinition Width="*" /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Name="tb" | |||
Grid.Column="0" | |||
Width="150" | |||
Height="29" | |||
Margin="3,1" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="20" | |||
Text="{Binding RawMaterialName}" /> | |||
<Button | |||
Grid.Column="1" | |||
Margin="10,0,10,0" | |||
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RawMaterialId}" | |||
Content="删除" /> | |||
</Grid> | |||
</ControlTemplate> | |||
</RadioButton.Template> | |||
</RadioButton> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</ScrollViewer> | |||
</Border> | |||
</Grid> | |||
</Grid> | |||
</Border> | |||
</Window> |
@@ -0,0 +1,35 @@ | |||
using BPASmartClient.Helper; | |||
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.Shapes; | |||
namespace BPASmartClient.DosingHKProject.View | |||
{ | |||
/// <summary> | |||
/// NewMateritalView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class NewMaterialView : Window | |||
{ | |||
public NewMaterialView() | |||
{ | |||
InitializeComponent(); | |||
this.btClose.Click += (o, e) => { this.Close(); }; | |||
this.br.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); }; | |||
} | |||
private void btClose_Click(object sender, RoutedEventArgs e) | |||
{ | |||
this.Close(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,238 @@ | |||
<Window | |||
x:Class="BPASmartClient.DosingHKProject.View.NewRecipeView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingHKProject.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingHKProject.ViewModel" | |||
Title="NewRecipeView" | |||
Width="550" | |||
Height="450" | |||
AllowsTransparency="True" | |||
Background="{x:Null}" | |||
Topmost="True" | |||
WindowStartupLocation="CenterScreen" | |||
WindowStyle="None" | |||
mc:Ignorable="d"> | |||
<Window.DataContext> | |||
<vm:NewRecipeViewModel /> | |||
</Window.DataContext> | |||
<Window.Resources> | |||
<ResourceDictionary> | |||
<ResourceDictionary.MergedDictionaries> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" /> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" /> | |||
<ResourceDictionary> | |||
<!--#region ListBox样式--> | |||
<Style x:Key="ListBoxItemStyle1" TargetType="{x:Type ListBoxItem}"> | |||
<Setter Property="OverridesDefaultStyle" Value="True" /> | |||
<Setter Property="SnapsToDevicePixels" Value="True" /> | |||
<Setter Property="BorderBrush" Value="{x:Null}" /> | |||
<Setter Property="Foreground" Value="White" /> | |||
<Setter Property="FontSize" Value="20" /> | |||
<Setter Property="HorizontalContentAlignment" Value="Center" /> | |||
<Setter Property="VerticalContentAlignment" Value="Center" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type ListBoxItem}"> | |||
<Border x:Name="border" CornerRadius="8"> | |||
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" /> | |||
</Border> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<!--#endregion--> | |||
</ResourceDictionary> | |||
</ResourceDictionary.MergedDictionaries> | |||
</ResourceDictionary> | |||
</Window.Resources> | |||
<Border | |||
Name="br" | |||
BorderBrush="#0CADF5" | |||
BorderThickness="2"> | |||
<Border.Background> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/bg.png" /> | |||
<!--<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/弹窗2.png" />--> | |||
</Border.Background> | |||
<Grid> | |||
<!--<Grid.Background> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/弹窗.png" /> | |||
</Grid.Background>--> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="5" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<!--<Button | |||
Name="btClose" | |||
Margin="0,0,5,0" | |||
Padding="10,5" | |||
HorizontalAlignment="Right" | |||
VerticalAlignment="Center" | |||
Background="Transparent" | |||
BorderThickness="0" | |||
Content="X" | |||
FontSize="18" | |||
Foreground="White" /> | |||
<Border BorderBrush="#88DDDDDD" BorderThickness="0,0,0,1" />--> | |||
<Grid Grid.Row="1"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40" /> | |||
<RowDefinition Height="40" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<TextBlock | |||
Margin="10,0,0,0" | |||
Background="Transparent" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="请输入配方名称:" /> | |||
<TextBlock | |||
Margin="0,0,10,0" | |||
HorizontalAlignment="Right" | |||
Background="Transparent" | |||
FontSize="16" | |||
Foreground="Red" | |||
Text="{Binding ErrorInfo}" /> | |||
<StackPanel | |||
Grid.Row="1" | |||
Margin="10,0,0,0" | |||
Orientation="Horizontal"> | |||
<TextBox | |||
Grid.Column="1" | |||
Width="200" | |||
Height="30" | |||
Margin="0,0,7,0" | |||
FontSize="16" | |||
Text="{Binding RecipeName}" /> | |||
<Button | |||
Width="148" | |||
Height="30" | |||
Margin="0,0,7,0" | |||
Command="{Binding AddCommand}" | |||
Content="添加原料" | |||
Cursor="Hand" /> | |||
<Button | |||
Width="80" | |||
Height="30" | |||
Command="{Binding SaveCommand}" | |||
Content="确认" /> | |||
<Button | |||
Name="btClose" | |||
Width="80" | |||
Height="30" | |||
Margin="7,0,0,0" | |||
Content="取消" /> | |||
</StackPanel> | |||
<ScrollViewer | |||
Grid.Row="2" | |||
Margin="5" | |||
HorizontalScrollBarVisibility="Hidden" | |||
VerticalScrollBarVisibility="Hidden"> | |||
<ItemsControl ItemsSource="{Binding RawMaterials}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<RadioButton GroupName="all"> | |||
<RadioButton.Template> | |||
<ControlTemplate TargetType="RadioButton"> | |||
<Grid Name="gr" Height="40"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition Width="0.5*" /> | |||
</Grid.ColumnDefinitions> | |||
<ComboBox | |||
Name="cb" | |||
Grid.Column="0" | |||
Margin="3,1" | |||
VerticalAlignment="Center" | |||
BorderBrush="#FF074B92" | |||
BorderThickness="1" | |||
FontFamily="楷体" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
IsEditable="False" | |||
ItemsSource="{Binding DataContext.RawMaterialNames, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
SelectedIndex="0" | |||
Style="{StaticResource ComboBoxStyle}" | |||
Text="{Binding RawMaterialName}" /> | |||
<!--<TextBox | |||
Name="cb" | |||
Grid.Column="0" | |||
Margin="3,1" | |||
VerticalAlignment="Center" | |||
BorderBrush="#FF074B92" | |||
BorderThickness="1" | |||
FontFamily="楷体" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="{Binding RawMaterialName}" />--> | |||
<StackPanel | |||
Grid.Column="1" | |||
VerticalAlignment="Center" | |||
Orientation="Horizontal"> | |||
<TextBox | |||
Name="tb" | |||
Grid.Column="1" | |||
Width="150" | |||
Height="29" | |||
Margin="3,1" | |||
VerticalAlignment="Center" | |||
FontSize="20" | |||
Text="{Binding RawMaterialWeight}" /> | |||
<TextBlock | |||
Grid.Column="1" | |||
Margin="0,0,8,4" | |||
HorizontalAlignment="Right" | |||
VerticalAlignment="Center" | |||
FontSize="20" | |||
Text="g" /> | |||
</StackPanel> | |||
<Button | |||
Grid.Column="2" | |||
Width="80" | |||
Margin="25,0,0,0" | |||
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RawMaterialId}" | |||
Content="删除" /> | |||
</Grid> | |||
</ControlTemplate> | |||
</RadioButton.Template> | |||
</RadioButton> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</ScrollViewer> | |||
</Grid> | |||
</Grid> | |||
</Border> | |||
</Window> |
@@ -0,0 +1,32 @@ | |||
using BPASmartClient.Helper; | |||
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.Shapes; | |||
namespace BPASmartClient.DosingHKProject.View | |||
{ | |||
/// <summary> | |||
/// NewRecipeView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class NewRecipeView : Window | |||
{ | |||
public NewRecipeView() | |||
{ | |||
InitializeComponent(); | |||
this.btClose.Click += (o, e) => { this.Close(); }; | |||
this.br.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); }; | |||
ActionManage.GetInstance.CancelRegister("CloseNewRecipeView"); | |||
ActionManage.GetInstance.Register(new Action(() => { this.Close(); }), "CloseNewRecipeView"); | |||
} | |||
} | |||
} |
@@ -0,0 +1,802 @@ | |||
<UserControl | |||
x:Class="BPASmartClient.DosingHKProject.View.RecipeControlView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:con="clr-namespace:BPASmartClient.DosingHKProject.Converter" | |||
xmlns:control="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingHKProject.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingHKProject.ViewModel" | |||
d:DesignHeight="800" | |||
d:DesignWidth="1400" | |||
mc:Ignorable="d"> | |||
<UserControl.DataContext> | |||
<vm:RecipeControlViewModel x:Name="bingSource" /> | |||
</UserControl.DataContext> | |||
<UserControl.Resources> | |||
<con:RunStatusConvert x:Key="RunStatusConvert" /> | |||
<con:EnbleConvert x:Key="EnbleConvert" /> | |||
<con:IntToSourceConvert x:Key="IntToSourceConvert" /> | |||
<Style x:Key="UserItemContainerStyle" TargetType="ListBoxItem"> | |||
<Style.Resources> | |||
<!-- SelectedItem with focus --> | |||
<SolidColorBrush | |||
x:Key="{x:Static SystemColors.HighlightBrushKey}" | |||
Opacity=".4" | |||
Color="White" /> | |||
<!-- SelectedItem without focus --> | |||
<SolidColorBrush | |||
x:Key="{x:Static SystemColors.ControlBrushKey}" | |||
Opacity=".4" | |||
Color="White" /> | |||
</Style.Resources> | |||
<!-- 设置触发器 --> | |||
<Style.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter Property="Background" Value="White" /> | |||
<Setter Property="Foreground" Value="White" /> | |||
</Trigger> | |||
<Trigger Property="IsFocused" Value="true"> | |||
<Setter Property="Background" Value="White" /> | |||
<Setter Property="Foreground" Value="White" /> | |||
</Trigger> | |||
</Style.Triggers> | |||
</Style> | |||
<Style x:Key="RadioState" TargetType="RadioButton"> | |||
<Setter Property="Margin" Value="1" /> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="Foreground" Value="#ddd" /> | |||
<Setter Property="VerticalContentAlignment" Value="Bottom" /> | |||
<Setter Property="Margin" Value="2,5" /> | |||
<Setter Property="FontSize" Value="16" /> | |||
<Setter Property="FontFamily" Value="Consolas" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="RadioButton"> | |||
<Border | |||
Name="radiobutton" | |||
Background="{TemplateBinding Background}" | |||
CornerRadius="5" | |||
Opacity="0.85"> | |||
<Grid> | |||
<!--<Border | |||
x:Name="back_border" | |||
BorderBrush="Black" | |||
BorderThickness="0" | |||
CornerRadius="1"> | |||
<Border.Effect> | |||
<BlurEffect KernelType="Gaussian" Radius="2" /> | |||
</Border.Effect> | |||
</Border> | |||
<Border | |||
x:Name="fore_border" | |||
Margin="2" | |||
BorderBrush="White" | |||
BorderThickness="0" | |||
CornerRadius="{Binding ElementName=button, Path=CornerRadius}" | |||
Opacity="0.7"> | |||
<Border.Effect> | |||
<BlurEffect KernelType="Gaussian" Radius="2" /> | |||
</Border.Effect> | |||
</Border>--> | |||
<ContentPresenter | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Content="{TemplateBinding Content}" | |||
TextBlock.FontFamily="{TemplateBinding FontFamily}" | |||
TextBlock.FontSize="{TemplateBinding FontSize}" | |||
TextBlock.Foreground="{TemplateBinding Foreground}" /> | |||
<Image | |||
Name="im" | |||
Source="/BPASmartClient.CustomResource;component/Image/按钮/组 8.png" | |||
Stretch="Fill" /> | |||
</Grid> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsChecked" Value="True"> | |||
<!--<Setter TargetName="back_border" Property="BorderThickness" Value="1,0,1,1" /> | |||
<Setter TargetName="back_border" Property="CornerRadius" Value="5" /> | |||
<Setter TargetName="fore_border" Property="BorderThickness" Value="0,2,0,0" /> | |||
<Setter Property="Background" Value=" #4169E1" />--> | |||
<Setter TargetName="im" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/按钮/组 7.png" /> | |||
</Trigger> | |||
<Trigger Property="IsChecked" Value="False"> | |||
<Setter TargetName="im" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/按钮/组 8.png" /> | |||
</Trigger> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<!--<Setter TargetName="back_border" Property="BorderBrush" Value="white" /> | |||
<Setter TargetName="back_border" Property="BorderThickness" Value="1,1,1,1" />--> | |||
<Setter TargetName="radiobutton" Property="Opacity" Value="1" /> | |||
<!--<Setter TargetName="im" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/按钮背景蓝色.png" />--> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style x:Key="materialMakingButton" TargetType="Button"> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="FontSize" Value="16" /> | |||
<Setter Property="Foreground" Value="#CD5555" /> | |||
<Setter Property="BorderThickness" Value="0" /> | |||
<Setter Property="HorizontalAlignment" Value="Left" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate> | |||
<Border | |||
x:Name="brState" | |||
Padding="2" | |||
BorderBrush="White" | |||
BorderThickness="0"> | |||
<TextBlock | |||
x:Name="txState" | |||
Margin="1" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Text="{Binding RecipeStatus, Converter={StaticResource RunStatusConvert}}" /> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsEnabled" Value="True"> | |||
<Setter TargetName="brState" Property="BorderThickness" Value="0" /> | |||
<Setter TargetName="brState" Property="CornerRadius" Value="5" /> | |||
<Setter TargetName="brState" Property="Background" Value="#F0FFFF" /> | |||
<Setter TargetName="txState" Property="Foreground" Value="#CD5555" /> | |||
</Trigger> | |||
<DataTrigger Binding="{Binding RecipeStatus}" Value="3"> | |||
<Setter TargetName="brState" Property="Background" Value="#F0FFFF" /> | |||
<Setter TargetName="txState" Property="Foreground" Value="#3CB371" /> | |||
</DataTrigger> | |||
<DataTrigger Binding="{Binding RecipeStatus}" Value="2"> | |||
<Setter TargetName="txState" Property="Foreground" Value="Aqua" /> | |||
</DataTrigger> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<Condition Property="IsMouseOver" Value="True" /> | |||
<Condition Property="IsEnabled" Value="True" /> | |||
</MultiTrigger.Conditions> | |||
<Setter TargetName="txState" Property="FontSize" Value="17 " /> | |||
</MultiTrigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
<Style.Triggers /> | |||
</Style> | |||
<DataTemplate x:Key="TreeItemTemplate" DataType="TreeViewItem"> | |||
<Grid Height="28" Margin="50,0,0,0"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="*" /> | |||
<ColumnDefinition Width="*" /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Margin="10,0" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Center" | |||
FontSize="15" | |||
Foreground="#aa2AB2E7" | |||
Text="原料:" /> | |||
<TextBlock | |||
Grid.Column="1" | |||
Margin="10,0" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Center" | |||
FontSize="15" | |||
Foreground="#aa2AB2E7" | |||
Text="{Binding RawMaterialName}" /> | |||
</Grid> | |||
</DataTemplate> | |||
<Style x:Key="recipeTreeItem" TargetType="TreeViewItem"> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="BorderThickness" Value="0" /> | |||
<Setter Property="IsExpanded" Value="True" /> | |||
<Setter Property="HeaderTemplate"> | |||
<Setter.Value> | |||
<HierarchicalDataTemplate ItemTemplate="{StaticResource TreeItemTemplate}" ItemsSource="{Binding RawMaterials, Mode=TwoWay}"> | |||
<StackPanel | |||
Height="28" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Center" | |||
Orientation="Horizontal"> | |||
<TextBlock | |||
Margin="5,0,0,0" | |||
VerticalAlignment="Center" | |||
FontSize="15" | |||
Foreground="#FF2AB2E7" | |||
Text="配方:" /> | |||
<TextBlock | |||
Margin="5,0,0,0" | |||
VerticalAlignment="Center" | |||
FontSize="15" | |||
Foreground="#FF2AB2E7" | |||
Text="{Binding RecipeName}" /> | |||
</StackPanel> | |||
</HierarchicalDataTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type TreeViewItem}"> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="Auto" /> | |||
<ColumnDefinition Width="*" /> | |||
</Grid.ColumnDefinitions> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="Auto" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<Border | |||
x:Name="Bd" | |||
Grid.Column="0" | |||
Padding="{TemplateBinding Padding}" | |||
Background="{TemplateBinding Background}" | |||
BorderBrush="{TemplateBinding BorderBrush}" | |||
BorderThickness="{TemplateBinding BorderThickness}"> | |||
<ContentPresenter | |||
x:Name="PART_Header" | |||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" | |||
ContentSource="Header" /> | |||
</Border> | |||
<ItemsPresenter | |||
x:Name="ItemsHost" | |||
Grid.Row="1" | |||
Grid.Column="0" | |||
Grid.ColumnSpan="2" | |||
Visibility="Collapsed" /> | |||
<VisualStateManager.VisualStateGroups> | |||
<VisualStateGroup x:Name="SelectionStates"> | |||
<VisualState x:Name="Selected"> | |||
<Storyboard> | |||
<ColorAnimationUsingKeyFrames Storyboard.TargetName="Bd" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)"> | |||
<EasingColorKeyFrame KeyTime="0" Value="Transparent" /> | |||
</ColorAnimationUsingKeyFrames> | |||
</Storyboard> | |||
</VisualState> | |||
<VisualState x:Name="Unselected" /> | |||
<VisualState x:Name="SelectedInactive"> | |||
<Storyboard> | |||
<ColorAnimationUsingKeyFrames Storyboard.TargetName="Bd" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)"> | |||
<EasingColorKeyFrame KeyTime="0" Value="Transparent" /> | |||
</ColorAnimationUsingKeyFrames> | |||
</Storyboard> | |||
</VisualState> | |||
</VisualStateGroup> | |||
<VisualStateGroup x:Name="ExpansionStates"> | |||
<VisualState x:Name="Expanded"> | |||
<Storyboard> | |||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ItemsHost" Storyboard.TargetProperty="(UIElement.Visibility)"> | |||
<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" /> | |||
</ObjectAnimationUsingKeyFrames> | |||
</Storyboard> | |||
</VisualState> | |||
<VisualState x:Name="Collapsed" /> | |||
</VisualStateGroup> | |||
</VisualStateManager.VisualStateGroups> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<Condition Property="HasHeader" Value="false" /> | |||
<Condition Property="Width" Value="Auto" /> | |||
</MultiTrigger.Conditions> | |||
<Setter TargetName="PART_Header" Property="MinWidth" Value="75" /> | |||
</MultiTrigger> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<Condition Property="HasHeader" Value="false" /> | |||
<Condition Property="Height" Value="Auto" /> | |||
</MultiTrigger.Conditions> | |||
<Setter TargetName="PART_Header" Property="MinHeight" Value="19" /> | |||
</MultiTrigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
</UserControl.Resources> | |||
<Grid Margin="20"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition Width="0.25*" /> | |||
</Grid.ColumnDefinitions> | |||
<Grid Name="ggr" Margin="10"> | |||
<pry:ImageBorder Width="{Binding ElementName=ggr, Path=ActualWidth}" Height="{Binding ElementName=ggr, Path=ActualHeight}" /> | |||
<ListBox | |||
Margin="5" | |||
VerticalAlignment="Top" | |||
Background="Transparent" | |||
BorderThickness="0" | |||
ItemsSource="{Binding Recipes}" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListBox.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<UniformGrid | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
Columns="6" /> | |||
</ItemsPanelTemplate> | |||
</ListBox.ItemsPanel> | |||
<ListBox.ItemTemplate> | |||
<DataTemplate> | |||
<Grid | |||
Name="tt" | |||
Height="220" | |||
Margin="5"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="30" /> | |||
<RowDefinition Height="20" /> | |||
<RowDefinition Height="128" /> | |||
<RowDefinition Height="2" /> | |||
<RowDefinition Height="40" /> | |||
</Grid.RowDefinitions> | |||
<Image | |||
Grid.RowSpan="5" | |||
Source="/BPASmartClient.CustomResource;component/Image/配方背景/竖背景框.png" | |||
Stretch="Fill" /> | |||
<TextBlock | |||
Grid.Row="0" | |||
Margin="2,5,0,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Top" | |||
FontSize="18" | |||
Foreground="#FF2AB2E7" | |||
Text="{Binding RecipeName}" /> | |||
<TextBlock | |||
Grid.Row="1" | |||
Margin="5,0,0,0" | |||
VerticalAlignment="Top" | |||
Foreground="#FF2AB2E7" | |||
Text="配方信息:" /> | |||
<ScrollViewer | |||
Grid.Row="2" | |||
VerticalAlignment="Top" | |||
Background="Transparent" | |||
HorizontalScrollBarVisibility="Hidden" | |||
VerticalScrollBarVisibility="Hidden"> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="auto" /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<ItemsControl ItemsSource="{Binding RawMaterials}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid> | |||
<TextBlock | |||
Grid.Row="1" | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Right" | |||
VerticalAlignment="Center" | |||
Foreground="#aa2AB2E7" | |||
Text="{Binding RawMaterialName}" /> | |||
</Grid> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
<ItemsControl Grid.Column="1" ItemsSource="{Binding RawMaterials}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<StackPanel Orientation="Horizontal"> | |||
<TextBlock | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Foreground="#aa2AB2E7" | |||
Text=":" /> | |||
<TextBlock | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Foreground="#aa2AB2E7" | |||
Text="{Binding RawMaterialWeight}" /> | |||
<TextBlock | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Foreground="#aa2AB2E7" | |||
Text="g" /> | |||
</StackPanel> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</Grid> | |||
</ScrollViewer> | |||
<!--<Grid | |||
Grid.Row="3" | |||
Height="2" | |||
VerticalAlignment="Bottom"> | |||
<Grid.Background> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/直线.png" Stretch="Fill" /> | |||
</Grid.Background> | |||
</Grid>--> | |||
<Image | |||
Grid.Row="3" | |||
Width="{Binding ElementName=tt, Path=ActualWidth}" | |||
Height="2" | |||
VerticalAlignment="Bottom" | |||
Source="/BPASmartClient.CustomResource;component/Image/直线.png" | |||
Stretch="Fill" /> | |||
<Grid | |||
Name="gr" | |||
Grid.Row="4" | |||
Height="30" | |||
Margin="0,0,0,10" | |||
VerticalAlignment="Bottom" | |||
Background="Transparent"> | |||
<!--<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions>--> | |||
<!--<Image | |||
Height="2" | |||
Grid.ColumnSpan="2" | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
VerticalAlignment="Top" | |||
Source="/BPASmartClient.CustomResource;component/Image/直线.png" />--> | |||
<pry:IcoButton | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
Margin="4,4,4,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Background="#222bd06f" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.StartCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipeName}" | |||
Content="配方下发" | |||
EnterBackground="#332bd06f" | |||
FontStyle="Normal" | |||
Foreground="#ff2bd06f" | |||
IcoText="" | |||
IsEnabled="{Binding IsEnable}" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
<!--<pry:IcoButton | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
Margin="4,4,3,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Background="#11F53F62" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipCode}" | |||
Content="删除" | |||
EnterBackground="#22F53F62" | |||
FontStyle="Normal" | |||
Foreground="#FFF53F62" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
<pry:IcoButton | |||
Grid.Column="1" | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
Margin="3,4,4,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Background="#112AB2E7" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.DetailsCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipCode}" | |||
Content="编辑" | |||
EnterBackground="#222AB2E7" | |||
Foreground="#FF2AB2E7" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" />--> | |||
</Grid> | |||
<!--</StackPanel>--> | |||
</Grid> | |||
<!--<Grid Name="tt" Margin="5"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="auto" /> | |||
<RowDefinition Height="auto" /> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<Image | |||
Grid.RowSpan="4" | |||
Source="/BPASmartClient.CustomResource;component/Image/配方背景/竖背景框.png" | |||
Stretch="Fill" /> | |||
<TextBlock | |||
Grid.Row="0" | |||
Margin="2,5,0,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Top" | |||
FontSize="18" | |||
Foreground="#FF2AB2E7" | |||
Text="{Binding RecipeName}" /> | |||
<TextBlock | |||
Grid.Row="1" | |||
Margin="5,0,0,5" | |||
Foreground="#ffc000" | |||
Text="配方信息:" /> | |||
<ScrollViewer | |||
Grid.Row="2" | |||
HorizontalScrollBarVisibility="Hidden" | |||
VerticalScrollBarVisibility="Hidden"> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="auto" /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<ItemsControl ItemsSource="{Binding RawMaterials}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid> | |||
<TextBlock | |||
Grid.Row="1" | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Right" | |||
VerticalAlignment="Center" | |||
Foreground="#aaffc000" | |||
Text="{Binding RawMaterialName}" /> | |||
</Grid> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
<ItemsControl Grid.Column="1" ItemsSource="{Binding RawMaterials}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<StackPanel Orientation="Horizontal"> | |||
<TextBlock | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Foreground="#aaffc000" | |||
Text=":" /> | |||
<TextBlock | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Foreground="#aaffc000" | |||
Text="{Binding RawMaterialWeight}" /> | |||
<TextBlock | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Foreground="#aaffc000" | |||
Text="g" /> | |||
</StackPanel> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</Grid> | |||
</ScrollViewer> | |||
<Grid | |||
Name="grb" | |||
Grid.Row="3" | |||
Height="30" | |||
Margin="0,0,0,10" | |||
VerticalAlignment="Bottom" | |||
Background="Transparent"> | |||
<Image | |||
Width="{Binding ElementName=grb, Path=ActualWidth}" | |||
VerticalAlignment="Top" | |||
StretchDirection="Both" | |||
Source="/BPASmartClient.CustomResource;component/Image/直线.png" /> | |||
<pry:IcoButton | |||
Width="{Binding ElementName=grb, Path=ActualWidth}" | |||
Height="{Binding ElementName=grb, Path=ActualHeight}" | |||
Margin="4,4,4,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Background="#222bd06f" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.StartCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipeName}" | |||
Content="配方下发" | |||
EnterBackground="#332bd06f" | |||
FontStyle="Normal" | |||
Foreground="#ff2bd06f" | |||
IcoText="" | |||
IsEnabled="{Binding IsEnable}" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
</Grid> | |||
</Grid>--> | |||
</DataTemplate> | |||
</ListBox.ItemTemplate> | |||
</ListBox> | |||
</Grid> | |||
<Grid | |||
Name="gr" | |||
Grid.Column="1" | |||
Margin="10"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="50" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<pry:ImageBorder | |||
Grid.RowSpan="2" | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" /> | |||
<Grid Margin="5"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<RadioButton | |||
Click="RadioButtonWait_Click" | |||
Command="{Binding ChangeRecipeStateCommand}" | |||
Content="等待中" | |||
GroupName="state" | |||
IsChecked="True" | |||
Style="{DynamicResource RadioState}" /> | |||
<RadioButton | |||
Grid.Column="1" | |||
Click="RadioButtonMaking_Click" | |||
Content="执行中" | |||
GroupName="state" | |||
Style="{DynamicResource RadioState}" /> | |||
<RadioButton | |||
Grid.Column="2" | |||
Click="RadioButtonCompelete_Click" | |||
Content="已完成" | |||
GroupName="state" | |||
Style="{DynamicResource RadioState}" /> | |||
</Grid> | |||
<ScrollViewer | |||
Grid.Row="1" | |||
HorizontalScrollBarVisibility="Hidden" | |||
VerticalScrollBarVisibility="Hidden"> | |||
<Border> | |||
<Grid Grid.Row="1"> | |||
<Grid x:Name="repiceListMaking" Margin="5"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="30" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<TextBlock | |||
Margin="10,0" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Center" | |||
FontSize="18" | |||
Foreground="#FF2AB2E7" | |||
Text="{Binding CurrentRecipeName}" /> | |||
<ItemsControl | |||
Grid.Row="1" | |||
Margin="50,0" | |||
ItemsSource="{Binding recipeProcesses}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid Margin="5"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition Width="16" /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Margin="10,0,5,0" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Center" | |||
FontSize="15" | |||
Foreground="#AA2AB2E7" | |||
Text="{Binding RawMaterialName}" | |||
ToolTip="{Binding RawMaterialSource, Converter={StaticResource IntToSourceConvert}}" /> | |||
<TextBlock | |||
Grid.Column="1" | |||
Margin="0,0,5,0" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Center" | |||
FontSize="15" | |||
Foreground="#AA2AB2E7" | |||
Text=":" /> | |||
<Button | |||
Grid.Column="2" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Command="{Binding DataContext.ChangeRecipeStateCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RawMaterialId}" | |||
Content="{Binding RecipeStatus, Converter={StaticResource RunStatusConvert}}" | |||
IsEnabled="{Binding RawMaterialSource, Converter={StaticResource EnbleConvert}}" | |||
Style="{StaticResource materialMakingButton}" /> | |||
</Grid> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</Grid> | |||
<!--<TreeView x:Name="repiceListMaking" ItemsSource="{Binding RecipeProcesse}" | |||
ScrollViewer.VerticalScrollBarVisibility="Disabled" HorizontalAlignment="Stretch" Background="Wheat" ItemContainerStyle="{StaticResource recipeTreeItem}"> | |||
</TreeView>--> | |||
<!-- 等待和已完成 --> | |||
<TreeView | |||
x:Name="repiceList" | |||
HorizontalAlignment="Stretch" | |||
Background="Transparent" | |||
BorderThickness="0" | |||
ItemContainerStyle="{StaticResource recipeTreeItem}" | |||
ItemsSource="{Binding UserTreeWait}" | |||
ScrollViewer.VerticalScrollBarVisibility="Visible" /> | |||
</Grid> | |||
</Border> | |||
</ScrollViewer> | |||
</Grid> | |||
</Grid> | |||
</UserControl> |
@@ -0,0 +1,56 @@ | |||
using BPASmartClient.DosingHKProject.ViewModel; | |||
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.DosingHKProject.View | |||
{ | |||
/// <summary> | |||
/// RecipeControlView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class RecipeControlView : UserControl | |||
{ | |||
public RecipeControlView() | |||
{ | |||
InitializeComponent(); | |||
RadioButtonWait_Click(null,null); | |||
} | |||
private void RadioButtonCompelete_Click(object sender, RoutedEventArgs e) | |||
{ | |||
repiceList.ItemsSource = RecipeControlViewModel.UserTreeCompelete; | |||
repiceList.Visibility = Visibility.Visible; | |||
repiceListMaking.Visibility = Visibility.Hidden; | |||
} | |||
private void RadioButtonWait_Click(object sender, RoutedEventArgs e) | |||
{ | |||
repiceList.ItemsSource = RecipeControlViewModel.UserTreeWait; | |||
repiceList.Visibility = Visibility.Visible; | |||
repiceListMaking.Visibility = Visibility.Hidden; | |||
} | |||
private void RadioButtonMaking_Click(object sender, RoutedEventArgs e) | |||
{ | |||
repiceListMaking.Visibility = Visibility.Visible; | |||
repiceList.Visibility = Visibility.Hidden; | |||
} | |||
} | |||
} |
@@ -0,0 +1,140 @@ | |||
<Window | |||
x:Class="BPASmartClient.DosingHKProject.View.RecipeInfosView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingHKProject.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingHKProject.ViewModel" | |||
Title="RecipeInfosView" | |||
Width="550" | |||
Height="450" | |||
AllowsTransparency="True" | |||
Background="{x:Null}" | |||
Topmost="True" | |||
WindowStartupLocation="CenterScreen" | |||
WindowStyle="None" | |||
mc:Ignorable="d"> | |||
<Window.DataContext> | |||
<vm:RecipeInfosViewModel /> | |||
</Window.DataContext> | |||
<Window.Resources> | |||
<ResourceDictionary> | |||
<ResourceDictionary.MergedDictionaries> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" /> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" /> | |||
<ResourceDictionary> | |||
<!--#region ListBox样式--> | |||
<!--<Style x:Key="ListBoxItemStyle1" TargetType="{x:Type ListBoxItem}"> | |||
<Setter Property="OverridesDefaultStyle" Value="True" /> | |||
<Setter Property="SnapsToDevicePixels" Value="True" /> | |||
<Setter Property="BorderBrush" Value="{x:Null}" /> | |||
<Setter Property="Foreground" Value="White" /> | |||
<Setter Property="FontSize" Value="20" /> | |||
<Setter Property="HorizontalContentAlignment" Value="Center" /> | |||
<Setter Property="VerticalContentAlignment" Value="Center" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type ListBoxItem}"> | |||
<Border x:Name="border" CornerRadius="8"> | |||
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" /> | |||
</Border> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style>--> | |||
<!--#endregion--> | |||
</ResourceDictionary> | |||
</ResourceDictionary.MergedDictionaries> | |||
</ResourceDictionary> | |||
</Window.Resources> | |||
<Border Name="br" | |||
BorderBrush="#0CADF5" | |||
BorderThickness="1" > | |||
<Border.Background> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/bg.png" /> | |||
</Border.Background> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<Grid Grid.Row="1"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="80" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition></ColumnDefinition> | |||
<ColumnDefinition></ColumnDefinition> | |||
</Grid.ColumnDefinitions> | |||
<Grid.RowDefinitions> | |||
<RowDefinition></RowDefinition> | |||
<RowDefinition></RowDefinition> | |||
</Grid.RowDefinitions> | |||
<WrapPanel> | |||
<TextBlock Margin="10,0,0,0" Background="Transparent" FontSize="20" Foreground="#FF2AB2E7" Text="配方名称:" /> | |||
<TextBlock Margin="10,0,0,0" Background="Transparent" FontSize="20" Foreground="#FF2AB2E7" Text="{Binding RecipeName}" /> | |||
</WrapPanel> | |||
<WrapPanel Grid.Column="1"> | |||
<TextBlock Margin="10,0,0,0" Background="Transparent" FontSize="20" Foreground="#FF2AB2E7" Text="配方编号:" /> | |||
<TextBlock Margin="10,0,0,0" Background="Transparent" FontSize="20" Foreground="#FF2AB2E7" Text="{Binding RecipeCode}" /> | |||
</WrapPanel> | |||
<WrapPanel Grid.Row="1"> | |||
<TextBlock Margin="10,0,0,0" Background="Transparent" FontSize="20" Foreground="#FF2AB2E7" Text="托盘编号:" /> | |||
<TextBlock Grid.Row="1" Margin="10,0,0,0" Background="Transparent" FontSize="20" Foreground="#FF2AB2E7" Text="{Binding TrayCode}" /> | |||
</WrapPanel> | |||
<Button Grid.Column="1" Grid.Row="1" Width="100" Command="{Binding ReturnPage}" HorizontalAlignment="Left" Margin="10,0,0,0">返回</Button> | |||
</Grid> | |||
<Grid Grid.Row="3"> | |||
<Grid Grid.Column="1"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="20"></RowDefinition> | |||
<RowDefinition></RowDefinition> | |||
</Grid.RowDefinitions> | |||
<Grid Grid.Row="0" > | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="2*"/> | |||
<ColumnDefinition Width="2*"/> | |||
<ColumnDefinition Width="2*"/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock FontSize="16" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Top">原料位置</TextBlock> | |||
<TextBlock FontSize="16" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Top">原料桶号</TextBlock> | |||
<TextBlock FontSize="16" Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Top">原料重量</TextBlock> | |||
</Grid> | |||
<ScrollViewer Grid.Row="1" HorizontalScrollBarVisibility="Hidden" > | |||
<ItemsControl ItemsSource="{Binding RawMaterialsInfo}" Width="548" > | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid x:Name="grb" Height="25" > | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="2*"/> | |||
<ColumnDefinition Width="2*"/> | |||
<ColumnDefinition Width="2*"/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Top" FontSize="20" Foreground="#FF2AB2E7" Text="{Binding RawMaterialLocation}"></TextBlock> | |||
<TextBlock Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Top" FontSize="20" Foreground="#FF2AB2E7" Text="{Binding RawMaterialBarrelNum}"></TextBlock> | |||
<TextBlock Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Top" FontSize="20" Foreground="#FF2AB2E7" Text="{Binding RawMaterialWeight}"></TextBlock> | |||
</Grid> | |||
<DataTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter TargetName="grb" Property="Background" Value="#112AB2E7" /> | |||
</Trigger> | |||
</DataTemplate.Triggers> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</ScrollViewer> | |||
</Grid> | |||
</Grid> | |||
</Grid> | |||
</Grid> | |||
</Border> | |||
</Window> |
@@ -0,0 +1,31 @@ | |||
using BPASmartClient.Helper; | |||
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.Shapes; | |||
namespace BPASmartClient.DosingHKProject.View | |||
{ | |||
/// <summary> | |||
/// NewRecipeView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class RecipeInfosView : Window | |||
{ | |||
public RecipeInfosView() | |||
{ | |||
InitializeComponent(); | |||
this.br.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); }; | |||
ActionManage.GetInstance.CancelRegister("CloseRecipeInfosView"); | |||
ActionManage.GetInstance.Register(new Action(() => { this.Close(); }), "CloseRecipeInfosView"); | |||
} | |||
} | |||
} |
@@ -0,0 +1,189 @@ | |||
<UserControl | |||
x:Class="BPASmartClient.DosingHKProject.View.RecipeReceiveView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:control="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingHKProject.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingHKProject.ViewModel" | |||
d:DesignHeight="450" | |||
d:DesignWidth="800" | |||
mc:Ignorable="d"> | |||
<UserControl.Resources> | |||
<SolidColorBrush x:Key="BorderSolid" Color="#5523CACA" /> | |||
<SolidColorBrush x:Key="FontColor" Color="#FF2AB2E7" /> | |||
<SolidColorBrush x:Key="TitleFontColor" Color="#ddd" /> | |||
<SolidColorBrush x:Key="CursorColor" Color="Aqua" /> | |||
<SolidColorBrush x:Key="TitleBorderColor" Color="#FF2AB2E7" /> | |||
<SolidColorBrush x:Key="TextBlockForeground" Color="#9934F7F7" /> | |||
<Style x:Key="TextBlockStyle" TargetType="TextBlock"> | |||
<Setter Property="FontFamily" Value="楷体" /> | |||
<Setter Property="FontSize" Value="20" /> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<!--<Setter Property="Foreground" Value="{StaticResource FontColor}" />--> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
<Setter Property="HorizontalAlignment" Value="Center" /> | |||
</Style> | |||
<Style x:Key="buttonStyle" TargetType="Button"> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="FontSize" Value="16" /> | |||
<Setter Property="Foreground" Value="Aqua" /> | |||
<Setter Property="HorizontalAlignment" Value="Center" /> | |||
<Setter Property="BorderThickness" Value="0" /> | |||
</Style> | |||
</UserControl.Resources> | |||
<UserControl.DataContext> | |||
<vm:RecipeReceiveViewModel /> | |||
</UserControl.DataContext> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="50"/> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right"> | |||
<pry:IcoButton | |||
Width="140" | |||
Margin="10" | |||
HorizontalAlignment="Right" | |||
Command="{Binding NewRecipe}" | |||
Content="自定义配方" | |||
FontSize="16" | |||
Foreground="Aqua" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
<pry:IcoButton | |||
Width="140" | |||
Margin="10" | |||
HorizontalAlignment="Right" | |||
Command="{Binding NewSimulateRecipe}" | |||
Content="新建模拟配方" | |||
FontSize="16" | |||
Foreground="Aqua" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
<pry:IcoButton | |||
Width="140" | |||
Margin="10" | |||
HorizontalAlignment="Right" | |||
Command="{Binding ClearAllRecipe}" | |||
Content="清除所有配方" | |||
FontSize="16" | |||
Foreground="Aqua" | |||
IcoText="" | |||
IsEnabled="True" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
</StackPanel> | |||
<ScrollViewer Grid.Row="1"> | |||
<ListView | |||
Margin="5" | |||
VerticalAlignment="Top" | |||
Background="Transparent" | |||
BorderThickness="0" | |||
ItemsSource="{Binding Recipes}" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListView.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<UniformGrid | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
Columns="8" /> | |||
</ItemsPanelTemplate> | |||
</ListView.ItemsPanel> | |||
<ListView.ItemTemplate> | |||
<DataTemplate> | |||
<Border Margin="5" Background="LightSkyBlue"> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition Height="0.25*" /> | |||
<RowDefinition Height="0.2*" /> | |||
</Grid.RowDefinitions> | |||
<Image Source="/BPASmartClient.CustomResource;component/Image/AGV/炒锅.png" /> | |||
<WrapPanel Grid.Row="1"> | |||
<TextBlock | |||
Margin="2,0,0,0" | |||
Foreground="#dd000000" | |||
Text="名称:" /> | |||
<TextBlock | |||
Margin="2,0,0,0" | |||
Foreground="#dd000000" | |||
Text="{Binding RecipeName}" /> | |||
<TextBlock | |||
Margin="5,0,0,0" | |||
Foreground="#dd000000" | |||
Text="编号:" /> | |||
<TextBlock | |||
Margin="2,0,0,0" | |||
Foreground="#dd000000" | |||
Text="{Binding RecipeCode}" /> | |||
</WrapPanel> | |||
<Grid | |||
Name="gr" | |||
Grid.Row="2" | |||
Height="30"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<pry:IcoButton | |||
Grid.Column="0" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.DetailsCommand, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipeCode}" | |||
Content="编辑" | |||
EnterBackground="#FF2AB2E7" | |||
Foreground="#dd000000" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
<pry:IcoButton | |||
Grid.Column="1" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.IssueRecipe, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipeCode}" | |||
Content="下发" | |||
EnterBackground="#FF2AB2E7" | |||
Foreground="#dd000000" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
<pry:IcoButton | |||
Grid.Column="2" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.RemoveRecipe, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipeCode}" | |||
Content="删除" | |||
EnterBackground="#FF2AB2E7" | |||
Foreground="#dd000000" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
</Grid> | |||
</Grid> | |||
</Border> | |||
</DataTemplate> | |||
</ListView.ItemTemplate> | |||
</ListView> | |||
</ScrollViewer> | |||
</Grid> | |||
</UserControl> |
@@ -0,0 +1,30 @@ | |||
using BPASmartClient.DosingHKProject.Model; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Reflection; | |||
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.DosingHKProject.View | |||
{ | |||
/// <summary> | |||
/// RecipeSettingsView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class RecipeReceiveView : UserControl | |||
{ | |||
public RecipeReceiveView() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,289 @@ | |||
<UserControl | |||
x:Class="BPASmartClient.DosingHKProject.View.RecipeSettingsView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:control="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingHKProject.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingHKProject.ViewModel" | |||
d:DesignHeight="450" | |||
d:DesignWidth="800" | |||
mc:Ignorable="d"> | |||
<UserControl.Resources> | |||
<SolidColorBrush x:Key="BorderSolid" Color="#5523CACA" /> | |||
<SolidColorBrush x:Key="FontColor" Color="#FF2AB2E7" /> | |||
<SolidColorBrush x:Key="TitleFontColor" Color="#ddd" /> | |||
<SolidColorBrush x:Key="CursorColor" Color="Aqua" /> | |||
<SolidColorBrush x:Key="TitleBorderColor" Color="#FF2AB2E7" /> | |||
<SolidColorBrush x:Key="TextBlockForeground" Color="#9934F7F7" /> | |||
<Style x:Key="TextBlockStyle" TargetType="TextBlock"> | |||
<Setter Property="FontFamily" Value="楷体" /> | |||
<Setter Property="FontSize" Value="20" /> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
<Setter Property="HorizontalAlignment" Value="Center" /> | |||
</Style> | |||
<Style x:Key="buttonStyle" TargetType="Button"> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="FontSize" Value="16" /> | |||
<Setter Property="Foreground" Value="Aqua" /> | |||
<Setter Property="HorizontalAlignment" Value="Center" /> | |||
<Setter Property="BorderThickness" Value="0" /> | |||
</Style> | |||
<Style x:Key="ListViewStyle" TargetType="ListView" /> | |||
</UserControl.Resources> | |||
<UserControl.DataContext> | |||
<vm:RecipeSettingsViewModel /> | |||
</UserControl.DataContext> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="50" /> | |||
<RowDefinition Height="30" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<!--#region 操作按钮--> | |||
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal"> | |||
<pry:IcoButton | |||
Grid.Column="3" | |||
Width="140" | |||
Margin="10" | |||
HorizontalAlignment="Left" | |||
Command="{Binding NewMaterital}" | |||
Content="新建原料" | |||
FontSize="16" | |||
Foreground="Aqua" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
<pry:IcoButton | |||
Grid.Column="3" | |||
Width="140" | |||
Margin="10" | |||
HorizontalAlignment="Left" | |||
Command="{Binding NewRecipe}" | |||
Content="新建配方" | |||
FontSize="16" | |||
Foreground="Aqua" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
<pry:IcoButton | |||
Grid.Column="3" | |||
Width="140" | |||
Margin="10" | |||
HorizontalAlignment="Left" | |||
Command="{Binding SaveRecipe}" | |||
Content="保存配方" | |||
FontSize="17" | |||
Foreground="Aqua" | |||
IcoText="" | |||
IsEnabled="True" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
</StackPanel> | |||
<!--#endregion--> | |||
<ListBox | |||
Grid.Row="2" | |||
Margin="5" | |||
VerticalAlignment="Top" | |||
Background="Transparent" | |||
BorderThickness="0" | |||
ItemsSource="{Binding Recipes}" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListBox.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<UniformGrid | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
Columns="8" /> | |||
</ItemsPanelTemplate> | |||
</ListBox.ItemsPanel> | |||
<ListBox.ItemTemplate> | |||
<DataTemplate> | |||
<Grid | |||
Name="tt" | |||
Height="220" | |||
Margin="5"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="30" /> | |||
<RowDefinition Height="20" /> | |||
<RowDefinition Height="128" /> | |||
<RowDefinition Height="2" /> | |||
<RowDefinition Height="40" /> | |||
</Grid.RowDefinitions> | |||
<Image | |||
Grid.RowSpan="5" | |||
Source="/BPASmartClient.CustomResource;component/Image/配方背景/竖背景框.png" | |||
Stretch="Fill" /> | |||
<TextBlock | |||
Grid.Row="0" | |||
Margin="2,5,0,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Top" | |||
FontSize="18" | |||
Foreground="#FF2AB2E7" | |||
Text="{Binding RecipeName}" /> | |||
<TextBlock | |||
Grid.Row="1" | |||
Margin="5,0,0,0" | |||
VerticalAlignment="Top" | |||
Foreground="#FF2AB2E7" | |||
Text="配方信息:" /> | |||
<ScrollViewer | |||
Grid.Row="2" | |||
VerticalAlignment="Top" | |||
Background="Transparent" | |||
HorizontalScrollBarVisibility="Hidden" | |||
VerticalScrollBarVisibility="Hidden"> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="auto" /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<ItemsControl ItemsSource="{Binding RawMaterials}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid> | |||
<TextBlock | |||
Grid.Row="1" | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Right" | |||
VerticalAlignment="Center" | |||
Foreground="#aa2AB2E7" | |||
Text="{Binding RawMaterialName}" /> | |||
</Grid> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
<ItemsControl Grid.Column="1" ItemsSource="{Binding RawMaterials}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<StackPanel Orientation="Horizontal"> | |||
<TextBlock | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Foreground="#aa2AB2E7" | |||
Text=":" /> | |||
<TextBlock | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Foreground="#aa2AB2E7" | |||
Text="{Binding RawMaterialWeight}" /> | |||
<TextBlock | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Foreground="#aa2AB2E7" | |||
Text="g" /> | |||
</StackPanel> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</Grid> | |||
</ScrollViewer> | |||
<!--<Grid | |||
Grid.Row="3" | |||
Height="2" | |||
VerticalAlignment="Bottom"> | |||
<Grid.Background> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/直线.png" Stretch="Fill" /> | |||
</Grid.Background> | |||
</Grid>--> | |||
<Image | |||
Grid.Row="3" | |||
Width="{Binding ElementName=tt, Path=ActualWidth}" | |||
Height="2" | |||
VerticalAlignment="Bottom" | |||
Source="/BPASmartClient.CustomResource;component/Image/直线.png" | |||
Stretch="Fill" /> | |||
<Grid | |||
Name="gr" | |||
Grid.Row="4" | |||
Height="30" | |||
Margin="0,0,0,10" | |||
VerticalAlignment="Bottom" | |||
Background="Transparent"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<!--<Image | |||
Height="2" | |||
Grid.ColumnSpan="2" | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
VerticalAlignment="Top" | |||
Source="/BPASmartClient.CustomResource;component/Image/直线.png" />--> | |||
<pry:IcoButton | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
Margin="4,4,3,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Background="#11F53F62" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipCode}" | |||
Content="删除" | |||
EnterBackground="#22F53F62" | |||
FontStyle="Normal" | |||
Foreground="#FFF53F62" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
<pry:IcoButton | |||
Grid.Column="1" | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
Margin="3,4,4,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Background="#112AB2E7" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.DetailsCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipCode}" | |||
Content="编辑" | |||
EnterBackground="#222AB2E7" | |||
Foreground="#FF2AB2E7" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
</Grid> | |||
<!--</StackPanel>--> | |||
</Grid> | |||
</DataTemplate> | |||
</ListBox.ItemTemplate> | |||
</ListBox> | |||
</Grid> | |||
</UserControl> |
@@ -0,0 +1,48 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Reflection; | |||
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.DosingHKProject.View | |||
{ | |||
/// <summary> | |||
/// RecipeSettingsView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class RecipeSettingsView : UserControl | |||
{ | |||
public RecipeSettingsView() | |||
{ | |||
InitializeComponent(); | |||
//SetAlignment(); | |||
} | |||
//public static void SetAlignment() | |||
//{ | |||
// //获取系统是以Left-handed(true)还是Right-handed(false) | |||
// var ifLeft = SystemParameters.MenuDropAlignment; | |||
// if (ifLeft) | |||
// { | |||
// Console.WriteLine($"系统为左撇子,转换为右撇子。"); | |||
// // change to false | |||
// var t = typeof(SystemParameters); | |||
// var field = t.GetField("_menuDropAlignment", BindingFlags.NonPublic | BindingFlags.Static); | |||
// field.SetValue(null, false); | |||
// ifLeft = SystemParameters.MenuDropAlignment; | |||
// } | |||
//} | |||
} | |||
} |
@@ -0,0 +1,150 @@ | |||
<UserControl | |||
x:Class="BPASmartClient.DosingHKProject.View.SiemensRecipeReceiveView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:control="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingHKProject.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingHKProject.ViewModel" | |||
d:DesignHeight="450" | |||
d:DesignWidth="800" | |||
mc:Ignorable="d"> | |||
<UserControl.Resources> | |||
<SolidColorBrush x:Key="BorderSolid" Color="#5523CACA" /> | |||
<SolidColorBrush x:Key="FontColor" Color="#FF2AB2E7" /> | |||
<SolidColorBrush x:Key="TitleFontColor" Color="#ddd" /> | |||
<SolidColorBrush x:Key="CursorColor" Color="Aqua" /> | |||
<SolidColorBrush x:Key="TitleBorderColor" Color="#FF2AB2E7" /> | |||
<SolidColorBrush x:Key="TextBlockForeground" Color="#9934F7F7" /> | |||
<Style x:Key="TextBlockStyle" TargetType="TextBlock"> | |||
<Setter Property="FontFamily" Value="楷体" /> | |||
<Setter Property="FontSize" Value="20" /> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<!--<Setter Property="Foreground" Value="{StaticResource FontColor}" />--> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
<Setter Property="HorizontalAlignment" Value="Center" /> | |||
</Style> | |||
<Style x:Key="buttonStyle" TargetType="Button"> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="FontSize" Value="16" /> | |||
<Setter Property="Foreground" Value="Aqua" /> | |||
<Setter Property="HorizontalAlignment" Value="Center" /> | |||
<Setter Property="BorderThickness" Value="0" /> | |||
</Style> | |||
</UserControl.Resources> | |||
<UserControl.DataContext> | |||
<vm:SiemensRecipeReceiveViewModel /> | |||
</UserControl.DataContext> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="50"/> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right"> | |||
<pry:IcoButton | |||
Grid.Column="3" | |||
Width="140" | |||
Margin="10" | |||
HorizontalAlignment="Right" | |||
Command="{Binding ClearAllRecipe}" | |||
Content="清除所有配方" | |||
FontSize="16" | |||
Foreground="Aqua" | |||
IcoText="" | |||
IsEnabled="True" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
</StackPanel> | |||
<ScrollViewer Grid.Row="1"> | |||
<ListView | |||
Margin="5" | |||
VerticalAlignment="Top" | |||
Background="Transparent" | |||
BorderThickness="0" | |||
ItemsSource="{Binding Recipes}" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListView.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<UniformGrid | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
Columns="8" /> | |||
</ItemsPanelTemplate> | |||
</ListView.ItemsPanel> | |||
<ListView.ItemTemplate> | |||
<DataTemplate> | |||
<Border Margin="5" Background="LightSkyBlue"> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition Height="0.25*" /> | |||
<RowDefinition Height="0.2*" /> | |||
</Grid.RowDefinitions> | |||
<Image Source="/BPASmartClient.CustomResource;component/Image/AGV/炒锅.png" /> | |||
<WrapPanel Grid.Row="1"> | |||
<TextBlock | |||
Margin="2,0,0,0" | |||
Foreground="#dd000000" | |||
Text="名称:" /> | |||
<TextBlock | |||
Margin="2,0,0,0" | |||
Foreground="#dd000000" | |||
Text="{Binding RecipeName}" /> | |||
<TextBlock | |||
Margin="5,0,0,0" | |||
Foreground="#dd000000" | |||
Text="编号:" /> | |||
<TextBlock | |||
Margin="2,0,0,0" | |||
Foreground="#dd000000" | |||
Text="{Binding RecipeCode}" /> | |||
<TextBlock | |||
Margin="5,0,0,0" | |||
Foreground="#dd000000" | |||
Text="托盘号:" /> | |||
<TextBlock | |||
Margin="2,0,0,0" | |||
Foreground="#dd000000" | |||
Text="{Binding TrayCode}" /> | |||
</WrapPanel> | |||
<Grid | |||
Name="gr" | |||
Grid.Row="2" | |||
Height="30"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<pry:IcoButton | |||
Grid.Column="0" | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Center" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.DetailsCommand, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipeCode}" | |||
Content="详情" | |||
EnterBackground="#FF2AB2E7" | |||
Foreground="#dd000000" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
</Grid> | |||
</Grid> | |||
</Border> | |||
</DataTemplate> | |||
</ListView.ItemTemplate> | |||
</ListView> | |||
</ScrollViewer> | |||
</Grid> | |||
</UserControl> |
@@ -0,0 +1,29 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Reflection; | |||
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.DosingHKProject.View | |||
{ | |||
/// <summary> | |||
/// RecipeSettingsView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class SiemensRecipeReceiveView : UserControl | |||
{ | |||
public SiemensRecipeReceiveView() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,74 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using BPASmartClient.Helper; | |||
using BPASmartClient.DosingHKProject.Model; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
namespace BPASmartClient.DosingHKProject.ViewModel | |||
{ | |||
public class ChangeDeviceNameViewModel : ObservableObject | |||
{ | |||
public ChangeDeviceNameViewModel() | |||
{ | |||
ActionManage.GetInstance.Register(new Action<object>((o) => | |||
{ | |||
if (o != null && o is string str) IpAddress = str; | |||
}), "ChangeDeviceNameViewOpen"); | |||
CancleCommand = new RelayCommand(() => { ActionManage.GetInstance.Send("ChangeDeviceNameViewClose"); }); | |||
ConfirmCommand = new RelayCommand(() => | |||
{ | |||
if (string.IsNullOrEmpty(DeviceName)) | |||
{ | |||
ErrorInfo = "设备名称不能为空"; | |||
return; | |||
} | |||
int index = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.IpAddress == IpAddress); | |||
if (index >= 0 && index < DeviceInquire.GetInstance.devices.Count) | |||
{ | |||
if (DeviceInquire.GetInstance.devices.FirstOrDefault(p => p.DeviceName == DeviceName) != null) | |||
ErrorInfo = "设备名称已存在"; | |||
else | |||
{ | |||
var res = Global.DeviceRawMaterials.FirstOrDefault(p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(index).DeviceName); | |||
if (res != null) | |||
{ | |||
res.RawMaterialName = DeviceName; | |||
DeviceInquire.GetInstance.devices.ElementAt(index).DeviceName = DeviceName; | |||
DeviceInquire.GetInstance.GetDevice(IpAddress).SetDeviceName(DeviceName);//设置PLC名称 | |||
for (int i = 0; i < Json<LocaPar>.Data.Recipes.Count; i++) | |||
{ | |||
for (int m = 0; m < Json<LocaPar>.Data.Recipes.ElementAt(i).RawMaterials.Count; m++) | |||
{ | |||
Json<LocaPar>.Data.Recipes.ElementAt(i).RawMaterials.ElementAt(m).RawMaterialName = DeviceName; | |||
} | |||
} | |||
ActionManage.GetInstance.Send("ChangeDeviceNameViewClose"); | |||
} | |||
} | |||
} | |||
}); | |||
} | |||
private static string IpAddress = string.Empty; | |||
public RelayCommand ConfirmCommand { get; set; } | |||
public RelayCommand CancleCommand { get; set; } | |||
public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } } | |||
private string _mErrorInfo; | |||
public string DeviceName { get { return _mDeviceName; } set { _mDeviceName = value; OnPropertyChanged(); } } | |||
private string _mDeviceName; | |||
} | |||
} |
@@ -0,0 +1,48 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System.Collections.Concurrent; | |||
using System.Collections.ObjectModel; | |||
using System.Windows; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPASmartClient.DosingHKProject.View; | |||
using BPASmartClient.DosingHKProject.Model; | |||
namespace BPASmartClient.DosingHKProject.ViewModel | |||
{ | |||
public class DeviceListViewModel : ObservableObject | |||
{ | |||
public DeviceListViewModel() | |||
{ | |||
ChangeNameCommand = new RelayCommand<object>((o) => | |||
{ | |||
if (o != null && o is string str) | |||
{ | |||
ChangeDeviceNameView cdn = new ChangeDeviceNameView(); | |||
ActionManage.GetInstance.Send("ChangeDeviceNameViewOpen", str); | |||
cdn.ShowDialog(); | |||
} | |||
}); | |||
devices = DeviceInquire.GetInstance.devices; | |||
} | |||
public RelayCommand<object> ChangeNameCommand { get; set; } | |||
//public static ObservableCollection<Devices> devices { get; set; } = new ObservableCollection<Devices>(); | |||
public ObservableCollection<Devices> devices { get; set; } | |||
} | |||
public class Devices : ObservableObject | |||
{ | |||
public string IpAddress { get { return _mIpAddress; } set { _mIpAddress = value; OnPropertyChanged(); } } | |||
private string _mIpAddress; | |||
public string DeviceName { get { return _mDeviceName; } set { _mDeviceName = value; OnPropertyChanged(); } } | |||
private string _mDeviceName; | |||
} | |||
} |
@@ -0,0 +1,70 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System.Collections.ObjectModel; | |||
using BPASmartClient.DosingHKProject.Model; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPASmartClient.CustomResource.UserControls.MessageShow; | |||
using BPASmartClient.CustomResource.UserControls; | |||
using System.Diagnostics; | |||
using BPASmartClient.DosingProject; | |||
namespace BPASmartClient.DosingHKProject.ViewModel | |||
{ | |||
public class DeviceMaterialParViewModel : ObservableObject | |||
{ | |||
public DeviceMaterialParViewModel() | |||
{ | |||
deviceParModels = Json<DevicePar>.Data.deviceParModels; | |||
RemoveCommand = new RelayCommand<object>((o) => | |||
{ | |||
var res = deviceParModels.FirstOrDefault(p => p.MaterialName == o?.ToString()); | |||
if (res != null) deviceParModels.Remove(res); | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"{o.ToString()}:原料删除成功!"); | |||
}); | |||
AddCommand = new RelayCommand(() => { deviceParModels.Add(new DeviceParMode()); }); | |||
SaveCommand = new RelayCommand(() => | |||
{ | |||
if (deviceParModels == null || deviceParModels.Count <= 0) | |||
{ | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", $"没有可保存的参数!"); | |||
return; | |||
} | |||
for (int i = 0; i < deviceParModels.Count; i++) | |||
{ | |||
if (deviceParModels.Where(p => p.MaterialName == deviceParModels.ElementAt(i).MaterialName)?.ToList()?.Count >= 2) | |||
deviceParModels.ElementAt(i).IsRedundant = true; | |||
else | |||
deviceParModels.ElementAt(i).IsRedundant = false; | |||
} | |||
if (deviceParModels.FirstOrDefault(p => p.IsRedundant == true) != null) | |||
{ | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "错误", $"原料名称冲突,请检查后重试!"); | |||
return; | |||
} | |||
deviceParModels.Where(P => P.MaterialName.Length <= 0)?.ToList()?.ForEach(item => | |||
{ | |||
Json<DevicePar>.Data.deviceParModels.Remove(item); | |||
}); | |||
Json<DevicePar>.Save(); | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"原料参数保存成功!"); | |||
}); | |||
} | |||
public ObservableCollection<DeviceParMode> deviceParModels { get; set; } | |||
public RelayCommand<object> RemoveCommand { get; set; } | |||
public RelayCommand AddCommand { get; set; } | |||
public RelayCommand SaveCommand { get; set; } | |||
} | |||
} |
@@ -0,0 +1,28 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System.Collections.Concurrent; | |||
using System.Collections.ObjectModel; | |||
using System.Windows; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPASmartClient.DosingHKProject.Model; | |||
namespace BPASmartClient.DosingHKProject.ViewModel | |||
{ | |||
public class HardwareStatusViewModel : ObservableObject | |||
{ | |||
public HardwareStatusViewModel() | |||
{ | |||
TopDeviceCurrentStatuses = DeviceInquire.GetInstance.TopDeviceCurrentStatuses; | |||
BottomDeviceCurrentStatuses = DeviceInquire.GetInstance.BottomDeviceCurrentStatuses; | |||
} | |||
public ObservableCollection<DeviceCurrentStatus> TopDeviceCurrentStatuses { get; set; } | |||
public ObservableCollection<DeviceCurrentStatus> BottomDeviceCurrentStatuses { get; set; } | |||
} | |||
} |
@@ -0,0 +1,93 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System.Collections.ObjectModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPASmartClient.Helper; | |||
namespace BPASmartClient.DosingHKProject.ViewModel | |||
{ | |||
public class ManualControlViewModel : ObservableObject | |||
{ | |||
public ManualControlViewModel() | |||
{ | |||
for (int i = 0; i < 6; i++) | |||
{ | |||
cylinderModels.Add(new CylinderModel() | |||
{ | |||
Name = $"顶升气缸 {i + 1}", | |||
LeftTog = false, | |||
RightTog = false, | |||
}); | |||
} | |||
PalletCylinders.Add(new CylinderModel() | |||
{ | |||
Name = $"进料桶顶升气缸", | |||
LeftTog = false, | |||
RightTog = false, | |||
}); | |||
for (int i = 0; i < 3; i++) | |||
{ | |||
PalletCylinders.Add(new CylinderModel() | |||
{ | |||
Name = $"出料桶顶升气缸{i+1}", | |||
LeftTog = false, | |||
RightTog = false, | |||
}); | |||
} | |||
Open = new RelayCommand<object>((o) => | |||
{ | |||
ActionManage.GetInstance.Send("ManualOpen", o); | |||
}); | |||
Close = new RelayCommand<object>((o) => | |||
{ | |||
ActionManage.GetInstance.Send("ManualClose", o); | |||
}); | |||
} | |||
/// <summary> | |||
/// 升降气缸 | |||
/// </summary> | |||
public ObservableCollection<CylinderModel> cylinderModels { get; set; } = new ObservableCollection<CylinderModel>(); | |||
/// <summary> | |||
/// 阻挡气缸 | |||
/// </summary> | |||
public ObservableCollection<CylinderModel> BlockCylinders { get; set; } = new ObservableCollection<CylinderModel>(); | |||
/// <summary> | |||
/// 托盘气缸 | |||
/// </summary> | |||
public ObservableCollection<CylinderModel> PalletCylinders { get; set; } = new ObservableCollection<CylinderModel>(); | |||
public RelayCommand<object> Open { get; set; } | |||
public RelayCommand<object> Close { get; set; } | |||
} | |||
public class CylinderModel : ObservableObject | |||
{ | |||
public bool LeftTog { get { return _mLeftTog; } set { _mLeftTog = value; OnPropertyChanged(); } } | |||
private bool _mLeftTog; | |||
public bool RightTog { get { return _mRightTog; } set { _mRightTog = value; OnPropertyChanged(); } } | |||
private bool _mRightTog; | |||
public string Name { get { return _mName; } set { _mName = value; OnPropertyChanged(); } } | |||
private string _mName; | |||
} | |||
} |
@@ -0,0 +1,132 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System.Collections.ObjectModel; | |||
using BPASmartClient.DosingHKProject.Model; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPASmartClient.CustomResource.UserControls.MessageShow; | |||
using BPASmartClient.CustomResource.UserControls; | |||
using System.Diagnostics; | |||
using BPASmartClient.DosingHKProject.Model.Siemens; | |||
using BPASmartClient.DosingProject; | |||
namespace BPASmartClient.DosingHKProject.ViewModel | |||
{ | |||
public class NewLocalRecipeViewModel : ObservableObject | |||
{ | |||
public NewLocalRecipeViewModel() | |||
{ | |||
ActionManage.GetInstance.CancelRegister("LocalRecipeEdit"); | |||
ActionManage.GetInstance.Register(new Action<object>((o) => | |||
{ | |||
if (o != null && o is RemoteRecipeData rm) | |||
{ | |||
RecipeName = rm.RecipeName; | |||
RecipeCode = rm.RecipeCode; | |||
foreach (var item in rm.RawMaterial) | |||
{ | |||
RawMaterial.Add(item); | |||
} | |||
} | |||
}), "LocalRecipeEdit"); | |||
RemoveCommand = new RelayCommand<object>((o) => | |||
{ | |||
var res = RawMaterial.FirstOrDefault(p => p.RawMaterialLocation == (int)o); | |||
if (res != null) RawMaterial.Remove(res); | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"{o.ToString()}:原料删除成功!"); | |||
}); | |||
AddCommand = new RelayCommand(() => | |||
{ | |||
RawMaterial.Add(new RemoteRecipeRawMaterial() | |||
{ | |||
RawMaterialName = "原料" + (RawMaterial.Count + 1), | |||
RawMaterialLocation = RawMaterial.Count + 1, | |||
RawMaterialBarrelNum = 1, | |||
RawMaterialWeight = 100 | |||
}); | |||
}); | |||
SaveCommand = new RelayCommand(() => | |||
{ | |||
if (RecipeName.Length < 0 || RecipeName == null) | |||
{ | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "错误", $"配方名称不能为空"); | |||
return; | |||
} | |||
ObservableCollection<RemoteRecipeRawMaterial> RawMaterials = new ObservableCollection<RemoteRecipeRawMaterial>(); | |||
if (RawMaterial == null || RawMaterial.Count <= 0) | |||
{ | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", $"没有可保存的参数!"); | |||
return; | |||
} | |||
for (int i = 0; i < RawMaterial.Count; i++) | |||
{ | |||
if (RawMaterial.Where(p => p.RawMaterialLocation == RawMaterial.ElementAt(i).RawMaterialLocation)?.ToList()?.Count >= 2) | |||
{ | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "错误", $"原料位置冲突,请检查后重试!"); | |||
return; | |||
} | |||
} | |||
int index = Array.FindIndex(Json<LocalRecipeDataColl>.Data.Recipes.ToArray(), p => p.RecipeCode == RecipeCode); | |||
if (index >= 0) | |||
{ | |||
foreach (var item in RawMaterial) | |||
{ | |||
RawMaterials.Add(new RemoteRecipeRawMaterial() | |||
{ | |||
RawMaterialLocation = item.RawMaterialLocation, | |||
RawMaterialBarrelNum = item.RawMaterialBarrelNum, | |||
RawMaterialWeight = item.RawMaterialWeight, | |||
}); | |||
} | |||
Json<LocalRecipeDataColl>.Data.Recipes.ElementAt(index).RecipeName= RecipeName; | |||
Json<LocalRecipeDataColl>.Data.Recipes.ElementAt(index).RecipeCode = RecipeCode; | |||
Json<LocalRecipeDataColl>.Data.Recipes.ElementAt(index).RawMaterial = RawMaterial; | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"修改配方完成!"); | |||
} | |||
else | |||
{ | |||
foreach (var item in RawMaterial) | |||
{ | |||
RawMaterials.Add(new RemoteRecipeRawMaterial() | |||
{ | |||
RawMaterialLocation = item.RawMaterialLocation, | |||
RawMaterialBarrelNum = item.RawMaterialBarrelNum, | |||
RawMaterialWeight = item.RawMaterialWeight, | |||
}); | |||
} | |||
Json<LocalRecipeDataColl>.Data.Recipes.Add(new RemoteRecipeData() | |||
{ | |||
RecipeName = RecipeName, | |||
RecipeCode = RecipeCode, | |||
RawMaterial = RawMaterials, | |||
}); | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"自定义配方添加完成!"); | |||
} | |||
ActionManage.GetInstance.Send("CloseNewRemoteRecipeView"); | |||
}); | |||
} | |||
public string RecipeCode { get { return _mRecipeCode; } set { _mRecipeCode = value; OnPropertyChanged(); } } | |||
private string _mRecipeCode = string.Empty; | |||
public string RecipeName { get { return _mRecipeName; } set { _mRecipeName = value; OnPropertyChanged(); } } | |||
private string _mRecipeName = string.Empty; | |||
public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } } | |||
private string _mErrorInfo; | |||
public ObservableCollection<RemoteRecipeRawMaterial> RawMaterial { get; set; } = new ObservableCollection<RemoteRecipeRawMaterial>(); | |||
public RelayCommand<object> RemoveCommand { get; set; } | |||
public RelayCommand AddCommand { get; set; } | |||
public RelayCommand SaveCommand { get; set; } | |||
} | |||
} |
@@ -0,0 +1,58 @@ | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
using BPASmartClient.DosingHKProject.Model; | |||
using BPASmartClient.Helper; | |||
using BPASmartClient.Model; | |||
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; | |||
namespace BPASmartClient.DosingHKProject.ViewModel; | |||
public class NewMaterialViewModel:ObservableObject | |||
{ | |||
public ObservableCollection<RawMaterialModel> Materials { get; set; } = Json<LocaMaterial>.Data.LocalMaterails; | |||
public string MaterialName { get { return _materialName; } set { _materialName = value; OnPropertyChanged(); } } | |||
private string _materialName = string.Empty; | |||
public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } } | |||
private string _mErrorInfo; | |||
public RelayCommand<object> RemoveCommand { get; set; } | |||
public RelayCommand SaveCommand { get; set; } | |||
private void Remove(object o) | |||
{ | |||
if (o == null) return; | |||
if(o is string id) | |||
{ | |||
var res = Materials.FirstOrDefault(p=>p.RawMaterialId == id); | |||
Materials.Remove(res); | |||
Json<LocaMaterial>.Save(); | |||
MessageLog.GetInstance.ShowUserLog($"删除原料--{res.RawMaterialName}"); | |||
} | |||
} | |||
public NewMaterialViewModel() | |||
{ | |||
RemoveCommand = new RelayCommand<object>(Remove); | |||
SaveCommand = new RelayCommand(() => | |||
{ | |||
if(MaterialName == String.Empty) { ErrorInfo = "原料名称不能为空";return; } | |||
if(Global.DeviceRawMaterials.FirstOrDefault(p=>p.RawMaterialName == MaterialName) != null) { ErrorInfo = "设备中已存在该原料名称";return;} | |||
if(Json<LocaMaterial>.Data.LocalMaterails.FirstOrDefault(p=>p.RawMaterialName == MaterialName) != null) { ErrorInfo = "本地原料名称重复";return ;} | |||
Json<LocaMaterial>.Data.LocalMaterails.Add(new RawMaterialModel { RawMaterialName = MaterialName, RawMaterialId = Guid.NewGuid().ToString() , RawMaterialSource = 0 }); | |||
Json<LocaMaterial>.Save(); | |||
MessageLog.GetInstance.ShowUserLog($"添加原料--{MaterialName}"); | |||
}); | |||
} | |||
} |
@@ -0,0 +1,164 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System.Collections.ObjectModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPASmartClient.Helper; | |||
using BPASmartClient.DosingHKProject.Model; | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
using BPASmartClient.Model; | |||
using BPASmartClient.DosingHKProject.Model.RawMaterial; | |||
namespace BPASmartClient.DosingHKProject.ViewModel | |||
{ | |||
public class NewRecipeViewModel : ObservableObject | |||
{ | |||
public NewRecipeViewModel() | |||
{ | |||
ActionManage.GetInstance.Register(new Action<object>((o) => | |||
{ | |||
if (o != null && o is RecipeModel rm) | |||
{ | |||
RecipeName = rm.RecipeName; | |||
foreach (var item in rm.RawMaterials) | |||
{ | |||
RawMaterials.Add(item); | |||
} | |||
RecipeCode = rm.RecipCode; | |||
} | |||
}), "Details"); | |||
AddCommand = new RelayCommand(() => | |||
{ | |||
p: | |||
string guid = Guid.NewGuid().ToString(); | |||
if (RawMaterials.FirstOrDefault(p => p.RawMaterialId == guid) == null) | |||
{ | |||
RawMaterials.Add(new RawMaterialModel() | |||
{ | |||
RawMaterialId = guid | |||
}); | |||
} | |||
else goto p; | |||
}); | |||
RemoveCommand = new RelayCommand<object>((obj) => | |||
{ | |||
if (obj is string rm) | |||
{ | |||
var res = RawMaterials.FirstOrDefault(p => p.RawMaterialId == rm); | |||
if (res != null) Global.DeviceRawMaterials.Remove(res); | |||
} | |||
}); | |||
SaveCommand = new RelayCommand(() => | |||
{ | |||
ErrorInfo = String.Empty; | |||
if (RecipeName == String.Empty) { ErrorInfo = "配方名称未填写"; return; } | |||
for (int i = 0; i < RawMaterials.Count; i++) | |||
{ | |||
var res = DeviceInquire.GetInstance.devices.FirstOrDefault(p => p.DeviceName == RawMaterials.ElementAt(i).RawMaterialName); | |||
if (res != null) | |||
{ | |||
RawMaterials.ElementAt(i).DeviceIp = res.IpAddress;//根据设备名称和原料名称的唯一匹配关系,给原料配置IP | |||
RawMaterials.ElementAt(i).RawMaterialSource = 1; | |||
} | |||
var su = Global.DeviceRawMaterials.FirstOrDefault(p => p.RawMaterialName == RawMaterials.ElementAt(i).RawMaterialName); | |||
if (su != null) | |||
{ | |||
RawMaterials.ElementAt(i).RawMaterialSource = su.RawMaterialSource; | |||
} | |||
} | |||
if (RecipeCode.Length <= 0)//新建配方 | |||
{ | |||
var res = Array.FindIndex(Json<LocaPar>.Data.Recipes.ToArray(), p => p.RecipeName == RecipeName); | |||
if (res >= 0 && res < Json<LocaPar>.Data.Recipes.Count) | |||
{ | |||
ErrorInfo = "该配方已存在,请重新输入"; | |||
} | |||
else | |||
{ | |||
AddRecipes(); | |||
} | |||
} | |||
else//修改配方 | |||
{ | |||
var res = Array.FindIndex(Json<LocaPar>.Data.Recipes.ToArray(), p => p.RecipCode == RecipeCode); | |||
if (res >= 0 && res < Json<LocaPar>.Data.Recipes.Count) | |||
{ | |||
Json<LocaPar>.Data.Recipes.ElementAt(res).RecipeName = RecipeName; | |||
Json<LocaPar>.Data.Recipes.ElementAt(res).RawMaterials.Clear(); | |||
foreach (var item in RawMaterials) | |||
{ | |||
Json<LocaPar>.Data.Recipes.ElementAt(res).RawMaterials.Add(item); | |||
} | |||
} | |||
} | |||
ActionManage.GetInstance.Send("CloseNewRecipeView"); | |||
}); | |||
if (Global.userInfo.permission == CustomResource.Pages.Enums.Permission.管理员) | |||
{ | |||
foreach (var item in Global.DeviceRawMaterials) | |||
{ | |||
RawMaterialNames.Add(item.RawMaterialName); | |||
} | |||
foreach (var item in Json<LocaMaterial>.Data.LocalMaterails) | |||
{ | |||
RawMaterialNames.Add(item.RawMaterialName); | |||
} | |||
} | |||
else | |||
{ | |||
foreach (var item in Global.DeviceRawMaterials) | |||
{ | |||
if (Global.userInfo.devRawMaterials.FirstOrDefault(p => p.RawMaterialName == item.RawMaterialName) != null) RawMaterialNames.Add(item.RawMaterialName); | |||
} | |||
foreach (var item in Json<LocaMaterial>.Data.LocalMaterails) | |||
{ | |||
if (Global.userInfo.locaRawMaterials.FirstOrDefault(p => p.RawMaterialName == item.RawMaterialName) != null) RawMaterialNames.Add(item.RawMaterialName); | |||
} | |||
} | |||
} | |||
private void AddRecipes() | |||
{ | |||
string date = DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss"); | |||
var dates = date.Split("-").ToList(); | |||
StringBuilder sb = new StringBuilder(); | |||
dates?.ForEach((item) => { sb.Append(item); }); | |||
Json<LocaPar>.Data.Recipes.Add(new RecipeModel() | |||
{ | |||
SerialNum = Json<LocaPar>.Data.Recipes.Count + 1, | |||
RawMaterials = RawMaterials, | |||
RecipCode = sb.ToString(), | |||
RecipeName = RecipeName, | |||
}); | |||
} | |||
public string RecipeCode { get { return _mRecipeCode; } set { _mRecipeCode = value; OnPropertyChanged(); } } | |||
private string _mRecipeCode = string.Empty; | |||
public string RecipeName { get { return _mRecipeName; } set { _mRecipeName = value; OnPropertyChanged(); } } | |||
private string _mRecipeName = string.Empty; | |||
public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } } | |||
private string _mErrorInfo; | |||
public RelayCommand AddCommand { get; set; } | |||
public RelayCommand<object> RemoveCommand { get; set; } | |||
public RelayCommand SaveCommand { get; set; } | |||
public ObservableCollection<RawMaterialModel> RawMaterials { get; set; } = new ObservableCollection<RawMaterialModel>(); | |||
public ObservableCollection<string> RawMaterialNames { get; set; } = new ObservableCollection<string>(); | |||
} | |||
} |
@@ -0,0 +1,214 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System.Collections.Concurrent; | |||
using System.Collections.ObjectModel; | |||
using System.Windows; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPASmartClient.DosingHKProject.Model; | |||
using System.Threading; | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
using BPASmartClient.CustomResource.UserControls.MessageShow; | |||
using BPASmartClient.CustomResource.UserControls; | |||
using BPASmartClient.Model.柔性味魔方; | |||
using BPASmartClient.Model; | |||
using BPASmartClient.DosingProject; | |||
namespace BPASmartClient.DosingHKProject.ViewModel | |||
{ | |||
public class RecipeControlViewModel : ObservableObject | |||
{ | |||
ConcurrentQueue<string> devices = new ConcurrentQueue<string>(); | |||
public RecipeControlViewModel() | |||
{ | |||
StartCommand = new RelayCommand<object>((o) => | |||
{ | |||
if (o != null && o is string deviceName) | |||
{ | |||
int index = Array.FindIndex(Recipes.ToArray(), p => p.RecipeName == deviceName); | |||
if (index >= 0 && index < Recipes.Count) | |||
{ | |||
Recipes.ElementAt(index).IsEnable = false; | |||
} | |||
MessageLog.GetInstance.ShowUserLog($"下发工单 { Recipes.ElementAt(index).RecipeName}"); | |||
devices.Enqueue(deviceName); | |||
var res = Recipes.FirstOrDefault(p => p.RecipeName == deviceName); | |||
UserTreeWait.Add(new RecipeModel { RecipeName = deviceName, RawMaterials = res.RawMaterials }); | |||
} | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方下发成功!"); | |||
MessageLog.GetInstance.ShowUserLog($"下发工单 {Guid.NewGuid().ToString()}"); | |||
}); | |||
ChangeRecipeStateCommand = new RelayCommand<object>(ChangeRecipeState); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
if (devices.Count > 0) | |||
{ | |||
int index = Array.FindIndex(Recipes.ToArray(), p => p.RecipeName == devices.ElementAt(0)); | |||
if (index >= 0 && index < Recipes.Count) | |||
{ | |||
Recipes.ElementAt(index).Are.Reset(); | |||
Recipes.ElementAt(index).IsEnable = false; | |||
App.Current.Dispatcher.Invoke(new Action(() => | |||
{ | |||
recipeProcesses.Clear(); | |||
UserTreeWait.RemoveAt(0); | |||
})); | |||
CurrentRecipeName = Recipes.ElementAt(index).RecipeName; | |||
foreach (var item in Recipes.ElementAt(index).RawMaterials) | |||
{ | |||
DeviceInquire.GetInstance.GetDevice(item.DeviceIp)?.Start(item.RawMaterialWeight);//启动并写入每个原料重量 | |||
App.Current.Dispatcher.Invoke(new Action(() => | |||
{ | |||
recipeProcesses.Add(new RawMaterialModel() | |||
{ | |||
RawMaterialName = item.RawMaterialName, | |||
RecipeStatus = item.RecipeStatus, | |||
RawMaterialSource = item.RawMaterialSource, | |||
RawMaterialId = item.RawMaterialId, | |||
}); | |||
})); | |||
} | |||
Recipes.ElementAt(index).Are.WaitOne();//阻塞,直到当前配方完成 | |||
devices.TryDequeue(out string deviceName); | |||
App.Current.Dispatcher.Invoke(new Action(() => | |||
{ | |||
UserTreeCompelete.Add(Recipes.ElementAt(index));//当前配方完成后添加到已完成的配方列表 | |||
})); | |||
App.Current.Dispatcher.Invoke(new Action(() => { | |||
recipeProcesses.Clear(); | |||
CurrentRecipeName = string.Empty; | |||
}));//完成后清空当前配方 | |||
} | |||
} | |||
Thread.Sleep(100); | |||
}), "启动配方下发"); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
for (int i = 0; i < Recipes.Count; i++) | |||
{ | |||
for (int m = 0; m < Recipes.ElementAt(i).RawMaterials.Count; m++) | |||
{ | |||
var RunStatus = DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(m).DeviceIp).deviceStatus.RunStatus; | |||
//设备状态显示 | |||
if (Recipes.ElementAt(i).RecipeName == CurrentRecipeName) | |||
{ | |||
string deviceName = DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(m).DeviceIp).DeviceName; | |||
int index = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == deviceName); | |||
if (index >= 0 && index < recipeProcesses.Count) | |||
{ | |||
App.Current.Dispatcher.Invoke(new Action(() => { recipeProcesses.ElementAt(index).RecipeStatus = RunStatus; })); | |||
} | |||
} | |||
var proc = recipeProcesses.Where(p=>p.RecipeStatus==3).ToList(); | |||
if (proc != null && proc.Count > 0 && proc.Count== recipeProcesses.Count) | |||
{ | |||
int recipIndex = Array.FindIndex(Recipes.ToArray(), p => p.RecipeName == CurrentRecipeName); | |||
if (recipIndex >= 0 && recipIndex < Recipes.Count) | |||
{ | |||
for (int n = 0; n < recipeProcesses.Count; n++) | |||
{ | |||
DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(recipIndex).RawMaterials.ElementAt(n).DeviceIp).StatusReset();//完成配料的设备运行状态地址写0 | |||
MessageLog.GetInstance.ShowRunLog(Recipes.ElementAt(recipIndex).RawMaterials.ElementAt(n).DeviceIp); | |||
} | |||
App.Current.Dispatcher.Invoke(new Action(() => { recipeProcesses.Clear(); })); | |||
Recipes.ElementAt(recipIndex).IsEnable = true; | |||
Recipes.ElementAt(recipIndex).Are.Set(); | |||
} | |||
} | |||
//Recipes.ElementAt(i).RawMaterials.ElementAt(m).RecipeStatus = RunStatus; | |||
//var res = Recipes.ElementAt(i).RawMaterials.Where(p => p.RecipeStatus == 3).ToList(); | |||
//if (res != null && res.Count == Recipes.ElementAt(i).RawMaterials.Count)//配方所有配料完成下料 | |||
//{ | |||
// for (int r = 0; r < Recipes.ElementAt(i).RawMaterials.Count; r++) | |||
// { | |||
// DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(r).DeviceIp).StatusReset();//完成配料的设备运行状态地址写0 | |||
// App.Current.Dispatcher.Invoke(new Action(() => { recipeProcesses.Clear(); })); | |||
// } | |||
// Recipes.ElementAt(i).IsEnable = true; | |||
// Recipes.ElementAt(i).Are.Set(); | |||
//} | |||
} | |||
} | |||
Thread.Sleep(100); | |||
}), "RecipeControlViewModelStatusInquire"); | |||
//测试数据 | |||
/* RawMaterialModel rawMaterial_1 = new RawMaterialModel { RawMaterialName = "香料_1" }; | |||
RawMaterialModel rawMaterial_2 = new RawMaterialModel { RawMaterialName = "香料_2" }; | |||
RawMaterialModel rawMaterial_3 = new RawMaterialModel { RawMaterialName = "香料_3" }; | |||
RawMaterialModel rawMaterial_4 = new RawMaterialModel { RawMaterialName = "香料_4" }; | |||
ObservableCollection<RawMaterialModel> rawMaterials = new ObservableCollection<RawMaterialModel> { rawMaterial_1, rawMaterial_2, rawMaterial_3, rawMaterial_4 }; | |||
UserTreeCompelete.Add(new RecipeModel { RecipeName = "完成的香料1", RawMaterials = rawMaterials }); | |||
UserTreeCompelete.Add(new RecipeModel { RecipeName = "完成的香料2", RawMaterials = rawMaterials });*/ | |||
} | |||
public RelayCommand<object> StartCommand { get; set; } | |||
public RelayCommand<object> ChangeRecipeStateCommand { get; set; } | |||
public static ObservableCollection<RecipeModel> Recipes { get; set; } = Json<LocaPar>.Data.Recipes; | |||
public string CurrentRecipeName { get { return _RecipeName; }set { _RecipeName = value; OnPropertyChanged(); } } | |||
private static string _RecipeName; | |||
/// <summary> | |||
/// 当前正在制作的配方 | |||
/// </summary> | |||
public static ObservableCollection<RawMaterialModel> recipeProcesses { get; set; } = new ObservableCollection<RawMaterialModel>(); | |||
/// <summary> | |||
/// 等待制作的配方 | |||
/// </summary> | |||
public static ObservableCollection<RecipeModel> UserTreeWait { get; set; } = new ObservableCollection<RecipeModel>(); | |||
/// <summary> | |||
/// 已完成的配方 | |||
/// </summary> | |||
public static ObservableCollection<RecipeModel> UserTreeCompelete { get; set; } = new ObservableCollection<RecipeModel>(); | |||
private void ChangeRecipeState(object o) | |||
{ | |||
if (o == null) return; | |||
if(o is string id) | |||
{ | |||
var res = recipeProcesses.FirstOrDefault(p => p.RawMaterialId == id); | |||
if (res != null) | |||
{ | |||
if(res.RecipeStatus == 3) | |||
{ | |||
res.RecipeStatus = 1; | |||
}else | |||
{ | |||
res.RecipeStatus = 3; | |||
} | |||
} | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,54 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System.Collections.ObjectModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPASmartClient.Helper; | |||
using BPASmartClient.DosingHKProject.Model; | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
namespace BPASmartClient.DosingHKProject.ViewModel | |||
{ | |||
public class RecipeInfosViewModel : ObservableObject | |||
{ | |||
public RecipeInfosViewModel() | |||
{ | |||
ActionManage.GetInstance.CancelRegister("RecipeInfo"); | |||
ActionManage.GetInstance.Register(new Action<object>((o) => | |||
{ | |||
if (o != null && o is RemoteRecipeData rm) | |||
{ | |||
RecipeName = rm.RecipeName; | |||
RecipeCode = rm.RecipeCode; | |||
TrayCode = rm.TrayCode; | |||
foreach (var item in rm.RawMaterial) | |||
{ | |||
RawMaterialsInfo.Add(item); | |||
} | |||
} | |||
}), "RecipeInfo"); | |||
ReturnPage = new RelayCommand(() => | |||
{ | |||
ActionManage.GetInstance.Send("CloseRecipeInfosView"); | |||
}); | |||
} | |||
public string RecipeName { get { return _mRecipeName; } set { _mRecipeName = value; OnPropertyChanged(); } } | |||
private string _mRecipeName; | |||
public string RecipeCode { get { return _mRecipeCode; } set { _mRecipeCode = value; OnPropertyChanged(); } } | |||
private string _mRecipeCode; | |||
public int TrayCode { get { return _mTrayCode; } set { _mTrayCode = value; OnPropertyChanged(); } } | |||
private int _mTrayCode; | |||
public RelayCommand ReturnPage { get; set; } | |||
public ObservableCollection<RemoteRecipeRawMaterial> RawMaterialsInfo { get; set; } = new ObservableCollection<RemoteRecipeRawMaterial>(); | |||
} | |||
} |
@@ -0,0 +1,143 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System.Collections.Concurrent; | |||
using System.Collections.ObjectModel; | |||
using System.Windows; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPASmartClient.DosingHKProject.Model; | |||
using BPASmartClient.DosingHKProject.View; | |||
using BPASmartClient.CustomResource.UserControls; | |||
using BPASmartClient.CustomResource.UserControls.Model; | |||
using BPASmartClient.CustomResource.UserControls.Enum; | |||
using System.Windows.Media; | |||
using BPASmartClient.CustomResource.UserControls.MessageShow; | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
using BPASmartClient.DosingHKProject.Model.Siemens; | |||
using BPASmartClient.DosingHKProject.Model.GVL; | |||
using BPASmartClient.DosingProject; | |||
namespace BPASmartClient.DosingHKProject.ViewModel | |||
{ | |||
public class RecipeReceiveViewModel : ObservableObject | |||
{ | |||
//ObservableCollection<RemoteRecipeRawMaterial> RawMaterials { get; set; } = new ObservableCollection<RemoteRecipeRawMaterial>(); | |||
public RecipeReceiveViewModel() | |||
{ | |||
IsUseLocalRecipe = GVL_SmallStation.GetInstance.IsUseLocalRecipe; | |||
IsUseWindSendDosing = GVL_SmallStation.GetInstance.IsUseLocalRecipe; | |||
//Json<LocaPar>.Read(); | |||
Recipes = Json<LocalRecipeDataColl>.Data.Recipes; | |||
NewRecipe = new RelayCommand(() => | |||
{ | |||
NewLocalRecipeView NewLocalRecipe = new NewLocalRecipeView(); | |||
NewLocalRecipe.ShowDialog(); | |||
}); | |||
RemoveRecipe = new RelayCommand<object>((o) => | |||
{ | |||
if (o != null && o is string cnt) | |||
{ | |||
var res = Json<LocalRecipeDataColl>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == cnt); | |||
if (res != null) | |||
{ | |||
Json<LocalRecipeDataColl>.Data.Recipes.Remove(res); | |||
MessageLog.GetInstance.ShowUserLog($"删除配方——{res.RecipeName}"); | |||
} | |||
} | |||
}); | |||
DetailsCommand = new RelayCommand<object>((o) => | |||
{ | |||
if (o != null && o is string cnt) | |||
{ | |||
ActionManage.GetInstance.Send("CloseNewRemoteRecipeView"); | |||
NewLocalRecipeView nrv = new NewLocalRecipeView(); | |||
var res = Json<LocalRecipeDataColl>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == cnt); | |||
if (res != null) | |||
{ | |||
ActionManage.GetInstance.Send("LocalRecipeEdit", res); | |||
nrv.Show(); | |||
MessageLog.GetInstance.ShowUserLog($"编辑配方——{res.RecipeName}"); | |||
} | |||
} | |||
}); | |||
IssueRecipe = new RelayCommand<object>((o) => | |||
{ | |||
if (IsUseLocalRecipe == false) | |||
{ | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "错误", $"未处于本地模拟配方状态!"); | |||
return; | |||
} | |||
else | |||
{ | |||
if (o != null && o is string cnt) | |||
{ | |||
var res = Json<LocalRecipeDataColl>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == cnt); | |||
if (res != null) | |||
{ | |||
MessageLog.GetInstance.ShowUserLog($"下发配方——{res.RecipeName}"); | |||
} | |||
} | |||
} | |||
}); | |||
NewSimulateRecipe = new RelayCommand(() => | |||
{ | |||
ObservableCollection<RemoteRecipeRawMaterial> RawMaterials = new ObservableCollection<RemoteRecipeRawMaterial>(); | |||
string recipeName = "配方" + (Json<LocalRecipeDataColl>.Data.Recipes.Count + 1) + ""; | |||
go: | |||
string recipeCode = new Random().Next(1000, 9999).ToString(); | |||
foreach (var item in Json<LocalRecipeDataColl>.Data.Recipes) | |||
{ | |||
if (item.RecipeCode == recipeCode) | |||
{ | |||
goto go; | |||
} | |||
} | |||
int trayCode = new Random().Next(1, 3); | |||
for (int i = 1; i < 16; i++) | |||
{ | |||
RawMaterials.Add(new RemoteRecipeRawMaterial() | |||
{ | |||
RawMaterialName = "原料" + i, | |||
RawMaterialWeight = new Random().Next(200, 300), | |||
RawMaterialBarrelNum = (short)new Random().Next(1, 5), | |||
RawMaterialLocation = i, | |||
}); | |||
} | |||
var res = Array.FindIndex(Json<LocalRecipeDataColl>.Data.Recipes.ToArray(), p => p.RecipeCode == recipeCode); | |||
if (res < 0) | |||
{ | |||
Json<LocalRecipeDataColl>.Data.Recipes.Add(new RemoteRecipeData() | |||
{ | |||
RecipeName = recipeName, | |||
RecipeCode = recipeCode, | |||
TrayCode = trayCode, | |||
RawMaterial = RawMaterials, | |||
}); | |||
} | |||
}); | |||
ClearAllRecipe = new RelayCommand(() => | |||
{ | |||
Json<LocalRecipeDataColl>.Data.Recipes.Clear(); | |||
}); | |||
} | |||
public bool IsUseLocalRecipe { get { return _mIsUseLocalRecipe; }set { _mIsUseLocalRecipe = value; OnPropertyChanged(); } } | |||
private bool _mIsUseLocalRecipe = GVL_SmallStation.GetInstance.IsUseLocalRecipe; | |||
public bool IsUseWindSendDosing { get { return _mIsUseWindSendDosing; } set { _mIsUseWindSendDosing = value;OnPropertyChanged(); } } | |||
private bool _mIsUseWindSendDosing = GVL_SmallStation.GetInstance.IsUseLocalRecipe; | |||
public RelayCommand<object> DetailsCommand { get; set; } | |||
public RelayCommand<object> IssueRecipe { get; set; } | |||
public RelayCommand<object> RemoveRecipe { get; set; } | |||
public RelayCommand NewSimulateRecipe { get;set; } | |||
public RelayCommand ClearAllRecipe { get; set; } | |||
public RelayCommand NewRecipe { get; set; } | |||
public ObservableCollection<RemoteRecipeData> Recipes { get; set; } | |||
} | |||
} |
@@ -0,0 +1,87 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System.Collections.Concurrent; | |||
using System.Collections.ObjectModel; | |||
using System.Windows; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPASmartClient.DosingHKProject.Model; | |||
using BPASmartClient.DosingHKProject.View; | |||
using BPASmartClient.CustomResource.UserControls; | |||
using BPASmartClient.CustomResource.UserControls.Model; | |||
using BPASmartClient.CustomResource.UserControls.Enum; | |||
using System.Windows.Media; | |||
using BPASmartClient.CustomResource.UserControls.MessageShow; | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
using BPASmartClient.Model; | |||
using BPASmartClient.DosingProject; | |||
namespace BPASmartClient.DosingHKProject.ViewModel | |||
{ | |||
public class RecipeSettingsViewModel : ObservableObject | |||
{ | |||
public RecipeSettingsViewModel() | |||
{ | |||
Recipes = Json<LocaPar>.Data.Recipes; | |||
NewMaterital = new RelayCommand(() => | |||
{ | |||
NewMaterialView newMateritalView = new NewMaterialView(); | |||
newMateritalView.ShowDialog(); | |||
}); | |||
NewRecipe = new RelayCommand(() => | |||
{ | |||
NewRecipeView nrv = new NewRecipeView(); | |||
nrv.ShowDialog(); | |||
MessageLog.GetInstance.ShowUserLog("新建配方"); | |||
}); | |||
SaveRecipe = new RelayCommand(() => | |||
{ | |||
Json<LocaPar>.Save(); | |||
MessageLog.GetInstance.ShowUserLog("保存配方"); | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方保存成功!"); | |||
}); | |||
RemoveCommand = new RelayCommand<object>((o) => | |||
{ | |||
if (o is string str) | |||
{ | |||
var res = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipCode == str); | |||
if (res != null) Json<LocaPar>.Data.Recipes.Remove(res); | |||
MessageLog.GetInstance.ShowUserLog($"删除名称——{res.RecipeName}"); | |||
} | |||
}); | |||
DetailsCommand = new RelayCommand<object>((o) => | |||
{ | |||
if (o != null && o is string str) | |||
{ | |||
ActionManage.GetInstance.CancelRegister("Details"); | |||
NewRecipeView nrv = new NewRecipeView(); | |||
var res = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipCode == str); | |||
ActionManage.GetInstance.Send("Details", res); | |||
nrv.ShowDialog(); | |||
MessageLog.GetInstance.ShowUserLog($"编辑配方名称——{res.RecipeName}"); | |||
} | |||
}); | |||
} | |||
public RelayCommand NewMaterital { get; set; } | |||
public RelayCommand NewRecipe { get; set; } | |||
public RelayCommand SaveRecipe { get; set; } | |||
public RelayCommand<object> EditCommand { get; set; } | |||
public RelayCommand<object> DetailsCommand { get; set; } | |||
public RelayCommand<object> RemoveCommand { get; set; } | |||
public ObservableCollection<RecipeModel> Recipes { get; set; } | |||
} | |||
} |
@@ -0,0 +1,52 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System.Collections.Concurrent; | |||
using System.Collections.ObjectModel; | |||
using System.Windows; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPASmartClient.DosingHKProject.Model; | |||
using BPASmartClient.DosingHKProject.View; | |||
using BPASmartClient.CustomResource.UserControls; | |||
using BPASmartClient.CustomResource.UserControls.Model; | |||
using BPASmartClient.CustomResource.UserControls.Enum; | |||
using System.Windows.Media; | |||
using BPASmartClient.CustomResource.UserControls.MessageShow; | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
using BPASmartClient.DosingHKProject.Model.Siemens; | |||
using BPASmartClient.DosingHKProject.Model.GVL; | |||
namespace BPASmartClient.DosingHKProject.ViewModel | |||
{ | |||
public class SiemensRecipeReceiveViewModel : ObservableObject | |||
{ | |||
//ObservableCollection<RemoteRecipeRawMaterial> RawMaterials { get; set; } = new ObservableCollection<RemoteRecipeRawMaterial>(); | |||
public SiemensRecipeReceiveViewModel() | |||
{ | |||
Recipes = Json<RemoteRecipeDataColl>.Data.Recipes; | |||
DetailsCommand = new RelayCommand<object>((o) => | |||
{ | |||
if (o != null && o is string cnt) | |||
{ | |||
ActionManage.GetInstance.Send("CloseRecipeInfosView"); | |||
RecipeInfosView nrv = new RecipeInfosView(); | |||
var res = Json<RemoteRecipeDataColl>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == cnt); | |||
if (res != null) | |||
{ | |||
ActionManage.GetInstance.Send("RecipeInfo", res); | |||
nrv.Show(); | |||
MessageLog.GetInstance.ShowUserLog($"查看配方——{res.RecipeName}"); | |||
} | |||
} | |||
}); | |||
} | |||
public RelayCommand<object> DetailsCommand { get; set; } | |||
public RelayCommand ClearAllRecipe { get; set; } | |||
public ObservableCollection<RemoteRecipeData> Recipes { get; set; } | |||
} | |||
} |
@@ -3,5 +3,6 @@ | |||
<appSettings> | |||
<add key="HKPlc_IP" value="192.168.0.15"/> | |||
<add key="Siemens_IP" value="192.168.0.30"/> | |||
<add key="WindSend_IP" value="192.168.0.40"/> | |||
</appSettings> | |||
</configuration> |
@@ -13,6 +13,7 @@ using BPASmartClient.CustomResource.Pages.View; | |||
using BPASmartClient.CustomResource.Pages.ViewModel; | |||
using BPASmartClient.Helper; | |||
using BPASmartClient.JXJFoodSmallStation.Model.Siemens; | |||
using BPASmartClient.JXJFoodSmallStation.Model.WindSend; | |||
namespace BPASmartClient.JXJFoodSmallStation | |||
{ | |||
@@ -98,11 +99,18 @@ namespace BPASmartClient.JXJFoodSmallStation | |||
ObservableCollection<SubMenumodel> ParSet = new ObservableCollection<SubMenumodel>(); | |||
ParSet.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "原料参数设置", | |||
SubMenuName = "柔性味魔方参数设置", | |||
SubMenuPermission = new Permission[] { Permission.管理员 }, | |||
AssemblyName = "BPASmartClient.JXJFoodSmallStation", | |||
ToggleWindowPath = "View.DeviceMaterialParView" | |||
}); | |||
ParSet.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "粉仓参数设置", | |||
SubMenuPermission = new Permission[] { Permission.管理员 }, | |||
AssemblyName = "BPASmartClient.JXJFoodSmallStation", | |||
ToggleWindowPath = "View.WindSendParView" | |||
}); | |||
MenuManage.GetInstance.menuModels.Add(new MenuModel() | |||
{ | |||
MainMenuIcon = "", | |||
@@ -249,6 +257,7 @@ namespace BPASmartClient.JXJFoodSmallStation | |||
//Config.GetInstance.Init(); | |||
Json<LocaPar>.Read(); | |||
Json<DevicePar>.Read(); | |||
Json<WindSendDevicePar>.Read(); | |||
} | |||
} | |||
@@ -21,7 +21,7 @@ | |||
<ItemGroup> | |||
<Page Update="View\ChangeDeviceNameView.xaml"> | |||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | |||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | |||
</Page> | |||
<Page Update="View\DeviceListView.xaml"> | |||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | |||
@@ -8,6 +8,5 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.GVL | |||
{ | |||
public class GVL | |||
{ | |||
public static bool IsUseLocalRecipe { get; set; } | |||
} | |||
} |
@@ -11,6 +11,13 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
{ | |||
public class GVL_SmallStation | |||
{ | |||
private volatile static GVL_SmallStation SmallStation; | |||
public static GVL_SmallStation GetInstance => SmallStation ?? (SmallStation = new GVL_SmallStation()); | |||
private GVL_SmallStation() { } | |||
/// <summary> | |||
/// 是否允许西门子下发配方 | |||
/// </summary> | |||
public bool IsAllowSiemensSendRecipe; | |||
/// <summary> | |||
/// 往输送带下发配方完成 | |||
@@ -60,10 +67,34 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
/// </summary> | |||
public int AgvPickUpPosition { get; set; } = 0; | |||
/// <summary> | |||
/// 是否使用粉仓 | |||
/// </summary> | |||
public bool IsUseWindSend; | |||
/// <summary> | |||
/// 风送配料完成标志 | |||
/// </summary> | |||
public bool WindSendDosingFinish; | |||
/// <summary> | |||
/// 是否占用托盘1 | |||
/// </summary> | |||
public bool IsOccupationTray1 { get; set; } = true; | |||
/// <summary> | |||
/// 是否占用托盘2 | |||
/// </summary> | |||
public bool IsOccupationTray2 { get; set; } = true; | |||
#region AGV进出站 从HK PLC读取 | |||
public bool Agv { get; set; } = false; | |||
#region 本地模拟配方 | |||
/// <summary> | |||
/// 是否使用本地模拟配方 | |||
/// </summary> | |||
public bool IsUseLocalRecipe { get; set; } | |||
/// <summary> | |||
/// 是否使用本地模拟订单+风送配方 | |||
/// </summary> | |||
public bool IsUseWindSendDosing { get; set; } | |||
#endregion | |||
} | |||
} |
@@ -2,6 +2,7 @@ | |||
using BPASmartClient.Helper; | |||
using BPASmartClient.JXJFoodSmallStation.Model.HK_PLC; | |||
using BPASmartClient.JXJFoodSmallStation.Model.Siemens; | |||
using BPASmartClient.JXJFoodSmallStation.Model.WindSend; | |||
using BPASmartClient.Modbus; | |||
using System; | |||
using System.Collections.Concurrent; | |||
@@ -37,8 +38,9 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
public SiemensDeviceStatus SiemensDevice = new SiemensDeviceStatus(); | |||
public HKDeviceStatus HKDevice = new HKDeviceStatus(); | |||
GVL_SmallStation SmallStation = new GVL_SmallStation(); | |||
public WindSendDeviceStatus WindSendDevice = new WindSendDeviceStatus(); | |||
XL_Finish_DB RecipeFinishInfo = new XL_Finish_DB(); | |||
XL_WindSendData_DB WindSendData = new XL_WindSendData_DB(); | |||
/// <summary> | |||
/// 接收原料数据 | |||
/// </summary> | |||
@@ -91,21 +93,42 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
} | |||
} | |||
}), "SiemensRecipeRecive", true); | |||
ActionManage.GetInstance.CancelRegister("WindSendDosingFinish"); | |||
ActionManage.GetInstance.Register(new Action(() => | |||
{ | |||
GVL_SmallStation.GetInstance.WindSendDosingFinish = true; | |||
}),"WindSendDosingFinish",true); | |||
ActionManage.GetInstance.CancelRegister("LocalSimulationRecipeIssue"); | |||
ActionManage.GetInstance.Register(new Action<Object>((res) => | |||
{ | |||
if (res!=null && res is RemoteRecipeData recipe) | |||
{ | |||
Json<RemoteRecipeDataColl>.Data.Recipes.Add(recipe); | |||
} | |||
}), "LocalSimulationRecipeIssue", true); | |||
string HK_PLC_IP = ConfigurationManager.AppSettings["HKPlc_IP"]; | |||
string Siemens_PLC_IP = ConfigurationManager.AppSettings["Siemens_IP"]; | |||
string WindSend_PLC_IP = ConfigurationManager.AppSettings["WindSend_IP"]; | |||
try | |||
{ | |||
//HKDevice.HK_PLC_S7.Connect(S7.Net.CpuType.S71200, HK_PLC_IP); | |||
//SiemensDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71500, Siemens_PLC_IP); | |||
//WindSendDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71200,WindSend_PLC_IP); | |||
if (HKDevice.IsConnected) | |||
{ | |||
HKDevice.Init(); | |||
MessageLog.GetInstance.ShowUserLog("海科plc初始化完成"); | |||
MessageLog.GetInstance.ShowUserLog("海科plc连接成功,并初始化完成"); | |||
} | |||
if (SiemensDevice.IsConnected) | |||
{ | |||
SiemensDevice.Init(); | |||
MessageLog.GetInstance.ShowUserLog(""); | |||
MessageLog.GetInstance.ShowUserLog("西门子plc连接成功,并初始化完成"); | |||
} | |||
if (WindSendDevice.IsConnected) | |||
{ | |||
WindSendDevice.Init(); | |||
MessageLog.GetInstance.ShowUserLog("风送plc连接成功,并初始化完成"); | |||
} | |||
} | |||
catch(Exception ex) | |||
@@ -119,7 +142,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
ReceviceData(); | |||
RecipeInfoToHKPLC(); | |||
Thread.Sleep(10); | |||
}), "流程处理", true); | |||
}), "西门子配发下发流程处理", true); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
if (SiemensDevice.IsConnected && HKDevice.IsConnected) | |||
@@ -459,47 +482,47 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
/// </summary> | |||
private void AgvGetInDelivery() | |||
{ | |||
switch (SmallStation.AgvDeliveryPosition) | |||
switch (GVL_SmallStation.GetInstance.AgvDeliveryPosition) | |||
{ | |||
case 0: | |||
if (RTrig.GetInstance("").Start(SiemensDevice.Siemens_PLC_S7.Read<object>(SiemensCommAddress.DeliveryAGVApply) is bool)) | |||
{ | |||
SmallStation.AgvDeliveryPosition = 1; | |||
GVL_SmallStation.GetInstance.AgvDeliveryPosition = 1; | |||
HKDevice.HK_PLC_S7.Write(HKPlcCommAddress.DeliveryAGVApply, true); | |||
} | |||
break; | |||
case 1: | |||
if (RTrig.GetInstance("").Start(HKDevice.HK_PLC_S7.Read<bool>(HKPlcCommAddress.DeliveryAGVIsApply))) | |||
{ | |||
SmallStation.AgvDeliveryPosition = 2; | |||
GVL_SmallStation.GetInstance.AgvDeliveryPosition = 2; | |||
SiemensDevice.Siemens_PLC_S7.Write(SiemensCommAddress.DeliveryAGVIsApply, true); | |||
} | |||
break; | |||
case 2: | |||
if (RTrig.GetInstance("").Start(SiemensDevice.Siemens_PLC_S7.Read<object>(SiemensCommAddress.DeliveryAGVApplyJack) is bool)) | |||
{ | |||
SmallStation.AgvDeliveryPosition = 3; | |||
GVL_SmallStation.GetInstance.AgvDeliveryPosition = 3; | |||
HKDevice.HK_PLC_S7.Write(HKPlcCommAddress.DeliveryAGVApplyJack, true); | |||
} | |||
break; | |||
case 3: | |||
if (RTrig.GetInstance("").Start(HKDevice.HK_PLC_S7.Read<bool>(HKPlcCommAddress.DeliveryAGVIsApplyJack))) | |||
{ | |||
SmallStation.AgvDeliveryPosition = 4; | |||
GVL_SmallStation.GetInstance.AgvDeliveryPosition = 4; | |||
SiemensDevice.Siemens_PLC_S7.Write(SiemensCommAddress.DeliveryAGVIsApplyJack, true); | |||
} | |||
break; | |||
case 4: | |||
if (RTrig.GetInstance("").Start(SiemensDevice.Siemens_PLC_S7.Read<object>(SiemensCommAddress.DeliveryAGVFinsih) is bool)) | |||
{ | |||
SmallStation.AgvDeliveryPosition = 5; | |||
GVL_SmallStation.GetInstance.AgvDeliveryPosition = 5; | |||
HKDevice.HK_PLC_S7.Write(HKPlcCommAddress.DeliveryAGVFinsih, true); | |||
} | |||
break; | |||
case 5: | |||
if (RTrig.GetInstance("").Start(HKDevice.HK_PLC_S7.Read<bool>(HKPlcCommAddress.StationHaveCargo))) | |||
{ | |||
SmallStation.AgvDeliveryPosition = 0; | |||
GVL_SmallStation.GetInstance.AgvDeliveryPosition = 0; | |||
SiemensDevice.Siemens_PLC_S7.Write(SiemensCommAddress.StationHaveCargo, true); | |||
} | |||
break; | |||
@@ -515,33 +538,33 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
/// </summary> | |||
private void AgvGetInPickUp() | |||
{ | |||
switch (SmallStation.AgvPickUpPosition) | |||
switch (GVL_SmallStation.GetInstance.AgvPickUpPosition) | |||
{ | |||
case 0: | |||
if (RTrig.GetInstance("").Start(SiemensDevice.Siemens_PLC_S7.Read<bool>(SiemensCommAddress.PickAGVApply))) | |||
{ | |||
SmallStation.AgvPickUpPosition = 1; | |||
GVL_SmallStation.GetInstance.AgvPickUpPosition = 1; | |||
HKDevice.HK_PLC_S7.Write(HKPlcCommAddress.PickAGVApply, true); | |||
} | |||
break; | |||
case 1: | |||
if (RTrig.GetInstance("").Start(HKDevice.HK_PLC_S7.Read<bool>(HKPlcCommAddress.PickAGVIsApply))) | |||
{ | |||
SmallStation.AgvPickUpPosition = 2; | |||
GVL_SmallStation.GetInstance.AgvPickUpPosition = 2; | |||
SiemensDevice.Siemens_PLC_S7.Write(SiemensCommAddress.PickAGVIsApply, true); | |||
} | |||
break; | |||
case 2: | |||
if (RTrig.GetInstance("").Start(SiemensDevice.Siemens_PLC_S7.Read<object>(SiemensCommAddress.PickCargoAGVFinish) is bool)) | |||
if (RTrig.GetInstance("").Start(SiemensDevice.Siemens_PLC_S7.Read<bool>(SiemensCommAddress.PickCargoAGVFinish))) | |||
{ | |||
SmallStation.AgvPickUpPosition = 3; | |||
GVL_SmallStation.GetInstance.AgvPickUpPosition = 3; | |||
HKDevice.HK_PLC_S7.Write(HKPlcCommAddress.PickCargoAGVFinish, true); | |||
} | |||
break; | |||
case 3: | |||
if (RTrig.GetInstance("").Start(HKDevice.HK_PLC_S7.Read<bool>(HKPlcCommAddress.PickAGVFinish))) | |||
{ | |||
SmallStation.AgvPickUpPosition = 0; | |||
GVL_SmallStation.GetInstance.AgvPickUpPosition = 0; | |||
SiemensDevice.Siemens_PLC_S7.Write(SiemensCommAddress.PickAGVFinish, true); | |||
} | |||
break; | |||
@@ -579,8 +602,8 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
{ | |||
RecipeQueue.Clear(); | |||
RecipeQueueTray2.Clear(); | |||
SmallStation.RecipeStatusID = 0; | |||
SmallStation.RecipeStatusIDTray2 = 0; | |||
GVL_SmallStation.GetInstance.RecipeStatusID = 0; | |||
GVL_SmallStation.GetInstance.RecipeStatusIDTray2 = 0; | |||
} | |||
} | |||
/// <summary> | |||
@@ -596,32 +619,59 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
string code = RemoteRecipes.ElementAt(index).RecipeCode; | |||
int trayCode = RemoteRecipes.ElementAt(index).TrayCode; | |||
string recipeName = RemoteRecipes.ElementAt(index).RecipeName; | |||
string windSend = RemoteRecipes.ElementAt(index).ToString(); | |||
if (trayCode == 1) | |||
{ | |||
if (SmallStation.RecipeStatusID == 0) | |||
if (GVL_SmallStation.GetInstance.RecipeStatusID == 0) | |||
{ | |||
if (GVL_SmallStation.GetInstance.IsUseWindSend) | |||
{ | |||
GVL_SmallStation.GetInstance.IsUseWindSend = false; | |||
WindSendData.TargetRecipeCode = code; | |||
if (RemoteRecipes.ElementAt(index).WindSendRawMaterial.ElementAt(0).RawMaterialName == DeviceName.原料1.ToString()) | |||
{ | |||
WindSendData.RawMaterial1_SetWeight = RemoteRecipes.ElementAt(index).WindSendRawMaterial.ElementAt(0).RawMaterialWeight; | |||
} | |||
if (RemoteRecipes.ElementAt(index).WindSendRawMaterial.ElementAt(1).RawMaterialName == DeviceName.原料2.ToString()) | |||
{ | |||
WindSendData.RawMaterial2_SetWeight = RemoteRecipes.ElementAt(index).WindSendRawMaterial.ElementAt(1).RawMaterialWeight; | |||
} | |||
if (RemoteRecipes.ElementAt(index).WindSendRawMaterial.ElementAt(2).RawMaterialName == DeviceName.原料3.ToString()) | |||
{ | |||
WindSendData.RawMaterial3_SetWeight = RemoteRecipes.ElementAt(index).WindSendRawMaterial.ElementAt(2).RawMaterialWeight; | |||
} | |||
if (RemoteRecipes.ElementAt(index).WindSendRawMaterial.ElementAt(3).RawMaterialName == DeviceName.原料4.ToString()) | |||
{ | |||
WindSendData.RawMaterial4_SetWeight = RemoteRecipes.ElementAt(index).WindSendRawMaterial.ElementAt(3).RawMaterialWeight; | |||
} | |||
if (RemoteRecipes.ElementAt(index).WindSendRawMaterial.ElementAt(4).RawMaterialName == DeviceName.原料5.ToString()) | |||
{ | |||
WindSendData.RawMaterial5_SetWeight = RemoteRecipes.ElementAt(index).WindSendRawMaterial.ElementAt(4).RawMaterialWeight; | |||
} | |||
WindSendDevice.Siemens_PLC_S7.WriteClass<XL_WindSendData_DB>(WindSendData, 5); | |||
} | |||
foreach (var item in RemoteRecipes.ElementAt(index).RawMaterial) | |||
{ | |||
HKDevice.StockBinPar((uint)item.RawMaterialBarrelNum, (ushort)item.RawMaterialLocation); | |||
} | |||
HKDevice.HK_PLC_S7.Write("DB4.DBX1.3", true); | |||
SmallStation.RecipeStatusID = 1; | |||
GVL_SmallStation.GetInstance.RecipeStatusID = 1; | |||
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},下发完成"); | |||
HKDevice.HK_PLC_S7.Write("DB3.DBX1.3", true); | |||
} | |||
if (HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX1.3") && SmallStation.RecipeStatusID == 1) | |||
if (HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX1.3") && GVL_SmallStation.GetInstance.RecipeStatusID == 1) | |||
{ | |||
HKDevice.HK_PLC_S7.Write("DB3.DBX1.3", false); | |||
SmallStation.RecipeStatusID = 2; | |||
GVL_SmallStation.GetInstance.RecipeStatusID = 2; | |||
MessageLog.GetInstance.ShowRunLog($"托盘1,{ recipeName}plc端 配方接收完成"); | |||
} | |||
if (SmallStation.RecipeStatusID == 2) | |||
if (GVL_SmallStation.GetInstance.RecipeStatusID == 2) | |||
{ | |||
if (RTrig.GetInstance("DB3.DBX50.0").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.0"))) | |||
{ | |||
var res = HKDevice.HK_PLC_S7.Read<float>("DB3.DBD10"); | |||
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},1号桶,{res}料仓,允许配料"); | |||
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},1号桶,{res}料仓,允许配料"); | |||
if (res > 0 && res is float loc) | |||
{ | |||
//int decimalNum = Convert.ToInt32(loc.ToString().Substring(loc.ToString().IndexOf(".") + 1)); | |||
@@ -630,17 +680,17 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
if (loc_index >= 0) | |||
{ | |||
DeviceInquire.GetInstance.GetDevice((int)loc)?.Start(weight);//根据料仓编号 启动并写入每个原料重量 | |||
SmallStation.StockInIsWork = (int)loc; | |||
GVL_SmallStation.GetInstance.StockInIsWork = (int)loc; | |||
//HKDevice.HK_PLC_S7.Write("DB3.DBX50.0", false); | |||
} | |||
SmallStation.DosingTray1 = true; | |||
GVL_SmallStation.GetInstance.DosingTray1 = true; | |||
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},1号桶,{(int)loc}号仓,配料完成"); | |||
} | |||
} | |||
else if(RTrig.GetInstance("DB3.DBX50.1").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.1"))) | |||
{ | |||
var res = HKDevice.HK_PLC_S7.Read<float>("DB3.DBD14"); | |||
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},2号桶,{res}料仓,允许配料"); | |||
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},2号桶,{res}料仓,允许配料"); | |||
if (res > 0 && res is float loc) | |||
{ | |||
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc); | |||
@@ -648,17 +698,17 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
if (loc_index >= 0) | |||
{ | |||
DeviceInquire.GetInstance.GetDevice((int)loc)?.Start(weight);//启动并写入每个原料重量 | |||
SmallStation.StockInIsWork = (int)loc; | |||
GVL_SmallStation.GetInstance.StockInIsWork = (int)loc; | |||
//HKDevice.HK_PLC_S7.Write("DB3.DBX50.1", false); | |||
} | |||
SmallStation.DosingTray1 = true; | |||
GVL_SmallStation.GetInstance.DosingTray1 = true; | |||
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},2号桶,{(int)loc}号仓,配料完成"); | |||
} | |||
} | |||
else if (RTrig.GetInstance("DB3.DBX50.2").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.2"))) | |||
{ | |||
var res = HKDevice.HK_PLC_S7.Read<float>("DB3.DBD18"); | |||
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},3号桶,{res}料仓,允许配料"); | |||
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},3号桶,{res}料仓,允许配料"); | |||
if (res > 0 && res is float loc) | |||
{ | |||
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc); | |||
@@ -666,17 +716,17 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
if (loc_index >= 0) | |||
{ | |||
DeviceInquire.GetInstance.GetDevice((int)loc)?.Start(weight);//启动并写入每个原料重量 | |||
SmallStation.StockInIsWork = (int)loc; | |||
GVL_SmallStation.GetInstance.StockInIsWork = (int)loc; | |||
//HKDevice.HK_PLC_S7.Write("DB3.DBX50.2", false); | |||
} | |||
SmallStation.DosingTray1 = true; | |||
GVL_SmallStation.GetInstance.DosingTray1 = true; | |||
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},3号桶,{(int)loc}号仓,配料完成"); | |||
} | |||
} | |||
else if (RTrig.GetInstance("DB3.DBX50.3").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.3"))) | |||
{ | |||
var res = HKDevice.HK_PLC_S7.Read<float>("DB3.DBD22"); | |||
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},4号桶,{res}料仓,允许配料"); | |||
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},4号桶,{res}料仓,允许配料"); | |||
if (res > 0 && res is float loc) | |||
{ | |||
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc); | |||
@@ -684,17 +734,18 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
if (loc_index >= 0) | |||
{ | |||
DeviceInquire.GetInstance.GetDevice((int)loc)?.Start(weight);//启动并写入每个原料重量 | |||
SmallStation.StockInIsWork = (int)loc; | |||
GVL_SmallStation.GetInstance.StockInIsWork = (int)loc; | |||
//HKDevice.HK_PLC_S7.Write("DB3.DBX50.3", false); | |||
} | |||
SmallStation.DosingTray1 = true; | |||
GVL_SmallStation.GetInstance.DosingTray1 = true; | |||
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},4号桶,{(int)loc}号仓,配料完成"); | |||
} | |||
} | |||
if (SmallStation.DosingTray1) { | |||
if (GVL_SmallStation.GetInstance.DosingTray1) | |||
{ | |||
for (int i = 1; i < 16; i++) | |||
{ | |||
if (RTrig.GetInstance("柔性味魔方配料完成").Start(DeviceInquire.GetInstance.GetDevice(i).deviceStatus.RunStatus == 3)) | |||
if (RTrig.GetInstance("GetDeviceRunStatus").Start(DeviceInquire.GetInstance.GetDevice(i).deviceStatus.RunStatus == 3)) | |||
{ | |||
MessageLog.GetInstance.ShowRunLog($"柔性味魔方,托盘1,配方:{recipeName},{i}号仓,配料完成"); | |||
int res = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == i); | |||
@@ -708,11 +759,11 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
{ | |||
HKDevice.HK_PLC_S7.Write("DB4.DBX31." + (i - 9), true); | |||
} | |||
SmallStation.DosingTray1 = false; | |||
GVL_SmallStation.GetInstance.DosingTray1 = false; | |||
} | |||
} | |||
} | |||
if (RTrig.GetInstance("配方配料完成").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX1.1"))) | |||
if (RTrig.GetInstance("配方配料完成").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX1.1")) && (GVL_SmallStation.GetInstance.WindSendDosingFinish || !GVL_SmallStation.GetInstance.IsUseWindSend)) | |||
{ | |||
var res = Json<RemoteRecipeDataColl>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == code); | |||
MessageLog.GetInstance.ShowRunLog($"托盘1,配方{res.RecipeName},配料完成"); | |||
@@ -727,16 +778,16 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
} | |||
if (SiemensDevice.IsConnected) | |||
{ | |||
RecipeFinishInfo.Ask_For_Finish = true; | |||
SiemensDevice.Siemens_PLC_S7.WriteClass<XL_Finish_DB>(RecipeFinishInfo, 3); | |||
} | |||
RecipeFinishInfo.Ask_For_Finish = true; | |||
App.Current.Dispatcher.Invoke(() => | |||
{ | |||
Json<RemoteRecipeDataColl>.Data.Recipes.Remove(res); | |||
}); | |||
RecipeQueue.TryDequeue(out code); | |||
HKDevice.HK_PLC_S7.Write("DB3.DBX1.1", false); | |||
SmallStation.RecipeStatusID = 0; | |||
GVL_SmallStation.GetInstance.RecipeStatusID = 0; | |||
} | |||
} | |||
} | |||
@@ -752,7 +803,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
string recipeName = RemoteRecipes.ElementAt(index).RecipeName; | |||
if (trayCode == 2) | |||
{ | |||
if (SmallStation.RecipeStatusIDTray2 == 0) | |||
if (GVL_SmallStation.GetInstance.RecipeStatusIDTray2 == 0) | |||
{ | |||
MessageLog.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},初始化"); | |||
foreach (var item in RemoteRecipes.ElementAt(index).RawMaterial) | |||
@@ -760,18 +811,18 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
HKDevice.StockBinPar((uint)item.RawMaterialBarrelNum, (ushort)item.RawMaterialLocation, 2); | |||
} | |||
HKDevice.HK_PLC_S7.Write("DB4.DBX1.4", true); | |||
SmallStation.RecipeStatusIDTray2 = 1; | |||
GVL_SmallStation.GetInstance.RecipeStatusIDTray2 = 1; | |||
MessageLog.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},下发完成"); | |||
HKDevice.HK_PLC_S7.Write("DB3.DBX1.4", true); | |||
} | |||
if (HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX1.4") && SmallStation.RecipeStatusIDTray2 == 1) | |||
if (HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX1.4") && GVL_SmallStation.GetInstance.RecipeStatusIDTray2 == 1) | |||
{ | |||
HKDevice.HK_PLC_S7.Write("DB3.DBX1.4", false); | |||
SmallStation.RecipeStatusIDTray2 = 2; | |||
GVL_SmallStation.GetInstance.RecipeStatusIDTray2 = 2; | |||
MessageLog.GetInstance.ShowRunLog($"配方:{recipeName},plc端 配方接收完成"); | |||
} | |||
if (SmallStation.RecipeStatusIDTray2 == 2) | |||
if (GVL_SmallStation.GetInstance.RecipeStatusIDTray2 == 2) | |||
{ | |||
if (RTrig.GetInstance("DB3.DBX50.4").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.4"))) | |||
{ | |||
@@ -785,10 +836,10 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
if (loc_index >= 0) | |||
{ | |||
DeviceInquire.GetInstance.GetDevice((int)loc)?.Start((uint)weight);//根据料仓编号 启动并写入每个原料重量 | |||
SmallStation.StockInIsWork = (int)loc; | |||
GVL_SmallStation.GetInstance.StockInIsWork = (int)loc; | |||
//HKDevice.HK_PLC_S7.Write("DB3.DBX50.0", false); | |||
} | |||
SmallStation.DosingTray2 = true; | |||
GVL_SmallStation.GetInstance.DosingTray2 = true; | |||
MessageLog.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},1号桶,{(int)loc}号仓,配料完成"); | |||
} | |||
} | |||
@@ -803,10 +854,10 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
if (loc_index >= 0) | |||
{ | |||
DeviceInquire.GetInstance.GetDevice((int)loc)?.Start((uint)weight);//启动并写入每个原料重量 | |||
SmallStation.StockInIsWork = (int)loc; | |||
GVL_SmallStation.GetInstance.StockInIsWork = (int)loc; | |||
//HKDevice.HK_PLC_S7.Write("DB3.DBX50.5", false); | |||
} | |||
SmallStation.DosingTray2 = true; | |||
GVL_SmallStation.GetInstance.DosingTray2 = true; | |||
MessageLog.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},2号桶,{(int)loc}号仓,配料完成"); | |||
} | |||
} | |||
@@ -821,10 +872,10 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
if (loc_index >= 0) | |||
{ | |||
DeviceInquire.GetInstance.GetDevice((int)loc)?.Start((uint)weight);//启动并写入每个原料重量 | |||
SmallStation.StockInIsWork = (int)loc; | |||
GVL_SmallStation.GetInstance.StockInIsWork = (int)loc; | |||
//HKDevice.HK_PLC_S7.Write("DB3.DBX50.6", false); | |||
} | |||
SmallStation.DosingTray2 = true; | |||
GVL_SmallStation.GetInstance.DosingTray2 = true; | |||
MessageLog.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},3号桶,{(int)loc}号仓,配料完成"); | |||
} | |||
@@ -840,14 +891,14 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
if (loc_index >= 0) | |||
{ | |||
DeviceInquire.GetInstance.GetDevice((int)loc)?.Start((uint)weight);//启动并写入每个原料重量 | |||
SmallStation.StockInIsWork = (int)loc; | |||
GVL_SmallStation.GetInstance.StockInIsWork = (int)loc; | |||
//HKDevice.HK_PLC_S7.Write("DB3.DBX50.7", false); | |||
} | |||
SmallStation.DosingTray2 = true; | |||
GVL_SmallStation.GetInstance.DosingTray2 = true; | |||
MessageLog.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},4号桶,{(int)loc}号仓,配料完成"); | |||
} | |||
} | |||
if (SmallStation.DosingTray2 == true) | |||
if (GVL_SmallStation.GetInstance.DosingTray2 == true) | |||
{ | |||
for (int i = 1; i < 16; i++) | |||
{ | |||
@@ -865,7 +916,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
{ | |||
HKDevice.HK_PLC_S7.Write("DB4.DBX31." + (i - 9), true); | |||
} | |||
SmallStation.DosingTray2 = false; | |||
GVL_SmallStation.GetInstance.DosingTray2 = false; | |||
} | |||
} | |||
} | |||
@@ -882,9 +933,9 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
RecipeFinishInfo.Material[i].Material_BarrelNum = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum; | |||
RecipeFinishInfo.Material[i].Material_Laying_Off_Weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight; | |||
} | |||
RecipeFinishInfo.Ask_For_Finish = true; | |||
if (SiemensDevice.IsConnected) | |||
{ | |||
RecipeFinishInfo.Ask_For_Finish = true; | |||
SiemensDevice.Siemens_PLC_S7.WriteClass<XL_Finish_DB>(RecipeFinishInfo, 3); | |||
} | |||
App.Current.Dispatcher.Invoke(() => | |||
@@ -893,7 +944,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
}); | |||
RecipeQueueTray2.TryDequeue(out code); | |||
HKDevice.HK_PLC_S7.Write("DB3.DBX1.2", false); | |||
SmallStation.RecipeStatusIDTray2 = 0; | |||
GVL_SmallStation.GetInstance.RecipeStatusIDTray2 = 0; | |||
} | |||
} | |||
} | |||
@@ -96,6 +96,9 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
} | |||
public void Init() | |||
{ | |||
AlarmHelper<AlarmInfo>.Init(); | |||
AlarmHelper<AlarmInfo>.Alarm.EStop1 = true; | |||
//TestData(); | |||
IpAddressLines(); | |||
DeviceDataInit(); | |||
@@ -290,6 +293,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
{ | |||
this.DeviceName = DeviceName; | |||
AlarmHelper<AlarmInfo>.Init(); | |||
AlarmHelper<AlarmInfo>.Alarm.EStop1 = true; | |||
if (modbusTcp.Connected) | |||
{ | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
@@ -306,13 +310,13 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
deviceStatus.DeviceNum = (ushort)this.modbusTcp.ReadShort(DeviceAddress.DeviceNum);//获取设备编号 | |||
deviceStatus.DeviceAlarmCode = (ushort)this.modbusTcp.ReadShort(DeviceAddress.DeviceAlarmCode);//获取设备故障编码 | |||
AlarmHelper<AlarmInfo>.Alarm.EStop1 = deviceStatus.DeviceAlarmCode.Get16bitValue(1); | |||
//AlarmHelper<AlarmInfo>.Alarm.EStop1 = deviceStatus.DeviceAlarmCode.Get16bitValue(1); | |||
AlarmHelper<AlarmInfo>.Alarm.Servo = deviceStatus.DeviceAlarmCode.Get16bitValue(2); | |||
AlarmHelper<AlarmInfo>.Alarm.Inverter = deviceStatus.DeviceAlarmCode.Get16bitValue(3); | |||
AlarmHelper<AlarmInfo>.Alarm.EStop2 = deviceStatus.DeviceAlarmCode.Get16bitValue(7); | |||
AlarmHelper<AlarmInfo>.Alarm.SiloUpperLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(8); | |||
AlarmHelper<AlarmInfo>.Alarm.SiloLowerLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(9); | |||
AlarmHelper<AlarmInfo>.Alarm.EStop1 = true; | |||
Thread.Sleep(10); | |||
}), $"{DeviceName} 开始监听", true); | |||
} | |||
@@ -10,6 +10,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
{ | |||
public class DevicePar | |||
{ | |||
public ObservableCollection<DeviceParModel> deviceParModels { get; set; } = new ObservableCollection<DeviceParModel>(); | |||
public ObservableCollection<DeviceParMode> deviceParModels { get; set; } = new ObservableCollection<DeviceParMode>(); | |||
} | |||
} |
@@ -7,8 +7,9 @@ using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
namespace BPASmartClient.JXJFoodSmallStation.Model | |||
{ | |||
public class DeviceParModel : ObservableObject | |||
public class DeviceParMode : ObservableObject | |||
{ | |||
/// <summary> | |||
/// 原料名称 | |||
/// </summary> | |||
@@ -70,6 +71,5 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
public bool IsRedundant { get { return _mIsRedundant; } set { _mIsRedundant = value; OnPropertyChanged(); } } | |||
private bool _mIsRedundant; | |||
} | |||
} |
@@ -1,4 +1,5 @@ | |||
using System; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
@@ -7,24 +8,24 @@ using System.Threading.Tasks; | |||
namespace BPASmartClient.JXJFoodSmallStation.Model | |||
{ | |||
public class RemoteRecipeData | |||
public class RemoteRecipeData:ObservableObject | |||
{ | |||
/// <summary> | |||
/// 配方名称 | |||
/// </summary> | |||
public string RecipeName { get { return _mRecipeName; } set { _mRecipeName = value; } } | |||
public string RecipeName { get { return _mRecipeName; } set { _mRecipeName = value; OnPropertyChanged(); } } | |||
private string _mRecipeName; | |||
/// <summary> | |||
/// 配方ID | |||
/// </summary> | |||
public string RecipeCode { get { return _mRecipeCode; } set { _mRecipeCode = value; } } | |||
public string RecipeCode { get { return _mRecipeCode; } set { _mRecipeCode = value;OnPropertyChanged(); } } | |||
private string _mRecipeCode; | |||
/// <summary> | |||
/// 托盘编号 | |||
/// </summary> | |||
public int TrayCode { get { return _mTrayCode; } set { _mTrayCode = value; } } | |||
public int TrayCode { get { return _mTrayCode; } set { _mTrayCode = value; OnPropertyChanged(); } } | |||
private int _mTrayCode; | |||
/// <summary> | |||
@@ -32,6 +33,10 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
/// </summary> | |||
public ObservableCollection<RemoteRecipeRawMaterial> RawMaterial { get; set; } = new ObservableCollection<RemoteRecipeRawMaterial>(); | |||
/// <summary> | |||
/// 粉料仓的原料数据 | |||
/// </summary> | |||
public ObservableCollection<WindSendRawMaterial> WindSendRawMaterial { get; set; } = new ObservableCollection<WindSendRawMaterial>(); | |||
} | |||
} |
@@ -1,4 +1,5 @@ | |||
using System; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
@@ -6,24 +7,24 @@ using System.Threading.Tasks; | |||
namespace BPASmartClient.JXJFoodSmallStation.Model | |||
{ | |||
public class RemoteRecipeRawMaterial | |||
public class RemoteRecipeRawMaterial:ObservableObject | |||
{ | |||
public int DeviceIp { get { return _mIp; } set { _mIp = value; }} | |||
private int _mIp; | |||
public string RawMaterialName { get { return _mRawMaterialName; } set { _mRawMaterialName = value; } } | |||
public string RawMaterialName { get { return _mRawMaterialName; } set { _mRawMaterialName = value; OnPropertyChanged(); } } | |||
private string _mRawMaterialName; | |||
/// <summary> | |||
/// 原料对应的桶号 | |||
/// </summary> | |||
public short RawMaterialBarrelNum { get { return _mRawMaterialBarrelNum; } set { _mRawMaterialBarrelNum = value; } } | |||
public short RawMaterialBarrelNum { get { return _mRawMaterialBarrelNum; } set { _mRawMaterialBarrelNum = value; OnPropertyChanged(); } } | |||
private short _mRawMaterialBarrelNum; | |||
/// <summary> | |||
/// 需要原料重量 | |||
/// </summary> | |||
public float RawMaterialWeight { get { return _mRawMaterialWeight; } set { _mRawMaterialWeight = value; } } | |||
public float RawMaterialWeight { get { return _mRawMaterialWeight; } set { _mRawMaterialWeight = value; OnPropertyChanged(); } } | |||
private float _mRawMaterialWeight; | |||
/// <summary> | |||
@@ -41,7 +42,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
/// <summary> | |||
/// 原料对应料仓的位置 | |||
/// </summary> | |||
public int RawMaterialLocation { get { return _mRawMaterialLocation; } set { _mRawMaterialLocation = value; } } | |||
public int RawMaterialLocation { get { return _mRawMaterialLocation; } set { _mRawMaterialLocation = value;OnPropertyChanged(); } } | |||
private int _mRawMaterialLocation; | |||
} | |||
} |
@@ -24,10 +24,15 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens | |||
var res = this.Siemens_PLC_S7.ReadClass<XL_Start_DB>(1); | |||
var res1 = this.Siemens_PLC_S7.ReadClass<XL_Status_DB>(2); | |||
var res2 = this.Siemens_PLC_S7.ReadClass<XL_Finish_DB>(3); | |||
if (res != null && RTrig.GetInstance("RecipeTrig").Start(res.Ask_For_Send_Bit)) | |||
if (res != null && res.Ask_For_Send_Bit == false && GVL_SmallStation.GetInstance.IsAllowSiemensSendRecipe) | |||
{ | |||
res.Ask_For_Send_Bit = true; | |||
this.Siemens_PLC_S7.WriteClass<XL_Start_DB>(res, 1); | |||
} | |||
if (res != null && RTrig.GetInstance("RecipeTrig").Start(res.Ack_Ask_For_Send_Bit)) | |||
{ | |||
ActionManage.GetInstance.Send("SiemensRecipeRecive", res); | |||
res.Ask_For_Send_Bit = false; | |||
res.Ack_Ask_For_Send_Bit = false; | |||
this.Siemens_PLC_S7.WriteClass<XL_Start_DB>(res, 1); | |||
} | |||
@@ -0,0 +1,14 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.JXJFoodSmallStation.Model.WindSend | |||
{ | |||
public class WindSendDevicePar | |||
{ | |||
public ObservableCollection<WindSendDeviceParMode> WindSendPar { get; set; }=new ObservableCollection<WindSendDeviceParMode>(); | |||
} | |||
} |
@@ -0,0 +1,50 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
namespace BPASmartClient.JXJFoodSmallStation.Model | |||
{ | |||
public class WindSendDeviceParMode : ObservableObject | |||
{ | |||
/// <summary> | |||
/// 原料名称 | |||
/// </summary> | |||
public string MaterialName { get { return _mMaterialName; } set { _mMaterialName = value; OnPropertyChanged(); } } | |||
private string _mMaterialName = string.Empty; | |||
/// <summary> | |||
/// 料仓上限重量 | |||
/// </summary> | |||
public float UpperLimitWeight { get { return _mUpperLimitWeight; } set { _mUpperLimitWeight = value; OnPropertyChanged(); } } | |||
private float _mUpperLimitWeight; | |||
/// <summary> | |||
/// 料仓下限重量 | |||
/// </summary> | |||
public float LowerLimitWeight { get { return _mLowerLimitWeight; } set { _mLowerLimitWeight = value; OnPropertyChanged(); } } | |||
private float _mLowerLimitWeight; | |||
/// <summary> | |||
/// 料仓上限重量偏移 | |||
/// </summary> | |||
public float UpperLimitWeightOffset { get { return _mUpperLimitWeightOffset; } set { _mUpperLimitWeightOffset = value; OnPropertyChanged(); } } | |||
private float _mUpperLimitWeightOffset; | |||
/// <summary> | |||
/// 料仓下限重量偏移 | |||
/// </summary> | |||
public float LowerLimitWeightOffset { get { return _mLowerLimitWeightOffset; } set { _mLowerLimitWeightOffset = value; OnPropertyChanged(); } } | |||
private float _mLowerLimitWeightOffset; | |||
/// <summary> | |||
/// 是否重复 | |||
/// </summary> | |||
[Newtonsoft.Json.JsonIgnore] | |||
public bool IsRedundant { get { return _mIsRedundant; } set { _mIsRedundant = value; OnPropertyChanged(); } } | |||
private bool _mIsRedundant; | |||
} | |||
} |
@@ -0,0 +1,70 @@ | |||
using BPASmartClient.Helper; | |||
using BPASmartClient.Modbus; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using BPASmartClient.S7Net; | |||
using System.Threading; | |||
using BPASmartClient.JXJFoodSmallStation.Model.WindSend; | |||
using BPASmartClient.CustomResource.UserControls.MessageShow; | |||
using BPASmartClient.CustomResource.UserControls; | |||
namespace BPASmartClient.JXJFoodSmallStation.Model | |||
{ | |||
public class WindSendDeviceStatus | |||
{ | |||
public SiemensHelper Siemens_PLC_S7 = new SiemensHelper(); | |||
public bool IsConnected => Siemens_PLC_S7.IsConnected; | |||
public void Init() | |||
{ | |||
if (IsConnected) | |||
{ | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
var res = this.Siemens_PLC_S7.ReadClass<XL_WindSendData_DB>(5); | |||
if(RTrig.GetInstance("CurrentCompleteSign").Start(res.CurrentCompleteSign)) | |||
{ | |||
ActionManage.GetInstance.Send("WindSendDosingFinish"); | |||
} | |||
float weightAlarmStockBin1 = Json<WindSendDevicePar>.Data.WindSendPar.ElementAt(0).LowerLimitWeight + Json<WindSendDevicePar>.Data.WindSendPar.ElementAt(0).LowerLimitWeightOffset; | |||
float weightAlarmStockBin2 = Json<WindSendDevicePar>.Data.WindSendPar.ElementAt(1).LowerLimitWeight + Json<WindSendDevicePar>.Data.WindSendPar.ElementAt(1).LowerLimitWeightOffset; | |||
float weightAlarmStockBin3 = Json<WindSendDevicePar>.Data.WindSendPar.ElementAt(2).LowerLimitWeight + Json<WindSendDevicePar>.Data.WindSendPar.ElementAt(2).LowerLimitWeightOffset; | |||
float weightAlarmStockBin4 = Json<WindSendDevicePar>.Data.WindSendPar.ElementAt(3).LowerLimitWeight + Json<WindSendDevicePar>.Data.WindSendPar.ElementAt(3).LowerLimitWeightOffset; | |||
float weightAlarmStockBin5 = Json<WindSendDevicePar>.Data.WindSendPar.ElementAt(4).LowerLimitWeight + Json<WindSendDevicePar>.Data.WindSendPar.ElementAt(4).LowerLimitWeightOffset; | |||
if (res.RawMaterial1_StockBinWeight < weightAlarmStockBin1) | |||
{ | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", $"料仓1缺料!"); | |||
} | |||
if (res.RawMaterial2_StockBinWeight < weightAlarmStockBin2) | |||
{ | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", $"料仓2缺料!"); | |||
} | |||
if (res.RawMaterial3_StockBinWeight < weightAlarmStockBin3) | |||
{ | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", $"料仓3缺料!"); | |||
} | |||
if (res.RawMaterial4_StockBinWeight < weightAlarmStockBin4) | |||
{ | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", $"料仓4缺料!"); | |||
} | |||
if (res.RawMaterial5_StockBinWeight < weightAlarmStockBin5) | |||
{ | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", $"料仓5缺料!"); | |||
} | |||
Thread.Sleep(10); | |||
}),"监听服务数据"); | |||
} | |||
} | |||
} | |||
enum DeviceName | |||
{ | |||
原料1, | |||
原料2, | |||
原料3, | |||
原料4, | |||
原料5 | |||
} | |||
} |
@@ -0,0 +1,23 @@ | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.JXJFoodSmallStation.Model | |||
{ | |||
public class WindSendRawMaterial:ObservableObject | |||
{ | |||
public int DeviceIp { get { return _mIp; } set { _mIp = value; }} | |||
private int _mIp; | |||
public string RawMaterialName { get { return _mRawMaterialName; } set { _mRawMaterialName = value; OnPropertyChanged(); } } | |||
private string _mRawMaterialName; | |||
/// <summary> | |||
/// 需要原料重量 | |||
/// </summary> | |||
public float RawMaterialWeight { get { return _mRawMaterialWeight; } set { _mRawMaterialWeight = value; OnPropertyChanged(); } } | |||
private float _mRawMaterialWeight; | |||
} | |||
} |
@@ -0,0 +1,38 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.JXJFoodSmallStation.Model.WindSend | |||
{ | |||
public class XL_WindSendData_DB | |||
{ | |||
public string TargetRecipeCode; | |||
public string CurrentRecipeCode; | |||
public bool CurrentCompleteSign; | |||
public float RawMaterial1_SetWeight; | |||
public float RawMaterial2_SetWeight; | |||
public float RawMaterial3_SetWeight; | |||
public float RawMaterial4_SetWeight; | |||
public float RawMaterial5_SetWeight; | |||
public float RawMaterial1_FinishWeight; | |||
public float RawMaterial2_FinishWeight; | |||
public float RawMaterial3_FinishWeight; | |||
public float RawMaterial4_FinishWeight; | |||
public float RawMaterial5_FinishWeight; | |||
public float RawMaterial1_CurrentWeight; | |||
public float RawMaterial2_CurrentWeight; | |||
public float RawMaterial3_CurrentWeight; | |||
public float RawMaterial4_CurrentWeight; | |||
public float RawMaterial5_CurrentWeight; | |||
public float RawMaterial1_StockBinWeight; | |||
public float RawMaterial2_StockBinWeight; | |||
public float RawMaterial3_StockBinWeight; | |||
public float RawMaterial4_StockBinWeight; | |||
public float RawMaterial5_StockBinWeight; | |||
} | |||
} |
@@ -160,14 +160,19 @@ | |||
<ColumnDefinition Width="1*"/> | |||
<ColumnDefinition Width="1*"/> | |||
<ColumnDefinition Width="1*"/> | |||
<ColumnDefinition Width="1*"/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Grid.Column="0" Text="原料位置" HorizontalAlignment="Center" /> | |||
<Grid Grid.Column="1"> | |||
<Grid Grid.Column="0"> | |||
<TextBlock Text="原料名称" HorizontalAlignment="Center" /> | |||
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBlock Grid.Column="1" Text="原料位置" HorizontalAlignment="Center" /> | |||
<Grid Grid.Column="2"> | |||
<TextBlock Text="原料桶号" HorizontalAlignment="Center" /> | |||
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBlock Grid.Column="2" Text="原料重量" HorizontalAlignment="Center" /> | |||
<Grid Grid.Column="3"> | |||
<TextBlock Grid.Column="3" Text="原料重量" HorizontalAlignment="Center" /> | |||
<Grid Grid.Column="4"> | |||
<TextBlock Text="功能操作" HorizontalAlignment="Center" /> | |||
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" /> | |||
</Grid> | |||
@@ -184,13 +189,20 @@ | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<Grid Grid.Column="0"> | |||
<TextBox | |||
Text="{Binding RawMaterialName}" /> | |||
<Border | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBox | |||
Grid.Column="0" | |||
Grid.Column="1" | |||
Text="{Binding RawMaterialLocation }" /> | |||
<Grid Grid.Column="1"> | |||
<Grid Grid.Column="2"> | |||
<TextBox | |||
Text="{Binding RawMaterialBarrelNum}" /> | |||
<Border | |||
@@ -199,10 +211,10 @@ | |||
</Grid> | |||
<TextBox | |||
Grid.Column="2" | |||
Grid.Column="3" | |||
Text="{Binding RawMaterialWeight}" /> | |||
<Grid Grid.Column="3"> | |||
<Grid Grid.Column="4"> | |||
<Button | |||
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RawMaterialLocation}" | |||
@@ -49,12 +49,21 @@ | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right"> | |||
<!--<CheckBox | |||
Content="本地配方模拟" | |||
<CheckBox | |||
x:Name="IsUseWindSend" | |||
Margin="0,0,10,0" | |||
Content="使用粉料仓配料模拟" | |||
FontFamily="楷体" | |||
VerticalAlignment="Center" | |||
Foreground="Aqua" | |||
IsChecked="{Binding IsUseLocalRecipe}"/>--> | |||
IsChecked="{Binding IsUseWindSendDosing}" /> | |||
<CheckBox | |||
x:Name="IsUseStockBin" | |||
Content="本地小料仓配方模拟" | |||
FontFamily="楷体" | |||
VerticalAlignment="Center" | |||
Foreground="Aqua" | |||
IsChecked="{Binding IsUseLocalRecipe}"/> | |||
<pry:IcoButton | |||
Width="140" | |||
Margin="10" | |||
@@ -76,8 +85,7 @@ | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
<pry:IcoButton | |||
Grid.Column="3" | |||
<pry:IcoButton | |||
Width="140" | |||
Margin="10" | |||
HorizontalAlignment="Right" | |||
@@ -150,6 +158,7 @@ | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<pry:IcoButton | |||
@@ -171,13 +180,26 @@ | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.DetailsCommand, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
Command="{Binding DataContext.IssueRecipe, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipeCode}" | |||
Content="下发" | |||
EnterBackground="#FF2AB2E7" | |||
Foreground="#dd000000" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
<pry:IcoButton | |||
Grid.Column="2" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.RemoveRecipe, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipeCode}" | |||
Content="删除" | |||
EnterBackground="#FF2AB2E7" | |||
Foreground="#dd000000" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
</Grid> | |||
</Grid> | |||
@@ -1,4 +1,5 @@ | |||
using System; | |||
using BPASmartClient.JXJFoodSmallStation.Model; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Reflection; | |||
@@ -24,6 +25,8 @@ namespace BPASmartClient.JXJFoodSmallStation.View | |||
public RecipeReceiveView() | |||
{ | |||
InitializeComponent(); | |||
this.IsUseWindSend.Click += (o, e) => { GVL_SmallStation.GetInstance.IsUseWindSend = (bool)IsUseWindSend.IsChecked; }; | |||
this.IsUseStockBin.Click += (o, e) => { GVL_SmallStation.GetInstance.IsUseLocalRecipe = (bool)IsUseStockBin.IsChecked; }; | |||
} | |||
} | |||
} |
@@ -162,10 +162,6 @@ | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
@@ -175,58 +171,34 @@ | |||
Text="原料名称" /> | |||
<Grid Grid.Column="1"> | |||
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="慢加重量(g)" /> | |||
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="料仓上限重量" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="2" | |||
Style="{StaticResource TitleTextblockStyle}" | |||
Text="提前关阀重量" /> | |||
<Grid Grid.Column="3"> | |||
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="快加速度" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="4" | |||
Style="{StaticResource TitleTextblockStyle}" | |||
Text="慢加速度" /> | |||
<Grid Grid.Column="5"> | |||
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="伺服手动速度" /> | |||
<Grid Grid.Column="2"> | |||
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="料仓下限重量" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="6" | |||
Style="{StaticResource TitleTextblockStyle}" | |||
Text="料仓上限重量" /> | |||
<Grid Grid.Column="7"> | |||
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="料仓下限重量" /> | |||
<Grid Grid.Column="3"> | |||
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="上限重量报警阈值" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="8" | |||
Grid.Column="4" | |||
Style="{StaticResource TitleTextblockStyle}" | |||
Text="搅拌速度" /> | |||
<Grid Grid.Column="9"> | |||
Text="下限重量报警阈值" /> | |||
<Grid Grid.Column="5"> | |||
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="功能操作" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
@@ -255,10 +227,6 @@ | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBox | |||
@@ -266,76 +234,50 @@ | |||
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}" | |||
Style="{StaticResource InputTextboxStyle}" | |||
Text="{Binding MaterialName}" /> | |||
<Grid Grid.Column="1"> | |||
<TextBox | |||
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}" | |||
Style="{StaticResource InputTextboxStyle}" | |||
Text="{Binding SlowlyAddWeight}" /> | |||
Text="{Binding UpperLimitWeight}" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBox | |||
Grid.Column="2" | |||
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}" | |||
Style="{StaticResource InputTextboxStyle}" | |||
Text="{Binding PreCloseValveWeight}" /> | |||
<Grid Grid.Column="3"> | |||
<Grid Grid.Column="2"> | |||
<TextBox | |||
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}" | |||
Style="{StaticResource InputTextboxStyle}" | |||
Text="{Binding RapidAcceleration}" /> | |||
Text="{Binding LowerLimitWeight}" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBox | |||
Grid.Column="4" | |||
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}" | |||
Style="{StaticResource InputTextboxStyle}" | |||
Text="{Binding SlowAcceleration}" /> | |||
<Grid Grid.Column="5"> | |||
<Grid Grid.Column="3"> | |||
<TextBox | |||
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}" | |||
Style="{StaticResource InputTextboxStyle}" | |||
Text="{Binding ServoManualSpeed}" /> | |||
Text="{Binding UpperLimitWeightOffset}" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBox | |||
Grid.Column="6" | |||
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}" | |||
Style="{StaticResource InputTextboxStyle}" | |||
Text="{Binding SiloUpperLimitWeight}" /> | |||
<Grid Grid.Column="7"> | |||
<Grid Grid.Column="4"> | |||
<TextBox | |||
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}" | |||
Style="{StaticResource InputTextboxStyle}" | |||
Text="{Binding LowerLimitWeightOfSilo}" /> | |||
Text="{Binding LowerLimitWeightOffset}" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBox | |||
Grid.Column="8" | |||
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}" | |||
Style="{StaticResource InputTextboxStyle}" | |||
Text="{Binding StirringSpeed}" /> | |||
<Grid Grid.Column="9"> | |||
<Grid Grid.Column="5"> | |||
<Button | |||
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
CommandParameter="{Binding MaterialName}" | |||
@@ -23,6 +23,7 @@ namespace BPASmartClient.JXJFoodSmallStation.View | |||
public WindSendParView() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -26,39 +26,39 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"{o.ToString()}:原料删除成功!"); | |||
}); | |||
AddCommand = new RelayCommand(() => { deviceParModels.Add(new DeviceParModel()); }); | |||
AddCommand = new RelayCommand(() => { deviceParModels.Add(new DeviceParMode()); }); | |||
SaveCommand = new RelayCommand(() => | |||
{ | |||
if (deviceParModels == null || deviceParModels.Count <= 0) | |||
{ | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", $"没有可保存的参数!"); | |||
return; | |||
} | |||
{ | |||
if (deviceParModels == null || deviceParModels.Count <= 0) | |||
{ | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", $"没有可保存的参数!"); | |||
return; | |||
} | |||
for (int i = 0; i < deviceParModels.Count; i++) | |||
{ | |||
if (deviceParModels.Where(p => p.MaterialName == deviceParModels.ElementAt(i).MaterialName)?.ToList()?.Count >= 2) | |||
deviceParModels.ElementAt(i).IsRedundant = true; | |||
else | |||
deviceParModels.ElementAt(i).IsRedundant = false; | |||
} | |||
for (int i = 0; i < deviceParModels.Count; i++) | |||
{ | |||
if (deviceParModels.Where(p => p.MaterialName == deviceParModels.ElementAt(i).MaterialName)?.ToList()?.Count >= 2) | |||
deviceParModels.ElementAt(i).IsRedundant = true; | |||
else | |||
deviceParModels.ElementAt(i).IsRedundant = false; | |||
} | |||
if (deviceParModels.FirstOrDefault(p => p.IsRedundant == true) != null) | |||
{ | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "错误", $"原料名称冲突,请检查后重试!"); | |||
return; | |||
} | |||
if (deviceParModels.FirstOrDefault(p => p.IsRedundant == true) != null) | |||
{ | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "错误", $"原料名称冲突,请检查后重试!"); | |||
return; | |||
} | |||
deviceParModels.Where(P => P.MaterialName.Length <= 0)?.ToList()?.ForEach(item => | |||
{ | |||
Json<DevicePar>.Data.deviceParModels.Remove(item); | |||
}); | |||
Json<DevicePar>.Save(); | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"原料参数保存成功!"); | |||
}); | |||
deviceParModels.Where(P => P.MaterialName.Length <= 0)?.ToList()?.ForEach(item => | |||
{ | |||
Json<DevicePar>.Data.deviceParModels.Remove(item); | |||
}); | |||
Json<DevicePar>.Save(); | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"原料参数保存成功!"); | |||
}); | |||
} | |||
public ObservableCollection<DeviceParModel> deviceParModels { get; set; } | |||
public ObservableCollection<DeviceParMode> deviceParModels { get; set; } | |||
public RelayCommand<object> RemoveCommand { get; set; } | |||
@@ -64,7 +64,7 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||
{ | |||
Name = $"出料桶顶升气缸{i+1}", | |||
LeftTog = false, | |||
RightTog = true, | |||
RightTog = false, | |||
}); | |||
} | |||
@@ -40,27 +40,59 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"{o.ToString()}:原料删除成功!"); | |||
}); | |||
AddCommand = new RelayCommand(() => | |||
AddCommand = new RelayCommand(() => | |||
{ | |||
RawMaterial.Add(new RemoteRecipeRawMaterial() | |||
int MaxRawMaterial = 15; | |||
if (GVL_SmallStation.GetInstance.IsUseWindSend && TrayNum == 1) | |||
{ | |||
RawMaterialLocation= RawMaterial.Count +1 | |||
}); | |||
MaxRawMaterial = 20; | |||
} | |||
else | |||
{ | |||
MaxRawMaterial = 15; | |||
} | |||
if (RawMaterial.Count < MaxRawMaterial) | |||
{ | |||
if (RawMaterial.Count < 15) | |||
{ | |||
RawMaterial.Add(new RemoteRecipeRawMaterial() | |||
{ | |||
RawMaterialName = "原料" + (RawMaterial.Count + 1), | |||
RawMaterialLocation = RawMaterial.Count + 1, | |||
RawMaterialBarrelNum = 1, | |||
RawMaterialWeight = 100 | |||
}); | |||
} | |||
else | |||
{ | |||
RawMaterial.Add(new RemoteRecipeRawMaterial() | |||
{ | |||
RawMaterialName = "粉料" + (RawMaterial.Count -14), | |||
RawMaterialLocation = (RawMaterial.Count - 14), | |||
RawMaterialBarrelNum = 7, | |||
RawMaterialWeight = 100 | |||
}); | |||
} | |||
} | |||
else | |||
{ | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"原料最多添加{MaxRawMaterial}种"); | |||
} | |||
}); | |||
SaveCommand = new RelayCommand(() => | |||
{ | |||
if (RecipeName.Length < 0 || RecipeName == null) | |||
if (RecipeName.Length < 0 || RecipeName == null|| RecipeName==String.Empty || RecipeName == "") | |||
{ | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "错误", $"配方名称不能为空"); | |||
return; | |||
} | |||
int index = Array.FindIndex(Json<RemoteRecipeDataColl>.Data.Recipes.ToArray(), p => p.RecipeCode == RecipeCode); | |||
if (index >= 0) | |||
if (RecipeCode.Length < 0 || RecipeCode == null || RecipeCode == String.Empty || RecipeCode == "") | |||
{ | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "错误", $"已经存在配方{RecipeCode}"); | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "错误", $"配方编号不能为空"); | |||
return; | |||
} | |||
if (TrayNum != 1 || TrayNum!=2) | |||
if (TrayNum != 1 && TrayNum!=2) | |||
{ | |||
TrayNum = 1; | |||
} | |||
@@ -77,26 +109,46 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||
{ | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "错误", $"原料位置冲突,请检查后重试!"); | |||
return; | |||
} | |||
} | |||
} | |||
foreach (var item in RawMaterial) | |||
int index = Array.FindIndex(Json<LocalRecipeDataColl>.Data.Recipes.ToArray(), p => p.RecipeCode == RecipeCode); | |||
if (index >= 0) | |||
{ | |||
RawMaterials.Add(new RemoteRecipeRawMaterial() | |||
foreach (var item in RawMaterial) | |||
{ | |||
RawMaterialLocation = item.RawMaterialLocation, | |||
RawMaterialBarrelNum = item.RawMaterialBarrelNum, | |||
RawMaterialWeight = item.RawMaterialWeight, | |||
}); | |||
RawMaterials.Add(new RemoteRecipeRawMaterial() | |||
{ | |||
RawMaterialLocation = item.RawMaterialLocation, | |||
RawMaterialBarrelNum = item.RawMaterialBarrelNum, | |||
RawMaterialWeight = item.RawMaterialWeight, | |||
}); | |||
} | |||
Json<LocalRecipeDataColl>.Data.Recipes.ElementAt(index).RecipeName= RecipeName; | |||
Json<LocalRecipeDataColl>.Data.Recipes.ElementAt(index).TrayCode = TrayNum; | |||
Json<LocalRecipeDataColl>.Data.Recipes.ElementAt(index).RecipeCode = RecipeCode; | |||
Json<LocalRecipeDataColl>.Data.Recipes.ElementAt(index).RawMaterial = RawMaterial; | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"修改配方完成!"); | |||
} | |||
Json<LocalRecipeDataColl>.Data.Recipes.Add(new RemoteRecipeData() | |||
else | |||
{ | |||
RecipeName = RecipeName, | |||
RecipeCode = RecipeCode, | |||
TrayCode = TrayNum, | |||
RawMaterial = RawMaterials, | |||
}); | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"自定义配方添加完成!"); | |||
foreach (var item in RawMaterial) | |||
{ | |||
RawMaterials.Add(new RemoteRecipeRawMaterial() | |||
{ | |||
RawMaterialLocation = item.RawMaterialLocation, | |||
RawMaterialBarrelNum = item.RawMaterialBarrelNum, | |||
RawMaterialWeight = item.RawMaterialWeight, | |||
}); | |||
} | |||
Json<LocalRecipeDataColl>.Data.Recipes.Add(new RemoteRecipeData() | |||
{ | |||
RecipeName = RecipeName, | |||
RecipeCode = RecipeCode, | |||
TrayCode = TrayNum, | |||
RawMaterial = RawMaterials, | |||
}); | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"自定义配方添加完成!"); | |||
} | |||
ActionManage.GetInstance.Send("CloseNewRemoteRecipeView"); | |||
}); | |||
} | |||
@@ -144,7 +144,6 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||
if (Global.userInfo.locaRawMaterials.FirstOrDefault(p => p.RawMaterialName == item.RawMaterialName) != null) RawMaterialNames.Add(item.RawMaterialName); | |||
} | |||
} | |||
} | |||
private void AddRecipes() | |||
@@ -179,7 +178,6 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||
public ObservableCollection<RawMaterialModel> RawMaterials { get; set; } = new ObservableCollection<RawMaterialModel>(); | |||
public ObservableCollection<string> RawMaterialNames { get; set; } = new ObservableCollection<string>(); | |||
} | |||
} |