/// <summary> // /check if the last station of the SN in the route is PASS /// </summary> /// <param name="sn"></param> /// <param name="station"></param> /// <param name="sfcdb"></param> /// <returns></returns> public bool TheLastStationIsPass(string sn, string station, OleExec sfcdb) { bool bPass = true; C_ROUTE_DETAIL lastSation = null; R_SN_STATION_DETAIL r_sn_station_detail = null; T_R_SN t_r_sn = new T_R_SN(sfcdb, this.DBType); T_C_ROUTE_DETAIL t_c_route_detail = new T_C_ROUTE_DETAIL(sfcdb, this.DBType); R_SN snObject = t_r_sn.LoadSN(sn, sfcdb); if (snObject != null) { if (!t_c_route_detail.StationInRoute(snObject.ROUTE_ID, station, sfcdb)) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000156", new string[] { sn, station })); } C_ROUTE_DETAIL currentStation = t_c_route_detail.GetByRouteIdOrderBySEQASC(snObject.ROUTE_ID, sfcdb).Find(s => s.STATION_NAME == station); List <C_ROUTE_DETAIL> routeList = t_c_route_detail.GetByRouteIdOrderBySEQASC(snObject.ROUTE_ID, sfcdb).FindAll(s => s.SEQ_NO < currentStation.SEQ_NO); if (routeList.Count > 0) { lastSation = routeList.OrderBy(t => t.SEQ_NO).LastOrDefault(); if (lastSation != null) { r_sn_station_detail = sfcdb.ORM.Queryable <R_SN_STATION_DETAIL>().Where(p => p.STATION_NAME == lastSation.STATION_NAME && p.ROUTE_ID == lastSation.ROUTE_ID && p.SN == snObject.SN && p.R_SN_ID == snObject.ID).ToList().FirstOrDefault(); if (r_sn_station_detail == null) { bPass = false; } } } } return(bPass); }
public C_ROUTE_DETAIL GetDataObject() { C_ROUTE_DETAIL DataObject = new C_ROUTE_DETAIL(); DataObject.ID = this.ID; DataObject.SEQ_NO = this.SEQ_NO; DataObject.ROUTE_ID = this.ROUTE_ID; DataObject.STATION_NAME = this.STATION_NAME; DataObject.STATION_TYPE = this.STATION_TYPE; DataObject.RETURN_FLAG = this.RETURN_FLAG; return(DataObject); }
/// <summary> /// 通過ID更新 /// </summary> /// <param name="updateitem"></param> /// <param name="DB"></param> /// <returns></returns> public int UpdateById(C_ROUTE_DETAIL updateitem, OleExec DB) { string strSql = $@"update c_route_detail set seq_no=:seq_no,station_name=:station_name,station_type=:station_type,return_flag=:return_flag where id=:id"; OleDbParameter[] paramet = new OleDbParameter[5]; paramet[0] = new OleDbParameter(":seq_no", updateitem.SEQ_NO); paramet[1] = new OleDbParameter(":station_name", updateitem.STATION_NAME); paramet[2] = new OleDbParameter(":station_type", updateitem.STATION_TYPE); paramet[3] = new OleDbParameter(":return_flag", updateitem.RETURN_FLAG); paramet[4] = new OleDbParameter(":id", updateitem.ID); int result = DB.ExecuteNonQuery(strSql, CommandType.Text, paramet); return(result); }
/// <summary> /// 添加C_ROUTE_DETAIL /// </summary> /// <param name="newc_route_detail"></param> /// <param name="DB"></param> /// <returns></returns> public int Add(C_ROUTE_DETAIL newc_route_detail, OleExec DB) { string strSql = $@"insert into c_route_detail(id,seq_no,route_id,station_name,station_type,return_flag)"; strSql = strSql + $@"values(:id,:seq_no,:route_id,:station_name,:station_type,:return_flag)"; OleDbParameter[] paramet = new OleDbParameter[6]; paramet[0] = new OleDbParameter(":id", newc_route_detail.ID); paramet[1] = new OleDbParameter(":seq_no", newc_route_detail.SEQ_NO); paramet[2] = new OleDbParameter(":route_id", newc_route_detail.ROUTE_ID); paramet[3] = new OleDbParameter(":station_name", newc_route_detail.STATION_NAME); paramet[4] = new OleDbParameter(":station_type", newc_route_detail.STATION_TYPE); paramet[5] = new OleDbParameter(":return_flag", newc_route_detail.RETURN_FLAG); int result = DB.ExecuteNonQuery(strSql, CommandType.Text, paramet); return(result); }