public void AddSeatToBoard(string board, int seat, string sn) { var result = (from x in this._boardSet where x.BoardName == board select x); if (result.Any()) { result.First().Seats.Add(new SeatEntry() { Seat = seat, Sn = sn }); Utility.Dump(targetFile, this._boardSet); IBoard controller = result.First().GetController(); if (controller != null) { controller.AddSeat(seat, sn); } else { this._Logger.Error("Board " + board + "'s Controller is null,add seat to boar fail."); } this.BoardStateChanged?.Invoke(this, null); } }
public override void RemoveSeat() { Dictionary <string, string> param = CreateParam(_boardName, _floorNum, _boardNum, _ovenPort, _ctlPort); IBoard test = DriverFactory.Instance(_logger).CreateDriver(DriverType.TOSA25G, param); this._logger.Debug("Add seats:"); Dictionary <int, string> seats = new Dictionary <int, string>(); for (int i = 1; i <= 16; i++) { seats[i] = string.Format("SN_{0:D2}", i); test.AddSeat(i, seats[i]); } this._logger.Info("Remove test seat:"); for (int i = 1; i <= 14; i++) { test.RemoveSeat(i); } this._logger.Info("Left sn:"); Dictionary <int, string> snSet = test.GetSnSet(); Assert.AreEqual(snSet.Count, 2); foreach (var sn in snSet) { this._logger.Info("Left sn info:\t" + sn.Key + ":" + sn.Value); } }
public void AddSeatToBoard(string boardName, int seat, string sn) { if (IsSnExist(sn)) { this._Logger.Error(sn + " exists in current system."); return; } this._Logger.Info("add >>>>\t" + boardName + "_" + seat + "\t" + sn); var result = (from x in this._boardSet where x.GetBoardInfo().BoardName == boardName select x); if (result.Any()) { BoardUnit boardUnit = result.First(); BoardInfo boardInfo = boardUnit.GetBoardInfo(); IBoard controller = boardUnit.GetController(); if (controller != null) { controller.AddSeat(seat, sn); UnitInfo unitInfo = CreateUnitInfo(boardName, seat, sn, boardInfo.Plan); boardInfo.units.Add(unitInfo); DumpBoardInfos(); SaveUnitInfoToDb(unitInfo, boardInfo.temperature); BoardUnit.ProductsUpdate?.Invoke(this, null); } else { this._Logger.Error("Board " + boardName + "'s Controller is null,add seat to board fail."); } BoardStateChanged?.Invoke(this, null); } }
public override void AddSeat() { Dictionary <string, string> param = CreateParam(_boardName, _floorNum, _boardNum, _ovenPort, _ctlPort); IBoard test = DriverFactory.Instance(_logger).CreateDriver(DriverType.TOSA25G, param); for (int i = 1; i <= 16; i++) { test.AddSeat(i, string.Format("SN_{0:D2}", i)); } }