|
|
@ -82,7 +82,34 @@ namespace DyeingComputer.ViewModel |
|
|
|
WorkNumder = "----------"; |
|
|
|
SYS_SET(); //crbl
|
|
|
|
SQL_data(); //读数据库
|
|
|
|
UPort(); //启动串口
|
|
|
|
if(S04!="1") UPort(); //启动串口
|
|
|
|
|
|
|
|
if (dt_TP.Rows.Count > 0) |
|
|
|
{ |
|
|
|
MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show(Properties.Resources.RunningProcess, "800", MessageBoxButton.YesNo); |
|
|
|
if (messageBoxResult == MessageBoxResult.Yes) |
|
|
|
{ |
|
|
|
DataRow drEmployee = dt_TP.Select("RUN=1").First(); |
|
|
|
|
|
|
|
RUN_STEPID = drEmployee.Field<int>("Step"); |
|
|
|
|
|
|
|
STEP_START(drEmployee.Field<string>("StepID"), |
|
|
|
drEmployee.Field<double>("Parameter1"), |
|
|
|
drEmployee.Field<double>("Parameter2"), |
|
|
|
drEmployee.Field<double>("Parameter3"), |
|
|
|
drEmployee.Field<double>("Parameter4"), |
|
|
|
drEmployee.Field<double>("Parameter5") |
|
|
|
); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
SQLiteHelpers = new SQLiteHelper(DBAddress); |
|
|
|
SQLiteHelpers.Open(); |
|
|
|
SQLiteHelpers.Delete("RUN", null, null); |
|
|
|
SQLiteHelpers.Close(); |
|
|
|
}//清楚任务列表
|
|
|
|
}//如果有未完成的工艺
|
|
|
|
|
|
|
|
CountDown(); //启动循环任务
|
|
|
|
|
|
|
|
_ = AsyncTcpServer.Main(); |
|
|
@ -140,6 +167,7 @@ namespace DyeingComputer.ViewModel |
|
|
|
private static int MU01;//呼叫操作员
|
|
|
|
public static string S01;//机台号
|
|
|
|
public static string S03;//设备组
|
|
|
|
public static string S04;//展示模式
|
|
|
|
public static string S05;//管控模式
|
|
|
|
public static string S06;//通讯编码
|
|
|
|
public static int S16;//风机联动
|
|
|
@ -197,6 +225,7 @@ namespace DyeingComputer.ViewModel |
|
|
|
|
|
|
|
S01 = Selet_sys("S01");//
|
|
|
|
S03 = Selet_sys("S03");//
|
|
|
|
S04 = Selet_sys("S04");//
|
|
|
|
S05 = Selet_sys("S05");//
|
|
|
|
S06 = Selet_sys("S06");//
|
|
|
|
S16 = Convert.ToInt16(Selet_sys("S16"));//工作信息
|
|
|
@ -542,6 +571,7 @@ namespace DyeingComputer.ViewModel |
|
|
|
private bool Alert_yellow = false; //警报黄灯
|
|
|
|
private bool Alert_red = false; //警报红灯
|
|
|
|
private bool Alert_bell = false; //警报铃声
|
|
|
|
static Dictionary<string, object> updata_RUN = new Dictionary<string, object>();//
|
|
|
|
public static void STEP_START(string ID, double P1, double P2, double P3, double P4, double P5) //启动模块
|
|
|
|
{ |
|
|
|
STEP_ID = ID; |
|
|
@ -740,6 +770,19 @@ namespace DyeingComputer.ViewModel |
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
|
|
|
SQLiteHelpers.Open(); //打开数据库
|
|
|
|
|
|
|
|
updata_RUN.Clear(); |
|
|
|
updata_RUN.Add("RUN", 0); |
|
|
|
SQLiteHelpers.Update("RUN", updata_RUN, "RUN ='1'", null);//更新
|
|
|
|
|
|
|
|
updata_RUN.Clear(); |
|
|
|
updata_RUN.Add("RUN", 1); |
|
|
|
SQLiteHelpers.Update("RUN", updata_RUN, "Step ='"+ RUN_STEPID + "'", null);//更新
|
|
|
|
dt_TP = SQLiteHelpers.ExecuteDataSet("select * from RUN", null).Tables[0]; |
|
|
|
SQLiteHelpers.Close();//关闭数据库
|
|
|
|
} |
|
|
|
|
|
|
|
TimeSpan ts = new TimeSpan(00,00,01);//1秒间隔
|
|
|
@ -1808,6 +1851,7 @@ namespace DyeingComputer.ViewModel |
|
|
|
dt_m = SQLiteHelpers.ExecuteDataSet("select * from IOName where type='M' order by ID", null).Tables[0]; |
|
|
|
dt_ParameterSet = SQLiteHelpers.ExecuteDataSet("select * from Parameters order by ParameterID asc", null).Tables[0]; |
|
|
|
dt_SysSet = SQLiteHelpers.ExecuteDataSet("select * from System order by ParameterID asc", null).Tables[0]; |
|
|
|
dt_TP = SQLiteHelpers.ExecuteDataSet("select * from RUN", null).Tables[0]; |
|
|
|
|
|
|
|
SQLiteHelpers.Close(); |
|
|
|
//创建dt_d主建
|
|
|
@ -1818,7 +1862,7 @@ namespace DyeingComputer.ViewModel |
|
|
|
dt_a.PrimaryKey = dt_acols; |
|
|
|
//创建dt_m主建
|
|
|
|
DataColumn[] dt_mcols = new DataColumn[] { dt_m.Columns["ID"] }; |
|
|
|
dt_m.PrimaryKey = dt_mcols; |
|
|
|
dt_m.PrimaryKey = dt_mcols; |
|
|
|
} |
|
|
|
private async void IO_data()//刷新
|
|
|
|
{ |
|
|
|