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; }
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; }
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); } }
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); } }
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); } }
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; }
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; }