Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement
This commit is contained in:
commit
3c3b608bfb
10 files changed
+141
-333
No files matched your search
@@ -29,7 +29,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ConvertMoels
|
||||
else if (i == "800") Staten = "LinkOff";//未连接
|
||||
else if (i == "801") Staten = "Link";//连接成功
|
||||
else if (i == "899") Staten = "LinkOff";//关闭连接
|
||||
else if (i == "TRUE") Staten = "Lock";//锁
|
||||
else if (i == "True") Staten = "Lock";//锁
|
||||
|
||||
return Staten;
|
||||
}
|
||||
|
||||
Generated
+18
@@ -2688,6 +2688,24 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 user_lock 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string user_lock {
|
||||
get {
|
||||
return ResourceManager.GetString("user_lock", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 user_unlock 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string user_unlock {
|
||||
get {
|
||||
return ResourceManager.GetString("user_unlock", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Valid time 的本地化字符串。
|
||||
/// </summary>
|
||||
|
||||
@@ -1050,4 +1050,10 @@
|
||||
<data name="TMNR" xml:space="preserve">
|
||||
<value>The machine is not ready</value>
|
||||
</data>
|
||||
<data name="user_lock" xml:space="preserve">
|
||||
<value>LOCK</value>
|
||||
</data>
|
||||
<data name="user_unlock" xml:space="preserve">
|
||||
<value>UNLOCK</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1050,4 +1050,10 @@
|
||||
<data name="TMNR" xml:space="preserve">
|
||||
<value>The machine is not ready</value>
|
||||
</data>
|
||||
<data name="user_lock" xml:space="preserve">
|
||||
<value>user_lock</value>
|
||||
</data>
|
||||
<data name="user_unlock" xml:space="preserve">
|
||||
<value>user_unlock</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1050,4 +1050,10 @@
|
||||
<data name="TMNR" xml:space="preserve">
|
||||
<value>机台未就绪</value>
|
||||
</data>
|
||||
<data name="user_lock" xml:space="preserve">
|
||||
<value>锁定</value>
|
||||
</data>
|
||||
<data name="user_unlock" xml:space="preserve">
|
||||
<value>解锁</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1050,4 +1050,10 @@
|
||||
<data name="TMNR" xml:space="preserve">
|
||||
<value>機台未就緒</value>
|
||||
</data>
|
||||
<data name="user_lock" xml:space="preserve">
|
||||
<value />
|
||||
</data>
|
||||
<data name="user_unlock" xml:space="preserve">
|
||||
<value />
|
||||
</data>
|
||||
</root>
|
||||
@@ -74,6 +74,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
||||
drEmployee["Process"] = "";
|
||||
drEmployee["Step"] = "";
|
||||
drEmployee["Message"] = "";
|
||||
drEmployee["SYSKEY"] = "";
|
||||
drEmployee.EndEdit();
|
||||
drEmployee.AcceptChanges();
|
||||
LogGing.LogGingDATA("[IP='" + client.IP + "' AND port='" + client.Port + "']=Link_STOP");
|
||||
@@ -98,6 +99,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
||||
drEmployee["Process"] = "";
|
||||
drEmployee["Step"] = "";
|
||||
drEmployee["Message"] = "";
|
||||
drEmployee["SYSKEY"] = "";
|
||||
drEmployee.EndEdit();
|
||||
drEmployee.AcceptChanges();
|
||||
LogGing.LogGingDATA("[IP='" + client.IP + "' AND port='" + client.Port + "']=Link_INTERRUPT");
|
||||
@@ -133,7 +135,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
||||
{
|
||||
LogGing.ERRDATA(ex); MainWindowViewModel.ERR_c++;
|
||||
}
|
||||
|
||||
}
|
||||
else if (SYSAPI == "SC810")
|
||||
{
|
||||
@@ -174,6 +175,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
||||
_new = JsonConvert.DeserializeObject<Dictionary<string, object>>(DAT);//反序列化
|
||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("IP='" + client.IP + "'").First();
|
||||
drEmployee.BeginEdit();
|
||||
drEmployee["LOCK"] = _new.GetValue("LOCK");
|
||||
drEmployee["Message"] = _new.GetValue("Status");
|
||||
drEmployee["WorkOrder"] = _new.GetValue("WorkNumder");
|
||||
drEmployee["Temperature"] = _new.GetValue("MTT");
|
||||
@@ -209,7 +211,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
||||
|
||||
}
|
||||
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||
}
|
||||
}//当前信息
|
||||
else if (SYSAPI == "SC831")
|
||||
{
|
||||
try
|
||||
|
||||
+41
-37
@@ -460,50 +460,54 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
}
|
||||
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)
|
||||
try
|
||||
{
|
||||
T entity = new T();
|
||||
foreach (PropertyInfo pi in propertys)
|
||||
Type t = typeof(T);
|
||||
PropertyInfo[] propertys = t.GetProperties();
|
||||
ObservableCollection<T> lst = new ObservableCollection<T>();
|
||||
string typeName = string.Empty;
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
{
|
||||
typeName = pi.Name;
|
||||
if (dt.Columns.Contains(typeName))
|
||||
T entity = new T();
|
||||
foreach (PropertyInfo pi in propertys)
|
||||
{
|
||||
if (!pi.CanWrite) continue;
|
||||
object value = dr[typeName];
|
||||
if (value == DBNull.Value) continue;
|
||||
if (pi.PropertyType == typeof(string))
|
||||
typeName = pi.Name;
|
||||
if (dt.Columns.Contains(typeName))
|
||||
{
|
||||
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);
|
||||
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);
|
||||
}
|
||||
lst.Add(entity);
|
||||
return lst;
|
||||
}
|
||||
return lst;
|
||||
}
|
||||
catch (Exception) { return null; }
|
||||
}
|
||||
}
|
||||
}
|
||||
+50
-43
@@ -119,7 +119,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
else
|
||||
{
|
||||
MessageBox.Show(Properties.Resources.TMNR, "800", MessageBoxButton.OK, MessageBoxImage.Information); //
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,15 +225,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
Dictionary<string, object> dat_821 = new Dictionary<string, object>();
|
||||
dat_821.Clear();
|
||||
|
||||
if (mode != "TRUE")
|
||||
if (mode != "True")
|
||||
{
|
||||
dat_821.Add("LOCK", "TRUE");
|
||||
MainWindowViewModel.Updata_Machines(MainWindowViewModel.Machines, "LOCK", "Name='" + machine + "'", "TRUE");
|
||||
}
|
||||
dat_821.Add("LOCK", "True");
|
||||
MainWindowViewModel.Updata_Machines(MainWindowViewModel.Machines, "LOCK", "Name='" + machine + "'", "True");
|
||||
}
|
||||
else
|
||||
{
|
||||
dat_821.Add("LOCK", "FALSE");
|
||||
MainWindowViewModel.Updata_Machines(MainWindowViewModel.Machines, "LOCK", "Name='" + machine + "'", "FALSE");
|
||||
MainWindowViewModel.Updata_Machines(MainWindowViewModel.Machines, "LOCK", "Name='" + machine + "'", "False");
|
||||
}
|
||||
|
||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
||||
@@ -245,6 +244,10 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
DAT = "SC829" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'") + dat_821.ToJsonString()
|
||||
});
|
||||
|
||||
if (mode != "True") { MessageBox.Show(machine + Properties.Resources.user_lock, "800", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
} else {
|
||||
MessageBox.Show(machine + Properties.Resources.user_unlock, "800", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
}//锁定
|
||||
private void ListViewItem_Curve(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
@@ -599,7 +602,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
catch (Exception) { }
|
||||
try
|
||||
{
|
||||
if (MainWindowViewModel.dt_TP.Rows.Count >= 0)
|
||||
if (MainWindowViewModel.dt_TP.Rows.Count > 0)
|
||||
{
|
||||
if (TechnologicalProcess_bool)
|
||||
{
|
||||
@@ -665,50 +668,54 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
|
||||
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)
|
||||
try
|
||||
{
|
||||
T entity = new T();
|
||||
foreach (PropertyInfo pi in propertys)
|
||||
Type t = typeof(T);
|
||||
PropertyInfo[] propertys = t.GetProperties();
|
||||
ObservableCollection<T> lst = new ObservableCollection<T>();
|
||||
string typeName = string.Empty;
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
{
|
||||
typeName = pi.Name;
|
||||
if (dt.Columns.Contains(typeName))
|
||||
T entity = new T();
|
||||
foreach (PropertyInfo pi in propertys)
|
||||
{
|
||||
if (!pi.CanWrite) continue;
|
||||
object value = dr[typeName];
|
||||
if (value == DBNull.Value) continue;
|
||||
if (pi.PropertyType == typeof(string))
|
||||
typeName = pi.Name;
|
||||
if (dt.Columns.Contains(typeName))
|
||||
{
|
||||
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);
|
||||
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);
|
||||
}
|
||||
lst.Add(entity);
|
||||
return lst;
|
||||
}
|
||||
return lst;
|
||||
catch (Exception) { return null; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -177,7 +177,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
|
||||
void Tick_Main_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S
|
||||
{
|
||||
DATA_view();
|
||||
//下传工单信息
|
||||
SQLiteHelper WorkOrderSQL = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||
WorkOrderSQL.Open(); //打开数据库
|
||||
@@ -239,11 +238,11 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
});//信息插入队列
|
||||
|
||||
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>();
|
||||
dat_821.Clear();
|
||||
dat_821.Add("LOCK", "TRUE");
|
||||
dat_821.Add("LOCK", "True");
|
||||
DataRow drEmployee = Machines.Select("ID='" + i + "'").First();
|
||||
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
||||
stringQueue.Enqueue(new QueueString
|
||||
@@ -406,253 +405,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
public static string workOrder;
|
||||
public static string dyelot;
|
||||
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 TX=0;
|
||||
|
||||
Reference in new issue
Block a user