Prechádzať zdrojové kódy

工时利用率 区域调整

daiyueteng 6 rokov pred
rodič
commit
84dee1fbd9
3 zmenil súbory, kde vykonal 13 pridanie a 5 odobranie
  1. 6 1
      area.cpp
  2. 3 0
      area.h
  3. 4 4
      module_service/area_business_work_rate.cpp

+ 6 - 1
area.cpp

@@ -266,7 +266,7 @@ void area_list::init_from_db(int id/*=-1*/)
 {
     std::string sql = "SELECT a.area_id, a.name, a.map_id, a.area_type_id, a.path,b.scale, \
             over_count_person, over_count_vehicle, over_time_person, over_time_vehicle, \
-            over_speed_vehicle, is_attendance,business_type \
+            over_speed_vehicle, is_attendance,business_type, a.is_work_area\
             FROM dat_area a,dat_map b\
             where a.map_id = b.map_id and  area_id not in \
 			  (select monkeycar_base_info_id from dat_monkeycar_base_info)";
@@ -330,6 +330,9 @@ void area_list::init_from_db(int id/*=-1*/)
 		uint32_t b_type =0;
         DBRes.GetField( "business_type",b_type, Error );
 
+        int is_work_area = 0;
+        DBRes.GetField( "is_work_area",is_work_area, Error );
+
         log_info("init_area : id:%d,path:%s",area_id, path.c_str());
 
         if(-1 == id)
@@ -338,6 +341,7 @@ void area_list::init_from_db(int id/*=-1*/)
             ap->m_limit_vehicle_second = over_time_vehicle;
             ap->m_limit_vehicle_count = over_count_vehicle;
             ap->m_over_speed_vehicle = over_speed_vehicle;
+            ap->m_is_work_area = is_work_area;
 
             ap->m_bound=init_path(path);
             for(const auto &p : ap->m_bound)
@@ -355,6 +359,7 @@ void area_list::init_from_db(int id/*=-1*/)
             tmp_ptr->update(over_count_person, over_time_person,scale,map_id,area_type_id, over_count_vehicle,over_time_vehicle);
             tmp_ptr->m_bound=init_path(path);
             tmp_ptr->m_over_speed_vehicle = over_speed_vehicle;
+            tmp_ptr->m_is_work_area = is_work_area;
             for(const auto &p : tmp_ptr->m_bound)
                 log_info("point:area_id:%d--x:%.2f,y:%.2f",area_id,p.x,p.y);
 

+ 3 - 0
area.h

@@ -94,6 +94,9 @@ public:
 
     //区域速度门限
     double m_over_speed_vehicle;
+
+    //是否是工作区域(0:不是、1:是)
+    int m_is_work_area=0;
 };
 
 struct area_list:single_base<area_list,int,std::shared_ptr<area>>

+ 4 - 4
module_service/area_business_work_rate.cpp

@@ -34,7 +34,7 @@ void area_business_work_rate::on_enter(const std::shared_ptr<area_hover>&area_ho
 
     auto area = std::make_shared<area_data>();
     area->area_id = area_hover_ptr->id();
-    //area->is_work_area = area_hover_ptr->m_area->
+    area->is_work_area = area_hover_ptr->m_area->m_is_work_area;
     area->enter_time = tool_time::now_to_seconds();
 
     three_rates::get_instance()->enter_area(card, area);
@@ -57,12 +57,12 @@ void area_business_work_rate::on_leave(const std::shared_ptr<area_hover>&area_ho
     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
+    card->work_line = card_ptr->get_workline();
+    card->identifier_id = card_ptr->m_cid;
 
     auto area = std::make_shared<area_data>();
     area->area_id = area_hover_ptr->id();
-    //area->is_work_area = area_hover_ptr->m_area->
+    area->is_work_area = area_hover_ptr->m_area->m_is_work_area;
     area->leave_time = tool_time::now_to_seconds();
 
     three_rates::get_instance()->leave_area(card, area);