alsmanager_lib 3.0.224 → 3.0.226
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 +60 -0
- package/package.json +1 -1
package/lib/modules.js
CHANGED
|
@@ -4413,7 +4413,57 @@ function queryDeviceByIdentificativo(db_used, identificativo) {
|
|
|
4413
4413
|
return query;
|
|
4414
4414
|
}
|
|
4415
4415
|
//End Get Device by Identificativo
|
|
4416
|
+
// Manage Devices annotations
|
|
4417
|
+
function getDeviceAnnotationsByIdDevice(id_device) {
|
|
4418
|
+
var query = "select da.id, da.date_annotation, da.annotation, a.name from device_annotations da ";
|
|
4419
|
+
query += "join annotation_types a on a.id = da.annotation_type ";
|
|
4420
|
+
query += "where id_device = " + id_device + " ";
|
|
4421
|
+
query += "order by date_annotation";
|
|
4422
|
+
return query;
|
|
4423
|
+
}
|
|
4416
4424
|
|
|
4425
|
+
function selectDeviceAnnotationsById(id_annot) {
|
|
4426
|
+
var query = "select da.id, da.date_annotation, da.annotation, da.annotation_type from device_annotations da ";
|
|
4427
|
+
query += "where id = " + id_annot;
|
|
4428
|
+
return query;
|
|
4429
|
+
}
|
|
4430
|
+
|
|
4431
|
+
function insertDeviceAnnotation(id_device, date_annot, annot, annot_type) {
|
|
4432
|
+
var query = "insert into device_annotations (id_device, date_annotation, annotation, annotation_type) values (";
|
|
4433
|
+
var dt_str = convertDateToStringDB(date_annot);
|
|
4434
|
+
query += id_device + ", ";
|
|
4435
|
+
query += "'" + dt_str + "', ";
|
|
4436
|
+
query += "'" + annot + "', ";
|
|
4437
|
+
query += annot_type;
|
|
4438
|
+
query += ")";
|
|
4439
|
+
return query;
|
|
4440
|
+
}
|
|
4441
|
+
function updateDeviceAnnotation(id_annot, date_annot, annot, annot_type) {
|
|
4442
|
+
var query = "update device_annotations set ";
|
|
4443
|
+
var dt_str = convertDateToStringDB(date_annot);
|
|
4444
|
+
query += "date_annotation = '" + dt_str + "', ";
|
|
4445
|
+
query += "annotation = '" + annot + "', ";
|
|
4446
|
+
query += "annotation_type = " + annotation_type + " ";
|
|
4447
|
+
query += "where id = " + id_annot;
|
|
4448
|
+
return query;
|
|
4449
|
+
}
|
|
4450
|
+
function removeDeviceAnnotation(id_annot) {
|
|
4451
|
+
var query = "delete from device_annotations ";
|
|
4452
|
+
query += "where id = " + id_annot;
|
|
4453
|
+
return query;
|
|
4454
|
+
}
|
|
4455
|
+
|
|
4456
|
+
function selectAnnotationTypes() {
|
|
4457
|
+
var query = "select id, name, description from annotation_types ";
|
|
4458
|
+
return query;
|
|
4459
|
+
}
|
|
4460
|
+
|
|
4461
|
+
function selectAnnotationTypesInfos(id_annot_type) {
|
|
4462
|
+
var query = "select id, name, description from annotation_types ";
|
|
4463
|
+
query += "where id = " + id_annot_type;
|
|
4464
|
+
return query;
|
|
4465
|
+
}
|
|
4466
|
+
//End Manage Devices annotations
|
|
4417
4467
|
|
|
4418
4468
|
|
|
4419
4469
|
//Get Device Status
|
|
@@ -17301,6 +17351,9 @@ function getNotesByIdDevice(id_device) {
|
|
|
17301
17351
|
query += "UNION ";
|
|
17302
17352
|
query += "select CONCAT('INTERVENTO n. ', di.id) as Tipo, di.date_start as Data, di.note_intervento as note from device_interventi di ";
|
|
17303
17353
|
query += "where di.id_device = " + id_device + " and di.note_intervento is not null ";
|
|
17354
|
+
query += "UNION ";
|
|
17355
|
+
query += "select 'ANNOTAZIONI' as Tipo, da.date_annotation as Data, da.annotation as note from device_annotation da ";
|
|
17356
|
+
query += "where da.id_device = " + id_device + " and da.annotation is not null ";
|
|
17304
17357
|
return query;
|
|
17305
17358
|
}
|
|
17306
17359
|
|
|
@@ -17331,6 +17384,13 @@ module.exports = {
|
|
|
17331
17384
|
getDevicesSelectBySite,
|
|
17332
17385
|
queryDeviceById,
|
|
17333
17386
|
queryDeviceByIdentificativo,
|
|
17387
|
+
getDeviceAnnotationsByIdDevice,
|
|
17388
|
+
selectDeviceAnnotationsById,
|
|
17389
|
+
insertDeviceAnnotation,
|
|
17390
|
+
updateDeviceAnnotation,
|
|
17391
|
+
removeDeviceAnnotation,
|
|
17392
|
+
selectAnnotationTypes,
|
|
17393
|
+
selectAnnotationTypesInfos,
|
|
17334
17394
|
queryDeviceForConsegneById,
|
|
17335
17395
|
getDevicesCounterBySite,
|
|
17336
17396
|
getDevicesCounterByPlace,
|