瀏覽代碼

解决冲突

master
pengliangyang 2 年之前
父節點
當前提交
ae8e5d9a32
共有 59 個檔案被更改,包括 1207 行新增498 行删除
  1. +35
    -0
      BPASmartClient.CustomResource/Converters/ForegroundConverter.cs
  2. +48
    -0
      BPASmartClient.CustomResource/Converters/StatusIconConverter.cs
  3. +15
    -0
      BPASmartClient.CustomResource/Pages/Enums/Status.cs
  4. +154
    -26
      BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs
  5. +145
    -0
      BPASmartClient.CustomResource/Pages/Model/AlarmTest.cs
  6. +4
    -4
      BPASmartClient.CustomResource/Pages/Model/MessageNotify.cs
  7. +2
    -2
      BPASmartClient.CustomResource/Pages/ViewModel/NfcSetViewModel.cs
  8. +1
    -1
      BPASmartClient.CustomResource/Pages/ViewModel/RunLogViewModel.cs
  9. +1
    -1
      BPASmartClient.CustomResource/Pages/ViewModel/UserLogViewModel.cs
  10. +128
    -0
      BPASmartClient.CustomResource/RecDictionarys/GlobalStyle.xaml
  11. +2
    -2
      BPASmartClient.DosingProject/App.xaml.cs
  12. +12
    -12
      BPASmartClient.DosingProject/Model/ProcessControl.cs
  13. +9
    -9
      BPASmartClient.DosingProject/Model/RawMaterial/DeviceInquire.cs
  14. +2
    -2
      BPASmartClient.DosingProject/ViewModel/NewMaterialViewModel.cs
  15. +3
    -3
      BPASmartClient.DosingProject/ViewModel/RecipeControlViewModel.cs
  16. +3
    -3
      BPASmartClient.DosingProject/ViewModel/RecipeReceiveViewModel.cs
  17. +4
    -4
      BPASmartClient.DosingProject/ViewModel/RecipeSettingsViewModel.cs
  18. +1
    -1
      BPASmartClient.DosingProject/ViewModel/SiemensRecipeReceiveViewModel.cs
  19. +2
    -2
      BPASmartClient.JXJFoodBigStation/App.xaml.cs
  20. +1
    -1
      BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs
  21. +1
    -1
      BPASmartClient.JXJFoodBigStation/ViewModel/RecipeReceiveViewModel.cs
  22. +2
    -2
      BPASmartClient.JXJFoodSmallStation/App.xaml.cs
  23. +8
    -8
      BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/HKDeviceStatus.cs
  24. +38
    -38
      BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs
  25. +13
    -13
      BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DeviceInquire.cs
  26. +2
    -2
      BPASmartClient.JXJFoodSmallStation/ViewModel/NewMaterialViewModel.cs
  27. +3
    -3
      BPASmartClient.JXJFoodSmallStation/ViewModel/RecipeControlViewModel.cs
  28. +3
    -3
      BPASmartClient.JXJFoodSmallStation/ViewModel/RecipeReceiveViewModel.cs
  29. +4
    -4
      BPASmartClient.JXJFoodSmallStation/ViewModel/RecipeSettingsViewModel.cs
  30. +1
    -1
      BPASmartClient.JXJFoodSmallStation/ViewModel/SiemensRecipeReceiveViewModel.cs
  31. +2
    -2
      BPASmartClient.SmallBatchingSystem/Services/Control.cs
  32. +1
    -1
      BPASmartClient.ZhuoDian/App.xaml.cs
  33. +11
    -4
      DosingSystem/App.xaml.cs
  34. +4
    -1
      DosingSystem/BPASmartClient.DosingSystem.csproj
  35. +15
    -13
      DosingSystem/Model/DeviceInquire.cs
  36. +0
    -15
      DosingSystem/Model/DevicePar.cs
  37. +44
    -0
      DosingSystem/Model/par/DevicePar.cs
  38. +0
    -0
      DosingSystem/Model/par/DeviceParModel.cs
  39. +0
    -0
      DosingSystem/Model/par/LocaPar.cs
  40. +45
    -0
      DosingSystem/View/CommParSetView.xaml
  41. +28
    -0
      DosingSystem/View/CommParSetView.xaml.cs
  42. +1
    -2
      DosingSystem/ViewModel/ChangeDeviceNameViewModel.cs
  43. +48
    -0
      DosingSystem/ViewModel/CommparSetViewModel.cs
  44. +1
    -1
      DosingSystem/ViewModel/DeviceListViewModel.cs
  45. +1
    -2
      DosingSystem/ViewModel/DeviceMaterialParViewModel.cs
  46. +1
    -1
      DosingSystem/ViewModel/HardwareStatusViewModel.cs
  47. +6
    -2
      DosingSystem/ViewModel/ManualControlViewModel.cs
  48. +3
    -4
      DosingSystem/ViewModel/NewMaterialViewModel.cs
  49. +1
    -1
      DosingSystem/ViewModel/NewRecipeViewModel.cs
  50. +4
    -5
      DosingSystem/ViewModel/RecipeControlViewModel.cs
  51. +5
    -5
      DosingSystem/ViewModel/RecipeSettingsViewModel.cs
  52. +2
    -2
      FryPot_DosingSystem/App.xaml.cs
  53. +15
    -15
      FryPot_DosingSystem/Control/DeviceOperate.cs
  54. +243
    -243
      FryPot_DosingSystem/Control/DosingLogicControl.cs
  55. +9
    -9
      FryPot_DosingSystem/ViewModel/NewRecipeViewModel.cs
  56. +18
    -0
      WPFDemo/Class2.cs
  57. +35
    -21
      WPFDemo/TheListBox.xaml
  58. +2
    -1
      WPFDemo/Window2.xaml
  59. +15
    -0
      WPFDemo/Window2.xaml.cs

+ 35
- 0
BPASmartClient.CustomResource/Converters/ForegroundConverter.cs 查看文件

@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Windows.Data;
using System.Globalization;
using System.Windows.Media;

namespace BPASmartClient.CustomResource.Converters
{
public class ForegroundConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
SolidColorBrush returnValue = new SolidColorBrush(Color.FromArgb(255, 0, 204, 255));
if (value != null)
{
if (value.ToString() == "等待配料")
returnValue = new SolidColorBrush(Color.FromArgb(255, 236, 187, 17));//黄 FFECBB11
else if (value.ToString() == "正在配料")
returnValue = new SolidColorBrush(Color.FromArgb(255, 22, 219, 234));//篮 FF16DBEA
else if (value.ToString() == "配料完成")
returnValue = new SolidColorBrush(Color.FromArgb(255, 43, 208, 111));//绿 FF2BD06F
}
return returnValue;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

+ 48
- 0
BPASmartClient.CustomResource/Converters/StatusIconConverter.cs 查看文件

@@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Windows.Data;
using System.Globalization;
using System.Text.RegularExpressions;
using BPASmartClient.CustomResource.Pages.Enums;

namespace BPASmartClient.CustomResource.Converters
{
public class StatusIconConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value != null)
{
if (value.ToString() == Status.等待配料.ToString())
return Regex.Unescape(StringToUnicode(""));
else if (value.ToString() == Status.正在配料.ToString())
return Regex.Unescape(StringToUnicode(""));
else if (value.ToString() == Status.配料完成.ToString())
return Regex.Unescape(StringToUnicode(""));
}
return value;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}

/// <summary>
/// 字符串转为UniCode码字符串
/// </summary>
public static string StringToUnicode(string s)
{
if (!string.IsNullOrEmpty(s))
{
//这里把格式&#xe625; 转为 \ue625
return s.Replace(@"&#x", @"\u").Replace(";", "");
}
return s;
}
}
}

+ 15
- 0
BPASmartClient.CustomResource/Pages/Enums/Status.cs 查看文件

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

namespace BPASmartClient.CustomResource.Pages.Enums
{
public enum Status
{
等待配料,
正在配料,
配料完成
}
}

+ 154
- 26
BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs 查看文件

@@ -16,16 +16,15 @@ namespace BPASmartClient.CustomResource.Pages.Model

public class AlarmHelper<AlarmT> where AlarmT : class, new()
{


//private volatile static ConcurrentDictionary<string, AlarmT> _Instance;
//public static AlarmT GetInstance(string name)
//{
// if (_Instance == null) _Instance = new ConcurrentDictionary<string, AlarmT>();
// if (!_Instance.ContainsKey(name)) _Instance.TryAdd(name, new AlarmT());
// return _Instance[name];
//}
//private AlarmHelper() { }
private volatile static ConcurrentDictionary<string, AlarmT> _Instance;
public static AlarmT GetInstance(string name = "")
{
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];
}
private AlarmHelper() { }


public static ObservableCollection<Alarm> Alarms { get; set; } = new ObservableCollection<Alarm>();
@@ -36,22 +35,29 @@ namespace BPASmartClient.CustomResource.Pages.Model
public static Action<string> RemoveAction { get; set; }
public static Action ChangeAction { get; set; }

public static AlarmT Alarm { get; set; } = new AlarmT();
//public static AlarmT Alarm { get; set; } = new AlarmT();

public static void Init()
{
AlarmViewModel.AlarmInfos = Alarms;
ThreadManage.GetInstance().StartLong(new Action(() =>
{
foreach (var item in Alarm.GetType().GetProperties())
if (_Instance != null)
{
if (item.CustomAttributes.Count() > 0)
foreach (var temp in _Instance)
{
var AlarmModel = item.GetCustomAttribute<AlarmAttribute>();
if (AlarmModel != null)
foreach (var item in temp.Value.GetType().GetProperties())
{
bool value = Convert.ToBoolean(Alarm.GetType().GetProperty(item.Name)?.GetValue(Alarm));
EdgeAlarm(value, AlarmModel.AlarmInfo, 1, AlarmModel.AlarmLevel, AlarmModel.AlarmType);
if (item.CustomAttributes.Count() > 0)
{
var AlarmModel = item.GetCustomAttribute<AlarmAttribute>();
if (AlarmModel != null)
{
bool value = Convert.ToBoolean(_Instance[temp.Key].GetType().GetProperty(item.Name)?.GetValue(_Instance[temp.Key]));
string text = typeof(AlarmT).Name == temp.Key ? AlarmModel.AlarmInfo : $"{temp.Key}:{AlarmModel.AlarmInfo}";
EdgeAlarm(value, text, 1, AlarmModel.AlarmLevel, AlarmModel.AlarmType);
}
}
}
}
}
@@ -60,15 +66,6 @@ namespace BPASmartClient.CustomResource.Pages.Model

}


//public static void AnalogAlarm(dynamic Trigger, string info, dynamic HH = null, dynamic H = 0, dynamic L = 0, dynamic LL = 0)
//{

//}




/// <summary>
/// 沿报警检测
/// </summary>
@@ -144,4 +141,135 @@ namespace BPASmartClient.CustomResource.Pages.Model
}

}

//public class AlarmHelper<AlarmT> where AlarmT : class, new()
//{


// //private volatile static ConcurrentDictionary<string, AlarmT> _Instance;
// //public static AlarmT GetInstance(string name)
// //{
// // if (_Instance == null) _Instance = new ConcurrentDictionary<string, AlarmT>();
// // if (!_Instance.ContainsKey(name)) _Instance.TryAdd(name, new AlarmT());
// // return _Instance[name];
// //}
// //private AlarmHelper() { }


// public static ObservableCollection<Alarm> Alarms { get; set; } = new ObservableCollection<Alarm>();
// public static List<Alarm> HistoryAlarms { get; set; } = new List<Alarm>();
// static ConcurrentDictionary<string, bool> flagbit = new ConcurrentDictionary<string, bool>();
// static ConcurrentDictionary<string, Delay> delays = new ConcurrentDictionary<string, Delay>();
// public static Action<string> AddAction { get; set; }
// public static Action<string> RemoveAction { get; set; }
// public static Action ChangeAction { get; set; }

// public static AlarmT Alarm { get; set; } = new AlarmT();

// public static void Init()
// {
// AlarmViewModel.AlarmInfos = Alarms;
// ThreadManage.GetInstance().StartLong(new Action(() =>
// {
// foreach (var item in Alarm.GetType().GetProperties())
// {
// if (item.CustomAttributes.Count() > 0)
// {
// var AlarmModel = item.GetCustomAttribute<AlarmAttribute>();
// if (AlarmModel != null)
// {
// 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).Name},报警通用模块监听");

// }


// //public static void AnalogAlarm(dynamic Trigger, string info, dynamic HH = null, dynamic H = 0, dynamic L = 0, dynamic LL = 0)
// //{

// //}




// /// <summary>
// /// 沿报警检测
// /// </summary>
// /// <param name="Trigger">触发变量</param>
// /// <param name="text">报警信息</param>
// /// <param name="edgeType">触发类型,上升沿 或 下降沿</param>
// private static void EdgeAlarm(bool Trigger, string text, int delay = 2, AlarmLevel alarmLevel = AlarmLevel.一般报警, AlarmTriggerType edgeType = AlarmTriggerType.Rising)
// {
// if (!flagbit.ContainsKey(text)) flagbit.TryAdd(text, false);
// 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])
// {
// AddAlarm(Trigger, text, alarmLevel);
// flagbit[text] = edgeType == AlarmTriggerType.Rising ? true : false;
// }
// }
// else RemoveAlarm(text);
// if (edgeType == AlarmTriggerType.Rising ? flagbit[text] : !flagbit[text]) flagbit[text] = Trigger;
// }

// /// <summary>
// /// 添加报警信息
// /// </summary>
// /// <param name="AlarmInfo">报警信息</param>
// private static void AddAlarm(object value, string AlarmInfo, AlarmLevel alarmLevel)
// {
// Alarm tempAlarm = new Alarm()
// {
// NumId = Alarms.Count + 1,
// Date = DateTime.Now.ToString("yyyy/MM/dd"),
// Grade = alarmLevel.ToString(),
// Info = AlarmInfo,
// Value = value.ToString(),
// Time = DateTime.Now.ToString("HH:mm:ss"),
// };

// var res = Sqlite<Alarm>.GetInstance.Base.Add(tempAlarm);
// Sqlite<Alarm>.GetInstance.Save();

// if (Alarms.FirstOrDefault(p => p.Info == AlarmInfo) == null)
// {
// Application.Current.Dispatcher.Invoke(new Action(() =>
// {
// Alarms.Insert(0, tempAlarm);
// for (int i = 0; i < Alarms.Count; i++) { Alarms.ElementAt(i).NumId = i + 1; }
// }));

// AddAction?.Invoke(AlarmInfo);//添加报警通知
// ChangeAction?.Invoke();//更改报警通知
// }
// }

// /// <summary>
// /// 移除报警信息
// /// </summary>
// /// <param name="AlarmInfo">报警信息</param>
// private static void RemoveAlarm(string AlarmInfo)
// {
// var result = Alarms.FirstOrDefault(p => p.Info == AlarmInfo);
// if (result != null)
// {
// Application.Current.Dispatcher.Invoke(new Action(() =>
// {
// Alarms.Remove(result);
// for (int i = 0; i < Alarms.Count; i++) { Alarms.ElementAt(i).NumId = i + 1; }
// }));

// if (RemoveAction != null) RemoveAction(AlarmInfo);
// if (ChangeAction != null) ChangeAction();
// }
// }

//}
}

