输送次数消息
This commit is contained in:
commit
78aab33698
5 files changed
+148
-71
No files matched your search
@@ -124,12 +124,16 @@ namespace SunlightAggregationTerminal.Class
|
||||
}
|
||||
if (data.TryGetValue("SysData", out var value_SysData))
|
||||
{
|
||||
|
||||
var tmp = JsonSerializer.Deserialize<List<Dictionary<string, object>>>(value_SysData.ToString()!)!;
|
||||
}
|
||||
|
||||
if (data.TryGetValue("Info", out val) && val != null)//机台信息接受
|
||||
{
|
||||
DataModel.Info_data = JsonSerializer.Deserialize<List<Dictionary<string, object>>>(val.ToString()!)!;
|
||||
DataModel.Info_data = JsonSerializer.Deserialize<List<Dictionary<string, object>>>(val.ToString()!)!;
|
||||
InfoPage.DyeMeasurementNumber = data.GetValue("DyeMeasurementNumber").ToString();
|
||||
InfoPage.ChemicalNumber = data.GetValue("ChemicalNumber").ToString();
|
||||
InfoPage.PowderNumber = data.GetValue("PowderNumber").ToString();
|
||||
InfoPage.DyeDissolveNumber = data.GetValue("DyeDissolveNumber").ToString();
|
||||
|
||||
//发送消息
|
||||
WeakReferenceMessenger.Default.Send(new object());
|
||||
}
|
||||
|
||||
+126
-65
@@ -2,7 +2,7 @@
|
||||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="SunlightAggregationTerminal.InfoPage"
|
||||
xmlns:converters="clr-namespace:SunlightAggregationTerminal.Converters"
|
||||
xmlns:converters="clr-namespace:SunlightAggregationTerminal.Converters"
|
||||
Title="设备信息">
|
||||
<ContentPage.Resources>
|
||||
<ResourceDictionary>
|
||||
@@ -12,73 +12,134 @@
|
||||
</ContentPage.Resources>
|
||||
<RefreshView x:Name="myRefreshView_" >
|
||||
<CollectionView x:Name="CardCollectionView">
|
||||
<!-- 保持滚动条 -->
|
||||
<CollectionView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<!-- 这里定义单个卡片的 UI 结构 -->
|
||||
<Border BackgroundColor="White" Stroke="#CCCCCC"
|
||||
<CollectionView.Header>
|
||||
<Border BackgroundColor="White"
|
||||
Stroke="#CCCCCC"
|
||||
Margin="10,0,10,10"
|
||||
StrokeThickness="5"
|
||||
StrokeShape="RoundRectangle 10">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Label Text="今日输送信息" Grid.Row="0" BackgroundColor="#CCCCCC"
|
||||
FontAttributes="Bold" FontSize="24" TextColor="Black" Padding="5"/>
|
||||
<Grid Grid.Row="1" ColumnDefinitions="Auto,*,Auto" Padding="5" ColumnSpacing="5">
|
||||
<HorizontalStackLayout>
|
||||
<!-- 图片 -->
|
||||
<Image WidthRequest="100" HeightRequest="100" Source="sunlightlogo.png"/>
|
||||
<!-- 设备状态文字内容 -->
|
||||
<VerticalStackLayout Grid.Column="1" VerticalOptions="Center">
|
||||
<ContentView>
|
||||
<HorizontalStackLayout VerticalOptions="Center">
|
||||
<Label Text="染料称量(次): " FontAttributes="Bold"
|
||||
FontSize="20" TextColor="Black"/>
|
||||
<Label x:Name="_DyeMeasurementNumber" FontAttributes="Bold"
|
||||
FontSize="22" TextColor="Black"/>
|
||||
</HorizontalStackLayout>
|
||||
</ContentView>
|
||||
<ContentView>
|
||||
<HorizontalStackLayout VerticalOptions="Center">
|
||||
<Label Text="染料输送(次): " FontAttributes="Bold"
|
||||
FontSize="20" TextColor="Black"/>
|
||||
<Label x:Name="_DyeDissolveNumber" FontAttributes="Bold"
|
||||
FontSize="22" TextColor="Black"/>
|
||||
</HorizontalStackLayout>
|
||||
</ContentView>
|
||||
<ContentView>
|
||||
<HorizontalStackLayout VerticalOptions="Center">
|
||||
<Label Text="助剂输送(次): " FontAttributes="Bold"
|
||||
FontSize="20" TextColor="Black"/>
|
||||
<Label x:Name="_ChemicalNumber" FontAttributes="Bold"
|
||||
FontSize="22" TextColor="Black"/>
|
||||
</HorizontalStackLayout>
|
||||
</ContentView>
|
||||
<ContentView>
|
||||
<HorizontalStackLayout VerticalOptions="Center">
|
||||
<Label Text="粉剂输送(次): " FontAttributes="Bold"
|
||||
FontSize="20" TextColor="Black"/>
|
||||
<Label x:Name="_PowderNumber" FontAttributes="Bold"
|
||||
FontSize="22" TextColor="Black"/>
|
||||
</HorizontalStackLayout>
|
||||
</ContentView>
|
||||
</VerticalStackLayout>
|
||||
</HorizontalStackLayout>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<!-- 点击事件 -->
|
||||
<Border.GestureRecognizers>
|
||||
<TapGestureRecognizer Tapped="TapGestureRecognizer_ChemicalStatistics"/>
|
||||
</Border.GestureRecognizers>
|
||||
</Border>
|
||||
</CollectionView.Header>
|
||||
<!-- 保持滚动条 -->
|
||||
<CollectionView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<!-- 这里定义单个卡片的 UI 结构 -->
|
||||
<Border BackgroundColor="White" Stroke="#CCCCCC"
|
||||
StrokeThickness="2" Margin="10,0,10,10"
|
||||
StrokeShape="RoundRectangle 10">
|
||||
<Grid>
|
||||
<!-- 定义一行 -->
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Grid.Row="0" BackgroundColor="#CCCCCC">
|
||||
<Label Text="{Binding Name}" FontAttributes="Bold"
|
||||
<Grid>
|
||||
<!-- 定义一行 -->
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Grid.Row="0" BackgroundColor="#CCCCCC">
|
||||
<Label Text="{Binding Name}" FontAttributes="Bold"
|
||||
FontSize="24" TextColor="Black" Padding="5"/>
|
||||
</Grid>
|
||||
<Grid Grid.Row="1">
|
||||
<VerticalStackLayout>
|
||||
<Grid>
|
||||
<HorizontalStackLayout>
|
||||
<!-- 图片 -->
|
||||
<Image WidthRequest="100" HeightRequest="100"
|
||||
Source="{Binding Path=Model, Converter={StaticResource StringToImageConverter}}"/>
|
||||
<!-- 设备状态 -->
|
||||
<VerticalStackLayout>
|
||||
<HorizontalStackLayout>
|
||||
<Label Text="状态: " FontAttributes="Bold"
|
||||
FontSize="22" TextColor="Black"/>
|
||||
<Label Text="{Binding State}" FontAttributes="Bold"
|
||||
FontSize="22" TextColor="Black"/>
|
||||
</HorizontalStackLayout>
|
||||
<HorizontalStackLayout>
|
||||
<Label Text="机台: " FontAttributes="Bold"
|
||||
FontSize="22" TextColor="Black"/>
|
||||
<Label Text="{Binding Machine}" FontAttributes="Bold"
|
||||
FontSize="22" TextColor="Black"/>
|
||||
</HorizontalStackLayout>
|
||||
</VerticalStackLayout>
|
||||
</HorizontalStackLayout>
|
||||
</Grid>
|
||||
<BoxView HeightRequest="3" Color="#CCCCCC" />
|
||||
<!-- 设备信息 -->
|
||||
<Label Text="{Binding ModelA}" FontAttributes="Bold" FontSize="22" TextColor="Black"
|
||||
IsVisible="{Binding Path=ModelA, Converter={StaticResource StringToBoolConverter}}"/>
|
||||
<Label Text="{Binding ModelB}" FontAttributes="Bold" FontSize="22" TextColor="Black"
|
||||
IsVisible="{Binding Path=ModelB, Converter={StaticResource StringToBoolConverter}}"/>
|
||||
<Label Text="{Binding ModelC}" FontAttributes="Bold" FontSize="22" TextColor="Black"
|
||||
IsVisible="{Binding Path=ModelC, Converter={StaticResource StringToBoolConverter}}"/>
|
||||
<Label Text="{Binding ModelD}" FontAttributes="Bold" FontSize="22" TextColor="Black"
|
||||
IsVisible="{Binding Path=ModelD, Converter={StaticResource StringToBoolConverter}}"/>
|
||||
<Label Text="{Binding ModelE}" FontAttributes="Bold" FontSize="22" TextColor="Black"
|
||||
IsVisible="{Binding Path=ModelE, Converter={StaticResource StringToBoolConverter}}"/>
|
||||
<Label Text="{Binding ModelF}" FontAttributes="Bold" FontSize="22" TextColor="Black"
|
||||
IsVisible="{Binding Path=ModelF, Converter={StaticResource StringToBoolConverter}}"/>
|
||||
<Label Text="{Binding Information}" FontAttributes="Bold"
|
||||
FontSize="22" TextColor="Black"/>
|
||||
</VerticalStackLayout>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<!-- 点击事件 -->
|
||||
<Border.GestureRecognizers>
|
||||
<TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped"/>
|
||||
</Border.GestureRecognizers>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</CollectionView.ItemTemplate>
|
||||
</CollectionView>
|
||||
<Grid Grid.Row="1">
|
||||
<VerticalStackLayout>
|
||||
<Grid>
|
||||
<HorizontalStackLayout>
|
||||
<!-- 图片 -->
|
||||
<Image WidthRequest="100" HeightRequest="100"
|
||||
Source="{Binding Path=Model, Converter={StaticResource StringToImageConverter}}"/>
|
||||
<!-- 设备状态 -->
|
||||
<VerticalStackLayout>
|
||||
<HorizontalStackLayout>
|
||||
<Label Text="状态: " FontAttributes="Bold"
|
||||
FontSize="22" TextColor="Black"/>
|
||||
<Label Text="{Binding State}" FontAttributes="Bold"
|
||||
FontSize="22" TextColor="Black"/>
|
||||
</HorizontalStackLayout>
|
||||
<HorizontalStackLayout>
|
||||
<Label Text="机台: " FontAttributes="Bold"
|
||||
FontSize="22" TextColor="Black"/>
|
||||
<Label Text="{Binding Machine}" FontAttributes="Bold"
|
||||
FontSize="22" TextColor="Black"/>
|
||||
</HorizontalStackLayout>
|
||||
</VerticalStackLayout>
|
||||
</HorizontalStackLayout>
|
||||
</Grid>
|
||||
<BoxView HeightRequest="3" Color="#CCCCCC" />
|
||||
<!-- 设备信息 -->
|
||||
<Label Text="{Binding ModelA}" FontAttributes="Bold" FontSize="22" TextColor="Black"
|
||||
IsVisible="{Binding Path=ModelA, Converter={StaticResource StringToBoolConverter}}"/>
|
||||
<Label Text="{Binding ModelB}" FontAttributes="Bold" FontSize="22" TextColor="Black"
|
||||
IsVisible="{Binding Path=ModelB, Converter={StaticResource StringToBoolConverter}}"/>
|
||||
<Label Text="{Binding ModelC}" FontAttributes="Bold" FontSize="22" TextColor="Black"
|
||||
IsVisible="{Binding Path=ModelC, Converter={StaticResource StringToBoolConverter}}"/>
|
||||
<Label Text="{Binding ModelD}" FontAttributes="Bold" FontSize="22" TextColor="Black"
|
||||
IsVisible="{Binding Path=ModelD, Converter={StaticResource StringToBoolConverter}}"/>
|
||||
<Label Text="{Binding ModelE}" FontAttributes="Bold" FontSize="22" TextColor="Black"
|
||||
IsVisible="{Binding Path=ModelE, Converter={StaticResource StringToBoolConverter}}"/>
|
||||
<Label Text="{Binding ModelF}" FontAttributes="Bold" FontSize="22" TextColor="Black"
|
||||
IsVisible="{Binding Path=ModelF, Converter={StaticResource StringToBoolConverter}}"/>
|
||||
<Label Text="{Binding Information}" FontAttributes="Bold"
|
||||
FontSize="22" TextColor="Black"/>
|
||||
</VerticalStackLayout>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<!-- 点击事件 -->
|
||||
<Border.GestureRecognizers>
|
||||
<TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped"/>
|
||||
</Border.GestureRecognizers>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</CollectionView.ItemTemplate>
|
||||
</CollectionView>
|
||||
</RefreshView>
|
||||
</ContentPage>
|
||||
+12
-1
@@ -11,6 +11,7 @@ public partial class InfoPage : ContentPage
|
||||
{
|
||||
public static ObservableCollection<InfoItem> InfoItems { get; set; } = new();
|
||||
private DateTime _lastRefreshTime = DateTime.MinValue;
|
||||
public static string? DyeMeasurementNumber, ChemicalNumber, PowderNumber, DyeDissolveNumber;
|
||||
|
||||
public InfoPage()
|
||||
{
|
||||
@@ -44,8 +45,18 @@ public partial class InfoPage : ContentPage
|
||||
}
|
||||
};
|
||||
}
|
||||
private void HandleUITrigger()
|
||||
|
||||
private void TapGestureRecognizer_ChemicalStatistics(object sender, TappedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void HandleUITrigger()
|
||||
{
|
||||
_DyeMeasurementNumber.Text = DyeMeasurementNumber;
|
||||
_ChemicalNumber.Text = ChemicalNumber;
|
||||
_PowderNumber.Text = PowderNumber;
|
||||
_DyeDissolveNumber.Text = DyeDissolveNumber;
|
||||
InfoItems.Clear();
|
||||
foreach (Dictionary<string, object> List in DataModel.Info_data)
|
||||
{
|
||||
|
||||
@@ -38,6 +38,7 @@ namespace SunlightAggregationTerminal.Models
|
||||
[ObservableProperty]
|
||||
public partial bool MessageNotificationMode { get; set; }
|
||||
|
||||
|
||||
public class RefreshUISignal { }
|
||||
public static List<Dictionary<string, object>> Info_data = new List<Dictionary<string, object>>();
|
||||
}
|
||||
|
||||
+2
-2
@@ -23,8 +23,8 @@
|
||||
FontAttributes="Bold"
|
||||
TextColor="Black" />
|
||||
<HorizontalStackLayout VerticalOptions="Center">
|
||||
<Label Text="ID:" FontSize="12" TextColor="Gray" Margin="0,0,0,0"/>
|
||||
<Label Text="{Binding UserId}" FontSize="12" TextColor="Gray" Margin="0,0,0,0"/>
|
||||
<Label Text="ID:" FontSize="12" TextColor="Gray" Margin="0,0,0,0"/>
|
||||
<Label Text="{Binding UserId}" FontSize="12" TextColor="Gray" Margin="0,0,0,0"/>
|
||||
</HorizontalStackLayout>
|
||||
</VerticalStackLayout>
|
||||
</HorizontalStackLayout>
|
||||
|
||||
Reference in new issue
Block a user