/// <summary> /// 通過id獲取 /// </summary> /// <param name="id"></param> /// <param name="DB"></param> /// <returns></returns> public C_ROUTE_DETAIL GetById(string id, OleExec DB) { string strSql = $@"select * from c_route_detail where id=:id"; OleDbParameter[] paramet = new OleDbParameter[] { new OleDbParameter(":id", OleDbType.VarChar, 240) }; paramet[0].Value = id; DataTable res = DB.ExecuteDataTable(strSql, CommandType.Text, paramet); if (res.Rows.Count > 0) { Row_T_C_ROUTE_DETAIL ret = (Row_T_C_ROUTE_DETAIL)NewRow(); ret.loadData(res.Rows[0]); return(ret.GetDataObject()); } else { return(null); } }
/// <summary> /// 取Station之前的測試工站,包括當前工站 /// </summary> /// <param name="DB"></param> /// <param name="DBType"></param> /// <returns></returns> public List <C_ROUTE_DETAIL> GetTestStationByNameBefor(OleExec DB, string routeId, string CurrentStation) { List <C_ROUTE_DETAIL> r = new List <C_ROUTE_DETAIL>(); string strSql = $@" select a.* from c_route_detail a,c_temes_station_mapping b,c_route_detail c where a.route_id=:id and c.station_name=:station_name and c.route_id =a.route_id and a.seq_no<=c.seq_no and a.station_name=b.mes_station order by A.seq_no asc "; OleDbParameter[] paramet = new OleDbParameter[] { new OleDbParameter(":id", OleDbType.VarChar, 240), new OleDbParameter(":station_name", OleDbType.VarChar, 20) }; paramet[0].Value = routeId; paramet[1].Value = CurrentStation; DataTable res = DB.ExecuteDataTable(strSql, CommandType.Text, paramet); foreach (DataRow item in res.Rows) { Row_T_C_ROUTE_DETAIL ret = (Row_T_C_ROUTE_DETAIL)NewRow(); ret.loadData(item); r.Add(ret.GetDataObject()); } return(r); }
/// <summary> /// 通過路由ID獲取所有C_ROUTE_DETAIL,並且order by seq_no asc /// </summary> /// <param name="RouteID">路由ID</param> /// <param name="DB"></param> /// <returns></returns> public List <C_ROUTE_DETAIL> GetByRouteIdOrderBySEQASC(string RouteID, OleExec DB) { string strSql = $@"select * from c_route_detail where route_id=:RouteID order by seq_no asc"; OleDbParameter[] paramet = new OleDbParameter[] { new OleDbParameter(":RouteID", OleDbType.VarChar, 240) }; paramet[0].Value = RouteID; DataTable res = DB.ExecuteDataTable(strSql, CommandType.Text, paramet); if (res.Rows.Count > 0) { List <C_ROUTE_DETAIL> retlist = new List <C_ROUTE_DETAIL>(); for (int i = 0; i < res.Rows.Count; i++) { Row_T_C_ROUTE_DETAIL ret = (Row_T_C_ROUTE_DETAIL)NewRow(); ret.loadData(res.Rows[i]); retlist.Add(ret.GetDataObject()); } return(retlist); } else { return(null); } }