+ 145
- 0
BPASmartClient.CustomResource/Pages/Model/AlarmTest.cs 查看文件

@@ -0,0 +1,145 @@
using BPASmartClient.CustomResource.Pages.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.Reflection;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;

namespace BPASmartClient.CustomResource.Pages.Model
{
public class AlarmTest<AlarmT> where AlarmT : class, new()
{


private volatile static ConcurrentDictionary<string, AlarmT> _Instance;
public static AlarmT GetInstance(string name = "")
{
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];
}
private AlarmTest() { }


public static ObservableCollection<Alarm> Alarms { get; set; } = new ObservableCollection<Alarm>();
public static List<Alarm> HistoryAlarms { get; set; } = new List<Alarm>();
static ConcurrentDictionary<string, bool> flagbit = new ConcurrentDictionary<string, bool>();
static ConcurrentDictionary<string, Delay> delays = new ConcurrentDictionary<string, Delay>();
public static Action<string> AddAction { get; set; }
public static Action<string> RemoveAction { get; set; }
public static Action ChangeAction { get; set; }

//public static AlarmT Alarm { get; set; } = new AlarmT();

public static void Init()
{
AlarmViewModel.AlarmInfos = Alarms;
ThreadManage.GetInstance().StartLong(new Action(() =>
{
if (_Instance != null)
{
foreach (var temp in _Instance)
{
foreach (var item in temp.Value.GetType().GetProperties())
{
if (item.CustomAttributes.Count() > 0)
{
var AlarmModel = item.GetCustomAttribute<AlarmAttribute>();
if (AlarmModel != null)
{
bool value = Convert.ToBoolean(_Instance[temp.Key].GetType().GetProperty(item.Name)?.GetValue(_Instance[temp.Key]));
EdgeAlarm(value, $"{temp.Key}:{AlarmModel.AlarmInfo}", 1, AlarmModel.AlarmLevel, AlarmModel.AlarmType);
}
}
}
}
}
Thread.Sleep(100);
}), $"{typeof(AlarmT).Name},报警通用模块监听");

}

/// <summary>
/// 沿报警检测
/// </summary>
/// <param name="Trigger">触发变量</param>
/// <param name="text">报警信息</param>
/// <param name="edgeType">触发类型,上升沿 或 下降沿</param>
private static void EdgeAlarm(bool Trigger, string text, int delay = 2, AlarmLevel alarmLevel = AlarmLevel.一般报警, AlarmTriggerType edgeType = AlarmTriggerType.Rising)
{
if (!flagbit.ContainsKey(text)) flagbit.TryAdd(text, false);
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])
{
AddAlarm(Trigger, text, alarmLevel);
flagbit[text] = edgeType == AlarmTriggerType.Rising ? true : false;
}
}
else RemoveAlarm(text);
if (edgeType == AlarmTriggerType.Rising ? flagbit[text] : !flagbit[text]) flagbit[text] = Trigger;
}

/// <summary>
/// 添加报警信息
/// </summary>
/// <param name="AlarmInfo">报警信息</param>
private static void AddAlarm(object value, string AlarmInfo, AlarmLevel alarmLevel)
{
Alarm tempAlarm = new Alarm()
{
NumId = Alarms.Count + 1,
Date = DateTime.Now.ToString("yyyy/MM/dd"),
Grade = alarmLevel.ToString(),
Info = AlarmInfo,
Value = value.ToString(),
Time = DateTime.Now.ToString("HH:mm:ss"),
};

var res = Sqlite<Alarm>.GetInstance.Base.Add(tempAlarm);
Sqlite<Alarm>.GetInstance.Save();

if (Alarms.FirstOrDefault(p => p.Info == AlarmInfo) == null)
{
Application.Current.Dispatcher.Invoke(new Action(() =>
{
Alarms.Insert(0, tempAlarm);
for (int i = 0; i < Alarms.Count; i++) { Alarms.ElementAt(i).NumId = i + 1; }
}));

AddAction?.Invoke(AlarmInfo);//添加报警通知
ChangeAction?.Invoke();//更改报警通知
}
}

/// <summary>
/// 移除报警信息
/// </summary>
/// <param name="AlarmInfo">报警信息</param>
private static void RemoveAlarm(string AlarmInfo)
{
var result = Alarms.FirstOrDefault(p => p.Info == AlarmInfo);
if (result != null)
{
Application.Current.Dispatcher.Invoke(new Action(() =>
{
Alarms.Remove(result);
for (int i = 0; i < Alarms.Count; i++) { Alarms.ElementAt(i).NumId = i + 1; }
}));

if (RemoveAction != null) RemoveAction(AlarmInfo);
if (ChangeAction != null) ChangeAction();
}
}

}

}

BPASmartClient.CustomResource/Pages/Model/MessageLog.cs → BPASmartClient.CustomResource/Pages/Model/MessageNotify.cs 查看文件

@@ -12,15 +12,15 @@ using BPASmartClient.CustomResource.Pages.View;

namespace BPASmartClient.CustomResource.Pages.Model
{
public class MessageLog
public class MessageNotify
{
private volatile static MessageLog _Instance;
public static MessageLog GetInstance => _Instance ??= new MessageLog();
private volatile static MessageNotify _Instance;
public static MessageNotify GetInstance => _Instance ??= new MessageNotify();

public static readonly object runLock = new object();
public static readonly object userlock = new object();
public static readonly object alarmlock = new object();
private MessageLog() { }
private MessageNotify() { }

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


+ 2
- 2
BPASmartClient.CustomResource/Pages/ViewModel/NfcSetViewModel.cs 查看文件

@@ -75,7 +75,7 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
});
Config.GetInstance.SaveUser();
Info = $"Info:ID {CardNum} 添加成功;";
MessageLog.GetInstance.ShowRunLog($" ID {CardNum} 用户添加成功");
MessageNotify.GetInstance.ShowRunLog($" ID {CardNum} 用户添加成功");
Thread.Sleep(1000);
ActionManage.GetInstance.Send("Exit");
}
@@ -96,7 +96,7 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
Global.userManager.userInfos.Remove(res);
Config.GetInstance.SaveUser();
Info = $"Info:ID {CardNum} 注销成功;";
MessageLog.GetInstance.ShowRunLog($"ID {CardNum} 用户注销成功");
MessageNotify.GetInstance.ShowRunLog($"ID {CardNum} 用户注销成功");
Thread.Sleep(1000);
ActionManage.GetInstance.Send("Exit");
}


+ 1
- 1
BPASmartClient.CustomResource/Pages/ViewModel/RunLogViewModel.cs 查看文件

@@ -121,6 +121,6 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel

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

public ObservableCollection<RunLog> Log { get; set; } = MessageLog.GetInstance.runLogs;
public ObservableCollection<RunLog> Log { get; set; } = MessageNotify.GetInstance.runLogs;
}
}

+ 1
- 1
BPASmartClient.CustomResource/Pages/ViewModel/UserLogViewModel.cs 查看文件

