mfm1992

来自「一个基于五岳鑫语音卡的语音系统,对开发语音系统的人来说有借鉴作用」· 代码 · 共 1,407 行 · 第 1/3 页

TXT
1,407
字号
	pCh->nPlayCount = -1;
	pCh->strSentence = "";
	pCh->strSentence += CN_ERR;
	TV_PlaySentence(pCh->nChNo,(unsigned char *)(LPCSTR)pCh->strSentence);
	pCh->bOnPlay = TRUE;
	GetListCtrl().SetItemText(pCh->nChNo,2,"提示ID输入错误");
}
#define VPATH1 ".\\yy_back\\"

void CSbcxView::GetYyId(CH_STRUCT *pCh)//得到预约号
{
	if(ChHangUp(pCh)) return;
	if(TV_TimerElapsed(pCh->nChNo) == -1)
	{
		pCh->nWS = WS_WAITCALL;
		if(pCh->nChType == CT_EXTERNAL) TV_HangUpCtrl(pCh->nChNo);
		GetListCtrl().SetItemText(pCh->nChNo,2,"等待呼入");
		GetListCtrl().SetItemText(pCh->nChNo,3,"");
		return;
	}
	
	int nChar = TV_GetDTMFChar(pCh->nChNo);
	if(nChar == -1) return;
	if(nChar >= '0' && nChar <= '9')
	{
		pCh->stryyid += nChar;return;
	}
	if (nChar == '*'){
			if(pCh->bOnPlay)
		{
			TV_StopPlayFile(pCh->nChNo);
			pCh->bOnPlay = FALSE;
		}
		pCh->nWS = WS_DOMENU1;
		GetListCtrl().SetItemText(pCh->nChNo,2,"提示选择功能");
		pCh->strSentence = "";
		pCh->strSentence += CN_VMENU1;
		TV_PlaySentence(pCh->nChNo,(unsigned char *)(LPCSTR)pCh->strSentence);
		pCh->bOnPlay = TRUE;
		return;
	}
	if(nChar == '#')
	{
		CSbcxDoc*  pDoc = GetDocument();
		CString strSQL;
	if(!pDoc->ConnectDb())
	{
		AfxMessageBox("无法连接数据库,程序停止运行");	
	}
	CString fname,path,result;
	CString ls_month,ls_date,ls_hou,ls_min,ls_morning;
	char buff[20];//buff1[20];
////	unsigned char  buff_month[20],buff_date[20],buff_hou[20],buff_min[20];
	CString money1,bz;
	CString money;
///	double ld_month,ld_date,ld_hou,ld_min;
	CRecordset rs( &pDoc->m_sainfor);
	rs.Open( CRecordset::forwardOnly,_T( "SELECT * FROM u_backyy WHERE yyid ='" + pCh->stryyid + "'" ) );
	if (rs.GetRecordCount( ) == 0){
		pCh->strSentence = "";
		pCh->strSentence = CN_NO;
		TV_PlaySentence(pCh->nChNo,(unsigned char *)(LPCSTR)pCh->strSentence);
	
		GetListCtrl().SetItemText(pCh->nChNo,2,"预约还未处理");
		pCh->strSentence += CN_VMENU1;
		pCh->nWS = WS_DOMENU1;
		GetListCtrl().SetItemText(pCh->nChNo,2,"提示选择功能");
		pCh->bOnPlay = TRUE;

	}else{
		//////////////////////////
		rs.GetFieldValue(4,fname);
		pCh->strSentence = fname;
		sprintf(buff,"%s",fname);
		////////////////////////////
/*		rs.GetFieldValue(1,fname);
		rs.GetFieldValue(2,ls_month);
		rs.GetFieldValue(3,ls_date);
		rs.GetFieldValue(4,ls_morning);
		rs.GetFieldValue(5,ls_hou);
		rs.GetFieldValue(6,ls_min);
		sprintf(buff,"%s",fname);
		TV_SetVoicei(CN_PUB,buff);
		pCh->strSentence = "";
		if (fname == ""){
			pCh->strSentence = CN_PUB;//不接受预约
		}else{
			if (ls_morning == '0'){
				TV_SetVoicei(CN_MORNING,VPATH1"resu.tw");		//上午
			}else TV_SetVoicei(CN_MORNING,VPATH1"resu.tw");		//下午
			pCh->strSentence += CN_RUS;
			pCh->strSentence += CN_PUB;
			ld_month = atof((const char *)ls_month);
			ld_date = atof((const char *)ls_date);
			ld_hou = atof((const char *)ls_hou);
			ld_min = atof((const char *)ls_min);
			TV_MakeSentence(ld_month,buff_month);
			TV_MakeSentence(ld_date,buff_date);
			TV_MakeSentence(ld_hou,buff_hou);
			TV_MakeSentence(ld_min,buff_min);
			pCh->strSentence += (const char *)buff_month;
			pCh->strSentence += CN_MH;
			pCh->strSentence += (const char *)buff_date;
			pCh->strSentence += CN_DD;
			pCh->strSentence += CN_MORNING;
			pCh->strSentence += (const char *)buff_hou;
			pCh->strSentence += CN_HH;
			pCh->strSentence += (const char *)buff_min;
			pCh->strSentence += CN_MM;
		}*/
		
//		TV_PlaySentence(pCh->nChNo,(unsigned char *)(LPCSTR)pCh->strSentence);
//		pCh->bOnPlay = TRUE;
//		pCh->strSentence += CN_VMENU1;
//		pCh->nWS = WS_DOMENU1;
//		GetListCtrl().SetItemText(pCh->nChNo,2,"提示选择功能");
		pCh->nWS = WS_READBACKYY;
		pCh->nPlayCount = 0;
		TV_StartPlayChFile(pCh->nChNo,(char *)(LPCSTR)fname);
		pCh->bOnPlay = TRUE;
		pCh->bPlayCh = TRUE;
		
	}
			return;
		
	}
	pCh->strSentence = "";
	pCh->strSentence += CN_ERR;
	TV_PlaySentence(pCh->nChNo,(unsigned char *)(LPCSTR)pCh->strSentence);
	pCh->bOnPlay = TRUE;
	pCh->nPlayCount = -1;
	pCh->nWS = WS_INYYID;
	GetListCtrl().SetItemText(pCh->nChNo,2,"提示ID输入错误");
}

