mfm1992

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

TXT
1,407
字号
	
	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 >= 3)
			{
				if(pCh->nChType == CT_EXTERNAL)
					TV_HangUpCtrl(pCh->nChNo);
				pCh->nWS = WS_WAITCALL;
				GetListCtrl().SetItemText(pCh->nChNo,2,"等待呼入");
				GetListCtrl().SetItemText(pCh->nChNo,3,"");
			}else{
				if(pCh->nPlayCount == 0)
				{
					pCh->strSentence = "";
					pCh->strSentence += CN_INTSID;
					GetListCtrl().SetItemText(pCh->nChNo,2,"提示输入ID");
					GetListCtrl().SetItemText(pCh->nChNo,3,"");
				}
				TV_PlaySentence(pCh->nChNo,(unsigned char *)(LPCSTR)pCh->strSentence);
				pCh->bOnPlay = TRUE;
			}
		}
	}
	int nChar = TV_GetDTMFChar(pCh->nChNo);
	if(nChar == -1) return;
	if(nChar >= '0' && nChar <= '9')
	{
		if(pCh->bOnPlay)
		{
			TV_StopPlayFile(pCh->nChNo);
			pCh->bOnPlay = FALSE;
		}
		pCh->strAjLb = "";
		pCh->strAjLb += nChar;
		pCh->nWS = WS_TS_AJ;
		TV_StartTimer(pCh->nChNo,30);
		GetListCtrl().SetItemText(pCh->nChNo,2,"等待案件选择完毕");
		return;
	}
	if (nChar == '*'){
		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;
		pCh->nPlayCount = 0;
	}
}

void CSbcxView::Ts_GetAj(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;
	CString AjLb;
	if(nChar >= '0' && nChar <= '9')
	{
		pCh->strAjLb += nChar;
		return;
	}
	if(nChar == '#'){
		CSbcxDoc*  pDoc = GetDocument();
		AjLb = pCh->strAjLb;
		if (AjLb.GetLength() <= 1) AjLb = "0" + AjLb;
		if (AjLb.GetLength() >= 3) {
			pCh->strSentence = "";
			pCh->strSentence += CN_ERR;
			pCh->strSentence += CN_VTS0;
			GetListCtrl().SetItemText(pCh->nChNo,2,"提示输入错误,重新选择");
			pCh->nPlayCount = -1;
			pCh->nWS = WS_TS0;			
			pCh->bOnPlay = TRUE;
			TV_PlaySentence(pCh->nChNo,(unsigned char *)(LPCSTR)pCh->strSentence);
			return;
		}
		pDoc->ts_aj_lx = AjLb;
		///////////////////////////////////////
		char buff[20];
		UINT No;
		CString ts_id,ts;
		double ts_num,ts_bh;
		No = pDoc->no + 1;
		ts_num = pDoc->GetData_Ts_num(AjLb);//该案件类别投诉的人数
		if (ts_num == 1000){//没有该案件类别
			pCh->strSentence = "";
			pCh->strSentence += CN_ERR;
			pCh->strSentence += CN_VTS0;
			GetListCtrl().SetItemText(pCh->nChNo,2,"提示输入错误,重新选择");
			pCh->nPlayCount = -1;
			pCh->nWS = WS_TS0;			
			pCh->bOnPlay = TRUE;
			TV_PlaySentence(pCh->nChNo,(unsigned char *)(LPCSTR)pCh->strSentence);
			return;
		} 
		ms_ts_num = (int) floor(ts_num) + 1;
		pDoc->ms_ts_num = ms_ts_num;
		sprintf(buff,"%d",ms_ts_num);
		ts = CString(buff);
		ts_id = "1" + AjLb + ts;//投诉编号
		ms_ts_bh = ts_id;       //同上
		pDoc->ms_ts_bh = ms_ts_bh;
//		AfxMessageBox(ms_ts_bh);
		ts_bh = atof(ts_id);
		TV_MakeSentence (ts_bh, ( unsigned char *)buff);
		pCh->nWS = WS_TS1;
		pCh->nPlayCount = 0;
		pCh->strSentence = "";
		pCh->strSentence += CN_VTSP;
		pCh->strSentence += (const char *)buff;
		GetListCtrl().SetItemText(pCh->nChNo,2,"投诉提示");	
	}
	if (nChar == '*')
	{
		pCh->nWS = WS_DOMENU1;
		GetListCtrl().SetItemText(pCh->nChNo,2,"提示选择功能");
		pCh->strSentence = "";
		pCh->strSentence += CN_VMENU1;
	}
	pCh->bOnPlay = TRUE;
	TV_PlaySentence(pCh->nChNo,(unsigned char *)(LPCSTR)pCh->strSentence);
}