@@ -17,7 +17,7 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
public UserLogViewModel()
{
Sqlite<UserLog>.GetInstance.Save();
UserLogs = MessageLog.GetInstance.userLogs;
UserLogs = MessageNotify.GetInstance.userLogs;
SwitchCommand = new RelayCommand(() =>
{
if (ButContent == "历史日志")


+ 128
- 0
BPASmartClient.CustomResource/RecDictionarys/GlobalStyle.xaml 查看文件

@@ -15,4 +15,132 @@
<SolidColorBrush x:Key="BorderSolid" Color="#5523CACA" />



<!--#region 颜色资源-->
<SolidColorBrush x:Key="FontColor" Color="#FF2AB2E7" />
<SolidColorBrush x:Key="tabColor" Color="#FF2AB2E7" />
<SolidColorBrush x:Key="bordColor" Color="#332AB2E7" />
<!--#endregion-->

<!--#region 值转换器-->
<con:DataTableRedundantConverter x:Key="tabConvert" />
<con:StatusIconConverter x:Key="StatusIconConverter" />
<con:ForegroundConverter x:Key="ForegroundConverter" />
<!--#endregion-->

<Style x:Key="TextBlockStyle" TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Right" />
<Setter Property="Foreground" Value="{StaticResource FontColor}" />
<Setter Property="FontSize" Value="20" />
</Style>

<Style x:Key="TextBoxStyle" TargetType="TextBox">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="22" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Width" Value="188" />
<Setter Property="Padding" Value="6,0,0,0" />
<Setter Property="Height" Value="37" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Foreground" Value="#009dff" />
<Setter Property="BorderBrush" Value="#009dff" />
<Setter Property="CaretBrush" Value="#009dff" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Background">
<Setter.Value>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/textBox.png" Stretch="Fill" />
</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>

<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>


</ResourceDictionary>

+ 2
- 2
BPASmartClient.DosingProject/App.xaml.cs 查看文件

@@ -32,7 +32,7 @@ namespace BPASmartClient.DosingProject
var res = lv.ShowDialog();
if (res != null && res == true)
{
MessageLog.GetInstance.ShowUserLog("用户登录");
MessageNotify.GetInstance.ShowUserLog("用户登录");
mv.Show();
}
else
@@ -44,7 +44,7 @@ namespace BPASmartClient.DosingProject
{
base.OnExit(e);
Json<LocaPar>.Save();
MessageLog.GetInstance.LogSave();
MessageNotify.GetInstance.LogSave();
ThreadManage.GetInstance().Dispose();
}



+ 12
- 12
BPASmartClient.DosingProject/Model/ProcessControl.cs 查看文件

@@ -56,7 +56,7 @@ namespace BPASmartClient.DosingHKProject.Model
if (HKDevice.IsConnected)
{
HKDevice.Init();
MessageLog.GetInstance.ShowUserLog("海科plc连接成功,并初始化完成");
MessageNotify.GetInstance.ShowUserLog("海科plc连接成功,并初始化完成");
}
}
catch(Exception ex)
@@ -346,7 +346,7 @@ namespace BPASmartClient.DosingHKProject.Model
{
HKDevice.HK_PLC_S7.Write<bool>("DB2.DBX3.0", false);
HKDevice.HK_PLC_S7.Write<bool>("DB2.DBX3.1", false);
MessageLog.GetInstance.ShowRunLog($"下料桶堵料,线体不运行");
MessageNotify.GetInstance.ShowRunLog($"下料桶堵料,线体不运行");
cnt_sensor8++;
}
else
@@ -437,7 +437,7 @@ namespace BPASmartClient.DosingHKProject.Model
if (GVL_SmallStation.GetInstance.AllowDosing_Pos[0])
{
int res = 1;
MessageLog.GetInstance.ShowRunLog($"配方:{recipeName},1号桶,{res}料仓,允许配料");
MessageNotify.GetInstance.ShowRunLog($"配方:{recipeName},1号桶,{res}料仓,允许配料");
if (res > 0 )
{
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == res);
@@ -448,13 +448,13 @@ namespace BPASmartClient.DosingHKProject.Model
GVL_SmallStation.GetInstance.StockInIsWork = (int)res;
}
GVL_SmallStation.GetInstance.DosingTray1 = true;
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},1号桶,{(int)res}号仓,配料完成");
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},1号桶,{(int)res}号仓,配料完成");
}
}
else if(RTrig.GetInstance("DB3.DBX50.1").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.1")))
{
var res = HKDevice.HK_PLC_S7.Read<float>("DB3.DBD14");
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},2号桶,{res}料仓,允许配料");
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},2号桶,{res}料仓,允许配料");
if (res > 0 && res is float loc)
{
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc);
@@ -465,13 +465,13 @@ namespace BPASmartClient.DosingHKProject.Model
GVL_SmallStation.GetInstance.StockInIsWork = (int)loc;
}
GVL_SmallStation.GetInstance.DosingTray1 = true;
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},2号桶,{(int)loc}号仓,配料完成");
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},2号桶,{(int)loc}号仓,配料完成");
}
}
else if (RTrig.GetInstance("DB3.DBX50.2").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.2")))
{
var res = HKDevice.HK_PLC_S7.Read<float>("DB3.DBD18");
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},3号桶,{res}料仓,允许配料");
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},3号桶,{res}料仓,允许配料");
if (res > 0 && res is float loc)
{
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc);
@@ -482,13 +482,13 @@ namespace BPASmartClient.DosingHKProject.Model
GVL_SmallStation.GetInstance.StockInIsWork = (int)loc;
}
GVL_SmallStation.GetInstance.DosingTray1 = true;
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},3号桶,{(int)loc}号仓,配料完成");
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},3号桶,{(int)loc}号仓,配料完成");
}
}
else if (RTrig.GetInstance("DB3.DBX50.3").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.3")))
{
var res = HKDevice.HK_PLC_S7.Read<float>("DB3.DBD22");
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},4号桶,{res}料仓,允许配料");
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},4号桶,{res}料仓,允许配料");
if (res > 0 && res is float loc)
{
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc);
@@ -499,7 +499,7 @@ namespace BPASmartClient.DosingHKProject.Model
GVL_SmallStation.GetInstance.StockInIsWork = (int)loc;
}
GVL_SmallStation.GetInstance.DosingTray1 = true;
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},4号桶,{(int)loc}号仓,配料完成");
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},4号桶,{(int)loc}号仓,配料完成");
}
}
if (GVL_SmallStation.GetInstance.DosingTray1)
@@ -508,7 +508,7 @@ namespace BPASmartClient.DosingHKProject.Model
{
if (RTrig.GetInstance("GetDeviceRunStatus").Start(DeviceInquire.GetInstance.GetDevice(i).deviceStatus.RunStatus == 3))
{
MessageLog.GetInstance.ShowRunLog($"柔性味魔方,托盘1,配方:{recipeName},{i}号仓,配料完成");
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方,托盘1,配方:{recipeName},{i}号仓,配料完成");
int res = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == i);
RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(res).Laying_Off_Weight = DeviceInquire.GetInstance.GetDevice(i).deviceStatus.CutWeightFeedback;
DeviceInquire.GetInstance.GetDevice(i).StatusReset();
@@ -527,7 +527,7 @@ namespace BPASmartClient.DosingHKProject.Model
if (RTrig.GetInstance("配方配料完成").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX1.1")) && (GVL_SmallStation.GetInstance.WindSendDosingFinish || !GVL_SmallStation.GetInstance.IsUseWindSend))
{
var res = Json<RemoteRecipeDataColl>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == code);
MessageLog.GetInstance.ShowRunLog($"托盘1,配方{res.RecipeName},配料完成");
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方{res.RecipeName},配料完成");
App.Current.Dispatcher.Invoke(() =>
{
Json<RemoteRecipeDataColl>.Data.Recipes.Remove(res);


+ 9
- 9
BPASmartClient.DosingProject/Model/RawMaterial/DeviceInquire.cs 查看文件

@@ -307,13 +307,13 @@ namespace BPASmartClient.DosingHKProject.Model
deviceStatus.DeviceNum = (ushort)this.modbusTcp.ReadShort(DeviceAddress.DeviceNum);//获取设备编号
deviceStatus.DeviceAlarmCode = (ushort)this.modbusTcp.ReadShort(DeviceAddress.DeviceAlarmCode);//获取设备故障编码

AlarmHelper<AlarmInfo>.Alarm.EStop1 = deviceStatus.DeviceAlarmCode.Get16bitValue(1);
AlarmHelper<AlarmInfo>.Alarm.Servo = deviceStatus.DeviceAlarmCode.Get16bitValue(2);
AlarmHelper<AlarmInfo>.Alarm.Inverter = deviceStatus.DeviceAlarmCode.Get16bitValue(3);
AlarmHelper<AlarmInfo>.Alarm.EStop2 = deviceStatus.DeviceAlarmCode.Get16bitValue(7);
AlarmHelper<AlarmInfo>.Alarm.SiloUpperLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(8);
AlarmHelper<AlarmInfo>.Alarm.SiloLowerLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(9);
AlarmHelper<AlarmInfo>.Alarm.EStop1 = true;
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);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).EStop1 = true;
Thread.Sleep(10);
}), $"{DeviceName} 开始监听", true);
}
@@ -342,7 +342,7 @@ namespace BPASmartClient.DosingHKProject.Model
{
modbusTcp.SetReal(DeviceAddress.WeightSet, Value);//写入配方量
modbusTcp.Write(DeviceAddress.Start, (ushort)1);//设备启动写入
MessageLog.GetInstance.ShowRunLog($"开始配料");
MessageNotify.GetInstance.ShowRunLog($"开始配料");
//配料设备参数写入
var res = Json<DevicePar>.Data.deviceParModels.FirstOrDefault(p => p.MaterialName == DeviceName);
if (res != null)
@@ -355,7 +355,7 @@ namespace BPASmartClient.DosingHKProject.Model
modbusTcp.SetUint(DeviceAddress.SiloUpperLimitWeight, (uint)res.SiloUpperLimitWeight);
modbusTcp.SetUint(DeviceAddress.LowerLimitWeightOfSilo, (uint)res.LowerLimitWeightOfSilo);
modbusTcp.SetUint(DeviceAddress.StirringSpeed, (uint)res.StirringSpeed * 100);
MessageLog.GetInstance.ShowRunLog($"参数下发完成");
MessageNotify.GetInstance.ShowRunLog($"参数下发完成");
}
}
}


+ 2
- 2
BPASmartClient.DosingProject/ViewModel/NewMaterialViewModel.cs 查看文件

@@ -37,7 +37,7 @@ public class NewMaterialViewModel:ObservableObject
var res = Materials.FirstOrDefault(p=>p.RawMaterialId == id);
Materials.Remove(res);
Json<LocaMaterial>.Save();
MessageLog.GetInstance.ShowUserLog($"删除原料--{res.RawMaterialName}");
MessageNotify.GetInstance.ShowUserLog($"删除原料--{res.RawMaterialName}");
}
}

@@ -52,7 +52,7 @@ public class NewMaterialViewModel:ObservableObject
if(Json<LocaMaterial>.Data.LocalMaterails.FirstOrDefault(p=>p.RawMaterialName == MaterialName) != null) { ErrorInfo = "本地原料名称重复";return ;}
Json<LocaMaterial>.Data.LocalMaterails.Add(new RawMaterialModel { RawMaterialName = MaterialName, RawMaterialId = Guid.NewGuid().ToString() , RawMaterialSource = 0 });
Json<LocaMaterial>.Save();
MessageLog.GetInstance.ShowUserLog($"添加原料--{MaterialName}");
MessageNotify.GetInstance.ShowUserLog($"添加原料--{MaterialName}");
});
}
}

+ 3
- 3
BPASmartClient.DosingProject/ViewModel/RecipeControlViewModel.cs 查看文件

@@ -35,7 +35,7 @@ namespace BPASmartClient.DosingHKProject.ViewModel
{
Recipes.ElementAt(index).IsEnable = false;
}
MessageLog.GetInstance.ShowUserLog($"下发工单 { Recipes.ElementAt(index).RecipeName}");
MessageNotify.GetInstance.ShowUserLog($"下发工单 { Recipes.ElementAt(index).RecipeName}");
devices.Enqueue(deviceName);
var res = Recipes.FirstOrDefault(p => p.RecipeName == deviceName);
UserTreeWait.Add(new RecipeModel { RecipeName = deviceName, RawMaterials = res.RawMaterials });
@@ -43,7 +43,7 @@ namespace BPASmartClient.DosingHKProject.ViewModel


NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方下发成功!");
MessageLog.GetInstance.ShowUserLog($"下发工单 {Guid.NewGuid().ToString()}");
MessageNotify.GetInstance.ShowUserLog($"下发工单 {Guid.NewGuid().ToString()}");
});

ChangeRecipeStateCommand = new RelayCommand<object>(ChangeRecipeState);
@@ -128,7 +128,7 @@ namespace BPASmartClient.DosingHKProject.ViewModel
for (int n = 0; n < recipeProcesses.Count; n++)
{
DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(recipIndex).RawMaterials.ElementAt(n).DeviceIp).StatusReset();//完成配料的设备运行状态地址写0
MessageLog.GetInstance.ShowRunLog(Recipes.ElementAt(recipIndex).RawMaterials.ElementAt(n).DeviceIp);
MessageNotify.GetInstance.ShowRunLog(Recipes.ElementAt(recipIndex).RawMaterials.ElementAt(n).DeviceIp);
}
App.Current.Dispatcher.Invoke(new Action(() => { recipeProcesses.Clear(); }));
Recipes.ElementAt(recipIndex).IsEnable = true;


+ 3
- 3
BPASmartClient.DosingProject/ViewModel/RecipeReceiveViewModel.cs 查看文件

@@ -43,7 +43,7 @@ namespace BPASmartClient.DosingHKProject.ViewModel
if (res != null)
{
Json<LocalRecipeDataColl>.Data.Recipes.Remove(res);
MessageLog.GetInstance.ShowUserLog($"删除配方——{res.RecipeName}");
MessageNotify.GetInstance.ShowUserLog($"删除配方——{res.RecipeName}");
}
}
});
@@ -58,7 +58,7 @@ namespace BPASmartClient.DosingHKProject.ViewModel
{
ActionManage.GetInstance.Send("LocalRecipeEdit", res);
nrv.Show();
MessageLog.GetInstance.ShowUserLog($"编辑配方——{res.RecipeName}");
MessageNotify.GetInstance.ShowUserLog($"编辑配方——{res.RecipeName}");
}
}
});
@@ -70,7 +70,7 @@ namespace BPASmartClient.DosingHKProject.ViewModel
if (res != null)
{
Json<RemoteRecipeDataColl>.Data.Recipes.Add(res);
MessageLog.GetInstance.ShowUserLog($"下发配方——{res.RecipeName}");
MessageNotify.GetInstance.ShowUserLog($"下发配方——{res.RecipeName}");
}
}
});


+ 4
- 4
BPASmartClient.DosingProject/ViewModel/RecipeSettingsViewModel.cs 查看文件

@@ -37,12 +37,12 @@ namespace BPASmartClient.DosingHKProject.ViewModel
{
NewRecipeView nrv = new NewRecipeView();
nrv.ShowDialog();
MessageLog.GetInstance.ShowUserLog("新建配方");
MessageNotify.GetInstance.ShowUserLog("新建配方");
});
SaveRecipe = new RelayCommand(() =>
{
Json<LocaPar>.Save();
MessageLog.GetInstance.ShowUserLog("保存配方");
MessageNotify.GetInstance.ShowUserLog("保存配方");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方保存成功!");
});
RemoveCommand = new RelayCommand<object>((o) =>
@@ -51,7 +51,7 @@ namespace BPASmartClient.DosingHKProject.ViewModel
{
var res = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipCode == str);
if (res != null) Json<LocaPar>.Data.Recipes.Remove(res);
MessageLog.GetInstance.ShowUserLog($"删除名称——{res.RecipeName}");
MessageNotify.GetInstance.ShowUserLog($"删除名称——{res.RecipeName}");
}
});

@@ -64,7 +64,7 @@ namespace BPASmartClient.DosingHKProject.ViewModel
var res = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipCode == str);
ActionManage.GetInstance.Send("Details", res);
nrv.ShowDialog();
MessageLog.GetInstance.ShowUserLog($"编辑配方名称——{res.RecipeName}");
MessageNotify.GetInstance.ShowUserLog($"编辑配方名称——{res.RecipeName}");
}
});



+ 1
- 1
BPASmartClient.DosingProject/ViewModel/SiemensRecipeReceiveViewModel.cs 查看文件

@@ -40,7 +40,7 @@ namespace BPASmartClient.DosingHKProject.ViewModel
{
ActionManage.GetInstance.Send("RecipeInfo", res);
nrv.Show();
MessageLog.GetInstance.ShowUserLog($"查看配方——{res.RecipeName}");
MessageNotify.GetInstance.ShowUserLog($"查看配方——{res.RecipeName}");
}
}
});


+ 2
- 2
BPASmartClient.JXJFoodBigStation/App.xaml.cs 查看文件

