|
@ -177,7 +177,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel |
|
|
|
|
|
|
|
|
void Tick_Main_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S
|
|
|
void Tick_Main_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S
|
|
|
{ |
|
|
{ |
|
|
DATA_view(); |
|
|
|
|
|
//下传工单信息
|
|
|
//下传工单信息
|
|
|
SQLiteHelper WorkOrderSQL = new SQLiteHelper(DBAddress); //数据库连接路径
|
|
|
SQLiteHelper WorkOrderSQL = new SQLiteHelper(DBAddress); //数据库连接路径
|
|
|
WorkOrderSQL.Open(); //打开数据库
|
|
|
WorkOrderSQL.Open(); //打开数据库
|
|
@ -239,11 +238,11 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel |
|
|
});//信息插入队列
|
|
|
});//信息插入队列
|
|
|
|
|
|
|
|
|
string mode = Machines.Select("ID='" + i + "'").First().Field<string>("LOCK");//发送锁定状态
|
|
|
string mode = Machines.Select("ID='" + i + "'").First().Field<string>("LOCK");//发送锁定状态
|
|
|
if (mode == "TRUE") |
|
|
if (mode == "True") |
|
|
{ |
|
|
{ |
|
|
Dictionary<string, object> dat_821 = new Dictionary<string, object>(); |
|
|
Dictionary<string, object> dat_821 = new Dictionary<string, object>(); |
|
|
dat_821.Clear(); |
|
|
dat_821.Clear(); |
|
|
dat_821.Add("LOCK", "TRUE"); |
|
|
dat_821.Add("LOCK", "True"); |
|
|
DataRow drEmployee = Machines.Select("ID='" + i + "'").First(); |
|
|
DataRow drEmployee = Machines.Select("ID='" + i + "'").First(); |
|
|
int index = Convert.ToInt16(drEmployee.Field<object>("ID")); |
|
|
int index = Convert.ToInt16(drEmployee.Field<object>("ID")); |
|
|
stringQueue.Enqueue(new QueueString |
|
|
stringQueue.Enqueue(new QueueString |
|
@ -407,252 +406,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel |
|
|
public static string dyelot; |
|
|
public static string dyelot; |
|
|
public static string machin_LOG; |
|
|
public static string machin_LOG; |
|
|
|
|
|
|
|
|
private async void DATA_view()//IO显示
|
|
|
|
|
|
{ |
|
|
|
|
|
await Task.Run(() => |
|
|
|
|
|
{ |
|
|
|
|
|
/* try |
|
|
|
|
|
{ |
|
|
|
|
|
if (dt_m.Rows.Count >= 0) |
|
|
|
|
|
{ |
|
|
|
|
|
SYSData_M = ToObservableCollection<DATA_M>(dt_m); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
catch (Exception ) { } |
|
|
|
|
|
try |
|
|
|
|
|
{ |
|
|
|
|
|
if (dt_a.Rows.Count >= 0) |
|
|
|
|
|
{ |
|
|
|
|
|
if ((bool)A_view) SYSData_A = ToObservableCollection<DATA_A>(dt_a); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
catch (Exception ) { } |
|
|
|
|
|
try |
|
|
|
|
|
{ |
|
|
|
|
|
if (dt_d.Rows.Count >= 0) |
|
|
|
|
|
{ |
|
|
|
|
|
if ((bool)D_view) SYSData_D = ToObservableCollection<DATA_D>(dt_d); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
catch (Exception) { }*/ |
|
|
|
|
|
/* try |
|
|
|
|
|
{ |
|
|
|
|
|
TechnologicalMachine_View = ToObservableCollection<TechnologicalM>(Machines); |
|
|
|
|
|
} |
|
|
|
|
|
catch (Exception) { }*/ |
|
|
|
|
|
/* try |
|
|
|
|
|
{ |
|
|
|
|
|
if (dt_ParameterSet.Rows.Count >= 0) |
|
|
|
|
|
{ |
|
|
|
|
|
if(ParameterSet_view) Paramete_Set = ToObservableCollection<ParameterSet>(dt_ParameterSet); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
catch (Exception) { } |
|
|
|
|
|
try |
|
|
|
|
|
{ |
|
|
|
|
|
if (dt_SysSet.Rows.Count >= 0) |
|
|
|
|
|
{ |
|
|
|
|
|
if (SysSet_view) Sys_Set = ToObservableCollection<SysSet>(dt_SysSet); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
catch (Exception) { }*/ |
|
|
|
|
|
/* try |
|
|
|
|
|
{ |
|
|
|
|
|
if (dt_TP.Rows.Count >= 0) |
|
|
|
|
|
{ |
|
|
|
|
|
if(TechnologicalProcess_bool) TechnologicalProcess_View = ToObservableCollection<TechnologicalP>(dt_TP); |
|
|
|
|
|
Sys_machine = MachineLOG; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
catch (Exception) { }*/ |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 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 |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
get { return sysData_A; } |
|
|
|
|
|
set |
|
|
|
|
|
{ |
|
|
|
|
|
sysData_A = value; |
|
|
|
|
|
RaisePropertyChanged("SYSData_A"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
public ObservableCollection<DATA_D> SYSData_D |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
get { return sysData_D; } |
|
|
|
|
|
set |
|
|
|
|
|
{ |
|
|
|
|
|
sysData_D = value; |
|
|
|
|
|
RaisePropertyChanged("SYSData_D"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
public ObservableCollection<DATA_M> SYSData_M |
|
|
|
|
|
{ |
|
|
|
|
|
get { return sysData_M; } |
|
|
|
|
|
set |
|
|
|
|
|
{ |
|
|
|
|
|
sysData_M = value; |
|
|
|
|
|
RaisePropertyChanged("SYSData_M"); |
|
|
|
|
|
} |
|
|
|
|
|
}*/ |
|
|
|
|
|
/* 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 ObservableCollection<ParameterSet> Paramete_Set |
|
|
|
|
|
{ |
|
|
|
|
|
get { return paramete_Set; } |
|
|
|
|
|
set |
|
|
|
|
|
{ |
|
|
|
|
|
paramete_Set = value; |
|
|
|
|
|
RaisePropertyChanged("Paramete_Set"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
public ObservableCollection<SysSet> Sys_Set |
|
|
|
|
|
{ |
|
|
|
|
|
get { return sys_Set; } |
|
|
|
|
|
set |
|
|
|
|
|
{ |
|
|
|
|
|
sys_Set = value; |
|
|
|
|
|
RaisePropertyChanged("Sys_Set"); |
|
|
|
|
|
} |
|
|
|
|
|
}*/ |
|
|
|
|
|
/* public class DATA_A |
|
|
|
|
|
{ |
|
|
|
|
|
public string IOName { get; set; } |
|
|
|
|
|
public int AIO { get; set; } |
|
|
|
|
|
public string ID { get; set; } |
|
|
|
|
|
public string PLC { get; set; } |
|
|
|
|
|
public string type { get; set; } |
|
|
|
|
|
} |
|
|
|
|
|
public class DATA_D |
|
|
|
|
|
{ |
|
|
|
|
|
public string IOName { get; set; } |
|
|
|
|
|
public bool DIO { get; set; } |
|
|
|
|
|
public string ID { get; set; } |
|
|
|
|
|
public string PLC { get; set; } |
|
|
|
|
|
public string type { get; set; } |
|
|
|
|
|
} |
|
|
|
|
|
public class DATA_M |
|
|
|
|
|
{ |
|
|
|
|
|
public string IOName { get; set; } |
|
|
|
|
|
public double Value { get; set; } |
|
|
|
|
|
public string ID { get; set; } |
|
|
|
|
|
public string PLC { get; set; } |
|
|
|
|
|
public string type { get; set; } |
|
|
|
|
|
}*/ |
|
|
|
|
|
/* 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 class ParameterSet |
|
|
|
|
|
{ public string Category { get; set; } |
|
|
|
|
|
public string ParameterID { get; set; } |
|
|
|
|
|
public string ParameterName { get; set; } |
|
|
|
|
|
public string Value { get; set; } |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
public class SysSet |
|
|
|
|
|
{ |
|
|
|
|
|
public string Category { get; set; } |
|
|
|
|
|
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); |
|
|
|
|
|
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; |
|
|
|
|
|
} |
|
|
|
|
|
//通讯队列
|
|
|
//通讯队列
|
|
|
public static UInt32 RX=0; |
|
|
public static UInt32 RX=0; |
|
|
public static UInt32 TX=0; |
|
|
public static UInt32 TX=0; |
|
|