页面显示设备状态逻辑修改
This commit is contained in:
commit
6eae137bd1
15 files changed
+456
-218
No files matched your search
@@ -238,13 +238,13 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
DAT = "SC830" + Selet_Machines(Machines, "SYSKEY", "ID='" + i + "'").ToString()
|
||||
});//信息插入队列
|
||||
|
||||
string mode = Machines.Select("NAME='" + machine + "'").First().Field<string>("LOCK");
|
||||
string mode = Machines.Select("ID='" + i + "'").First().Field<string>("LOCK");//发送锁定状态
|
||||
if (mode == "TRUE")
|
||||
{
|
||||
Dictionary<string, object> dat_821 = new Dictionary<string, object>();
|
||||
dat_821.Clear();
|
||||
dat_821.Add("LOCK", "TRUE");
|
||||
DataRow drEmployee = Machines.Select("NAME='" + machine + "'").First();
|
||||
DataRow drEmployee = Machines.Select("ID='" + i + "'").First();
|
||||
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
||||
stringQueue.Enqueue(new QueueString
|
||||
{
|
||||
@@ -259,7 +259,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
for (int i = 0; i < Machinesdata_Count; i++)
|
||||
{
|
||||
string mac_s = Selet_Machines(Machines, "State", "ID='" + i + "'").ToString();
|
||||
if ((mac_s == "101") || (mac_s == "201") || (mac_s == "202") || (mac_s == "309"))//获取信息
|
||||
if ((mac_s == "101") || (mac_s == "201") || (mac_s == "202") || (mac_s == "301") || (mac_s == "309"))//获取信息
|
||||
{
|
||||
stringQueue.Enqueue(new QueueString
|
||||
{
|
||||
@@ -397,11 +397,11 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
public static DataTable dt_ParameterSet = new DataTable();
|
||||
public static DataTable dt_SysSet = new DataTable();
|
||||
public static bool TechnologicalProcess_bool =true;
|
||||
public static bool A_view =true;
|
||||
public static bool D_view =true;
|
||||
// public static bool A_view =true;
|
||||
// public static bool D_view =true;
|
||||
public static bool IO_view;
|
||||
public static bool ParameterSet_view=true;
|
||||
public static bool SysSet_view=true;
|
||||
// public static bool ParameterSet_view=true;
|
||||
// public static bool SysSet_view=true;
|
||||
public static string machine;
|
||||
public static string workOrder;
|
||||
public static string dyelot;
|
||||
@@ -411,7 +411,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
{
|
||||
await Task.Run(() =>
|
||||
{
|
||||
try
|
||||
/* try
|
||||
{
|
||||
if (dt_m.Rows.Count >= 0)
|
||||
{
|
||||
@@ -434,13 +434,13 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
if ((bool)D_view) SYSData_D = ToObservableCollection<DATA_D>(dt_d);
|
||||
}
|
||||
}
|
||||
catch (Exception) { }
|
||||
catch (Exception) { }*/
|
||||
/* try
|
||||
{
|
||||
TechnologicalMachine_View = ToObservableCollection<TechnologicalM>(Machines);
|
||||
}
|
||||
catch (Exception) { }*/
|
||||
try
|
||||
/* try
|
||||
{
|
||||
if (dt_ParameterSet.Rows.Count >= 0)
|
||||
{
|
||||
@@ -455,7 +455,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
if (SysSet_view) Sys_Set = ToObservableCollection<SysSet>(dt_SysSet);
|
||||
}
|
||||
}
|
||||
catch (Exception) { }
|
||||
catch (Exception) { }*/
|
||||
/* try
|
||||
{
|
||||
if (dt_TP.Rows.Count >= 0)
|
||||
@@ -468,14 +468,14 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
});
|
||||
}
|
||||
|
||||
ObservableCollection<DATA_A> sysData_A = new ObservableCollection<DATA_A>();
|
||||
ObservableCollection<DATA_D> sysData_D = new ObservableCollection<DATA_D>();
|
||||
ObservableCollection<DATA_M> sysData_M = new ObservableCollection<DATA_M>();
|
||||
ObservableCollection<ParameterSet> paramete_Set = new ObservableCollection<ParameterSet>();
|
||||
ObservableCollection<SysSet> sys_Set = new ObservableCollection<SysSet>();
|
||||
// ObservableCollection<DATA_A> sysData_A = new ObservableCollection<DATA_A>();
|
||||
// ObservableCollection<DATA_D> sysData_D = new ObservableCollection<DATA_D>();
|
||||
// ObservableCollection<DATA_M> sysData_M = new ObservableCollection<DATA_M>();
|
||||
// ObservableCollection<ParameterSet> paramete_Set = new ObservableCollection<ParameterSet>();
|
||||
// ObservableCollection<SysSet> sys_Set = new ObservableCollection<SysSet>();
|
||||
//ObservableCollection<TechnologicalP> technologicalProcess_View = new ObservableCollection<TechnologicalP>();
|
||||
//ObservableCollection<TechnologicalM> technologicalMachine_View = new ObservableCollection<TechnologicalM>();
|
||||
public ObservableCollection<DATA_A> SYSData_A
|
||||
/* public ObservableCollection<DATA_A> SYSData_A
|
||||
{
|
||||
|
||||
get { return sysData_A; }
|
||||
@@ -503,7 +503,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
sysData_M = value;
|
||||
RaisePropertyChanged("SYSData_M");
|
||||
}
|
||||
}
|
||||
}*/
|
||||
/* public ObservableCollection<TechnologicalP> TechnologicalProcess_View
|
||||
{
|
||||
get { return technologicalProcess_View; }
|
||||
@@ -522,7 +522,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
RaisePropertyChanged("TechnologicalMachine_View");
|
||||
}
|
||||
}*/
|
||||
public ObservableCollection<ParameterSet> Paramete_Set
|
||||
/* public ObservableCollection<ParameterSet> Paramete_Set
|
||||
{
|
||||
get { return paramete_Set; }
|
||||
set
|
||||
@@ -539,8 +539,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
sys_Set = value;
|
||||
RaisePropertyChanged("Sys_Set");
|
||||
}
|
||||
}
|
||||
public class DATA_A
|
||||
}*/
|
||||
/* public class DATA_A
|
||||
{
|
||||
public string IOName { get; set; }
|
||||
public int AIO { get; set; }
|
||||
@@ -563,7 +563,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
public string ID { get; set; }
|
||||
public string PLC { get; set; }
|
||||
public string type { get; set; }
|
||||
}
|
||||
}*/
|
||||
/* public class TechnologicalM
|
||||
{
|
||||
public string Name { get; set; }
|
||||
@@ -592,7 +592,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
public string Parameter5 { get; set; }
|
||||
public string DYELOT { get; set; }
|
||||
}*/
|
||||
public class ParameterSet
|
||||
/* public class ParameterSet
|
||||
{ public string Category { get; set; }
|
||||
public string ParameterID { get; set; }
|
||||
public string ParameterName { get; set; }
|
||||
@@ -605,7 +605,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
public string ParameterID { get; set; }
|
||||
public string ParameterName { get; set; }
|
||||
public string Value { get; set; }
|
||||
}
|
||||
}*/
|
||||
public ObservableCollection<T> ToObservableCollection<T>(DataTable dt) where T : class, new()
|
||||
{
|
||||
Type t = typeof(T);
|
||||
|
||||
@@ -26,137 +26,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
// timer1s.Start();
|
||||
}
|
||||
|
||||
void Tick_Main_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S
|
||||
{
|
||||
DATA_view();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public string sys_machine; //显示log
|
||||
public string Sys_machine //通知UI控件参数改变
|
||||
{
|
||||
get { return sys_machine; }
|
||||
set { sys_machine = value; OnPropertyChanged("Sys_machine"); }
|
||||
}
|
||||
public static bool TechnologicalProcess_bool = true;
|
||||
private async void DATA_view()//IO显示
|
||||
{
|
||||
await Task.Run(() =>
|
||||
{
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
TechnologicalMachine_View = ToObservableCollection<TechnologicalM>(Machines);
|
||||
}
|
||||
catch (Exception) { }
|
||||
|
||||
try
|
||||
{
|
||||
if (dt_TP.Rows.Count >= 0)
|
||||
{
|
||||
if (TechnologicalProcess_bool) TechnologicalProcess_View = ToObservableCollection<TechnologicalP>(dt_TP);
|
||||
Sys_machine = MachineLOG;
|
||||
}
|
||||
}
|
||||
catch (Exception) { }
|
||||
});
|
||||
}
|
||||
ObservableCollection<TechnologicalP> technologicalProcess_View = new ObservableCollection<TechnologicalP>();
|
||||
ObservableCollection<TechnologicalM> technologicalMachine_View = new ObservableCollection<TechnologicalM>();
|
||||
public ObservableCollection<TechnologicalP> TechnologicalProcess_View
|
||||
{
|
||||
get { return technologicalProcess_View; }
|
||||
set
|
||||
{
|
||||
technologicalProcess_View = value;
|
||||
RaisePropertyChanged("TechnologicalProcess_View");
|
||||
}
|
||||
}
|
||||
public ObservableCollection<TechnologicalM> TechnologicalMachine_View
|
||||
{
|
||||
get { return technologicalMachine_View; }
|
||||
set
|
||||
{
|
||||
technologicalMachine_View = value;
|
||||
RaisePropertyChanged("TechnologicalMachine_View");
|
||||
}
|
||||
}
|
||||
public class TechnologicalM
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string WorkOrder { get; set; }
|
||||
public string Dyelot { get; set; }
|
||||
public string Temperature { get; set; }
|
||||
public string WaterLevel { get; set; }
|
||||
public string Process { get; set; }
|
||||
public string Step { get; set; }
|
||||
public string Message { get; set; }
|
||||
public string State { get; set; }
|
||||
|
||||
}
|
||||
public class TechnologicalP
|
||||
{
|
||||
public string ProgramID { get; set; }
|
||||
public string Program { get; set; }
|
||||
public double Step { get; set; }
|
||||
public string StepID { get; set; }
|
||||
public string StepName { get; set; }
|
||||
public string ParameterName { get; set; }
|
||||
public string Parameter1 { get; set; }
|
||||
public string Parameter2 { get; set; }
|
||||
public string Parameter3 { get; set; }
|
||||
public string Parameter4 { get; set; }
|
||||
public string Parameter5 { get; set; }
|
||||
public string DYELOT { get; set; }
|
||||
}
|
||||
|
||||
public ObservableCollection<T> ToObservableCollection<T>(DataTable dt) where T : class, new()
|
||||
{
|
||||
Type t = typeof(T);
|
||||
PropertyInfo[] propertys = t.GetProperties();
|
||||
ObservableCollection<T> lst = new ObservableCollection<T>();
|
||||
string typeName = string.Empty;
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
{
|
||||
T entity = new T();
|
||||
foreach (PropertyInfo pi in propertys)
|
||||
{
|
||||
typeName = pi.Name;
|
||||
if (dt.Columns.Contains(typeName))
|
||||
{
|
||||
if (!pi.CanWrite) continue;
|
||||
object value = dr[typeName];
|
||||
if (value == DBNull.Value) continue;
|
||||
if (pi.PropertyType == typeof(string))
|
||||
{
|
||||
pi.SetValue(entity, value.ToString(), null);
|
||||
}
|
||||
else if (pi.PropertyType == typeof(int) || pi.PropertyType == typeof(int?))
|
||||
{
|
||||
pi.SetValue(entity, int.Parse(value.ToString()), null);
|
||||
}
|
||||
else if (pi.PropertyType == typeof(DateTime?) || pi.PropertyType == typeof(DateTime))
|
||||
{
|
||||
pi.SetValue(entity, DateTime.Parse(value.ToString()), null);
|
||||
}
|
||||
else if (pi.PropertyType == typeof(float))
|
||||
{
|
||||
pi.SetValue(entity, float.Parse(value.ToString()), null);
|
||||
}
|
||||
else if (pi.PropertyType == typeof(double))
|
||||
{
|
||||
pi.SetValue(entity, double.Parse(value.ToString()), null);
|
||||
}
|
||||
else
|
||||
{
|
||||
pi.SetValue(entity, value, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
lst.Add(entity);
|
||||
}
|
||||
return lst;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user