@@ -34,7 +34,7 @@ namespace BPASmartClient.JXJFoodBigStation
var res = lv.ShowDialog();
if (res != null && res == true)
{
MessageLog.GetInstance.ShowUserLog("用户登录");
MessageNotify.GetInstance.ShowUserLog("用户登录");
mv.Show();
}
else
@@ -45,7 +45,7 @@ namespace BPASmartClient.JXJFoodBigStation
protected override void OnExit(ExitEventArgs e)
{
base.OnExit(e);
MessageLog.GetInstance.LogSave();
MessageNotify.GetInstance.LogSave();
ThreadManage.GetInstance().Dispose();
}



+ 1
- 1
BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs 查看文件

@@ -113,7 +113,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
if (HKDevice.IsConnected)
{
HKDevice.Init();
MessageLog.GetInstance.ShowRunLog("海科plc连接成功");
MessageNotify.GetInstance.ShowRunLog("海科plc连接成功");
}
if (SiemensDevice.IsConnected)
{


+ 1
- 1
BPASmartClient.JXJFoodBigStation/ViewModel/RecipeReceiveViewModel.cs 查看文件

@@ -37,7 +37,7 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
var res = Json<LocalRecipe>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == num);
ActionManage.GetInstance.Send("RecipeInfo", res);
nrv.Show();
MessageLog.GetInstance.ShowUserLog($"查看配方——{res.RecipeName}");
MessageNotify.GetInstance.ShowUserLog($"查看配方——{res.RecipeName}");
}
});
NewRecipe = new RelayCommand(() => {


+ 2
- 2
BPASmartClient.JXJFoodSmallStation/App.xaml.cs 查看文件

@@ -35,7 +35,7 @@ namespace BPASmartClient.JXJFoodSmallStation
var res = lv.ShowDialog();
if (res != null && res == true)
{
MessageLog.GetInstance.ShowUserLog("用户登录");
MessageNotify.GetInstance.ShowUserLog("用户登录");
mv.Show();
}
else
@@ -48,7 +48,7 @@ namespace BPASmartClient.JXJFoodSmallStation
base.OnExit(e);
Json<LocaPar>.Save();
Json<LocalRecipeDataColl>.Save();
MessageLog.GetInstance.LogSave();
MessageNotify.GetInstance.LogSave();
ThreadManage.GetInstance().Dispose();
}



+ 8
- 8
BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/HKDeviceStatus.cs 查看文件

@@ -86,7 +86,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC
{
HK_PLC_S7.Write<bool>("DB4.DBX11." + (StockBinLocation - 9), true);
}
MessageLog.GetInstance.ShowRunLog($"托盘1—1号桶在料仓{StockBinLocation}配料");
MessageNotify.GetInstance.ShowRunLog($"托盘1—1号桶在料仓{StockBinLocation}配料");
}
else if (BarrelNum == 2)
{
@@ -98,7 +98,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC
{
HK_PLC_S7.Write<bool>("DB4.DBX13." + (StockBinLocation - 9), true);
}
MessageLog.GetInstance.ShowRunLog($"托盘1—2号桶在料仓{StockBinLocation}配料");
MessageNotify.GetInstance.ShowRunLog($"托盘1—2号桶在料仓{StockBinLocation}配料");
}
else if (BarrelNum == 3)
{
@@ -110,7 +110,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC
{
HK_PLC_S7.Write<bool>("DB4.DBX15." + (StockBinLocation - 9), true);
}
MessageLog.GetInstance.ShowRunLog($"托盘1—3号桶在料仓{StockBinLocation}配料");
MessageNotify.GetInstance.ShowRunLog($"托盘1—3号桶在料仓{StockBinLocation}配料");
}
else if (BarrelNum == 4)
{
@@ -122,7 +122,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC
{
HK_PLC_S7.Write<bool>("DB4.DBX17." + (StockBinLocation - 9), true);
}
MessageLog.GetInstance.ShowRunLog($"托盘1—4号桶在料仓{StockBinLocation}配料");
MessageNotify.GetInstance.ShowRunLog($"托盘1—4号桶在料仓{StockBinLocation}配料");
}
}
}
@@ -140,7 +140,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC
{
HK_PLC_S7.Write<bool>("DB4.DBX19." + (StockBinLocation - 9), true);
}
MessageLog.GetInstance.ShowRunLog($"托盘2—1号桶在料仓{StockBinLocation}配料");
MessageNotify.GetInstance.ShowRunLog($"托盘2—1号桶在料仓{StockBinLocation}配料");
}
else if (BarrelNum == 2)
{
@@ -152,7 +152,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC
{
HK_PLC_S7.Write<bool>("DB4.DBX21." + (StockBinLocation - 9), true);
}
MessageLog.GetInstance.ShowRunLog($"托盘2—2号桶在料仓{StockBinLocation}配料");
MessageNotify.GetInstance.ShowRunLog($"托盘2—2号桶在料仓{StockBinLocation}配料");
}
else if (BarrelNum == 3)
{
@@ -164,7 +164,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC
{
HK_PLC_S7.Write<bool>("DB4.DBX23." + (StockBinLocation - 9), true);
}
MessageLog.GetInstance.ShowRunLog($"托盘2—3号桶在料仓{StockBinLocation}配料");
MessageNotify.GetInstance.ShowRunLog($"托盘2—3号桶在料仓{StockBinLocation}配料");
}
else if (BarrelNum == 4)
{
@@ -176,7 +176,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC
{
HK_PLC_S7.Write<bool>("DB4.DBX25." + (StockBinLocation - 9), true);
}
MessageLog.GetInstance.ShowRunLog($"托盘2—4号桶在料仓{StockBinLocation}配料");
MessageNotify.GetInstance.ShowRunLog($"托盘2—4号桶在料仓{StockBinLocation}配料");
}
}
}


+ 38
- 38
BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs 查看文件

@@ -80,7 +80,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
else
{
MessageLog.GetInstance.AlarmLog("配方名称与本地不符合");
MessageNotify.GetInstance.AlarmLog("配方名称与本地不符合");
}
}
Json<RemoteRecipeDataColl>.Data.Recipes.Add(new RemoteRecipeData()
@@ -117,17 +117,17 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
if (HKDevice.IsConnected)
{
HKDevice.Init();
MessageLog.GetInstance.ShowRunLog("海科plc连接成功,并初始化完成");
MessageNotify.GetInstance.ShowRunLog("海科plc连接成功,并初始化完成");
}
if (SiemensDevice.IsConnected)
{
SiemensDevice.Init();
MessageLog.GetInstance.ShowRunLog("西门子plc连接成功,并初始化完成");
MessageNotify.GetInstance.ShowRunLog("西门子plc连接成功,并初始化完成");
}
if (WindSendDevice.IsConnected)
{
WindSendDevice.Init();
MessageLog.GetInstance.ShowRunLog("风送plc连接成功,并初始化完成");
MessageNotify.GetInstance.ShowRunLog("风送plc连接成功,并初始化完成");
}
}
catch(Exception ex)
@@ -706,7 +706,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
HKDevice.HK_PLC_S7.Write("DB4.DBX1.3", true);
GVL_SmallStation.GetInstance.RecipeStatusID = 1;
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},下发完成");
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},下发完成");
HKDevice.HK_PLC_S7.Write("DB3.DBX1.3", true);
}
@@ -714,14 +714,14 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
{
HKDevice.HK_PLC_S7.Write("DB3.DBX1.3", false);
GVL_SmallStation.GetInstance.RecipeStatusID = 2;
MessageLog.GetInstance.ShowRunLog($"托盘1,{ recipeName}plc端 配方接收完成");
MessageNotify.GetInstance.ShowRunLog($"托盘1,{ recipeName}plc端 配方接收完成");
}
if (GVL_SmallStation.GetInstance.RecipeStatusID == 2)
{
if (RTrig.GetInstance("DB3.DBX50.0").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.0")))
{
var res = HKDevice.HK_PLC_S7.Read<float>("DB3.DBD10");
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},1号桶,{res}料仓,允许配料");
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},1号桶,{res}料仓,允许配料");
if (res > 0 && res is float loc)
{
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc);
@@ -734,13 +734,13 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
GVL_SmallStation.GetInstance.DosingTray1 = true;
GVL_SmallStation.GetInstance.DosingTray1Loc = (int)loc;
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},1号桶,{(int)loc}号仓,配料完成");
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},1号桶,{(int)loc}号仓,配料完成");
}
}
else if(RTrig.GetInstance("DB3.DBX50.1").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.1")))
{
var res = HKDevice.HK_PLC_S7.Read<float>("DB3.DBD14");
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},2号桶,{res}料仓,允许配料");
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},2号桶,{res}料仓,允许配料");
if (res > 0 && res is float loc)
{
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc);
@@ -753,13 +753,13 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
GVL_SmallStation.GetInstance.DosingTray1 = true;
GVL_SmallStation.GetInstance.DosingTray1Loc = (int)loc;
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},2号桶,{(int)loc}号仓,配料完成");
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},2号桶,{(int)loc}号仓,配料完成");
}
}
else if (RTrig.GetInstance("DB3.DBX50.2").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.2")))
{
var res = HKDevice.HK_PLC_S7.Read<float>("DB3.DBD18");
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},3号桶,{res}料仓,允许配料");
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},3号桶,{res}料仓,允许配料");
if (res > 0 && res is float loc)
{
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc);
@@ -772,13 +772,13 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
GVL_SmallStation.GetInstance.DosingTray1 = true;
GVL_SmallStation.GetInstance.DosingTray1Loc = (int)loc;
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},3号桶,{(int)loc}号仓,配料完成");
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},3号桶,{(int)loc}号仓,配料完成");
}
}
else if (RTrig.GetInstance("DB3.DBX50.3").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.3")))
{
var res = HKDevice.HK_PLC_S7.Read<float>("DB3.DBD22");
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},4号桶,{res}料仓,允许配料");
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},4号桶,{res}料仓,允许配料");
if (res > 0 && res is float loc)
{
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc);
@@ -791,7 +791,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
GVL_SmallStation.GetInstance.DosingTray1 = true;
GVL_SmallStation.GetInstance.DosingTray1Loc = (int)loc;
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},4号桶,{(int)loc}号仓,配料完成");
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},4号桶,{(int)loc}号仓,配料完成");
}
}
if (GVL_SmallStation.GetInstance.DosingTray1 && GVL_SmallStation.GetInstance.DosingTray1Loc > 0 && GVL_SmallStation.GetInstance.DosingTray1Loc < 16)
@@ -799,27 +799,27 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
int i = GVL_SmallStation.GetInstance.DosingTray1Loc;
if (RTrig.GetInstance("Tray1StatusDevice" + i).Start(DeviceInquire.GetInstance.GetDevice(i).deviceStatus.RunStatus == 3))
{
MessageLog.GetInstance.ShowRunLog($"柔性味魔方,托盘1,配方:{recipeName},{i}号仓,配料完成");
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方,托盘1,配方:{recipeName},{i}号仓,配料完成");
int res = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == i);
RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(res).Laying_Off_Weight = DeviceInquire.GetInstance.GetDevice(i).deviceStatus.CutWeightFeedback;
bool info = DeviceInquire.GetInstance.GetDevice(i).StatusReset();
if (info)
{
MessageLog.GetInstance.ShowRunLog($"柔性味魔方配料完成后复位 发送成功");
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方配料完成后复位 发送成功");
}
else
{
MessageLog.GetInstance.ShowRunLog($"柔性味魔方配料完成后复位 发送失败");
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方配料完成后复位 发送失败");
}
if (i >= 1 && i <= 8)
{
string commInfo = HKDevice.HK_PLC_S7.Write("DB4.DBX30." + (i - 1), true, 4);
MessageLog.GetInstance.ShowRunLog(commInfo);
MessageNotify.GetInstance.ShowRunLog(commInfo);
}
else if (i >= 9 && i <= 15)
{
string commInfo1 = HKDevice.HK_PLC_S7.Write("DB4.DBX31." + (i - 9), true, 4);
MessageLog.GetInstance.ShowRunLog(commInfo1);
MessageNotify.GetInstance.ShowRunLog(commInfo1);
}
GVL_SmallStation.GetInstance.DosingTray1 = false;
GVL_SmallStation.GetInstance.DosingTray1Loc = 0;
@@ -829,7 +829,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
if (RTrig.GetInstance("配方配料完成").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX1.1")) && (GVL_SmallStation.GetInstance.WindSendDosingFinish || !GVL_SmallStation.GetInstance.IsUseWindSend))
{
var res = Json<RemoteRecipeDataColl>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == code);
MessageLog.GetInstance.ShowRunLog($"托盘1,配方{res.RecipeName},配料完成");
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方{res.RecipeName},配料完成");
RecipeFinishInfo.Order_No = RemoteRecipes.ElementAt(index).RecipeCode;
RecipeFinishInfo.Product_Code = RemoteRecipes.ElementAt(index).RecipeName;
for (int i = 0; i < RemoteRecipes.ElementAt(index).RawMaterial.Count; i++)
@@ -868,14 +868,14 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
{
if (GVL_SmallStation.GetInstance.RecipeStatusIDTray2 == 0)
{
MessageLog.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},初始化");
MessageNotify.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},初始化");
foreach (var item in RemoteRecipes.ElementAt(index).RawMaterial)
{
HKDevice.StockBinPar((uint)item.RawMaterialBarrelNum, (ushort)item.RawMaterialLocation, 2);
}
HKDevice.HK_PLC_S7.Write("DB4.DBX1.4", true);
GVL_SmallStation.GetInstance.RecipeStatusIDTray2 = 1;
MessageLog.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},下发完成");
MessageNotify.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},下发完成");
HKDevice.HK_PLC_S7.Write("DB3.DBX1.4", true);
}

