alsmanager_lib 1.0.33 → 1.0.35
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 +684 -17
- 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,245 @@ 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
|
+
function insertDeviceSiteFromInventarioSQLite(table_name, data_in, id_place, id_site, lista_inv) {
|
|
2601
|
+
var query = "";
|
|
2602
|
+
var insert_sql = "";
|
|
2603
|
+
if (table_name && id_site > 0 && id_place != '' && lista_inv.length > 0) {
|
|
2604
|
+
insert_sql = "insert into device_site (id_device, id_place, id_site, date_in, date_out) "
|
|
2605
|
+
var dp_str = "2024-09-01";
|
|
2606
|
+
var dp = data_in;
|
|
2607
|
+
if (dp) {
|
|
2608
|
+
var d = new Date(dp);
|
|
2609
|
+
dp_str = d.getFullYear() + "-" + String((d.getMonth() + 1)).padStart(2, '0') + "-" + String(d.getDate()).padStart(2, '0');
|
|
2610
|
+
}
|
|
2611
|
+
|
|
2612
|
+
if (inv_info.tabella == "ImportRevisione2024") {
|
|
2613
|
+
query = "Select ";
|
|
2614
|
+
query += "d.id, ";
|
|
2615
|
+
query += "'" + id_place + "', ";
|
|
2616
|
+
query += id_site + ", ";
|
|
2617
|
+
query += "'" + dp_str + "', ";
|
|
2618
|
+
query += "'2999-12-31' ";
|
|
2619
|
+
query += "from " + table_name + " imp ";
|
|
2620
|
+
query += "join devices d on d.inv_ict3_number = trim(imp.inv_ict3) ";
|
|
2621
|
+
query += "left join device_site ds on d.id = ds.id_device ";
|
|
2622
|
+
query += "where ds.id_device is null ";
|
|
2623
|
+
|
|
2624
|
+
}
|
|
2625
|
+
else {
|
|
2626
|
+
query = "Select ";
|
|
2627
|
+
query += "d.id, ";
|
|
2628
|
+
query += "'" + id_place + "', ";
|
|
2629
|
+
query += id_site + ", ";
|
|
2630
|
+
query += "'" + dp_str + "', ";
|
|
2631
|
+
query += "'2999-12-31' ";
|
|
2632
|
+
query += "from " + table_name + " imp ";
|
|
2633
|
+
query += "join devices d on d.inv_ict3_number = trim(imp.inv_ict3) ";
|
|
2634
|
+
query += "left join device_site ds on d.id = ds.id_device ";
|
|
2635
|
+
query += "where ds.id_device is null ";
|
|
2636
|
+
}
|
|
2637
|
+
if (lista_inv && lista_inv.length > 0) {
|
|
2638
|
+
var list_clause = "and imp.inv_ict3 in (";
|
|
2639
|
+
for (let i = 0; i < lista_inv.length; i++) {
|
|
2640
|
+
list_clause += "'" + lista_inv[i] + "'";
|
|
2641
|
+
if (i < lista_inv.length - 1) {
|
|
2642
|
+
list_clause += ", ";
|
|
2643
|
+
}
|
|
2644
|
+
}
|
|
2645
|
+
list_clause += ") ";
|
|
2646
|
+
query += list_clause;
|
|
2647
|
+
}
|
|
2648
|
+
query += "group by imp.inv_ict3";
|
|
2649
|
+
}
|
|
2650
|
+
|
|
2651
|
+
return insert_sql + query;
|
|
2652
|
+
}
|
|
2653
|
+
function insertDeviceSiteFromInventarioMySQL() {
|
|
2654
|
+
|
|
2655
|
+
}
|
|
2656
|
+
function insertDeviceSiteFromInventario(db_used, table_name, data_in, id_place, id_site, lista_inv) {
|
|
2657
|
+
var query = "";
|
|
2658
|
+
if (db_used) {
|
|
2659
|
+
switch (db_used) {
|
|
2660
|
+
case 'SQLITE':
|
|
2661
|
+
query = insertDeviceSiteFromInventarioSQLite(table_name, data_in, id_place, id_site, lista_inv);
|
|
2662
|
+
break;
|
|
2663
|
+
case 'MYSQL':
|
|
2664
|
+
query = insertDeviceSiteFromInventarioMySQL(table_name, data_in, id_place, id_site, lista_inv);
|
|
2665
|
+
break;
|
|
2666
|
+
}
|
|
2667
|
+
}
|
|
2668
|
+
return query;
|
|
2669
|
+
}
|
|
2670
|
+
|
|
2175
2671
|
//Manage sets
|
|
2176
2672
|
function getSetInfoByIdSetSQLite(id_Set) {
|
|
2177
2673
|
var query = "";
|
|
@@ -2243,13 +2739,6 @@ function insertSetInfoMySQL(id_device, id_device_col) {
|
|
|
2243
2739
|
}
|
|
2244
2740
|
|
|
2245
2741
|
|
|
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
2742
|
function insertSetInfo(db_used, id_device, id_device_col) {
|
|
2254
2743
|
var query = "";
|
|
2255
2744
|
if (db_used) {
|
|
@@ -2818,6 +3307,35 @@ function selectBeneDaInventario(db_used, table_name, inv_code, is_pnrr, is_dismi
|
|
|
2818
3307
|
return query;
|
|
2819
3308
|
}
|
|
2820
3309
|
|
|
3310
|
+
function checkEsistenzaInInventarioSQLite(codice) {
|
|
3311
|
+
var query = "select id from devices ";
|
|
3312
|
+
query += "where inv_ict3_number = '" + codice + "' or ";
|
|
3313
|
+
query += "inv_tn_number = '" + codice +"'";
|
|
3314
|
+
return query;
|
|
3315
|
+
}
|
|
3316
|
+
|
|
3317
|
+
function checkEsistenzaInInventarioMySQL(codice) {
|
|
3318
|
+
var query = "select id from devices ";
|
|
3319
|
+
query += "where inv_ict3_number = '" + codice + "' or ";
|
|
3320
|
+
query += "inv_tn_number = '" + codice +"'";
|
|
3321
|
+
return query;
|
|
3322
|
+
}
|
|
3323
|
+
|
|
3324
|
+
function checkEsistenzaInInventario(db_used,codice) {
|
|
3325
|
+
var query = "";
|
|
3326
|
+
if (db_used) {
|
|
3327
|
+
switch (db_used) {
|
|
3328
|
+
case 'SQLITE':
|
|
3329
|
+
query = checkEsistenzaInInventarioSQLite(codice);
|
|
3330
|
+
break;
|
|
3331
|
+
case 'MYSQL':
|
|
3332
|
+
query = checkEsistenzaInInventarioMySQL(codice);
|
|
3333
|
+
break;
|
|
3334
|
+
}
|
|
3335
|
+
}
|
|
3336
|
+
return query;
|
|
3337
|
+
}
|
|
3338
|
+
|
|
2821
3339
|
function selectTabelleInventariComboSQLite(only_dismiss, only_pnrr) {
|
|
2822
3340
|
var query = "select name, description from table_inventari "
|
|
2823
3341
|
if ((only_dismiss && only_dismiss == 1)|| (only_pnrr && only_pnrr == 1)) {
|
|
@@ -4781,6 +5299,132 @@ function queryLastDismissioneId(db_used) {
|
|
|
4781
5299
|
return query;
|
|
4782
5300
|
}
|
|
4783
5301
|
|
|
5302
|
+
function selectDocumentiByIdDismissioneSQLite(id_dismiss) {
|
|
5303
|
+
var query = "select dsc.id, dc.tipo, dc.data_emissione, dc.descrizione from dismissione_docs dsc ";
|
|
5304
|
+
query += "join documenti dc on dc.id = dsc.id_documento ";
|
|
5305
|
+
query += "where id_dismissione = " + id_dismiss;
|
|
5306
|
+
return query;
|
|
5307
|
+
}
|
|
5308
|
+
function selectDocumentiByIdDismissioneMySQL(id_dismiss) {
|
|
5309
|
+
var query = "select dsc.id, dc.tipo, dc.data_emissione, dc.descrizione from dismissione_docs dsc ";
|
|
5310
|
+
query += "join documenti dc on dc.id = dsc.id_documento ";
|
|
5311
|
+
query += "where id_dismissione = :id_dismiss";
|
|
5312
|
+
return query;
|
|
5313
|
+
}
|
|
5314
|
+
function selectDocumentiByIdDismissione(db_used,id_dismiss) {
|
|
5315
|
+
var query = "";
|
|
5316
|
+
if (db_used) {
|
|
5317
|
+
switch (db_used) {
|
|
5318
|
+
case 'SQLITE':
|
|
5319
|
+
query = selectDocumentiByIdDismissioneSQLite(id_dismiss);
|
|
5320
|
+
break;
|
|
5321
|
+
case 'MYSQL':
|
|
5322
|
+
query = selectDocumentiByIdDismissioneMySQL(id_dismiss);
|
|
5323
|
+
break;
|
|
5324
|
+
}
|
|
5325
|
+
}
|
|
5326
|
+
return query;
|
|
5327
|
+
}
|
|
5328
|
+
|
|
5329
|
+
function insertDocumentoDismissioneSQLite(id_dismiss, id_doc) {
|
|
5330
|
+
var query = "insert into dismissioni_docs (id_dismissione, id_documento) values ";
|
|
5331
|
+
query += "(" + id_dismiss + ", " + id_doc + ")";
|
|
5332
|
+
return query;
|
|
5333
|
+
}
|
|
5334
|
+
function insertDocumentoDismissioneMySQL(id_dismiss, id_doc) {
|
|
5335
|
+
var query = "insert into dismissioni_docs (id_dismissione, id_documento) values ";
|
|
5336
|
+
query += "(:id_dismiss, :id_doc)";
|
|
5337
|
+
return query;
|
|
5338
|
+
}
|
|
5339
|
+
function insertDocumentoDismissione(db_used, id_dismiss, id_doc) {
|
|
5340
|
+
var query = "";
|
|
5341
|
+
if (db_used) {
|
|
5342
|
+
switch (db_used) {
|
|
5343
|
+
case 'SQLITE':
|
|
5344
|
+
query = insertDocumentoDismissioneSQLite(id_dismiss, id_doc);
|
|
5345
|
+
break;
|
|
5346
|
+
case 'MYSQL':
|
|
5347
|
+
query = insertDocumentoDismissioneMySQL(id_dismiss, id_doc);
|
|
5348
|
+
break;
|
|
5349
|
+
}
|
|
5350
|
+
}
|
|
5351
|
+
return query;
|
|
5352
|
+
}
|
|
5353
|
+
|
|
5354
|
+
function updateDocumentoDismissioneSQLite(id_docdismiss, id_doc) {
|
|
5355
|
+
var query = "update dismissioni_docs set id_documento = " + id_doc + " ";
|
|
5356
|
+
query += "where id = " + id_docdismiss;
|
|
5357
|
+
return query;
|
|
5358
|
+
}
|
|
5359
|
+
function updateDocumentoDismissioneMySQL(id_docdismiss, id_doc) {
|
|
5360
|
+
var query = "update dismissioni_docs set id_documento = :id_doc ";
|
|
5361
|
+
query += "where id = :id_docdismiss";
|
|
5362
|
+
return query;
|
|
5363
|
+
}
|
|
5364
|
+
function updateDocumentoDismissione(db_used, id_docdismiss, id_doc) {
|
|
5365
|
+
var query = "";
|
|
5366
|
+
if (db_used) {
|
|
5367
|
+
switch (db_used) {
|
|
5368
|
+
case 'SQLITE':
|
|
5369
|
+
query = updateDocumentoDismissioneSQLite(id_docdismiss, id_doc);
|
|
5370
|
+
break;
|
|
5371
|
+
case 'MYSQL':
|
|
5372
|
+
query = updateDocumentoDismissioneMySQL(id_docdismiss, id_doc);
|
|
5373
|
+
break;
|
|
5374
|
+
}
|
|
5375
|
+
}
|
|
5376
|
+
return query;
|
|
5377
|
+
}
|
|
5378
|
+
|
|
5379
|
+
function removeDocumentoDismissioneSQLite(id_docdismiss) {
|
|
5380
|
+
var query = "delete from dismissioni_docs ";
|
|
5381
|
+
query += "where id = " + id_docdismiss;
|
|
5382
|
+
return query;
|
|
5383
|
+
}
|
|
5384
|
+
function removeDocumentoDismissioneMySQL(id_docdismiss) {
|
|
5385
|
+
var query = "delete from dismissioni_docs ";
|
|
5386
|
+
query += "where id = :id_docdismiss";
|
|
5387
|
+
return query;
|
|
5388
|
+
}
|
|
5389
|
+
function removeDocumentoDismissione(db_used, id_docdismiss) {
|
|
5390
|
+
var query = "";
|
|
5391
|
+
if (db_used) {
|
|
5392
|
+
switch (db_used) {
|
|
5393
|
+
case 'SQLITE':
|
|
5394
|
+
query = removeDocumentoDismissioneSQLite(id_docdismiss);
|
|
5395
|
+
break;
|
|
5396
|
+
case 'MYSQL':
|
|
5397
|
+
query = removeDocumentoDismissioneMySQL(id_docdismiss);
|
|
5398
|
+
break;
|
|
5399
|
+
}
|
|
5400
|
+
}
|
|
5401
|
+
return query;
|
|
5402
|
+
}
|
|
5403
|
+
|
|
5404
|
+
function checkDocumentoInDismissioneSQLite(id_dismiss, id_doc) {
|
|
5405
|
+
var query = "select count(*) from dismissione_docs ";
|
|
5406
|
+
query += "where id_dismissione = " + id_dismiss + " and id_documento = " + id_doc;
|
|
5407
|
+
return query;
|
|
5408
|
+
}
|
|
5409
|
+
function checkDocumentoInDismissioneMySQL(id_dismiss, id_doc) {
|
|
5410
|
+
var query = "select count(*) from dismissione_docs ";
|
|
5411
|
+
query += "where id_dismissione = :id_dismiss and id_documento = :id_doc";
|
|
5412
|
+
return query;
|
|
5413
|
+
}
|
|
5414
|
+
function checkDocumentoInDismissione(db_used, id_dismiss, id_doc) {
|
|
5415
|
+
var query = "";
|
|
5416
|
+
if (db_used) {
|
|
5417
|
+
switch (db_used) {
|
|
5418
|
+
case 'SQLITE':
|
|
5419
|
+
query = checkDocumentoInDismissioneSQLite(id_dismiss, id_doc);
|
|
5420
|
+
break;
|
|
5421
|
+
case 'MYSQL':
|
|
5422
|
+
query = checkDocumentoInDismissioneMySQL(id_dismiss, id_doc);
|
|
5423
|
+
break;
|
|
5424
|
+
}
|
|
5425
|
+
}
|
|
5426
|
+
return query;
|
|
5427
|
+
}
|
|
4784
5428
|
|
|
4785
5429
|
//End manage dismissioni
|
|
4786
5430
|
|
|
@@ -4866,7 +5510,9 @@ function selectDocumentoById(db_used, id_doc) {
|
|
|
4866
5510
|
return query;
|
|
4867
5511
|
}
|
|
4868
5512
|
|
|
4869
|
-
|
|
5513
|
+
function queryDocumentoTypes() {
|
|
5514
|
+
return "select tipo, descrizione from documento_types order by tipo";
|
|
5515
|
+
}
|
|
4870
5516
|
|
|
4871
5517
|
function selectDocumentiComboSQLite(tipo, anno_emissione) {
|
|
4872
5518
|
var where_clause = "";
|
|
@@ -5229,9 +5875,12 @@ function removeConnectionSet(db_used, id_set, id_conn_set) {
|
|
|
5229
5875
|
}
|
|
5230
5876
|
|
|
5231
5877
|
// end define removeConnectionSet
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
|
|
5878
|
+
|
|
5879
|
+
function getBeniConsumoTypes() {
|
|
5880
|
+
var query = "SELECT DISTINCT Tipo as search_type from beniconsumo order by search_type";
|
|
5881
|
+
return query;
|
|
5882
|
+
}
|
|
5883
|
+
|
|
5235
5884
|
function getBeniConsumo() {
|
|
5236
5885
|
var query = "select id, Tipo, Marca, Modello, Quantitativo from beniconsumo";
|
|
5237
5886
|
query += " order by Tipo";
|
|
@@ -6521,6 +7170,11 @@ module.exports = {
|
|
|
6521
7170
|
getDevicesSelectBySiteCombo,
|
|
6522
7171
|
getDevicesWithProperties,
|
|
6523
7172
|
getBeniAcquisiti,
|
|
7173
|
+
selectInventariPerIntervallo,
|
|
7174
|
+
insertDeviceMassivo,
|
|
7175
|
+
updateDeviceFromInventario,
|
|
7176
|
+
insertDeviceSiteFromInventario,
|
|
7177
|
+
getBeniDaInventari,
|
|
6524
7178
|
getNetworksOnDevice,
|
|
6525
7179
|
getImportedPropertiesByIdDevice,
|
|
6526
7180
|
getSetInfoByIdSet,
|
|
@@ -6568,9 +7222,15 @@ module.exports = {
|
|
|
6568
7222
|
insertAddOn,
|
|
6569
7223
|
updateAddOn,
|
|
6570
7224
|
removeAddOn,
|
|
7225
|
+
//
|
|
6571
7226
|
selectBeneDaInventario,
|
|
6572
7227
|
getDevicesSelectForInventarioRaw,
|
|
6573
7228
|
getDevicesSelectForInventarioRawById,
|
|
7229
|
+
selectTabelleInventariCombo,
|
|
7230
|
+
selectTabellaInventarioByName,
|
|
7231
|
+
checkEsistenzaInInventario,
|
|
7232
|
+
//
|
|
7233
|
+
getBeniConsumoTypes,
|
|
6574
7234
|
getBeniConsumo,
|
|
6575
7235
|
getBeniConsumoNotNull,
|
|
6576
7236
|
getBeneConsumoUsato,
|
|
@@ -6592,6 +7252,7 @@ module.exports = {
|
|
|
6592
7252
|
updateDocumento,
|
|
6593
7253
|
removeDocumento,
|
|
6594
7254
|
getDocumentByIdDoc,
|
|
7255
|
+
queryDocumentoTypes,
|
|
6595
7256
|
//
|
|
6596
7257
|
selectDismissioniByYear,
|
|
6597
7258
|
selectDismissioneById,
|
|
@@ -6611,6 +7272,11 @@ module.exports = {
|
|
|
6611
7272
|
removeDevicesFromDismissione,
|
|
6612
7273
|
removeDismissioneDeviceFromDismissione,
|
|
6613
7274
|
queryLastDismissioneId,
|
|
7275
|
+
selectDocumentiByIdDismissione,
|
|
7276
|
+
insertDocumentoDismissione,
|
|
7277
|
+
updateDocumentoDismissione,
|
|
7278
|
+
removeDocumentoDismissione,
|
|
7279
|
+
checkDocumentoInDismissione,
|
|
6614
7280
|
//
|
|
6615
7281
|
assignCategoryFromDB,
|
|
6616
7282
|
getBeniConsumoByIdDevice,
|
|
@@ -6623,11 +7289,17 @@ module.exports = {
|
|
|
6623
7289
|
querySelectGestioniDeviceByIdDevice,
|
|
6624
7290
|
queryConsegne,
|
|
6625
7291
|
queryConsegnaById,
|
|
7292
|
+
createConsegnaMySQLObj,
|
|
7293
|
+
insertConsegna,
|
|
7294
|
+
updateConsegna,
|
|
7295
|
+
removeConsegna,
|
|
7296
|
+
queryLastConsegnaId,
|
|
6626
7297
|
insertConsegnaDevice,
|
|
6627
7298
|
updateConsegnaDevice,
|
|
6628
7299
|
removeConsegnaDevice,
|
|
6629
7300
|
selectDevicePerConsegna,
|
|
6630
7301
|
selectDeviceConsegna,
|
|
7302
|
+
//
|
|
6631
7303
|
selectDeviceInDeposito,
|
|
6632
7304
|
queryDeviceStatusCombo,
|
|
6633
7305
|
queryUsers,
|
|
@@ -6649,11 +7321,6 @@ module.exports = {
|
|
|
6649
7321
|
getLaboratorioByIdSite,
|
|
6650
7322
|
getCategories,
|
|
6651
7323
|
getCategoriesByIdDevice,
|
|
6652
|
-
createConsegnaMySQLObj,
|
|
6653
|
-
insertConsegna,
|
|
6654
|
-
updateConsegna,
|
|
6655
|
-
removeConsegna,
|
|
6656
|
-
queryLastConsegnaId,
|
|
6657
7324
|
//
|
|
6658
7325
|
removeSiteBySet,
|
|
6659
7326
|
updateSiteBySet,
|