void CSbcxView::Ts_id_twice(CH_STRUCT *pCh, CString tsbh)//第二次播放投诉号
{
	if(ChHangUp(pCh)) return;
	double ts_bh;
	char buff[20];
	ts_bh = atof(tsbh);
	TV_MakeSentence (ts_bh, ( unsigned char *)buff);
	pCh->nWS = WS_TS1;
	pCh->strSentence = "";
	pCh->strSentence += CN_VTSP;
	pCh->strSentence += (const char *)buff;
	pCh->strSentence += CN_VTS1;

	GetListCtrl().SetItemText(pCh->nChNo,2,"投诉提示");	
	pCh->bOnPlay = TRUE;
	TV_PlaySentence(pCh->nChNo,(unsigned char *)(LPCSTR)pCh->strSentence);
}

void CSbcxView::bm_check(CH_STRUCT *pCh)//在预约时,接受代表医生代码的键号
{
	if(ChHangUp(pCh)) return;
	
	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 >= 3)
			{
				if(pCh->nChType == CT_EXTERNAL)
					TV_HangUpCtrl(pCh->nChNo);
				pCh->nWS = WS_WAITCALL;
				GetListCtrl().SetItemText(pCh->nChNo,2,"等待呼入");
				GetListCtrl().SetItemText(pCh->nChNo,3,"");
			}else{
				if(pCh->nPlayCount == 0)
				{
					pCh->strSentence = "";
					pCh->strSentence += CN_INTSID;
					GetListCtrl().SetItemText(pCh->nChNo,2,"提示输入ID");
					GetListCtrl().SetItemText(pCh->nChNo,3,"");
				}
				TV_PlaySentence(pCh->nChNo,(unsigned char *)(LPCSTR)pCh->strSentence);
				pCh->bOnPlay = TRUE;
			}
		}
	}
	int nChar = TV_GetDTMFChar(pCh->nChNo);
	if(nChar == -1) return;
	if(nChar >= '0' && nChar <= '9')
	{
		if(pCh->bOnPlay)
		{
			TV_StopPlayFile(pCh->nChNo);
			pCh->bOnPlay = FALSE;
		}
		pCh->strDoc_bm = "";
		pCh->strDoc_bm += nChar;
		pCh->nWS = WS_YY_BM;
		TV_StartTimer(pCh->nChNo,30);
		GetListCtrl().SetItemText(pCh->nChNo,2,"等待医生代码选择完毕");
		return;
	}
	if (nChar == '*'){
		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;
		pCh->nPlayCount = 0;
	}
}