void CSbcxView::TsBack(CH_STRUCT *pCh)
{
	char buff[100];
	if(ChHangUp(pCh)) return;
//	buff = "";
	if(pCh->bOnPlay)
	{
		if(TV_PlayChFileRest(pCh->nChNo) <= 0)
		{
			pCh->bOnPlay = FALSE;
			pCh->nPlayCount ++;
			TV_StartTimer(pCh->nChNo,1);
		}

	}else{
		if(TV_TimerElapsed(pCh->nChNo) == -1)
		{
			if(pCh->nPlayCount >= 2)
			{
				if(pCh->nChType == CT_EXTERNAL)
				TV_HangUpCtrl(pCh->nChNo);
				pCh->nWS = WS_WAITCALL;
			//	pCh->strSentence = "";
			//	pCh->strSentence += CN_VMENU1;
				GetListCtrl().SetItemText(pCh->nChNo,2,"等待呼入");
			//	TV_PlaySentence(pCh->nChNo,(unsigned char *)(LPCSTR)pCh->strSentence);
			//	pCh->bOnPlay = TRUE;
			//	return;
			}else{
				if(pCh->nPlayCount == 0){
					//pCh->strSentence = "";
					//pCh->strSentence += CN_VMENU1;
					GetListCtrl().SetItemText(pCh->nChNo,2,"播放回复");
					sprintf(buff,"%s",pCh->strSentence);
				}
				TV_StartPlayChFile(pCh->nChNo,(char *)(LPCSTR)pCh->strSentence);
				pCh->bOnPlay = TRUE;
			}
		}
	}
}

