/// <summary> /// 更新LED动态区域 /// </summary> /// <param name="value1">第一行内容</param> /// <param name="value2">第二行内容</param> private void UpdateLedShow(string value1 = "", string value2 = "") { FrmDebugConsole.GetInstance().Output("更新LED1:|" + value1 + "|" + value2 + "|"); if (!this.LED1ConnectStatus) { return; } if (this.LED1PrevLedFileContent == value1 + value2) { return; } if (LED1m_bSendBusy == false) { LED1m_bSendBusy = true; bool nResult = led.UpdateLED(value1 + " " + value2); if (!nResult) { Log4Neter.Error("更新LED动态区域", new Exception("更新LED动态区域")); } LED1m_bSendBusy = false; } this.LED1PrevLedFileContent = value1 + value2; }
/// <summary> /// 更新LED动态区域 /// </summary> /// <param name="value1">第一行内容</param> /// <param name="value2">第二行内容</param> private void UpdateLedShow(string value1 = "", string value2 = "") { FrmDebugConsole.GetInstance().Output("更新LED1:|" + value1 + "|" + value2 + "|"); if (!this.LED1ConnectStatus) { return; } if (this.LED1PrevLedFileContent == value1 + value2) { return; } string ledContent = GenerateFillLedContent12(value1) + GenerateFillLedContent12(value2); File.WriteAllText(this.LED1TempFile, ledContent, Encoding.UTF8); if (LED1m_bSendBusy == false) { LED1m_bSendBusy = true; //int nResult = YB14DynamicAreaLeder.SendDynamicAreaInfoCommand(this.LED1nScreenNo, this.LED1DYArea_ID); //if (nResult != YB14DynamicAreaLeder.RETURN_NOERROR) Log4Neter.Error("更新LED动态区域", new Exception(YB14DynamicAreaLeder.GetErrorMessage("SendDynamicAreaInfoCommand", nResult))); LED1m_bSendBusy = false; } this.LED1PrevLedFileContent = value1 + value2; }
/// <summary> /// 信号灯2绿灯 /// </summary> public void GreenLight2() { #if DEBUG FrmDebugConsole.GetInstance().Output("信号灯2绿灯"); #endif this.Iocer.Output(commonDAO.GetAppletConfigInt32("IO控制器_信号灯2端口"), true); Thread.Sleep(500); commonDAO.SetSignalDataValue(commonAppConfig.AppIdentifier, "信号灯2", "0"); }
/// <summary> /// 信号灯1红灯 /// </summary> public void RedLight1() { #if DEBUG FrmDebugConsole.GetInstance().Output("信号灯1红灯"); #endif this.Iocer.Output(commonDAO.GetAppletConfigInt32("IO控制器_信号灯1端口"), false); Thread.Sleep(500); commonDAO.SetSignalDataValue(commonAppConfig.AppIdentifier, "信号灯1", "1"); }
/// <summary> /// 信号灯1绿灯 /// </summary> public void GreenLight1() { #if DEBUG FrmDebugConsole.GetInstance().Output("信号灯1绿灯"); #endif this.Iocer.Output(commonDAO.GetAppletConfigInt32("IO控制器_信号灯1端口"), true); Thread.Sleep(500); commonDAO.SetSignalDataValue(CommonAppConfig.GetInstance().AppIdentifier, eSignalDataName.信号灯1.ToString(), "0"); }
/// <summary> /// 窗体初始化 /// </summary> private void InitForm() { FrmDebugConsole.GetInstance(); // 采样机设备编码 this.SamplerMachineCode = commonDAO.GetAppletConfigString("采样机设备编码"); this.SamplerMachineName = commonDAO.GetMachineNameByCode(this.SamplerMachineCode); // 默认自动 sbtnChangeAutoHandMode.Value = true; }
/// <summary> /// 窗体初始化 /// </summary> private void InitForm() { FrmDebugConsole.GetInstance(); // 默认自动 sbtnChangeAutoHandMode.Value = true; // 重置程序远程控制命令 commonDAO.ResetAppRemoteControlCmd(CommonAppConfig.GetInstance().AppIdentifier); btnRefresh_Click(null, null); }
/// <summary> /// 道闸2降杆 /// </summary> public void Gate2Down() { #if DEBUG FrmDebugConsole.GetInstance().Output("道闸2降杆"); #endif int port = commonDAO.GetAppletConfigInt32("IO控制器_道闸2降杆端口"); this.Iocer.Output(port, true); Thread.Sleep(100); this.Iocer.Output(port, false); Thread.Sleep(500); commonDAO.SetSignalDataValue(commonAppConfig.AppIdentifier, "道闸2升杆", "0"); }
/// <summary> /// 道闸2升杆 /// </summary> public void Gate2Up() { #if DEBUG FrmDebugConsole.GetInstance().Output("道闸2升杆"); #endif int port = commonDAO.GetAppletConfigInt32("IO控制器_道闸2升杆端口"); this.Iocer.Output(port, true); Thread.Sleep(100); this.Iocer.Output(port, false); Thread.Sleep(500); commonDAO.SetSignalDataValue(CommonAppConfig.GetInstance().AppIdentifier, eSignalDataName.道闸2升杆.ToString(), "1"); }
/// <summary> /// 窗体初始化 /// </summary> private void InitForm() { FrmDebugConsole.GetInstance(); // 采样机设备编码 this.SamplerMachineCode = commonDAO.GetAppletConfigString("采样机设备编码"); this.SamplerMachineName = commonDAO.GetMachineNameByCode(this.SamplerMachineCode); // 默认自动 sbtnChangeAutoHandMode.Value = true; // 重置程序远程控制命令 commonDAO.ResetAppRemoteControlCmd(CommonAppConfig.GetInstance().AppIdentifier); btnRefresh_Click(null, null); }
/// <summary> /// 道闸1降杆 /// </summary> public void Gate1Down() { #if DEBUG FrmDebugConsole.GetInstance().Output("道闸1降杆"); #endif if (commonDAO.GetAppletConfigString("启用道闸1") != "1") { return; } int port = commonDAO.GetAppletConfigInt32("IO控制器_道闸1降杆端口"); this.Iocer.Output(port, true); Thread.Sleep(100); this.Iocer.Output(port, false); Thread.Sleep(500); commonDAO.SetSignalDataValue(CommonAppConfig.GetInstance().AppIdentifier, "道闸1升杆", "0"); }
/// <summary> /// 读卡、车号识别任务 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void timer1_Tick(object sender, EventArgs e) { timer1.Stop(); timer1.Interval = 500; try { // 执行远程命令 ExecAppRemoteControlCmd(); switch (this.CurrentFlowFlag) { case eFlowFlag.等待车辆: #region //提高灵敏度 timer1.Interval = 1000; List <string> tags = Hardwarer.Rwer1.ScanTags(); if (tags.Count > 0) { passCarQueuer.Enqueue(ePassWay.Way1, tags[0], true); FrmDebugConsole.GetInstance().Output("识别到卡号:" + tags[0]); } if (passCarQueuer.Count > 0) { this.CurrentFlowFlag = eFlowFlag.识别车辆; } #endregion break; case eFlowFlag.识别车辆: #region // 队列中无车时,等待车辆 if (passCarQueuer.Count == 0) { this.CurrentFlowFlag = eFlowFlag.等待车辆; break; } this.CurrentImperfectCar = passCarQueuer.Dequeue(); // 方式一:根据识别的车牌号查找车辆信息 this.CurrentAutotruck = carTransportDAO.GetAutotruckByCarNumber(this.CurrentImperfectCar.Voucher); if (this.CurrentAutotruck == null) { // 方式二:根据识别的标签卡查找车辆信息 this.CurrentAutotruck = carTransportDAO.GetAutotruckByTagId(this.CurrentImperfectCar.Voucher); } if (this.CurrentAutotruck != null) { if (this.CurrentAutotruck.IsUse == 1) { if (this.CurrentAutotruck.CarType == eCarType.入厂煤.ToString()) { this.timer_BuyFuel_Cancel = false; this.CurrentFlowFlag = eFlowFlag.验证信息; } else if (this.CurrentAutotruck.CarType == eCarType.其他物资.ToString()) { this.timer_Goods_Cancel = false; this.CurrentFlowFlag = eFlowFlag.验证信息; } } else { this.voiceSpeaker.Speak("车牌号 " + this.CurrentAutotruck.CarNumber + " 已停用,禁止通过", 1, false); this.CurrentFlowFlag = eFlowFlag.等待车辆; this.CurrentAutotruck = null; this.CurrentImperfectCar = null; timer1.Interval = 20000; } } else { //// 方式一:车号识别 //this.voiceSpeaker.Speak("车牌号 " + this.CurrentImperfectCar.Voucher + " 未登记,禁止通过", 1, false); // 方式二:刷卡方式 this.voiceSpeaker.Speak("卡号未登记,禁止通过", 1, false); this.CurrentFlowFlag = eFlowFlag.等待车辆; this.CurrentAutotruck = null; this.CurrentImperfectCar = null; timer1.Interval = 20000; } #endregion break; } } catch (Exception ex) { Log4Neter.Error("timer1_Tick", ex); } finally { timer1.Start(); } }