@@ -883,14 +883,14 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
{
HKDevice.HK_PLC_S7.Write("DB3.DBX1.4", false);
GVL_SmallStation.GetInstance.RecipeStatusIDTray2 = 2;
MessageLog.GetInstance.ShowRunLog($"配方:{recipeName},plc端 配方接收完成");
MessageNotify.GetInstance.ShowRunLog($"配方:{recipeName},plc端 配方接收完成");
}
if (GVL_SmallStation.GetInstance.RecipeStatusIDTray2 == 2)
{
if (RTrig.GetInstance("DB3.DBX50.4").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.4")))
{
var res = HKDevice.HK_PLC_S7.Read<float>("DB3.DBD26");
MessageLog.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},1号桶,{res}料仓,允许配料");
MessageNotify.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},1号桶,{res}料仓,允许配料");
if (res > 0 && res is float loc)
{
//int decimalNum = Convert.ToInt32(loc.ToString().Substring(loc.ToString().IndexOf(".") + 1));
@@ -904,13 +904,13 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
GVL_SmallStation.GetInstance.DosingTray2 = true;
GVL_SmallStation.GetInstance.DosingTray2Loc = (int)loc;
MessageLog.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},1号桶,{(int)loc}号仓,配料完成");
MessageNotify.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},1号桶,{(int)loc}号仓,配料完成");
}
}
else if (RTrig.GetInstance("DB3.DBX50.5").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.5")))
{
var res = HKDevice.HK_PLC_S7.Read<float>("DB3.DBD30");
MessageLog.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},2号桶,{res}料仓,允许配料");
MessageNotify.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},2号桶,{res}料仓,允许配料");
if (res > 0 && res is float loc)
{
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc);
@@ -923,13 +923,13 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
GVL_SmallStation.GetInstance.DosingTray2 = true;
GVL_SmallStation.GetInstance.DosingTray2Loc = (int)loc;
MessageLog.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},2号桶,{(int)loc}号仓,配料完成");
MessageNotify.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},2号桶,{(int)loc}号仓,配料完成");
}
}
else if (RTrig.GetInstance("DB3.DBX50.6").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.6")))
{
var res = HKDevice.HK_PLC_S7.Read<float>("DB3.DBD34");
MessageLog.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},3号桶,{res}料仓,允许配料");
MessageNotify.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},3号桶,{res}料仓,允许配料");
if (res > 0 && res is float loc)
{
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc);
@@ -942,13 +942,13 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
GVL_SmallStation.GetInstance.DosingTray2 = true;
GVL_SmallStation.GetInstance.DosingTray2Loc = (int)loc;
MessageLog.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},3号桶,{(int)loc}号仓,配料完成");
MessageNotify.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},3号桶,{(int)loc}号仓,配料完成");
}
}
else if (RTrig.GetInstance("DB3.DBX50.7").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.7")))
{
var res = HKDevice.HK_PLC_S7.Read<float>("DB3.DBD38");
MessageLog.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},4号桶,{res}料仓,允许配料");
MessageNotify.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},4号桶,{res}料仓,允许配料");
if (res > 0 && res is float loc)
{
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc);
@@ -961,7 +961,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
GVL_SmallStation.GetInstance.DosingTray2 = true;
GVL_SmallStation.GetInstance.DosingTray2Loc = (int)loc;
MessageLog.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},4号桶,{(int)loc}号仓,配料完成");
MessageNotify.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},4号桶,{(int)loc}号仓,配料完成");
}
}
if (GVL_SmallStation.GetInstance.DosingTray2 == true && GVL_SmallStation.GetInstance.DosingTray1 == false && GVL_SmallStation.GetInstance.DosingTray2Loc > 0 && GVL_SmallStation.GetInstance.DosingTray2Loc < 16)
@@ -969,27 +969,27 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
int i = GVL_SmallStation.GetInstance.DosingTray2Loc;
if (RTrig.GetInstance("Tray2StatusDevice" + i).Start(DeviceInquire.GetInstance.GetDevice(i).deviceStatus.RunStatus == 3))
{
MessageLog.GetInstance.ShowRunLog($"柔性味魔方,托盘2,配方:{recipeName},{i}号仓,配料完成");
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方,托盘2,配方:{recipeName},{i}号仓,配料完成");
int res = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == i);
RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(res).Laying_Off_Weight = DeviceInquire.GetInstance.GetDevice(i).deviceStatus.CutWeightFeedback;
bool info = DeviceInquire.GetInstance.GetDevice(i).StatusReset();
if (info)
{
MessageLog.GetInstance.ShowRunLog($"柔性味魔方配料完成后复位 发送成功");
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方配料完成后复位 发送成功");
}
else
{
MessageLog.GetInstance.ShowRunLog($"柔性味魔方配料完成后复位 发送失败");
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方配料完成后复位 发送失败");
}
if (i >= 1 && i <= 8)
{
string commInfo = HKDevice.HK_PLC_S7.Write("DB4.DBX30." + (i - 1), true, 4);
MessageLog.GetInstance.ShowRunLog(commInfo);
MessageNotify.GetInstance.ShowRunLog(commInfo);
}
else if (i >= 9 && i <= 15)
{
string commInfo1 = HKDevice.HK_PLC_S7.Write("DB4.DBX31." + (i - 9), true, 4);
MessageLog.GetInstance.ShowRunLog(commInfo1);
MessageNotify.GetInstance.ShowRunLog(commInfo1);
}
GVL_SmallStation.GetInstance.DosingTray2 = false;
GVL_SmallStation.GetInstance.DosingTray2Loc = 0;
@@ -998,7 +998,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
if (RTrig.GetInstance("DB3.DBX1.2").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX1.2")))
{
var res = Json<RemoteRecipeDataColl>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == code);
MessageLog.GetInstance.ShowRunLog($"托盘2,配方{res.RecipeName},配料完成");
MessageNotify.GetInstance.ShowRunLog($"托盘2,配方{res.RecipeName},配料完成");
RecipeFinishInfo.Order_No = RemoteRecipes.ElementAt(index).RecipeCode;
RecipeFinishInfo.Product_Code = RemoteRecipes.ElementAt(index).RecipeName;
for (int i = 0; i < RemoteRecipes.ElementAt(index).RawMaterial.Count; i++)
@@ -1040,7 +1040,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
{
if (RTrig.GetInstance("Tray2StatusDevice" + DeviceID).Start(DeviceInquire.GetInstance.GetDevice(DeviceID).deviceStatus.RunStatus == 3))
{
MessageLog.GetInstance.ShowRunLog($"柔性味魔方,托盘2,配方:{RemoteRecipes.ElementAt(Index).RecipeName},{DeviceID}号仓,配料完成");
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方,托盘2,配方:{RemoteRecipes.ElementAt(Index).RecipeName},{DeviceID}号仓,配料完成");
int res = Array.FindIndex(RemoteRecipes.ElementAt(Index).RawMaterial.ToArray(), p => p.RawMaterialLocation == DeviceID);
RemoteRecipes.ElementAt(Index).RawMaterial.ElementAt(res).Laying_Off_Weight = DeviceInquire.GetInstance.GetDevice(DeviceID).deviceStatus.CutWeightFeedback;
DeviceInquire.GetInstance.GetDevice(DeviceID).StatusReset();


+ 13
- 13
BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DeviceInquire.cs 查看文件

@@ -100,8 +100,8 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
public void Init()
{
AlarmHelper<AlarmInfo>.Init();
AlarmHelper<AlarmInfo>.Alarm.EStop1 = true;
//AlarmHelper<AlarmInfo>.Init();
//AlarmHelper<AlarmInfo>.Alarm.EStop1 = true;

//TestData();
IpAddressLines();
@@ -297,12 +297,12 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
{
modbusTcp.Show += new Action<string>((s) =>
{
if (s != null) MessageLog.GetInstance.ShowRunLog(s);
if (s != null) MessageNotify.GetInstance.ShowRunLog(s);
});

modbusTcp.ShowEx += new Action<string>((s) =>
{
if (s != null) MessageLog.GetInstance.ShowRunLog(s);
if (s != null) MessageNotify.GetInstance.ShowRunLog(s);
});
this.DeviceName = DeviceName;
AlarmHelper<AlarmInfo>.Init();
@@ -321,12 +321,12 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
deviceStatus.NowWeightFeedback = (float)this.modbusTcp.GetUint(DeviceAddress.CutWeightFeedback);//获取下料重量
deviceStatus.DeviceNum = (ushort)this.modbusTcp.ReadShort(DeviceAddress.DeviceNum);//获取设备编号
deviceStatus.DeviceAlarmCode = (ushort)this.modbusTcp.ReadShort(DeviceAddress.DeviceAlarmCode);//获取设备故障编码
AlarmHelper<AlarmInfo>.Alarm.EStop1 = deviceStatus.DeviceAlarmCode.Get16bitValue(1);
AlarmHelper<AlarmInfo>.Alarm.Servo = deviceStatus.DeviceAlarmCode.Get16bitValue(2);
AlarmHelper<AlarmInfo>.Alarm.Inverter = deviceStatus.DeviceAlarmCode.Get16bitValue(3);
AlarmHelper<AlarmInfo>.Alarm.EStop2 = deviceStatus.DeviceAlarmCode.Get16bitValue(7);
AlarmHelper<AlarmInfo>.Alarm.SiloUpperLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(8);
AlarmHelper<AlarmInfo>.Alarm.SiloLowerLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(9);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).EStop1 = deviceStatus.DeviceAlarmCode.Get16bitValue(1);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).Servo = deviceStatus.DeviceAlarmCode.Get16bitValue(2);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).Inverter = deviceStatus.DeviceAlarmCode.Get16bitValue(3);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).EStop2 = deviceStatus.DeviceAlarmCode.Get16bitValue(7);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).SiloUpperLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(8);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).SiloLowerLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(9);

Thread.Sleep(10);
}), $"{DeviceName} 开始监听", true);
@@ -358,11 +358,11 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
bool returnValue = modbusTcp.Write(DeviceAddress.Start, (ushort)1);//设备启动写入
if (returnValue)
{
MessageLog.GetInstance.ShowRunLog($"发送成功" + DeviceAddress.Start);
MessageNotify.GetInstance.ShowRunLog($"发送成功" + DeviceAddress.Start);
}
else
{
MessageLog.GetInstance.ShowRunLog($"发送失败" + DeviceAddress.Start);
MessageNotify.GetInstance.ShowRunLog($"发送失败" + DeviceAddress.Start);
}
//配料设备参数写入
var res = Json<DevicePar>.Data.deviceParModels.FirstOrDefault(p => p.MaterialName == DeviceName);
@@ -376,7 +376,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
modbusTcp.SetUint(DeviceAddress.SiloUpperLimitWeight, (uint)res.SiloUpperLimitWeight);
modbusTcp.SetUint(DeviceAddress.LowerLimitWeightOfSilo, (uint)res.LowerLimitWeightOfSilo);
modbusTcp.SetUint(DeviceAddress.StirringSpeed, (uint)res.StirringSpeed * 100);
MessageLog.GetInstance.ShowRunLog($"{res.MaterialName},参数下发完成");
MessageNotify.GetInstance.ShowRunLog($"{res.MaterialName},参数下发完成");
}
}
}


+ 2
- 2
BPASmartClient.JXJFoodSmallStation/ViewModel/NewMaterialViewModel.cs 查看文件

@@ -37,7 +37,7 @@ public class NewMaterialViewModel:ObservableObject
var res = Materials.FirstOrDefault(p=>p.RawMaterialId == id);
Materials.Remove(res);
Json<LocaMaterial>.Save();
MessageLog.GetInstance.ShowUserLog($"删除原料--{res.RawMaterialName}");
MessageNotify.GetInstance.ShowUserLog($"删除原料--{res.RawMaterialName}");
}
}

@@ -52,7 +52,7 @@ public class NewMaterialViewModel:ObservableObject
if(Json<LocaMaterial>.Data.LocalMaterails.FirstOrDefault(p=>p.RawMaterialName == MaterialName) != null) { ErrorInfo = "本地原料名称重复";return ;}
Json<LocaMaterial>.Data.LocalMaterails.Add(new RawMaterialModel { RawMaterialName = MaterialName, RawMaterialId = Guid.NewGuid().ToString() , RawMaterialSource = 0 });
Json<LocaMaterial>.Save();
MessageLog.GetInstance.ShowUserLog($"添加原料--{MaterialName}");
MessageNotify.GetInstance.ShowUserLog($"添加原料--{MaterialName}");
});
}
}

+ 3
- 3
BPASmartClient.JXJFoodSmallStation/ViewModel/RecipeControlViewModel.cs 查看文件

