Merge branch 'master' of http://www.scserverddns.top:13000/sc/DyeingComputer
This commit is contained in:
commit
d6b10afdbe
1 file changed
+15
-21
@@ -226,6 +226,7 @@ namespace DyeingComputer.ViewModel
|
||||
|
||||
STEP_RUN();
|
||||
LOG_view();
|
||||
// IO_view();
|
||||
|
||||
if (!string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Name_err.ToString();
|
||||
}
|
||||
@@ -240,8 +241,8 @@ namespace DyeingComputer.ViewModel
|
||||
void DisTimer_500MS(object sender, EventArgs e)//Tick_Event周期执行事件500MS
|
||||
{
|
||||
if (LINK_OK) Modbus_link();
|
||||
IO_view();
|
||||
if (LINK_OK) IO_data();
|
||||
IO_view();
|
||||
if (!string.IsNullOrEmpty(Name_err.ToString()) && (!ERR_JOG)) //有故障信息,无故障保持
|
||||
{
|
||||
ERR_JOG = true;
|
||||
@@ -416,8 +417,8 @@ namespace DyeingComputer.ViewModel
|
||||
}
|
||||
}
|
||||
|
||||
TimeSpan ts = new TimeSpan(1);//1秒间隔
|
||||
private int temp_time10s = 10;
|
||||
TimeSpan ts = new TimeSpan(00,00,01);//1秒间隔
|
||||
private int temp_time10s = 10;//开关周期时间
|
||||
void STEP_RUN()
|
||||
{
|
||||
if (WORK_RUN == 2)
|
||||
@@ -1079,9 +1080,9 @@ namespace DyeingComputer.ViewModel
|
||||
{
|
||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||
SQLiteHelpers.Open(); //打开数据库
|
||||
dt_d = SQLiteHelpers.ExecuteDataSet("select * from IOName where ID>'2000' AND ID<'4000' order by ID", null).Tables[0]; //读取表写入缓存
|
||||
dt_d = SQLiteHelpers.ExecuteDataSet("select * from IOName where type='DO' OR type='DQ' order by ID", null).Tables[0]; //读取表写入缓存
|
||||
dt_a = SQLiteHelpers.ExecuteDataSet("select * from IOName where type='AI' OR type='AO' order by ID", null).Tables[0];
|
||||
dt_m = SQLiteHelpers.ExecuteDataSet("select * from IOName where ID<'2000' order by ID", null).Tables[0];
|
||||
dt_m = SQLiteHelpers.ExecuteDataSet("select * from IOName where type='M' order by ID", null).Tables[0];
|
||||
SQLiteHelpers.Close();
|
||||
//创建dt_d主建
|
||||
DataColumn[] dt_dcols =new DataColumn[] { dt_d.Columns["ID"] };
|
||||
@@ -1095,6 +1096,7 @@ namespace DyeingComputer.ViewModel
|
||||
}
|
||||
private async void IO_data()//刷新
|
||||
{
|
||||
|
||||
updata_dtm("1001", LINK_RUN);
|
||||
updata_dtm("1002", LINK_ERR);
|
||||
updata_dtm("1010", (Convert.ToDouble(Selet_dta("4001")) + MT33)/10);
|
||||
@@ -1114,21 +1116,23 @@ namespace DyeingComputer.ViewModel
|
||||
{
|
||||
await Task.Run(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
SYSData_M = ToObservableCollection<DATA_M>(dt_m);
|
||||
}
|
||||
catch (Exception ex) { Name_err = "IO_SYSData_M" + "(" + ex.Message + ")"; }
|
||||
|
||||
try
|
||||
{
|
||||
SYSData_A = ToObservableCollection<DATA_A>(dt_a);
|
||||
}
|
||||
catch (Exception ex) { Name_err = "IO_SYSData_A" + "(" + ex.Message + ")"; }
|
||||
|
||||
try
|
||||
{
|
||||
SYSData_D = ToObservableCollection<DATA_D>(dt_d);
|
||||
}
|
||||
catch (Exception ex) { Name_err = "IO_SYSData_D" + "(" + ex.Message + ")"; }
|
||||
try
|
||||
{
|
||||
SYSData_M = ToObservableCollection<DATA_M>(dt_m);
|
||||
}
|
||||
catch (Exception ex) { Name_err = "IO_SYSData_M" + "(" + ex.Message + ")"; }
|
||||
});
|
||||
}
|
||||
public static double Selet_dtm(string key)//M寄存器
|
||||
@@ -1194,15 +1198,6 @@ namespace DyeingComputer.ViewModel
|
||||
{
|
||||
lock (dt_m)
|
||||
{
|
||||
/* DataRow[] arrRows = dt_m.Select("ID='" + key + "'");
|
||||
int index = dt_m.Rows.IndexOf(arrRows[0]);
|
||||
if (index != -1)
|
||||
{
|
||||
DataRow drEmployee = dt_m.Rows[index];
|
||||
drEmployee.BeginEdit();
|
||||
drEmployee["Value"] = Value;
|
||||
drEmployee.EndEdit();
|
||||
}*/
|
||||
DataRow drEmployee = dt_m.Rows.Find(key);
|
||||
drEmployee.BeginEdit();
|
||||
drEmployee["Value"] = Value;
|
||||
@@ -1307,8 +1302,7 @@ namespace DyeingComputer.ViewModel
|
||||
{
|
||||
public string IOName { get; set; }
|
||||
public double Value { get; set; }
|
||||
public String ID { get; set; }
|
||||
public string Info { get; set; }
|
||||
public string ID { get; set; }
|
||||
public string type { get; set; }
|
||||
}
|
||||
public ObservableCollection<T> ToObservableCollection<T>(DataTable dt) where T : class, new()
|
||||
|
||||
Reference in new issue
Block a user