void CSbcxView::YyBack(CH_STRUCT *pCh)//播放预约或投诉回复结果
{
//	char buff[100];
	if(ChHangUp(pCh)) return;
	ipCh->nChNo,2,"提示选择功能");
		pCh->strSentence = "";
		pCh->strSentence += CN_VMENU1;	
		TV_PlaySentence(pCh->nChNo,(unsigned char *)(LPCSTR)pCh->strSentence);
		
		pCh->bOnPlay = TRUE;
		pCh->nPlayCount = 0;
		return;
	}
	if (nChar == '0'|| nChar == '1' || nChar == '2'|| nChar == '3'|| nChar == '4'|| nChar == '5'|| nChar == '6'|| nChar == '7'|| nChar == '8'|| nChar == '9')
	{
Play: if (pDoc->GetData_next_2(ch,nChar) == '0'){
		pCh->nWS = WS_VOICE_PUBLIC_2;
		GetListCtrl().SetItemText(pCh->nChNo,2,ls_decr + "内容");
	  }else if (pDoc->GetData_next_2(ch,nChar) == '1'){
/*		pCh->nWS = WS_PLAYING_2;
		GetListCtrl().SetItemText(pCh->nChNo,2,ls_decr + "提示");
		CString ls_ch,ls_tel;
		ls_tel.Format("%d",nChar);
		if (j == 0) {
			ls_ch = '1' + ch + ls_tel;
		}else ls_ch = ch + ls_tel;
		m_curr_Tele_no = atoi(ls_ch);*/
		  goto Err;
	  }
		sprintf(v_c,"%s",v_s);
		TV_SetVoicei(CN_PUBLIC,v_c);
		pCh->strSentence = "";
		pCh->strSentence = CN_PUBLIC;
		pCh->strSentence += CN_RETURN;			
		pCh->bOnPlay = TRUE;
		TV_PlaySentence(pCh->nChNo,(unsigned char *)(LPCSTR)pCh->strSentence);
		return;
	}
		Err:	pCh->strSentence = "";
				pCh->strSentence += CN_ERR;
				pCh->strSentence += CN_PUBLIC;
				GetListCtrl().SetItemText(pCh->nChNo,2,"提示输入错误,重新选择");
				pCh->nPlayCount = -1;
				TV_PlaySentence(pCh->nChNo,(unsigned char *)(LPCSTR)pCh->strSentence);
				pCh->bOnPlay = TRUE;
}

