diff --git a/BPASmartClient.CustomResource/Pages/Model/PlcVariableInfoManage.cs b/BPASmartClient.CustomResource/Pages/Model/PlcVariableInfoManage.cs new file mode 100644 index 00000000..b8c11c6c --- /dev/null +++ b/BPASmartClient.CustomResource/Pages/Model/PlcVariableInfoManage.cs @@ -0,0 +1,15 @@ +using Microsoft.Toolkit.Mvvm.ComponentModel; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPASmartClient.CustomResource.Pages.Model +{ + public class PlcVariableInfoManage:ObservableObject + { + public ObservableCollection VariablesInfo { get; set; } = new ObservableCollection(); + } +} diff --git a/BPASmartClient.CustomResource/Pages/Model/PlcVariableInfoModel.cs b/BPASmartClient.CustomResource/Pages/Model/PlcVariableInfoModel.cs new file mode 100644 index 00000000..fafe30b9 --- /dev/null +++ b/BPASmartClient.CustomResource/Pages/Model/PlcVariableInfoModel.cs @@ -0,0 +1,20 @@ + +using Microsoft.Toolkit.Mvvm.ComponentModel; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPASmartClient.CustomResource.Pages.Model +{ + public class PlcVariableInfoModel : ObservableObject + { + //public int Id { get { return _id; } set { _id = value;OnPropertyChanged(); } } + //private int _id; + public string PlcAddress { get { return plcAddress; } set { plcAddress = value; OnPropertyChanged(); } } + private string plcAddress; + public int? Length { get { return length; } set { length = value; OnPropertyChanged(); } } + private int? length; + } +} diff --git a/BPASmartClient.CustomResource/Pages/View/VariableConfigView.xaml b/BPASmartClient.CustomResource/Pages/View/VariableConfigView.xaml new file mode 100644 index 00000000..e58ed834 --- /dev/null +++ b/BPASmartClient.CustomResource/Pages/View/VariableConfigView.xaml @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BPASmartClient.CustomResource/Pages/View/VariableConfigView.xaml.cs b/BPASmartClient.CustomResource/Pages/View/VariableConfigView.xaml.cs new file mode 100644 index 00000000..f133e9ba --- /dev/null +++ b/BPASmartClient.CustomResource/Pages/View/VariableConfigView.xaml.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace BPASmartClient.CustomResource.Pages.View +{ + /// + /// VariableConfigView.xaml 的交互逻辑 + /// + public partial class VariableConfigView : UserControl + { + public VariableConfigView() + { + InitializeComponent(); + } + + private void DataGrid_LoadingRow(object sender, DataGridRowEventArgs e) + { + e.Row.Header = e.Row.GetIndex() + 1; + } + + + } +} diff --git a/BPASmartClient.CustomResource/Pages/ViewModel/VariableViewModel.cs b/BPASmartClient.CustomResource/Pages/ViewModel/VariableViewModel.cs new file mode 100644 index 00000000..f8ff0489 --- /dev/null +++ b/BPASmartClient.CustomResource/Pages/ViewModel/VariableViewModel.cs @@ -0,0 +1,35 @@ +using BPASmartClient.CustomResource.Pages.Model; +using BPASmartClient.Helper; +using Microsoft.Toolkit.Mvvm.ComponentModel; +using Microsoft.Toolkit.Mvvm.Input; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; + +namespace BPASmartClient.CustomResource.Pages.ViewModel +{ + public class VariableViewModel : ObservableObject + { + public ObservableCollection Variables { get; set; } = new ObservableCollection(); + + public RelayCommand SaveDataCommand { get; set; } + + public VariableViewModel() + { + Json.Read(); + Variables = Json.Data.VariablesInfo; + SaveDataCommand = new RelayCommand(() => + { + Json.Save(); + MessageBox.Show("保存成功","提示",MessageBoxButton.OK,MessageBoxImage.Information); + }); + + } + + + } +} diff --git a/BPASmartClient.Helper/Sqlite.cs b/BPASmartClient.Helper/Sqlite.cs index fafe28eb..03b78159 100644 --- a/BPASmartClient.Helper/Sqlite.cs +++ b/BPASmartClient.Helper/Sqlite.cs @@ -31,7 +31,10 @@ namespace BPASmartClient.Helper return $"{AppDomain.CurrentDomain.BaseDirectory}AccessFile\\DB\\{typeof(T).Name}.db"; } } - + public bool DataBaseExist() + { + return Database.EnsureCreated(); + } public void Save() { diff --git a/FryPot_DosingSystem/App.xaml.cs b/FryPot_DosingSystem/App.xaml.cs index 3d322339..bbe44799 100644 --- a/FryPot_DosingSystem/App.xaml.cs +++ b/FryPot_DosingSystem/App.xaml.cs @@ -12,6 +12,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Configuration; using System.Data; +using System.IO; using System.Linq; using System.Threading.Tasks; using System.Windows; @@ -29,7 +30,7 @@ namespace FryPot_DosingSystem base.OnStartup(e); MenuInite(); LoginDataInite(); - + MainView mv = new MainView(); LoginView lv = new LoginView(); var res = lv.ShowDialog(); @@ -58,6 +59,9 @@ namespace FryPot_DosingSystem } + + + protected override void OnExit(ExitEventArgs e) { base.OnExit(e); @@ -119,6 +123,13 @@ namespace FryPot_DosingSystem AssemblyName = "BPASmartClient.CustomResource", ToggleWindowPath = "Pages.View.AlarmView" }); + InfoLog.Add(new SubMenumodel() + { + SubMenuName = "炒锅状态记录", + SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 }, + AssemblyName = "FryPot_DosingSystem", + ToggleWindowPath = "View.SqliteDataView" + }); MenuManage.GetInstance.menuModels.Add(new MenuModel() { @@ -139,6 +150,13 @@ namespace FryPot_DosingSystem AssemblyName = "FryPot_DosingSystem", ToggleWindowPath = "View.DeviceListVIew" }); + DeviceMonitor.Add(new SubMenumodel() + { + SubMenuName = "PLC变量配置", + SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 }, + AssemblyName = "BPASmartClient.CustomResource", + ToggleWindowPath = "Pages.View.VariableConfigView" + }); DeviceMonitor.Add(new SubMenumodel() { @@ -147,6 +165,14 @@ namespace FryPot_DosingSystem AssemblyName = "FryPot_DosingSystem", ToggleWindowPath = "View.HardWareStatusView" + }); + DeviceMonitor.Add(new SubMenumodel() + { + SubMenuName = "炒锅状态监控", + SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员, Permission.观察员 }, + AssemblyName = "FryPot_DosingSystem", + ToggleWindowPath = "View.FryPotMonitorView" + }); DeviceMonitor.Add(new SubMenumodel() @@ -156,7 +182,7 @@ namespace FryPot_DosingSystem AssemblyName = "FryPot_DosingSystem", ToggleWindowPath = "View.AgvView" }); - + MenuManage.GetInstance.menuModels.Add(new MenuModel() { MainMenuIcon = "", diff --git a/FryPot_DosingSystem/Attributes/VariableAttribute.cs b/FryPot_DosingSystem/Attributes/VariableAttribute.cs new file mode 100644 index 00000000..954bc98f --- /dev/null +++ b/FryPot_DosingSystem/Attributes/VariableAttribute.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FryPot_DosingSystem.Attributes +{ + internal class VariableAttribute:Attribute + { + public string VarName { get; set; } + public string Notes { get; set; } + public string PLCAddress { get; set; } + public string ModbusTcpAddress { get; set; } + /// + /// + /// + /// 变量名 + /// 描述 + /// plc地址 + /// modbustcp地址 + public VariableAttribute(string name,string notes,string plcaddress,string modbustcpaddress) + { + VarName = name; + Notes = notes; + PLCAddress = plcaddress; + ModbusTcpAddress = modbustcpaddress; + } + } +} diff --git a/FryPot_DosingSystem/Control/DeviceOperate.cs b/FryPot_DosingSystem/Control/DeviceOperate.cs index 5f9fe3be..e39a393b 100644 --- a/FryPot_DosingSystem/Control/DeviceOperate.cs +++ b/FryPot_DosingSystem/Control/DeviceOperate.cs @@ -1,4 +1,6 @@ -using BPASmartClient.Helper; + +using BPASmartClient.CustomResource.Pages.Model; +using BPASmartClient.Helper; using BPASmartClient.Message; using BPASmartClient.Modbus; using FryPot_DosingSystem.Model; @@ -16,7 +18,8 @@ namespace FryPot_DosingSystem.Control internal class DeviceOperate { private static DeviceOperate _instance; - public static DeviceOperate GetInstance=>_instance ??= new DeviceOperate(); + public static DeviceOperate GetInstance => _instance ??= new DeviceOperate(); + public bool IsConfig { get; set; }//设备plc数据是否配置 ModbusTcp modbus = new ModbusTcp(); private string Ip { get; set; } private string Port { get; set; } @@ -25,7 +28,7 @@ namespace FryPot_DosingSystem.Control private string DeviceName { get; set; } public ConcurrentDictionary Data { get; set; } = new ConcurrentDictionary(); - public ObservableCollection Variables { get; set; }=new ObservableCollection(); + public ObservableCollection Variables { get; set; } = new ObservableCollection(); public DeviceOperate() { Init(); @@ -38,67 +41,94 @@ namespace FryPot_DosingSystem.Control { Variables.Clear(); } - Variables.Add(new PlcVariableModel() { Address = "D2001", Length = 8 });//1号线体滚筒工位号 - Variables.Add(new PlcVariableModel() { Address = "D2011", Length = 8 });//2号线体滚筒工位号 - Variables.Add(new PlcVariableModel() { Address = "D2021", Length = 8 });//3号线体滚筒工位号 - Variables.Add(new PlcVariableModel() { Address = "D2031", Length = 9 });//输送线出料状态 - Variables.Add(new PlcVariableModel() { Address = "D2040", Length = 5 });//炒锅1-5进料滚筒运行 - Variables.Add(new PlcVariableModel() { Address = "D2045", Length = 5 });//炒锅1-5进料到位信号 - Variables.Add(new PlcVariableModel() { Address = "D2050", Length = 5 });//炒锅1-5空桶到位信号 - Variables.Add(new PlcVariableModel() { Address = "D2055", Length = 5 });//炒锅1-5空桶呼叫AGV - Variables.Add(new PlcVariableModel() { Address = "D2060", Length = 5 });//炒锅1空桶洗桶呼叫AGV - Variables.Add(new PlcVariableModel() { Address = "D2065", Length = 5 });//炒锅1-5空桶滚筒运行 - Variables.Add(new PlcVariableModel() { Address = "D2070", Length = 5 });//炒锅1-5滚筒故障信号 - Variables.Add(new PlcVariableModel() { Address = "D2075", Length = 1 });//洗桶进桶滚筒运行信号 - Variables.Add(new PlcVariableModel() { Address = "D2076", Length = 1 });//洗桶出桶呼叫AGV - Variables.Add(new PlcVariableModel() { Address = "D2077", Length = 1 });// 洗桶出桶滚筒运行信号 - Variables.Add(new PlcVariableModel() { Address = "D2078", Length = 3 });//1-3滚筒线体配方完成信号 - } - public void Connect() - { - Json.Read(); - DeviceManage devices = Json.Data; - if (devices != null) + Json.Read(); + if (Json.Data.VariablesInfo.Count > 0) { - if (devices.Devices.Count > 0) + try { - Ip = devices.Devices[0].Ip; - Port = devices.Devices[0].Port; - DeviceName = devices.Devices[0].DeviceName; - Task.Run(() => { modbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); }); + foreach (var item in Json.Data.VariablesInfo) + { + Variables.Add(new PlcVariableModel { Address = item.PlcAddress, Length = (ushort)(item.Length == null ? 0 : item.Length) }); + } + IsConfig = true; + } + catch (Exception) + { + IsConfig = false; + //throw; } } + else + { + IsConfig= false; + } + //Variables.Add(new PlcVariableModel() { Address = "D2001", Length = 8 });//1号线体滚筒工位号 + //Variables.Add(new PlcVariableModel() { Address = "D2011", Length = 8 });//2号线体滚筒工位号 + //Variables.Add(new PlcVariableModel() { Address = "D2021", Length = 8 });//3号线体滚筒工位号 + //Variables.Add(new PlcVariableModel() { Address = "D2031", Length = 9 });//输送线出料状态 + //Variables.Add(new PlcVariableModel() { Address = "D2040", Length = 5 });//炒锅1-5进料滚筒运行 + //Variables.Add(new PlcVariableModel() { Address = "D2045", Length = 5 });//炒锅1-5进料到位信号 + //Variables.Add(new PlcVariableModel() { Address = "D2050", Length = 5 });//炒锅1-5空桶到位信号 + //Variables.Add(new PlcVariableModel() { Address = "D2055", Length = 5 });//炒锅1-5空桶呼叫AGV + //Variables.Add(new PlcVariableModel() { Address = "D2060", Length = 5 });//炒锅1空桶洗桶呼叫AGV + //Variables.Add(new PlcVariableModel() { Address = "D2065", Length = 5 });//炒锅1-5空桶滚筒运行 + //Variables.Add(new PlcVariableModel() { Address = "D2070", Length = 5 });//炒锅1-5滚筒故障信号 + //Variables.Add(new PlcVariableModel() { Address = "D2075", Length = 1 });//洗桶进桶滚筒运行信号 + //Variables.Add(new PlcVariableModel() { Address = "D2076", Length = 1 });//洗桶出桶呼叫AGV + //Variables.Add(new PlcVariableModel() { Address = "D2077", Length = 1 });// 洗桶出桶滚筒运行信号 + //Variables.Add(new PlcVariableModel() { Address = "D2078", Length = 3 });//1-3滚筒线体配方完成信号 } - public void ReadData() + public void Connect() { - ThreadManage.GetInstance().StartLong(new Action(() => + if (IsConfig) { - Connected = modbus.Connected; - while (Connected) + Json.Read(); + DeviceManage devices = Json.Data; + if (devices != null) { - foreach (var item in Variables) + if (devices.Devices.Count > 0) { - var res = modbus.Read(item.Address, item.Length); - if (Data.ContainsKey(item.Address)) - { - Data[item.Address] = res; - } - else - { - Data.TryAdd(item.Address, res); - } + Ip = devices.Devices[0].Ip; + Port = devices.Devices[0].Port; + DeviceName = devices.Devices[0].DeviceName; + Task.Run(() => { modbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); }); } - Thread.Sleep(500); - - } - Thread.Sleep(1000); - }),$"设备【{DeviceName}】PLC实时数据读取线程"); + } + } + } + public void ReadData() + { + if (IsConfig) + { + ThreadManage.GetInstance().StartLong(new Action(() => + { + Connected = modbus.Connected; + while (Connected) + { + foreach (var item in Variables) + { + var res = modbus.Read(item.Address, item.Length);//读取plc数据 + if (Data.ContainsKey(item.Address)) + { + Data[item.Address] = res; + } + else + { + Data.TryAdd(item.Address, res); + } + } + Thread.Sleep(500); + + } + Thread.Sleep(1000); + }), $"设备【{DeviceName}】PLC实时数据读取线程"); + } } - public void WritePlcData(string address,ushort value) + public void WritePlcData(string address, ushort value) { lock (this) { - modbus.Write(address, value); + modbus.Write(address, value); } } public ConcurrentDictionary GetAllData() diff --git a/FryPot_DosingSystem/Control/DosingLogicControl.cs b/FryPot_DosingSystem/Control/DosingLogicControl.cs index d2e8f0bd..74b0a430 100644 --- a/FryPot_DosingSystem/Control/DosingLogicControl.cs +++ b/FryPot_DosingSystem/Control/DosingLogicControl.cs @@ -18,6 +18,7 @@ using System.Threading.Tasks; using System.Windows.Media; using System.Windows; using FryPot_DosingSystem.AGV; +using FryPot_DosingSystem.FryPotStatus; namespace FryPot_DosingSystem.Control { @@ -70,6 +71,26 @@ namespace FryPot_DosingSystem.Control /// 线体状态对象声明 /// HardWareStatusViewModel hardWareStatusModel; + ///// + ///// 炒锅1状态 + ///// + //PotOneStatus fryOne; + ///// + ///// 炒锅2状态 + ///// + //PotTwoStatus fryTwo; + ///// + ///// 炒锅3状态 + ///// + //PotThreeStatus fryThree; + ///// + ///// 炒锅4状态 + ///// + //PotFourStatus fryFour; + ///// + ///// 炒锅5状态 + ///// + //PotFiveStatus fryFive; /// /// 报警信息对象声明 /// @@ -218,12 +239,23 @@ namespace FryPot_DosingSystem.Control public DosingLogicControl() { globalVar = new GlobalVariable(); + //fryOne = new PotOneStatus(); + //fryTwo = new PotTwoStatus(); + //fryThree = new PotThreeStatus(); + //fryFour = new PotFourStatus(); + //fryFive = new PotFiveStatus(); hardWareStatusModel = HardWareStatusViewModel.GetInstance; + DateTimeJudge(); ActionManage.GetInstance.Register(new Action(RecipeDataParse), "RecipeSetDown"); - ActionManage.GetInstance.Register(new Action(() => { RecipeQuene.Clear(); InputMaterialQuene.Clear(); OutputMaterialQuene.Clear(); LTwoInputMaterialQuene.Clear(); LTwoOutputMaterialQuene.Clear(); LThreeInputMaterialQuene.Clear(); LThreeOutputMaterialQuene.Clear(); }), "ClearRecipes"); + //ActionManage.GetInstance.Register(new Action(() => { RecipeQuene.Clear(); InputMaterialQuene.Clear(); OutputMaterialQuene.Clear(); LTwoInputMaterialQuene.Clear(); LTwoOutputMaterialQuene.Clear(); LThreeInputMaterialQuene.Clear(); LThreeOutputMaterialQuene.Clear(); }), "ClearRecipes"); + ActionManage.GetInstance.Register(new Action(() => { RecipeQuene.Clear(); InputMaterialQuene.Clear(); OutputMaterialQuene.Clear(); }), "ClearOneRecipes"); + ActionManage.GetInstance.Register(new Action(() => { LTwoRecipeQuene.Clear(); LTwoInputMaterialQuene.Clear(); LTwoOutputMaterialQuene.Clear(); }), "ClearTwoRecipes"); + ActionManage.GetInstance.Register(new Action(() => { LThreeRecipeQuene.Clear(); LThreeInputMaterialQuene.Clear(); LThreeOutputMaterialQuene.Clear(); }), "ClearThreeRecipes"); ActionManage.GetInstance.Register(new Action(() => { globalVar.PlcInite = 1; }), "StartPlcInite"); ActionManage.GetInstance.Register(new Action(() => { globalVar.PlcInite = 0; }), "EndPlcInite"); - ActionManage.GetInstance.Register(new Action(() => { globalVar.ExitMainTask = true; }), "FryPotDosingMainTaskExit"); + ActionManage.GetInstance.Register(new Action(() => { globalVar.ExitLineOneTask = true; LineOneTaskRestart(); }), "LineOneTaskExit"); + ActionManage.GetInstance.Register(new Action(() => { globalVar.ExitLineTwoTask = true; LineTwoTaskRestart(); }), "LineTwoTaskExit"); + ActionManage.GetInstance.Register(new Action(() => { globalVar.ExitLineThreeTask = true; LineThreeTaskRestart(); }), "LineThreeTaskExit"); HubHelper.GetInstance.Report = new Action(AgvTaskUpReportDataAnalysis); HubHelper.GetInstance.Upstreamrequest = new Action(AgvFeedBackUpReportDataAnalysis); // ResetProgram(); @@ -231,6 +263,58 @@ namespace FryPot_DosingSystem.Control MainTask(); CommandRegist(); } + /// + /// 时间判断,数据处理 + /// + private void DateTimeJudge() + { + if (Sqlite.GetInstance.GetData().Count > 0) + { + string time1 = Sqlite.GetInstance.GetData().Last().Time; + if (time1.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样 + { + FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy = Sqlite.GetInstance.GetData().Last().TotalOilCapactiy; + FryPotMonitorManage.GetInstance.fryOne.TotalProduct = Sqlite.GetInstance.GetData().Last().TotalProduct; + } + } + if (Sqlite.GetInstance.GetData().Count > 0) + { + string time2 = Sqlite.GetInstance.GetData().Last().Time; + if (time2.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样 + { + FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy = Sqlite.GetInstance.GetData().Last().TotalOilCapactiy; + FryPotMonitorManage.GetInstance.fryTwo.TotalProduct = Sqlite.GetInstance.GetData().Last().TotalProduct; + } + } + if (Sqlite.GetInstance.GetData().Count > 0) + { + string time3 = Sqlite.GetInstance.GetData().Last().Time; + if (time3.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样 + { + FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy = Sqlite.GetInstance.GetData().Last().TotalOilCapactiy; + FryPotMonitorManage.GetInstance.fryThree.TotalProduct = Sqlite.GetInstance.GetData().Last().TotalProduct; + } + } + if (Sqlite.GetInstance.GetData().Count > 0) + { + string time4 = Sqlite.GetInstance.GetData().Last().Time; + if (time4.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样 + { + FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy = Sqlite.GetInstance.GetData().Last().TotalOilCapactiy; + FryPotMonitorManage.GetInstance.fryFour.TotalProduct = Sqlite.GetInstance.GetData().Last().TotalProduct; + } + } + + if (Sqlite.GetInstance.GetData().Count > 0) + { + string time5 = Sqlite.GetInstance.GetData().Last().Time; + if (time5.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样 + { + FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy = Sqlite.GetInstance.GetData().Last().TotalOilCapactiy; + FryPotMonitorManage.GetInstance.fryFive.TotalProduct = Sqlite.GetInstance.GetData().Last().TotalProduct; + } + } + } /// /// AGV上下料上报数据解析 @@ -518,9 +602,9 @@ namespace FryPot_DosingSystem.Control ThreadManage.GetInstance().StopTask("MainViewReadPlcData", new Action(() => { - ActionManage.GetInstance.CancelRegister("RecipeSetDown"); - ActionManage.GetInstance.Register(new Action(RecipeDataParse), "RecipeSetDown"); - ActionManage.GetInstance.Send("ClearRecipes"); + //ActionManage.GetInstance.CancelRegister("RecipeSetDown"); + //ActionManage.GetInstance.Register(new Action(RecipeDataParse), "RecipeSetDown"); + // ActionManage.GetInstance.Send("ClearRecipes"); ThreadManage.GetInstance().StopTask("滚筒线1任务线程", new Action(() => { ThreadManage.GetInstance().StopTask("滚筒线2任务线程", new Action(() => @@ -533,7 +617,6 @@ namespace FryPot_DosingSystem.Control ReadPlcData(); MainTask(); MessageLog.GetInstance.ShowUserLog("主任务重启完成"); - })); })); @@ -544,6 +627,98 @@ namespace FryPot_DosingSystem.Control Thread.Sleep(10); }), "ResetProgram"); } + + public void LineOneTaskRestart() + { + ThreadManage.GetInstance().StopTask("滚筒线1任务线程", new Action(() => + { + ActionManage.GetInstance.Send("ClearOneRecipes"); + globalVar.rollerLineOne = null; + globalVar.rollerLineOne = new RollerLineOne(); + globalVar.fryPotOne = null; + globalVar.fryPotOne = new FryPotOne(); + globalVar.fryPotFour = null; + globalVar.fryPotFour = new FryPotFour(); + globalVar.ExitLineOneTask = false; + globalVar.AllowAgvToLineLoadRoller = true; + globalVar.InOrOutputLock = false; + globalVar.LOneCurrentRecipeName = string.Empty; + globalVar.LoadRoller = false; + globalVar.AgvToFryPot = false; + globalVar.PotOneInputMaterialArrive = false; + globalVar.PotOneOutputRollerArrive = false; + globalVar.AgvArrivePot = false; + globalVar.LOneMaterialNum = 0; + globalVar.LOneFryPotSerial = 1; + globalVar.LOneCurrentCookingStep = 0; + globalVar.agvArriveUpLoad = false; + globalVar.agvArriveUnLoad = false; + globalVar.agvFryPotEmptyRollerArrive = false; + globalVar.EmptyRollerUnLoadcCom = false; + ThreadManage.GetInstance().StartLong(new Action(() => { LineOneProcessExecute(); Thread.Sleep(10); }), "滚筒线1任务线程"); + MessageLog.GetInstance.ShowUserLog("滚筒线【1】任务重启成功"); + })); + } + public void LineTwoTaskRestart() + { + ThreadManage.GetInstance().StopTask("滚筒线2任务线程", new Action(() => + { + ActionManage.GetInstance.Send("ClearTwoRecipes"); + globalVar.rollerLineTwo = null; + globalVar.rollerLineTwo = new RollerLineTwo(); + globalVar.fryPotTwo = null; + globalVar.fryPotTwo = new FryPotTwo(); + globalVar.fryPotFive = null; + globalVar.fryPotFive = new FryPotFive(); + globalVar.ExitLineTwoTask = false; + globalVar.AllowAgvToLineTwoLoadRoller = true; + globalVar.LTwoInOrOutputLock = false; + globalVar.LTwoCurrentRecipeName = string.Empty; + globalVar.LTwoLoadRoller = false; + globalVar.LTwoAgvToFryPot = false; + globalVar.LTwoPotInputMaterialArrive = false; + globalVar.LTwoPotOutputRollerArrive = false; + globalVar.LTwoAgvArrivePot = false; + globalVar.LTwoMaterialNum = 0; + globalVar.LTwoFryPotSerial = 2; + globalVar.LTwoCurrentCookingStep = 0; + globalVar.agvArriveLTwoUpLoad = false; + globalVar.LTwoagvArriveUnLoad = false; + globalVar.LTwoagvFryPotEmptyRollerArrive = false; + globalVar.LTwoEmptyRollerUnLoadcCom = false; + ThreadManage.GetInstance().StartLong(new Action(() => { LineTwoProcessExecute(); Thread.Sleep(10); }), "滚筒线2任务线程"); + MessageLog.GetInstance.ShowUserLog("滚筒线【2】任务重启成功"); + })); + } + public void LineThreeTaskRestart() + { + ThreadManage.GetInstance().StopTask("滚筒线3任务线程", new Action(() => + { + ActionManage.GetInstance.Send("ClearThreeRecipes"); + globalVar.rollerLineThree = null; + globalVar.rollerLineThree = new RollerLineThree(); + globalVar.fryPotThree = null; + globalVar.fryPotThree = new FryPotThree(); + globalVar.ExitLineThreeTask = false; + globalVar.AllowAgvToLineThreeLoadRoller = true; + globalVar.LThreeInOrOutputLock = false; + globalVar.LThreeCurrentRecipeName = string.Empty; + globalVar.LThreeLoadRoller = false; + globalVar.LThreeAgvToFryPot = false; + globalVar.LThreePotInputMaterialArrive = false; + globalVar.LThreePotOutputRollerArrive = false; + globalVar.LThreeAgvArrivePot = false; + globalVar.LThreeMaterialNum = 0; + globalVar.LThreeFryPotSerial = 3; + globalVar.LThreeCurrentCookingStep = 0; + globalVar.agvArriveLThreeUpLoad = false; + globalVar.LThreeagvArriveUnLoad = false; + globalVar.LThreeagvFryPotEmptyRollerArrive = false; + globalVar.LThreeEmptyRollerUnLoadcCom = false; + ThreadManage.GetInstance().StartLong(new Action(() => { LineThreeProcessExecute(); Thread.Sleep(10); }), "滚筒线3任务线程"); + MessageLog.GetInstance.ShowUserLog("滚筒线【3】任务重启成功"); + })); + } /// /// 实时获取plc数据 /// @@ -658,16 +833,86 @@ namespace FryPot_DosingSystem.Control globalVar.CleadBarrelExitSingle = data[0]; })); - //globalVar.rollerLineOne.OutMaterialingSingle = 0; - //globalVar.rollerLineOne.StationOne = 401; - //globalVar.rollerLineOne.StationTwo = 402; - //globalVar.rollerLineOne.OutMaterialingTroubleSingle = 1; - // AlarmHelper.Alarm.LOneRollerTrouble =1; + if (globalVar.fryPotOne.OilConfirm == 1) + { + FryPotMonitorManage.GetInstance.fryOne.OilCapacity = globalVar.fryPotOne.OilCapacity; + FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy += globalVar.fryPotOne.OilCapacity; + } + if (globalVar.fryPotTwo.OilConfirm == 1) + { + FryPotMonitorManage.GetInstance.fryTwo.OilCapacity = globalVar.fryPotTwo.OilCapacity; + FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy += globalVar.fryPotTwo.OilCapacity; + } + if (globalVar.fryPotThree.OilConfirm == 1) + { + FryPotMonitorManage.GetInstance.fryThree.OilCapacity = globalVar.fryPotThree.OilCapacity; + FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy += globalVar.fryPotThree.OilCapacity; + } + if (globalVar.fryPotFour.OilConfirm == 1) + { + FryPotMonitorManage.GetInstance.fryFour.OilCapacity = globalVar.fryPotFour.OilCapacity; + FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy += globalVar.fryPotFour.OilCapacity; + } + if (globalVar.fryPotFive.OilConfirm == 1) + { + FryPotMonitorManage.GetInstance.fryFive.OilCapacity = globalVar.fryPotFive.OilCapacity; + FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy += globalVar.fryPotFive.OilCapacity; + } + //炒锅状态实时显示 + FryPotStatusDisplay(); + + RollerLineStatusDisplay(); + Thread.Sleep(10); }), "MainViewReadPlcData"); } + + private void FryPotStatusDisplay() + { + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneTemp").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.Temperature.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOnePower").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.HotPower.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneSpeed").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.Speed.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneWeight").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.FryPotWeight.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneOil").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.OilCapacity.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneTotalOil").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneTotalProduct").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.TotalProduct.ToString(); + + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoTemp").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.Temperature.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoPower").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.HotPower.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoSpeed").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.Speed.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoWeight").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.FryPotWeight.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoOil").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.OilCapacity.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoTotalOil").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotTwoTotalProduct").CurrentValue = FryPotMonitorManage.GetInstance.fryTwo.TotalProduct.ToString(); + + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeTemp").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.Temperature.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreePower").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.HotPower.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeSpeed").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.Speed.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeWeight").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.FryPotWeight.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeOil").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.OilCapacity.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeTotalOil").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotThreeTotalProduct").CurrentValue = FryPotMonitorManage.GetInstance.fryThree.TotalProduct.ToString(); + + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourTemp").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.Temperature.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourPower").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.HotPower.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourSpeed").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.Speed.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourWeight").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.FryPotWeight.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourOil").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.OilCapacity.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourTotalOil").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFourTotalProduct").CurrentValue = FryPotMonitorManage.GetInstance.fryFour.TotalProduct.ToString(); + + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveTemp").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.Temperature.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFivePower").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.HotPower.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveSpeed").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.Speed.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveWeight").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.FryPotWeight.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveOil").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.OilCapacity.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveTotalOil").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy.ToString(); + FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveTotalProduct").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.TotalProduct.ToString(); + + } + /// /// 滚筒线运行状态显示 /// @@ -853,12 +1098,12 @@ namespace FryPot_DosingSystem.Control //if (!globalVar.LOneTaskLock) //{ // globalVar.LOneTaskLock = true; - LOneRecipeDataToPlc(); - LOneLoadRoller(); - LOneFryPotInputMaterial(); - LOneFallMaterial(); - LOneFryPotOutputMaterial(); - LOneEmptyOperate(); + LOneRecipeDataToPlc(); + LOneLoadRoller(); + LOneFryPotInputMaterial(); + LOneFallMaterial(); + LOneFryPotOutputMaterial(); + LOneEmptyOperate(); // globalVar.LOneTaskLock = false; //} @@ -871,12 +1116,12 @@ namespace FryPot_DosingSystem.Control //if (!globalVar.LTwoTaskLock) //{ // globalVar.LTwoTaskLock = true; - LTwoRecipeDataToPlc(); - LTwoAgvLoadRoller(); - LTwoFryPotInputMaterial(); - LTwoFallMaterial(); - LTwoFryPotOutputMaterial(); - LTwoEmptyOperate(); + LTwoRecipeDataToPlc(); + LTwoAgvLoadRoller(); + LTwoFryPotInputMaterial(); + LTwoFallMaterial(); + LTwoFryPotOutputMaterial(); + LTwoEmptyOperate(); // globalVar.LTwoTaskLock = false; //} @@ -889,12 +1134,12 @@ namespace FryPot_DosingSystem.Control //if (!globalVar.LThreeTaskLock) //{ // globalVar.LThreeTaskLock = true; - LThreeRecipeDataToPlc(); - LThreeAgvLoadRoller(); - LThreeFryPotInputMaterial(); - LThreeFallMaterial(); - LThreeFryPotOutputMaterial(); - LThreeEmptyOperate(); + LThreeRecipeDataToPlc(); + LThreeAgvLoadRoller(); + LThreeFryPotInputMaterial(); + LThreeFallMaterial(); + LThreeFryPotOutputMaterial(); + LThreeEmptyOperate(); // globalVar.LThreeTaskLock = false; //} @@ -912,6 +1157,12 @@ namespace FryPot_DosingSystem.Control { MessageLog.GetInstance.ShowUserLog($"【3】号滚筒线【{globalVar.LThreeCurrentRecipeName}】 配方制作完成"); globalVar.LThreeCurrentRecipeName = string.Empty; + if (globalVar.LThreeFryPotSerial == 3) + { + FryPotMonitorManage.GetInstance.fryThree.TotalProduct++; + Sqlite.GetInstance.Base.Add(new PotThreeStatus { Temperature = FryPotMonitorManage.GetInstance.fryThree.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryThree.HotPower, Speed = FryPotMonitorManage.GetInstance.fryThree.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryThree.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryThree.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryThree.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据 + Sqlite.GetInstance.Save();//保存数据 + } } } if (LThreeRecipeQuene.Count > 0 && LThreeOutputMaterialQuene.Count == 0 && LThreeInputMaterialQuene.Count == 0)//后续添加其它限制条件 @@ -919,8 +1170,8 @@ namespace FryPot_DosingSystem.Control Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.goodsName = string.Empty; })); Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.workflows = new ObservableCollection(); })); AgvViewModel.GetInstance().Set启动或停止炒锅(3, IsRun.Stop); - if (globalVar.LThreeCurrentRecipeName != string.Empty) - MessageLog.GetInstance.ShowUserLog($"【3】号滚筒线【{globalVar.LThreeCurrentRecipeName}】 配方制作完成"); + //if (globalVar.LThreeCurrentRecipeName != string.Empty) + // MessageLog.GetInstance.ShowUserLog($"【3】号滚筒线【{globalVar.LThreeCurrentRecipeName}】 配方制作完成"); if (LThreeRecipeQuene.TryDequeue(out NewRecipeModel result)) { LThreeErrorRecipe = false; @@ -971,6 +1222,18 @@ namespace FryPot_DosingSystem.Control { MessageLog.GetInstance.ShowUserLog($"【2】号滚筒线【{globalVar.LTwoCurrentRecipeName}】 配方制作完成"); globalVar.LTwoCurrentRecipeName = string.Empty; + if (globalVar.LTwoFryPotSerial == 2) + { + FryPotMonitorManage.GetInstance.fryTwo.TotalProduct++; + Sqlite.GetInstance.Base.Add(new PotTwoStatus { Temperature = FryPotMonitorManage.GetInstance.fryTwo.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryTwo.HotPower, Speed = FryPotMonitorManage.GetInstance.fryTwo.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryTwo.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryTwo.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryTwo.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据 + Sqlite.GetInstance.Save();//保存数据 + } + if (globalVar.LTwoFryPotSerial == 5) + { + FryPotMonitorManage.GetInstance.fryFive.TotalProduct++; + Sqlite.GetInstance.Base.Add(new PotFiveStatus { Temperature = FryPotMonitorManage.GetInstance.fryFive.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFive.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFive.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFive.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFive.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFive.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据 + Sqlite.GetInstance.Save();//保存数据 + } } } @@ -988,8 +1251,8 @@ namespace FryPot_DosingSystem.Control Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.workflows = new ObservableCollection(); })); AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LTwoFryPotSerial, IsRun.Stop); } - if (globalVar.LTwoCurrentRecipeName != string.Empty) - MessageLog.GetInstance.ShowUserLog($"【2】号滚筒线【{globalVar.LTwoCurrentRecipeName}】 配方制作完成"); + //if (globalVar.LTwoCurrentRecipeName != string.Empty) + // MessageLog.GetInstance.ShowUserLog($"【2】号滚筒线【{globalVar.LTwoCurrentRecipeName}】 配方制作完成"); if (LTwoRecipeQuene.TryDequeue(out NewRecipeModel result)) { LTwoErrorRecipe = false; @@ -1047,6 +1310,18 @@ namespace FryPot_DosingSystem.Control { MessageLog.GetInstance.ShowUserLog($"【1】号滚筒线【{globalVar.LOneCurrentRecipeName}】 配方制作完成"); globalVar.LOneCurrentRecipeName = string.Empty; + if (globalVar.LOneFryPotSerial == 1) + { + FryPotMonitorManage.GetInstance.fryOne.TotalProduct++; + Sqlite.GetInstance.Base.Add(new PotOneStatus { Temperature = FryPotMonitorManage.GetInstance.fryOne.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryOne.HotPower, Speed = FryPotMonitorManage.GetInstance.fryOne.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryOne.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryOne.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryOne.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据 + Sqlite.GetInstance.Save();//保存数据 + } + if (globalVar.LOneFryPotSerial == 4) + { + FryPotMonitorManage.GetInstance.fryFour.TotalProduct++; + Sqlite.GetInstance.Base.Add(new PotFourStatus { Temperature = FryPotMonitorManage.GetInstance.fryFour.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFour.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFour.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFour.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFour.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFour.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据 + Sqlite.GetInstance.Save();//保存数据 + } } } @@ -1278,6 +1553,16 @@ namespace FryPot_DosingSystem.Control { if (!globalVar.InOrOutputLock && (globalVar.fryPotOne.InputMaterialArrivedSingle == 1 || globalVar.fryPotFour.InputMaterialArrivedSingle == 1) && globalVar.PotOneInputMaterialArrive && OutputMaterialQuene.Count > 0 && !globalVar.PotOneOutputRollerArrive) { + if (globalVar.LOneFryPotSerial == 1) + { + Sqlite.GetInstance.Base.Add(new PotOneStatus {Temperature= FryPotMonitorManage.GetInstance.fryOne.Temperature,HotPower= FryPotMonitorManage.GetInstance.fryOne.HotPower,Speed=FryPotMonitorManage.GetInstance.fryOne.Speed,FryPotWeight=FryPotMonitorManage.GetInstance.fryOne.FryPotWeight,OilCapacity=FryPotMonitorManage.GetInstance.fryOne.OilCapacity,TotalOilCapactiy=FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy,TotalProduct=FryPotMonitorManage.GetInstance.fryOne.TotalProduct,Time=DateTime.Now.ToShortDateString() });//向表中新增数据 + Sqlite.GetInstance.Save();//保存数据 + } + else + { + Sqlite.GetInstance.Base.Add(new PotFourStatus { Temperature = FryPotMonitorManage.GetInstance.fryFour.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFour.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFour.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFour.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFour.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFour.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据 + Sqlite.GetInstance.Save();//保存数据 + } FryPotOneRollerTroubleCheck(); if (FryPotAlarm == 1 || FryPotFourAlarm == 1)//炒锅滚筒无故障 { @@ -1289,6 +1574,7 @@ namespace FryPot_DosingSystem.Control } else { + Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_4.workflows.Add(new WorkflowModel { id = globalVar.LOneCurrentCookingStep, Name = OutputMaterialQuene.ElementAt(0).materialType.MaterialName, isBool = IsBool.Yes }); })); } AgvViewModel.GetInstance().Set小车是否承载物品(1, IsBool.No); @@ -1326,6 +1612,16 @@ namespace FryPot_DosingSystem.Control { if (!globalVar.LTwoInOrOutputLock && (globalVar.fryPotTwo.InputMaterialArrivedSingle == 1 || globalVar.fryPotFive.InputMaterialArrivedSingle == 1) && globalVar.LTwoPotInputMaterialArrive && LTwoOutputMaterialQuene.Count > 0 && !globalVar.LTwoPotOutputRollerArrive) { + if (globalVar.LTwoFryPotSerial == 2) + { + Sqlite.GetInstance.Base.Add(new PotTwoStatus { Temperature = FryPotMonitorManage.GetInstance.fryTwo.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryTwo.HotPower, Speed = FryPotMonitorManage.GetInstance.fryTwo.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryTwo.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryTwo.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryTwo.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据 + Sqlite.GetInstance.Save();//保存数据 + } + else + { + Sqlite.GetInstance.Base.Add(new PotFiveStatus { Temperature = FryPotMonitorManage.GetInstance.fryFive.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFive.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFive.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFive.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFive.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFive.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据 + Sqlite.GetInstance.Save();//保存数据 + } FryPotTwoRollerTroubleCheck(); if (FryPotTwoAlarm == 1 || FryPotFiveAlarm == 1)//炒锅滚筒无故障 { @@ -1337,6 +1633,7 @@ namespace FryPot_DosingSystem.Control } else { + Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.workflows.Add(new WorkflowModel { id = globalVar.LTwoCurrentCookingStep, Name = LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialName, isBool = IsBool.Yes }); })); } AgvViewModel.GetInstance().Set小车是否承载物品(2, IsBool.No); @@ -1368,9 +1665,12 @@ namespace FryPot_DosingSystem.Control { if (!globalVar.LThreeInOrOutputLock && globalVar.fryPotThree.InputMaterialArrivedSingle == 1 && globalVar.LThreePotInputMaterialArrive && LThreeOutputMaterialQuene.Count > 0 && !globalVar.LThreePotOutputRollerArrive) { + Sqlite.GetInstance.Base.Add(new PotThreeStatus { Temperature = FryPotMonitorManage.GetInstance.fryThree.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryThree.HotPower, Speed = FryPotMonitorManage.GetInstance.fryThree.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryThree.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryThree.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryThree.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据 + Sqlite.GetInstance.Save();//保存数据 FryPotThreeRollerTroubleCheck(); if (FryPotThreeAlarm == 1)//炒锅滚筒无故障 { + Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.workflows.Add(new WorkflowModel { id = globalVar.LThreeCurrentCookingStep, Name = LThreeOutputMaterialQuene.ElementAt(0).materialType.MaterialName, isBool = IsBool.Yes }); })); AgvViewModel.GetInstance().Set小车是否承载物品(3, IsBool.No); //炒锅滚筒进料运行到位处理 @@ -1631,48 +1931,48 @@ namespace FryPot_DosingSystem.Control /// /// 炒锅滚筒进料运行到位处理 /// - public void FryPotInputMaterialRollerOperate(ConcurrentQueue queue) - { - switch (queue.ElementAt(0).materialType.MaterialLoc / 100) - { - case 1: - while (globalVar.fryPotOne.InputMaterialArrivedSingle == 0) - { - Thread.Sleep(5); if (globalVar.ExitMainTask) - return; - } - MessageLog.GetInstance.ShowRunLog($"炒锅【1】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break; - case 2: - while (globalVar.fryPotTwo.InputMaterialArrivedSingle == 0) - { - Thread.Sleep(5); if (globalVar.ExitMainTask) - return; - } - MessageLog.GetInstance.ShowRunLog($"炒锅【2】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break; - case 3: - while (globalVar.fryPotThree.InputMaterialArrivedSingle == 0) - { - Thread.Sleep(5); if (globalVar.ExitMainTask) - return; - } - MessageLog.GetInstance.ShowRunLog($"炒锅【3】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break; - case 4: - while (globalVar.fryPotFour.InputMaterialArrivedSingle == 0) - { - Thread.Sleep(5); if (globalVar.ExitMainTask) - return; - } - MessageLog.GetInstance.ShowRunLog($"炒锅【4】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break; - case 5: - while (globalVar.fryPotFive.InputMaterialArrivedSingle == 0) - { - Thread.Sleep(5); if (globalVar.ExitMainTask) - return; - } - MessageLog.GetInstance.ShowRunLog($"炒锅【5】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break; - } + //public void FryPotInputMaterialRollerOperate(ConcurrentQueue queue) + //{ + // switch (queue.ElementAt(0).materialType.MaterialLoc / 100) + // { + // case 1: + // while (globalVar.fryPotOne.InputMaterialArrivedSingle == 0) + // { + // Thread.Sleep(5); if (globalVar.ExitMainTask) + // return; + // } + // MessageLog.GetInstance.ShowRunLog($"炒锅【1】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break; + // case 2: + // while (globalVar.fryPotTwo.InputMaterialArrivedSingle == 0) + // { + // Thread.Sleep(5); if (globalVar.ExitMainTask) + // return; + // } + // MessageLog.GetInstance.ShowRunLog($"炒锅【2】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break; + // case 3: + // while (globalVar.fryPotThree.InputMaterialArrivedSingle == 0) + // { + // Thread.Sleep(5); if (globalVar.ExitMainTask) + // return; + // } + // MessageLog.GetInstance.ShowRunLog($"炒锅【3】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break; + // case 4: + // while (globalVar.fryPotFour.InputMaterialArrivedSingle == 0) + // { + // Thread.Sleep(5); if (globalVar.ExitMainTask) + // return; + // } + // MessageLog.GetInstance.ShowRunLog($"炒锅【4】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break; + // case 5: + // while (globalVar.fryPotFive.InputMaterialArrivedSingle == 0) + // { + // Thread.Sleep(5); if (globalVar.ExitMainTask) + // return; + // } + // MessageLog.GetInstance.ShowRunLog($"炒锅【5】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break; + // } - } + //} /// /// 炒锅1,4滚筒进料运行到位处理 /// @@ -1704,75 +2004,75 @@ namespace FryPot_DosingSystem.Control switch (LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100) { case 2: - while (globalVar.fryPotTwo.InputMaterialArrivedSingle == 0) - { - Thread.Sleep(5); if (globalVar.ExitMainTask) - return; - } + //while (globalVar.fryPotTwo.InputMaterialArrivedSingle == 0) + //{ + // Thread.Sleep(5); if (globalVar.ExitMainTask) + // return; + //} MessageLog.GetInstance.ShowRunLog($"炒锅【2】原料:{LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break; case 5: - while (globalVar.fryPotFive.InputMaterialArrivedSingle == 0) - { - Thread.Sleep(5); if (globalVar.ExitMainTask) - return; - } + //while (globalVar.fryPotFive.InputMaterialArrivedSingle == 0) + //{ + // Thread.Sleep(5); if (globalVar.ExitMainTask) + // return; + //} MessageLog.GetInstance.ShowRunLog($"炒锅【5】原料:{LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break; } } public void FryPotThreeInputMaterialRollerOperate() { - while (globalVar.fryPotThree.InputMaterialArrivedSingle == 0) - { - Thread.Sleep(5); if (globalVar.ExitMainTask) - return; - } + //while (globalVar.fryPotThree.InputMaterialArrivedSingle == 0) + //{ + // Thread.Sleep(5); if (globalVar.ExitMainTask) + // return; + //} MessageLog.GetInstance.ShowRunLog($"炒锅【3】原料:{LThreeOutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); } /// /// 炒锅滚筒空桶出桶处理 /// - public void FryPotOutEmpetyRollerOperate(ConcurrentQueue queue) - { - switch (queue.ElementAt(0).materialType.MaterialLoc / 100) - { - case 1: - while (globalVar.fryPotOne.EmptyBarrelArrivedSingle == 0) - { - Thread.Sleep(5); if (globalVar.ExitMainTask) - return; - } - MessageLog.GetInstance.ShowRunLog($"炒锅【1】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break; - case 2: - while (globalVar.fryPotTwo.EmptyBarrelArrivedSingle == 0) - { - Thread.Sleep(5); if (globalVar.ExitMainTask) - return; - } - MessageLog.GetInstance.ShowRunLog($"炒锅【2】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break; - case 3: - while (globalVar.fryPotThree.EmptyBarrelArrivedSingle == 0) - { - Thread.Sleep(5); if (globalVar.ExitMainTask) - return; - } - MessageLog.GetInstance.ShowRunLog($"炒锅【3】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break; - case 4: - while (globalVar.fryPotFour.EmptyBarrelArrivedSingle == 0) - { - Thread.Sleep(5); if (globalVar.ExitMainTask) - return; - } - MessageLog.GetInstance.ShowRunLog($"炒锅【4】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break; - case 5: - while (globalVar.fryPotFive.EmptyBarrelArrivedSingle == 0) - { - Thread.Sleep(5); if (globalVar.ExitMainTask) - return; - } - MessageLog.GetInstance.ShowRunLog($"炒锅【5】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break; + //public void FryPotOutEmpetyRollerOperate(ConcurrentQueue queue) + //{ + // switch (queue.ElementAt(0).materialType.MaterialLoc / 100) + // { + // case 1: + // while (globalVar.fryPotOne.EmptyBarrelArrivedSingle == 0) + // { + // Thread.Sleep(5); if (globalVar.ExitMainTask) + // return; + // } + // MessageLog.GetInstance.ShowRunLog($"炒锅【1】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break; + // case 2: + // while (globalVar.fryPotTwo.EmptyBarrelArrivedSingle == 0) + // { + // Thread.Sleep(5); if (globalVar.ExitMainTask) + // return; + // } + // MessageLog.GetInstance.ShowRunLog($"炒锅【2】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break; + // case 3: + // while (globalVar.fryPotThree.EmptyBarrelArrivedSingle == 0) + // { + // Thread.Sleep(5); if (globalVar.ExitMainTask) + // return; + // } + // MessageLog.GetInstance.ShowRunLog($"炒锅【3】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break; + // case 4: + // while (globalVar.fryPotFour.EmptyBarrelArrivedSingle == 0) + // { + // Thread.Sleep(5); if (globalVar.ExitMainTask) + // return; + // } + // MessageLog.GetInstance.ShowRunLog($"炒锅【4】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break; + // case 5: + // while (globalVar.fryPotFive.EmptyBarrelArrivedSingle == 0) + // { + // Thread.Sleep(5); if (globalVar.ExitMainTask) + // return; + // } + // MessageLog.GetInstance.ShowRunLog($"炒锅【5】原料:【{queue.ElementAt(0).materialType.MaterialName}】空桶到达出桶位置,正在出桶"); break; - } - } + // } + //} /// /// 炒锅1,4滚筒空桶出桶处理 /// @@ -1804,18 +2104,18 @@ namespace FryPot_DosingSystem.Control switch (LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100) { case 2: - while (globalVar.fryPotTwo.EmptyBarrelArrivedSingle == 0) - { - Thread.Sleep(5); if (globalVar.ExitMainTask) - return; - } + //while (globalVar.fryPotTwo.EmptyBarrelArrivedSingle == 0) + //{ + // Thread.Sleep(5); if (globalVar.ExitMainTask) + // return; + //} MessageLog.GetInstance.ShowRunLog($"炒锅【2】原料:【{LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialName}】空桶上料完成"); break; case 5: - while (globalVar.fryPotFive.EmptyBarrelArrivedSingle == 0) - { - Thread.Sleep(5); if (globalVar.ExitMainTask) - return; - } + //while (globalVar.fryPotFive.EmptyBarrelArrivedSingle == 0) + //{ + // Thread.Sleep(5); if (globalVar.ExitMainTask) + // return; + //} MessageLog.GetInstance.ShowRunLog($"炒锅【5】原料:【{LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialName}】空桶上料完成"); break; } } @@ -1824,11 +2124,11 @@ namespace FryPot_DosingSystem.Control /// public void FryPotThreeOutEmpetyRollerOperate() { - while (globalVar.fryPotThree.EmptyBarrelArrivedSingle == 0) - { - Thread.Sleep(5); if (globalVar.ExitMainTask) - return; - } + //while (globalVar.fryPotThree.EmptyBarrelArrivedSingle == 0) + //{ + // Thread.Sleep(5); if (globalVar.ExitMainTask) + // return; + //} MessageLog.GetInstance.ShowRunLog($"炒锅【3】原料:【{LThreeOutputMaterialQuene.ElementAt(0).materialType.MaterialName}】空桶上料完成"); } /// @@ -2066,7 +2366,7 @@ namespace FryPot_DosingSystem.Control while (AlarmHelper.Alarm.LOneRollerTrouble == 1) { Thread.Sleep(5); - if (globalVar.ExitMainTask) + if (globalVar.ExitLineOneTask) return; } MessageLog.GetInstance.ShowRunLog("线体【1】滚筒故障解除,继续运行"); @@ -2106,7 +2406,7 @@ namespace FryPot_DosingSystem.Control while (AlarmHelper.Alarm.LTwoRollerTrouble == 1) { Thread.Sleep(5); - if (globalVar.ExitMainTask) + if (globalVar.ExitLineTwoTask) return; } MessageLog.GetInstance.ShowRunLog("线体【2】滚筒故障解除,继续运行"); @@ -2146,7 +2446,7 @@ namespace FryPot_DosingSystem.Control while (AlarmHelper.Alarm.LThreeRollerTrouble == 1) { Thread.Sleep(5); - if (globalVar.ExitMainTask) + if (globalVar.ExitLineThreeTask) return; } MessageLog.GetInstance.ShowRunLog("线体【3】滚筒故障解除,继续运行"); @@ -2171,7 +2471,7 @@ namespace FryPot_DosingSystem.Control } else if (errorCode == "Analysis Error") { - MessageLog.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线API调用失败,请检查"); + MessageLog.GetInstance.ShowRunLog($"提示:AGV去{num}号滚筒线API调用失败,请检查请求报文"); } else { @@ -2444,58 +2744,58 @@ namespace FryPot_DosingSystem.Control /// /// 炒锅滚筒信号检测 /// - public void FryPotRollerTroubleCheck() - { - FryPotAlarm = 0; - FryPotTwoAlarm = 0; - FryPotThreeAlarm = 0; - FryPotFourAlarm = 0; - FryPotFiveAlarm = 0; - switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100) - { - case 1: - if (AlarmHelper.Alarm.FryPotOneRollerTrouble == 1) { FryPotAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【1】输送滚筒发生故障"); } else { FryPotAlarm = 1; } while (AlarmHelper.Alarm.FryPotOneRollerTrouble == 1) - { - Thread.Sleep(5); if (globalVar.ExitMainTask) - return; - } - MessageLog.GetInstance.ShowRunLog("炒锅【1】输送滚筒故障解除,继续运行"); - FryPotAlarm = 1; break; - case 2: - if (AlarmHelper.Alarm.FryPotTwoRollerTrouble == 1) { FryPotTwoAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【2】输送滚筒发生故障"); } else { FryPotTwoAlarm = 1; } while (AlarmHelper.Alarm.FryPotTwoRollerTrouble == 1) - { - Thread.Sleep(5); if (globalVar.ExitMainTask) - return; - } - MessageLog.GetInstance.ShowRunLog("炒锅【2】输送滚筒故障解除,继续运行"); - FryPotTwoAlarm = 1; break; - case 3: - if (AlarmHelper.Alarm.FryPotThreeRollerTrouble == 1) { FryPotThreeAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【3】输送滚筒发生故障"); } else { FryPotThreeAlarm = 1; } while (AlarmHelper.Alarm.FryPotThreeRollerTrouble == 1) - { - Thread.Sleep(5); if (globalVar.ExitMainTask) - return; - } - MessageLog.GetInstance.ShowRunLog("炒锅【3】输送滚筒故障解除,继续运行"); - FryPotThreeAlarm = 1; break; - case 4: - if (AlarmHelper.Alarm.FryPotFourRollerTrouble == 1) { FryPotFourAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【4】输送滚筒发生故障"); } else { FryPotFourAlarm = 1; } while (AlarmHelper.Alarm.FryPotFourRollerTrouble == 1) - { - Thread.Sleep(5); if (globalVar.ExitMainTask) - return; - } - MessageLog.GetInstance.ShowRunLog("炒锅【4】输送滚筒故障解除,继续运行"); - FryPotFourAlarm = 1; break; - case 5: - if (AlarmHelper.Alarm.FryPotFiveRollerTrouble == 1) { FryPotFiveAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【5】输送滚筒发生故障"); } else { FryPotFiveAlarm = 1; } while (AlarmHelper.Alarm.FryPotFiveRollerTrouble == 1) - { - Thread.Sleep(5); if (globalVar.ExitMainTask) - return; - } - MessageLog.GetInstance.ShowRunLog("炒锅【5】输送滚筒故障解除,继续运行"); - FryPotFiveAlarm = 1; break; + //public void FryPotRollerTroubleCheck() + //{ + // FryPotAlarm = 0; + // FryPotTwoAlarm = 0; + // FryPotThreeAlarm = 0; + // FryPotFourAlarm = 0; + // FryPotFiveAlarm = 0; + // switch (OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc / 100) + // { + // case 1: + // if (AlarmHelper.Alarm.FryPotOneRollerTrouble == 1) { FryPotAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【1】输送滚筒发生故障"); } else { FryPotAlarm = 1; } while (AlarmHelper.Alarm.FryPotOneRollerTrouble == 1) + // { + // Thread.Sleep(5); if (globalVar.ExitMainTask) + // return; + // } + // MessageLog.GetInstance.ShowRunLog("炒锅【1】输送滚筒故障解除,继续运行"); + // FryPotAlarm = 1; break; + // case 2: + // if (AlarmHelper.Alarm.FryPotTwoRollerTrouble == 1) { FryPotTwoAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【2】输送滚筒发生故障"); } else { FryPotTwoAlarm = 1; } while (AlarmHelper.Alarm.FryPotTwoRollerTrouble == 1) + // { + // Thread.Sleep(5); if (globalVar.ExitMainTask) + // return; + // } + // MessageLog.GetInstance.ShowRunLog("炒锅【2】输送滚筒故障解除,继续运行"); + // FryPotTwoAlarm = 1; break; + // case 3: + // if (AlarmHelper.Alarm.FryPotThreeRollerTrouble == 1) { FryPotThreeAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【3】输送滚筒发生故障"); } else { FryPotThreeAlarm = 1; } while (AlarmHelper.Alarm.FryPotThreeRollerTrouble == 1) + // { + // Thread.Sleep(5); if (globalVar.ExitMainTask) + // return; + // } + // MessageLog.GetInstance.ShowRunLog("炒锅【3】输送滚筒故障解除,继续运行"); + // FryPotThreeAlarm = 1; break; + // case 4: + // if (AlarmHelper.Alarm.FryPotFourRollerTrouble == 1) { FryPotFourAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【4】输送滚筒发生故障"); } else { FryPotFourAlarm = 1; } while (AlarmHelper.Alarm.FryPotFourRollerTrouble == 1) + // { + // Thread.Sleep(5); if (globalVar.ExitMainTask) + // return; + // } + // MessageLog.GetInstance.ShowRunLog("炒锅【4】输送滚筒故障解除,继续运行"); + // FryPotFourAlarm = 1; break; + // case 5: + // if (AlarmHelper.Alarm.FryPotFiveRollerTrouble == 1) { FryPotFiveAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【5】输送滚筒发生故障"); } else { FryPotFiveAlarm = 1; } while (AlarmHelper.Alarm.FryPotFiveRollerTrouble == 1) + // { + // Thread.Sleep(5); if (globalVar.ExitMainTask) + // return; + // } + // MessageLog.GetInstance.ShowRunLog("炒锅【5】输送滚筒故障解除,继续运行"); + // FryPotFiveAlarm = 1; break; - } - } + // } + //} /// /// 炒锅1,4滚筒信号检测 /// @@ -2508,7 +2808,7 @@ namespace FryPot_DosingSystem.Control case 1: if (AlarmHelper.Alarm.FryPotOneRollerTrouble == 1) { FryPotAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【1】输送滚筒发生故障"); } else { FryPotAlarm = 1; return; } while (AlarmHelper.Alarm.FryPotOneRollerTrouble == 1) { - Thread.Sleep(5); if (globalVar.ExitMainTask) + Thread.Sleep(5); if (globalVar.ExitLineOneTask) return; } MessageLog.GetInstance.ShowRunLog("炒锅【1】输送滚筒故障解除,继续运行"); @@ -2516,7 +2816,7 @@ namespace FryPot_DosingSystem.Control case 4: if (AlarmHelper.Alarm.FryPotFourRollerTrouble == 1) { FryPotFourAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【4】输送滚筒发生故障"); } else { FryPotFourAlarm = 1; return; } while (AlarmHelper.Alarm.FryPotFourRollerTrouble == 1) { - Thread.Sleep(5); if (globalVar.ExitMainTask) + Thread.Sleep(5); if (globalVar.ExitLineOneTask) return; } MessageLog.GetInstance.ShowRunLog("炒锅【4】输送滚筒故障解除,继续运行"); @@ -2536,7 +2836,7 @@ namespace FryPot_DosingSystem.Control case 2: if (AlarmHelper.Alarm.FryPotTwoRollerTrouble == 1) { FryPotTwoAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【1】输送滚筒发生故障"); } else { FryPotTwoAlarm = 1; return; } while (AlarmHelper.Alarm.FryPotTwoRollerTrouble == 1) { - Thread.Sleep(5); if (globalVar.ExitMainTask) + Thread.Sleep(5); if (globalVar.ExitLineTwoTask) return; } MessageLog.GetInstance.ShowRunLog("炒锅【1】输送滚筒故障解除,继续运行"); @@ -2544,7 +2844,7 @@ namespace FryPot_DosingSystem.Control case 5: if (AlarmHelper.Alarm.FryPotFiveRollerTrouble == 1) { FryPotFiveAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【4】输送滚筒发生故障"); } else { FryPotFiveAlarm = 1; return; } while (AlarmHelper.Alarm.FryPotFiveRollerTrouble == 1) { - Thread.Sleep(5); if (globalVar.ExitMainTask) + Thread.Sleep(5); if (globalVar.ExitLineTwoTask) return; } MessageLog.GetInstance.ShowRunLog("炒锅【4】输送滚筒故障解除,继续运行"); @@ -2559,7 +2859,7 @@ namespace FryPot_DosingSystem.Control FryPotThreeAlarm = 0; if (AlarmHelper.Alarm.FryPotThreeRollerTrouble == 1) { FryPotThreeAlarm = -1; MessageLog.GetInstance.ShowRunLog("警告:炒锅【3】输送滚筒发生故障"); } else { FryPotThreeAlarm = 1; return; } while (AlarmHelper.Alarm.FryPotThreeRollerTrouble == 1) { - Thread.Sleep(5); if (globalVar.ExitMainTask) + Thread.Sleep(5); if (globalVar.ExitLineThreeTask) return; } MessageLog.GetInstance.ShowRunLog("炒锅【3】输送滚筒故障解除,继续运行"); diff --git a/FryPot_DosingSystem/Control/GlobalVariable.cs b/FryPot_DosingSystem/Control/GlobalVariable.cs index 4a4d7a61..1e149760 100644 --- a/FryPot_DosingSystem/Control/GlobalVariable.cs +++ b/FryPot_DosingSystem/Control/GlobalVariable.cs @@ -59,9 +59,17 @@ namespace FryPot_DosingSystem.Control public ushort PlcInite { get; set; } #region 上位机内部逻辑条件 /// - /// 退出主任务循环 + /// 退出线体1任务 /// - public bool ExitMainTask { get; set; } + public bool ExitLineOneTask { get; set; } + /// + /// 退出线体2任务 + /// + public bool ExitLineTwoTask { get; set; } + /// + /// 退出线体3任务 + /// + public bool ExitLineThreeTask { get; set; } /// /// 允许AGV去线体1装桶条件 /// @@ -74,10 +82,10 @@ namespace FryPot_DosingSystem.Control /// 允许AGV去线体3装桶条件 /// public bool AllowAgvToLineThreeLoadRoller { get; set; } = true; - /// - /// 配方唯一ID - /// - public string RecipeId { get; set; } + ///// + ///// 配方唯一ID + ///// + //public string RecipeId { get; set; } /// /// 线体1对应的进桶出桶互锁 /// @@ -90,18 +98,18 @@ namespace FryPot_DosingSystem.Control /// 线体3对应的进桶出桶互锁 /// public bool LThreeInOrOutputLock { get; set; } - /// - /// 线体1任务执行锁 - /// - public bool LOneTaskLock { get; set; } - /// - /// 线体2任务执行锁 - /// - public bool LTwoTaskLock { get; set; } - /// - /// 线体3任务执行锁 - /// - public bool LThreeTaskLock { get; set; } + ///// + ///// 线体1任务执行锁 + ///// + //public bool LOneTaskLock { get; set; } + ///// + ///// 线体2任务执行锁 + ///// + //public bool LTwoTaskLock { get; set; } + ///// + ///// 线体3任务执行锁 + ///// + //public bool LThreeTaskLock { get; set; } /// /// 线体1当前正在制作的配方名称 /// @@ -146,31 +154,31 @@ namespace FryPot_DosingSystem.Control public bool LThreeAgvArrivePot { get; set; } #endregion #region AGV视图显示变量 - public int LOneMaterialNum = 0; - public int LOneFryPotSerial = 1; - public int LOneCurrentCookingStep = 0; - public bool agvArriveUpLoad; - public bool agvArriveUnLoad; - public bool agvFryPotEmptyRollerArrive; + public int LOneMaterialNum { get; set; } = 0; + public int LOneFryPotSerial { get; set; } = 1; + public int LOneCurrentCookingStep { get; set; } = 0; + public bool agvArriveUpLoad { get; set; } + public bool agvArriveUnLoad { get; set; } + public bool agvFryPotEmptyRollerArrive { get; set; } public bool EmptyRollerUnLoadcCom { get; set; }//AGV空桶4号线体下料完成 - public int LTwoMaterialNum = 0; - public int LTwoFryPotSerial = 2; - public int LTwoCurrentCookingStep = 0; - public bool agvArriveLTwoUpLoad; - public bool LTwoagvArriveUnLoad; - public bool LTwoagvFryPotEmptyRollerArrive; + public int LTwoMaterialNum { get; set; } = 0; + public int LTwoFryPotSerial { get; set; } = 2; + public int LTwoCurrentCookingStep { get; set; } = 0; + public bool agvArriveLTwoUpLoad { get; set; } + public bool LTwoagvArriveUnLoad { get; set; } + public bool LTwoagvFryPotEmptyRollerArrive { get; set; } public bool LTwoEmptyRollerUnLoadcCom { get; set; }//AGV空桶4号线体下料完成 - public int LThreeMaterialNum = 0; - public int LThreeFryPotSerial = 3; - public int LThreeCurrentCookingStep = 0; - public bool agvArriveLThreeUpLoad; - public bool LThreeagvArriveUnLoad; - public bool LThreeagvFryPotEmptyRollerArrive; + public int LThreeMaterialNum { get; set; } = 0; + public int LThreeFryPotSerial { get; set; } = 3; + public int LThreeCurrentCookingStep { get; set; } = 0; + public bool agvArriveLThreeUpLoad { get; set; } + public bool LThreeagvArriveUnLoad { get; set; } + public bool LThreeagvFryPotEmptyRollerArrive { get; set; } public bool LThreeEmptyRollerUnLoadcCom { get; set; }//AGV空桶4号线体下料完成 - public int LFourRollerNum = 0; + public int LFourRollerNum { get; set; } = 0; #endregion } /// @@ -374,6 +382,8 @@ namespace FryPot_DosingSystem.Control /// 当前线体配方完成信号 /// public ushort RecipeCompleteSingle { get; set; } + + } /// /// 炒锅1相关变量 @@ -400,6 +410,15 @@ namespace FryPot_DosingSystem.Control /// 滚筒故障信号 /// public ushort RollerTroubleSingle { get; set; } + + /// + /// 用油量确认信号 + /// + public ushort OilConfirm { get; set; } + /// + /// 当前配方用油量 + /// + public double OilCapacity { get; set; } } /// /// 炒锅2相关变量 @@ -426,6 +445,14 @@ namespace FryPot_DosingSystem.Control /// 滚筒故障信号 /// public ushort RollerTroubleSingle { get; set; } + /// + /// 用油量确认信号 + /// + public ushort OilConfirm { get; set; } + /// + /// 当前配方用油量 + /// + public double OilCapacity { get; set; } } /// /// 炒锅3相关变量 @@ -452,6 +479,14 @@ namespace FryPot_DosingSystem.Control /// 滚筒故障信号 /// public ushort RollerTroubleSingle { get; set; } + /// + /// 用油量确认信号 + /// + public ushort OilConfirm { get; set; } + /// + /// 当前配方用油量 + /// + public double OilCapacity { get; set; } } /// /// 炒锅4相关变量 @@ -478,6 +513,14 @@ namespace FryPot_DosingSystem.Control /// 滚筒故障信号 /// public ushort RollerTroubleSingle { get; set; } + /// + /// 用油量确认信号 + /// + public ushort OilConfirm { get; set; } + /// + /// 当前配方用油量 + /// + public double OilCapacity { get; set; } } /// /// 炒锅5相关变量 @@ -504,5 +547,13 @@ namespace FryPot_DosingSystem.Control /// 滚筒故障信号 /// public ushort RollerTroubleSingle { get; set; } + /// + /// 用油量确认信号 + /// + public ushort OilConfirm { get; set; } + /// + /// 当前配方用油量 + /// + public double OilCapacity { get; set; } } } diff --git a/FryPot_DosingSystem/FryPotStatus/PotFiveStatus.cs b/FryPot_DosingSystem/FryPotStatus/PotFiveStatus.cs new file mode 100644 index 00000000..84892c28 --- /dev/null +++ b/FryPot_DosingSystem/FryPotStatus/PotFiveStatus.cs @@ -0,0 +1,76 @@ +using FryPot_DosingSystem.Attributes; +using Microsoft.Toolkit.Mvvm.ComponentModel; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FryPot_DosingSystem.FryPotStatus +{ + [Table("TbfryPotFive")] + internal class PotFiveStatus:ObservableObject + { + [Key] + [Column("Id")] + [DatabaseGenerated(DatabaseGeneratedOption.Identity)]//自增 + public int Id { get; set; } + [Column("Temperature")] + [Variable("FryPotFiveTemp","5号炒锅温度","","")] + /// + /// 温度 + /// + public double? Temperature { get { return temperature; } set { temperature = value; OnPropertyChanged(); } } + private double? temperature=0; + [Column("HotPower")] + [Variable("FryPotFivePower", "5号炒锅火力", "", "")] + /// + /// 火力 + /// + public string? HotPower { get { return hotPower; } set { hotPower = value; OnPropertyChanged(); } } + private string? hotPower="0"; + [Column("Speed")] + [Variable("FryPotFiveSpeed", "5号炒锅搅拌速度", "", "")] + /// + /// 搅拌速度 + /// + public double? Speed { get { return speed; } set { speed = value; OnPropertyChanged(); } } + private double? speed=0; + [Column("FryPotWeight")] + [Variable("FryPotFiveWeight", "5号炒锅载重", "", "")] + /// + /// 炒锅重量 + /// + public double? FryPotWeight { get { return fryPotWeight; } set { fryPotWeight = value; OnPropertyChanged(); } } + private double? fryPotWeight=0; + [Column("OilCapacity")] + [Variable("FryPotFiveOil", "5号炒锅当前配方用油量", "", "")] + /// + /// 单次配方用油量 + /// + public double? OilCapacity { get { return oilCapacity; } set { oilCapacity = value; OnPropertyChanged(); } } + private double? oilCapacity=0; + [Column("TotalOilCapactiy")] + [Variable("FryPotFiveTotalOil", "5号炒锅总用油量", "", "")] + /// + /// 一天总用油量 + /// + public double? TotalOilCapactiy { get { return totalOilCapactiy; } set { totalOilCapactiy = value; OnPropertyChanged(); } } + private double? totalOilCapactiy=0; + + [Column("TotalProduct")] + [Variable("FryPotFiveTotalProduct", "5号炒锅总产量", "", "")] + /// + /// 一天配方生产总量 + /// + public int? TotalProduct { get { return totalProduct; } set { totalProduct = value; OnPropertyChanged(); } } + private int? totalProduct=0; + [Column("Time")] + /// + /// 时间 + /// + public string Time { get; set; } = DateTime.Now.ToShortTimeString(); + } +} diff --git a/FryPot_DosingSystem/FryPotStatus/PotFourStatus.cs b/FryPot_DosingSystem/FryPotStatus/PotFourStatus.cs new file mode 100644 index 00000000..83b057b6 --- /dev/null +++ b/FryPot_DosingSystem/FryPotStatus/PotFourStatus.cs @@ -0,0 +1,76 @@ +using FryPot_DosingSystem.Attributes; +using Microsoft.Toolkit.Mvvm.ComponentModel; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FryPot_DosingSystem.FryPotStatus +{ + [Table("TbfryPotOne")] + internal class PotFourStatus:ObservableObject + { + [Key] + [Column("Id")] + [DatabaseGenerated(DatabaseGeneratedOption.Identity)]//自增 + public int Id { get; set; } + [Column("Temperature")] + [Variable("FryPotFourTemp", "4号炒锅温度", "", "")] + /// + /// 温度 + /// + public double? Temperature { get { return temperature; } set { temperature = value; OnPropertyChanged(); } } + private double? temperature=0; + [Column("HotPower")] + [Variable("FryPotFourPower", "4号炒锅火力", "", "")] + /// + /// 火力 + /// + public string? HotPower { get { return hotPower; } set { hotPower = value; OnPropertyChanged(); } } + private string? hotPower="0"; + [Column("Speed")] + [Variable("FryPotFourSpeed", "4号炒锅搅拌速度", "", "")] + /// + /// 搅拌速度 + /// + public double? Speed { get { return speed; } set { speed = value; OnPropertyChanged(); } } + private double? speed=0; + [Column("FryPotWeight")] + [Variable("FryPotFourWeight", "4号炒锅载重", "", "")] + /// + /// 炒锅重量 + /// + public double? FryPotWeight { get { return fryPotWeight; } set { fryPotWeight = value; OnPropertyChanged(); } } + private double? fryPotWeight=0; + [Column("OilCapacity")] + [Variable("FryPotFourOil", "4号炒锅当前配方用油量", "", "")] + /// + /// 单次配方用油量 + /// + public double? OilCapacity { get { return oilCapacity; } set { oilCapacity = value; OnPropertyChanged(); } } + private double? oilCapacity=0; + [Column("TotalOilCapactiy")] + [Variable("FryPotFourTotalOil", "4号炒锅总用油量", "", "")] + /// + /// 一天总用油量 + /// + public double? TotalOilCapactiy { get { return totalOilCapactiy; } set { totalOilCapactiy = value; OnPropertyChanged(); } } + private double? totalOilCapactiy=0; + + [Column("TotalProduct")] + [Variable("FryPotFourTotalProduct", "4号炒锅总产量", "", "")] + /// + /// 一天配方生产总量 + /// + public int? TotalProduct { get { return totalProduct; } set { totalProduct = value; OnPropertyChanged(); } } + private int? totalProduct=0; + [Column("Time")] + /// + /// 时间 + /// + public string Time { get; set; } = DateTime.Now.ToShortTimeString(); + } +} diff --git a/FryPot_DosingSystem/FryPotStatus/PotOneStatus.cs b/FryPot_DosingSystem/FryPotStatus/PotOneStatus.cs new file mode 100644 index 00000000..a445f143 --- /dev/null +++ b/FryPot_DosingSystem/FryPotStatus/PotOneStatus.cs @@ -0,0 +1,76 @@ +using FryPot_DosingSystem.Attributes; +using Microsoft.Toolkit.Mvvm.ComponentModel; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FryPot_DosingSystem.FryPotStatus +{ + [Table("TbfryPotOne")] + internal class PotOneStatus:ObservableObject + { + [Key] + [Column("Id")] + [DatabaseGenerated(DatabaseGeneratedOption.Identity)]//自增 + public int Id { get; set; } + [Column("Temperature")] + [Variable("FryPotOneTemp", "1号炒锅温度", "", "")] + /// + /// 温度 + /// + public double? Temperature { get { return temperature; } set { temperature = value; OnPropertyChanged(); } } + private double? temperature=0; + [Column("HotPower")] + [Variable("FryPotOnePower", "1号炒锅火力", "", "")] + /// + /// 火力 + /// + public string? HotPower { get { return hotPower; } set { hotPower = value; OnPropertyChanged(); } } + private string? hotPower="0"; + [Column("Speed")] + [Variable("FryPotOneSpeed", "1号炒锅搅拌速度", "", "")] + /// + /// 搅拌速度 + /// + public double? Speed { get { return speed; } set { speed = value; OnPropertyChanged(); } } + private double? speed = 0; + [Column("FryPotWeight")] + [Variable("FryPotOneWeight", "1号炒锅载重", "", "")] + /// + /// 炒锅重量 + /// + public double? FryPotWeight { get { return fryPotWeight; } set { fryPotWeight = value; OnPropertyChanged(); } } + private double? fryPotWeight = 0; + [Column("OilCapacity")] + [Variable("FryPotOneOil", "1号炒锅当前配方用油量", "", "")] + /// + /// 单次配方用油量 + /// + public double? OilCapacity { get { return oilCapacity; } set { oilCapacity = value; OnPropertyChanged(); } } + private double? oilCapacity = 0; + [Column("TotalOilCapactiy")] + [Variable("FryPotOneTotalOil", "1号炒锅总用油量", "", "")] + /// + /// 一天总用油量 + /// + public double? TotalOilCapactiy { get { return totalOilCapactiy; } set { totalOilCapactiy = value; OnPropertyChanged(); } } + private double? totalOilCapactiy = 0; + + [Column("TotalProduct")] + [Variable("FryPotOneTotalProduct", "1号炒锅总产量", "", "")] + /// + /// 一天配方生产总量 + /// + public int? TotalProduct { get { return totalProduct; } set { totalProduct = value; OnPropertyChanged(); } } + private int? totalProduct = 0; + [Column("Time")] + /// + /// 时间 + /// + public string Time { get; set; } = DateTime.Now.ToShortTimeString(); + } +} diff --git a/FryPot_DosingSystem/FryPotStatus/PotThreeStatus.cs b/FryPot_DosingSystem/FryPotStatus/PotThreeStatus.cs new file mode 100644 index 00000000..eea023e3 --- /dev/null +++ b/FryPot_DosingSystem/FryPotStatus/PotThreeStatus.cs @@ -0,0 +1,76 @@ +using FryPot_DosingSystem.Attributes; +using Microsoft.Toolkit.Mvvm.ComponentModel; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FryPot_DosingSystem.FryPotStatus +{ + [Table("TbfryPotThree")] + internal class PotThreeStatus:ObservableObject + { + [Key] + [Column("Id")] + [DatabaseGenerated(DatabaseGeneratedOption.Identity)]//自增 + public int Id { get; set; } + [Column("Temperature")] + [Variable("FryPotThreeTemp", "3号炒锅温度", "", "")] + /// + /// 温度 + /// + public double? Temperature { get { return temperature; } set { temperature = value; OnPropertyChanged(); } } + private double? temperature=0; + [Column("HotPower")] + [Variable("FryPotThreePower", "3号炒锅火力", "", "")] + /// + /// 火力 + /// + public string? HotPower { get { return hotPower; } set { hotPower = value; OnPropertyChanged(); } } + private string? hotPower="0"; + [Column("Speed")] + [Variable("FryPotThreeSpeed", "3号炒锅搅拌速度", "", "")] + /// + /// 搅拌速度 + /// + public double? Speed { get { return speed; } set { speed = value; OnPropertyChanged(); } } + private double? speed=0; + [Column("FryPotWeight")] + [Variable("FryPotThreeWeight", "3号炒锅载重", "", "")] + /// + /// 炒锅重量 + /// + public double? FryPotWeight { get { return fryPotWeight; } set { fryPotWeight = value; OnPropertyChanged(); } } + private double? fryPotWeight=0; + [Column("OilCapacity")] + [Variable("FryPotThreeOil", "3号炒锅当前配方用油量", "", "")] + /// + /// 单次配方用油量 + /// + public double? OilCapacity { get { return oilCapacity; } set { oilCapacity = value; OnPropertyChanged(); } } + private double? oilCapacity=0; + [Column("TotalOilCapactiy")] + [Variable("FryPotThreeTotalOil", "3号炒锅总用油量", "", "")] + /// + /// 一天总用油量 + /// + public double? TotalOilCapactiy { get { return totalOilCapactiy; } set { totalOilCapactiy = value; OnPropertyChanged(); } } + private double? totalOilCapactiy=0; + + [Column("TotalProduct")] + [Variable("FryPotThreeTotalProduct", "3号炒锅总产量", "", "")] + /// + /// 一天配方生产总量 + /// + public int? TotalProduct { get { return totalProduct; } set { totalProduct = value; OnPropertyChanged(); } } + private int? totalProduct=0; + [Column("Time")] + /// + /// 时间 + /// + public string Time { get; set; } = DateTime.Now.ToShortTimeString(); + } +} diff --git a/FryPot_DosingSystem/FryPotStatus/PotTwoStatus.cs b/FryPot_DosingSystem/FryPotStatus/PotTwoStatus.cs new file mode 100644 index 00000000..458cadea --- /dev/null +++ b/FryPot_DosingSystem/FryPotStatus/PotTwoStatus.cs @@ -0,0 +1,76 @@ +using FryPot_DosingSystem.Attributes; +using Microsoft.Toolkit.Mvvm.ComponentModel; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FryPot_DosingSystem.FryPotStatus +{ + [Table("TbfryPotTwo")] + internal class PotTwoStatus:ObservableObject + { + [Key] + [Column("Id")] + [DatabaseGenerated(DatabaseGeneratedOption.Identity)]//自增 + public int Id { get; set; } + [Column("Temperature")] + [Variable("FryPotTwoTemp", "2号炒锅温度", "", "")] + /// + /// 温度 + /// + public double? Temperature { get { return temperature; } set { temperature = value; OnPropertyChanged(); } } + private double? temperature=0; + [Column("HotPower")] + [Variable("FryPotTwoPower", "2号炒锅火力", "", "")] + /// + /// 火力 + /// + public string? HotPower { get { return hotPower; } set { hotPower = value; OnPropertyChanged(); } } + private string? hotPower="0"; + [Column("Speed")] + [Variable("FryPotTwoSpeed", "2号炒锅搅拌速度", "", "")] + /// + /// 搅拌速度 + /// + public double? Speed { get { return speed; } set { speed = value; OnPropertyChanged(); } } + private double? speed=0; + [Column("FryPotWeight")] + [Variable("FryPotTwoWeight", "2号炒锅载重", "", "")] + /// + /// 炒锅重量 + /// + public double? FryPotWeight { get { return fryPotWeight; } set { fryPotWeight = value; OnPropertyChanged(); } } + private double? fryPotWeight=0; + [Column("OilCapacity")] + [Variable("FryPotTwoOil", "2号炒锅当前配方用油量", "", "")] + /// + /// 单次配方用油量 + /// + public double? OilCapacity { get { return oilCapacity; } set { oilCapacity = value; OnPropertyChanged(); } } + private double? oilCapacity=0; + [Column("TotalOilCapactiy")] + [Variable("FryPotTwoTotalOil", "2号炒锅总用油量", "", "")] + /// + /// 一天总用油量 + /// + public double? TotalOilCapactiy { get { return totalOilCapactiy; } set { totalOilCapactiy = value; OnPropertyChanged(); } } + private double? totalOilCapactiy=0; + + [Column("TotalProduct")] + [Variable("FryPotTwoTotalProduct", "2号炒锅总产量", "", "")] + /// + /// 一天配方生产总量 + /// + public int? TotalProduct { get { return totalProduct; } set { totalProduct = value; OnPropertyChanged(); } } + private int? totalProduct=0; + [Column("Time")] + /// + /// 时间 + /// + public string Time { get; set; } = DateTime.Now.ToShortTimeString(); + } +} diff --git a/FryPot_DosingSystem/Model/FryPotInfoManage.cs b/FryPot_DosingSystem/Model/FryPotInfoManage.cs new file mode 100644 index 00000000..4dd7dc50 --- /dev/null +++ b/FryPot_DosingSystem/Model/FryPotInfoManage.cs @@ -0,0 +1,77 @@ +using FryPot_DosingSystem.Attributes; +using Microsoft.Toolkit.Mvvm.ComponentModel; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; + +namespace FryPot_DosingSystem.Model +{ + internal class FryPotInfoManage:ObservableObject + { + public static FryPotInfoManage GetInstance => _instance ?? (_instance = new FryPotInfoManage()); + private static FryPotInfoManage _instance; + public int id { get; set; } + public ObservableCollection variableInfos { get; set; } = new ObservableCollection(); + public FryPotInfoManage() + { + if (variableInfos.Count > 0) + { + variableInfos.Clear(); + } + PropertyInfo[] pros = FryPotMonitorManage.GetInstance.fryOne.GetType().GetProperties(); + foreach (var item in pros) + { + var monitor = item.GetCustomAttribute(); + if (monitor != null) + { + variableInfos.Add(new VariableMonitorModel { Id = id + 1, VarName = monitor.VarName, PLCAddress = monitor.PLCAddress, Notes = monitor.Notes, ModbusTcpAddress = monitor.ModbusTcpAddress }); + id++; + } + } + PropertyInfo[] pros2 = FryPotMonitorManage.GetInstance.fryTwo.GetType().GetProperties(); + foreach (var item in pros2) + { + var monitor = item.GetCustomAttribute(); + if (monitor != null) + { + variableInfos.Add(new VariableMonitorModel { Id = id + 1, VarName = monitor.VarName, PLCAddress = monitor.PLCAddress, Notes = monitor.Notes, ModbusTcpAddress = monitor.ModbusTcpAddress }); + id++; + } + } + PropertyInfo[] pros3 = FryPotMonitorManage.GetInstance.fryThree.GetType().GetProperties(); + foreach (var item in pros3) + { + var monitor = item.GetCustomAttribute(); + if (monitor != null) + { + variableInfos.Add(new VariableMonitorModel { Id = id + 1, VarName = monitor.VarName, PLCAddress = monitor.PLCAddress, Notes = monitor.Notes, ModbusTcpAddress = monitor.ModbusTcpAddress }); + id++; + } + } + PropertyInfo[] pros4 = FryPotMonitorManage.GetInstance.fryFour.GetType().GetProperties(); + foreach (var item in pros4) + { + var monitor = item.GetCustomAttribute(); + if (monitor != null) + { + variableInfos.Add(new VariableMonitorModel { Id = id + 1, VarName = monitor.VarName, PLCAddress = monitor.PLCAddress, Notes = monitor.Notes, ModbusTcpAddress = monitor.ModbusTcpAddress }); + id++; + } + } + PropertyInfo[] pros5 = FryPotMonitorManage.GetInstance.fryFive.GetType().GetProperties(); + foreach (var item in pros5) + { + var monitor = item.GetCustomAttribute(); + if (monitor != null) + { + variableInfos.Add(new VariableMonitorModel { Id = id + 1, VarName = monitor.VarName, PLCAddress = monitor.PLCAddress, Notes = monitor.Notes, ModbusTcpAddress = monitor.ModbusTcpAddress }); + id++; + } + } + } + } +} diff --git a/FryPot_DosingSystem/Model/FryPotMonitorManage.cs b/FryPot_DosingSystem/Model/FryPotMonitorManage.cs new file mode 100644 index 00000000..6d1c4053 --- /dev/null +++ b/FryPot_DosingSystem/Model/FryPotMonitorManage.cs @@ -0,0 +1,29 @@ +using FryPot_DosingSystem.FryPotStatus; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FryPot_DosingSystem.Model +{ + internal class FryPotMonitorManage + { + public static FryPotMonitorManage GetInstance=>_instance ?? (_instance = new FryPotMonitorManage()); + private static FryPotMonitorManage _instance; + public PotOneStatus fryOne; + public PotTwoStatus fryTwo; + public PotThreeStatus fryThree; + public PotFourStatus fryFour; + public PotFiveStatus fryFive; + public FryPotMonitorManage() + { + fryOne = new PotOneStatus(); + fryTwo = new PotTwoStatus(); + fryThree = new PotThreeStatus(); + fryFour = new PotFourStatus(); + fryFive = new PotFiveStatus(); + } + + } +} diff --git a/FryPot_DosingSystem/Model/Global.cs b/FryPot_DosingSystem/Model/Global.cs index 313ac728..7413fe14 100644 --- a/FryPot_DosingSystem/Model/Global.cs +++ b/FryPot_DosingSystem/Model/Global.cs @@ -1,4 +1,5 @@ -using System; + +using System; using System.Collections.Generic; using System.Linq; using System.Text; diff --git a/FryPot_DosingSystem/Model/VariableMonitorModel.cs b/FryPot_DosingSystem/Model/VariableMonitorModel.cs new file mode 100644 index 00000000..ee0794d9 --- /dev/null +++ b/FryPot_DosingSystem/Model/VariableMonitorModel.cs @@ -0,0 +1,34 @@ +using Microsoft.Toolkit.Mvvm.ComponentModel; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FryPot_DosingSystem.Model +{ + internal class VariableMonitorModel:ObservableObject + { + public int Id { get { return _mId; } set { _mId = value; OnPropertyChanged(); } } + private int _mId; + + + public string VarName { get { return _mVarName; } set { _mVarName = value; OnPropertyChanged(); } } + private string _mVarName; + + + public string PLCAddress { get { return _mPLCAddress; } set { _mPLCAddress = value; OnPropertyChanged(); } } + private string _mPLCAddress; + + + public string Notes { get { return _mNotes; } set { _mNotes = value; OnPropertyChanged(); } } + private string _mNotes; + + + public string ModbusTcpAddress { get { return _mModbusTcpAddress; } set { _mModbusTcpAddress = value; OnPropertyChanged(); } } + private string _mModbusTcpAddress; + + public string CurrentValue { get { return _currentValue; }set { _currentValue = value;OnPropertyChanged(); } } + private string _currentValue; + } +} diff --git a/FryPot_DosingSystem/View/DebugView.xaml b/FryPot_DosingSystem/View/DebugView.xaml index 24afcb6c..3d6e0550 100644 --- a/FryPot_DosingSystem/View/DebugView.xaml +++ b/FryPot_DosingSystem/View/DebugView.xaml @@ -39,6 +39,7 @@ @@ -48,6 +49,7 @@ @@ -79,6 +82,7 @@ diff --git a/FryPot_DosingSystem/View/FryPotMonitorView.xaml b/FryPot_DosingSystem/View/FryPotMonitorView.xaml new file mode 100644 index 00000000..7b040438 --- /dev/null +++ b/FryPot_DosingSystem/View/FryPotMonitorView.xaml @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/FryPot_DosingSystem/View/FryPotMonitorView.xaml.cs b/FryPot_DosingSystem/View/FryPotMonitorView.xaml.cs new file mode 100644 index 00000000..25532848 --- /dev/null +++ b/FryPot_DosingSystem/View/FryPotMonitorView.xaml.cs @@ -0,0 +1,29 @@ +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 FryPot_DosingSystem.View +{ + /// + /// FryPotMonitorView.xaml 的交互逻辑 + /// + public partial class FryPotMonitorView : UserControl + { + public FryPotMonitorView() + { + InitializeComponent(); + + } + } +} diff --git a/FryPot_DosingSystem/View/SqliteDataView.xaml b/FryPot_DosingSystem/View/SqliteDataView.xaml new file mode 100644 index 00000000..ea38c41c --- /dev/null +++ b/FryPot_DosingSystem/View/SqliteDataView.xaml @@ -0,0 +1,702 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/FryPot_DosingSystem/View/SqliteDataView.xaml.cs b/FryPot_DosingSystem/View/SqliteDataView.xaml.cs new file mode 100644 index 00000000..04b5bbf5 --- /dev/null +++ b/FryPot_DosingSystem/View/SqliteDataView.xaml.cs @@ -0,0 +1,30 @@ +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 FryPot_DosingSystem.View +{ + /// + /// SqliteDataView.xaml 的交互逻辑 + /// + public partial class SqliteDataView : UserControl + { + public SqliteDataView() + { + InitializeComponent(); + } + + + } +} diff --git a/FryPot_DosingSystem/View/UserManageView.xaml b/FryPot_DosingSystem/View/UserManageView.xaml index 17a40b16..21955a15 100644 --- a/FryPot_DosingSystem/View/UserManageView.xaml +++ b/FryPot_DosingSystem/View/UserManageView.xaml @@ -42,17 +42,17 @@ - - + + @@ -245,7 +247,7 @@ - + @@ -282,8 +284,8 @@ - - + + @@ -318,12 +320,12 @@ - - + + @@ -345,8 +347,8 @@ - --> - + + + - --> + @@ -377,12 +379,12 @@ - + @@ -406,9 +408,9 @@ + CommandParameter="{Binding UserName}" Template="{DynamicResource ButtonTemplate1}" Style="{StaticResource btnStyle}" Foreground="Cyan" Content="Save" Margin="5,0"> - + diff --git a/FryPot_DosingSystem/ViewModel/DebugViewModel.cs b/FryPot_DosingSystem/ViewModel/DebugViewModel.cs index d7191cb5..b829d119 100644 --- a/FryPot_DosingSystem/ViewModel/DebugViewModel.cs +++ b/FryPot_DosingSystem/ViewModel/DebugViewModel.cs @@ -21,6 +21,7 @@ namespace FryPot_DosingSystem.ViewModel public RelayCommand EightWorkLoc { get; set; } public RelayCommand FryPotInputArrive { get; set; } public RelayCommand FryPotEmptyRollerArrive { get; set; } + public RelayCommand LineOneTaskExit { get; set; } public RelayCommand AGVLOneArrive { get; set; } @@ -33,6 +34,7 @@ namespace FryPot_DosingSystem.ViewModel //public RelayCommand EightWorkLoc { get; set; } public RelayCommand FryPotTwoInputArrive { get; set; } public RelayCommand FryPotTwoEmptyRollerArrive { get; set; } + public RelayCommand LineTwoTaskExit { get; set; } public RelayCommand AGVLTwoArrive { get; set; } @@ -44,7 +46,7 @@ namespace FryPot_DosingSystem.ViewModel //public RelayCommand EightWorkLoc { get; set; } public RelayCommand FryPotThreeInputArrive { get; set; } public RelayCommand FryPotThreeEmptyRollerArrive { get; set; } - + public RelayCommand LineThreeTaskExit { get; set; } public RelayCommand AGVLThreeArrive { get; set; } public RelayCommand AGVFryPotThreeDownArrive { get; set; } @@ -160,6 +162,19 @@ namespace FryPot_DosingSystem.ViewModel { ActionManage.GetInstance.Send("AGVFryPotThreeGetEmptyRoller"); })); + + LineOneTaskExit = new RelayCommand(new Action(() => + { + ActionManage.GetInstance.Send("LineOneTaskExit"); + })); + LineTwoTaskExit = new RelayCommand(new Action(() => + { + ActionManage.GetInstance.Send("LineTwoTaskExit"); + })); + LineThreeTaskExit = new RelayCommand(new Action(() => + { + ActionManage.GetInstance.Send("LineThreeTaskExit"); + })); } } } diff --git a/FryPot_DosingSystem/ViewModel/FryPotMonitorViewModel.cs b/FryPot_DosingSystem/ViewModel/FryPotMonitorViewModel.cs new file mode 100644 index 00000000..c0867d49 --- /dev/null +++ b/FryPot_DosingSystem/ViewModel/FryPotMonitorViewModel.cs @@ -0,0 +1,73 @@ +using FryPot_DosingSystem.Attributes; +using FryPot_DosingSystem.Model; +using Microsoft.Toolkit.Mvvm.ComponentModel; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; + +namespace FryPot_DosingSystem.ViewModel +{ + internal class FryPotMonitorViewModel:ObservableObject + { + public ObservableCollection variableMonitorModels { get; set; } = new ObservableCollection(); + public int id { get; set; } = 0; + public FryPotMonitorViewModel() + { + variableMonitorModels = FryPotInfoManage.GetInstance.variableInfos; + // if (variableMonitorModels.Count > 0) + // { + // variableMonitorModels.Clear(); + // } + //PropertyInfo[] pros= FryPotMonitorManage.GetInstance.fryOne.GetType().GetProperties(); + // foreach (var item in pros) + // { + // var monitor = item.GetCustomAttribute(); + // if (monitor != null) + // { + // variableMonitorModels.Add(new VariableMonitorModel { Id=id+1,VarName=monitor.VarName,PLCAddress=monitor.PLCAddress,Notes=monitor.Notes,ModbusTcpAddress=monitor.ModbusTcpAddress }); + // } + // } + // PropertyInfo[] pros2 = FryPotMonitorManage.GetInstance.fryTwo.GetType().GetProperties(); + // foreach (var item in pros2) + // { + // var monitor = item.GetCustomAttribute(); + // if (monitor != null) + // { + // variableMonitorModels.Add(new VariableMonitorModel { Id = id + 1, VarName = monitor.VarName, PLCAddress = monitor.PLCAddress, Notes = monitor.Notes, ModbusTcpAddress = monitor.ModbusTcpAddress }); + // } + // } + // PropertyInfo[] pros3 = FryPotMonitorManage.GetInstance.fryThree.GetType().GetProperties(); + // foreach (var item in pros3) + // { + // var monitor = item.GetCustomAttribute(); + // if (monitor != null) + // { + // variableMonitorModels.Add(new VariableMonitorModel { Id = id + 1, VarName = monitor.VarName, PLCAddress = monitor.PLCAddress, Notes = monitor.Notes, ModbusTcpAddress = monitor.ModbusTcpAddress }); + // } + // } + // PropertyInfo[] pros4 = FryPotMonitorManage.GetInstance.fryFour.GetType().GetProperties(); + // foreach (var item in pros4) + // { + // var monitor = item.GetCustomAttribute(); + // if (monitor != null) + // { + // variableMonitorModels.Add(new VariableMonitorModel { Id = id + 1, VarName = monitor.VarName, PLCAddress = monitor.PLCAddress, Notes = monitor.Notes, ModbusTcpAddress = monitor.ModbusTcpAddress }); + // } + // } + // PropertyInfo[] pros5 = FryPotMonitorManage.GetInstance.fryFive.GetType().GetProperties(); + // foreach (var item in pros5) + // { + // var monitor = item.GetCustomAttribute(); + // if (monitor != null) + // { + // variableMonitorModels.Add(new VariableMonitorModel { Id = id + 1, VarName = monitor.VarName, PLCAddress = monitor.PLCAddress, Notes = monitor.Notes, ModbusTcpAddress = monitor.ModbusTcpAddress }); + // } + // } + + } + } +} diff --git a/FryPot_DosingSystem/ViewModel/SqliteDataViewModel.cs b/FryPot_DosingSystem/ViewModel/SqliteDataViewModel.cs new file mode 100644 index 00000000..0c690c6d --- /dev/null +++ b/FryPot_DosingSystem/ViewModel/SqliteDataViewModel.cs @@ -0,0 +1,176 @@ +using BPASmartClient.Helper; +using FryPot_DosingSystem.FryPotStatus; +using Microsoft.Toolkit.Mvvm.ComponentModel; +using Microsoft.Toolkit.Mvvm.Input; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; + +namespace FryPot_DosingSystem.ViewModel +{ + internal class SqliteDataViewModel : ObservableObject + { + public ObservableCollection StatusOne { get; set; } = new ObservableCollection(); + public ObservableCollection StatusTwo { get; set; } = new ObservableCollection(); + public ObservableCollection StatusThree { get; set; } = new ObservableCollection(); + public ObservableCollection StatusFour { get; set; } = new ObservableCollection(); + public ObservableCollection StatusFive { get; set; } = new ObservableCollection(); + + public Visibility fryOneDataVisible { get { return _fryOneDataVisible; } set { _fryOneDataVisible = value; OnPropertyChanged(); } } + private Visibility _fryOneDataVisible=Visibility.Visible; + + public Visibility fryTwoDataVisible { get { return _fryTwoDataVisible; } set { _fryTwoDataVisible = value; OnPropertyChanged(); } } + private Visibility _fryTwoDataVisible=Visibility.Collapsed; + + public Visibility fryThreeDataVisible { get { return _fryThreeDataVisible; } set { _fryThreeDataVisible = value; OnPropertyChanged(); } } + private Visibility _fryThreeDataVisible = Visibility.Collapsed; + public Visibility fryFourDataVisible { get { return _fryFourDataVisible; } set { _fryFourDataVisible = value; OnPropertyChanged(); } } + private Visibility _fryFourDataVisible = Visibility.Collapsed; + public Visibility fryFiveDataVisible { get { return _fryFiveDataVisible; } set { _fryFiveDataVisible = value; OnPropertyChanged(); } } + private Visibility _fryFiveDataVisible = Visibility.Collapsed; + + public List list { get; set; } = new List() { "1号炒锅", "2号炒锅", "3号炒锅", "4号炒锅", "5号炒锅" }; + public string SelectedDate { get; set; } + public string cboSelectedValue { get; set; } + public RelayCommand SelectCommand { get; set; } + public SqliteDataViewModel() + { + SelectCommand = new RelayCommand(() => + { + if (SelectedDate != string.Empty && SelectedDate != "" && SelectedDate != null && cboSelectedValue != null && cboSelectedValue != string.Empty && cboSelectedValue != "") + { + if (cboSelectedValue == "1号炒锅") + { + List listOne = Sqlite.GetInstance.Base.ToList(); + var list = listOne.Where(p => p.Time.Equals(Convert.ToDateTime(SelectedDate).ToShortDateString())); + if (list != null && list.Count() != 0) + { + if (StatusOne.Count > 0) + { + StatusOne.Clear(); + } + foreach (var item in list) + { + StatusOne.Add(item); + } + fryOneDataVisible = Visibility.Visible; + fryTwoDataVisible = Visibility.Collapsed; + fryThreeDataVisible = Visibility.Collapsed; + fryFourDataVisible = Visibility.Collapsed; + fryFiveDataVisible = Visibility.Collapsed; + } + else + { + MessageBox.Show("未找到对应数据","提示",MessageBoxButton.OK,MessageBoxImage.Information); + } + + } + if (cboSelectedValue == "2号炒锅") + { + List listTwo = Sqlite.GetInstance.Base.ToList(); + var list = listTwo.Where(p => p.Time.Equals(Convert.ToDateTime(SelectedDate).ToShortDateString())); + if (list != null && list.Count() != 0) + { + if (StatusTwo.Count > 0) + { + StatusTwo.Clear(); + } + foreach (var item in list) + { + StatusTwo.Add(item); + } + fryOneDataVisible = Visibility.Collapsed; + fryTwoDataVisible = Visibility.Visible; + fryThreeDataVisible = Visibility.Collapsed; + fryFourDataVisible = Visibility.Collapsed; + fryFiveDataVisible = Visibility.Collapsed; + } + else + { + MessageBox.Show("未找到对应数据", "提示", MessageBoxButton.OK, MessageBoxImage.Information); + } + } + if (cboSelectedValue == "3号炒锅") + { + List listThree = Sqlite.GetInstance.Base.ToList(); + var list = listThree.Where(p => p.Time.Equals(Convert.ToDateTime(SelectedDate).ToShortDateString())); + if (list != null && list.Count() != 0) + { + if (StatusThree.Count > 0) + { + StatusThree.Clear(); + } + foreach (var item in list) + { + StatusThree.Add(item); + } + fryOneDataVisible = Visibility.Collapsed; + fryTwoDataVisible = Visibility.Collapsed; + fryThreeDataVisible = Visibility.Visible; + fryFourDataVisible = Visibility.Collapsed; + fryFiveDataVisible = Visibility.Collapsed; + } + else + { + MessageBox.Show("未找到对应数据", "提示", MessageBoxButton.OK, MessageBoxImage.Information); + } + } + if (cboSelectedValue == "4号炒锅") + { + List listFour = Sqlite.GetInstance.Base.ToList(); + var list = listFour.Where(p => p.Time.Equals(Convert.ToDateTime(SelectedDate).ToShortDateString())); + if (list != null&&list.Count()!=0) + { + if (StatusFour.Count > 0) + { + StatusFour.Clear(); + } + foreach (var item in list) + { + StatusFour.Add(item); + } + fryOneDataVisible = Visibility.Collapsed; + fryTwoDataVisible = Visibility.Collapsed; + fryThreeDataVisible = Visibility.Collapsed; + fryFourDataVisible = Visibility.Visible; + fryFiveDataVisible = Visibility.Collapsed; + } + else + { + MessageBox.Show("未找到对应数据", "提示", MessageBoxButton.OK, MessageBoxImage.Information); + } + } + if (cboSelectedValue == "5号炒锅") + { + List listFive = Sqlite.GetInstance.Base.ToList(); + var list = listFive.Where(p => p.Time.Equals(Convert.ToDateTime(SelectedDate).ToShortDateString())); + if (list != null && list.Count() != 0) + { + if (StatusFive.Count > 0) + { + StatusFive.Clear(); + } + foreach (var item in list) + { + StatusFive.Add(item); + } + fryOneDataVisible = Visibility.Collapsed; + fryTwoDataVisible = Visibility.Collapsed; + fryThreeDataVisible = Visibility.Collapsed; + fryFourDataVisible = Visibility.Collapsed; + fryFiveDataVisible = Visibility.Visible; + } + else + { + MessageBox.Show("未找到对应数据", "提示", MessageBoxButton.OK, MessageBoxImage.Information); + } + } + } + }); + } + } +} diff --git a/FryPot_DosingSystem/ViewModel/UserManageViewModel.cs b/FryPot_DosingSystem/ViewModel/UserManageViewModel.cs index 3cf75e0f..73972072 100644 --- a/FryPot_DosingSystem/ViewModel/UserManageViewModel.cs +++ b/FryPot_DosingSystem/ViewModel/UserManageViewModel.cs @@ -22,7 +22,6 @@ namespace FryPot_DosingSystem.ViewModel public List Authorities { get; set; } = new List(); public RelayCommand SaveCommand { get; set; } - public RelayCommand UpdateCommand { get; set; } public RelayCommand DeleteCommand { get; set; } public UserManageViewModel() { diff --git a/SmartClient.sln b/SmartClient.sln index ba5d45bb..71121625 100644 --- a/SmartClient.sln +++ b/SmartClient.sln @@ -114,8 +114,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestDemo", "TestDemo\TestDe EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.HubHelper", "BPASmartClient.HubHelper\BPASmartClient.HubHelper.csproj", "{099E047C-F40E-47A3-A5BA-81FC1500D5E8}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MorkTM", "BPASmartClient.MorkTM\BPASmartClient.MorkTM.csproj", "{76B6B333-0109-4EE8-A9B2-3E53A7421D92}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -1070,26 +1068,6 @@ Global {099E047C-F40E-47A3-A5BA-81FC1500D5E8}.Release|x64.Build.0 = Release|Any CPU {099E047C-F40E-47A3-A5BA-81FC1500D5E8}.Release|x86.ActiveCfg = Release|Any CPU {099E047C-F40E-47A3-A5BA-81FC1500D5E8}.Release|x86.Build.0 = Release|Any CPU - {76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Debug|Any CPU.Build.0 = Debug|Any CPU - {76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Debug|ARM.ActiveCfg = Debug|Any CPU - {76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Debug|ARM.Build.0 = Debug|Any CPU - {76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Debug|ARM64.ActiveCfg = Debug|Any CPU - {76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Debug|ARM64.Build.0 = Debug|Any CPU - {76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Debug|x64.ActiveCfg = Debug|Any CPU - {76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Debug|x64.Build.0 = Debug|Any CPU - {76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Debug|x86.ActiveCfg = Debug|Any CPU - {76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Debug|x86.Build.0 = Debug|Any CPU - {76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Release|Any CPU.ActiveCfg = Release|Any CPU - {76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Release|Any CPU.Build.0 = Release|Any CPU - {76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Release|ARM.ActiveCfg = Release|Any CPU - {76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Release|ARM.Build.0 = Release|Any CPU - {76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Release|ARM64.ActiveCfg = Release|Any CPU - {76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Release|ARM64.Build.0 = Release|Any CPU - {76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Release|x64.ActiveCfg = Release|Any CPU - {76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Release|x64.Build.0 = Release|Any CPU - {76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Release|x86.ActiveCfg = Release|Any CPU - {76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1142,7 +1120,6 @@ Global {E7168B03-68E5-4285-BB95-5660F877577A} = {8712125E-14CD-4E1B-A1CE-4BDE03805942} {A49E1C5A-9489-451C-9CE6-CEA586234B84} = {8712125E-14CD-4E1B-A1CE-4BDE03805942} {099E047C-F40E-47A3-A5BA-81FC1500D5E8} = {3D1D0E04-03FD-480A-8CF8-6E01A2E28625} - {76B6B333-0109-4EE8-A9B2-3E53A7421D92} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {9AEC9B81-0222-4DE9-B642-D915C29222AC}