alsmanager_lib 1.0.30 → 1.0.32
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 +254 -4
- package/package.json +1 -1
package/lib/modules.js
CHANGED
|
@@ -276,7 +276,6 @@ function removeStorageMySQL(id_device, storage_obj) {
|
|
|
276
276
|
}
|
|
277
277
|
function removeStorage(db_used, id_device, storage_obj) {
|
|
278
278
|
var query = "";
|
|
279
|
-
var db_used = global.get("db_used");
|
|
280
279
|
if (db_used) {
|
|
281
280
|
switch (db_used) {
|
|
282
281
|
case 'SQLITE':
|
|
@@ -1367,7 +1366,6 @@ function queryDeviceByIdMySQL(id_device) {
|
|
|
1367
1366
|
}
|
|
1368
1367
|
function queryDeviceById(db_used, id_device) {
|
|
1369
1368
|
var query = "";
|
|
1370
|
-
var db_used = global.get("db_used");
|
|
1371
1369
|
if (db_used) {
|
|
1372
1370
|
switch (db_used) {
|
|
1373
1371
|
case 'SQLITE':
|
|
@@ -2648,7 +2646,7 @@ function getDevicesSelectForInventarioRawByIdMySQL(id_device) {
|
|
|
2648
2646
|
query += "from devices d ";
|
|
2649
2647
|
query += "join device_site ds on ds.id_device = d.id "
|
|
2650
2648
|
query += "where (CURDATE() >= ds.date_in and CURDATE() <= ds.date_out)";
|
|
2651
|
-
query += " and id = "
|
|
2649
|
+
query += " and id = :id_device";
|
|
2652
2650
|
return query;
|
|
2653
2651
|
}
|
|
2654
2652
|
|
|
@@ -3465,7 +3463,6 @@ function updateConsegnaMySQL(consegna) {
|
|
|
3465
3463
|
|
|
3466
3464
|
function updateConsegna(db_used, consegna) {
|
|
3467
3465
|
var query = "";
|
|
3468
|
-
var db_used = global.get("db_used");
|
|
3469
3466
|
if (db_used) {
|
|
3470
3467
|
switch (db_used) {
|
|
3471
3468
|
case 'SQLITE':
|
|
@@ -3529,6 +3526,253 @@ function queryLastConsegnaId(db_used) {
|
|
|
3529
3526
|
return query;
|
|
3530
3527
|
}
|
|
3531
3528
|
|
|
3529
|
+
function insertConsegnaDeviceSQLite(id_consegna, id_device, note){
|
|
3530
|
+
var query = "insert into device_consegne (id_consegna, id_device, note) values ";
|
|
3531
|
+
query += "(" + id_consegna + ", ";
|
|
3532
|
+
query += id_device + ", ";
|
|
3533
|
+
query += "'" + note + "' ";
|
|
3534
|
+
return query;
|
|
3535
|
+
}
|
|
3536
|
+
|
|
3537
|
+
function insertConsegnaDeviceMySQL(id_consegna, id_device, note){
|
|
3538
|
+
var query = "insert into device_consegne (id_consegna, id_device, note) values ";
|
|
3539
|
+
query += "(:id_consegna, ";
|
|
3540
|
+
query += ":id_device, ";
|
|
3541
|
+
query += ":note ";
|
|
3542
|
+
return query;
|
|
3543
|
+
}
|
|
3544
|
+
|
|
3545
|
+
function insertConsegnaDevice(db_used, id_consegna, id_device, note) {
|
|
3546
|
+
var query = "";
|
|
3547
|
+
if (db_used) {
|
|
3548
|
+
switch (db_used) {
|
|
3549
|
+
case 'SQLITE':
|
|
3550
|
+
query = insertConsegnaDeviceSQLite(id_consegna, id_device, note);
|
|
3551
|
+
break;
|
|
3552
|
+
case 'MYSQL':
|
|
3553
|
+
query = insertConsegnaDeviceMySQL(id_consegna, id_device, note);
|
|
3554
|
+
break;
|
|
3555
|
+
}
|
|
3556
|
+
}
|
|
3557
|
+
return query;
|
|
3558
|
+
}
|
|
3559
|
+
|
|
3560
|
+
function updateConsegnaDeviceSQLite(id_devcons, id_consegna, id_device, note){
|
|
3561
|
+
var query = "update device_consegne set ";
|
|
3562
|
+
query += "id_consegna = " + id_consegna + ", ";
|
|
3563
|
+
query += "id_device = " + id_device + ", ";
|
|
3564
|
+
query += "note = '" + note + "' ";
|
|
3565
|
+
query += "where id = " + id_devcons;
|
|
3566
|
+
return query;
|
|
3567
|
+
}
|
|
3568
|
+
|
|
3569
|
+
function updateConsegnaDeviceMySQL(id_devcons, id_consegna, id_device, note){
|
|
3570
|
+
var query = "update device_consegne set ";
|
|
3571
|
+
query += "id_consegna = :id_consegna, ";
|
|
3572
|
+
query += "id_device = :id_device, ";
|
|
3573
|
+
query += "note = :note ";
|
|
3574
|
+
query += "where id = :id_devcons";
|
|
3575
|
+
return query;
|
|
3576
|
+
}
|
|
3577
|
+
|
|
3578
|
+
function updateConsegnaDevice(db_used, id_devcons, id_consegna, id_device, note) {
|
|
3579
|
+
var query = "";
|
|
3580
|
+
if (db_used) {
|
|
3581
|
+
switch (db_used) {
|
|
3582
|
+
case 'SQLITE':
|
|
3583
|
+
query = updateConsegnaDeviceSQLite(id_devcons, id_consegna, id_device, note);
|
|
3584
|
+
break;
|
|
3585
|
+
case 'MYSQL':
|
|
3586
|
+
query = updateConsegnaDeviceMySQL(id_devcons, id_consegna, id_device, note);
|
|
3587
|
+
break;
|
|
3588
|
+
}
|
|
3589
|
+
}
|
|
3590
|
+
return query;
|
|
3591
|
+
}
|
|
3592
|
+
|
|
3593
|
+
function removeConsegnaDeviceSQLite(id_consegna, id_device){
|
|
3594
|
+
var query = "DELETE from device_consegne ";
|
|
3595
|
+
query += "where id_consegna = " + id_consegna + " ";
|
|
3596
|
+
query += "and id_device = " + id_device;
|
|
3597
|
+
msg.topic = query;
|
|
3598
|
+
}
|
|
3599
|
+
function removeConsegnaDeviceMySQL(id_devcons){
|
|
3600
|
+
var query = "DELETE from device_consegne ";
|
|
3601
|
+
query += "where id_consegna = :id_consegna ";
|
|
3602
|
+
query += "and id_device = :id_device";
|
|
3603
|
+
msg.topic = query;
|
|
3604
|
+
}
|
|
3605
|
+
function removeConsegnaDevice(db_used, id_consegna, id_device) {
|
|
3606
|
+
var query = "";
|
|
3607
|
+
if (db_used) {
|
|
3608
|
+
switch (db_used) {
|
|
3609
|
+
case 'SQLITE':
|
|
3610
|
+
query = removeConsegnaDeviceSQLite(id_consegna, id_device);
|
|
3611
|
+
break;
|
|
3612
|
+
case 'MYSQL':
|
|
3613
|
+
query = removeConsegnaDeviceMySQL(id_consegna, id_device);
|
|
3614
|
+
break;
|
|
3615
|
+
}
|
|
3616
|
+
}
|
|
3617
|
+
return query;
|
|
3618
|
+
}
|
|
3619
|
+
|
|
3620
|
+
function selectDevicePerConsegnaSQLite(id_consegna) {
|
|
3621
|
+
var query = "select d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
|
|
3622
|
+
query += "case ";
|
|
3623
|
+
query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then d.inv_ict3_number ";
|
|
3624
|
+
query += "when d.inv_pnrr_number != '' and d.inv_pnrr_number is not null then d.inv_pnrr_number ";
|
|
3625
|
+
query += "when d.inv_tn_number != '' and d.inv_tn_number is not null then concat(d.inv_tn_number,'(TN)') ";
|
|
3626
|
+
query += "when d.inv_tndigit_number != '' and d.inv_tndigit_number is not null then concat(d.inv_tndigit_number,'(TNDigit)') ";
|
|
3627
|
+
query += "when d.serial_no != '' and d.serial_no is not null then concat(d.serial_no,'(S/N)') ";
|
|
3628
|
+
query += "end as Codice, ";
|
|
3629
|
+
query += "case ";
|
|
3630
|
+
query += "when trim(d.inv_pnrr_number) is null then '' ";
|
|
3631
|
+
query += "when trim(d.inv_pnrr_number) = '' then '' ";
|
|
3632
|
+
query += "else 'SI' ";
|
|
3633
|
+
query += "end as PNRR ";
|
|
3634
|
+
query += " from devices d";
|
|
3635
|
+
query += " left join device_consegne dc on dc.id_device = d.id";
|
|
3636
|
+
query += " where dc.id_consegna = " + id_consegna;
|
|
3637
|
+
return query;
|
|
3638
|
+
}
|
|
3639
|
+
|
|
3640
|
+
function selectDevicePerConsegnaMySQL(id_consegna) {
|
|
3641
|
+
var query = "select d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
|
|
3642
|
+
query += "case ";
|
|
3643
|
+
query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then d.inv_ict3_number ";
|
|
3644
|
+
query += "when d.inv_pnrr_number != '' and d.inv_pnrr_number is not null then d.inv_pnrr_number ";
|
|
3645
|
+
query += "when d.inv_tn_number != '' and d.inv_tn_number is not null then concat(d.inv_tn_number,'(TN)') ";
|
|
3646
|
+
query += "when d.inv_tndigit_number != '' and d.inv_tndigit_number is not null then concat(d.inv_tndigit_number,'(TNDigit)') ";
|
|
3647
|
+
query += "when d.serial_no != '' and d.serial_no is not null then concat(d.serial_no,'(S/N)') ";
|
|
3648
|
+
query += "end as Codice, ";
|
|
3649
|
+
query += "case ";
|
|
3650
|
+
query += "when trim(d.inv_pnrr_number) is null then '' ";
|
|
3651
|
+
query += "when trim(d.inv_pnrr_number) = '' then '' ";
|
|
3652
|
+
query += "else 'SI' ";
|
|
3653
|
+
query += "end as PNRR ";
|
|
3654
|
+
query += " from devices d";
|
|
3655
|
+
query += " left join device_consegne dc on dc.id_device = d.id";
|
|
3656
|
+
query += " where dc.id_consegna = :id_consegna";
|
|
3657
|
+
return query;
|
|
3658
|
+
}
|
|
3659
|
+
function selectDevicePerConsegna(db_used, id_consegna) {
|
|
3660
|
+
var query = "";
|
|
3661
|
+
if (db_used) {
|
|
3662
|
+
switch (db_used) {
|
|
3663
|
+
case 'SQLITE':
|
|
3664
|
+
query = selectDevicePerConsegnaSQLite(id_consegna);
|
|
3665
|
+
break;
|
|
3666
|
+
case 'MYSQL':
|
|
3667
|
+
query = selectDevicePerConsegnaMySQL(id_consegna);
|
|
3668
|
+
break;
|
|
3669
|
+
}
|
|
3670
|
+
}
|
|
3671
|
+
return query;
|
|
3672
|
+
}
|
|
3673
|
+
|
|
3674
|
+
function selectDeviceConsegnaSQLite(id_consegna, id_device) {
|
|
3675
|
+
var query = "select dc.id as id_dev_cons, d.id, d.type, d.manifacturer, d.model, ";
|
|
3676
|
+
query += "case ";
|
|
3677
|
+
query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then d.inv_ict3_number ";
|
|
3678
|
+
query += "when d.inv_pnrr_number != '' and d.inv_pnrr_number is not null then d.inv_pnrr_number ";
|
|
3679
|
+
query += "when d.inv_tn_number != '' and d.inv_tn_number is not null then concat(d.inv_tn_number,'(TN)') ";
|
|
3680
|
+
query += "when d.inv_tndigit_number != '' and d.inv_tndigit_number is not null then concat(d.inv_tndigit_number,'(TNDigit)') ";
|
|
3681
|
+
query += "when d.serial_no != '' and d.serial_no is not null then concat(d.serial_no,'(S/N)') ";
|
|
3682
|
+
query += "end as codice ";
|
|
3683
|
+
query += ", dc.note as note_cons from device_consegne dc";
|
|
3684
|
+
query += " join devices d on d.id = dc.id_device";
|
|
3685
|
+
query += " where dc.id_consegna = " + id_consegna;
|
|
3686
|
+
query += " and d.id = " + id_device;
|
|
3687
|
+
return query;
|
|
3688
|
+
}
|
|
3689
|
+
|
|
3690
|
+
function selectDeviceConsegnaMySQL(id_consegna, id_device) {
|
|
3691
|
+
var query = "select dc.id as id_dev_cons, d.id, d.type, d.manifacturer, d.model, ";
|
|
3692
|
+
query += "case ";
|
|
3693
|
+
query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then d.inv_ict3_number ";
|
|
3694
|
+
query += "when d.inv_pnrr_number != '' and d.inv_pnrr_number is not null then d.inv_pnrr_number ";
|
|
3695
|
+
query += "when d.inv_tn_number != '' and d.inv_tn_number is not null then concat(d.inv_tn_number,'(TN)') ";
|
|
3696
|
+
query += "when d.inv_tndigit_number != '' and d.inv_tndigit_number is not null then concat(d.inv_tndigit_number,'(TNDigit)') ";
|
|
3697
|
+
query += "when d.serial_no != '' and d.serial_no is not null then concat(d.serial_no,'(S/N)') ";
|
|
3698
|
+
query += "end as codice ";
|
|
3699
|
+
query += ", dc.note as note_cons from device_consegne dc";
|
|
3700
|
+
query += " join devices d on d.id = dc.id_device";
|
|
3701
|
+
query += " where dc.id_consegna = :id_consegna";
|
|
3702
|
+
query += " and d.id :id_device";
|
|
3703
|
+
return query;
|
|
3704
|
+
}
|
|
3705
|
+
|
|
3706
|
+
|
|
3707
|
+
function selectDeviceConsegna(db_used, id_consegna, id_device) {
|
|
3708
|
+
var query = "";
|
|
3709
|
+
if (db_used) {
|
|
3710
|
+
switch (db_used) {
|
|
3711
|
+
case 'SQLITE':
|
|
3712
|
+
query = selectDeviceConsegnaSQLite(id_consegna, id_device);
|
|
3713
|
+
break;
|
|
3714
|
+
case 'MYSQL':
|
|
3715
|
+
query = selectDeviceConsegnaMySQL(id_consegna, id_device);
|
|
3716
|
+
break;
|
|
3717
|
+
}
|
|
3718
|
+
}
|
|
3719
|
+
return query;
|
|
3720
|
+
}
|
|
3721
|
+
|
|
3722
|
+
function selectDeviceInDepositoSQLite(inv_code) {
|
|
3723
|
+
var query = "SELECT d.id, d.type, d.manifacturer, d.model, ";
|
|
3724
|
+
query += "case ";
|
|
3725
|
+
query += "when inv_ict3_number != '' and inv_ict3_number is not null then inv_ict3_number ";
|
|
3726
|
+
query += "when inv_pnrr_number != '' and inv_pnrr_number is not null then inv_pnrr_number ";
|
|
3727
|
+
query += "when inv_tn_number != '' and inv_tn_number is not null then concat(inv_tn_number,'(TN)') ";
|
|
3728
|
+
query += "when inv_tndigit_number != '' and inv_tndigit_number is not null then concat(inv_tndigit_number,'(TNDigit)') ";
|
|
3729
|
+
query += "when serial_no != '' and serial_no is not null then concat(serial_no,'(S/N)') ";
|
|
3730
|
+
query += "end as Codice ";
|
|
3731
|
+
query += " from devices d";
|
|
3732
|
+
query += " join device_site ds on ds.id_device = d.id"
|
|
3733
|
+
query += " join sites s on s.id = ds.id_site"
|
|
3734
|
+
query += " join site_destinations sd on sd.id_site = s.id"
|
|
3735
|
+
query += " where (inv_ict3_number = '" + inv_code + "' or ";
|
|
3736
|
+
query += "inv_tn_number = '" + inv_code + "' or ";
|
|
3737
|
+
query += "serial_no like '" + inv_code + "%' or ";
|
|
3738
|
+
query += "inv_pnrr_number = '" + inv_code + "') and ";
|
|
3739
|
+
query += "sd.type = 'MAGAZZINO'";
|
|
3740
|
+
return query;
|
|
3741
|
+
}
|
|
3742
|
+
function selectDeviceInDepositoMySQL(inv_code) {
|
|
3743
|
+
var query = "SELECT d.id, d.type, d.manifacturer, d.model, ";
|
|
3744
|
+
query += "case ";
|
|
3745
|
+
query += "when inv_ict3_number != '' and inv_ict3_number is not null then inv_ict3_number ";
|
|
3746
|
+
query += "when inv_pnrr_number != '' and inv_pnrr_number is not null then inv_pnrr_number ";
|
|
3747
|
+
query += "when inv_tn_number != '' and inv_tn_number is not null then concat(inv_tn_number,'(TN)') ";
|
|
3748
|
+
query += "when inv_tndigit_number != '' and inv_tndigit_number is not null then concat(inv_tndigit_number,'(TNDigit)') ";
|
|
3749
|
+
query += "when serial_no != '' and serial_no is not null then concat(serial_no,'(S/N)') ";
|
|
3750
|
+
query += "end as Codice ";
|
|
3751
|
+
query += " from devices d";
|
|
3752
|
+
query += " join device_site ds on ds.id_device = d.id"
|
|
3753
|
+
query += " join sites s on s.id = ds.id_site"
|
|
3754
|
+
query += " join site_destinations sd on sd.id_site = s.id"
|
|
3755
|
+
query += " where (inv_ict3_number = :inv_code or ";
|
|
3756
|
+
query += "inv_tn_number = :inv_code or ";
|
|
3757
|
+
query += "serial_no like ':inv_code%' or ";
|
|
3758
|
+
query += "inv_pnrr_number = :inv_code) and ";
|
|
3759
|
+
query += "sd.type = 'MAGAZZINO'";
|
|
3760
|
+
return query;
|
|
3761
|
+
}
|
|
3762
|
+
function selectDeviceInDeposito(db_used, inv_code) {
|
|
3763
|
+
var query = "";
|
|
3764
|
+
if (db_used) {
|
|
3765
|
+
switch (db_used) {
|
|
3766
|
+
case 'SQLITE':
|
|
3767
|
+
query = selectDeviceInDepositoSQLite(inv_code);
|
|
3768
|
+
break;
|
|
3769
|
+
case 'MYSQL':
|
|
3770
|
+
query = selectDeviceInDepositoMySQL(inv_code);
|
|
3771
|
+
break;
|
|
3772
|
+
}
|
|
3773
|
+
}
|
|
3774
|
+
return query;
|
|
3775
|
+
}
|
|
3532
3776
|
//get connection types
|
|
3533
3777
|
function getConnectionTypesSQLite() {
|
|
3534
3778
|
var query = "select id, conn_type from connection_types";
|
|
@@ -6117,6 +6361,12 @@ module.exports = {
|
|
|
6117
6361
|
querySelectGestioniDeviceByIdDevice,
|
|
6118
6362
|
queryConsegne,
|
|
6119
6363
|
queryConsegnaById,
|
|
6364
|
+
insertConsegnaDevice,
|
|
6365
|
+
updateConsegnaDevice,
|
|
6366
|
+
removeConsegnaDevice,
|
|
6367
|
+
selectDevicePerConsegna,
|
|
6368
|
+
selectDeviceConsegna,
|
|
6369
|
+
selectDeviceInDeposito,
|
|
6120
6370
|
queryDeviceStatusCombo,
|
|
6121
6371
|
queryUsers,
|
|
6122
6372
|
queryFunctions,
|