Procházet zdrojové kódy

2018.6.14严格轮循。从队头轮到队尾

zhangguoyu %!s(int64=7) %!d(string=před) roky
rodič
revize
7233c8c32c
3 změnil soubory, kde provedl 23 přidání a 2 odebrání
  1. 16 1
      ACD/AgentGroup.cpp
  2. 1 1
      ACD/AgentGroup.h
  3. 6 0
      ACD/StrategyLoop.cpp

+ 16 - 1
ACD/AgentGroup.cpp

80
 		if(m_pData[i]->isFree())
80
 		if(m_pData[i]->isFree())
81
 			return false;
81
 			return false;
82
 	}
82
 	}
83
-
84
 	return true;
83
 	return true;
85
 }
84
 }
85
+//2018.6.14 for ÑϸñÑ­»·
86
+CAgent* CAgentGroup::GetFreeAgentForLoop()
87
+{
88
+	CSingleLock Lock(&m_CsLock4Distribute, TRUE);
89
+	CAgent *pAgent = NULL;
90
+
91
+	for (int idx = m_nSize; idx > 0; idx-- ) {
92
+		pAgent = m_pData[0];
93
+		RemoveAt(0, 1);
94
+		Add(pAgent);
95
+		if (pAgent->isFree()) {
96
+			break;
97
+		}
98
+	}
99
+	return pAgent;
100
+}
86
 
101
 
87
 /*****************************************************************
102
 /*****************************************************************
88
 **¡¾º¯ÊýÃû³Æ¡¿	distributeAgent
103
 **¡¾º¯ÊýÃû³Æ¡¿	distributeAgent

+ 1 - 1
ACD/AgentGroup.h

30
 	void clear(void);
30
 	void clear(void);
31
 	bool isNoFreeAgent(void);		// ÊÇ·ñ×ùϯȫæ
31
 	bool isNoFreeAgent(void);		// ÊÇ·ñ×ùϯȫæ
32
 	QUEUE_AGENT_RESULT distributeAgent(CStrategyAD* pStrategy, const CString& InfoEx, UINT& Agent, UINT& Exten);
32
 	QUEUE_AGENT_RESULT distributeAgent(CStrategyAD* pStrategy, const CString& InfoEx, UINT& Agent, UINT& Exten);
33
-
33
+	CAgent* GetFreeAgentForLoop();
34
 private:
34
 private:
35
 	CCriticalSection m_CsLock4Distribute;
35
 	CCriticalSection m_CsLock4Distribute;
36
 };
36
 };

+ 6 - 0
ACD/StrategyLoop.cpp

24
 	CAgent* pAgent = NULL;
24
 	CAgent* pAgent = NULL;
25
 	bool t_b_has_jump = false;
25
 	bool t_b_has_jump = false;
26
 
26
 
27
+	pAgent = AgentGroup.GetFreeAgentForLoop();
28
+
29
+	return pAgent;
30
+	/* 
27
 	for(int i=0; i<AgentGroup.GetCount(); ++i)	// ±£Ö¤±éÀúÒ»ÂÖ
31
 	for(int i=0; i<AgentGroup.GetCount(); ++i)	// ±£Ö¤±éÀúÒ»ÂÖ
28
 	{
32
 	{
29
 		if(m_Index >= AgentGroup.GetCount())
33
 		if(m_Index >= AgentGroup.GetCount())
48
 				return pAgent;
52
 				return pAgent;
49
 		} // end if
53
 		} // end if
50
 	}
54
 	}
55
+
51
 	return NULL;
56
 	return NULL;
57
+	*/
52
 }
58
 }