|
@@ -9748,7 +9748,8 @@ void CYAServerDlg::init_base_data()
|
|
|
void CYAServerDlg::load_his_data()
|
|
|
{
|
|
|
//load_his_reader(); // 分站状态
|
|
|
- load_his_card_postion(); // 标识卡所在位置
|
|
|
+ load_his_card_postion_vehicle(); // 标识卡所在位置
|
|
|
+ load_his_card_postion_staff();
|
|
|
//load_his_card_state();
|
|
|
deal_hist_card_postion();
|
|
|
load_his_driving_face_card_postion();//掘进面卡所在位置
|
|
@@ -9789,7 +9790,7 @@ void CYAServerDlg::load_his_area()
|
|
|
show_log(strlog);
|
|
|
}
|
|
|
|
|
|
-void CYAServerDlg::load_his_card_postion()
|
|
|
+void CYAServerDlg::load_his_card_postion_vehicle()
|
|
|
{
|
|
|
CMysqlConn* pConn = NULL;
|
|
|
CDBConnGuard pDbGuard(pConn);
|
|
@@ -9858,7 +9859,80 @@ void CYAServerDlg::load_his_card_postion()
|
|
|
}
|
|
|
mysql_free_result(pRes);
|
|
|
CString strlog;
|
|
|
- strlog.Format(_T("%s%d%s"), _T(LOG_LOAD_HIS_POSTION), nRow, _T(LOG_RECORD_COUNT));
|
|
|
+ strlog.Format(_T("%s%d%s"), _T(LOG_LOAD_HIS_POSTION_VEHICLE), nRow, _T(LOG_RECORD_COUNT));
|
|
|
+ show_log(strlog);
|
|
|
+}
|
|
|
+
|
|
|
+void CYAServerDlg::load_his_card_postion_staff()
|
|
|
+{
|
|
|
+ CMysqlConn* pConn = NULL;
|
|
|
+ CDBConnGuard pDbGuard(pConn);
|
|
|
+
|
|
|
+ if(pConn == NULL){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ MYSQL_RES* pRes;
|
|
|
+ MYSQL_ROW pRow;
|
|
|
+ int err = 0;
|
|
|
+ char buf[LENGTH_SQL] = {0};
|
|
|
+ sprintf_s(buf, "select l.card_id, l.cur_time, l.x, l.y, l.z, l.map_id, l.area_id, l.state, \
|
|
|
+ case when l.cur_time >= date_sub(now(), interval 2 minute) then l.speed else 0 end as speed, \
|
|
|
+ l.mileage, la.enter_time, att.start_time, \
|
|
|
+ case when isnull(att.end_time) then 2 else 1 end as down_state \
|
|
|
+ from rt_location l, rt_location_area la, rt_att_staff att, dat_card c \
|
|
|
+ where l.card_id = c.card_id and l.card_id = la.card_id and l.card_id = att.card_id \
|
|
|
+ and c.state=0;");
|
|
|
+
|
|
|
+ pRes = pConn->Execute(buf, err);
|
|
|
+
|
|
|
+ if (err)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ int nRow = 0;
|
|
|
+ std::string rec_time, enter_time, start_time;
|
|
|
+ while(pRow = mysql_fetch_row(pRes)){
|
|
|
+ CardMap::iterator it = mp_card_list_all.find(pRow[0]);
|
|
|
+ if(it != mp_card_list_all.end()){
|
|
|
+ rec_time = pRow[1];
|
|
|
+ API_StringToTime(rec_time, it->second->rec_time);
|
|
|
+
|
|
|
+ it->second->x = atof(pRow[2]);
|
|
|
+ it->second->y = atof(pRow[3]);
|
|
|
+ it->second->z = atof(pRow[4]);
|
|
|
+
|
|
|
+ it->second->map_id = atoi(pRow[5]);
|
|
|
+ it->second->area_id = atoi(pRow[6]);
|
|
|
+ it->second->state = atoi(pRow[7]);
|
|
|
+ it->second->set_speed(atof(pRow[8]));
|
|
|
+ it->second->mileage = atof(pRow[9]);
|
|
|
+
|
|
|
+ enter_time = pRow[10];
|
|
|
+ CFunctions::string2systemtime(enter_time,it->second->enter_area_time);
|
|
|
+ start_time = pRow[11];
|
|
|
+ API_StringToTime(start_time, it->second->down_time);
|
|
|
+
|
|
|
+ it->second->pos_state = atoi(pRow[12]);
|
|
|
+ it->second->pos_state_old = it->second->pos_state;
|
|
|
+
|
|
|
+ it->second->last_x = it->second->x;
|
|
|
+ it->second->last_y = it->second->y;
|
|
|
+ it->second->last_z = it->second->z;
|
|
|
+
|
|
|
+ ::GetLocalTime(&it->second->deal_time);
|
|
|
+
|
|
|
+ it->second->is_hist = true;
|
|
|
+ it->second->isdealed = true;
|
|
|
+ it->second->isoutput = true;
|
|
|
+ it->second->issent = false;
|
|
|
+ nRow++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ mysql_free_result(pRes);
|
|
|
+ CString strlog;
|
|
|
+ strlog.Format(_T("%s%d%s"), _T(LOG_LOAD_HIS_POSTION_STAFF), nRow, _T(LOG_RECORD_COUNT));
|
|
|
show_log(strlog);
|
|
|
}
|
|
|
|