Browse Source

更改果汁机和制冰机的状态显示

样式分支
pengliangyang 2 years ago
parent
commit
d69cb1eb13
10 changed files with 145 additions and 35 deletions
  1. +10
    -0
      BPASmartClient.Device/VariableMonitor.cs
  2. +1
    -0
      BPASmartClient.MorkT_BarCounter/BPASmartClient.MorkT_BarCounter.csproj
  3. +5
    -6
      BPASmartClient.MorkT_BarCounter/View/DebugView.xaml
  4. +1
    -0
      BPASmartClient.MorkT_BarCounter/ViewModel/DebugViewModel.cs
  5. +1
    -0
      BPASmartClient.MorkT_Container/BPASmartClient.MorkT_Container.csproj
  6. +18
    -2
      BPASmartClient.MorkT_Container/Control_MorkT_Container.cs
  7. +11
    -11
      BPASmartClient.MorkT_Container/View/DebugView.xaml
  8. +73
    -16
      BPASmartClient.MorkT_Container/ViewModel/DebugViewModel.cs
  9. +2
    -0
      BPASmartClient/BPASmartClient.csproj
  10. +23
    -0
      SmartClient.sln

+ 10
- 0
BPASmartClient.Device/VariableMonitor.cs View File

@@ -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; }
}
}

+ 1
- 0
BPASmartClient.MorkT_BarCounter/BPASmartClient.MorkT_BarCounter.csproj View File

@@ -8,6 +8,7 @@

<ItemGroup>
<ProjectReference Include="..\BPASmartClient.Business\BPASmartClient.Business.csproj" />
<ProjectReference Include="..\BPASmartClient.CustomResource\BPASmartClient.CustomResource.csproj" />
<ProjectReference Include="..\BPASmartClient.Device\BPASmartClient.Device.csproj" />
<ProjectReference Include="..\BPASmartClient.DRCoffee\BPASmartClient.DRCoffee.csproj" />
<ProjectReference Include="..\BPASmartClient.GSIceCream\BPASmartClient.GSIceCream.csproj" />


+ 5
- 6
BPASmartClient.MorkT_BarCounter/View/DebugView.xaml View File

@@ -368,8 +368,7 @@
<TextBlock Text="连接状态" />
</Grid>
<Grid Grid.Row="0" Grid.Column="1">
<TextBlock Text="{Binding CoffeeConnected}"
Margin="120,0,0,0"/>
<TextBlock Text="{Binding CoffeeConnected}"/>
</Grid>
<Grid Grid.Row="1" Grid.RowSpan="2" Grid.ColumnSpan="2">
<Grid.Resources>
@@ -383,10 +382,10 @@
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="99" />
<ColumnDefinition Width="140" />
<ColumnDefinition Width="100" />
<ColumnDefinition Width="171" />
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="3*" />
</Grid.ColumnDefinitions>
<TextBlock Height="23" Width="100" FontSize="18" HorizontalAlignment="Center">咖啡机状态</TextBlock>
<TextBlock FontSize="18"


+ 1
- 0
BPASmartClient.MorkT_BarCounter/ViewModel/DebugViewModel.cs View File

@@ -367,6 +367,7 @@ namespace BPASmartClient.MorkT_BarCounter.ViewModel;
IceMakerConnect = variableMonitors.FirstOrDefault(p => p.Notes == "制冰机连接状态").CurrentValue == "True" ? "已连接" : "未连接";
IceMakerState = variableMonitors.FirstOrDefault(p => p.Notes == "制冰机设备状态").CurrentValue;
#endregion

#region 果汁机
JuicerConnected = variableMonitors.FirstOrDefault(p => p.Notes == "果汁机连接状态").CurrentValue == "True" ? "已连接" : "未连接";


+ 1
- 0
BPASmartClient.MorkT_Container/BPASmartClient.MorkT_Container.csproj View File

@@ -8,6 +8,7 @@

