diff --git a/BPASmartClient.Device/VariableMonitor.cs b/BPASmartClient.Device/VariableMonitor.cs index 63e7139e..40d3bca3 100644 --- a/BPASmartClient.Device/VariableMonitor.cs +++ b/BPASmartClient.Device/VariableMonitor.cs @@ -58,6 +58,16 @@ namespace BPASmartClient.Device } } private bool _sWitchValue; + public int IntValue + { + get { return _intValue; } + set + { + _intValue = value; + OnPropertyChanged(); + } + } + private int _intValue; public object StatusColor { get; set; } } } diff --git a/BPASmartClient.MorkT_BarCounter/BPASmartClient.MorkT_BarCounter.csproj b/BPASmartClient.MorkT_BarCounter/BPASmartClient.MorkT_BarCounter.csproj index 621da4cb..4eaa9d28 100644 --- a/BPASmartClient.MorkT_BarCounter/BPASmartClient.MorkT_BarCounter.csproj +++ b/BPASmartClient.MorkT_BarCounter/BPASmartClient.MorkT_BarCounter.csproj @@ -8,6 +8,7 @@ + diff --git a/BPASmartClient.MorkT_BarCounter/View/DebugView.xaml b/BPASmartClient.MorkT_BarCounter/View/DebugView.xaml index 5d8a62a2..673ac70c 100644 --- a/BPASmartClient.MorkT_BarCounter/View/DebugView.xaml +++ b/BPASmartClient.MorkT_BarCounter/View/DebugView.xaml @@ -368,8 +368,7 @@ - + @@ -383,10 +382,10 @@ - - - - + + + + 咖啡机状态 p.Notes == "制冰机连接状态").CurrentValue == "True" ? "已连接" : "未连接"; IceMakerState = variableMonitors.FirstOrDefault(p => p.Notes == "制冰机设备状态").CurrentValue; #endregion + #region 果汁机 JuicerConnected = variableMonitors.FirstOrDefault(p => p.Notes == "果汁机连接状态").CurrentValue == "True" ? "已连接" : "未连接"; diff --git a/BPASmartClient.MorkT_Container/BPASmartClient.MorkT_Container.csproj b/BPASmartClient.MorkT_Container/BPASmartClient.MorkT_Container.csproj index 0c60eeb7..60e320c8 100644 --- a/BPASmartClient.MorkT_Container/BPASmartClient.MorkT_Container.csproj +++ b/BPASmartClient.MorkT_Container/BPASmartClient.MorkT_Container.csproj @@ -8,6 +8,7 @@ + diff --git a/BPASmartClient.MorkT_Container/Control_MorkT_Container.cs b/BPASmartClient.MorkT_Container/Control_MorkT_Container.cs index c6181b66..c0c97340 100644 --- a/BPASmartClient.MorkT_Container/Control_MorkT_Container.cs +++ b/BPASmartClient.MorkT_Container/Control_MorkT_Container.cs @@ -20,6 +20,7 @@ using BPASmartClient.Model.单片机; using BPASmartClient.Model.PLC; using BPASmartClient.DRCoffee; using BPASmartClient.LebaiRobot; +using System.Text.RegularExpressions; namespace BPASmartClient.MorkT_Container { @@ -534,7 +535,7 @@ namespace BPASmartClient.MorkT_Container Sence(GVL_MorkT.放咖啡杯); //Wait(); OrderChange(morkTLebaiJC.morkOrderPushesCoffee.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); - DeviceProcessLogShow($"-------------{morkTLebaiJC.morkOrderPushesCoffee.ElementAt(0).GoodName}制作完成------------"); + DeviceProcessLogShow($"-------------{Regex.Replace(morkTLebaiJC.morkOrderPushesCoffee.ElementAt(0).GoodName, @"[\r\n]", "")}制作完成------------"); } #endregion #region 做开水流程 @@ -1109,12 +1110,27 @@ namespace BPASmartClient.MorkT_Container morkTLebaiJC.JuicerConnected = b; } })); - GetStatus("GetJuicerDeviceStatus", new Action((o) => + GetStatus("GetJuicerDeviceStatus", new Action(async (o) => { if (o is int[] b) { morkTLebaiJC.JuicerState = b; } + if (morkTLebaiJC.JuicerState != null && morkTLebaiJC.JuicerState.Length>0) + { + if ((morkTLebaiJC.JuicerState[0] >> 7 & 1) == 1) + { + morkTLebaiJC.JuiceState_Using = true; + } + if ((morkTLebaiJC.JuicerState[0] >> 6 & 1) == 1) + { + morkTLebaiJC.JuiceState_LackOfWater = true; + } + if ((morkTLebaiJC.JuicerState[0] >> 5 & 1) == 1) + { + morkTLebaiJC.JuiceState_Heating = true; + } + } })); #endregion } diff --git a/BPASmartClient.MorkT_Container/View/DebugView.xaml b/BPASmartClient.MorkT_Container/View/DebugView.xaml index 9ed18079..b96e2ef8 100644 --- a/BPASmartClient.MorkT_Container/View/DebugView.xaml +++ b/BPASmartClient.MorkT_Container/View/DebugView.xaml @@ -328,10 +328,11 @@ 设备状态: - - - - + + + + + @@ -371,8 +372,7 @@ - + @@ -386,12 +386,12 @@ - - - - + + + + - 咖啡机状态 + 咖啡机状态 diff --git a/BPASmartClient.MorkT_Container/ViewModel/DebugViewModel.cs b/BPASmartClient.MorkT_Container/ViewModel/DebugViewModel.cs index 9373a6c1..de23bceb 100644 --- a/BPASmartClient.MorkT_Container/ViewModel/DebugViewModel.cs +++ b/BPASmartClient.MorkT_Container/ViewModel/DebugViewModel.cs @@ -47,13 +47,7 @@ namespace BPASmartClient.MorkT_Container.ViewModel; { EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiControlEvent { DeviceId = DeviceId, LebaiControl = o.ToString() }); } - private void IceMaker_StateCommand(object o) - { - if (IceMakerState != null) - { - - } - } + private void Button_RobotDoutput() { @@ -157,8 +151,18 @@ namespace BPASmartClient.MorkT_Container.ViewModel; #region 制冰机 public string IceMakerConnect { get { return _iceMakerConnect; } set { _iceMakerConnect = value;OnPropertyChanged(); } } private string _iceMakerConnect { get; set; } - public string IceMakerState { get { return _iceMakerState; } set { _iceMakerState = value; OnPropertyChanged(); } } - private string _iceMakerState { get; set; } + public int IceMakerState { get { return _iceMakerState; } set { _iceMakerState = value; OnPropertyChanged(); } } + private int _iceMakerState { get; set; } + public string IceMakerState1 { get { return _iceMakerState1; } set { _iceMakerState1 = value; OnPropertyChanged(); } } + private string _iceMakerState1 { get; set; } + public string IceMakerState2 { get { return _iceMakerState2; } set { _iceMakerState2 = value; OnPropertyChanged(); } } + private string _iceMakerState2 { get; set; } + public string IceMakerState3 { get { return _iceMakerState3; } set { _iceMakerState3 = value; OnPropertyChanged(); } } + private string _iceMakerState3 { get; set; } + public string IceMakerState4 { get { return _iceMakerState4; } set { _iceMakerState4 = value; OnPropertyChanged(); } } + private string _iceMakerState4 { get; set; } + public string IceMakerState5 { get { return _iceMakerState5; } set { _iceMakerState5 = value; OnPropertyChanged(); } } + private string _iceMakerState5 { get; set; } public int IceMaker_IceTime { get { return _iceMaker_IceTime; } set { _iceMaker_IceTime = value; OnPropertyChanged(); } } private int _iceMaker_IceTime = 3; @@ -317,7 +321,6 @@ namespace BPASmartClient.MorkT_Container.ViewModel; IceMaker_BtnStart = new RelayCommand(IceMaker_BtnStartCommand); IceMaker_BtnEnd = new RelayCommand(IceMaker_BtnEndCommand); IceMaker_BtnSetIceTime = new RelayCommand(IceMaker_BtnSetIceTimeCommand); - IceMaker_State = new RelayCommand(IceMaker_StateCommand); foreach (DrCoffeeDrinksCode code in Enum.GetValues(typeof(DrCoffeeDrinksCode))) { @@ -336,7 +339,7 @@ namespace BPASmartClient.MorkT_Container.ViewModel; if (device.Name == "Container") DeviceId = device.DeviceId ; }); - ThreadManage.GetInstance().StartLong(new Action(() => + ThreadManage.GetInstance().StartLong(new Action(async () => { variableMonitors = Plugin.GetInstance()?.GetPlugin()?.GetDevices()?.FirstOrDefault(p => p.DeviceId == DeviceId)?.variableMonitors; if (variableMonitors != null && variableMonitors.Count > 0) @@ -374,19 +377,73 @@ namespace BPASmartClient.MorkT_Container.ViewModel; #region 制冰机 IceMakerConnect = variableMonitors.FirstOrDefault(p => p.Notes == "制冰机连接状态").CurrentValue == "True" ? "已连接" : "未连接"; - IceMakerState = variableMonitors.FirstOrDefault(p => p.Notes == "制冰机设备状态").CurrentValue; + IceMakerState = variableMonitors.FirstOrDefault(p => p.Notes == "制冰机设备状态").IntValue; + if (IceMakerState>=0 && IceMakerState<=255) + { + byte a = (byte)IceMakerState; + if ((a >> 0 & 1) == 1) + { + IceMakerState1 = "关机状态"; + } + else + { + IceMakerState1 = "开机状态"; + } + if ((a >> 1 & 1) == 1) + { + IceMakerState2 = "制冰状态"; + } + else + { + IceMakerState2 = "待机状态"; + } + if ((a >> 2 & 1) == 1) + { + IceMakerState3 = "电机故障"; + } + else + { + IceMakerState3 = "正常"; + } + if ((a >> 3 & 1) == 1) + { + IceMakerState4 = "缺水"; + } + else + { + IceMakerState4 = "正常"; + } + if ((a >> 4 & 1) == 1) + { + IceMakerState5 = "冰满"; + } + else + { + IceMakerState5 = "未定义"; + } + + } #endregion - +/* + List res = new List(); + byte[] receive = new byte[32] { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x30, 0x31, 0x32 }; + res.Add(receive.Skip(24).Take(4).ToArray().BytesToInt()); + res.Add(receive.Skip(28).Take(4).ToArray().BytesToInt()); + int[] am = res.ToArray(); + var Juicestate1 = Convert.ToString(am[0], 2); + var Juicestate2 = am[1]; + int cd = Juicestate1.IndexOf("0");*/ #region 果汁机 JuicerConnected = variableMonitors.FirstOrDefault(p => p.Notes == "果汁机连接状态").CurrentValue == "True" ? "已连接" : "未连接"; - JuiceState_Heating = variableMonitors.FirstOrDefault(p => p.Notes == "果汁机制热").CurrentValue== "True"? System.Windows.Visibility.Visible: System.Windows.Visibility.Hidden; + JuiceState_Heating = variableMonitors.FirstOrDefault(p => p.Notes == "果汁机制热").CurrentValue == "True" ? System.Windows.Visibility.Visible : System.Windows.Visibility.Hidden; JuiceState_Cooling = variableMonitors.FirstOrDefault(p => p.Notes == "果汁机制冷").CurrentValue == "True" ? System.Windows.Visibility.Visible : System.Windows.Visibility.Hidden; JuiceState_LackOfWater = variableMonitors.FirstOrDefault(p => p.Notes == "果汁机缺水").CurrentValue == "True" ? System.Windows.Visibility.Visible : System.Windows.Visibility.Hidden; JuiceState_ChildLocks = variableMonitors.FirstOrDefault(p => p.Notes == "果汁机童锁").CurrentValue == "True" ? System.Windows.Visibility.Visible : System.Windows.Visibility.Hidden; JuiceState_Using = variableMonitors.FirstOrDefault(p => p.Notes == "果汁机使用").CurrentValue == "True" ? System.Windows.Visibility.Visible : System.Windows.Visibility.Hidden; #endregion - } - Thread.Sleep(500); + Thread.Sleep(200); + + } }), "MorkT-状态刷新"); } } diff --git a/BPASmartClient/BPASmartClient.csproj b/BPASmartClient/BPASmartClient.csproj index bba8ce8f..d18fa5e3 100644 --- a/BPASmartClient/BPASmartClient.csproj +++ b/BPASmartClient/BPASmartClient.csproj @@ -37,6 +37,8 @@ + + diff --git a/SmartClient.sln b/SmartClient.sln index 853dbddc..5d8750ae 100644 --- a/SmartClient.sln +++ b/SmartClient.sln @@ -104,6 +104,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.IceMaker", " EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MorkT_BarCounter", "BPASmartClient.MorkT_BarCounter\BPASmartClient.MorkT_BarCounter.csproj", "{048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MorkT_Container", "BPASmartClient.MorkT_Container\BPASmartClient.MorkT_Container.csproj", "{1BFE3DEE-D57A-4497-9CFA-7FF8EEA1B883}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -958,6 +960,26 @@ Global {048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}.Release|x64.Build.0 = Release|Any CPU {048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}.Release|x86.ActiveCfg = Release|Any CPU {048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD}.Release|x86.Build.0 = Release|Any CPU + {1BFE3DEE-D57A-4497-9CFA-7FF8EEA1B883}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1BFE3DEE-D57A-4497-9CFA-7FF8EEA1B883}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1BFE3DEE-D57A-4497-9CFA-7FF8EEA1B883}.Debug|ARM.ActiveCfg = Debug|Any CPU + {1BFE3DEE-D57A-4497-9CFA-7FF8EEA1B883}.Debug|ARM.Build.0 = Debug|Any CPU + {1BFE3DEE-D57A-4497-9CFA-7FF8EEA1B883}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {1BFE3DEE-D57A-4497-9CFA-7FF8EEA1B883}.Debug|ARM64.Build.0 = Debug|Any CPU + {1BFE3DEE-D57A-4497-9CFA-7FF8EEA1B883}.Debug|x64.ActiveCfg = Debug|Any CPU + {1BFE3DEE-D57A-4497-9CFA-7FF8EEA1B883}.Debug|x64.Build.0 = Debug|Any CPU + {1BFE3DEE-D57A-4497-9CFA-7FF8EEA1B883}.Debug|x86.ActiveCfg = Debug|Any CPU + {1BFE3DEE-D57A-4497-9CFA-7FF8EEA1B883}.Debug|x86.Build.0 = Debug|Any CPU + {1BFE3DEE-D57A-4497-9CFA-7FF8EEA1B883}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1BFE3DEE-D57A-4497-9CFA-7FF8EEA1B883}.Release|Any CPU.Build.0 = Release|Any CPU + {1BFE3DEE-D57A-4497-9CFA-7FF8EEA1B883}.Release|ARM.ActiveCfg = Release|Any CPU + {1BFE3DEE-D57A-4497-9CFA-7FF8EEA1B883}.Release|ARM.Build.0 = Release|Any CPU + {1BFE3DEE-D57A-4497-9CFA-7FF8EEA1B883}.Release|ARM64.ActiveCfg = Release|Any CPU + {1BFE3DEE-D57A-4497-9CFA-7FF8EEA1B883}.Release|ARM64.Build.0 = Release|Any CPU + {1BFE3DEE-D57A-4497-9CFA-7FF8EEA1B883}.Release|x64.ActiveCfg = Release|Any CPU + {1BFE3DEE-D57A-4497-9CFA-7FF8EEA1B883}.Release|x64.Build.0 = Release|Any CPU + {1BFE3DEE-D57A-4497-9CFA-7FF8EEA1B883}.Release|x86.ActiveCfg = Release|Any CPU + {1BFE3DEE-D57A-4497-9CFA-7FF8EEA1B883}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1005,6 +1027,7 @@ Global {507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8} = {3D1D0E04-03FD-480A-8CF8-6E01A2E28625} {F61AC179-156D-4075-BFEB-355862231F48} = {666CB1A9-562E-453A-A2C7-FD9D77CFDFDD} {048FED78-4BFA-4FCD-8FF2-905E9CA4D7DD} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F} + {1BFE3DEE-D57A-4497-9CFA-7FF8EEA1B883} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {9AEC9B81-0222-4DE9-B642-D915C29222AC}