public void SubscribeUnit(string sn, string plan, double ovenTemperature, string board, int seat) { if (_unitSet.FindAll(x => x.Sn == sn).Any()) { throw new Exception(sn + " exists in current system."); } this.Log.Info(sn + "\t>>>>\t[Unit Pool]"); var driverType = FetchPlans.Inst(this._param.tbiesServer).GetDriverType(plan); Guid id = dataService.CreateBiRecord(sn, driverType, plan, board, seat.ToString()); var entry = new UnitEntry() { Id = id, Sn = sn, Plan = plan, Board = board, Seat = seat, Cost = 0, Comment = "", State = UnitState.READY, Result = UnitResult.PASS, CreateTime = DateTime.Now, CostCounter = DateTime.Now, ReadCounter = DateTime.Now, FinishTime = DateTime.Now, OutSpec = false, OutStart = DateTime.Now, }; _unitSet.Add(entry); DumpEntry(entry); _runList.Add(id); Utility.Dump(_targetFile, _runList); ProductsUpdate?.Invoke(this, null); }
public bool ReadActive(string sn) { var info = GetUnitInfo(sn); if (info == null) { this.Log.Error("sn = " + sn + ":unit info is not exist in unit set,read active fail"); return(false); } double interval = FetchPlans.Inst(this._param.tbiesServer).GetInterval(info.Plan); return(DateTime.Now.Subtract(info.ReadCounter).TotalMinutes >= interval); }
private double GetTimeOut(string sn) { var info = GetUnitInfo(sn); if (info == null) { // this.Log.Error("sn = " + sn + ":unit info is not exist in unit set,get timeOut fail"); return(0); } double timeOut = FetchPlans.Inst(this._param.tbiesServer).GetSpan(info.Plan) * 60; return(timeOut); }
public SpecResult CheckDataBySpec(string sn, List <KeyValuePair <string, string> > data, out string message) { message = ""; var ret = new SpecResult { CompareFail = false, Pausable = false, Stopable = false }; var info = GetUnitInfo(sn); if (info == null) { this.Log.Error("sn = " + sn + ":unit info is not exist in unit set,check data by spec fail"); return(ret); } SpecItem[] specArray = FetchPlans.Inst(this._param.tbiesServer).GetSpecification(info.Plan); List <SpecItem> failList = new List <SpecItem>(); foreach (var specItem in specArray) { foreach (var dataRow in data) { if (dataRow.Key == specItem.Item) { if (!(double.Parse(specItem.LBound) <= double.Parse(dataRow.Value) && double.Parse(dataRow.Value) < double.Parse(specItem.UBound))) { message += specItem.Item; failList.Add(specItem); } } } } foreach (var spec in failList) { if (spec.Type.Contains("C")) { ret.CompareFail = true; } if (spec.Type.Contains("P")) { ret.Pausable = true; } if (spec.Type.Contains("S")) { ret.Stopable = true; } } return(ret); }
public BIModelTOSA(ConfigParam param, log4net.ILog logger, IDatabaseService dbStore) { _configParam = param; log = logger; _dbService = dbStore; try { _fetchPlans = FetchPlans.Inst(_configParam.systemParam.tbiesServer); _boardFactory = BoardFactory.Instance(log, _fetchPlans, _configParam.ports); _mesOperator = BiModelFactory.GetMesOperator(); boardManager = new BoardManager(log, dbStore, BiModelFactory.CreateIPosMapScheme(dbStore), _boardFactory, param.systemParam); unitManager = new UnitManager(log, param.systemParam); SyncDbStore(dbStore); InitTimer(); } catch (Exception ex) { log.Error(ex.Message); log.Error(ex.StackTrace); } }
public static FetchPlans Inst(string remoteServerIp) { return(_inst ?? (_inst = new FetchPlans(remoteServerIp))); }