alsmanager_lib 3.0.192 → 3.0.194
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/modules.js +88 -5
- package/package.json +1 -1
package/lib/modules.js
CHANGED
|
@@ -8165,6 +8165,80 @@ function queryAllFunctions() {
|
|
|
8165
8165
|
var query = "select f.id, f.name as func_name from functions f ";
|
|
8166
8166
|
return query;
|
|
8167
8167
|
}
|
|
8168
|
+
// Manage Pianificazioni
|
|
8169
|
+
/*
|
|
8170
|
+
CREATE TABLE "piano_interventi" (
|
|
8171
|
+
"id" INTEGER,
|
|
8172
|
+
"frequenza" TEXT,
|
|
8173
|
+
"date_start" TEXT,
|
|
8174
|
+
"date_max_end" TEXT,
|
|
8175
|
+
"descrizione" TEXT,
|
|
8176
|
+
PRIMARY KEY("id" AUTOINCREMENT)
|
|
8177
|
+
)
|
|
8178
|
+
*/
|
|
8179
|
+
function selectPianificazioni(filter_date_start, filter_date_end) {
|
|
8180
|
+
var dt_start = convertDateToStringDB(filter_date_start);
|
|
8181
|
+
var dt_end = convertDateToStringDB(filter_date_end);
|
|
8182
|
+
|
|
8183
|
+
var query = "select id, frequenza, date_start, date_max_end, descrizione, id_assegnazione from piano_interventi ";
|
|
8184
|
+
var where_clause = "";
|
|
8185
|
+
if (dt_start != "") {
|
|
8186
|
+
where_clause += "date_start >= '" + dt_start + "' ";
|
|
8187
|
+
}
|
|
8188
|
+
if (dt_end != "") {
|
|
8189
|
+
if (where_clause != "") {
|
|
8190
|
+
where_clause += " and ";
|
|
8191
|
+
}
|
|
8192
|
+
where_clause += "date_max_end <= '" + dt_end + "' ";
|
|
8193
|
+
}
|
|
8194
|
+
query += where_clause;
|
|
8195
|
+
query += "order by date_start, date_max_end desc";
|
|
8196
|
+
return query;
|
|
8197
|
+
}
|
|
8198
|
+
|
|
8199
|
+
function selectPianificazioneById(id_pianificazione) {
|
|
8200
|
+
var query = "select id, frequenza, date_start, date_max_end, descrizione, id_assegnazione from piano_interventi ";
|
|
8201
|
+
query += "where id = " + id_pianificazione;
|
|
8202
|
+
return query;
|
|
8203
|
+
}
|
|
8204
|
+
|
|
8205
|
+
function insertPianificazione(frequenza, date_start, date_max_end, descrizione, id_assegnazione) {
|
|
8206
|
+
var query = "insert into piano_interventi (frequenza, date_start, date_max_end, descrizione, id_assegnazione) values (";
|
|
8207
|
+
query += "'" + frequenza + "', ";
|
|
8208
|
+
query += "'" + date_start + "', ";
|
|
8209
|
+
query += "'" + date_max_end + "', ";
|
|
8210
|
+
query += "'" + descrizione + "', ";
|
|
8211
|
+
query += id_assegnazione + " ";
|
|
8212
|
+
query += ")";
|
|
8213
|
+
return query;
|
|
8214
|
+
}
|
|
8215
|
+
|
|
8216
|
+
function updatePianificazione(id_pianificazione, frequenza, date_start, date_max_end, descrizione, id_assegnazione) {
|
|
8217
|
+
var query = "update piano_interventi set ";
|
|
8218
|
+
query += "frequenza = '" + frequenza + "', ";
|
|
8219
|
+
query += "date_start = '" + date_start + "', ";
|
|
8220
|
+
query += "date_max_end = '" + date_max_end + "', ";
|
|
8221
|
+
query += "descrizione = '" + descrizione + "', ";
|
|
8222
|
+
query += "id_assegnazione = " + id_assegnazione + " ";
|
|
8223
|
+
query += "where id = " + id_pianificazione;
|
|
8224
|
+
return query;
|
|
8225
|
+
}
|
|
8226
|
+
|
|
8227
|
+
function removePianificazione(id_pianificazione) {
|
|
8228
|
+
var query = "delete from piano_interventi ";
|
|
8229
|
+
query += "where id = " + id_pianificazione;
|
|
8230
|
+
return query;
|
|
8231
|
+
}
|
|
8232
|
+
|
|
8233
|
+
function getFrequenzaTypes() {
|
|
8234
|
+
var query = "select id, name from frequenza_type order by id"
|
|
8235
|
+
return query;
|
|
8236
|
+
}
|
|
8237
|
+
|
|
8238
|
+
//End manage pianificazioni
|
|
8239
|
+
|
|
8240
|
+
|
|
8241
|
+
|
|
8168
8242
|
//
|
|
8169
8243
|
function selectInterventiSQLite(data_da, data_a) {
|
|
8170
8244
|
var query = "select id, data_inizio as Inizio, data_fine as Fine, description as Descrizione from interventi ";
|
|
@@ -8277,7 +8351,7 @@ function insertInterventoSQLite(id_place, id_site, id_pianificazione, data_inizi
|
|
|
8277
8351
|
return query;
|
|
8278
8352
|
}
|
|
8279
8353
|
|
|
8280
|
-
function insertInterventoMySQL(id_place, id_site, data_inizio, data_fine, richiedente, esecutore, id_esecutore, tipo_esecutore, tipo_risoluzione, descrizione) {
|
|
8354
|
+
function insertInterventoMySQL(id_place, id_site, id_pianificazione, data_inizio, data_fine, richiedente, esecutore, id_esecutore, tipo_esecutore, tipo_risoluzione, descrizione) {
|
|
8281
8355
|
var query = "insert into interventi (id_place, id_site, data_inizio, data_fine, request_by, executed_by, id_executor, executor_type, tipo_risoluzione, description) ";
|
|
8282
8356
|
query += " values ('" + id_place + "', ";
|
|
8283
8357
|
query += id_site +", ";
|
|
@@ -8365,7 +8439,7 @@ function removeInterventoSQLite(id_intervento) {
|
|
|
8365
8439
|
return query;
|
|
8366
8440
|
}
|
|
8367
8441
|
|
|
8368
|
-
function removeInterventoMySQL(
|
|
8442
|
+
function removeInterventoMySQL() {
|
|
8369
8443
|
var query = "delete from interventi ";
|
|
8370
8444
|
query += " where id = :id_intervento";
|
|
8371
8445
|
return query;
|
|
@@ -8379,7 +8453,7 @@ function removeIntervento(db_used,id_intervento) {
|
|
|
8379
8453
|
query = removeInterventoSQLite(id_intervento);
|
|
8380
8454
|
break;
|
|
8381
8455
|
case 'MYSQL':
|
|
8382
|
-
query = removeInterventoMySQL(
|
|
8456
|
+
query = removeInterventoMySQL();
|
|
8383
8457
|
break;
|
|
8384
8458
|
case 'MYSQL2':
|
|
8385
8459
|
query = removeInterventoSQLite(id_intervento);
|
|
@@ -8398,7 +8472,7 @@ function selectDevicesInterventoByIdInterventoSQLite(id_intervento) {
|
|
|
8398
8472
|
return query;
|
|
8399
8473
|
}
|
|
8400
8474
|
|
|
8401
|
-
function selectDevicesInterventoByIdInterventoMySQL(
|
|
8475
|
+
function selectDevicesInterventoByIdInterventoMySQL() {
|
|
8402
8476
|
var query = "select id, id_device, id_intervento, date_start, date_end, note_intervento, tempo_stimato_min, tempo_effettivo_min from device_interventi ";
|
|
8403
8477
|
query += "where id_intervento = :id_intervento";
|
|
8404
8478
|
return query;
|
|
@@ -8430,7 +8504,7 @@ function selectDevicesInterventoByIdSQLite(id_dev_intervento) {
|
|
|
8430
8504
|
return query;
|
|
8431
8505
|
}
|
|
8432
8506
|
|
|
8433
|
-
function selectDevicesInterventoByIdMySQL(
|
|
8507
|
+
function selectDevicesInterventoByIdMySQL() {
|
|
8434
8508
|
var query = "select id, id_device, id_intervento, date_start, date_end, note_intervento, tempo_stimato_min, tempo_effettivo_min from device_interventi ";
|
|
8435
8509
|
query += "where id = :id_dev_intervento";
|
|
8436
8510
|
return query;
|
|
@@ -16539,6 +16613,15 @@ module.exports = {
|
|
|
16539
16613
|
queryUsers,
|
|
16540
16614
|
queryFunctions,
|
|
16541
16615
|
queryAllFunctions,
|
|
16616
|
+
//
|
|
16617
|
+
selectPianificazioni,
|
|
16618
|
+
selectPianificazioneById,
|
|
16619
|
+
insertPianificazione,
|
|
16620
|
+
updatePianificazione,
|
|
16621
|
+
removePianificazione,
|
|
16622
|
+
//
|
|
16623
|
+
getFrequenzaTypes,
|
|
16624
|
+
//
|
|
16542
16625
|
selectInterventi,
|
|
16543
16626
|
queryInterventoById,
|
|
16544
16627
|
insertIntervento,
|