diff --git a/BPASmartClient.CustomResource/Converters/ForegroundConverter.cs b/BPASmartClient.CustomResource/Converters/ForegroundConverter.cs new file mode 100644 index 00000000..0297db72 --- /dev/null +++ b/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(); + } + } +} diff --git a/BPASmartClient.CustomResource/Converters/StatusIconConverter.cs b/BPASmartClient.CustomResource/Converters/StatusIconConverter.cs new file mode 100644 index 00000000..9961f850 --- /dev/null +++ b/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(); + } + + /// + /// 字符串转为UniCode码字符串 + /// + public static string StringToUnicode(string s) + { + if (!string.IsNullOrEmpty(s)) + { + //这里把格式 转为 \ue625 + return s.Replace(@"&#x", @"\u").Replace(";", ""); + } + return s; + } + } +} diff --git a/BPASmartClient.CustomResource/Pages/Enums/Status.cs b/BPASmartClient.CustomResource/Pages/Enums/Status.cs new file mode 100644 index 00000000..c8b8b437 --- /dev/null +++ b/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 + { + 等待配料, + 正在配料, + 配料完成 + } +} diff --git a/BPASmartClient.CustomResource/Pages/Model/MessageLog.cs b/BPASmartClient.CustomResource/Pages/Model/MessageNotify.cs similarity index 95% rename from BPASmartClient.CustomResource/Pages/Model/MessageLog.cs rename to BPASmartClient.CustomResource/Pages/Model/MessageNotify.cs index cd9263f6..e1325b1a 100644 --- a/BPASmartClient.CustomResource/Pages/Model/MessageLog.cs +++ b/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 UserLog { get; set; } diff --git a/BPASmartClient.CustomResource/Pages/ViewModel/NfcSetViewModel.cs b/BPASmartClient.CustomResource/Pages/ViewModel/NfcSetViewModel.cs index 98808520..b1c059d1 100644 --- a/BPASmartClient.CustomResource/Pages/ViewModel/NfcSetViewModel.cs +++ b/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"); } diff --git a/BPASmartClient.CustomResource/Pages/ViewModel/RunLogViewModel.cs b/BPASmartClient.CustomResource/Pages/ViewModel/RunLogViewModel.cs index fafff930..b8ac842a 100644 --- a/BPASmartClient.CustomResource/Pages/ViewModel/RunLogViewModel.cs +++ b/BPASmartClient.CustomResource/Pages/ViewModel/RunLogViewModel.cs @@ -121,6 +121,6 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel public ObservableCollection HistoryRunLog { get; set; } = new ObservableCollection(); - public ObservableCollection Log { get; set; } = MessageLog.GetInstance.runLogs; + public ObservableCollection Log { get; set; } = MessageNotify.GetInstance.runLogs; } } diff --git a/BPASmartClient.CustomResource/Pages/ViewModel/UserLogViewModel.cs b/BPASmartClient.CustomResource/Pages/ViewModel/UserLogViewModel.cs index 227c127f..233491d9 100644 --- a/BPASmartClient.CustomResource/Pages/ViewModel/UserLogViewModel.cs +++ b/BPASmartClient.CustomResource/Pages/ViewModel/UserLogViewModel.cs @@ -17,7 +17,7 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel public UserLogViewModel() { Sqlite.GetInstance.Save(); - UserLogs = MessageLog.GetInstance.userLogs; + UserLogs = MessageNotify.GetInstance.userLogs; SwitchCommand = new RelayCommand(() => { if (ButContent == "历史日志") diff --git a/BPASmartClient.CustomResource/RecDictionarys/GlobalStyle.xaml b/BPASmartClient.CustomResource/RecDictionarys/GlobalStyle.xaml index 8b6a4b0d..325c7d39 100644 --- a/BPASmartClient.CustomResource/RecDictionarys/GlobalStyle.xaml +++ b/BPASmartClient.CustomResource/RecDictionarys/GlobalStyle.xaml @@ -15,4 +15,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/BPASmartClient.DosingProject/App.xaml.cs b/BPASmartClient.DosingProject/App.xaml.cs index c3fd67e9..a2a10e74 100644 --- a/BPASmartClient.DosingProject/App.xaml.cs +++ b/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.Save(); - MessageLog.GetInstance.LogSave(); + MessageNotify.GetInstance.LogSave(); ThreadManage.GetInstance().Dispose(); } diff --git a/BPASmartClient.DosingProject/Model/ProcessControl.cs b/BPASmartClient.DosingProject/Model/ProcessControl.cs index 125670fa..a094bbb5 100644 --- a/BPASmartClient.DosingProject/Model/ProcessControl.cs +++ b/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("DB2.DBX3.0", false); HKDevice.HK_PLC_S7.Write("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("DB3.DBX50.1"))) { var res = HKDevice.HK_PLC_S7.Read("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("DB3.DBX50.2"))) { var res = HKDevice.HK_PLC_S7.Read("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("DB3.DBX50.3"))) { var res = HKDevice.HK_PLC_S7.Read("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("DB3.DBX1.1")) && (GVL_SmallStation.GetInstance.WindSendDosingFinish || !GVL_SmallStation.GetInstance.IsUseWindSend)) { var res = Json.Data.Recipes.FirstOrDefault(p => p.RecipeCode == code); - MessageLog.GetInstance.ShowRunLog($"托盘1,配方{res.RecipeName},配料完成"); + MessageNotify.GetInstance.ShowRunLog($"托盘1,配方{res.RecipeName},配料完成"); App.Current.Dispatcher.Invoke(() => { Json.Data.Recipes.Remove(res); diff --git a/BPASmartClient.DosingProject/Model/RawMaterial/DeviceInquire.cs b/BPASmartClient.DosingProject/Model/RawMaterial/DeviceInquire.cs index c4ff9f55..4f4b33ef 100644 --- a/BPASmartClient.DosingProject/Model/RawMaterial/DeviceInquire.cs +++ b/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.Alarm.EStop1 = deviceStatus.DeviceAlarmCode.Get16bitValue(1); - AlarmHelper.Alarm.Servo = deviceStatus.DeviceAlarmCode.Get16bitValue(2); - AlarmHelper.Alarm.Inverter = deviceStatus.DeviceAlarmCode.Get16bitValue(3); - AlarmHelper.Alarm.EStop2 = deviceStatus.DeviceAlarmCode.Get16bitValue(7); - AlarmHelper.Alarm.SiloUpperLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(8); - AlarmHelper.Alarm.SiloLowerLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(9); - AlarmHelper.Alarm.EStop1 = true; + AlarmHelper.GetInstance(DeviceName).EStop1 = deviceStatus.DeviceAlarmCode.Get16bitValue(1); + AlarmHelper.GetInstance(DeviceName).Servo = deviceStatus.DeviceAlarmCode.Get16bitValue(2); + AlarmHelper.GetInstance(DeviceName).Inverter = deviceStatus.DeviceAlarmCode.Get16bitValue(3); + AlarmHelper.GetInstance(DeviceName).EStop2 = deviceStatus.DeviceAlarmCode.Get16bitValue(7); + AlarmHelper.GetInstance(DeviceName).SiloUpperLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(8); + AlarmHelper.GetInstance(DeviceName).SiloLowerLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(9); + AlarmHelper.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.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($"参数下发完成"); } } } diff --git a/BPASmartClient.DosingProject/ViewModel/NewMaterialViewModel.cs b/BPASmartClient.DosingProject/ViewModel/NewMaterialViewModel.cs index 3f2d4df8..226e3360 100644 --- a/BPASmartClient.DosingProject/ViewModel/NewMaterialViewModel.cs +++ b/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.Save(); - MessageLog.GetInstance.ShowUserLog($"删除原料--{res.RawMaterialName}"); + MessageNotify.GetInstance.ShowUserLog($"删除原料--{res.RawMaterialName}"); } } @@ -52,7 +52,7 @@ public class NewMaterialViewModel:ObservableObject if(Json.Data.LocalMaterails.FirstOrDefault(p=>p.RawMaterialName == MaterialName) != null) { ErrorInfo = "本地原料名称重复";return ;} Json.Data.LocalMaterails.Add(new RawMaterialModel { RawMaterialName = MaterialName, RawMaterialId = Guid.NewGuid().ToString() , RawMaterialSource = 0 }); Json.Save(); - MessageLog.GetInstance.ShowUserLog($"添加原料--{MaterialName}"); + MessageNotify.GetInstance.ShowUserLog($"添加原料--{MaterialName}"); }); } } diff --git a/BPASmartClient.DosingProject/ViewModel/RecipeControlViewModel.cs b/BPASmartClient.DosingProject/ViewModel/RecipeControlViewModel.cs index ba12aa85..9530d1a4 100644 --- a/BPASmartClient.DosingProject/ViewModel/RecipeControlViewModel.cs +++ b/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(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; diff --git a/BPASmartClient.DosingProject/ViewModel/RecipeReceiveViewModel.cs b/BPASmartClient.DosingProject/ViewModel/RecipeReceiveViewModel.cs index 85dd6135..09962cb3 100644 --- a/BPASmartClient.DosingProject/ViewModel/RecipeReceiveViewModel.cs +++ b/BPASmartClient.DosingProject/ViewModel/RecipeReceiveViewModel.cs @@ -43,7 +43,7 @@ namespace BPASmartClient.DosingHKProject.ViewModel if (res != null) { Json.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.Data.Recipes.Add(res); - MessageLog.GetInstance.ShowUserLog($"下发配方——{res.RecipeName}"); + MessageNotify.GetInstance.ShowUserLog($"下发配方——{res.RecipeName}"); } } }); diff --git a/BPASmartClient.DosingProject/ViewModel/RecipeSettingsViewModel.cs b/BPASmartClient.DosingProject/ViewModel/RecipeSettingsViewModel.cs index 7b2eab93..001cb1c0 100644 --- a/BPASmartClient.DosingProject/ViewModel/RecipeSettingsViewModel.cs +++ b/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.Save(); - MessageLog.GetInstance.ShowUserLog("保存配方"); + MessageNotify.GetInstance.ShowUserLog("保存配方"); NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方保存成功!"); }); RemoveCommand = new RelayCommand((o) => @@ -51,7 +51,7 @@ namespace BPASmartClient.DosingHKProject.ViewModel { var res = Json.Data.Recipes.FirstOrDefault(p => p.RecipCode == str); if (res != null) Json.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.Data.Recipes.FirstOrDefault(p => p.RecipCode == str); ActionManage.GetInstance.Send("Details", res); nrv.ShowDialog(); - MessageLog.GetInstance.ShowUserLog($"编辑配方名称——{res.RecipeName}"); + MessageNotify.GetInstance.ShowUserLog($"编辑配方名称——{res.RecipeName}"); } }); diff --git a/BPASmartClient.DosingProject/ViewModel/SiemensRecipeReceiveViewModel.cs b/BPASmartClient.DosingProject/ViewModel/SiemensRecipeReceiveViewModel.cs index 12e19bb5..6b0d4e9b 100644 --- a/BPASmartClient.DosingProject/ViewModel/SiemensRecipeReceiveViewModel.cs +++ b/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}"); } } }); diff --git a/BPASmartClient.JXJFoodBigStation/App.xaml.cs b/BPASmartClient.JXJFoodBigStation/App.xaml.cs index 7d285245..4a2e0aa6 100644 --- a/BPASmartClient.JXJFoodBigStation/App.xaml.cs +++ b/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(); } diff --git a/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKDeviceStatus.cs b/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKDeviceStatus.cs index 2181fb20..858ecd56 100644 --- a/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKDeviceStatus.cs +++ b/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKDeviceStatus.cs @@ -54,7 +54,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC { string address = "MD" + (4120 + (loc - 1) * 4 + (barrel - 1 - 1) * 48); HK_PLC_S7.Write(address, recipe.RawMaterial.ElementAt(index).RawMaterialWeight); - MessageLog.GetInstance.ShowRunLog($"配方数据下发完成,地址:{address},重量:{recipe.RawMaterial.ElementAt(index).RawMaterialWeight}"); + MessageNotify.GetInstance.ShowRunLog($"配方数据下发完成,地址:{address},重量:{recipe.RawMaterial.ElementAt(index).RawMaterialWeight}"); } else//不存在的原料信息,重量写0 { @@ -68,7 +68,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC { string address = "MD" + (4120 + (loc - 1) * 4 + (barrel - 1) * 48); HK_PLC_S7.Write(address, recipe.RawMaterial.ElementAt(index).RawMaterialWeight); - MessageLog.GetInstance.ShowRunLog($"配方数据下发完成,地址:{address},重量:{recipe.RawMaterial.ElementAt(index).RawMaterialWeight}"); + MessageNotify.GetInstance.ShowRunLog($"配方数据下发完成,地址:{address},重量:{recipe.RawMaterial.ElementAt(index).RawMaterialWeight}"); } else//不存在的原料信息,重量写0 { diff --git a/BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs b/BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs index 3b19daa8..6e870721 100644 --- a/BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs +++ b/BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs @@ -108,7 +108,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model if (HKDevice.IsConnected) { HKDevice.Init(); - MessageLog.GetInstance.ShowRunLog("海科plc连接成功"); + MessageNotify.GetInstance.ShowRunLog("海科plc连接成功"); } if (SiemensDevice.IsConnected) { @@ -299,20 +299,20 @@ namespace BPASmartClient.JXJFoodBigStation.Model HKDevice.HK_PLC_S7.Write("M4001.0", true);//配发下发完成,to plc HKDevice.HK_PLC_S7.Write("M5001.0", false);//复位允许下发配方1信号 BigStation.RecipeDosingStatus = 1; - MessageLog.GetInstance.ShowRunLog($"配方状态:{code}下发完成"); + MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}下发完成"); } if (HKDevice.HK_PLC_S7.Read("M5001.4") && BigStation.RecipeDosingStatus == 1) { BigStation.RecipeDosingStatus = 2; HKDevice.HK_PLC_S7.Write("M5001.4", false);// - MessageLog.GetInstance.ShowRunLog($"配方状态:{code}配方配料"); + MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配方配料"); } if (BigStation.RecipeDosingStatus == 2) { if (RTrig.GetInstance("StockState").Start(HKDevice.HK_PLC_S7.Read("M5007.0"))) { BigStation.RecipeDosingStatus = 3; - MessageLog.GetInstance.ShowRunLog($"配方状态:{code}配料完成"); + MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成"); HKDevice.HK_PLC_S7.Write("M5007.0",false); RecipeQueue.TryDequeue(out code); IssuedComplete.Add(RemoteRecipes.ElementAt(index));//将该配方添加到下 diff --git a/BPASmartClient.JXJFoodBigStation/ViewModel/RecipeReceiveViewModel.cs b/BPASmartClient.JXJFoodBigStation/ViewModel/RecipeReceiveViewModel.cs index 05d2d544..bcc8e7e5 100644 --- a/BPASmartClient.JXJFoodBigStation/ViewModel/RecipeReceiveViewModel.cs +++ b/BPASmartClient.JXJFoodBigStation/ViewModel/RecipeReceiveViewModel.cs @@ -37,7 +37,7 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel var res = Json.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(() => { diff --git a/BPASmartClient.JXJFoodSmallStation/App.xaml.cs b/BPASmartClient.JXJFoodSmallStation/App.xaml.cs index b7ad1236..26d8e0dc 100644 --- a/BPASmartClient.JXJFoodSmallStation/App.xaml.cs +++ b/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.Save(); Json.Save(); - MessageLog.GetInstance.LogSave(); + MessageNotify.GetInstance.LogSave(); ThreadManage.GetInstance().Dispose(); } diff --git a/BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/HKDeviceStatus.cs b/BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/HKDeviceStatus.cs index d3304a56..8c2ea0d7 100644 --- a/BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/HKDeviceStatus.cs +++ b/BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/HKDeviceStatus.cs @@ -86,7 +86,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC { HK_PLC_S7.Write("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("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("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("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("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("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("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("DB4.DBX25." + (StockBinLocation - 9), true); } - MessageLog.GetInstance.ShowRunLog($"托盘2—4号桶在料仓{StockBinLocation}配料"); + MessageNotify.GetInstance.ShowRunLog($"托盘2—4号桶在料仓{StockBinLocation}配料"); } } } diff --git a/BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs b/BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs index 56795827..f5b46f84 100644 --- a/BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs +++ b/BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs @@ -80,7 +80,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model } else { - MessageLog.GetInstance.AlarmLog("配方名称与本地不符合"); + MessageNotify.GetInstance.AlarmLog("配方名称与本地不符合"); } } Json.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("DB3.DBX50.0"))) { var res = HKDevice.HK_PLC_S7.Read("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("DB3.DBX50.1"))) { var res = HKDevice.HK_PLC_S7.Read("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("DB3.DBX50.2"))) { var res = HKDevice.HK_PLC_S7.Read("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("DB3.DBX50.3"))) { var res = HKDevice.HK_PLC_S7.Read("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("DB3.DBX1.1")) && (GVL_SmallStation.GetInstance.WindSendDosingFinish || !GVL_SmallStation.GetInstance.IsUseWindSend)) { var res = Json.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("DB3.DBX50.4"))) { var res = HKDevice.HK_PLC_S7.Read("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("DB3.DBX50.5"))) { var res = HKDevice.HK_PLC_S7.Read("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("DB3.DBX50.6"))) { var res = HKDevice.HK_PLC_S7.Read("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("DB3.DBX50.7"))) { var res = HKDevice.HK_PLC_S7.Read("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("DB3.DBX1.2"))) { var res = Json.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(); diff --git a/BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DeviceInquire.cs b/BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DeviceInquire.cs index c11079f6..8b20cc97 100644 --- a/BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DeviceInquire.cs +++ b/BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DeviceInquire.cs @@ -297,12 +297,12 @@ namespace BPASmartClient.JXJFoodSmallStation.Model { modbusTcp.Show += new Action((s) => { - if (s != null) MessageLog.GetInstance.ShowRunLog(s); + if (s != null) MessageNotify.GetInstance.ShowRunLog(s); }); modbusTcp.ShowEx += new Action((s) => { - if (s != null) MessageLog.GetInstance.ShowRunLog(s); + if (s != null) MessageNotify.GetInstance.ShowRunLog(s); }); this.DeviceName = DeviceName; AlarmHelper.Init(); @@ -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.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},参数下发完成"); } } } diff --git a/BPASmartClient.JXJFoodSmallStation/ViewModel/NewMaterialViewModel.cs b/BPASmartClient.JXJFoodSmallStation/ViewModel/NewMaterialViewModel.cs index 83a42878..ff254aba 100644 --- a/BPASmartClient.JXJFoodSmallStation/ViewModel/NewMaterialViewModel.cs +++ b/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.Save(); - MessageLog.GetInstance.ShowUserLog($"删除原料--{res.RawMaterialName}"); + MessageNotify.GetInstance.ShowUserLog($"删除原料--{res.RawMaterialName}"); } } @@ -52,7 +52,7 @@ public class NewMaterialViewModel:ObservableObject if(Json.Data.LocalMaterails.FirstOrDefault(p=>p.RawMaterialName == MaterialName) != null) { ErrorInfo = "本地原料名称重复";return ;} Json.Data.LocalMaterails.Add(new RawMaterialModel { RawMaterialName = MaterialName, RawMaterialId = Guid.NewGuid().ToString() , RawMaterialSource = 0 }); Json.Save(); - MessageLog.GetInstance.ShowUserLog($"添加原料--{MaterialName}"); + MessageNotify.GetInstance.ShowUserLog($"添加原料--{MaterialName}"); }); } } diff --git a/BPASmartClient.JXJFoodSmallStation/ViewModel/RecipeControlViewModel.cs b/BPASmartClient.JXJFoodSmallStation/ViewModel/RecipeControlViewModel.cs index 0f54c8e7..757d9365 100644 --- a/BPASmartClient.JXJFoodSmallStation/ViewModel/RecipeControlViewModel.cs +++ b/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(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; diff --git a/BPASmartClient.JXJFoodSmallStation/ViewModel/RecipeReceiveViewModel.cs b/BPASmartClient.JXJFoodSmallStation/ViewModel/RecipeReceiveViewModel.cs index c8ecb76a..40fbf5ce 100644 --- a/BPASmartClient.JXJFoodSmallStation/ViewModel/RecipeReceiveViewModel.cs +++ b/BPASmartClient.JXJFoodSmallStation/ViewModel/RecipeReceiveViewModel.cs @@ -45,7 +45,7 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel if (res != null) { Json.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}"); } } } diff --git a/BPASmartClient.JXJFoodSmallStation/ViewModel/RecipeSettingsViewModel.cs b/BPASmartClient.JXJFoodSmallStation/ViewModel/RecipeSettingsViewModel.cs index e4fc2fb7..3ca9c517 100644 --- a/BPASmartClient.JXJFoodSmallStation/ViewModel/RecipeSettingsViewModel.cs +++ b/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.Save(); - MessageLog.GetInstance.ShowUserLog("保存配方"); + MessageNotify.GetInstance.ShowUserLog("保存配方"); NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方保存成功!"); }); RemoveCommand = new RelayCommand((o) => @@ -50,7 +50,7 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel { var res = Json.Data.Recipes.FirstOrDefault(p => p.RecipCode == str); if (res != null) Json.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.Data.Recipes.FirstOrDefault(p => p.RecipCode == str); ActionManage.GetInstance.Send("Details", res); nrv.ShowDialog(); - MessageLog.GetInstance.ShowUserLog($"编辑配方名称——{res.RecipeName}"); + MessageNotify.GetInstance.ShowUserLog($"编辑配方名称——{res.RecipeName}"); } }); diff --git a/BPASmartClient.JXJFoodSmallStation/ViewModel/SiemensRecipeReceiveViewModel.cs b/BPASmartClient.JXJFoodSmallStation/ViewModel/SiemensRecipeReceiveViewModel.cs index b549895f..a6b30e26 100644 --- a/BPASmartClient.JXJFoodSmallStation/ViewModel/SiemensRecipeReceiveViewModel.cs +++ b/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}"); } } }); diff --git a/BPASmartClient.SmallBatchingSystem/Services/Control.cs b/BPASmartClient.SmallBatchingSystem/Services/Control.cs index 5c36f832..bd17b38a 100644 --- a/BPASmartClient.SmallBatchingSystem/Services/Control.cs +++ b/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}"); } diff --git a/BPASmartClient.ZhuoDian/App.xaml.cs b/BPASmartClient.ZhuoDian/App.xaml.cs index 33f130f5..a8ba718c 100644 --- a/BPASmartClient.ZhuoDian/App.xaml.cs +++ b/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() diff --git a/DosingSystem/App.xaml.cs b/DosingSystem/App.xaml.cs index 1d35aca8..a21cba4c 100644 --- a/DosingSystem/App.xaml.cs +++ b/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.Save(); Json.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 = "", diff --git a/DosingSystem/BPASmartClient.DosingSystem.csproj b/DosingSystem/BPASmartClient.DosingSystem.csproj index d6aaf8b9..ed43f822 100644 --- a/DosingSystem/BPASmartClient.DosingSystem.csproj +++ b/DosingSystem/BPASmartClient.DosingSystem.csproj @@ -24,7 +24,10 @@ - + + + + diff --git a/DosingSystem/Model/DeviceInquire.cs b/DosingSystem/Model/DeviceInquire.cs index 0be08513..dd9e0144 100644 --- a/DosingSystem/Model/DeviceInquire.cs +++ b/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.Data.Address)) IPSegment = Json.Data.Address; + else Json.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 /// public RawMaterialDeviceStatus deviceStatus { get; set; } = new RawMaterialDeviceStatus(); - - public ModbusTcp modbusTcp = new ModbusTcp(); public bool IsConnected => modbusTcp.Connected; @@ -311,12 +316,12 @@ namespace BPASmartClient.DosingSystem deviceStatus.DeviceNum = (ushort)this.modbusTcp.ReadShort(DeviceAddress.DeviceNum);//获取设备编号 deviceStatus.DeviceAlarmCode = (ushort)this.modbusTcp.ReadShort(DeviceAddress.DeviceAlarmCode);//获取设备故障编码 - AlarmHelper.GetInstance(DeviceName).EStop1 = deviceStatus.DeviceAlarmCode.Get16bitValue(1); - AlarmHelper.GetInstance(DeviceName).Servo = deviceStatus.DeviceAlarmCode.Get16bitValue(2); - AlarmHelper.GetInstance(DeviceName).Inverter = deviceStatus.DeviceAlarmCode.Get16bitValue(3); - AlarmHelper.GetInstance(DeviceName).EStop2 = deviceStatus.DeviceAlarmCode.Get16bitValue(7); - AlarmHelper.GetInstance(DeviceName).SiloUpperLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(8); - AlarmHelper.GetInstance(DeviceName).SiloLowerLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(9); + AlarmHelper.GetInstance(DeviceName).EStop1 = deviceStatus.DeviceAlarmCode.GetBitValue(1); + AlarmHelper.GetInstance(DeviceName).Servo = deviceStatus.DeviceAlarmCode.GetBitValue(2); + AlarmHelper.GetInstance(DeviceName).Inverter = deviceStatus.DeviceAlarmCode.GetBitValue(3); + AlarmHelper.GetInstance(DeviceName).EStop2 = deviceStatus.DeviceAlarmCode.GetBitValue(7); + AlarmHelper.GetInstance(DeviceName).SiloUpperLimit = deviceStatus.DeviceAlarmCode.GetBitValue(8); + AlarmHelper.GetInstance(DeviceName).SiloLowerLimit = deviceStatus.DeviceAlarmCode.GetBitValue(9); Thread.Sleep(100); }), $"{DeviceName} 开始监听", true); } diff --git a/DosingSystem/Model/DevicePar.cs b/DosingSystem/Model/DevicePar.cs deleted file mode 100644 index f59897ad..00000000 --- a/DosingSystem/Model/DevicePar.cs +++ /dev/null @@ -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 deviceParModels { get; set; } = new ObservableCollection(); - } -} diff --git a/DosingSystem/Model/par/DevicePar.cs b/DosingSystem/Model/par/DevicePar.cs new file mode 100644 index 00000000..5597eaf0 --- /dev/null +++ b/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 + { + /// + /// 配料设备参数 + /// + public ObservableCollection deviceParModels { get; set; } = new ObservableCollection(); + + /// + /// 设备扫描网段 + /// + public string Address { get; set; } = string.Empty; + + /// + /// 设备端口号 + /// + public int Port { get; set; } = 502; + + /// + /// 升降气缸数量 + /// + public int LiftCylinderCount { get; set; } + + /// + /// 阻挡气缸数量 + /// + public int BlockCylinderCount { get; set; } + + /// + /// 托盘气缸数量 + /// + public int PalletCylinderCount { get; set; } + + } +} diff --git a/DosingSystem/Model/DeviceParModel.cs b/DosingSystem/Model/par/DeviceParModel.cs similarity index 100% rename from DosingSystem/Model/DeviceParModel.cs rename to DosingSystem/Model/par/DeviceParModel.cs diff --git a/DosingSystem/Model/LocaPar.cs b/DosingSystem/Model/par/LocaPar.cs similarity index 100% rename from DosingSystem/Model/LocaPar.cs rename to DosingSystem/Model/par/LocaPar.cs diff --git a/DosingSystem/View/CommParSetView.xaml b/DosingSystem/View/CommParSetView.xaml new file mode 100644 index 00000000..4aa1eacc --- /dev/null +++ b/DosingSystem/View/CommParSetView.xaml @@ -0,0 +1,45 @@ + + + + + + + + + + +