@@ -20,7 +20,7 @@ | |||
</ItemGroup> | |||
<ItemGroup> | |||
<PackageReference Include="BPA.Helper" Version="1.0.28" /> | |||
<PackageReference Include="BPA.Helper" Version="1.0.54" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
@@ -8,7 +8,7 @@ | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<PackageReference Include="BPA.Helper" Version="1.0.28" /> | |||
<PackageReference Include="BPA.Helper" Version="1.0.54" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
@@ -9,7 +9,7 @@ | |||
<ItemGroup> | |||
<PackageReference Include="BPA.Communication" Version="1.0.36" /> | |||
<PackageReference Include="BPA.Helper" Version="1.0.28" /> | |||
<PackageReference Include="BPA.Helper" Version="1.0.54" /> | |||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.9" /> | |||
</ItemGroup> | |||
@@ -30,7 +30,7 @@ | |||
<ItemGroup> | |||
<PackageReference Include="BPA.Communication" Version="1.0.36" /> | |||
<PackageReference Include="BPA.Helper" Version="1.0.28" /> | |||
<PackageReference Include="BPA.Helper" Version="1.0.54" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
@@ -8,8 +8,8 @@ | |||
<ItemGroup> | |||
<PackageReference Include="BPA.ApolloClient" Version="1.0.12" /> | |||
<PackageReference Include="BPA.Helper" Version="1.0.33" /> | |||
<PackageReference Include="BPA.Message" Version="1.0.84" /> | |||
<PackageReference Include="BPA.Helper" Version="1.0.54" /> | |||
<PackageReference Include="BPA.Message" Version="1.0.86" /> | |||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" /> | |||
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="6.0.0" /> | |||
<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.0" /> | |||
@@ -56,6 +56,9 @@ namespace BPASmartClient.Business | |||
new OrderStatusChangedEvent() { SortNum = mork.SortNum.ToString(), Status = ORDER_STATUS.COMPLETED_COOK, SubOrderId = mork.SuborderId, GoodName = mork.GoodsName }.Publish(); | |||
Thread.Sleep(5000); | |||
new OrderStatusChangedEvent() { SortNum = mork.SortNum.ToString(), Status = ORDER_STATUS.COMPLETED_TAKE, SubOrderId = mork.SuborderId, GoodName = mork.GoodsName }.Publish(); | |||
string num = mork.SortNum.ToString().Substring(0, mork.SortNum.ToString().Length - 1); | |||
if (int.TryParse(num, out int sort)) | |||
ActionManage.GetInstance.Send("COMPLETED_TAKE_Notify", sort.ToString("0000")); | |||
Thread.Sleep(2000); | |||
} | |||
} | |||
@@ -114,7 +117,8 @@ namespace BPASmartClient.Business | |||
else if (message is StirFryPushMessage frybom) | |||
{ | |||
IDevice device = deviceMgr.GetDevices().FirstOrDefault(x => x.DeviceId == 28); | |||
new StirFryGoodsEvent() { | |||
new StirFryGoodsEvent() | |||
{ | |||
DeviceId = device.DeviceId, | |||
stirFrymessage = frybom | |||
}.Publish(); | |||
@@ -202,6 +206,8 @@ namespace BPASmartClient.Business | |||
var temp = BPAPackage.Make(orderStatusChange, clientId, orderStatusChangedEvent.deviceClientType); | |||
var q = temp.Serialize(false); | |||
Plugin.GetInstance().GetPlugin<MQTTMgr>().Publish(TOPIC.GetInstance.GetAppTopic(clientId.ToString()), temp.Serialize(false)); | |||
if (orderStatusChange.CookingStatus == ORDER_STATUS.COMPLETED_TAKE) | |||
MessageLog.GetInstance.Show($"通知叫号:{orderStatusChange.GoodName}--{orderStatusChange.SortNum}"); | |||
#endregion | |||
} | |||
@@ -127,6 +127,25 @@ | |||
<None Remove="Image\工艺流程.jpg" /> | |||
<None Remove="Image\工艺流程.png" /> | |||
<None Remove="Image\底部背景.png" /> | |||
<None Remove="Image\弹框\BG.png" /> | |||
<None Remove="Image\弹框\bh.png" /> | |||
<None Remove="Image\弹框\biankuang_.png" /> | |||
<None Remove="Image\弹框\bz.png" /> | |||
<None Remove="Image\弹框\c.png" /> | |||
<None Remove="Image\弹框\ch.png" /> | |||
<None Remove="Image\弹框\j1.png" /> | |||
<None Remove="Image\弹框\j2.png" /> | |||
<None Remove="Image\弹框\j3.png" /> | |||
<None Remove="Image\弹框\j4.png" /> | |||
<None Remove="Image\弹框\j5.png" /> | |||
<None Remove="Image\弹框\j6.png" /> | |||
<None Remove="Image\弹框\sbj.png" /> | |||
<None Remove="Image\弹框\wbjx.png" /> | |||
<None Remove="Image\弹框\xsbj.png" /> | |||
<None Remove="Image\弹框\ybjx.png" /> | |||
<None Remove="Image\弹框\z22.png" /> | |||
<None Remove="Image\弹框\z4.png" /> | |||
<None Remove="Image\弹框\弹窗.png" /> | |||
<None Remove="Image\弹窗2.png" /> | |||
<None Remove="Image\按钮\AddGreen.png" /> | |||
<None Remove="Image\按钮\Delete.png" /> | |||
@@ -266,8 +285,20 @@ | |||
<None Remove="Image\顶部线条.png" /> | |||
<None Remove="Image\顶部背景.png" /> | |||
<None Remove="Image\黑菠萝科技.png" /> | |||
<None Remove="Vioce\0.wav" /> | |||
<None Remove="Vioce\1.wav" /> | |||
<None Remove="Vioce\2.wav" /> | |||
<None Remove="Vioce\3.wav" /> | |||
<None Remove="Vioce\4.wav" /> | |||
<None Remove="Vioce\5.wav" /> | |||
<None Remove="Vioce\6.wav" /> | |||
<None Remove="Vioce\7.wav" /> | |||
<None Remove="Vioce\8.wav" /> | |||
<None Remove="Vioce\9.wav" /> | |||
<None Remove="Vioce\取餐通知.wav" /> | |||
<None Remove="Vioce\号用户取餐.wav" /> | |||
<None Remove="Vioce\电子提示音.wav" /> | |||
<None Remove="Vioce\请.wav" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
@@ -332,6 +363,25 @@ | |||
<Resource Include="Image\容器边框2.png" /> | |||
<Resource Include="Image\工艺流程.jpg" /> | |||
<Resource Include="Image\工艺流程.png" /> | |||
<Resource Include="Image\弹框\BG.png" /> | |||
<Resource Include="Image\弹框\bh.png" /> | |||
<Resource Include="Image\弹框\biankuang_.png" /> | |||
<Resource Include="Image\弹框\bz.png" /> | |||
<Resource Include="Image\弹框\c.png" /> | |||
<Resource Include="Image\弹框\ch.png" /> | |||
<Resource Include="Image\弹框\j1.png" /> | |||
<Resource Include="Image\弹框\j2.png" /> | |||
<Resource Include="Image\弹框\j3.png" /> | |||
<Resource Include="Image\弹框\j4.png" /> | |||
<Resource Include="Image\弹框\j5.png" /> | |||
<Resource Include="Image\弹框\j6.png" /> | |||
<Resource Include="Image\弹框\sbj.png" /> | |||
<Resource Include="Image\弹框\wbjx.png" /> | |||
<Resource Include="Image\弹框\xsbj.png" /> | |||
<Resource Include="Image\弹框\ybjx.png" /> | |||
<Resource Include="Image\弹框\z22.png" /> | |||
<Resource Include="Image\弹框\z4.png" /> | |||
<Resource Include="Image\弹框\弹窗.png" /> | |||
<Resource Include="Image\弹窗2.png" /> | |||
<Resource Include="Image\按钮\AddGreen.png" /> | |||
<Resource Include="Image\按钮\Delete.png" /> | |||
@@ -409,8 +459,8 @@ | |||
</ItemGroup> | |||
<ItemGroup> | |||
<PackageReference Include="BPA.Helper" Version="1.0.28" /> | |||
<PackageReference Include="BPA.Message" Version="1.0.84" /> | |||
<PackageReference Include="BPA.Helper" Version="1.0.62" /> | |||
<PackageReference Include="BPA.Message" Version="1.0.86" /> | |||
<PackageReference Include="MahApps.Metro.IconPacks.FontAwesome" Version="4.11.0" /> | |||
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" /> | |||
</ItemGroup> | |||
@@ -550,6 +600,42 @@ | |||
<Resource Include="Image\顶部线条.png" /> | |||
<Resource Include="Image\顶部背景.png" /> | |||
<Resource Include="Image\黑菠萝科技.png" /> | |||
<EmbeddedResource Include="Vioce\0.wav"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</EmbeddedResource> | |||
<EmbeddedResource Include="Vioce\1.wav"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</EmbeddedResource> | |||
<EmbeddedResource Include="Vioce\2.wav"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</EmbeddedResource> | |||
<EmbeddedResource Include="Vioce\3.wav"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</EmbeddedResource> | |||
<EmbeddedResource Include="Vioce\4.wav"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</EmbeddedResource> | |||
<EmbeddedResource Include="Vioce\5.wav"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</EmbeddedResource> | |||
<EmbeddedResource Include="Vioce\6.wav"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</EmbeddedResource> | |||
<EmbeddedResource Include="Vioce\7.wav"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</EmbeddedResource> | |||
<EmbeddedResource Include="Vioce\8.wav"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</EmbeddedResource> | |||
<EmbeddedResource Include="Vioce\9.wav"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</EmbeddedResource> | |||
<EmbeddedResource Include="Vioce\号用户取餐.wav"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</EmbeddedResource> | |||
<EmbeddedResource Include="Vioce\请.wav"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</EmbeddedResource> | |||
</ItemGroup> | |||
<ItemGroup> | |||
@@ -25,7 +25,7 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||
if (string.IsNullOrEmpty(name)) name = typeof(AlarmT).Name; | |||
if (_Instance == null) _Instance = new ConcurrentDictionary<string, AlarmT>(); | |||
if (!_Instance.ContainsKey(name)) _Instance.TryAdd(name, new AlarmT()); | |||
return _Instance[name]; | |||
return _Instance[name]; | |||
} | |||
} | |||
private AlarmHelper() { } | |||
@@ -67,7 +67,6 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||
} | |||
Thread.Sleep(100); | |||
}), $"{typeof(AlarmT).Name},报警通用模块监听"); | |||
} | |||
/// <summary> | |||
@@ -20,6 +20,7 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||
public static readonly object runLock = new object(); | |||
public static readonly object userlock = new object(); | |||
public static readonly object alarmlock = new object(); | |||
public static readonly object recipeLogslock = new object(); | |||
private MessageNotify() { } | |||
public Action<string> UserLog { get; set; } | |||
@@ -28,17 +29,46 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||
public Action<string> AlarmLog { get; set; } | |||
public ObservableCollection<RunLog> runLogs { get; set; } = new ObservableCollection<RunLog>(); | |||
public Action<string> RecipeCompleteLogs { get; set; } | |||
public ObservableCollection<UserLog> userLogs { get; set; } = new ObservableCollection<UserLog>(); | |||
public ObservableCollection<RunLog> runLogs { get; set; } = new(); | |||
public ObservableCollection<Alarm> alarmLogs { get; set; } = new ObservableCollection<Alarm>(); | |||
public ObservableCollection<UserLog> userLogs { get; set; } = new(); | |||
public ObservableCollection<Alarm> alarmLogs { get; set; } = new(); | |||
public ObservableCollection<RecipeCompleteLog> recipeLogs { get; set; } = new(); | |||
public void LogSave() | |||
{ | |||
Sqlite<UserLog>.GetInstance.Save(); | |||
Sqlite<RunLog>.GetInstance.Save(); | |||
Sqlite<Alarm>.GetInstance.Save(); | |||
Sqlite<RecipeCompleteLog>.GetInstance.Save(); | |||
} | |||
public void ShowRecipeLog(string info) | |||
{ | |||
lock (recipeLogslock) | |||
{ | |||
try | |||
{ | |||
RecipeCompleteLog runLog = new RecipeCompleteLog() | |||
{ | |||
Date = DateTime.Now.ToString("yyyy-MM-dd"), | |||
Time = DateTime.Now.ToString("HH:mm:ss"), | |||
RecipeName = info | |||
}; | |||
Sqlite<RecipeCompleteLog>.GetInstance.Base.Add(runLog); | |||
Application.Current.Dispatcher.Invoke(new Action(() => { recipeLogs.Insert(0, runLog); })); | |||
RecipeCompleteLogs?.Invoke(info); | |||
} | |||
catch (Exception) | |||
{ | |||
// throw; | |||
} | |||
} | |||
} | |||
public void ShowUserLog(string info) | |||
@@ -81,7 +111,7 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||
catch (Exception) | |||
{ | |||
// throw; | |||
// throw; | |||
} | |||
} | |||
} | |||
@@ -109,34 +139,40 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||
public bool ShowDialog(string info, DialogType dialogType = DialogType.Information) | |||
{ | |||
PromptView PV = new PromptView(); | |||
PV.TextBlockInfo = info; | |||
switch (dialogType) | |||
bool result = false; | |||
Application.Current.Dispatcher.Invoke(() => | |||
{ | |||
case DialogType.Warning: | |||
PV.TextBlockIcon = ""; | |||
PV.TextBlockForeground = Brushes.Yellow; | |||
PV.infoType.Text = "警告:"; | |||
//PV.Cancel.Visibility = Visibility.Collapsed; | |||
break; | |||
case DialogType.Error: | |||
PV.TextBlockIcon = ""; | |||
PV.TextBlockForeground = Brushes.Red; | |||
PV.infoType.Text = "错误:"; | |||
//PV.Cancel.Visibility = Visibility.Collapsed; | |||
break; | |||
case DialogType.Information: | |||
PV.TextBlockIcon = ""; | |||
PV.TextBlockForeground = Brushes.DeepSkyBlue; | |||
PV.infoType.Text = "提示:"; | |||
//PV.Cancel.Visibility = Visibility.Visible; | |||
break; | |||
default: | |||
break; | |||
} | |||
PV.infoType.Foreground = PV.TextBlockForeground; | |||
var res = PV.ShowDialog(); | |||
return res == null ? false : (bool)res; | |||
PromptView PV = new PromptView(); | |||
PV.TextBlockInfo = info; | |||
switch (dialogType) | |||
{ | |||
case DialogType.Warning: | |||
PV.TextBlockIcon = ""; | |||
PV.TextBlockForeground = Brushes.Yellow; | |||
PV.infoType.Text = "警告:"; | |||
//PV.Cancel.Visibility = Visibility.Collapsed; | |||
break; | |||
case DialogType.Error: | |||
PV.TextBlockIcon = ""; | |||
PV.TextBlockForeground = Brushes.Red; | |||
PV.infoType.Text = "错误:"; | |||
//PV.Cancel.Visibility = Visibility.Collapsed; | |||
break; | |||
case DialogType.Information: | |||
PV.TextBlockIcon = ""; | |||
PV.TextBlockForeground = Brushes.DeepSkyBlue; | |||
PV.infoType.Text = "提示:"; | |||
//PV.Cancel.Visibility = Visibility.Visible; | |||
break; | |||
default: | |||
break; | |||
} | |||
PV.infoType.Foreground = PV.TextBlockForeground; | |||
var res = PV.ShowDialog(); | |||
result = res == null ? false : (bool)res; | |||
}); | |||
return result; | |||
} | |||
} | |||
@@ -0,0 +1,22 @@ | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.ComponentModel.DataAnnotations; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.CustomResource.Pages.Model | |||
{ | |||
public class RecipeCompleteLog : ObservableObject | |||
{ | |||
[Key] | |||
public int Id { get; set; } | |||
public string Date { get; set; } | |||
public string Time { get; set; } | |||
public string RecipeName { get; set; } | |||
} | |||
} |
@@ -0,0 +1,90 @@ | |||
using BPASmartClient.Message; | |||
using System; | |||
using System.Collections.Concurrent; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Runtime.InteropServices; | |||
using System.Text; | |||
using System.Threading; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.CustomResource | |||
{ | |||
public class VoiceAPI | |||
{ | |||
public VoiceAPI() | |||
{ | |||
} | |||
static VoiceAPI() | |||
{ | |||
BPA.Helper.ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
while (msg.Count > 0) | |||
{ | |||
if (msg.TryDequeue(out string str)) | |||
{ | |||
WaitMeaLSpeak(str); | |||
} | |||
} | |||
Thread.Sleep(1000); | |||
}), "语音播报", true); | |||
} | |||
[DllImport("winmm.dll")] | |||
public static extern bool PlaySound(string pszSound, int hmod, int fdwSound); | |||
private static ConcurrentQueue<string> msg { get; set; } = new ConcurrentQueue<string>(); | |||
public static void Speak(string s) | |||
{ | |||
if (int.TryParse(s.Substring(0, s.Length - 1), out int num)) | |||
msg.Enqueue(num.ToString("0000")); | |||
} | |||
// 系统播放wav格式的文件 | |||
private static void m_SystemPlayWav(string strPlayFile) | |||
{ | |||
try | |||
{ | |||
if (strPlayFile.Trim() == "") | |||
{ return; }//为空不放 | |||
string strPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase; | |||
strPath = strPath + strPlayFile; | |||
int SND_FILENAME = 0x00020000; | |||
int SND_ASYNC = 0x0001; | |||
PlaySound(strPath, 0, SND_ASYNC | SND_FILENAME);//播放音乐 | |||
} | |||
catch (Exception ex) | |||
{ | |||
MessageLog.GetInstance.ShowEx(ex.Message); | |||
} | |||
} | |||
private static void WaitMeaLSpeak(string meal, int count = 1, int IntervalTime = 1000) | |||
{ | |||
m_SystemPlayWav(@"Vioce\电子提示音.wav"); | |||
Thread.Sleep(1000); | |||
for (int m = 0; m < count; m++) | |||
{ | |||
m_SystemPlayWav(@"Vioce\请.wav"); | |||
Thread.Sleep(500); | |||
for (int i = 0; i < meal.Length; i++) | |||
{ | |||
string name = meal.Substring(i, 1); | |||
m_SystemPlayWav($"Vioce\\{name}.wav"); | |||
Thread.Sleep(500); | |||
} | |||
m_SystemPlayWav(@"Vioce\号用户取餐.wav"); | |||
Thread.Sleep(1500 + IntervalTime); | |||
} | |||
} | |||
} | |||
} |
@@ -21,7 +21,7 @@ | |||
</Window.DataContext> | |||
<Window.Resources> | |||
<!--#region 静态资源--> | |||
<ImageBrush x:Key="leftImage" ImageSource="../../Image/leftImage.png" /> | |||
@@ -376,33 +376,33 @@ | |||
<ControlTemplate TargetType="ToggleButton"> | |||
<Grid Cursor="Hand"> | |||
<Border | |||
x:Name="bd1" | |||
Width="25" | |||
Height="13" | |||
Margin="0,-10,-5,0" | |||
HorizontalAlignment="Right" | |||
VerticalAlignment="Top" | |||
Panel.ZIndex="100" | |||
Background="#2600CAFF" | |||
CornerRadius="3" | |||
Cursor="Hand" | |||
Visibility="Collapsed"> | |||
x:Name="bd1" | |||
Width="25" | |||
Height="13" | |||
Margin="0,-10,-5,0" | |||
HorizontalAlignment="Right" | |||
VerticalAlignment="Top" | |||
Panel.ZIndex="100" | |||
Background="#2600CAFF" | |||
CornerRadius="3" | |||
Cursor="Hand" | |||
Visibility="Collapsed"> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
FontSize="8" | |||
Foreground="#FF00E6F7" | |||
Text="{Binding ListNum, Mode=TwoWay}" /> | |||
HorizontalAlignment="Center" | |||
FontSize="8" | |||
Foreground="#FF00E6F7" | |||
Text="{Binding ListNum, Mode=TwoWay}" /> | |||
<!-- --> | |||
</Border> | |||
<Image | |||
x:Name="image1" | |||
Width="{TemplateBinding Width}" | |||
Height="{TemplateBinding Height}" | |||
Panel.ZIndex="0" | |||
RenderOptions.BitmapScalingMode="HighQuality" | |||
SnapsToDevicePixels="True" | |||
Source="/BPASmartClient.CustomResource;component/Image/告警/无告警.png" | |||
UseLayoutRounding="True" /> | |||
x:Name="image1" | |||
Width="{TemplateBinding Width}" | |||
Height="{TemplateBinding Height}" | |||
Panel.ZIndex="0" | |||
RenderOptions.BitmapScalingMode="HighQuality" | |||
SnapsToDevicePixels="True" | |||
Source="/BPASmartClient.CustomResource;component/Image/告警/无告警.png" | |||
UseLayoutRounding="True" /> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsChecked" Value="true"> | |||
@@ -581,12 +581,13 @@ | |||
</Grid.RowDefinitions> | |||
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal"> | |||
<ToggleButton | |||
Margin="0,0,8,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Cursor="Hand" | |||
IsChecked="{Binding IsAlarm}" | |||
Style="{DynamicResource StatusBtnStyle告警}" | |||
ToolTip="心跳检测报警" Margin="0,0,8,0"/> | |||
ToolTip="心跳检测报警" /> | |||
<CheckBox | |||
Margin="5,0,8,0" | |||
Content="开机启动" | |||
@@ -0,0 +1,340 @@ | |||
<UserControl | |||
x:Class="BPASmartClient.CustomResource.Pages.View.RecipeCompleteView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.CustomResource.Pages.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel" | |||
d:DesignHeight="450" | |||
d:DesignWidth="800" | |||
mc:Ignorable="d"> | |||
<UserControl.DataContext> | |||
<vm:RecipeCompleteViewModel /> | |||
</UserControl.DataContext> | |||
<UserControl.Resources> | |||
<ResourceDictionary> | |||
<ResourceDictionary.MergedDictionaries> | |||
<ResourceDictionary> | |||
<!--<convert:TextDisplayConvert x:Key="textDisplayConvert" /> | |||
<convert:IsEnableConvert x:Key="isEnableConvert" /> | |||
<convert:AnalogAlarmConvert x:Key="analogAlarmConvert" /> | |||
<convert:DiscreteAlarmConvert x:Key="discreteAlarmConvert" /> | |||
<convert:AlarmTypeTextConvert x:Key="alarmTypeTextConvert" />--> | |||
<SolidColorBrush x:Key="BorderSolid" Color="#5523CACA" /> | |||
<SolidColorBrush x:Key="FontColor" Color="#FF2AB2E7" /> | |||
<SolidColorBrush x:Key="TitleFontColor" Color="#FF2AB2E7" /> | |||
<SolidColorBrush x:Key="CursorColor" Color="Aqua" /> | |||
<SolidColorBrush x:Key="TitleBorderColor" Color="#332AB2E7" /> | |||
<Style x:Key="TextBlockStyle" TargetType="TextBlock"> | |||
<Setter Property="FontFamily" Value="楷体" /> | |||
<Setter Property="FontSize" Value="18" /> | |||
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" /> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
<Setter Property="HorizontalAlignment" Value="Center" /> | |||
</Style> | |||
<Style x:Key="TextBoxStyle" TargetType="TextBox"> | |||
<Setter Property="FontFamily" Value="楷体" /> | |||
<Setter Property="FontSize" Value="22" /> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" /> | |||
<Setter Property="BorderBrush" Value="#FF23CACA" /> | |||
<Setter Property="CaretBrush" Value="Aqua" /> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
</Style> | |||
<Style x:Key="DataTextBlockStyle" TargetType="TextBlock"> | |||
<Setter Property="HorizontalAlignment" Value="Center" /> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="Foreground" Value="#FF2BD06F" /> | |||
<Setter Property="FontSize" Value="14" /> | |||
</Style> | |||
<ControlTemplate x:Key="ButTemplate" TargetType="Button"> | |||
<Border | |||
x:Name="br" | |||
Background="Transparent" | |||
BorderBrush="#FF19B7EC" | |||
BorderThickness="2"> | |||
<StackPanel | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Orientation="Horizontal"> | |||
<ContentControl | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Content="{TemplateBinding Content}" | |||
Foreground="{TemplateBinding Foreground}" /> | |||
</StackPanel> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter TargetName="br" Property="Background" Value="#2219B7EC" /> | |||
</Trigger> | |||
<Trigger Property="IsPressed" Value="true"> | |||
<Setter TargetName="br" Property="Background" Value="#2219B7EC" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</ResourceDictionary> | |||
</ResourceDictionary.MergedDictionaries> | |||
</ResourceDictionary> | |||
</UserControl.Resources> | |||
<Grid Margin="10"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="50" /> | |||
<RowDefinition Height="30" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<StackPanel | |||
Margin="0,8" | |||
HorizontalAlignment="Right" | |||
Orientation="Horizontal"> | |||
<DatePicker | |||
Background="Transparent" | |||
BorderBrush="#aa3aa7f3" | |||
BorderThickness="2" | |||
SelectedDate="{Binding StartDateTime}" | |||
Style="{StaticResource PickerStyle}" | |||
Text="请输入开始时间" | |||
Visibility="{Binding IsVisibility}" /> | |||
<DatePicker | |||
Margin="20,0,20,0" | |||
Background="Transparent" | |||
BorderBrush="#aa3aa7f3" | |||
BorderThickness="2" | |||
SelectedDate="{Binding EndDateTime}" | |||
Style="{StaticResource PickerStyle}" | |||
Text="请输入结束时间" | |||
Visibility="{Binding IsVisibility}" /> | |||
<Button | |||
Width="140" | |||
Height="30" | |||
Background="#FF19B7EC" | |||
Command="{Binding ControlCommand}" | |||
Content="{Binding ControlButText}" | |||
FontFamily="楷体" | |||
FontSize="18" | |||
Template="{StaticResource ButTemplate}" | |||
Visibility="{Binding IsVisibility}"> | |||
<Button.Foreground> | |||
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> | |||
<GradientStop Color="#FFBB662A" /> | |||
<GradientStop Offset="1" Color="White" /> | |||
</LinearGradientBrush> | |||
</Button.Foreground> | |||
</Button> | |||
<Button | |||
Width="140" | |||
Height="30" | |||
Margin="20,0,0,0" | |||
Background="#FF19B7EC" | |||
Command="{Binding SwitchCommand}" | |||
Content="{Binding ButContent}" | |||
FontFamily="楷体" | |||
FontSize="18" | |||
Template="{StaticResource ButTemplate}"> | |||
<Button.Foreground> | |||
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> | |||
<GradientStop Color="#FFBB662A" /> | |||
<GradientStop Offset="1" Color="White" /> | |||
</LinearGradientBrush> | |||
</Button.Foreground> | |||
</Button> | |||
</StackPanel> | |||
<!--#region 表格标题栏设置--> | |||
<Grid | |||
Grid.Row="1" | |||
Margin="0,0,17,0" | |||
Background="#ff0C255F"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.2*" /> | |||
<ColumnDefinition Width="0.2*" /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="日期" /> | |||
<Grid Grid.Column="1"> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="时间" /> | |||
<Border | |||
BorderBrush="{StaticResource TitleBorderColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="2" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="配方名称" /> | |||
<!--<Grid Grid.Column="3"> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="报警信息" /> | |||
<Border | |||
BorderBrush="{StaticResource TitleBorderColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid>--> | |||
<!--<TextBlock | |||
Grid.Column="4" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="报警值" /> | |||
<Grid Grid.Column="5"> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="报警等级" /> | |||
<Border | |||
BorderBrush="{StaticResource TitleBorderColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid>--> | |||
</Grid> | |||
<!--#endregion--> | |||
<!--#region 表格数据显示--> | |||
<ScrollViewer | |||
Grid.Row="2" | |||
HorizontalScrollBarVisibility="Hidden" | |||
VerticalScrollBarVisibility="Visible"> | |||
<Grid> | |||
<!--#region 实时报警信息--> | |||
<ItemsControl ItemsSource="{Binding Log}" Visibility="{Binding CurrentDataVis}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid x:Name="gr" Height="30"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.2*" /> | |||
<ColumnDefinition Width="0.2*" /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="0" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding Date}" /> | |||
<Grid Grid.Column="1"> | |||
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Time}" /> | |||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="2" | |||
Margin="10,0,0,0" | |||
HorizontalAlignment="Left" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding RunLogInfo}" | |||
TextWrapping="Wrap" /> | |||
<Border | |||
Grid.ColumnSpan="6" | |||
BorderBrush="{StaticResource BorderSolid}" | |||
BorderThickness="1" /> | |||
</Grid> | |||
<DataTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" /> | |||
</Trigger> | |||
</DataTemplate.Triggers> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
<!--#endregion--> | |||
<!--#region 历史报警信息--> | |||
<ItemsControl ItemsSource="{Binding HistoryRunLog}" Visibility="{Binding HistoryDataVis}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid x:Name="gr" Height="30"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.2*" /> | |||
<ColumnDefinition Width="0.2*" /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="0" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding Date}" /> | |||
<Grid Grid.Column="1"> | |||
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Time}" /> | |||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="2" | |||
Margin="10,0,0,0" | |||
HorizontalAlignment="Left" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding RunLogInfo}" /> | |||
<Border | |||
Grid.ColumnSpan="6" | |||
BorderBrush="{StaticResource BorderSolid}" | |||
BorderThickness="1" /> | |||
</Grid> | |||
<DataTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" /> | |||
</Trigger> | |||
</DataTemplate.Triggers> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
<!--#endregion--> | |||
</Grid> | |||
</ScrollViewer> | |||
<!--#endregion--> | |||
</Grid> | |||
</UserControl> |
@@ -0,0 +1,28 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using System.Windows.Controls; | |||
using System.Windows.Data; | |||
using System.Windows.Documents; | |||
using System.Windows.Input; | |||
using System.Windows.Media; | |||
using System.Windows.Media.Imaging; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
namespace BPASmartClient.CustomResource.Pages.View | |||
{ | |||
/// <summary> | |||
/// RecipeCompleteView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class RecipeCompleteView : UserControl | |||
{ | |||
public RecipeCompleteView() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -54,7 +54,6 @@ | |||
<Setter Property="Foreground" Value="#FF2BD06F" /> | |||
<Setter Property="FontSize" Value="14" /> | |||
</Style> | |||
<ControlTemplate x:Key="ButTemplate" TargetType="Button"> | |||
<Border | |||
x:Name="br" | |||
@@ -158,10 +157,14 @@ | |||
</StackPanel> | |||
<!--#region 表格标题栏设置--> | |||
<Grid Grid.Row="1" Background="#ff0C255F"> | |||
<Grid | |||
Grid.Row="1" | |||
Margin="0,0,17,0" | |||
Background="#ff0C255F"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.2*" /> | |||
<ColumnDefinition Width="0.2*" /> | |||
<ColumnDefinition Width="150" /> | |||
<ColumnDefinition Width="150" /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
@@ -227,112 +230,172 @@ | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid>--> | |||
</Grid> | |||
<!--#endregion--> | |||
<!--#region 表格数据显示--> | |||
<ScrollViewer | |||
<!--<ScrollViewer | |||
Grid.Row="2" | |||
HorizontalScrollBarVisibility="Hidden" | |||
VerticalScrollBarVisibility="Hidden"> | |||
<Grid> | |||
<!--#region 实时报警信息--> | |||
<ItemsControl ItemsSource="{Binding Log}" Visibility="{Binding CurrentDataVis}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid x:Name="gr" Height="30"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.2*" /> | |||
<ColumnDefinition Width="0.2*" /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="0" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding Date}" /> | |||
<Grid Grid.Column="1"> | |||
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Time}" /> | |||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="2" | |||
Margin="10,0,0,0" | |||
HorizontalAlignment="Left" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding RunLogInfo}" | |||
TextWrapping="Wrap"/> | |||
<Border | |||
Grid.ColumnSpan="6" | |||
BorderBrush="{StaticResource BorderSolid}" | |||
BorderThickness="1" /> | |||
VerticalScrollBarVisibility="Visible">--> | |||
<Grid Grid.Row="2"> | |||
<!--#region 实时报警信息--> | |||
<ItemsControl | |||
ItemsSource="{Binding Log}" | |||
ScrollViewer.CanContentScroll="True" | |||
VirtualizingStackPanel.IsVirtualizing="True" | |||
Visibility="{Binding CurrentDataVis}"> | |||
<ItemsControl.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<VirtualizingStackPanel /> | |||
</ItemsPanelTemplate> | |||
</ItemsControl.ItemsPanel> | |||
<ItemsControl.Template> | |||
<ControlTemplate> | |||
<Border | |||
Padding="{TemplateBinding Control.Padding}" | |||
Background="{TemplateBinding Panel.Background}" | |||
BorderBrush="{TemplateBinding Border.BorderBrush}" | |||
BorderThickness="{TemplateBinding Border.BorderThickness}" | |||
SnapsToDevicePixels="True"> | |||
<ScrollViewer Padding="{TemplateBinding Control.Padding}" Focusable="False"> | |||
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" /> | |||
</ScrollViewer> | |||
</Border> | |||
</ControlTemplate> | |||
</ItemsControl.Template> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid x:Name="gr" MinHeight="30"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="150" /> | |||
<ColumnDefinition Width="150" /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="0" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding Date}" /> | |||
<Grid Grid.Column="1"> | |||
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Time}" /> | |||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<DataTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" /> | |||
</Trigger> | |||
</DataTemplate.Triggers> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
<!--#endregion--> | |||
<!--#region 历史报警信息--> | |||
<ItemsControl ItemsSource="{Binding HistoryRunLog}" Visibility="{Binding HistoryDataVis}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid x:Name="gr" Height="30"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.2*" /> | |||
<ColumnDefinition Width="0.2*" /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="0" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding Date}" /> | |||
<Grid Grid.Column="1"> | |||
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Time}" /> | |||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="2" | |||
Margin="10,0,0,0" | |||
HorizontalAlignment="Left" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding RunLogInfo}" /> | |||
<Border | |||
Grid.ColumnSpan="6" | |||
BorderBrush="{StaticResource BorderSolid}" | |||
BorderThickness="1" /> | |||
<TextBlock | |||
Grid.Column="2" | |||
Margin="10,0,0,0" | |||
HorizontalAlignment="Left" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding RunLogInfo}" | |||
TextWrapping="Wrap" /> | |||
<Border | |||
Grid.ColumnSpan="6" | |||
BorderBrush="{StaticResource BorderSolid}" | |||
BorderThickness="1" /> | |||
</Grid> | |||
<DataTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" /> | |||
</Trigger> | |||
</DataTemplate.Triggers> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
<!--#endregion--> | |||
<!--#region 历史报警信息--> | |||
<ItemsControl | |||
ItemsSource="{Binding HistoryRunLog}" | |||
ScrollViewer.CanContentScroll="True" | |||
VirtualizingStackPanel.IsVirtualizing="True" | |||
Visibility="{Binding HistoryDataVis}"> | |||
<ItemsControl.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<VirtualizingStackPanel /> | |||
</ItemsPanelTemplate> | |||
</ItemsControl.ItemsPanel> | |||
<ItemsControl.Template> | |||
<ControlTemplate> | |||
<Border | |||
Padding="{TemplateBinding Control.Padding}" | |||
Background="{TemplateBinding Panel.Background}" | |||
BorderBrush="{TemplateBinding Border.BorderBrush}" | |||
BorderThickness="{TemplateBinding Border.BorderThickness}" | |||
SnapsToDevicePixels="True"> | |||
<ScrollViewer Padding="{TemplateBinding Control.Padding}" Focusable="False"> | |||
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" /> | |||
</ScrollViewer> | |||
</Border> | |||
</ControlTemplate> | |||
</ItemsControl.Template> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid x:Name="gr" MinHeight="30"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="150" /> | |||
<ColumnDefinition Width="150" /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="0" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding Date}" /> | |||
<Grid Grid.Column="1"> | |||
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Time}" /> | |||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<DataTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" /> | |||
</Trigger> | |||
</DataTemplate.Triggers> | |||
<TextBlock | |||
Grid.Column="2" | |||
Margin="10,0,0,0" | |||
HorizontalAlignment="Left" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding RunLogInfo}" /> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
<!--#endregion--> | |||
</Grid> | |||
</ScrollViewer> | |||
<Border | |||
Grid.ColumnSpan="6" | |||
BorderBrush="{StaticResource BorderSolid}" | |||
BorderThickness="1" /> | |||
</Grid> | |||
<DataTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" /> | |||
</Trigger> | |||
</DataTemplate.Triggers> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
<!--#endregion--> | |||
</Grid> | |||
<!--</ScrollViewer>--> | |||
<!--#endregion--> | |||
</Grid> | |||
@@ -240,7 +240,7 @@ | |||
</StackPanel> | |||
<!--#region 表格标题栏设置--> | |||
<Grid Grid.Row="1" Background="#ff0C255F"> | |||
<Grid Grid.Row="1" Margin="0 0 17 0" Background="#ff0C255F"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.3*" /> | |||
<ColumnDefinition Width="0.3*" /> | |||
@@ -310,7 +310,7 @@ | |||
<ScrollViewer | |||
Grid.Row="2" | |||
HorizontalScrollBarVisibility="Hidden" | |||
VerticalScrollBarVisibility="Hidden"> | |||
VerticalScrollBarVisibility="Visible"> | |||
<Grid> | |||
<!--#region 实时报警信息--> | |||
@@ -0,0 +1,126 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using System.Collections.ObjectModel; | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
using System.Windows; | |||
using BPASmartClient.Helper; | |||
namespace BPASmartClient.CustomResource.Pages.ViewModel | |||
{ | |||
public class RecipeCompleteViewModel : ObservableObject | |||
{ | |||
public RecipeCompleteViewModel() | |||
{ | |||
Sqlite<RecipeCompleteLog>.GetInstance.Save(); | |||
SwitchCommand = new RelayCommand(() => | |||
{ | |||
if (ButContent == "历史日志") | |||
{ | |||
GetHistoryRunLog(); | |||
CurrentDataVis = Visibility.Hidden; | |||
HistoryDataVis = Visibility.Visible; | |||
IsVisibility = Visibility.Visible; | |||
ControlButText = "开始查询"; | |||
ButContent = "实时日志"; | |||
return; | |||
} | |||
if (ButContent == "实时日志") | |||
{ | |||
HistoryDataVis = Visibility.Hidden; | |||
CurrentDataVis = Visibility.Visible; | |||
IsVisibility = Visibility.Hidden; | |||
ButContent = "历史日志"; | |||
return; | |||
} | |||
}); | |||
ControlCommand = new RelayCommand(() => | |||
{ | |||
if (ControlButText == "报警复位") return; | |||
if (ControlButText == "开始查询") | |||
{ | |||
var lists = Sqlite<RecipeCompleteLog>.GetInstance.GetData(); | |||
var res = lists.Where(p => Convert.ToDateTime(p.Date) >= StartDateTime && Convert.ToDateTime(p.Date) <= EndDateTime).ToList(); | |||
if (res != null) | |||
{ | |||
HistoryRunLog.Clear(); | |||
foreach (var item in res) | |||
{ | |||
HistoryRunLog.Add(item); | |||
} | |||
} | |||
} | |||
}); | |||
} | |||
private void GetHistoryRunLog() | |||
{ | |||
var data = Sqlite<RecipeCompleteLog>.GetInstance.GetData(); | |||
if (data != null) | |||
{ | |||
HistoryRunLog.Clear(); | |||
foreach (var item in data) | |||
{ | |||
int day = DateTime.Now.Subtract(Convert.ToDateTime(item.Date)).Days; | |||
if (day == 0) | |||
{ | |||
HistoryRunLog.Add(item); | |||
} | |||
} | |||
} | |||
} | |||
public RelayCommand SwitchCommand { get; set; } | |||
public RelayCommand ControlCommand { get; set; } | |||
public Visibility CurrentDataVis { get { return _mCurrentDataVis; } set { _mCurrentDataVis = value; OnPropertyChanged(); } } | |||
private Visibility _mCurrentDataVis = Visibility.Visible; | |||
public Visibility HistoryDataVis { get { return _mHistoryDataVis; } set { _mHistoryDataVis = value; OnPropertyChanged(); } } | |||
private Visibility _mHistoryDataVis = Visibility.Hidden; | |||
/// <summary> | |||
/// 是否显示 | |||
/// </summary> | |||
public Visibility IsVisibility { get { return _mIsVisibility; } set { _mIsVisibility = value; OnPropertyChanged(); } } | |||
private Visibility _mIsVisibility = Visibility.Hidden; | |||
/// <summary> | |||
/// 文字显示 | |||
/// </summary> | |||
public string ButContent { get { return _mButContent; } set { _mButContent = value; OnPropertyChanged(); } } | |||
private string _mButContent = "历史日志"; | |||
/// <summary> | |||
/// 控制按钮文本显示 | |||
/// </summary> | |||
public string ControlButText { get { return _mControlButText; } set { _mControlButText = value; OnPropertyChanged(); } } | |||
private string _mControlButText = "报警复位"; | |||
/// <summary> | |||
/// 开始时间 | |||
/// </summary> | |||
public DateTime StartDateTime { get { return _mStartDateTime; } set { _mStartDateTime = value; OnPropertyChanged(); } } | |||
private DateTime _mStartDateTime = DateTime.Now; | |||
/// <summary> | |||
/// 结束时间 | |||
/// </summary> | |||
public DateTime EndDateTime { get { return _mEndDateTime; } set { _mEndDateTime = value; OnPropertyChanged(); } } | |||
private DateTime _mEndDateTime = DateTime.Now; | |||
public ObservableCollection<RecipeCompleteLog> HistoryRunLog { get; set; } = new ObservableCollection<RecipeCompleteLog>(); | |||
public ObservableCollection<RecipeCompleteLog> Log { get; set; } = MessageNotify.GetInstance.recipeLogs; | |||
} | |||
} |
@@ -9,6 +9,7 @@ using System.Collections.ObjectModel; | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
using System.Windows; | |||
using BPASmartClient.Helper; | |||
using System.Diagnostics; | |||
namespace BPASmartClient.CustomResource.Pages.ViewModel | |||
{ | |||
@@ -67,15 +68,23 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel | |||
var data = Sqlite<RunLog>.GetInstance.GetData(); | |||
if (data != null) | |||
{ | |||
HistoryRunLog.Clear(); | |||
foreach (var item in data) | |||
var res = data.Where(p => p.Date == DateTime.Now.ToString("yyyy-MM-dd")).ToList(); | |||
if (res != null) | |||
{ | |||
int day = DateTime.Now.Subtract(Convert.ToDateTime(item.Date)).Days; | |||
if (day == 0) | |||
HistoryRunLog.Clear(); | |||
res.ForEach(item => | |||
{ | |||
HistoryRunLog.Add(item); | |||
} | |||
}); | |||
} | |||
//foreach (var item in data) | |||
//{ | |||
// int day = DateTime.Now.Subtract(Convert.ToDateTime(item.Date)).Days; | |||
// if (day == 0) | |||
// { | |||
// HistoryRunLog.Add(item); | |||
// } | |||
//} | |||
} | |||
} | |||
@@ -106,7 +115,7 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel | |||
/// </summary> | |||
public string ControlButText { get { return _mControlButText; } set { _mControlButText = value; OnPropertyChanged(); } } | |||
private string _mControlButText = "报警复位"; | |||
/// <summary> | |||
/// 开始时间 | |||
/// </summary> | |||
@@ -122,5 +131,7 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel | |||
public ObservableCollection<RunLog> HistoryRunLog { get; set; } = new ObservableCollection<RunLog>(); | |||
public ObservableCollection<RunLog> Log { get; set; } = MessageNotify.GetInstance.runLogs; | |||
} | |||
} |
@@ -83,7 +83,7 @@ | |||
Duration="0:0:20" /> | |||
</Storyboard> | |||
</VisualState> | |||
<VisualState Name="Stop" /> | |||
<!--<VisualState Name="Stop" />--> | |||
</VisualStateGroup> | |||
<VisualStateGroup Name="DirectionGroup"> | |||
<VisualState Name="LeftState"> | |||
@@ -96,6 +96,7 @@ | |||
Duration="0:0:20" /> | |||
</Storyboard> | |||
</VisualState> | |||
<VisualState Name="Stop" /> | |||
<VisualState Name="RightState"> | |||
<Storyboard RepeatBehavior="Forever"> | |||
<DoubleAnimation | |||
@@ -37,7 +37,22 @@ namespace BPASmartClient.CustomResource.UserControls | |||
private static void OnRunningChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) | |||
{ | |||
VisualStateManager.GoToState(d as ConveyBelt2, (bool)e.NewValue ? "RunState" : "Stop", false); | |||
string status = "Stop"; | |||
if ((bool)e.NewValue) | |||
{ | |||
if ((d as ConveyBelt2)?.BeltDirection == 0) | |||
{ | |||
VisualStateManager.GoToState(d as ConveyBelt2, "RightState", false); | |||
return; | |||
} | |||
else | |||
{ | |||
VisualStateManager.GoToState(d as ConveyBelt2, "LeftState", false); | |||
return; | |||
} | |||
} | |||
VisualStateManager.GoToState(d as ConveyBelt2, status, false); | |||
//VisualStateManager.GoToState(d as ConveyBelt2, (bool)e.NewValue ? "RunState" : "Stop", false); | |||
} | |||
public double BeltWidth | |||
@@ -59,7 +74,7 @@ namespace BPASmartClient.CustomResource.UserControls | |||
if (BeltHeight > 100) | |||
{ | |||
pathFigure.StartPoint = new Point(0, 35 + (BeltHeight - 100) / 2); | |||
pathFigure.Segments.Add(new LineSegment(new Point(BeltWidth - 10, 35 + (BeltHeight - 100)/2), true)); | |||
pathFigure.Segments.Add(new LineSegment(new Point(BeltWidth - 10, 35 + (BeltHeight - 100) / 2), true)); | |||
} | |||
else | |||
{ | |||
@@ -74,7 +89,7 @@ namespace BPASmartClient.CustomResource.UserControls | |||
{ | |||
this.recDown.Margin = new Thickness(0, BeltHeight - 20, 0, 0); | |||
} | |||
else | |||
else | |||
{ | |||
this.recDown.Margin = new Thickness(0, 80, 0, 0); | |||
} | |||
@@ -115,15 +130,29 @@ namespace BPASmartClient.CustomResource.UserControls | |||
private static void OnDirectionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) | |||
{ | |||
if ((d as ConveyBelt2)?.BeltDirection == 0) | |||
{ | |||
VisualStateManager.GoToState(d as ConveyBelt2, "RightState", false); | |||
} | |||
else | |||
string status = "Stop"; | |||
if ((d as ConveyBelt2).IsRun) | |||
{ | |||
VisualStateManager.GoToState(d as ConveyBelt2, "LeftState", false); | |||
if ((d as ConveyBelt2)?.BeltDirection == 0) | |||
{ | |||
VisualStateManager.GoToState(d as ConveyBelt2, "RightState", false); | |||
return; | |||
} | |||
else | |||
{ | |||
VisualStateManager.GoToState(d as ConveyBelt2, "LeftState", false); | |||
return; | |||
} | |||
} | |||
VisualStateManager.GoToState(d as ConveyBelt2, status, false); | |||
//if ((d as ConveyBelt2)?.BeltDirection == 0) | |||
//{ | |||
// VisualStateManager.GoToState(d as ConveyBelt2, "RightState", false); | |||
//} | |||
//else | |||
//{ | |||
// VisualStateManager.GoToState(d as ConveyBelt2, "LeftState", false); | |||
//} | |||
} | |||
} | |||
@@ -7,7 +7,8 @@ | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<PackageReference Include="BPA.Message" Version="1.0.84" /> | |||
<PackageReference Include="BPA.Message" Version="1.0.86" /> | |||
<PackageReference Include="Microsoft.CognitiveServices.Speech" Version="1.27.0" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
@@ -104,7 +104,7 @@ namespace BPASmartClient.Device | |||
/// </summary> | |||
protected ConcurrentDictionary<string, object> peripheralStatus = new ConcurrentDictionary<string, object>(); | |||
protected | |||
protected | |||
/// <summary> | |||
/// 外设设备集合 | |||
@@ -122,6 +122,7 @@ namespace BPASmartClient.Device | |||
public IAlarm InterfaceAlarm { get; set; } | |||
public AlarmHelper alarmHelper { get; set; } = new AlarmHelper(); | |||
public IStatus InterfaceStatus { get; set; } | |||
public ObservableCollection<Variable> variables { get; set; } = new ObservableCollection<Variable>(); | |||
#endregion | |||
@@ -145,7 +146,7 @@ namespace BPASmartClient.Device | |||
/// </summary> | |||
/// <param name="address"></param> | |||
/// <param name="value"></param> | |||
public void WriteControlExact(string address, object value,int i) | |||
public void WriteControlExact(string address, object value, int i) | |||
{ | |||
if (peripherals != null) | |||
{ | |||
@@ -205,7 +206,7 @@ namespace BPASmartClient.Device | |||
Status.Update($"{TypeName}.{key}", peripheral.GetAllStatus()[key]); | |||
} | |||
} | |||
if(dicPort2peripheralStatus.ContainsKey(i)) | |||
if (dicPort2peripheralStatus.ContainsKey(i)) | |||
{ | |||
dicPort2peripheralStatus[i] = newPeripheralStatus; | |||
} | |||
@@ -361,6 +362,7 @@ namespace BPASmartClient.Device | |||
{ | |||
ThreadManage.GetInstance().StopTask($"GvlStatusMonitor:{DeviceId}", new Action(() => | |||
{ | |||
ActionManage.GetInstance.Send("ClearOrders"); | |||
ResetProgram(); | |||
ResetStatus(); | |||
InitTask(); | |||
@@ -380,7 +382,7 @@ namespace BPASmartClient.Device | |||
{ | |||
ReadData(); | |||
Thread.Sleep(10); | |||
}), $"ReadData:{DeviceId}",true); | |||
}), $"ReadData:{DeviceId}", true); | |||
#endregion | |||
#region 任务流程 | |||
@@ -62,6 +62,8 @@ namespace BPASmartClient.Device | |||
/// </summary> | |||
ObservableCollection<VariableMonitor> variableMonitors { get; set; } | |||
ObservableCollection<Variable> variables { get; set; } | |||
/// <summary> | |||
/// 设备报警信息集合 | |||
/// </summary> | |||
@@ -0,0 +1,72 @@ | |||
using Microsoft.CognitiveServices.Speech; | |||
using Microsoft.CognitiveServices.Speech.Audio; | |||
using System; | |||
using System.Runtime.InteropServices; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.IO; | |||
using System.Diagnostics; | |||
namespace BPASmartClient.Device | |||
{ | |||
public class Speech | |||
{ | |||
public static uint SND_ASYNC = 0x0001; | |||
public static uint SND_FILENAME = 0x0002; | |||
[DllImport("winmm.dll", CharSet = CharSet.Auto)] | |||
public static extern int mciSendString(string m_strCmd, string m_strReceive, int m_v1, int m_v2); | |||
[DllImport("Kernel32", CharSet = CharSet.Auto)] | |||
public static extern Int32 GetShortPathName(string path, StringBuilder shortPath, Int32 shortPathLength); | |||
private volatile static Speech _Instance; | |||
public static Speech GetInstance => _Instance ?? (_Instance = new Speech()); | |||
private Speech() { } | |||
/// <summary> | |||
/// 播放语音 | |||
/// </summary> | |||
/// <param name="SpeakText"></param> | |||
public void Speak(string SpeakText) | |||
{ | |||
string path = $"{AppDomain.CurrentDomain.BaseDirectory}Sound";//设置音频文件保存路径 | |||
Directory.CreateDirectory(path); | |||
string SpeakPath = $"{path}\\{SpeakText}.wav"; | |||
SpeakPath = SpeakPath.Replace(' ', '_'); | |||
if (!File.Exists(SpeakPath)) | |||
{ | |||
var res = SynthesizeAudioAsync(SpeakText, SpeakPath); | |||
} | |||
StringBuilder shortPath = new StringBuilder(200); | |||
int result = GetShortPathName(SpeakPath, shortPath, shortPath.Capacity); | |||
string shortName = shortPath.ToString(); | |||
mciSendString(@"close all", null, 0, 0); | |||
mciSendString(@"open " + shortName + " alias song", null, 0, 0); | |||
mciSendString(@"play song", null, 0, 0); | |||
//return "22"; | |||
} | |||
/// <summary> | |||
/// 文字转音频 | |||
/// </summary> | |||
/// <param name="text"></param> | |||
/// <returns></returns> | |||
private string SynthesizeAudioAsync(string text, string path) | |||
{ | |||
var config = SpeechConfig.FromSubscription("b88f6907c8f64075a6169dc4d7dff65a", "chinanorth2"); | |||
config.SpeechSynthesisLanguage = "zh-CN"; //config.SpeechSynthesisVoiceName = ""; | |||
using var audioConfig = AudioConfig.FromWavFileOutput(path); | |||
using var synthesizer = new SpeechSynthesizer(config, audioConfig); | |||
synthesizer.SpeakTextAsync(text).Wait(); | |||
//await Task.Delay(TimeSpan.FromSeconds(2)); | |||
return "1"; | |||
} | |||
} | |||
} |
@@ -1,4 +1,5 @@ | |||
using System; | |||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion.Internal; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
@@ -17,10 +18,42 @@ namespace BPASmartClient.Device | |||
public VariableMonitorAttribute(string Notes, string PLCAddress = "", string ModbusTcpAddress = "") | |||
{ | |||
this.PLCAddress = PLCAddress; | |||
this.ModbusTcpAddress = ModbusTcpAddress; | |||
this.ModbusTcpAddress = GetModbusTcpAdd(PLCAddress);// ModbusTcpAddress; | |||
this.Notes = Notes; | |||
} | |||
private string GetModbusTcpAdd(string address) | |||
{ | |||
if (address == null) return ""; | |||
if (address.Length > 0) | |||
{ | |||
address = address.Trim(); | |||
if (address.ToUpper().Contains("M") && address.Length >= 4) | |||
{ | |||
var res = address.Substring(1).Split('.'); | |||
if (res != null && res.Length == 2) | |||
{ | |||
if (int.TryParse(res[0], out int firstAddress) && int.TryParse(res[1], out int ExitAddress)) | |||
{ | |||
if (ExitAddress >= 0 && ExitAddress <= 7) | |||
{ | |||
return ((firstAddress * 8) + 320 + ExitAddress).ToString(); | |||
} | |||
} | |||
} | |||
} | |||
else if ((address.ToUpper().Contains("VW") || address.ToUpper().Contains("VD")) && address.Length >= 3) | |||
{ | |||
var res = address.Substring(2); | |||
if (res != null && int.TryParse(res, out int tempAddress)) | |||
{ | |||
return ((tempAddress / 2) + 100).ToString(); | |||
} | |||
} | |||
} | |||
return ""; | |||
} | |||
/// <summary> | |||
/// PLC 地址 | |||
/// </summary> | |||
@@ -1,4 +1,5 @@ | |||
<Application x:Class="BPASmartClient.DosingSystemSingle.App" | |||
<Application | |||
x:Class="BPASmartClient.DosingSystemSingle.App" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:con="clr-namespace:BPASmartClient.CustomResource.Converters;assembly=BPASmartClient.CustomResource" | |||
@@ -16,8 +16,8 @@ | |||
</ItemGroup> | |||
<ItemGroup> | |||
<PackageReference Include="BPA.Helper" Version="1.0.33" /> | |||
<PackageReference Include="BPA.Message" Version="1.0.84" /> | |||
<PackageReference Include="BPA.Helper" Version="1.0.54" /> | |||
<PackageReference Include="BPA.Message" Version="1.0.86" /> | |||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> | |||
</ItemGroup> | |||
@@ -0,0 +1,37 @@ | |||
<Application | |||
x:Class="BPASmartClient.FoodStationTest.App" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:con="clr-namespace:BPASmartClient.CustomResource.Converters;assembly=BPASmartClient.CustomResource" | |||
xmlns:local="clr-namespace:BPASmartClient.FoodStationTest"> | |||
<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,335 @@ | |||
using BPASmartClient.CustomResource.Pages.Enums; | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
using BPASmartClient.CustomResource.Pages.View; | |||
using BPASmartClient.FoodStationTest.Model; | |||
using BPASmartClient.Helper; | |||
using System; | |||
using System.Collections.ObjectModel; | |||
using System.Threading; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
namespace BPASmartClient.FoodStationTest | |||
{ | |||
/// <summary> | |||
/// Interaction logic for App.xaml | |||
/// </summary> | |||
public partial class App : Application | |||
{ | |||
public static Window MainWindow; | |||
public EventWaitHandle ProgramStarted { get; set; } | |||
protected override void OnStartup(StartupEventArgs e) | |||
{ | |||
bool createNew; | |||
ProgramStarted = new EventWaitHandle(false, EventResetMode.AutoReset, "SmallStationApp", out createNew); | |||
if (!createNew) | |||
{ | |||
MessageBox.Show("程序已启动"); | |||
App.Current.Shutdown(); | |||
Environment.Exit(0); | |||
} | |||
BPASmartClient.Helper.SystemHelper.GetInstance.CreateDesktopShortcut(); | |||
base.OnStartup(e); | |||
MenuInit(); | |||
DataInit(); | |||
Init(); | |||
MainView mv = new MainView(); | |||
//TODO:修改软件名称。 | |||
mv.TitleName = "自动化产线-上位机控制系统"; | |||
LoginView lv = new LoginView(); | |||
var res = lv.ShowDialog(); | |||
if (res != null && res == true) | |||
{ | |||
MessageNotify.GetInstance.ShowUserLog("用户登录"); | |||
mv.Show(); | |||
} | |||
else | |||
mv.Close(); | |||
GVL_SmallStation.GetInstance.RecipeDosingCompleNum = Json<LocalPar>.Data.RecipeDosingCompleNum; | |||
MainWindow = mv; | |||
} | |||
private async void Init() | |||
{ | |||
await Task.Run(new Action(() => | |||
{ | |||
DeviceInquire.GetInstance.Init();//配料机设备上线监听,设备列表初始化 | |||
ProcessControl.GetInstance.Init(); | |||
})); | |||
} | |||
protected override void OnExit(ExitEventArgs e) | |||
{ | |||
base.OnExit(e); | |||
Json<LocalPar>.Data.RecipeDosingCompleNum = GVL_SmallStation.GetInstance.RecipeDosingCompleNum; | |||
Json<LocalPar>.Save(); | |||
Json<LocalRecipeDataColl>.Save(); | |||
Json<RemoteRecipeDataColl>.Save(); | |||
MessageNotify.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.FoodStationTest", | |||
// ToggleWindowPath = "View.RecipeSettingsView" | |||
//}); | |||
//RecipeManage.Add(new SubMenumodel() | |||
//{ | |||
// SubMenuName = "味魔方配方下发", | |||
// SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员 }, | |||
// AssemblyName = "BPASmartClient.FoodStationTest", | |||
// ToggleWindowPath = "View.RecipeControlView" | |||
//}); | |||
RecipeManage.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "本地配方管理", | |||
SubMenuPermission = new Permission[] { Permission.管理员 }, | |||
AssemblyName = "BPASmartClient.FoodStationTest", | |||
ToggleWindowPath = "View.RecipeReceiveView" | |||
}); | |||
RecipeManage.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "西门子配方管理", | |||
SubMenuPermission = new Permission[] { Permission.管理员 }, | |||
AssemblyName = "BPASmartClient.FoodStationTest", | |||
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.FoodStationTest", | |||
ToggleWindowPath = "View.DeviceMaterialParView" | |||
}); | |||
ParSet.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "系统参数设置", | |||
SubMenuPermission = new Permission[] { Permission.管理员 }, | |||
AssemblyName = "BPASmartClient.FoodStationTest", | |||
ToggleWindowPath = "View.SystemParView" | |||
}); | |||
ParSet.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "原料与料仓管理", | |||
SubMenuPermission = new Permission[] { Permission.管理员 }, | |||
AssemblyName = "BPASmartClient.FoodStationTest", | |||
ToggleWindowPath = "View.StockBinRawMaterialView" | |||
}); | |||
ParSet.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "西门子物料管理", | |||
SubMenuPermission = new Permission[] { Permission.管理员 }, | |||
AssemblyName = "BPASmartClient.FoodStationTest", | |||
ToggleWindowPath = "View.BomOfMaterialView" | |||
}); | |||
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.FoodStationTest", | |||
ToggleWindowPath = "View.ManualControlView" | |||
}); | |||
/*ManualControl.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "手动控制信号", | |||
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 }, | |||
AssemblyName = "BPASmartClient.FoodStationTest", | |||
ToggleWindowPath = "View.ManualCommView" | |||
});*/ | |||
ManualControl.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "手动控制流程", | |||
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 }, | |||
AssemblyName = "BPASmartClient.FoodStationTest", | |||
ToggleWindowPath = "View.ManualFlowView" | |||
}); | |||
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.RecipeCompleteView" | |||
}); | |||
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.技术员 }, | |||
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.FoodStationTest", | |||
ToggleWindowPath = "View.DeviceListView" | |||
}); | |||
DeviceMonitor.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "Plc变量监控", | |||
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 }, | |||
AssemblyName = "BPASmartClient.FoodStationTest", | |||
ToggleWindowPath = "View.PlcVarMonitorView" | |||
}); | |||
DeviceMonitor.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "流程变量监控", | |||
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 }, | |||
AssemblyName = "BPASmartClient.FoodStationTest", | |||
ToggleWindowPath = "View.ProcessMonitorView" | |||
}); | |||
DeviceMonitor.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "设备状态", | |||
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 }, | |||
AssemblyName = "BPASmartClient.FoodStationTest", | |||
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.技术员 }, | |||
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<LocalPar>.Read(); | |||
Json<DevicePar>.Read(); | |||
Json<LocalRecipeDataColl>.Read(); | |||
Json<RemoteRecipeDataColl>.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,92 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<OutputType>WinExe</OutputType> | |||
<TargetFramework>net6.0-windows</TargetFramework> | |||
<Nullable>enable</Nullable> | |||
<UseWPF>true</UseWPF> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<None Remove="hbl.ico" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Content Include="hbl.ico" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<PackageReference Include="BPA.Communication" Version="1.0.105" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\BPASmartClient.CustomResource\BPASmartClient.CustomResource.csproj" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Compile Update="View\BomOfMaterialView.xaml.cs"> | |||
<SubType>Code</SubType> | |||
</Compile> | |||
<Compile Update="View\ManualFlowView.xaml.cs"> | |||
<SubType>Code</SubType> | |||
</Compile> | |||
<Compile Update="View\SelectRecipesView.xaml.cs"> | |||
<SubType>Code</SubType> | |||
</Compile> | |||
<Compile Update="View\StockBinRawMaterialView.xaml.cs"> | |||
<SubType>Code</SubType> | |||
</Compile> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Page Update="View\BomOfMaterialView.xaml"> | |||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | |||
</Page> | |||
<Page Update="View\ChangeDeviceNameView.xaml"> | |||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | |||
</Page> | |||
<Page Update="View\DeviceListView.xaml"> | |||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | |||
</Page> | |||
<Page Update="View\DeviceMaterialParView.xaml"> | |||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | |||
</Page> | |||
<Page Update="View\HardwareStatusView.xaml"> | |||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | |||
</Page> | |||
<Page Update="View\ManualCommView.xaml"> | |||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | |||
</Page> | |||
<Page Update="View\ManualControlView.xaml"> | |||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | |||
</Page> | |||
<Page Update="View\ManualFlowView.xaml"> | |||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | |||
</Page> | |||
<Page Update="View\NewLocalRecipeView.xaml"> | |||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | |||
</Page> | |||
<Page Update="View\NewMaterialView.xaml"> | |||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | |||
</Page> | |||
<Page Update="View\NewRecipeView.xaml"> | |||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | |||
</Page> | |||
<Page Update="View\RecipeControlView.xaml"> | |||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | |||
</Page> | |||
<Page Update="View\RecipeSettingsView.xaml"> | |||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | |||
</Page> | |||
<Page Update="View\SiemensRecipeReceiveView.xaml"> | |||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | |||
</Page> | |||
<Page Update="View\StockBinRawMaterialView.xaml"> | |||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | |||
</Page> | |||
<Page Update="View\SystemParView.xaml"> | |||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | |||
</Page> | |||
</ItemGroup> | |||
</Project> |
@@ -0,0 +1,27 @@ | |||
using System; | |||
using System.Globalization; | |||
using System.Windows.Data; | |||
using System.Windows.Media; | |||
namespace BPASmartClient.FoodStationTest.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,71 @@ | |||
using System; | |||
using System.Globalization; | |||
using System.Windows.Data; | |||
namespace BPASmartClient.FoodStationTest.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,16 @@ | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
namespace BPASmartClient.FoodStationTest.Model.Bom | |||
{ | |||
public class BomMaterial : ObservableObject | |||
{ | |||
public int Count { get { return _count; } set { _count = value; OnPropertyChanged(); } } | |||
public int _count { get; set; } | |||
public string MaterialCode { get { return _materialCode; } set { _materialCode = value; OnPropertyChanged(); } } | |||
private string _materialCode = ""; | |||
public string MaterialName { get { return _materialName; } set { _materialName = value; OnPropertyChanged(); } } | |||
private string _materialName = ""; | |||
} | |||
} |
@@ -0,0 +1,10 @@ | |||
using System.Collections.ObjectModel; | |||
namespace BPASmartClient.FoodStationTest.Model.Bom | |||
{ | |||
public class BomMaterialData | |||
{ | |||
public ObservableCollection<BomMaterial> Materials { get; set; } = new ObservableCollection<BomMaterial>(); | |||
} | |||
} |
@@ -0,0 +1,42 @@ | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
namespace BPASmartClient.FoodStationTest.Model.GVL | |||
{ | |||
/// <summary> | |||
/// PLC变量信息 | |||
/// </summary> | |||
public class PlcInfos : ObservableObject | |||
{ | |||
/// <summary> | |||
/// 变量序号 | |||
/// </summary> | |||
public int Count { get { return _Count; } set { _Count = value; OnPropertyChanged(); } } | |||
private int _Count { get; set; } | |||
/// <summary> | |||
/// 变量名称 | |||
/// </summary> | |||
public string Name { get { return _Name; } set { _Name = value; OnPropertyChanged(); } } | |||
private string _Name { get; set; } | |||
/// <summary> | |||
/// 变量地址 | |||
/// </summary> | |||
public string Address { get { return _Address; } set { _Address = value; OnPropertyChanged(); } } | |||
private string _Address { get; set; } | |||
/// <summary> | |||
/// 变量类型 | |||
/// </summary> | |||
public string Type { get { return _Type; } set { _Type = value; OnPropertyChanged(); } } | |||
private string _Type { get; set; } | |||
/// <summary> | |||
/// 变量描述 | |||
/// </summary> | |||
public string Describe { get { return _Describe; } set { _Describe = value; OnPropertyChanged(); } } | |||
private string _Describe { get; set; } | |||
/// <summary> | |||
/// 变量值 | |||
/// </summary> | |||
public string Value { get { return _Value; } set { _Value = value; OnPropertyChanged(); } } | |||
private string _Value { get; set; } | |||
} | |||
} |
@@ -0,0 +1,22 @@ | |||
using System; | |||
namespace BPASmartClient.FoodStationTest.Model.GVL | |||
{ | |||
[AttributeUsage(AttributeTargets.Property)] | |||
public sealed class VarCommAttribute : Attribute | |||
{ | |||
public VarCommAttribute(string address, string des) | |||
{ | |||
Address = address; | |||
Describe = des; | |||
} | |||
/// <summary> | |||
/// 变量信息描述。 | |||
/// </summary> | |||
public string Describe { get; set; } | |||
/// <summary> | |||
/// 变量地址 | |||
/// </summary> | |||
public string Address { get; set; } | |||
} | |||
} |
@@ -0,0 +1,26 @@ | |||
namespace BPASmartClient.FoodStationTest.Model | |||
{ | |||
public class VarMonitor | |||
{ | |||
/// <summary> | |||
/// 序号 | |||
/// </summary> | |||
public int SerialNum { get; set; } | |||
/// <summary> | |||
/// 变量地址 | |||
/// </summary> | |||
public string Address { get; set; } | |||
/// <summary> | |||
/// 变量描述 | |||
/// </summary> | |||
public string Describe { get; set; } | |||
/// <summary> | |||
/// 变量值当前值 | |||
/// </summary> | |||
public string NowValue { get; set; } | |||
/// <summary> | |||
/// 变量值设定值 | |||
/// </summary> | |||
public string SetValue { get; set; } | |||
} | |||
} |
@@ -0,0 +1,361 @@ | |||
using BPASmartClient.FoodStationTest.Model.GVL; | |||
using BPASmartClient.FoodStationTest.Model.HK_PLC; | |||
using System; | |||
using System.Collections.Concurrent; | |||
namespace BPASmartClient.FoodStationTest.Model | |||
{ | |||
public class GVL_SmallStation | |||
{ | |||
private volatile static GVL_SmallStation SmallStation; | |||
public static GVL_SmallStation GetInstance => SmallStation ?? (SmallStation = new GVL_SmallStation()); | |||
private GVL_SmallStation() { } | |||
public PlcReadAddressDB3 plcReadDataDB3 { get; set; } = new PlcReadAddressDB3(); | |||
/// <summary> | |||
/// 配料站料仓数目 | |||
/// </summary> | |||
public const int Max_DosingSotckBinNum = 15; | |||
/// <summary> | |||
/// 风送料仓数目 | |||
/// </summary> | |||
public const int Max_PowderSotckBinNum = 5; | |||
[VarComm("Global", "订单取消")] | |||
/// <summary> | |||
/// 订单取消 | |||
/// </summary> | |||
public bool Order_Cancel { get; set; } | |||
[VarComm("Global", "订单取消的配方编号")] | |||
/// <summary> | |||
/// 订单取消的配方编号 | |||
/// </summary> | |||
public string Order_CancelRecipeCode { get; set; } = ""; | |||
[VarComm("Global", "柔性配料料仓配料下发情况")] | |||
/// <summary> | |||
/// 料仓配料情况 | |||
/// </summary> | |||
public bool[] PlcAllowIssueRecipe { get; set; } = new bool[5] { false, false, false, false, false }; | |||
[VarComm("Global", "柔性配料料仓,气缸顶起状态")] | |||
/// <summary> | |||
/// 柔性配料料仓,气缸顶起状态 | |||
/// </summary> | |||
public ushort StockBinCylinderStatus { get; set; } | |||
[VarComm("Global", "柔性配料料仓配料下发情况")] | |||
/// <summary> | |||
/// 料仓配料情况 | |||
/// </summary> | |||
public ushort[] StockBinDosingIssue { get; set; } = new ushort[5] { 0, 0, 0, 0, 0 }; | |||
[VarComm("Global", "柔性配料料仓配料下发情况")] | |||
/// <summary> | |||
/// 料仓配料情况 | |||
/// </summary> | |||
public ushort[] RecipeStockBinDosing { get; set; } = new ushort[5] { 0, 0, 0, 0, 0 }; | |||
[VarComm("Global", "柔性配料料仓配料情况")] | |||
/// <summary> | |||
/// 料仓配料情况 | |||
/// </summary> | |||
public ushort StockBinDosing { get; set; } = 0; | |||
[VarComm("Global", "托盘1托盘到位情况0:未到位,1=AGV到位,2=托盘有货架,3=AGV取托盘完成")] | |||
/// <summary> | |||
/// 托盘1托盘到位情况 | |||
/// </summary> | |||
public int Tray1LogicFinish { get; set; } = 0; | |||
[VarComm("Global", "托盘1托盘到位情况0:未到位,1=AGV到位,2=托盘有货架,3=AGV取托盘完成")] | |||
/// <summary> | |||
/// 托盘1托盘到位情况 | |||
/// </summary> | |||
public int[] Tray_AGVLogic { get; set; } = new int[5] { 0, 0, 0, 0, 0 }; | |||
[VarComm("Global", "托盘2托盘到位情况0:未到位,1=AGV到位,2=托盘有货架,3=AGV取托盘完成")] | |||
/// <summary> | |||
/// 托盘2托盘到位 逻辑完成 | |||
/// </summary> | |||
public int Tray2LogicFinish { get; set; } = 0; | |||
[VarComm("Global", "托盘1有货架")] | |||
/// <summary> | |||
/// 托盘1有货架 | |||
/// </summary> | |||
public bool Station1HaveTray { get; set; } | |||
[VarComm("Global", "托盘2有货架")] | |||
/// <summary> | |||
/// 托盘2有货架 | |||
/// </summary> | |||
public bool Station2HaveTray { get; set; } | |||
[VarComm("Global", "托盘1传感器信号")] | |||
/// <summary> | |||
/// 托盘1传感器信号 | |||
/// </summary> | |||
public bool Station1Sensor { get; set; } | |||
[VarComm("Global", "托盘2传感器信号")] | |||
/// <summary> | |||
/// 托盘2传感器信号 | |||
/// </summary> | |||
public bool Station2Sensor { get; set; } | |||
[VarComm("Global", "托盘1气缸信号")] | |||
/// <summary> | |||
/// 托盘1气缸信号 | |||
/// </summary> | |||
public bool Station1Cylinder { get; set; } | |||
[VarComm("Global", "托盘2气缸信号")] | |||
/// <summary> | |||
/// 托盘2气缸信号 | |||
/// </summary> | |||
public bool Station2Cylinder { get; set; } | |||
[VarComm("Global", "AGV放托盘1完成")] | |||
/// <summary> | |||
/// AGV放托盘1完成 | |||
/// </summary> | |||
public bool AGV_PutTray1Finish { get; set; } | |||
[VarComm("Global", "AGV取托盘1完成")] | |||
/// <summary> | |||
/// AGV取托盘1完成 | |||
/// </summary> | |||
public bool AGV_GetTray1Finish { get; set; } | |||
[VarComm("Global", "AGV放托盘2完成")] | |||
/// <summary> | |||
/// AGV放托盘1完成 | |||
/// </summary> | |||
public bool AGV_PutTray2Finish { get; set; } | |||
[VarComm("Global", "AGV取托盘2完成")] | |||
/// <summary> | |||
/// AGV取托盘2完成 | |||
/// </summary> | |||
public bool AGV_GetTray2Finish { get; set; } | |||
[VarComm("Global", "托盘1气缸复位")] | |||
/// <summary> | |||
/// 托盘1气缸复位 | |||
/// </summary> | |||
public bool CylinderReset { get; set; } | |||
[VarComm("Global", "发送给plc的心跳")] | |||
/// <summary> | |||
/// 发送给plc的心跳 | |||
/// </summary> | |||
public bool HeartBeatToPlc { get; set; } = false; | |||
[VarComm("Global", "屏蔽小料站料仓不足15个报警")] | |||
public bool DisEnableStockAlarm { get; set; } = false; | |||
[VarComm("Global", "配方制作完成数量")] | |||
/// <summary> | |||
/// 配方制作完成数量 | |||
/// </summary> | |||
public int RecipeDosingCompleNum { get; set; } = 0; | |||
[VarComm("Global", "来自plc的心跳")] | |||
/// <summary> | |||
/// 来自plc的心跳 | |||
/// </summary> | |||
public bool HeartBeatFromPlc { get; set; } = false; | |||
[VarComm("Global", "是否允许西门子下发配方")] | |||
/// <summary> | |||
/// 是否允许西门子下发配方 | |||
/// </summary> | |||
public bool IsAllowSiemensSendRecipe { get; set; } = false; | |||
[VarComm("Global", "西门子下发配方状态0=等待下发配方 1=请求下发配方 2=接收配方 3=配方接收配方完成 4=请求配料 5=西门子确认开始配料 6=西门子确认开始配料信号复位")] | |||
/// <summary> | |||
/// 西门子下发配方状态 0:等待下发配方 1:请求下发配方 2:上位机接收配方 3:配方接收配方完成 4:上位机向西门子请求配料 5:西门子确认开始配料 6:西门子确认开始配料 信号复位 | |||
/// </summary> | |||
public int SiemensSendRecipeStatus { get; set; } = 0; | |||
[VarComm("Global", "配方1下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料")] | |||
/// <summary> | |||
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料 | |||
/// </summary> | |||
public int RecipeStatusIDTray1 { get; set; } = 0; | |||
[VarComm("Global", "配方1下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料")] | |||
/// <summary> | |||
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料 | |||
/// </summary> | |||
public int[] RecipeProcessStatus { get; set; } = new int[5] { 0, 0, 0, 0, 0 }; | |||
[VarComm("Global", "配方1下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料")] | |||
/// <summary> | |||
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料 | |||
/// </summary> | |||
public bool AGVIsGetTray { get; set; } = false; | |||
[VarComm("Global", "配方2下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料")] | |||
/// <summary> | |||
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料 | |||
/// </summary> | |||
public int RecipeStatusIDTray2 { get; set; } = 0; | |||
[VarComm("Global", "当前配方正在配料位置")] | |||
/// <summary> | |||
/// 当前料仓的位置 | |||
/// </summary> | |||
public int StockInIsWork { get; set; } = 0; | |||
[VarComm("Global", "设置料仓配料完成")] | |||
/// <summary> | |||
/// 当前料仓的位置 | |||
/// </summary> | |||
public bool[] StockInDosingComple { get; set; } = new bool[15]; | |||
[VarComm("Global", "粉仓正在配料")] | |||
/// <summary> | |||
/// 粉仓正在配料 | |||
/// </summary> | |||
public bool WindSendDosing { get; set; } = false; | |||
/// <summary> | |||
/// 所有气缸的信号 | |||
/// </summary> | |||
public bool[] Cylinder_JackInfo { get; set; } = new bool[30]; | |||
#region 本地模拟配方 | |||
[VarComm("Global", "是否使用本地模拟配方")] | |||
/// <summary> | |||
/// 是否使用本地模拟配方 | |||
/// </summary> | |||
public bool IsUseLocalRecipe { get; set; } | |||
[VarComm("Global", "是否使用本地模拟配方")] | |||
/// <summary> | |||
/// 是否使用本地模拟配方 | |||
/// </summary> | |||
public bool NotUseSmallStation { get; set; } | |||
/// <summary> | |||
/// 配料时间 | |||
/// </summary> | |||
public DateTime time1; | |||
/// <summary> | |||
/// 配料时间 | |||
/// </summary> | |||
public DateTime[] DosingTime = new DateTime[5] { DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now }; | |||
/// <summary> | |||
/// 原料的名称和原料编号对应,Mes提供的信息 | |||
/// </summary> | |||
public ConcurrentDictionary<string, string> RawMaterialsNameCode { get; set; } = new ConcurrentDictionary<string, string>(); | |||
[VarComm("Global", "风送是否允许AGV到工站")] | |||
/// <summary> | |||
/// 风送是否允许AGV到工站 | |||
/// </summary> | |||
public bool WindSendAllowAGVPutGet { get; set; } = false; | |||
[VarComm("Global", "粉料仓配料完成")] | |||
/// <summary> | |||
/// 粉料仓配料完成 | |||
/// </summary> | |||
public bool WindSendDosingComple { get; set; } = false; | |||
[VarComm("Global", "粉料仓配料状态")] | |||
/// <summary> | |||
/// 粉料仓配料状态(0:无意义,1:粉料仓下配方,2:plc接收配方完成,3:粉料仓配料完成,4:粉料仓配料完成信号复位,5:排料完成) | |||
/// </summary> | |||
public int WindSendDosingStatus { get; set; } = 0; | |||
[VarComm("Global", "PLC的系统模式 DB44.DBX0.1")] | |||
/// <summary> | |||
/// PLC的系统模式 DB44.DBX0.1 | |||
/// </summary> | |||
public bool PlcSystemMode { get; set; } = false; | |||
[VarComm("Global", "PLC的系统模式 DB44.DBX0.1")] | |||
/// <summary> | |||
/// 不使用15个料仓报警 | |||
/// </summary> | |||
public bool DisEnableStockBinAlarm { get; set; } = false; | |||
[VarComm("Global", "PLC的系统自动启停 DB44.DBX0.0")] | |||
/// <summary> | |||
/// PLC的系统自动启停 DB44.DBX0.0 | |||
/// </summary> | |||
public bool PlcSystemIsAutoRun { get; set; } = false; | |||
[VarComm("Global", "PLC的系统自动暂停/开始 DB44.DBX0.2")] | |||
/// <summary> | |||
/// PLC的系统自动暂停/开始 DB44.DBX0.2 | |||
/// </summary> | |||
public bool PlcSystemIsPause { get; set; } = false; | |||
[VarComm("Global", "延迟采集料仓的配料完成重量")] | |||
/// <summary> | |||
/// 延迟采集料仓的配料完成重量 | |||
/// </summary> | |||
public int Time { get; set; } = 2000; | |||
[VarComm("Global", "取消订单的步骤号")] | |||
/// <summary> | |||
/// 取消订单的步骤: 1-9:配料过程中配方1取消配方 10-19:配料过程中配方2取消配方 20-29:下发订单的过程中取消订单(订单未到达上位机) 30-39:下发订单的过程中取消订单(订单未到达PLC) | |||
/// </summary> | |||
public int OrderCancelStep { get; set; } = 0; | |||
[VarComm("Global", "机器人的状态")] | |||
/// <summary> | |||
/// 机器人的状态 | |||
/// </summary> | |||
public ushort RobotStatus { get; set; } = 0; | |||
[VarComm("Global", "机器人的程序号")] | |||
/// <summary> | |||
/// 机器人的程序号 | |||
/// </summary> | |||
public byte RobotProgramNum { get; set; } = 0; | |||
/// <summary> | |||
/// 最近一次下发订单的时间 | |||
/// </summary> | |||
public DateTime LatestIssueRecipe { get; set; } = new DateTime(2023, 5, 1, 00, 00, 00); | |||
#endregion | |||
} | |||
public enum IssueRecipeCondition | |||
{ | |||
等待小料站PLC允许下配方, | |||
等待西门子下发配方, | |||
等待西门子下发配方信号复位, | |||
等待上位机请求配料, | |||
等待西门子确认配料, | |||
等待西门子确认配料信号复位, | |||
} | |||
public enum ProcessCondition | |||
{ | |||
等待AGV到位, | |||
等待小料站PLC接受配方完成, | |||
等待配方配料完成, | |||
等待AGV取托盘完成 | |||
} | |||
} |
@@ -0,0 +1,183 @@ | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
using BPASmartClient.Helper; | |||
using System; | |||
using System.Collections.ObjectModel; | |||
using System.Threading; | |||
namespace BPASmartClient.FoodStationTest.Model.HK_PLC | |||
{ | |||
public class HKDeviceStatus | |||
{ | |||
public BPA.Communication.Siemens HK_PLC_S7 = new BPA.Communication.Siemens(); | |||
public bool IsConnected => HK_PLC_S7.IsConnected(); | |||
public PlcReadAddressDB45 DeviceStatus = new PlcReadAddressDB45(); | |||
public void Init() | |||
{ | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
if (IsConnected) | |||
{ | |||
var res = this.HK_PLC_S7.Read<PlcReadAddressDB45>(45); | |||
if (res.IsSuccess && res.Content != null && res.Content is PlcReadAddressDB45 data) | |||
{ | |||
DeviceStatus = data; | |||
} | |||
var res1 = this.HK_PLC_S7.Read<PlcReadAddressDB3>(3); | |||
if (res1.IsSuccess && res1.Content != null && res1.Content is PlcReadAddressDB3 data1) | |||
{ | |||
GVL_SmallStation.GetInstance.plcReadDataDB3 = data1; | |||
} | |||
} | |||
Thread.Sleep(10); | |||
}), "海科PLC设备状态", true); | |||
} | |||
private void TempStockBinPar(int num, ushort StockBinLocation, string info) | |||
{ | |||
if (StockBinLocation >= 1 && StockBinLocation <= 8) | |||
{ | |||
HK_PLC_S7.Write<bool>($"DB4.DBX{num}." + (StockBinLocation - 1), true); | |||
} | |||
else if (StockBinLocation >= 9 && StockBinLocation <= 15) | |||
{ | |||
HK_PLC_S7.Write<bool>($"DB4.DBX{num + 1}." + (StockBinLocation - 9), true); | |||
} | |||
MessageNotify.GetInstance.ShowRunLog($"托盘{info}号桶在料仓{StockBinLocation}配料"); | |||
} | |||
/// <summary> | |||
/// 下发配方数据 | |||
/// </summary> | |||
/// <param name="BarrelNum">单个桶的编号</param> | |||
/// <param name="StockBinLocation">单个桶对应的料仓位置</param> | |||
public void StockBinPar(uint BarrelNum, ushort StockBinLocation, int TrayNum = 1) | |||
{ | |||
if (IsConnected) | |||
{ | |||
if (TrayNum == 1) | |||
{ | |||
if (BarrelNum >= 6 && BarrelNum <= 8 && StockBinLocation >= 1 && StockBinLocation <= 15) | |||
{ | |||
if (BarrelNum == 6) | |||
{ | |||
TempStockBinPar(10, StockBinLocation, "1—1"); | |||
} | |||
else if (BarrelNum == 7) | |||
{ | |||
TempStockBinPar(12, StockBinLocation, "1—2"); | |||
} | |||
else if (BarrelNum == 8) | |||
{ | |||
TempStockBinPar(14, StockBinLocation, "1—3"); | |||
} | |||
else if (BarrelNum == 4) | |||
{ | |||
TempStockBinPar(16, StockBinLocation, "1—4"); | |||
} | |||
} | |||
} | |||
else if (TrayNum == 2) | |||
{ | |||
if (BarrelNum >= 1 && BarrelNum <= 4 && StockBinLocation >= 1 && StockBinLocation <= 15) | |||
{ | |||
if (BarrelNum == 6) | |||
{ | |||
TempStockBinPar(18, StockBinLocation, "2—1"); | |||
} | |||
else if (BarrelNum == 7) | |||
{ | |||
TempStockBinPar(20, StockBinLocation, "2—2"); | |||
} | |||
else if (BarrelNum == 8) | |||
{ | |||
TempStockBinPar(22, StockBinLocation, "2—3"); | |||
} | |||
else if (BarrelNum == 4) | |||
{ | |||
TempStockBinPar(24, StockBinLocation, "2—4"); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
public void IssueRecipeToPlc(ObservableCollection<RemoteRecipeRawMaterial> rawMaterials, int recipeLoction) | |||
{ | |||
bool[] barrel = new bool[16]; | |||
bool[] barrel1 = new bool[16]; | |||
bool[] barrel2 = new bool[16]; | |||
bool[] barrel3 = new bool[16]; | |||
ushort barrel1_short = 0; | |||
ushort barrel2_short = 0; | |||
ushort barrel3_short = 0; | |||
foreach (var item in rawMaterials) | |||
{ | |||
switch (item.RawMaterialBarrelNum) | |||
{ | |||
case 6: | |||
barrel[item.RawMaterialLocation - 1] = true; | |||
barrel1[item.RawMaterialLocation - 1] = true; | |||
break; | |||
case 7: | |||
barrel[item.RawMaterialLocation - 1] = true; | |||
barrel2[item.RawMaterialLocation - 1] = true; | |||
break; | |||
case 8: | |||
barrel[item.RawMaterialLocation - 1] = true; | |||
barrel3[item.RawMaterialLocation - 1] = true; | |||
break; | |||
default: | |||
break; | |||
} | |||
} | |||
for (int i = 0; i < 16; i++) | |||
{ | |||
if (recipeLoction == 0) | |||
{ | |||
if (i >= 8) | |||
{ | |||
HK_PLC_S7.Write<bool>("DB4.DBX15." + (i - 8), barrel1[i]); | |||
HK_PLC_S7.Write<bool>("DB4.DBX17." + (i - 8), barrel2[i]); | |||
HK_PLC_S7.Write<bool>("DB4.DBX19." + (i - 8), barrel3[i]); | |||
} | |||
else | |||
{ | |||
HK_PLC_S7.Write<bool>("DB4.DBX14." + i, barrel1[i]); | |||
HK_PLC_S7.Write<bool>("DB4.DBX16." + i, barrel2[i]); | |||
HK_PLC_S7.Write<bool>("DB4.DBX18." + i, barrel3[i]); | |||
} | |||
barrel1_short = barrel1_short.SetBitValue((byte)(i + 1), barrel1[i]); | |||
barrel2_short = barrel2_short.SetBitValue((byte)(i + 1), barrel2[i]); | |||
barrel3_short = barrel3_short.SetBitValue((byte)(i + 1), barrel3[i]); | |||
GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeLoction] = GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeLoction].SetBitValue((byte)(i + 1), barrel[i]); | |||
} | |||
else if (recipeLoction == 1) | |||
{ | |||
if (i >= 8) | |||
{ | |||
HK_PLC_S7.Write<bool>("DB4.DBX21." + (i - 8), barrel1[i]); | |||
HK_PLC_S7.Write<bool>("DB4.DBX23." + (i - 8), barrel2[i]); | |||
HK_PLC_S7.Write<bool>("DB4.DBX25." + (i - 8), barrel3[i]); | |||
} | |||
else | |||
{ | |||
HK_PLC_S7.Write<bool>("DB4.DBX20." + i, barrel1[i]); | |||
HK_PLC_S7.Write<bool>("DB4.DBX22." + i, barrel2[i]); | |||
HK_PLC_S7.Write<bool>("DB4.DBX24." + i, barrel3[i]); | |||
} | |||
barrel1_short = barrel1_short.SetBitValue((byte)(i + 1), barrel1[i]); | |||
barrel2_short = barrel2_short.SetBitValue((byte)(i + 1), barrel2[i]); | |||
barrel3_short = barrel3_short.SetBitValue((byte)(i + 1), barrel3[i]); | |||
GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeLoction] = GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeLoction].SetBitValue((byte)(i + 1), barrel[i]); | |||
} | |||
} | |||
MessageNotify.GetInstance.ShowRunLog($"配方下发,plc配方位置{recipeLoction},桶1料仓配料{barrel1_short},配料位置{barrel1_short.ToBinString()}"); | |||
MessageNotify.GetInstance.ShowRunLog($"配方下发,plc配方位置{recipeLoction},桶2料仓配料{barrel2_short},配料位置{barrel2_short.ToBinString()}"); | |||
MessageNotify.GetInstance.ShowRunLog($"配方下发,plc配方位置{recipeLoction},桶3料仓配料{barrel3_short},配料位置{barrel3_short.ToBinString()}"); | |||
MessageNotify.GetInstance.ShowRunLog($"配方下发,plc配方位置{recipeLoction},料仓配料{GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeLoction]},配料位置{GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeLoction].ToBinString()}"); | |||
} | |||
} | |||
} |
@@ -0,0 +1,17 @@ | |||
namespace BPASmartClient.FoodStationTest.Model.HK_PLC | |||
{ | |||
public class HKDeviceWrite | |||
{ | |||
public string Address { get; set; } | |||
public PlcVarType PlcVarType { get; set; } = PlcVarType.Bool; | |||
public object Value { get; set; } | |||
} | |||
public enum PlcVarType | |||
{ | |||
Bool, | |||
Byte, | |||
Int, | |||
Dint, | |||
Real, | |||
} | |||
} |
@@ -0,0 +1,80 @@ | |||
using BPASmartClient.FoodStationTest.Model.GVL; | |||
namespace BPASmartClient.FoodStationTest.Model.HK_PLC | |||
{ | |||
public class PlcReadAddressDB3 | |||
{ | |||
[VarComm("DB3.DBX0.0", "心跳")] | |||
public bool HeartBeat { get; set; } | |||
[VarComm("DB3.DBX0.1", "机器人自动运行模式")] | |||
public bool RobotAutoRunMode { get; set; } | |||
[VarComm("DB3.DBX0.2", "机器人正在自动运行")] | |||
public bool RobotAutoRunning { get; set; } | |||
[VarComm("DB3.DBX0.3", "机器人停止运行")] | |||
public bool RobotStopped { get; set; } | |||
[VarComm("DB3.DBX0.4", "机器人正常运行")] | |||
public bool RobotRunning { get; set; } | |||
[VarComm("DB3.DBX0.5", "机器人运行故障")] | |||
public bool RobotAlarm { get; set; } | |||
[VarComm("DB3.DBX0.6", "机器人在Home点")] | |||
public bool RobotInHomed { get; set; } | |||
[VarComm("DB3.DBX1.0", "机器人执行程序号")] | |||
public byte RobotRunProgram { get; set; } | |||
[VarComm("DB3.DBX2.0", "Plc允许工单下发")] | |||
public bool[] RecipeAllowIssue { get; set; } = new bool[16]; | |||
[VarComm("DB3.DBX4.0", "Plc工单接收完成")] | |||
public bool[] RecipeReceviceComple { get; set; } = new bool[16]; | |||
[VarComm("DB3.DBX6.0", "工单配料完成")] | |||
public bool[] RecipeDosingComple { get; set; } = new bool[16]; | |||
[VarComm("DB3.DBX8.0", "允许单个料仓下料")] | |||
public bool[] StockBinAllowIssue { get; set; } = new bool[16]; | |||
[VarComm("DB3.DBW10", "配方1桶位置反馈")] | |||
public ushort[] Recipe1BarrelPosReserve { get; set; } = new ushort[3]; | |||
[VarComm("DB3.DBW16", "配方2桶位置反馈")] | |||
public ushort[] Recipe2BarrelPosReserve { get; set; } = new ushort[3]; | |||
[VarComm("DB3.DBW22", "配方3桶位置反馈")] | |||
public ushort[] Recipe3BarrelPosReserve { get; set; } = new ushort[3]; | |||
[VarComm("DB3.DBW28", "配方4桶位置反馈")] | |||
public ushort[] Recipe4BarrelPosReserve { get; set; } = new ushort[3]; | |||
[VarComm("DB3.DBW34", "配方5桶位置反馈")] | |||
public ushort[] Recipe5BarrelPosReserve { get; set; } = new ushort[3]; | |||
[VarComm("DB3.DBX40.0", "工站1有无托盘")] | |||
public bool Station1HaveTray { get; set; } | |||
[VarComm("DB3.DBX40.1", "工站1传感器信号")] | |||
public bool Station1Sensor { get; set; } | |||
[VarComm("DB3.DBX40.2", "工站1气缸信号")] | |||
public bool Station1Cylinder { get; set; } | |||
[VarComm("DB3.DBX100.7", "机器人抓空桶完成")] | |||
public bool RobotTakeEmptyBarrelFinish { get; set; } | |||
[VarComm("DB3.DBX101.0", "机器人放空桶完成")] | |||
public bool RobotPutEmptyBarrelFinish { get; set; } | |||
[VarComm("DB3.DBX101.1", "机器人抓满桶完成")] | |||
public bool RobotTakeFullBarrelFinish { get; set; } | |||
[VarComm("DB3.DBX101.2", "机器人放满桶完成")] | |||
public bool RobotPutFullBarrelFinish { get; set; } | |||
} | |||
} |
@@ -0,0 +1,52 @@ | |||
namespace BPASmartClient.FoodStationTest.Model.HK_PLC | |||
{ | |||
public class PlcReadAddressDB45 | |||
{ | |||
/// <summary> | |||
/// 通信心跳 DB45.DBX0.0 | |||
/// </summary> | |||
public bool HeartBeat { get; set; } | |||
/// <summary> | |||
/// 设备运行 DB45.DBX0.1 | |||
/// </summary> | |||
public bool DeviceRun { get; set; } | |||
/// <summary> | |||
/// 设备停止 DB45.DBX0.2 | |||
/// </summary> | |||
public bool DeviceStop { get; set; } | |||
/// <summary> | |||
/// 设备急停 DB45.DBX0.3 | |||
/// </summary> | |||
public bool DeviceEStop { get; set; } | |||
/// <summary> | |||
/// 设备暂停 DB45.DBX0.4 | |||
/// </summary> | |||
public bool DevicePause { get; set; } | |||
/// <summary> | |||
/// 设备故障 DB45.DBX0.5 | |||
/// </summary> | |||
public bool DeviceAlarm { get; set; } | |||
/// <summary> | |||
/// 料仓缺料 DB45.DBX0.6 | |||
/// </summary> | |||
public bool StockBin { get; set; } | |||
/// <summary> | |||
/// 上游缺料 DB45.DBX0.7 | |||
/// </summary> | |||
public bool Top { get; set; } | |||
/// <summary> | |||
/// 上游缺料 DB45.DBX1.0 | |||
/// </summary> | |||
public bool TopDown { get; set; } | |||
/// <summary> | |||
/// 系统模式 | |||
/// </summary> | |||
public short Mode { get; set; } | |||
/// <summary> | |||
/// 报警 | |||
/// </summary> | |||
public bool[] Alarm { get; set; } = new bool[24]; | |||
public int Standby1 { get; set; } | |||
public int Standby2 { get; set; } | |||
} | |||
} |
@@ -0,0 +1,47 @@ | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
namespace BPASmartClient.FoodStationTest.Model.Par | |||
{ | |||
/// <summary> | |||
/// 连接参数设置。 | |||
/// </summary> | |||
public class ConnectParMode : ObservableObject | |||
{ | |||
/// <summary> | |||
/// 海科PLC是否连接 | |||
/// </summary> | |||
public bool HKPlcConnect { get { return _mHKPlcConnect; } set { _mHKPlcConnect = value; OnPropertyChanged(); } } | |||
private bool _mHKPlcConnect; | |||
/// <summary> | |||
/// 是否屏蔽料仓报警 | |||
/// </summary> | |||
public bool ShieldStockbinAlarm { get { return _mShieldStockbinAlarm; } set { _mShieldStockbinAlarm = value; OnPropertyChanged(); } } | |||
private bool _mShieldStockbinAlarm; | |||
/// <summary> | |||
/// 进桶侧调速电机速度 | |||
/// </summary> | |||
public short AxisLoadSpeed { get { return _mAxisLoadSpeed; } set { _mAxisLoadSpeed = value; OnPropertyChanged(); } } | |||
private short _mAxisLoadSpeed; | |||
/// <summary> | |||
/// 过度侧调速电机速度 | |||
/// </summary> | |||
public short AxisMidSpeed { get { return _mAxisMidSpeed; } set { _mAxisMidSpeed = value; OnPropertyChanged(); } } | |||
private short _mAxisMidSpeed; | |||
/// <summary> | |||
/// 出桶侧调速电机速度 | |||
/// </summary> | |||
public short AxisUnLoadSpeed { get { return _mAxisUnLoadSpeed; } set { _mAxisUnLoadSpeed = value; OnPropertyChanged(); } } | |||
private short _mAxisUnLoadSpeed; | |||
/// <summary> | |||
/// 进桶侧伺服电机速度 | |||
/// </summary> | |||
public float Axis1Speed { get { return _mAxis1Speed; } set { _mAxis1Speed = value; OnPropertyChanged(); } } | |||
private float _mAxis1Speed; | |||
/// <summary> | |||
/// 出桶侧伺服电机速度 | |||
/// </summary> | |||
public float Axis2Speed { get { return _mAxis2Speed; } set { _mAxis2Speed = value; OnPropertyChanged(); } } | |||
private float _mAxis2Speed; | |||
} | |||
} |
@@ -0,0 +1,26 @@ | |||
using System.Collections.ObjectModel; | |||
namespace BPASmartClient.FoodStationTest.Model | |||
{ | |||
public class LocalPar | |||
{ | |||
/// <summary> | |||
/// 本地模拟配方列表。 | |||
/// </summary> | |||
public ObservableCollection<RecipeModel> Recipes { get; set; } = new ObservableCollection<RecipeModel>(); | |||
/// <summary> | |||
/// 配方完成数目。 | |||
/// </summary> | |||
public int RecipeDosingCompleNum { get; set; } = 0; | |||
/// <summary> | |||
/// 味魔方数量,每个项目应该固定的。 | |||
/// </summary> | |||
public int RawMaterialDeviceNum { get; } = 6; | |||
/// <summary> | |||
/// 海科PLC的IP地址。 | |||
/// </summary> | |||
public string HK_PLC_IP { get; } | |||
} | |||
} |
@@ -0,0 +1,46 @@ | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
namespace BPASmartClient.FoodStationTest.Model | |||
{ | |||
/// <summary> | |||
/// 料仓报警信息。 | |||
/// </summary> | |||
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,117 @@ | |||
namespace BPASmartClient.FoodStationTest.Model | |||
{ | |||
/// <summary> | |||
/// 味魔法通讯地址。 | |||
/// </summary> | |||
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 OpenLid { get; set; } = ""; | |||
/// <summary> | |||
/// 关盖地址 | |||
/// </summary> | |||
public static string CloseLid { get; set; } = ""; | |||
/// <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 DosingStatusFeedback { get; set; } = "LW62"; | |||
/// <summary> | |||
/// 搅拌速度 | |||
/// </summary> | |||
public static string StirringSpeed { get; set; } = "LW37"; | |||
} | |||
} |
@@ -0,0 +1,28 @@ | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
namespace BPASmartClient.FoodStationTest.Model | |||
{ | |||
/// <summary> | |||
/// 味魔方当前状态。 | |||
/// </summary> | |||
public class DeviceCurrentStatus : ObservableObject | |||
{ | |||
public double Weight { get { return _mWeight; } set { _mWeight = value; OnPropertyChanged(); } } | |||
private double _mWeight; | |||
public ushort RunStatus { get { return _mRunStatus; } set { _mRunStatus = value; OnPropertyChanged(); } } | |||
private ushort _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,444 @@ | |||
using BPA.Communication; | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
using BPASmartClient.FoodStationTest.ViewModel; | |||
using BPASmartClient.Helper; | |||
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.FoodStationTest.Model | |||
{ | |||
public class DeviceInquire | |||
{ | |||
private volatile static DeviceInquire _Instance; | |||
public static DeviceInquire GetInstance => _Instance ?? (_Instance = new DeviceInquire()); | |||
private DeviceInquire() { } | |||
//代码片段。 | |||
string IPSegment = "107.107.2."; | |||
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; | |||
TopDeviceCurrentStatuses.ElementAt(TopIndex).RunStatus = DeviceLists.ElementAt(i).Value.deviceStatus.RunStatus; | |||
} | |||
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; | |||
BottomDeviceCurrentStatuses.ElementAt(BottomIndex).RunStatus = DeviceLists.ElementAt(i).Value.deviceStatus.RunStatus; | |||
} | |||
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; | |||
} | |||
if (!ThreadManage.GetInstance().IsContainsKey($"{deviceName} 开始监听")) | |||
{ | |||
DeviceLists[DeviceLists.ElementAt(i).Key].Init(deviceName); | |||
} | |||
} | |||
Thread.Sleep(200); | |||
}), "设备状态监听", true); | |||
} | |||
private void TestData() | |||
{ | |||
for (int i = 0; i < 8; i++) | |||
{ | |||
TopDeviceCurrentStatuses.Add(new DeviceCurrentStatus() | |||
{ | |||
DeviceName = $"测试设备{i + 1}", | |||
DeviceNum = i + 1, | |||
RunStatus = 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, | |||
RunStatus = 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() | |||
{ | |||
//AlarmHelper<AlarmInfo>.Init(); | |||
//AlarmHelper<AlarmInfo>.Alarm.EStop1 = true; | |||
//IPSegment = ConfigurationManager.AppSettings["RawMaterial_IP"]; | |||
//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 = 0; i < Json<LocalPar>.Data.RawMaterialDeviceNum; i++) | |||
{ | |||
//这里“69”是味魔方起始地址。 | |||
//TODO:修改起始地址。 | |||
IPLists.Add($"{IPSegment}{i + 69}"); | |||
} | |||
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 != null && 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.Read<string>(DeviceAddress.DeviceName, 20).Content.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<LocalPar>.Data.Recipes.Count; i++) | |||
{ | |||
for (int m = 0; m < Json<LocalPar>.Data.Recipes.ElementAt(i).RawMaterials.Count; m++) | |||
{ | |||
if (Json<LocalPar>.Data.Recipes.ElementAt(i).RawMaterials.ElementAt(m).DeviceIp == ip) | |||
{ | |||
Json<LocalPar>.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); | |||
if (DeviceLists.ContainsKey(ip)) | |||
{ | |||
DeviceLists[ip].Dispose(); | |||
var res11 = DeviceLists[ip]; | |||
DeviceLists.TryRemove(ip, out res11); | |||
} | |||
} | |||
}); | |||
DS.modbusTcp.ConnectFail = new Action(() => | |||
{ | |||
//if (!InvalidIP.Contains(ip)) InvalidIP.Add(ip); | |||
//MessageLog.GetInstance.ShowAlarmLog($"设备{ip}连接失败"); | |||
if (DeviceLists.ContainsKey(ip)) | |||
{ | |||
DeviceLists[ip].Dispose(); | |||
var res11 = DeviceLists[ip]; | |||
DeviceLists.TryRemove(ip, out res11); | |||
} | |||
}); | |||
DS.modbusTcp.Disconnect = new Action(() => | |||
{ | |||
if (InvalidIP.Contains(ip)) | |||
InvalidIP.Remove(ip); | |||
var res = devices.FirstOrDefault(P => P.IpAddress == ip); | |||
if (res != null && devices.Contains(res)) | |||
{ | |||
App.Current.Dispatcher.Invoke(new Action(() => | |||
{ | |||
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(); | |||
var res11 = DeviceLists[ip]; | |||
DeviceLists.TryRemove(ip, out res11); | |||
} | |||
}); | |||
Task.Run(new Action(() => | |||
{ | |||
DS.modbusTcp.Connect(new BPA.Communication.Base.ConfigurationOptions() { IpAddress = ip, Port = 502 });//PLC连接 | |||
IPQueues.Enqueue(e.Reply.Address.ToString()); | |||
})); | |||
} | |||
else | |||
{ | |||
IPQueues.Enqueue(e.Reply.Address.ToString()); | |||
} | |||
} | |||
else | |||
{ | |||
if (e.Reply != null) | |||
IPQueues.Enqueue(e.Reply.Address.ToString()); | |||
} | |||
} | |||
} | |||
public class DeviceStatus | |||
{ | |||
#region 对象属性声明 | |||
public string DeviceName = String.Empty; | |||
/// <summary> | |||
/// ModbusTcp的地址。 | |||
/// </summary> | |||
public string IpAddress=> modbusTcp.GetConfigPar().IpAddress; | |||
/// <summary> | |||
/// 设备状态 | |||
/// </summary> | |||
public RawMaterialDeviceStatus deviceStatus { get; set; } = new RawMaterialDeviceStatus(); | |||
public ModbusTcp modbusTcp = new ModbusTcp(); | |||
public bool IsConnected => modbusTcp.IsConnected(); | |||
#endregion | |||
public void Init(string DeviceName) | |||
{ | |||
this.DeviceName = DeviceName; | |||
//AlarmHelper<AlarmInfo>.Init(); | |||
if (modbusTcp.IsConnected()) | |||
{ | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
if (modbusTcp.IsConnected()) | |||
{ | |||
deviceStatus.RunStatus = (ushort)this.modbusTcp.Read<ushort>(DeviceAddress.RunStatus).Content; //获取设备运行状态 | |||
deviceStatus.WeightFeedback = this.modbusTcp.Read<float>(DeviceAddress.WeightFeedback).Content;//获取设备料仓剩余重量 | |||
deviceStatus.NowWeightFeedback = this.modbusTcp.Read<float>(DeviceAddress.CutWeightFeedback).Content;//获取下料重量 | |||
deviceStatus.DeviceNum = (ushort)this.modbusTcp.Read<ushort>(DeviceAddress.DeviceNum).Content;//获取设备编号 | |||
deviceStatus.DeviceAlarmCode = (ushort)this.modbusTcp.Read<ushort>(DeviceAddress.DeviceAlarmCode).Content;//获取设备故障编码 | |||
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).EStop1 = deviceStatus.DeviceAlarmCode.Get16bitValue(1); | |||
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).Servo = deviceStatus.DeviceAlarmCode.Get16bitValue(2); | |||
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).Inverter = deviceStatus.DeviceAlarmCode.Get16bitValue(3); | |||
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).EStop2 = deviceStatus.DeviceAlarmCode.Get16bitValue(7); | |||
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).SiloUpperLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(8); | |||
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).SiloLowerLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(9); | |||
//允许配料即产线气缸抬起,发送给味魔方 | |||
if (deviceStatus.DeviceNum >= 1 && deviceStatus.DeviceNum <= 15) | |||
{ | |||
if (GVL_SmallStation.GetInstance.plcReadDataDB3.StockBinAllowIssue[deviceStatus.DeviceNum - 1]) | |||
{ | |||
this.modbusTcp.Write("LW41", (ushort)1); | |||
GVL_SmallStation.GetInstance.StockBinCylinderStatus.SetBitValue((byte)(deviceStatus.DeviceNum), true); | |||
} | |||
else | |||
{ | |||
this.modbusTcp.Write("LW41", (ushort)0); | |||
GVL_SmallStation.GetInstance.StockBinCylinderStatus.SetBitValue((byte)(deviceStatus.DeviceNum), false); | |||
} | |||
} | |||
Thread.Sleep(10); | |||
} | |||
}), $"{DeviceName} 开始监听", true); | |||
} | |||
} | |||
public void SetDeviceName(string name) | |||
{ | |||
this.modbusTcp.Write(DeviceAddress.DeviceName, new ushort[20]); | |||
this.modbusTcp.Write<string>(DeviceAddress.DeviceName, name); | |||
} | |||
/// <summary> | |||
/// 开盖 | |||
/// </summary> | |||
public void OpenLid() | |||
{ | |||
//modbusTcp.Write(DeviceAddress.OpenLid, (ushort)1); | |||
} | |||
/// <summary> | |||
/// 关盖 | |||
/// </summary> | |||
public void CloseLid() | |||
{ | |||
//modbusTcp.Write(DeviceAddress.CloseLid, (ushort)1); | |||
} | |||
public bool StatusReset() | |||
{ | |||
return this.modbusTcp.Write(DeviceAddress.FinfishStatus, (ushort)1).IsSuccess; | |||
//var res = modbusTcp.Read(DeviceAddress.RunStatus); | |||
} | |||
public void Dispose() | |||
{ | |||
ThreadManage.GetInstance().StopTask($"{DeviceName} 开始监听"); | |||
} | |||
/// <summary> | |||
/// 写入重量数据,开始配料。 | |||
/// </summary> | |||
/// <param name="Value">配料重量。</param> | |||
public void Start(float Value) | |||
{ | |||
if (modbusTcp.IsConnected()) | |||
{ | |||
var res = Json<DevicePar>.Data.deviceParModels.FirstOrDefault(p => p.MaterialName == DeviceName); | |||
if (res != null) | |||
{ | |||
modbusTcp.Write<float>(DeviceAddress.SlowlyAddWeight, res.SlowlyAddWeight); | |||
modbusTcp.Write<float>(DeviceAddress.PreCloseValveWeight, res.PreCloseValveWeight); | |||
modbusTcp.Write<uint>(DeviceAddress.RapidAcceleration, (uint)res.RapidAcceleration); | |||
modbusTcp.Write<uint>(DeviceAddress.SlowAcceleration, (uint)res.SlowAcceleration); | |||
modbusTcp.Write<uint>(DeviceAddress.ServoManualSpeed, (uint)res.ServoManualSpeed); | |||
modbusTcp.Write<uint>(DeviceAddress.SiloUpperLimitWeight, (uint)res.SiloUpperLimitWeight); | |||
modbusTcp.Write<uint>(DeviceAddress.LowerLimitWeightOfSilo, (uint)res.LowerLimitWeightOfSilo); | |||
modbusTcp.Write<uint>(DeviceAddress.StirringSpeed, (uint)res.StirringSpeed * 100); | |||
MessageNotify.GetInstance.ShowRunLog($"{res.MaterialName},参数下发完成"); | |||
} | |||
modbusTcp.Write<float>(DeviceAddress.WeightSet, Value);//写入原料重量 | |||
if (!modbusTcp.Write(DeviceAddress.Start, (ushort)1).IsSuccess)//设备启动写入 | |||
{ | |||
MessageNotify.GetInstance.ShowRunLog($"{DeviceName},设置重量:{Value},启动信号写入失败"); | |||
} | |||
MessageNotify.GetInstance.ShowRunLog($"{DeviceName},设置重量:{Value},柔性味魔方开始配料"); | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,18 @@ | |||
using BPASmartClient.FoodStationTest.Model.Bom; | |||
using BPASmartClient.FoodStationTest.Model.Par; | |||
using BPASmartClient.FoodStationTest.Model.RawMaterial; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System.Collections.ObjectModel; | |||
namespace BPASmartClient.FoodStationTest.Model | |||
{ | |||
public class DevicePar : ObservableObject | |||
{ | |||
public ObservableCollection<DeviceParMode> deviceParModels { get; set; } = new ObservableCollection<DeviceParMode>(); | |||
public ConnectParMode deviceConnectPar { get { return _mdeviceConnectPar; } set { _mdeviceConnectPar = value; OnPropertyChanged(); } } | |||
private ConnectParMode _mdeviceConnectPar = new ConnectParMode(); | |||
public ObservableCollection<RawMaterialStockBin> rawMaterialStockBin { get; set; } = new ObservableCollection<RawMaterialStockBin>(); | |||
public ObservableCollection<BomMaterial> BomMaterial { get; set; } = new ObservableCollection<BomMaterial>(); | |||
} | |||
} |
@@ -0,0 +1,73 @@ | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
namespace BPASmartClient.FoodStationTest.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; | |||
public float ErrorRange { get { return _mErrorRange; } set { _mErrorRange = value; OnPropertyChanged(); } } | |||
private float _mErrorRange; | |||
/// <summary> | |||
/// 是否重复 | |||
/// </summary> | |||
[Newtonsoft.Json.JsonIgnore] | |||
public bool IsRedundant { get { return _mIsRedundant; } set { _mIsRedundant = value; OnPropertyChanged(); } } | |||
private bool _mIsRedundant; | |||
} | |||
} |
@@ -0,0 +1,94 @@ | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
namespace BPASmartClient.FoodStationTest.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,59 @@ | |||
namespace BPASmartClient.FoodStationTest.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,24 @@ | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
namespace BPASmartClient.FoodStationTest.Model.RawMaterial | |||
{ | |||
public class RawMaterialStockBin : ObservableObject | |||
{ | |||
public short RawMaterialCount { get { return _mRawMaterialCount; } set { _mRawMaterialCount = value; OnPropertyChanged(); } } | |||
private short _mRawMaterialCount; | |||
/// <summary> | |||
/// 原料名称 | |||
/// </summary> | |||
public string RawMaterialName { get { return _mRawMaterialName; } set { _mRawMaterialName = value; OnPropertyChanged(); } } | |||
private string _mRawMaterialName; | |||
/// <summary> | |||
/// 原料对应料仓的位置 | |||
/// </summary> | |||
public int RawMaterialLocation { get { return _mRawMaterialLocation; } set { _mRawMaterialLocation = value; OnPropertyChanged(); } } | |||
private int _mRawMaterialLocation; | |||
} | |||
} |
@@ -0,0 +1,50 @@ | |||
using BPASmartClient.Model; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System.Collections.ObjectModel; | |||
using System.Threading; | |||
namespace BPASmartClient.FoodStationTest.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,16 @@ | |||
using System.Collections.ObjectModel; | |||
namespace BPASmartClient.FoodStationTest.Model | |||
{ | |||
/// <summary> | |||
/// 本地模拟配方集合。 | |||
/// </summary> | |||
internal class LocalRecipeDataColl | |||
{ | |||
public ObservableCollection<RemoteRecipeData> Recipes { get; set; } = new ObservableCollection<RemoteRecipeData>(); | |||
/// <summary> | |||
/// 筛选后的配方显示集合。 | |||
/// </summary> | |||
public ObservableCollection<RemoteRecipeData> SelectedRecipes { get; set; } = new ObservableCollection<RemoteRecipeData>(); | |||
} | |||
} |
@@ -0,0 +1,35 @@ | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System.Collections.ObjectModel; | |||
namespace BPASmartClient.FoodStationTest.Model | |||
{ | |||
/// <summary> | |||
/// 远程配方数据。 | |||
/// </summary> | |||
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,13 @@ | |||
using System.Collections.ObjectModel; | |||
namespace BPASmartClient.FoodStationTest.Model | |||
{ | |||
/// <summary> | |||
/// 远程配方数据集合。 | |||
/// </summary> | |||
public class RemoteRecipeDataColl | |||
{ | |||
public ObservableCollection<RemoteRecipeData> Recipes { get; set; } = new ObservableCollection<RemoteRecipeData>(); | |||
} | |||
} |
@@ -0,0 +1,49 @@ | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
namespace BPASmartClient.FoodStationTest.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; | |||
public string RawMaterialType { get { return _mRawMaterialType; } set { _mRawMaterialType = value; OnPropertyChanged(); } } | |||
private string _mRawMaterialType; | |||
/// <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; | |||
public bool IsDosingComple { get { return _mIsDosingComple; } set { _mIsDosingComple = value; OnPropertyChanged(); } } | |||
private bool _mIsDosingComple; | |||
} | |||
} |
@@ -0,0 +1,105 @@ | |||
using System.Collections.ObjectModel; | |||
namespace BPASmartClient.FoodStationTest.Model | |||
{ | |||
public class TestData | |||
{ | |||
public volatile static TestData Instance; | |||
public static TestData GetInstance => Instance ?? (Instance = new TestData()); | |||
public ObservableCollection<RemoteRecipeData> Recipes { get; set; } = new ObservableCollection<RemoteRecipeData>(); | |||
public ObservableCollection<RemoteRecipeRawMaterial> RawMaterials { get; set; } = new ObservableCollection<RemoteRecipeRawMaterial>(); | |||
public TestData() | |||
{ | |||
string recipeName = "配方1"; | |||
string recipeCode = "10001"; | |||
int Traycode = 1; | |||
float RawmaterialWeight = 10; | |||
short RawMaterialbarrelNum = 1; | |||
int RawMaterialLocation = 5; | |||
float RawmaterialWeight1 = 20; | |||
short RawMaterialbarrelNum1 = 2; | |||
int RawMaterialLocation1 = 7; | |||
float RawmaterialWeight2 = 30; | |||
short RawMaterialbarrelNum2 = 3; | |||
int RawMaterialLocation2 = 9; | |||
RawMaterials.Add(new RemoteRecipeRawMaterial() | |||
{ | |||
DeviceIp = RawMaterials.Count + 1, | |||
RawMaterialWeight = RawmaterialWeight, | |||
RawMaterialBarrelNum = RawMaterialbarrelNum, | |||
RawMaterialLocation = RawMaterialLocation | |||
}); | |||
RawMaterials.Add(new RemoteRecipeRawMaterial() | |||
{ | |||
DeviceIp = RawMaterials.Count + 1, | |||
RawMaterialWeight = RawmaterialWeight1, | |||
RawMaterialBarrelNum = RawMaterialbarrelNum1, | |||
RawMaterialLocation = RawMaterialLocation1 | |||
}); | |||
RawMaterials.Add(new RemoteRecipeRawMaterial() | |||
{ | |||
DeviceIp = RawMaterials.Count + 1, | |||
RawMaterialWeight = RawmaterialWeight2, | |||
RawMaterialBarrelNum = RawMaterialbarrelNum2, | |||
RawMaterialLocation = RawMaterialLocation2 | |||
}); | |||
Recipes.Add(new Model.RemoteRecipeData() | |||
{ | |||
RecipeName = recipeName, | |||
RecipeCode = recipeCode, | |||
TrayCode = Traycode, | |||
RawMaterial = RawMaterials | |||
}); | |||
RawMaterials.Clear(); | |||
string recipeName_2 = "配方2"; | |||
string recipeCode_2 = "20001"; | |||
int Traycode_2 = 3; | |||
float RawmaterialWeight_2 = 10; | |||
short RawMaterialbarrelNum_2 = 1; | |||
int RawMaterialLocation_2 = 5; | |||
float RawmaterialWeight1_2 = 20; | |||
short RawMaterialbarrelNum1_2 = 2; | |||
int RawMaterialLocation1_2 = 7; | |||
float RawmaterialWeight2_2 = 30; | |||
short RawMaterialbarrelNum2_2 = 3; | |||
int RawMaterialLocation2_2 = 9; | |||
RawMaterials.Add(new RemoteRecipeRawMaterial() | |||
{ | |||
DeviceIp = RawMaterials.Count + 1, | |||
RawMaterialWeight = RawmaterialWeight_2, | |||
RawMaterialBarrelNum = RawMaterialbarrelNum_2, | |||
RawMaterialLocation = RawMaterialLocation_2 | |||
}); | |||
RawMaterials.Add(new RemoteRecipeRawMaterial() | |||
{ | |||
DeviceIp = RawMaterials.Count + 1, | |||
RawMaterialWeight = RawmaterialWeight1_2, | |||
RawMaterialBarrelNum = RawMaterialbarrelNum1_2, | |||
RawMaterialLocation = RawMaterialLocation1_2 | |||
}); | |||
RawMaterials.Add(new RemoteRecipeRawMaterial() | |||
{ | |||
DeviceIp = RawMaterials.Count + 1, | |||
RawMaterialWeight = RawmaterialWeight2_2, | |||
RawMaterialBarrelNum = RawMaterialbarrelNum2_2, | |||
RawMaterialLocation = RawMaterialLocation2_2 | |||
}); | |||
Recipes.Add(new Model.RemoteRecipeData() | |||
{ | |||
RecipeName = recipeName_2, | |||
RecipeCode = recipeCode_2, | |||
TrayCode = Traycode_2, | |||
RawMaterial = RawMaterials | |||
}); | |||
} | |||
} | |||
} |
@@ -0,0 +1,113 @@ | |||
<ResourceDictionary | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:con="clr-namespace:BPASmartClient.FoodStationTest.Converter"> | |||
<SolidColorBrush x:Key="tabColor" Color="#FF2AB2E7" /> | |||
<!--<SolidColorBrush x:Key="bordColor" Color="#33ffffff" />--> | |||
<SolidColorBrush x:Key="bordColor" Color="#552AB2E7" /> | |||
<con:DataTableRedundantConverter x:Key="tabConvert" /> | |||
<Style x:Key="RowRadioButtonStyle" TargetType="{x:Type RadioButton}"> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type RadioButton}"> | |||
<Border | |||
x:Name="NvaBor" | |||
Background="Transparent" | |||
BorderBrush="#FF2AB2E7" | |||
BorderThickness="0"> | |||
<ContentControl | |||
Margin="10,4" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
HorizontalContentAlignment="Center" | |||
VerticalContentAlignment="Center" | |||
Content="{TemplateBinding Content}" | |||
FontSize="16" /> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsChecked" Value="True"> | |||
<Setter TargetName="NvaBor" Property="Background" Value="#22ffffff" /> | |||
<Setter TargetName="NvaBor" Property="BorderThickness" Value="0" /> | |||
</Trigger> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<Condition Property="IsChecked" Value="false" /> | |||
<Condition Property="IsMouseOver" Value="True" /> | |||
</MultiTrigger.Conditions> | |||
<MultiTrigger.Setters> | |||
<Setter TargetName="NvaBor" Property="Background" Value="#22ffffff" /> | |||
</MultiTrigger.Setters> | |||
</MultiTrigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style x:Key="InputTextboxStyle" TargetType="TextBox"> | |||
<Setter Property="Margin" Value="5,0,0,0" /> | |||
<Setter Property="BorderThickness" Value="0" /> | |||
<Setter Property="HorizontalAlignment" Value="Left" /> | |||
<Setter Property="Width" Value="150" /> | |||
<Setter Property="Height" Value="40" /> | |||
<Setter Property="CaretBrush" Value="{StaticResource TitleBorderColor}" /> | |||
<Setter Property="Foreground" Value="{StaticResource TitleBorderColor}" /> | |||
<Setter Property="VerticalContentAlignment" Value="Center" /> | |||
<Setter Property="FontSize" Value="14" /> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
</Style> | |||
<Style x:Key="ControlButtonStyle" TargetType="Button"> | |||
<Setter Property="Margin" Value="0" /> | |||
<Setter Property="FontSize" Value="18" /> | |||
<Setter Property="Foreground" Value="#FFF53F62" /> | |||
<Setter Property="FontWeight" Value="SemiBold" /> | |||
<Setter Property="FontFamily" Value="楷体" /> | |||
<Setter Property="VerticalContentAlignment" Value="Center" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="Button"> | |||
<Border | |||
Name="TitleBarBr" | |||
BorderBrush="#00c2f4" | |||
BorderThickness="0" | |||
CornerRadius="0" | |||
Opacity="0.8"> | |||
<ContentPresenter | |||
Margin="{TemplateBinding Margin}" | |||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" | |||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" /> | |||
<Border.Background> | |||
<ImageBrush | |||
ImageSource="/BPASmartClient.CustomResource;component/Image/组合边框1.1.png" | |||
Opacity="0.8" | |||
Stretch="Fill" /> | |||
</Border.Background> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter TargetName="TitleBarBr" Property="Opacity" Value="1" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style x:Key="TitleTextblockStyle" TargetType="TextBlock"> | |||
<Setter Property="FontSize" Value="16" /> | |||
<Setter Property="HorizontalAlignment" Value="Center" /> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
<Setter Property="Foreground" Value="{StaticResource tabColor}" /> | |||
<Setter Property="FontFamily" Value="楷体" /> | |||
<Setter Property="FontWeight" Value="SemiBold" /> | |||
</Style> | |||
</ResourceDictionary> |
@@ -0,0 +1,377 @@ | |||
<UserControl | |||
x:Class="BPASmartClient.FoodStationTest.View.BomOfMaterialView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:con="clr-namespace:BPASmartClient.FoodStationTest.Converter" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:vm="clr-namespace:BPASmartClient.FoodStationTest.ViewModel" | |||
d:DesignHeight="1080" | |||
d:DesignWidth="1920" | |||
mc:Ignorable="d"> | |||
<UserControl.DataContext> | |||
<vm:BomOfMaterialViewModel /> | |||
</UserControl.DataContext> | |||
<UserControl.Resources> | |||
<ResourceDictionary> | |||
<ResourceDictionary.MergedDictionaries> | |||
<ResourceDictionary Source="/BPASmartClient.FoodStationTest;component/Resource/MyStyle.xaml" /> | |||
</ResourceDictionary.MergedDictionaries> | |||
</ResourceDictionary> | |||
</UserControl.Resources> | |||
<!--<UserControl.Resources> | |||
<SolidColorBrush x:Key="tabColor" Color="#FF2AB2E7" /> | |||
--> | |||
<!--<SolidColorBrush x:Key="bordColor" Color="#33ffffff" />--> | |||
<!-- | |||
<SolidColorBrush x:Key="bordColor" Color="#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="60" /> | |||
<RowDefinition Height="50" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<!--#region 表格标题栏设置--> | |||
<Grid> | |||
<StackPanel | |||
Margin="0,0,10,0" | |||
HorizontalAlignment="Right" | |||
Orientation="Horizontal"> | |||
<Button | |||
Width="200" | |||
Height="50" | |||
Margin="5" | |||
Command="{Binding GetBomMaterialData}" | |||
Content="拉取本地数据" | |||
FontSize="28" | |||
Foreground="DeepSkyBlue" | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
<Button | |||
Width="200" | |||
Height="50" | |||
Margin="5" | |||
Command="{Binding DeleteAllMaterial}" | |||
Content="删除所有数据" | |||
FontSize="28" | |||
Foreground="DeepSkyBlue" | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
<Button | |||
Width="200" | |||
Height="50" | |||
Margin="5" | |||
Command="{Binding AddMaterial}" | |||
Content="新增数据" | |||
FontSize="28" | |||
Foreground="DeepSkyBlue" | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
<Button | |||
Width="200" | |||
Height="50" | |||
Margin="5" | |||
Command="{Binding SaveMaterials}" | |||
Content="保存参数" | |||
FontSize="28" | |||
Foreground="DeepSkyBlue" | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
</StackPanel> | |||
</Grid> | |||
<Grid | |||
Grid.Row="1" | |||
Margin="0,10,17,0" | |||
Background="#ff0C255F"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="0" | |||
FontSize="24" | |||
Style="{StaticResource TitleTextblockStyle}" | |||
Text="序号" /> | |||
<TextBlock | |||
Grid.Column="1" | |||
FontSize="24" | |||
Style="{StaticResource TitleTextblockStyle}" | |||
Text="原料编号" /> | |||
<TextBlock | |||
Grid.Column="2" | |||
FontSize="24" | |||
Style="{StaticResource TitleTextblockStyle}" | |||
Text="原料名称" /> | |||
<TextBlock | |||
Grid.Column="3" | |||
FontSize="24" | |||
Style="{StaticResource TitleTextblockStyle}" | |||
Text="操作" /> | |||
<Border | |||
Grid.Column="0" | |||
Grid.ColumnSpan="4" | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,1,1,1" /> | |||
<Border | |||
Grid.Column="1" | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" /> | |||
<Border | |||
Grid.Column="3" | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" /> | |||
<!--<Grid Grid.Column="0"> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="24" | |||
Foreground="Aqua" | |||
Text="序号" /> | |||
--> | |||
<!--<Border BorderThickness="1,1,1,1" Cursor="SizeWE" | |||
BorderBrush="{StaticResource bordColor}" />--> | |||
<!-- | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="1" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="24" | |||
Foreground="Aqua" | |||
Text="原料编号" /> | |||
<TextBlock | |||
Grid.Column="2" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="24" | |||
Foreground="Aqua" | |||
Text="原料名称" /> | |||
<TextBlock | |||
Grid.Column="3" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="24" | |||
Foreground="Aqua" | |||
Text="操作" />--> | |||
</Grid> | |||
<Grid Grid.Row="2"> | |||
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Visible"> | |||
<ItemsControl Foreground="DeepSkyBlue" ItemsSource="{Binding RawMaterialInfo}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid Name="gr"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Text="{Binding Count}" /> | |||
<TextBox | |||
Grid.Column="1" | |||
Style="{StaticResource InputTextboxStyle}" | |||
Text="{Binding MaterialCode}" /> | |||
<TextBox | |||
Grid.Column="2" | |||
Style="{StaticResource InputTextboxStyle}" | |||
Text="{Binding MaterialName}" /> | |||
<Button | |||
Grid.Column="3" | |||
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RawMaterialLocation}" | |||
Content="删除" | |||
FontSize="16" | |||
Style="{StaticResource ControlButtonStyle}" /> | |||
<Border | |||
Grid.Column="0" | |||
Grid.ColumnSpan="4" | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,1" /> | |||
<Border | |||
Grid.Column="1" | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" /> | |||
<Border | |||
Grid.Column="3" | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" /> | |||
<!--<Grid Grid.Column="0" Margin="5"> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Text="{Binding Count}" /> | |||
</Grid> | |||
<Grid Grid.Column="1" Margin="5"> | |||
<TextBox | |||
Width="50" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Text="{Binding MaterialCode}" /> | |||
</Grid> | |||
<Grid Grid.Column="2" Margin="5"> | |||
<TextBox | |||
Width="200" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Text="{Binding MaterialName}" /> | |||
</Grid> | |||
<Grid Grid.Column="3" Margin="5"> | |||
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal"> | |||
<pry:IcoButton | |||
Margin="3,4,4,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Background="#11F53F62" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
CommandParameter="{Binding Count}" | |||
Content="删除" | |||
EnterBackground="#22F53F62" | |||
Foreground="#FFF53F62" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
</StackPanel> | |||
</Grid>--> | |||
</Grid> | |||
<DataTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" /> | |||
</Trigger> | |||
</DataTemplate.Triggers> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</ScrollViewer> | |||
</Grid> | |||
</Grid> | |||
</UserControl> |
@@ -0,0 +1,15 @@ | |||
using System.Windows.Controls; | |||
namespace BPASmartClient.FoodStationTest.View | |||
{ | |||
/// <summary> | |||
/// HKPlcCommMonitor.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class BomOfMaterialView : UserControl | |||
{ | |||
public BomOfMaterialView() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,122 @@ | |||
<Window | |||
x:Class="BPASmartClient.FoodStationTest.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.FoodStationTest.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:vm="clr-namespace:BPASmartClient.FoodStationTest.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,21 @@ | |||
using BPASmartClient.Helper; | |||
using System; | |||
using System.Windows; | |||
using System.Windows.Input; | |||
namespace BPASmartClient.FoodStationTest.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,195 @@ | |||
<UserControl | |||
x:Class="BPASmartClient.FoodStationTest.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.FoodStationTest.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.FoodStationTest.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 /> | |||
<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}" /> | |||
<WrapPanel Grid.Row="3"> | |||
<Button | |||
Width="65" | |||
Height="30" | |||
Margin="0,0,0,0" | |||
VerticalAlignment="Top" | |||
Command="{Binding DataContext.Open, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding IpAddress}" | |||
Content="开盖" | |||
FontSize="16" | |||
IsEnabled="{Binding IsEnable}" | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
<Button | |||
Width="65" | |||
Height="30" | |||
Margin="10,0,0,0" | |||
VerticalAlignment="Top" | |||
Command="{Binding DataContext.Close, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding IpAddress}" | |||
Content="关盖" | |||
FontSize="16" | |||
IsEnabled="{Binding IsEnable}" | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
</WrapPanel> | |||
<!--<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,15 @@ | |||
using System.Windows.Controls; | |||
namespace BPASmartClient.FoodStationTest.View | |||
{ | |||
/// <summary> | |||
/// DeviceListView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class DeviceListView : UserControl | |||
{ | |||
public DeviceListView() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,284 @@ | |||
<UserControl | |||
x:Class="BPASmartClient.FoodStationTest.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.FoodStationTest.Converter" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.FoodStationTest.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:vm="clr-namespace:BPASmartClient.FoodStationTest.ViewModel" | |||
d:DesignHeight="1080" | |||
d:DesignWidth="1920" | |||
mc:Ignorable="d"> | |||
<UserControl.DataContext> | |||
<vm:DeviceMaterialParViewModel /> | |||
</UserControl.DataContext> | |||
<UserControl.Resources> | |||
<ResourceDictionary> | |||
<ResourceDictionary.MergedDictionaries> | |||
<ResourceDictionary Source="/BPASmartClient.FoodStationTest;component/Resource/MyStyle.xaml" /> | |||
</ResourceDictionary.MergedDictionaries> | |||
</ResourceDictionary> | |||
</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 /> | |||
<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="精度误差阈值(±g)" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<Grid Grid.Column="10"> | |||
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="功能操作" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<Border | |||
Grid.ColumnSpan="11" | |||
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 /> | |||
<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"> | |||
<TextBox | |||
Foreground="Red" | |||
Style="{StaticResource InputTextboxStyle}" | |||
Text="{Binding ErrorRange}" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<Button | |||
Grid.Column="10" | |||
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
CommandParameter="{Binding MaterialName}" | |||
Content="删除" | |||
FontSize="16" | |||
Style="{StaticResource ControlButtonStyle}" /> | |||
<Border | |||
Grid.ColumnSpan="11" | |||
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> |