public static bool RunExecuteWHCmdThread = true; //运行立库指令表的线程 public static void ExecuteWHCmd(object obj) // 执行立库指令表(不断查询数据库AGV指令表中有没有未发送给AGV的指令,然后将其发送出去) { DataBaseHandle db = obj as DataBaseHandle; SqlConnection con = new SqlConnection(); while (RunExecuteWHCmdThread) { Thread.Sleep(TimeSpan.FromSeconds(3)); //3s查询一次 if ((ExecuteFlag == true || HandAndDownFlag == true) && SendWHCmdEnable == true) //开始执行订单 { db.SelectWHCmd(con); //查询立库需要发送的指令 } } RunExecuteWHCmdThread = true; }