Esempio n. 1
0
CString CProducePacket::ProduceSendPacket(const SLZData& data,int leftNum,SendDataType dataType,CString cardNum/* =_T */,CardType cardType/*cardNotDefine*/)
{
	CString packet = _T("<?xml version=\"1.0\" encoding=\"UTF-8\"?><dataPacket version=\"1.0\"><headCode>hallQue</headCode>");
	packet.AppendFormat(_T("<dataType>%d</dataType>"),dataType);
	packet.AppendFormat(_T("<orgName>%s</orgName>"),data.GetOrganName());
	packet.AppendFormat(_T("<orgID>%s</orgID>"),data.GetOrganId());
	packet.AppendFormat(_T("<cardType>%d</cardType>"),cardType);
	packet.AppendFormat(_T("<cardNum>%s</cardNum>"),cardNum);
	packet.AppendFormat(_T("<queID>%s</queID>"),data.GetBussinessType());
	packet.AppendFormat(_T("<queNum>%s</queNum>"),data.GetQueueNumber());
	CString wStrtakeNumTime = ExChangeTime(data.GetTakingNumTime());
	packet.AppendFormat(_T("<enterTime>%s</enterTime>"),wStrtakeNumTime);
	CString wStrCallTime = ExChangeTime(data.GetCallTime());
	packet.AppendFormat(_T("<callTime>%s</callTime>"),wStrCallTime);
	packet.AppendFormat(_T("<workerID>%s</workerID>"),data.GetStaffId());
	packet.AppendFormat(_T("<windowNum>%d</windowNum>"),data.GetWindowId());
	CString wStrFinishTime = ExChangeTime(data.GetFinishTime());
	packet.AppendFormat(_T("<scoreTime>%s</scoreTime>"),wStrFinishTime);
	packet.AppendFormat(_T("<scoreLev>%d</scoreLev>"),data.GetEvaluateLevel());
	
// 	int len = CCommonConvert::CStringToChar(packet,NULL);
// 	char* strPacket = new char[len+1];
// 	memset(strPacket,0,len+1);
// 	CCommonConvert::CStringToChar(packet,strPacket);
// 	std::string stdStrPacket(strPacket);
// 	return stdStrPacket;
	return packet;
}
Esempio n. 2
0
void CInlineQueData::GetCandoQueHaveData(CStringArray& queIDArray,const CStringArray& canDoQueIDArray,UINT uWndID)
{
	int count = canDoQueIDArray.GetCount();
	for(int i = 0; i < count; i++)
	{
		CString candoQueID = canDoQueIDArray[i];
		POSITION pos = m_lstInlineQue.GetHeadPosition();
		while(pos)
		{
			SLZData data;
			POSITION posLast = pos;
			data = m_lstInlineQue.GetNext(pos);
			if(data.GetWindowId()==0)//如果没设置指定窗口
			{
				if(candoQueID.Compare(data.GetBussinessType()) == 0)
				{
					queIDArray.Add(candoQueID);
					break;
				}
			}
			else//设置了指定窗口
			{
				if(uWndID == data.GetWindowId())
				{
					queIDArray.Add(data.GetBussinessType());
					break;
				}
			}
		}
	}
}
Esempio n. 3
0
int CInlineQueData::GetMaxQueNum(const CString queID)
{
	m_mtInlineQue.Lock();
	int maxNum = 0;
	POSITION pos = m_lstInlineQue.GetHeadPosition();
	while(pos)
	{
		SLZData data = m_lstInlineQue.GetNext(pos);
		if(data.GetBussinessType() == queID)
		{
			int queNum = data.GetIntQueNum();
			maxNum = maxNum > queNum ? maxNum : queNum;
		}
	}
// 	CString num;
// 	if(!maxNum.IsEmpty())
// 	{
// 		for(int i=0;i<maxNum.GetLength();i++)
// 		{
// 			WCHAR w = maxNum.GetAt(i);
// 			if(w>'0'&&w<'9')
// 			{
// 				num+=w;
// 			}
// 		}
// 	}
	m_mtInlineQue.Unlock();
// 	int iNum = 0;
// 	CCommonConvert convert;
// 	convert.CStringToint(iNum,num);
	return maxNum;
}
Esempio n. 4
0
void CCallThread::OnWait(CallerCmd& callerCmd)
{
	if(m_rWaitQueData.IsHaveWaitQueData(callerCmd.GetWindowId()))
	{
		return;//只允许每个窗口等候一个人
	}
	else
	{
		SLZData data;
		//获取排队首个加入等候队列
		if(m_rInlineQueData.GetInlineQueData(callerCmd.GetWindowId(),data))
			m_rWaitQueData.Add(data);
		//返回,写剩余人数
//		CString carriedData = data.GetQueueNumber() + _T(" ") + GetQueInlineCount(data.GetBussinessType());
		CString carriedData = data.GetQueueNumber() + _T(" ") + GetCandoQueInlineCount(callerCmd.GetWindowId());
		callerCmd.SetCarriedData(carriedData);
		//界面剩余人数更新
// 		if(theApp.m_pView)
// 		{
// 			theApp.m_pView->ShowWaitNum(data.GetBussinessType(),m_rInlineQueData.GetBussCount(data.GetBussinessType()));
// 		}
		//playsound,display
		theApp.m_Controller.m_pPlaySound->DataPlay(data,TRUE);
	}
}
Esempio n. 5
0
BOOL CInlineQueData::GetFirstTakeNumData(SLZData& data,const CStringArray& arrStrQueId)
{
	BOOL flag = FALSE;
	BOOL canDo = FALSE;
	POSITION pos = m_lstInlineQue.GetHeadPosition();
	SLZData tempdata;
	while(pos)
	{
		tempdata = m_lstInlineQue.GetNext(pos);
		for(int i=0;i<arrStrQueId.GetCount();i++)
		{
			if(arrStrQueId[i].Compare(tempdata.GetBussinessType()) == 0)
			{
				canDo = TRUE;
				break;
			}
		}
		if(canDo)
		{
			if(!flag)
			{
				data = tempdata;
				flag = TRUE;
			}
			else
			{
				data = data.GetTakingNumTime() < tempdata.GetTakingNumTime() ? data : tempdata;
			}
		}
	}
	return flag;
}
Esempio n. 6
0
BOOL CCallThread::ShowCallerWaitNum(const CString& queID,int nWaitNum)
{
	if(queID.IsEmpty())return FALSE;
	std::map<UINT,SLZWindow>::const_iterator itera = m_rInlineQueData.m_rWindowTable.m_mapIdWindow.begin();
	for(itera;itera!=m_rInlineQueData.m_rWindowTable.m_mapIdWindow.end();itera++)
	{
		SLZWindow Window = itera->second;
		CStringArray ArrayQueID;
		Window.GetArrayQueId(ArrayQueID);
		for(int i=0;i<ArrayQueID.GetCount();i++)
		{
			CString wStrQueID = ArrayQueID.GetAt(i);
			if(wStrQueID == queID)
			{
				SLZData data;
				m_rCalledQueData.GetCalledQueData(Window.GetWindowId(),data);
				CString wStrWaitNum;
				wStrWaitNum.Format(_T("%d"),nWaitNum);
				CString carriedData = data.GetQueueNumber() + _T(" ") + wStrWaitNum;
				CallerCmd callerCmd;
				callerCmd.SetCmdType(callerCmdShowNum);
				callerCmd.SetWindowId(Window.GetWindowId());
				callerCmd.SetCarriedData(carriedData);
				ReturnToCaller(callerCmd);
				break;
			}
		}
	}
	return TRUE;
}
Esempio n. 7
0
/*
接收到开启评价命令
*/
void CCallThread::OnEvaReq(CallerCmd& callerCmd)
{
	SLZData data;
	if(m_rCalledQueData.GetCalledQueData(callerCmd.GetWindowId(),data))
	{
		data.SetIsOpenEva(TRUE);//开启评价
		m_rCalledQueData.ModifyCalledQueData(data);
		callerCmd.SetSuccess(TRUE);
	}
}
Esempio n. 8
0
/*
呼叫特定号码
*/
void CCallThread::OnCallNum(CallerCmd& callerCmd)
{
	CString callNum = callerCmd.GetCarriedData();//获取附加数据,就是呼叫的号码
	UINT winID = callerCmd.GetWindowId();//窗口ID
	callerCmd.SetSuccess(TRUE);
	//playsound,display
	SLZData data;
	data.SetWindowId(winID);
	data.SetQueueNumber(callNum);
	theApp.m_Controller.m_pPlaySound->DataPlay(data);
}
Esempio n. 9
0
void CCallThread::OnRecall(CallerCmd& callerCmd)
{
	//重呼
	SLZData data;
	UINT uWindID = callerCmd.GetWindowId();
	if(m_rCalledQueData.GetCalledQueData(uWindID,data))
	{
		//返回,写剩余人数
//		CString carriedData = data.GetQueueNumber() + _T(" ") + GetQueInlineCount(data.GetBussinessType());
		CString carriedData = data.GetQueueNumber() + _T(" ") + GetCandoQueInlineCount(callerCmd.GetWindowId());
		callerCmd.SetCarriedData(carriedData);
		//playsound,display
		theApp.m_Controller.m_pPlaySound->DataPlay(data);
	}
}
Esempio n. 10
0
BOOL CInlineQueData::RemoveFirstTakeNumData(const SLZData& data)
{
	BOOL flag = FALSE;
	POSITION pos = m_lstInlineQue.GetHeadPosition();
	POSITION poslast;
	SLZData tempdata;
	while(pos)
	{
		poslast = pos;
		tempdata = m_lstInlineQue.GetNext(pos);
		if(tempdata.GetSerialId() == data.GetSerialId())
		{
			flag = TRUE;
			m_lstInlineQue.RemoveAt(poslast);
			break;
		}
	}
	return flag;
}
Esempio n. 11
0
void CInlineQueData::GetAllBussCount(const CString& strBussid,UINT* pWaitNum)
{
	m_mtInlineQue.Lock();
	UINT iCount = 0;
	POSITION pos = m_lstInlineQue.GetHeadPosition();
	SLZData data;
	for(; pos; )
	{
		data = m_lstInlineQue.GetNext(pos);
		CString queID = data.GetBussinessType();

		if(queID == strBussid)
		{
			//返回队列总人数
			iCount++;
		}
	}
	m_mtInlineQue.Unlock();
	*pWaitNum = iCount;
}
Esempio n. 12
0
UINT CInlineQueData::GetBussCount(const CString& strBussId)
{
	m_mtInlineQue.Lock();
	UINT iCount = 0;
	POSITION pos = m_lstInlineQue.GetHeadPosition();
	SLZData data;
	for(; pos; )
	{
		data = m_lstInlineQue.GetNext(pos);
		CString queID = data.GetBussinessType();
		if(queID == strBussId)
		{
			//只返回本机的人数
// 			if(data.GetIsClientData() && theApp.m_logicVariables.IsOpenInterNum)
// 			{
// 				if(theApp.m_logicVariables.strInterIP[0] == '\0')//主机
// 					continue;
// 			}
			iCount++;
		}
	}
	m_mtInlineQue.Unlock();
	return iCount;
}
Esempio n. 13
0
BOOL CInlineQueData::AlterData(const CString QueNum,const CString strPhoneNum,const CString strMsg)
{
	m_mtInlineQue.Lock();
	int iCount = m_lstInlineQue.GetCount();
	for (int i = 0;i<iCount;i++)
	{
		SLZData data;
		POSITION pos = m_lstInlineQue.FindIndex(i);
		if (pos)
		{
			data = m_lstInlineQue.GetAt(pos);
			if (data.GetQueueNumber()==QueNum)
			{
				data.SetPhoneNum(strPhoneNum);
				data.SetSendMsg(strMsg);
				m_lstInlineQue.SetAt(pos,data);
				m_mtInlineQue.Unlock();
				return TRUE;
			}
		}
	}
	m_mtInlineQue.Unlock();
	return FALSE;
}
Esempio n. 14
0
void CCallThread::OnDiscard(CallerCmd& callerCmd)
{
	//过号
	SLZData data;
	UINT uWindID = callerCmd.GetWindowId();
	if(m_rCalledQueData.GetCalledQueData(uWindID,data))
	{
		//加入到过号队列
		m_rDiscardQueData.Add(data);
		m_rCalledQueData.DeleteCalledQueData(data);
		//返回,写剩余人数
//		CString carriedData = data.GetQueueNumber() + _T(" ") + GetQueInlineCount(data.GetBussinessType());
		CString carriedData = data.GetQueueNumber() + _T(" ") + GetCandoQueInlineCount(callerCmd.GetWindowId());
		callerCmd.SetCarriedData(carriedData);
		//界面剩余人数更新
		if(theApp.m_pView)
		{
//			theApp.m_pView->ShowWaitNum(data.GetBussinessType(),m_rInlineQueData.GetBussCount(data.GetBussinessType()));
			ShowViewWaitNum(data.GetBussinessType(),data,callerCmd);
		}
		//playsound,display
//		theApp.m_Controller.m_pPlaySound->DataPlay(data);
	}
}
Esempio n. 15
0
/*
获取排队 队列首个数据
*/
BOOL CInlineQueData::GetInlineQueData(const UINT iWinId, 
									  SLZData& rdata)
{
	if(m_lstInlineQue.GetCount() < 1)
	{
		return FALSE;
	}
	CStringArray arrStrQueId;//可处理队列以及优先级
	SLZWindow Window;
	BOOL flag = m_rWindowTable.QueryWindowById(iWinId,Window);
	if(!flag)return FALSE;
	BOOL bIsUserPower = Window.GetIsUsePower();//是否使用优先级
	Window.GetArrayQueId(arrStrQueId);//获取可处理队列及优先级
	CString staffID = theApp.m_Controller.m_mapLoginList[Window.GetWindowId()];//获取登录STAFFID
	if(staffID.IsEmpty())return FALSE;
	if(arrStrQueId.GetCount() < 1)
	{
		return FALSE;
	}
	///////////////////////
	BOOL bFind = FALSE;
	m_mtInlineQue.Lock();
	if(bIsUserPower)//使用优先级
	{
		int count = arrStrQueId.GetCount();
		for(int i = 0; i < count; i++)
		{
			POSITION pos = m_lstInlineQue.GetHeadPosition();
			while(pos)
			{
				SLZData data;
				POSITION posLast = pos;
				data = m_lstInlineQue.GetNext(pos);
				if(data.GetWindowId()==0)//如果没设置指定窗口
				{
					if(arrStrQueId[i].Compare(data.GetBussinessType()) == 0)
					{
						bFind = TRUE;
						rdata = data;
						m_lstInlineQue.RemoveAt(posLast);
						break;
					}
				}
				else//设置了指定窗口优先呼叫
				{
					if(iWinId == data.GetWindowId())
					{
						rdata = data;
						m_lstInlineQue.RemoveAt(posLast);
						bFind = TRUE;
						break;
					}
				}
			}
			if(bFind)
			{
				break;
			}
		}
	}
	else//不使用优先级
	{
		/*
		/////////////////////////////////////////首先找到可处理队列中哪几个队列有数据
		CStringArray haveDataArray;
		GetCandoQueHaveData(haveDataArray,arrStrQueId,iWinId);
		if(haveDataArray.GetCount() == 0)
		{
			return FALSE;
		}
		/////////////////////////////////////////随机取数
		int count = haveDataArray.GetCount();
		time_t t;	
		srand((unsigned) time(&t));	
		int nRand = rand() % count;
		CString strQueID = haveDataArray[nRand];
		POSITION pos = m_lstInlineQue.GetHeadPosition();
		while(pos)
		{
			SLZData data;
			POSITION posLast = pos;
			data = m_lstInlineQue.GetNext(pos);
			if(data.GetWindowId()==0)//如果没设置指定窗口
			{
				if(strQueID.Compare(data.GetBussinessType()) == 0)
				{
					rdata = data;
					m_lstInlineQue.RemoveAt(posLast);
					bFind = TRUE;
					break;
				}
			}
			else//指定了窗口
			{
				if(iWinId == data.GetWindowId())
				{
					rdata = data;
					m_lstInlineQue.RemoveAt(posLast);
					bFind = TRUE;
					break;
				}
			}
		}
		*/
		bFind = GetFirstTakeNumData(rdata,arrStrQueId);
		if(bFind)
			bFind = RemoveFirstTakeNumData(rdata);
	}
	CTime currTime = CTime::GetCurrentTime();
	rdata.SetCallTime(currTime);//设置呼叫时间
	rdata.SetStaffId(staffID);//设置员工ID,哪个员工呼叫
	rdata.SetWindowId(iWinId);//设置哪个窗口呼叫
	rdata.SetWindowShowId(Window.GetShowWndId());//设置窗口编号
	m_mtInlineQue.Unlock();
	return bFind;
}
Esempio n. 16
0
void CCallThread::DoEvaMsg(const MSG& msg)
{
	SLZEvaData* pEvaData = (SLZEvaData*)msg.wParam;

	SLZWindow Window;
	BOOL flag = m_rInlineQueData.m_rWindowTable.QueryWindowByEvaId(pEvaData->GetEvaluatorId(),Window);
	if(flag)
	{
		SLZData data;
		//找出正在呼叫的那条数据
		if(m_rCalledQueData.GetCalledQueData(Window.GetWindowId(),data))
		{
			data.SetEvaluateLevel(pEvaData->GetEvaLevel());
			data.SetIsFinshEva(TRUE);
			CTime curTime = CTime::GetCurrentTime();
			data.SetFinishTime(curTime);
			if(m_rCalledQueData.DeleteCalledQueData(data))//删除正在呼叫的那条数据
			{
				m_rFinshQueData.Add(data);//加入完成队列
			}
		}
		else//不呼叫只评价
		{
			data.SetEvaluateLevel(pEvaData->GetEvaLevel());
			data.SetIsFinshEva(TRUE);
			CTime curTime = CTime::GetCurrentTime();
			data.SetFinishTime(curTime);
			data.SetWindowId(Window.GetWindowId());
			data.SetWindowShowId(Window.GetShowWndId());
			CString staffID = m_map_login[Window.GetWindowId()];
			data.SetStaffId(staffID);
			CString bussinessType;
			/*
			处理业务ID
			*/
			SLZWindow window;
			m_rInlineQueData.m_rWindowTable.QueryWindowById(data.GetWindowId(),window);
			CStringArray arrayQueID;
			window.GetArrayQueId(arrayQueID);
			if(!arrayQueID.IsEmpty())
			{
				bussinessType = arrayQueID[0];
			}
			else
			{
				CMap<int,int,CQueueInfo,CQueueInfo&>::CPair* pCurEva;
				int count = m_map_que.GetCount();
				for(int i=0;i<count;i++)
				{
					pCurEva = m_map_que.PLookup(i);
					bussinessType = pCurEva->value.GetQueID();
					break;
				}
			}
			////////////////////////////////
			data.SetBussinessType(bussinessType);
			data.SetOrganId(theApp.m_logicVariables.strOrganID);
			data.SetOrganName(theApp.m_logicVariables.strOrganNmae);
//			data.SetQueSerialID(_T("1"));
			data.SetQueueNumber(_T("0"));
			data.SetCallTime(curTime);
			data.SetTakingNumTime(curTime);
			m_rFinshQueData.Add(data);//加入完成队列
		}
	}
	if(pEvaData)//释放资源
		delete pEvaData;
}
Esempio n. 17
0
BOOL CCallThread::ShowViewWaitNum(const CString& queserial_id,const SLZData& data,CallerCmd& callerCmd)
{
	CString queManNum;
	theApp.m_Controller.GetManQueNumByQueSerialID(queserial_id,queManNum);
	if(theApp.m_logicVariables.IsOpenInterNum)
	{
		if(theApp.m_logicVariables.strInterIP[0] == '\0')//主机
		{
			goto Normal;		
		}
		else//客户机
		{
			CComplSocketClient client;
			
			string sendMsg,recvMsg;
			int actRecvSize = 0;
			CDealInterMsg::ProduceSendInNumMsg(queManNum,sendMsg);
			if(client.SendData(INTERPORT,theApp.m_logicVariables.strInterIP,
				sendMsg,sendMsg.size(),recvMsg,actRecvSize) && actRecvSize)
			{
				//CDealInterMsg::AnaRetInterMsg(recvMsg,&iQueNum,pInlineNum);
				UINT waitNum = 0;
				CDealInterMsg::AnaRetInNumMsg(recvMsg,&waitNum);

				theApp.m_pView->ShowWaitNum(queserial_id,waitNum);

				//返回,写剩余人数
				CString wStrWaitNum;
				wStrWaitNum.Format(_T("%d"),waitNum);
				CString carriedData = data.GetQueueNumber() + _T(" ") + wStrWaitNum;
				callerCmd.SetCarriedData(carriedData);
				return TRUE;
			}
			else
			{
				goto Normal;
			}
		}
	}
	else
	{
Normal:
		UINT nWaitNum = 0;
		m_rInlineQueData.GetAllBussCount(queserial_id,&nWaitNum);//获取当前队列人数
		theApp.m_pView->ShowWaitNum(queserial_id,nWaitNum);//m_rInlineQueData.GetBussCount(queserial_id));
		
		//返回,写剩余人数
		CString wStrWaitNum;
		wStrWaitNum.Format(_T("%d"),nWaitNum);
		CString carriedData = data.GetQueueNumber() + _T(" ") + wStrWaitNum;
		callerCmd.SetCarriedData(carriedData);

		//广播人数
		CUDPBrodcast brodcast;
		string retMsg;
		CDealInterMsg::ProduceBrodcastRetInNumMsg(queManNum,nWaitNum,retMsg);
		CString wRetMsg(retMsg.c_str());
		brodcast.BroadCast(wRetMsg);
		
		return TRUE;
	}
	return FALSE;
}
Esempio n. 18
0
BOOL CInlineQueData::DeleteInlineClientData(BOOL bIsUsePower,const CStringArray& queIDArray,const CString& organId,SLZData* pData)
{
	m_mtInlineQue.Lock();
	BOOL flag = FALSE;
	if(bIsUsePower)
	{
		if(queIDArray.GetCount() < 1)
		{
			return FALSE;
		}
		
		int count = queIDArray.GetCount();
		for(int i = 0; i < count; i++)
		{
			POSITION pos = m_lstInlineQue.GetHeadPosition();
			while(pos)
			{
				SLZData data;
				POSITION posLast = pos;
				data = m_lstInlineQue.GetNext(pos);
				if(data.GetWindowId()==0)//如果没设置指定窗口
				{
					if(queIDArray[i].Compare(data.GetBussinessType()) == 0)
					{
						flag = TRUE;
						*pData = data;
						m_lstInlineQue.RemoveAt(posLast);
						break;
					}
				}
			}
			if(flag)
			{
				break;
			}
		}
	}
	else
	{
		/*
		/////////////////////////////////////////首先找到可处理队列中哪几个队列有数据
		CStringArray haveDataArray;
		GetCandoQueHaveData(haveDataArray,queIDArray);
		if(haveDataArray.GetCount() == 0)
		{
			return FALSE;
		}
		/////////////////////////////////////////随机取数
		int count = haveDataArray.GetCount();
		time_t t;	
		srand((unsigned) time(&t));	
		int nRand = rand() % count;
		CString strQueID = haveDataArray[nRand];
		POSITION pos = m_lstInlineQue.GetHeadPosition();
		while(pos)
		{
			SLZData data;
			POSITION posLast = pos;
			data = m_lstInlineQue.GetNext(pos);
			if(data.GetWindowId()==0)//如果没设置指定窗口
			{
				if(strQueID.Compare(data.GetBussinessType()) == 0)
				{
					*pData = data;
					m_lstInlineQue.RemoveAt(posLast);
					flag = TRUE;
					break;
				}
			}
		}
		*/
		flag = GetFirstTakeNumData(*pData,queIDArray);
		if(flag)
			flag = RemoveFirstTakeNumData(*pData);
	}
	m_mtInlineQue.Unlock();
	return flag;
}
Esempio n. 19
0
/*
转移队列/窗口
*/
void CCallThread::OnExChange(CallerCmd& callerCmd)
{
	SLZData data;
	if(m_logicVariables.ExchangeQue)
	{
		BOOL flag = FALSE;
		CString queID = callerCmd.GetCarriedData();//获取转移的队列
		if(queID.IsEmpty())return;
		CQueueInfo queinfo;
		for(int i=0;i<m_map_que.GetCount();i++)
		{
			if(m_map_que[i].GetQueManNum()==queID)//找到QUEID
			{
				flag = TRUE;
				queinfo = m_map_que[i];
				break;
			}
		}
		//获取对应窗口正在呼叫的数据
		if(flag)
		{
			if(m_rCalledQueData.GetCalledQueData(callerCmd.GetWindowId(),data))
			{
				data.SetIsOpenEva(FALSE);data.SetIsFinshEva(FALSE);
				m_rCalledQueData.DeleteCalledQueData(data);//删除正在呼叫队列的数据
				data.SetBussinessType(queinfo.GetQueID());
				//设置队列名称
				data.SetBussName(GetQueNumFromID(queinfo.GetQueID()));
				data.SetWindowId(0);//不设置指定窗口,返回初始状态
				m_rInlineQueData.AddHeadData(data);//添加到排队队列最前
				callerCmd.SetSuccess(TRUE);
			}
		}
	}
	if(m_logicVariables.ExchangeWindow)//转移窗口
	{
		CString winID = callerCmd.GetCarriedData();//获取转移的窗口
		if(winID.IsEmpty())return;
		CCommonConvert convert;
		int i_winID = -1;
		convert.CStringToint(i_winID,winID);
		SLZWindow Window;
		BOOL flag = m_rInlineQueData.m_rWindowTable.QueryWindowBySerialID(i_winID,Window);
		if(flag)//找到了窗口
		{
			if(m_rCalledQueData.GetCalledQueData(callerCmd.GetWindowId(),data))
			{
				if(JudgeWindowHaveQue(Window.GetWindowId()))//判断窗口ID下是否有可处理队列
				{
					data.SetIsOpenEva(FALSE);data.SetIsFinshEva(FALSE);
					m_rCalledQueData.DeleteCalledQueData(data);//删除正在呼叫队列的数据
					data.SetWindowId(Window.GetWindowId());
					m_rInlineQueData.AddHeadData(data);//添加到排队队列最前
					callerCmd.SetSuccess(TRUE);
				}
				else
				{
					callerCmd.SetSuccess(FALSE);
				}
			}
		}
		/////////////////////////////////////
	}
	///////////////////////////////////
}
Esempio n. 20
0
void CCallThread::OnCall(CallerCmd& callerCmd)
{
	SLZData callingData;//正在呼叫的data
	if(m_rCalledQueData.GetCalledQueData(callerCmd.GetWindowId(),callingData))//有一条数据在正在呼叫队列没有处理完(包括评价)
	{
		if(callingData.GetIsOpenEva()==TRUE &&  callingData.GetIsFinshEva()==FALSE)
			//打开了评价但还没有评价,流程没完等待用户评价,如15秒后没有评价自动发送未评价消息
		{
			return;//评价没有结束不能呼叫
		}
		else if(!callingData.GetIsFinshEva())//没有开启评价
		{
			m_rCalledQueData.DeleteCalledQueData(callingData);//删除正在呼叫的那条数据
			///加入完成队列
			CTime curTime = CTime::GetCurrentTime();
			callingData.SetFinishTime(curTime);//设置完成时间
			m_rFinshQueData.Add(callingData);//添加到完成队列
		}
	}
	///////////////////////呼叫
	//首先判断该窗口下有没有等候的人,如果有呼叫等候队列的那条数据
	//没有从排队队列中取出新的数据
	SLZData data;
	if(m_rWaitQueData.IsHaveWaitQueData(callerCmd.GetWindowId()))
	{
		if(m_rWaitQueData.GetWaitQueData(callerCmd.GetWindowId(),data))
		{
			cyclock.lock();//崔,我加的
			//加入正在呼叫队列
			m_rCalledQueData.Add(data);
			cyclock.unlock();//崔,我加的
		}
	}
	else
	{
		///得到排队队列的下一个数据
		if(!theApp.IsLocal())//客户机
		{
			/////如果是客户机呼叫则需要向服务端发送一条请求删除队列中的一条客户机数据
			CComplSocketClient client;
			CStringArray queSerialIDArray,queManNumArray;
			CString callStaffID,queManNum;
			BOOL bIsUsePower = FALSE;
			m_rInlineQueData.GetWindowCanDoQue(callerCmd.GetWindowId(),queSerialIDArray,callStaffID,&bIsUsePower);
			
			for(int i=0;i<queSerialIDArray.GetCount();i++)
			{
				theApp.m_Controller.GetManQueNumByQueSerialID(queSerialIDArray.GetAt(i),queManNum);
				queManNumArray.Add(queManNum);
			}

			string sendMsg,recvMsg;
			int actRecvSize = 0;
			CDealInterMsg::ProduceSendCallMsg(queManNumArray,sendMsg,theApp.m_logicVariables.strOrganID,bIsUsePower);
			if(client.SendData(INTERPORT,theApp.m_logicVariables.strInterIP,
				sendMsg,sendMsg.size(),recvMsg,actRecvSize) && actRecvSize)
			{
				BOOL isSucced;
				CDealInterMsg::AnaRetCallMsg(recvMsg,&isSucced,&data);
				if(isSucced)
				{
					data.SetCallTime(CTime::GetCurrentTime());
					data.SetStaffId(callStaffID);
					data.SetWindowId(callerCmd.GetWindowId());
					CString queSerialID;
					theApp.m_Controller.GetQueSerialIDByManQueNum(queSerialID,data.GetQueSerialID());
					data.SetBussinessType(queSerialID);
				}
				else
				{
					return;
				}
			}
		}
		else
		{
			m_rInlineQueData.GetInlineQueData(callerCmd.GetWindowId(),data);
		}
	}
	if(!data.GetBussinessType().IsEmpty())
	{
		cyclock.lock();//崔,我加的
		m_rCalledQueData.Add(data);//添加到正在呼叫队列
		cyclock.unlock();//崔,我加的
		
		//界面剩余人数更新
			//theApp.m_pView->ShowWaitNum(data.GetBussinessType(),m_rInlineQueData.GetBussCount(data.GetBussinessType()));
		ShowViewWaitNum(data.GetBussinessType(),data,callerCmd);
		
		//playsound,显示
		theApp.m_Controller.m_pPlaySound->DataPlay(data);

		//发短信
 		if (!data.GetPhoneNum().IsEmpty())
 		{
 			m_pShortMsg->ClearSendBox();
 			m_pShortMsg->SendMsg(data.GetPhoneNum(),data.GetSendMsg());
 		}
	}
	if(theApp.IsLocal())
		///重新写file,保存没处理(呼叫)的数据
		theApp.m_Controller.WriteInlineDataToFile();
}