void CSbcxView::v_public_end_3(CH_STRUCT *pCh)//播放第三层中的键号所表示的信息
{
	CString ch,s_settext,v_s,ch_t;
	char v_c[30];
	CSbcxDoc*  pDoc = GetDocument();
	if(ChHangUp(pCh)) return;
	int i;
	if (m_curr_Tele_no >=100 ) {
				i = m_curr_Tele_no - 100;
				ch_t.Format("%d",i); 
				ch = '0' + ch_t;
			}else{
					ch.Format("%d",m_curr_Tele_no);
					i = m_curr_Tele_no;
			}
	if(pCh->bOnPlay)
	{
		if(TV_PlaySentenceRest(pCh->nChNo) <= 0)
		{
			pCh->nPlayCount = 0;
			pCh->strSentence = "";
			v_s = ".\\voice\\v" + ch + ".tw";
			sprintf(v_c,"%s",v_s);		
			TV_SetVoicei(CN_PUBLIC,v_c);
			s_settext = "第二层" + ch + "提示";
			GetListCtrl().SetItemText(pCh->nChNo,2,s_settext);
			pCh->nWS = WS_PLAYING_2;
			pCh->strSentence += CN_PUBLIC;	
			pCh->strSentence += CN_RETURN;
				
			TV_PlaySentence(pCh->nChNo,(unsigned char *)(LPCSTR)pCh->strSentence);
			pCh->bOnPlay = TRUE;
	}
	}
	int nChar = TV_GetDTMFChar(pCh->nChNo);
	if(nChar == -1) return;	
	if(pCh->bOnPlay)
	{
		TV_StopPlayFile(pCh->nChNo);
		pCh->bOnPlay = FALSE;
	}
	CString ls_decr;
	if (nChar != '*' && nChar != '#') {
		ls_decr = pDoc->GetData_decr_3(ch.Left(1),ch.Right(1),nChar);
		ms_decr = ls_decr;
	}
	switch(nChar)
	{
		case '0':	
			v_s = ".\\voice\\v" + ch + "0.tw";
			if (pDoc->GetData_checked_3( ch.Left(1),ch.Right(1) ,'0') == '1')
					{
						Faxlb = 1000 + i * 10;//表示
						goto Play;
				}else
					goto Err;
				break;
			case '1':
				v_s = ".\\voice\\v" + ch + "1.tw";
				if (pDoc->GetData_checked_3( ch.Left(1),ch.Right(1) ,'1') == '1')
						{
							Faxlb = 1000 + i * 10 + 1;//表示
							goto Play;
					}else
						goto Err;
				break;
			case '2':
				v_s = ".\\voice\\v" + ch + "2.tw";
				if (pDoc->GetData_checked_3( ch.Left(1),ch.Right(1) ,'2') == '1')
						{
							Faxlb = 1000 + i * 10 + 2;//表示
							goto Play;
					}else
						goto Err;
				break;
			case '3':
				v_s = ".\\voice\\v" + ch + "3.tw";
				if (pDoc->GetData_checked_3( ch.Left(1),ch.Right(1) ,'3') == '1')
						{
							Faxlb = 1000 + i * 10 + 3;//表示
							goto Play;
					}else
						goto Err;
				break;
			case '4':
				v_s = ".\\voice\\v" + ch + "4.tw";
				if (pDoc->GetData_checked_3( ch.Left(1),ch.Right(1) ,'4') == '1')
						{
							Faxlb = 1000 + i * 10 + 4;//表示
							goto Play;
					}else
						goto Err;
				break;
			case '5':
				v_s = ".\\voice\\v" + ch + "5.tw";
				if (pDoc->GetData_checked_3( ch.Left(1),ch.Right(1) ,'5') == '1')
						{
							Faxlb = 1000 + i * 10 + 5;//表示
							goto Play;
					}else
						goto Err;
				break;
			case '6':
				v_s = ".\\voice\\v" + ch + "6.tw";
				if (pDoc->GetData_checked_3( ch.Left(1),ch.Right(1) ,'6') == '1')
						{
							Faxlb = 1000 + i * 10 + 6;//表示
							goto Play;
					}else
						goto Err;
				break;
			case '7':
				v_s = ".\\voice\\v" + ch + "7.tw";
				if (pDoc->GetData_checked_3( ch.Left(1),ch.Right(1) ,'7') == '1')
						{
							Faxlb = 1000 + i * 10 + 7;//表示
							goto Play;
					}else
						goto Err;
				break;
			case '8':
				v_s = ".\\voice\\v" + ch + "8.tw";
				if (pDoc->GetData_checked_3( ch.Left(1),ch.Right(1) ,'8') == '1')
						{
							Faxlb = 1000 + i * 10 + 8;//表示
							goto Play;
					}else
						goto Err;
				break;
			case '9':
				v_s = ".\\voice\\v" + ch + "9.tw";
				if (pDoc->GetData_checked_3( ch.Left(1),ch.Right(1) ,'9') == '1')
						{
							Faxlb = 1000 + i * 10 + 9;//表示
							goto Play;
					}else
						goto Err;
				break;
			//case '#':
				//Startsucc(pCh);
				//return;
			case '*':
				v_s = ".\\voice\\v" + ch + ".tw";
				sprintf(v_c,"%s",v_s);
				TV_SetVoicei(CN_PUBLIC,v_c);
				pCh->strSentence = "";
				pCh->strSentence = CN_PUBLIC;
				pCh->strSentence += CN_RETURN;			
				pCh->bOnPlay = TRUE;
				pCh->nWS = WS_PLAYING_2;
				TV_PlaySentence(pCh->nChNo,(unsigned char *)(LPCSTR)pCh->strSentence);
				s_settext = "第三层" + ch + "提示";
				GetListCtrl().SetItemText(pCh->nChNo,2,s_settext);
				return;
		}
	/////////////////////////////////////////////
	if (nChar == '0'|| nChar == '1' || nChar == '2'|| nChar == '3'|| nChar == '4'|| nChar == '5'|| nChar == '6'|| nChar == '7'|| nChar == '8'|| nChar == '9')
	{
	Play:sprintf(v_c,"%s",v_s);
		TV_SetVoicei(CN_PUBLIC,v_c);
		pCh->nWS = WS_VOICE_PUBLIC_3;
		GetListCtrl().SetItemText(pCh->nChNo,2,ls_decr + "内容");
		pCh->strSentence = "";
		pCh->strSentence = CN_PUBLIC;
		pCh->strSentence += CN_RETURN;			
		pCh->bOnPlay = TRUE;
		TV_PlaySentence(pCh->nChNo,(unsigned char *)(LPCSTR)pCh->strSentence);
		return;
	}
		Err:	pCh->strSentence = "";
				pCh->strSentence += CN_ERR;
				pCh->strSentence += CN_PUBLIC;
				GetListCtrl().SetItemText(pCh->nChNo,2,"提示输入错误,重新选择");
				pCh->nPlayCount = -1;
				TV_PlaySentence(pCh->nChNo,(unsigned char *)(LPCSTR)pCh->strSentence);
				pCh->bOnPlay = TRUE;
	/////////////////////////////////////////////
	
}

