@@ -175,8 +175,12 @@ | |||
<None Remove="Image\窗体样式\Tab\Tab_SelectBJ.png" /> | |||
<None Remove="Image\窗体样式\Tab\Tab_SelectWZBJ.png" /> | |||
<None Remove="Image\竖线.png" /> | |||
<None Remove="Image\系统名称.png" /> | |||
<None Remove="Image\红色圆角矩形背景.png" /> | |||
<None Remove="Image\纹理背景.jpeg" /> | |||
<None Remove="Image\组 8.png" /> | |||
<None Remove="Image\组合边框1.1.png" /> | |||
<None Remove="Image\组合边框1.png" /> | |||
<None Remove="Image\维护.png" /> | |||
<None Remove="Image\背景.png" /> | |||
<None Remove="Image\背景2.png" /> | |||
@@ -189,6 +193,7 @@ | |||
<None Remove="Image\背景矢量\左下.png" /> | |||
<None Remove="Image\背景矢量\矢量智能对象.png" /> | |||
<None Remove="Image\营销额.png" /> | |||
<None Remove="Image\蓝色背景.png" /> | |||
<None Remove="Image\蓝边框.png" /> | |||
<None Remove="Image\表头背景.png" /> | |||
<None Remove="Image\表格\矩形2609.png" /> | |||
@@ -299,10 +304,15 @@ | |||
<Resource Include="Image\圆角矩形 30 拷贝.png" /> | |||
<Resource Include="Image\登录界面背景.jpg" /> | |||
<Resource Include="Image\登录界面背景1.jpg" /> | |||
<Resource Include="Image\系统名称.png" /> | |||
<Resource Include="Image\红色圆角矩形背景.png" /> | |||
<Resource Include="Image\纹理背景.jpeg" /> | |||
<Resource Include="Image\组 8.png" /> | |||
<Resource Include="Image\组合边框1.1.png" /> | |||
<Resource Include="Image\组合边框1.png" /> | |||
<Resource Include="Image\背景2.png" /> | |||
<Resource Include="Image\背景3.jpg" /> | |||
<Resource Include="Image\蓝色背景.png" /> | |||
<Resource Include="Image\蓝边框.png" /> | |||
<Resource Include="Image\调味品.jpeg" /> | |||
<Resource Include="Image\边角.png" /> | |||
@@ -37,11 +37,11 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||
{ | |||
bool value = Convert.ToBoolean(Alarm.GetType().GetProperty(item.Name)?.GetValue(Alarm)); | |||
EdgeAlarm(value, AlarmModel.AlarmInfo, 1, AlarmModel.AlarmLevel, AlarmModel.AlarmType); | |||
} | |||
} | |||
} | |||
} | |||
Thread.Sleep(100); | |||
}), "报警通用模块监听"); | |||
}), $"{typeof(AlarmT)},报警通用模块监听"); | |||
} | |||
@@ -57,7 +57,7 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||
if (!delays.ContainsKey(text)) delays.TryAdd(text, Delay.GetInstance(text)); | |||
if (edgeType == AlarmTriggerType.Rising ? delays[text].Start(Trigger, delay) : delays[text].Start(!Trigger, delay)) | |||
{ | |||
if (edgeType == AlarmTriggerType.Rising ? !flagbit[text] :flagbit[text]) | |||
if (edgeType == AlarmTriggerType.Rising ? !flagbit[text] : flagbit[text]) | |||
{ | |||
AddAlarm(Trigger, text, alarmLevel); | |||
flagbit[text] = edgeType == AlarmTriggerType.Rising ? true : false; | |||
@@ -27,7 +27,7 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||
public string Password { get { return _password; } set { _password = value; OnPropertyChanged(); } } | |||
private string _password = "admin"; | |||
public string CardId { get; set; } = String.Empty; | |||
public string CardId { get; set; } = string.Empty; | |||
public List<RawMaterialModel> locaRawMaterials { get; set; } = new List<RawMaterialModel>(); | |||
@@ -354,7 +354,7 @@ | |||
<Setter TargetName="PART_MonthView" Property="Visibility" Value="Hidden" /> | |||
<Setter TargetName="PART_YearView" Property="Visibility" Value="Visible" /> | |||
</DataTrigger> | |||
<DataTrigger Binding="{Binding DisplayMode, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Calendar}}}" Value="Decade"> | |||
<Setter TargetName="PART_MonthView" Property="Visibility" Value="Hidden" /> | |||
<Setter TargetName="PART_YearView" Property="Visibility" Value="Visible" /> | |||
@@ -29,4 +29,38 @@ | |||
</Style> | |||
<!--#endregion--> | |||
<Style x:Key="ImageButtonStyle" TargetType="Button"> | |||
<Setter Property="Margin" Value="10" /> | |||
<Setter Property="FontSize" Value="18" /> | |||
<Setter Property="Height" Value="80" /> | |||
<Setter Property="Foreground" Value="#00c2f4" /> | |||
<Setter Property="FontFamily" Value="楷体" /> | |||
<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/系统名称.png" /> | |||
</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> | |||
</ResourceDictionary> |
@@ -17,13 +17,11 @@ | |||
Opacity="0.7" | |||
SnapsToDevicePixels="true"> | |||
<Grid> | |||
<Image Source="/BPASmartClient.CustomResource;component/Image/textBox.png" Stretch="Fill" /> | |||
<Image Source="/BPASmartClient.CustomResource;component/Image/textBox.png" Stretch="Fill" /> | |||
<ScrollViewer | |||
x:Name="PART_ContentHost" | |||
Grid.Column="1" | |||
MinHeight="20" | |||
Margin="10,0,0,0" | |||
VerticalAlignment="Center" | |||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /> | |||
</Grid> | |||
@@ -41,35 +41,57 @@ | |||
Fill="{StaticResource fillColor}" | |||
Stroke="{StaticResource BorderColor}" /> | |||
<TextBlock Text="IP:192.168.0.1" FontSize="25" Foreground="Red" Canvas.Left="31" Canvas.Top="156" RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Left" VerticalAlignment="Center"> | |||
<TextBlock | |||
Canvas.Left="31" | |||
Canvas.Top="156" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Center" | |||
FontSize="25" | |||
Foreground="Red" | |||
RenderTransformOrigin="0.5,0.5" | |||
Text="IP:192.168.0.1"> | |||
<TextBlock.RenderTransform> | |||
<TransformGroup> | |||
<ScaleTransform/> | |||
<SkewTransform/> | |||
<RotateTransform Angle="12.644"/> | |||
<TranslateTransform/> | |||
<ScaleTransform /> | |||
<SkewTransform /> | |||
<RotateTransform Angle="12.644" /> | |||
<TranslateTransform /> | |||
</TransformGroup> | |||
</TextBlock.RenderTransform> | |||
</TextBlock> | |||
<TextBlock Text="原料设备A" FontSize="25" Foreground="Red" Canvas.Left="55" Canvas.Top="106" RenderTransformOrigin="0.5,0.5"> | |||
<TextBlock | |||
Canvas.Left="55" | |||
Canvas.Top="106" | |||
FontSize="25" | |||
Foreground="Red" | |||
RenderTransformOrigin="0.5,0.5" | |||
Text="原料设备A"> | |||
<TextBlock.RenderTransform> | |||
<TransformGroup> | |||
<ScaleTransform/> | |||
<SkewTransform/> | |||
<RotateTransform Angle="12.644"/> | |||
<TranslateTransform/> | |||
<ScaleTransform /> | |||
<SkewTransform /> | |||
<RotateTransform Angle="12.644" /> | |||
<TranslateTransform /> | |||
</TransformGroup> | |||
</TextBlock.RenderTransform> | |||
</TextBlock> | |||
<TextBlock Text="125.0 kg" FontSize="25" Foreground="Red" Canvas.Left="275" Canvas.Top="78" RenderTransformOrigin="0.721,0.662" HorizontalAlignment="Left" VerticalAlignment="Center"> | |||
<TextBlock | |||
Canvas.Left="275" | |||
Canvas.Top="78" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Center" | |||
FontSize="25" | |||
Foreground="Red" | |||
RenderTransformOrigin="0.721,0.662" | |||
Text="125.0 kg"> | |||
<TextBlock.RenderTransform> | |||
<TransformGroup> | |||
<ScaleTransform/> | |||
<SkewTransform/> | |||
<RotateTransform Angle="-21.298"/> | |||
<TranslateTransform X="0.241" Y="-6.13"/> | |||
<ScaleTransform /> | |||
<SkewTransform /> | |||
<RotateTransform Angle="-21.298" /> | |||
<TranslateTransform X="0.241" Y="-6.13" /> | |||
</TransformGroup> | |||
</TextBlock.RenderTransform> | |||
</TextBlock> | |||
@@ -149,7 +149,17 @@ namespace BPASmartClient.Helper | |||
} | |||
/// <summary> | |||
/// 获取16位整数中指定位的值 | |||
/// </summary> | |||
/// <param name="data">要获取的整数</param> | |||
/// <param name="offset">偏移量 范围(1-16)</param> | |||
/// <returns></returns> | |||
public static bool Get16bitValue(this ushort data, byte offset) | |||
{ | |||
if (offset > 16 || offset < 1) return false; | |||
return (data & 1 << offset - 1) == 0 ? false : true; | |||
} | |||
@@ -145,31 +145,31 @@ namespace BPASmartClient.Modbus | |||
return LwAddress; | |||
} | |||
} | |||
else if (address.ToUpper().Contains("D") && address.Length == 5) | |||
else if (address.ToUpper().Contains("D") && address.Length == 5) | |||
{ | |||
try | |||
{ | |||
string head = (Convert.ToInt32(address.Substring(1, 1))).ToString(); | |||
int num = Convert.ToInt32(address.Substring(2, 3)); | |||
int len = num.ToString().Length; | |||
string tail=string.Empty; | |||
string tail = string.Empty; | |||
switch (len) | |||
{ | |||
case 1: | |||
{ | |||
case 1: | |||
if ((Convert.ToInt32(address.Substring(4, 1))).ToString().Length > 1) | |||
{ | |||
tail = "0" + (Convert.ToInt32(address.Substring(4, 1))).ToString(); | |||
} | |||
else | |||
else | |||
{ | |||
tail = "00" + (Convert.ToInt32(address.Substring(4, 1))).ToString(); | |||
} | |||
break; | |||
case 2: | |||
if ((Convert.ToInt32(address.Substring(3, 2))).ToString().Length >2) | |||
if ((Convert.ToInt32(address.Substring(3, 2))).ToString().Length > 2) | |||
{ | |||
tail =(Convert.ToInt32(address.Substring(3, 2))).ToString(); | |||
tail = (Convert.ToInt32(address.Substring(3, 2))).ToString(); | |||
} | |||
else | |||
{ | |||
@@ -180,21 +180,21 @@ namespace BPASmartClient.Modbus | |||
tail = (Convert.ToInt32(address.Substring(2, 3))).ToString(); | |||
break; | |||
} | |||
address = head + tail; | |||
return Convert.ToInt32(address); | |||
} | |||
catch (Exception) | |||
{ | |||
//打印日志 | |||
} | |||
} | |||
} | |||
return -1; | |||
} | |||
private void ExceptionHandling(Exception ex) | |||
{ | |||
if (ex.InnerException is SocketException) | |||
@@ -208,7 +208,15 @@ namespace BPASmartClient.Modbus | |||
} | |||
} | |||
//public object ReadHC(stri) | |||
public short ReadShort(string address) | |||
{ | |||
var res = Read(address); | |||
if (res != null && res is short[] shorts && shorts.Length == 1) | |||
{ | |||
return shorts[0]; | |||
} | |||
return 0; | |||
} | |||
public object Read(string address, ushort len = 1, byte slaveAddress = 1) | |||
{ | |||
@@ -222,7 +230,7 @@ namespace BPASmartClient.Modbus | |||
commandType = CommandType.Coils; | |||
return master.ReadCoils(slaveAddress, startAddress, len); | |||
} | |||
else if (address.ToUpper().Contains("VW") || address.ToUpper().Contains("LW")|| address.ToUpper().Contains("D")) | |||
else if (address.ToUpper().Contains("VW") || address.ToUpper().Contains("LW") || address.ToUpper().Contains("D")) | |||
{ | |||
commandType = CommandType.HoldingRegisters; | |||
return master.ReadHoldingRegisters(slaveAddress, startAddress, len); | |||
@@ -232,7 +240,7 @@ namespace BPASmartClient.Modbus | |||
commandType = CommandType.Inputs; | |||
return master.ReadInputs(slaveAddress, startAddress, len); | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -241,6 +249,7 @@ namespace BPASmartClient.Modbus | |||
} | |||
return default(object); | |||
} | |||
#region 180项目调用 | |||
public int GetAddress(string address, string target) | |||
{ | |||
@@ -251,15 +260,15 @@ namespace BPASmartClient.Modbus | |||
{ | |||
try | |||
{ | |||
string head = "4"+(Convert.ToInt32(address.Substring(1, 1)) - 1).ToString(); | |||
string head = "4" + (Convert.ToInt32(address.Substring(1, 1)) - 1).ToString(); | |||
string tail = address.Substring(2, 3); | |||
address = head + tail; | |||
address = head + tail; | |||
return Convert.ToInt32(address); | |||
} | |||
catch (Exception) | |||
{ | |||
//打印日志 | |||
} | |||
} | |||
@@ -291,11 +300,11 @@ namespace BPASmartClient.Modbus | |||
public void Write<T>(string address, T value, string target, byte slaveAddress = 1) | |||
{ | |||
if (address == null || tcpClient == null) return; | |||
ushort startAddress = (ushort)GetAddress(address,target); | |||
ushort startAddress = (ushort)GetAddress(address, target); | |||
CommandType commandType = CommandType.Coils; | |||
try | |||
{ | |||
if (address.ToUpper().Contains("D")) | |||
{ | |||
commandType = CommandType.HoldingRegisters; | |||
@@ -303,17 +312,19 @@ namespace BPASmartClient.Modbus | |||
{ | |||
master.WriteSingleRegister(slaveAddress, startAddress, ushortValue); | |||
} | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
MessageLog.GetInstance.ShowEx($"写入地址:【{address}:= {startAddress}】,写入类型:【{commandType.ToString()}】出错,{ex.ToString()}"); | |||
ExceptionHandling(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
public void Write<T>(string address, T value, byte slaveAddress = 1) | |||
{ | |||
if (address == null || tcpClient == null) return; | |||
@@ -329,7 +340,7 @@ namespace BPASmartClient.Modbus | |||
else if (value is bool[] boolsValue) | |||
master.WriteMultipleCoils(slaveAddress, startAddress, boolsValue); | |||
} | |||
else if (address.ToUpper().Contains("VW") || address.ToUpper().Contains("LW")|| address.ToUpper().Contains("D")) | |||
else if (address.ToUpper().Contains("VW") || address.ToUpper().Contains("LW") || address.ToUpper().Contains("D")) | |||
{ | |||
commandType = CommandType.HoldingRegisters; | |||
if (value is ushort ushortValue) | |||
@@ -30,8 +30,6 @@ namespace BPASmartClient.DosingSystem | |||
MenuInit(); | |||
DataInit(); | |||
DeviceInquire.GetInstance.Init();//配料机设备上线监听,设备列表初始化 | |||
//NewMaterialDeviceParView newMaterialDeviceParView = new NewMaterialDeviceParView(); | |||
//newMaterialDeviceParView.ShowDialog(); | |||
MainView mv = new MainView(); | |||
//mv.Show(); | |||
LoginView lv = new LoginView(); | |||
@@ -50,6 +48,7 @@ namespace BPASmartClient.DosingSystem | |||
{ | |||
base.OnExit(e); | |||
Json<LocaPar>.Save(); | |||
Json<DevicePar>.Save(); | |||
MessageLog.GetInstance.LogSave(); | |||
ThreadManage.GetInstance().Dispose(); | |||
} | |||
@@ -85,6 +84,25 @@ namespace BPASmartClient.DosingSystem | |||
}); | |||
#endregion | |||
#region 参数设置 | |||
ObservableCollection<SubMenumodel> ParSet = new ObservableCollection<SubMenumodel>(); | |||
ParSet.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "原料参数设置", | |||
SubMenuPermission = new Permission[] { Permission.管理员 }, | |||
AssemblyName = "BPASmartClient.DosingSystem", | |||
ToggleWindowPath = "View.DeviceMaterialParView" | |||
}); | |||
MenuManage.GetInstance.menuModels.Add(new MenuModel() | |||
{ | |||
MainMenuIcon = "", | |||
MainMenuName = "参数设置", | |||
Alias = "Parameter Set", | |||
subMenumodels = ParSet, | |||
}); | |||
#endregion | |||
#region 消息日志 | |||
ObservableCollection<SubMenumodel> InfoLog = new ObservableCollection<SubMenumodel>(); | |||
InfoLog.Add(new SubMenumodel() | |||
@@ -202,6 +220,7 @@ namespace BPASmartClient.DosingSystem | |||
{ | |||
Config.GetInstance.Init(); | |||
Json<LocaPar>.Read(); | |||
Json<DevicePar>.Read(); | |||
Json<LocaMaterial>.Read(); | |||
} | |||
@@ -0,0 +1,31 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Globalization; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows.Data; | |||
using System.Windows.Media; | |||
namespace BPASmartClient.DosingSystem.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,48 @@ | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.DosingSystem.Model | |||
{ | |||
public class AlarmInfo | |||
{ | |||
/// <summary> | |||
/// 1#急停 | |||
/// </summary> | |||
[Alarm("1#急停")] | |||
public bool EStop1 { get; set; } | |||
/// <summary> | |||
/// 伺服故障 | |||
/// </summary> | |||
[Alarm("伺服故障")] | |||
public bool Servo { get; set; } | |||
/// <summary> | |||
/// 变频器故障 | |||
/// </summary> | |||
[Alarm("变频器故障")] | |||
public bool Inverter { get; set; } | |||
/// <summary> | |||
/// 2#急停 | |||
/// </summary> | |||
[Alarm("2#急停")] | |||
public bool EStop2 { get; set; } | |||
/// <summary> | |||
/// 料仓上限 | |||
/// </summary> | |||
[Alarm("料仓上限")] | |||
public bool SiloUpperLimit { get; set; } | |||
/// <summary> | |||
/// 料仓下限 | |||
/// </summary> | |||
[Alarm("料仓下限")] | |||
public bool SiloLowerLimit { get; set; } | |||
} | |||
} |
@@ -38,6 +38,17 @@ namespace BPASmartClient.DosingSystem.Model | |||
/// </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> | |||
@@ -18,6 +18,9 @@ namespace BPASmartClient.DosingSystem.Model | |||
private bool _mRunStatus; | |||
public int DeviceNum { get { return _mDeviceNum; } set { _mDeviceNum = value; OnPropertyChanged(); } } | |||
private int _mDeviceNum; | |||
public string DeviceName { get { return _mDeviceName; } set { _mDeviceName = value; OnPropertyChanged(); } } | |||
private string _mDeviceName; | |||
@@ -13,6 +13,7 @@ using System.Threading.Tasks; | |||
using BPASmartClient.CustomResource.UserControls.MessageShow; | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
using BPASmartClient.Model; | |||
using System.Collections.ObjectModel; | |||
namespace BPASmartClient.DosingSystem.Model | |||
{ | |||
@@ -29,9 +30,45 @@ namespace BPASmartClient.DosingSystem.Model | |||
List<string> IPLists = new List<string>();//启动 Ping 任务IP集合 | |||
ConcurrentQueue<string> IPQueues = new ConcurrentQueue<string>();//pincomplete 完成队列 | |||
public ObservableCollection<DeviceCurrentStatus> TopDeviceCurrentStatuses { get; set; } = new ObservableCollection<DeviceCurrentStatus>(); | |||
public ObservableCollection<DeviceCurrentStatus> BottomDeviceCurrentStatuses { get; set; } = new ObservableCollection<DeviceCurrentStatus>(); | |||
public ObservableCollection<Devices> devices { get; set; } = new ObservableCollection<Devices>(); | |||
private void DeviceDataInit() | |||
{ | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
for (int i = 0; i < DeviceLists.Count; i++) | |||
{ | |||
string deviceName = DeviceLists.ElementAt(i).Value.DeviceName; | |||
int TopIndex = Array.FindIndex(TopDeviceCurrentStatuses.ToArray(), p => p.DeviceName == deviceName); | |||
int BottomIndex = Array.FindIndex(BottomDeviceCurrentStatuses.ToArray(), p => p.DeviceName == deviceName); | |||
if (TopIndex >= 0 && TopIndex < TopDeviceCurrentStatuses.Count) | |||
{ | |||
TopDeviceCurrentStatuses.ElementAt(TopIndex).Weight = DeviceLists.ElementAt(i).Value.deviceStatus.WeightFeedback; | |||
TopDeviceCurrentStatuses.ElementAt(TopIndex).DeviceNum = DeviceLists.ElementAt(i).Value.deviceStatus.DeviceNum; | |||
} | |||
if (BottomIndex >= 0 && BottomIndex < BottomDeviceCurrentStatuses.Count) | |||
{ | |||
BottomDeviceCurrentStatuses.ElementAt(BottomIndex).Weight = DeviceLists.ElementAt(i).Value.deviceStatus.WeightFeedback; | |||
BottomDeviceCurrentStatuses.ElementAt(BottomIndex).DeviceNum = DeviceLists.ElementAt(i).Value.deviceStatus.DeviceNum; | |||
} | |||
int deviceIndex = Array.FindIndex(devices.ToArray(), p => p.IpAddress == DeviceLists.ElementAt(i).Key); | |||
if (deviceIndex >= 0 && deviceIndex < devices.Count) | |||
{ | |||
devices.ElementAt(i).DeviceName = DeviceLists.ElementAt(i).Value.DeviceName; | |||
} | |||
} | |||
Thread.Sleep(200); | |||
}), "设备状态监听"); | |||
} | |||
public void Init() | |||
{ | |||
devices.Add(new Devices() { DeviceName = "测试", IpAddress = "192.168.0.1" }); | |||
IpAddressLines(); | |||
DeviceDataInit(); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
if (IPQueues.Count >= IPLists.Count) | |||
@@ -55,6 +92,16 @@ namespace BPASmartClient.DosingSystem.Model | |||
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(); | |||
@@ -87,7 +134,7 @@ namespace BPASmartClient.DosingSystem.Model | |||
DS.modbusTcp.ConnectOk = new Action(() => | |||
{ | |||
string DeviceName = DS.modbusTcp.GetString(DeviceAddress.DeviceName, 20).Trim();//读取设备名称 | |||
string DeviceName = DS.modbusTcp.GetString(DeviceAddress.DeviceName, 20).Trim()?.Replace(" ", "");//读取设备名称 | |||
if (DeviceName.Length > 0) | |||
{ | |||
DeviceLists.TryAdd(ip, DS); | |||
@@ -95,11 +142,19 @@ namespace BPASmartClient.DosingSystem.Model | |||
DeviceLists[ip].modbusTcp.IsReconnect = false; | |||
App.Current.Dispatcher.Invoke(new Action(() => | |||
{ | |||
DeviceListViewModel.devices.Add(new Devices() | |||
{ | |||
DeviceName = DeviceName, | |||
IpAddress = ip | |||
});//加入连接的(有名称的)设备列表 | |||
//DeviceListViewModel.devices.Add(new Devices() | |||
//{ | |||
// DeviceName = DeviceName, | |||
// IpAddress = ip | |||
//});//加入连接的(有名称的)设备列表 | |||
devices.Add(new Devices() { DeviceName = DeviceName, IpAddress = ip }); | |||
if (TopDeviceCurrentStatuses.Count <= 8) | |||
TopDeviceCurrentStatuses.Add(new DeviceCurrentStatus() { DeviceName = DeviceName }); | |||
else | |||
BottomDeviceCurrentStatuses.Add(new DeviceCurrentStatus() { DeviceName = DeviceName }); | |||
for (int i = 0; i < Json<LocaPar>.Data.Recipes.Count; i++) | |||
{ | |||
@@ -115,12 +170,12 @@ namespace BPASmartClient.DosingSystem.Model | |||
{ | |||
if (Global.DeviceRawMaterials.FirstOrDefault(p => p.RawMaterialName == DeviceName) == null) | |||
{ | |||
Global.DeviceRawMaterials.Add(new RawMaterialModel() { RawMaterialName = DeviceName, DeviceIp = ip ,RawMaterialSource = 1}); | |||
Global.DeviceRawMaterials.Add(new RawMaterialModel() { RawMaterialName = DeviceName, DeviceIp = ip, RawMaterialSource = 1 }); | |||
} | |||
} | |||
else | |||
{ | |||
Global.DeviceRawMaterials.Add(new RawMaterialModel() { RawMaterialName = DeviceName, DeviceIp = ip , RawMaterialSource = 1 }); | |||
Global.DeviceRawMaterials.Add(new RawMaterialModel() { RawMaterialName = DeviceName, DeviceIp = ip, RawMaterialSource = 1 }); | |||
} | |||
})); | |||
@@ -140,15 +195,25 @@ namespace BPASmartClient.DosingSystem.Model | |||
DS.modbusTcp.Disconnect = new Action(() => | |||
{ | |||
if (InvalidIP.Contains(ip)) InvalidIP.Remove(ip); | |||
var res = DeviceListViewModel.devices.FirstOrDefault(P => P.IpAddress == ip); | |||
if (res != null && DeviceListViewModel.devices.Contains(res)) | |||
//var res = DeviceListViewModel.devices.FirstOrDefault(P => P.IpAddress == ip); | |||
var res = devices.FirstOrDefault(P => P.IpAddress == ip); | |||
//if (res != null && DeviceListViewModel.devices.Contains(res)) | |||
if (res != null && devices.Contains(res)) | |||
{ | |||
App.Current.Dispatcher.Invoke(new Action(() => | |||
{ | |||
DeviceListViewModel.devices.Remove(res); | |||
//DeviceListViewModel.devices.Remove(res); | |||
devices.Remove(res); | |||
var item = Global.DeviceRawMaterials.FirstOrDefault(P => P.RawMaterialName == res.DeviceName); | |||
if (item != null) Global.DeviceRawMaterials.Remove(item); | |||
var topRes = TopDeviceCurrentStatuses.FirstOrDefault(p => p.DeviceName == res.DeviceName); | |||
var bottomRes = BottomDeviceCurrentStatuses.FirstOrDefault(p => p.DeviceName == res.DeviceName); | |||
if (topRes != null) TopDeviceCurrentStatuses.Remove(topRes); | |||
if (bottomRes != null) BottomDeviceCurrentStatuses.Remove(bottomRes); | |||
})); | |||
} | |||
if (DeviceLists.ContainsKey(ip)) DeviceLists[ip].Dispose(); | |||
}); | |||
@@ -186,22 +251,31 @@ namespace BPASmartClient.DosingSystem.Model | |||
public void Init(string DeviceName) | |||
{ | |||
this.DeviceName = DeviceName; | |||
AlarmHelper<AlarmInfo>.Init(); | |||
if (modbusTcp.Connected) | |||
{ | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
//获取设备运行状态 | |||
var res = this.modbusTcp.Read(DeviceAddress.RunStatus); | |||
if (res != null && res is ushort[] ushortValue) | |||
{ | |||
if (ushortValue.Length >= 1) deviceStatus.RunStatus = ushortValue[0]; | |||
} | |||
//var res = this.modbusTcp.Read(DeviceAddress.RunStatus); | |||
//if (res != null && res is ushort[] ushortValue) | |||
//{ | |||
// if (ushortValue.Length >= 1) deviceStatus.RunStatus = ushortValue[0]; | |||
//} | |||
//获取设备料仓剩余重量 | |||
deviceStatus.WeightFeedback = this.modbusTcp.GetUint(DeviceAddress.WeightFeedback); | |||
var resddd = this.modbusTcp.GetUint(DeviceAddress.WeightFeedback); | |||
var rrr = this.modbusTcp.Read(DeviceAddress.WeightFeedback); | |||
var t = this.modbusTcp.GetReal(DeviceAddress.CutWeightFeedback); | |||
this.DeviceName = modbusTcp.GetString(DeviceAddress.DeviceName, 20).Trim()?.Replace(" ", ""); | |||
deviceStatus.RunStatus = (ushort)this.modbusTcp.ReadShort(DeviceAddress.RunStatus); //获取设备运行状态 | |||
deviceStatus.WeightFeedback = (float)this.modbusTcp.GetUint(DeviceAddress.WeightFeedback);//获取设备料仓剩余重量 | |||
deviceStatus.DeviceNum = (ushort)this.modbusTcp.ReadShort(DeviceAddress.DeviceNum);//获取设备编号 | |||
deviceStatus.DeviceAlarmCode = (ushort)this.modbusTcp.ReadShort(DeviceAddress.DeviceAlarmCode);//获取设备故障编码 | |||
AlarmHelper<AlarmInfo>.Alarm.EStop1 = deviceStatus.DeviceAlarmCode.Get16bitValue(1); | |||
AlarmHelper<AlarmInfo>.Alarm.Servo = deviceStatus.DeviceAlarmCode.Get16bitValue(2); | |||
AlarmHelper<AlarmInfo>.Alarm.Inverter = deviceStatus.DeviceAlarmCode.Get16bitValue(3); | |||
AlarmHelper<AlarmInfo>.Alarm.EStop2 = deviceStatus.DeviceAlarmCode.Get16bitValue(7); | |||
AlarmHelper<AlarmInfo>.Alarm.SiloUpperLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(8); | |||
AlarmHelper<AlarmInfo>.Alarm.SiloLowerLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(9); | |||
Thread.Sleep(100); | |||
}), $"{DeviceName} 开始监听", true); | |||
@@ -230,6 +304,19 @@ namespace BPASmartClient.DosingSystem.Model | |||
{ | |||
modbusTcp.SetReal(DeviceAddress.WeightSet, Value);//写入配方量 | |||
modbusTcp.Write(DeviceAddress.Start, (ushort)1);//设备启动写入 | |||
//配料设备参数写入 | |||
var res = Json<DevicePar>.Data.deviceParModels.FirstOrDefault(p => p.MaterialName == DeviceName); | |||
if (res != null) | |||
{ | |||
modbusTcp.SetReal(DeviceAddress.SlowlyAddWeight, res.SlowlyAddWeight); | |||
modbusTcp.SetReal(DeviceAddress.PreCloseValveWeight, res.PreCloseValveWeight); | |||
modbusTcp.SetUint(DeviceAddress.RapidAcceleration, (uint)res.RapidAcceleration); | |||
modbusTcp.SetUint(DeviceAddress.SlowAcceleration, (uint)res.SlowAcceleration); | |||
modbusTcp.SetUint(DeviceAddress.ServoManualSpeed, (uint)res.ServoManualSpeed); | |||
modbusTcp.SetUint(DeviceAddress.SiloUpperLimitWeight, (uint)res.SiloUpperLimitWeight); | |||
modbusTcp.SetUint(DeviceAddress.LowerLimitWeightOfSilo, (uint)res.LowerLimitWeightOfSilo); | |||
modbusTcp.SetUint(DeviceAddress.StirringSpeed, (uint)res.StirringSpeed); | |||
} | |||
} | |||
} | |||
} | |||
@@ -3,54 +3,73 @@ using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
namespace BPASmartClient.DosingSystem.Model | |||
{ | |||
public class DeviceParModel | |||
public class DeviceParModel : ObservableObject | |||
{ | |||
/// <summary> | |||
/// 原料名称 | |||
/// </summary> | |||
public string MaterialName { get; set; } = string.Empty; | |||
public string MaterialName { get { return _mMaterialName; } set { _mMaterialName = value; OnPropertyChanged(); } } | |||
private string _mMaterialName = string.Empty; | |||
/// <summary> | |||
/// 慢加重量 | |||
/// </summary> | |||
public float SlowlyAddWeight { get; set; } | |||
public float SlowlyAddWeight { get { return _mSlowlyAddWeight; } set { _mSlowlyAddWeight = value; OnPropertyChanged(); } } | |||
private float _mSlowlyAddWeight; | |||
/// <summary> | |||
/// 提前关阀重量 | |||
/// </summary> | |||
public float PreCloseValveWeight { get; set; } | |||
public float PreCloseValveWeight { get { return _mPreCloseValveWeight; } set { _mPreCloseValveWeight = value; OnPropertyChanged(); } } | |||
private float _mPreCloseValveWeight; | |||
/// <summary> | |||
/// 快加速度 | |||
/// </summary> | |||
public int RapidAcceleration { get; set; } | |||
public int RapidAcceleration { get { return _mRapidAcceleration; } set { _mRapidAcceleration = value; OnPropertyChanged(); } } | |||
private int _mRapidAcceleration; | |||
/// <summary> | |||
/// 慢加速度 | |||
/// </summary> | |||
public int SlowAcceleration { get; set; } | |||
public int SlowAcceleration { get { return _mSlowAcceleration; } set { _mSlowAcceleration = value; OnPropertyChanged(); } } | |||
private int _mSlowAcceleration; | |||
/// <summary> | |||
/// 伺服手动速度 | |||
/// </summary> | |||
public int ServoManualSpeed { get; set; } | |||
public int ServoManualSpeed { get { return _mServoManualSpeed; } set { _mServoManualSpeed = value; OnPropertyChanged(); } } | |||
private int _mServoManualSpeed; | |||
/// <summary> | |||
/// 料仓上限重量 | |||
/// </summary> | |||
public int SiloUpperLimitWeight { get; set; } | |||
public int SiloUpperLimitWeight { get { return _mSiloUpperLimitWeight; } set { _mSiloUpperLimitWeight = value; OnPropertyChanged(); } } | |||
private int _mSiloUpperLimitWeight; | |||
/// <summary> | |||
/// 料仓下限重量 | |||
/// </summary> | |||
public int LowerLimitWeightOfSilo { get; set; } | |||
public int LowerLimitWeightOfSilo { get { return _mLowerLimitWeightOfSilo; } set { _mLowerLimitWeightOfSilo = value; OnPropertyChanged(); } } | |||
private int _mLowerLimitWeightOfSilo; | |||
/// <summary> | |||
/// 搅拌速度 | |||
/// </summary> | |||
public int StirringSpeed { get; set; } | |||
public int StirringSpeed { get { return _mStirringSpeed; } set { _mStirringSpeed = value; OnPropertyChanged(); } } | |||
private int _mStirringSpeed; | |||
/// <summary> | |||
/// 是否重复 | |||
/// </summary> | |||
[Newtonsoft.Json.JsonIgnore] | |||
public bool IsRedundant { get { return _mIsRedundant; } set { _mIsRedundant = value; OnPropertyChanged(); } } | |||
private bool _mIsRedundant; | |||
} | |||
} |
@@ -11,8 +11,8 @@ namespace BPASmartClient.DosingSystem.Model | |||
/// <summary> | |||
/// 原料类型 | |||
/// 1:液体 | |||
/// 2:膏体 | |||
/// 1:膏体 | |||
/// 2:液体 | |||
/// 3:粉体 | |||
/// </summary> | |||
public ushort RawMaterialType { get; set; } | |||
@@ -39,7 +39,22 @@ namespace BPASmartClient.DosingSystem.Model | |||
/// <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; } | |||
} | |||
} |
@@ -71,19 +71,16 @@ | |||
Height="150" | |||
VerticalAlignment="Top" | |||
BorderBrush="#00BEFA" | |||
BorderThickness="2" | |||
BorderThickness="0" | |||
ClipToBounds="True" | |||
CornerRadius="8"> | |||
<Border.Effect> | |||
<DropShadowEffect | |||
BlurRadius="18" | |||
ShadowDepth="0" | |||
Color="#00BEFA" /> | |||
</Border.Effect> | |||
CornerRadius="0"> | |||
<Border.Background> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/蓝色背景.png" /> | |||
</Border.Background> | |||
<Grid Margin="20,0,20,0"> | |||
<Grid.RowDefinitions> | |||
<!--<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
@@ -91,34 +88,53 @@ | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
</Grid.ColumnDefinitions>--> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<TextBlock | |||
Grid.Row="0" | |||
Grid.ColumnSpan="2" | |||
VerticalAlignment="Bottom" | |||
Margin="0 0 0 5" | |||
Margin="0,10,0,0" | |||
VerticalAlignment="Center" | |||
FontSize="20" | |||
Foreground="#00BEFA" | |||
Text="{Binding DeviceName}" /> | |||
<StackPanel | |||
Grid.Row="1" | |||
Grid.ColumnSpan="2" | |||
VerticalAlignment="Center" | |||
Orientation="Horizontal"> | |||
<TextBlock | |||
Grid.Row="1" | |||
FontSize="14" | |||
Foreground="Aqua" | |||
Foreground="#aa00BEFA" | |||
Text="设备IP:" /> | |||
<TextBlock | |||
Grid.Row="1" | |||
FontSize="14" | |||
Foreground="Aqua" | |||
Foreground="#aa00BEFA" | |||
Text="{Binding IpAddress}" /> | |||
</StackPanel> | |||
<Button | |||
Grid.Row="2" | |||
Width="130" | |||
Height="30" | |||
VerticalAlignment="Top" | |||
Margin="0,0,0,0" | |||
Command="{Binding DataContext.ChangeNameCommand, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding IpAddress}" | |||
Content="修改原料名称" | |||
FontSize="16" | |||
IsEnabled="{Binding IsEnable}" | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
<!--<Button | |||
Grid.Row="1" | |||
Grid.Column="0" | |||
Grid.ColumnSpan="2" | |||
@@ -133,9 +149,9 @@ | |||
Content="修改原料名称" | |||
IsEnabled="{Binding IsEnable}"> | |||
<Button.Background> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/蓝边框.png" /> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/系统名称.png" /> | |||
</Button.Background> | |||
</Button> | |||
</Button>--> | |||
</Grid> | |||
@@ -0,0 +1,369 @@ | |||
<UserControl | |||
x:Class="BPASmartClient.DosingSystem.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.DosingSystem.Converter" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingSystem.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel" | |||
d:DesignHeight="1080" | |||
d:DesignWidth="1920" | |||
mc:Ignorable="d"> | |||
<UserControl.DataContext> | |||
<vm:DeviceMaterialParViewModel /> | |||
</UserControl.DataContext> | |||
<UserControl.Resources> | |||
<SolidColorBrush x:Key="tabColor" Color="#FF2AB2E7" /> | |||
<SolidColorBrush x:Key="bordColor" Color="#33ffffff" /> | |||
<con:DataTableRedundantConverter x:Key="tabConvert" /> | |||
<Style x:Key="RowRadioButtonStyle" TargetType="{x:Type RadioButton}"> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type RadioButton}"> | |||
<Border | |||
x:Name="NvaBor" | |||
Background="Transparent" | |||
BorderBrush="#FF2AB2E7" | |||
BorderThickness="0"> | |||
<ContentControl | |||
Margin="10,4" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
HorizontalContentAlignment="Center" | |||
VerticalContentAlignment="Center" | |||
Content="{TemplateBinding Content}" | |||
FontSize="16" /> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsChecked" Value="True"> | |||
<Setter TargetName="NvaBor" Property="Background" Value="#22ffffff" /> | |||
<Setter TargetName="NvaBor" Property="BorderThickness" Value="0" /> | |||
</Trigger> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<Condition Property="IsChecked" Value="false" /> | |||
<Condition Property="IsMouseOver" Value="True" /> | |||
</MultiTrigger.Conditions> | |||
<MultiTrigger.Setters> | |||
<Setter TargetName="NvaBor" Property="Background" Value="#22ffffff" /> | |||
</MultiTrigger.Setters> | |||
</MultiTrigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style x:Key="InputTextboxStyle" TargetType="TextBox"> | |||
<Setter Property="Margin" Value="5,0,0,0" /> | |||
<Setter Property="BorderThickness" Value="0" /> | |||
<Setter Property="HorizontalAlignment" Value="Left" /> | |||
<Setter Property="Width" Value="150" /> | |||
<Setter Property="Height" Value="40" /> | |||
<Setter Property="CaretBrush" Value="{StaticResource TitleBorderColor}" /> | |||
<Setter Property="Foreground" Value="{StaticResource TitleBorderColor}" /> | |||
<Setter Property="VerticalContentAlignment" Value="Center" /> | |||
<Setter Property="FontSize" Value="14" /> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
</Style> | |||
<Style x:Key="ControlButtonStyle" TargetType="Button"> | |||
<Setter Property="Margin" Value="0" /> | |||
<Setter Property="FontSize" Value="18" /> | |||
<Setter Property="Foreground" Value="#FFF53F62" /> | |||
<Setter Property="FontWeight" Value="SemiBold" /> | |||
<Setter Property="FontFamily" Value="楷体" /> | |||
<Setter Property="VerticalContentAlignment" Value="Center" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="Button"> | |||
<Border | |||
Name="TitleBarBr" | |||
BorderBrush="#00c2f4" | |||
BorderThickness="0" | |||
CornerRadius="0" | |||
Opacity="0.8"> | |||
<ContentPresenter | |||
Margin="{TemplateBinding Margin}" | |||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" | |||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" /> | |||
<Border.Background> | |||
<ImageBrush | |||
ImageSource="/BPASmartClient.CustomResource;component/Image/组合边框1.1.png" | |||
Opacity="0.8" | |||
Stretch="Fill" /> | |||
</Border.Background> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter TargetName="TitleBarBr" Property="Opacity" Value="1" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style x:Key="TitleTextblockStyle" TargetType="TextBlock"> | |||
<Setter Property="FontSize" Value="16" /> | |||
<Setter Property="HorizontalAlignment" Value="Center" /> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
<Setter Property="Foreground" Value="{StaticResource tabColor}" /> | |||
<Setter Property="FontFamily" Value="楷体" /> | |||
<Setter Property="FontWeight" Value="SemiBold" /> | |||
</Style> | |||
</UserControl.Resources> | |||
<Grid Margin="10"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40" /> | |||
<RowDefinition Height="40" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal"> | |||
<Button | |||
Width="150" | |||
Height="40" | |||
Margin="10,0,10,0" | |||
Command="{Binding AddCommand}" | |||
Content="添加原料参数" | |||
FontSize="20" | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
<Button | |||
Width="150" | |||
Height="40" | |||
Margin="10,0,10,0" | |||
Command="{Binding SaveCommand}" | |||
Content="保存参数" | |||
FontSize="20" | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
</StackPanel> | |||
<!--#region 表格标题栏设置--> | |||
<Grid | |||
Grid.Row="1" | |||
Margin="0,10,0,0" | |||
Background="#ff0C255F"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="0" | |||
Style="{StaticResource TitleTextblockStyle}" | |||
Text="原料名称" /> | |||
<Grid Grid.Column="1"> | |||
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="慢加重量(g)" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="2" | |||
Style="{StaticResource TitleTextblockStyle}" | |||
Text="提前关阀重量" /> | |||
<Grid Grid.Column="3"> | |||
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="快加速度" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="4" | |||
Style="{StaticResource TitleTextblockStyle}" | |||
Text="慢加速度" /> | |||
<Grid Grid.Column="5"> | |||
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="伺服手动速度" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="6" | |||
Style="{StaticResource TitleTextblockStyle}" | |||
Text="料仓上限重量" /> | |||
<Grid Grid.Column="7"> | |||
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="料仓下限重量" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="8" | |||
Style="{StaticResource TitleTextblockStyle}" | |||
Text="搅拌速度" /> | |||
<Grid Grid.Column="9"> | |||
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="功能操作" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<Border | |||
Grid.ColumnSpan="10" | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<!--#endregion--> | |||
<Grid Grid.Row="2"> | |||
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"> | |||
<ItemsControl ItemsSource="{Binding deviceParModels}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid Name="gr" Height="30"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBox | |||
Grid.Column="0" | |||
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}" | |||
Style="{StaticResource InputTextboxStyle}" | |||
Text="{Binding MaterialName}" /> | |||
<Grid Grid.Column="1"> | |||
<TextBox | |||
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}" | |||
Style="{StaticResource InputTextboxStyle}" | |||
Text="{Binding SlowlyAddWeight}" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBox | |||
Grid.Column="2" | |||
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}" | |||
Style="{StaticResource InputTextboxStyle}" | |||
Text="{Binding PreCloseValveWeight}" /> | |||
<Grid Grid.Column="3"> | |||
<TextBox | |||
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}" | |||
Style="{StaticResource InputTextboxStyle}" | |||
Text="{Binding RapidAcceleration}" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBox | |||
Grid.Column="4" | |||
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}" | |||
Style="{StaticResource InputTextboxStyle}" | |||
Text="{Binding SlowAcceleration}" /> | |||
<Grid Grid.Column="5"> | |||
<TextBox | |||
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}" | |||
Style="{StaticResource InputTextboxStyle}" | |||
Text="{Binding ServoManualSpeed}" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBox | |||
Grid.Column="6" | |||
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}" | |||
Style="{StaticResource InputTextboxStyle}" | |||
Text="{Binding SiloUpperLimitWeight}" /> | |||
<Grid Grid.Column="7"> | |||
<TextBox | |||
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}" | |||
Style="{StaticResource InputTextboxStyle}" | |||
Text="{Binding LowerLimitWeightOfSilo}" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBox | |||
Grid.Column="8" | |||
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}" | |||
Style="{StaticResource InputTextboxStyle}" | |||
Text="{Binding StirringSpeed}" /> | |||
<Grid Grid.Column="9"> | |||
<Button | |||
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
CommandParameter="{Binding MaterialName}" | |||
Content="删除" | |||
FontSize="16" | |||
Style="{StaticResource ControlButtonStyle}" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<Border | |||
Grid.ColumnSpan="10" | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,1" /> | |||
</Grid> | |||
<DataTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" /> | |||
</Trigger> | |||
</DataTemplate.Triggers> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</ScrollViewer> | |||
</Grid> | |||
</Grid> | |||
</UserControl> |
@@ -0,0 +1,28 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using System.Windows.Controls; | |||
using System.Windows.Data; | |||
using System.Windows.Documents; | |||
using System.Windows.Input; | |||
using System.Windows.Media; | |||
using System.Windows.Media.Imaging; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
namespace BPASmartClient.DosingSystem.View | |||
{ | |||
/// <summary> | |||
/// DeviceMaterialParView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class DeviceMaterialParView : UserControl | |||
{ | |||
public DeviceMaterialParView() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -17,231 +17,96 @@ | |||
</UserControl.DataContext> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="0.5*" /> | |||
<RowDefinition /> | |||
<RowDefinition Height="0.5*" /> | |||
</Grid.RowDefinitions> | |||
<!--#region 测试--> | |||
<!--<ListView | |||
Height="150" | |||
VerticalAlignment="Center" | |||
Background="Transparent" | |||
BorderThickness="0" | |||
ItemsSource="{Binding TopDeviceCurrentStatuses}" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListView.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<UniformGrid | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Columns="10" /> | |||
</ItemsPanelTemplate> | |||
</ListView.ItemsPanel> | |||
<ListView.ItemTemplate> | |||
<DataTemplate> | |||
<Border Background="Transparent"> | |||
<Grid Height="100"> | |||
<pry:MotorBottle | |||
Height="100" | |||
CurrentValue="{Binding Weight}" | |||
IsRun="{Binding RunStatus}" | |||
RenderTransformOrigin="0.5,0.5"> | |||
<pry:MotorBottle.RenderTransform> | |||
<TransformGroup> | |||
<RotateTransform Angle="90" /> | |||
</TransformGroup> | |||
</pry:MotorBottle.RenderTransform> | |||
</pry:MotorBottle> | |||
</Grid> | |||
</Border> | |||
</DataTemplate> | |||
</ListView.ItemTemplate> | |||
</ListView>--> | |||
<!--#region 顶部料仓--> | |||
<Grid Name="TopGrid"> | |||
<ListView | |||
Height="{Binding ElementName=TopGrid, Path=ActualHeight}" | |||
VerticalAlignment="Center" | |||
Background="Transparent" | |||
BorderThickness="0" | |||
ItemsSource="{Binding TopDeviceCurrentStatuses}" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListView.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<!--<WrapPanel Orientation="Horizontal" IsItemsHost="True"/>--> | |||
<UniformGrid | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
Columns="8" | |||
Rows="1" /> | |||
</ItemsPanelTemplate> | |||
</ListView.ItemsPanel> | |||
<ListView.ItemTemplate> | |||
<DataTemplate> | |||
<Border Margin="5" Background="Transparent"> | |||
<Grid Height="220"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<TextBlock | |||
Margin="0,0,0,35" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Bottom" | |||
FontSize="25" | |||
Foreground="#ffccd61f" | |||
Text="{Binding DeviceName}" /> | |||
<StackPanel | |||
Grid.Row="1" | |||
Margin="0,25,0,0" | |||
HorizontalAlignment="Center" | |||
Orientation="Horizontal"> | |||
<TextBlock | |||
FontSize="20" | |||
Foreground="#FF0084FF" | |||
Text="{Binding Weight}" /> | |||
<TextBlock | |||
FontSize="20" | |||
Foreground="#FF0084FF" | |||
Text=" kg" /> | |||
</StackPanel> | |||
<StackPanel | |||
Grid.Row="1" | |||
Margin="0,70,0,0" | |||
HorizontalAlignment="Center" | |||
Orientation="Horizontal"> | |||
<TextBlock | |||
FontSize="20" | |||
Foreground="#FF0084FF" | |||
Text="{Binding DeviceNum}" /> | |||
<TextBlock | |||
FontSize="20" | |||
Foreground="#FF0084FF" | |||
Text=" 号仓" /> | |||
</StackPanel> | |||
<Image | |||
Grid.RowSpan="2" | |||
Source="/BPASmartClient.CustomResource;component/Image/光柱.png" | |||
Stretch="Fill" /> | |||
</Grid> | |||
</Border> | |||
</DataTemplate> | |||
</ListView.ItemTemplate> | |||
</ListView> | |||
</Grid> | |||
<!--#endregion--> | |||
<UniformGrid Columns="10"> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Bottom" | |||
Margin="0 0 0 35" | |||
FontSize="25" | |||
Foreground="#FFCCD61F" | |||
Text="香料剂" /> | |||
<TextBlock | |||
Grid.Row="1" | |||
Margin="0,25,0,0" | |||
HorizontalAlignment="Center" | |||
FontSize="20" | |||
Foreground="#FF0084FF" | |||
Text="25.53 kg" /> | |||
<TextBlock | |||
Grid.Row="1" | |||
Margin="0,70,0,0" | |||
HorizontalAlignment="Center" | |||
FontSize="20" | |||
Foreground="#FF0084FF" | |||
Text="1 号仓" /> | |||
<Image | |||
Grid.RowSpan="2" | |||
Source="/BPASmartClient.CustomResource;component/Image/光柱.png" | |||
Stretch="Fill" /> | |||
</Grid> | |||
<Image Source="/BPASmartClient.CustomResource;component/Image/光柱.png" /> | |||
<Image Source="/BPASmartClient.CustomResource;component/Image/光柱.png" /> | |||
<Image Source="/BPASmartClient.CustomResource;component/Image/光柱.png" /> | |||
<Image Source="/BPASmartClient.CustomResource;component/Image/光柱.png" /> | |||
<Image Source="/BPASmartClient.CustomResource;component/Image/光柱.png" /> | |||
<Image Source="/BPASmartClient.CustomResource;component/Image/光柱.png" /> | |||
<Image Source="/BPASmartClient.CustomResource;component/Image/光柱.png" /> | |||
<Image Source="/BPASmartClient.CustomResource;component/Image/光柱.png" /> | |||
<Image Source="/BPASmartClient.CustomResource;component/Image/光柱.png" /> | |||
<!--<pry:BatchingMachine Margin="56,35,-112,10"/> | |||
<pry:BatchingMachine Margin="56,35,-112,10"/> | |||
<pry:BatchingMachine Margin="56,35,-112,10"/> | |||
<pry:BatchingMachine Margin="56,35,-112,10"/> | |||
<pry:BatchingMachine Margin="56,35,-112,10"/> | |||
<pry:BatchingMachine Margin="56,35,-112,10"/> | |||
<pry:BatchingMachine Margin="56,35,-112,10"/> | |||
<pry:BatchingMachine Margin="56,35,-112,10"/> | |||
<pry:BatchingMachine Margin="56,35,-112,10"/>--> | |||
</UniformGrid> | |||
<UniformGrid Grid.Row="2" Columns="10"> | |||
<pry:BatchingMachine Margin="56,35,-112,10" /> | |||
<pry:BatchingMachine Margin="56,35,-112,10" /> | |||
<pry:BatchingMachine Margin="56,35,-112,10" /> | |||
<pry:BatchingMachine Margin="56,35,-112,10" /> | |||
<pry:BatchingMachine Margin="56,35,-112,10" /> | |||
<pry:BatchingMachine Margin="56,35,-112,10" /> | |||
<pry:BatchingMachine Margin="56,35,-112,10" /> | |||
<pry:BatchingMachine Margin="56,35,-112,10" /> | |||
<pry:BatchingMachine Margin="56,35,-112,10" /> | |||
</UniformGrid> | |||
<!--<UniformGrid Columns="10" Visibility="Collapsed"> | |||
<pry:MotorBottle | |||
Width="150" | |||
Height="100" | |||
CurrentValue="66" | |||
IsRun="True" | |||
RenderTransformOrigin="0.5,0.5"> | |||
<pry:MotorBottle.RenderTransform> | |||
<TransformGroup> | |||
<RotateTransform Angle="90" /> | |||
</TransformGroup> | |||
</pry:MotorBottle.RenderTransform> | |||
</pry:MotorBottle> | |||
<pry:MotorBottle | |||
Width="150" | |||
Height="100" | |||
CurrentValue="40" | |||
IsRun="True" | |||
RenderTransformOrigin="0.5,0.5"> | |||
<pry:MotorBottle.RenderTransform> | |||
<TransformGroup> | |||
<RotateTransform Angle="90" /> | |||
</TransformGroup> | |||
</pry:MotorBottle.RenderTransform> | |||
</pry:MotorBottle> | |||
<pry:MotorBottle | |||
Width="150" | |||
Height="100" | |||
CurrentValue="88" | |||
IsRun="True" | |||
RenderTransformOrigin="0.5,0.5"> | |||
<pry:MotorBottle.RenderTransform> | |||
<TransformGroup> | |||
<RotateTransform Angle="90" /> | |||
</TransformGroup> | |||
</pry:MotorBottle.RenderTransform> | |||
</pry:MotorBottle> | |||
<pry:MotorBottle | |||
Width="150" | |||
Height="100" | |||
CurrentValue="25" | |||
IsRun="True" | |||
RenderTransformOrigin="0.5,0.5"> | |||
<pry:MotorBottle.RenderTransform> | |||
<TransformGroup> | |||
<RotateTransform Angle="90" /> | |||
</TransformGroup> | |||
</pry:MotorBottle.RenderTransform> | |||
</pry:MotorBottle> | |||
<pry:MotorBottle | |||
Width="150" | |||
Height="100" | |||
CurrentValue="97" | |||
IsRun="True" | |||
RenderTransformOrigin="0.5,0.5"> | |||
<pry:MotorBottle.RenderTransform> | |||
<TransformGroup> | |||
<RotateTransform Angle="90" /> | |||
</TransformGroup> | |||
</pry:MotorBottle.RenderTransform> | |||
</pry:MotorBottle> | |||
<pry:MotorBottle | |||
Width="150" | |||
Height="100" | |||
CurrentValue="10" | |||
IsRun="True" | |||
RenderTransformOrigin="0.5,0.5"> | |||
<pry:MotorBottle.RenderTransform> | |||
<TransformGroup> | |||
<RotateTransform Angle="90" /> | |||
</TransformGroup> | |||
</pry:MotorBottle.RenderTransform> | |||
</pry:MotorBottle> | |||
<pry:MotorBottle | |||
Width="150" | |||
Height="100" | |||
CurrentValue="60" | |||
IsRun="True" | |||
RenderTransformOrigin="0.5,0.5"> | |||
<pry:MotorBottle.RenderTransform> | |||
<TransformGroup> | |||
<RotateTransform Angle="90" /> | |||
</TransformGroup> | |||
</pry:MotorBottle.RenderTransform> | |||
</pry:MotorBottle> | |||
<pry:MotorBottle | |||
Width="150" | |||
Height="100" | |||
CurrentValue="96" | |||
IsRun="True" | |||
RenderTransformOrigin="0.5,0.5"> | |||
<pry:MotorBottle.RenderTransform> | |||
<TransformGroup> | |||
<RotateTransform Angle="90" /> | |||
</TransformGroup> | |||
</pry:MotorBottle.RenderTransform> | |||
</pry:MotorBottle> | |||
</UniformGrid>--> | |||
<Grid x:Name="gr" Grid.Row="1"> | |||
<pry:ConveyorBelt | |||
Grid.Row="1" | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
@@ -253,133 +118,88 @@ | |||
StrokeDashArray="1.5 1.5" | |||
StrokeFillBrush="#00BEFA" | |||
StrokeThickness="2" /> | |||
<!--<pry:Pipeline CapRadius="30" Height="30"/>--> | |||
</Grid> | |||
<!--<UniformGrid Grid.Row="2" Columns="10"> | |||
<pry:MotorBottle | |||
Width="150" | |||
Height="100" | |||
CurrentValue="89" | |||
IsRun="True" | |||
RenderTransformOrigin="0.5,0.5"> | |||
<pry:MotorBottle.RenderTransform> | |||
<TransformGroup> | |||
<RotateTransform Angle="270" /> | |||
<ScaleTransform ScaleX="-1" /> | |||
</TransformGroup> | |||
</pry:MotorBottle.RenderTransform> | |||
</pry:MotorBottle> | |||
<pry:MotorBottle | |||
Width="150" | |||
Height="100" | |||
CurrentValue="13" | |||
IsRun="True" | |||
RenderTransformOrigin="0.5,0.5"> | |||
<pry:MotorBottle.RenderTransform> | |||
<TransformGroup> | |||
<RotateTransform Angle="270" /> | |||
<ScaleTransform ScaleX="-1" /> | |||
</TransformGroup> | |||
</pry:MotorBottle.RenderTransform> | |||
</pry:MotorBottle> | |||
<pry:MotorBottle | |||
Width="150" | |||
Height="100" | |||
CurrentValue="31" | |||
IsRun="True" | |||
RenderTransformOrigin="0.5,0.5"> | |||
<pry:MotorBottle.RenderTransform> | |||
<TransformGroup> | |||
<RotateTransform Angle="270" /> | |||
<ScaleTransform ScaleX="-1" /> | |||
</TransformGroup> | |||
</pry:MotorBottle.RenderTransform> | |||
</pry:MotorBottle> | |||
<pry:MotorBottle | |||
Width="150" | |||
Height="100" | |||
CurrentValue="96" | |||
IsRun="True" | |||
RenderTransformOrigin="0.5,0.5"> | |||
<pry:MotorBottle.RenderTransform> | |||
<TransformGroup> | |||
<RotateTransform Angle="270" /> | |||
<ScaleTransform ScaleX="-1" /> | |||
</TransformGroup> | |||
</pry:MotorBottle.RenderTransform> | |||
</pry:MotorBottle> | |||
<pry:MotorBottle | |||
Width="150" | |||
Height="100" | |||
CurrentValue="80" | |||
IsRun="True" | |||
RenderTransformOrigin="0.5,0.5"> | |||
<pry:MotorBottle.RenderTransform> | |||
<TransformGroup> | |||
<RotateTransform Angle="270" /> | |||
<ScaleTransform ScaleX="-1" /> | |||
</TransformGroup> | |||
</pry:MotorBottle.RenderTransform> | |||
</pry:MotorBottle> | |||
<pry:MotorBottle | |||
Width="150" | |||
Height="100" | |||
CurrentValue="26" | |||
IsRun="True" | |||
RenderTransformOrigin="0.5,0.5"> | |||
<pry:MotorBottle.RenderTransform> | |||
<TransformGroup> | |||
<RotateTransform Angle="270" /> | |||
<ScaleTransform ScaleX="-1" /> | |||
</TransformGroup> | |||
</pry:MotorBottle.RenderTransform> | |||
</pry:MotorBottle> | |||
<pry:MotorBottle | |||
Width="150" | |||
Height="100" | |||
CurrentValue="20" | |||
IsRun="True" | |||
RenderTransformOrigin="0.5,0.5"> | |||
<pry:MotorBottle.RenderTransform> | |||
<TransformGroup> | |||
<RotateTransform Angle="270" /> | |||
<ScaleTransform ScaleX="-1" /> | |||
</TransformGroup> | |||
</pry:MotorBottle.RenderTransform> | |||
</pry:MotorBottle> | |||
<pry:MotorBottle | |||
Width="150" | |||
Height="100" | |||
CurrentValue="100" | |||
IsRun="True" | |||
RenderTransformOrigin="0.5,0.5"> | |||
<pry:MotorBottle.RenderTransform> | |||
<TransformGroup> | |||
<RotateTransform Angle="270" /> | |||
<ScaleTransform ScaleX="-1" /> | |||
</TransformGroup> | |||
</pry:MotorBottle.RenderTransform> | |||
</pry:MotorBottle> | |||
</UniformGrid>--> | |||
<!--#region 底部料仓--> | |||
<Grid Grid.Row="2"> | |||
<ListView | |||
VerticalAlignment="Center" | |||
Background="Transparent" | |||
BorderThickness="0" | |||
ItemsSource="{Binding BottomDeviceCurrentStatuses}" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListView.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<UniformGrid | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
Columns="8" | |||
Rows="1" /> | |||
</ItemsPanelTemplate> | |||
</ListView.ItemsPanel> | |||
<ListView.ItemTemplate> | |||
<DataTemplate> | |||
<Border Margin="5" Background="Transparent"> | |||
<Grid Height="220"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<TextBlock | |||
Margin="0,0,0,35" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Bottom" | |||
FontSize="25" | |||
Foreground="#ffccd61f" | |||
Text="{Binding DeviceName}" /> | |||
<StackPanel | |||
Grid.Row="1" | |||
Margin="0,25,0,0" | |||
HorizontalAlignment="Center" | |||
Orientation="Horizontal"> | |||
<TextBlock | |||
FontSize="20" | |||
Foreground="#FF0084FF" | |||
Text="{Binding Weight}" /> | |||
<TextBlock | |||
FontSize="20" | |||
Foreground="#FF0084FF" | |||
Text=" kg" /> | |||
</StackPanel> | |||
<StackPanel | |||
Grid.Row="1" | |||
Margin="0,70,0,0" | |||
HorizontalAlignment="Center" | |||
Orientation="Horizontal"> | |||
<TextBlock | |||
FontSize="20" | |||
Foreground="#FF0084FF" | |||
Text="{Binding DeviceNum}" /> | |||
<TextBlock | |||
FontSize="20" | |||
Foreground="#FF0084FF" | |||
Text=" 号仓" /> | |||
</StackPanel> | |||
<Image | |||
Grid.RowSpan="2" | |||
Source="/BPASmartClient.CustomResource;component/Image/光柱.png" | |||
Stretch="Fill" /> | |||
</Grid> | |||
</Border> | |||
</DataTemplate> | |||
</ListView.ItemTemplate> | |||
</ListView> | |||
</Grid> | |||
<!--#endregion--> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="0.5*" /> | |||
<RowDefinition /> | |||
<RowDefinition Height="0.5*" /> | |||
</Grid.RowDefinitions> | |||
</Grid> | |||
</UserControl> |
@@ -1,525 +0,0 @@ | |||
<Window | |||
x:Class="BPASmartClient.DosingSystem.View.NewMaterialDeviceParView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:Themes1="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Classic" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingSystem.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel" | |||
Title="NewMaterialDeviceParView" | |||
Width="550" | |||
Height="450" | |||
AllowsTransparency="True" | |||
Background="{x:Null}" | |||
Topmost="True" | |||
WindowStartupLocation="CenterScreen" | |||
WindowStyle="None" | |||
mc:Ignorable="d"> | |||
<Window.DataContext> | |||
<vm:NewMaterialDeviceParViewModel /> | |||
</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--> | |||
<!--#region Combox 样式--> | |||
<Style x:Key="ComboBoxStyle1" TargetType="{x:Type ComboBox}"> | |||
<Setter Property="FocusVisualStyle" Value="{StaticResource ComboBoxFocusVisual}" /> | |||
<Setter Property="Foreground" Value="{DynamicResource foreground}" /> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="BorderBrush" Value="{DynamicResource borderBrush}" /> | |||
<Setter Property="BorderThickness" Value="1" /> | |||
<Setter Property="Margin" Value="0,0,0,0" /> | |||
<Setter Property="Padding" Value="0" /> | |||
<Setter Property="Height" Value="24" /> | |||
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" /> | |||
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" /> | |||
<Setter Property="ScrollViewer.CanContentScroll" Value="true" /> | |||
<Setter Property="ScrollViewer.PanningMode" Value="Both" /> | |||
<Setter Property="Stylus.IsFlicksEnabled" Value="False" /> | |||
<Setter Property="VerticalContentAlignment" Value="Center" /> | |||
<Setter Property="IsTextSearchCaseSensitive" Value="true" /> | |||
<Setter Property="IsEditable" Value="true" /> | |||
<Setter Property="StaysOpenOnEdit" Value="true" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type ComboBox}"> | |||
<Border | |||
Background="{TemplateBinding Background}" | |||
BorderBrush="{TemplateBinding BorderBrush}" | |||
BorderThickness="{TemplateBinding BorderThickness}" | |||
SnapsToDevicePixels="true"> | |||
<Grid> | |||
<Themes1:ClassicBorderDecorator | |||
x:Name="Border" | |||
BorderBrush="{x:Static Themes1:ClassicBorderDecorator.ClassicBorderBrush}" | |||
BorderStyle="None" | |||
BorderThickness="2"> | |||
<Popup | |||
x:Name="PART_Popup" | |||
AllowsTransparency="true" | |||
Focusable="False" | |||
IsOpen="{TemplateBinding IsDropDownOpen}" | |||
Placement="Bottom" | |||
PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}"> | |||
<Themes1:SystemDropShadowChrome | |||
x:Name="Shdw" | |||
MinWidth="{Binding ActualWidth, ElementName=Border}" | |||
MaxHeight="{TemplateBinding MaxDropDownHeight}" | |||
Color="Transparent"> | |||
<Border | |||
x:Name="DropDownBorder" | |||
BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" | |||
BorderThickness="1"> | |||
<Border.Background> | |||
<SolidColorBrush Color="#264c73" /> | |||
</Border.Background> | |||
<ScrollViewer x:Name="DropDownScrollViewer"> | |||
<Grid RenderOptions.ClearTypeHint="Enabled"> | |||
<Canvas | |||
Width="0" | |||
Height="0" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top"> | |||
<Rectangle | |||
x:Name="OpaqueRect" | |||
Width="{Binding ActualWidth, ElementName=DropDownBorder}" | |||
Height="{Binding ActualHeight, ElementName=DropDownBorder}" | |||
Fill="{Binding Background, ElementName=DropDownBorder}" /> | |||
</Canvas> | |||
<ItemsPresenter | |||
x:Name="ItemsPresenter" | |||
KeyboardNavigation.DirectionalNavigation="Contained" | |||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /> | |||
</Grid> | |||
</ScrollViewer> | |||
</Border> | |||
</Themes1:SystemDropShadowChrome> | |||
</Popup> | |||
</Themes1:ClassicBorderDecorator> | |||
<DockPanel Margin="2"> | |||
<FrameworkElement Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" DockPanel.Dock="Right" /> | |||
<Border x:Name="SelectedItemBorder" Margin="{TemplateBinding Padding}"> | |||
<ContentPresenter | |||
Margin="1,1,1,1" | |||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" | |||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" | |||
Content="{TemplateBinding SelectionBoxItem}" | |||
ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}" | |||
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" | |||
ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" | |||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /> | |||
</Border> | |||
</DockPanel> | |||
<ToggleButton | |||
Width="Auto" | |||
MinWidth="0" | |||
MinHeight="0" | |||
Margin="2" | |||
ClickMode="Press" | |||
Focusable="false" | |||
IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" | |||
Style="{StaticResource ComboBoxTransparentButtonStyle}" /> | |||
</Grid> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<Condition Property="IsDropDownOpen" Value="false" /> | |||
</MultiTrigger.Conditions> | |||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}" /> | |||
</MultiTrigger> | |||
<Trigger Property="HasItems" Value="false"> | |||
<Setter TargetName="DropDownBorder" Property="MinHeight" Value="95" /> | |||
</Trigger> | |||
<Trigger Property="IsEnabled" Value="false"> | |||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" /> | |||
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" /> | |||
</Trigger> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<Condition Property="IsGrouping" Value="true" /> | |||
<Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false" /> | |||
</MultiTrigger.Conditions> | |||
<Setter Property="ScrollViewer.CanContentScroll" Value="false" /> | |||
</MultiTrigger> | |||
<Trigger SourceName="PART_Popup" Property="HasDropShadow" Value="true"> | |||
<Setter TargetName="Shdw" Property="Margin" Value="0,0,5,5" /> | |||
<Setter TargetName="Shdw" Property="Color" Value="#71000000" /> | |||
</Trigger> | |||
<Trigger SourceName="DropDownScrollViewer" Property="ScrollViewer.CanContentScroll" Value="false"> | |||
<Setter TargetName="OpaqueRect" Property="Canvas.Top" Value="{Binding VerticalOffset, ElementName=DropDownScrollViewer}" /> | |||
<Setter TargetName="OpaqueRect" Property="Canvas.Left" Value="{Binding HorizontalOffset, ElementName=DropDownScrollViewer}" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
<Style.Triggers> | |||
<Trigger Property="IsEditable" Value="true"> | |||
<Setter Property="IsTabStop" Value="false" /> | |||
<Setter Property="Padding" Value="1" /> | |||
<Setter Property="Template" Value="{StaticResource ComboBoxEditableTemplate}" /> | |||
</Trigger> | |||
</Style.Triggers> | |||
</Style> | |||
<!--#endregion--> | |||
</ResourceDictionary> | |||
</ResourceDictionary.MergedDictionaries> | |||
</ResourceDictionary> | |||
</Window.Resources> | |||
<Border | |||
Name="br" | |||
BorderBrush="#0CADF5" | |||
BorderThickness="2"> | |||
<Border.Background> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/bg.png" /> | |||
</Border.Background> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="5" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<Grid Grid.Row="1"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<TextBlock | |||
Margin="0,0,10,0" | |||
HorizontalAlignment="Right" | |||
Background="Transparent" | |||
FontSize="16" | |||
Foreground="Red" | |||
Text="{Binding ErrorInfo}" /> | |||
<Grid Grid.Row="1" Margin="5"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<!--#region 请输入原料名称--> | |||
<TextBlock | |||
Grid.Column="0" | |||
HorizontalAlignment="Right" | |||
Background="Transparent" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="请输入原料名称:" /> | |||
<!--<TextBox | |||
Grid.Column="1" | |||
Margin="3" | |||
Style="{StaticResource TextBoxStyle}" | |||
Text="{Binding RawMaterialName}" />--> | |||
<ComboBox | |||
Grid.Column="1" | |||
Margin="3" | |||
FontSize="14" | |||
ItemsSource="{Binding DataContext.materialNames, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}" | |||
KeyUp="ComboBox_KeyUp" | |||
LostFocus="ComboBox_LostFocus" | |||
Style="{StaticResource ComboBoxStyle1}" | |||
Text="{Binding MaterialName}"> | |||
<ComboBox.ItemContainerStyle> | |||
<Style TargetType="{x:Type ComboBoxItem}"> | |||
<Setter Property="Background" Value="White" /> | |||
<Setter Property="Foreground" Value="#e69519" /> | |||
</Style> | |||
</ComboBox.ItemContainerStyle> | |||
</ComboBox> | |||
<StackPanel Grid.Column="2" Orientation="Horizontal"> | |||
<Button | |||
Width="80" | |||
Height="30" | |||
Command="{Binding SaveCommand}" | |||
Content="确认" /> | |||
<Button | |||
Name="btClose" | |||
Width="80" | |||
Height="30" | |||
Margin="7,0,0,0" | |||
Content="取消" /> | |||
</StackPanel> | |||
<!--#endregion--> | |||
<!--#region 慢加重量--> | |||
<TextBlock | |||
Grid.Row="1" | |||
Grid.Column="0" | |||
HorizontalAlignment="Right" | |||
Background="Transparent" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="慢加重量:" /> | |||
<TextBox | |||
Grid.Row="1" | |||
Grid.Column="1" | |||
Margin="3" | |||
Style="{StaticResource TextBoxStyle}" | |||
Text="{Binding RawMaterialName}" /> | |||
<TextBlock | |||
Grid.Row="1" | |||
Grid.Column="2" | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Left" | |||
Background="Transparent" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="g" /> | |||
<!--#endregion--> | |||
<!--#region 提前关阀重量--> | |||
<TextBlock | |||
Grid.Row="2" | |||
Grid.Column="0" | |||
HorizontalAlignment="Right" | |||
Background="Transparent" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="提前关阀重量:" /> | |||
<TextBox | |||
Grid.Row="2" | |||
Grid.Column="1" | |||
Margin="3" | |||
Style="{StaticResource TextBoxStyle}" | |||
Text="{Binding RawMaterialName}" /> | |||
<TextBlock | |||
Grid.Row="2" | |||
Grid.Column="2" | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Left" | |||
Background="Transparent" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="g" /> | |||
<!--#endregion--> | |||
<!--#region 快加速度--> | |||
<TextBlock | |||
Grid.Row="3" | |||
Grid.Column="0" | |||
HorizontalAlignment="Right" | |||
Background="Transparent" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="快加速度:" /> | |||
<TextBox | |||
Grid.Row="3" | |||
Grid.Column="1" | |||
Margin="3" | |||
Style="{StaticResource TextBoxStyle}" | |||
Text="{Binding RawMaterialName}" /> | |||
<TextBlock | |||
Grid.Row="3" | |||
Grid.Column="2" | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Left" | |||
Background="Transparent" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="单位" /> | |||
<!--#endregion--> | |||
<!--#region 慢加速度--> | |||
<TextBlock | |||
Grid.Row="4" | |||
Grid.Column="0" | |||
HorizontalAlignment="Right" | |||
Background="Transparent" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="慢加速度:" /> | |||
<TextBox | |||
Grid.Row="4" | |||
Grid.Column="1" | |||
Margin="3" | |||
Style="{StaticResource TextBoxStyle}" | |||
Text="{Binding RawMaterialName}" /> | |||
<TextBlock | |||
Grid.Row="4" | |||
Grid.Column="2" | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Left" | |||
Background="Transparent" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="单位" /> | |||
<!--#endregion--> | |||
<!--#region 伺服手动速度--> | |||
<TextBlock | |||
Grid.Row="5" | |||
Grid.Column="0" | |||
HorizontalAlignment="Right" | |||
Background="Transparent" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="伺服手动速度:" /> | |||
<TextBox | |||
Grid.Row="5" | |||
Grid.Column="1" | |||
Margin="3" | |||
Style="{StaticResource TextBoxStyle}" | |||
Text="{Binding RawMaterialName}" /> | |||
<TextBlock | |||
Grid.Row="5" | |||
Grid.Column="2" | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Left" | |||
Background="Transparent" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="单位" /> | |||
<!--#endregion--> | |||
<!--#region 料仓上限重量--> | |||
<TextBlock | |||
Grid.Row="6" | |||
Grid.Column="0" | |||
HorizontalAlignment="Right" | |||
Background="Transparent" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="料仓上限重量:" /> | |||
<TextBox | |||
Grid.Row="6" | |||
Grid.Column="1" | |||
Margin="3" | |||
Style="{StaticResource TextBoxStyle}" | |||
Text="{Binding RawMaterialName}" /> | |||
<TextBlock | |||
Grid.Row="6" | |||
Grid.Column="2" | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Left" | |||
Background="Transparent" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="g" /> | |||
<!--#endregion--> | |||
<!--#region 料仓下限重量--> | |||
<TextBlock | |||
Grid.Row="7" | |||
Grid.Column="0" | |||
HorizontalAlignment="Right" | |||
Background="Transparent" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="料仓下限重量:" /> | |||
<TextBox | |||
Grid.Row="7" | |||
Grid.Column="1" | |||
Margin="3" | |||
Style="{StaticResource TextBoxStyle}" | |||
Text="{Binding RawMaterialName}" /> | |||
<TextBlock | |||
Grid.Row="7" | |||
Grid.Column="2" | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Left" | |||
Background="Transparent" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="g" /> | |||
<!--#endregion--> | |||
<!--#region 搅拌速度--> | |||
<TextBlock | |||
Grid.Row="8" | |||
Grid.Column="0" | |||
HorizontalAlignment="Right" | |||
Background="Transparent" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="搅拌速度:" /> | |||
<TextBox | |||
Grid.Row="8" | |||
Grid.Column="1" | |||
Margin="3" | |||
Style="{StaticResource TextBoxStyle}" | |||
Text="{Binding RawMaterialName}" /> | |||
<TextBlock | |||
Grid.Row="8" | |||
Grid.Column="2" | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Left" | |||
Background="Transparent" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="单位" /> | |||
<!--#endregion--> | |||
</Grid> | |||
</Grid> | |||
</Grid> | |||
</Border> | |||
</Window> |
@@ -1,55 +0,0 @@ | |||
using BPASmartClient.DosingSystem.Model; | |||
using BPASmartClient.Helper; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using System.Windows.Controls; | |||
using System.Windows.Data; | |||
using System.Windows.Documents; | |||
using System.Windows.Input; | |||
using System.Windows.Media; | |||
using System.Windows.Media.Imaging; | |||
using System.Windows.Shapes; | |||
namespace BPASmartClient.DosingSystem.View | |||
{ | |||
/// <summary> | |||
/// NewMaterialDeviceParView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class NewMaterialDeviceParView : Window | |||
{ | |||
public NewMaterialDeviceParView() | |||
{ | |||
InitializeComponent(); | |||
this.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); }; | |||
this.DragMove(); | |||
} | |||
private void ComboBox_KeyUp(object sender, KeyEventArgs e) | |||
{ | |||
var res = sender as ComboBox; | |||
Json<DevicePar>.Read(); | |||
if (res.Text != null && res.Text != String.Empty) | |||
{ | |||
var datas = Json<DevicePar>.Data.deviceParModels.Where(s => s.MaterialName.Contains(res.Text.Trim())); | |||
if (datas.Count() > 0) | |||
{ | |||
res.ItemsSource = datas; | |||
res.IsDropDownOpen = true; | |||
} | |||
else | |||
{ | |||
res.IsDropDownOpen = false; | |||
} | |||
} | |||
} | |||
private void ComboBox_LostFocus(object sender, RoutedEventArgs e) | |||
{ | |||
} | |||
} | |||
} |
@@ -90,75 +90,6 @@ | |||
</StackPanel> | |||
<!--#endregion--> | |||
<!--#region 表格标题栏设置--> | |||
<!--<Grid Grid.Row="1" Background="#dd2AB2E7"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.3*" /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0" /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0.5*" /> | |||
</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" /> | |||
</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" /> | |||
</Grid> | |||
<Grid Grid.Column="5"> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="制作状态" /> | |||
<Border BorderBrush="{StaticResource TitleBorderColor}" BorderThickness="0,0,1,0" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="6" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="完成时间" /> | |||
</Grid>--> | |||
<!--#endregion--> | |||
<ScrollViewer Grid.Row="2"> | |||
<ListView | |||
Margin="5" | |||
@@ -10,6 +10,7 @@ using System.Windows; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPASmartClient.DosingSystem.View; | |||
using BPASmartClient.DosingSystem.Model; | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
@@ -26,12 +27,13 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
cdn.ShowDialog(); | |||
} | |||
}); | |||
devices = DeviceInquire.GetInstance.devices; | |||
} | |||
public RelayCommand<object> ChangeNameCommand { get; set; } | |||
public static ObservableCollection<Devices> devices { get; set; } = new ObservableCollection<Devices>(); | |||
//public static ObservableCollection<Devices> devices { get; set; } = new ObservableCollection<Devices>(); | |||
public static ObservableCollection<Devices> devices { get; set; } | |||
} | |||
public class Devices : ObservableObject | |||
@@ -0,0 +1,69 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System.Collections.ObjectModel; | |||
using BPASmartClient.DosingSystem.Model; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPASmartClient.CustomResource.UserControls.MessageShow; | |||
using BPASmartClient.CustomResource.UserControls; | |||
using System.Diagnostics; | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
public class DeviceMaterialParViewModel : ObservableObject | |||
{ | |||
public DeviceMaterialParViewModel() | |||
{ | |||
deviceParModels = Json<DevicePar>.Data.deviceParModels; | |||
RemoveCommand = new RelayCommand<object>((o) => | |||
{ | |||
var res = deviceParModels.FirstOrDefault(p => p.MaterialName == o?.ToString()); | |||
if (res != null) deviceParModels.Remove(res); | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"{o.ToString()}:原料删除成功!"); | |||
}); | |||
AddCommand = new RelayCommand(() => { deviceParModels.Add(new DeviceParModel()); }); | |||
SaveCommand = new RelayCommand(() => | |||
{ | |||
if (deviceParModels == null || deviceParModels.Count <= 0) | |||
{ | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", $"没有可保存的参数!"); | |||
return; | |||
} | |||
for (int i = 0; i < deviceParModels.Count; i++) | |||
{ | |||
if (deviceParModels.Where(p => p.MaterialName == deviceParModels.ElementAt(i).MaterialName)?.ToList()?.Count >= 2) | |||
deviceParModels.ElementAt(i).IsRedundant = true; | |||
else | |||
deviceParModels.ElementAt(i).IsRedundant = false; | |||
} | |||
if (deviceParModels.FirstOrDefault(p => p.IsRedundant == true) != null) | |||
{ | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "错误", $"原料名称冲突,请检查后重试!"); | |||
return; | |||
} | |||
deviceParModels.Where(P => P.MaterialName.Length <= 0)?.ToList()?.ForEach(item => | |||
{ | |||
Json<DevicePar>.Data.deviceParModels.Remove(item); | |||
}); | |||
Json<DevicePar>.Save(); | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"原料参数保存成功!"); | |||
}); | |||
} | |||
public ObservableCollection<DeviceParModel> deviceParModels { get; set; } | |||
public RelayCommand<object> RemoveCommand { get; set; } | |||
public RelayCommand AddCommand { get; set; } | |||
public RelayCommand SaveCommand { get; set; } | |||
} | |||
} |
@@ -17,18 +17,12 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
public HardwareStatusViewModel() | |||
{ | |||
for (int i = 0; i < 8; i++) | |||
{ | |||
TopDeviceCurrentStatuses.Add(new DeviceCurrentStatus() | |||
{ | |||
DeviceName = i.ToString(), | |||
RunStatus = false, | |||
Weight = new Random().Next(0, 100) | |||
}); | |||
} | |||
TopDeviceCurrentStatuses = DeviceInquire.GetInstance.TopDeviceCurrentStatuses; | |||
BottomDeviceCurrentStatuses = DeviceInquire.GetInstance.BottomDeviceCurrentStatuses; | |||
} | |||
public ObservableCollection<DeviceCurrentStatus> TopDeviceCurrentStatuses { get; set; } = new ObservableCollection<DeviceCurrentStatus>(); | |||
public ObservableCollection<DeviceCurrentStatus> BottomDeviceCurrentStatuses { get; set; } = new ObservableCollection<DeviceCurrentStatus>(); | |||
public ObservableCollection<DeviceCurrentStatus> TopDeviceCurrentStatuses { get; set; } | |||
public ObservableCollection<DeviceCurrentStatus> BottomDeviceCurrentStatuses { get; set; } | |||
} | |||
} |
@@ -1,23 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
public class NewMaterialDeviceParViewModel : ObservableObject | |||
{ | |||
public NewMaterialDeviceParViewModel() | |||
{ | |||
} | |||
public RelayCommand Save { get; set; } | |||
public RelayCommand Cancle { get; set; } | |||
} | |||
} |
@@ -53,7 +53,7 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
if (devices.Count > 0) | |||
{ | |||
int index = Array.FindIndex(Recipes.ToArray(), p => p.RecipeName == devices.ElementAt(0));///??????? | |||
int index = Array.FindIndex(Recipes.ToArray(), p => p.RecipeName == devices.ElementAt(0)); | |||
if (index >= 0 && index < Recipes.Count) | |||
{ | |||
Recipes.ElementAt(index).Are.Reset(); | |||
@@ -25,7 +25,6 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
public RecipeSettingsViewModel() | |||
{ | |||
//Json<LocaPar>.Read(); | |||
Recipes = Json<LocaPar>.Data.Recipes; | |||
NewMaterital = new RelayCommand(() => | |||
@@ -62,12 +61,12 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
ActionManage.GetInstance.CancelRegister("Details"); | |||
NewRecipeView nrv = new NewRecipeView(); | |||
var res = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipCode == str); | |||
ActionManage.GetInstance.Send("Details",res); | |||
ActionManage.GetInstance.Send("Details", res); | |||
nrv.ShowDialog(); | |||
MessageLog.GetInstance.ShowUserLog($"编辑配方名称——{res.RecipeName}"); | |||
} | |||
}); | |||
} | |||
public RelayCommand NewMaterital { get; set; } | |||