void CSbcxView::Yy_GetBm(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;
	CString doc_bm;
	if(nChar >= '0' && nChar <= '9')
	{
		pCh->strDoc_bm += nChar;
		return;
	}
	if(nChar == '#'){
		CSbcxDoc*  pDoc = GetDocument();
		doc_bm = pCh->strDoc_bm;
		if (doc_bm.GetLength() <= 1) doc_bm = "0" + doc_bm;
		if (doc_bm.GetLength() >= 3) {
			pCh->strSentence = "";
			pCh->strSentence += CN_ERR;
			pCh->strSentence += CN_VYY0;
			GetListCtrl().SetItemText(pCh->nChNo,2,"提示输入错误,重新选择");
			pCh->nPlayCount = -1;
			pCh->nWS = WS_YY0;			
			pCh->bOnPlay = TRUE;
			TV_PlaySentence(pCh->nChNo,(unsigned char *)(LPCSTR)pCh->strSentence);
			return;
		}
		pDoc->yy_doc_bm = doc_bm;
		///////////////////////////////////////
		char buff[20];
		UINT No;
		CString yy_id,yy;
		double yy_num,yy_bh;
		No = pDoc->no + 1;
		yy_num = pDoc->GetData_yy_num(doc_bm);//预约该医生的人数
		if (yy_num == 1000){//没有该医生
			pCh->strSentence = "";
			pCh->strSentence += CN_ERR;
			pCh->strSentence += CN_VYY0;
			GetListCtrl().SetItemText(pCh->nChNo,2,"提示输入错误,重新选择");
			pCh->nPlayCount = -1;
			pCh->nWS = WS_YY0;			
			pCh->bOnPlay = TRUE;
			TV_PlaySentence(pCh->nChNo,(unsigned char *)(LPCSTR)pCh->strSentence);
			return;
		} 
		ms_yy_num = (int) floor(yy_num) + 1;
		pDoc->ms_yy_num = ms_yy_num;
		sprintf(buff,"%d",ms_yy_num);
		yy = CString(buff);
		yy_id = "1" + doc_bm + yy;//投诉编号
		ms_yy_bh = yy_id;       //同上
		pDoc->ms_yy_bh = ms_yy_bh;
//		AfxMessageBox(ms_ts_bh);
		yy_bh = atof(yy_id);
		TV_MakeSentence (yy_bh, ( unsigned char *)buff);
		pCh->nWS = WS_YY_START;
		pCh->nPlayCount = 0;
		pCh->strSentence = "";
		pCh->strSentence += CN_VYYP;
		pCh->strSentence += (const char *)buff;
		GetListCtrl().SetItemText(pCh->nChNo,2,"预约提示");	
	}
	if (nChar == '*')
	{
		pCh->nWS = WS_DOMENU1;
		GetListCtrl().SetItemText(pCh->nChNo,2,"提示选择功能");
		pCh->strSentence = "";
		pCh->strSentence += CN_VMENU1;
	}
	pCh->bOnPlay = TRUE;
	TV_PlaySentence(pCh->nChNo,(unsigned char *)(LPCSTR)pCh->strSentence);
}
#define YYPATH ".\\yy\\"
void CSbcxView::StartYy(CH_STRUCT *pCh)//开始预约
{
	if(ChHangUp(pCh)) return;
	CSbcxDoc*  pDoc = GetDocument();
	if(pCh->bOnPlay)
	{
		if(TV_PlaySentenceRest(pCh->nChNo) <= 0){
			if (pCh->nPlayCount == 0 ){
				pCh->nWS = WS_YY_TWICE;//第二遍播放预约号
				pCh->nPlayCount ++;
				pCh->bOnPlay = true;
				return;
			}
			CString s;
			char fn[30];
			pDoc->no++;
			s = CString(YYPATH) + "yy" + CString(ms_yy_bh) + CString(tw); 
			pCh->file_name_yy = s;
			sprintf(fn,"%s",s);
			remove (fn);
			pCh->bOnRecord = true;
			TV_StartRecordFile (pCh->nChNo, fn,0,0x1000000L);
			GetListCtrl().SetItemText(pCh->nChNo,2,"预约");
			pCh->nWS = WS_YY;
			TV_StartTimer(pCh->nChNo,30);//预约时间
			pCh->Tsws = "startyy";
			GetDocument()->AddToTaskList(pCh);
			return;
		}
			
	}
	int nChar = TV_GetDTMFChar(pCh->nChNo);
	if(nChar == -1) return;	
	if(pCh->bOnPlay)
	{
		TV_StopRecordFile(pCh->nChNo);
		pCh->bOnPlay = FALSE;
	}
	if(nChar =='*'){
		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;
		pCh->nPlayCount = 0;
	}
}

