Browse Source

查询功能

master
Administrator 2 months ago
parent
commit
e52dd61baa
  1. 4
      Class/DataReceived.cs
  2. 32
      InfoDetail.xaml
  3. 262
      InfoDetail.xaml.cs
  4. 4
      QueryDetail.xaml.cs

4
Class/DataReceived.cs

@ -145,6 +145,10 @@ namespace SunlightAggregationTerminal.Class
{ {
InfoDetail.Info_data(val.ToString()!,data.GetValue("Type").ToString()!); InfoDetail.Info_data(val.ToString()!,data.GetValue("Type").ToString()!);
} }
if (data.TryGetValue("InfoMachineHistory", out val) && val != null)//
{
InfoDetail.Info_data(val.ToString()!, data.GetValue("Type").ToString()!);
}
if (data.TryGetValue("InfoMachinePipes", out val) && val != null)// if (data.TryGetValue("InfoMachinePipes", out val) && val != null)//
{ {
InfoDetail.Info_data(val.ToString()!, "00"); InfoDetail.Info_data(val.ToString()!, "00");

32
InfoDetail.xaml

@ -121,30 +121,36 @@
FontSize="22" TextColor="Black"/> FontSize="22" TextColor="Black"/>
<Label Text="{Binding ReDye}" FontAttributes="Bold" <Label Text="{Binding ReDye}" FontAttributes="Bold"
FontSize="22" TextColor="Black"/> FontSize="22" TextColor="Black"/>
<Label Text=" 步骤" FontAttributes="Bold"
FontSize="22" TextColor="Black"/>
<Label Text="{Binding Step}" FontAttributes="Bold"
FontSize="22" TextColor="Black"/>
</HorizontalStackLayout> </HorizontalStackLayout>
<HorizontalStackLayout> <HorizontalStackLayout>
<Label Text="染机: " FontAttributes="Bold" <Label Text="步骤: " FontAttributes="Bold"
FontSize="22" TextColor="Black"/> FontSize="22" TextColor="Black"/>
<Label Text="{Binding Machine}" FontAttributes="Bold" <Label Text="{Binding StepNumber}" FontAttributes="Bold"
FontSize="22" TextColor="Black"/> FontSize="22" TextColor="Black"/>
</HorizontalStackLayout> </HorizontalStackLayout>
<BoxView HeightRequest="3" Color="#CCCCCC" />
<HorizontalStackLayout> <HorizontalStackLayout>
<Label Text="时间: " FontAttributes="Bold" <Label Text="{Binding Notes}" FontAttributes="Bold"
FontSize="22" TextColor="Black"/> FontSize="22" TextColor="Black"/>
<Label Text="{Binding EndTime}" FontAttributes="Bold"
FontSize="22" TextColor="Black"/>
</HorizontalStackLayout> </HorizontalStackLayout>
<BoxView HeightRequest="3" Color="#CCCCCC" />
<HorizontalStackLayout> <HorizontalStackLayout>
<Label Text="信息: " FontAttributes="Bold" <Label Text="呼叫时间: " FontAttributes="Bold"
FontSize="22" TextColor="Black"/> FontSize="22" TextColor="Black"/>
<Label Text="{Binding Information}" FontAttributes="Bold" <Label Text="{Binding UsageTime}" FontAttributes="Bold"
FontSize="22" TextColor="Black"/> FontSize="22" TextColor="Black"/>
</HorizontalStackLayout> </HorizontalStackLayout>
<HorizontalStackLayout>
<Label Text="开始时间: " FontAttributes="Bold"
FontSize="22" TextColor="Black"/>
<Label Text="{Binding DispenseStartTime}" FontAttributes="Bold"
FontSize="22" TextColor="Black"/>
</HorizontalStackLayout>
<HorizontalStackLayout>
<Label Text="完成时间: " FontAttributes="Bold"
FontSize="22" TextColor="Black"/>
<Label Text="{Binding DispenseEndTime}" FontAttributes="Bold"
FontSize="22" TextColor="Black"/>
</HorizontalStackLayout>
</VerticalStackLayout> </VerticalStackLayout>
</Border> </Border>
</DataTemplate> </DataTemplate>

262
InfoDetail.xaml.cs

@ -14,7 +14,7 @@ public class InfoMachineItem
}public partial class InfoDetail : ContentPage }public partial class InfoDetail : ContentPage
{ {
public static ObservableCollection<ProbuctItem> InfoProbuctItems { get; set; } = new(); public static ObservableCollection<ProbuctItem> InfoProbuctItems { get; set; } = new();
public static ObservableCollection<DyelotDetailsItem> InfoDyelotDetailsItems { get; set; } = new(); public static ObservableCollection<DyelotDetailsItem> InfoDyelotHistoryItems { get; set; } = new();
public static ObservableCollection<InfoMachineItem> InfoMachineItems { get; set; } = new(); public static ObservableCollection<InfoMachineItem> InfoMachineItems { get; set; } = new();
public static InfoItem infoItem=new(); public static InfoItem infoItem=new();
private DateTime _lastRefreshTime = DateTime.MinValue; private DateTime _lastRefreshTime = DateTime.MinValue;
@ -49,13 +49,14 @@ public class InfoMachineItem
InfoMachineItems.Clear(); InfoMachineItems.Clear();
InfoProbuctItems.Clear(); InfoProbuctItems.Clear();
InfoDyelotDetailsItems.Clear(); InfoDyelotHistoryItems.Clear();
CardCollectionView_inf.ItemsSource = InfoMachineItems; CardCollectionView_inf.ItemsSource = InfoMachineItems;
CardCollectionView_machine.ItemsSource = InfoProbuctItems; CardCollectionView_machine.ItemsSource = InfoProbuctItems;
CardCollectionView_history.ItemsSource = InfoDyelotDetailsItems; CardCollectionView_history.ItemsSource = InfoDyelotHistoryItems;
} }
//查询
private void InfoMachine() { private void InfoMachine() {
Dictionary<string, object> data_ = new Dictionary<string, object>(); Dictionary<string, object> data_ = new Dictionary<string, object>();
data_.Add("Command", "InfoMachine"); data_.Add("Command", "InfoMachine");
@ -116,7 +117,7 @@ public class InfoMachineItem
Query_Command(data_.ToJsonString()); Query_Command(data_.ToJsonString());
} }
} }
//设备信息 //设备信息
private void Button_real(object sender, EventArgs e) private void Button_real(object sender, EventArgs e)
{ {
@ -158,6 +159,67 @@ public class InfoMachineItem
_machine.IsVisible = false; _machine.IsVisible = false;
_history.IsVisible = true; _history.IsVisible = true;
_control.IsVisible = false; _control.IsVisible = false;
if (InfoDyelotHistoryItems.Count == 0)
{
Dictionary<string, object> data_ = new Dictionary<string, object>();
data_.Add("Command", "InfoMachineHistory");
if (infoItem.Model == "252")
{
data_.Add("Type", "80");
data_.Add("Field", "*");
data_.Add("MachinName", infoItem.Machine!);
Query_History(data_.ToJsonString());
}
else if (infoItem.Model == "252-2T")
{
data_.Add("Type", "80");
data_.Add("Field", "*");
data_.Add("MachinName", infoItem.Machine!);
Query_History(data_.ToJsonString());
}
else if (infoItem.Model == "252RB")
{
data_.Add("Type", "80");
data_.Add("Field", "*");
data_.Add("MachinName", infoItem.Machine!);
Query_History(data_.ToJsonString());
}
else if (infoItem.Model == "252RDRM")
{
data_.Add("Type", "82");
data_.Add("Field", "*");
data_.Add("MachinName", infoItem.Machine!);
Query_History(data_.ToJsonString());
}
else if (infoItem.Model == "242W")
{
data_.Add("Type", "80");
data_.Add("Field", "*");
data_.Add("MachinName", infoItem.Machine!);
Query_History(data_.ToJsonString());
}
else if (infoItem.Model == "302")
{
data_.Add("Type", "90");
data_.Add("Field", "*");
data_.Add("MachinName", infoItem.Machine!);
Query_History(data_.ToJsonString());
}
else if (infoItem.Model == "303")
{
data_.Add("Type", "90");
data_.Add("Field", "*");
data_.Add("MachinName", infoItem.Machine!);
Query_History(data_.ToJsonString());
}
else if (infoItem.Model == "303PDW")
{
data_.Add("Type", "90");
data_.Add("Field", "*");
data_.Add("MachinName", infoItem.Machine!);
Query_History(data_.ToJsonString());
}
}
} }
//远程 //远程
@ -216,8 +278,30 @@ public class InfoMachineItem
await Task.WhenAny(delayTask, monitorTask); await Task.WhenAny(delayTask, monitorTask);
LoadingIndicator.IsVisible = false; LoadingIndicator.IsVisible = false;
} }
public async void Query_History(string dat)
{
LoadingIndicator.IsVisible = true;
InfoDyelotHistoryItems.Clear();
DataReceived.Transmit(dat);
// 创建一个 秒的延时任务
Task delayTask = Task.Delay(10000);
// 创建一个监测任务,不断检查变量
Task monitorTask = Task.Run(async () =>
{
while (InfoDyelotHistoryItems.Count == 0)
{
// 每隔 100 毫秒检查一次,避免 CPU 占用过高
await Task.Delay(1000);
}
});
// 使用 Task.WhenAny 等待任意一个任务完成
await Task.WhenAny(delayTask, monitorTask);
LoadingIndicator.IsVisible = false;
}
public static void Info_data(string dat, string id) public static void Info_data(string dat, string id)
{ {
var data = JsonSerializer.Deserialize<List<Dictionary<string, object>>>(dat)!; var data = JsonSerializer.Deserialize<List<Dictionary<string, object>>>(dat)!;
@ -237,23 +321,23 @@ public class InfoMachineItem
else { probuctItem.ProductState = "停用"; } else { probuctItem.ProductState = "停用"; }
if (item!.TryGetValue("No", out var _No) && _No != null) if (item!.TryGetValue("No", out var _No) && _No != null)
{ {
probuctItem.ProductInf = "管路:" + _No + "\n"; probuctItem.ProductInf = "管路: " + _No + "\n";
} }
if (item!.TryGetValue("MinLimit", out var _MinLimit) && _MinLimit != null) if (item!.TryGetValue("MinLimit", out var _MinLimit) && _MinLimit != null)
{ {
probuctItem.ProductInf = probuctItem.ProductInf+"最少量:" + _MinLimit + "g\n"; probuctItem.ProductInf = probuctItem.ProductInf+"最少量: " + _MinLimit + "g\n";
} }
if (item!.TryGetValue("MaxLimit", out var _MaxLimit) && _MaxLimit != null) if (item!.TryGetValue("MaxLimit", out var _MaxLimit) && _MaxLimit != null)
{ {
probuctItem.ProductInf = probuctItem.ProductInf + "最大量:" + _MinLimit + "g\n"; probuctItem.ProductInf = probuctItem.ProductInf + "最大量: " + _MinLimit + "g\n";
} }
if (item!.TryGetValue("Conc", out var _Conc) && _Conc != null) if (item!.TryGetValue("Conc", out var _Conc) && _Conc != null)
{ {
probuctItem.ProductInf = probuctItem.ProductInf + "浓度:" + _Conc + "\n"; probuctItem.ProductInf = probuctItem.ProductInf + "浓度: " + _Conc + "\n";
} }
if (item!.TryGetValue("Enabled", out var _Gravity) && _Gravity != null) if (item!.TryGetValue("Enabled", out var _Gravity) && _Gravity != null)
{ {
probuctItem.ProductInf = probuctItem.ProductInf + "比重:" + _Gravity; probuctItem.ProductInf = probuctItem.ProductInf + "比重: " + _Gravity;
} }
InfoProbuctItems.Add(probuctItem); InfoProbuctItems.Add(probuctItem);
} }
@ -264,13 +348,13 @@ public class InfoMachineItem
{ {
foreach (var item in data!) foreach (var item in data!)
{ {
string inf_ = "染机:" + item.GetValue("Machine").ToString()! + "\n"; string inf_ = "染机: " + item.GetValue("Machine").ToString()! + "\n";
inf_ = inf_ + "料单:" + item.GetValue("Dyelot").ToString()!; inf_ = inf_ + "料单: " + item.GetValue("Dyelot").ToString()!;
inf_ = inf_ + "@" + item.GetValue("ReDye").ToString()! + "\n"; inf_ = inf_ + "@" + item.GetValue("ReDye").ToString()! + "\n";
inf_ = inf_ + "步骤:" + item.GetValue("StepNumber").ToString()! + "\n"; inf_ = inf_ + "步骤: " + item.GetValue("StepNumber").ToString()! + "\n";
inf_ = inf_ + "流程:" + item.GetValue("Process").ToString()! + "\n"; inf_ = inf_ + "流程: " + item.GetValue("Process").ToString()! + "\n";
inf_ = inf_ + "化料桶:" + item.GetValue("TankNO").ToString()! + "\n"; inf_ = inf_ + "化料桶: " + item.GetValue("TankNO").ToString()! + "\n";
inf_ = inf_ + "染料桶数:" + item.GetValue("TotalNumber").ToString()!; inf_ = inf_ + "染料桶数: " + item.GetValue("TotalNumber").ToString()!;
if (item!.TryGetValue("BarrelState", out var _Type) && _Type != null) if (item!.TryGetValue("BarrelState", out var _Type) && _Type != null)
{ {
string temp = _Type?.ToString() ?? ""; string temp = _Type?.ToString() ?? "";
@ -283,7 +367,7 @@ public class InfoMachineItem
}; };
inf_ = inf_ + _Type; inf_ = inf_ + _Type;
} }
inf_ = inf_ + "状态:" + item.GetValue("State").ToString()! + "\n"; inf_ = inf_ + "状态: " + item.GetValue("State").ToString()! + "\n";
InfoMachineItem infoMachineItem = new InfoMachineItem(); InfoMachineItem infoMachineItem = new InfoMachineItem();
infoMachineItem.inf = inf_; infoMachineItem.inf = inf_;
@ -291,15 +375,15 @@ public class InfoMachineItem
} }
if (InfoMachineItems.Count == 0) InfoMachineItems.Add(new InfoMachineItem()); if (InfoMachineItems.Count == 0) InfoMachineItems.Add(new InfoMachineItem());
} }
//染料查询查询化料货架 //染料查询化料货架
else if (id == "12") else if (id == "12")
{ {
foreach (var item in data!) foreach (var item in data!)
{ {
string inf_ = "位置:" + item.GetValue("position").ToString()! + "\n"; string inf_ = "位置: " + item.GetValue("position").ToString()! + "\n";
inf_ = inf_ + "料单:" + item.GetValue("Dyelot").ToString()!; inf_ = inf_ + "料单: " + item.GetValue("Dyelot").ToString()!;
inf_ = inf_ + "@" + item.GetValue("ReDye").ToString()! + "\n"; inf_ = inf_ + "@" + item.GetValue("ReDye").ToString()! + "\n";
inf_ = inf_ + "步骤:" + item.GetValue("StepNumber").ToString()! + "\n"; inf_ = inf_ + "步骤: " + item.GetValue("StepNumber").ToString()! + "\n";
if (item!.TryGetValue("BarrelType", out var _Type) && _Type != null) if (item!.TryGetValue("BarrelType", out var _Type) && _Type != null)
{ {
string temp = _Type?.ToString() ?? ""; string temp = _Type?.ToString() ?? "";
@ -323,9 +407,9 @@ public class InfoMachineItem
inf_ = inf_ + _BarrelState; inf_ = inf_ + _BarrelState;
} }
inf_ = inf_ + "[" + item.GetValue("Barrelserialnumber").ToString()! + "]\n"; inf_ = inf_ + "[" + item.GetValue("Barrelserialnumber").ToString()! + "]\n";
inf_ = inf_ + "上架时间:" + DateTime.Parse(item.GetValue("createtime").ToString() ?? "") inf_ = inf_ + "上架时间: " + DateTime.Parse(item.GetValue("createtime").ToString() ?? "")
.ToString("yyyy-MM-dd HH:mm:ss") + "\n"; .ToString("yyyy-MM-dd HH:mm:ss") + "\n";
inf_ = inf_ + "状态[" + item.GetValue("State").ToString()! + "]"; inf_ = inf_ + "状态 [" + item.GetValue("State").ToString()! + "]";
InfoMachineItem infoMachineItem = new InfoMachineItem(); InfoMachineItem infoMachineItem = new InfoMachineItem();
infoMachineItem.inf = inf_; infoMachineItem.inf = inf_;
@ -338,20 +422,20 @@ public class InfoMachineItem
{ {
foreach (var item in data!) foreach (var item in data!)
{ {
string inf_ = "染机:" + item.GetValue("Machine").ToString()! + "\n"; string inf_ = "染机: " + item.GetValue("Machine").ToString()! + "\n";
inf_ = inf_ + "料单:" + item.GetValue("Dyelot").ToString()!; inf_ = inf_ + "料单: " + item.GetValue("Dyelot").ToString()!;
inf_ = inf_ + "@" + item.GetValue("ReDye").ToString()! + "\n"; inf_ = inf_ + "@" + item.GetValue("ReDye").ToString()! + "\n";
inf_ = inf_ + "步骤:" + item.GetValue("StepNumber").ToString()! + "\n"; inf_ = inf_ + "步骤: " + item.GetValue("StepNumber").ToString()! + "\n";
inf_ = inf_ + "总浴量:" + item.GetValue("Volume").ToString()! + "\n"; inf_ = inf_ + "总浴量: " + item.GetValue("Volume").ToString()! + "\n";
inf_ = inf_ + "计量模组:" + item.GetValue("DispenseModule").ToString()! + "\n"; inf_ = inf_ + "计量模组: " + item.GetValue("DispenseModule").ToString()! + "\n";
if (item!.TryGetValue("TankNo", out var _TankNo) && _TankNo != null) if (item!.TryGetValue("TankNo", out var _TankNo) && _TankNo != null)
{ {
inf_ = inf_ + "目标位置:" + item.GetValue("TankNo").ToString()! + "\n"; inf_ = inf_ + "目标位置: " + item.GetValue("TankNo").ToString()! + "\n";
} }
else { else {
inf_ = inf_ + "目标位置:未指定\n" ; inf_ = inf_ + "目标位置: 未指定\n" ;
} }
inf_ = inf_ + "开始时间:" + DateTime.Parse(item.GetValue("DispenseStartTime").ToString() ?? "") inf_ = inf_ + "开始时间: " + DateTime.Parse(item.GetValue("DispenseStartTime").ToString() ?? "")
.ToString("yyyy-MM-dd HH:mm:ss") + "\n"; .ToString("yyyy-MM-dd HH:mm:ss") + "\n";
if (item!.TryGetValue("State", out var _Type) && _Type != null) if (item!.TryGetValue("State", out var _Type) && _Type != null)
{ {
@ -364,7 +448,7 @@ public class InfoMachineItem
"309" => "异常", "309" => "异常",
_ => "无信息" _ => "无信息"
}; };
inf_ = inf_ + "状态:" + _Type; inf_ = inf_ + "状态: " + _Type;
} }
InfoMachineItem infoMachineItem = new InfoMachineItem(); InfoMachineItem infoMachineItem = new InfoMachineItem();
@ -378,7 +462,119 @@ public class InfoMachineItem
} }
if (InfoMachineItems.Count==0) InfoMachineItems.Add(new InfoMachineItem()); if (InfoMachineItems.Count==0) InfoMachineItems.Add(new InfoMachineItem());
} }
//化料历史信息查询
else if (id == "80")
{
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";
if (item!.TryGetValue("State", out var _State) && _State != null)
{
string temp = _State?.ToString() ?? "";
// 转换
_State = temp switch
{
"301" => "完成",
"309" => "异常",
_ => "无信息"
};
dyelotDetailsItem.Notes = dyelotDetailsItem.Notes + "状态: " + _State ;
}
if (item!.TryGetValue("TankNo", out var _TankNo) && _TankNo != null)
{
dyelotDetailsItem.Notes = dyelotDetailsItem.Notes + " [化料桶T" + _TankNo + "]";
}
if (item!.TryGetValue("TotalNumber", out var _TotalNumber) && _TotalNumber != null)
{
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", " ");
InfoDyelotHistoryItems.Add(dyelotDetailsItem);
}
if (InfoDyelotHistoryItems.Count == 0) InfoDyelotHistoryItems.Add(new DyelotDetailsItem());
}
//化料货架历史信息查询
else if (id == "82")
{
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";
if (item!.TryGetValue("BarrelType", out var _Type) && _Type != null)
{
string temp = _Type?.ToString() ?? "";
// 转换
_Type = temp switch
{
"1" => "空桶",
"2" => "染料桶",
_ => "无桶"
};
dyelotDetailsItem.Notes = dyelotDetailsItem.Notes + "类型: " + _Type;
}
if (item!.TryGetValue("BarrelState", out var _BarrelState) && _BarrelState != null)
{
string temp = _BarrelState?.ToString() ?? "";
_BarrelState = temp switch
{
"201" => "[分桶]",
_ => ""
};
dyelotDetailsItem.Notes = dyelotDetailsItem.Notes + _BarrelState;
}
dyelotDetailsItem.Notes = dyelotDetailsItem.Notes + "[" + item.GetValue("Barrelserialnumber").ToString()! + "]\n";
if (item!.TryGetValue("State", out var _State) && _State != null)
{
dyelotDetailsItem.Notes = dyelotDetailsItem.Notes + "状态: " + _State;
}
dyelotDetailsItem.DispenseStartTime = "";
dyelotDetailsItem.DispenseEndTime = "";
dyelotDetailsItem.UsageTime = item.GetValue("Createtime").ToString()!.Replace("T", " ");
InfoDyelotHistoryItems.Add(dyelotDetailsItem);
}
if (InfoDyelotHistoryItems.Count == 0) InfoDyelotHistoryItems.Add(new DyelotDetailsItem());
}
//助剂历史信息查询
else if (id == "90")
{
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";
if (item!.TryGetValue("State", out var _State) && _State != null)
{
string temp = _State?.ToString() ?? "";
// 转换
_State = temp switch
{
"301" => "完成",
"309" => "异常",
_ => "无信息"
};
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", " ");
InfoDyelotHistoryItems.Add(dyelotDetailsItem);
}
if (InfoDyelotHistoryItems.Count == 0) InfoDyelotHistoryItems.Add(new DyelotDetailsItem());
}
} }

4
QueryDetail.xaml.cs

@ -108,10 +108,10 @@ public partial class QueryDetail : ContentPage
if (DateTime.TryParse(item.DispenseEndTime, out DateTime dte)) if (DateTime.TryParse(item.DispenseEndTime, out DateTime dte))
{ {
item.DispenseEndTime = dte.ToString("yyyy-MM-dd HH:mm:ss"); item.DispenseEndTime = dte.ToString("yyyy-MM-dd HH:mm:ss");
if (DateTime.TryParse(item.DispenseStartTime, out DateTime dtr)) if (DateTime.TryParse(item.DispenseStartTime, out DateTime dtr))
{ {
item.UsageTime = (dte - dtr).ToString("mm:ss"); //计算用时
item.UsageTime = $"{(int)(dte - dtr).TotalMinutes}:{(dte - dtr).Seconds:D2}";
} }
} }
if (item.ProductType == 1 && item.Process == null) item.Process = "未知"; if (item.ProductType == 1 && item.Process == null) item.Process = "未知";

Loading…
Cancel
Save