void CSbcxView::v_public_playing_2(CH_STRUCT *pCh)//第二层的提示语音
{
	CString ch,s_settext,v_s,ch_t;
	char v_c[30];
	CSbcxDoc*  pDoc = GetDocument();
	if(ChHangUp(pCh)) return;
	int i;
	if (m_curr_Tele_no >=100 ) {
				i = m_curr_Tele_no - 100;
				ch_t.Format("%d",i); 
				ch = '0' + ch_t;
			}else{
					ch.Format("%d",m_curr_Tele_no);
					i = m_curr_Tele_no;
			}
	if(pCh->bOnPlay)
	{
		if(TV_PlaySentenceRest(pCh->nChNo) <= 0)
		{
			pCh->bOnPlay = FALSE;
			pCh->nPlayCount ++;
			TV_StartTimer(pCh->nChNo,1);
		}
	}else{
		if(TV_TimerElapsed(pCh->nChNo) == -1)
		{
			if(pCh->nPlayCount >= 2)
			{
				if(pCh->nChType == CT_EXTERNAL)
					TV_HangUpCtrl(pCh->nChNo);
					pCh->nWS = WS_WAITCALL;
					GetListCtrl().SetItemText(pCh->nChNo,2,"等待呼入");
			}else if(pCh->nPlayCount == 0){
					pCh->strSentence = "";
					pCh->strSentence += CN_PUBLIC;
					GetListCtrl().SetItemText(pCh->nChNo,2,"第二层" + ch + "提示");
					TV_PlaySentence(pCh->nChNo,(unsigned char *)(LPCSTR)pCh->strSentence);
					pCh->bOnPlay = TRUE;
				}
		}
	}
	int nChar = TV_GetDTMFChar(pCh->nChNo);
	if(nChar == -1) return;	
	if(pCh->bOnPlay)
	{
		TV_StopPlayFile(pCh->nChNo);
		pCh->bOnPlay = FALSE;
	}
	CString ls_decr;
	if (nChar != '*' && nChar != '#') {
		ls_decr = pDoc->GetData_decr_3(ch.Left(1),ch.Right(1),nChar);
		ms_decr = ls_decr;
	}
	switch(nChar)
	{
		case '0':	
			v_s = ".\\voice\\v" + ch + "0.tw";
			if (pDoc->GetData_checked_3( ch.Left(1),ch.Right(1) ,'0') == '1')
					{
						Faxlb = 1000 + i * 10;//表示
						ms_fax = pDoc->GetData_Fax_3(ch.Left(1),ch.Right(1),'0');
				//////////////////记录查询该信息的人数///////////////////
					pDoc-Q_N TXLN














3 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?