Exemplo n.º 1
0
        /// <summary>
        /// 保存配置
        /// </summary>
        bool SaveAppConfig()
        {
            if (!TestDBConnect())
            {
                return(false);
            }

            commonAppConfig.AppIdentifier = txtAppIdentifier.Text.Trim();
            commonAppConfig.SelfConnStr   = txtSelfConnStr.Text;
            commonAppConfig.Save();
            commonDAO.SetAppletConfig("开机启动", Convert.ToInt16(chbStartup.Checked).ToString());

            commonDAO.SetCommonAppletConfig("火车采样机设备编码", txtJxSamplerMachineCode.Text.Trim());

            try
            {
#if DEBUG
#else
                // 添加、取消开机启动
                if (chbStartup.Checked)
                {
                    StartUpUtil.InsertStartUp(Application.ProductName, Application.ExecutablePath);
                }
                else
                {
                    StartUpUtil.DeleteStartUp(Application.ProductName);
                }
#endif
            }
            catch { }

            return(true);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 保存配置
        /// </summary>
        bool SaveAppConfig()
        {
            if (!TestDBConnect())
            {
                return(false);
            }

            commonAppConfig.AppIdentifier = txtAppIdentifier.Text.Trim();
            commonAppConfig.SelfConnStr   = txtSelfConnStr.Text;
            commonAppConfig.Save();
            commonDAO.SetAppletConfig("开机启动", Convert.ToInt16(chbStartup.Checked).ToString());
            commonDAO.SetAppletConfig("入口采样机", Convert.ToInt16(chbInFactorySampler.Checked).ToString());

            commonDAO.SetAppletConfig("采样机设备编码", txtJxSamplerMachineCode.Text.Trim());

            try
            {
#if DEBUG
#else
                // 添加、取消开机启动
                if (chbStartup.Checked)
                {
                    StartUpUtil.InsertStartUp(Application.ProductName, Application.ExecutablePath);
                }
                else
                {
                    StartUpUtil.DeleteStartUp(Application.ProductName);
                }
#endif
            }
            catch { }

            // IO控制器
            commonDAO.SetAppletConfig("IO控制器_IP地址", iptxtIOIP.Value);
            commonDAO.SetAppletConfig("IO控制器_端口", txtIOPort.Text);
            commonDAO.SetAppletConfig("IO控制器_地感1端口", (cmbInductorCoil1Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_地感2端口", (cmbInductorCoil2Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_地感3端口", (cmbInductorCoil3Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_地感4端口", (cmbInductorCoil4Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_对射1端口", (cmbInfraredSensor1Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_对射2端口", (cmbInfraredSensor2Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_道闸1升杆端口", (cmbGate1UpPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_道闸1降杆端口", (cmbGate1DownPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_道闸2升杆端口", (cmbGate2UpPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_道闸2降杆端口", (cmbGate2DownPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_信号灯1端口", (cmbSignalLight1Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_信号灯2端口", (cmbSignalLight2Port.SelectedItem as DataItem).Value);

            // 读卡器网口
            commonDAO.SetAppletConfig("读卡器1_IP地址", iptxtRwerIP.Value);
            commonDAO.SetAppletConfig("读卡器1_端口", txtRwerPort.Text);
            commonDAO.SetAppletConfig("读卡器_标签过滤", txtRwerTagStartWith.Text);
            commonDAO.SetAppletConfig("读卡器1_功率", (cmbRwerPower.SelectedItem as DataItem).Value);

            // LED显示屏
            commonDAO.SetAppletConfig("LED显示屏1_IP地址", iptxtLED1IP.Value);
            commonDAO.SetAppletConfig("LED显示屏2_IP地址", iptxtLED2IP.Value);

            return(true);
        }
Exemplo n.º 3
0
        /// <summary>
        /// ±£´æÅäÖÃ
        /// </summary>
        bool SaveAppConfig()
        {
            if (!TestDBConnect())
            {
                return(false);
            }

            commonAppConfig.AppIdentifier = txtAppIdentifier.Text.Trim();
            commonAppConfig.SelfConnStr   = txtSelfConnStr.Text;
            commonAppConfig.Save();
            commonDAO.SetAppletConfig("¿ª»úÆô¶¯", Convert.ToInt16(chbStartup.Checked).ToString());
            commonDAO.SetAppletConfig("Ó¯Òì³£¶ÖÊý", dbtxtProfinWeight.Value.ToString());
            commonDAO.SetAppletConfig("¿÷Òì³£¶ÖÊý", dbtxtProfinWeight2.Value.ToString());
            try
            {
#if DEBUG
#else
                // Ìí¼Ó¡¢È¡Ïû¿ª»úÆô¶¯
                if (chbStartup.Checked)
                {
                    StartUpUtil.InsertStartUp(Application.ProductName, Application.ExecutablePath);
                }
                else
                {
                    StartUpUtil.DeleteStartUp(Application.ProductName);
                }
#endif
            }
            catch { }

            // IO¿ØÖÆÆ÷
            commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_IPµØÖ·", iptxtIOIP.Value);
            commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_¶Ë¿Ú", txtIOPort.Text);
            commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_µØ¸Ð1¶Ë¿Ú", (cmbInductorCoil1Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_µØ¸Ð2¶Ë¿Ú", (cmbInductorCoil2Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_µØ¸Ð3¶Ë¿Ú", (cmbInductorCoil3Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_µØ¸Ð4¶Ë¿Ú", (cmbInductorCoil4Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_µÀÕ¢1Éý¸Ë¶Ë¿Ú", (cmbGate1UpPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_µÀÕ¢1½µ¸Ë¶Ë¿Ú", (cmbGate1DownPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_µÀÕ¢2Éý¸Ë¶Ë¿Ú", (cmbGate2UpPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_µÀÕ¢2½µ¸Ë¶Ë¿Ú", (cmbGate2DownPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_ÐźŵÆ1¶Ë¿Ú", (cmbSignalLight1Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_ÐźŵÆ2¶Ë¿Ú", (cmbSignalLight2Port.SelectedItem as DataItem).Value);

            // LEDÏÔʾÆÁ
            commonDAO.SetAppletConfig("LEDÏÔʾÆÁ1_IPµØÖ·", iptxtLED1IP.Value);

            // ¶Á¿¨Æ÷Íø¿Ú
            commonDAO.SetAppletConfig("¶Á¿¨Æ÷1IPµØÖ·", ipAddressInput1.Value);
            commonDAO.SetAppletConfig("¶Á¿¨Æ÷1¶Ë¿Ú", ipAddressPort1.Text);
            commonDAO.SetAppletConfig("¶Á¿¨Æ÷_±êÇ©¹ýÂË", txtRwerTagStartWith.Text);
            commonDAO.SetAppletConfig("¶Á¿¨Æ÷1¹¦ÂÊ", (cmbRwerPower.SelectedItem as DataItem).Value);

            // ·¢¿¨Æ÷
            commonDAO.SetAppletConfig("·¢¿¨Æ÷_´®¿Ú", (cmbRwer2Com.SelectedItem as DataItem).Value);


            return(true);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 保存配置
        /// </summary>
        bool SaveAppConfig()
        {
            if (!TestDBConnect())
            {
                return(false);
            }

            commonAppConfig.AppIdentifier = txtAppIdentifier.Text.Trim();
            commonAppConfig.SelfConnStr   = txtSelfConnStr.Text;
            commonAppConfig.Save();
            commonDAO.SetAppletConfig("开机启动", Convert.ToInt16(chbStartup.Checked).ToString());
            if (txtJxSamplerMachineCode.Text.Contains("1"))
            {
                commonDAO.SetCommonAppletConfig("#1汽车机械采样机接口连接字符串", txtSqlConnStr.Text.Trim());
            }
            else if (txtJxSamplerMachineCode.Text.Contains("2"))
            {
                commonDAO.SetCommonAppletConfig("#2汽车机械采样机接口连接字符串", txtSqlConnStr.Text.Trim());
            }
            commonDAO.SetAppletConfig("采样机设备编码", txtJxSamplerMachineCode.Text.Trim());

            try
            {
#if DEBUG
#else
                // 添加、取消开机启动
                if (chbStartup.Checked)
                {
                    StartUpUtil.InsertStartUp(Application.ProductName, Application.ExecutablePath);
                }
                else
                {
                    StartUpUtil.DeleteStartUp(Application.ProductName);
                }
#endif
            }
            catch { }

            // IO控制器
            commonDAO.SetAppletConfig("IO控制器_串口", (cmbIocerCom.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_波特率", (cmbIocerBandrate.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_数据位", (cmbIocerDataBits.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_停止位", (cmbIocerStopBits.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_校验位", (cmbIocerParity.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_地感1端口", (cmbInductorCoil1Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_地感2端口", (cmbInductorCoil2Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_道闸1升杆端口", (cmbGate1UpPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_道闸1降杆端口", (cmbGate1DownPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_确认按钮端口", (cmbAffirmPort.SelectedItem as DataItem).Value);

            // 车号识别
            commonDAO.SetAppletConfig("车号识别1_IP地址", iptxtRwer1.Value);

            // LED显示屏
            commonDAO.SetAppletConfig("LED显示屏1_IP地址", iptxtLED1IP.Value);

            return(true);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 保存配置
        /// </summary>
        bool SaveAppConfig()
        {
            if (!TestDBConnect())
            {
                return(false);
            }

            commonAppConfig.AppIdentifier = txtAppIdentifier.Text.Trim();
            commonAppConfig.SelfConnStr   = txtSelfConnStr.Text;
            commonAppConfig.Save();
            commonDAO.SetAppletConfig("开机启动", Convert.ToInt16(chbStartup.Checked).ToString());

            commonDAO.SetAppletConfig("采样机设备编码", txtJxSamplerMachineCode.Text.Trim());

            try
            {
#if DEBUG
#else
                // 添加、取消开机启动
                if (chbStartup.Checked)
                {
                    StartUpUtil.InsertStartUp(Application.ProductName, Application.ExecutablePath);
                }
                else
                {
                    StartUpUtil.DeleteStartUp(Application.ProductName);
                }
#endif
            }
            catch { }

            // IO控制器
            commonDAO.SetAppletConfig("IO控制器_串口", (cmbIocerCom.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_波特率", (cmbIocerBandrate.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_数据位", (cmbIocerDataBits.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_停止位", (cmbIocerStopBits.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_校验位", (cmbIocerParity.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_地感1端口", (cmbInductorCoil1Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_地感2端口", (cmbInductorCoil2Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_地感3端口", (cmbInductorCoil3Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_地感4端口", (cmbInductorCoil4Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_道闸1升杆端口", (cmbGate1UpPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_道闸1降杆端口", (cmbGate1DownPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_道闸2升杆端口", (cmbGate2UpPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_道闸2降杆端口", (cmbGate2DownPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_信号灯1端口", (cmbSignalLight1Port.SelectedItem as DataItem).Value);

            // 读卡器
            commonDAO.SetAppletConfig("读卡器1_串口", (cmbRwer1Com.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("读卡器_标签过滤", txtRwerTagStartWith.Text);

            // LED显示屏
            commonDAO.SetAppletConfig("LED显示屏1_IP地址", iptxtLED1IP.Value);

            return(true);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 保存配置
        /// </summary>
        bool SaveAppConfig()
        {
            commonAppConfig.AppIdentifier = txtAppIdentifier.Text.Trim();
            commonAppConfig.SelfConnStr   = txtSelfConnStr.Text;
            commonAppConfig.Save();
            commonDAO.SetAppletConfig("开机启动", Convert.ToInt16(chbStartup.Checked).ToString());

            try
            {
#if DEBUG
#else
                // 添加、取消开机启动
                if (chbStartup.Checked)
                {
                    StartUpUtil.InsertStartUp(Application.ProductName, Application.ExecutablePath);
                }
                else
                {
                    StartUpUtil.DeleteStartUp(Application.ProductName);
                }
#endif
            }
            catch { }

            // IO控制器
            commonDAO.SetAppletConfig("IO控制器_串口", (cmbIocerCom.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_波特率", (cmbIocerBandrate.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_数据位", (cmbIocerDataBits.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_停止位", (cmbIocerStopBits.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_校验位", (cmbIocerParity.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_地感1端口", (cmbInductorCoil1Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_地感2端口", (cmbInductorCoil2Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_地感3端口", (cmbInductorCoil3Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_地感4端口", (cmbInductorCoil4Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_道闸1升杆端口", (cmbGate1UpPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_道闸1降杆端口", (cmbGate1DownPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_道闸2升杆端口", (cmbGate2UpPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_道闸2降杆端口", (cmbGate2DownPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_信号灯1端口", (cmbSignalLight1Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_信号灯2端口", (cmbSignalLight2Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("启用道闸1", Convert.ToInt16(chbUseGate1.Checked).ToString());
            commonDAO.SetAppletConfig("启用道闸2", Convert.ToInt16(chbUseGate2.Checked).ToString());
            // 读卡器
            commonDAO.SetAppletConfig("车号识别1_IP地址", iptxtRwer1.Value);
            commonDAO.SetAppletConfig("车号识别2_IP地址", iptxtRwer2.Value);
            commonDAO.SetAppletConfig("启用车号识别1", Convert.ToInt16(chbUseCamera1.Checked).ToString());
            commonDAO.SetAppletConfig("启用车号识别2", Convert.ToInt16(chbUseCamera2.Checked).ToString());

            // LED显示屏
            commonDAO.SetAppletConfig("LED显示屏1_IP地址", iptxtLED1IP.Value);
            commonDAO.SetAppletConfig("LED显示屏2_IP地址", iptxtLED2IP.Value);

            return(true);
        }
Exemplo n.º 7
0
 private void Form1_Shown(object sender, EventArgs e)
 {
     try
     {
         // 添加、取消开机启动
         if (CommonAppConfig.GetInstance().Startup)
         {
             StartUpUtil.InsertStartUp(Application.ProductName, Application.ExecutablePath);
         }
         else
         {
             StartUpUtil.DeleteStartUp(Application.ProductName);
         }
     }
     catch { }
 }
Exemplo n.º 8
0
        /// <summary>
        /// 保存配置
        /// </summary>
        bool SaveAppConfig()
        {
            if (!TestDBConnect())
            {
                return(false);
            }

            commonAppConfig.AppIdentifier = txtAppIdentifier.Text.Trim();
            commonAppConfig.SelfConnStr   = txtSelfConnStr.Text;
            commonAppConfig.Save();
            commonDAO.SetAppletConfig("开机启动", Convert.ToInt16(chbStartup.Checked).ToString());

            commonDAO.SetAppletConfig("采样机设备编码", txtJxSamplerMachineCode.Text.Trim());

            try
            {
#if DEBUG
#else
                // 添加、取消开机启动
                if (chbStartup.Checked)
                {
                    StartUpUtil.InsertStartUp(Application.ProductName, Application.ExecutablePath);
                }
                else
                {
                    StartUpUtil.DeleteStartUp(Application.ProductName);
                }
#endif
            }
            catch { }

            // 车号识别
            commonDAO.SetAppletConfig("车号识别1_IP地址", iptxtRwer1.Value);

            // LED显示屏
            commonDAO.SetAppletConfig("LED显示屏1_IP地址", iptxtLED1IP.Value);

            // 语音
            commonDAO.SetAppletConfig("语音包", (cmbVoiceName.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("语速", sldVoiceRate.Value.ToString());
            commonDAO.SetAppletConfig("音量", sldVoiceVolume.Value.ToString());

            return(true);
        }
Exemplo n.º 9
0
        private void Form1_Shown(object sender, EventArgs e)
        {
            try
            {
#if DEBUG
#else
                // 添加、取消开机启动
                if (ADGSAppConfig.GetInstance().Startup)
                {
                    StartUpUtil.InsertStartUp(Application.ProductName, Application.ExecutablePath);
                }
                else
                {
                    StartUpUtil.DeleteStartUp(Application.ProductName);
                }
#endif
            }
            catch { }

            grabPerformer.StartGrab();
        }
Exemplo n.º 10
0
        /// <summary>
        /// 保存配置
        /// </summary>
        bool SaveAppConfig()
        {
            if (!TestDBConnect())
            {
                return(false);
            }

            commonAppConfig.AppIdentifier = txtAppIdentifier.Text.Trim();
            commonAppConfig.SelfConnStr   = txtSelfConnStr.Text;
            commonAppConfig.Save();
            commonDAO.SetAppletConfig("开机启动", Convert.ToInt16(chbStartup.Checked).ToString());

            try
            {
#if DEBUG
#else
                // 添加、取消开机启动
                if (chbStartup.Checked)
                {
                    StartUpUtil.InsertStartUp(Application.ProductName, Application.ExecutablePath);
                }
                else
                {
                    StartUpUtil.DeleteStartUp(Application.ProductName);
                }
#endif
            }
            catch { }

            // 地磅仪表
            commonDAO.SetAppletConfig("地磅仪表_串口", (cmbWberCom.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("地磅仪表_波特率", (cmbWberBandrate.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("地磅仪表_数据位", (cmbWberDataBits.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("地磅仪表_停止位", (cmbWberStopBits.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("地磅仪表_校验位", (cmbWberParity.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("地磅仪表_最小称重", dbtxtMinWeight.Value.ToString());

            return(true);
        }
Exemplo n.º 11
0
        private void Form1_Shown(object sender, EventArgs e)
        {
            //timer1.Interval = (double)ClientConfiguration.Instance.GrabInterval * 60 * 1000;
            //timer1.Elapsed += new System.Timers.ElapsedEventHandler(timer1_Elapsed);
            //timer1_Elapsed(null, null);
            try
            {
#if DEBUG
#else
                // 添加、取消开机启动
                if (ADGSAppConfig.GetInstance().Startup)
                {
                    StartUpUtil.InsertStartUp(Application.ProductName, Application.ExecutablePath);
                }
                else
                {
                    StartUpUtil.DeleteStartUp(Application.ProductName);
                }
#endif
            }
            catch { }
        }
Exemplo n.º 12
0
        /// <summary>
        /// ±£´æÅäÖÃ
        /// </summary>
        bool SaveAppConfig()
        {
            if (!TestDBConnect())
            {
                return(false);
            }

            commonAppConfig.AppIdentifier = txtAppIdentifier.Text.Trim();
            commonAppConfig.SelfConnStr   = txtSelfConnStr.Text;
            commonAppConfig.Save();
            commonDAO.SetAppletConfig("¿ª»úÆô¶¯", Convert.ToInt16(chbStartup.Checked).ToString());

            try
            {
#if DEBUG
#else
                // Ìí¼Ó¡¢È¡Ïû¿ª»úÆô¶¯
                if (chbStartup.Checked)
                {
                    StartUpUtil.InsertStartUp(Application.ProductName, Application.ExecutablePath);
                }
                else
                {
                    StartUpUtil.DeleteStartUp(Application.ProductName);
                }
#endif
            }
            catch { }

            // IO¿ØÖÆÆ÷
            commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_´®¿Ú", (cmbIocerCom.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_²¨ÌØÂÊ", (cmbIocerBandrate.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_Êý¾Ýλ", (cmbIocerDataBits.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_ֹͣλ", (cmbIocerStopBits.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_УÑéλ", (cmbIocerParity.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_µØ¸Ð1¶Ë¿Ú", (cmbInductorCoil1Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_µØ¸Ð2¶Ë¿Ú", (cmbInductorCoil2Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_µØ¸Ð3¶Ë¿Ú", (cmbInductorCoil3Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_µØ¸Ð4¶Ë¿Ú", (cmbInductorCoil4Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_µÀÕ¢1Éý¸Ë¶Ë¿Ú", (cmbGate1UpPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_µÀÕ¢1½µ¸Ë¶Ë¿Ú", (cmbGate1DownPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_µÀÕ¢2Éý¸Ë¶Ë¿Ú", (cmbGate2UpPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_µÀÕ¢2½µ¸Ë¶Ë¿Ú", (cmbGate2DownPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_ÐźŵÆ1¶Ë¿Ú", (cmbSignalLight1Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_ÐźŵÆ2¶Ë¿Ú", (cmbSignalLight2Port.SelectedItem as DataItem).Value);

            // ¶Á¿¨Æ÷
            commonDAO.SetAppletConfig("¶Á¿¨Æ÷1_´®¿Ú", (cmbRwer1Com.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("¶Á¿¨Æ÷2_´®¿Ú", (cmbRwer2Com.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("¶Á¿¨Æ÷_±êÇ©¹ýÂË", txtRwerTagStartWith.Text);

            // LEDÏÔʾÆÁ
            commonDAO.SetAppletConfig("LEDÏÔʾÆÁ1_IPµØÖ·", iptxtLED1IP.Value);
            commonDAO.SetAppletConfig("LEDÏÔʾÆÁ2_IPµØÖ·", iptxtLED2IP.Value);

            // ÓïÒô
            commonDAO.SetAppletConfig("ÓïÒô°ü", (cmbVoiceName.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("ÓïËÙ", sldVoiceRate.Value.ToString());
            commonDAO.SetAppletConfig("ÒôÁ¿", sldVoiceVolume.Value.ToString());

            return(true);
        }
Exemplo n.º 13
0
        /// <summary>
        /// 保存配置
        /// </summary>
        bool SaveAppConfig()
        {
            if (!TestDBConnect())
            {
                return(false);
            }

            commonAppConfig.AppIdentifier = txtAppIdentifier.Text.Trim();
            commonAppConfig.SelfConnStr   = txtSelfConnStr.Text;
            commonAppConfig.Save();
            commonDAO.SetAppletConfig("开机启动", Convert.ToInt16(chbStartup.Checked).ToString());

            try
            {
#if DEBUG
#else
                // 添加、取消开机启动
                if (chbStartup.Checked)
                {
                    StartUpUtil.InsertStartUp(Application.ProductName, Application.ExecutablePath);
                }
                else
                {
                    StartUpUtil.DeleteStartUp(Application.ProductName);
                }
#endif
            }
            catch { }

            commonDAO.SetAppletConfig("上磅方向", (cmbDecrition.SelectedItem as DataItem).Value);
            // IO控制器
            commonDAO.SetAppletConfig("IO控制器_串口", (cmbIocerCom.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_波特率", (cmbIocerBandrate.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_数据位", (cmbIocerDataBits.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_停止位", (cmbIocerStopBits.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_校验位", (cmbIocerParity.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_地感1端口", (cmbInductorCoil1Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_地感2端口", (cmbInductorCoil2Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_地感3端口", (cmbInductorCoil3Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_地感4端口", (cmbInductorCoil4Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_对射1端口", (cmbInfraredSensor1Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_道闸1升杆端口", (cmbGate1UpPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_道闸1降杆端口", (cmbGate1DownPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_道闸2升杆端口", (cmbGate2UpPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_道闸2降杆端口", (cmbGate2DownPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_信号灯1端口", (cmbSignalLight1Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("启用对射", Convert.ToInt16(chbUseInfraredSensor.Checked).ToString());

            // 地磅仪表
            commonDAO.SetAppletConfig("地磅仪表_串口", (cmbWberCom.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("地磅仪表_波特率", (cmbWberBandrate.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("地磅仪表_数据位", (cmbWberDataBits.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("地磅仪表_停止位", (cmbWberStopBits.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("地磅仪表_校验位", (cmbWberParity.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("地磅仪表_最小称重", dbtxtMinWeight.Value.ToString());

            // 车号识别
            commonDAO.SetAppletConfig("车号识别1_IP地址", iptxtRwer1.Value);
            commonDAO.SetAppletConfig("车号识别2_IP地址", iptxtRwer2.Value);

            // LED显示屏
            commonDAO.SetAppletConfig("LED显示屏1_IP地址", iptxtLED1IP.Value);
            commonDAO.SetAppletConfig("LED显示屏2_IP地址", iptxtLED2IP.Value);

            // 语音
            commonDAO.SetAppletConfig("语音包", (cmbVoiceName.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("语速", sldVoiceRate.Value.ToString());
            commonDAO.SetAppletConfig("音量", sldVoiceVolume.Value.ToString());

            return(true);
        }
Exemplo n.º 14
0
        /// <summary>
        /// ±£´æÅäÖÃ
        /// </summary>
        bool SaveAppConfig()
        {
            if (!TestDBConnect())
            {
                return(false);
            }

            commonAppConfig.AppIdentifier = txtAppIdentifier.Text.Trim();
            commonAppConfig.SelfConnStr   = txtSelfConnStr.Text;
            commonAppConfig.Save();
            commonDAO.SetAppletConfig("¿ª»úÆô¶¯", Convert.ToInt16(chbStartup.Checked).ToString());
            commonDAO.SetCommonAppletConfig("ÊÇ·ñPDAÈ·ÈÏ", chkIsNormal.Checked ? "1" : "0");
            try
            {
#if DEBUG
#else
                // Ìí¼Ó¡¢È¡Ïû¿ª»úÆô¶¯
                if (chbStartup.Checked)
                {
                    StartUpUtil.InsertStartUp(Application.ProductName, Application.ExecutablePath);
                }
                else
                {
                    StartUpUtil.DeleteStartUp(Application.ProductName);
                }
#endif
            }
            catch { }

            // IO¿ØÖÆÆ÷
            commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_IPµØÖ·", iptxtIOIP.Value);
            commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_¶Ë¿Ú", txtIOPort.Text);
            commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_µØ¸Ð1¶Ë¿Ú", (cmbInductorCoil1Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_µØ¸Ð2¶Ë¿Ú", (cmbInductorCoil2Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_µØ¸Ð3¶Ë¿Ú", (cmbInductorCoil3Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_µØ¸Ð4¶Ë¿Ú", (cmbInductorCoil4Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_¶ÔÉä1¶Ë¿Ú", (cmbInfraredSensor1Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_¶ÔÉä2¶Ë¿Ú", (cmbInfraredSensor2Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_µÀÕ¢1Éý¸Ë¶Ë¿Ú", (cmbGate1UpPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_µÀÕ¢1½µ¸Ë¶Ë¿Ú", (cmbGate1DownPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_µÀÕ¢2Éý¸Ë¶Ë¿Ú", (cmbGate2UpPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_µÀÕ¢2½µ¸Ë¶Ë¿Ú", (cmbGate2DownPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_ÐźŵÆ1¶Ë¿Ú", (cmbSignalLight1Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_ÐźŵÆ2¶Ë¿Ú", (cmbSignalLight2Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_°´Å¥¶Ë¿Ú", (cmbButtonSensorPort.SelectedItem as DataItem).Value);

            // µØ°õÒDZí
            commonDAO.SetAppletConfig("µØ°õÒDZí_´®¿Ú", (cmbWberCom.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("µØ°õÒDZí_²¨ÌØÂÊ", (cmbWberBandrate.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("µØ°õÒDZí_Êý¾Ýλ", (cmbWberDataBits.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("µØ°õÒDZí_ֹͣλ", (cmbWberStopBits.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("µØ°õÒDZí_УÑéλ", (cmbWberParity.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("µØ°õÒDZí_×îС³ÆÖØ", dbtxtMinWeight.Value.ToString());
            commonDAO.SetCommonAppletConfig("ëƤÖزî", dbGrossTareDiffent.Value.ToString());
            // LEDÏÔʾÆÁ
            commonDAO.SetAppletConfig("LEDÏÔʾÆÁ1_IPµØÖ·", iptxtLED1IP.Value);

            // ¶Á¿¨Æ÷Íø¿Ú
            commonDAO.SetAppletConfig("¶Á¿¨Æ÷1_IPµØÖ·", iptxtRwerIP.Value);
            commonDAO.SetAppletConfig("¶Á¿¨Æ÷1_¶Ë¿Ú", txtRwerPort.Text);
            commonDAO.SetAppletConfig("¶Á¿¨Æ÷_±êÇ©¹ýÂË", txtRwerTagStartWith.Text);
            commonDAO.SetAppletConfig("¶Á¿¨Æ÷1_¹¦ÂÊ", (cmbRwerPower.SelectedItem as DataItem).Value);

            //ÉãÏñ»ú
            //commonDAO.SetAppletConfig("ÉãÏñ»úÆôÓÃ", chbUseCamera.Checked ? "1" : "0");
            //CmcsCamare video1 = commonDAO.SelfDber.Entity<CmcsCamare>("where EquipmentCode=:EquipmentCode", new { EquipmentCode = commonAppConfig.AppIdentifier + "ÉãÏñÍ·1" });
            //if (video1 != null)
            //{
            //    video1.Ip = iptxtCamera1IP.Value;
            //    video1.Port = Convert.ToInt32(txtCamera1Port.Text);
            //    video1.UserName = txtCamera1UserName.Text;
            //    video1.Password = txtCamera1Pwd.Text;
            //    video1.Channel = Convert.ToInt32(txtCamera1Channel.Text);
            //    commonDAO.SelfDber.Update(video1);
            //}
            //else
            //{
            //    video1 = new CmcsCamare();
            //    video1.Ip = iptxtCamera1IP.Value;
            //    video1.Port = Convert.ToInt32(txtCamera1Port.Text);
            //    video1.UserName = txtCamera1UserName.Text;
            //    video1.Password = txtCamera1Pwd.Text;
            //    video1.Channel = Convert.ToInt32(txtCamera1Channel.Text);
            //    video1.ParentId = "-1";
            //    commonDAO.SelfDber.Insert(video1);
            //}
            //CmcsCamare video2 = commonDAO.SelfDber.Entity<CmcsCamare>("where EquipmentCode=:EquipmentCode", new { EquipmentCode = commonAppConfig.AppIdentifier + "ÉãÏñÍ·2" });
            //if (video2 != null)
            //{
            //    video2.Ip = iptxtCamera2IP.Value;
            //    video2.Port = Convert.ToInt32(txtCamera2Port.Text);
            //    video2.UserName = txtCamera2UserName.Text;
            //    video2.Password = txtCamera2Pwd.Text;
            //    video2.Channel = Convert.ToInt32(txtCamera2Channel.Text);
            //    commonDAO.SelfDber.Update(video2);
            //}
            //else
            //{
            //    video2 = new CmcsCamare();
            //    video2.Ip = iptxtCamera2IP.Value;
            //    video2.Port = Convert.ToInt32(txtCamera2Port.Text);
            //    video2.UserName = txtCamera2UserName.Text;
            //    video2.Password = txtCamera2Pwd.Text;
            //    video2.Channel = Convert.ToInt32(txtCamera2Channel.Text);
            //    video1.ParentId = "-1";
            //    commonDAO.SelfDber.Insert(video2);
            //}

            //жú¹µLED
            //commonDAO.SetCommonAppletConfig("жú¹µLEDÏÔʾÆÁ1_IPµØÖ·", iptxtUnloadLED1.Value);
            //commonDAO.SetCommonAppletConfig("жú¹µLEDÏÔʾÆÁ2_IPµØÖ·", iptxtUnloadLED2.Value);
            //commonDAO.SetCommonAppletConfig("жú¹µLEDÏÔʾÆÁ3_IPµØÖ·", iptxtUnloadLED3.Value);
            //commonDAO.SetCommonAppletConfig("жú¹µLEDÏÔʾÆÁ4_IPµØÖ·", iptxtUnloadLED4.Value);
            //commonDAO.SetCommonAppletConfig("жú¹µLEDÏÔʾÆÁ5_IPµØÖ·", iptxtUnloadLED5.Value);
            //commonDAO.SetCommonAppletConfig("жú¹µLEDÏÔʾÆÁ6_IPµØÖ·", iptxtUnloadLED6.Value);
            //commonDAO.SetCommonAppletConfig("жú¹µLEDÏÔʾÆÁ7_IPµØÖ·", iptxtUnloadLED7.Value);
            //commonDAO.SetCommonAppletConfig("жú¹µLEDÏÔʾÆÁ8_IPµØÖ·", iptxtUnloadLED8.Value);

            CmcsUnLoadLED unLoadLed = commonDAO.SelfDber.Entity <CmcsUnLoadLED>("where UnLoadNumber=1");
            if (unLoadLed != null)
            {
                unLoadLed.UnLoadName = txtUnload1Number.Text;
                unLoadLed.IP         = iptxtUnloadLED1.Value;
                commonDAO.SelfDber.Update(unLoadLed);
            }
            else
            {
                unLoadLed = new CmcsUnLoadLED();
                unLoadLed.UnLoadNumber = 1;
                unLoadLed.UnLoadName   = txtUnload1Number.Text;
                unLoadLed.IP           = iptxtUnloadLED1.Value;
                unLoadLed.IsUse        = 0;
                commonDAO.SelfDber.Insert(unLoadLed);
            }

            unLoadLed = commonDAO.SelfDber.Entity <CmcsUnLoadLED>("where UnLoadNumber=2");
            if (unLoadLed != null)
            {
                unLoadLed.UnLoadName = txtUnload2Number.Text;
                unLoadLed.IP         = iptxtUnloadLED2.Value;
                commonDAO.SelfDber.Update(unLoadLed);
            }
            else
            {
                unLoadLed = new CmcsUnLoadLED();
                unLoadLed.UnLoadNumber = 2;
                unLoadLed.UnLoadName   = txtUnload2Number.Text;
                unLoadLed.IP           = iptxtUnloadLED2.Value;
                unLoadLed.IsUse        = 0;
                commonDAO.SelfDber.Insert(unLoadLed);
            }

            unLoadLed = commonDAO.SelfDber.Entity <CmcsUnLoadLED>("where UnLoadNumber=3");
            if (unLoadLed != null)
            {
                unLoadLed.UnLoadName = txtUnload3Number.Text;
                unLoadLed.IP         = iptxtUnloadLED3.Value;
                commonDAO.SelfDber.Update(unLoadLed);
            }
            else
            {
                unLoadLed = new CmcsUnLoadLED();
                unLoadLed.UnLoadNumber = 3;
                unLoadLed.UnLoadName   = txtUnload3Number.Text;
                unLoadLed.IP           = iptxtUnloadLED3.Value;
                unLoadLed.IsUse        = 0;
                commonDAO.SelfDber.Insert(unLoadLed);
            }

            unLoadLed = commonDAO.SelfDber.Entity <CmcsUnLoadLED>("where UnLoadNumber=4");
            if (unLoadLed != null)
            {
                unLoadLed.UnLoadName = txtUnload4Number.Text;
                unLoadLed.IP         = iptxtUnloadLED4.Value;
                commonDAO.SelfDber.Update(unLoadLed);
            }
            else
            {
                unLoadLed = new CmcsUnLoadLED();
                unLoadLed.UnLoadNumber = 4;
                unLoadLed.UnLoadName   = txtUnload4Number.Text;
                unLoadLed.IP           = iptxtUnloadLED4.Value;
                unLoadLed.IsUse        = 0;
                commonDAO.SelfDber.Insert(unLoadLed);
            }

            unLoadLed = commonDAO.SelfDber.Entity <CmcsUnLoadLED>("where UnLoadNumber=5");
            if (unLoadLed != null)
            {
                unLoadLed.UnLoadName = txtUnload5Number.Text;
                unLoadLed.IP         = iptxtUnloadLED5.Value;
                commonDAO.SelfDber.Update(unLoadLed);
            }
            else
            {
                unLoadLed = new CmcsUnLoadLED();
                unLoadLed.UnLoadNumber = 5;
                unLoadLed.UnLoadName   = txtUnload5Number.Text;
                unLoadLed.IP           = iptxtUnloadLED5.Value;
                unLoadLed.IsUse        = 0;
                commonDAO.SelfDber.Insert(unLoadLed);
            }

            unLoadLed = commonDAO.SelfDber.Entity <CmcsUnLoadLED>("where UnLoadNumber=6");
            if (unLoadLed != null)
            {
                unLoadLed.UnLoadName = txtUnload6Number.Text;
                unLoadLed.IP         = iptxtUnloadLED6.Value;
                commonDAO.SelfDber.Update(unLoadLed);
            }
            else
            {
                unLoadLed = new CmcsUnLoadLED();
                unLoadLed.UnLoadNumber = 6;
                unLoadLed.UnLoadName   = txtUnload6Number.Text;
                unLoadLed.IP           = iptxtUnloadLED6.Value;
                unLoadLed.IsUse        = 0;
                commonDAO.SelfDber.Insert(unLoadLed);
            }

            unLoadLed = commonDAO.SelfDber.Entity <CmcsUnLoadLED>("where UnLoadNumber=7");
            if (unLoadLed != null)
            {
                unLoadLed.UnLoadName = txtUnload7Number.Text;
                unLoadLed.IP         = iptxtUnloadLED7.Value;
                commonDAO.SelfDber.Update(unLoadLed);
            }
            else
            {
                unLoadLed = new CmcsUnLoadLED();
                unLoadLed.UnLoadNumber = 7;
                unLoadLed.UnLoadName   = txtUnload7Number.Text;
                unLoadLed.IP           = iptxtUnloadLED7.Value;
                unLoadLed.IsUse        = 0;
                commonDAO.SelfDber.Insert(unLoadLed);
            }

            unLoadLed = commonDAO.SelfDber.Entity <CmcsUnLoadLED>("where UnLoadNumber=8");
            if (unLoadLed != null)
            {
                unLoadLed.UnLoadName = txtUnload8Number.Text;
                unLoadLed.IP         = iptxtUnloadLED8.Value;
                commonDAO.SelfDber.Update(unLoadLed);
            }
            else
            {
                unLoadLed = new CmcsUnLoadLED();
                unLoadLed.UnLoadNumber = 8;
                unLoadLed.UnLoadName   = txtUnload8Number.Text;
                unLoadLed.IP           = iptxtUnloadLED8.Value;
                unLoadLed.IsUse        = 0;
                commonDAO.SelfDber.Insert(unLoadLed);
            }

            return(true);
        }
Exemplo n.º 15
0
        /// <summary>
        /// 保存配置
        /// </summary>
        bool SaveAppConfig()
        {
            if (!TestDBConnect())
            {
                return(false);
            }

            if (!chkUseCamera.Checked && !chkUseRwer.Checked)
            {
                MessageBoxEx.Show("识别相机与读卡器必须启用一个", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(false);
            }

            commonAppConfig.AppIdentifier = txtAppIdentifier.Text.Trim();
            commonAppConfig.SelfConnStr   = txtSelfConnStr.Text;
            commonAppConfig.Save();
            commonDAO.SetAppletConfig("开机启动", Convert.ToInt16(chbStartup.Checked).ToString());
            commonDAO.SetAppletConfig("启用读卡器", Convert.ToInt16(chkUseRwer.Checked).ToString());
            commonDAO.SetAppletConfig("启用识别相机", Convert.ToInt16(chkUseCamera.Checked).ToString());

            commonDAO.SetAppletConfig("采样机设备编码", txtJxSamplerMachineCode.Text.Trim());

            try
            {
#if DEBUG
#else
                // 添加、取消开机启动
                if (chbStartup.Checked)
                {
                    StartUpUtil.InsertStartUp(Application.ProductName, Application.ExecutablePath);
                }
                else
                {
                    StartUpUtil.DeleteStartUp(Application.ProductName);
                }
#endif
            }
            catch { }

            // IO控制器
            commonDAO.SetAppletConfig("IO控制器_串口", (cmbIocerCom.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_波特率", (cmbIocerBandrate.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_数据位", (cmbIocerDataBits.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_停止位", (cmbIocerStopBits.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_校验位", (cmbIocerParity.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_地感1端口", (cmbInductorCoil1Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_地感2端口", (cmbInductorCoil2Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_地感3端口", (cmbInductorCoil3Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_地感4端口", (cmbInductorCoil4Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_对射1端口", (cmbInfraredSensor1Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_对射2端口", (cmbInfraredSensor2Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_道闸1升杆端口", (cmbGate1UpPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_道闸1降杆端口", (cmbGate1DownPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_道闸2升杆端口", (cmbGate2UpPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_道闸2降杆端口", (cmbGate2DownPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_信号灯1端口", (cmbSignalLight1Port.SelectedItem as DataItem).Value);

            // 读卡器
            commonDAO.SetAppletConfig("读卡器1_IP地址", txtRwer1IP.Value);
            commonDAO.SetAppletConfig("读卡器1_功率", (cmbRwer1Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("读卡器_标签过滤", txtRwerTagStartWith.Text);

            // LED显示屏
            commonDAO.SetAppletConfig("LED显示屏1_IP地址", iptxtLED1IP.Value);

            // 语音
            commonDAO.SetAppletConfig("语音包", (cmbVoiceName.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("语速", sldVoiceRate.Value.ToString());
            commonDAO.SetAppletConfig("音量", sldVoiceVolume.Value.ToString());

            return(true);
        }
Exemplo n.º 16
0
        /// <summary>
        /// 保存配置
        /// </summary>
        bool SaveAppConfig()
        {
            if (!TestDBConnect())
            {
                return(false);
            }

            commonAppConfig.AppIdentifier = txtAppIdentifier.Text.Trim();
            commonAppConfig.SelfConnStr   = txtSelfConnStr.Text;
            commonAppConfig.Save();
            commonDAO.SetAppletConfig("开机启动", Convert.ToInt16(chbStartup.Checked).ToString());
            commonDAO.SetAppletConfig("采样机编码", txtSampleMahineCode.Text);
            commonDAO.SetAppletConfig("上磅方向", (cmbDecrtion.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("启动采样", Convert.ToInt16(chk_Sampler.Checked).ToString());
            commonDAO.SetAppletConfig("启动过衡", Convert.ToInt16(chk_Use.Checked).ToString());
            commonDAO.SetAppletConfig("磅类型", (cmbPoundType.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("落杆延时", iptTiming.Text);
            try
            {
#if DEBUG
#else
                // 添加、取消开机启动
                if (chbStartup.Checked)
                {
                    StartUpUtil.InsertStartUp(Application.ProductName, Application.ExecutablePath);
                }
                else
                {
                    StartUpUtil.DeleteStartUp(Application.ProductName);
                }
#endif
            }
            catch { }

            // IO控制器
            commonDAO.SetAppletConfig("IO控制器_串口", (cmbIocerCom.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_波特率", (cmbIocerBandrate.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_数据位", (cmbIocerDataBits.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_停止位", (cmbIocerStopBits.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_校验位", (cmbIocerParity.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_地感1端口", (cmbInductorCoil1Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_地感2端口", (cmbInductorCoil2Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_地感3端口", (cmbInductorCoil3Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_地感4端口", (cmbInductorCoil4Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_对射1端口", (cmbInfraredSensor1Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_对射2端口", (cmbInfraredSensor2Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_道闸1升杆端口", (cmbGate1UpPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_道闸1降杆端口", (cmbGate1DownPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_道闸2升杆端口", (cmbGate2UpPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_道闸2降杆端口", (cmbGate2DownPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_信号灯1端口", (cmbSignalLight1Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_信号灯2端口", (cmbSignalLight2Port.SelectedItem as DataItem).Value);

            // 地磅仪表
            commonDAO.SetAppletConfig("地磅仪表_类型", (cmbWeberType.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("地磅仪表_串口", (cmbWberCom.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("地磅仪表_波特率", (cmbWberBandrate.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("地磅仪表_数据位", (cmbWberDataBits.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("地磅仪表_停止位", (cmbWberStopBits.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("地磅仪表_校验位", (cmbWberParity.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("地磅仪表_最小称重", dbtxtMinWeight.Value.ToString());

            // 读卡器
            commonDAO.SetAppletConfig("读卡器1_串口", (cmbRwer1Com.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("读卡器2_串口", (cmbRwer2Com.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("读卡器_标签过滤", txtRwerTagStartWith.Text);

            // LED显示屏
            commonDAO.SetAppletConfig("LED显示屏1_IP地址", iptxtLED1IP.Value);

            // 语音
            commonDAO.SetAppletConfig("语音包", (cmbVoiceName.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("语速", sldVoiceRate.Value.ToString());
            commonDAO.SetAppletConfig("音量", sldVoiceVolume.Value.ToString());

            return(true);
        }
Exemplo n.º 17
0
        /// <summary>
        /// 保存配置
        /// </summary>
        bool SaveAppConfig()
        {
            if (!TestDBConnect())
            {
                return(false);
            }

            commonAppConfig.AppIdentifier = txtAppIdentifier.Text.Trim();
            commonAppConfig.SelfConnStr   = txtSelfConnStr.Text;
            commonAppConfig.Save();
            commonDAO.SetAppletConfig("开机启动", Convert.ToInt16(chbStartup.Checked).ToString());

            try
            {
#if DEBUG
#else
                // 添加、取消开机启动
                if (chbStartup.Checked)
                {
                    StartUpUtil.InsertStartUp(Application.ProductName, Application.ExecutablePath);
                }
                else
                {
                    StartUpUtil.DeleteStartUp(Application.ProductName);
                }
#endif
            }
            catch { }

            commonDAO.SetAppletConfig("磅编号", intPoundIndex.Value.ToString());

            //公共配置
            commonDAO.SetCommonAppletConfig("自动打印磅单", Convert.ToInt16(chkAutoPrint.Checked).ToString());
            commonDAO.SetCommonAppletConfig("启用智能调运", Convert.ToInt16(chkITMS.Checked).ToString());
            commonDAO.SetCommonAppletConfig("启用证件到期", Convert.ToInt16(chkPaperWorkPass.Checked).ToString());
            commonDAO.SetCommonAppletConfig("启用出厂天线", Convert.ToInt16(chkOutFactoryITMS.Checked).ToString());
            commonDAO.SetCommonAppletConfig("采样通道车数", dbiSampleWayCount.Value.ToString());
            commonDAO.SetCommonAppletConfig("启用采样通道车数", Convert.ToInt16(chkSampleWayCount.Checked).ToString());
            commonDAO.SetCommonAppletConfig("厂内总车数", dbiFactoryCount.Value.ToString());
            commonDAO.SetCommonAppletConfig("启用厂内总车数", Convert.ToInt16(chkFactoryCount.Checked).ToString());
            commonDAO.SetCommonAppletConfig("净重超差限值", txtTicketDiff.Value.ToString());
            commonDAO.SetCommonAppletConfig("启用净重超差限值", Convert.ToInt16(chkTicketDiff.Checked).ToString());
            commonDAO.SetCommonAppletConfig("皮重排查系数", txtTareCoefficient.Value.ToString());
            commonDAO.SetCommonAppletConfig("启用皮重排查系数", Convert.ToInt16(chkTareCoefficient.Checked).ToString());

            // IO控制器
            commonDAO.SetAppletConfig("IO控制器_串口", (cmbIocerCom.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_波特率", (cmbIocerBandrate.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_数据位", (cmbIocerDataBits.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_停止位", (cmbIocerStopBits.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_校验位", (cmbIocerParity.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_地感1端口", (cmbInductorCoil1Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_地感2端口", (cmbInductorCoil2Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_地感3端口", (cmbInductorCoil3Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_地感4端口", (cmbInductorCoil4Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_道闸1升杆端口", (cmbGate1UpPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_道闸1降杆端口", (cmbGate1DownPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_道闸2升杆端口", (cmbGate2UpPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_道闸2降杆端口", (cmbGate2DownPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_信号灯1端口", (cmbSignalLight1Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_信号灯2端口", (cmbSignalLight2Port.SelectedItem as DataItem).Value);

            // 入厂读卡器
            commonDAO.SetAppletConfig("读卡器1_Ip", cmbRwer1Ip.Value);
            commonDAO.SetAppletConfig("读卡器1_端口", cmbRwer1Port.Value.ToString());

            // 出厂读卡器
            commonDAO.SetAppletConfig("读卡器2_Ip", cmbRwer2Ip.Value);
            commonDAO.SetAppletConfig("读卡器2_端口", cmbRwer2Port.Value.ToString());

            //室内发卡器
            commonDAO.SetAppletConfig("读卡器2_串口", (cmbRwer2Com.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("读卡器_标签过滤", txtRwerTagStartWith.Text);

            // LED显示屏
            commonDAO.SetAppletConfig("LED显示屏1_IP地址", iptxtLED1IP.Value);
            commonDAO.SetAppletConfig("LED显示屏2_IP地址", iptxtLED2IP.Value);

            // 语音
            commonDAO.SetAppletConfig("语音包", (cmbVoiceName.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("语速", sldVoiceRate.Value.ToString());
            commonDAO.SetAppletConfig("音量", sldVoiceVolume.Value.ToString());

            return(true);
        }
Exemplo n.º 18
0
        /// <summary>
        /// 保存配置
        /// </summary>
        bool SaveAppConfig()
        {
            if (!TestDBConnect())
            {
                return(false);
            }

            commonAppConfig.AppIdentifier = txtAppIdentifier.Text.Trim();
            commonAppConfig.SelfConnStr   = txtSelfConnStr.Text;
            commonAppConfig.Save();
            commonDAO.SetAppletConfig("开机启动", Convert.ToInt16(chbStartup.Checked).ToString());
            commonDAO.SetAppletConfig("双向磅", Convert.ToInt16(chbBothWay.Checked).ToString());
            commonDAO.SetAppletConfig("过磅类型", cmbInFactoryType.Text);

            try
            {
#if DEBUG
#else
                // 添加、取消开机启动
                if (chbStartup.Checked)
                {
                    StartUpUtil.InsertStartUp(Application.ProductName, Application.ExecutablePath);
                }
                else
                {
                    StartUpUtil.DeleteStartUp(Application.ProductName);
                }
#endif
            }
            catch { }

            // IO控制器
            commonDAO.SetAppletConfig("IO控制器_串口", (cmbIocerCom.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_波特率", (cmbIocerBandrate.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_数据位", (cmbIocerDataBits.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_停止位", (cmbIocerStopBits.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_校验位", (cmbIocerParity.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_地感1端口", (cmbInductorCoil1Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_地感2端口", (cmbInductorCoil2Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_地感3端口", (cmbInductorCoil3Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_地感4端口", (cmbInductorCoil4Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_对射1端口", (cmbInfraredSensor1Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_对射2端口", (cmbInfraredSensor2Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_道闸1升杆端口", (cmbGate1UpPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_道闸1降杆端口", (cmbGate1DownPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_道闸2升杆端口", (cmbGate2UpPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_道闸2降杆端口", (cmbGate2DownPort.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_信号灯1端口", (cmbSignalLight1Port.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("IO控制器_信号灯2端口", (cmbSignalLight2Port.SelectedItem as DataItem).Value);

            // 地磅仪表
            commonDAO.SetAppletConfig("地磅仪表_串口", (cmbWberCom.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("地磅仪表_波特率", (cmbWberBandrate.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("地磅仪表_数据位", (cmbWberDataBits.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("地磅仪表_停止位", (cmbWberStopBits.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("地磅仪表_校验位", (cmbWberParity.SelectedItem as DataItem).Value);
            commonDAO.SetAppletConfig("地磅仪表_最小称重", dbtxtMinWeight.Value.ToString());
            commonDAO.SetAppletConfig("地磅仪表_稳定时间", dbtxtSteady.Value.ToString());
            commonDAO.SetAppletConfig(GlobalVars.CommonAppletConfigName, "地磅仪表_毛皮差", dbtxtGrossLossTare.Value.ToString());
            // 读卡器
            commonDAO.SetAppletConfig("车号识别1_IP地址", iptxtRwer1.Value);
            commonDAO.SetAppletConfig("车号识别2_IP地址", iptxtRwer2.Value);

            // LED显示屏
            commonDAO.SetAppletConfig("LED显示屏1_IP地址", iptxtLED1IP.Value);
            commonDAO.SetAppletConfig("LED显示屏2_IP地址", iptxtLED2IP.Value);
            commonDAO.SetAppletConfig("LED显示屏类型", (cmbLEDType.SelectedItem as DataItem).Value);
            return(true);
        }