update Mi 4. Mär 11:31:01 CET 2020
This commit is contained in:
parent
13d27dc8ec
commit
dbc600bb4f
@ -193,7 +193,7 @@ module.exports = function(app, sql, uuidv4, app_cfg, passport, auth, waip, udp)
|
||||
if (result) {
|
||||
req.flash('successMessage', 'Rückmeldung erfolgreich gesendet, auf zum Einsatz!');
|
||||
res.redirect('/rmld/' + waip_uuid + '/' + rmld_uuid );
|
||||
waip.reuckmeldung_verteilen_by_uuid(req.params.rmld_uuid);
|
||||
waip.reuckmeldung_verteilen_by_uuid(waip_uuid, rmld_uuid);
|
||||
} else {
|
||||
req.flash('errorMessage', 'Fehler beim Senden der Rückmeldung!');
|
||||
res.redirect('/rmld/' + waip_uuid + '/' + rmld_uuid );
|
||||
|
||||
@ -41,10 +41,10 @@ socket_api.emit('CH01', 'me', 'test msg');
|
||||
waip.einsatz_verteilen(result_einsatz[0].waip_einsaetze_ID, socket.id, wachen_id);
|
||||
sql.db_update_client_status(socket, result_einsatz[0].waip_einsaetze_ID);
|
||||
//vorhanden Rückmeldungen verteilen
|
||||
sql.db_get_response_wache(result_einsatz[0].waip_einsaetze_ID, wachen_id, function(result){
|
||||
console.log('response_wache: ' + result);
|
||||
if (result) {
|
||||
waip.reuckmeldung_verteilen(result_einsatz[0].waip_einsaetze_ID, result);
|
||||
sql.db_get_response_for_wache(result_einsatz[0].waip_einsaetze_ID, wachen_id, function(rmld){
|
||||
console.log('vorhandene reuckmeldungen fuer die wache: ' + rmld);
|
||||
if (rmld) {
|
||||
waip.reuckmeldung_senden(socket.id, rmld);
|
||||
};
|
||||
});
|
||||
} else {
|
||||
@ -61,15 +61,15 @@ socket_api.emit('CH01', 'me', 'test msg');
|
||||
};
|
||||
});
|
||||
});
|
||||
socket.on('response', function(waip_id, responseobj) {
|
||||
//socket.on('response', function(waip_id, responseobj) {
|
||||
//var i_ek = ek ? 1 : 0;
|
||||
//var i_ma = ma ? 1 : 0;
|
||||
//var i_fk = fk ? 1 : 0;
|
||||
//var i_agt = agt ? 1 : 0;
|
||||
sql.db_update_response(waip_id, responseobj, function(result){
|
||||
waip.reuckmeldung_verteilen(waip_id, result);
|
||||
});
|
||||
});
|
||||
//sql.db_update_response(waip_id, responseobj, function(result){
|
||||
//waip.reuckmeldung_verteilen(waip_id, result);
|
||||
//});
|
||||
//});
|
||||
// TODO: socket.on(Version) um Server-Version abzugleichen
|
||||
});
|
||||
|
||||
|
||||
@ -699,7 +699,7 @@ module.exports = function(db, uuidv4, app_cfg) {
|
||||
});
|
||||
};
|
||||
|
||||
function db_get_response_wache(waip_einsaetze_id, wachen_nr, callback) {
|
||||
function db_get_response_for_wache(waip_einsaetze_id, wachen_nr, callback) {
|
||||
db.all(`SELECT * FROM waip_response WHERE waip_uuid = (select uuid from waip_einsaetze where id = ?)`, [waip_einsaetze_id], function (err, rows) {
|
||||
if (err == null && rows) {
|
||||
|
||||
@ -831,7 +831,7 @@ module.exports = function(db, uuidv4, app_cfg) {
|
||||
//db_update_response: db_update_response,
|
||||
db_save_rmld: db_save_rmld,
|
||||
db_get_response_gesamter_einsatz: db_get_response_gesamter_einsatz,
|
||||
db_get_response_wache: db_get_response_wache,
|
||||
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
|
||||
};
|
||||
|
||||
@ -69,47 +69,59 @@ module.exports = function(io, sql, async, app_cfg) {
|
||||
});
|
||||
};
|
||||
|
||||
function reuckmeldung_verteilen_by_uuid(waip_uuid) {
|
||||
function reuckmeldung_verteilen_by_uuid(waip_uuid, rmld_uuid) {
|
||||
|
||||
sql.db_get_waipid_by_uuid(waip_uuid, function(waip_id) {
|
||||
console.log('rueckmeldung waip_id: '+waip_id);
|
||||
|
||||
/*console.log('rueckmeldung waip_id: '+waip_id);
|
||||
sql.db_get_einsatzwachen(waip_id, function(data) {
|
||||
console.log(data);
|
||||
if (data) {
|
||||
|
||||
data.forEach(function(row) {
|
||||
sql.db_get_response_wache(waip_id, row.room, function(result){
|
||||
console.log('response_wache: ' + result);
|
||||
if (row.room) {
|
||||
reuckmeldung_verteilen(waip_id, result);
|
||||
};
|
||||
|
||||
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){
|
||||
//console.log('response_wache: ' + result);
|
||||
//if (row.room) {
|
||||
//reuckmeldung_verteilen(waip_id, result);
|
||||
//};
|
||||
//});
|
||||
|
||||
});
|
||||
} else {
|
||||
sql.db_log('Fehler-WAIP', 'Fehler: Wache für waip_id ' + waip_id + ' nicht vorhanden, Rückmeldung konnte nicht verteilt werden!');
|
||||
};
|
||||
});
|
||||
});*/
|
||||
});
|
||||
};
|
||||
|
||||
function reuckmeldung_verteilen(waip_id, result) {
|
||||
console.log('rueckmeldung alt: '+waip_id + ' ' + result);
|
||||
sql.db_get_einsatzwachen(waip_id, function(data) {
|
||||
if (data) {
|
||||
data.forEach(function(row) {
|
||||
function reuckmeldung_senden(socketid, rmld) {
|
||||
//console.log('rueckmeldung alt: '+waip_id + ' ' + result);
|
||||
//sql.db_get_einsatzwachen(waip_id, function(data) {
|
||||
// if (data) {
|
||||
//data.forEach(function(row) {
|
||||
// fuer jede Wache(row.room) die verbundenen Sockets(Clients) ermitteln und Einsatz verteilen
|
||||
var room_stockets = io.sockets.adapter.rooms[row.room];
|
||||
if (typeof room_stockets !== 'undefined') {
|
||||
Object.keys(room_stockets.sockets).forEach(function(socket_id) {
|
||||
io.sockets.to(socket_id).emit('io.response', result)
|
||||
sql.db_log('WAIP', 'Rückmeldung ' + result + ' an Socket ' + socket_id + ' gesendet');
|
||||
});
|
||||
//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 ' + socketid + ' gesendet');
|
||||
//});
|
||||
};
|
||||
});
|
||||
} else {
|
||||
sql.db_log('Fehler-WAIP', 'Fehler: Wache für waip_id ' + waip_id + ' nicht vorhanden, Rückmeldung konnte nicht verteilt werden!');
|
||||
};
|
||||
});
|
||||
//});
|
||||
//} else {
|
||||
//sql.db_log('Fehler-WAIP', 'Fehler: Wache für waip_id ' + waip_id + ' nicht vorhanden, Rückmeldung konnte nicht verteilt werden!');
|
||||
//};
|
||||
//});
|
||||
};
|
||||
|
||||
function tts_erstellen(app_cfg, socket_id, einsatzdaten, callback) {
|
||||
@ -291,7 +303,7 @@ module.exports = function(io, sql, async, app_cfg) {
|
||||
return {
|
||||
einsatz_speichern: einsatz_speichern,
|
||||
einsatz_verteilen: einsatz_verteilen,
|
||||
reuckmeldung_verteilen: reuckmeldung_verteilen,
|
||||
reuckmeldung_senden: reuckmeldung_senden,
|
||||
reuckmeldung_verteilen_by_uuid: reuckmeldung_verteilen_by_uuid
|
||||
};
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user