public bool ShowTrigger(Model.PSTData objPSTData) { if (objPSTData == null) { return(false); } if (objErrorDaoService == null) { objErrorDaoService = new ErrorDaoImp(); } if (objErrorControllerService == null) { objErrorControllerService = new ErrorControllerImp(); } int error = objErrorControllerService.GetErrorCode(objPSTData.machineChannel, objPSTData.machineCode, OpcTags.PST_L2_ErrCode); if (error != 0) { return(false); } TriggerData objTriggerData = new TriggerData(); objTriggerData.MachineCode = objPSTData.machineCode; objTriggerData.category = TriggerData.triggerCategory.ERROR; objTriggerData.ErrorCode = error.ToString(); objTriggerData.TriggerEnabled = true; objErrorDaoService.UpdateTriggerActiveStatus(objTriggerData); return(true); }
public TriggerData NeedToShowTrigger(VLCData objVLCData) { bool needToShow = false; if (objVLCDaoService == null) { objVLCDaoService = new VLCDaoImp(); } int checkCount = 0; int errorCode = 0; TriggerData objTriggerData = new TriggerData(); if (objErrorControllerService == null) { objErrorControllerService = new ErrorControllerImp(); } int max_check_count = 10; using (OpcOperationsService opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection())) { do { errorCode = objErrorControllerService.GetErrorCode(objVLCData.machineChannel, objVLCData.machineCode, OpcTags.VLC_L2_ErrCode); if (errorCode > 0) { objTriggerData.category = TriggerData.triggerCategory.ERROR; objTriggerData.ErrorCode = errorCode.ToString(); needToShow = true; break; } needToShow = !opcd.ReadTag <bool>(objVLCData.machineChannel, objVLCData.machineCode, OpcTags.VLC_Auto_Ready); if (needToShow) { if (checkCount >= max_check_count) { objTriggerData.category = TriggerData.triggerCategory.MANUAL; break; } checkCount++; Thread.Sleep(1000); continue; } needToShow = objVLCDaoService.IsVLCDisabled(objVLCData.machineCode); if (needToShow) { objTriggerData.category = TriggerData.triggerCategory.DISABLE; break; } } while (needToShow && checkCount < max_check_count); } if (needToShow) { objTriggerData.MachineCode = objVLCData.machineCode; objTriggerData.TriggerEnabled = true; Logger.WriteLogger(GlobalValues.PARKING_LOG, "Queue Id:" + objVLCData.queueId + ": VLC = " + objVLCData.machineCode + "--'NeedToShowTrigger For VLC' = " + needToShow); } return(objTriggerData); }
public bool CheckPVLCommandDone(Model.PVLData objPVLData) { bool result = false; int counter = 1; OpcOperationsService opcd = null; int commandType = 0; string doneCheckTag = null; int error = 0; try { opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection()); if (objErrorControllerService == null) { objErrorControllerService = new ErrorControllerImp(); } if (objErrorDaoService == null) { objErrorDaoService = new ErrorDaoImp(); } Thread.Sleep(2000); result = false; FindCommandTypeAndDoneTag(objPVLData, out commandType, out doneCheckTag); do { error = objErrorControllerService.GetErrorCode(objPVLData.machineChannel, objPVLData.machineCode, OpcTags.PVL_L2_ErrCode); if (error > 0) { TriggerData objTriggerData = new TriggerData(); objTriggerData.MachineCode = objPVLData.machineCode; objTriggerData.category = TriggerData.triggerCategory.ERROR; objTriggerData.ErrorCode = error.ToString(); objTriggerData.TriggerEnabled = true; objErrorDaoService.UpdateTriggerActiveStatus(objTriggerData); while (objErrorControllerService.GetTriggerActiveStatus(objPVLData.machineCode)) { Thread.Sleep(1000); } if (objErrorControllerService.GetTriggerAction(objPVLData.machineCode) == 1) { DoTriggerAction(objPVLData, commandType); Thread.Sleep(2000); } } result = opcd.ReadTag <bool>(objPVLData.machineChannel, objPVLData.machineCode, doneCheckTag); if (counter > 3) { Thread.Sleep(700); } counter += 1; } while (!result); } catch (Exception errMsg) { Console.WriteLine(errMsg.Message); } finally { if (opcd != null) { opcd.Dispose(); } } return(result); }