Sic08/SicUI/Models/PMs/PMMfcTestViewModel.cs

184 lines
5.3 KiB
C#

using Aitex.Core.Common.DeviceData;
using Aitex.Core.Util;
using MECF.Framework.Common.Aitex.Core.Common.DeviceData.IoDevice;
using MECF.Framework.Common.OperationCenter;
using MECF.Framework.UI.Client.ClientBase;
using Newtonsoft.Json;
using OpenSEMI.ClientBase;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Media;
namespace SicUI.Models.PMs
{
public class PMMfcTestViewModel : SicModuleUIViewModelBase, ISupportMultipleSystem
{
//SensorGBDoorClosed
[Subscription("SensorGBDoorClosed.DeviceData")]
public AITSensorData GBDoorClosed { get; set; }
[Subscription("SensorGN2InletPressSW.DeviceData")]
public AITSensorData GN2InletPressSW { get; set; }
[Subscription("SensorArInletPressSW.DeviceData")]
public AITSensorData ArInletPressSW { get; set; }
[Subscription("SensorH2PressureSW.DeviceData")]
public AITSensorData H2PressureSW { get; set; }
//private List<ControlNameData> _valueTestList;
//[Subscription("MfcTest.ValueTestList")]
//public List<ControlNameData> ValueTestList
//{
// get { return _valueTestList; }
// set
// {
// if (_valueTestList != value)
// _valueTestList = value;
// }
//}
//private List<ControlNameData> _pcTestList;
//[Subscription("MfcTest.PCTestList")]
//public List<ControlNameData> PCTestList
//{
// get { return _pcTestList; }
// set
// {
// if (_pcTestList != value)
// _pcTestList = value;
// }
//}
//private List<MfcTestData> _mfcTestList;
//[Subscription("MfcTest.MfcTestList")]
//public List<MfcTestData> MfcTestList
//{
// get { return _mfcTestList; }
// set
// {
// if (_mfcTestList != value)
// _mfcTestList = value;
// }
//}
//public void DeleteMfcTest()
//{
// var selection = DialogBox.ShowDialog(DialogButton.Yes | DialogButton.Cancel, DialogType.CONFIRM,
// "Are you sure delect all test data");
// if (selection == DialogButton.Yes)
// {
// InvokeClient.Instance.Service.DoOperation($"{SystemName}.MfcTest.DeleteMfcTest");
// }
//}
public List<ControlNameData> ValueTestList { get; set; }
private string _strValueTestList;
[Subscription("MfcTest.ValueTestList")]
public string StrValueTestList
{
get { return _strValueTestList; }
set
{
if (_strValueTestList != value && value != null)
{
ValueTestList = JsonConvert.DeserializeObject<List<ControlNameData>>(value);
}
_strValueTestList = value;
}
}
public List<ControlNameData> PCTestList { get; set; }
private string _strPCTestList;
[Subscription("MfcTest.PCTestList")]
public string StrPCTestList
{
get { return _strPCTestList; }
set
{
if (_strPCTestList != value && value != null)
{
PCTestList = JsonConvert.DeserializeObject<List<ControlNameData>>(value);
}
_strPCTestList = value;
}
}
public List<MfcTestData> MfcTestList { get; set; } = new List<MfcTestData>();
private string _strMfcTestList;
[Subscription("MfcTest.MfcTestList")]
public string StrMfcTestList
{
get { return _strMfcTestList; }
set
{
if (_strMfcTestList != value && value != null)
{
MfcTestList = JsonConvert.DeserializeObject<List<MfcTestData>>(value);
}
_strMfcTestList = value;
}
}
public void DeleteMfcTest()
{
var selection = DialogBox.ShowDialog(DialogButton.Yes | DialogButton.Cancel, DialogType.CONFIRM,
"Are you sure delect all test data");
if (selection == DialogButton.Yes)
{
InvokeClient.Instance.Service.DoOperation($"{SystemName}.MfcTest.DeleteMfcTest");
}
}
}
/// <summary>
/// 输入数值检测
/// </summary>
class ColorConverter_IsTestOK : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null || value.ToString().Length == 0)
return new SolidColorBrush(Colors.Gray);
if (value.ToString() == "OK")
return new SolidColorBrush(Colors.Green);
else if (value.ToString() == "NG")
return new SolidColorBrush(Colors.Red);
else
return new SolidColorBrush(Colors.Gray);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return null;
}
}
}