alsmanager_lib 1.0.33 → 1.0.34
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 +471 -13
- package/package.json +1 -1
package/lib/modules.js
CHANGED
|
@@ -185,7 +185,7 @@ function getStorageByIdMySQL() {
|
|
|
185
185
|
return query;
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
-
function getStorageById(
|
|
188
|
+
function getStorageById(db_used, id_storage) {
|
|
189
189
|
var query = "";
|
|
190
190
|
if (db_used) {
|
|
191
191
|
switch (db_used) {
|
|
@@ -2033,6 +2033,263 @@ function getDevicesWithProperties(db_used, id_device) {
|
|
|
2033
2033
|
}
|
|
2034
2034
|
|
|
2035
2035
|
// End get devices with properties
|
|
2036
|
+
// Selezione dati da inventarii...
|
|
2037
|
+
function getBeniDaInventariSQLite(table_name, inv_code, include_imp, is_pnrr, is_dismissione) {
|
|
2038
|
+
var query = "";
|
|
2039
|
+
if (table_name && table_name != '') {
|
|
2040
|
+
if (table_name == "ImportRevisione2024") {
|
|
2041
|
+
query = "Select ";
|
|
2042
|
+
query += "inv_ict3 as Inventario, ";
|
|
2043
|
+
query += "ex_inv as Precedente, ";
|
|
2044
|
+
query += "descrizione_bene as Descrizione, ";
|
|
2045
|
+
query += "collocazione as Luogo, ";
|
|
2046
|
+
query += "sede as Plesso, ";
|
|
2047
|
+
query += "marca as 'Marca bene', ";
|
|
2048
|
+
query += "modello_serie as Modello, ";
|
|
2049
|
+
query += "targa_matricola as Matricola, ";
|
|
2050
|
+
query += "data_presa_in_carico as 'Data acq.', ";
|
|
2051
|
+
query += "prezzo as Costo, ";
|
|
2052
|
+
query += "data_scarico as 'Data scarico', ";
|
|
2053
|
+
query += "concat(imp.NOTE, ' ', NOTE_2, ' ', NOTE_3, ' ', NOTE_4, ' ', NOTE_5, ' ', NOTE_6, ' ', NOTE_7, ' ', NOTE_8) as 'Note bene' ";
|
|
2054
|
+
query += "from " + table_name + " imp ";
|
|
2055
|
+
query += "left join devices d on imp.inv_ict3 = d.inv_ict3_number "
|
|
2056
|
+
}
|
|
2057
|
+
else if (table_name == "devices") {
|
|
2058
|
+
query = getDevicesSelectForInventarioRawSQLite(inv_code);
|
|
2059
|
+
}
|
|
2060
|
+
else if (is_pnrr == 1) {
|
|
2061
|
+
query = "Select ";
|
|
2062
|
+
query += "inventario as Inventario, ";
|
|
2063
|
+
query += "Tipo, ";
|
|
2064
|
+
query += "marca as 'Marca bene', ";
|
|
2065
|
+
query += "Descrizione, ";
|
|
2066
|
+
query += "Plesso as Luogo ";
|
|
2067
|
+
query += "from " + table_name + " imp ";
|
|
2068
|
+
}
|
|
2069
|
+
else if (is_dismissione == 1) {
|
|
2070
|
+
query = "Select ";
|
|
2071
|
+
query += "inv_ict3 as Inventario, ";
|
|
2072
|
+
query += "Descrizione, ";
|
|
2073
|
+
query += "Plesso, ";
|
|
2074
|
+
query += "Costo, ";
|
|
2075
|
+
query += "Note as 'Note bene' ";
|
|
2076
|
+
query += "from " + table_name + " imp ";
|
|
2077
|
+
}
|
|
2078
|
+
else {
|
|
2079
|
+
query = "Select ";
|
|
2080
|
+
query += "inv_ict3 as Inventario, ";
|
|
2081
|
+
query += "ex_inventario as Precedente, ";
|
|
2082
|
+
query += "descrizione_bene as Descrizione, ";
|
|
2083
|
+
query += "collocazione as Luogo, ";
|
|
2084
|
+
query += "sede as Plesso, ";
|
|
2085
|
+
query += "marca as 'Marca bene', ";
|
|
2086
|
+
query += "modello_serie as Modello, ";
|
|
2087
|
+
query += "targa_matricola as Matricola, ";
|
|
2088
|
+
query += "data_presa_in_carico as 'Data acq.', ";
|
|
2089
|
+
query += "prezzo as Costo, ";
|
|
2090
|
+
query += "data_scarico as 'Data scarico', ";
|
|
2091
|
+
query += "concat(note, ' ', note_2, ' ', note_3) as 'Note bene' ";
|
|
2092
|
+
query += "from " + table_name + " imp ";
|
|
2093
|
+
}
|
|
2094
|
+
}
|
|
2095
|
+
if (inv_code && table_name) {
|
|
2096
|
+
if (table_name != "devices" && is_pnrr != 1 && is_dismissione != 1) {
|
|
2097
|
+
query += " where Inventario = '" + inv_code +"' or ";
|
|
2098
|
+
query += " Precedente = '" + inv_code +"' ";
|
|
2099
|
+
if (!include_imp || include_imp == 0) {
|
|
2100
|
+
query += "and d.id is null"
|
|
2101
|
+
}
|
|
2102
|
+
}
|
|
2103
|
+
}
|
|
2104
|
+
else {
|
|
2105
|
+
if (table_name != "devices" && is_pnrr != 1 && is_dismissione != 1) {
|
|
2106
|
+
if (!include_imp || include_imp == 0) {
|
|
2107
|
+
query += "where d.id is null"
|
|
2108
|
+
}
|
|
2109
|
+
}
|
|
2110
|
+
}
|
|
2111
|
+
return query;
|
|
2112
|
+
}
|
|
2113
|
+
|
|
2114
|
+
function getBeniDaInventariMySQL(table_name, inv_code, include_imp, is_pnrr, is_dismissione) {
|
|
2115
|
+
if (table_name && table_name != '') {
|
|
2116
|
+
if (table_name == "ImportRevisione2024") {
|
|
2117
|
+
query = "Select ";
|
|
2118
|
+
query += "inv_ict3 as Inventario, ";
|
|
2119
|
+
query += "ex_inv as Precedente, ";
|
|
2120
|
+
query += "descrizione_bene as Descrizione, ";
|
|
2121
|
+
query += "collocazione as Luogo, ";
|
|
2122
|
+
query += "sede as Plesso, ";
|
|
2123
|
+
query += "marca as 'Marca bene', ";
|
|
2124
|
+
query += "modello_serie as Modello, ";
|
|
2125
|
+
query += "targa_matricola as Matricola, ";
|
|
2126
|
+
query += "data_presa_in_carico as 'Data acq.', ";
|
|
2127
|
+
query += "prezzo as Costo, ";
|
|
2128
|
+
query += "data_scarico as 'Data scarico', ";
|
|
2129
|
+
query += "concat(imp.NOTE, ' ', NOTE_2, ' ', NOTE_3, ' ', NOTE_4, ' ', NOTE_5, ' ', NOTE_6, ' ', NOTE_7, ' ', NOTE_8) as 'Note bene' ";
|
|
2130
|
+
query += "from :table_name imp ";
|
|
2131
|
+
query += "left join devices d on imp.inv_ict3 = d.inv_ict3_number "
|
|
2132
|
+
}
|
|
2133
|
+
else if (table_name == "devices") {
|
|
2134
|
+
query = getDevicesSelectForInventarioRawMySQL(inv_code);
|
|
2135
|
+
}
|
|
2136
|
+
else if (is_pnrr == 1) {
|
|
2137
|
+
query = "Select ";
|
|
2138
|
+
query += "inventario as Inventario, ";
|
|
2139
|
+
query += "Tipo, ";
|
|
2140
|
+
query += "marca as 'Marca bene', ";
|
|
2141
|
+
query += "Descrizione, ";
|
|
2142
|
+
query += "Plesso as Luogo ";
|
|
2143
|
+
query += "from :table_name imp ";
|
|
2144
|
+
}
|
|
2145
|
+
else if (is_dismissione == 1) {
|
|
2146
|
+
query = "Select ";
|
|
2147
|
+
query += "inv_ict3 as Inventario, ";
|
|
2148
|
+
query += "Descrizione, ";
|
|
2149
|
+
query += "Plesso, ";
|
|
2150
|
+
query += "Costo, ";
|
|
2151
|
+
query += "Note as 'Note bene' ";
|
|
2152
|
+
query += "from :table_name imp ";
|
|
2153
|
+
}
|
|
2154
|
+
else {
|
|
2155
|
+
query = "Select ";
|
|
2156
|
+
query += "inv_ict3 as Inventario, ";
|
|
2157
|
+
query += "ex_inventario as Precedente, ";
|
|
2158
|
+
query += "descrizione_bene as Descrizione, ";
|
|
2159
|
+
query += "collocazione as Luogo, ";
|
|
2160
|
+
query += "sede as Plesso, ";
|
|
2161
|
+
query += "marca as 'Marca bene', ";
|
|
2162
|
+
query += "modello_serie as Modello, ";
|
|
2163
|
+
query += "targa_matricola as Matricola, ";
|
|
2164
|
+
query += "data_presa_in_carico as 'Data acq.', ";
|
|
2165
|
+
query += "prezzo as Costo, ";
|
|
2166
|
+
query += "data_scarico as 'Data scarico', ";
|
|
2167
|
+
query += "concat(note, ' ', note_2, ' ', note_3) as 'Note bene' ";
|
|
2168
|
+
query += "from :table_name imp ";
|
|
2169
|
+
}
|
|
2170
|
+
}
|
|
2171
|
+
if (inv_code && table_name) {
|
|
2172
|
+
if (table_name != "devices" && is_pnrr != 1 && is_dismissione != 1) {
|
|
2173
|
+
query += " where Inventario = '" + inv_code +"' or ";
|
|
2174
|
+
query += " Precedente = '" + inv_code +"' ";
|
|
2175
|
+
if (!include_imp || include_imp == 0) {
|
|
2176
|
+
query += "and d.id is null"
|
|
2177
|
+
}
|
|
2178
|
+
}
|
|
2179
|
+
}
|
|
2180
|
+
else {
|
|
2181
|
+
if (table_name != "devices" && is_pnrr != 1 && is_dismissione != 1) {
|
|
2182
|
+
if (!include_imp || include_imp == 0) {
|
|
2183
|
+
query += "where d.id is null"
|
|
2184
|
+
}
|
|
2185
|
+
}
|
|
2186
|
+
}
|
|
2187
|
+
return query;
|
|
2188
|
+
}
|
|
2189
|
+
|
|
2190
|
+
function getBeniDaInventari(db_used, table_name, inv_code, include_imp, is_pnrr, is_dismissione) {
|
|
2191
|
+
var query = "";
|
|
2192
|
+
if (db_used) {
|
|
2193
|
+
switch (db_used) {
|
|
2194
|
+
case 'SQLITE':
|
|
2195
|
+
query = getBeniDaInventariSQLite(table_name, inv_code, include_imp, is_pnrr, is_dismissione);
|
|
2196
|
+
break;
|
|
2197
|
+
case 'MYSQL':
|
|
2198
|
+
query = getBeniDaInventariMySQL(table_name, inv_code, include_imp, is_pnrr, is_dismissione);
|
|
2199
|
+
break;
|
|
2200
|
+
}
|
|
2201
|
+
}
|
|
2202
|
+
return query;
|
|
2203
|
+
}
|
|
2204
|
+
// Range..
|
|
2205
|
+
function selectInventariPerIntervalloSQLite(table_name, is_pnrr, is_dismissione, code_da, code_a) {
|
|
2206
|
+
var query = "";
|
|
2207
|
+
if (table_name && table_name != '') {
|
|
2208
|
+
if (table_name == "ImportRevisione2024") {
|
|
2209
|
+
query = "Select ";
|
|
2210
|
+
query += "inv_ict3 as Inventario, ";
|
|
2211
|
+
query += "concat(inv_ict3, ' - ', descrizione_bene, ' - ', marca, ' - ', modello_serie) as Descrizione ";
|
|
2212
|
+
query += "from " + table_name + " imp ";
|
|
2213
|
+
//query += "where instr(upper(imp.descrizione_bene), (select type from devices)) ";
|
|
2214
|
+
}
|
|
2215
|
+
else if (is_pnrr == 1) {
|
|
2216
|
+
query = "Select ";
|
|
2217
|
+
query += "inventario as Inventario, ";
|
|
2218
|
+
query += "concat(inv_ict3, ' - ', descrizione_bene, ' - ', marca, ' - ', modello_serie) as Descrizione ";
|
|
2219
|
+
query += "from " + table_name + " imp ";
|
|
2220
|
+
}
|
|
2221
|
+
else if (is_dismissione == 1) {
|
|
2222
|
+
query = "Select ";
|
|
2223
|
+
query += "inv_ict3 as Inventario, ";
|
|
2224
|
+
query += "concat(inv_ict3, ' - ', descrizione_bene, ' - ', marca, ' - ', modello_serie) as Descrizione ";
|
|
2225
|
+
query += "from " + table_name + " imp ";
|
|
2226
|
+
}
|
|
2227
|
+
else {
|
|
2228
|
+
query = "Select ";
|
|
2229
|
+
query += "inv_ict3 as Inventario, ";
|
|
2230
|
+
query += "concat(inv_ict3, ' - ', descrizione_bene, ' - ', marca, ' - ', modello_serie) as Descrizione ";
|
|
2231
|
+
query += "from " + table_name + " imp ";
|
|
2232
|
+
//query += "where instr(upper(imp.descrizione_bene), (select type from devices)) ";
|
|
2233
|
+
}
|
|
2234
|
+
}
|
|
2235
|
+
if (code_da && code_a && table_name) {
|
|
2236
|
+
query += " and Inventario >= '" + code_da + "' ";
|
|
2237
|
+
query += " and Inventario <= '" + code_a + "'";
|
|
2238
|
+
}
|
|
2239
|
+
return query;
|
|
2240
|
+
}
|
|
2241
|
+
function selectInventariPerIntervalloMySQL() {
|
|
2242
|
+
var query = "";
|
|
2243
|
+
if (table_name && table_name != '') {
|
|
2244
|
+
if (table_name == "ImportRevisione2024") {
|
|
2245
|
+
query = "Select ";
|
|
2246
|
+
query += "inv_ict3 as Inventario, ";
|
|
2247
|
+
query += "concat(inv_ict3, ' - ', descrizione_bene, ' - ', marca, ' - ', modello_serie) as Descrizione ";
|
|
2248
|
+
query += "from :table_name imp ";
|
|
2249
|
+
//query += "where instr(upper(imp.descrizione_bene), (select type from devices)) ";
|
|
2250
|
+
}
|
|
2251
|
+
else if (is_pnrr == 1) {
|
|
2252
|
+
query = "Select ";
|
|
2253
|
+
query += "inventario as Inventario, ";
|
|
2254
|
+
query += "concat(inv_ict3, ' - ', descrizione_bene, ' - ', marca, ' - ', modello_serie) as Descrizione ";
|
|
2255
|
+
query += "from :table_name imp ";
|
|
2256
|
+
}
|
|
2257
|
+
else if (is_dismissione == 1) {
|
|
2258
|
+
query = "Select ";
|
|
2259
|
+
query += "inv_ict3 as Inventario, ";
|
|
2260
|
+
query += "concat(inv_ict3, ' - ', descrizione_bene, ' - ', marca, ' - ', modello_serie) as Descrizione ";
|
|
2261
|
+
query += "from :table_name imp ";
|
|
2262
|
+
}
|
|
2263
|
+
else {
|
|
2264
|
+
query = "Select ";
|
|
2265
|
+
query += "inv_ict3 as Inventario, ";
|
|
2266
|
+
query += "concat(inv_ict3, ' - ', descrizione_bene, ' - ', marca, ' - ', modello_serie) as Descrizione ";
|
|
2267
|
+
query += "from :table_name imp ";
|
|
2268
|
+
//query += "where instr(upper(imp.descrizione_bene), (select type from devices)) ";
|
|
2269
|
+
}
|
|
2270
|
+
}
|
|
2271
|
+
if (code_da && code_a && table_name) {
|
|
2272
|
+
query += " and Inventario >= :code_da ";
|
|
2273
|
+
query += " and Inventario <= :code_a";
|
|
2274
|
+
}
|
|
2275
|
+
return query;
|
|
2276
|
+
}
|
|
2277
|
+
function selectInventariPerIntervallo(db_used,table_name, is_pnrr, is_dismissione, code_da, code_a) {
|
|
2278
|
+
var query = "";
|
|
2279
|
+
if (db_used) {
|
|
2280
|
+
switch (db_used) {
|
|
2281
|
+
case 'SQLITE':
|
|
2282
|
+
query = selectInventariPerIntervalloSQLite(table_name, is_pnrr, is_dismissione, code_da, code_a);
|
|
2283
|
+
break;
|
|
2284
|
+
case 'MYSQL':
|
|
2285
|
+
query = selectInventariPerIntervalloMySQL(table_name, is_pnrr, is_dismissione, code_da, code_a);
|
|
2286
|
+
break;
|
|
2287
|
+
}
|
|
2288
|
+
}
|
|
2289
|
+
return query;
|
|
2290
|
+
}
|
|
2291
|
+
//end range
|
|
2292
|
+
|
|
2036
2293
|
// Get Beni Acquisiti...
|
|
2037
2294
|
function getBeniAcquisitiSQLite(table_name, is_pnrr, is_dismissione) {
|
|
2038
2295
|
var query = "";
|
|
@@ -2172,6 +2429,175 @@ function getBeniAcquisiti(db_used, tab_name, is_pnrr, is_dismissione) {
|
|
|
2172
2429
|
return query;
|
|
2173
2430
|
}
|
|
2174
2431
|
//End get beni acquisiti
|
|
2432
|
+
// Insert massivo
|
|
2433
|
+
function insertDeviceMassivoSQLite(table_name,lista_inv) {
|
|
2434
|
+
var query = "";
|
|
2435
|
+
var insert_sql = "insert into devices (inv_ict3_number, inv_tn_number, manifacturer, model, note) "
|
|
2436
|
+
if (table_name && table_name != '') {
|
|
2437
|
+
if (inv_info.tabella == "ImportRevisione2024") {
|
|
2438
|
+
query = "Select ";
|
|
2439
|
+
query += "trim(inv_ict3) as Inventario, ";
|
|
2440
|
+
query += "trim(ex_inv) as ex_inventario, ";
|
|
2441
|
+
query += "marca, ";
|
|
2442
|
+
query += "modello_serie, ";
|
|
2443
|
+
query += "concat(imp.NOTE, ' ', NOTE_2, ' ', NOTE_3, ' ', NOTE_4, ' ', NOTE_5, ' ', NOTE_6, ' ', NOTE_7, ' ', NOTE_8) as note_bene ";
|
|
2444
|
+
query += "from " + table_name + " imp ";
|
|
2445
|
+
query += "left join devices d on Inventario = d.inv_ict3_number "
|
|
2446
|
+
query += "where d.id is null ";
|
|
2447
|
+
}
|
|
2448
|
+
else {
|
|
2449
|
+
query = "Select ";
|
|
2450
|
+
query += "trim(inv_ict3) as Inventario, ";
|
|
2451
|
+
query += "trim(ex_inv) as ex_inventario, ";
|
|
2452
|
+
query += "marca, ";
|
|
2453
|
+
query += "modello_serie, ";
|
|
2454
|
+
query += "concat(imp.note, ' ', note_2, ' ', note_3) as note_bene ";
|
|
2455
|
+
query += "from " + table_name + " imp ";
|
|
2456
|
+
query += "left join devices d on Inventario = d.inv_ict3_number "
|
|
2457
|
+
query += "where d.id is null ";
|
|
2458
|
+
}
|
|
2459
|
+
}
|
|
2460
|
+
|
|
2461
|
+
if (lista_inv && lista_inv.length > 0) {
|
|
2462
|
+
var list_clause = "and Inventario in (";
|
|
2463
|
+
for (let i = 0; i < lista_inv.length; i++) {
|
|
2464
|
+
list_clause += "'" + lista_inv[i] + "'";
|
|
2465
|
+
if (i < lista_inv.length - 1) {
|
|
2466
|
+
list_clause += ", ";
|
|
2467
|
+
}
|
|
2468
|
+
}
|
|
2469
|
+
list_clause += ") ";
|
|
2470
|
+
query += list_clause;
|
|
2471
|
+
}
|
|
2472
|
+
query += "group by Inventario";
|
|
2473
|
+
return insert_sql + query;
|
|
2474
|
+
}
|
|
2475
|
+
function insertDeviceMassivoMySQL(table_name,lista_inv) {
|
|
2476
|
+
var query = "";
|
|
2477
|
+
var insert_sql = "insert into devices (inv_ict3_number, inv_tn_number, manifacturer, model, note) "
|
|
2478
|
+
if (table_name && table_name != '') {
|
|
2479
|
+
if (inv_info.tabella == "ImportRevisione2024") {
|
|
2480
|
+
query = "Select ";
|
|
2481
|
+
query += "trim(inv_ict3) as Inventario, ";
|
|
2482
|
+
query += "trim(ex_inv) as ex_inventario, ";
|
|
2483
|
+
query += "marca, ";
|
|
2484
|
+
query += "modello_serie, ";
|
|
2485
|
+
query += "concat(imp.NOTE, ' ', NOTE_2, ' ', NOTE_3, ' ', NOTE_4, ' ', NOTE_5, ' ', NOTE_6, ' ', NOTE_7, ' ', NOTE_8) as note_bene ";
|
|
2486
|
+
query += "from :table_name imp ";
|
|
2487
|
+
query += "left join devices d on Inventario = d.inv_ict3_number "
|
|
2488
|
+
query += "where d.id is null ";
|
|
2489
|
+
}
|
|
2490
|
+
else {
|
|
2491
|
+
query = "Select ";
|
|
2492
|
+
query += "trim(inv_ict3) as Inventario, ";
|
|
2493
|
+
query += "trim(ex_inv) as ex_inventario, ";
|
|
2494
|
+
query += "marca, ";
|
|
2495
|
+
query += "modello_serie, ";
|
|
2496
|
+
query += "concat(imp.note, ' ', note_2, ' ', note_3) as note_bene ";
|
|
2497
|
+
query += "from :table_name imp ";
|
|
2498
|
+
query += "left join devices d on Inventario = d.inv_ict3_number "
|
|
2499
|
+
query += "where d.id is null ";
|
|
2500
|
+
}
|
|
2501
|
+
}
|
|
2502
|
+
|
|
2503
|
+
if (lista_inv && lista_inv.length > 0) {
|
|
2504
|
+
var list_clause = "and Inventario in (";
|
|
2505
|
+
for (let i = 0; i < lista_inv.length; i++) {
|
|
2506
|
+
list_clause += "'" + lista_inv[i] + "'";
|
|
2507
|
+
if (i < lista_inv.length - 1) {
|
|
2508
|
+
list_clause += ", ";
|
|
2509
|
+
}
|
|
2510
|
+
}
|
|
2511
|
+
list_clause += ") ";
|
|
2512
|
+
query += list_clause;
|
|
2513
|
+
}
|
|
2514
|
+
query += "group by Inventario";
|
|
2515
|
+
return insert_sql + query;
|
|
2516
|
+
}
|
|
2517
|
+
function insertDeviceMassivo(db_used,table_name,lista_inv) {
|
|
2518
|
+
var query = "";
|
|
2519
|
+
if (db_used) {
|
|
2520
|
+
switch (db_used) {
|
|
2521
|
+
case 'SQLITE':
|
|
2522
|
+
query = insertDeviceMassivoSQLite(table_name,lista_inv);
|
|
2523
|
+
break;
|
|
2524
|
+
case 'MYSQL':
|
|
2525
|
+
query = insertDeviceMassivoMySQL(table_name,lista_inv);
|
|
2526
|
+
break;
|
|
2527
|
+
}
|
|
2528
|
+
}
|
|
2529
|
+
return query;
|
|
2530
|
+
}
|
|
2531
|
+
//
|
|
2532
|
+
function updateDeviceFromInventarioSQLite(marca_sel, type_sel, lista_inv) {
|
|
2533
|
+
var query = "";
|
|
2534
|
+
var update_sql = "";
|
|
2535
|
+
if (marca_sel != '' || type_sel != '') {
|
|
2536
|
+
update_sql = "update devices set ";
|
|
2537
|
+
if (marca_sel != '') {
|
|
2538
|
+
update_sql += "manifacturer = '" + marca_sel + "'";
|
|
2539
|
+
if (type_sel != '') {
|
|
2540
|
+
update_sql += ", ";
|
|
2541
|
+
}
|
|
2542
|
+
}
|
|
2543
|
+
if (type_sel != '') {
|
|
2544
|
+
update_sql += "type = '" + type_sel + "'";
|
|
2545
|
+
}
|
|
2546
|
+
var list_clause = "where inv_ict3_number in (";
|
|
2547
|
+
for (let i = 0; i < lista_inv.length; i++) {
|
|
2548
|
+
list_clause += "'" + lista_inv[i] + "'";
|
|
2549
|
+
if (i < lista_inv.length - 1) {
|
|
2550
|
+
list_clause += ", ";
|
|
2551
|
+
}
|
|
2552
|
+
}
|
|
2553
|
+
list_clause += ") ";
|
|
2554
|
+
query += update_sql + list_clause;
|
|
2555
|
+
}
|
|
2556
|
+
return query;
|
|
2557
|
+
}
|
|
2558
|
+
function updateDeviceFromInventarioMySQL(marca_sel, type_sel, lista_inv) {
|
|
2559
|
+
var query = "";
|
|
2560
|
+
var update_sql = "";
|
|
2561
|
+
if (marca_sel != '' || type_sel != '') {
|
|
2562
|
+
update_sql = "update devices set ";
|
|
2563
|
+
if (marca_sel != '') {
|
|
2564
|
+
update_sql += "manifacturer = :marca_sel ";
|
|
2565
|
+
if (type_sel != '') {
|
|
2566
|
+
update_sql += ", ";
|
|
2567
|
+
}
|
|
2568
|
+
}
|
|
2569
|
+
if (type_sel != '') {
|
|
2570
|
+
update_sql += "type = :type_sel ";
|
|
2571
|
+
}
|
|
2572
|
+
var list_clause = "where inv_ict3_number in (";
|
|
2573
|
+
for (let i = 0; i < lista_inv.length; i++) {
|
|
2574
|
+
list_clause += "'" + lista_inv[i] + "'";
|
|
2575
|
+
if (i < lista_inv.length - 1) {
|
|
2576
|
+
list_clause += ", ";
|
|
2577
|
+
}
|
|
2578
|
+
}
|
|
2579
|
+
list_clause += ") ";
|
|
2580
|
+
query += update_sql + list_clause;
|
|
2581
|
+
}
|
|
2582
|
+
return query;
|
|
2583
|
+
}
|
|
2584
|
+
function updateDeviceFromInventario(db_used, marca_sel, type_sel, lista_inv) {
|
|
2585
|
+
var query = "";
|
|
2586
|
+
if (db_used) {
|
|
2587
|
+
switch (db_used) {
|
|
2588
|
+
case 'SQLITE':
|
|
2589
|
+
query = updateDeviceFromInventarioSQLite(marca_sel, type_sel, lista_inv);
|
|
2590
|
+
break;
|
|
2591
|
+
case 'MYSQL':
|
|
2592
|
+
query = updateDeviceFromInventarioMySQL(marca_sel, type_sel, lista_inv);
|
|
2593
|
+
break;
|
|
2594
|
+
}
|
|
2595
|
+
}
|
|
2596
|
+
return query;
|
|
2597
|
+
|
|
2598
|
+
}
|
|
2599
|
+
|
|
2600
|
+
|
|
2175
2601
|
//Manage sets
|
|
2176
2602
|
function getSetInfoByIdSetSQLite(id_Set) {
|
|
2177
2603
|
var query = "";
|
|
@@ -2243,13 +2669,6 @@ function insertSetInfoMySQL(id_device, id_device_col) {
|
|
|
2243
2669
|
}
|
|
2244
2670
|
|
|
2245
2671
|
|
|
2246
|
-
function insertSetInfoInverseSQLite(id_device, id_device_col) {
|
|
2247
|
-
return insertSetInfoSQLite(id_device_col, id_device);
|
|
2248
|
-
}
|
|
2249
|
-
|
|
2250
|
-
function insertSetInfoInverseMySQL(id_device, id_device_col) {
|
|
2251
|
-
return insertSetInfoMySQL(id_device_col, id_device);
|
|
2252
|
-
}
|
|
2253
2672
|
function insertSetInfo(db_used, id_device, id_device_col) {
|
|
2254
2673
|
var query = "";
|
|
2255
2674
|
if (db_used) {
|
|
@@ -2818,6 +3237,35 @@ function selectBeneDaInventario(db_used, table_name, inv_code, is_pnrr, is_dismi
|
|
|
2818
3237
|
return query;
|
|
2819
3238
|
}
|
|
2820
3239
|
|
|
3240
|
+
function checkEsistenzaInInventarioSQLite(codice) {
|
|
3241
|
+
var query = "select id from devices ";
|
|
3242
|
+
query += "where inv_ict3_number = '" + codice + "' or ";
|
|
3243
|
+
query += "inv_tn_number = '" + codice +"'";
|
|
3244
|
+
return query;
|
|
3245
|
+
}
|
|
3246
|
+
|
|
3247
|
+
function checkEsistenzaInInventarioMySQL(codice) {
|
|
3248
|
+
var query = "select id from devices ";
|
|
3249
|
+
query += "where inv_ict3_number = '" + codice + "' or ";
|
|
3250
|
+
query += "inv_tn_number = '" + codice +"'";
|
|
3251
|
+
return query;
|
|
3252
|
+
}
|
|
3253
|
+
|
|
3254
|
+
function checkEsistenzaInInventario(db_used,codice) {
|
|
3255
|
+
var query = "";
|
|
3256
|
+
if (db_used) {
|
|
3257
|
+
switch (db_used) {
|
|
3258
|
+
case 'SQLITE':
|
|
3259
|
+
query = checkEsistenzaInInventarioSQLite(codice);
|
|
3260
|
+
break;
|
|
3261
|
+
case 'MYSQL':
|
|
3262
|
+
query = checkEsistenzaInInventarioMySQL(codice);
|
|
3263
|
+
break;
|
|
3264
|
+
}
|
|
3265
|
+
}
|
|
3266
|
+
return query;
|
|
3267
|
+
}
|
|
3268
|
+
|
|
2821
3269
|
function selectTabelleInventariComboSQLite(only_dismiss, only_pnrr) {
|
|
2822
3270
|
var query = "select name, description from table_inventari "
|
|
2823
3271
|
if ((only_dismiss && only_dismiss == 1)|| (only_pnrr && only_pnrr == 1)) {
|
|
@@ -6521,6 +6969,10 @@ module.exports = {
|
|
|
6521
6969
|
getDevicesSelectBySiteCombo,
|
|
6522
6970
|
getDevicesWithProperties,
|
|
6523
6971
|
getBeniAcquisiti,
|
|
6972
|
+
selectInventariPerIntervallo,
|
|
6973
|
+
insertDeviceMassivo,
|
|
6974
|
+
updateDeviceFromInventario,
|
|
6975
|
+
getBeniDaInventari,
|
|
6524
6976
|
getNetworksOnDevice,
|
|
6525
6977
|
getImportedPropertiesByIdDevice,
|
|
6526
6978
|
getSetInfoByIdSet,
|
|
@@ -6568,9 +7020,14 @@ module.exports = {
|
|
|
6568
7020
|
insertAddOn,
|
|
6569
7021
|
updateAddOn,
|
|
6570
7022
|
removeAddOn,
|
|
7023
|
+
//
|
|
6571
7024
|
selectBeneDaInventario,
|
|
6572
7025
|
getDevicesSelectForInventarioRaw,
|
|
6573
7026
|
getDevicesSelectForInventarioRawById,
|
|
7027
|
+
selectTabelleInventariCombo,
|
|
7028
|
+
selectTabellaInventarioByName,
|
|
7029
|
+
checkEsistenzaInInventario,
|
|
7030
|
+
//
|
|
6574
7031
|
getBeniConsumo,
|
|
6575
7032
|
getBeniConsumoNotNull,
|
|
6576
7033
|
getBeneConsumoUsato,
|
|
@@ -6623,11 +7080,17 @@ module.exports = {
|
|
|
6623
7080
|
querySelectGestioniDeviceByIdDevice,
|
|
6624
7081
|
queryConsegne,
|
|
6625
7082
|
queryConsegnaById,
|
|
7083
|
+
createConsegnaMySQLObj,
|
|
7084
|
+
insertConsegna,
|
|
7085
|
+
updateConsegna,
|
|
7086
|
+
removeConsegna,
|
|
7087
|
+
queryLastConsegnaId,
|
|
6626
7088
|
insertConsegnaDevice,
|
|
6627
7089
|
updateConsegnaDevice,
|
|
6628
7090
|
removeConsegnaDevice,
|
|
6629
7091
|
selectDevicePerConsegna,
|
|
6630
7092
|
selectDeviceConsegna,
|
|
7093
|
+
//
|
|
6631
7094
|
selectDeviceInDeposito,
|
|
6632
7095
|
queryDeviceStatusCombo,
|
|
6633
7096
|
queryUsers,
|
|
@@ -6649,11 +7112,6 @@ module.exports = {
|
|
|
6649
7112
|
getLaboratorioByIdSite,
|
|
6650
7113
|
getCategories,
|
|
6651
7114
|
getCategoriesByIdDevice,
|
|
6652
|
-
createConsegnaMySQLObj,
|
|
6653
|
-
insertConsegna,
|
|
6654
|
-
updateConsegna,
|
|
6655
|
-
removeConsegna,
|
|
6656
|
-
queryLastConsegnaId,
|
|
6657
7115
|
//
|
|
6658
7116
|
removeSiteBySet,
|
|
6659
7117
|
updateSiteBySet,
|