@@ -34,7 +34,7 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
{
Recipes.ElementAt(index).IsEnable = false;
}
MessageLog.GetInstance.ShowUserLog($"下发工单 { Recipes.ElementAt(index).RecipeName}");
MessageNotify.GetInstance.ShowUserLog($"下发工单 { Recipes.ElementAt(index).RecipeName}");
devices.Enqueue(deviceName);
var res = Recipes.FirstOrDefault(p => p.RecipeName == deviceName);
UserTreeWait.Add(new RecipeModel { RecipeName = deviceName, RawMaterials = res.RawMaterials });
@@ -42,7 +42,7 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel


NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方下发成功!");
MessageLog.GetInstance.ShowUserLog($"下发工单 {Guid.NewGuid().ToString()}");
MessageNotify.GetInstance.ShowUserLog($"下发工单 {Guid.NewGuid().ToString()}");
});

ChangeRecipeStateCommand = new RelayCommand<object>(ChangeRecipeState);
@@ -127,7 +127,7 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
for (int n = 0; n < recipeProcesses.Count; n++)
{
DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(recipIndex).RawMaterials.ElementAt(n).DeviceIp).StatusReset();//完成配料的设备运行状态地址写0
MessageLog.GetInstance.ShowRunLog(Recipes.ElementAt(recipIndex).RawMaterials.ElementAt(n).DeviceIp);
MessageNotify.GetInstance.ShowRunLog(Recipes.ElementAt(recipIndex).RawMaterials.ElementAt(n).DeviceIp);
}
App.Current.Dispatcher.Invoke(new Action(() => { recipeProcesses.Clear(); }));
Recipes.ElementAt(recipIndex).IsEnable = true;


+ 3
- 3
BPASmartClient.JXJFoodSmallStation/ViewModel/RecipeReceiveViewModel.cs 查看文件

@@ -45,7 +45,7 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
if (res != null)
{
Json<LocalRecipeDataColl>.Data.Recipes.Remove(res);
MessageLog.GetInstance.ShowUserLog($"删除配方——{res.RecipeName}");
MessageNotify.GetInstance.ShowUserLog($"删除配方——{res.RecipeName}");
}
}
});
@@ -60,7 +60,7 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
{
ActionManage.GetInstance.Send("LocalRecipeEdit", res);
nrv.Show();
MessageLog.GetInstance.ShowUserLog($"编辑配方——{res.RecipeName}");
MessageNotify.GetInstance.ShowUserLog($"编辑配方——{res.RecipeName}");
}
}
});
@@ -86,7 +86,7 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
{
ActionManage.GetInstance.Send("LocalSimulationRecipeIssue", res);
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"{res.RecipeName}配方下发成功!");
MessageLog.GetInstance.ShowUserLog($"下发本地模拟配方——{res.RecipeName}");
MessageNotify.GetInstance.ShowUserLog($"下发本地模拟配方——{res.RecipeName}");
}
}
}


+ 4
- 4
BPASmartClient.JXJFoodSmallStation/ViewModel/RecipeSettingsViewModel.cs 查看文件

@@ -36,12 +36,12 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
{
NewRecipeView nrv = new NewRecipeView();
nrv.ShowDialog();
MessageLog.GetInstance.ShowUserLog("新建配方");
MessageNotify.GetInstance.ShowUserLog("新建配方");
});
SaveRecipe = new RelayCommand(() =>
{
Json<LocaPar>.Save();
MessageLog.GetInstance.ShowUserLog("保存配方");
MessageNotify.GetInstance.ShowUserLog("保存配方");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方保存成功!");
});
RemoveCommand = new RelayCommand<object>((o) =>
@@ -50,7 +50,7 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
{
var res = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipCode == str);
if (res != null) Json<LocaPar>.Data.Recipes.Remove(res);
MessageLog.GetInstance.ShowUserLog($"删除名称——{res.RecipeName}");
MessageNotify.GetInstance.ShowUserLog($"删除名称——{res.RecipeName}");
}
});

@@ -63,7 +63,7 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
var res = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipCode == str);
ActionManage.GetInstance.Send("Details", res);
nrv.ShowDialog();
MessageLog.GetInstance.ShowUserLog($"编辑配方名称——{res.RecipeName}");
MessageNotify.GetInstance.ShowUserLog($"编辑配方名称——{res.RecipeName}");
}
});



+ 1
- 1
BPASmartClient.JXJFoodSmallStation/ViewModel/SiemensRecipeReceiveViewModel.cs 查看文件

@@ -40,7 +40,7 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
{
ActionManage.GetInstance.Send("RecipeInfo", res);
nrv.Show();
MessageLog.GetInstance.ShowUserLog($"查看配方——{res.RecipeName}");
MessageNotify.GetInstance.ShowUserLog($"查看配方——{res.RecipeName}");
}
}
});


+ 2
- 2
BPASmartClient.SmallBatchingSystem/Services/Control.cs 查看文件

@@ -312,13 +312,13 @@ PlcServer.GetInstance.WriteData("M4.0", false);//复位出料完成信号

public void RunLog(string info)
{
BPASmartClient.CustomResource.Pages.Model.MessageLog.GetInstance.ShowRunLog(info);
BPASmartClient.CustomResource.Pages.Model.MessageNotify.GetInstance.ShowRunLog(info);
Debug.WriteLine($"{DateTime.Now.ToString("HH:mm:ss")}:{info}");
}

public void OperationLog(string info)
{
BPASmartClient.CustomResource.Pages.Model.MessageLog.GetInstance.ShowUserLog(info);
BPASmartClient.CustomResource.Pages.Model.MessageNotify.GetInstance.ShowUserLog(info);
Debug.WriteLine($"{DateTime.Now.ToString("HH:mm:ss")}:{info}");
}



+ 1
- 1
BPASmartClient.ZhuoDian/App.xaml.cs 查看文件

@@ -35,7 +35,7 @@ namespace BPASmartClient.ZhuoDian
protected override void OnExit(ExitEventArgs e)
{
base.OnExit(e);
MessageLog.GetInstance.LogSave();
MessageNotify.GetInstance.LogSave();
}

private void MenuInit()


+ 11
- 4
DosingSystem/App.xaml.cs 查看文件

@@ -12,8 +12,7 @@ using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.CustomResource.Pages.View;
using BPASmartClient.CustomResource.Pages.ViewModel;
using BPASmartClient.DosingSystem.View;
using BPASmartClient.Helper;
using BPASmartClient.Nfc;
using BPA.Helper;

namespace BPASmartClient.DosingSystem
{
@@ -37,7 +36,7 @@ namespace BPASmartClient.DosingSystem
var res = lv.ShowDialog();
if (res != null && res == true)
{
MessageLog.GetInstance.ShowUserLog("用户登录");
BPASmartClient.CustomResource.Pages.Model.MessageNotify.GetInstance.ShowUserLog("用户登录");
mv.Show();
}
else
@@ -50,7 +49,7 @@ namespace BPASmartClient.DosingSystem
base.OnExit(e);
Json<LocaPar>.Save();
Json<DevicePar>.Save();
MessageLog.GetInstance.LogSave();
BPASmartClient.CustomResource.Pages.Model.MessageNotify.GetInstance.LogSave();
ThreadManage.GetInstance().Dispose();
}

@@ -95,6 +94,14 @@ namespace BPASmartClient.DosingSystem
ToggleWindowPath = "View.DeviceMaterialParView"
});

ParSet.Add(new SubMenumodel()
{
SubMenuName = "通讯参数设置",
SubMenuPermission = new Permission[] { Permission.管理员 },
AssemblyName = "BPASmartClient.DosingSystem",
ToggleWindowPath = "View.CommParSetView"
});

MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "&#xe62d;",


+ 4
- 1
DosingSystem/BPASmartClient.DosingSystem.csproj 查看文件

@@ -24,7 +24,10 @@
<ItemGroup>
<ProjectReference Include="..\BPASmartClient.CustomResource\BPASmartClient.CustomResource.csproj" />
<ProjectReference Include="..\BPASmartClient.Modbus\BPASmartClient.Modbus.csproj" />
<ProjectReference Include="..\BPASmartClient.Nfc\BPASmartClient.Nfc.csproj" />
</ItemGroup>

<ItemGroup>
<Folder Include="Service\" />
</ItemGroup>

</Project>

+ 15
- 13
DosingSystem/Model/DeviceInquire.cs 查看文件

@@ -1,6 +1,5 @@
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.DosingSystem.ViewModel;
using BPASmartClient.Helper;
using BPASmartClient.Modbus;
using BPASmartClient.Model;
using System;
@@ -11,6 +10,8 @@ using System.Linq;
using System.Net.NetworkInformation;
using System.Threading;
using System.Threading.Tasks;
using BPA.Helper;
using System.Text.RegularExpressions;

namespace BPASmartClient.DosingSystem
{
@@ -106,6 +107,8 @@ namespace BPASmartClient.DosingSystem

public void Init()
{
if (!string.IsNullOrEmpty(Json<DevicePar>.Data.Address)) IPSegment = Json<DevicePar>.Data.Address;
else Json<DevicePar>.Data.Address = IPSegment;
TestData();
IpAddressLines();
DeviceDataInit();
@@ -150,7 +153,11 @@ namespace BPASmartClient.DosingSystem
{
if (!InvalidIP.Contains($"{IPSegment}{i}") && !DeviceLists.ContainsKey($"{IPSegment}{i}"))
{
IPLists.Add($"{IPSegment}{i}");
string pattern = @"^(([1-9]\d?)|(1\d{2})|(2[01]\d)|(22[0-3]))(\.((1?\d\d?)|(2[04]/d)|(25[0-5]))){3}$";
if (Regex.IsMatch($"{IPSegment}{i}", pattern))
{
IPLists.Add($"{IPSegment}{i}");
}
}
}

@@ -281,8 +288,6 @@ namespace BPASmartClient.DosingSystem
/// </summary>
public RawMaterialDeviceStatus deviceStatus { get; set; } = new RawMaterialDeviceStatus();



public ModbusTcp modbusTcp = new ModbusTcp();

public bool IsConnected => modbusTcp.Connected;
@@ -311,15 +316,12 @@ namespace BPASmartClient.DosingSystem
deviceStatus.DeviceNum = (ushort)this.modbusTcp.ReadShort(DeviceAddress.DeviceNum);//获取设备编号
deviceStatus.DeviceAlarmCode = (ushort)this.modbusTcp.ReadShort(DeviceAddress.DeviceAlarmCode);//获取设备故障编码

AlarmHelper<AlarmInfo>.Alarm.EStop1 = deviceStatus.DeviceAlarmCode.Get16bitValue(1);
AlarmHelper<AlarmInfo>.Alarm.Servo = deviceStatus.DeviceAlarmCode.Get16bitValue(2);
AlarmHelper<AlarmInfo>.Alarm.Inverter = deviceStatus.DeviceAlarmCode.Get16bitValue(3);
AlarmHelper<AlarmInfo>.Alarm.EStop2 = deviceStatus.DeviceAlarmCode.Get16bitValue(7);
AlarmHelper<AlarmInfo>.Alarm.SiloUpperLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(8);
AlarmHelper<AlarmInfo>.Alarm.SiloLowerLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(9);

AlarmHelper<AlarmInfo>("dd").Alarm.SiloLowerLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(9);

AlarmHelper<AlarmInfo>.GetInstance(DeviceName).EStop1 = deviceStatus.DeviceAlarmCode.GetBitValue(1);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).Servo = deviceStatus.DeviceAlarmCode.GetBitValue(2);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).Inverter = deviceStatus.DeviceAlarmCode.GetBitValue(3);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).EStop2 = deviceStatus.DeviceAlarmCode.GetBitValue(7);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).SiloUpperLimit = deviceStatus.DeviceAlarmCode.GetBitValue(8);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).SiloLowerLimit = deviceStatus.DeviceAlarmCode.GetBitValue(9);
Thread.Sleep(100);
}), $"{DeviceName} 开始监听", true);
}


+ 0
- 15
DosingSystem/Model/DevicePar.cs 查看文件

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

namespace BPASmartClient.DosingSystem
{
public class DevicePar
{
public ObservableCollection<DeviceParModel> deviceParModels { get; set; } = new ObservableCollection<DeviceParModel>();
}
}

+ 44
- 0
DosingSystem/Model/par/DevicePar.cs 查看文件

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

namespace BPASmartClient.DosingSystem
{
public class DevicePar
{
/// <summary>
/// 配料设备参数
/// </summary>
public ObservableCollection<DeviceParModel> deviceParModels { get; set; } = new ObservableCollection<DeviceParModel>();

/// <summary>
/// 设备扫描网段
/// </summary>
public string Address { get; set; } = string.Empty;

/// <summary>
/// 设备端口号
/// </summary>
public int Port { get; set; } = 502;

/// <summary>
/// 升降气缸数量
/// </summary>
public int LiftCylinderCount { get; set; }

/// <summary>
/// 阻挡气缸数量
/// </summary>
public int BlockCylinderCount { get; set; }

/// <summary>
/// 托盘气缸数量
/// </summary>
public int PalletCylinderCount { get; set; }

}
}

DosingSystem/Model/DeviceParModel.cs → DosingSystem/Model/par/DeviceParModel.cs 查看文件