void CSbcxView::Yy(CH_STRUCT *pCh)//继续预约
{
	if(ChHangUp(pCh)) return;
	TV_RecordFileRest(pCh->nChNo);
	if(TV_TimerElapsed(pCh->nChNo) == -1)
	{	TV_StopRecordFile (pCh->nChNo);
		pCh->nWS = WS_DOMENU1;
		GetListCtrl().SetItemText(pCh->nChNo,2,"提示选择功能");
		pCh->strSentence = "";
		pCh->strSentence += CN_VYY2;
		pCh->strSentence += CN_VMENU1;
		TV_PlaySentence(pCh->nChNo,(unsigned char *)(LPCSTR)pCh->strSentence);
		pCh->bOnPlay = TRUE;
		pCh->nPlayCount = 0;
		return;
	}
	int nChar = TV_GetDTMFChar(pCh->nChNo);
	if(nChar == -1) return;	
	if(pCh->bOnRecord)
	{
		TV_StopRecordFile (pCh->nChNo);
		pCh->bOnRecord = FALSE;
	}
	if(nChar =='*'){
		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;
		pCh->nPlayCount = 0;
	}	
}

void CSbcxView::Yy_id_twice(CH_STRUCT *pCh, CString yybh)//第二次播放预约号
{
	if(ChHangUp(pCh)) return;
	double yy_bh;
	char buff[20];
	yy_bh = atof(yybh);
	TV_MakeSentence (yy_bh, ( unsigned char *)buff);
	pCh->nWS = WS_YY_START;
	pCh->strSentence = "";
	pCh->strSentence += CN_VYYP;
	pCh->strSentence += (const char *)buff;
	pCh->strSentence += CN_VYY1;

	GetListCtrl().SetItemText(pCh->nChNo,2,"预约提示");	
	pCh->bOnPlay = TRUE;
	TV_PlaySentence(pCh->nChNo,(unsigned char *)(LPCSTR)pCh->strSentence);
}

void CSbcxView::InYyId(CH_STRUCT *pCh)//输入预约号
{
	if(ChHangUp(pCh)) return;
	
	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 >= 3)
			{
				if(pCh->nChType == CT_EXTERNAL)
					TV_HangUpCtrl(pCh->nChNo);
				pCh->nWS = WS_WAITCALL;
				GetListCtrl().SetItemText(pCh->nChNo,2,"等待呼入");
				GetListCtrl().SetItemText(pCh->nChNo,3,"");
			}else{
				if(pCh->nPlayCount == 0)
				{
					pCh->strSentence = "";
					pCh->strSentence += CN_INYYID;
					GetListCtrl().SetItemText(pCh->nChNo,2,"提示输入ID");
					GetListCtrl().SetItemText(pCh->nChNo,3,"");
				}
				TV_PlaySentence(pCh->nChNo,(unsigned char *)(LPCSTR)pCh->strSentence);
				pCh->bOnPlay = TRUE;
			}
		}
	}
	int nChar = TV_GetDTMFChar(pCh->nChNo);
	if(nChar == -1) return;
	if(nChar >= '0' && nChar <= '9')
	{
		if(pCh->bOnPlay)
		{
			TV_StopPlayFile(pCh->nChNo);
			pCh->bOnPlay = FALSE;
		}
		pCh->stryyid = "";
		pCh->stryyid += nChar;
		pCh->nWS = WS_GETYYID;
		TV_StartTimer(pCh->nChNo,40);
		GetListCtrl().SetItemText(pCh->nChNo,2,"等待ID输入完毕");
		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;
	}

⌨️ 快捷键说明

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