通讯循环逻辑修改

This commit is contained in:
sc committed 2025-09-07 12:27:07 +08:00
commit 6c6fa42544
3 files changed
+44 -10

No files matched your search

+18 -10
View File
@@ -2474,7 +2474,7 @@ namespace DyeingComputer.ViewModel
else if (WORK_RUN == 1)
{
Status_Str = Resources.Paused;
for (int i = 4; i < 128; i++)
for (int i = 4; i < DQ_DL; i++)
{
Updata_dtd((3000 + i).ToString(), false);
}
@@ -2485,7 +2485,7 @@ namespace DyeingComputer.ViewModel
// {
Updata_dtm("1004", 0);
Updata_dtm("1005", Selet_dtm("1010"));
for (int i = 1; i <128; i++)
for (int i = 1; i < DQ_DL; i++)
{
Updata_dtd((3000+i).ToString(), false);
}
@@ -3376,10 +3376,10 @@ namespace DyeingComputer.ViewModel
private bool LINK_OK = false;
private int LINK_RUN = 0;
private int LINK_ERR = 0;
bool[] DQ = new bool[63];
ushort DQ_L = 63;
bool[] DO = new bool[63];
ushort DO_L = 63;
bool[] DQ = new bool[127];
ushort DQ_L = 127;
bool[] DO = new bool[127];
ushort DO_L = 127;
//int[] MW = new int[128];
// ushort MW_L = 128;
ushort[] DW = new ushort[63];
@@ -3577,6 +3577,10 @@ namespace DyeingComputer.ViewModel
public static object D_view = true;
public static object A_view = true;
public static bool User_Button = false;
public static int DO_DL = 0;
public static int DQ_DL = 0;
public static int AI_DL = 0;
public static int AO_DL = 0;
public static void SQL_data()//获得io表
{
//SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
@@ -3588,6 +3592,10 @@ namespace DyeingComputer.ViewModel
dt_SysSet = MainWindow.SQLiteHelpers.ExecuteDataSet("select * from System order by ParameterID asc", null).Tables[0];
dt_TP = MainWindow.SQLiteHelpers.ExecuteDataSet("select * from RUN", null).Tables[0];
//SQLiteHelpers.Close();
DO_DL = dt_d.Select("type='DO'").Count();
DQ_DL = dt_d.Select("type='DQ'").Count();
AI_DL = dt_a.Select("type='AI'").Count();
AO_DL = dt_a.Select("type='AO'").Count();
dt_d.RowChanged += new DataRowChangeEventHandler(ROW_changed_D);//添加行改变触发事件
dt_a.RowChanged += new DataRowChangeEventHandler(ROW_changed_A);
@@ -3644,10 +3652,10 @@ namespace DyeingComputer.ViewModel
{
await Task.Run(() =>
{
for (ushort i = 0; i < DO_L; i++) { Upplc_dtd((i + 2001).ToString(), DO[i]); }
for (ushort i = 0; i < DQ_L; i++) { DQ[i] = Seplc_dtd((i + 3001).ToString()); }
for (ushort i = 0; i < RW_L; i++) { Upplc_dta((i + 4001).ToString(), RW[i]); }
for (ushort i = 0; i < DW_L; i++) { DW[i] = Convert.ToUInt16(Seplc_dta((i + 5001).ToString())); }
for (ushort i = 0; i < DO_DL-1; i++) { Upplc_dtd((i + 2001).ToString(), DO[i]); }
for (ushort i = 0; i < DQ_DL-1; i++) { DQ[i] = Seplc_dtd((i + 3001).ToString()); }
for (ushort i = 0; i < AI_DL-1; i++) { Upplc_dta((i + 4001).ToString(), RW[i]); }
for (ushort i = 0; i < AO_DL-1; i++) { DW[i] =Convert.ToUInt16( Seplc_dta((i + 5001).ToString())); }
});
}
public void IO_view()//IO显示