示例#1
0
 private void btnTest_Click(object sender, EventArgs e)
 {
     if (PortName.SelectedItem == null || BaudRate.SelectedItem == null)
     {
         UMessageBox.Show("请选择串口号和波特率!", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     else
     {
         WaitWin.Show(this, "正在测试,请稍后。。。。。。");
         CDMASMS.Close();
         CDMASMS.Set(PortName.SelectedItem.ToString(), Convert.ToInt32(BaudRate.SelectedItem.ToString()));
         if (CDMASMS.Open())
         {
             string TSX             = CDMASMS.SendAT("AT^MEID").Replace("\r\n", "").Replace("OK", "");
             string production_Name = CDMASMS.SendAT("AT+CGMM").Replace("\r\n", "").Replace("OK", "");
             if (TSX.Length == 14 && production_Name.IndexOf("MC323") != -1)
             {
                 WaitWin.Close();
                 UMessageBox.Show("测试通过,请保存后重启系统。", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             else
             {
                 WaitWin.Close();
                 UMessageBox.Show("测试未通过,请重试!", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
         }
         else
         {
             WaitWin.Close();
             UMessageBox.Show("测试未通过,请重试!", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
 }
示例#2
0
 private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     this.Focus();
     WaitWin.Show(this, "正在关闭,请稍后。。。。。。");
     if (_isOpen == true)
     {
         Cef.Shutdown();
     }
     if (_isOpen != false)
     {
         CDMASMS.Close();
     }
     WaitWin.Close();
 }
示例#3
0
        private void GetDeviceMsg()
        {
            string content = CDMASMS.GetDeviceMsg();

            if (content != null)
            {
                string[] str = content.Split(';');
                DeviceName.Text      = str[1].Replace("Manufacturer:", "");
                DeviceModel.Text     = str[2].Replace("Model:", "");
                HardwareVersion.Text = str[8].Replace("^HWVER:", "");
                SoftwareVersion.Text = str[3].Replace("Revision:", "");
                CardNo.Text          = str[9];
                Signal.Text          = str[10].Replace("+CSQ:", "").Split(',')[0];
            }
        }
示例#4
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     this.timer1.Stop();
     if (SerialPort.GetPortNames().Length != 0)
     {
         //读取配置文件
         string portName = ReadWriteXml.ReadXml("PortName");
         string baudRate = ReadWriteXml.ReadXml("BaudRate");
         CDMASMS.Set(portName, Convert.ToInt32(baudRate));
         if (CDMASMS.Open())
         {
             string TSX             = CDMASMS.SendAT("AT^MEID").Replace("\r\n", "").Replace("OK", "");
             string production_Name = CDMASMS.SendAT("AT+CGMM").Replace("\r\n", "").Replace("OK", "");
             if (TSX.Length == 14 && production_Name.IndexOf("MC323") != -1)
             {
                 TSX = SysFunction.GetSecurit(TSX.Remove(3, 5));
                 if (tsx.Equals(TSX))
                 {
                     string netstat = CDMASMS.SendAT("AT+CREG?").Replace("\r\n", "").Replace("OK", "");
                     if (netstat.Split(',')[1] == "1")
                     {
                         if (ReadWriteRegistry.ReadRegistry("isInvalid") == null)
                         {
                             ReadWriteRegistry.WriteRegistry("isInvalid", "false");
                         }
                         if (ReadWriteRegistry.ReadRegistry("isInvalid") == "true")
                         {
                             this.DialogResult = DialogResult.Abort;
                         }
                         else
                         {
                             CDMASMS.DeviceInitialize();
                             this.DialogResult = DialogResult.OK;
                         }
                         this.Close();
                     }
                     else
                     {
                         UMessageBox.Show("未注册到本地网络!", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error);
                         CDMASMS.Close();
                         this.Close();
                     }
                 }
                 else
                 {
                     UMessageBox.Show("硬件不匹配!", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     CDMASMS.Close();
                     this.Close();
                 }
             }
             else
             {
                 UMessageBox.Show("串口打开失败,请在系统设置中重新配置串口数据。", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 this.DialogResult = DialogResult.No;
                 this.Close();
             }
         }
         else
         {
             UMessageBox.Show("串口打开失败,请在系统设置中重新配置串口数据。", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error);
             this.DialogResult = DialogResult.No;
             this.Close();
         }
     }
     else
     {
         UMessageBox.Show("读取硬件信息失败!请确认硬件设备连接正确。", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error);
         CDMASMS.Close();
         this.Close();
     }
 }
示例#5
0
 private void SenAlarmMsg(string msg, string report_Time, string realName)
 {
     CDMASMS.SendCHNSms(msg + ":地点:" + place + ",发生时间:" + time, phone);
     userLogHelper.InsertUserLog(report_Time, "处理" + msg, CommonClass.UserName, DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"), realName);
 }
示例#6
0
        /// <summary>
        /// 处理信息
        /// </summary>
        private void DisposeMsg(CSPNType type)
        {
            switch (type)
            {
            case CSPNType.AlarmInfo:
                switch (well_State_ID)
                {
                case 2:
                    SenAlarmMsg("报警信息", time, realName);
                    break;

                case 3:
                    SenAlarmMsg("状态信息(低电量报警)", time, realName);
                    break;

                case 4:
                    SenAlarmMsg("状态信息(烟感报警)", time, realName);
                    break;

                case 5:
                    SenAlarmMsg("状态信息(烟感低电量报警)", time, realName);
                    break;
                }
                wellStateService.UpdateWellCurrentStateInfo(7, terminal_ID);
                wellInfoService.UpdateReportInfo_Pending(1, terminal_ID);
                wellInfoService.UpdateReportInfo_Send(7, terminal_ID);
                GetSMS.UpdateMap(terminal_ID);
                if (refreshMessageDelegate != null)
                {
                    refreshMessageDelegate();
                }
                break;

            case CSPNType.DisposeInfo:
                switch (well_State_ID)
                {
                //case 2:
                //    UpdateDisposeMsg("报警信息", time, realName);
                //    break;
                //case 3:
                //    UpdateDisposeMsg("状态信息(低电量报警)", time, realName);
                //    break;
                //case 4:
                //    UpdateDisposeMsg("状态信息(烟感报警)", time, realName);
                //    break;
                //case 5:
                //    UpdateDisposeMsg("状态信息(烟感低电量报警)", time, realName);
                //    break;
                case 7:
                    UpdateDisposeMsg("报警信息", time, realName);
                    break;
                }
                wellStateService.UpdateWellCurrentStateInfo(1, terminal_ID);
                wellInfoService.UpdateReportInfo_Send(1, terminal_ID);
                GetSMS.UpdateMap(terminal_ID);
                break;

            case CSPNType.NotReportInfo:
                CDMASMS.SendCHNSms(string.Format("位于:{0}的{1}已经{2}天或超过{2}天未发送信息。", place, terminal_Name, ReadWriteXml.ReadXml("NotReportTimes")), phone);
                wellInfoService.Empty_NotReportNumInfo(terminal_ID);
                userLogHelper.InsertUserLog(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"), "处理未上报信息。", CommonClass.UserName, null, null);
                break;
            }
        }