/// <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 R_SN_STATION_DETAIL GetSNLastPassStationDetail(string SN, OleExec DB) { R_SN_STATION_DETAIL R_Sn_Station_Detail = null; Row_R_SN_STATION_DETAIL Rows = (Row_R_SN_STATION_DETAIL)NewRow(); DataTable Dt = new DataTable(); string result = string.Empty; string StrSql = string.Empty; StrSql = $@"select*from (select*from r_sn_station_detail where sn='{SN}' and repair_failed_flag='0' order by edit_time desc)a where rownum=1 "; Dt = DB.ExecSelect(StrSql).Tables[0]; if (Dt.Rows.Count > 0) { Rows.loadData(Dt.Rows[0]); R_Sn_Station_Detail = Rows.GetDataObject(); } return(R_Sn_Station_Detail); }
public List <R_SN_STATION_DETAIL> GetSNStationDetailByPanel(string PanelSn, OleExec DB) { List <R_SN_STATION_DETAIL> R_SN_STATION_DETAIL_LIST = new List <R_SN_STATION_DETAIL>(); R_SN_STATION_DETAIL R_Sn_Station_Detail = null; Row_R_SN_STATION_DETAIL Rows = (Row_R_SN_STATION_DETAIL)NewRow(); DataTable Dt = new DataTable(); string result = string.Empty; string StrSql = string.Empty; StrSql = $@"SELECT * FROM R_SN_STATION_DETAIL WHERE SN IN (SELECT SN FROM R_PANEL_SN WHERE PANEL = '{PanelSn}') order by id "; Dt = DB.ExecSelect(StrSql).Tables[0]; foreach (DataRow r in Dt.Rows) { Rows.loadData(r); R_Sn_Station_Detail = Rows.GetDataObject(); R_SN_STATION_DETAIL_LIST.Add(R_Sn_Station_Detail); } return(R_SN_STATION_DETAIL_LIST); }
public R_SN_STATION_DETAIL GetDataObject() { R_SN_STATION_DETAIL DataObject = new R_SN_STATION_DETAIL(); DataObject.ID = this.ID; DataObject.R_SN_ID = this.R_SN_ID; DataObject.SN = this.SN; DataObject.SKUNO = this.SKUNO; DataObject.WORKORDERNO = this.WORKORDERNO; DataObject.PLANT = this.PLANT; DataObject.CLASS_NAME = this.CLASS_NAME; DataObject.ROUTE_ID = this.ROUTE_ID; DataObject.LINE = this.LINE; DataObject.STARTED_FLAG = this.STARTED_FLAG; DataObject.START_TIME = this.START_TIME; DataObject.PACKED_FLAG = this.PACKED_FLAG; DataObject.PACKED_TIME = this.PACKED_TIME; DataObject.COMPLETED_FLAG = this.COMPLETED_FLAG; DataObject.COMPLETED_TIME = this.COMPLETED_TIME; DataObject.SHIPPED_FLAG = this.SHIPPED_FLAG; DataObject.SHIPDATE = this.SHIPDATE; DataObject.REPAIR_FAILED_FLAG = this.REPAIR_FAILED_FLAG; DataObject.CURRENT_STATION = this.CURRENT_STATION; DataObject.NEXT_STATION = this.NEXT_STATION; DataObject.KP_LIST_ID = this.KP_LIST_ID; DataObject.PO_NO = this.PO_NO; DataObject.CUST_ORDER_NO = this.CUST_ORDER_NO; DataObject.CUST_PN = this.CUST_PN; DataObject.BOXSN = this.BOXSN; DataObject.DEVICE_NAME = this.DEVICE_NAME; DataObject.STATION_NAME = this.STATION_NAME; DataObject.SCRAPED_FLAG = this.SCRAPED_FLAG; DataObject.SCRAPED_TIME = this.SCRAPED_TIME; DataObject.PRODUCT_STATUS = this.PRODUCT_STATUS; DataObject.REWORK_COUNT = this.REWORK_COUNT; DataObject.VALID_FLAG = this.VALID_FLAG; DataObject.EDIT_EMP = this.EDIT_EMP; DataObject.EDIT_TIME = this.EDIT_TIME; return(DataObject); }
/// <summary> // /check if the sn is write into r_sn_station_detail /// </summary> /// <param name="sn"></param> /// <param name="station"></param> /// <param name="sfcdb"></param> /// <returns></returns> public bool HadWriteIntoDetail(string sn, string station, OleExec sfcdb) { bool bPass = true; 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 })); } r_sn_station_detail = sfcdb.ORM.Queryable <R_SN_STATION_DETAIL>().Where(p => p.STATION_NAME == station && p.ROUTE_ID == snObject.ROUTE_ID && p.SN == snObject.SN && p.R_SN_ID == snObject.ID).ToList().FirstOrDefault(); if (r_sn_station_detail == null) { bPass = false; } } return(bPass); }