protected override void OnEntranceStatusReporting(EntranceStatusReport report) { if (report.Status != EntranceStatus.OffLine) { NetEntrance entrance = GetEntrance(report.EntranceID) as NetEntrance; if (entrance != null) //如果主控制器重新连接 { entrance.SyncToHardware(); } } RaiseEntranceStatusReporting(report); }
/// <summary> /// 更新一个控制板 /// </summary> /// <param name="info"></param> /// <returns></returns> public override bool UpdateEntrance(EntranceInfo info) { if (info.ParkID == this.Park.ParkID) { NetEntrance entrance = GetEntrance(info.EntranceID) as NetEntrance; if (entrance != null) { if (info.IsMaster) //更新主控制器 { entrance.EntranceInfo = info; entrance.EntranceInfo.MasterIP = info.IPAddress; _Master = entrance; _Master.SyncToHardware(); foreach (NetEntrance en in _Entrances) { if (!en.Equals(entrance)) { en.EntranceInfo.MasterIP = info.IPAddress; if (en.Status != EntranceStatus.OffLine) { en.SyncToHardware(); } } } return(true); } else { if (_Master != null && _Master.EntranceInfo == info) //info由主控制器转为非主控制器,将停车场的主控制器设置为空 { _Master = null; } info.MasterIP = _Master != null ? _Master.EntranceInfo.IPAddress : string.Empty; entrance.EntranceInfo = info; entrance.SyncToHardware(); return(true); } } } else { foreach (NETPark subPark in _SubParks) { if (info.ParkID == subPark.Park.ParkID) { return(subPark.UpdateEntrance(info)); } } return(false); } return(false); }
protected override void OnEntranceStatusReporting(EntranceStatusReport report) { if (report.Status != EntranceStatus.OffLine) { NetEntrance entrance = GetEntrance(report.EntranceID) as NetEntrance; if (entrance != null) //如果主控制器重新连接 { entrance.SyncToHardware(); if (entrance == Master && WorkMode == ParkWorkMode.OffLine) { Hardware.ParkParams pp; if (_Master.ParkDevice.GetParkLots(0, out pp)) //如果成功,则以硬件保存的车位数为准 { Park.Vacant = (short)pp.ParkVacant; _ParkBll.UpdateVacant(Park.ParkID, Park.Vacant); RaiseParkVacantReporting(new ParkVacantReport(Park.ParkID, 0, DateTime.Now, Park.ParkName, Park.Vacant)); } } } } RaiseEntranceStatusReporting(report); }