update Mi 4. Mär 17:31:01 CET 2020
This commit is contained in:
parent
dcc95f3a15
commit
beb02f9d52
36
server/sql_qry.js
Normal file → Executable file
36
server/sql_qry.js
Normal file → Executable file
@ -757,6 +757,39 @@ module.exports = function(db, uuidv4, app_cfg) {
|
||||
});
|
||||
};
|
||||
|
||||
function db_get_single_response_by_rmlduuid(rmld_uuid, callback) {
|
||||
db.get(`SELECT * FROM waip_response WHERE rmld_uuid like ?`, [rmld_uuid], function (err, row) {
|
||||
if (err == null && row) {
|
||||
console.log('single_rmld_uuid '+row);
|
||||
if (row.einsatzkraft == 1) {
|
||||
row.einsatzkraft = true;
|
||||
} else {
|
||||
row.einsatzkraft = false;
|
||||
};
|
||||
if (row.maschinist == 1) {
|
||||
row.maschinist = true;
|
||||
} else {
|
||||
row.maschinist = false;
|
||||
};
|
||||
if (row.fuehrungskraft == 1) {
|
||||
row.fuehrungskraft = true;
|
||||
} else {
|
||||
row.fuehrungskraft = false;
|
||||
};
|
||||
if (row.agt == 1) {
|
||||
row.agt = true;
|
||||
} else {
|
||||
row.agt = false;
|
||||
};
|
||||
// response_wache aufsummieren
|
||||
callback && callback(row);
|
||||
|
||||
} else {
|
||||
callback && callback(null);
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
function db_get_einsatzdaten_by_uuid(waip_uuid, callback){
|
||||
db.get(`SELECT e.id, e.uuid, e.ZEITSTEMPEL, e.EINSATZART, e.STICHWORT, e.SONDERSIGNAL, e.OBJEKT, e.ORT,
|
||||
e.ORTSTEIL, e.STRASSE, e.BESONDERHEITEN, e.wgs84_x, e.wgs84_y, e.wgs84_area FROM WAIP_EINSAETZE e
|
||||
@ -833,7 +866,8 @@ module.exports = function(db, uuidv4, app_cfg) {
|
||||
db_get_response_gesamter_einsatz: db_get_response_gesamter_einsatz,
|
||||
db_get_response_for_wache: db_get_response_for_wache,
|
||||
db_get_einsatzdaten_by_uuid: db_get_einsatzdaten_by_uuid,
|
||||
db_get_waipid_by_uuid:db_get_waipid_by_uuid
|
||||
db_get_waipid_by_uuid:db_get_waipid_by_uuid,
|
||||
db_get_single_response_by_rmlduuid, db_get_single_response_by_rmlduuid
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
@ -74,19 +74,33 @@ module.exports = function(io, sql, async, app_cfg) {
|
||||
sql.db_get_waipid_by_uuid(waip_uuid, function(waip_id) {
|
||||
|
||||
console.log('rueckmeldung waip_id: '+waip_id);
|
||||
|
||||
|
||||
|
||||
sql.db_get_einsatzwachen(waip_id, function(data) {
|
||||
console.log(data);
|
||||
/*if (data) {
|
||||
if (data) {
|
||||
|
||||
|
||||
data.forEach(function(row) {
|
||||
console.log(row.room);
|
||||
|
||||
var room_stockets = io.sockets.adapter.rooms[socketid];
|
||||
|
||||
sql.db_get_single_response_by_rmlduuid(rmld_uuid, function(rmld){
|
||||
console.log('vorhandene reuckmeldungen fuer die wache: ' + rmld);
|
||||
if (rmld) {
|
||||
//waip.reuckmeldung_senden(socket.id, rmld);
|
||||
io.to(row.room).emit('io.response', 'a');
|
||||
};
|
||||
});
|
||||
|
||||
/* var room_stockets = io.sockets.adapter.rooms[socketid];
|
||||
if (typeof socketid !== 'undefined') {
|
||||
Object.keys(room_stockets.sockets).forEach(function(socket_id) {
|
||||
io.sockets.to(socketid).emit('io.response', rmld)
|
||||
sql.db_log('WAIP', 'Rückmeldung ' + rmld + ' an Socket ' + socket_id + ' gesendet');
|
||||
});
|
||||
};
|
||||
};*/
|
||||
|
||||
|
||||
//sql.db_get_response_wache(waip_id, row.room, function(result){
|
||||
@ -99,7 +113,7 @@ module.exports = function(io, sql, async, app_cfg) {
|
||||
});
|
||||
} else {
|
||||
sql.db_log('Fehler-WAIP', 'Fehler: Wache für waip_id ' + waip_id + ' nicht vorhanden, Rückmeldung konnte nicht verteilt werden!');
|
||||
};*/
|
||||
};
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user