Exemplo n.º 1
0
        /// <summary>
        /// 更新LIS常规设置信息和网络设置信息或者串口设置信息
        /// </summary>
        /// <param name="obj"></param>
        public void UpdateLISSetingAndNetworkORSerialInfo(object[] obj)
        {
            LISSettingInfo            lisSet  = obj[0] as LISSettingInfo;
            SerialCommunicationInfo   serial  = obj[1] as SerialCommunicationInfo;
            LISCommunicateNetworkInfo network = obj[2] as LISCommunicateNetworkInfo;

            try
            {
                //修改LIS常规设置信息
                ism_SqlMap.Update("LISCommunicateInfo.updateLISInfo", string.Format("update LISSettingtb set CommunicationMode = '{0}',CommunicationDirection = '{1}',CommunicationOverTime = {2},RealTiimeSampleResults = '{3}'", lisSet.CommunicationMode, lisSet.CommunicationDirection, lisSet.CommunicationOverTime, lisSet.RealTiimeSampleResults));
                if (serial != null)
                {
                    //修改串口设置信息
                    ism_SqlMap.Update("LISCommunicateInfo.updateLISInfo", string.Format("update SerialCommunicationTb set SerialName = '{0}',BaudRate = {1},DataBits = {2},StopBits = '{3}',Parity = '{4}'", serial.SerialName, serial.BaudRate, serial.DataBits, serial.StopBits, serial.Parity));
                }
                else
                {
                    //修改网络设置信息
                    ism_SqlMap.Update("LISCommunicateInfo.updateLISInfo", string.Format("update NetworkCommunicationTb set IPAddress = '{0}',NetworkPort = '{1}'", network.IPAddress, network.NetworkPort));
                }
            }
            catch (Exception ex)
            {
                LogInfo.WriteErrorLog("void UpdateLISSetingAndNetworkORSerialInfo(object[] obj) ==" + ex.ToString(), Module.LISSetting);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 页面加载
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public void LISSetting_Load(object sender, EventArgs e)
 {
     this.cboSerialPort.Properties.Items.AddRange(SerialPort.GetPortNames());
     object[] lis = service.QueryLISSettingInfo() as object[];
     if (lis[0] as LISSettingInfo == null)
     {
         this.comBoxCommMode.SelectedIndex      = 0;
         this.comBoxCommDirection.SelectedIndex = 0;
     }
     else
     {
         LISSettingInfo lisSetting = lis[0] as LISSettingInfo;
         this.comBoxCommMode.SelectedIndex      = this.comBoxCommMode.Properties.Items.IndexOf(lisSetting.CommunicationMode);
         this.comBoxCommDirection.SelectedIndex = this.comBoxCommDirection.Properties.Items.IndexOf(lisSetting.CommunicationDirection);
         this.txtCommOverTime.Text       = lisSetting.CommunicationOverTime.ToString();
         this.checkBoxSampResult.Checked = lisSetting.RealTiimeSampleResults;
     }
     if (lis[1] as SerialCommunicationInfo == null)
     {
         this.cboSerialPort.SelectedIndex = 0;
         this.cboBaudRate.SelectedIndex   = 0;
         this.cboDataBit.SelectedIndex    = 0;
         this.cboStopBits.SelectedIndex   = 0;
         this.cboParity.SelectedIndex     = 0;
     }
     else
     {
         SerialCommunicationInfo lisSerial = lis[1] as SerialCommunicationInfo;
         this.cboSerialPort.SelectedIndex = this.cboSerialPort.Properties.Items.IndexOf(lisSerial.SerialName);
         this.cboBaudRate.SelectedIndex   = this.cboBaudRate.Properties.Items.IndexOf(lisSerial.BaudRate.ToString());
         this.cboDataBit.SelectedIndex    = this.cboDataBit.Properties.Items.IndexOf(lisSerial.DataBits.ToString());
         this.cboStopBits.SelectedIndex   = this.cboStopBits.Properties.Items.IndexOf(lisSerial.StopBits);
         this.cboParity.SelectedIndex     = this.cboParity.Properties.Items.IndexOf(lisSerial.Parity);
     }
     if (lis[2] as LISCommunicateNetworkInfo == null)
     {
     }
     else
     {
         LISCommunicateNetworkInfo lisNteWork = lis[2] as LISCommunicateNetworkInfo;
         this.txtServerIP.Text = lisNteWork.IPAddress;
         this.txtPort.Text     = lisNteWork.NetworkPort;
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// 应用
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            object[]       LISSettingList = new object[3];
            LISSettingInfo lisSetting     = new LISSettingInfo();

            lisSetting.CommunicationMode      = this.comBoxCommMode.Text;
            lisSetting.CommunicationDirection = this.comBoxCommDirection.Text;
            lisSetting.CommunicationOverTime  = Convert.ToInt32(this.txtCommOverTime.Text == "" ? "1":txtCommOverTime.Text);
            lisSetting.RealTiimeSampleResults = this.checkBoxSampResult.Checked;
            LISSettingList[0] = lisSetting;
            if (this.comBoxCommMode.Text == "串口")
            {
                SerialCommunicationInfo lisSerialCommInfo = new SerialCommunicationInfo();
                lisSerialCommInfo.SerialName = this.cboSerialPort.Text;
                lisSerialCommInfo.BaudRate   = Convert.ToInt32(this.cboBaudRate.Text);
                lisSerialCommInfo.DataBits   = Convert.ToInt32(this.cboDataBit.Text);
                lisSerialCommInfo.StopBits   = this.cboStopBits.Text;
                lisSerialCommInfo.Parity     = this.cboParity.Text;
                LISSettingList[1]            = lisSerialCommInfo;
            }
            else
            {
                LISCommunicateNetworkInfo lisCommNetwork = new LISCommunicateNetworkInfo();
                lisCommNetwork.IPAddress   = this.txtServerIP.Text;
                lisCommNetwork.NetworkPort = this.txtPort.Text;
                LISSettingList[2]          = lisCommNetwork;
            }
            service.UpdateLISSetingAndNetworkORSerialInfo(LISSettingList);

            if (LISApplyEvent != null)
            {
                LISApplyEvent();
            }

            button2_Click(null, null);
        }
Exemplo n.º 4
0
 public int SerialUpDate(string strDBMethod, SerialCommunicationInfo serialCommunicationInfo)
 {
     return(myBatis.UpdateLISCommunicateSerialInfo(strDBMethod, serialCommunicationInfo));
 }
Exemplo n.º 5
0
        private void simpleButton2_Click(object sender, EventArgs e)
        {
            SerialCommunicationInfo serialCommunicationInfo = new SerialCommunicationInfo();

            if (cboSerialPort.SelectedIndex < 0)
            {
                MessageBoxDraw.ShowMsg("请选择串口!", MsgType.Warning);
                return;
            }


            string message1 = txtCommunicateTime.Text.Trim();
            string message2 = txtReConnectTime.Text.Trim();
            int    result;

            if (message1 != "")
            {
                if (isNumberic(message1, out result))
                {
                    serialCommunicationInfo.CommunicateionOvertime = (float)Convert.ToDouble(txtCommunicateTime.Text);
                }
                else
                {
                    MessageBoxDraw.ShowMsg("您的输入有误,请重新输入!", MsgType.Warning);
                    return;
                }
            }
            if (message2 != "")
            {
                if (isNumberic(message2, out result))
                {
                    serialCommunicationInfo.ReConnectionTime = (float)Convert.ToDouble(txtReConnectTime.Text);
                }
                else
                {
                    MessageBoxDraw.ShowMsg("您的输入有误,请重新输入!", MsgType.Warning);
                    return;
                }
            }



            serialCommunicationInfo.SerialName = cboSerialPort.Text;
            serialCommunicationInfo.BaudRate   = Convert.ToInt32(cboBaudRate.Text);
            serialCommunicationInfo.DataBits   = Convert.ToInt32(cboDataBit.Text);
            serialCommunicationInfo.StopBits   = cboStopBits.Text;
            serialCommunicationInfo.Parity     = cboParity.Text;
            //serialCommunicationInfo.CommunicateionType= textEdit8.Text ;

            if (checkEdit1.Checked == true)
            {
                serialCommunicationInfo.RealTimeSendResult = true;
            }
            else
            {
                serialCommunicationInfo.RealTimeSendResult = false;
            }

            if (checkEdit2.Checked == true)
            {
                serialCommunicationInfo.Reconnection = true;
            }
            else
            {
                serialCommunicationInfo.Reconnection = false;
            }
            if (checkEdit3.Checked == true)
            {
                serialCommunicationInfo.StartingUp = true;
            }
            else
            {
                serialCommunicationInfo.StartingUp = false;
            }
            CommunicationEntity NetworkcommunicationEntity = new CommunicationEntity();

            if (serialCommunicationInfo != null)
            {
                //NetworkcommunicationEntity.StrmethodName = "SerialLISCommunicateUpDate";
                //NetworkcommunicationEntity.ObjParam = XmlUtility.Serializer(typeof(SerialCommunicationInfo), serialCommunicationInfo);
                lisCommDic.Clear();
                //修改串口参数信息
                lisCommDic.Add("SerialLISCommunicateUpDate", new object[] { XmlUtility.Serializer(typeof(SerialCommunicationInfo), serialCommunicationInfo) });
                LISCommunicateLoad(lisCommDic);
            }
        }