/// <summary> /// 获取任务记录 /// </summary> public List <TaskRecord> SelectTaskRecordBySql(string sql) { List <TaskRecord> taskRecordList = new List <TaskRecord>(); try { lock (lockDB) { dataReader = execQuery(sql); while (dataReader.Read()) { TaskRecord taskRecord = new TaskRecord(); taskRecord.taskRecordID = int.Parse(dataReader["taskRecordID"] + ""); taskRecord.taskRecordStat = (TASKSTAT_T)int.Parse(dataReader["taskRecordStat"] + ""); taskRecord.taskLevel = int.Parse(dataReader["taskLevel"] + ""); try { if (!String.IsNullOrEmpty(dataReader["forklift"].ToString())) { taskRecord.forkLiftWrapper = AGVCacheData.getForkLiftByID(int.Parse(dataReader["forklift"] + "")); } } catch (FormatException fx) { Console.WriteLine("message = " + fx.Message); } taskRecord.singleTask = SingleTaskDao.getDao().getSingleTaskByID(int.Parse(dataReader["singleTask"] + "")); taskRecord.taskRecordName = taskRecord.singleTask.taskName; taskRecord.updateTime = (DateTime)(dataReader["taskRecordUpdateTime"]); taskRecordList.Add(taskRecord); } } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } return(taskRecordList); }
public static SingleTaskDao getDao() { if (dao == null) { dao = new SingleTaskDao(); } return(dao); }