Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightAggregationTerminal
This commit is contained in:
commit
94d1fb6a5d
8 files changed
+81
-48
No files matched your search
+48
-38
@@ -40,52 +40,62 @@ 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(), "是");
|
||||
});
|
||||
}
|
||||
|
||||
//配置config
|
||||
await httpclient.SetupAsync(config);
|
||||
//连接
|
||||
await httpclient.ConnectAsync();
|
||||
}
|
||||
|
||||
/***发送信息处理***/
|
||||
@@ -142,7 +152,7 @@ namespace SunlightAggregationTerminal.Class
|
||||
}
|
||||
finally
|
||||
{
|
||||
Start();
|
||||
//Start();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,10 +28,12 @@
|
||||
FontSize="22" TextColor="Black"/>
|
||||
</HorizontalStackLayout>
|
||||
<HorizontalStackLayout>
|
||||
<Label Text="用量(kg): " FontAttributes="Bold"
|
||||
<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>
|
||||
|
||||
@@ -59,7 +59,7 @@ public partial class InfoChemicalStatistics : ContentPage
|
||||
{
|
||||
foreach (var item in data)
|
||||
{
|
||||
item.TotalDispenseGrams = item.TotalDispenseGrams / 1000;
|
||||
item.TotalDispenseGrams = MathF.Round((float)item.TotalDispenseGrams! / 1000, 5);
|
||||
|
||||
ChemicalTotals.Add(item);
|
||||
}
|
||||
|
||||
+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>
|
||||
|
||||
+14
-2
@@ -496,7 +496,13 @@ public class InfoMachineItem
|
||||
}
|
||||
dyelotDetailsItem.DispenseStartTime = item.GetValue("DispenseStartTime").ToString()!.Replace("T", " ");
|
||||
dyelotDetailsItem.DispenseEndTime = item.GetValue("DispenseEndTime").ToString()!.Replace("T", " ");
|
||||
dyelotDetailsItem.UsageTime = item.GetValue("CallTime").ToString()!.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());
|
||||
@@ -569,7 +575,13 @@ public class InfoMachineItem
|
||||
}
|
||||
dyelotDetailsItem.DispenseStartTime = item.GetValue("DispenseStartTime").ToString()!.Replace("T", " ");
|
||||
dyelotDetailsItem.DispenseEndTime = item.GetValue("DispenseEndTime").ToString()!.Replace("T", " ");
|
||||
dyelotDetailsItem.UsageTime = item.GetValue("CallTime").ToString()!.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());
|
||||
|
||||
@@ -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; }
|
||||
|
||||
+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 ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user