Browse Source

增加area_business_work_rate

daiyueteng 6 years ago
parent
commit
2e73158116

+ 70 - 0
module_service/area_business_work_rate.cpp

@@ -0,0 +1,70 @@
+#include"area_business_work_rate.h"
+
+#include<memory>
+#include<string>
+
+#include"log.h"
+#include"card.h"
+#include"struct_def.h"
+#include"three_rates.h"
+#include"area.h"
+#include"card.h"
+#include"tool_time.h"
+
+struct work_rate_data:business_data
+{
+    work_rate_data()
+    {
+    }
+};
+
+void area_business_work_rate::on_enter(const std::shared_ptr<area_hover>&area_hover_ptr,
+                                       const std::shared_ptr<card_location_base>&card_ptr,std::shared_ptr<business_data>& ptr)
+{
+    if(!card_ptr->is_person())
+    {
+        return;
+    }
+
+    auto card = std::make_shared<card_pos>();
+    card->id = card_ptr->m_id;
+    card->type = card_ptr->m_type;
+    //card->work_line =
+    //card->identifier_id
+
+    auto area = std::make_shared<area_data>();
+    area->area_id = area_hover_ptr->id();
+    //area->is_work_area = area_hover_ptr->m_area->
+    area->enter_time = tool_time::now_to_seconds();
+
+    three_rates::get_instance()->enter_area(card, area);
+}
+
+void area_business_work_rate::on_hover(const std::shared_ptr<area_hover>&area_hover_ptr,
+                                       const std::shared_ptr<card_location_base>&card_ptr,std::shared_ptr<business_data> ptr)
+{
+}
+
+
+void area_business_work_rate::on_leave(const std::shared_ptr<area_hover>&area_hover_ptr,
+                                       const std::shared_ptr<card_location_base>&card_ptr,std::shared_ptr<business_data> ptr)
+{
+    if(!card_ptr->is_person())
+    {
+        return;
+    }
+
+    auto card = std::make_shared<card_pos>();
+    card->id = card_ptr->m_id;
+    card->type = card_ptr->m_type;
+    //card->work_line =
+    //card->identifier_id
+
+    auto area = std::make_shared<area_data>();
+    area->area_id = area_hover_ptr->id();
+    //area->is_work_area = area_hover_ptr->m_area->
+    area->leave_time = tool_time::now_to_seconds();
+
+    three_rates::get_instance()->leave_area(card, area);
+}
+

+ 22 - 0
module_service/area_business_work_rate.h

@@ -0,0 +1,22 @@
+#ifndef AREA_BUSINESS_WORK_RATE
+#define AREA_BUSINESS_WORK_RATE
+
+#include<area_business.h>
+
+/**
+ * @brief 工时利用率
+ */
+class area_business_work_rate:public area_business
+{
+public:
+    int area_business_type()
+    {
+        return 13;
+    }
+
+    void on_enter(const std::shared_ptr<area_hover>&a,const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data>&ptr);
+    void on_hover(const std::shared_ptr<area_hover>&a,const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr);
+    void on_leave(const std::shared_ptr<area_hover>&a,const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr);
+};
+
+#endif // AREA_BUSINESS_WORK_RATE