/// <summary> /// 获取语音设置 /// </summary> /// <param name="sql"></param> /// <returns></returns> public static VoiceCalls GetVoice(string sql) { DataSet dataset = LinQBaseDao.Query(sql); VoiceCalls vc = new VoiceCalls(); foreach (DataRow dr in dataset.Tables[0].Rows) { vc.VoiceCalls_ID = int.Parse(dr["VoiceCalls_ID"].ToString()); vc.VoiceCalls_Number = int.Parse(dr["VoiceCalls_Number"].ToString()); vc.VoiceCalls_Content = dr["VoiceCalls_Content"].ToString(); vc.VoiceCalls_PositionName = dr["VoiceCalls_PositionName"].ToString(); vc.VoiceCalls_PositionValue = dr["VoiceCalls_PositionValue"].ToString(); vc.VoiceCalls_Remark = dr["VoiceCalls_Remark"].ToString(); } return(vc); }
/// <summary> /// 添加一条数据 /// </summary> /// <param name="pLED">LED实体</param> /// <returns>返回执行结果 true or false</returns> public static bool InsertVoiceCalls(VoiceCalls vc) { bool rbool = false; using (DCCarManagementDataContext dc = new DCCarManagementDataContext()) { try { rbool = LinQBaseDao.InsertOne <VoiceCalls>(dc, vc); } catch { rbool = false; } finally { dc.Connection.Close(); } } return(rbool); }
private void GetData() { try { if (CommonalityEntity.isvoic) { if (pv.PositionVoice_Content.ToString().Length > 0) { string sbSpeak = string.Empty; sbSpeak += "请," + this.lvwUserList.SelectedRows[0].Cells["Queue_Id"].Value.ToString() + "," + GetNumberGbkString(lvwUserList.SelectedRows[0].Cells["QueueCarNumber"].Value.ToString()) + ","; string str = lvwUserList.SelectedRows[0].Cells["QueueShortNumber"].Value.ToString();//排队号 sbSpeak += GetNumberGbkString(str.Substring(str.Length - 4)); sbSpeak += ",进,"; sbSpeak += GetNumberGbkString(comboxDriveway.Text.Replace("#", "号")); //呼叫准备车辆数量 _LEDShowNumber = Convert.ToInt32(combox_LEDShowNumber.Text.Trim()); int number = _LEDShowNumber; //呼叫提示下一辆车 string strslq = " select top(" + number + ") * from View_LEDShow_zj where sortnumberinfo_state='启动' and 车辆类型='" + _carType + "' and CarInfo_State='启动' and 通行状态='排队中' and 排队号 <> '' order by sortnumberinfo_ID"; dtsortnumber = LinQBaseDao.Query(strslq).Tables[0]; //正常呼叫时呼叫准备入厂车辆,异常不呼叫准备车辆 if (!isUnusual) { if (dtsortnumber.Rows.Count > 1) { for (int i = 0; i < number; i++) { if (i <= dtsortnumber.Rows.Count - 1) { sbSpeak += ",请," + GetNumberGbkString(dtsortnumber.Rows[i]["排队号"].ToString().Substring(str.Length - 4)) + ",做准备"; } } } } //将呼叫内容保存到呼叫表中 VoiceCalls vc = new VoiceCalls(); vc.VoiceCalls_Content = sbSpeak; vc.VoiceCalls_Number = pv.PositionVoice_Count; vc.VoiceCalls_PositionName = SystemClass.PositionName; vc.VoiceCalls_PositionValue = SystemClass.PosistionValue; if (isUnusual) { vc.VoiceCalls_Remark = "异常呼叫"; } else { vc.VoiceCalls_Remark = ""; } vc.VoiceCalls_Time = CommonalityEntity.GetServersTime(); vc.VoiceCalls_ISVice = false; if (VoiceCallsDAL.InsertVoiceCalls(vc)) { CommonalityEntity.ishujiao = false; Commons.CommonClass.VoiceReade.readCount = SystemClass.HuJiaoCount; Commons.CommonClass.VoiceReade.readTxt = sbSpeak; Thread myThread = new Thread(new ThreadStart(read)); myThread.Priority = ThreadPriority.Highest; myThread.Start(); if (myThread.IsAlive) { } } else { MessageBox.Show("呼叫失败!"); } } } } catch { CommonalityEntity.WriteTextLog("QueueForm GetData()"); } }