Exemple #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);
            }
        }
Exemple #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;
     }
 }
Exemple #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);
        }
Exemple #4
0
 public int NetworkUpDate(string strDBMethod, LISCommunicateNetworkInfo lISCommunicateInfo)
 {
     return(myBatis.UpdateLISCommunicateNetworkInfo(strDBMethod, lISCommunicateInfo));
 }
Exemple #5
0
        private void btnLink_Click(object sender, EventArgs e)
        {
            string message1 = txtServerIP.Text.Trim();
            string message2 = txtPort.Text.Trim();
            int    result;

            if (message1 != string.Empty)
            {
                if (isNumberic(message2, out result))
                {
                }
                else
                {
                    MessageBoxDraw.ShowMsg("端口号输入有误,请重新输入!", MsgType.Exception);
                    return;
                }
            }
            else
            {
                MessageBoxDraw.ShowMsg("请输入服务器IP地址!", MsgType.Exception);
                return;
            }

            LISCommunicateNetworkInfo lISCommunicateNetworkInfo = new LISCommunicateNetworkInfo();

            lISCommunicateNetworkInfo.IPAddress   = txtServerIP.Text;
            lISCommunicateNetworkInfo.NetworkPort = txtPort.Text;
            if (chkTestResults.Checked == true)
            {
                lISCommunicateNetworkInfo.RealTimeSendResult = true;
            }
            else
            {
                lISCommunicateNetworkInfo.RealTimeSendResult = false;
            }
            if (chkDisconnectAutoReconnect.Checked == true)
            {
                lISCommunicateNetworkInfo.Reconnection = true;
            }
            else
            {
                lISCommunicateNetworkInfo.Reconnection = false;
            }
            if (chkBootAutoLinkLISServe.Checked == true)
            {
                lISCommunicateNetworkInfo.StartingUp = true;
            }
            else
            {
                lISCommunicateNetworkInfo.StartingUp = false;
            }

            if (lISCommunicateNetworkInfo != null)
            {
                //CommunicationEntity NetworkcommunicationEntity = new CommunicationEntity();
                //NetworkcommunicationEntity.StrmethodName = "NetworkLISCommunicateUpDate";
                //NetworkcommunicationEntity.ObjParam = XmlUtility.Serializer(typeof(LISCommunicateNetworkInfo), lISCommunicateNetworkInfo);
                lisCommDic.Clear();
                //修改IP/TCP参数信息
                lisCommDic.Add("NetworkLISCommunicateUpDate", new object[] { XmlUtility.Serializer(typeof(LISCommunicateNetworkInfo), lISCommunicateNetworkInfo) });
                LISCommunicateLoad(lisCommDic);
            }
        }