private static void LoadUnloadingPoint(object o) { try { List <UnloadingPointController> listUnloadingPointController = new List <UnloadingPointController>(); List <AscmUnloadingPointController> listAscmUnloadingPointController = AscmUnloadingPointControllerService.GetInstance().GetList("from AscmUnloadingPointController"); List <AscmUnloadingPoint> listAscmUnloadingPoint = AscmUnloadingPointService.GetInstance().GetList("from AscmUnloadingPoint"); foreach (AscmUnloadingPointController controller in listAscmUnloadingPointController) { UnloadingPointController unloadingPointController = new UnloadingPointController(); unloadingPointController.ascmUnloadingPointController = controller; foreach (AscmUnloadingPoint unloadingPoint in listAscmUnloadingPoint) { if (unloadingPoint.controllerId == controller.id) { unloadingPointController.listAscmUnloadingPoint.Add(unloadingPoint); } } listUnloadingPointController.Add(unloadingPointController); } foreach (UnloadingPointController controller in listUnloadingPointController) { Thread thread = new Thread(UpdateStatus); thread.Start(controller); } } catch (Exception ex) { //this.AddLog("加载卸货点控制器异常:");// + ex.Message } }
private static void UpdateStatus(Object o) { try { UnloadingPointController controller = (UnloadingPointController)o; int[] status = controller.ReadStatus(); foreach (AscmUnloadingPoint point in controller.listAscmUnloadingPoint) { if (!controller.Connected) { point.status = AscmUnloadingPoint.StatusDefine.breakdown; } else { if (status[point.controllerAddress] == 1) { point.status = AscmUnloadingPoint.StatusDefine.inUse; } if (status[point.controllerAddress] == 0) { point.status = AscmUnloadingPoint.StatusDefine.idle; } } Oracle.AscmUnloadingPointUpdate(point); } } catch (Exception e) { } }
private static void LoadUnloadingPoint(object o) { try { List<UnloadingPointController> listUnloadingPointController = new List<UnloadingPointController>(); List<AscmUnloadingPointController> listAscmUnloadingPointController = AscmUnloadingPointControllerService.GetInstance().GetList("from AscmUnloadingPointController"); List<AscmUnloadingPoint> listAscmUnloadingPoint = AscmUnloadingPointService.GetInstance().GetList("from AscmUnloadingPoint"); foreach (AscmUnloadingPointController controller in listAscmUnloadingPointController) { UnloadingPointController unloadingPointController = new UnloadingPointController(); unloadingPointController.ascmUnloadingPointController = controller; foreach (AscmUnloadingPoint unloadingPoint in listAscmUnloadingPoint) { if (unloadingPoint.controllerId == controller.id) { unloadingPointController.listAscmUnloadingPoint.Add(unloadingPoint); } } listUnloadingPointController.Add(unloadingPointController); } foreach (UnloadingPointController controller in listUnloadingPointController) { Thread thread = new Thread(UpdateStatus); thread.Start(controller); } } catch (Exception ex) { //this.AddLog("加载卸货点控制器异常:");// + ex.Message } }