DosingSystem/Model/LocaPar.cs → DosingSystem/Model/par/LocaPar.cs 查看文件


+ 45
- 0
DosingSystem/View/CommParSetView.xaml 查看文件

@@ -0,0 +1,45 @@
<UserControl
x:Class="BPASmartClient.DosingSystem.View.CommParSetView"
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.DosingSystem.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">

<UserControl.DataContext>
<vm:CommparSetViewModel />
</UserControl.DataContext>

<Grid>
<StackPanel
Margin="0,10,0,0"
VerticalAlignment="Top"
Orientation="Horizontal">
<TextBlock
Margin="10,0,0,0"
HorizontalAlignment="Left"
Style="{StaticResource TextBlockStyle}"
Text="设备网段地址设置:" />
<TextBox
Width="180"
Height="35"
Margin="0,0,0,0"
FontSize="20"
Style="{StaticResource TextBoxStyle}"
Text="{Binding Address}" />
<Button
Width="90"
Height="30"
Margin="5,0,5,0"
Command="{Binding SaveCommand}"
Content="保存参数"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />

</StackPanel>
</Grid>
</UserControl>

+ 28
- 0
DosingSystem/View/CommParSetView.xaml.cs 查看文件

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

+ 1
- 2
DosingSystem/ViewModel/ChangeDeviceNameViewModel.cs 查看文件

@@ -3,8 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BPASmartClient.Helper;

using BPA.Helper;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using BPASmartClient.CustomResource.Pages.Model;


+ 48
- 0
DosingSystem/ViewModel/CommparSetViewModel.cs 查看文件

@@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BPA.Helper;
using BPASmartClient.CustomResource.UserControls;
using BPASmartClient.CustomResource.UserControls.MessageShow;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;

namespace BPASmartClient.DosingSystem.ViewModel
{
public class CommparSetViewModel : ObservableObject
{
public CommparSetViewModel()
{
SaveCommand = new RelayCommand(() =>
{
if (!string.IsNullOrEmpty(Address))
{
var res = Address.Split(".");
if (res != null)
{
StringBuilder sb = new StringBuilder();
if (res.Length >= 3)
{
for (int i = 0; i < 3; i++)
{
sb.Append($"{res[i]}.");
}
Json<DevicePar>.Data.Address = sb.ToString();
Json<DevicePar>.Save();
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"参数保存成功!");
}
}
}
});
Address = Json<DevicePar>.Data.Address;
}

public string Address { get { return _mAddress; } set { _mAddress = value; OnPropertyChanged(); } }
private string _mAddress;

public RelayCommand SaveCommand { get; set; }

}
}

+ 1
- 1
DosingSystem/ViewModel/DeviceListViewModel.cs 查看文件

@@ -7,7 +7,7 @@ using Microsoft.Toolkit.Mvvm.ComponentModel;
using System.Collections.Concurrent;
using System.Collections.ObjectModel;
using System.Windows;
using BPASmartClient.Helper;
using BPA.Helper;
using Microsoft.Toolkit.Mvvm.Input;
using BPASmartClient.DosingSystem.View;



+ 1
- 2
DosingSystem/ViewModel/DeviceMaterialParViewModel.cs 查看文件

@@ -5,8 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System.Collections.ObjectModel;

using BPASmartClient.Helper;
using BPA.Helper;
using Microsoft.Toolkit.Mvvm.Input;
using BPASmartClient.CustomResource.UserControls.MessageShow;
using BPASmartClient.CustomResource.UserControls;


+ 1
- 1
DosingSystem/ViewModel/HardwareStatusViewModel.cs 查看文件

@@ -7,7 +7,7 @@ using Microsoft.Toolkit.Mvvm.ComponentModel;
using System.Collections.Concurrent;
using System.Collections.ObjectModel;
using System.Windows;
using BPASmartClient.Helper;
using BPA.Helper;
using Microsoft.Toolkit.Mvvm.Input;




+ 6
- 2
DosingSystem/ViewModel/ManualControlViewModel.cs 查看文件

@@ -6,6 +6,7 @@ using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System.Collections.ObjectModel;
using Microsoft.Toolkit.Mvvm.Input;
using BPA.Helper;

namespace BPASmartClient.DosingSystem.ViewModel
{
@@ -13,7 +14,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
{
public ManualControlViewModel()
{
for (int i = 0; i < 15; i++)
for (int i = 0; i < Json<DevicePar>.Data.LiftCylinderCount; i++)
{
cylinderModels.Add(new CylinderModel()
{
@@ -21,7 +22,10 @@ namespace BPASmartClient.DosingSystem.ViewModel
LeftTog = false,
RightTog = false,
});
}

for (int i = 0; i < Json<DevicePar>.Data.BlockCylinderCount; i++)
{
BlockCylinders.Add(new CylinderModel()
{
Name = $"阻挡气缸 {i + 1}",
@@ -30,7 +34,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
});
}

for (int i = 0; i < 4; i++)
for (int i = 0; i < Json<DevicePar>.Data.PalletCylinderCount; i++)
{
PalletCylinders.Add(new CylinderModel()
{


+ 3
- 4
DosingSystem/ViewModel/NewMaterialViewModel.cs 查看文件

@@ -1,6 +1,5 @@
using BPASmartClient.CustomResource.Pages.Model;

using BPASmartClient.Helper;
using BPA.Helper;
using BPASmartClient.Model;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
@@ -37,7 +36,7 @@ public class NewMaterialViewModel : ViewModelBase
var res = Materials.FirstOrDefault(p => p.RawMaterialId == id);
Materials.Remove(res);
Json<LocaMaterial>.Save();
MessageLog.GetInstance.ShowUserLog($"删除原料--{res.RawMaterialName}");
MessageNotify.GetInstance.ShowUserLog($"删除原料--{res.RawMaterialName}");
}
}

@@ -52,7 +51,7 @@ public class NewMaterialViewModel : ViewModelBase
if (Json<LocaMaterial>.Data.LocalMaterails.FirstOrDefault(p => p.RawMaterialName == MaterialName) != null) { ErrorInfo = "本地原料名称重复"; return; }
Json<LocaMaterial>.Data.LocalMaterails.Add(new RawMaterialModel { RawMaterialName = MaterialName, RawMaterialId = Guid.NewGuid().ToString(), RawMaterialSource = 0 });
Json<LocaMaterial>.Save();
MessageLog.GetInstance.ShowUserLog($"添加原料--{MaterialName}");
MessageNotify.GetInstance.ShowUserLog($"添加原料--{MaterialName}");
});
}
}

+ 1
- 1
DosingSystem/ViewModel/NewRecipeViewModel.cs 查看文件

@@ -6,7 +6,7 @@ using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System.Collections.ObjectModel;
using Microsoft.Toolkit.Mvvm.Input;
using BPASmartClient.Helper;
using BPA.Helper;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.Model;
using BPASmartClient.CustomResource.UserControls.MessageShow;


+ 4
- 5
DosingSystem/ViewModel/RecipeControlViewModel.cs 查看文件

@@ -7,9 +7,8 @@ using Microsoft.Toolkit.Mvvm.ComponentModel;
using System.Collections.Concurrent;
using System.Collections.ObjectModel;
using System.Windows;
using BPASmartClient.Helper;
using BPA.Helper;
using Microsoft.Toolkit.Mvvm.Input;

using System.Threading;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.CustomResource.UserControls.MessageShow;
@@ -34,7 +33,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
{
Recipes.ElementAt(index).IsEnable = false;
}
MessageLog.GetInstance.ShowUserLog($"下发工单 {Recipes.ElementAt(index).RecipeName}");
MessageNotify.GetInstance.ShowUserLog($"下发工单 {Recipes.ElementAt(index).RecipeName}");
devices.Enqueue(deviceName);
var res = Recipes.FirstOrDefault(p => p.RecipeName == deviceName);
UserTreeWait.Add(new RecipeModel { RecipeName = deviceName, RawMaterials = res.RawMaterials });
@@ -42,7 +41,7 @@ namespace BPASmartClient.DosingSystem.ViewModel


NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方下发成功!");
MessageLog.GetInstance.ShowUserLog($"下发工单 {Guid.NewGuid().ToString()}");
MessageNotify.GetInstance.ShowUserLog($"下发工单 {Guid.NewGuid().ToString()}");
});

ChangeRecipeStateCommand = new RelayCommand<object>(ChangeRecipeState);
@@ -129,7 +128,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
for (int n = 0; n < recipeProcesses.Count; n++)
{
DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(recipIndex).RawMaterials.ElementAt(n).DeviceIp).StatusReset();//完成配料的设备运行状态地址写0
MessageLog.GetInstance.ShowRunLog(Recipes.ElementAt(recipIndex).RawMaterials.ElementAt(n).DeviceIp);
MessageNotify.GetInstance.ShowRunLog(Recipes.ElementAt(recipIndex).RawMaterials.ElementAt(n).DeviceIp);
}
App.Current.Dispatcher.Invoke(new Action(() => { recipeProcesses.Clear(); }));
Recipes.ElementAt(recipIndex).IsEnable = true;


+ 5
- 5
DosingSystem/ViewModel/RecipeSettingsViewModel.cs 查看文件

@@ -7,7 +7,7 @@ using Microsoft.Toolkit.Mvvm.ComponentModel;
using System.Collections.Concurrent;
using System.Collections.ObjectModel;
using System.Windows;
using BPASmartClient.Helper;
using BPA.Helper;
using Microsoft.Toolkit.Mvvm.Input;
using BPASmartClient.DosingSystem.View;
using BPASmartClient.CustomResource.UserControls;
@@ -35,25 +35,25 @@ namespace BPASmartClient.DosingSystem.ViewModel
{
NewRecipeView nrv = new NewRecipeView();
nrv.ShowDialog();
MessageLog.GetInstance.ShowUserLog("新建配方");
MessageNotify.GetInstance.ShowUserLog("新建配方");
});
SaveRecipe = new RelayCommand(() =>
{
Json<LocaPar>.Save();
MessageLog.GetInstance.ShowUserLog("保存配方");
MessageNotify.GetInstance.ShowUserLog("保存配方");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方保存成功!");
});
RemoveCommand = new RelayCommand<object>((o) =>
{
if (!string.IsNullOrEmpty(o?.ToString()))
{
if (MessageLog.GetInstance.ShowDialog($"是否删除【{o.ToString()}】配方,删除后数据将永久丢失!无法找回", DialogType.Warning))
if (MessageNotify.GetInstance.ShowDialog($"是否删除【{o.ToString()}】配方,删除后数据将永久丢失!无法找回", DialogType.Warning))
{
var res = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipeName == o.ToString());
if (res != null) Json<LocaPar>.Data.Recipes.Remove(res);
Json<LocaPar>.Save();
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方删除成功!");
MessageLog.GetInstance.ShowUserLog($"删除配方 {res.RecipeName}");
MessageNotify.GetInstance.ShowUserLog($"删除配方 {res.RecipeName}");
}
}
});


+ 2
- 2
FryPot_DosingSystem/App.xaml.cs 查看文件

