/// <summary> /// 初始化外接设备 /// </summary> private void InitHardware() { try { bool success = false; // 初始化-电子秤 if (IsUseWeight) { this.WbMinWeight = commonDAO.GetAppletConfigDouble("电子秤最小重量"); this.BarrelWeight = commonDAO.GetAppletConfigDouble("人工样桶重量"); wber.OnStatusChange += new WB.TOLEDO.IND231.TOLEDO_IND231Wber.StatusChangeHandler(wber_OnStatusChange); wber.OnSteadyChange += new WB.TOLEDO.IND231.TOLEDO_IND231Wber.SteadyChangeEventHandler(wber_OnSteadyChange); success = wber.OpenCom(commonDAO.GetAppletConfigInt32("电子秤串口"), commonDAO.GetAppletConfigInt32("电子秤波特率"), commonDAO.GetAppletConfigInt32("电子秤数据位"), commonDAO.GetAppletConfigInt32("电子秤停止位")); } timer1.Enabled = true; } catch (Exception ex) { Log4Neter.Error("设备初始化", ex); } }
/// <summary> /// ¼ÓÔØÅäÖà /// </summary> void LoadAppConfig() { txtAppIdentifier.Text = commonAppConfig.AppIdentifier; txtSelfConnStr.Text = commonAppConfig.SelfConnStr; chbStartup.Checked = (commonDAO.GetAppletConfigString("¿ª»úÆô¶¯") == "1"); dbtxtProfinWeight.Value = commonDAO.GetAppletConfigDouble("Ó¯Òì³£¶ÖÊý"); dbtxtProfinWeight2.Value = commonDAO.GetAppletConfigDouble("¿÷Òì³£¶ÖÊý"); // IO¿ØÖÆÆ÷ iptxtIOIP.Value = commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_IPµØÖ·"); txtIOPort.Text = commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_¶Ë¿Ú"); SelectedComboBoxItem(cmbInductorCoil1Port, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_µØ¸Ð1¶Ë¿Ú")); SelectedComboBoxItem(cmbInductorCoil2Port, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_µØ¸Ð2¶Ë¿Ú")); SelectedComboBoxItem(cmbInductorCoil3Port, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_µØ¸Ð3¶Ë¿Ú")); SelectedComboBoxItem(cmbInductorCoil4Port, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_µØ¸Ð4¶Ë¿Ú")); SelectedComboBoxItem(cmbGate1UpPort, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_µÀÕ¢1Éý¸Ë¶Ë¿Ú")); SelectedComboBoxItem(cmbGate1DownPort, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_µÀÕ¢1½µ¸Ë¶Ë¿Ú")); SelectedComboBoxItem(cmbGate2UpPort, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_µÀÕ¢2Éý¸Ë¶Ë¿Ú")); SelectedComboBoxItem(cmbGate2DownPort, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_µÀÕ¢2½µ¸Ë¶Ë¿Ú")); SelectedComboBoxItem(cmbSignalLight1Port, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_ÐźŵÆ1¶Ë¿Ú")); SelectedComboBoxItem(cmbSignalLight2Port, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_ÐźŵÆ2¶Ë¿Ú")); // LEDÏÔʾÆÁ iptxtLED1IP.Value = commonDAO.GetAppletConfigString("LEDÏÔʾÆÁ1_IPµØÖ·"); // ¶Á¿¨Æ÷Íø¿Ú ipAddressInput1.Value = commonDAO.GetAppletConfigString("¶Á¿¨Æ÷1IPµØÖ·"); ipAddressPort1.Text = commonDAO.GetAppletConfigString("¶Á¿¨Æ÷1¶Ë¿Ú"); txtRwerTagStartWith.Text = commonDAO.GetAppletConfigString("¶Á¿¨Æ÷_±êÇ©¹ýÂË"); SelectedComboBoxItem(cmbRwerPower, commonDAO.GetAppletConfigString("¶Á¿¨Æ÷1¹¦ÂÊ")); // ·¢¿¨Æ÷ SelectedComboBoxItem(cmbRwer2Com, commonDAO.GetAppletConfigString("·¢¿¨Æ÷_´®¿Ú")); }
private void FrmSetting_Load(object sender, EventArgs e) { try { labelX3.ForeColor = Color.Red; labelX4.ForeColor = Color.Red; txtAppIdentifier.Text = CommonAppConfig.GetInstance().AppIdentifier; txtSelfConnStr.Text = CommonAppConfig.GetInstance().SelfConnStr; //电子秤 SelectedComboItem("COM" + commonDAO.GetAppletConfigInt32("电子秤串口"), cmbLibra_COM); SelectedComboItem(commonDAO.GetAppletConfigString("电子秤波特率"), cmbLibra_Bandrate); SelectedComboItem(commonDAO.GetAppletConfigString("电子秤数据位"), cmbDataBits); SelectedComboItem(commonDAO.GetAppletConfigString("电子秤停止位"), cmbParity); dInputLibraWeight.Value = commonDAO.GetAppletConfigDouble("电子秤最小重量") * 1000; chkIsUseWeight.Checked = Convert.ToBoolean(commonDAO.GetAppletConfigInt32("启用称重")); dobBarrelWeight.Value = commonDAO.GetAppletConfigDouble("人工样桶重量") * 1000; // 全局参数 Old_Param = (cmbLibra_COM.SelectedIndex + 1).ToString() + (cmbLibra_Bandrate.SelectedItem as ComboItem).Text + (cmbDataBits.SelectedItem as ComboItem).Text + (cmbParity.SelectedItem as ComboItem).Text + dInputLibraWeight.Value.ToString() + chkIsUseWeight.Checked.ToString(); } catch (Exception ex) { MessageBoxEx.Show("参数初始化失败" + ex.Message, "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } }
private void FrmSetting_Load(object sender, EventArgs e) { try { labelX1.ForeColor = Color.Red; labelX4.ForeColor = Color.Red; labelX12.ForeColor = Color.Red; labelX11.ForeColor = Color.Red; labelX25.ForeColor = Color.Red; labelX30.ForeColor = Color.Red; txtAppIdentifier.Text = CommonAppConfig.GetInstance().AppIdentifier; txtSelfConnStr.Text = CommonAppConfig.GetInstance().SelfConnStr; SelectedComboItem(commonDAO.GetCommonAppletConfigString(CommonAppConfig.GetInstance().AppIdentifier + "对应制样机"), cmbMake); //电子秤 SelectedComboItem("COM" + commonDAO.GetAppletConfigInt32("电子秤串口"), cmbLibra_COM); SelectedComboItem(commonDAO.GetAppletConfigString("电子秤波特率"), cmbLibra_Bandrate); SelectedComboItem(commonDAO.GetAppletConfigString("电子秤数据位"), cmbDataBits); SelectedComboItem(commonDAO.GetAppletConfigString("电子秤停止位"), cmbParity); dInputLibraWeight.Value = commonDAO.GetAppletConfigDouble("电子秤最小重量"); chkIsUseWeight.Checked = Convert.ToBoolean(commonDAO.GetAppletConfigInt32("启用称重")); dobBarrelWeight.Value = commonDAO.GetAppletConfigDouble("人工样桶重量"); //电子天平 SelectedComboItem("COM" + commonDAO.GetAppletConfigInt32("电子天平串口"), cmbLibramin_COM); SelectedComboItem(commonDAO.GetAppletConfigString("电子天平波特率"), cmbLibramin_Bandrate); SelectedComboItem(commonDAO.GetAppletConfigString("电子天平数据位"), cmbminDataBits); SelectedComboItem(commonDAO.GetAppletConfigString("电子天平停止位"), cmbminParity); dInputLibraminWeight.Value = commonDAO.GetAppletConfigDouble("电子天平最小重量"); chkminIsUseWeight.Checked = Convert.ToBoolean(commonDAO.GetAppletConfigInt32("电子天平启用称重")); // 读卡器 iptxtIP.Value = commonDAO.GetAppletConfigString("读卡器IP"); txtPort.Text = commonDAO.GetAppletConfigString("读卡器端口"); SelectedComboItem(commonDAO.GetAppletConfigString("读卡器扇区"), cmbSecNumber); SelectedComboItem(commonDAO.GetAppletConfigString("读卡器块区"), cmbBlockNumber); //样罐 db2Weight.Value = commonDAO.GetCommonAppletConfigDouble("0.2mm样罐重"); db3Weight.Value = commonDAO.GetCommonAppletConfigDouble("3mm样罐重"); db6Weight.Value = commonDAO.GetCommonAppletConfigDouble("6mm样罐重"); db2OverWeight.Value = commonDAO.GetCommonAppletConfigDouble("0.2mm超差重"); db3OverWeight.Value = commonDAO.GetCommonAppletConfigDouble("3mm超差重"); db6OverWeight.Value = commonDAO.GetCommonAppletConfigDouble("6mm超差重"); // 全局参数 Old_Param = (cmbLibra_COM.SelectedIndex + 1).ToString() + (cmbLibra_Bandrate.SelectedItem as ComboItem).Text + (cmbDataBits.SelectedItem as ComboItem).Text + (cmbParity.SelectedItem as ComboItem).Text + dInputLibraWeight.Value.ToString() + chkIsUseWeight.Checked.ToString(); } catch (Exception ex) { MessageBoxEx.Show("参数初始化失败" + ex.Message, "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } }
/// <summary> /// 加载配置 /// </summary> void LoadAppConfig() { #region 绑定语音类型 List <string> arrVoices = voiceSpeaker.GetVoices(); for (int i = 0; i < arrVoices.Count; i++) { DataItem comboitem = new DataItem(arrVoices[i]); cmbVoiceName.Items.Add(comboitem); } cmbVoiceName.SelectedIndex = 0; #endregion txtAppIdentifier.Text = commonAppConfig.AppIdentifier; txtSelfConnStr.Text = commonAppConfig.SelfConnStr; chbStartup.Checked = (commonDAO.GetAppletConfigString("开机启动") == "1"); SelectedComboBoxItem(cmbDecrition, commonDAO.GetAppletConfigString("上磅方向").ToString()); // IO控制器 SelectedComboBoxItem(cmbIocerCom, commonDAO.GetAppletConfigInt32("IO控制器_串口").ToString()); SelectedComboBoxItem(cmbIocerBandrate, commonDAO.GetAppletConfigInt32("IO控制器_波特率").ToString()); SelectedComboBoxItem(cmbIocerDataBits, commonDAO.GetAppletConfigInt32("IO控制器_数据位").ToString()); SelectedComboBoxItem(cmbIocerStopBits, commonDAO.GetAppletConfigInt32("IO控制器_停止位").ToString()); SelectedComboBoxItem(cmbIocerParity, commonDAO.GetAppletConfigInt32("IO控制器_校验位").ToString()); SelectedComboBoxItem(cmbInductorCoil1Port, commonDAO.GetAppletConfigInt32("IO控制器_地感1端口").ToString()); SelectedComboBoxItem(cmbInductorCoil2Port, commonDAO.GetAppletConfigInt32("IO控制器_地感2端口").ToString()); SelectedComboBoxItem(cmbInductorCoil3Port, commonDAO.GetAppletConfigInt32("IO控制器_地感3端口").ToString()); SelectedComboBoxItem(cmbInductorCoil4Port, commonDAO.GetAppletConfigInt32("IO控制器_地感4端口").ToString()); SelectedComboBoxItem(cmbInfraredSensor1Port, commonDAO.GetAppletConfigInt32("IO控制器_对射1端口").ToString()); SelectedComboBoxItem(cmbGate1UpPort, commonDAO.GetAppletConfigInt32("IO控制器_道闸1升杆端口").ToString()); SelectedComboBoxItem(cmbGate1DownPort, commonDAO.GetAppletConfigInt32("IO控制器_道闸1降杆端口").ToString()); SelectedComboBoxItem(cmbGate2UpPort, commonDAO.GetAppletConfigInt32("IO控制器_道闸2升杆端口").ToString()); SelectedComboBoxItem(cmbGate2DownPort, commonDAO.GetAppletConfigInt32("IO控制器_道闸2降杆端口").ToString()); SelectedComboBoxItem(cmbSignalLight1Port, commonDAO.GetAppletConfigInt32("IO控制器_信号灯1端口").ToString()); chbUseInfraredSensor.Checked = (commonDAO.GetAppletConfigString("启用对射") == "1"); // 地磅仪表 SelectedComboBoxItem(cmbWberCom, commonDAO.GetAppletConfigInt32("地磅仪表_串口").ToString()); SelectedComboBoxItem(cmbWberBandrate, commonDAO.GetAppletConfigInt32("地磅仪表_波特率").ToString()); SelectedComboBoxItem(cmbWberDataBits, commonDAO.GetAppletConfigInt32("地磅仪表_数据位").ToString()); SelectedComboBoxItem(cmbWberStopBits, commonDAO.GetAppletConfigInt32("地磅仪表_停止位").ToString()); SelectedComboBoxItem(cmbWberParity, commonDAO.GetAppletConfigInt32("地磅仪表_校验位").ToString()); dbtxtMinWeight.Value = commonDAO.GetAppletConfigDouble("地磅仪表_最小称重"); // 车号识别 iptxtRwer1.Value = commonDAO.GetAppletConfigString("车号识别1_IP地址"); iptxtRwer2.Value = commonDAO.GetAppletConfigString("车号识别2_IP地址"); // LED显示屏 iptxtLED1IP.Value = commonDAO.GetAppletConfigString("LED显示屏1_IP地址"); iptxtLED2IP.Value = commonDAO.GetAppletConfigString("LED显示屏2_IP地址"); // 语音 SelectedComboBoxItem(cmbVoiceName, commonDAO.GetAppletConfigString("语音包").ToString()); sldVoiceRate.Value = commonDAO.GetAppletConfigInt32("语速"); sldVoiceVolume.Value = commonDAO.GetAppletConfigInt32("音量"); lblVoiceRate.Text = sldVoiceRate.Value.ToString(); lblVoiceVolume.Text = sldVoiceVolume.Value.ToString(); }
private void FrmSetting_Load(object sender, EventArgs e) { try { cmbLibra_COM.SelectedIndex = 0; cmbLibra_Bandrate.SelectedIndex = 0; cmbDataBits.SelectedIndex = 0; cmbParity.SelectedIndex = 0; labelX1.ForeColor = Color.Red; labelX4.ForeColor = Color.Red; txtCommonAppConfig.Text = CommonAppConfig.GetInstance().AppIdentifier; //电子秤 SelectedComboItem("COM" + commonDAO.GetAppletConfigInt32("电子秤串口"), cmbLibra_COM); SelectedComboItem(commonDAO.GetAppletConfigString("电子秤波特率"), cmbLibra_Bandrate); SelectedComboItem(commonDAO.GetAppletConfigString("电子秤数据位"), cmbDataBits); SelectedComboItem(commonDAO.GetAppletConfigString("电子秤停止位"), cmbParity); // 读卡器 //SelectedComboItem("COM" + commonDAO.GetAppletConfigInt32("Read_Write_COM"), cmbRead_Write_COM); //SelectedComboItem(commonDAO.GetAppletConfigString("Read_Write_Bandrate"), cmbRead_Write_Bandrate); //电子秤最小重量 dInputLibraWeight.Value = commonDAO.GetAppletConfigDouble("电子秤最小重量"); //是否启用称重 chkIsUseWeight.Checked = Convert.ToBoolean(commonDAO.GetAppletConfigInt32("启用称重")); } catch (Exception ex) { MessageBoxEx.Show("参数初始化失败" + ex.Message, "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } }
/// <summary> /// 写卡 /// </summary> /// <returns></returns> //private string WriteRf(string rf) //{ //byte SecNumber = 2;// Convert.ToByte(commonDAO.GetAppletConfigInt32("读卡器扇区")); //byte BlockNumber = 0;// Convert.ToByte(commonDAO.GetAppletConfigInt32("读卡器块区")); //if (ReadRwer.OpenRF()) //{ // ShowMessage("射频打开成功", eOutputType.Normal); //} //else //{ // ShowMessage("射频打开失败", eOutputType.Error); // return string.Empty; //} //if (ReadRwer.ChangeToISO14443A()) //{ // ShowMessage("切换到1443模式成功", eOutputType.Normal); //} //else //{ // ShowMessage("切换到1443模式失败", eOutputType.Error); // return string.Empty; //} //if (ReadRwer.Request14443A()) //{ // ShowMessage("获取卡类型成功", eOutputType.Normal); //} //else //{ // ShowMessage("获取卡类型失败", eOutputType.Error); // return string.Empty; //} //if (ReadRwer.Anticoll14443A()) //{ // ShowMessage("获取卡号成功", eOutputType.Normal); //} //else //{ // ShowMessage("获取卡号失败", eOutputType.Error); // return string.Empty; //} //if (ReadRwer.Select14443A()) //{ // ShowMessage("获取卡容量成功", eOutputType.Normal); //} //else //{ // ShowMessage("获取卡容量失败", eOutputType.Error); // return string.Empty; //} //if (ReadRwer.AuthKey14443A(SecNumber, BlockNumber)) //{ // ShowMessage("标签密钥验证成功", eOutputType.Normal); //} //else //{ // ShowMessage("标签密钥验证失败", eOutputType.Error); // return string.Empty; //} //if (ReadRwer.Write14443(rf, Convert.ToInt32(SecNumber), Convert.ToInt32(BlockNumber))) //{ // ShowMessage("编码:" + rf + "写卡成功", eOutputType.Normal); // string rf_new = ReadRwer.Byte16ToString(ReadRwer.RWRead14443A(SecNumber, BlockNumber)); // if (rf == rf_new) // { // ShowMessage("编码:" + rf + "读卡验证成功", eOutputType.Normal); // return rf_new; // } //} //return string.Empty; //} #endregion #region 设备初始化与卸载 /// <summary> /// 初始化外接设备 /// </summary> private void InitHardware() { try { bool success = false; // 初始化-电子秤 if (IsUseWeight) { this.WbMinWeight = commonDAO.GetAppletConfigDouble("电子秤最小重量"); // 电子秤 wber.OnStatusChange += new WB.TOLEDO.IND231.TOLEDO_IND231Wber.StatusChangeHandler(Wber_OnStatusChange); wber.OnSteadyChange += new WB.TOLEDO.IND231.TOLEDO_IND231Wber.SteadyChangeEventHandler(Wber_OnSteadyChange); success = wber.OpenCom(commonDAO.GetAppletConfigInt32("电子秤串口"), commonDAO.GetAppletConfigInt32("电子秤波特率"), commonDAO.GetAppletConfigInt32("电子秤数据位"), commonDAO.GetAppletConfigInt32("电子秤停止位")); } // IO控制器 ReadRwer.OnReceived += new RW.RF30WRQ80URS01.RF30WRQ80URS01Rwer.ReceivedEventHandler(Rwer_Received); ReadRwer.OnStatusChange += new RW.RF30WRQ80URS01.RF30WRQ80URS01Rwer.StatusChangeHandler(Rwer_OnStatusChange); success = ReadRwer.OpenCom(commonDAO.GetAppletConfigInt32("读卡器串口"), 115200, 8, (StopBits)1, (Parity)0); //if (!success) MessageBoxEx.Show("IO控制器连接失败!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); //this.iocControler = new IocControler(Hardwarer.Iocer); timer1.Enabled = true; } catch (Exception ex) { Log4Neter.Error("设备初始化", ex); } }
/// <summary> /// 初始化外接设备 /// </summary> private void InitHardware() { try { bool success = false; ReadRwer.OnStatusChange += new HFReaderRwer.StatusChangeHandler(Rwer_OnStatusChange); Rwer_OnStatusChange(ReadRwer.Status); // 初始化-读卡器 success = ReadRwer.OpenNetPort(commonDAO.GetAppletConfigString("读卡器网口"), 6000); //success = ReadRwer.OpenNetPort("192.168.70.30",6000); // 初始化-电子秤 if (IsUseWeight) { this.WbMinWeight = commonDAO.GetAppletConfigDouble("电子秤最小重量"); // 电子秤仪表1 wber.OnStatusChange += new WB.TOLEDO.IND231.TOLEDO_IND231Wber.StatusChangeHandler(Wber_OnStatusChange); wber.OnSteadyChange += new WB.TOLEDO.IND231.TOLEDO_IND231Wber.SteadyChangeEventHandler(Wber_OnSteadyChange); success = wber.OpenCom(commonDAO.GetAppletConfigInt32("电子秤串口"), commonDAO.GetAppletConfigInt32("电子秤波特率"), commonDAO.GetAppletConfigInt32("电子秤数据位"), commonDAO.GetAppletConfigInt32("电子秤停止位")); } timer1.Enabled = true; } catch (Exception ex) { Log4Neter.Error("设备初始化", ex); } }
/// <summary> /// 初始化外接设备 /// </summary> private void InitHardware() { try { bool success = false; // 初始化-读卡器 rwer.OnStatusChange += new HFReaderRwer.StatusChangeHandler(Rwer_OnStatusChange); success = rwer.OpenNetPort(commonDAO.GetAppletConfigString("读卡器IP"), commonDAO.GetAppletConfigInt32("读卡器端口")); if (success) { Rwer_OnStatusChange(true); } else { Rwer_OnStatusChange(false); } // 初始化-电子秤 if (IsUseWeight) { this.WbMinWeight = commonDAO.GetAppletConfigDouble("电子秤最小重量"); wber.OnStatusChange += new WB.TOLEDO.IND231.TOLEDO_IND231Wber.StatusChangeHandler(Wber_OnStatusChange); wber.OnSteadyChange += new WB.TOLEDO.IND231.TOLEDO_IND231Wber.SteadyChangeEventHandler(Wber_OnSteadyChange); success = wber.OpenCom(commonDAO.GetAppletConfigInt32("电子秤串口"), commonDAO.GetAppletConfigInt32("电子秤波特率"), commonDAO.GetAppletConfigInt32("电子秤数据位"), commonDAO.GetAppletConfigInt32("电子秤停止位")); } } catch (Exception ex) { Log4Neter.Error("设备初始化", ex); } }
/// <summary> /// 加载配置 /// </summary> void LoadAppConfig() { txtAppIdentifier.Text = commonAppConfig.AppIdentifier; txtSelfConnStr.Text = commonAppConfig.SelfConnStr; chbStartup.Checked = (commonDAO.GetAppletConfigString("开机启动") == "1"); chbBothWay.Checked = (commonDAO.GetAppletConfigString("双向磅") == "1"); cmbInFactoryType.Text = commonDAO.GetAppletConfigString("过磅类型"); // IO控制器 SelectedComboBoxItem(cmbIocerCom, commonDAO.GetAppletConfigInt32("IO控制器_串口").ToString()); SelectedComboBoxItem(cmbIocerBandrate, commonDAO.GetAppletConfigInt32("IO控制器_波特率").ToString()); SelectedComboBoxItem(cmbIocerDataBits, commonDAO.GetAppletConfigInt32("IO控制器_数据位").ToString()); SelectedComboBoxItem(cmbIocerStopBits, commonDAO.GetAppletConfigInt32("IO控制器_停止位").ToString()); SelectedComboBoxItem(cmbIocerParity, commonDAO.GetAppletConfigInt32("IO控制器_校验位").ToString()); SelectedComboBoxItem(cmbInductorCoil1Port, commonDAO.GetAppletConfigInt32("IO控制器_地感1端口").ToString()); SelectedComboBoxItem(cmbInductorCoil2Port, commonDAO.GetAppletConfigInt32("IO控制器_地感2端口").ToString()); SelectedComboBoxItem(cmbInductorCoil3Port, commonDAO.GetAppletConfigInt32("IO控制器_地感3端口").ToString()); SelectedComboBoxItem(cmbInductorCoil4Port, commonDAO.GetAppletConfigInt32("IO控制器_地感4端口").ToString()); SelectedComboBoxItem(cmbInfraredSensor1Port, commonDAO.GetAppletConfigInt32("IO控制器_对射1端口").ToString()); SelectedComboBoxItem(cmbInfraredSensor2Port, commonDAO.GetAppletConfigInt32("IO控制器_对射2端口").ToString()); SelectedComboBoxItem(cmbGate1UpPort, commonDAO.GetAppletConfigInt32("IO控制器_道闸1升杆端口").ToString()); SelectedComboBoxItem(cmbGate1DownPort, commonDAO.GetAppletConfigInt32("IO控制器_道闸1降杆端口").ToString()); SelectedComboBoxItem(cmbGate2UpPort, commonDAO.GetAppletConfigInt32("IO控制器_道闸2升杆端口").ToString()); SelectedComboBoxItem(cmbGate2DownPort, commonDAO.GetAppletConfigInt32("IO控制器_道闸2降杆端口").ToString()); SelectedComboBoxItem(cmbSignalLight1Port, commonDAO.GetAppletConfigInt32("IO控制器_信号灯1端口").ToString()); SelectedComboBoxItem(cmbSignalLight2Port, commonDAO.GetAppletConfigInt32("IO控制器_信号灯2端口").ToString()); // 地磅仪表 SelectedComboBoxItem(cmbWberCom, commonDAO.GetAppletConfigInt32("地磅仪表_串口").ToString()); SelectedComboBoxItem(cmbWberBandrate, commonDAO.GetAppletConfigInt32("地磅仪表_波特率").ToString()); SelectedComboBoxItem(cmbWberDataBits, commonDAO.GetAppletConfigInt32("地磅仪表_数据位").ToString()); SelectedComboBoxItem(cmbWberStopBits, commonDAO.GetAppletConfigInt32("地磅仪表_停止位").ToString()); SelectedComboBoxItem(cmbWberParity, commonDAO.GetAppletConfigInt32("地磅仪表_校验位").ToString()); dbtxtMinWeight.Value = commonDAO.GetAppletConfigDouble("地磅仪表_最小称重"); dbtxtSteady.Value = commonDAO.GetAppletConfigDouble("地磅仪表_稳定时间"); dbtxtGrossLossTare.Value = Convert.ToDouble(commonDAO.GetAppletConfigString(GlobalVars.CommonAppletConfigName, "地磅仪表_毛皮差")); // 读卡器 iptxtRwer1.Value = commonDAO.GetAppletConfigString("车号识别1_IP地址"); iptxtRwer2.Value = commonDAO.GetAppletConfigString("车号识别2_IP地址"); // LED显示屏 iptxtLED1IP.Value = commonDAO.GetAppletConfigString("LED显示屏1_IP地址"); iptxtLED2IP.Value = commonDAO.GetAppletConfigString("LED显示屏2_IP地址"); SelectedComboBoxItem(cmbLEDType, commonDAO.GetAppletConfigString("LED显示屏类型").ToString()); }
/// <summary> /// 加载配置 /// </summary> void LoadAppConfig() { txtAppIdentifier.Text = commonAppConfig.AppIdentifier; txtSelfConnStr.Text = commonAppConfig.SelfConnStr; chbStartup.Checked = (commonDAO.GetAppletConfigString("开机启动") == "1"); // 地磅仪表 SelectedComboBoxItem(cmbWberCom, commonDAO.GetAppletConfigInt32("地磅仪表_串口").ToString()); SelectedComboBoxItem(cmbWberBandrate, commonDAO.GetAppletConfigInt32("地磅仪表_波特率").ToString()); SelectedComboBoxItem(cmbWberDataBits, commonDAO.GetAppletConfigInt32("地磅仪表_数据位").ToString()); SelectedComboBoxItem(cmbWberStopBits, commonDAO.GetAppletConfigInt32("地磅仪表_停止位").ToString()); SelectedComboBoxItem(cmbWberParity, commonDAO.GetAppletConfigInt32("地磅仪表_校验位").ToString()); dbtxtMinWeight.Value = commonDAO.GetAppletConfigDouble("地磅仪表_最小称重"); }
private void FrmSetting_Load(object sender, EventArgs e) { try { labelX1.ForeColor = Color.Red; labelX4.ForeColor = Color.Red; labelX14.ForeColor = Color.Red; labelX10.ForeColor = Color.Red; txtAppIdentifier.Text = commonAppConfig.AppIdentifier; txtSelfConnStr.Text = commonAppConfig.SelfConnStr; // 读卡器 iptxtIP.Value = commonDAO.GetAppletConfigString("读卡器IP"); txtPort.Text = commonDAO.GetAppletConfigString("读卡器端口"); SelectedComboItem(commonDAO.GetAppletConfigString("读卡器扇区"), cmbSecNumber); SelectedComboItem(commonDAO.GetAppletConfigString("读卡器块区"), cmbBlockNumber); //电子秤 SelectedComboItem("COM" + commonDAO.GetAppletConfigInt32("电子秤串口"), cmbLibra_COM); SelectedComboItem(commonDAO.GetAppletConfigString("电子秤波特率"), cmbLibra_Bandrate); SelectedComboItem(commonDAO.GetAppletConfigString("电子秤数据位"), cmbDataBits); SelectedComboItem(commonDAO.GetAppletConfigString("电子秤停止位"), cmbParity); //电子秤最小重量 dInputLibraWeight.Value = commonDAO.GetAppletConfigDouble("电子秤最小重量"); //是否启用称重 chkIsUseWeight.Checked = Convert.ToBoolean(commonDAO.GetAppletConfigInt32("启用称重")); //样罐 db2Weight.Value = commonDAO.GetCommonAppletConfigDouble("0.2mm样罐重"); db3Weight.Value = commonDAO.GetCommonAppletConfigDouble("3mm样罐重"); db6Weight.Value = commonDAO.GetCommonAppletConfigDouble("6mm样罐重"); db2OverWeight.Value = commonDAO.GetCommonAppletConfigDouble("0.2mm超差重"); db3OverWeight.Value = commonDAO.GetCommonAppletConfigDouble("3mm超差重"); db6OverWeight.Value = commonDAO.GetCommonAppletConfigDouble("6mm超差重"); } catch (Exception ex) { MessageBoxEx.Show("参数初始化失败" + ex.Message, "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } }
/// <summary> /// 初始化外接设备 /// </summary> private void InitHardware() { try { bool success = false; this.WbMinWeight = commonDAO.GetAppletConfigDouble("地磅仪表_最小称重"); // 地磅仪表 Hardwarer.Wber.OnStatusChange += new WB.TOLEDO.YAOHUA.TOLEDO_YAOHUAWber.StatusChangeHandler(Wber_OnStatusChange); Hardwarer.Wber.OnSteadyChange += new WB.TOLEDO.YAOHUA.TOLEDO_YAOHUAWber.SteadyChangeEventHandler(Wber_OnSteadyChange); Hardwarer.Wber.OnWeightChange += new WB.TOLEDO.YAOHUA.TOLEDO_YAOHUAWber.WeightChangeEventHandler(Wber_OnWeightChange); success = Hardwarer.Wber.OpenCom(commonDAO.GetAppletConfigInt32("地磅仪表_串口"), commonDAO.GetAppletConfigInt32("地磅仪表_波特率"), commonDAO.GetAppletConfigInt32("地磅仪表_数据位"), commonDAO.GetAppletConfigInt32("地磅仪表_停止位")); timer1.Enabled = true; } catch (Exception ex) { Log4Neter.Error("设备初始化", ex); } }
/// <summary> /// ¼ÓÔØÅäÖà /// </summary> void LoadAppConfig() { txtAppIdentifier.Text = commonAppConfig.AppIdentifier; txtSelfConnStr.Text = commonAppConfig.SelfConnStr; chbStartup.Checked = (commonDAO.GetAppletConfigString("¿ª»úÆô¶¯") == "1"); chkIsNormal.Checked = commonDAO.GetCommonAppletConfigString("ÊÇ·ñPDAÈ·ÈÏ") == "1"; // IO¿ØÖÆÆ÷ iptxtIOIP.Value = commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_IPµØÖ·"); txtIOPort.Text = commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_¶Ë¿Ú"); SelectedComboBoxItem(cmbInductorCoil1Port, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_µØ¸Ð1¶Ë¿Ú")); SelectedComboBoxItem(cmbInductorCoil2Port, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_µØ¸Ð2¶Ë¿Ú")); SelectedComboBoxItem(cmbInductorCoil3Port, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_µØ¸Ð3¶Ë¿Ú")); SelectedComboBoxItem(cmbInductorCoil4Port, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_µØ¸Ð4¶Ë¿Ú")); SelectedComboBoxItem(cmbInfraredSensor1Port, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_¶ÔÉä1¶Ë¿Ú")); SelectedComboBoxItem(cmbInfraredSensor2Port, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_¶ÔÉä2¶Ë¿Ú")); SelectedComboBoxItem(cmbGate1UpPort, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_µÀÕ¢1Éý¸Ë¶Ë¿Ú")); SelectedComboBoxItem(cmbGate1DownPort, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_µÀÕ¢1½µ¸Ë¶Ë¿Ú")); SelectedComboBoxItem(cmbGate2UpPort, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_µÀÕ¢2Éý¸Ë¶Ë¿Ú")); SelectedComboBoxItem(cmbGate2DownPort, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_µÀÕ¢2½µ¸Ë¶Ë¿Ú")); SelectedComboBoxItem(cmbSignalLight1Port, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_ÐźŵÆ1¶Ë¿Ú")); SelectedComboBoxItem(cmbSignalLight2Port, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_ÐźŵÆ2¶Ë¿Ú")); SelectedComboBoxItem(cmbButtonSensorPort, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_°´Å¥¶Ë¿Ú")); // µØ°õÒDZí SelectedComboBoxItem(cmbWberCom, commonDAO.GetAppletConfigString("µØ°õÒDZí_´®¿Ú")); SelectedComboBoxItem(cmbWberBandrate, commonDAO.GetAppletConfigString("µØ°õÒDZí_²¨ÌØÂÊ")); SelectedComboBoxItem(cmbWberDataBits, commonDAO.GetAppletConfigString("µØ°õÒDZí_Êý¾Ýλ")); SelectedComboBoxItem(cmbWberStopBits, commonDAO.GetAppletConfigString("µØ°õÒDZí_ֹͣλ")); SelectedComboBoxItem(cmbWberParity, commonDAO.GetAppletConfigString("µØ°õÒDZí_УÑéλ")); dbtxtMinWeight.Value = commonDAO.GetAppletConfigDouble("µØ°õÒDZí_×îС³ÆÖØ"); dbGrossTareDiffent.Value = commonDAO.GetCommonAppletConfigDouble("ëƤÖزî"); // LEDÏÔʾÆÁ iptxtLED1IP.Value = commonDAO.GetAppletConfigString("LEDÏÔʾÆÁ1_IPµØÖ·"); // ¶Á¿¨Æ÷Íø¿Ú iptxtRwerIP.Value = commonDAO.GetAppletConfigString("¶Á¿¨Æ÷1_IPµØÖ·"); txtRwerPort.Text = commonDAO.GetAppletConfigString("¶Á¿¨Æ÷1_¶Ë¿Ú"); txtRwerTagStartWith.Text = commonDAO.GetAppletConfigString("¶Á¿¨Æ÷_±êÇ©¹ýÂË"); SelectedComboBoxItem(cmbRwerPower, commonDAO.GetAppletConfigString("¶Á¿¨Æ÷1_¹¦ÂÊ")); //ÉãÏñ»ú //chbUseCamera.Checked = commonDAO.GetAppletConfigString("ÉãÏñ»úÆôÓÃ") == "1"; //CmcsCamare video1 = commonDAO.SelfDber.Entity<CmcsCamare>("where EquipmentCode=:EquipmentCode", new { EquipmentCode = commonAppConfig.AppIdentifier + "ÉãÏñÍ·1" }); //if (video1 != null) //{ // iptxtCamera1IP.Value = video1.Ip; // txtCamera1Port.Text = video1.Port.ToString(); // txtCamera1UserName.Text = video1.UserName; // txtCamera1Pwd.Text = video1.Password; // txtCamera1Channel.Text = video1.Channel.ToString(); //} //CmcsCamare video2 = commonDAO.SelfDber.Entity<CmcsCamare>("where EquipmentCode=:EquipmentCode", new { EquipmentCode = commonAppConfig.AppIdentifier + "ÉãÏñÍ·2" }); //if (video2 != null) //{ // iptxtCamera2IP.Value = video2.Ip; // txtCamera2Port.Text = video2.Port.ToString(); // txtCamera2UserName.Text = video2.UserName; // txtCamera2Pwd.Text = video2.Password; // txtCamera2Channel.Text = video2.Channel.ToString(); //} //жú¹µLED iptxtUnloadLED1.Value = commonDAO.GetCommonAppletConfigString("жú¹µLEDÏÔʾÆÁ1_IPµØÖ·"); iptxtUnloadLED2.Value = commonDAO.GetCommonAppletConfigString("жú¹µLEDÏÔʾÆÁ2_IPµØÖ·"); iptxtUnloadLED3.Value = commonDAO.GetCommonAppletConfigString("жú¹µLEDÏÔʾÆÁ3_IPµØÖ·"); iptxtUnloadLED4.Value = commonDAO.GetCommonAppletConfigString("жú¹µLEDÏÔʾÆÁ4_IPµØÖ·"); iptxtUnloadLED5.Value = commonDAO.GetCommonAppletConfigString("жú¹µLEDÏÔʾÆÁ5_IPµØÖ·"); iptxtUnloadLED6.Value = commonDAO.GetCommonAppletConfigString("жú¹µLEDÏÔʾÆÁ6_IPµØÖ·"); iptxtUnloadLED7.Value = commonDAO.GetCommonAppletConfigString("жú¹µLEDÏÔʾÆÁ7_IPµØÖ·"); iptxtUnloadLED8.Value = commonDAO.GetCommonAppletConfigString("жú¹µLEDÏÔʾÆÁ8_IPµØÖ·"); CmcsUnLoadLED unLoadLed = commonDAO.SelfDber.Entity <CmcsUnLoadLED>("where UnLoadNumber=1"); if (unLoadLed != null) { txtUnload1Number.Text = unLoadLed.UnLoadName; iptxtUnloadLED1.Value = unLoadLed.IP; } unLoadLed = commonDAO.SelfDber.Entity <CmcsUnLoadLED>("where UnLoadNumber=2"); if (unLoadLed != null) { txtUnload2Number.Text = unLoadLed.UnLoadName; iptxtUnloadLED2.Value = unLoadLed.IP; } unLoadLed = commonDAO.SelfDber.Entity <CmcsUnLoadLED>("where UnLoadNumber=3"); if (unLoadLed != null) { txtUnload3Number.Text = unLoadLed.UnLoadName; iptxtUnloadLED3.Value = unLoadLed.IP; } unLoadLed = commonDAO.SelfDber.Entity <CmcsUnLoadLED>("where UnLoadNumber=4"); if (unLoadLed != null) { txtUnload4Number.Text = unLoadLed.UnLoadName; iptxtUnloadLED4.Value = unLoadLed.IP; } unLoadLed = commonDAO.SelfDber.Entity <CmcsUnLoadLED>("where UnLoadNumber=5"); if (unLoadLed != null) { txtUnload5Number.Text = unLoadLed.UnLoadName; iptxtUnloadLED5.Value = unLoadLed.IP; } unLoadLed = commonDAO.SelfDber.Entity <CmcsUnLoadLED>("where UnLoadNumber=6"); if (unLoadLed != null) { txtUnload6Number.Text = unLoadLed.UnLoadName; iptxtUnloadLED6.Value = unLoadLed.IP; } unLoadLed = commonDAO.SelfDber.Entity <CmcsUnLoadLED>("where UnLoadNumber=7"); if (unLoadLed != null) { txtUnload7Number.Text = unLoadLed.UnLoadName; iptxtUnloadLED7.Value = unLoadLed.IP; } unLoadLed = commonDAO.SelfDber.Entity <CmcsUnLoadLED>("where UnLoadNumber=8"); if (unLoadLed != null) { txtUnload8Number.Text = unLoadLed.UnLoadName; iptxtUnloadLED8.Value = unLoadLed.IP; } }
/// <summary> /// ¼ÓÔØÅäÖà /// </summary> void LoadAppConfig() { #region °ó¶¨ÓïÒôÀàÐÍ List <string> arrVoices = voiceSpeaker.GetVoices(); for (int i = 0; i < arrVoices.Count; i++) { DataItem comboitem = new DataItem(arrVoices[i]); cmbVoiceName.Items.Add(comboitem); } cmbVoiceName.SelectedIndex = 0; #endregion txtAppIdentifier.Text = commonAppConfig.AppIdentifier; txtSelfConnStr.Text = commonAppConfig.SelfConnStr; chbStartup.Checked = (commonDAO.GetAppletConfigString("¿ª»úÆô¶¯") == "1"); intPoundIndex.Value = commonDAO.GetAppletConfigInt32("°õ±àºÅ"); // IO¿ØÖÆÆ÷ SelectedComboBoxItem(cmbIocerCom, commonDAO.GetAppletConfigInt32("IO¿ØÖÆÆ÷_´®¿Ú").ToString()); SelectedComboBoxItem(cmbIocerBandrate, commonDAO.GetAppletConfigInt32("IO¿ØÖÆÆ÷_²¨ÌØÂÊ").ToString()); SelectedComboBoxItem(cmbIocerDataBits, commonDAO.GetAppletConfigInt32("IO¿ØÖÆÆ÷_Êý¾Ýλ").ToString()); SelectedComboBoxItem(cmbIocerStopBits, commonDAO.GetAppletConfigInt32("IO¿ØÖÆÆ÷_ֹͣλ").ToString()); SelectedComboBoxItem(cmbIocerParity, commonDAO.GetAppletConfigInt32("IO¿ØÖÆÆ÷_УÑéλ").ToString()); SelectedComboBoxItem(cmbInductorCoil1Port, commonDAO.GetAppletConfigInt32("IO¿ØÖÆÆ÷_µØ¸Ð1¶Ë¿Ú").ToString()); SelectedComboBoxItem(cmbInductorCoil2Port, commonDAO.GetAppletConfigInt32("IO¿ØÖÆÆ÷_µØ¸Ð2¶Ë¿Ú").ToString()); SelectedComboBoxItem(cmbInductorCoil3Port, commonDAO.GetAppletConfigInt32("IO¿ØÖÆÆ÷_µØ¸Ð3¶Ë¿Ú").ToString()); SelectedComboBoxItem(cmbInductorCoil4Port, commonDAO.GetAppletConfigInt32("IO¿ØÖÆÆ÷_µØ¸Ð4¶Ë¿Ú").ToString()); SelectedComboBoxItem(cmbInfraredSensor1Port, commonDAO.GetAppletConfigInt32("IO¿ØÖÆÆ÷_¶ÔÉä1¶Ë¿Ú").ToString()); SelectedComboBoxItem(cmbInfraredSensor2Port, commonDAO.GetAppletConfigInt32("IO¿ØÖÆÆ÷_¶ÔÉä2¶Ë¿Ú").ToString()); SelectedComboBoxItem(cmbGate1UpPort, commonDAO.GetAppletConfigInt32("IO¿ØÖÆÆ÷_µÀÕ¢1Éý¸Ë¶Ë¿Ú").ToString()); SelectedComboBoxItem(cmbGate1DownPort, commonDAO.GetAppletConfigInt32("IO¿ØÖÆÆ÷_µÀÕ¢1½µ¸Ë¶Ë¿Ú").ToString()); SelectedComboBoxItem(cmbGate2UpPort, commonDAO.GetAppletConfigInt32("IO¿ØÖÆÆ÷_µÀÕ¢2Éý¸Ë¶Ë¿Ú").ToString()); SelectedComboBoxItem(cmbGate2DownPort, commonDAO.GetAppletConfigInt32("IO¿ØÖÆÆ÷_µÀÕ¢2½µ¸Ë¶Ë¿Ú").ToString()); SelectedComboBoxItem(cmbSignalLight1Port, commonDAO.GetAppletConfigInt32("IO¿ØÖÆÆ÷_ÐźŵÆ1¶Ë¿Ú").ToString()); SelectedComboBoxItem(cmbSignalLight2Port, commonDAO.GetAppletConfigInt32("IO¿ØÖÆÆ÷_ÐźŵÆ2¶Ë¿Ú").ToString()); // µØ°õÒDZí SelectedComboBoxItem(cmbWberCom, commonDAO.GetAppletConfigInt32("µØ°õÒDZí_´®¿Ú").ToString()); SelectedComboBoxItem(cmbWberBandrate, commonDAO.GetAppletConfigInt32("µØ°õÒDZí_²¨ÌØÂÊ").ToString()); SelectedComboBoxItem(cmbWberDataBits, commonDAO.GetAppletConfigInt32("µØ°õÒDZí_Êý¾Ýλ").ToString()); SelectedComboBoxItem(cmbWberStopBits, commonDAO.GetAppletConfigInt32("µØ°õÒDZí_ֹͣλ").ToString()); SelectedComboBoxItem(cmbWberParity, commonDAO.GetAppletConfigInt32("µØ°õÒDZí_УÑéλ").ToString()); dbtxtMinWeight.Value = commonDAO.GetAppletConfigDouble("µØ°õÒDZí_×îС³ÆÖØ"); // ¶Á¿¨Æ÷ cmbRwer1Ip.Value = commonDAO.GetAppletConfigString("¶Á¿¨Æ÷1_Ip"); cmbRwer1Port.Value = commonDAO.GetAppletConfigInt32("¶Á¿¨Æ÷1_¶Ë¿Ú"); cmbRwer2Ip.Value = commonDAO.GetAppletConfigString("¶Á¿¨Æ÷2_Ip"); cmbRwer2Port.Value = commonDAO.GetAppletConfigInt32("¶Á¿¨Æ÷2_¶Ë¿Ú"); txtRwerTagStartWith.Text = commonDAO.GetAppletConfigString("¶Á¿¨Æ÷_±êÇ©¹ýÂË"); // LEDÏÔʾÆÁ iptxtLED1IP.Value = commonDAO.GetAppletConfigString("LEDÏÔʾÆÁ1_IPµØÖ·"); iptxtLED2IP.Value = commonDAO.GetAppletConfigString("LEDÏÔʾÆÁ2_IPµØÖ·"); // ÓïÒô SelectedComboBoxItem(cmbVoiceName, commonDAO.GetAppletConfigString("ÓïÒô°ü").ToString()); sldVoiceRate.Value = commonDAO.GetAppletConfigInt32("ÓïËÙ"); sldVoiceVolume.Value = commonDAO.GetAppletConfigInt32("ÒôÁ¿"); lblVoiceRate.Text = sldVoiceRate.Value.ToString(); lblVoiceVolume.Text = sldVoiceVolume.Value.ToString(); }