You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
AUCMA_SCADA/Aucma.Core.BoxFoam/ViewModels/FoamMachinesPageViewModel.cs

474 lines
14 KiB
C#

using Admin.Core.Common;
using Admin.Core.IService;
using Admin.Core.Model.ViewModels;
using Admin.Core.Service;
using Aucma.Core.BoxFoam.Models;
using CommunityToolkit.Mvvm.ComponentModel;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Aucma.Core.BoxFoam.ViewModels
{
public partial class FoamMachinesPageViewModel : ObservableObject
{
IBoxLastShotRecordServices _boxLastShotRecordServices;
public FoamMachinesPageViewModel()
{
_boxLastShotRecordServices = App.ServiceProvider.GetService<IBoxLastShotRecordServices>();
//Task.WaitAll(LoadData());
}
#region 加载DataGrid数据
private async Task LoadData()
{
System.Windows.Application.Current.Dispatcher.Invoke((Action)(async () =>
{
LastShotRecordDataGrid.Clear();
int i = 1;
var list = await _boxLastShotRecordServices.QueryAsync();
if (list == null) return;
list.OrderByDescending(d => d.LastTime);
foreach (var item in list.Take(50))
{
string system = string.Empty;
if (item.System == "1") { system = "1系统"; }
if (item.System == "2") { system = "2系统"; }
LastShotRecordDataGrid.Add(new LastShotRecordModel()
{
No = i,
System = system,
GunHead=item.GunHead,
StationNumber=item.StationNumber,
PolInjectionpressure = item.PolInjectionpressure,
IsoInjectionpressure = item.IsoInjectionpressure,
PolInjectiontemperature = item.PolInjectiontemperature,
IsoInjectiontemperature = item.IsoInjectiontemperature,
LastTime = item.LastTime,
Createtime = item.Createtime
});
i++;
};
//Datalist.Insert(0, Datalist[Datalist.Count - 1]);
//Datalist.RemoveAt(Datalist.Count - 1);
}));
}
#endregion
#region 初始化datagrid
private ObservableCollection<LastShotRecordModel> _lastShotRecordDataGrid = new ObservableCollection<LastShotRecordModel>();
public ObservableCollection<LastShotRecordModel> LastShotRecordDataGrid
{
get { return _lastShotRecordDataGrid; }
set
{
_lastShotRecordDataGrid = value;
OnPropertyChanged();//属性通知
}
}
#endregion
#region 1系统属性
/// <summary>
/// POL输入压力
/// </summary>
private string _PolInputPressure = "0.00";
public string PolInputPressure1
{
get => _PolInputPressure;
set => SetProperty(ref _PolInputPressure, value);
}
/// <summary>
/// ISO输入压力
/// </summary>
private string _IsoInputPressure = "0.00";
public string IsoInputPressure1
{
get => _IsoInputPressure;
set => SetProperty(ref _IsoInputPressure, value);
}
/// <summary>
/// POL输出压力
/// </summary>
private string _polOutputPressure = "0.0";
public string PolOutputPressure1
{
get => _polOutputPressure;
set => SetProperty(ref _polOutputPressure, value);
}
/// <summary>
/// ISO输出压力
/// </summary>
private string _isoOutputPressure1 = "0.0";
public string IsoOutputPressure1
{
get => _isoOutputPressure1;
set => SetProperty(ref _isoOutputPressure1, value);
}
/// <summary>
/// Pol流量
/// </summary>
private string _Polflow1 = "0";
public string PolFlow1
{
get => _Polflow1;
set => SetProperty(ref _Polflow1, value);
}
/// <summary>
/// Iso流量
/// </summary>
private string _isoflow1 = "0";
public string IsoFlow1
{
get => _isoflow1;
set => SetProperty(ref _isoflow1, value);
}
/// <summary>
/// Pol温度
/// </summary>
private string _PoleTmperature = "0";
public string PoleTmperature1
{
get => _PoleTmperature;
set => SetProperty(ref _PoleTmperature, value);
}
/// <summary>
/// Iso温度
/// </summary>
private string _isoTemperature = "0";
public string IsoTemperature1
{
get => _isoTemperature;
set => SetProperty(ref _isoTemperature, value);
}
/// <summary>
/// 料位
/// </summary>
private string _PolMaterialLevel1 = "0";
public string PolMaterialLevel1
{
get => _PolMaterialLevel1;
set => SetProperty(ref _PolMaterialLevel1, value);
}
/// <summary>
/// Iso温度
/// </summary>
private string _IsoMaterialLevel1 = "0";
public string IsoMaterialLevel1
{
get => _IsoMaterialLevel1;
set => SetProperty(ref _IsoMaterialLevel1, value);
}
/// <summary>
/// 压力
/// </summary>
private string _pressure1 = "0.00";
public string Pressure1
{
get => _pressure1;
set => SetProperty(ref _pressure1, value);
}
/// <summary>
/// 温度
/// </summary>
private string _temperature1 = "0.00";
public string Temperature1
{
get => _temperature1;
set => SetProperty(ref _temperature1, value);
}
/// <summary>
/// A枪状态
/// </summary>
private string _status1;
public string Status1
{
get => _status1;
set => SetProperty(ref _status1, value);
}
/// <summary>
/// B枪状态
/// </summary>
private string _status11;
public string Status11
{
get => _status11;
set => SetProperty(ref _status11, value);
}
/// <summary>
/// 压力
/// </summary>
private string _POLPressure1 = "0.00";
public string POLPressure1
{
get => _POLPressure1;
set => SetProperty(ref _POLPressure1, value);
}
/// <summary>
/// A枪POL温度
/// </summary>
private string _POLTemperature1 = "0.00";
public string POLTemperature1
{
get => _POLTemperature1;
set => SetProperty(ref _POLTemperature1, value);
}
/// <summary>
/// B枪POL温度
/// </summary>
private string _POLTemperature11 = "0.0";
public string POLTemperature11
{
get => _POLTemperature11;
set => SetProperty(ref _POLTemperature11, value);
}
/// <summary>
/// 压力
/// </summary>
private string _ISOPressure1 = "0.00";
public string ISOPressure1
{
get => _ISOPressure1;
set => SetProperty(ref _ISOPressure1, value);
}
/// <summary>
/// 压力
/// </summary>
private string _ISOPressure11 = "0.00";
public string ISOPressure11
{
get => _ISOPressure11;
set => SetProperty(ref _ISOPressure11, value);
}
/// <summary>
/// 温度
/// </summary>
private string _ISOTemperature11 = "0.0";
public string ISOTemperature11
{
get => _ISOTemperature11;
set => SetProperty(ref _ISOTemperature11, value);
}
#endregion
#region 2系统属性
/// <summary>
/// POL输入压力
/// </summary>
private string _PolInputPressure2 = "0.00";
public string PolInputPressure2
{
get => _PolInputPressure2;
set => SetProperty(ref _PolInputPressure2, value);
}
/// <summary>
/// ISO输入压力
/// </summary>
private string _IsoInputPressure2 = "0.00";
public string IsoInputPressure2
{
get => _IsoInputPressure2;
set => SetProperty(ref _IsoInputPressure2, value);
}
/// <summary>
/// POL输出压力
/// </summary>
private string _polOutputPressure2 = "0.00";
public string PolOutputPressure2
{
get => _polOutputPressure2;
set => SetProperty(ref _polOutputPressure2, value);
}
/// <summary>
/// ISO输出压力
/// </summary>
private string _isoOutputPressure2 = "0.00";
public string IsoOutputPressure2
{
get => _isoOutputPressure2;
set => SetProperty(ref _isoOutputPressure2, value);
}
/// <summary>
/// Pol流量
/// </summary>
private string _Polflow2 = "0";
public string PolFlow2
{
get => _Polflow2;
set => SetProperty(ref _Polflow2, value);
}
/// <summary>
/// Iso流量
/// </summary>
private string _isoflow2 = "0";
public string IsoFlow2
{
get => _isoflow2;
set => SetProperty(ref _isoflow2, value);
}
/// <summary>
/// Pol温度
/// </summary>
private string _PoleTmperature2 = "0";
public string PoleTmperature2
{
get => _PoleTmperature2;
set => SetProperty(ref _PoleTmperature2, value);
}
/// <summary>
/// Iso温度
/// </summary>
private string _isoTemperature2 = "0";
public string IsoTemperature2
{
get => _isoTemperature2;
set => SetProperty(ref _isoTemperature2, value);
}
/// <summary>
/// 料位
/// </summary>
private string _PolMaterialLevel2 = "0";
public string PolMaterialLevel2
{
get => _PolMaterialLevel2;
set => SetProperty(ref _PolMaterialLevel2, value);
}
/// <summary>
/// Iso温度
/// </summary>
private string _IsoMaterialLevel2 = "0";
public string IsoMaterialLevel2
{
get => _IsoMaterialLevel2;
set => SetProperty(ref _IsoMaterialLevel2, value);
}
/// <summary>
/// 压力
/// </summary>
private string _pressure2 = "0.00";
public string Pressure2
{
get => _pressure2;
set => SetProperty(ref _pressure2, value);
}
/// <summary>
/// 温度
/// </summary>
private string _temperature2 = "0.00";
public string Temperature2
{
get => _temperature2;
set => SetProperty(ref _temperature2, value);
}
/// <summary>
/// A枪状态
/// </summary>
private string _status2 = "";
public string Status2
{
get => _status2;
set => SetProperty(ref _status2, value);
}
/// <summary>
/// B枪状态
/// </summary>
private string _status12 = "";
public string Status12
{
get => _status12;
set => SetProperty(ref _status12, value);
}
/// <summary>
/// 压力
/// </summary>
private string _POLPressure2 = "0.00";
public string POLPressure2
{
get => _POLPressure2;
set => SetProperty(ref _POLPressure2, value);
}
/// <summary>
/// 温度
/// </summary>
private string _POLTemperature2 = "0.00";
public string POLTemperature2
{
get => _POLTemperature2;
set => SetProperty(ref _POLTemperature2, value);
}
/// <summary>
/// A枪压力
/// </summary>
private string _ISOPressure2 = "0.00";
public string ISOPressure2
{
get => _ISOPressure2;
set => SetProperty(ref _ISOPressure2, value);
}
/// <summary>
///A枪温度
/// </summary>
private string _ISOTemperature22 = "0.0";
public string ISOTemperature22
{
get => _ISOTemperature22;
set => SetProperty(ref _ISOTemperature22, value);
}
/// <summary>
/// B枪温度
/// </summary>
private string _ISOTemperature222 = "0.0";
public string ISOTemperature222
{
get => _ISOTemperature222;
set => SetProperty(ref _ISOTemperature222, value);
}
/// <summary>
/// B枪温度
/// </summary>
private string _POLPressure22 = "0.0";
public string POLPressure22
{
get => _POLPressure22;
set => SetProperty(ref _POLPressure22, value);
}
/// <summary>
/// B枪ISO温度
/// </summary>
private string _POLTemperature22 = "0.0";
public string POLTemperature22
{
get => _POLTemperature22;
set => SetProperty(ref _POLTemperature22, value);
}
/// <summary>
/// B枪ISO压力
/// </summary>
private string _ISOPressure22 = "0.0";
public string ISOPressure22
{
get => _ISOPressure22;
set => SetProperty(ref _ISOPressure22, value);
}
#endregion
}
}