Преглед на файлове

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

zhangguoyu преди 7 години
родител
ревизия
7233c8c32c
променени са 3 файла, в които са добавени 23 реда и са изтрити 2 реда
  1. 16 1
      ACD/AgentGroup.cpp
  2. 1 1
      ACD/AgentGroup.h
  3. 6 0
      ACD/StrategyLoop.cpp

+ 16 - 1
ACD/AgentGroup.cpp

@@ -80,9 +80,24 @@ bool CAgentGroup::isNoFreeAgent( void )
80 80
 		if(m_pData[i]->isFree())
81 81
 			return false;
82 82
 	}
83
-
84 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 103
 **¡¾º¯ÊýÃû³Æ¡¿	distributeAgent

+ 1 - 1
ACD/AgentGroup.h

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

+ 6 - 0
ACD/StrategyLoop.cpp

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