<ItemGroup>
<ProjectReference Include="..\BPASmartClient.Business\BPASmartClient.Business.csproj" />
<ProjectReference Include="..\BPASmartClient.CustomResource\BPASmartClient.CustomResource.csproj" />
<ProjectReference Include="..\BPASmartClient.Device\BPASmartClient.Device.csproj" />
<ProjectReference Include="..\BPASmartClient.DRCoffee\BPASmartClient.DRCoffee.csproj" />
<ProjectReference Include="..\BPASmartClient.GSIceCream\BPASmartClient.GSIceCream.csproj" />


+ 18
- 2
BPASmartClient.MorkT_Container/Control_MorkT_Container.cs View File

@@ -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<object>((o) =>
GetStatus("GetJuicerDeviceStatus", new Action<object>(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
}


+ 11
- 11
BPASmartClient.MorkT_Container/View/DebugView.xaml View File

@@ -328,10 +328,11 @@
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" Grid.ColumnSpan="2" >
<TextBlock>设备状态:</TextBlock>
<Button IsEnabled="False" Command="{Binding IceMaker_State}" >开机状态</Button>
<Button IsEnabled="False" Command="{Binding IceMaker_State}">待机状态</Button>
<Button IsEnabled="False" Command="{Binding IceMaker_State}" >电机故障</Button>
<Button IsEnabled="False" Command="{Binding IceMaker_State}">冰满</Button>
<Button IsEnabled="False" Content="{Binding IceMakerState1}"></Button>
<Button IsEnabled="False" Content="{Binding IceMakerState2}"></Button>
<Button IsEnabled="False" Content="{Binding IceMakerState3}"></Button>
<Button IsEnabled="False" Content="{Binding IceMakerState4}"></Button>
<Button IsEnabled="False" Content="{Binding IceMakerState5}"></Button>
</StackPanel>
</Grid>
<Grid Grid.Row="2" Grid.Column="0">
@@ -371,8 +372,7 @@
<TextBlock Text="连接状态" />
</Grid>
<Grid Grid.Row="0" Grid.Column="1">
<TextBlock Text="{Binding CoffeeConnected}"
Margin="120,0,0,0"/>
<TextBlock Text="{Binding CoffeeConnected}" />
</Grid>
<Grid Grid.Row="1" Grid.RowSpan="2" Grid.ColumnSpan="2">
<Grid.Resources>
@@ -386,12 +386,12 @@
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="99" />
<ColumnDefinition Width="140" />
<ColumnDefinition Width="100" />
<ColumnDefinition Width="171" />
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="3*" />
</Grid.ColumnDefinitions>
<TextBlock Height="23" Width="100" FontSize="18" HorizontalAlignment="Center">咖啡机状态</TextBlock>
<TextBlock Height="23" Width="100" FontSize="18">咖啡机状态</TextBlock>
<TextBlock FontSize="18"
Grid.Column="1"
Text="{Binding CoffeeStatus}" Height="23" />


+ 73
- 16
BPASmartClient.MorkT_Container/ViewModel/DebugViewModel.cs View File

@@ -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<object>(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<DeviceMgr>()?.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<int> res = new List<int>();
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-状态刷新");
}
}


+ 2
- 0
BPASmartClient/BPASmartClient.csproj View File

@@ -37,6 +37,8 @@
<ProjectReference Include="..\BPASmartClient.MorkT.Lebai.JC\BPASmartClient.MorkTLebaiJC.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkTJuicer\BPASmartClient.MorkTJuicer.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkT\BPASmartClient.MorkT.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkT_BarCounter\BPASmartClient.MorkT_BarCounter.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkT_Container\BPASmartClient.MorkT_Container.csproj" />
<ProjectReference Include="..\BPASmartClient.SCChip\BPASmartClient.SCChip.csproj" />
<ProjectReference Include="..\BPASmartClient.ViewModel\BPASmartClient.ViewModel.csproj" />
</ItemGroup>


+ 23
- 0
SmartClient.sln View File

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


Loading…
Cancel
Save