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; }
BOOL CCallThread::SetLoginStaffID(const UINT iWinID,const CString& staffID) { //得到窗口 SLZWindow Window; BOOL flag = m_rInlineQueData.m_rWindowTable.QueryWindowById(iWinID,Window); if(!flag)return FALSE; Window.SetLoginStaff(staffID);//设置登录员工工号 return TRUE; }
BOOL CCallThread::DelWindowLoginStaffID(const UINT iWinID) { SLZWindow Window; BOOL flag = m_rInlineQueData.m_rWindowTable.QueryWindowById(iWinID,Window); if(!flag)return FALSE; CString content; Window.SetLoginStaff(content);//设置登录员工工号 return TRUE; }
BOOL CCallThread::JudgeWindowHaveQue(const UINT iWindow) { CStringArray arrStrQueId; SLZWindow Window; BOOL flag = m_rInlineQueData.m_rWindowTable.QueryWindowById(iWindow,Window); if(!flag)return FALSE; Window.GetArrayQueId(arrStrQueId); if(arrStrQueId.GetCount() < 1) { return FALSE; } return TRUE; }
/* 呼叫业务顾问 */ void CCallThread::OnCallBusc(CallerCmd& callerCmd) { UINT winID = callerCmd.GetWindowId();//窗口ID callerCmd.SetSuccess(TRUE); //playsound,display SLZWindow Window; BOOL flag = m_rInlineQueData.m_rWindowTable.QueryWindowById(winID,Window); if(!flag)return; CString callName = Window.GetWindowCallName(); CString strMsg; callName.Remove(_T('号')); callName.Remove(_T('窗')); callName.Remove(_T('口')); strMsg.Format(_T("#请#业务顾问#到#%s#号窗口"),callName); theApp.m_Controller.m_pPlaySound->DataPlay(strMsg); }
UINT CInlineQueData::GetCandoQueCount(UINT iWinID) { UINT uWaitCount = 0; SLZWindow Window; BOOL flag = m_rWindowTable.QueryWindowById(iWinID,Window); ASSERT(flag != FALSE); CStringArray arrayQueID; Window.GetArrayQueId(arrayQueID); for(int i=0;i<arrayQueID.GetCount();i++) { CString queID = arrayQueID.GetAt(i); ASSERT(!queID.IsEmpty()); uWaitCount += GetBussCount(queID); } return uWaitCount; }
BOOL CInlineQueData::GetWindowCanDoQue(UINT nWindowID,CStringArray& queerial_id_array,CString& callStaffID,BOOL* pIsUsePower) { // if(m_lstInlineQue.GetCount() < 1) // { // return FALSE; // } CStringArray arrStrQueId;//可处理队列以及优先级 SLZWindow Window; BOOL flag = m_rWindowTable.QueryWindowById(nWindowID,Window); if(!flag)return FALSE; Window.GetArrayQueId(arrStrQueId);//获取可处理队列及优先级 CString staffID = theApp.m_Controller.m_mapLoginList[Window.GetWindowId()];//获取登录STAFFID if(staffID.IsEmpty())return FALSE; if(arrStrQueId.GetCount() < 1) { return FALSE; } queerial_id_array.Copy(arrStrQueId); callStaffID = staffID; *pIsUsePower = Window.GetIsUsePower(); return TRUE; }
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; }
void CCallThread::ReturnToCaller(CallerCmd& callerCmd) { SLZCCaller* pSLZCCaller = SLZCCaller::GetInstance(); SLZCallerData data; data.SetCmdType(callerCmd.GetCmdType());//命令类型 data.SetAttchMsg(callerCmd.GetCarriedData());//附加信息 switch(data.GetCmdType()) { case cmdLogin: data.SetCmdType(callerCmd.GetSuccess() ? callerCmdShowSuc : callerCmdShowFail); break; case cmdQuit: data.SetCmdType(callerCmd.GetSuccess() ? callerCmdShowSuc : callerCmdShowFail); break; case cmdCall: data.SetCmdType(callerCmdShowNum); break; case cmdRecall: data.SetCmdType(callerCmdShowNum); break; case cmdDiscard: data.SetCmdType(callerCmdShowNum); break; case cmdWait: data.SetCmdType(callerCmdShowNum); break; case cmdEvaReq: // data.SetCmdType(callerCmd.GetSuccess() ? callerCmdShowSuc : callerCmdShowFail); break; case cmdPause: data.SetCmdType(callerCmd.GetSuccess() ? callerCmdShowSuc : callerCmdShowFail); break; case cmdCallNum: data.SetCmdType(callerCmd.GetSuccess() ? callerCmdShowSuc : callerCmdShowFail); break; case cmdCallSec: data.SetCmdType(callerCmd.GetSuccess() ? callerCmdShowSuc : callerCmdShowFail); break; case cmdCallMana: data.SetCmdType(callerCmd.GetSuccess() ? callerCmdShowSuc : callerCmdShowFail); break; case cmdCallBusc: data.SetCmdType(callerCmd.GetSuccess() ? callerCmdShowSuc : callerCmdShowFail); break; case cmdExChange: data.SetCmdType(callerCmd.GetSuccess() ? callerCmdShowSuc : callerCmdShowFail); break; case callerCmdShowAdd: data.SetCmdType(callerCmdShowAdd); break; default: break; } SLZWindow Window; BOOL flag = m_rInlineQueData.m_rWindowTable.QueryWindowById(callerCmd.GetWindowId(),Window); if(flag) { data.SetCallerId(Window.GetCallerId());//呼叫器地址 pSLZCCaller->AddWriteCallerData(data); } }
/* 转移队列/窗口 */ 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); } } } ///////////////////////////////////// } /////////////////////////////////// }
/* 获取排队 队列首个数据 */ 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; }