hd

CellCancelQueue.cpp 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. #include "StdAfx.h"
  2. #include "CellCancelQueue.h"
  3. #include "NetworkIvr.h"
  4. #include "IvrFlow.h"
  5. #include "FlowDataProvider.h"
  6. IMPLEMENT_CELL_AUTOCREATE(CCellCancelQueue, CELL_NAME_CANCEL_QUEUE)
  7. CCellCancelQueue::CCellCancelQueue(void) : m_NextPos(0), m_Reason("")
  8. {
  9. }
  10. CCellCancelQueue::CCellCancelQueue( CCellCancelQueue & cellCancelQueue ) : CCellBase(cellCancelQueue), m_NextPos(cellCancelQueue.m_NextPos), m_Reason(cellCancelQueue.m_Reason)
  11. {
  12. }
  13. CCellCancelQueue::~CCellCancelQueue(void)
  14. {
  15. }
  16. /*****************************************************************
  17. **【函数名称】 Operate
  18. **【函数功能】 节点执行函数
  19. **【参数】
  20. **【返回值】 下一个节点编号
  21. ****************************************************************/
  22. int CCellCancelQueue::operate( void )
  23. {
  24. if(m_pIvrFlow == NULL)
  25. return CELL_OP_ERROR;
  26. CString Info;
  27. _getCellInfo(Info);
  28. ILogger::getInstance().log(LOG_CLASS_BUSI, LOG_LEVEL_NORMAL, _T("{Cell}: 开始执行[%s]"), Info);
  29. CPduEntity CmdCancelQueue(PDU_CMD_IVR_QUEUE_CANCEL);
  30. CmdCancelQueue.SetDataInt(1,m_pIvrFlow->id());
  31. if( !CNetworkIvr::GetInstance().send(CmdCancelQueue))
  32. {
  33. ILogger::getInstance().log(LOG_CLASS_SOCKET, LOG_LEVEL_WARNING, _T("{Cell}: 执行[%s]出错, 向CTI发送消息失败"), Info);
  34. return CELL_OP_SEND_ERROR;
  35. }
  36. ILogger::getInstance().log(LOG_CLASS_BUSI, LOG_LEVEL_NORMAL, _T("{Cell}: 执行[%s]结束, 放弃排队原因: %s"), Info, m_Reason);
  37. return m_NextPos;
  38. }
  39. /*****************************************************************
  40. **【函数名称】 copy
  41. **【函数功能】 拷贝自身
  42. **【参数】
  43. **【返回值】 拷贝副本
  44. ****************************************************************/
  45. CCellBase * CCellCancelQueue::copy( void )
  46. {
  47. CCellBase *pCellBase = new CCellCancelQueue(*this);
  48. return pCellBase;
  49. }
  50. /*****************************************************************
  51. **【函数名称】 fillData
  52. **【函数功能】 节点解析,填充数据
  53. **【参数】 Provider:数据提供器
  54. **【返回值】 成功true,失败false
  55. ****************************************************************/
  56. bool CCellCancelQueue::fillData( IFlowDataProvider& Provider )
  57. {
  58. CString Data;
  59. do
  60. {
  61. if(!Provider.getData(CELL_ATTRIBUTE_POS, Data))
  62. {
  63. Data = _T("节点号");
  64. break;
  65. }
  66. else
  67. {
  68. sscanf_s(Data, _T("%d"), &m_Pos);
  69. if(m_Pos < 1)
  70. {
  71. Data = _T("节点号");
  72. break;
  73. }
  74. }
  75. Provider.getData(CELL_ATTRIBUTE_REASON, m_Reason);
  76. if(!Provider.getData(CELL_ATTRIBUTE_NEXT, Data))
  77. {
  78. Data = _T("下一节点号");
  79. break;
  80. }
  81. else
  82. {
  83. sscanf_s(Data, _T("%d"), &m_NextPos);
  84. if(m_NextPos < 1)
  85. {
  86. Data = _T("下一节点号");
  87. break;
  88. }
  89. }
  90. Provider.getData(CELL_ATTRIBUTE_NOTE, m_Note);
  91. return true;
  92. } while (false);
  93. ILogger::getInstance().log(LOG_CLASS_BUSI, LOG_LEVEL_ERROR, _T("{Cell}: 节点[%s]解析失败, '%s'错误"), CELL_NAME_CANCEL_QUEUE, Data);
  94. return false;
  95. }