mine.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #ifndef MINE_H
  2. #define MINE_H
  3. /**
  4. * @brief 矿井里相关的业务
  5. * @author 戴月腾
  6. * @date 2018-09-24
  7. */
  8. #include <unordered_map>
  9. #include <log.h>
  10. #include <chrono>
  11. #include "common.h"
  12. #include <memory>
  13. struct card_location_base;
  14. struct mine_tool
  15. {
  16. mine_tool()
  17. :m_over_speed_count(0)
  18. ,m_normal_speed_count(0)
  19. ,m_status_call(0)
  20. ,m_stat_attendance(AS_INIT)
  21. ,m_attendance_start_time(std::chrono::seconds(0))
  22. ,m_is_overtime(false)
  23. ,m_overtime(std::chrono::seconds(0))
  24. {
  25. }
  26. int m_over_speed_count;
  27. int m_normal_speed_count;
  28. ///CALL_NONE(0):没有呼叫,CALL_ING(2):正在呼叫,CALL_SUCCESSED(1):呼叫成功
  29. int m_status_call;
  30. ///考勤状态 0初始状态 1 没在考勤 2 考勤;参看ATTENDANCE_STATUS
  31. int m_stat_attendance;
  32. ///考勤开始时间
  33. std::chrono::system_clock::time_point m_attendance_start_time;
  34. //井下是否超时
  35. bool m_is_overtime;
  36. //井下超时时间
  37. std::chrono::system_clock::time_point m_overtime;
  38. void on_point(uint32_t card_id, int32_t type, int vehicle_category_id);
  39. //检查井下超时
  40. void on_check_overtime(uint32_t card_id, int32_t type);
  41. uint64_t get_down_time();
  42. uint64_t get_work_time();
  43. int32_t is_on_duty();
  44. bool is_attendance()
  45. {
  46. return AS_ATTENDANCE == m_stat_attendance;
  47. }
  48. };
  49. #endif // MINE_H