@@ -38,7 +38,7 @@ namespace FryPot_DosingSystem
if (res != null && res == true)
{
mv.Show();
MessageLog.GetInstance.ShowUserLog("用户登录");
MessageNotify.GetInstance.ShowUserLog("用户登录");
await Task.Run(()=> { DeviceOperate deviceOperate = DeviceOperate.GetInstance; });//开启实时PLC数据读取
DosingLogicControl logigControl = DosingLogicControl.GetInstance;//开启逻辑控制任务程序
HubHelper.GetInstance.Connect("192.168.1.20", 8089);
@@ -67,7 +67,7 @@ namespace FryPot_DosingSystem
{
base.OnExit(e);
Json<RecipeManage>.Save();
MessageLog.GetInstance.LogSave();
MessageNotify.GetInstance.LogSave();
}
private void MenuInite()
{


+ 15
- 15
FryPot_DosingSystem/Control/DeviceOperate.cs 查看文件

@@ -130,19 +130,19 @@ namespace FryPot_DosingSystem.Control
}
}
IsConfig = true;
MessageLog.GetInstance.ShowRunLog("PLC变量配置加载成功");
MessageNotify.GetInstance.ShowRunLog("PLC变量配置加载成功");
}
catch (Exception)
{
IsConfig = false;
MessageLog.GetInstance.ShowRunLog("PLC变量配置加载错误,请重新配置并重启软件");
MessageNotify.GetInstance.ShowRunLog("PLC变量配置加载错误,请重新配置并重启软件");
//throw;
}
}
else
{
IsConfig = false;
MessageLog.GetInstance.ShowRunLog("PLC变量配置加载失败:文件无数据,请重新配置并重启软件");
MessageNotify.GetInstance.ShowRunLog("PLC变量配置加载失败:文件无数据,请重新配置并重启软件");
}
//Variables.Add(new PlcVariableModel() { Address = "D2001", Length = 8 });//1号线体滚筒工位号
//Variables.Add(new PlcVariableModel() { Address = "D2011", Length = 8 });//2号线体滚筒工位号
@@ -180,12 +180,12 @@ namespace FryPot_DosingSystem.Control
string DeviceName = devices.Devices[i].DeviceName;
switch (DeviceName)
{
case "滚筒输送线": modbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageLog.GetInstance.ShowRunLog("滚筒线PLC连接成功"); break;
case "炒锅1": fryOneModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageLog.GetInstance.ShowRunLog("1号炒锅PLC连接成功"); break;
case "炒锅2": fryTwoModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageLog.GetInstance.ShowRunLog("2号炒锅PLC连接成功"); break;
case "炒锅3": fryThreeModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageLog.GetInstance.ShowRunLog("3号炒锅PLC连接成功"); break;
case "炒锅4": fryFourModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageLog.GetInstance.ShowRunLog("4号炒锅PLC连接成功"); break;
case "炒锅5": fryFiveModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageLog.GetInstance.ShowRunLog("5号炒锅PLC连接成功"); break;
case "滚筒输送线": modbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageNotify.GetInstance.ShowRunLog("滚筒线PLC连接成功"); break;
case "炒锅1": fryOneModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageNotify.GetInstance.ShowRunLog("1号炒锅PLC连接成功"); break;
case "炒锅2": fryTwoModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageNotify.GetInstance.ShowRunLog("2号炒锅PLC连接成功"); break;
case "炒锅3": fryThreeModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageNotify.GetInstance.ShowRunLog("3号炒锅PLC连接成功"); break;
case "炒锅4": fryFourModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageNotify.GetInstance.ShowRunLog("4号炒锅PLC连接成功"); break;
case "炒锅5": fryFiveModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageNotify.GetInstance.ShowRunLog("5号炒锅PLC连接成功"); break;
}

}
@@ -225,7 +225,7 @@ namespace FryPot_DosingSystem.Control
DeviceManage devices = Json<DeviceManage>.Data;
var res = devices.Devices.FirstOrDefault(p => p.DeviceName == "滚筒输送线");
if (res != null)
modbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageLog.GetInstance.ShowRunLog("滚筒线PLC重连成功");
modbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageNotify.GetInstance.ShowRunLog("滚筒线PLC重连成功");
}
Thread.Sleep(10);
}), $"滚筒线实时数据读取线程");
@@ -259,7 +259,7 @@ namespace FryPot_DosingSystem.Control
DeviceManage devices = Json<DeviceManage>.Data;
var res = devices.Devices.FirstOrDefault(p => p.DeviceName == "炒锅1");
if (res != null)
modbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageLog.GetInstance.ShowRunLog("1号炒锅PLC重连成功");
modbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageNotify.GetInstance.ShowRunLog("1号炒锅PLC重连成功");
}
Thread.Sleep(10);
}), $"炒锅1实时数据读取线程");
@@ -289,7 +289,7 @@ namespace FryPot_DosingSystem.Control
DeviceManage devices = Json<DeviceManage>.Data;
var res = devices.Devices.FirstOrDefault(p => p.DeviceName == "炒锅2");
if (res != null)
modbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageLog.GetInstance.ShowRunLog("2号炒锅PLC重连成功");
modbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageNotify.GetInstance.ShowRunLog("2号炒锅PLC重连成功");
}
Thread.Sleep(10);
}), $"炒锅2实时数据读取线程");
@@ -319,7 +319,7 @@ namespace FryPot_DosingSystem.Control
DeviceManage devices = Json<DeviceManage>.Data;
var res = devices.Devices.FirstOrDefault(p => p.DeviceName == "炒锅3");
if (res != null)
modbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageLog.GetInstance.ShowRunLog("3号炒锅PLC重连成功");
modbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageNotify.GetInstance.ShowRunLog("3号炒锅PLC重连成功");
}
Thread.Sleep(10);
}), $"炒锅3实时数据读取线程");
@@ -349,7 +349,7 @@ namespace FryPot_DosingSystem.Control
DeviceManage devices = Json<DeviceManage>.Data;
var res = devices.Devices.FirstOrDefault(p => p.DeviceName == "炒锅4");
if (res != null)
modbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageLog.GetInstance.ShowRunLog("4号炒锅PLC重连成功");
modbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageNotify.GetInstance.ShowRunLog("4号炒锅PLC重连成功");
}
Thread.Sleep(10);
}), $"炒锅4实时数据读取线程");
@@ -379,7 +379,7 @@ namespace FryPot_DosingSystem.Control
DeviceManage devices = Json<DeviceManage>.Data;
var res = devices.Devices.FirstOrDefault(p => p.DeviceName == "炒锅5");
if (res != null)
modbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageLog.GetInstance.ShowRunLog("5号炒锅PLC重连成功");
modbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageNotify.GetInstance.ShowRunLog("5号炒锅PLC重连成功");
}
Thread.Sleep(10);
}), $"炒锅5实时数据读取线程");


+ 243
- 243
FryPot_DosingSystem/Control/DosingLogicControl.cs
文件差異過大導致無法顯示
查看文件


+ 9
- 9
FryPot_DosingSystem/ViewModel/NewRecipeViewModel.cs 查看文件

@@ -107,7 +107,7 @@ namespace FryPot_DosingSystem.ViewModel
{
if (materials.ElementAt(i).MaterialLoc / 100 != lineNum|| materials.ElementAt(i).MaterialLoc % 100!=i+1||lineNum<=0||lineNum>5)
{
MessageLog.GetInstance.ShowUserLog($"新建配方【{RecipeName}】无效:【配方中原料桶号异常】");
MessageNotify.GetInstance.ShowUserLog($"新建配方【{RecipeName}】无效:【配方中原料桶号异常】");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"新建配方【{RecipeName}】无效");
ActionManage.GetInstance.Send("CloseNewRecipeView");
return;
@@ -124,12 +124,12 @@ namespace FryPot_DosingSystem.ViewModel
{
goto prop;
}
MessageLog.GetInstance.ShowUserLog($"配方【{RecipeName}】新建成功");
MessageNotify.GetInstance.ShowUserLog($"配方【{RecipeName}】新建成功");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"新建配方【{RecipeName}】成功");
}
else
{
MessageLog.GetInstance.ShowUserLog($"新建配方【{RecipeName}】无效:【配方中原料桶数异常】");
MessageNotify.GetInstance.ShowUserLog($"新建配方【{RecipeName}】无效:【配方中原料桶数异常】");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"新建配方【{RecipeName}】无效");
}
ActionManage.GetInstance.Send("CloseNewRecipeView");
@@ -150,7 +150,7 @@ namespace FryPot_DosingSystem.ViewModel
{
if (materials.ElementAt(i).MaterialLoc / 100 != lineNum && materials.ElementAt(i).MaterialLoc % 100 != i + 1 || lineNum <= 0 || lineNum > 5)
{
MessageLog.GetInstance.ShowUserLog($"另存配方【{RecipeName}】无效:【配方中原料桶号异常】");
MessageNotify.GetInstance.ShowUserLog($"另存配方【{RecipeName}】无效:【配方中原料桶号异常】");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"另存配方【{RecipeName}】无效");
ActionManage.GetInstance.Send("CloseNewRecipeView");
return;
@@ -160,12 +160,12 @@ namespace FryPot_DosingSystem.ViewModel
bom.RecipeName = RecipeName;
bom.UpdateTime = DateTime.Now.ToShortDateString();
Json<RecipeManage>.Save();
MessageLog.GetInstance.ShowUserLog($"配方【{RecipeName}】修改成功");
MessageNotify.GetInstance.ShowUserLog($"配方【{RecipeName}】修改成功");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"修改配方【{RecipeName}】成功");
}
else
{
MessageLog.GetInstance.ShowUserLog($"修改配方【{RecipeName}】无效:【配方中原料桶数异常】");
MessageNotify.GetInstance.ShowUserLog($"修改配方【{RecipeName}】无效:【配方中原料桶数异常】");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"修改配方【{RecipeName}】无效");
}
ActionManage.GetInstance.Send("CloseNewRecipeView");
@@ -186,7 +186,7 @@ namespace FryPot_DosingSystem.ViewModel
{
if (materials.ElementAt(i).MaterialLoc / 100 != lineNum && materials.ElementAt(i).MaterialLoc % 100 != i + 1 || lineNum <= 0 || lineNum > 5)
{
MessageLog.GetInstance.ShowUserLog($"另存配方【{RecipeName}】无效:【配方中原料桶号异常】");
MessageNotify.GetInstance.ShowUserLog($"另存配方【{RecipeName}】无效:【配方中原料桶号异常】");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"另存配方【{RecipeName}】无效");
ActionManage.GetInstance.Send("CloseNewRecipeView");
return;
@@ -203,12 +203,12 @@ namespace FryPot_DosingSystem.ViewModel
{
goto prop;
}
MessageLog.GetInstance.ShowUserLog("另存配方成功");
MessageNotify.GetInstance.ShowUserLog("另存配方成功");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"另存配方【{RecipeName}】成功");
}
else
{
MessageLog.GetInstance.ShowUserLog($"另存配方【{rec.RecipeName}】无效:【配方中原料桶数异常】");
MessageNotify.GetInstance.ShowUserLog($"另存配方【{rec.RecipeName}】无效:【配方中原料桶数异常】");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"另存配方【{rec.RecipeName}】无效");
}
ActionManage.GetInstance.Send("CloseNewRecipeView");


+ 18
- 0
WPFDemo/Class2.cs 查看文件

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BPASmartClient.CustomResource.Pages.Model;

namespace WPFDemo
{
public class Class2
{
[Alarm("测试报警1")]
public bool TT { get; set; }

[Alarm("测试报警2")]
public bool CC { get; set; }
}
}

+ 35
- 21
WPFDemo/TheListBox.xaml 查看文件

@@ -1,29 +1,43 @@
<UserControl x:Class="WPFDemo.TheListBox"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:WPFDemo"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<ListView x:Name="listView"
ItemsSource="{Binding ViewItems,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
Background="{x:Null}" Foreground="White"
PreviewMouseMove="ListView_PreviewMouseMove"
PreviewMouseLeftButtonUp="lisbox_PreviewMouseLeftButtonUp">
<UserControl
x:Class="WPFDemo.TheListBox"
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:WPFDemo"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<ListView
x:Name="listView"
Background="{x:Null}"
Foreground="White"
ItemsSource="{Binding ViewItems, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
PreviewMouseLeftButtonUp="lisbox_PreviewMouseLeftButtonUp"
PreviewMouseMove="ListView_PreviewMouseMove">
<ListBox.ItemTemplate>
<ItemContainerTemplate>
<Border x:Name="border" Tag="border" BorderBrush="Aquamarine" MouseLeftButtonDown="Border_MouseLeftButtonDown" BorderThickness="1" Padding="5" Background="#FF18888A">
<Border
x:Name="border"
Padding="5"
Background="#FF18888A"
BorderBrush="Aquamarine"
BorderThickness="1"
MouseLeftButtonDown="Border_MouseLeftButtonDown"
Tag="border">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="60"/>
<ColumnDefinition/>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="60"/>
<ColumnDefinition Width="60" />
<ColumnDefinition />
<ColumnDefinition Width="100" />
<ColumnDefinition Width="60" />
</Grid.ColumnDefinitions>
<TextBlock Margin="10,0,10,0" Grid.Column="0" Text="{Binding Name,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Grid.Column="1" Text="{Binding Ph,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBox Width="100" Grid.Column="1"></TextBox>
<TextBlock
Grid.Column="0"
Margin="10,0,10,0"
Text="{Binding Name, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Grid.Column="1" Text="{Binding Ph, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" />
<TextBox Grid.Column="1" Width="100" />
<ComboBox Grid.Column="2" Width="60">
<ComboBoxItem>sdsds</ComboBoxItem>
<ComboBoxItem>sdsds</ComboBoxItem>


+ 2
- 1
WPFDemo/Window2.xaml 查看文件

@@ -10,7 +10,8 @@
<Canvas.Background>
<ImageBrush ImageSource="/bj.png"/>
</Canvas.Background>
<local:TheListBox Canvas.Left="180" Canvas.Top="100" HorizontalAlignment="Right" Grid.Row="1"></local:TheListBox>
<Button Width="100" Height="30" Click="Button_Click"/>
</Canvas>
</Window>

+ 15
- 0
WPFDemo/Window2.xaml.cs 查看文件

@@ -15,6 +15,7 @@ using System.Windows.Media;
using System.Windows.Media.Effects;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using BPASmartClient.CustomResource.Pages.Model;

namespace WPFDemo
{
@@ -26,6 +27,20 @@ namespace WPFDemo
public Window2()
{
InitializeComponent();
AlarmHelper<Class2>.Init();
AlarmHelper<Class2>.GetInstance("设备1").TT = true;
AlarmHelper<Class2>.GetInstance("设备1").CC = true;
AlarmHelper<Class2>.GetInstance("设备2").TT = true;
AlarmHelper<Class2>.GetInstance("设备2").CC = true;

//AlarmHelper<Class2>.GetInstance().TT = true;
//AlarmHelper<Class2>.GetInstance().CC = true;

}

private void Button_Click(object sender, RoutedEventArgs e)
{
var res = AlarmHelper<Class2>.Alarms;
}
}
}

Loading…
取消
儲存