Compare commits
40
Commits
61ac666002
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
47317ca033 | ||
|
|
83cd4915d8 | ||
|
|
25243c03e6 | ||
|
|
b97bfab44f | ||
|
|
40f380f95f | ||
|
|
f8da62df7d | ||
|
|
ff289a0221 | ||
|
|
a14f490032 | ||
|
|
af28d6eba3 | ||
|
|
f80d3f4950 | ||
|
|
40392fccb4 | ||
|
|
95b61a35ac | ||
|
|
ad9cd88b41 | ||
|
|
0122e98b4d | ||
|
|
7b0517c59c | ||
|
|
18cc18740c | ||
|
|
69f2a4e4ed | ||
|
|
ee07bb7eca | ||
|
|
5f3f2ab7bb | ||
|
|
2af3cccba8 | ||
|
|
6dbfa0610e | ||
|
|
395f066568 | ||
|
|
2e3f894a4d | ||
|
|
9e94b03bc4 | ||
|
|
9a3c8f0d80 | ||
|
|
c0e21f9752 | ||
|
|
7cd46d11de | ||
|
|
a72383e422 | ||
|
|
c3c4bfcd68 | ||
|
|
164c229cb2 | ||
|
|
ec1112f641 | ||
|
|
aea7c945ae | ||
|
|
cdacabee03 | ||
|
|
94d1fb6a5d | ||
|
|
130bfb9d7b | ||
|
|
c7afb21ddf | ||
|
|
822fb19d28 | ||
|
|
0b2d726287 | ||
|
|
3ad3523631 | ||
|
|
78aab33698 |
No files matched your search
@@ -31,6 +31,12 @@
|
||||
Title="查询"
|
||||
Icon="search.png"
|
||||
ContentTemplate="{DataTemplate local:QueryPage}"/>
|
||||
<!-- 操作页面 -->
|
||||
<!--
|
||||
<ShellContent
|
||||
Title="操作"
|
||||
Icon="IcOutlinePsychologyAlt.png"
|
||||
ContentTemplate="{DataTemplate local:QueryPage}"/>-->
|
||||
<!-- 3 通知页面 -->
|
||||
<ShellContent
|
||||
Title="通知"
|
||||
|
||||
+4
-4
@@ -27,15 +27,15 @@ namespace SunlightAggregationTerminal
|
||||
await Navigation.PushModalAsync(loading);
|
||||
|
||||
if (await AppModels.LogIn())
|
||||
{//拒绝登陆时打开登录页面
|
||||
{
|
||||
await loading.Navigation.PopModalAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
else
|
||||
{//拒绝登陆时打开登录页面
|
||||
await loading.Navigation.PopModalAsync();
|
||||
|
||||
var logpage = new View.LogPage();
|
||||
await Navigation.PushModalAsync(logpage);
|
||||
await Navigation.PushModalAsync(new NavigationPage(logpage));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Runtime.Intrinsics.X86;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace SunlightAggregationTerminal.Class
|
||||
{
|
||||
public class AES
|
||||
{
|
||||
public static string AesEncipher(string Key, string dat) //加密
|
||||
{
|
||||
//压缩
|
||||
byte[] plainBytes = Compress( Encoding.UTF8.GetBytes(dat));
|
||||
|
||||
using var sha256 = System.Security.Cryptography.SHA256.Create();
|
||||
using var aes = System.Security.Cryptography.Aes.Create();
|
||||
|
||||
aes.Key = sha256.ComputeHash(Encoding.UTF8.GetBytes(Key));
|
||||
aes.Mode = CipherMode.CBC;
|
||||
aes.Padding = PaddingMode.PKCS7;
|
||||
aes.GenerateIV(); // 生成随机 IV
|
||||
|
||||
using var enc = aes.CreateEncryptor();
|
||||
byte[] cipherBytes = enc.TransformFinalBlock(plainBytes, 0, plainBytes.Length);
|
||||
|
||||
//将 IV (16字节) 和 密文 拼接成一个完整的字节数组
|
||||
byte[] combinedBytes = new byte[aes.IV.Length + cipherBytes.Length];
|
||||
Buffer.BlockCopy(aes.IV, 0, combinedBytes, 0, aes.IV.Length);
|
||||
Buffer.BlockCopy(cipherBytes, 0, combinedBytes, aes.IV.Length, cipherBytes.Length);
|
||||
|
||||
return Convert.ToBase64String(combinedBytes);
|
||||
}
|
||||
|
||||
public static string AesDecrypt(string Key, string dat)//解密
|
||||
{
|
||||
// 解码Base64
|
||||
byte[] cipherBytes = Convert.FromBase64String(dat);
|
||||
|
||||
using var sha256 = System.Security.Cryptography.SHA256.Create();
|
||||
using var aes = System.Security.Cryptography.Aes.Create();
|
||||
|
||||
aes.Key = sha256.ComputeHash(Encoding.UTF8.GetBytes(Key));
|
||||
aes.Mode = CipherMode.CBC;
|
||||
aes.Padding = PaddingMode.PKCS7;
|
||||
// 从字节数组中提取前 16 字节作为 IV
|
||||
aes.IV = cipherBytes.AsSpan(0, 16).ToArray();
|
||||
using var dec = aes.CreateDecryptor();
|
||||
|
||||
// 解密
|
||||
byte[] bytes = dec.TransformFinalBlock(cipherBytes, 16, cipherBytes.Length - 16);
|
||||
//解压缩并返回
|
||||
return Encoding.UTF8.GetString(Decompress(bytes));
|
||||
}
|
||||
|
||||
// 3. Brotli 压缩辅助方法
|
||||
private static byte[] Compress(byte[] data)
|
||||
{
|
||||
using var output = new MemoryStream();
|
||||
using (var brotli = new BrotliStream(output, CompressionLevel.Optimal))
|
||||
{
|
||||
brotli.Write(data, 0, data.Length);
|
||||
}
|
||||
return output.ToArray();
|
||||
}
|
||||
|
||||
// 4. Brotli 解压辅助方法
|
||||
private static byte[] Decompress(byte[] data)
|
||||
{
|
||||
using var input = new MemoryStream(data);
|
||||
using var brotli = new BrotliStream(input, CompressionMode.Decompress);
|
||||
using var output = new MemoryStream();
|
||||
brotli.CopyTo(output);
|
||||
return output.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
+18
-4
@@ -102,7 +102,8 @@ namespace SunlightAggregationTerminal.Class
|
||||
try
|
||||
{
|
||||
Person deserializedPerson = JsonSerializer.Deserialize<Person>(dat)!;
|
||||
var data = JsonSerializer.Deserialize<Dictionary<string, object>>(deserializedPerson.Dat);
|
||||
var data = JsonSerializer.Deserialize<Dictionary<string, object>>
|
||||
(AES.AesDecrypt( deserializedPerson.Terminal,deserializedPerson.Dat));
|
||||
|
||||
if (data != null)
|
||||
{
|
||||
@@ -124,15 +125,23 @@ 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());
|
||||
}
|
||||
if (data.TryGetValue("ChemicalStatistics", out val) && val != null)//查询接受
|
||||
{
|
||||
InfoChemicalStatistics.Total_data(val.ToString()!);
|
||||
}
|
||||
if (data.TryGetValue("Query", out val) && val != null)//查询接受
|
||||
{
|
||||
QueryPage.Query_data(val.ToString()!);
|
||||
@@ -167,6 +176,7 @@ namespace SunlightAggregationTerminal.Class
|
||||
&& value_Notification_id != null)
|
||||
{
|
||||
_id = (int)value_Notification_id;
|
||||
App.GlobalData.NotificationID = _id.ToString();
|
||||
}
|
||||
if (dataNotificationrow!.TryGetValue("Title", out var value_Notification_Title)
|
||||
&& value_Notification_Title != null)
|
||||
@@ -205,6 +215,10 @@ namespace SunlightAggregationTerminal.Class
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string sql = "UPDATE Users SET NotificationID = '" + App.GlobalData.NotificationID +
|
||||
"'WHERE User='" + App.GlobalData.User + "';";
|
||||
AppModels.Updata(sql);
|
||||
}
|
||||
if (data.TryGetValue("SETUSER", out val) && val != null)//信息通知接受
|
||||
{
|
||||
|
||||
+82
-75
@@ -40,70 +40,82 @@ namespace SunlightAggregationTerminal.Class
|
||||
else
|
||||
{
|
||||
await HttpClient(DataReceived.ServerIP);
|
||||
|
||||
HttpTransmit("{\"Command\":\"Log\"}");
|
||||
}
|
||||
}
|
||||
|
||||
public static async Task HttpClient(string url)
|
||||
{
|
||||
var config = new TouchSocketConfig();
|
||||
#region Http设置远程服务器地址
|
||||
config.SetRemoteIPHost("http://" + url);
|
||||
#endregion
|
||||
|
||||
#region Http客户端获取断线通知
|
||||
config.ConfigurePlugins(a =>
|
||||
try
|
||||
{
|
||||
//处理连接断开
|
||||
a.AddTcpClosedPlugin(async (c, e) =>
|
||||
{
|
||||
//MainThread.BeginInvokeOnMainThread(() =>
|
||||
// {
|
||||
// Application.Current!.Windows[0].Page!.DisplayAlertAsync("", "客户端断开连接", "是");
|
||||
// });
|
||||
// await e.InvokeNext();
|
||||
});
|
||||
//自动重连
|
||||
a.UseReconnection<TouchSocket.Http.HttpClient>(options =>
|
||||
{
|
||||
options.PollingInterval = TimeSpan.FromSeconds(3);
|
||||
});
|
||||
//处理连接
|
||||
a.AddTcpConnectedPlugin(async (c, e) =>
|
||||
{
|
||||
await e.InvokeNext();
|
||||
});
|
||||
});
|
||||
#endregion
|
||||
var config = new TouchSocketConfig();
|
||||
#region Http设置远程服务器地址
|
||||
config.SetRemoteIPHost("http://" + url);
|
||||
#endregion
|
||||
|
||||
if (httpclient.Online)//是否重置客户端
|
||||
#region Http客户端获取断线通知
|
||||
config.ConfigurePlugins(a =>
|
||||
{
|
||||
//处理连接断开
|
||||
a.AddTcpClosedPlugin(async (c, e) =>
|
||||
{
|
||||
//MainThread.BeginInvokeOnMainThread(() =>
|
||||
// {
|
||||
// Application.Current!.Windows[0].Page!.DisplayAlertAsync("", "客户端断开连接", "是");
|
||||
// });
|
||||
// await e.InvokeNext();
|
||||
});
|
||||
//自动重连
|
||||
a.UseReconnection<TouchSocket.Http.HttpClient>(options =>
|
||||
{
|
||||
options.PollingInterval = TimeSpan.FromSeconds(3);
|
||||
});
|
||||
//处理连接
|
||||
a.AddTcpConnectedPlugin(async (c, e) =>
|
||||
{
|
||||
await e.InvokeNext();
|
||||
});
|
||||
});
|
||||
#endregion
|
||||
|
||||
if (httpclient.Online)//是否重置客户端
|
||||
{
|
||||
await httpclient.CloseAsync();
|
||||
}
|
||||
|
||||
//配置config
|
||||
await httpclient.SetupAsync(config);
|
||||
//连接
|
||||
await httpclient.ConnectAsync();
|
||||
|
||||
HttpTransmit("{\"Command\":\"Log\"}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await httpclient.CloseAsync();
|
||||
MainThread.BeginInvokeOnMainThread(() =>
|
||||
{
|
||||
Application.Current!.Windows[0].Page!.DisplayAlertAsync("网络错误", ex.Message.ToString(), "是");
|
||||
});
|
||||
await httpclient.CloseAsync();
|
||||
httpclient.Dispose();
|
||||
}
|
||||
|
||||
//配置config
|
||||
await httpclient.SetupAsync(config);
|
||||
//连接
|
||||
await httpclient.ConnectAsync();
|
||||
}
|
||||
|
||||
/***发送信息处理***/
|
||||
private static int HttpOutN=0;
|
||||
public static async void HttpTransmit(string Dat)
|
||||
{
|
||||
if (!httpclient.Online) //检查连接
|
||||
{
|
||||
await httpclient.ConnectAsync();
|
||||
}
|
||||
Dispose();
|
||||
|
||||
var dat = new DataReceived.Person()
|
||||
{
|
||||
User = DataReceived.ServerName,
|
||||
Password = DataReceived.ServerPassword,
|
||||
Password = AES.AesEncipher(DataReceived.ServerTerminal, DataReceived.ServerPassword),
|
||||
IP = DataReceived.GetLocalIpSimple(),
|
||||
Terminal = DataReceived.ServerTerminal,
|
||||
Dat = Dat
|
||||
Dat = AES.AesEncipher(DataReceived.ServerTerminal, Dat),
|
||||
};
|
||||
|
||||
var request = new HttpRequest();
|
||||
@@ -114,7 +126,7 @@ namespace SunlightAggregationTerminal.Class
|
||||
.AsPost();
|
||||
|
||||
// 创建一个超时操作,15秒后取消
|
||||
using var cts = new CancellationTokenSource(1000 * 15);
|
||||
using var cts = new CancellationTokenSource(1000 * 10);
|
||||
try
|
||||
{
|
||||
using (var responseResult = await httpclient.RequestAsync(request, cts.Token))
|
||||
@@ -127,50 +139,45 @@ namespace SunlightAggregationTerminal.Class
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
// 专门处理超时或主动取消的情况
|
||||
MainThread.BeginInvokeOnMainThread(() =>
|
||||
if (HttpOutN >= 3)
|
||||
{
|
||||
Application.Current!.Windows[0].Page!.DisplayAlertAsync("网络错误", "网络请求超时,请检查网络网络连接", "是");
|
||||
});
|
||||
HttpOutN = 0;
|
||||
// 专门处理超时或主动取消的情况
|
||||
MainThread.BeginInvokeOnMainThread(() =>
|
||||
{
|
||||
Application.Current!.Windows[0].Page!.DisplayAlertAsync("网络错误", "网络请求超时,请检查网络网络连接", "是");
|
||||
});
|
||||
await httpclient.CloseAsync();
|
||||
httpclient.Dispose();
|
||||
}
|
||||
else
|
||||
{
|
||||
HttpTransmit(Dat);//回调
|
||||
HttpOutN++;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MainThread.BeginInvokeOnMainThread(() =>
|
||||
if (HttpOutN >= 3)
|
||||
{
|
||||
Application.Current!.Windows[0].Page!.DisplayAlertAsync("网络错误", ex.Message.ToString(), "是");
|
||||
});
|
||||
HttpOutN = 0;
|
||||
MainThread.BeginInvokeOnMainThread(() =>
|
||||
{
|
||||
Application.Current!.Windows[0].Page!.DisplayAlertAsync("访问错误", ex.Message.ToString(), "是");
|
||||
});
|
||||
await httpclient.CloseAsync();
|
||||
httpclient.Dispose();
|
||||
}
|
||||
else
|
||||
{
|
||||
HttpTransmit(Dat);//回调
|
||||
HttpOutN++;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
Start();
|
||||
}
|
||||
}
|
||||
|
||||
//倒计时5秒关闭http客户端
|
||||
private static Timer? _timer;
|
||||
private static bool _isDisposed = false;
|
||||
private static void Start()
|
||||
{
|
||||
// 延迟30秒后执行一次,不自动循环
|
||||
_timer = new Timer(Httpout, null, TimeSpan.FromSeconds(60), Timeout.InfiniteTimeSpan);
|
||||
}
|
||||
private static async void Dispose()
|
||||
{
|
||||
if (!_isDisposed)
|
||||
{
|
||||
_isDisposed = true;
|
||||
_timer?.Dispose(); // 释放定时器资源
|
||||
_timer = null;
|
||||
}
|
||||
}
|
||||
private static async void Httpout(object? state)
|
||||
{
|
||||
if (httpclient.Online)
|
||||
{
|
||||
await httpclient.CloseAsync();
|
||||
}
|
||||
Dispose();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -160,6 +160,12 @@ namespace SunlightAggregationTerminal.Class
|
||||
string sql = "ALTER TABLE Users ADD COLUMN MessageNotificationMode BOOL DEFAULT (0);";
|
||||
SQLitedata.ExecuteNonQuery(sql, null);
|
||||
}
|
||||
// 检查 NotificationID
|
||||
if (!existingColumns.Contains("NotificationID"))
|
||||
{
|
||||
string sql = "ALTER TABLE Users ADD COLUMN NotificationID TEXT;";
|
||||
SQLitedata.ExecuteNonQuery(sql, null);
|
||||
}
|
||||
// 检查 GUID
|
||||
if (!existingColumns.Contains("GUID"))
|
||||
{
|
||||
@@ -290,6 +296,7 @@ namespace SunlightAggregationTerminal.Class
|
||||
LocalAreaNetworkMode BOOL DEFAULT (0),
|
||||
DarkMode BOOL DEFAULT (0),
|
||||
MessageNotificationMode BOOL DEFAULT (0),
|
||||
NotificationID TEXT,
|
||||
GUID TEXT
|
||||
);";
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="0 0 24 24"><path fill="currentColor" d="M19.94 9.06C19.5 5.73 16.57 3 13 3C9.47 3 6.57 5.61 6.08 9l-1.93 3.48c-.41.66.07 1.52.85 1.52h1v2c0 1.1.9 2 2 2h1v3h7v-4.68a7.02 7.02 0 0 0 3.94-7.26m-5.05 5.57l-.89.42V19h-3v-3H8v-4H6.7l1.33-2.33C8.21 7.06 10.35 5 13 5c2.76 0 5 2.24 5 5c0 2.09-1.29 3.88-3.11 4.63"/><path fill="currentColor" d="M12.5 12.54c-.41 0-.74.31-.74.73c0 .41.33.74.74.74c.42 0 .73-.33.73-.74a.71.71 0 0 0-.73-.73m0-5.54c-1.03 0-1.74.67-2 1.45l.96.4c.13-.39.43-.86 1.05-.86c.95 0 1.13.89.8 1.36c-.32.45-.86.75-1.14 1.26c-.23.4-.18.87-.18 1.16h1.06c0-.55.04-.65.13-.82c.23-.42.65-.62 1.09-1.27c.4-.59.25-1.38-.01-1.8c-.31-.49-.9-.88-1.76-.88"/></svg>
|
||||
|
After Width: | Height: | Size: 738 B |
@@ -0,0 +1,70 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="SunlightAggregationTerminal.InfoChemicalStatistics"
|
||||
Title="耗用统计">
|
||||
<Grid>
|
||||
<Grid RowDefinitions="Auto, *" >
|
||||
<Grid ColumnDefinitions="*, Auto" Grid.Row="0" Grid.Column="0" Margin="5">
|
||||
<HorizontalStackLayout Grid.Row="0" Grid.Column="0" Margin="5,0,0,0" >
|
||||
<DatePicker x:Name="StartTime" Format="yyyy年MM月dd日" FontSize="16"
|
||||
MaximumWidthRequest="150" MinimumWidthRequest="130" WidthRequest="135"/>
|
||||
<Label Text="~" FontSize="28"/>
|
||||
<DatePicker x:Name="EndTime" Format="yyyy年MM月dd日" FontSize="16"
|
||||
MaximumWidthRequest="150" MinimumWidthRequest="130" WidthRequest="135"/>
|
||||
</HorizontalStackLayout>
|
||||
<Button Grid.Row="0" Grid.Column="1" Text="查询" Clicked="Button_Clicked"
|
||||
WidthRequest="60" Padding="5,0,5,0" Margin="20,0,0,5" />
|
||||
</Grid>
|
||||
<CollectionView Grid.Row="1" x:Name="CardCollectionView">
|
||||
<!-- 保持滚动条 -->
|
||||
<CollectionView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<!-- 这里定义单个卡片的 UI 结构 -->
|
||||
<Border BackgroundColor="White" Stroke="#CCCCCC"
|
||||
StrokeThickness="2" Margin="10,0,10,10"
|
||||
StrokeShape="RoundRectangle 10">
|
||||
<VerticalStackLayout>
|
||||
<!-- 设备信息 -->
|
||||
<HorizontalStackLayout>
|
||||
<Label Text="原料: " FontAttributes="Bold"
|
||||
FontSize="22" TextColor="Black"/>
|
||||
<Label Text="{Binding ProductName}" FontAttributes="Bold"
|
||||
FontSize="22" TextColor="Black"/>
|
||||
</HorizontalStackLayout>
|
||||
<HorizontalStackLayout>
|
||||
<Label Text="代码: " FontAttributes="Bold"
|
||||
FontSize="22" TextColor="Black"/>
|
||||
<Label Text="{Binding ProductCode}" FontAttributes="Bold"
|
||||
FontSize="22" TextColor="Black"/>
|
||||
</HorizontalStackLayout>
|
||||
<HorizontalStackLayout>
|
||||
<Label Text="用量: " FontAttributes="Bold"
|
||||
FontSize="22" TextColor="Black"/>
|
||||
<Label Text="{Binding TotalDispenseGrams}" FontAttributes="Bold"
|
||||
FontSize="22" TextColor="Black"/>
|
||||
<Label Text="Kg" FontAttributes="Bold"
|
||||
FontSize="22" TextColor="Black"/>
|
||||
</HorizontalStackLayout>
|
||||
</VerticalStackLayout>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</CollectionView.ItemTemplate>
|
||||
</CollectionView>
|
||||
</Grid>
|
||||
<!-- 查询中动画页面 -->
|
||||
<Grid x:Name="LoadingIndicator" BackgroundColor="Gray"
|
||||
IsVisible="False" Opacity="0.9">
|
||||
<VerticalStackLayout Padding="30" Spacing="10"
|
||||
VerticalOptions="Center"
|
||||
HorizontalOptions="Center">
|
||||
<ActivityIndicator IsRunning="True"
|
||||
Color="#512BD4"
|
||||
HorizontalOptions="Center"
|
||||
VerticalOptions="Center" />
|
||||
<Label Text="查询中..." FontAttributes="Bold"
|
||||
FontSize="24" TextColor="Black"/>
|
||||
</VerticalStackLayout>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</ContentPage>
|
||||
@@ -0,0 +1,89 @@
|
||||
using SunlightAggregationTerminal.Class;
|
||||
using SunlightAggregationTerminal.Models;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Reflection;
|
||||
using System.Text.Json;
|
||||
using TouchSocket.Core;
|
||||
|
||||
namespace SunlightAggregationTerminal;
|
||||
|
||||
public partial class InfoChemicalStatistics : ContentPage
|
||||
{
|
||||
public class ChemicalTotal
|
||||
{
|
||||
public string? ProductName { get; set; }
|
||||
public string? ProductCode { get; set; }
|
||||
public float? TotalDispenseGrams { get; set; }
|
||||
}
|
||||
|
||||
public static ObservableCollection<ChemicalTotal> ChemicalTotals { get; set; } = new();
|
||||
public InfoChemicalStatistics()
|
||||
{
|
||||
InitializeComponent();
|
||||
Dictionary<string, object> Dictionary = new Dictionary<string, object>();
|
||||
Dictionary.Add("Command", "ChemicalStatistics");
|
||||
DateTime StartTimee_ = (DateTime)StartTime.Date!;
|
||||
Dictionary.Add("StartTime", StartTimee_.ToString("yyyy-MM-dd"));
|
||||
DateTime EndTime_ = (DateTime)EndTime.Date!;
|
||||
Dictionary.Add("EndTime", EndTime_.AddDays(1).ToString("yyyy-MM-dd"));
|
||||
Total_Command(Dictionary.ToJsonString());
|
||||
}
|
||||
|
||||
public async void Total_Command(string dat)
|
||||
{
|
||||
LoadingIndicator.IsVisible = true;
|
||||
ChemicalTotals.Clear();
|
||||
|
||||
DataReceived.Transmit(dat);
|
||||
|
||||
// 创建一个 15 秒的延时任务
|
||||
Task delayTask = Task.Delay(15000);
|
||||
// 创建一个监测任务,不断检查变量
|
||||
Task monitorTask = Task.Run(async () =>
|
||||
{
|
||||
while (ChemicalTotals.Count == 0)
|
||||
{
|
||||
// 每隔 100 毫秒检查一次,避免 CPU 占用过高
|
||||
await Task.Delay(100);
|
||||
}
|
||||
});
|
||||
// 使用 Task.WhenAny 等待任意一个任务完成
|
||||
await Task.WhenAny(delayTask, monitorTask);
|
||||
CardCollectionView.ItemsSource = ChemicalTotals;
|
||||
|
||||
LoadingIndicator.IsVisible = false;
|
||||
}
|
||||
|
||||
public static void Total_data(string dat)
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = JsonSerializer.Deserialize<List<ChemicalTotal>>(dat);
|
||||
|
||||
if (data != null)
|
||||
{
|
||||
foreach (var item in data)
|
||||
{
|
||||
item.TotalDispenseGrams = MathF.Round((float)item.TotalDispenseGrams! / 1000, 5);
|
||||
|
||||
ChemicalTotals.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//搜索按钮
|
||||
private void Button_Clicked(object sender, EventArgs e)
|
||||
{
|
||||
Dictionary<string, object> Dictionary = new Dictionary<string, object>();
|
||||
Dictionary.Add("Command", "ChemicalStatistics");
|
||||
DateTime StartTimee_ = (DateTime)StartTime.Date!;
|
||||
Dictionary.Add("StartTime", StartTimee_.ToString("yyyy-MM-dd"));
|
||||
DateTime EndTime_ = (DateTime)EndTime.Date!;
|
||||
Dictionary.Add("EndTime", EndTime_.AddDays(1).ToString("yyyy-MM-dd"));
|
||||
Total_Command(Dictionary.ToJsonString());
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -136,7 +136,7 @@
|
||||
<HorizontalStackLayout>
|
||||
<Label Text="呼叫时间: " FontAttributes="Bold"
|
||||
FontSize="22" TextColor="Black"/>
|
||||
<Label Text="{Binding UsageTime}" FontAttributes="Bold"
|
||||
<Label Text="{Binding CallTime}" FontAttributes="Bold"
|
||||
FontSize="22" TextColor="Black"/>
|
||||
</HorizontalStackLayout>
|
||||
<HorizontalStackLayout>
|
||||
|
||||
+77
-52
@@ -2,6 +2,7 @@ using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using SunlightAggregationTerminal.Class;
|
||||
using SunlightAggregationTerminal.Models;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Data;
|
||||
using System.Reflection.PortableExecutable;
|
||||
using System.Text.Json;
|
||||
using TouchSocket.Core;
|
||||
@@ -312,8 +313,8 @@ public class InfoMachineItem
|
||||
{
|
||||
ProbuctItem probuctItem = new ProbuctItem();
|
||||
|
||||
probuctItem.ProductCode = item.GetValue("ProductCode").ToString()!;
|
||||
probuctItem.ProductName = item.GetValue("ProductName").ToString()!;
|
||||
probuctItem.ProductCode = SafeGet(item, "ProductCode");
|
||||
probuctItem.ProductName = SafeGet(item, "ProductName");
|
||||
if (item.GetValue("Enabled").ToString()! == "1")
|
||||
{
|
||||
probuctItem.ProductState = "启用";
|
||||
@@ -348,13 +349,13 @@ public class InfoMachineItem
|
||||
{
|
||||
foreach (var item in data!)
|
||||
{
|
||||
string inf_ = "染机: " + item.GetValue("Machine").ToString()! + "\n";
|
||||
inf_ = inf_ + "料单: " + item.GetValue("Dyelot").ToString()!;
|
||||
inf_ = inf_ + "@" + item.GetValue("ReDye").ToString()! + "\n";
|
||||
inf_ = inf_ + "步骤: " + item.GetValue("StepNumber").ToString()! + "\n";
|
||||
inf_ = inf_ + "流程: " + item.GetValue("Process").ToString()! + "\n";
|
||||
inf_ = inf_ + "化料桶: " + item.GetValue("TankNO").ToString()! + "\n";
|
||||
inf_ = inf_ + "染料桶数: " + item.GetValue("TotalNumber").ToString()!;
|
||||
string inf_ = "染机: " + SafeGet(item, "Machine")+ "\n";
|
||||
inf_ = inf_ + "料单: " + SafeGet(item, "Dyelot");
|
||||
inf_ = inf_ + "@" + SafeGet(item, "ReDye") + "\n";
|
||||
inf_ = inf_ + "步骤: " + SafeGet(item, "StepNumber") + "\n";
|
||||
inf_ = inf_ + "流程: " + SafeGet(item, "Process") + "\n";
|
||||
inf_ = inf_ + "化料桶: " + SafeGet(item, "TankNO") + "\n";
|
||||
inf_ = inf_ + "染料桶数: " + SafeGet(item, "TotalNumber");
|
||||
if (item!.TryGetValue("BarrelState", out var _Type) && _Type != null)
|
||||
{
|
||||
string temp = _Type?.ToString() ?? "";
|
||||
@@ -367,7 +368,7 @@ public class InfoMachineItem
|
||||
};
|
||||
inf_ = inf_ + _Type;
|
||||
}
|
||||
inf_ = inf_ + "状态: " + item.GetValue("State").ToString()! + "\n";
|
||||
inf_ = inf_ + "状态: " + SafeGet(item, "State") + "\n";
|
||||
|
||||
InfoMachineItem infoMachineItem = new InfoMachineItem();
|
||||
infoMachineItem.inf = inf_;
|
||||
@@ -380,10 +381,10 @@ public class InfoMachineItem
|
||||
{
|
||||
foreach (var item in data!)
|
||||
{
|
||||
string inf_ = "位置: " + item.GetValue("position").ToString()! + "\n";
|
||||
inf_ = inf_ + "料单: " + item.GetValue("Dyelot").ToString()!;
|
||||
inf_ = inf_ + "@" + item.GetValue("ReDye").ToString()! + "\n";
|
||||
inf_ = inf_ + "步骤: " + item.GetValue("StepNumber").ToString()! + "\n";
|
||||
string inf_ = "位置: " + SafeGet(item, "Position") + "\n";
|
||||
inf_ = inf_ + "料单: " + SafeGet(item, "Dyelot");
|
||||
inf_ = inf_ + "@" + SafeGet(item, "ReDye") + "\n";
|
||||
inf_ = inf_ + "步骤: " + SafeGet(item, "StepNumber") + "\n";
|
||||
if (item!.TryGetValue("BarrelType", out var _Type) && _Type != null)
|
||||
{
|
||||
string temp = _Type?.ToString() ?? "";
|
||||
@@ -406,10 +407,10 @@ public class InfoMachineItem
|
||||
};
|
||||
inf_ = inf_ + _BarrelState;
|
||||
}
|
||||
inf_ = inf_ + "[" + item.GetValue("Barrelserialnumber").ToString()! + "]\n";
|
||||
inf_ = inf_ + "上架时间: " + DateTime.Parse(item.GetValue("createtime").ToString() ?? "")
|
||||
inf_ = inf_ + "[" + SafeGet(item, "Barrelserialnumber") + "]\n";
|
||||
inf_ = inf_ + "上架时间: " + DateTime.Parse(item.GetValue("Createtime").ToString() ?? "")
|
||||
.ToString("yyyy-MM-dd HH:mm:ss") + "\n";
|
||||
inf_ = inf_ + "状态 [" + item.GetValue("State").ToString()! + "]";
|
||||
inf_ = inf_ + "状态 [" + SafeGet(item, "State") + "]";
|
||||
|
||||
InfoMachineItem infoMachineItem = new InfoMachineItem();
|
||||
infoMachineItem.inf = inf_;
|
||||
@@ -422,15 +423,15 @@ public class InfoMachineItem
|
||||
{
|
||||
foreach (var item in data!)
|
||||
{
|
||||
string inf_ = "染机: " + item.GetValue("Machine").ToString()! + "\n";
|
||||
inf_ = inf_ + "料单: " + item.GetValue("Dyelot").ToString()!;
|
||||
inf_ = inf_ + "@" + item.GetValue("ReDye").ToString()! + "\n";
|
||||
inf_ = inf_ + "步骤: " + item.GetValue("StepNumber").ToString()! + "\n";
|
||||
inf_ = inf_ + "总浴量: " + item.GetValue("Volume").ToString()! + "\n";
|
||||
inf_ = inf_ + "计量模组: " + item.GetValue("DispenseModule").ToString()! + "\n";
|
||||
string inf_ = "染机: " + SafeGet(item, "Machine") + "\n";
|
||||
inf_ = inf_ + "料单: " + SafeGet(item, "Dyelot");
|
||||
inf_ = inf_ + "@" + SafeGet(item, "ReDye") + "\n";
|
||||
inf_ = inf_ + "步骤: " + SafeGet(item, "StepNumber") + "\n";
|
||||
inf_ = inf_ + "总浴量: " + SafeGet(item, "Volume")+ "\n";
|
||||
inf_ = inf_ + "计量模组: " + SafeGet(item, "DispenseModule") + "\n";
|
||||
if (item!.TryGetValue("TankNo", out var _TankNo) && _TankNo != null)
|
||||
{
|
||||
inf_ = inf_ + "目标位置: " + item.GetValue("TankNo").ToString()! + "\n";
|
||||
inf_ = inf_ + "目标位置: " + item.GetValue("TankNo") + "\n";
|
||||
}
|
||||
else {
|
||||
inf_ = inf_ + "目标位置: 未指定\n" ;
|
||||
@@ -458,7 +459,6 @@ public class InfoMachineItem
|
||||
{
|
||||
InfoMachineItems.Add(infoMachineItem);
|
||||
}
|
||||
|
||||
}
|
||||
if (InfoMachineItems.Count==0) InfoMachineItems.Add(new InfoMachineItem());
|
||||
}
|
||||
@@ -468,12 +468,12 @@ public class InfoMachineItem
|
||||
foreach (var item in data!)
|
||||
{
|
||||
DyelotDetailsItem dyelotDetailsItem = new DyelotDetailsItem();
|
||||
dyelotDetailsItem.Dyelot = item.GetValue("Dyelot").ToString()!;
|
||||
dyelotDetailsItem.ReDye =int.Parse( item.GetValue("ReDye").ToString()!);
|
||||
dyelotDetailsItem.StepNumber = int.Parse(item.GetValue("StepNumber").ToString()!);
|
||||
dyelotDetailsItem.Notes = "染机: " + item.GetValue("Machine").ToString()!+"\n";
|
||||
dyelotDetailsItem.Notes = dyelotDetailsItem.Notes +
|
||||
"流程: " + item.GetValue("Process").ToString()!+"\n";
|
||||
dyelotDetailsItem.Dyelot = SafeGet(item,"Dyelot");
|
||||
dyelotDetailsItem.ReDye = int.Parse(SafeGet(item, "ReDye"));
|
||||
dyelotDetailsItem.StepNumber = int.Parse(SafeGet(item, "StepNumber"));
|
||||
dyelotDetailsItem.Notes = "染机: " + SafeGet(item, "Machine") + "\n";
|
||||
dyelotDetailsItem.Notes = dyelotDetailsItem.Notes +
|
||||
"流程: " + SafeGet(item, "Process") + "\n";
|
||||
if (item!.TryGetValue("State", out var _State) && _State != null)
|
||||
{
|
||||
string temp = _State?.ToString() ?? "";
|
||||
@@ -494,9 +494,16 @@ public class InfoMachineItem
|
||||
{
|
||||
dyelotDetailsItem.Notes = dyelotDetailsItem.Notes + " [" + _TotalNumber+"桶]";
|
||||
}
|
||||
dyelotDetailsItem.DispenseStartTime = item.GetValue("DispenseStartTime").ToString()!.Replace("T", " ");
|
||||
dyelotDetailsItem.DispenseEndTime = item.GetValue("DispenseEndTime").ToString()!.Replace("T", " ");
|
||||
dyelotDetailsItem.UsageTime = item.GetValue("CallTime").ToString()!.Replace("T", " ");
|
||||
dyelotDetailsItem.DispenseStartTime = SafeGet(item, "DispenseStartTime", "T").Replace("T", " ");
|
||||
dyelotDetailsItem.DispenseEndTime = SafeGet(item, "DispenseEndTime", "T").Replace("T", " ");
|
||||
|
||||
if (item!.TryGetValue("CallTime", out var _CallTime) && _CallTime != null)
|
||||
{
|
||||
if (DateTime.TryParse(_CallTime.ToString(), out DateTime dtc))
|
||||
{
|
||||
dyelotDetailsItem.CallTime = dtc.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
}
|
||||
}
|
||||
InfoDyelotHistoryItems.Add(dyelotDetailsItem);
|
||||
}
|
||||
if (InfoDyelotHistoryItems.Count == 0) InfoDyelotHistoryItems.Add(new DyelotDetailsItem());
|
||||
@@ -507,10 +514,10 @@ public class InfoMachineItem
|
||||
foreach (var item in data!)
|
||||
{
|
||||
DyelotDetailsItem dyelotDetailsItem = new DyelotDetailsItem();
|
||||
dyelotDetailsItem.Dyelot = item.GetValue("Dyelot").ToString()!;
|
||||
dyelotDetailsItem.ReDye = int.Parse(item.GetValue("ReDye").ToString()!);
|
||||
dyelotDetailsItem.StepNumber = int.Parse(item.GetValue("StepNumber").ToString()!);
|
||||
dyelotDetailsItem.Notes = "位置: " + item.GetValue("Position").ToString()! + "\n";
|
||||
dyelotDetailsItem.Dyelot = SafeGet(item, "Dyelot");
|
||||
dyelotDetailsItem.ReDye = int.Parse(SafeGet(item, "ReDye"));
|
||||
dyelotDetailsItem.StepNumber = int.Parse(SafeGet(item, "StepNumber"));
|
||||
dyelotDetailsItem.Notes = "位置: " + SafeGet(item, "Position") + "\n";
|
||||
if (item!.TryGetValue("BarrelType", out var _Type) && _Type != null)
|
||||
{
|
||||
string temp = _Type?.ToString() ?? "";
|
||||
@@ -533,15 +540,16 @@ public class InfoMachineItem
|
||||
};
|
||||
dyelotDetailsItem.Notes = dyelotDetailsItem.Notes + _BarrelState;
|
||||
}
|
||||
dyelotDetailsItem.Notes = dyelotDetailsItem.Notes + "[" + item.GetValue("Barrelserialnumber").ToString()! + "]\n";
|
||||
dyelotDetailsItem.Notes = dyelotDetailsItem.Notes + "[" + SafeGet(item, "Barrelserialnumber") + "]\n";
|
||||
if (item!.TryGetValue("State", out var _State) && _State != null)
|
||||
{
|
||||
dyelotDetailsItem.Notes = dyelotDetailsItem.Notes + "状态: " + _State;
|
||||
}
|
||||
dyelotDetailsItem.DispenseStartTime = "";
|
||||
dyelotDetailsItem.DispenseStartTime = SafeGet(item, "CreateTime", "T").Replace("T", " ");
|
||||
dyelotDetailsItem.DispenseEndTime = "";
|
||||
dyelotDetailsItem.UsageTime = item.GetValue("Createtime").ToString()!.Replace("T", " ");
|
||||
InfoDyelotHistoryItems.Add(dyelotDetailsItem);
|
||||
dyelotDetailsItem.UsageTime = SafeGet(item , "CreateTime","T").Replace("T", " ");
|
||||
dyelotDetailsItem.CallTime = SafeGet(item, "CreateTime", "T").Replace("T", " ");
|
||||
InfoDyelotHistoryItems.Add(dyelotDetailsItem);
|
||||
}
|
||||
if (InfoDyelotHistoryItems.Count == 0) InfoDyelotHistoryItems.Add(new DyelotDetailsItem());
|
||||
}
|
||||
@@ -551,10 +559,10 @@ public class InfoMachineItem
|
||||
foreach (var item in data!)
|
||||
{
|
||||
DyelotDetailsItem dyelotDetailsItem = new DyelotDetailsItem();
|
||||
dyelotDetailsItem.Dyelot = item.GetValue("Dyelot").ToString()!;
|
||||
dyelotDetailsItem.ReDye = int.Parse(item.GetValue("ReDye").ToString()!);
|
||||
dyelotDetailsItem.StepNumber = int.Parse(item.GetValue("StepNumber").ToString()!);
|
||||
dyelotDetailsItem.Notes = "染机: " + item.GetValue("Machine").ToString()! + "\n";
|
||||
dyelotDetailsItem.Dyelot = SafeGet(item, "Dyelot");
|
||||
dyelotDetailsItem.ReDye = int.Parse(SafeGet(item, "ReDye"));
|
||||
dyelotDetailsItem.StepNumber = int.Parse(SafeGet(item, "StepNumber"));
|
||||
dyelotDetailsItem.Notes = "染机: " + SafeGet(item, "Machine") + "\n";
|
||||
if (item!.TryGetValue("State", out var _State) && _State != null)
|
||||
{
|
||||
string temp = _State?.ToString() ?? "";
|
||||
@@ -566,16 +574,33 @@ public class InfoMachineItem
|
||||
_ => "无信息"
|
||||
};
|
||||
dyelotDetailsItem.Notes = dyelotDetailsItem.Notes + "状态: " + _State;
|
||||
}
|
||||
dyelotDetailsItem.DispenseStartTime = item.GetValue("DispenseStartTime").ToString()!.Replace("T", " ");
|
||||
dyelotDetailsItem.DispenseEndTime = item.GetValue("DispenseEndTime").ToString()!.Replace("T", " ");
|
||||
dyelotDetailsItem.UsageTime = item.GetValue("CallTime").ToString()!.Replace("T", " ");
|
||||
}
|
||||
dyelotDetailsItem.DispenseStartTime = SafeGet(item, "DispenseStartTime", "T").Replace("T", " ");
|
||||
dyelotDetailsItem.DispenseEndTime = SafeGet(item, "DispenseEndTime", "T").Replace("T", " ");
|
||||
if (item!.TryGetValue("CallTime", out var _CallTime) && _CallTime != null)
|
||||
{
|
||||
if (DateTime.TryParse(_CallTime.ToString(), out DateTime dtc))
|
||||
{
|
||||
dyelotDetailsItem.CallTime = dtc.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
}
|
||||
}
|
||||
InfoDyelotHistoryItems.Add(dyelotDetailsItem);
|
||||
}
|
||||
if (InfoDyelotHistoryItems.Count == 0) InfoDyelotHistoryItems.Add(new DyelotDetailsItem());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 辅助查询方法
|
||||
private static string SafeGet(Dictionary<string, object> item, string key, string defaultValue = "0")
|
||||
{
|
||||
//获取值并检查
|
||||
if (item!.TryGetValue(key, out var _dat) && _dat != null)
|
||||
{
|
||||
return _dat.ToString()!;
|
||||
}
|
||||
else
|
||||
{
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
+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 async void TapGestureRecognizer_ChemicalStatistics(object sender, TappedEventArgs e)
|
||||
{
|
||||
await Navigation.PushAsync(new InfoChemicalStatistics());
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
||||
+3
-6
@@ -13,7 +13,6 @@ namespace SunlightAggregationTerminal.Models
|
||||
|
||||
public static SqliteHelper sqliteHelper = SQLiteConfig.Config(Path.Combine(FileSystem.AppDataDirectory, "MyAppData.db"))!; //数据库连接路径(获取各平台的应用数据目录)
|
||||
private Timer timer;
|
||||
private static int TimerNotifications = -1440;
|
||||
public AppModels()
|
||||
{
|
||||
if(sqliteHelper != null)
|
||||
@@ -42,13 +41,14 @@ namespace SunlightAggregationTerminal.Models
|
||||
App.GlobalData.LocalAreaNetworkMode = Convert.ToBoolean(dat.Field<object>("LocalAreaNetworkMode"));
|
||||
App.GlobalData.DarkMode = Convert.ToBoolean(dat.Field<object>("DarkMode"));
|
||||
App.GlobalData.MessageNotificationMode = Convert.ToBoolean(dat.Field<object>("MessageNotificationMode"));
|
||||
App.GlobalData.NotificationID = dat.Field<string>("NotificationID")?? "0";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//启动通知轮询延迟120s启动周期600s
|
||||
timer = new Timer(TimerNotification, null, TimeSpan.FromSeconds(120), TimeSpan.FromSeconds(300));
|
||||
timer = new Timer(TimerNotification, null, TimeSpan.FromSeconds(120), TimeSpan.FromSeconds(120));
|
||||
}
|
||||
|
||||
//轮询通知的定时任务
|
||||
@@ -58,10 +58,9 @@ namespace SunlightAggregationTerminal.Models
|
||||
{
|
||||
Dictionary<string, object> NotificationDictionary = new Dictionary<string, object>();
|
||||
NotificationDictionary.Add("Command", "Notification");
|
||||
NotificationDictionary.Add("StartTime", DateTime.Now.AddMinutes(TimerNotifications).ToString("yyyy-MM-dd HH:mm:ss.fff"));
|
||||
NotificationDictionary.Add("StartTime", App.GlobalData.NotificationID);
|
||||
NotificationDictionary.Add("EndTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"));
|
||||
DataReceived.Transmit(NotificationDictionary.ToJsonString());
|
||||
TimerNotifications = -5;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,8 +133,6 @@ namespace SunlightAggregationTerminal.Models
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static string GetAppUniqueId()
|
||||
{
|
||||
const string key = "sunlight_app_unique_id";
|
||||
|
||||
@@ -37,6 +37,9 @@ namespace SunlightAggregationTerminal.Models
|
||||
public partial bool DarkMode { get; set; }
|
||||
[ObservableProperty]
|
||||
public partial bool MessageNotificationMode { get; set; }
|
||||
[ObservableProperty]
|
||||
public partial string NotificationID { get; set; }
|
||||
|
||||
|
||||
public class RefreshUISignal { }
|
||||
public static List<Dictionary<string, object>> Info_data = new List<Dictionary<string, object>>();
|
||||
|
||||
@@ -78,7 +78,8 @@ namespace SunlightAggregationTerminal.Models
|
||||
public string? DispenseTime { get; set; }
|
||||
public string? CallTime { get; set; }
|
||||
public string? UsageTime { get; set; }
|
||||
public string? Tank { get; set; }
|
||||
public string? Tank { get; set; }
|
||||
public object? PowderTargetTank { get; set; }
|
||||
public double? DispenseGrams { get; set; }
|
||||
public string DispenseGramsDisplay => DispenseGrams?.ToString("F2") ?? "";
|
||||
public int? DispenseResult { get; set; }
|
||||
@@ -92,7 +93,7 @@ namespace SunlightAggregationTerminal.Models
|
||||
public static List<NotificationItem> GetAllItems()
|
||||
{
|
||||
DataSet? data = AppModels.Select("select * from Notification Where Time > '" +
|
||||
DateTime.Now.AddDays(-30).ToString("yyyy-MM-dd HH:mm:ss.fff") + "'");
|
||||
DateTime.Now.AddDays(-60).ToString("yyyy-MM-dd HH:mm:ss.fff") + "'");
|
||||
|
||||
_NotificationData.Clear();
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ public partial class MessagePage : ContentPage
|
||||
MessageItems.Clear();
|
||||
|
||||
// 按时间倒序,并只取最新的 50 条
|
||||
var itemsToShow = allData.OrderByDescending(x => x.Time).Take(50).Where(x => x.Type == MsgType.Message);
|
||||
var itemsToShow = allData.OrderByDescending(x => x.Time).Take(100).Where(x => x.Type == MsgType.Message);
|
||||
|
||||
// 将数据添加到集合中,UI 会自动更新
|
||||
foreach (var item in itemsToShow)
|
||||
|
||||
@@ -25,7 +25,7 @@ public partial class NoticePage : ContentPage
|
||||
NoticeItems.Clear();
|
||||
|
||||
// 按时间倒序,并只取最新的 N 条(例如 50 条)
|
||||
var itemsToShow = allData.OrderByDescending(x => x.Time).Take(50).Where(x => x.Type == MsgType.Notice);
|
||||
var itemsToShow = allData.OrderByDescending(x => x.Time).Take(100).Where(x => x.Type == MsgType.Notice);
|
||||
|
||||
// 将数据添加到集合中,UI 会自动更新
|
||||
foreach (var item in itemsToShow)
|
||||
|
||||
@@ -24,7 +24,7 @@ public partial class SystemPage : ContentPage
|
||||
SystemItems.Clear();
|
||||
|
||||
// 按时间倒序,并只取最新的 N 条(例如 50 条)
|
||||
var itemsToShow = allData.OrderByDescending(x => x.Time).Take(50).Where(x => x.Type == MsgType.System);
|
||||
var itemsToShow = allData.OrderByDescending(x => x.Time).Take(100).Where(x => x.Type == MsgType.System);
|
||||
|
||||
// 将数据添加到集合中,UI 会自动更新
|
||||
foreach (var item in itemsToShow)
|
||||
|
||||
+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>
|
||||
|
||||
+6
-2
@@ -60,8 +60,6 @@
|
||||
FontSize="22" TextColor="Black"/>
|
||||
<Label Text="{Binding StepNumber}" FontAttributes="Bold"
|
||||
FontSize="22" TextColor="Black"/>
|
||||
<Label Text="{Binding Tank}" FontAttributes="Bold"
|
||||
FontSize="22" TextColor="Black"/>
|
||||
</HorizontalStackLayout>
|
||||
<HorizontalStackLayout>
|
||||
<Label Text="呼叫时间: " FontAttributes="Bold"
|
||||
@@ -81,6 +79,12 @@
|
||||
<Label Text="{Binding UsageTime}" FontAttributes="Bold"
|
||||
FontSize="22" TextColor="Black"/>
|
||||
</HorizontalStackLayout>
|
||||
<HorizontalStackLayout>
|
||||
<Label Text="目标地址: " FontAttributes="Bold" FontSize="22" TextColor="Black"
|
||||
IsVisible="{Binding Path=Tank, Converter={StaticResource StringToBoolConverter}}"/>
|
||||
<Label Text="{Binding Tank}" FontAttributes="Bold" FontSize="22" TextColor="Black"
|
||||
IsVisible="{Binding Path=Tank, Converter={StaticResource StringToBoolConverter}}"/>
|
||||
</HorizontalStackLayout>
|
||||
<HorizontalStackLayout>
|
||||
<Label Text="溶解流程: " FontAttributes="Bold" FontSize="22" TextColor="Black"
|
||||
IsVisible="{Binding Path=Process, Converter={StaticResource StringToBoolConverter}}"/>
|
||||
|
||||
+6
-2
@@ -114,8 +114,12 @@ public partial class QueryDetail : ContentPage
|
||||
item.UsageTime = $"{(int)(dte - dtr).TotalMinutes}:{(dte - dtr).Seconds:D2}";
|
||||
}
|
||||
}
|
||||
if (DateTime.TryParse(item.CallTime, out DateTime dtc))
|
||||
{
|
||||
item.CallTime = dtc.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
}
|
||||
if (item.ProductType == 1 && item.Process == null) item.Process = "未知";
|
||||
if (item.Tank != null) item.Tank ="@" + item.Tank;
|
||||
if (item.ProductType == 3) item.Tank = item.PowderTargetTank.ToString();
|
||||
|
||||
//行信息
|
||||
QueryDetailDyelotDetailsItems.Add(item);
|
||||
@@ -127,7 +131,7 @@ public partial class QueryDetail : ContentPage
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
catch (Exception )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
+7
-4
@@ -25,12 +25,15 @@
|
||||
<FileImageSource File="lucidescanline.png" />
|
||||
</Button.ImageSource>
|
||||
</Button>
|
||||
<HorizontalStackLayout Grid.Row="1" Grid.Column="0">
|
||||
<DatePicker x:Name="StartTime" Format="yyyy年MM月dd日" FontSize="16"/>
|
||||
<HorizontalStackLayout Grid.Row="1" Grid.Column="0" Margin="5,0,0,0" >
|
||||
<DatePicker x:Name="StartTime" Format="yyyy年MM月dd日" FontSize="16"
|
||||
MaximumWidthRequest="150" MinimumWidthRequest="130" WidthRequest="135"/>
|
||||
<Label Text="~" FontSize="28"/>
|
||||
<DatePicker x:Name="EndTime" Format="yyyy年MM月dd日" FontSize="16"/>
|
||||
<DatePicker x:Name="EndTime" Format="yyyy年MM月dd日" FontSize="16"
|
||||
MaximumWidthRequest="150" MinimumWidthRequest="130" WidthRequest="135"/>
|
||||
</HorizontalStackLayout>
|
||||
<Button Grid.Row="1" Grid.Column="1" Text="搜索" Clicked="Button_Clicked" Padding="30,0,30,0" Margin="5" />
|
||||
<Button Grid.Row="1" Grid.Column="1" Text="搜索" Clicked="Button_Clicked"
|
||||
WidthRequest="60" Padding="5,0,5,0" Margin="20,0,0,5" />
|
||||
</Grid>
|
||||
|
||||
<Grid Grid.Row="1" Grid.Column="0">
|
||||
|
||||
+13
-7
@@ -25,7 +25,7 @@ public partial class QueryPage : ContentPage
|
||||
QueryDictionary.Add("Command", "QueryDyelot");
|
||||
QueryDictionary.Add("Field", "[Dyelot],[ReDye],[Program],[Color],[CreationTime]," +
|
||||
"[Batch],[OrderNo],[TotalWeight],[LiquidRatio],[TotalVolume],[Final],[UserAccount]," +
|
||||
"[FabricName],[ColorName],[CustomerName],[Notes]");
|
||||
"[FabricName],[ColorName],[CustomerName]");
|
||||
QueryDictionary.Add("DyelotName", scannedValue);
|
||||
Query_Command(QueryDictionary.ToJsonString());
|
||||
}
|
||||
@@ -35,12 +35,16 @@ public partial class QueryPage : ContentPage
|
||||
|
||||
CardCollectionView.ItemsSource = DyelotItems;
|
||||
}
|
||||
|
||||
//扫码按钮
|
||||
private async void OnScanButtonClicked(object sender, EventArgs e)
|
||||
{
|
||||
ResultEntry.Text = "";
|
||||
// 跳转到扫码页面
|
||||
await Navigation.PushAsync(new ScanPage(0));
|
||||
}
|
||||
|
||||
//打开单个选项卡
|
||||
private async void TapGestureRecognizer_Tapped(object sender, TappedEventArgs e)
|
||||
{
|
||||
if (sender is Microsoft.Maui.Controls.BindableObject bindable)
|
||||
@@ -52,6 +56,7 @@ public partial class QueryPage : ContentPage
|
||||
await Navigation.PushAsync(new QueryDetail(item));
|
||||
}
|
||||
}
|
||||
ResultEntry.Text = "";
|
||||
}
|
||||
|
||||
//信息回复
|
||||
@@ -105,15 +110,15 @@ public partial class QueryPage : ContentPage
|
||||
|
||||
private void Button_Clicked(object sender, EventArgs e)
|
||||
{
|
||||
if (ResultEntry.Text != null)
|
||||
if (ResultEntry.Text.Length >0)
|
||||
{
|
||||
Dictionary<string, object> QueryDictionary = new Dictionary<string, object>();
|
||||
QueryDictionary.Add("Command", "QueryDyelot");
|
||||
QueryDictionary.Add("Field", "[Dyelot],[ReDye],[Program],[Color],[CreationTime]," +
|
||||
"[Batch],[OrderNo],[TotalWeight],[LiquidRatio],[TotalVolume],[Final],[UserAccount]," +
|
||||
"[FabricName],[ColorName],[CustomerName],[Notes]");
|
||||
"[FabricName],[ColorName],[CustomerName]");
|
||||
QueryDictionary.Add("DyelotName", ResultEntry.Text);
|
||||
Query_Command(QueryDictionary.ToJsonString());
|
||||
Query_Command(QueryDictionary.ToJsonString());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -127,10 +132,11 @@ public partial class QueryPage : ContentPage
|
||||
QueryDictionary.Add("Command", "Query");
|
||||
QueryDictionary.Add("Field", "[Dyelot],[ReDye],[Program],[Color],[CreationTime]," +
|
||||
"[Batch],[OrderNo],[TotalWeight],[LiquidRatio],[TotalVolume],[Final],[UserAccount]," +
|
||||
"[FabricName],[ColorName],[CustomerName],[Notes]");
|
||||
QueryDictionary.Add("StartTime", StartTime.Date.ToString()!);
|
||||
"[FabricName],[ColorName],[CustomerName]");
|
||||
DateTime StartTimee_ = (DateTime)StartTime.Date!;
|
||||
QueryDictionary.Add("StartTime", StartTimee_.ToString("yyyy-MM-dd"));
|
||||
DateTime EndTime_ = (DateTime)EndTime.Date!;
|
||||
QueryDictionary.Add("EndTime", EndTime_.AddDays(1).ToString());
|
||||
QueryDictionary.Add("EndTime", EndTime_.AddDays(1).ToString("yyyy-MM-dd"));
|
||||
Query_Command(QueryDictionary.ToJsonString());
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net10.0-android|AnyCPU'">
|
||||
<EmbedAssembliesIntoApk>False</EmbedAssembliesIntoApk>
|
||||
<EmbedAssembliesIntoApk>True</EmbedAssembliesIntoApk>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net10.0-android|AnyCPU'">
|
||||
@@ -92,16 +92,25 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.2" />
|
||||
<PackageReference Include="Microsoft.Data.Sqlite" Version="10.0.7" />
|
||||
<PackageReference Include="Microsoft.Extensions.Http" Version="10.0.7" />
|
||||
<PackageReference Include="Microsoft.Maui.Controls" Version="10.0.51" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="10.0.7" />
|
||||
<PackageReference Include="Microsoft.Data.Sqlite" Version="10.0.10" />
|
||||
<PackageReference Include="Microsoft.Extensions.Http" Version="10.0.10" />
|
||||
<PackageReference Include="Microsoft.Maui.Controls" Version="10.0.80" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="10.0.10" />
|
||||
<PackageReference Include="TouchSocket" Version="4.2.10" />
|
||||
<PackageReference Include="TouchSocket.Http" Version="4.2.10" />
|
||||
<PackageReference Include="ZXing.Net.Maui.Controls" Version="0.7.4" />
|
||||
<PackageReference Include="ZXing.Net.Maui.Controls" Version="0.10.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="View\LogLoading.xaml.cs">
|
||||
<DependentUpon>LogLoading.xaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<MauiXaml Update="InfoChemicalStatistics.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</MauiXaml>
|
||||
<MauiXaml Update="InfoDetail.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</MauiXaml>
|
||||
@@ -132,6 +141,9 @@
|
||||
<MauiXaml Update="ScanPage.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</MauiXaml>
|
||||
<MauiXaml Update="View\LogLoading.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</MauiXaml>
|
||||
<MauiXaml Update="View\Loading.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</MauiXaml>
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="SunlightAggregationTerminal.View.LogLoading"
|
||||
Title="LogLoading">
|
||||
<Grid x:Name="LoadingIndicator" BackgroundColor="Gray"
|
||||
IsVisible="True" Opacity="0.9">
|
||||
<VerticalStackLayout Padding="30" Spacing="10"
|
||||
VerticalOptions="Center"
|
||||
HorizontalOptions="Center">
|
||||
<Button Text="登 录"
|
||||
BackgroundColor="#512BD4"
|
||||
TextColor="White"
|
||||
HeightRequest="50"
|
||||
WidthRequest="100"
|
||||
CornerRadius="10"
|
||||
Margin="0,10,0,0"
|
||||
Clicked="Button_Clicked"/>
|
||||
</VerticalStackLayout>
|
||||
</Grid>
|
||||
</ContentPage>
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace SunlightAggregationTerminal.View;
|
||||
|
||||
public partial class LogLoading : ContentPage
|
||||
{
|
||||
public LogLoading()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private async void Button_Clicked(object sender, EventArgs e)
|
||||
{
|
||||
await Navigation.PopModalAsync();
|
||||
var logpage = new View.LogPage();
|
||||
await Navigation.PushModalAsync(logpage);
|
||||
|
||||
}
|
||||
}
|
||||
+13
-10
@@ -29,7 +29,7 @@ public partial class LogPage : ContentPage
|
||||
|
||||
//可用服务器列表
|
||||
AppModels.sqliteHelper.Open();
|
||||
var userdata = AppModels.sqliteHelper.ExecuteDataSet("select * from Server", null);
|
||||
var userdata = AppModels.sqliteHelper.ExecuteDataSet("SELECT * FROM Server", null);
|
||||
AppModels.sqliteHelper.Close();
|
||||
|
||||
Items = new ObservableCollection<ItemOption>();
|
||||
@@ -40,11 +40,13 @@ public partial class LogPage : ContentPage
|
||||
{
|
||||
if (dataRow != null)
|
||||
{
|
||||
string _SERVER = dataRow.Field<string>("Server")!;
|
||||
string _SERVERIP = dataRow.Field<string>("ServerID")! + "," + dataRow.Field<string>("ServerHTTP")!;
|
||||
|
||||
var dat = new ItemOption
|
||||
{
|
||||
SERVER = dataRow.Field<string>("Server") ?? "",
|
||||
SERVERIP = dataRow.Field<string>("ServerID") ?? "" +","+
|
||||
dataRow.Field<string>("ServerHTTP") ?? ""
|
||||
SERVER = _SERVER,
|
||||
SERVERIP = _SERVERIP
|
||||
};
|
||||
Items.Add(dat);
|
||||
}
|
||||
@@ -82,9 +84,10 @@ public partial class LogPage : ContentPage
|
||||
|
||||
App.GlobalData.ServerID = result[0]?? "";
|
||||
//判断是否有http连接信息
|
||||
if (result.Length == 2)
|
||||
if (result.Length ==2)
|
||||
{
|
||||
App.GlobalData.ServerHTTP = result[1] ?? "";
|
||||
App.GlobalData.LocalAreaNetworkMode = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -111,21 +114,21 @@ public partial class LogPage : ContentPage
|
||||
string sql = @"INSERT INTO Users (User,UserId ,UserName ,UserPassword ,
|
||||
Enterprise ,Department ,ServerID ,ServerHTTP ,Groups ,
|
||||
ProxyID ,LogNo ,LocalAreaNetworkMode ,DarkMode ,
|
||||
MessageNotificationMode ,GUID
|
||||
MessageNotificationMode ,GUID ,NotificationID
|
||||
)VALUES('" + UsernameEntry.Text + "','"+ App.GlobalData.UserId +
|
||||
"','" + App.GlobalData.UserName + "','" + PasswordEntry.Text +
|
||||
"','"+ App.GlobalData.Enterprise + "','"+ App.GlobalData.Department +
|
||||
"','" + App.GlobalData.ServerID + "','" +App.GlobalData.ServerHTTP+
|
||||
"','"+ App.GlobalData.Groups + "'," +
|
||||
" '',1,0,0,0,'" + Models.AppModels.GetAppUniqueId() + "');";
|
||||
"','"+ App.GlobalData.Groups + "'," + " '',1,0,0,0,'" +
|
||||
Models.AppModels.GetAppUniqueId() + "','0');";
|
||||
AppModels.INSERT(sql);
|
||||
}
|
||||
|
||||
int temp_server = AppModels.Select("SELECT * FROM Server WHERE ServerID='' LIMIT 1;")!.Tables[0].Rows.Count;
|
||||
int temp_server = AppModels.Select("SELECT * FROM Server WHERE Server='"+ App.GlobalData.Enterprise + "' LIMIT 1;")!.Tables[0].Rows.Count;
|
||||
if (temp_server == 0)
|
||||
{
|
||||
string sql = @"INSERT INTO Server ( Server, ServerID,ServerHTTP)VALUES('" + App.GlobalData.Enterprise + "','" +
|
||||
App.GlobalData.ServerID+ App.GlobalData.ServerHTTP + "');";
|
||||
App.GlobalData.ServerID+"','"+ App.GlobalData.ServerHTTP + "');";
|
||||
AppModels.INSERT(sql);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user