static void DownSTask() { string sql = string.Format(@"SELECT ts.*,c.ItemName FROM dbo.T_Task_Son ts LEFT JOIN dbo.T_Type_Config c ON ts.STaskType = c.ItemNo WHERE State IN(1, 2, 3) ORDER BY AgvNo, SerialNo"); DataSet ds = DbHelperSQL.Query(sql); foreach (DataRow dr in ds.Tables[0].Rows) { GetObject.GetSTask(dr); } }
/// <summary> /// 下载任务 /// </summary> static void DownTask() { try { string sql = @"SELECT ts.*,c.ItemName FROM dbo.T_Task_Son ts LEFT JOIN dbo.T_Type_Config c ON ts.STaskType = c.ItemNo WHERE State = 0 ORDER BY AgvNo, SerialNo"; DataSet ds = DbHelperSQL.Query(sql); DataRowCollection drc = ds.Tables[0].Rows; foreach (DataRow dr in drc) { STask s = GetObject.GetSTask(dr); string sql2 = string.Format("UPDATE dbo.T_Task_Son SET State = 1 WHERE SID = '{0}'", s.sID); DbHelperSQL.ExecuteSql(sql2); s.state = TaskState.Down; } } catch (Exception ex) { App.ExFile.MessageLog("DownTask", ex.Message + "\r"); } }