alsmanager_lib 1.0.0
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/index.js +3806 -0
- package/package.json +11 -0
- package/test/script.js +3 -0
package/index.js
ADDED
|
@@ -0,0 +1,3806 @@
|
|
|
1
|
+
// Manage connectors
|
|
2
|
+
function getConnectorsByIdDeviceSQLite(id_device) {
|
|
3
|
+
var query = "select dc.id, ct.conn_type as Tipo, cp.name as Protocollo, dc.conn_number as Numero, dc.conn_verse as Verso from device_connectors dc ";
|
|
4
|
+
query += "join connection_types ct on ct.id = dc.conn_type ";
|
|
5
|
+
query += "join connection_protocols cp on cp.id = dc.conn_protocol ";
|
|
6
|
+
query += "where id_device = " + id_device;
|
|
7
|
+
return query;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function getConnectorsByIdDeviceMySQL(id_device) {
|
|
11
|
+
var query = "select dc.id, ct.conn_type as Tipo, cp.name as Protocollo, dc.conn_number as Numero, dc.conn_verse as Verso from device_connectors dc ";
|
|
12
|
+
query += "join connection_types ct on ct.id = dc.conn_type ";
|
|
13
|
+
query += "join connection_protocols cp on cp.id = dc.conn_protocol ";
|
|
14
|
+
query += "where id_device = :id_device";
|
|
15
|
+
return query;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function getConnectorByIdSQLite(id_conn) {
|
|
19
|
+
var query = "select dc.id, dc.conn_type, dc.conn_protocol, dc.conn_number, dc.conn_verse from device_connectors dc ";
|
|
20
|
+
query += "where dc.id = " + id_conn;
|
|
21
|
+
return query;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function getConnectorByIdMySQL() {
|
|
25
|
+
var query = "select dc.id, dc.conn_type, dc.conn_protocol, dc.conn_number, dc.conn_verse from device_connectors dc ";
|
|
26
|
+
query += "where dc.id = :id_conn";
|
|
27
|
+
return query;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
function insertConnectorSQLite(id_device, conn_obj) {
|
|
32
|
+
//dc.id, ct.conn_type as Tipo, cp.name as Protocollo, dc.conn_number as Numero, dc.conn_verse as Verso from device_connectors
|
|
33
|
+
var query = "insert into device_connectors (id_device, conn_type, conn_protocol, conn_number, conn_verse) values ";
|
|
34
|
+
query += "(" + id_device + ", " + conn_obj.tipo + ", " + conn_obj.protocollo + "," + conn_obj.numero + ", '" + conn_obj.verso + "')";
|
|
35
|
+
return query;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function insertConnectorMySQL(id_device, conn_obj) {
|
|
39
|
+
var query = "insert into device_connectors (id_device, conn_type, conn_protocol, conn_number, conn_verse) values ";
|
|
40
|
+
query += "(:id_device, :tipo, :protocollo, :numero, :verso)";
|
|
41
|
+
return query;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function updateConnectorSQLite(id_device, conn_obj) {
|
|
45
|
+
var query = "update device_connectors "
|
|
46
|
+
query += "set id_device = " + id_device + ", ";
|
|
47
|
+
query += "conn_type = " + conn_obj.tipo + ", ";
|
|
48
|
+
query += "conn_protocol = " + conn_obj.protocollo + ", ";
|
|
49
|
+
query += "conn_number = " + conn_obj.numero + ", ";
|
|
50
|
+
query += "conn_verse = '" + conn_obj.verso + "' ";
|
|
51
|
+
query += "where id = " + conn_obj.id;
|
|
52
|
+
return query;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function updateConnectorMySQL(id_device, conn_obj) {
|
|
56
|
+
var query = "update device_connectors "
|
|
57
|
+
query += "set id_device = :id_device, ";
|
|
58
|
+
query += "conn_type = :tipo, ";
|
|
59
|
+
query += "conn_protocol = :protocollo, ";
|
|
60
|
+
query += "conn_number = :numero, ";
|
|
61
|
+
query += "conn_verse = :verso ";
|
|
62
|
+
query += "where id = :id_conn";
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
function removeConnectorSQLite(id_device, conn_obj) {
|
|
67
|
+
var query = "delete from device_connectors ";
|
|
68
|
+
query += "where id = " + conn_obj.id;
|
|
69
|
+
return query;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function removeConnectorMySQL() {
|
|
73
|
+
var query = "delete from device_connectors ";
|
|
74
|
+
query += "where id = :id_conn";
|
|
75
|
+
return query;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
//End Manage connectors
|
|
79
|
+
// Manage Storage
|
|
80
|
+
function getStorageByIdDeviceSQLite(id_device) {
|
|
81
|
+
var query = "select ds.id, st.name as Tipo, ds.storage_size_unit as Unit, ds.storage_totsize as Dimensione, ds.storage_available as Disponibile from device_storages ds ";
|
|
82
|
+
query += "join storage_types st on st.id = ds.storage_type ";
|
|
83
|
+
query += "where id_device = " + id_device;
|
|
84
|
+
return query;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function getStorageByIdDeviceMySQL(id_device) {
|
|
88
|
+
var query = "select ds.id, st.name as Tipo, ds.storage_size_unit as Unit, ds.storage_totsize as Dimensione, ds.storage_available as Disponibile from device_storages ds ";
|
|
89
|
+
query += "join storage_types st on st.id = ds.storage_type ";
|
|
90
|
+
query += "where id_device = :id_device";
|
|
91
|
+
return query;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function getStorageByIdSQLite(id_storage) {
|
|
95
|
+
var query = "select id, id_device, storage_type, storage_size_unit, storage_totsize, storage_available from device_storages ";
|
|
96
|
+
query += "where id = " + id_storage;
|
|
97
|
+
return query;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function getStorageByIdMySQL() {
|
|
101
|
+
var query = "select id, id_device, storage_type, storage_size_unit, storage_totsize, storage_available from device_storages ";
|
|
102
|
+
query += "where id = :id_storage";
|
|
103
|
+
return query;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function insertStorageSQLite(id_device, storage_obj) {
|
|
107
|
+
var query = "insert into device_storages (id_device, storage_type, storage_size_unit, storage_totsize, storage_available) values ";
|
|
108
|
+
query += "(" + id_device + ", " + storage_obj.tipo + ", '" + storage_obj.unita + "'," + storage_obj.dimensione + ", " + storage_obj.dim_disponibile + ")";
|
|
109
|
+
return query;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function insertStorageMySQL(id_device, storage_obj) {
|
|
113
|
+
var query = "insert into device_storages (id_device, storage_type, storage_size_unit, storage_totsize, storage_available) values ";
|
|
114
|
+
query += "(:id_device, :tipo, :unita, :dimensione, :dim_disponibile)";
|
|
115
|
+
return query;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function updateStorageSQLite(id_device, storage_obj) {
|
|
119
|
+
var query = "update device_storages "
|
|
120
|
+
query += "set id_device = " + id_device + ", ";
|
|
121
|
+
query += "storage_type = " + storage_obj.tipo + ", ";
|
|
122
|
+
query += "storage_size_unit = '" + storage_obj.unita + "', ";
|
|
123
|
+
query += "storage_totsize = " + storage_obj.dimensione + ", ";
|
|
124
|
+
query += "storage_available = " + storage_obj.dim_disponibile + " ";
|
|
125
|
+
query += "where id = " + storage_obj.id;
|
|
126
|
+
return query;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function updateStorageMySQL(id_device, storage_obj) {
|
|
130
|
+
var query = "update device_storages "
|
|
131
|
+
query += "set id_device = :id_device, ";
|
|
132
|
+
query += "storage_type = :tipo, ";
|
|
133
|
+
query += "storage_size_unit = :unita, ";
|
|
134
|
+
query += "storage_totsize = :dimensione, ";
|
|
135
|
+
query += "storage_available = :dim_disponibile ";
|
|
136
|
+
query += "where id = id_storage";
|
|
137
|
+
return query;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function removeStorageSQLite(id_device, storage_obj) {
|
|
141
|
+
var query = "delete from device_storages ";
|
|
142
|
+
query += "where id = " + storage_obj.id;
|
|
143
|
+
return query;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function removeStorageMySQL(id_device, storage_obj) {
|
|
147
|
+
var query = "delete from device_storages ";
|
|
148
|
+
query += "where id = id_storage";
|
|
149
|
+
return query;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
//End Manage Storage
|
|
153
|
+
// Manage Network
|
|
154
|
+
function getNetworkByIdDeviceSQLite(id_device) {
|
|
155
|
+
var query = "select dn.id, dn.net_type as Tipo, dn.mac_address as MAC, dn.ipv4_static as IP4, dn.ipv6_static as IP6 from device_networks dn ";
|
|
156
|
+
query += "where dn.id_device = " + id_device;
|
|
157
|
+
return query;
|
|
158
|
+
}
|
|
159
|
+
function getNetworkByIdDeviceMySQL(id_device) {
|
|
160
|
+
var query = "select dn.id, dn.net_type as Tipo, dn.mac_address as MAC, dn.ipv4_static as IP4, dn.ipv6_static as IP6 from device_networks dn ";
|
|
161
|
+
query += "where dn.id_device = :id_device";
|
|
162
|
+
return query;
|
|
163
|
+
}
|
|
164
|
+
function getNetworkByIdSQLite(id_network) {
|
|
165
|
+
var query = "select id, id_device, net_type, mac_address, ipv4_static, ipv6_static from device_networks ";
|
|
166
|
+
query += "where id = " + id_network;
|
|
167
|
+
return query;
|
|
168
|
+
}
|
|
169
|
+
function getNetworkByIdMySQL() {
|
|
170
|
+
var query = "select id, id_device, net_type, mac_address, ipv4_static, ipv6_static from device_networks ";
|
|
171
|
+
query += "where id = :id_network";
|
|
172
|
+
return query;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function insertNetworkSQLite(id_device, network_obj) {
|
|
176
|
+
var query = "insert into device_networks (id_device, net_type, mac_address, ipv4_static, ipv6_static) values ";
|
|
177
|
+
query += "(" + id_device + ", '" + network_obj.tipo + "', '" + network_obj.mac_address + "', '" + network_obj.ipv4_static + "', '" + network_obj.ipv6_static + "')";
|
|
178
|
+
return query;
|
|
179
|
+
}
|
|
180
|
+
function insertNetworkMySQL(id_device, network_obj) {
|
|
181
|
+
var query = "insert into device_networks (id_device, net_type, mac_address, ipv4_static, ipv6_static) values ";
|
|
182
|
+
query += "(:id_device, :tipo, :mac_address, :ipv4_static, :ipv6_static)";
|
|
183
|
+
return query;
|
|
184
|
+
}
|
|
185
|
+
function updateNetworkSQLite(id_device, network_obj) {
|
|
186
|
+
var query = "update device_networks "
|
|
187
|
+
query += "set id_device = " + id_device + ", ";
|
|
188
|
+
query += "net_type = '" + network_obj.tipo + "', ";
|
|
189
|
+
query += "mac_address = '" + network_obj.mac_address + "', ";
|
|
190
|
+
query += "ipv4_static = '" + network_obj.ipv4_static + "', ";
|
|
191
|
+
query += "ipv6_static = '" + network_obj.ipv6_static + "' ";
|
|
192
|
+
query += "where id = " + network_obj.id;
|
|
193
|
+
return query;
|
|
194
|
+
}
|
|
195
|
+
function updateNetworkMySQL(id_device, network_obj) {
|
|
196
|
+
var query = "update device_networks "
|
|
197
|
+
query += "set id_device = :id_device, ";
|
|
198
|
+
query += "net_type = :tipo, ";
|
|
199
|
+
query += "mac_address = :mac_address, ";
|
|
200
|
+
query += "ipv4_static = :ipv4_static, ";
|
|
201
|
+
query += "ipv6_static = :ipv6_static ";
|
|
202
|
+
query += "where id = :id_network";
|
|
203
|
+
return query;
|
|
204
|
+
}
|
|
205
|
+
function removeNetworkSQLite(id_device, network_obj) {
|
|
206
|
+
var query = "delete from device_networks ";
|
|
207
|
+
query += "where id = " + network_obj.id;
|
|
208
|
+
return query;
|
|
209
|
+
}
|
|
210
|
+
function removeNetworkMySQL(id_device, network_obj) {
|
|
211
|
+
var query = "delete from device_networks ";
|
|
212
|
+
query += "where id = :id_network";
|
|
213
|
+
return query;
|
|
214
|
+
}
|
|
215
|
+
//End Manage Network
|
|
216
|
+
// Manage AddOns
|
|
217
|
+
function getAddOnByIdDeviceSQLite(id_device) {
|
|
218
|
+
var query = "select da.id, a.name as Tipo, da.maker as Marca, da.model as Modello, da.description as Descrizione from device_addons da ";
|
|
219
|
+
query += "join addon_types a on a.id = da.addon_type ";
|
|
220
|
+
query += "where da.id_device = " + id_device;
|
|
221
|
+
return query;
|
|
222
|
+
}
|
|
223
|
+
function getAddOnByIdDeviceMySQL(id_device) {
|
|
224
|
+
var query = "select da.id, a.name as Tipo, da.maker as Marca, da.model as Modello, da.description as Descrizione from device_addons da ";
|
|
225
|
+
query += "join addon_types a on a.id = da.addon_type ";
|
|
226
|
+
query += "where da.id_device = :id_device";
|
|
227
|
+
return query;
|
|
228
|
+
}
|
|
229
|
+
function getAddOnByIdSQLite(id_addon) {
|
|
230
|
+
var query = "select id, id_device, addon_type, maker, model, description from device_addons ";
|
|
231
|
+
query += "where id = " + id_addon;
|
|
232
|
+
return query;
|
|
233
|
+
}
|
|
234
|
+
function getAddOnByIdMySQL() {
|
|
235
|
+
var query = "select id, id_device, addon_type, maker, model, description from device_addons ";
|
|
236
|
+
query += "where id = :id_addon";
|
|
237
|
+
return query;
|
|
238
|
+
}
|
|
239
|
+
function insertAddOnSQLite(id_device, addon_obj) {
|
|
240
|
+
var query = "insert into device_addons (id_device, addon_type, maker, model, description) values ";
|
|
241
|
+
query += "(" + id_device + ", " + addon_obj.addon_type + ", '" + addon_obj.maker + "', '" + addon_obj.model + "', '" + addon_obj.description + "')";
|
|
242
|
+
return query;
|
|
243
|
+
}
|
|
244
|
+
function insertAddOnMySQL(id_device, addon_obj) {
|
|
245
|
+
var query = "insert into device_addons (id_device, addon_type, maker, model, description) values ";
|
|
246
|
+
query += "(:id_device, :addon_type, :maker, :model, :description) ";
|
|
247
|
+
return query;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
function updateAddOnSQLite(id_device, addon_obj) {
|
|
251
|
+
var query = "update device_addons "
|
|
252
|
+
query += "set id_device = " + id_device + ", ";
|
|
253
|
+
query += "addon_type = " + addon_obj.addon_type + ", ";
|
|
254
|
+
query += "maker = '" + addon_obj.maker + "', ";
|
|
255
|
+
query += "model = '" + addon_obj.model + "', ";
|
|
256
|
+
query += "description = '" + addon_obj.description + "' ";
|
|
257
|
+
query += "where id = " + addon_obj.id;
|
|
258
|
+
return query;
|
|
259
|
+
}
|
|
260
|
+
function updateAddOnMySQL(id_device, addon_obj) {
|
|
261
|
+
var query = "update device_networks "
|
|
262
|
+
query += "set id_device = :id_device, ";
|
|
263
|
+
query += "addon_type = :addon_type, ";
|
|
264
|
+
query += "maker = :maker, ";
|
|
265
|
+
query += "model = :model, ";
|
|
266
|
+
query += "description = :description ";
|
|
267
|
+
query += "where id = :id_addon";
|
|
268
|
+
return query;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
function removeAddOnSQLite(id_device, addon_obj) {
|
|
272
|
+
var query = "delete from device_addons ";
|
|
273
|
+
query += "where id = " + addon_obj.id;
|
|
274
|
+
}
|
|
275
|
+
function removeAddOnMySQL(id_device, addon_obj) {
|
|
276
|
+
var query = "delete from device_addons ";
|
|
277
|
+
query += "where id = id_addon";
|
|
278
|
+
}
|
|
279
|
+
//End Manage AddOns
|
|
280
|
+
//Manage PC Properties
|
|
281
|
+
function existsPCPropertiesSQLite(id_device) {
|
|
282
|
+
var query = "select count(*) as num from device_pc ";
|
|
283
|
+
query += "where id_device = " + id_device;
|
|
284
|
+
return query;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
function existsPCPropertiesMySQL(id_device) {
|
|
288
|
+
var query = "select count(*) as num from device_pc ";
|
|
289
|
+
query += "where id_device = :id_device";
|
|
290
|
+
return query;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
function getPCPropertiesSQLite(id_device) {
|
|
294
|
+
var query = "select d.id as Id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello,";
|
|
295
|
+
query += "dp.pc_name as Name, dp.CPU as CPU, dp.CPU_arch as CPUArch, dp.OS_arch as OSArch, dp.OS as OS, dp.OS_version as OSVersion, ";
|
|
296
|
+
query += "dp.smartboard_ready as SB_Ready, dp.video_card as VideoCardAdded, ";
|
|
297
|
+
query += "dp.RAM_GB as RAM, dp.note, dp.da_properties ";
|
|
298
|
+
query += "from devices d ";
|
|
299
|
+
query += "left join device_pc dp on d.id = dp.id_device ";
|
|
300
|
+
query += "where d.id = " + id_device;
|
|
301
|
+
|
|
302
|
+
return query;
|
|
303
|
+
}
|
|
304
|
+
function getPCPropertiesMySQL(id_device) {
|
|
305
|
+
var query = "select d.id as Id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello,";
|
|
306
|
+
query += "dp.pc_name as Name, dp.CPU as CPU, dp.CPU_arch as CPUArch, dp.OS_arch as OSArch, dp.OS as OS, dp.OS_version as OSVersion, ";
|
|
307
|
+
query += "dp.smartboard_ready as SB_Ready, dp.video_card as VideoCardAdded, ";
|
|
308
|
+
query += "dp.RAM_GB as RAM, dp.note, dp.da_properties ";
|
|
309
|
+
query += "from devices d ";
|
|
310
|
+
query += "left join device_pc dp on d.id = dp.id_device ";
|
|
311
|
+
query += "where d.id = :id_device";
|
|
312
|
+
|
|
313
|
+
}
|
|
314
|
+
function createPCPropertiesMySQLObj(id_device, dev_prop) {
|
|
315
|
+
var obj = {};
|
|
316
|
+
obj.id_device = id_device;
|
|
317
|
+
obj.pc_name = dev_prop.pc_name;
|
|
318
|
+
obj.os = dev_prop.os;
|
|
319
|
+
obj.os_version = dev_prop.os_version;
|
|
320
|
+
obj.os_arch = dev_prop.os_arch;
|
|
321
|
+
obj.cpu = dev_prop.cpu;
|
|
322
|
+
obj.cpu_arch = dev_prop.cpu_arch;
|
|
323
|
+
obj.ram_size = dev_prop.ram_size;
|
|
324
|
+
obj.smartboard_ready = dev_prop.smartboard_ready;
|
|
325
|
+
obj.video_card = dev_prop.video_card;
|
|
326
|
+
obj.note = dev_prop.note;
|
|
327
|
+
obj.da_properties = dev_prop.da_properties;
|
|
328
|
+
return obj;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
function insertPCPropertiesSQLite(id_device, dev_prop) {
|
|
333
|
+
var query = "insert into device_pc (id_device, pc_name, OS, OS_version, OS_arch, CPU, CPU_arch, RAM_GB, video_card, smartboard_ready, note, da_properties) values ";
|
|
334
|
+
query += "(" + id_device + ", '" + dev_prop.pc_name + "', '" + dev_prop.os + "', '" + dev_prop.os_version + "', '" + dev_prop.os_arch + "', '" + dev_prop.cpu + "', '" + dev_prop.cpu_arch + "', " + dev_prop.ram_size + ", " + dev_prop.video_card + ", " + dev_prop.smartboard_ready + ", '" + dev_prop.note + "', " + dev_prop.da_properties + ")";
|
|
335
|
+
return query;
|
|
336
|
+
}
|
|
337
|
+
function insertPCPropertiesMySQL() {
|
|
338
|
+
var query = "insert into device_pc (id_device, pc_name, OS, OS_version, OS_arch, CPU, CPU_arch, RAM_GB, video_card, smartboard_ready, note, da_properties) values ";
|
|
339
|
+
query += "(:id_device, :pc_name, :os, :os_version, :os_arch, :cpu, :cpu_arch, :ram_size, :video_card, :smartboard_ready, :note, :da_properties)";
|
|
340
|
+
}
|
|
341
|
+
function updatePCPropertiesSQLite(id_device, dev_prop) {
|
|
342
|
+
var query = "update device_pc set ";
|
|
343
|
+
query += "id_device = " + id_device + ", ";
|
|
344
|
+
query += "pc_name = '" + dev_prop.pc_name + "', ";
|
|
345
|
+
query += "OS = '" + dev_prop.os + "', ";
|
|
346
|
+
query += "OS_version = '" + dev_prop.os_version + "', ";
|
|
347
|
+
query += "OS_arch = '" + dev_prop.os_arch + "', ";
|
|
348
|
+
query += "CPU = '" + dev_prop.cpu + "', ";
|
|
349
|
+
query += "CPU_arch = '" + dev_prop.cpu_arch + "', ";
|
|
350
|
+
query += "RAM_GB = " + dev_prop.ram_size + ", ";
|
|
351
|
+
query += "video_card = " + dev_prop.video_card + ", ";
|
|
352
|
+
query += "smartboard_ready = " + dev_prop.smartboard_ready + ", ";
|
|
353
|
+
query += "note = '" + dev_prop.note + "', ";
|
|
354
|
+
query += "da_properties = " + dev_prop.da_properties + " ";
|
|
355
|
+
query += "where id_device = " + id_device
|
|
356
|
+
return query;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
function updatePCPropertiesMySQL() {
|
|
360
|
+
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
//End Manage PC Properties
|
|
364
|
+
// Manage Display Part Properties
|
|
365
|
+
function getDisplayPartPropertiesSQLite(id_device) {
|
|
366
|
+
var query = "select d.id as Id, ";
|
|
367
|
+
query += "dm.size_inch as Dimensione, dm.format as Formato, dm.technology as Tecnologia, dm.touch as Touch, dm.is_removable as Removibile ";
|
|
368
|
+
query += "from devices d ";
|
|
369
|
+
query += "left join display_part dm on d.id = dm.id_device ";
|
|
370
|
+
query += "where d.id = " + id_device;
|
|
371
|
+
return query;
|
|
372
|
+
}
|
|
373
|
+
function getDisplayPartPropertiesMySQL(id_device) {
|
|
374
|
+
var query = "select d.id as Id, ";
|
|
375
|
+
query += "dm.size_inch as Dimensione, dm.format as Formato, dm.technology as Tecnologia, dm.touch as Touch, dm.is_removable as Removibile ";
|
|
376
|
+
query += "from devices d ";
|
|
377
|
+
query += "left join display_part dm on d.id = dm.id_device ";
|
|
378
|
+
query += "where d.id :id_device";
|
|
379
|
+
return query;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
function existsDisplayPartPropertiesSQLite(id_device) {
|
|
383
|
+
var query = "select count(*) from display_part ";
|
|
384
|
+
query += "where id_device = " + id_device;
|
|
385
|
+
}
|
|
386
|
+
function existsDisplayPartPropertiesMySQL(id_device) {
|
|
387
|
+
var query = "select count(*) from display_part ";
|
|
388
|
+
query += "where id_device = :id_device";
|
|
389
|
+
}
|
|
390
|
+
function insertDisplayPartPropertiesSQLite(id_device, dev_prop) {
|
|
391
|
+
var query = "insert into display_part (id_device, touch, size_inch, format, tecnology, is_removable) values ";
|
|
392
|
+
query += "(" + id_device + ", " + dev_prop.touch + ", " + dev_prop.size + ", '" + dev_prop.format + "', '" + dev_prop.technology + "', " + dev_prop.is_removable + ")";
|
|
393
|
+
return query;
|
|
394
|
+
}
|
|
395
|
+
function insertDisplayPartPropertiesMySQL() {
|
|
396
|
+
var query = "insert into display_part (id_device, touch, size_inch, format, tecnology, is_removable) values ";
|
|
397
|
+
query += "(:id_device, :touch, :size, :format, :technology, :is_removable)";
|
|
398
|
+
}
|
|
399
|
+
function updateDisplayPartPropertiesSQLite(id_device, dev_prop) {
|
|
400
|
+
var query = "update display_part set ";
|
|
401
|
+
query += "id_device = " + id_device + ", ";
|
|
402
|
+
query += "touch = " + dev_prop.touch + ", ";
|
|
403
|
+
query += "size_inch = " + dev_prop.size + ", ";
|
|
404
|
+
query += "format = '" + dev_prop.format + "', ";
|
|
405
|
+
query += "technology = '" + dev_prop.tecnology + "' ";
|
|
406
|
+
query += "where id_device = " + id_device;
|
|
407
|
+
return query;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
function updateDisplayPartPropertiesMySQL() {
|
|
411
|
+
var query = "update display_part set ";
|
|
412
|
+
query += "id_device = :id_device, ";
|
|
413
|
+
query += "touch = :touch, ";
|
|
414
|
+
query += "size_inch = :size, ";
|
|
415
|
+
query += "format = :format, ";
|
|
416
|
+
query += "technology = :tecnology ";
|
|
417
|
+
query += "where id_device = :id_device";
|
|
418
|
+
}
|
|
419
|
+
// End Manage Display Part Properties
|
|
420
|
+
// Manage Display Properties
|
|
421
|
+
function existsDisplayPropertiesSQLite(id_device) {
|
|
422
|
+
var query = "select count(*) from device_monitor ";
|
|
423
|
+
query += "where id_device = " + id_device;
|
|
424
|
+
return query;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
function existsDisplayPropertiesMySQL(id_device) {
|
|
428
|
+
var query = "select count(*) from device_monitor ";
|
|
429
|
+
query += "where id_device = :id_device";
|
|
430
|
+
return query;
|
|
431
|
+
}
|
|
432
|
+
function getDisplayPropertiesSQLite(id_device) {
|
|
433
|
+
var query = "select d.id as Id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello,";
|
|
434
|
+
query += "dm.size_inch as Dimensione, dm.format as Formato, dm.technology as Tecnologia, dm.touch as Touch ";
|
|
435
|
+
query += "from devices d ";
|
|
436
|
+
query += "left join device_monitor dm on d.id = dm.id_device ";
|
|
437
|
+
query += "where d.id = " + id_device;
|
|
438
|
+
return query;
|
|
439
|
+
}
|
|
440
|
+
function getDisplayPropertiesMySQL(id_device) {
|
|
441
|
+
var query = "select d.id as Id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello,";
|
|
442
|
+
query += "dm.size_inch as Dimensione, dm.format as Formato, dm.technology as Tecnologia, dm.touch as Touch ";
|
|
443
|
+
query += "from devices d ";
|
|
444
|
+
query += "left join device_monitor dm on d.id = dm.id_device ";
|
|
445
|
+
query += "where d.id = :id_device";
|
|
446
|
+
return query;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
function createDisplayPropertiesMySQLObj(id_device, dev_prop) {
|
|
450
|
+
var obj = {};
|
|
451
|
+
obj.id_device = id_device;
|
|
452
|
+
obj.touch = dev_prop.touch;
|
|
453
|
+
obj.format = dev_prop.formato;
|
|
454
|
+
obj.size = dev_prop.dimensione;
|
|
455
|
+
obj.technology = dev_prop.tecnologia;
|
|
456
|
+
obj.is_removable = dev_prop.rimovibile;
|
|
457
|
+
return obj;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
function insertDisplayPropertiesSQLite(id_device, dev_prop) {
|
|
461
|
+
var query = "insert into device_monitor (id_device, touch, size_inch, format, tecnology) values ";
|
|
462
|
+
query += "(" + id_device + ", " + dev_prop.touch + ", " + dev_prop.size + ", '" + dev_prop.format + "', '" + dev_prop.technology + "')";
|
|
463
|
+
return query;
|
|
464
|
+
}
|
|
465
|
+
function insertDisplayPropertiesMySQL() {
|
|
466
|
+
var query = "insert into device_monitor (id_device, touch, size_inch, format, tecnology) values ";
|
|
467
|
+
query += "(:id_device, :touch, :size, :format, :technology)";
|
|
468
|
+
return query;
|
|
469
|
+
}
|
|
470
|
+
function updateDisplayPropertiesSQLite(id_device, dev_prop) {
|
|
471
|
+
var query = "update device_monitor set ";
|
|
472
|
+
query += "id_device = " + id_device + ", ";
|
|
473
|
+
query += "touch = " + dev_prop.touch + ", ";
|
|
474
|
+
query += "size_inch = " + dev_prop.size + ", ";
|
|
475
|
+
query += "format = '" + dev_prop.format + "', ";
|
|
476
|
+
query += "technology = '" + dev_prop.tecnology + "' ";
|
|
477
|
+
query += "where id_device = " + id_device;
|
|
478
|
+
return query;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
function updateDisplayPropertiesMySQL() {
|
|
482
|
+
var query = "update device_monitor set ";
|
|
483
|
+
query += "id_device = :id_device, ";
|
|
484
|
+
query += "touch = :touch, ";
|
|
485
|
+
query += "size_inch = :size, ";
|
|
486
|
+
query += "format = :format, ";
|
|
487
|
+
query += "technology = :tecnology ";
|
|
488
|
+
query += "where id_device = :id_device";
|
|
489
|
+
}
|
|
490
|
+
// End Manage Display Properties
|
|
491
|
+
|
|
492
|
+
|
|
493
|
+
|
|
494
|
+
// End of source
|
|
495
|
+
|
|
496
|
+
function queryDeviceManifactures() {
|
|
497
|
+
var query = "SELECT DISTINCT manifacturer as search_manifacturer from devices order by search_manifacturer";
|
|
498
|
+
return query;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
// Device select
|
|
502
|
+
function getDevicesSelectSQLite(search_type, inv_code, dev_type, marca, is_PNRR, dev_status, id_dev_exclude) {
|
|
503
|
+
var query = "SELECT d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
|
|
504
|
+
query += "case ";
|
|
505
|
+
query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then d.inv_ict3_number ";
|
|
506
|
+
query += "when d.inv_pnrr_number != '' and d.inv_pnrr_number is not null then d.inv_pnrr_number ";
|
|
507
|
+
query += "when d.inv_tn_number != '' and d.inv_tn_number is not null then concat(d.inv_tn_number,'(TN)') ";
|
|
508
|
+
query += "when d.inv_tndigit_number != '' and d.inv_tndigit_number is not null then concat(d.inv_tndigit_number,'(TNDigit)') ";
|
|
509
|
+
query += "when d.serial_no != '' and d.serial_no is not null then concat(d.serial_no,'(S/N)') ";
|
|
510
|
+
query += "end as Codice ";
|
|
511
|
+
query += "from devices d ";
|
|
512
|
+
if (dev_status)
|
|
513
|
+
query += "left join device_usage du on d.id = du.id_device"
|
|
514
|
+
|
|
515
|
+
var where_clause = " where (d.is_removed is null or d.is_removed = 0) ";
|
|
516
|
+
if (inv_code || dev_type || marca || (is_PNRR && is_PNRR > 0) || dev_status) {
|
|
517
|
+
if (inv_code) {
|
|
518
|
+
if (search_type == "ESATTA") {
|
|
519
|
+
where_clause += " and (d.inv_ict3_number = '" + inv_code + "' or ";
|
|
520
|
+
where_clause += "d.inv_tn_number = '" + inv_code + "' or ";
|
|
521
|
+
where_clause += "d.serial_no = '" + inv_code + "' or ";
|
|
522
|
+
where_clause += "d.inv_tndigit_number = '" + inv_code + "' or ";
|
|
523
|
+
where_clause += "d.inv_pnrr_number = '" + inv_code + "')";
|
|
524
|
+
}
|
|
525
|
+
else {
|
|
526
|
+
where_clause += " and (d.inv_ict3_number like '" + inv_code + "%' or ";
|
|
527
|
+
where_clause += "d.inv_tn_number like '" + inv_code + "%' or ";
|
|
528
|
+
where_clause += "d.serial_no like '%" + inv_code + "%' or ";
|
|
529
|
+
where_clause += "d.inv_tndigit_number like '" + inv_code + "%' or ";
|
|
530
|
+
where_clause += "d.inv_pnrr_number = '" + inv_code + "')";
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
else {
|
|
534
|
+
where_clause += " and ";
|
|
535
|
+
if (dev_type) {
|
|
536
|
+
where_clause += "d.type = '" + dev_type + "'";
|
|
537
|
+
if (marca || (is_PNRR && is_PNRR > 0) || dev_status) {
|
|
538
|
+
where_clause += " and ";
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
if (marca) {
|
|
542
|
+
where_clause += " d.manifacturer = '" + marca + "'";
|
|
543
|
+
if ((is_PNRR && is_PNRR > 0) || dev_status) {
|
|
544
|
+
where_clause += " and ";
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
if (is_PNRR && is_PNRR > 0) {
|
|
548
|
+
where_clause += " (d.inv_pnrr_number <> '' and inv_pnrr_number is not null) ";
|
|
549
|
+
if (dev_status) {
|
|
550
|
+
where_clause += " and ";
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
if (dev_status) {
|
|
554
|
+
where_clause += " du.status = " + dev_status + " and date('now') >= du.date_status";
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
else {
|
|
559
|
+
if (id_dev_exclude > 0) {
|
|
560
|
+
where_clause += " and d.id <> " + id_dev_exclude;
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
query += where_clause;
|
|
564
|
+
return query;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
function getDevicesSelectMySQL(search_type, inv_code, dev_type, marca, is_PNRR, dev_status, id_dev_exclude) {
|
|
568
|
+
var query = "SELECT d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
|
|
569
|
+
query += "case ";
|
|
570
|
+
query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then d.inv_ict3_number ";
|
|
571
|
+
query += "when d.inv_pnrr_number != '' and d.inv_pnrr_number is not null then d.inv_pnrr_number ";
|
|
572
|
+
query += "when d.inv_tn_number != '' and d.inv_tn_number is not null then concat(d.inv_tn_number,'(TN)') ";
|
|
573
|
+
query += "when d.inv_tndigit_number != '' and d.inv_tndigit_number is not null then concat(d.inv_tndigit_number,'(TNDigit)') ";
|
|
574
|
+
query += "when d.serial_no != '' and d.serial_no is not null then concat(d.serial_no,'(S/N)') ";
|
|
575
|
+
query += "end as Codice ";
|
|
576
|
+
query += "from devices d ";
|
|
577
|
+
if (dev_status)
|
|
578
|
+
query += "left join device_usage du on d.id = du.id_device"
|
|
579
|
+
|
|
580
|
+
var where_clause = " where (d.is_removed is null or d.is_removed = 0) ";
|
|
581
|
+
if (inv_code || dev_type || marca || (is_PNRR && is_PNRR > 0)) {
|
|
582
|
+
if (inv_code) {
|
|
583
|
+
if (search_type == "ESATTA") {
|
|
584
|
+
where_clause += " and (d.inv_ict3_number = :inv_code or ";
|
|
585
|
+
where_clause += "d.inv_tn_number = :inv_code or ";
|
|
586
|
+
where_clause += "d.inv_tndigit_number = :inv_code or ";
|
|
587
|
+
where_clause += "d.serial_no = :inv_code or ";
|
|
588
|
+
where_clause += "d.inv_pnrr_number = :inv_code)";
|
|
589
|
+
}
|
|
590
|
+
else {
|
|
591
|
+
where_clause += " and (d.inv_ict3_number like :inv_code or ";
|
|
592
|
+
where_clause += "d.inv_tn_number like :inv_code or ";
|
|
593
|
+
where_clause += "d.inv_tndigit_number like :inv_code or ";
|
|
594
|
+
where_clause += "d.serial_no like :inv_code or ";
|
|
595
|
+
where_clause += "d.inv_pnrr_number = :inv_code)";
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
else {
|
|
599
|
+
where_clause += " and ";
|
|
600
|
+
if (dev_type) {
|
|
601
|
+
where_clause += " d.type = :dev_type";
|
|
602
|
+
if (marca || (is_PNRR && is_PNRR > 0)) {
|
|
603
|
+
where_clause += " and ";
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
if (marca) {
|
|
607
|
+
where_clause += " d.manifacturer = :marca";
|
|
608
|
+
if (is_PNRR && is_PNRR > 0) {
|
|
609
|
+
where_clause += " and ";
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
if (is_PNRR && is_PNRR > 0) {
|
|
613
|
+
where_clause += " (d.inv_pnrr_number <> '' and inv_pnrr_number is not null) ";
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
else {
|
|
618
|
+
if (id_dev_exclude > 0) {
|
|
619
|
+
where_clause += " and d.id <> :id_dev_exclude";
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
query += where_clause;
|
|
624
|
+
query += " order by id";
|
|
625
|
+
return query;
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
// End Device select
|
|
629
|
+
// Device Select by site
|
|
630
|
+
function getDevicesSelectBySiteSQLite(id_site) {
|
|
631
|
+
var query = "select devices.id, devices.type as Tipo, devices.manifacturer as Marca, devices.model as modello, ";
|
|
632
|
+
query += "case ";
|
|
633
|
+
query += "when inv_ict3_number != '' and inv_ict3_number is not null then inv_ict3_number ";
|
|
634
|
+
query += "when inv_pnrr_number != '' and inv_pnrr_number is not null then inv_pnrr_number ";
|
|
635
|
+
query += "when inv_tn_number != '' and inv_tn_number is not null then concat(inv_tn_number,'(TN)') ";
|
|
636
|
+
query += "when inv_tndigit_number != '' and inv_tndigit_number is not null then concat(inv_tndigit_number,'(TNDigit)') ";
|
|
637
|
+
query += "when serial_no != '' and serial_no is not null then concat(serial_no,'(S/N)') ";
|
|
638
|
+
query += "end as Codice, ";
|
|
639
|
+
query += "case ";
|
|
640
|
+
query += "when trim(inv_pnrr_number) is null then '' ";
|
|
641
|
+
query += "when trim(inv_pnrr_number) = '' then '' ";
|
|
642
|
+
query += "else 'SI' ";
|
|
643
|
+
query += "end as PNRR ";
|
|
644
|
+
query += " from devices ";
|
|
645
|
+
query += "inner join device_site on device_site.id_device = devices.id ";
|
|
646
|
+
query += "inner join sites on sites.id = device_site.id_site ";
|
|
647
|
+
query += "where (date('now') >= device_site.date_in and date('now') <= device_site.date_out) ";
|
|
648
|
+
query += "and (devices.is_removed is null or devices.is_removed = 0) ";
|
|
649
|
+
query += "and sites.id = " + id_site;
|
|
650
|
+
return query;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
function getDevicesSelectBySiteMySQL(id_site) {
|
|
654
|
+
var query = "select DISTINCT devices.id, devices.type as Tipo, devices.manifacturer as Marca, devices.model as modello, ";
|
|
655
|
+
query += "case ";
|
|
656
|
+
query += "when inv_ict3_number != '' and inv_ict3_number is not null then inv_ict3_number ";
|
|
657
|
+
query += "when inv_pnrr_number != '' and inv_pnrr_number is not null then inv_pnrr_number ";
|
|
658
|
+
query += "when inv_tn_number != '' and inv_tn_number is not null then concat(inv_tn_number,'(TN)') ";
|
|
659
|
+
query += "when inv_tndigit_number != '' and inv_tndigit_number is not null then concat(inv_tndigit_number,'(TNDigit)') ";
|
|
660
|
+
query += "when serial_no != '' and serial_no is not null then concat(serial_no,'(S/N)') ";
|
|
661
|
+
query += "end as Codice, ";
|
|
662
|
+
query += "case ";
|
|
663
|
+
query += "when trim(inv_pnrr_number) is null then '' ";
|
|
664
|
+
query += "when trim(inv_pnrr_number) = '' then '' ";
|
|
665
|
+
query += "else 'SI' ";
|
|
666
|
+
query += "end as PNRR ";
|
|
667
|
+
query += " from devices ";
|
|
668
|
+
query += "inner join device_site on device_site.id_device = devices.id ";
|
|
669
|
+
query += "inner join sites on sites.id = device_site.id_site ";
|
|
670
|
+
query += "where (CURDATE() >= device_site.date_in and CURDATE() <= device_site.date_out) ";
|
|
671
|
+
query += "and (devices.is_removed is null or devices.is_removed = 0) ";
|
|
672
|
+
query += "and sites.id = :id_site";
|
|
673
|
+
return query;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
//End Device Select by site
|
|
677
|
+
// Device per plesso
|
|
678
|
+
function getDevicesSelectByPlaceSQLite(id_place) {
|
|
679
|
+
var query = "select devices.id, devices.type as Tipo, devices.manifacturer as Marca, devices.model as modello, ";
|
|
680
|
+
query += "case ";
|
|
681
|
+
query += "when inv_ict3_number != '' and inv_ict3_number is not null then inv_ict3_number ";
|
|
682
|
+
query += "when inv_pnrr_number != '' and inv_pnrr_number is not null then inv_pnrr_number ";
|
|
683
|
+
query += "when inv_tn_number != '' and inv_tn_number is not null then concat(inv_tn_number,'(TN)') ";
|
|
684
|
+
query += "when inv_tndigit_number != '' and inv_tndigit_number is not null then concat(inv_tndigit_number,'(TNDigit)') ";
|
|
685
|
+
query += "when serial_no != '' and serial_no is not null then concat(serial_no,'(S/N)') ";
|
|
686
|
+
query += "end as Codice, ";
|
|
687
|
+
query += "case ";
|
|
688
|
+
query += "when trim(inv_pnrr_number) is null then '' ";
|
|
689
|
+
query += "when trim(inv_pnrr_number) = '' then '' ";
|
|
690
|
+
query += "else 'SI' ";
|
|
691
|
+
query += "end as PNRR ";
|
|
692
|
+
query += " from devices ";
|
|
693
|
+
query += "inner join device_site on device_site.id_device = devices.id ";
|
|
694
|
+
query += "inner join sites on sites.id = device_site.id_site ";
|
|
695
|
+
query += "where (date('now') >= device_site.date_in and date('now') <= device_site.date_out) ";
|
|
696
|
+
query += "and (devices.is_removed is null or devices.is_removed = 0) ";
|
|
697
|
+
query += "and sites.id_place = '" + id_place + "'";
|
|
698
|
+
return query;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
function getDevicesSelectByPlaceMySQL(id_place) {
|
|
702
|
+
var query = "select DISTINCT devices.id, devices.type as Tipo, devices.manifacturer as Marca, devices.model as modello, ";
|
|
703
|
+
query += "case ";
|
|
704
|
+
query += "when inv_ict3_number != '' and inv_ict3_number is not null then inv_ict3_number ";
|
|
705
|
+
query += "when inv_pnrr_number != '' and inv_pnrr_number is not null then inv_pnrr_number ";
|
|
706
|
+
query += "when inv_tn_number != '' and inv_tn_number is not null then concat(inv_tn_number,'(TN)') ";
|
|
707
|
+
query += "when inv_tndigit_number != '' and inv_tndigit_number is not null then concat(inv_tndigit_number,'(TNDigit)') ";
|
|
708
|
+
query += "when serial_no != '' and serial_no is not null then concat(serial_no,'(S/N)') ";
|
|
709
|
+
query += "end as Codice, ";
|
|
710
|
+
query += "case ";
|
|
711
|
+
query += "when trim(inv_pnrr_number) is null then '' ";
|
|
712
|
+
query += "when trim(inv_pnrr_number) = '' then '' ";
|
|
713
|
+
query += "else 'SI' ";
|
|
714
|
+
query += "end as PNRR ";
|
|
715
|
+
query += " from devices ";
|
|
716
|
+
query += "inner join device_site on device_site.id_device = devices.id ";
|
|
717
|
+
query += "inner join sites on sites.id = device_site.id_site ";
|
|
718
|
+
query += "where (CURDATE() >= device_site.date_in and CURDATE() <= device_site.date_out) ";
|
|
719
|
+
query += "and (devices.is_removed is null or devices.is_removed = 0) ";
|
|
720
|
+
query += "and sites.id_place = :id_place";
|
|
721
|
+
return query;
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
|
|
725
|
+
// End device per plesso
|
|
726
|
+
// Count Devices by Site
|
|
727
|
+
function getDevicesCounterBySiteSQLite(id_site) {
|
|
728
|
+
var query = "select d.type as Tipo, count(d.type) as Numero from devices d ";
|
|
729
|
+
query += "inner join device_site ds on ds.id_device = d.id ";
|
|
730
|
+
query += "where (date('now') >= ds.date_in and date('now') <= ds.date_out) ";
|
|
731
|
+
query += "and (d.is_removed is null or d.is_removed = 0) ";
|
|
732
|
+
query += "and ds.id_site = " + id_site;
|
|
733
|
+
query += " group by d.type";
|
|
734
|
+
return query;
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
function getDevicesCounterBySiteMySQL(id_site) {
|
|
738
|
+
var query = "select d.type as Tipo, count(d.type) as Numero from devices d ";
|
|
739
|
+
query += "inner join device_site ds on ds.id_device = d.id ";
|
|
740
|
+
query += "where (CURDATE() >= ds.date_in and CURDATE() <= ds.date_out) ";
|
|
741
|
+
query += "and (d.is_removed is null or d.is_removed = 0) ";
|
|
742
|
+
query += "and ds.id_site = :id_site";
|
|
743
|
+
query += " group by d.type";
|
|
744
|
+
return query;
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
//End Count Devices by Site
|
|
748
|
+
// Count Devices by Place
|
|
749
|
+
function getDevicesCounterByPlaceSQLite(id_place) {
|
|
750
|
+
var query = "select d.type as Tipo, count(d.type) as Numero from devices d ";
|
|
751
|
+
query += "inner join device_site ds on ds.id_device = d.id ";
|
|
752
|
+
query += "inner join sites s on s.id = ds.id_site ";
|
|
753
|
+
query += "where (date('now') >= ds.date_in and date('now') <= ds.date_out) ";
|
|
754
|
+
query += "and ds.id_place = '" + id_place + "' ";
|
|
755
|
+
query += "group by d.type";
|
|
756
|
+
return query;
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
function getDevicesCounterByPlaceMySQL(id_place) {
|
|
760
|
+
var query = "select d.type as Tipo, count(d.type) as Numero from devices d ";
|
|
761
|
+
query += "inner join device_site ds on ds.id_device = d.id ";
|
|
762
|
+
query += "inner join sites s on s.id = ds.id_site ";
|
|
763
|
+
query += "where (CURDATE() >= ds.date_in and CURDATE() <= ds.date_out) ";
|
|
764
|
+
query += "and ds.id_place = :id_place ";
|
|
765
|
+
query += "group by d.type";
|
|
766
|
+
return query;
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
//End Count Devices by Place
|
|
770
|
+
//Get Related Devices
|
|
771
|
+
function getDevicesSelectByRelatedSQLite(id_device) {
|
|
772
|
+
var query = "select type as Tipo, manifacturer as Marca, model as modello, ";
|
|
773
|
+
query += "case ";
|
|
774
|
+
query += "when inv_ict3_number != '' and inv_ict3_number is not null then inv_ict3_number ";
|
|
775
|
+
query += "when inv_pnrr_number != '' and inv_pnrr_number is not null then inv_pnrr_number ";
|
|
776
|
+
query += "when inv_tn_number != '' and inv_tn_number is not null then concat(inv_tn_number,'(TN)') ";
|
|
777
|
+
query += "when inv_tndigit_number != '' and inv_tndigit_number is not null then concat(inv_tndigit_number,'(TNDigit)') ";
|
|
778
|
+
query += "when serial_no != '' and serial_no is not null then concat(serial_no,'(S/N)') ";
|
|
779
|
+
query += "end as Codice, ";
|
|
780
|
+
query += "case ";
|
|
781
|
+
query += "when trim(inv_pnrr_number) is null then '' ";
|
|
782
|
+
query += "when trim(inv_pnrr_number) = '' then '' ";
|
|
783
|
+
query += "else 'SI' ";
|
|
784
|
+
query += "end as PNRR ";
|
|
785
|
+
query += "from devices d ";
|
|
786
|
+
query += "inner join device_set ds on ds.id_relateddevice = d.id ";
|
|
787
|
+
query += "where ds.id_maindevice = " + id_device;
|
|
788
|
+
return query;
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
function getDevicesSelectByRelatedMySQL(id_device) {
|
|
792
|
+
var query = "select type as Tipo, manifacturer as Marca, model as modello, ";
|
|
793
|
+
query += "case ";
|
|
794
|
+
query += "when inv_ict3_number != '' and inv_ict3_number is not null then inv_ict3_number ";
|
|
795
|
+
query += "when inv_pnrr_number != '' and inv_pnrr_number is not null then inv_pnrr_number ";
|
|
796
|
+
query += "when inv_tn_number != '' and inv_tn_number is not null then concat(inv_tn_number,'(TN)') ";
|
|
797
|
+
query += "when inv_tndigit_number != '' and inv_tndigit_number is not null then concat(inv_tndigit_number,'(TNDigit)') ";
|
|
798
|
+
query += "when serial_no != '' and serial_no is not null then concat(serial_no,'(S/N)') ";
|
|
799
|
+
query += "end as Codice, ";
|
|
800
|
+
query += "case ";
|
|
801
|
+
query += "when trim(inv_pnrr_number) is null then '' ";
|
|
802
|
+
query += "when trim(inv_pnrr_number) = '' then '' ";
|
|
803
|
+
query += "else 'SI' ";
|
|
804
|
+
query += "end as PNRR ";
|
|
805
|
+
query += "from devices d ";
|
|
806
|
+
query += "inner join device_set ds on ds.id_relateddevice = d.id ";
|
|
807
|
+
query += "where ds.id_maindevice = :id_device";
|
|
808
|
+
return query;
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
//End Get Related Devices
|
|
812
|
+
//Get Device by Id
|
|
813
|
+
function queryDeviceByIdSQLite(id_device) {
|
|
814
|
+
var query = "SELECT d.id, d.type as Tipo, ";
|
|
815
|
+
query += "d.manifacturer as Marca, d.model as Modello, ";
|
|
816
|
+
query += "d.inv_ict3_number as Inventario, d.serial_no, ";
|
|
817
|
+
query += "d.inv_tn_number, d.inv_pnrr_number, d.inv_tndigit_number, ";
|
|
818
|
+
query += "d.note from devices d ";
|
|
819
|
+
query += "where d.id = " + id_device;
|
|
820
|
+
return query;
|
|
821
|
+
}
|
|
822
|
+
function queryDeviceByIdMySQL(id_device) {
|
|
823
|
+
var query = "SELECT d.id, d.type as Tipo, ";
|
|
824
|
+
query += "d.manifacturer as Marca, d.model as Modello, ";
|
|
825
|
+
query += "d.inv_ict3_number as Inventario, d.serial_no, ";
|
|
826
|
+
query += "d.inv_tn_number, d.inv_pnrr_number, d.inv_tndigit_number, ";
|
|
827
|
+
query += "d.note from devices d ";
|
|
828
|
+
query += "where d.id = :id_device";
|
|
829
|
+
return query;
|
|
830
|
+
}
|
|
831
|
+
//End Get Device by Id
|
|
832
|
+
//Get Device by Identificativo
|
|
833
|
+
function queryDeviceByIdentificativoSQLite(identificativo) {
|
|
834
|
+
var query = "SELECT d.id, d.type as Tipo, ";
|
|
835
|
+
query += "d.manifacturer as Marca, d.model as Modello, ";
|
|
836
|
+
query += "d.inv_ict3_number as Inventario, d.serial_no, ";
|
|
837
|
+
query += "d.inv_tn_number, d.inv_pnrr_number, d.inv_tndigit_number, ";
|
|
838
|
+
query += "d.note from devices d ";
|
|
839
|
+
query += "where (d.inv_ict3_number = '" + identificativo + "' or ";
|
|
840
|
+
query += "d.serial_no = '" + identificativo + "' or ";
|
|
841
|
+
query += "d.inv_tndigit_number = '" + identificativo + "' or ";
|
|
842
|
+
query += "d.inv_tn_number = '" + identificativo + "')";
|
|
843
|
+
|
|
844
|
+
return query;
|
|
845
|
+
}
|
|
846
|
+
function queryDeviceByIdentificativoMySQL(identificativo) {
|
|
847
|
+
var query = "SELECT d.id, d.type as Tipo, ";
|
|
848
|
+
query += "d.manifacturer as Marca, d.model as Modello, ";
|
|
849
|
+
query += "d.inv_ict3_number as Inventario, d.serial_no, ";
|
|
850
|
+
query += "d.inv_tn_number, d.inv_pnrr_number, d.inv_tndigit_number, ";
|
|
851
|
+
query += "d.note from devices d ";
|
|
852
|
+
query += "where (d.inv_ict3_number = :identificativo or ";
|
|
853
|
+
query += "d.serial_no = :identificativo or ";
|
|
854
|
+
query += "d.inv_tndigit_number = :identificativo or ";
|
|
855
|
+
query += "d.inv_tn_number = :identificativo)";
|
|
856
|
+
return query;
|
|
857
|
+
}
|
|
858
|
+
//End Get Device by Identificativo
|
|
859
|
+
|
|
860
|
+
|
|
861
|
+
|
|
862
|
+
//Get Device Status
|
|
863
|
+
function queryDeviceStatusSQLite(id_device, date_ref) {
|
|
864
|
+
var query = "select case when status is null then 0 else status end as stato, MAX(date_status), count(*) as num from device_usage du ";
|
|
865
|
+
query += "where du.id_device = " + id_device + " ";
|
|
866
|
+
if (date_ref) {
|
|
867
|
+
switch (date_ref) {
|
|
868
|
+
case "current":
|
|
869
|
+
query += " and ";
|
|
870
|
+
query += " (date('now') >= du.date_status and date('now') <= du.date_end)";
|
|
871
|
+
break;
|
|
872
|
+
default:
|
|
873
|
+
query += " and ";
|
|
874
|
+
query += " ('" + date_ref + "' >= du.date_status and '" + date_ref + "' <= du.date_end)";
|
|
875
|
+
break;
|
|
876
|
+
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
return query;
|
|
880
|
+
}
|
|
881
|
+
function queryDeviceStatusMySQL(id_device, date_ref) {
|
|
882
|
+
var query = "select case when status is null then 0 else status end as stato, MAX(date_status), count(*) as num from device_usage du ";
|
|
883
|
+
query += "where du.id_device = :id_device ";
|
|
884
|
+
if (date_ref) {
|
|
885
|
+
switch (date_ref) {
|
|
886
|
+
case "current":
|
|
887
|
+
query += " and ";
|
|
888
|
+
query += " (CURDATE() >= du.date_status and CURDATE() <= du.date_end)";
|
|
889
|
+
break;
|
|
890
|
+
default:
|
|
891
|
+
query += " and ";
|
|
892
|
+
query += " (:date_ref >= du.date_status and :date_ref <= du.date_end)";
|
|
893
|
+
break;
|
|
894
|
+
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
return query;
|
|
898
|
+
}
|
|
899
|
+
//End Get Device Status
|
|
900
|
+
// Insert device status
|
|
901
|
+
function updateDeviceStatusSQLite(id_device) {
|
|
902
|
+
var query = "update device_usage set date_end = date('now','-1 day') ";
|
|
903
|
+
query += "where id_device = " + id_device + " and date_in = (select max(date_in) from device_usage where id_device = " + id_device + ")";
|
|
904
|
+
return query;
|
|
905
|
+
}
|
|
906
|
+
function updateDeviceStatusMySQL(id_device) {
|
|
907
|
+
var query = "update device_usage set date_end = date('now','-1 day') ";
|
|
908
|
+
query += "where id_device = :id_device and date_status = (select max(date_status) from device_usage where id_device = :id_device)";
|
|
909
|
+
return query;
|
|
910
|
+
}
|
|
911
|
+
// end manage updateDevicesStatus
|
|
912
|
+
// Manage insertDeviceStatus
|
|
913
|
+
function insertDeviceStatusSQLite(id_device, dev_status, start_date) {
|
|
914
|
+
var query = "insert into device_usage (date_status, date_end, id_device, status) ";
|
|
915
|
+
query += "values (";
|
|
916
|
+
if ((!start_date || start_date == '') || start_date == "TODAY") {
|
|
917
|
+
query += "date('now'),";
|
|
918
|
+
}
|
|
919
|
+
else {
|
|
920
|
+
query += "'" + start_date + "',";
|
|
921
|
+
}
|
|
922
|
+
query += "'2999-12-31',";
|
|
923
|
+
query += id_device + ",";
|
|
924
|
+
query += dev_status;
|
|
925
|
+
query += ")";
|
|
926
|
+
return query;
|
|
927
|
+
}
|
|
928
|
+
function insertDeviceStatusMySQL(id_device, dev_status, start_date) {
|
|
929
|
+
var query = "insert into device_usage (date_status, date_end, id_device, status) ";
|
|
930
|
+
query += "values (";
|
|
931
|
+
if ((!start_date || start_date == '') || start_date == "TODAY") {
|
|
932
|
+
query += "CURDATE(),";
|
|
933
|
+
}
|
|
934
|
+
else {
|
|
935
|
+
query += ":start_date,";
|
|
936
|
+
}
|
|
937
|
+
query += "'2999-12-31',";
|
|
938
|
+
query += ":id_device,";
|
|
939
|
+
query += ":dev_status";
|
|
940
|
+
query += ")";
|
|
941
|
+
return query;
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
//end insert device status
|
|
945
|
+
|
|
946
|
+
|
|
947
|
+
//Insert Device
|
|
948
|
+
function insertDeviceSQLite(dev) {
|
|
949
|
+
var query = "";
|
|
950
|
+
if (dev) {
|
|
951
|
+
let inventario = "";
|
|
952
|
+
let inv_comune = "";
|
|
953
|
+
let PNRR = "";
|
|
954
|
+
let inv_tndigit = "";
|
|
955
|
+
let type = "";
|
|
956
|
+
let marca = "";
|
|
957
|
+
let modello = "";
|
|
958
|
+
let serial_no = "";
|
|
959
|
+
let note = "";
|
|
960
|
+
|
|
961
|
+
if (dev.inventario)
|
|
962
|
+
inventario = dev.inventario;
|
|
963
|
+
if (dev.inv_comune)
|
|
964
|
+
inv_comune = dev.inv_comune;
|
|
965
|
+
if (dev.PNRR)
|
|
966
|
+
PNRR = dev.PNRR;
|
|
967
|
+
if (dev.inv_tndigit)
|
|
968
|
+
inv_tndigit = dev.inv_tndigit;
|
|
969
|
+
if (dev.type)
|
|
970
|
+
type = dev.type;
|
|
971
|
+
if (dev.marca)
|
|
972
|
+
marca = dev.marca;
|
|
973
|
+
if (dev.modello)
|
|
974
|
+
modello = dev.modello;
|
|
975
|
+
if (dev.serial_no)
|
|
976
|
+
serial_no = dev.serial_no;
|
|
977
|
+
if (dev.note)
|
|
978
|
+
note = dev.note;
|
|
979
|
+
|
|
980
|
+
query = "insert into devices (inv_ict3_number, inv_tn_number, inv_pnrr_number, inv_tndigit_number, type, manifacturer, model, serial_no, note) ";
|
|
981
|
+
query += "values (";
|
|
982
|
+
query += "'" + String(inventario).trim() + "',";
|
|
983
|
+
query += "'" + String(inv_comune).trim() + "',";
|
|
984
|
+
query += "'" + String(PNRR).trim() + "',";
|
|
985
|
+
query += "'" + String(inv_tndigit).trim() + "',";
|
|
986
|
+
query += "'" + String(type).trim() + "',";
|
|
987
|
+
query += "'" + String(marca).trim() + "',";
|
|
988
|
+
query += "'" + String(modello).trim() + "',";
|
|
989
|
+
query += "'" + String(serial_no).trim() + "',";
|
|
990
|
+
query += "'" + String(note).trim() + "'";
|
|
991
|
+
query += ")";
|
|
992
|
+
}
|
|
993
|
+
return query;
|
|
994
|
+
}
|
|
995
|
+
function insertDeviceMySQL() {
|
|
996
|
+
var query = "insert into devices (inv_ict3_number, inv_tn_number, inv_pnrr_number, inv_tndigit_number, type, manifacturer, model, serial_no, note) ";
|
|
997
|
+
query += "values (";
|
|
998
|
+
query += ":inventario, ";
|
|
999
|
+
query += ":inv_comune, ";
|
|
1000
|
+
query += ":PNRR, ";
|
|
1001
|
+
query += ":inv_tndigit, ";
|
|
1002
|
+
query += ":type, ";
|
|
1003
|
+
query += ":marca, ";
|
|
1004
|
+
query += ":modello, ";
|
|
1005
|
+
query += ":serial_no, ";
|
|
1006
|
+
query += ":note";
|
|
1007
|
+
query += ")";
|
|
1008
|
+
return query;
|
|
1009
|
+
}
|
|
1010
|
+
//End Insert Device
|
|
1011
|
+
//Update Device
|
|
1012
|
+
function updateDeviceSQLite(deviceObj) {
|
|
1013
|
+
var dev = deviceObj;
|
|
1014
|
+
var query = "";
|
|
1015
|
+
if (dev) {
|
|
1016
|
+
let inventario = "";
|
|
1017
|
+
let inv_comune = "";
|
|
1018
|
+
let PNRR = "";
|
|
1019
|
+
let inv_tndigit = "";
|
|
1020
|
+
let type = "";
|
|
1021
|
+
let marca = "";
|
|
1022
|
+
let modello = "";
|
|
1023
|
+
let serial_no = "";
|
|
1024
|
+
let note = "";
|
|
1025
|
+
|
|
1026
|
+
if (dev.inventario)
|
|
1027
|
+
inventario = dev.inventario;
|
|
1028
|
+
if (dev.inv_comune)
|
|
1029
|
+
inv_comune = dev.inv_comune;
|
|
1030
|
+
if (dev.PNRR)
|
|
1031
|
+
PNRR = dev.PNRR;
|
|
1032
|
+
if (dev.inv_tndigit)
|
|
1033
|
+
inv_tndigit = dev.inv_tndigit;
|
|
1034
|
+
if (dev.type)
|
|
1035
|
+
type = dev.type;
|
|
1036
|
+
if (dev.marca)
|
|
1037
|
+
marca = dev.marca;
|
|
1038
|
+
if (dev.modello)
|
|
1039
|
+
modello = dev.modello;
|
|
1040
|
+
if (dev.serial_no)
|
|
1041
|
+
serial_no = dev.serial_no;
|
|
1042
|
+
if (dev.note) {
|
|
1043
|
+
note = dev.note;
|
|
1044
|
+
}
|
|
1045
|
+
query = "update devices set ";
|
|
1046
|
+
query += "inv_ict3_number = '" + inventario.trim() + "',";
|
|
1047
|
+
query += "inv_tn_number = '" + inv_comune.trim() + "',";
|
|
1048
|
+
query += "inv_pnrr_number = '" + PNRR.trim() + "',";
|
|
1049
|
+
query += "inv_tndigit_number = '" + inv_tndigit.trim() + "',";
|
|
1050
|
+
query += "type = '" + type.trim() + "',";
|
|
1051
|
+
query += "manifacturer = '" + marca.trim() + "',";
|
|
1052
|
+
query += "model = '" + modello.trim() + "',";
|
|
1053
|
+
query += "serial_no = '" + serial_no.trim() + "',";
|
|
1054
|
+
query += "note = '" + note.trim() + "'";
|
|
1055
|
+
query += " where id = " + dev.id;
|
|
1056
|
+
}
|
|
1057
|
+
return query;
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
function updateDeviceMySQL() {
|
|
1061
|
+
var query = "update devices set ";
|
|
1062
|
+
query += "inv_ict3_number = :inventario, ";
|
|
1063
|
+
query += "inv_tn_number = :inv_comune, ";
|
|
1064
|
+
query += "inv_pnrr_number = :PNRR, ";
|
|
1065
|
+
query += "inv_tndigit_number = :inv_tndigit, ";
|
|
1066
|
+
query += "type = :type, ";
|
|
1067
|
+
query += "manifacturer = :marca, ";
|
|
1068
|
+
query += "model = :modello, ";
|
|
1069
|
+
query += "serial_no = :serial_no, ";
|
|
1070
|
+
query += "note = :note";
|
|
1071
|
+
query += " where id = :id_device";
|
|
1072
|
+
return query;
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
function getDeviceMySQLPayload(dev) {
|
|
1076
|
+
var payloadObj = {};
|
|
1077
|
+
if (dev) {
|
|
1078
|
+
var retValue = {};
|
|
1079
|
+
retValue.inventario = "";
|
|
1080
|
+
retValue.inv_comune = "";
|
|
1081
|
+
retValue.PNRR = "";
|
|
1082
|
+
retValue.inv_tndigit = "";
|
|
1083
|
+
retValue.type = "";
|
|
1084
|
+
retValue.marca = "";
|
|
1085
|
+
retValue.modello = "";
|
|
1086
|
+
retValue.serial_no = "";
|
|
1087
|
+
retValue.note = "";
|
|
1088
|
+
|
|
1089
|
+
if (dev.inventario)
|
|
1090
|
+
retValue.inventario = dev.inventario;
|
|
1091
|
+
if (dev.inv_comune)
|
|
1092
|
+
retValue.inv_comune = dev.inv_comune;
|
|
1093
|
+
if (dev.PNRR)
|
|
1094
|
+
retValue.PNRR = dev.PNRR;
|
|
1095
|
+
if (dev.inv_tndigit)
|
|
1096
|
+
retValue.inv_tndigit = dev.inv_tndigit;
|
|
1097
|
+
if (dev.type)
|
|
1098
|
+
retValue.type = dev.type;
|
|
1099
|
+
if (dev.marca)
|
|
1100
|
+
retValue.marca = dev.marca;
|
|
1101
|
+
if (dev.modello)
|
|
1102
|
+
retValue.modello = dev.modello;
|
|
1103
|
+
if (dev.serial_no)
|
|
1104
|
+
retValue.serial_no = dev.serial_no;
|
|
1105
|
+
if (dev.note) {
|
|
1106
|
+
retValue.note = dev.note;
|
|
1107
|
+
}
|
|
1108
|
+
/*
|
|
1109
|
+
payloadObj = {
|
|
1110
|
+
"inv_ict3_number": String(retValue.inventario).trim(),
|
|
1111
|
+
"inv_tn_number": String(retValue.inv_comune).trim(),
|
|
1112
|
+
"inv_pnrr_number": String(retValue.PNRR).trim(),
|
|
1113
|
+
"inv_tndigit_number": String(retValue).inv_tndigit.trim(),
|
|
1114
|
+
"type": String(retValue.type).trim(),
|
|
1115
|
+
"manifacturer": String(retValue.marca).trim(),
|
|
1116
|
+
"model": String(retValue.modello).trim(),
|
|
1117
|
+
"serial_no": String(retValue.serial_no).trim(),
|
|
1118
|
+
"note": String(retValue.note).trim(),
|
|
1119
|
+
"id_device": dev.id
|
|
1120
|
+
};
|
|
1121
|
+
*/
|
|
1122
|
+
payloadObj = {
|
|
1123
|
+
"inventario": retValue.inventario.trim(),
|
|
1124
|
+
"inv_comune": retValue.inv_comune.trim(),
|
|
1125
|
+
"PNRR": retValue.PNRR.trim(),
|
|
1126
|
+
"inv_tndigit": retValue.inv_tndigit.trim(),
|
|
1127
|
+
"type": retValue.type.trim(),
|
|
1128
|
+
"marca": retValue.marca.trim(),
|
|
1129
|
+
"modello": retValue.modello.trim(),
|
|
1130
|
+
"serial_no": retValue.serial_no.trim(),
|
|
1131
|
+
"note": retValue.note.trim(),
|
|
1132
|
+
"id_device": dev.id
|
|
1133
|
+
};
|
|
1134
|
+
}
|
|
1135
|
+
return payloadObj;
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
//End Update Device
|
|
1139
|
+
// Remove Device
|
|
1140
|
+
function removeDeviceSQLite(id_device) {
|
|
1141
|
+
var query = "update devices set is_removed = 1 ";
|
|
1142
|
+
query += "where id = " + id_device;
|
|
1143
|
+
return query;
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
function removeDeviceMySQL() {
|
|
1147
|
+
var query = "update devices set is_removed = 1 ";
|
|
1148
|
+
query += "where id = :id_device";
|
|
1149
|
+
return query;
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
//End remove device
|
|
1153
|
+
//Get Last Id
|
|
1154
|
+
function queryLastDeviceIdSQLite() {
|
|
1155
|
+
return "select seq as id from sqlite_sequence where name = 'devices'";
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
function queryLastDeviceIdMySQL() {
|
|
1159
|
+
return "SELECT AUTO_INCREMENT - 1 as CurrentId FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'ALS' AND TABLE_NAME = 'devices'";
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
//End Get Last Id
|
|
1163
|
+
//Get Devices for Combo
|
|
1164
|
+
function getDevicesSelectComboSQLite(categoria, id_dev_exclude, with_properties) {
|
|
1165
|
+
var query = "SELECT d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
|
|
1166
|
+
/*
|
|
1167
|
+
(case
|
|
1168
|
+
when d.inv_ict3_number != '' and d.inv_ict3_number is not null then concat(d.inv_ict3_number, ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model )
|
|
1169
|
+
when d.inv_tn_number != '' and d.inv_tn_number is not null then concat(d.inv_tn_number, '(TN)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model )
|
|
1170
|
+
when d.inv_tndigit_number != '' and d.inv_tndigit_number is not null then concat(d.inv_tndigit_number,'(TNDigit)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model )
|
|
1171
|
+
when d.serial_no != '' and d.serial_no is not null then concat(d.serial_no,'(S/N)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model )
|
|
1172
|
+
end) as Descrizione
|
|
1173
|
+
*/
|
|
1174
|
+
query += "case ";
|
|
1175
|
+
query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then concat(d.inv_ict3_number, ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
1176
|
+
query += "when d.inv_tn_number != '' and d.inv_tn_number is not null then concat(d.inv_tn_number, '(TN)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
1177
|
+
query += "when d.inv_tndigit_number != '' and d.inv_tndigit_number is not null then concat(d.inv_tndigit_number,'(TNDigit)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
1178
|
+
query += "when d.serial_no != '' and d.serial_no is not null then concat(d.serial_no,'(S/N)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
1179
|
+
query += "else '' "
|
|
1180
|
+
query += "end as Descrizione ";
|
|
1181
|
+
query += "from devices d ";
|
|
1182
|
+
if (with_properties && with_properties > 0) {
|
|
1183
|
+
query += "left join device_properties dp on d.id = dp.id_device ";
|
|
1184
|
+
}
|
|
1185
|
+
query += "where (d.is_removed is null or d.is_removed = 0) "
|
|
1186
|
+
if (categoria && categoria.trim() != '') {
|
|
1187
|
+
query += "and d.type in (select tipo from categorie_device where categoria = '" + categoria +"') ";
|
|
1188
|
+
}
|
|
1189
|
+
if (id_dev_exclude && id_dev_exclude > 0) {
|
|
1190
|
+
query += "and d.id <> " + id_dev_exclude + " ";
|
|
1191
|
+
}
|
|
1192
|
+
if (with_properties) {
|
|
1193
|
+
query += "and dp.raw_properties is not null ";
|
|
1194
|
+
}
|
|
1195
|
+
query += "order by d.inv_ict3_number";
|
|
1196
|
+
return query;
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
function getDevicesSelectComboMySQL(categoria, id_dev_exclude, with_properties) {
|
|
1200
|
+
var query = "SELECT d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
|
|
1201
|
+
query += "case ";
|
|
1202
|
+
query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then concat(d.inv_ict3_number, ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
1203
|
+
query += "when d.inv_tn_number != '' and d.inv_tn_number is not null then concat(d.inv_tn_number, '(TN)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
1204
|
+
query += "when d.inv_tndigit_number != '' and d.inv_tndigit_number is not null then concat(d.inv_tndigit_number,'(TNDigit)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
1205
|
+
query += "when d.serial_no != '' and d.serial_no is not null then concat(d.serial_no,'(S/N)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
1206
|
+
query += "else '' ";
|
|
1207
|
+
query += "end as Descrizione ";
|
|
1208
|
+
query += "from devices d ";
|
|
1209
|
+
if (with_properties && with_properties > 0) {
|
|
1210
|
+
query += "left join device_properties dp on d.id = dp.id_device ";
|
|
1211
|
+
}
|
|
1212
|
+
query += "where (d.is_removed is null or d.is_removed = 0) "
|
|
1213
|
+
if (categoria && categoria.trim() != '') {
|
|
1214
|
+
query += "and d.type in (select tipo from categorie_device where categoria = :categoria) ";
|
|
1215
|
+
}
|
|
1216
|
+
if (id_dev_exclude && id_dev_exclude > 0) {
|
|
1217
|
+
query += "and d.id <> :id_dev_exclude ";
|
|
1218
|
+
}
|
|
1219
|
+
if (with_properties) {
|
|
1220
|
+
query += "and dp.raw_properties is not null ";
|
|
1221
|
+
}
|
|
1222
|
+
query += "order by d.inv_ict3_number";
|
|
1223
|
+
return query;
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
//End get devices for combo
|
|
1227
|
+
// Get device by site combo
|
|
1228
|
+
function getDevicesSelectBySiteComboSQLite(id_site) {
|
|
1229
|
+
var query = "SELECT d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
|
|
1230
|
+
query += "case ";
|
|
1231
|
+
query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then concat(d.inv_ict3_number, ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
1232
|
+
query += "when d.inv_tn_number != '' and d.inv_tn_number is not null then concat(d.inv_tn_number, '(TN)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
1233
|
+
query += "when d.inv_tndigit_number != '' and d.inv_tndigit_number is not null then concat(d.inv_tndigit_number,'(TNDigit)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
1234
|
+
query += "when d.serial_no != '' and d.serial_no is not null then concat(d.serial_no,'(S/N)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
1235
|
+
query += "else '' "
|
|
1236
|
+
query += "end as Descrizione ";
|
|
1237
|
+
query += "from devices d ";
|
|
1238
|
+
query += "join device_site ds on ds.id_device = d.id ";
|
|
1239
|
+
query += "where (d.is_removed is null or d.is_removed = 0) ";
|
|
1240
|
+
query += "and ds.id_site = " + id_site + " ";
|
|
1241
|
+
query += "and date('now') >= ds.date_in and date('now') <= ds.date_out ";
|
|
1242
|
+
query += "order by d.inv_ict3_number";
|
|
1243
|
+
return query;
|
|
1244
|
+
}
|
|
1245
|
+
function getDevicesSelectBySiteComboMySQL(id_site) {
|
|
1246
|
+
var query = "SELECT d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
|
|
1247
|
+
query += "case ";
|
|
1248
|
+
query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then concat(d.inv_ict3_number, ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
1249
|
+
query += "when d.inv_tn_number != '' and d.inv_tn_number is not null then concat(d.inv_tn_number, '(TN)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
1250
|
+
query += "when d.inv_tndigit_number != '' and d.inv_tndigit_number is not null then concat(d.inv_tndigit_number,'(TNDigit)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
1251
|
+
query += "when d.serial_no != '' and d.serial_no is not null then concat(d.serial_no,'(S/N)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
1252
|
+
query += "else '' "
|
|
1253
|
+
query += "end as Descrizione ";
|
|
1254
|
+
query += "from devices d ";
|
|
1255
|
+
query += "join device_site ds on ds.id_device = d.id ";
|
|
1256
|
+
query += "where (d.is_removed is null or d.is_removed = 0) ";
|
|
1257
|
+
query += "and ds.id_site = :id_site ";
|
|
1258
|
+
query += "and CURDATE() >= ds.date_in and CURDATE() <= ds.date_out ";
|
|
1259
|
+
query += "order by d.inv_ict3_number";
|
|
1260
|
+
return query;
|
|
1261
|
+
}
|
|
1262
|
+
//end Get device by site Combo
|
|
1263
|
+
|
|
1264
|
+
//Write Device properties
|
|
1265
|
+
function writeDevicePropertiesSQLite(id_device, raw_data) {
|
|
1266
|
+
var query = "insert into device_properties (id_device, raw_properties) values (";
|
|
1267
|
+
query += id_device + ", " + "'" + raw_data + "')";
|
|
1268
|
+
return query;
|
|
1269
|
+
}
|
|
1270
|
+
|
|
1271
|
+
function writeDevicePropertiesMySQL() {
|
|
1272
|
+
var query = "insert into device_properties (id_device, raw_properties) values (";
|
|
1273
|
+
query += ":id_device, :raw_data)";
|
|
1274
|
+
return query;
|
|
1275
|
+
}
|
|
1276
|
+
|
|
1277
|
+
//End Write Device properties
|
|
1278
|
+
//Read Device properties
|
|
1279
|
+
function readDevicePropertiesSQLite(id_device) {
|
|
1280
|
+
var query = "select raw_properties from device_properties ";
|
|
1281
|
+
query += "where id_device = " + id_device;
|
|
1282
|
+
return query;
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
function readDevicePropertiesMySQL() {
|
|
1286
|
+
return "";
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
//End Read Device properties
|
|
1290
|
+
|
|
1291
|
+
// Get Devices with properties
|
|
1292
|
+
function getDevicesWithPropertiesSQLite(id_device) {
|
|
1293
|
+
var query = "select ";
|
|
1294
|
+
query += "case ";
|
|
1295
|
+
query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then d.inv_ict3_number ";
|
|
1296
|
+
query += "when d.inv_pnrr_number != '' and d.inv_pnrr_number is not null then d.inv_pnrr_number ";
|
|
1297
|
+
query += "when d.inv_tn_number != '' and d.inv_tn_number is not null then concat(d.inv_tn_number,'(TN)') ";
|
|
1298
|
+
query += "when d.inv_tndigit_number != '' and d.inv_tndigit_number is not null then concat(d.inv_tndigit_number,'(TNDigit)') ";
|
|
1299
|
+
query += "when d.serial_no != '' and d.serial_no is not null then concat(d.serial_no,'(S/N)') ";
|
|
1300
|
+
query += "end as Codice, ";
|
|
1301
|
+
query += "d.manifacturer as Marca, d.model as Modello, d.id as Id from devices d ";
|
|
1302
|
+
query += "left join device_properties dp on d.id = dp.id_device ";
|
|
1303
|
+
query += "where dp.id_device is not null ";
|
|
1304
|
+
if (id_device > 0) {
|
|
1305
|
+
query += "and d.id = " + id_device + " ";
|
|
1306
|
+
}
|
|
1307
|
+
query += "order by d.id";
|
|
1308
|
+
return query;
|
|
1309
|
+
}
|
|
1310
|
+
function getDevicesWithPropertiesMySQL(id_device) {
|
|
1311
|
+
|
|
1312
|
+
}
|
|
1313
|
+
// End get devices with properties
|
|
1314
|
+
// Get Beni Acquisiti...
|
|
1315
|
+
function getBeniAcquisitiSQLite(table_name, is_pnrr, is_dismissione) {
|
|
1316
|
+
var query = "";
|
|
1317
|
+
if (table_name) {
|
|
1318
|
+
if (table_name == "ImportRevisione2024") {
|
|
1319
|
+
query = "Select ";
|
|
1320
|
+
query += "inv_ict3 as Inventario, ";
|
|
1321
|
+
query += "ex_inv as Precedente, ";
|
|
1322
|
+
query += "descrizione_bene as Descrizione, ";
|
|
1323
|
+
query += "collocazione as Luogo, ";
|
|
1324
|
+
query += "sede as Plesso, ";
|
|
1325
|
+
query += "marca as 'Marca bene', ";
|
|
1326
|
+
query += "modello_serie as Modello, ";
|
|
1327
|
+
query += "targa_matricola as Matricola, ";
|
|
1328
|
+
query += "data_presa_in_carico as 'Data acq.', ";
|
|
1329
|
+
query += "prezzo as Costo, ";
|
|
1330
|
+
query += "data_scarico as 'Data scarico', ";
|
|
1331
|
+
query += "concat(imp.NOTE, ' ', imp.NOTE_2, ' ', imp.NOTE_3, ' ', imp.NOTE_4, ' ', NOTE_5, ' ', NOTE_6, ' ', NOTE_7, ' ', NOTE_8) as 'Note bene' ";
|
|
1332
|
+
query += "from " + table_name + " imp ";
|
|
1333
|
+
}
|
|
1334
|
+
else if (is_pnrr == 1) {
|
|
1335
|
+
query = "Select ";
|
|
1336
|
+
query += "inventario as Inventario, ";
|
|
1337
|
+
query += "Tipo, ";
|
|
1338
|
+
query += "marca as 'Marca bene', ";
|
|
1339
|
+
query += "Descrizione, ";
|
|
1340
|
+
query += "Plesso as Luogo ";
|
|
1341
|
+
query += "from " + table_name + " imp ";
|
|
1342
|
+
}
|
|
1343
|
+
else if (is_dismissione == 1) {
|
|
1344
|
+
query = "Select ";
|
|
1345
|
+
query += "inv_ict3 as Inventario, ";
|
|
1346
|
+
query += "Descrizione, ";
|
|
1347
|
+
query += "Plesso, ";
|
|
1348
|
+
query += "Costo, ";
|
|
1349
|
+
query += "imp.Note as 'Note bene' ";
|
|
1350
|
+
query += "from " + table_name + " imp ";
|
|
1351
|
+
}
|
|
1352
|
+
else {
|
|
1353
|
+
query = "Select ";
|
|
1354
|
+
query += "inv_ict3 as Inventario, ";
|
|
1355
|
+
query += "ex_inventario as Precedente, ";
|
|
1356
|
+
query += "descrizione_bene as Descrizione, ";
|
|
1357
|
+
query += "collocazione as Luogo, ";
|
|
1358
|
+
query += "sede as Plesso, ";
|
|
1359
|
+
query += "marca as 'Marca bene', ";
|
|
1360
|
+
query += "modello_serie as Modello, ";
|
|
1361
|
+
query += "targa_matricola as Matricola, ";
|
|
1362
|
+
query += "data_presa_in_carico as 'Data acq.', ";
|
|
1363
|
+
query += "prezzo as Costo, ";
|
|
1364
|
+
query += "data_scarico as 'Data scarico', ";
|
|
1365
|
+
query += "concat(imp.note, ' ', imp.note_2, ' ', imp.note_3) as 'Note bene' ";
|
|
1366
|
+
query += "from " + table_name + " imp ";
|
|
1367
|
+
}
|
|
1368
|
+
if (query != "") {
|
|
1369
|
+
query += " left join devices d on imp.inv_ict3 = d.inv_ict3_number ";
|
|
1370
|
+
query += "where d.inv_ict3_number is not null ";
|
|
1371
|
+
query += "and trim(d.inv_ict3_number) <> ''";
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
return query;
|
|
1375
|
+
}
|
|
1376
|
+
function getBeniAcquisitiMySQL(table_name, is_pnrr, is_dismissione) {
|
|
1377
|
+
var query = "";
|
|
1378
|
+
if (table_name) {
|
|
1379
|
+
if (table_name == "ImportRevisione2024") {
|
|
1380
|
+
query = "Select ";
|
|
1381
|
+
query += "inv_ict3 as Inventario, ";
|
|
1382
|
+
query += "ex_inv as Precedente, ";
|
|
1383
|
+
query += "descrizione_bene as Descrizione, ";
|
|
1384
|
+
query += "collocazione as Luogo, ";
|
|
1385
|
+
query += "sede as Plesso, ";
|
|
1386
|
+
query += "marca as 'Marca bene', ";
|
|
1387
|
+
query += "modello_serie as Modello, ";
|
|
1388
|
+
query += "targa_matricola as Matricola, ";
|
|
1389
|
+
query += "data_presa_in_carico as 'Data acq.', ";
|
|
1390
|
+
query += "prezzo as Costo, ";
|
|
1391
|
+
query += "data_scarico as 'Data scarico', ";
|
|
1392
|
+
query += "concat(imp.NOTE, ' ', imp.NOTE_2, ' ', imp.NOTE_3, ' ', imp.NOTE_4, ' ', NOTE_5, ' ', NOTE_6, ' ', NOTE_7, ' ', NOTE_8) as 'Note bene' ";
|
|
1393
|
+
query += "from TAB_NAME imp ";
|
|
1394
|
+
}
|
|
1395
|
+
else if (is_pnrr == 1) {
|
|
1396
|
+
query = "Select ";
|
|
1397
|
+
query += "inventario as Inventario, ";
|
|
1398
|
+
query += "Tipo, ";
|
|
1399
|
+
query += "marca as 'Marca bene', ";
|
|
1400
|
+
query += "Descrizione, ";
|
|
1401
|
+
query += "Plesso as Luogo ";
|
|
1402
|
+
query += "from TAB_NAME imp ";
|
|
1403
|
+
}
|
|
1404
|
+
else if (is_dismissione == 1) {
|
|
1405
|
+
query = "Select ";
|
|
1406
|
+
query += "inv_ict3 as Inventario, ";
|
|
1407
|
+
query += "Descrizione, ";
|
|
1408
|
+
query += "Plesso, ";
|
|
1409
|
+
query += "Costo, ";
|
|
1410
|
+
query += "imp.Note as 'Note bene' ";
|
|
1411
|
+
query += "from TAB_NAME imp ";
|
|
1412
|
+
}
|
|
1413
|
+
else {
|
|
1414
|
+
query = "Select ";
|
|
1415
|
+
query += "inv_ict3 as Inventario, ";
|
|
1416
|
+
query += "ex_inventario as Precedente, ";
|
|
1417
|
+
query += "descrizione_bene as Descrizione, ";
|
|
1418
|
+
query += "collocazione as Luogo, ";
|
|
1419
|
+
query += "sede as Plesso, ";
|
|
1420
|
+
query += "marca as 'Marca bene', ";
|
|
1421
|
+
query += "modello_serie as Modello, ";
|
|
1422
|
+
query += "targa_matricola as Matricola, ";
|
|
1423
|
+
query += "data_presa_in_carico as 'Data acq.', ";
|
|
1424
|
+
query += "prezzo as Costo, ";
|
|
1425
|
+
query += "data_scarico as 'Data scarico', ";
|
|
1426
|
+
query += "concat(imp.note, ' ', imp.note_2, ' ', imp.note_3) as 'Note bene' ";
|
|
1427
|
+
query += "from TAB_NAME imp ";
|
|
1428
|
+
}
|
|
1429
|
+
if (query != "") {
|
|
1430
|
+
query += " left join devices d on imp.inv_ict3 = d.inv_ict3_number ";
|
|
1431
|
+
query += "where d.inv_ict3_number is not null ";
|
|
1432
|
+
query += "and trim(d.inv_ict3_number) <> ''";
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
let result = query.replace("TAB_NAME", table_name);
|
|
1436
|
+
return result;
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1439
|
+
//End get beni acquisiti
|
|
1440
|
+
//Manage sets
|
|
1441
|
+
function getSetInfoByIdSetSQLite(id_Set) {
|
|
1442
|
+
var query = "";
|
|
1443
|
+
query = "select idset, id_maindevice, id_relateddevice, id_conn_out, id_conn_in, id_adapter from device_set ";
|
|
1444
|
+
query += "where idset = " + id_Set;
|
|
1445
|
+
return query;
|
|
1446
|
+
}
|
|
1447
|
+
function getSetInfoByIdSetMySQL(id_set) {
|
|
1448
|
+
var query = "";
|
|
1449
|
+
query = "select idset, id_maindevice, id_relateddevice, id_conn_out, id_conn_in, id_adapter from device_set ";
|
|
1450
|
+
query += "where idset = :id_set";
|
|
1451
|
+
return query;
|
|
1452
|
+
}
|
|
1453
|
+
|
|
1454
|
+
function getSetInfoByIdDeviceSQLite(id_device) {
|
|
1455
|
+
var query = "select idset, id_maindevice, id_relateddevice, id_conn_out, id_conn_in, id_adapter from device_set ";
|
|
1456
|
+
query += "where id_maindevice = " + id_device;
|
|
1457
|
+
return query;
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
function getSetInfoByIdDeviceMySQL(id_device) {
|
|
1461
|
+
var query = "select idset, id_maindevice, id_relateddevice, id_conn_out, id_conn_in, id_adapter from device_set ";
|
|
1462
|
+
query += "where id_maindevice = :id_device";
|
|
1463
|
+
return query;
|
|
1464
|
+
}
|
|
1465
|
+
|
|
1466
|
+
function insertSetInfoSQLite(id_device, id_device_col) {
|
|
1467
|
+
var query = "";
|
|
1468
|
+
if (id_device > 0 && id_device_col > 0) {
|
|
1469
|
+
query = "insert into device_set (idset, id_maindevice, id_relateddevice) ";
|
|
1470
|
+
query += "select max(idset) + 1, " + id_device + ", " + id_device_col + " from device_set; ";
|
|
1471
|
+
}
|
|
1472
|
+
return query;
|
|
1473
|
+
}
|
|
1474
|
+
|
|
1475
|
+
function insertSetInfoMySQL(id_device, id_device_col) {
|
|
1476
|
+
var query = "";
|
|
1477
|
+
if (id_device > 0 && id_device_col > 0) {
|
|
1478
|
+
query = "insert into device_set (idset, id_maindevice, id_relateddevice) ";
|
|
1479
|
+
query += "select max(idset) + 1, :id_device, :id_device_col from device_set; ";
|
|
1480
|
+
}
|
|
1481
|
+
return query;
|
|
1482
|
+
}
|
|
1483
|
+
|
|
1484
|
+
|
|
1485
|
+
function insertSetInfoInverseSQLite(id_device, id_device_col) {
|
|
1486
|
+
return insertSetInfoSQLite(id_device_col, id_device);
|
|
1487
|
+
}
|
|
1488
|
+
|
|
1489
|
+
function insertSetInfoInverseMySQL(id_device, id_device_col) {
|
|
1490
|
+
return insertSetInfoMySQL(id_device_col, id_device);
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1493
|
+
|
|
1494
|
+
function removeSetInfoSQLite(id_device, id_device_col) {
|
|
1495
|
+
var query = "";
|
|
1496
|
+
if (id_device > 0 && id_device_col > 0) {
|
|
1497
|
+
query = "delete from device_set ";
|
|
1498
|
+
query += "where id_maindevice = " + id_device + " or id_relateddevice = " + id_device_col;
|
|
1499
|
+
}
|
|
1500
|
+
return query;
|
|
1501
|
+
}
|
|
1502
|
+
|
|
1503
|
+
function removeSetInfoMySQL(id_device, id_device_col) {
|
|
1504
|
+
var query = "";
|
|
1505
|
+
if (id_device > 0 && id_device_col > 0) {
|
|
1506
|
+
query = "delete from device_set ";
|
|
1507
|
+
query += "where id_maindevice = :id_device or id_relateddevice = :id_device_col";
|
|
1508
|
+
}
|
|
1509
|
+
return query;
|
|
1510
|
+
}
|
|
1511
|
+
|
|
1512
|
+
|
|
1513
|
+
function setInfoObj(set_info) {
|
|
1514
|
+
var obj = {};
|
|
1515
|
+
obj.id_conn_out = set_info.id_conn_out;
|
|
1516
|
+
obj.id_conn_in = set_info.id_conn_in;
|
|
1517
|
+
obj.id_adapter = set_info.id_adapter;
|
|
1518
|
+
obj.idset = set_info.idset;
|
|
1519
|
+
return obj;
|
|
1520
|
+
}
|
|
1521
|
+
|
|
1522
|
+
|
|
1523
|
+
function updateSetInfoSQLite(set_info) {
|
|
1524
|
+
var query = "";
|
|
1525
|
+
if (set_info) {
|
|
1526
|
+
query = "update device_set set ";
|
|
1527
|
+
query += "id_conn_out = " + set_info.id_conn_out + ", ";
|
|
1528
|
+
query += "id_conn_in = " + set_info.id_conn_in + ", ";
|
|
1529
|
+
query += "id_adapter = " + set_info.id_adapter + " ";
|
|
1530
|
+
query += "where idset = " + set_info.idset;
|
|
1531
|
+
}
|
|
1532
|
+
return query;
|
|
1533
|
+
}
|
|
1534
|
+
|
|
1535
|
+
function updateSetInfoMySQL() {
|
|
1536
|
+
var query = "update device_set set ";
|
|
1537
|
+
query += "id_conn_out = :id_conn_out, ";
|
|
1538
|
+
query += "id_conn_in = :id_conn_in, ";
|
|
1539
|
+
query += "id_adapter = :id_adapter ";
|
|
1540
|
+
query += "where idset = :idset";
|
|
1541
|
+
return query;
|
|
1542
|
+
}
|
|
1543
|
+
|
|
1544
|
+
|
|
1545
|
+
//
|
|
1546
|
+
function selectSetsByIdDeviceSQLite(id_device) {
|
|
1547
|
+
var query = "select ds.idset, d.id as Id, type as Tipo, manifacturer as Marca, model as modello, inv_ict3_number as Inv from devices d ";
|
|
1548
|
+
query += "inner join device_set ds on ds.id_relateddevice = d.id ";
|
|
1549
|
+
query += "where ds.id_maindevice = " + id_device;
|
|
1550
|
+
return query;
|
|
1551
|
+
}
|
|
1552
|
+
function selectSetsByIdDeviceMySQL(id_device) {
|
|
1553
|
+
var query = "select ds.idset, d.id as Id, type as Tipo, manifacturer as Marca, model as modello, inv_ict3_number as Inv from devices d ";
|
|
1554
|
+
query += "inner join device_set ds on ds.id_relateddevice = d.id ";
|
|
1555
|
+
query += "where ds.id_maindevice = :id_device";
|
|
1556
|
+
return query;
|
|
1557
|
+
}
|
|
1558
|
+
|
|
1559
|
+
//End manage sets
|
|
1560
|
+
|
|
1561
|
+
|
|
1562
|
+
|
|
1563
|
+
//
|
|
1564
|
+
function queryOSList() {
|
|
1565
|
+
var query = "select DISTINCT OS from device_pc order by OS";
|
|
1566
|
+
return query;
|
|
1567
|
+
}
|
|
1568
|
+
|
|
1569
|
+
// Get Network on device
|
|
1570
|
+
function getNetworksOnDeviceSQLite(id_device) {
|
|
1571
|
+
var query = "";
|
|
1572
|
+
query += "select sp.port_sign as Porta, dn.net_type as Tipo, dn.ipv4_static as IP4, dn.ipv6_static as IP6, dn.mac_address as MAC from device_networks dn ";
|
|
1573
|
+
query += "left join device_lan_ports dlp on dn.id = dlp.id_card ";
|
|
1574
|
+
query += "left join site_ports sp on dlp.id_port = sp.id ";
|
|
1575
|
+
query += "where dn.id_device = " + id_device;
|
|
1576
|
+
return query;
|
|
1577
|
+
}
|
|
1578
|
+
function getNetworksOnDeviceMySQL(id_device) {
|
|
1579
|
+
var query = "";
|
|
1580
|
+
query += "select sp.port_sign as Porta, dn.net_type as Tipo, dn.ipv4_static as IP4, dn.ipv6_static as IP6, dn.mac_address as MAC from device_networks dn ";
|
|
1581
|
+
query += "left join device_lan_ports dlp on dn.id = dlp.id_card ";
|
|
1582
|
+
query += "left join site_ports sp on dlp.id_port = sp.id ";
|
|
1583
|
+
query += "where dn.id_device = :id_device";
|
|
1584
|
+
return query;
|
|
1585
|
+
}
|
|
1586
|
+
//end Get Network on device
|
|
1587
|
+
//
|
|
1588
|
+
function getImportedPropertiesByIdDeviceSQLite(id_device) {
|
|
1589
|
+
var query = "select raw_properties as Dati from device_properties dp ";
|
|
1590
|
+
query += "where dp.id_device = " + id_device;
|
|
1591
|
+
return query;
|
|
1592
|
+
}
|
|
1593
|
+
function getImportedPropertiesByIdDeviceMySQL(id_device) {
|
|
1594
|
+
var query = "select raw_properties as Dati from device_properties dp ";
|
|
1595
|
+
query += "where dp.id_device = :id_device";
|
|
1596
|
+
return query;
|
|
1597
|
+
}
|
|
1598
|
+
//
|
|
1599
|
+
|
|
1600
|
+
function queryDeviceTypes() {
|
|
1601
|
+
var query = "SELECT DISTINCT type as search_type from devices ";
|
|
1602
|
+
query += "where type is not null and trim(type) <> '' ";
|
|
1603
|
+
query += "order by search_type";
|
|
1604
|
+
return query;
|
|
1605
|
+
}
|
|
1606
|
+
// Define getDevicesNotAllocatedCombo
|
|
1607
|
+
function getDevicesNotAllocatedComboSQLite() {
|
|
1608
|
+
var query = "SELECT d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
|
|
1609
|
+
query += "case ";
|
|
1610
|
+
query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then concat(d.inv_ict3_number, ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
1611
|
+
query += "when d.inv_tn_number != '' and d.inv_tn_number is not null then concat(d.inv_tn_number, '(TN)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
1612
|
+
query += "when d.inv_tndigit_number != '' and d.inv_tndigit_number is not null then concat(d.inv_tndigit_number,'(TNDigit)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
1613
|
+
query += "when d.serial_no != '' and d.serial_no is not null then concat(d.serial_no,'(S/N)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
1614
|
+
query += "else '' "
|
|
1615
|
+
query += "end as Descrizione ";
|
|
1616
|
+
query += "from devices d ";
|
|
1617
|
+
query += "left join device_site ds on d.id = ds.id_device ";
|
|
1618
|
+
query += "left join site_destinations sd on ds.id_site = sd.id_site ";
|
|
1619
|
+
query += "where (d.is_removed is null or d.is_removed = 0) "
|
|
1620
|
+
query += "and (ds.id_place is null ";
|
|
1621
|
+
query += "or (ds.date_in <= date('now') and ds.date_out >= date('now') and sd.type = 'MAGAZZINO')) ";
|
|
1622
|
+
query += "order by d.inv_ict3_number";
|
|
1623
|
+
return query;
|
|
1624
|
+
}
|
|
1625
|
+
|
|
1626
|
+
function getDevicesNotAllocatedComboMySQL() {
|
|
1627
|
+
var query = "SELECT d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
|
|
1628
|
+
query += "case ";
|
|
1629
|
+
query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then concat(d.inv_ict3_number, ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
1630
|
+
query += "when d.inv_tn_number != '' and d.inv_tn_number is not null then concat(d.inv_tn_number, '(TN)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
1631
|
+
query += "when d.inv_tndigit_number != '' and d.inv_tndigit_number is not null then concat(d.inv_tndigit_number,'(TNDigit)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
1632
|
+
query += "when d.serial_no != '' and d.serial_no is not null then concat(d.serial_no,'(S/N)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
1633
|
+
query += "else '' "
|
|
1634
|
+
query += "end as Descrizione ";
|
|
1635
|
+
query += "from devices d ";
|
|
1636
|
+
query += "left join device_site ds on d.id = ds.id_device ";
|
|
1637
|
+
query += "left join site_destinations sd on ds.id_site = sd.id_site ";
|
|
1638
|
+
query += "where (d.is_removed is null or d.is_removed = 0) "
|
|
1639
|
+
query += "and (ds.id_place is null ";
|
|
1640
|
+
query += "or (ds.date_in <= CURDATE() and ds.date_out >= CURDATE() and sd.type = 'MAGAZZINO')) ";
|
|
1641
|
+
query += "order by d.inv_ict3_number";
|
|
1642
|
+
return query;
|
|
1643
|
+
}
|
|
1644
|
+
|
|
1645
|
+
function getDevicesNotAllocatedCombo() {
|
|
1646
|
+
var query = "";
|
|
1647
|
+
var db_used = global.get("db_used");
|
|
1648
|
+
if (db_used) {
|
|
1649
|
+
switch (db_used) {
|
|
1650
|
+
case 'SQLITE':
|
|
1651
|
+
query = getDevicesNotAllocatedComboSQLite();
|
|
1652
|
+
break;
|
|
1653
|
+
case 'MYSQL':
|
|
1654
|
+
query = getDevicesNotAllocatedComboMySQL();
|
|
1655
|
+
break;
|
|
1656
|
+
}
|
|
1657
|
+
}
|
|
1658
|
+
else {
|
|
1659
|
+
query = getDevicesNotAllocatedComboSQLite();
|
|
1660
|
+
}
|
|
1661
|
+
return query;
|
|
1662
|
+
}
|
|
1663
|
+
// End getDevicesNotAllocatedCombo
|
|
1664
|
+
// Define getDevicesAllocatedCombo
|
|
1665
|
+
function getDevicesAllocatedComboSQLite(id_site, id_place) {
|
|
1666
|
+
var query = "SELECT d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
|
|
1667
|
+
query += "case ";
|
|
1668
|
+
query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then concat(d.inv_ict3_number, ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
1669
|
+
query += "when d.inv_tn_number != '' and d.inv_tn_number is not null then concat(d.inv_tn_number, '(TN)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
1670
|
+
query += "when d.inv_tndigit_number != '' and d.inv_tndigit_number is not null then concat(d.inv_tndigit_number,'(TNDigit)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
1671
|
+
query += "when d.serial_no != '' and d.serial_no is not null then concat(d.serial_no,'(S/N)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
1672
|
+
query += "else '' "
|
|
1673
|
+
query += "end as Descrizione ";
|
|
1674
|
+
query += "from devices d ";
|
|
1675
|
+
query += "left join device_site ds on d.id = ds.id_device ";
|
|
1676
|
+
query += "left join site_destinations sd on ds.id_site = sd.id_site ";
|
|
1677
|
+
query += "where (d.is_removed is null or d.is_removed = 0) "
|
|
1678
|
+
query += "and (ds.id_place is not null ";
|
|
1679
|
+
query += "or (ds.date_in <= date('now') and ds.date_out >= date('now') and ds.id_site <> " + id_site + " and ds.id_place <> '" + id_place + "')) ";
|
|
1680
|
+
query += "order by d.inv_ict3_number";
|
|
1681
|
+
return query;
|
|
1682
|
+
}
|
|
1683
|
+
function getDevicesAllocatedComboMySQL(id_site, id_place) {
|
|
1684
|
+
var query = "SELECT d.id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello, ";
|
|
1685
|
+
query += "case ";
|
|
1686
|
+
query += "when d.inv_ict3_number != '' and d.inv_ict3_number is not null then concat(d.inv_ict3_number, ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
1687
|
+
query += "when d.inv_tn_number != '' and d.inv_tn_number is not null then concat(d.inv_tn_number, '(TN)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
1688
|
+
query += "when d.inv_tndigit_number != '' and d.inv_tndigit_number is not null then concat(d.inv_tndigit_number,'(TNDigit)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
1689
|
+
query += "when d.serial_no != '' and d.serial_no is not null then concat(d.serial_no,'(S/N)', ' - ', d.type, ' - ', d.manifacturer, ' - ', d.model) ";
|
|
1690
|
+
query += "else '' "
|
|
1691
|
+
query += "end as Descrizione ";
|
|
1692
|
+
query += "from devices d ";
|
|
1693
|
+
query += "left join device_site ds on d.id = ds.id_device ";
|
|
1694
|
+
query += "left join site_destinations sd on ds.id_site = sd.id_site ";
|
|
1695
|
+
query += "where (d.is_removed is null or d.is_removed = 0) "
|
|
1696
|
+
query += "and (ds.id_place is not null ";
|
|
1697
|
+
query += "or (ds.date_in <= CURDATE() and ds.date_out >= CURDATE() and ds.id_site <> :id_site and ds.id_place <> :id_place)) ";
|
|
1698
|
+
query += "order by d.inv_ict3_number";
|
|
1699
|
+
return query;
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1702
|
+
// End getDevicesAllocatedCombo
|
|
1703
|
+
|
|
1704
|
+
//end of source
|
|
1705
|
+
|
|
1706
|
+
// Code added here will be run once
|
|
1707
|
+
// whenever the node is started.
|
|
1708
|
+
|
|
1709
|
+
|
|
1710
|
+
function getDevicesSelectForInventarioRawSQLite(inv_code) {
|
|
1711
|
+
var query = "SELECT id, type as Tipo, manifacturer as Marca, model as Modello, ";
|
|
1712
|
+
query += "inv_ict3_number as Inventario, ";
|
|
1713
|
+
query += "inv_tn_number as Precedente, ";
|
|
1714
|
+
query += "serial_no as Matricola, ";
|
|
1715
|
+
query += "ds.id_place as Plesso, "
|
|
1716
|
+
query += "ds.id_site as Collocazione "
|
|
1717
|
+
query += "from devices d ";
|
|
1718
|
+
query += "join device_site ds on ds.id_device = d.id "
|
|
1719
|
+
query += "where (date('now') >= ds.date_in and date('now') <= ds.date_out)";
|
|
1720
|
+
if (inv_code != null && inv_code.trim() != "") {
|
|
1721
|
+
query += " and inv_ict3_number = '" + inv_code + "'";
|
|
1722
|
+
}
|
|
1723
|
+
return query;
|
|
1724
|
+
}
|
|
1725
|
+
|
|
1726
|
+
function getDevicesSelectForInventarioRawMySQL(inv_code) {
|
|
1727
|
+
var query = "SELECT id, type as Tipo, manifacturer as Marca, model as Modello, ";
|
|
1728
|
+
query += "inv_ict3_number as Inventario, ";
|
|
1729
|
+
query += "inv_tn_number as Precedente, ";
|
|
1730
|
+
query += "serial_no as Matricola, ";
|
|
1731
|
+
query += "ds.id_place as Plesso, "
|
|
1732
|
+
query += "ds.id_site as Collocazione "
|
|
1733
|
+
query += "from devices d ";
|
|
1734
|
+
query += "join device_site ds on ds.id_device = d.id "
|
|
1735
|
+
query += "where (CURDATE() >= ds.date_in and CURDATE() <= ds.date_out)";
|
|
1736
|
+
if (inv_code != null && inv_code.trim() != "") {
|
|
1737
|
+
query += " and inv_ict3_number = '" + inv_code + "'";
|
|
1738
|
+
}
|
|
1739
|
+
return query;
|
|
1740
|
+
}
|
|
1741
|
+
|
|
1742
|
+
function getDevicesSelectForInventarioRawByIdSQLite(id_device) {
|
|
1743
|
+
var query = "SELECT id, type as Tipo, manifacturer as Marca, model as Modello, ";
|
|
1744
|
+
query += "type as Tipo, ";
|
|
1745
|
+
query += "inv_ict3_number as Inventario, ";
|
|
1746
|
+
query += "inv_tn_number as Precedente, ";
|
|
1747
|
+
query += "serial_no as Matricola, ";
|
|
1748
|
+
query += "ds.id_place as Plesso, "
|
|
1749
|
+
query += "ds.id_site as Collocazione "
|
|
1750
|
+
query += "from devices d ";
|
|
1751
|
+
query += "join device_site ds on ds.id_device = d.id "
|
|
1752
|
+
query += "where (date('now') >= ds.date_in and date('now') <= ds.date_out)";
|
|
1753
|
+
query += " and id = " + id_device;
|
|
1754
|
+
return query;
|
|
1755
|
+
}
|
|
1756
|
+
|
|
1757
|
+
function getDevicesSelectForInventarioRawByIdMySQL(id_device) {
|
|
1758
|
+
var query = "SELECT id, type as Tipo, manifacturer as Marca, model as Modello, ";
|
|
1759
|
+
query += "type as Tipo, ";
|
|
1760
|
+
query += "inv_ict3_number as Inventario, ";
|
|
1761
|
+
query += "inv_tn_number as Precedente, ";
|
|
1762
|
+
query += "serial_no as Matricola, ";
|
|
1763
|
+
query += "ds.id_place as Plesso, "
|
|
1764
|
+
query += "ds.id_site as Collocazione "
|
|
1765
|
+
query += "from devices d ";
|
|
1766
|
+
query += "join device_site ds on ds.id_device = d.id "
|
|
1767
|
+
query += "where (CURDATE() >= ds.date_in and CURDATE() <= ds.date_out)";
|
|
1768
|
+
query += " and id = " + id_device;
|
|
1769
|
+
return query;
|
|
1770
|
+
}
|
|
1771
|
+
|
|
1772
|
+
|
|
1773
|
+
function selectBeneDaInventarioSQLite(table_name, inv_code, is_pnrr, is_dismissione) {
|
|
1774
|
+
var query = "";
|
|
1775
|
+
if (table_name && inv_code) {
|
|
1776
|
+
if (table_name == "ImportRevisione2024") {
|
|
1777
|
+
query = "Select ";
|
|
1778
|
+
query += "inv_ict3 as Inventario, ";
|
|
1779
|
+
query += "ex_inv as Precedente, ";
|
|
1780
|
+
query += "descrizione_bene as Descrizione, ";
|
|
1781
|
+
query += "collocazione as Luogo, ";
|
|
1782
|
+
query += "sede as Plesso, ";
|
|
1783
|
+
query += "Marca, ";
|
|
1784
|
+
query += "modello_serie as Modello, ";
|
|
1785
|
+
query += "targa_matricola as Matricola, ";
|
|
1786
|
+
query += "data_presa_in_carico as 'Data acq.', ";
|
|
1787
|
+
query += "prezzo as Costo, ";
|
|
1788
|
+
query += "data_scarico as 'Data scarico', ";
|
|
1789
|
+
query += "concat(imp.NOTE, ' ', NOTE_2, ' ', NOTE_3, ' ', NOTE_4, ' ', NOTE_5, ' ', NOTE_6, ' ', NOTE_7, ' ', NOTE_8) as note_complete ";
|
|
1790
|
+
query += "from " + table_name + " imp ";
|
|
1791
|
+
query += " where Inventario = '" + inv_code + "'"
|
|
1792
|
+
query += " group by Inventario";
|
|
1793
|
+
}
|
|
1794
|
+
else if (table_name == "devices") {
|
|
1795
|
+
// Get the global function
|
|
1796
|
+
var getDevicesSelectForInventarioRaw = global.get("getDevicesSelectForInventarioRaw");
|
|
1797
|
+
|
|
1798
|
+
// Use the function
|
|
1799
|
+
query = getDevicesSelectForInventarioRaw(inv_code);
|
|
1800
|
+
}
|
|
1801
|
+
else if (is_pnrr == 1) {
|
|
1802
|
+
query = "Select ";
|
|
1803
|
+
query += "inventario as Inventario, ";
|
|
1804
|
+
query += "Tipo, ";
|
|
1805
|
+
query += "marca as 'Marca bene', ";
|
|
1806
|
+
query += "Descrizione, ";
|
|
1807
|
+
query += "Plesso as Luogo ";
|
|
1808
|
+
query += "from " + table_name + " imp ";
|
|
1809
|
+
query += " where Inventario = '" + inv_code + "'"
|
|
1810
|
+
query += " group by Inventario";
|
|
1811
|
+
}
|
|
1812
|
+
else if (is_dismissione == 1) {
|
|
1813
|
+
query = "Select ";
|
|
1814
|
+
query += "inv_ict3 as Inventario, ";
|
|
1815
|
+
query += "Descrizione, ";
|
|
1816
|
+
query += "Plesso, ";
|
|
1817
|
+
query += "Costo, ";
|
|
1818
|
+
query += "Note as 'Note bene' ";
|
|
1819
|
+
query += "from " + table_name + " imp ";
|
|
1820
|
+
query += " where trim(Inventario) = '" + inv_code + "'"
|
|
1821
|
+
query += " group by Inventario";
|
|
1822
|
+
}
|
|
1823
|
+
else {
|
|
1824
|
+
query = "Select ";
|
|
1825
|
+
query += "inv_ict3 as Inventario, ";
|
|
1826
|
+
query += "ex_inventario as Precedente, ";
|
|
1827
|
+
query += "descrizione_bene as Descrizione, ";
|
|
1828
|
+
query += "collocazione as Luogo, ";
|
|
1829
|
+
query += "sede as Plesso, ";
|
|
1830
|
+
query += "imp.Marca, ";
|
|
1831
|
+
query += "modello_serie as Modello, ";
|
|
1832
|
+
query += "targa_matricola as Matricola, ";
|
|
1833
|
+
query += "data_presa_in_carico as 'Data acq.', ";
|
|
1834
|
+
query += "prezzo as Costo, ";
|
|
1835
|
+
query += "data_scarico as 'Data scarico', ";
|
|
1836
|
+
query += "concat(imp.note, ' ', note_2, ' ', note_3) as note_complete ";
|
|
1837
|
+
query += " from " + table_name + " imp ";
|
|
1838
|
+
query += " where Inventario = '" + inv_code + "'";
|
|
1839
|
+
}
|
|
1840
|
+
}
|
|
1841
|
+
return query;
|
|
1842
|
+
}
|
|
1843
|
+
|
|
1844
|
+
function selectBeneDaInventarioMySQL(table_name, inv_code, is_pnrr, is_dismissione) {
|
|
1845
|
+
var query = "";
|
|
1846
|
+
if (table_name) {
|
|
1847
|
+
if (table_name == "ImportRevisione2024") {
|
|
1848
|
+
query = "Select ";
|
|
1849
|
+
query += "inv_ict3 as Inventario, ";
|
|
1850
|
+
query += "ex_inv as Precedente, ";
|
|
1851
|
+
query += "descrizione_bene as Descrizione, ";
|
|
1852
|
+
query += "collocazione as Luogo, ";
|
|
1853
|
+
query += "sede as Plesso, ";
|
|
1854
|
+
query += "Marca, ";
|
|
1855
|
+
query += "modello_serie as Modello, ";
|
|
1856
|
+
query += "targa_matricola as Matricola, ";
|
|
1857
|
+
query += "data_presa_in_carico as 'Data acq.', ";
|
|
1858
|
+
query += "prezzo as Costo, ";
|
|
1859
|
+
query += "data_scarico as 'Data scarico', ";
|
|
1860
|
+
query += "concat(imp.NOTE, ' ', NOTE_2, ' ', NOTE_3, ' ', NOTE_4, ' ', NOTE_5, ' ', NOTE_6, ' ', NOTE_7, ' ', NOTE_8) as note_complete ";
|
|
1861
|
+
query += "from TAB_NAME imp ";
|
|
1862
|
+
query += " where inv_ict3 = :inv_code ";
|
|
1863
|
+
query += " group by Inventario";
|
|
1864
|
+
}
|
|
1865
|
+
else if (table_name == "devices") {
|
|
1866
|
+
// Get the global function
|
|
1867
|
+
var getDevicesSelectForInventarioRaw = global.get("getDevicesSelectForInventarioRaw");
|
|
1868
|
+
|
|
1869
|
+
// Use the function
|
|
1870
|
+
query = getDevicesSelectForInventarioRaw(inv_code);
|
|
1871
|
+
}
|
|
1872
|
+
else if (is_pnrr == 1) {
|
|
1873
|
+
query = "Select ";
|
|
1874
|
+
query += "inventario as Inventario, ";
|
|
1875
|
+
query += "Tipo, ";
|
|
1876
|
+
query += "marca as 'Marca bene', ";
|
|
1877
|
+
query += "Descrizione, ";
|
|
1878
|
+
query += "Plesso as Luogo ";
|
|
1879
|
+
query += "from TAB_NAME imp ";
|
|
1880
|
+
query += " where inv_ict3 = :inv_code ";
|
|
1881
|
+
query += " group by Inventario";
|
|
1882
|
+
}
|
|
1883
|
+
else if (is_dismissione == 1) {
|
|
1884
|
+
query = "Select ";
|
|
1885
|
+
query += "inv_ict3 as Inventario, ";
|
|
1886
|
+
query += "Descrizione, ";
|
|
1887
|
+
query += "Plesso, ";
|
|
1888
|
+
query += "Costo, ";
|
|
1889
|
+
query += "Note as 'Note bene' ";
|
|
1890
|
+
query += "from TAB_NAME imp ";
|
|
1891
|
+
query += " where trim(inv_ict3) = :inv_code "
|
|
1892
|
+
query += " group by Inventario";
|
|
1893
|
+
}
|
|
1894
|
+
else {
|
|
1895
|
+
query = "Select ";
|
|
1896
|
+
query += "inv_ict3 as Inventario, ";
|
|
1897
|
+
query += "ex_inventario as Precedente, ";
|
|
1898
|
+
query += "descrizione_bene as Descrizione, ";
|
|
1899
|
+
query += "collocazione as Luogo, ";
|
|
1900
|
+
query += "sede as Plesso, ";
|
|
1901
|
+
query += "imp.Marca, ";
|
|
1902
|
+
query += "modello_serie as Modello, ";
|
|
1903
|
+
query += "targa_matricola as Matricola, ";
|
|
1904
|
+
query += "data_presa_in_carico as 'Data acq.', ";
|
|
1905
|
+
query += "prezzo as Costo, ";
|
|
1906
|
+
query += "data_scarico as 'Data scarico', ";
|
|
1907
|
+
query += "concat(imp.note, ' ', note_2, ' ', note_3) as note_complete ";
|
|
1908
|
+
query += " from TAB_NAME imp ";
|
|
1909
|
+
query += " where inv_ict3 = :inv_code";
|
|
1910
|
+
}
|
|
1911
|
+
}
|
|
1912
|
+
let result = query.replace("TAB_NAME",table_name);
|
|
1913
|
+
return result;
|
|
1914
|
+
}
|
|
1915
|
+
|
|
1916
|
+
|
|
1917
|
+
function queryCloseGestioneDeviceSQLite(id_gestione) {
|
|
1918
|
+
var query = "update device_gestioni ";
|
|
1919
|
+
query += "set date_end = date('now' - 1day) ";
|
|
1920
|
+
query += "where id = " + id_gestione + " ";
|
|
1921
|
+
query += "and date_start < date('now')";
|
|
1922
|
+
return query;
|
|
1923
|
+
}
|
|
1924
|
+
|
|
1925
|
+
function queryCloseGestioneDeviceMySQL(id_gestione, id_device, id_gestore) {
|
|
1926
|
+
var query = "update device_gestioni ";
|
|
1927
|
+
query += "set date_end = CURDATE('now' - 1day) ";
|
|
1928
|
+
query += "where id = :id_gestione";
|
|
1929
|
+
query += "and date_start < CURDATE()";
|
|
1930
|
+
return query;
|
|
1931
|
+
}
|
|
1932
|
+
|
|
1933
|
+
|
|
1934
|
+
function queryFornitoriGestoriCombo()
|
|
1935
|
+
{
|
|
1936
|
+
var query = "SELECT id, name from gestori_fornitori order by name";
|
|
1937
|
+
return query;
|
|
1938
|
+
}
|
|
1939
|
+
|
|
1940
|
+
|
|
1941
|
+
function queryInsertGestioneDeviceSQLite(id_device, id_gestore) {
|
|
1942
|
+
var query = "insert into device_gestioni (id_device, id_gestione, date_start, date_end) ";
|
|
1943
|
+
query += "values (" + id_device + ", ";
|
|
1944
|
+
query += id_gestore + ", ";
|
|
1945
|
+
query += "date('now'), '2999-12-31')";
|
|
1946
|
+
return query;
|
|
1947
|
+
}
|
|
1948
|
+
|
|
1949
|
+
function queryInsertGestioneDeviceMySQL(id_device, id_gestore) {
|
|
1950
|
+
var query = "insert into device_gestioni (id_device, id_gestione, date_start, date_end) ";
|
|
1951
|
+
query += "values (:id_device, ";
|
|
1952
|
+
query += ":id_gestore, ";
|
|
1953
|
+
query += "CURDATE(), '2999-12-31')";
|
|
1954
|
+
return query;
|
|
1955
|
+
}
|
|
1956
|
+
|
|
1957
|
+
function querySelectExistsGestioneDeviceByIdsMySQL(id_device, id_gestione, date_ref) {
|
|
1958
|
+
|
|
1959
|
+
}
|
|
1960
|
+
|
|
1961
|
+
function querySelectExistsGestioneDeviceByIdsSQLite(id_device, id_gestione, date_ref) {
|
|
1962
|
+
var query = "select count(*) from device_gestioni "
|
|
1963
|
+
query += "where id_device = " + id_device + " and ";
|
|
1964
|
+
query += "id_gestione = " + id_gestione;
|
|
1965
|
+
return query;
|
|
1966
|
+
}
|
|
1967
|
+
|
|
1968
|
+
function querySelectGestioniDeviceByIdDeviceSQLite(id_device, date_ref) {
|
|
1969
|
+
var query = "select gf.name as Denominazione, contact_phone as Telefono, contact_email as Email from device_gestioni dg ";
|
|
1970
|
+
query += "inner join gestori_fornitori gf on gf.id = dg.id_gestione ";
|
|
1971
|
+
query += "where dg.id_device = " + id_device;
|
|
1972
|
+
if (date_ref) {
|
|
1973
|
+
switch (date_ref) {
|
|
1974
|
+
case "current":
|
|
1975
|
+
query += " and ";
|
|
1976
|
+
query += " (date('now') >= date_start and date('now') <= date_end)";
|
|
1977
|
+
break;
|
|
1978
|
+
default:
|
|
1979
|
+
query += " and ";
|
|
1980
|
+
query += " ('" + date_ref + "' >= date_start and '" + date_ref + "' <= date_end)";
|
|
1981
|
+
break;
|
|
1982
|
+
|
|
1983
|
+
}
|
|
1984
|
+
}
|
|
1985
|
+
query += " order by date_start desc"
|
|
1986
|
+
return query;
|
|
1987
|
+
}
|
|
1988
|
+
|
|
1989
|
+
function querySelectGestioniDeviceByIdDeviceMySQL(id_device, date_ref) {
|
|
1990
|
+
var query = "select gf.name as Denominazione, contact_phone as Telefono, contact_email as Email from device_gestioni dg ";
|
|
1991
|
+
query += "inner join gestori_fornitori gf on gf.id = dg.id_gestione ";
|
|
1992
|
+
query += "where dg.id_device = :id_device";
|
|
1993
|
+
if (date_ref) {
|
|
1994
|
+
switch (date_ref) {
|
|
1995
|
+
case "current":
|
|
1996
|
+
query += " and ";
|
|
1997
|
+
query += " (CURDATE() >= dg.date_start and CURDATE() <= dg.date_end)";
|
|
1998
|
+
break;
|
|
1999
|
+
default:
|
|
2000
|
+
query += " and ";
|
|
2001
|
+
query += " (:date_ref >= date_start and :date_ref <= date_end)";
|
|
2002
|
+
break;
|
|
2003
|
+
|
|
2004
|
+
}
|
|
2005
|
+
}
|
|
2006
|
+
query += " order by date_start desc"
|
|
2007
|
+
return query;
|
|
2008
|
+
}
|
|
2009
|
+
|
|
2010
|
+
|
|
2011
|
+
function queryConsegneSQLite(data_da, data_a, data_filter) {
|
|
2012
|
+
var query = "SELECT id, data_richiesta as Richiesta, data_consegna as Consegna, richiedente_adulto as Adulto, richiedente_alunno as Alunno, richiedente_genitore as Genitore, is_home as Casa, note as Note from consegne";
|
|
2013
|
+
query += " where (removed is null or removed = 0) ";
|
|
2014
|
+
if (data_da || data_a) {
|
|
2015
|
+
query += " and ";
|
|
2016
|
+
if (data_da) {
|
|
2017
|
+
var d = new Date(data_da);
|
|
2018
|
+
var data_str = d.getFullYear() + "-" + String((d.getMonth() + 1)).padStart(2, '0') + "-" + String(d.getDate()).padStart(2, '0');
|
|
2019
|
+
if (data_filter == "RICHIESTA")
|
|
2020
|
+
query += "data_richiesta >= '" + data_str + "'";
|
|
2021
|
+
else
|
|
2022
|
+
query += "data_consegna >= '" + data_str + "'";
|
|
2023
|
+
}
|
|
2024
|
+
if (data_da && data_a) {
|
|
2025
|
+
query += " and ";
|
|
2026
|
+
}
|
|
2027
|
+
if (data_a) {
|
|
2028
|
+
var d = new Date(data_a);
|
|
2029
|
+
var data_str = d.getFullYear() + "-" + String((d.getMonth() + 1)).padStart(2, '0') + "-" + String(d.getDate()).padStart(2, '0');
|
|
2030
|
+
if (data_filter == "RICHIESTA")
|
|
2031
|
+
query += "data_richiesta <= '" + data_str + "'";
|
|
2032
|
+
else
|
|
2033
|
+
query += "data_consegna <= '" + data_str + "'";
|
|
2034
|
+
}
|
|
2035
|
+
}
|
|
2036
|
+
if (data_filter == "RICHIESTA")
|
|
2037
|
+
query += " order by data_richiesta desc";
|
|
2038
|
+
else
|
|
2039
|
+
query += " order by data_consegna desc";
|
|
2040
|
+
return query;
|
|
2041
|
+
}
|
|
2042
|
+
|
|
2043
|
+
function queryConsegneMySQL(data_da, data_a, data_filter) {
|
|
2044
|
+
var query = "SELECT id, data_richiesta as Richiesta, data_consegna as Consegna, richiedente_adulto as Adulto, richiedente_alunno as Alunno, richiedente_genitore as Genitore, is_home as Casa, note as Note from consegne";
|
|
2045
|
+
query += " where (removed is null or removed = 0) ";
|
|
2046
|
+
if (data_da || data_a) {
|
|
2047
|
+
query += " and ";
|
|
2048
|
+
if (data_da) {
|
|
2049
|
+
if (data_filter == "RICHIESTA")
|
|
2050
|
+
query += "data_richiesta >= :data_da";
|
|
2051
|
+
else
|
|
2052
|
+
query += "data_consegna >= :data_da";
|
|
2053
|
+
}
|
|
2054
|
+
if (data_da && data_a) {
|
|
2055
|
+
query += " and ";
|
|
2056
|
+
}
|
|
2057
|
+
if (data_a) {
|
|
2058
|
+
if (data_filter == "RICHIESTA")
|
|
2059
|
+
query += "data_richiesta <= :data_a";
|
|
2060
|
+
else
|
|
2061
|
+
query += "data_consegna <= :data_a";
|
|
2062
|
+
}
|
|
2063
|
+
}
|
|
2064
|
+
if (data_filter == "RICHIESTA")
|
|
2065
|
+
query += " order by data_richiesta desc";
|
|
2066
|
+
else
|
|
2067
|
+
query += " order by data_consegna desc";
|
|
2068
|
+
|
|
2069
|
+
return query;
|
|
2070
|
+
}
|
|
2071
|
+
|
|
2072
|
+
|
|
2073
|
+
function queryConsegnaByIdSQLite(id_consegna) {
|
|
2074
|
+
var query = "SELECT id, id_place, id_site, data_richiesta, data_consegna, data_rientro, ";
|
|
2075
|
+
query += "case ";
|
|
2076
|
+
query += "when stato_restituzione is null then 0 else stato_restituzione end as stato_restituzione";
|
|
2077
|
+
query += ", is_home, note, richiedente_adulto, richiedente_alunno, richiedente_genitore from consegne";
|
|
2078
|
+
query += " where id = " + id_consegna;
|
|
2079
|
+
return query;
|
|
2080
|
+
}
|
|
2081
|
+
|
|
2082
|
+
function queryConsegnaByIdMySQL(id_consegna) {
|
|
2083
|
+
var query = "SELECT id, id_place, id_site, data_richiesta, data_consegna, data_rientro, ";
|
|
2084
|
+
query += "case ";
|
|
2085
|
+
query += "when stato_restituzione is null then 0 else stato_restituzione end as stato_restituzione";
|
|
2086
|
+
query += ", is_home, note, richiedente_adulto, richiedente_alunno, richiedente_genitore from consegne";
|
|
2087
|
+
query += " where id = :id_consegna";
|
|
2088
|
+
return query;
|
|
2089
|
+
}
|
|
2090
|
+
|
|
2091
|
+
|
|
2092
|
+
function queryConsegneByIdDeviceSQLite(id_device) {
|
|
2093
|
+
var query = "select c.data_consegna as Consegna, ";
|
|
2094
|
+
query += "case ";
|
|
2095
|
+
query += "when c.stato_restituzione = 0 then 'Prestito in corso' ";
|
|
2096
|
+
query += "when c.stato_restituzione = 1 then 'Non restituito' ";
|
|
2097
|
+
query += "when c.stato_restituzione = 2 then 'Restituito' ";
|
|
2098
|
+
query += "when c.stato_restituzione = 3 then 'Danneggiato' ";
|
|
2099
|
+
query += "when c.stato_restituzione = 4 then 'Parti mancanti' ";
|
|
2100
|
+
query += "else '' ";
|
|
2101
|
+
query += "end as Stato, ";
|
|
2102
|
+
query += "c.note as Note from device_consegne dc ";
|
|
2103
|
+
query += "inner join consegne c on c.id = dc.id_consegna ";
|
|
2104
|
+
query += "where dc.id_device = " + id_device;
|
|
2105
|
+
return query;
|
|
2106
|
+
}
|
|
2107
|
+
|
|
2108
|
+
function queryConsegneByIdDeviceMySQL(id_device) {
|
|
2109
|
+
var query = "select c.data_consegna as Consegna, ";
|
|
2110
|
+
query += "case ";
|
|
2111
|
+
query += "when c.stato_restituzione = 0 then 'Prestito in corso' ";
|
|
2112
|
+
query += "when c.stato_restituzione = 1 then 'Non restituito' ";
|
|
2113
|
+
query += "when c.stato_restituzione = 2 then 'Restituito' ";
|
|
2114
|
+
query += "when c.stato_restituzione = 3 then 'Danneggiato' ";
|
|
2115
|
+
query += "when c.stato_restituzione = 4 then 'Parti mancanti' ";
|
|
2116
|
+
query += "else '' ";
|
|
2117
|
+
query += "end as Stato, ";
|
|
2118
|
+
query += "c.note as Note from device_consegne dc ";
|
|
2119
|
+
query += "inner join consegne c on c.id = dc.id_consegna ";
|
|
2120
|
+
query += "where dc.id_device = :id_device";
|
|
2121
|
+
return query;
|
|
2122
|
+
}
|
|
2123
|
+
|
|
2124
|
+
|
|
2125
|
+
function queryDeviceStatusCombo() {
|
|
2126
|
+
var query = "SELECT id, name from status_description order by id";
|
|
2127
|
+
return query;
|
|
2128
|
+
}
|
|
2129
|
+
|
|
2130
|
+
function queryUsers() {
|
|
2131
|
+
var query = "select id, user, password, mac_address from users_granted ug ";
|
|
2132
|
+
query += "order by ug.id";
|
|
2133
|
+
return query;
|
|
2134
|
+
}
|
|
2135
|
+
|
|
2136
|
+
function queryFunctions() {
|
|
2137
|
+
var query = "select ug.id, ug.user, f.name as func_name from users_granted ug ";
|
|
2138
|
+
query += "join profile_functions pf on pf.id_profile = ug.id_profile ";
|
|
2139
|
+
query += "join functions f on f.id = pf.id_function ";
|
|
2140
|
+
query += "order by ug.id";
|
|
2141
|
+
return query;
|
|
2142
|
+
}
|
|
2143
|
+
|
|
2144
|
+
function queryAllFunctions() {
|
|
2145
|
+
var query = "select f.id, f.name as func_name from functions f ";
|
|
2146
|
+
return query;
|
|
2147
|
+
}
|
|
2148
|
+
|
|
2149
|
+
function queryInterventoByIdSQLite(id_interv) {
|
|
2150
|
+
var query = "select id, id_place, id_site, data_inizio, data_fine, tipo_risoluzione, executor_type, id_executor, executed_by, request_by, description, helpdesk_ref from interventi ";
|
|
2151
|
+
query += "where id = " + id_interv;
|
|
2152
|
+
return query;
|
|
2153
|
+
}
|
|
2154
|
+
|
|
2155
|
+
function queryInterventoByIdMySQL(id_interv) {
|
|
2156
|
+
var query = "select id, id_place, id_site, data_inizio, data_fine, tipo_risoluzione, executor_type, id_executor, executed_by, request_by, description, helpdesk_ref from interventi ";
|
|
2157
|
+
query += "where id = :id_interv";
|
|
2158
|
+
return query;
|
|
2159
|
+
}
|
|
2160
|
+
|
|
2161
|
+
|
|
2162
|
+
// Device intervento
|
|
2163
|
+
function insertDeviceInterventoSQLite(id_intervento, id_device, note) {
|
|
2164
|
+
var query = "insert into device_interventi (id_intervento, id_device, note) ";
|
|
2165
|
+
query += "values (" + id_intervento + ", " + id_device + ", '" + note + "')";
|
|
2166
|
+
return query;
|
|
2167
|
+
}
|
|
2168
|
+
function insertDeviceInterventoMySQL(id_intervento, id_device, note) {
|
|
2169
|
+
var query = "insert into device_interventi (id_intervento, id_device, note) ";
|
|
2170
|
+
query += "values (:id_intervento, :id_device, :note)";
|
|
2171
|
+
return query;
|
|
2172
|
+
}
|
|
2173
|
+
// Update
|
|
2174
|
+
function updateDeviceInterventoSQLite(id_dev_interv, id_device, note) {
|
|
2175
|
+
var query = "update device_interventi set ";
|
|
2176
|
+
query += "id_device = " + id_device + ", ";
|
|
2177
|
+
query += "note = " + note + " ";
|
|
2178
|
+
query += "where id = " + id_dev_interv;
|
|
2179
|
+
return query;
|
|
2180
|
+
}
|
|
2181
|
+
function updateDeviceInterventoMySQL(id_dev_interv, id_device, note) {
|
|
2182
|
+
var query = "update device_interventi set ";
|
|
2183
|
+
query += "id_device = :id_device ";
|
|
2184
|
+
query += "note = :note ";
|
|
2185
|
+
query += "where id = :id_dev_interv";
|
|
2186
|
+
return query;
|
|
2187
|
+
}
|
|
2188
|
+
// Remove
|
|
2189
|
+
function removeDeviceInterventoSQLite(id_dev_interv) {
|
|
2190
|
+
var query = "delete from device_interventi ";
|
|
2191
|
+
query += "where id = :id_dev_interv";
|
|
2192
|
+
return query;
|
|
2193
|
+
}
|
|
2194
|
+
function removeDeviceInterventoMySQL(id_intervento, id_device, note) {
|
|
2195
|
+
var query = "insert into device_interventi (id_intervento, id_device, note) ";
|
|
2196
|
+
query += "values (:id_intervento, :id_device, :note)";
|
|
2197
|
+
return query;
|
|
2198
|
+
}
|
|
2199
|
+
//End device intervento
|
|
2200
|
+
|
|
2201
|
+
|
|
2202
|
+
// Laboratori
|
|
2203
|
+
function getLaboratorioDevices(id_site, id_place) {
|
|
2204
|
+
var query = "select ";
|
|
2205
|
+
return query;
|
|
2206
|
+
}
|
|
2207
|
+
|
|
2208
|
+
// End Laboratori
|
|
2209
|
+
// Consegna Insert
|
|
2210
|
+
function createConsegnaObj(consegna) {
|
|
2211
|
+
var consegnaObj = null;
|
|
2212
|
+
if (consegna) {
|
|
2213
|
+
consegnaObj = {};
|
|
2214
|
+
consegnaObj.id = consegna.id;
|
|
2215
|
+
consegnaObj.adulto = "";
|
|
2216
|
+
consegnaObj.alunno = "";
|
|
2217
|
+
consegnaObj.genitore = "";
|
|
2218
|
+
consegnaObj.note = "";
|
|
2219
|
+
consegnaObj.is_home = 0;
|
|
2220
|
+
consegnaObj.stato_res = 0;
|
|
2221
|
+
consegnaObj.data_ric_str = "";
|
|
2222
|
+
consegnaObj.data_cons_str = "";
|
|
2223
|
+
consegnaObj.data_rest_str = "";
|
|
2224
|
+
consegnaObj.id_site = consegna.id_site;
|
|
2225
|
+
consegnaObj.id_place = consegna.id_place;
|
|
2226
|
+
|
|
2227
|
+
var dr = consegna.data_richiesta;
|
|
2228
|
+
if (dr) {
|
|
2229
|
+
var d = new Date(dr);
|
|
2230
|
+
consegnaObj.data_ric_str = d.getFullYear() + "-" + String((d.getMonth() + 1)).padStart(2, '0') + "-" + String(d.getDate()).padStart(2, '0');
|
|
2231
|
+
}
|
|
2232
|
+
|
|
2233
|
+
var dc = consegna.data_consegna;
|
|
2234
|
+
if (dc) {
|
|
2235
|
+
var d = new Date(dc);
|
|
2236
|
+
consegnaObj.data_cons_str = d.getFullYear() + "-" + String((d.getMonth() + 1)).padStart(2, '0') + "-" + String(d.getDate()).padStart(2, '0');
|
|
2237
|
+
}
|
|
2238
|
+
|
|
2239
|
+
var ds = consegna.data_restituzione;
|
|
2240
|
+
if (ds) {
|
|
2241
|
+
var d = new Date(ds);
|
|
2242
|
+
consegnaObj.data_rest_str = d.getFullYear() + "-" + String((d.getMonth() + 1)).padStart(2, '0') + "-" + String(d.getDate()).padStart(2, '0');
|
|
2243
|
+
}
|
|
2244
|
+
|
|
2245
|
+
if (!consegna.stato_restituzione) {
|
|
2246
|
+
consegnaObj.stato_res = 0;
|
|
2247
|
+
}
|
|
2248
|
+
else {
|
|
2249
|
+
consegnaObj.stato_res = consegna.stato_restituzione;
|
|
2250
|
+
}
|
|
2251
|
+
if (consegnaObj.stato_res == 0 || consegnaObj.stato_res == 1) {
|
|
2252
|
+
consegnaObj.data_rest_str = "";
|
|
2253
|
+
}
|
|
2254
|
+
|
|
2255
|
+
if (consegna.richiedente_adulto)
|
|
2256
|
+
consegnaObj.adulto = consegna.richiedente_adulto;
|
|
2257
|
+
if (consegna.richiedente_alunno)
|
|
2258
|
+
consegnaObj.alunno = consegna.richiedente_alunno;
|
|
2259
|
+
if (consegna.richiedente_genitore)
|
|
2260
|
+
consegnaObj.genitore = consegna.richiedente_genitore;
|
|
2261
|
+
if (consegna.is_home)
|
|
2262
|
+
consegnaObj.is_home = consegna.is_home;
|
|
2263
|
+
if (consegna.note)
|
|
2264
|
+
consegnaObj.note = consegna.note;
|
|
2265
|
+
}
|
|
2266
|
+
return consegnaObj;
|
|
2267
|
+
}
|
|
2268
|
+
|
|
2269
|
+
function createConsegnaMySQLObj(consegna) {
|
|
2270
|
+
var consegnaMySQLObj = {};
|
|
2271
|
+
var consegnaObj = createConsegnaObj(consegna);
|
|
2272
|
+
if (consegnaObj) {
|
|
2273
|
+
consegnaMySQLObj.adulto = consegnaObj.adulto;
|
|
2274
|
+
consegnaMySQLObj.genitore = consegnaObj.genitore;
|
|
2275
|
+
consegnaMySQLObj.alunno = consegnaObj.alunno;
|
|
2276
|
+
consegnaMySQLObj.note = consegnaObj.note;
|
|
2277
|
+
consegnaMySQLObj.is_home = consegnaObj.is_home;
|
|
2278
|
+
consegnaMySQLObj.stato_res = consegnaObj.stato_res;
|
|
2279
|
+
consegnaMySQLObj.data_ric_str = consegnaObj.data_ric_str;
|
|
2280
|
+
consegnaMySQLObj.data_cons_str = consegnaObj.data_cons_str;
|
|
2281
|
+
consegnaMySQLObj.data_rest_str = consegnaObj.data_rest_str;
|
|
2282
|
+
consegnaMySQLObj.id_site = consegnaObj.id_site;
|
|
2283
|
+
consegnaMySQLObj.id_place = consegnaObj.id_place;
|
|
2284
|
+
consegnaMySQLObj.id = consegnaObj.id;
|
|
2285
|
+
}
|
|
2286
|
+
return consegnaMySQLObj;
|
|
2287
|
+
}
|
|
2288
|
+
|
|
2289
|
+
function insertConsegnaSQLite(consegna) {
|
|
2290
|
+
var query = "";
|
|
2291
|
+
var consegnaObj = createConsegnaObj(consegna);
|
|
2292
|
+
if (consegnaObj) {
|
|
2293
|
+
query = "insert into consegne ";
|
|
2294
|
+
query += "(data_richiesta, data_consegna, stato_restituzione, data_rientro, richiedente_adulto, richiedente_alunno, richiedente_genitore, id_place, id_site, is_home, note) ";
|
|
2295
|
+
query += " values ('" + consegnaObj.data_ric_str + "',";
|
|
2296
|
+
query += "'" + consegnaObj.data_cons_str + "',";
|
|
2297
|
+
query += consegnaObj.stato_res + ",";
|
|
2298
|
+
query += "'" + consegnaObj.data_rest_str + "',";
|
|
2299
|
+
query += "'" + consegnaObj.adulto + "',";
|
|
2300
|
+
query += "'" + consegnaObj.alunno + "',";
|
|
2301
|
+
query += "'" + consegnaObj.genitore + "',";
|
|
2302
|
+
query += "'" + consegnaObj.id_place + "',";
|
|
2303
|
+
query += consegnaObj.id_site + ",";
|
|
2304
|
+
query += consegnaObj.is_home + ",";
|
|
2305
|
+
query += "'" + consegnaObj.note + "')";
|
|
2306
|
+
}
|
|
2307
|
+
return query;
|
|
2308
|
+
}
|
|
2309
|
+
|
|
2310
|
+
function insertConsegnaMySQL(consegnaObj) {
|
|
2311
|
+
var query = "";
|
|
2312
|
+
if (consegnaObj) {
|
|
2313
|
+
query = "insert into consegne ";
|
|
2314
|
+
query += "(data_richiesta, data_consegna, stato_restituzione, data_rientro, richiedente_adulto, richiedente_alunno, richiedente_genitore, id_place, id_site, is_home, note) ";
|
|
2315
|
+
query += " values (:data_ric_str,";
|
|
2316
|
+
query += ":data_cons_str,";
|
|
2317
|
+
query += ":stato_res,";
|
|
2318
|
+
query += ":data_rest_str,";
|
|
2319
|
+
query += ":adulto,";
|
|
2320
|
+
query += ":alunno,";
|
|
2321
|
+
query += ":genitore,";
|
|
2322
|
+
query += ":id_place,";
|
|
2323
|
+
query += ":id_site,";
|
|
2324
|
+
query += ":is_home,";
|
|
2325
|
+
query += ":note)";
|
|
2326
|
+
}
|
|
2327
|
+
return query;
|
|
2328
|
+
}
|
|
2329
|
+
|
|
2330
|
+
|
|
2331
|
+
|
|
2332
|
+
function updateConsegnaSQLite(consegna) {
|
|
2333
|
+
var query = "";
|
|
2334
|
+
var consegnaObj = createConsegnaObj(consegna);
|
|
2335
|
+
if (consegnaObj) {
|
|
2336
|
+
var query = "update consegne ";
|
|
2337
|
+
query += "set id_place = '" + consegnaObj.id_place + "', ";
|
|
2338
|
+
query += "id_site = " + consegnaObj.id_site;
|
|
2339
|
+
if (consegnaObj.data_ric_str.trim() != '')
|
|
2340
|
+
query += ", data_richiesta = '" + consegnaObj.data_ric_str + "'";
|
|
2341
|
+
if (consegnaObj.data_cons_str.trim() != '')
|
|
2342
|
+
query += ", data_consegna = '" + consegnaObj.data_cons_str + "'";
|
|
2343
|
+
query += ", stato_restituzione = " + consegnaObj.stato_res;
|
|
2344
|
+
if (consegnaObj.data_rest_str.trim() != '')
|
|
2345
|
+
query += ", data_rientro = '" + consegnaObj.data_rest_str + "'";
|
|
2346
|
+
if (consegnaObj.adulto.trim() != '')
|
|
2347
|
+
query += ", richiedente_adulto = '" + consegnaObj.adulto.trim() + "'";
|
|
2348
|
+
if (consegnaObj.alunno.trim() != '')
|
|
2349
|
+
query += ", richiedente_alunno = '" + consegnaObj.alunno.trim() + "'";
|
|
2350
|
+
if (consegnaObj.genitore.trim() != '')
|
|
2351
|
+
query += ", richiedente_genitore = '" + consegnaObj.genitore.trim() + "'";
|
|
2352
|
+
query += ", is_home = " + consegnaObj.is_home;
|
|
2353
|
+
if (consegnaObj.note.trim() != '')
|
|
2354
|
+
query += ", note = '" + consegnaObj.note + "'";
|
|
2355
|
+
query += " where id = " + consegnaObj.id;
|
|
2356
|
+
}
|
|
2357
|
+
return query;
|
|
2358
|
+
}
|
|
2359
|
+
|
|
2360
|
+
function updateConsegnaMySQL(consegna) {
|
|
2361
|
+
var query = "";
|
|
2362
|
+
var consegnaObj = createConsegnaObj(consegna);
|
|
2363
|
+
if (consegnaObj) {
|
|
2364
|
+
var query = "update consegne ";
|
|
2365
|
+
query += "set id_place = '" + consegnaObj.id_place + "', ";
|
|
2366
|
+
query += "id_site = id_site ";
|
|
2367
|
+
if (consegnaObj.data_ric_str.trim() != '')
|
|
2368
|
+
query += ", data_richiesta = :data_ric_str ";
|
|
2369
|
+
if (consegnaObj.data_cons_str.trim() != '')
|
|
2370
|
+
query += ", data_consegna = :data_cons_str ";
|
|
2371
|
+
query += ", stato_restituzione = " + consegnaObj.stato_res;
|
|
2372
|
+
if (consegnaObj.data_rest_str.trim() != '')
|
|
2373
|
+
query += ", data_rientro = :data_rest_str ";
|
|
2374
|
+
if (consegnaObj.adulto.trim() != '')
|
|
2375
|
+
query += ", richiedente_adulto = :adulto ";
|
|
2376
|
+
if (consegnaObj.alunno.trim() != '')
|
|
2377
|
+
query += ", richiedente_alunno = :alunno ";
|
|
2378
|
+
if (consegnaObj.genitore.trim() != '')
|
|
2379
|
+
query += ", richiedente_genitore = :genitore ";
|
|
2380
|
+
query += ", is_home = :is_home ";
|
|
2381
|
+
if (consegnaObj.note.trim() != '')
|
|
2382
|
+
query += ", note = :note ";
|
|
2383
|
+
query += " where id = :id ";
|
|
2384
|
+
}
|
|
2385
|
+
return query;
|
|
2386
|
+
}
|
|
2387
|
+
|
|
2388
|
+
|
|
2389
|
+
function removeConsegnaSQLite(id_consegna) {
|
|
2390
|
+
var query = "update consegne";
|
|
2391
|
+
query += " set removed = 1"
|
|
2392
|
+
query += " where id = " + id_consegna;
|
|
2393
|
+
return query;
|
|
2394
|
+
}
|
|
2395
|
+
|
|
2396
|
+
function removeConsegnaMySQL(id_consegna) {
|
|
2397
|
+
var query = "update consegne";
|
|
2398
|
+
query += " set removed = 1"
|
|
2399
|
+
query += " where id = :id_consegna";
|
|
2400
|
+
return query;
|
|
2401
|
+
}
|
|
2402
|
+
|
|
2403
|
+
|
|
2404
|
+
function queryLastConsegnaIdSQLite() {
|
|
2405
|
+
return "select seq as id from sqlite_sequence where name = 'consegne'";
|
|
2406
|
+
}
|
|
2407
|
+
function queryLastConsegnaIdMySQL() {
|
|
2408
|
+
return "SELECT AUTO_INCREMENT - 1 as CurrentId FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'ALS' AND TABLE_NAME = 'consegne'";
|
|
2409
|
+
}
|
|
2410
|
+
|
|
2411
|
+
|
|
2412
|
+
//get connection types
|
|
2413
|
+
function getConnectionTypesSQLite() {
|
|
2414
|
+
var query = "select id, conn_type from connection_types";
|
|
2415
|
+
return query;
|
|
2416
|
+
}
|
|
2417
|
+
function getConnectionTypesMySQL() {
|
|
2418
|
+
var query = "select id, conn_type from connection_types";
|
|
2419
|
+
return query;
|
|
2420
|
+
}
|
|
2421
|
+
//end get connection types
|
|
2422
|
+
//get connection protocols
|
|
2423
|
+
function getConnectionProtocolsSQLite() {
|
|
2424
|
+
var query = "select id, name from connection_protocols";
|
|
2425
|
+
return query;
|
|
2426
|
+
}
|
|
2427
|
+
function getConnectionProtocolsMySQL() {
|
|
2428
|
+
var query = "select id, name from connection_protocols";
|
|
2429
|
+
return query;
|
|
2430
|
+
}
|
|
2431
|
+
//end get connection protocols
|
|
2432
|
+
//Get Storage types
|
|
2433
|
+
function getStorageTypesSQLite() {
|
|
2434
|
+
var query = "select id, name from storage_types order by exp_order";
|
|
2435
|
+
return query;
|
|
2436
|
+
}
|
|
2437
|
+
function getStorageTypesMySQL() {
|
|
2438
|
+
var query = "select id, name from storage_types order by exp_order";
|
|
2439
|
+
return query;
|
|
2440
|
+
}
|
|
2441
|
+
//end get storage types
|
|
2442
|
+
|
|
2443
|
+
|
|
2444
|
+
//get adapter types
|
|
2445
|
+
function getAdapterTypesSQLite() {
|
|
2446
|
+
var query = "select a.id, concat(c.conn_type, ' -> ', c2.conn_type) as Descrizione from adapter_types a ";
|
|
2447
|
+
query += "join connection_types c on c.id = a.adapt_type_in ";
|
|
2448
|
+
query += "join connection_types c2 on c2.id = a.adapt_type_out ";
|
|
2449
|
+
|
|
2450
|
+
return query;
|
|
2451
|
+
}
|
|
2452
|
+
function getAdapterTypesMySQL() {
|
|
2453
|
+
var query = "select a.id, concat(c.conn_type, ' -> ', c2.conn_type) as Descrizione from adapter_types a ";
|
|
2454
|
+
query += "join connection_types c on c.id = a.adapt_type_in ";
|
|
2455
|
+
query += "join connection_types c2 on c2.id = a.adapt_type_out ";
|
|
2456
|
+
|
|
2457
|
+
return query;
|
|
2458
|
+
}
|
|
2459
|
+
//end get adapter types
|
|
2460
|
+
|
|
2461
|
+
function getLaboratorioByIdSiteSQLite(id_site, id_place) {
|
|
2462
|
+
var query = "select ";
|
|
2463
|
+
query += ""
|
|
2464
|
+
query += "d.id, ";
|
|
2465
|
+
query += "case ";
|
|
2466
|
+
query += "when d.inv_ict3_number is not null and trim(d.inv_ict3_number) <> '' then trim(d.inv_ict3_number) ";
|
|
2467
|
+
query += "when d.inv_tn_number is not null and trim(d.inv_tn_number) <> '' then concat(trim(d.inv_tn_number), '(TN)') ";
|
|
2468
|
+
query += "when d.inv_tndigit_number is not null and trim(d.inv_tndigit_number) <> '' then concat(trim(d.inv_tndigit_number), '(TNDigit)') ";
|
|
2469
|
+
query += "when d.serial_no is not null and trim(d.serial_no) <> '' then concat(trim(d.serial_no), '(SN)') ";
|
|
2470
|
+
query += "else concat(d.id, '(ID)') ";
|
|
2471
|
+
query += "end as Codice, ";
|
|
2472
|
+
query += "d.type as Tipo, ";
|
|
2473
|
+
query += "d.manifacturer as Marca, ";
|
|
2474
|
+
query += "d.model as Modello, ";
|
|
2475
|
+
query += "pl.bancata as Bancata, ";
|
|
2476
|
+
query += "pl.num_pos as Numero, ";
|
|
2477
|
+
query += "dp.pc_name as Nome, ";
|
|
2478
|
+
query += "pl.is_docente as Docente ";
|
|
2479
|
+
query += "from postazione_lab pl ";
|
|
2480
|
+
query += "join devices d on d.id = pl.id_device ";
|
|
2481
|
+
query += "left join device_pc dp on d.id = dp.id_device ";
|
|
2482
|
+
query += "where pl.id_site = " + id_site + " ";
|
|
2483
|
+
query += "and pl.id_place = '" + id_place + "' ";
|
|
2484
|
+
query += "and (d.is_removed is null or d.is_removed = 0) ";
|
|
2485
|
+
query += "order by pl.Bancata asc, pl.num_pos desc ";
|
|
2486
|
+
return query;
|
|
2487
|
+
}
|
|
2488
|
+
function getLaboratorioByIdSiteMySQL(id_site, id_place) {
|
|
2489
|
+
var query = "select ";
|
|
2490
|
+
query += ""
|
|
2491
|
+
query += "d.id, ";
|
|
2492
|
+
query += "case ";
|
|
2493
|
+
query += "when d.inv_ict3_number is not null and trim(d.inv_ict3_number) <> '' then trim(d.inv_ict3_number) ";
|
|
2494
|
+
query += "when d.inv_tn_number is not null and trim(d.inv_tn_number) <> '' then concat(trim(d.inv_tn_number), '(TN)') ";
|
|
2495
|
+
query += "when d.inv_tndigit_number is not null and trim(d.inv_tndigit_number) <> '' then concat(trim(d.inv_tndigit_number), '(TNDigit)') ";
|
|
2496
|
+
query += "when d.serial_no is not null and trim(d.serial_no) <> '' then concat(trim(d.serial_no), '(SN)') ";
|
|
2497
|
+
query += "else concat(d.id, '(ID)') ";
|
|
2498
|
+
query += "end as Codice, ";
|
|
2499
|
+
query += "d.type as Tipo, ";
|
|
2500
|
+
query += "d.manifacturer as Marca, ";
|
|
2501
|
+
query += "d.model as Modello, ";
|
|
2502
|
+
query += "pl.bancata as Bancata, ";
|
|
2503
|
+
query += "pl.num_pos as Numero, ";
|
|
2504
|
+
query += "dp.pc_name as Nome, ";
|
|
2505
|
+
query += "pl.is_docente as Docente ";
|
|
2506
|
+
query += "from postazione_lab pl ";
|
|
2507
|
+
query += "join devices d on d.id = pl.id_device ";
|
|
2508
|
+
query += "left join device_pc dp on d.id = dp.id_device ";
|
|
2509
|
+
query += "where pl.id_site = :id_site ";
|
|
2510
|
+
query += "and pl.id_place = :id_place ";
|
|
2511
|
+
query += "and (d.is_removed is null or d.is_removed = 0) ";
|
|
2512
|
+
query += "order by pl.Bancata asc, pl.num_pos desc ";
|
|
2513
|
+
return query;
|
|
2514
|
+
}
|
|
2515
|
+
// Manage categories
|
|
2516
|
+
function getCategories() {
|
|
2517
|
+
var query = "select DISTINCT categoria from categorie_device ";
|
|
2518
|
+
return query;
|
|
2519
|
+
}
|
|
2520
|
+
|
|
2521
|
+
function assignCategoryFromDBSQLite(dev_type) {
|
|
2522
|
+
var query = "select categoria from categorie_device ";
|
|
2523
|
+
query += "where tipo = '" + dev_type + "'";
|
|
2524
|
+
return query;
|
|
2525
|
+
}
|
|
2526
|
+
function assignCategoryFromDBMySQL(dev_type) {
|
|
2527
|
+
var query = "select categoria from categorie_device ";
|
|
2528
|
+
query += "where tipo = :dev_type";
|
|
2529
|
+
return query;
|
|
2530
|
+
}
|
|
2531
|
+
// end manage categories
|
|
2532
|
+
function getBeniConsumoByIdDeviceSQLite(id_device) {
|
|
2533
|
+
var query = "select Tipo, Marca, Modello from beniconsumo bc ";
|
|
2534
|
+
query += "inner join device_beniconsumo db on db.id_bene = bc.id ";
|
|
2535
|
+
query += "inner join devices d on d.id = db.id_device ";
|
|
2536
|
+
query += "where db.id_device = " + id_device;
|
|
2537
|
+
return query;
|
|
2538
|
+
}
|
|
2539
|
+
|
|
2540
|
+
function getBeniConsumoByIdDeviceMySQL(id_device) {
|
|
2541
|
+
var query = "select Tipo, Marca, Modello from beniconsumo bc ";
|
|
2542
|
+
query += "inner join device_beniconsumo db on db.id_bene = bc.id ";
|
|
2543
|
+
query += "inner join devices d on d.id = db.id_device ";
|
|
2544
|
+
query += "where db.id_device = :id_device";
|
|
2545
|
+
return query;
|
|
2546
|
+
}
|
|
2547
|
+
|
|
2548
|
+
//Manage dismissioni
|
|
2549
|
+
function selectDismissioni() {
|
|
2550
|
+
var query = "select id, identificativo as Identificativo, tipo_identificativo as 'Tipo id', tipo as 'Tipo disp', data as 'Data rilievo', note as 'Note dismiss' from dismissioni";
|
|
2551
|
+
return query;
|
|
2552
|
+
}
|
|
2553
|
+
|
|
2554
|
+
function selectDismissioneByIdSQLite(id_dismiss) {
|
|
2555
|
+
var query = "select id, identificativo, tipo_identificativo, tipo, id_device, data, note, motivo, id_place, id_site from dismissioni ";
|
|
2556
|
+
query += "where id = " + id_dismiss;
|
|
2557
|
+
return query;
|
|
2558
|
+
}
|
|
2559
|
+
function selectDismissioneByIdMySQL(id_dismiss) {
|
|
2560
|
+
var query = "select id, identificativo, tipo_identificativo, tipo, id_device, data, note, motivo, id_place, id_site from dismissioni ";
|
|
2561
|
+
query += "where id = :id_dismiss";
|
|
2562
|
+
return query;
|
|
2563
|
+
}
|
|
2564
|
+
//
|
|
2565
|
+
function insertDismissioneSQLite(dismiss) {
|
|
2566
|
+
var query = "insert into dismissioni ";
|
|
2567
|
+
query += "(data, identificativo, tipo_identificativo, tipo, id_device, note, motivo, id_site, id_place) ";
|
|
2568
|
+
query += " values ('" + dismiss.dr_str + "',";
|
|
2569
|
+
query += "'" + dismiss.Identificativo + "',";
|
|
2570
|
+
query += "'" + dismiss.tipo_identificativo + "',";
|
|
2571
|
+
query += "'" + dismiss.tipo_device + "',";
|
|
2572
|
+
query += dismiss.id_device + ",";
|
|
2573
|
+
query += "'" + dismiss.note + "',";
|
|
2574
|
+
query += "'" + dismiss.motivo + "',";
|
|
2575
|
+
query += dismiss.id_site + ",";
|
|
2576
|
+
query += "'" + dismiss.id_place + "')";
|
|
2577
|
+
return query;
|
|
2578
|
+
}
|
|
2579
|
+
function insertDismissioneMySQL(dismiss) {
|
|
2580
|
+
var query = "insert into dismissioni ";
|
|
2581
|
+
query += "(data, identificativo, tipo_identificativo, tipo, id_device, note, motivo, id_site, id_place) values (";
|
|
2582
|
+
query += ":dr_str, ";
|
|
2583
|
+
query += ":Identificativo, ";
|
|
2584
|
+
query += ":tipo_identificativo, ";
|
|
2585
|
+
query += ":tipo_device, ";
|
|
2586
|
+
query += ":id_device, ";
|
|
2587
|
+
query += ":note, ";
|
|
2588
|
+
query += ":dismiss.motivo, ";
|
|
2589
|
+
query += ":dismiss.id_site, ";
|
|
2590
|
+
query += ":dismiss.id_place)";
|
|
2591
|
+
return query;
|
|
2592
|
+
}
|
|
2593
|
+
//
|
|
2594
|
+
function updateDismissioneSQLite(dismiss) {
|
|
2595
|
+
var query = "update dismissioni ";
|
|
2596
|
+
query += "set id_place = '" + dismiss.id_place + "', ";
|
|
2597
|
+
query += "id_site = " + dismiss.id_site + ", ";
|
|
2598
|
+
query += "id_device = " + dismiss.id_device + ", ";
|
|
2599
|
+
query += "identificativo = '" + dismiss.Identificativo + "', ";
|
|
2600
|
+
query += "tipo_identificativo = '" + dismiss.tipo_identificativo + "', ";
|
|
2601
|
+
query += "tipo = '" + dismiss.tipo_device + "', ";
|
|
2602
|
+
if (dismiss.dr_str.trim() != '')
|
|
2603
|
+
query += "data = '" + dismiss.dr_str + "', ";
|
|
2604
|
+
query += "note = '" + dismiss.note + "', ";
|
|
2605
|
+
query += "motivo = '" + dismiss.motivo + "' ";
|
|
2606
|
+
query += "where id = " + dismiss.id;
|
|
2607
|
+
return query;
|
|
2608
|
+
}
|
|
2609
|
+
function updateDismissioneMySQL(dismiss) {
|
|
2610
|
+
var query = "update dismissioni ";
|
|
2611
|
+
query += "set id_place = :id_place, ";
|
|
2612
|
+
query += "id_site = :id_site, ";
|
|
2613
|
+
query += "id_device = :id_device, ";
|
|
2614
|
+
query += "identificativo = :Identificativo, ";
|
|
2615
|
+
query += "tipo_identificativo = :tipo_identificativo, ";
|
|
2616
|
+
query += "tipo = :tipo_device, ";
|
|
2617
|
+
if (dismiss.dr_str.trim() != '')
|
|
2618
|
+
query += "data = :dr_str, ";
|
|
2619
|
+
query += "note = :note, ";
|
|
2620
|
+
query += "motivo = :motivo ";
|
|
2621
|
+
query += "where id = :id";
|
|
2622
|
+
return query;
|
|
2623
|
+
}
|
|
2624
|
+
//End manage dismissioni
|
|
2625
|
+
|
|
2626
|
+
|
|
2627
|
+
|
|
2628
|
+
// Manage Docs
|
|
2629
|
+
function queryDocumentsIdDeviceSQLite(id_device) {
|
|
2630
|
+
var query = "select c.id, c.tipo, c.data_emissione, c.descrizione from documenti c ";
|
|
2631
|
+
query += "join device_doc dc on dc.id_doc = c.id ";
|
|
2632
|
+
query += "where dc.id_device = " + id_device;
|
|
2633
|
+
return query;
|
|
2634
|
+
}
|
|
2635
|
+
function queryDocumentsIdDeviceMySQL(id_device) {
|
|
2636
|
+
var query = "select c.id, c.tipo, c.data_emissione, c.descrizione from documenti c ";
|
|
2637
|
+
query += "join device_doc dc on dc.id_doc = c.id ";
|
|
2638
|
+
query += "where dc.id_device = :id_device";
|
|
2639
|
+
return query;
|
|
2640
|
+
}
|
|
2641
|
+
|
|
2642
|
+
function getDocumentByIdDocSQLite(id_doc) {
|
|
2643
|
+
var query = "select c.id, c.tipo, c.data_emissione, c.descrizione, c.riferimento, c.nome_originale, c.nome_uuid from documenti c ";
|
|
2644
|
+
query += "where c.id = " + id_doc;
|
|
2645
|
+
return query;
|
|
2646
|
+
}
|
|
2647
|
+
function getDocumentByIdDocMySQL(id_doc) {
|
|
2648
|
+
var query = "select c.id, c.tipo, c.data_emissione, c.descrizione, c.riferimento, c.nome_originale, c.nome_uuid from documenti c ";
|
|
2649
|
+
query += "where c.id = :id_doc";
|
|
2650
|
+
return query;
|
|
2651
|
+
}
|
|
2652
|
+
|
|
2653
|
+
// End Manage Docs
|
|
2654
|
+
// Get Categories by IdDevice
|
|
2655
|
+
function getCategoriesByIdDeviceSQLite(id_device) {
|
|
2656
|
+
var query = "select cd.categoria from categorie_device cd ";
|
|
2657
|
+
query += "join devices d on d.type = cd.tipo ";
|
|
2658
|
+
query += "where d.id = " + id_device;
|
|
2659
|
+
return query;
|
|
2660
|
+
}
|
|
2661
|
+
function getCategoriesByIdDeviceMySQL(id_device) {
|
|
2662
|
+
var query = "select cd.categoria from categorie_device cd ";
|
|
2663
|
+
query += "join devices d on d.type = cd.tipo ";
|
|
2664
|
+
query += "where d.id = :id_device";
|
|
2665
|
+
return query;
|
|
2666
|
+
}
|
|
2667
|
+
//End Get Categories by IdDevice
|
|
2668
|
+
//Get details by type
|
|
2669
|
+
function queryDetailsByIdDeviceSQLite(id_device) {
|
|
2670
|
+
var query = "select pt.tipo, pt.has_connection, pt.has_addons, pt.has_network, pt.has_storage from properties_tipo pt ";
|
|
2671
|
+
query += "join devices d on d.type = pt.tipo ";
|
|
2672
|
+
query += "where d.id = " + id_device;
|
|
2673
|
+
return query;
|
|
2674
|
+
}
|
|
2675
|
+
function queryDetailsByIdDeviceMySQL(id_device) {
|
|
2676
|
+
var query = "select pt.tipo, pt.has_connection, pt.has_addons, pt.has_network, pt.has_storage from properties_tipo pt ";
|
|
2677
|
+
query += "join devices d on d.type = pt.tipo ";
|
|
2678
|
+
query += "where d.id = :id_device";
|
|
2679
|
+
return query;
|
|
2680
|
+
}
|
|
2681
|
+
|
|
2682
|
+
//End Get details by type
|
|
2683
|
+
// Define getConnectionSetById
|
|
2684
|
+
function getConnectionSetByIdSQLite(id_conn_set) {
|
|
2685
|
+
var query = "select id, id_set, id_conn, id_adapter, verse from set_connections ";
|
|
2686
|
+
query += "where id = " + id_conn_set;
|
|
2687
|
+
return query;
|
|
2688
|
+
}
|
|
2689
|
+
function getConnectionSetByIdMySQL(id_conn_set) {
|
|
2690
|
+
|
|
2691
|
+
}
|
|
2692
|
+
// End define getConnectionSetById
|
|
2693
|
+
// Define getConnectionByIdSet
|
|
2694
|
+
function getConnectionByIdSetSQLite(id_set) {
|
|
2695
|
+
var query = "select sc.id, ct.conn_type as Tipo, ";
|
|
2696
|
+
query += "case ";
|
|
2697
|
+
query += "when sc.id_adapter is not null and sc.id_adapter > 0 then concat(ac1.conn_type, ' -> ', ac2.conn_type) ";
|
|
2698
|
+
query += "else '' ";
|
|
2699
|
+
query += "end as Adattatore, ";
|
|
2700
|
+
query += "sc.verse as Verso from set_connections sc ";
|
|
2701
|
+
query += "join connection_types ct on ct.id = sc.id_conn ";
|
|
2702
|
+
query += "left join adapter_types at on sc.id_adapter = at.id ";
|
|
2703
|
+
query += "left join connection_types ac1 on at.adapt_type_in = ac1.id ";
|
|
2704
|
+
query += "left join connection_types ac2 on at.adapt_type_out = ac2.id ";
|
|
2705
|
+
query += "where id_set = " + id_set;
|
|
2706
|
+
return query;
|
|
2707
|
+
}
|
|
2708
|
+
function getConnectionByIdSetMySQL(id_set) {
|
|
2709
|
+
var query = "select sc.id, ct.conn_type as Tipo, ";
|
|
2710
|
+
query += "case ";
|
|
2711
|
+
query += "when sc.id_adapter is not null and sc.id_adapter > 0 then concat(ac1.conn_type, ' -> ', ac2.conn_type) ";
|
|
2712
|
+
query += "else '' ";
|
|
2713
|
+
query += "end as Adattatore, ";
|
|
2714
|
+
query += "sc.verse as Verso from set_connections sc ";
|
|
2715
|
+
query += "join connection_types ct on ct.id = sc.id_conn ";
|
|
2716
|
+
query += "left join adapter_types at on sc.id_adapter = at.id ";
|
|
2717
|
+
query += "left join connection_types ac1 on at.adapt_type_in = ac1.id ";
|
|
2718
|
+
query += "left join connection_types ac2 on at.adapt_type_out = ac2.id ";
|
|
2719
|
+
query += "where id_set = :id_set";
|
|
2720
|
+
}
|
|
2721
|
+
//End Define getConnectionByIdSet
|
|
2722
|
+
// Define updateConnectionSet
|
|
2723
|
+
function updateConnectionSetSQLite(id_set, id_conn_set, id_conn, verse, id_adapter) {
|
|
2724
|
+
var query = "update set_connections set ";
|
|
2725
|
+
if (id_set && id_set > 0) {
|
|
2726
|
+
query += "id_set = " + id_set + ", ";
|
|
2727
|
+
}
|
|
2728
|
+
if (id_conn && id_conn > 0) {
|
|
2729
|
+
query += "id_conn = " + id_conn + ", ";
|
|
2730
|
+
}
|
|
2731
|
+
if (id_adapter && id_adapter > 0) {
|
|
2732
|
+
query += "id_adapter = " + id_adapter + ", ";
|
|
2733
|
+
}
|
|
2734
|
+
if (verse) {
|
|
2735
|
+
query += "verse = '" + verse + "' ";
|
|
2736
|
+
}
|
|
2737
|
+
query += "where id = " + id_conn_set;
|
|
2738
|
+
return query;
|
|
2739
|
+
}
|
|
2740
|
+
function updateConnectionSetMySQL(id_set, id_conn_set, id_conn, verse, id_adapter) {
|
|
2741
|
+
|
|
2742
|
+
}
|
|
2743
|
+
// end define updateConnectionSet
|
|
2744
|
+
// Define insertConnectionSet
|
|
2745
|
+
function insertConnectionSetSQLite(id_set, id_conn, verse, id_adapter) {
|
|
2746
|
+
var query = "insert into set_connections (id_set, id_conn, id_adapter, verse) values ";
|
|
2747
|
+
query += "(" + id_set + ", ";
|
|
2748
|
+
query += id_conn + ", ";
|
|
2749
|
+
query += id_adapter + ", ";
|
|
2750
|
+
query += "'" + verse + "')";
|
|
2751
|
+
return query;
|
|
2752
|
+
}
|
|
2753
|
+
function insertConnectionSetMySQL(id_set, id_conn, verse, id_adapter) {
|
|
2754
|
+
|
|
2755
|
+
}
|
|
2756
|
+
// end define insertConnectionSet
|
|
2757
|
+
// Define removeConnectionSet
|
|
2758
|
+
function removeConnectionSetSQLite(id_set, id_conn_set) {
|
|
2759
|
+
var query = "delete from set_connections ";
|
|
2760
|
+
query += "where id = " + id_conn_set + " ";
|
|
2761
|
+
query += "and id_set = " + id_set;
|
|
2762
|
+
return query;
|
|
2763
|
+
}
|
|
2764
|
+
function removeConnectionSetMySQL(id_set, id_conn_set, id_conn, id_adapter, verse) {
|
|
2765
|
+
|
|
2766
|
+
}
|
|
2767
|
+
// end define removeConnectionSet
|
|
2768
|
+
// Code added here will be run once
|
|
2769
|
+
// whenever the node is started.
|
|
2770
|
+
// Define the function
|
|
2771
|
+
function getBeniConsumo() {
|
|
2772
|
+
var query = "select id, Tipo, Marca, Modello, Quantitativo from beniconsumo";
|
|
2773
|
+
query += " order by Tipo";
|
|
2774
|
+
return query;
|
|
2775
|
+
}
|
|
2776
|
+
|
|
2777
|
+
function getBeniConsumoNotNull() {
|
|
2778
|
+
var query = "select id, Tipo, Marca, Modello, Quantitativo, "
|
|
2779
|
+
query += " (select count() from device_beniconsumo where id_bene = bc.id) as Usati"
|
|
2780
|
+
query += " from beniconsumo bc";
|
|
2781
|
+
query += " where bc.Quantitativo - Usati > 0"
|
|
2782
|
+
query += " order by Tipo";
|
|
2783
|
+
return query;
|
|
2784
|
+
}
|
|
2785
|
+
//
|
|
2786
|
+
function getBeneConsumoUsatoSQLite(id_device, id_bene) {
|
|
2787
|
+
var query = "select b.id, b.tipo, b.marca, b.modello, db.numero from device_beniconsumo db ";
|
|
2788
|
+
query += "join beniconsumo b on b.id = db.id_bene ";
|
|
2789
|
+
query += "where db.id_bene = " + id_bene + " and db.id_device = " + id_device;
|
|
2790
|
+
return query;
|
|
2791
|
+
}
|
|
2792
|
+
function getBeneConsumoUsatoMySQL(id_device, id_bene) {
|
|
2793
|
+
var query = "select b.id, b.tipo, b.marca, b.modello, db.numero from device_beniconsumo db ";
|
|
2794
|
+
query += "join beniconsumo b on b.id = db.id_bene ";
|
|
2795
|
+
query += "where db.id_bene = :id_bene and db.id_device = :id_device";
|
|
2796
|
+
return query;
|
|
2797
|
+
}
|
|
2798
|
+
//
|
|
2799
|
+
function getBeneConsumoByIdSQLite(id_bene) {
|
|
2800
|
+
var query = "select id, tipo, marca, modello, quantitativo from beniconsumo ";
|
|
2801
|
+
query += "where id = " + id_bene;
|
|
2802
|
+
return query;
|
|
2803
|
+
}
|
|
2804
|
+
function getBeneConsumoByIdMySQL(id_bene) {
|
|
2805
|
+
var query = "select id, tipo, marca, modello, quantitativo from beniconsumo ";
|
|
2806
|
+
query += "where id :id_bene";
|
|
2807
|
+
return query;
|
|
2808
|
+
}
|
|
2809
|
+
//
|
|
2810
|
+
function insertBeneConsumoAbbinatoSQLite(id_device, id_bene, numero) {
|
|
2811
|
+
var query = "insert into device_beniconsumo (id_device, id_bene, numero) values ";
|
|
2812
|
+
query += "(" + id_device + ", " + id_bene + " ," + numero + ")";
|
|
2813
|
+
return query;
|
|
2814
|
+
}
|
|
2815
|
+
function insertBeneConsumoAbbinatoMySQL(id_device, id_bene, numero) {
|
|
2816
|
+
var query = "insert into device_beniconsumo (id_device, id_bene, numero) values ";
|
|
2817
|
+
query += "(:id_device, :id_bene, :numero)";
|
|
2818
|
+
return query;
|
|
2819
|
+
}
|
|
2820
|
+
//
|
|
2821
|
+
function updateBeneConsumoAbbinatoSQLite(id_device, id_bene, numero) {
|
|
2822
|
+
var query = "update device_beniconsumo ";
|
|
2823
|
+
query += "set numero = " + numero + " ";
|
|
2824
|
+
query += "where id_device = " + id_device + " and id_bene = " + id_bene;
|
|
2825
|
+
return query;
|
|
2826
|
+
}
|
|
2827
|
+
function updateBeneConsumoAbbinatoMySQL(id_device, id_bene, numero) {
|
|
2828
|
+
var query = "update device_beniconsumo ";
|
|
2829
|
+
query += "set numero = :numero ";
|
|
2830
|
+
query += "where id_device = :id_device and id_bene = :id_bene";
|
|
2831
|
+
return query;
|
|
2832
|
+
}
|
|
2833
|
+
//
|
|
2834
|
+
function existBeneAbbinatoSQLite(id_device, id_bene) {
|
|
2835
|
+
var query = "select count(id_device) as numero from device_beniconsumo ";
|
|
2836
|
+
query += "where id_device = " + id_device + " and id_bene = " + id_bene;
|
|
2837
|
+
return query;
|
|
2838
|
+
}
|
|
2839
|
+
function existBeneAbbinatoMySQL(id_device, id_bene) {
|
|
2840
|
+
var query = "select count(id_device) as numero from device_beniconsumo ";
|
|
2841
|
+
query += "where id_device :id_device and id_bene = :id_bene";
|
|
2842
|
+
return query;
|
|
2843
|
+
}
|
|
2844
|
+
// end of source
|
|
2845
|
+
|
|
2846
|
+
|
|
2847
|
+
|
|
2848
|
+
// Code added here will be run once
|
|
2849
|
+
// whenever the node is started.
|
|
2850
|
+
function queryPlaces() {
|
|
2851
|
+
var query = "SELECT mark, name from places";
|
|
2852
|
+
return query;
|
|
2853
|
+
}
|
|
2854
|
+
|
|
2855
|
+
function queryFloorsByPlaceSQLite(id_place) {
|
|
2856
|
+
var query = "SELECT DISTINCT floor from sites";
|
|
2857
|
+
query += " where id_place = '" + id_place + "'";
|
|
2858
|
+
query += " order by floor";
|
|
2859
|
+
return query;
|
|
2860
|
+
}
|
|
2861
|
+
|
|
2862
|
+
function queryFloorsByPlaceMySQL(id_place) {
|
|
2863
|
+
var query = "SELECT DISTINCT floor from sites ";
|
|
2864
|
+
query += "where id_place = :id_place";
|
|
2865
|
+
query += " order by floor";
|
|
2866
|
+
return query;
|
|
2867
|
+
}
|
|
2868
|
+
|
|
2869
|
+
function queryFunzioneByPlaceAndFloorSQLite(id_place, piano) {
|
|
2870
|
+
var query = "";
|
|
2871
|
+
query = "SELECT DISTINCT sd.type as funzione from site_destinations sd";
|
|
2872
|
+
query += " JOIN sites s ON s.id = sd.id_site"
|
|
2873
|
+
if (id_place) {
|
|
2874
|
+
query += " where date('now') >= sd.date_start and date('now') <= sd.date_end";
|
|
2875
|
+
query += " and sd.id_place = '" + id_place + "'";
|
|
2876
|
+
if (piano) {
|
|
2877
|
+
query += " and s.floor = '" + piano + "'";
|
|
2878
|
+
}
|
|
2879
|
+
}
|
|
2880
|
+
query += " order by funzione";
|
|
2881
|
+
return query;
|
|
2882
|
+
|
|
2883
|
+
}
|
|
2884
|
+
|
|
2885
|
+
function queryFunzioneByPlaceAndFloorMySQL(id_place, piano) {
|
|
2886
|
+
var query = "";
|
|
2887
|
+
query = "SELECT DISTINCT sd.type as funzione from site_destinations sd";
|
|
2888
|
+
query += " JOIN sites s ON s.id = sd.id_site"
|
|
2889
|
+
if (id_place) {
|
|
2890
|
+
query += " where CURDATE() >= sd.date_start and CURDATE() <= sd.date_end";
|
|
2891
|
+
query += " and sd.id_place = :id_place";
|
|
2892
|
+
if (piano) {
|
|
2893
|
+
query += " and s.floor = :piano";
|
|
2894
|
+
}
|
|
2895
|
+
}
|
|
2896
|
+
query += " order by funzione";
|
|
2897
|
+
return query;
|
|
2898
|
+
|
|
2899
|
+
}
|
|
2900
|
+
|
|
2901
|
+
|
|
2902
|
+
function querySitesSQLite(place, piano, funzione) {
|
|
2903
|
+
var query = "SELECT site_destinations.id_site as id, sites.id_place as Plesso, site_destinations.name as Nome, sites.mark as Codice, sites.floor as Piano, site_destinations.type as Funzione from site_destinations";
|
|
2904
|
+
query += " LEFT JOIN sites ON sites.id = site_destinations.id_site"
|
|
2905
|
+
query += " where date('now') >= site_destinations.date_start and date('now') <= site_destinations.date_end";
|
|
2906
|
+
|
|
2907
|
+
if (place) {
|
|
2908
|
+
query += " and sites.id_place = '" + place + "'";
|
|
2909
|
+
}
|
|
2910
|
+
if (funzione) {
|
|
2911
|
+
query += " and site_destinations.type = '" + funzione + "'";
|
|
2912
|
+
}
|
|
2913
|
+
|
|
2914
|
+
if (piano) {
|
|
2915
|
+
query += " and sites.floor = '" + piano + "'";
|
|
2916
|
+
}
|
|
2917
|
+
query += " order by sites.id_place, sites.floor";
|
|
2918
|
+
return query;
|
|
2919
|
+
}
|
|
2920
|
+
|
|
2921
|
+
function querySitesMySQL(place, piano, funzione) {
|
|
2922
|
+
var query = "SELECT DISTINCT site_destinations.id_site as id, sites.id_place as Plesso, site_destinations.name as Nome, sites.mark as Codice, sites.floor as Piano, site_destinations.type as Funzione from site_destinations";
|
|
2923
|
+
query += " LEFT JOIN sites ON sites.id = site_destinations.id_site"
|
|
2924
|
+
query += " where CURDATE() >= site_destinations.date_start and CURDATE() <= site_destinations.date_end";
|
|
2925
|
+
|
|
2926
|
+
if (place) {
|
|
2927
|
+
query += " and sites.id_place = :id_place";
|
|
2928
|
+
}
|
|
2929
|
+
if (funzione) {
|
|
2930
|
+
query += " and site_destinations.type = :funzione";
|
|
2931
|
+
}
|
|
2932
|
+
|
|
2933
|
+
if (piano) {
|
|
2934
|
+
query += " and sites.floor = :piano";
|
|
2935
|
+
}
|
|
2936
|
+
query += " order by sites.id_place, sites.floor";
|
|
2937
|
+
return query;
|
|
2938
|
+
}
|
|
2939
|
+
|
|
2940
|
+
|
|
2941
|
+
//Sites by devices
|
|
2942
|
+
function getSitesFromDeviceSQLite(id_device, prec_pos) {
|
|
2943
|
+
var query = "SELECT places.mark as Sigla, places.name as Plesso, site_destinations.name as Aula, site_destinations.type as Funzione, sites.floor as Piano from device_site";
|
|
2944
|
+
query += " JOIN sites ON sites.id = device_site.id_site";
|
|
2945
|
+
query += " JOIN site_destinations ON site_destinations.id_site = device_site.id_site";
|
|
2946
|
+
query += " JOIN places ON places.mark = site_destinations.id_place";
|
|
2947
|
+
if (prec_pos == 1) {
|
|
2948
|
+
query += " where device_site.id_device = " + id_device;
|
|
2949
|
+
}
|
|
2950
|
+
else {
|
|
2951
|
+
query += " where (date('now') >= device_site.date_in and date('now') <= device_site.date_out) and";
|
|
2952
|
+
query += " device_site.id_device = " + id_device;
|
|
2953
|
+
}
|
|
2954
|
+
query += " order by site_destinations.name, sites.floor";
|
|
2955
|
+
return query;
|
|
2956
|
+
}
|
|
2957
|
+
function getSitesFromDeviceMySQL(id_device, prec_pos) {
|
|
2958
|
+
var query = "SELECT places.mark as Sigla, places.name as Plesso, site_destinations.name as Aula, site_destinations.type as Funzione, sites.floor as Piano from device_site";
|
|
2959
|
+
query += " JOIN sites ON sites.id = device_site.id_site";
|
|
2960
|
+
query += " JOIN site_destinations ON site_destinations.id_site = device_site.id_site";
|
|
2961
|
+
query += " JOIN places ON places.mark = site_destinations.id_place";
|
|
2962
|
+
if (prec_pos == 1) {
|
|
2963
|
+
query += " where device_site.id_device = :id_device";
|
|
2964
|
+
}
|
|
2965
|
+
else {
|
|
2966
|
+
query += " where (CURDATE() >= device_site.date_in and CURDATE() <= device_site.date_out) and";
|
|
2967
|
+
query += " device_site.id_device = :id_device";
|
|
2968
|
+
}
|
|
2969
|
+
query += " order by site_destinations.name, sites.floor";
|
|
2970
|
+
return query;
|
|
2971
|
+
}
|
|
2972
|
+
//End Sites by devices
|
|
2973
|
+
//Sites from device with date
|
|
2974
|
+
function getSitesWithDatesFromDeviceSQLite(id_device) {
|
|
2975
|
+
var query = "SELECT ds.date_in as 'Data inizio', ds.date_out as 'Data fine', sd.id_place as Plesso, s.mark as Sigla, sd.name as Destinazione from device_site ds ";
|
|
2976
|
+
query += "join site_destinations sd on sd.id_site = ds.id_site ";
|
|
2977
|
+
query += "join sites s on s.id = sd.id_site ";
|
|
2978
|
+
query += "where ds.id_device = " + id_device;
|
|
2979
|
+
query += " order by date_in";
|
|
2980
|
+
return query;
|
|
2981
|
+
}
|
|
2982
|
+
|
|
2983
|
+
function getSitesWithDatesFromDeviceMySQL(id_device) {
|
|
2984
|
+
var query = "SELECT ds.date_in as 'Data inizio', ds.date_out as 'Data fine', sd.id_place as Plesso, s.mark as Sigla, sd.name as Destinazione from device_site ds ";
|
|
2985
|
+
query += "join site_destinations sd on sd.id_site = ds.id_site ";
|
|
2986
|
+
query += "join sites s on s.id = sd.id_site ";
|
|
2987
|
+
query += "where ds.id_device = :id_device ";
|
|
2988
|
+
query += "order by date_in";
|
|
2989
|
+
return query;
|
|
2990
|
+
}
|
|
2991
|
+
|
|
2992
|
+
// Query Sites with Default
|
|
2993
|
+
|
|
2994
|
+
function querySitesWithDefaultsSQLite(def_values) {
|
|
2995
|
+
var where_clause = "";
|
|
2996
|
+
if (def_values && (def_values.site_place || def_values.site_floor || def_values.site_type)) {
|
|
2997
|
+
where_clause = " and ";
|
|
2998
|
+
if (def_values.site_place) {
|
|
2999
|
+
where_clause += "s.id_place = '" + def_values.site_place + "'";
|
|
3000
|
+
if (def_values.site_floor || def_values.site_type) {
|
|
3001
|
+
where_clause += " and ";
|
|
3002
|
+
}
|
|
3003
|
+
}
|
|
3004
|
+
if (def_values.site_floor) {
|
|
3005
|
+
where_clause += "s.floor = '" + def_values.site_floor + "'";
|
|
3006
|
+
if (def_values.site_type) {
|
|
3007
|
+
where_clause += " and ";
|
|
3008
|
+
}
|
|
3009
|
+
}
|
|
3010
|
+
if (def_values.type) {
|
|
3011
|
+
where_clause += "s.type = '" + def_values.site_type + "'";
|
|
3012
|
+
}
|
|
3013
|
+
}
|
|
3014
|
+
|
|
3015
|
+
var query = "select s.id, s.id_place as Plesso, p.name as Denominazione, sd.name as Destinazione, s.mark as Codice, sd.type as Tipo from sites s ";
|
|
3016
|
+
query += "join site_destinations sd on sd.id_site = s.id ";
|
|
3017
|
+
query += "join places p on p.mark = s.id_place ";
|
|
3018
|
+
query += "where date('now') >= sd.date_start and date('now') <= sd.date_end ";
|
|
3019
|
+
query += where_clause;
|
|
3020
|
+
query += " order by sd.id_place, s.mark";
|
|
3021
|
+
return query;
|
|
3022
|
+
}
|
|
3023
|
+
|
|
3024
|
+
function querySitesWithDefaultsMySQL(def_values) {
|
|
3025
|
+
var where_clause = "";
|
|
3026
|
+
if (def_values) {
|
|
3027
|
+
where_clause = " and ";
|
|
3028
|
+
if (def_values.id_place) {
|
|
3029
|
+
where_clause += "s.id_place = :site_place";
|
|
3030
|
+
if (def_values.floor || def_values.type) {
|
|
3031
|
+
where_clause += " and ";
|
|
3032
|
+
}
|
|
3033
|
+
}
|
|
3034
|
+
if (def_values.floor) {
|
|
3035
|
+
where_clause += "s.floor = :site_floor";
|
|
3036
|
+
if (def_values.type) {
|
|
3037
|
+
where_clause += " and ";
|
|
3038
|
+
}
|
|
3039
|
+
}
|
|
3040
|
+
if (def_values.type) {
|
|
3041
|
+
where_clause += "s.type = :site_type";
|
|
3042
|
+
}
|
|
3043
|
+
}
|
|
3044
|
+
|
|
3045
|
+
var query = "select s.id, s.id_place as Plesso, p.name as Denominazione, sd.name as Destinazione, s.mark as Codice, sd.type as Tipo from sites s ";
|
|
3046
|
+
query += "join site_destinations sd on sd.id_site = s.id ";
|
|
3047
|
+
query += "join places p on p.mark = s.id_place ";
|
|
3048
|
+
query += "where CURDATE() >= sd.date_start and CURDATE() <= sd.date_end ";
|
|
3049
|
+
query += where_clause;
|
|
3050
|
+
query += " order by sd.id_place, s.mark";
|
|
3051
|
+
return query;
|
|
3052
|
+
}
|
|
3053
|
+
|
|
3054
|
+
function getPorteByIdSiteSQLite(id_site) {
|
|
3055
|
+
var query = "select port_type as Tipo, port_sign as Porta, note as Note from site_ports sp ";
|
|
3056
|
+
query += "where sp.id_site = " + id_site;
|
|
3057
|
+
return query;
|
|
3058
|
+
}
|
|
3059
|
+
|
|
3060
|
+
function getPorteByIdSiteMySQL(id_site) {
|
|
3061
|
+
var query = "select port_type as Tipo, port_sign as Porta, note as Note from site_ports sp ";
|
|
3062
|
+
query += "where sp.id_site = :id_site";
|
|
3063
|
+
return query;
|
|
3064
|
+
}
|
|
3065
|
+
// Manage updateDevicesSite
|
|
3066
|
+
function verifyPrevDeviceSiteSQLite(id_device) {
|
|
3067
|
+
var query = "select count(id_site) as numero from device_site ";
|
|
3068
|
+
query += "where id_device = " + id_device;
|
|
3069
|
+
return query;
|
|
3070
|
+
}
|
|
3071
|
+
function verifyPrevDeviceSiteMySQL(id_device) {
|
|
3072
|
+
var query = "select count(id_site) as numero from device_site ";
|
|
3073
|
+
query += "where id_device = :id_device";
|
|
3074
|
+
return query;
|
|
3075
|
+
}
|
|
3076
|
+
|
|
3077
|
+
function removeDeviceSiteSQLite(id_site, id_place, id_device) {
|
|
3078
|
+
|
|
3079
|
+
}
|
|
3080
|
+
function removeDeviceSiteMySQL(id_site, id_place, id_device) {
|
|
3081
|
+
|
|
3082
|
+
}
|
|
3083
|
+
|
|
3084
|
+
|
|
3085
|
+
function updateDeviceSiteSQLite(id_device) {
|
|
3086
|
+
var query = "update device_site set date_out = date('now','-1 day') ";
|
|
3087
|
+
query += "where id_device = " + id_device + " and date_in = (select max(date_in) from device_site where id_device = " + id_device + ")";
|
|
3088
|
+
return query;
|
|
3089
|
+
}
|
|
3090
|
+
function updateDeviceSiteMySQL(id_device) {
|
|
3091
|
+
var query = "update device_site set date_out = date('now','-1 day') ";
|
|
3092
|
+
query += "where id_device = :id_device and date_in = (select max(date_in) from device_site where id_device = :id_device)";
|
|
3093
|
+
return query;
|
|
3094
|
+
}
|
|
3095
|
+
// end manage updateDevicesSite
|
|
3096
|
+
// Manage insertDeviceSite
|
|
3097
|
+
function insertDeviceSiteSQLite(id_device, id_place, id_site, start_date) {
|
|
3098
|
+
var query = "insert into device_site (date_in, date_out, id_device, id_site, id_place) ";
|
|
3099
|
+
query += "values (";
|
|
3100
|
+
if ((!start_date || start_date == '') || start_date == "TODAY") {
|
|
3101
|
+
query += "date('now'),";
|
|
3102
|
+
}
|
|
3103
|
+
else {
|
|
3104
|
+
query += "'" + start_date + "',";
|
|
3105
|
+
}
|
|
3106
|
+
query += "'2999-12-31',";
|
|
3107
|
+
query += id_device + ",";
|
|
3108
|
+
query += id_site + ",";
|
|
3109
|
+
query += "'" + id_place + "'";
|
|
3110
|
+
query += ")";
|
|
3111
|
+
return query;
|
|
3112
|
+
}
|
|
3113
|
+
function insertDeviceSiteMySQL(id_device, id_place, id_site, start_date) {
|
|
3114
|
+
var query = "insert into device_site (date_in, date_out, id_device, id_site, id_place) ";
|
|
3115
|
+
query += "values (";
|
|
3116
|
+
if ((!start_date || start_date == '') || start_date == "TODAY") {
|
|
3117
|
+
query += "CURDATE(),";
|
|
3118
|
+
}
|
|
3119
|
+
else {
|
|
3120
|
+
query += ":start_date,";
|
|
3121
|
+
}
|
|
3122
|
+
query += "'2999-12-31',";
|
|
3123
|
+
query += ":id_device,";
|
|
3124
|
+
query += ":id_site,";
|
|
3125
|
+
query += ":id_place";
|
|
3126
|
+
query += ")";
|
|
3127
|
+
return query;
|
|
3128
|
+
}
|
|
3129
|
+
// end manage updateDevicesSite
|
|
3130
|
+
//Get Sites for Combo
|
|
3131
|
+
function getSitesSelectComboSQLite(id_place, tipo_aula) {
|
|
3132
|
+
var query = "select s.id, concat(p.name, ' - ', sd.name, ' - ', s.mark) as Descrizione from sites s ";
|
|
3133
|
+
query += "join site_destinations sd on sd.id_site = s.id ";
|
|
3134
|
+
query += "join places p on p.mark = s.id_place ";
|
|
3135
|
+
query += "where date('now') >= sd.date_start and date('now') <= sd.date_end ";
|
|
3136
|
+
if (id_place || tipo_aula) {
|
|
3137
|
+
if (id_place && id_place != "") {
|
|
3138
|
+
query += "and s.id_place = '" + id_place +"' ";
|
|
3139
|
+
}
|
|
3140
|
+
if (tipo_aula && tipo_aula != "ALL") {
|
|
3141
|
+
query += "and sd.type = '" + tipo_aula + "' ";
|
|
3142
|
+
}
|
|
3143
|
+
}
|
|
3144
|
+
else {
|
|
3145
|
+
if (!tipo_aula || tipo_aula == "ALL")
|
|
3146
|
+
query += "and sd.type in ('DIDATTICA', 'LABORATORIO', 'UFFICIO', 'SERVIZIO') ";
|
|
3147
|
+
}
|
|
3148
|
+
query += "order by p.name, s.floor, sd.name ";
|
|
3149
|
+
return query;
|
|
3150
|
+
}
|
|
3151
|
+
|
|
3152
|
+
function getSitesSelectComboMySQL(id_place, tipo_aula) {
|
|
3153
|
+
var query = "select s.id, concat(p.name, ' - ', sd.name, ' - ', s.mark) as Descrizione from sites s ";
|
|
3154
|
+
query += "join site_destinations sd on sd.id_site = s.id ";
|
|
3155
|
+
query += "join places p on p.mark = s.id_place ";
|
|
3156
|
+
query += "where CURDATE() >= sd.date_start and CURDATE() <= sd.date_end ";
|
|
3157
|
+
if (id_place || tipo_aula) {
|
|
3158
|
+
if (id_place && id_place != "") {
|
|
3159
|
+
query += "and s.id_place = :id_place ";
|
|
3160
|
+
}
|
|
3161
|
+
if (tipo_aula && tipo_aula != "ALL") {
|
|
3162
|
+
query += "and sd.type = :tipo_aula ";
|
|
3163
|
+
}
|
|
3164
|
+
}
|
|
3165
|
+
else {
|
|
3166
|
+
if (!tipo_aula || tipo_aula == "ALL")
|
|
3167
|
+
query += "and sd.type in ('DIDATTICA', 'LABORATORIO', 'UFFICIO', 'SERVIZIO') ";
|
|
3168
|
+
}
|
|
3169
|
+
query += "order by p.name, s.floor, sd.name ";
|
|
3170
|
+
return query;
|
|
3171
|
+
}
|
|
3172
|
+
|
|
3173
|
+
//End get sites for combo
|
|
3174
|
+
//Get Sites by Id
|
|
3175
|
+
function getSiteByIdSQLite(id_site) {
|
|
3176
|
+
var query = "select s.id, s.id_place as Plesso, p.name as Denominazione, sd.name as Destinazione, s.mark as Codice, sd.type as Tipo from sites s ";
|
|
3177
|
+
query += "join site_destinations sd on sd.id_site = s.id ";
|
|
3178
|
+
query += "join places p on p.mark = s.id_place ";
|
|
3179
|
+
query += "where date('now') >= sd.date_start and date('now') <= sd.date_end ";
|
|
3180
|
+
query += "and s.id = " + id_site;
|
|
3181
|
+
return query;
|
|
3182
|
+
}
|
|
3183
|
+
|
|
3184
|
+
function getSiteByIdMySQL(id_site) {
|
|
3185
|
+
var query = "select s.id, s.id_place as Plesso, p.name as Denominazione, sd.name as Destinazione, s.mark as Codice, sd.type as Tipo from sites s ";
|
|
3186
|
+
query += "join site_destinations sd on sd.id_site = s.id ";
|
|
3187
|
+
query += "join places p on p.mark = s.id_place ";
|
|
3188
|
+
query += "where CURDATE() >= sd.date_start and CURDATE() <= sd.date_end ";
|
|
3189
|
+
query += "and s.id = :id_site";
|
|
3190
|
+
return query;
|
|
3191
|
+
}
|
|
3192
|
+
|
|
3193
|
+
//End get site by id
|
|
3194
|
+
// Get Labs from Place
|
|
3195
|
+
function querySitesLabSQLite(id_place) {
|
|
3196
|
+
var query = "SELECT sd.id_site as id, s.id_place as Plesso, sd.name as Nome, s.mark as Codice, s.floor as Piano, sd.type as Funzione from site_destinations sd ";
|
|
3197
|
+
query += "join sites s on s.id = sd.id_site "
|
|
3198
|
+
query += "where s.id_place = '" + id_place + "' ";
|
|
3199
|
+
query += "and s.id in (select id_site from postazione_lab where id_place = '" + id_place + "') ";
|
|
3200
|
+
return query;
|
|
3201
|
+
}
|
|
3202
|
+
function querySitesLabMySQL(id_place) {
|
|
3203
|
+
var query = "SELECT sd.id_site as id, s.id_place as Plesso, sd.name as Nome, s.mark as Codice, s.floor as Piano, sd.type as Funzione from site_destinations sd ";
|
|
3204
|
+
query += "join sites s on s.id = sd.id_site "
|
|
3205
|
+
query += "where s.id_place = :id_place ";
|
|
3206
|
+
query += "and s.id in (select id_site from postazione_lab where id_place = :id_place) ";
|
|
3207
|
+
}
|
|
3208
|
+
|
|
3209
|
+
//end get labs from place
|
|
3210
|
+
//Define removeSiteBySet
|
|
3211
|
+
function removeSiteBySetSQLite(id_device) {
|
|
3212
|
+
var query = "delete from device_site where id_device in ";
|
|
3213
|
+
query += "(select dt.id_relateddevice from device_set dt ";
|
|
3214
|
+
query += "left join device_site ds on dt.id_maindevice = ds.id_device ";
|
|
3215
|
+
query += "where dt.id_maindevice = " + id_device + " ";
|
|
3216
|
+
query += "and (date('now') >= ds.date_in and date('now') <= ds.date_out)";
|
|
3217
|
+
query += ")";
|
|
3218
|
+
return query;
|
|
3219
|
+
}
|
|
3220
|
+
function removeSiteBySetMySQL(id_device) {
|
|
3221
|
+
var query = "delete from device_site where id_device in ";
|
|
3222
|
+
query += "(select dt.id_relateddevice from device_set dt ";
|
|
3223
|
+
query += "left join device_site ds on dt.id_maindevice = ds.id_device ";
|
|
3224
|
+
query += "where dt.id_maindevice = :id_device ";
|
|
3225
|
+
query += "and (date('now') >= ds.date_in and date('now') <= ds.date_out)";
|
|
3226
|
+
query += ")";
|
|
3227
|
+
return query;
|
|
3228
|
+
}
|
|
3229
|
+
//End define removeSiteBySet
|
|
3230
|
+
|
|
3231
|
+
// Define updateSiteBySet
|
|
3232
|
+
function updateSiteBySetSQLite(id_device) {
|
|
3233
|
+
var query = "update device_site set date_out = date('now','-1 day'), date_in = date('now','-1 day') where id_device in "
|
|
3234
|
+
query += "(select dt.id_relateddevice from device_set dt ";
|
|
3235
|
+
query += "where dt.id_maindevice = " + id_device + ")";
|
|
3236
|
+
query += "and date('now') >= date_in and date('now') <= date_out"
|
|
3237
|
+
return query;
|
|
3238
|
+
}
|
|
3239
|
+
function updateSiteBySetMySQL(id_device) {
|
|
3240
|
+
var query = "update device_site set date_out = date_in where id_device in "
|
|
3241
|
+
query += "(select dt.id_relateddevice from device_set dt ";
|
|
3242
|
+
query += "where dt.id_maindevice = :id_device)";
|
|
3243
|
+
return query;
|
|
3244
|
+
}
|
|
3245
|
+
// End define updateSiteBySet
|
|
3246
|
+
// Define insertSiteBySet
|
|
3247
|
+
function insertSiteBySetSQLite(id_device) {
|
|
3248
|
+
var query = "insert into device_site (id_site, id_place, date_in, date_out, id_device) ";
|
|
3249
|
+
query += "select das.id_site, das.id_place, date('now'), '2999-12-31', d.id from devices d ";
|
|
3250
|
+
query += "join device_set ds on ds.id_relateddevice = d.id ";
|
|
3251
|
+
query += "join device_as_site das on das.id_device = ds.id_maindevice ";
|
|
3252
|
+
query += "where ds.id_maindevice = " + id_device;
|
|
3253
|
+
return query;
|
|
3254
|
+
}
|
|
3255
|
+
function insertSiteBySetMySQL(id_device) {
|
|
3256
|
+
var query = "insert into device_site (id_site, id_place, date_in, date_out, id_device) ";
|
|
3257
|
+
query += "select das.id_site, das.id_place, date('now'), '2999-12-31', d.id from devices d ";
|
|
3258
|
+
query += "join device_set ds on ds.id_relateddevice = d.id ";
|
|
3259
|
+
query += "join device_as_site das on das.id_device = ds.id_maindevice ";
|
|
3260
|
+
query += "where ds.id_maindevice = :id_device";
|
|
3261
|
+
return query;
|
|
3262
|
+
}
|
|
3263
|
+
//End define insertSiteBySet
|
|
3264
|
+
// Define insertSiteBySet
|
|
3265
|
+
function insertSiteBySetParamSQLite(id_device, id_site, id_place, start_date) {
|
|
3266
|
+
var query = "insert into device_site (id_site, id_place, date_in, date_out, id_device) ";
|
|
3267
|
+
query += "select " + id_site + ", " + id_place + ", '" + start_date + "', '2999-12-31', d.id from devices d ";
|
|
3268
|
+
query += "join device_set ds on ds.id_relateddevice = d.id ";
|
|
3269
|
+
query += "where ds.id_maindevice = " + id_device;
|
|
3270
|
+
return query;
|
|
3271
|
+
}
|
|
3272
|
+
function insertSiteBySetParamMySQL(id_device) {
|
|
3273
|
+
var query = "insert into device_site (id_site, id_place, date_in, date_out, id_device) ";
|
|
3274
|
+
query += "select :id_site, :id_place, :start_date, '2999-12-31', d.id from devices d ";
|
|
3275
|
+
query += "join device_set ds on ds.id_relateddevice = d.id ";
|
|
3276
|
+
query += "where ds.id_maindevice = :id_device";
|
|
3277
|
+
return query;
|
|
3278
|
+
}
|
|
3279
|
+
//End define insertSiteBySetParam
|
|
3280
|
+
//Define getDeviceAsSite
|
|
3281
|
+
function getDeviceAsSiteSQLite(id_device) {
|
|
3282
|
+
var query = "select id_site, id_place, id_device from device_as_site das ";
|
|
3283
|
+
query += "where das.id_device = " + id_device;
|
|
3284
|
+
return query;
|
|
3285
|
+
}
|
|
3286
|
+
function getDeviceAsSiteMySQL(id_device) {
|
|
3287
|
+
var query = "select id_site, id_place, id_device from device_as_site das ";
|
|
3288
|
+
query += "where das.id_device = :id_device";
|
|
3289
|
+
return query;
|
|
3290
|
+
}
|
|
3291
|
+
//End define getDeviceAsSite
|
|
3292
|
+
// Define getLastSiteForDevice
|
|
3293
|
+
function getLastSiteForDeviceSQLite(id_device) {
|
|
3294
|
+
var query = "select distinct id_site, id_place, id_device from device_site ds ";
|
|
3295
|
+
query += "where id_device = " + id_device + " ";
|
|
3296
|
+
query += "and date('now') >= ds.date_in and date('now') <= ds.date_out";
|
|
3297
|
+
return query;
|
|
3298
|
+
}
|
|
3299
|
+
function getLastSiteForDeviceMySQL(id_device) {
|
|
3300
|
+
var query = "select distinct id_site, id_place, id_device from device_site ds ";
|
|
3301
|
+
query += "where id_device = :id_device ";
|
|
3302
|
+
query += "and CURDATE() >= ds.date_in and CURDATE() <= ds.date_out";
|
|
3303
|
+
return query;
|
|
3304
|
+
}
|
|
3305
|
+
// End define getLastSiteForDevice
|
|
3306
|
+
|
|
3307
|
+
|
|
3308
|
+
// end of source//Get Devices for Statistics
|
|
3309
|
+
function queryStatisticSQLite(list_types) {
|
|
3310
|
+
var query = "select type as Tipo, count(*) as Numero from devices ";
|
|
3311
|
+
query += "where type in (";
|
|
3312
|
+
for (let i = 0; i < list_types.length; i++) {
|
|
3313
|
+
query += "'" + list_types[i] + "'";
|
|
3314
|
+
if (i < list_types.length - 1) {
|
|
3315
|
+
query += ", ";
|
|
3316
|
+
}
|
|
3317
|
+
}
|
|
3318
|
+
query += ") and (is_removed is null or is_removed = 0) ";
|
|
3319
|
+
query += "group by Tipo";
|
|
3320
|
+
return query;
|
|
3321
|
+
}
|
|
3322
|
+
function queryStatisticMySQL(list_types) {
|
|
3323
|
+
var query = "select type as Tipo, count(*) as Numero from devices ";
|
|
3324
|
+
query += "where type in (";
|
|
3325
|
+
for (let i = 0; i < list_types.length; i++) {
|
|
3326
|
+
query += "'" + list_types[i] + "'";
|
|
3327
|
+
if (i < list_types.length - 1) {
|
|
3328
|
+
query += ", ";
|
|
3329
|
+
}
|
|
3330
|
+
}
|
|
3331
|
+
query += ") and (is_removed is null or is_removed = 0) ";
|
|
3332
|
+
query += "group by Tipo";
|
|
3333
|
+
return query;
|
|
3334
|
+
}
|
|
3335
|
+
//End Get Devices for Statistics
|
|
3336
|
+
//Get Inventary for Statistics
|
|
3337
|
+
function queryStatisticInventarySQLite() {
|
|
3338
|
+
var query = "select COUNT(IIF(d.inv_ict3_number is not null and round(d.inv_ict3_number) > 0, 1, NULL)) as Con_Inventario, COUNT(IIF(d.inv_ict3_number is null or trim(d.inv_ict3_number) = '' or round(d.inv_ict3_number) > 0, 1, NULL)) as Senza_Inventario from devices d ";
|
|
3339
|
+
query += "where (is_removed is null or is_removed = 0) ";
|
|
3340
|
+
return query;
|
|
3341
|
+
}
|
|
3342
|
+
function queryStatisticInventaryMySQL() {
|
|
3343
|
+
var query = "select COUNT(IIF(d.inv_ict3_number is not null and round(d.inv_ict3_number) > 0, 1, NULL)) as Con_Inventario, COUNT(IIF(d.inv_ict3_number is null or trim(d.inv_ict3_number) = '' or round(d.inv_ict3_number) > 0, 1, NULL)) as Senza_Inventario from devices d ";
|
|
3344
|
+
query += "where (is_removed is null or is_removed = 0) ";
|
|
3345
|
+
return query;
|
|
3346
|
+
}
|
|
3347
|
+
//End Get Inventary for Statistics
|
|
3348
|
+
//Get Devices Statistics bt Status
|
|
3349
|
+
function queryStatisticsDeviceStatusSQLite() {
|
|
3350
|
+
var query = "select case when ds.status is null then 0 else ds.status end as Stato, sd.name as Descrizione, count(*) as Numero from devices d ";
|
|
3351
|
+
query += "left join device_usage ds on d.id = ds.id_device ";
|
|
3352
|
+
query += "join status_description sd on sd.id = Stato "
|
|
3353
|
+
query += "where date('now') >= ds.date_status or Stato = 0 ";
|
|
3354
|
+
query += "and (is_removed is null or is_removed = 0) ";
|
|
3355
|
+
query += "group by Stato";
|
|
3356
|
+
return query;
|
|
3357
|
+
}
|
|
3358
|
+
function queryStatisticsDeviceStatusMySQL() {
|
|
3359
|
+
}
|
|
3360
|
+
|
|
3361
|
+
function tokenizer(marker, input, marker2) {
|
|
3362
|
+
var retValue = "";
|
|
3363
|
+
let wordRegex = new RegExp("\/*" + marker + "\/*.", "g");
|
|
3364
|
+
let valToken = wordRegex.exec(input);
|
|
3365
|
+
if (valToken != null && valToken.index != null) {
|
|
3366
|
+
let tokenValue = input.substring(marker.length + valToken.index).trim();
|
|
3367
|
+
retValue = tokenValue;
|
|
3368
|
+
if (marker2 != "") {
|
|
3369
|
+
wordRegex = new RegExp("\/*" + marker2 + "\/*.", "g");
|
|
3370
|
+
let valToken2 = wordRegex.exec(tokenValue);
|
|
3371
|
+
if (valToken2 != null && valToken2.index != null)
|
|
3372
|
+
retValue = tokenValue.substring(0, valToken2.index).trim();
|
|
3373
|
+
}
|
|
3374
|
+
}
|
|
3375
|
+
return retValue;
|
|
3376
|
+
}
|
|
3377
|
+
|
|
3378
|
+
|
|
3379
|
+
function getPropertiesFromBLOB(text) {
|
|
3380
|
+
const markers = ["Nome dispositivo", "Nome completo del dispositivo", "Processore", "RAM installata", "ID dispositivo", "ID prodotto", "Tipo sistema"];
|
|
3381
|
+
var propertiesObj = {};
|
|
3382
|
+
text = text.replaceAll("\t", " ").trim();
|
|
3383
|
+
for (let i = 0; i < markers.length; i++) {
|
|
3384
|
+
var valore = "";
|
|
3385
|
+
if (i < markers.length + 1) {
|
|
3386
|
+
valore = tokenizer(markers[i], text.replaceAll("\t", " "), markers[i + 1]);
|
|
3387
|
+
}
|
|
3388
|
+
else {
|
|
3389
|
+
valore = tokenizer(markers[i], text.replaceAll("\t", " "), "");
|
|
3390
|
+
}
|
|
3391
|
+
//console.log(valore);
|
|
3392
|
+
switch (i) {
|
|
3393
|
+
case 0:
|
|
3394
|
+
propertiesObj.deviceName = valore;
|
|
3395
|
+
break;
|
|
3396
|
+
case 1:
|
|
3397
|
+
propertiesObj.deviceNameComplete = valore;
|
|
3398
|
+
break;
|
|
3399
|
+
case 2:
|
|
3400
|
+
propertiesObj.cpu = valore;
|
|
3401
|
+
break;
|
|
3402
|
+
case 3:
|
|
3403
|
+
propertiesObj.memory = valore.replace(/[^0-9].*/g, '');
|
|
3404
|
+
//propertiesObj.memory = propertiesObj.memory/100;
|
|
3405
|
+
break;
|
|
3406
|
+
case 4:
|
|
3407
|
+
propertiesObj.id_disp = valore;
|
|
3408
|
+
break;
|
|
3409
|
+
case 5:
|
|
3410
|
+
propertiesObj.id_prod = valore;
|
|
3411
|
+
break;
|
|
3412
|
+
case 6:
|
|
3413
|
+
propertiesObj.sys_type = valore;
|
|
3414
|
+
break;
|
|
3415
|
+
default:
|
|
3416
|
+
break;
|
|
3417
|
+
}
|
|
3418
|
+
}
|
|
3419
|
+
return propertiesObj;
|
|
3420
|
+
}
|
|
3421
|
+
|
|
3422
|
+
function getOpSystemFromBLOB(text) {
|
|
3423
|
+
const markers = ["Edizione", "Versione", "Data installazione:", "Build sistema operativo", "Numero di serie", "Esperienza"];
|
|
3424
|
+
var propertiesObj = {};
|
|
3425
|
+
text = text.replaceAll("\t", " ").trim();
|
|
3426
|
+
for (let i = 0; i < markers.length; i++) {
|
|
3427
|
+
var valore = "";
|
|
3428
|
+
if (i < markers.length + 1) {
|
|
3429
|
+
valore = tokenizer(markers[i], text.replaceAll("\t", " "), markers[i + 1]);
|
|
3430
|
+
}
|
|
3431
|
+
else {
|
|
3432
|
+
valore = tokenizer(markers[i], text.replaceAll("\t", " "), "");
|
|
3433
|
+
}
|
|
3434
|
+
//console.log(valore);
|
|
3435
|
+
switch (i) {
|
|
3436
|
+
case 0:
|
|
3437
|
+
propertiesObj.edition = valore;
|
|
3438
|
+
break;
|
|
3439
|
+
case 1:
|
|
3440
|
+
propertiesObj.version = valore;
|
|
3441
|
+
break;
|
|
3442
|
+
case 2:
|
|
3443
|
+
propertiesObj.date_inst = valore;
|
|
3444
|
+
break;
|
|
3445
|
+
case 3:
|
|
3446
|
+
propertiesObj.build = valore;
|
|
3447
|
+
break;
|
|
3448
|
+
case 4:
|
|
3449
|
+
propertiesObj.serial_no = valore;
|
|
3450
|
+
break;
|
|
3451
|
+
case 5:
|
|
3452
|
+
propertiesObj.id_prod = valore;
|
|
3453
|
+
break;
|
|
3454
|
+
case 6:
|
|
3455
|
+
propertiesObj.experience = valore;
|
|
3456
|
+
break;
|
|
3457
|
+
default:
|
|
3458
|
+
break;
|
|
3459
|
+
}
|
|
3460
|
+
}
|
|
3461
|
+
return propertiesObj;
|
|
3462
|
+
}
|
|
3463
|
+
//Complete parser
|
|
3464
|
+
function getAllPropertiesFromBLOB(text) {
|
|
3465
|
+
const markers = ["Nome dispositivo", "Nome completo del dispositivo", "Processore", "RAM installata", "ID dispositivo", "ID prodotto", "Tipo sistema",
|
|
3466
|
+
"Edizione", "Versione", "Data installazione:", "Build sistema operativo", "Numero di serie", "Esperienza"];
|
|
3467
|
+
var propertiesObj = {};
|
|
3468
|
+
text = text.replaceAll("\t", " ").trim();
|
|
3469
|
+
for (let i = 0; i < markers.length; i++) {
|
|
3470
|
+
var valore = "";
|
|
3471
|
+
if (i < markers.length + 1) {
|
|
3472
|
+
valore = tokenizer(markers[i], text.replaceAll("\t", " "), markers[i + 1]);
|
|
3473
|
+
}
|
|
3474
|
+
else {
|
|
3475
|
+
valore = tokenizer(markers[i], text.replaceAll("\t", " "), "");
|
|
3476
|
+
}
|
|
3477
|
+
//console.log(valore);
|
|
3478
|
+
switch (i) {
|
|
3479
|
+
case 0:
|
|
3480
|
+
propertiesObj.deviceName = valore;
|
|
3481
|
+
break;
|
|
3482
|
+
case 1:
|
|
3483
|
+
propertiesObj.deviceNameComplete = valore;
|
|
3484
|
+
break;
|
|
3485
|
+
case 2:
|
|
3486
|
+
propertiesObj.cpu = valore;
|
|
3487
|
+
break;
|
|
3488
|
+
case 3:
|
|
3489
|
+
propertiesObj.memory = valore.replace(/[^0-9].*/g, '');
|
|
3490
|
+
//propertiesObj.memory = propertiesObj.memory / 100;
|
|
3491
|
+
break;
|
|
3492
|
+
case 4:
|
|
3493
|
+
propertiesObj.id_disp = valore;
|
|
3494
|
+
break;
|
|
3495
|
+
case 5:
|
|
3496
|
+
propertiesObj.id_prod = valore;
|
|
3497
|
+
break;
|
|
3498
|
+
case 6:
|
|
3499
|
+
propertiesObj.sys_type = valore;
|
|
3500
|
+
break;
|
|
3501
|
+
case 7:
|
|
3502
|
+
propertiesObj.edition = valore;
|
|
3503
|
+
break;
|
|
3504
|
+
case 8:
|
|
3505
|
+
propertiesObj.version = valore;
|
|
3506
|
+
break;
|
|
3507
|
+
case 9:
|
|
3508
|
+
propertiesObj.date_inst = valore;
|
|
3509
|
+
break;
|
|
3510
|
+
case 10:
|
|
3511
|
+
propertiesObj.build = valore;
|
|
3512
|
+
break;
|
|
3513
|
+
case 11:
|
|
3514
|
+
propertiesObj.serial_no = valore;
|
|
3515
|
+
break;
|
|
3516
|
+
case 12:
|
|
3517
|
+
propertiesObj.id_prod = valore;
|
|
3518
|
+
break;
|
|
3519
|
+
case 13:
|
|
3520
|
+
propertiesObj.experience = valore;
|
|
3521
|
+
break;
|
|
3522
|
+
default:
|
|
3523
|
+
break;
|
|
3524
|
+
}
|
|
3525
|
+
}
|
|
3526
|
+
return propertiesObj;
|
|
3527
|
+
}
|
|
3528
|
+
|
|
3529
|
+
//end complete parser
|
|
3530
|
+
// Exports
|
|
3531
|
+
|
|
3532
|
+
module.exports = {
|
|
3533
|
+
getDevicesAllocatedComboSQLite,
|
|
3534
|
+
getDevicesAllocatedComboMySQL,
|
|
3535
|
+
getDevicesNotAllocatedCombo,
|
|
3536
|
+
queryDeviceTypes,
|
|
3537
|
+
queryDeviceManifactures,
|
|
3538
|
+
getDevicesSelectByRelatedSQLite,
|
|
3539
|
+
getDevicesSelectByRelatedMySQL,
|
|
3540
|
+
getDevicesSelectSQLite,
|
|
3541
|
+
getDevicesSelectMySQL,
|
|
3542
|
+
getDevicesSelectBySiteSQLite,
|
|
3543
|
+
getDevicesSelectBySiteMySQL,
|
|
3544
|
+
queryDeviceByIdSQLite,
|
|
3545
|
+
queryDeviceByIdMySQL,
|
|
3546
|
+
queryDeviceByIdentificativoSQLite,
|
|
3547
|
+
queryDeviceByIdentificativoMySQL,
|
|
3548
|
+
getDevicesCounterBySiteSQLite,
|
|
3549
|
+
getDevicesCounterBySiteMySQL,
|
|
3550
|
+
getDevicesCounterByPlaceSQLite,
|
|
3551
|
+
getDevicesCounterByPlaceMySQL,
|
|
3552
|
+
queryDeviceStatusSQLite,
|
|
3553
|
+
queryDeviceStatusMySQL,
|
|
3554
|
+
updateDeviceStatusSQLite,
|
|
3555
|
+
updateDeviceStatusMySQL,
|
|
3556
|
+
insertDeviceStatusSQLite,
|
|
3557
|
+
insertDeviceStatusMySQL,
|
|
3558
|
+
getDevicesSelectByPlaceSQLite,
|
|
3559
|
+
getDevicesSelectByPlaceMySQL,
|
|
3560
|
+
queryLastDeviceIdSQLite,
|
|
3561
|
+
queryLastDeviceIdMySQL,
|
|
3562
|
+
queryOSList,
|
|
3563
|
+
getDevicesSelectComboSQLite,
|
|
3564
|
+
getDevicesSelectComboMySQL,
|
|
3565
|
+
getDevicesSelectBySiteComboSQLite,
|
|
3566
|
+
getDevicesSelectBySiteComboMySQL,
|
|
3567
|
+
getDevicesWithPropertiesSQLite,
|
|
3568
|
+
getDevicesWithPropertiesMySQL,
|
|
3569
|
+
getBeniAcquisitiSQLite,
|
|
3570
|
+
getBeniAcquisitiMySQL,
|
|
3571
|
+
getNetworksOnDeviceSQLite,
|
|
3572
|
+
getNetworksOnDeviceMySQL,
|
|
3573
|
+
getImportedPropertiesByIdDeviceSQLite,
|
|
3574
|
+
getImportedPropertiesByIdDeviceMySQL,
|
|
3575
|
+
getSetInfoByIdSetSQLite,
|
|
3576
|
+
getSetInfoByIdSetMySQL,
|
|
3577
|
+
getSetInfoByIdDeviceSQLite,
|
|
3578
|
+
getSetInfoByIdDeviceMySQL,
|
|
3579
|
+
insertSetInfoSQLite,
|
|
3580
|
+
insertSetInfoMySQL,
|
|
3581
|
+
insertSetInfoInverseSQLite,
|
|
3582
|
+
insertSetInfoInverseMySQL,
|
|
3583
|
+
removeSetInfoSQLite,
|
|
3584
|
+
removeSetInfoMySQL,
|
|
3585
|
+
updateSetInfoSQLite,
|
|
3586
|
+
updateSetInfoMySQL,
|
|
3587
|
+
setInfoObj,
|
|
3588
|
+
selectSetsByIdDeviceSQLite,
|
|
3589
|
+
selectSetsByIdDeviceMySQL,
|
|
3590
|
+
insertDeviceSQLite,
|
|
3591
|
+
insertDeviceMySQL,
|
|
3592
|
+
updateDeviceSQLite,
|
|
3593
|
+
updateDeviceMySQL,
|
|
3594
|
+
removeDeviceSQLite,
|
|
3595
|
+
removeDeviceMySQL,
|
|
3596
|
+
getDeviceMySQLPayload,
|
|
3597
|
+
writeDevicePropertiesSQLite,
|
|
3598
|
+
writeDevicePropertiesMySQL,
|
|
3599
|
+
readDevicePropertiesSQLite,
|
|
3600
|
+
readDevicePropertiesMySQL,
|
|
3601
|
+
existsPCPropertiesSQLite,
|
|
3602
|
+
existsPCPropertiesMySQL,
|
|
3603
|
+
getPCPropertiesSQLite,
|
|
3604
|
+
getPCPropertiesMySQL,
|
|
3605
|
+
createPCPropertiesMySQLObj,
|
|
3606
|
+
insertPCPropertiesSQLite,
|
|
3607
|
+
insertPCPropertiesMySQL,
|
|
3608
|
+
updatePCPropertiesSQLite,
|
|
3609
|
+
updatePCPropertiesMySQL,
|
|
3610
|
+
existsDisplayPropertiesSQLite,
|
|
3611
|
+
existsDisplayPropertiesMySQL,
|
|
3612
|
+
getDisplayPropertiesSQLite,
|
|
3613
|
+
getDisplayPropertiesMySQL,
|
|
3614
|
+
createDisplayPropertiesMySQLObj,
|
|
3615
|
+
insertDisplayPropertiesSQLite,
|
|
3616
|
+
insertDisplayPropertiesMySQL,
|
|
3617
|
+
updateDisplayPropertiesSQLite,
|
|
3618
|
+
updateDisplayPropertiesMySQL,
|
|
3619
|
+
getDisplayPartPropertiesSQLite,
|
|
3620
|
+
getDisplayPartPropertiesMySQL,
|
|
3621
|
+
getConnectorsByIdDeviceSQLite,
|
|
3622
|
+
getConnectorsByIdDeviceMySQL,
|
|
3623
|
+
getConnectorByIdSQLite,
|
|
3624
|
+
getConnectorByIdMySQL,
|
|
3625
|
+
insertConnectorSQLite,
|
|
3626
|
+
insertConnectorMySQL,
|
|
3627
|
+
updateConnectorSQLite,
|
|
3628
|
+
updateConnectorMySQL,
|
|
3629
|
+
removeConnectorSQLite,
|
|
3630
|
+
removeConnectorMySQL,
|
|
3631
|
+
getStorageByIdDeviceSQLite,
|
|
3632
|
+
getStorageByIdDeviceMySQL,
|
|
3633
|
+
getStorageByIdSQLite,
|
|
3634
|
+
getStorageByIdMySQL,
|
|
3635
|
+
insertStorageSQLite,
|
|
3636
|
+
insertStorageMySQL,
|
|
3637
|
+
updateStorageSQLite,
|
|
3638
|
+
updateStorageMySQL,
|
|
3639
|
+
removeStorageSQLite,
|
|
3640
|
+
removeStorageMySQL,
|
|
3641
|
+
getNetworkByIdDeviceSQLite,
|
|
3642
|
+
getNetworkByIdDeviceMySQL,
|
|
3643
|
+
getNetworkByIdSQLite,
|
|
3644
|
+
getNetworkByIdMySQL,
|
|
3645
|
+
insertNetworkSQLite,
|
|
3646
|
+
insertNetworkMySQL,
|
|
3647
|
+
updateNetworkSQLite,
|
|
3648
|
+
updateNetworkMySQL,
|
|
3649
|
+
removeNetworkSQLite,
|
|
3650
|
+
removeNetworkMySQL,
|
|
3651
|
+
getAddOnByIdDeviceSQLite,
|
|
3652
|
+
getAddOnByIdDeviceMySQL,
|
|
3653
|
+
getAddOnByIdSQLite,
|
|
3654
|
+
getAddOnByIdMySQL,
|
|
3655
|
+
insertAddOnSQLite,
|
|
3656
|
+
insertAddOnMySQL,
|
|
3657
|
+
updateAddOnSQLite,
|
|
3658
|
+
updateAddOnMySQL,
|
|
3659
|
+
removeAddOnSQLite,
|
|
3660
|
+
removeAddOnMySQL,
|
|
3661
|
+
selectBeneDaInventarioSQLite,
|
|
3662
|
+
selectBeneDaInventarioMySQL,
|
|
3663
|
+
getDevicesSelectForInventarioRawSQLite,
|
|
3664
|
+
getDevicesSelectForInventarioRawMySQL,
|
|
3665
|
+
getDevicesSelectForInventarioRawByIdSQLite,
|
|
3666
|
+
getDevicesSelectForInventarioRawByIdMySQL,
|
|
3667
|
+
getBeniConsumo,
|
|
3668
|
+
getBeniConsumoNotNull,
|
|
3669
|
+
getBeneConsumoUsatoSQLite,
|
|
3670
|
+
getBeneConsumoUsatoMySQL,
|
|
3671
|
+
getBeneConsumoByIdSQLite,
|
|
3672
|
+
getBeneConsumoByIdMySQL,
|
|
3673
|
+
existBeneAbbinatoSQLite,
|
|
3674
|
+
existBeneAbbinatoMySQL,
|
|
3675
|
+
insertBeneConsumoAbbinatoSQLite,
|
|
3676
|
+
insertBeneConsumoAbbinatoMySQL,
|
|
3677
|
+
updateBeneConsumoAbbinatoSQLite,
|
|
3678
|
+
updateBeneConsumoAbbinatoMySQL,
|
|
3679
|
+
insertConnectionSetSQLite,
|
|
3680
|
+
insertConnectionSetMySQL,
|
|
3681
|
+
updateConnectionSetSQLite,
|
|
3682
|
+
updateConnectionSetMySQL,
|
|
3683
|
+
removeConnectionSetSQLite,
|
|
3684
|
+
removeConnectionSetMySQL,
|
|
3685
|
+
getConnectionByIdSetSQLite,
|
|
3686
|
+
getConnectionByIdSetMySQL,
|
|
3687
|
+
getConnectionSetByIdSQLite,
|
|
3688
|
+
getConnectionSetByIdMySQL,
|
|
3689
|
+
queryDetailsByIdDeviceSQLite,
|
|
3690
|
+
queryDetailsByIdDeviceMySQL,
|
|
3691
|
+
queryDocumentsIdDeviceSQLite,
|
|
3692
|
+
queryDocumentsIdDeviceMySQL,
|
|
3693
|
+
getDocumentByIdDocSQLite,
|
|
3694
|
+
getDocumentByIdDocMySQL,
|
|
3695
|
+
updateDismissioneSQLite,
|
|
3696
|
+
updateDismissioneMySQL,
|
|
3697
|
+
insertDismissioneSQLite,
|
|
3698
|
+
insertDismissioneMySQL,
|
|
3699
|
+
selectDismissioneByIdSQLite,
|
|
3700
|
+
selectDismissioneByIdMySQL,
|
|
3701
|
+
selectDismissioni,
|
|
3702
|
+
assignCategoryFromDBSQLite,
|
|
3703
|
+
assignCategoryFromDBMySQL,
|
|
3704
|
+
getBeniConsumoByIdDeviceSQLite,
|
|
3705
|
+
getBeniConsumoByIdDeviceMySQL,
|
|
3706
|
+
queryConsegneByIdDeviceSQLite,
|
|
3707
|
+
queryConsegneByIdDeviceMySQL,
|
|
3708
|
+
queryFornitoriGestoriCombo,
|
|
3709
|
+
queryCloseGestioneDeviceSQLite,
|
|
3710
|
+
queryCloseGestioneDeviceMySQL,
|
|
3711
|
+
queryInsertGestioneDeviceSQLite,
|
|
3712
|
+
queryInsertGestioneDeviceMySQL,
|
|
3713
|
+
querySelectExistsGestioneDeviceByIdsSQLite,
|
|
3714
|
+
querySelectExistsGestioneDeviceByIdsMySQL,
|
|
3715
|
+
querySelectGestioniDeviceByIdDeviceSQLite,
|
|
3716
|
+
querySelectGestioniDeviceByIdDeviceMySQL,
|
|
3717
|
+
queryConsegneSQLite,
|
|
3718
|
+
queryConsegneMySQL,
|
|
3719
|
+
queryConsegnaByIdSQLite,
|
|
3720
|
+
queryConsegnaByIdMySQL,
|
|
3721
|
+
queryDeviceStatusCombo,
|
|
3722
|
+
queryUsers,
|
|
3723
|
+
queryFunctions,
|
|
3724
|
+
queryAllFunctions,
|
|
3725
|
+
queryInterventoByIdSQLite,
|
|
3726
|
+
queryInterventoByIdMySQL,
|
|
3727
|
+
insertDeviceInterventoSQLite,
|
|
3728
|
+
insertDeviceInterventoMySQL,
|
|
3729
|
+
updateDeviceInterventoSQLite,
|
|
3730
|
+
updateDeviceInterventoMySQL,
|
|
3731
|
+
removeDeviceInterventoSQLite,
|
|
3732
|
+
removeDeviceInterventoMySQL,
|
|
3733
|
+
getConnectionTypesSQLite,
|
|
3734
|
+
getConnectionTypesMySQL,
|
|
3735
|
+
getConnectionProtocolsSQLite,
|
|
3736
|
+
getConnectionProtocolsMySQL,
|
|
3737
|
+
getAdapterTypesSQLite,
|
|
3738
|
+
getAdapterTypesMySQL,
|
|
3739
|
+
getStorageTypesSQLite,
|
|
3740
|
+
getStorageTypesMySQL,
|
|
3741
|
+
getLaboratorioByIdSiteSQLite,
|
|
3742
|
+
getLaboratorioByIdSiteMySQL,
|
|
3743
|
+
getCategories,
|
|
3744
|
+
getCategoriesByIdDeviceSQLite,
|
|
3745
|
+
getCategoriesByIdDeviceMySQL,
|
|
3746
|
+
createConsegnaMySQLObj,
|
|
3747
|
+
insertConsegnaSQLite,
|
|
3748
|
+
insertConsegnaMySQL,
|
|
3749
|
+
updateConsegnaSQLite,
|
|
3750
|
+
updateConsegnaMySQL,
|
|
3751
|
+
removeConsegnaSQLite,
|
|
3752
|
+
removeConsegnaMySQL,
|
|
3753
|
+
queryLastConsegnaIdSQLite,
|
|
3754
|
+
queryLastConsegnaIdMySQL,
|
|
3755
|
+
removeSiteBySetSQLite,
|
|
3756
|
+
removeSiteBySetMySQL,
|
|
3757
|
+
updateSiteBySetSQLite,
|
|
3758
|
+
updateSiteBySetMySQL,
|
|
3759
|
+
insertSiteBySetSQLite,
|
|
3760
|
+
insertSiteBySetMySQL,
|
|
3761
|
+
insertSiteBySetParamSQLite,
|
|
3762
|
+
insertSiteBySetParamMySQL,
|
|
3763
|
+
getDeviceAsSiteSQLite,
|
|
3764
|
+
getDeviceAsSiteMySQL,
|
|
3765
|
+
getLastSiteForDeviceSQLite,
|
|
3766
|
+
getLastSiteForDeviceMySQL,
|
|
3767
|
+
querySitesLabSQLite,
|
|
3768
|
+
querySitesLabMySQL,
|
|
3769
|
+
getSiteByIdSQLite,
|
|
3770
|
+
getSiteByIdMySQL,
|
|
3771
|
+
getSitesSelectComboSQLite,
|
|
3772
|
+
getSitesSelectComboMySQL,
|
|
3773
|
+
verifyPrevDeviceSiteSQLite,
|
|
3774
|
+
verifyPrevDeviceSiteMySQL,
|
|
3775
|
+
insertDeviceSiteSQLite,
|
|
3776
|
+
insertDeviceSiteMySQL,
|
|
3777
|
+
updateDeviceSiteSQLite,
|
|
3778
|
+
updateDeviceSiteMySQL,
|
|
3779
|
+
removeDeviceSiteSQLite,
|
|
3780
|
+
removeDeviceSiteMySQL,
|
|
3781
|
+
queryPlaces,
|
|
3782
|
+
queryFloorsByPlaceSQLite,
|
|
3783
|
+
queryFloorsByPlaceMySQL,
|
|
3784
|
+
queryFunzioneByPlaceAndFloorSQLite,
|
|
3785
|
+
queryFunzioneByPlaceAndFloorMySQL,
|
|
3786
|
+
querySitesSQLite,
|
|
3787
|
+
querySitesMySQL,
|
|
3788
|
+
getSitesFromDeviceSQLite,
|
|
3789
|
+
getSitesFromDeviceMySQL,
|
|
3790
|
+
getSitesWithDatesFromDeviceSQLite,
|
|
3791
|
+
getSitesWithDatesFromDeviceMySQL,
|
|
3792
|
+
querySitesWithDefaultsSQLite,
|
|
3793
|
+
querySitesWithDefaultsMySQL,
|
|
3794
|
+
getPorteByIdSiteSQLite,
|
|
3795
|
+
getPorteByIdSiteMySQL,
|
|
3796
|
+
queryStatisticSQLite,
|
|
3797
|
+
queryStatisticMySQL,
|
|
3798
|
+
queryStatisticInventarySQLite,
|
|
3799
|
+
queryStatisticInventaryMySQL,
|
|
3800
|
+
queryStatisticsDeviceStatusSQLite,
|
|
3801
|
+
queryStatisticsDeviceStatusMySQL,
|
|
3802
|
+
getPropertiesFromBLOB,
|
|
3803
|
+
getOpSystemFromBLOB,
|
|
3804
|
+
getAllPropertiesFromBLOB
|
|
3805
|
+
};
|
|
3806
|
+
// end of source
|