Revision 7028cd4c
Von Sven Schöling vor fast 7 Jahren hinzugefügt
SL/AM.pm | ||
---|---|---|
1305 | 1305 |
map { $form->{$_} = $ref->{$_} } keys %{ $ref }; |
1306 | 1306 |
|
1307 | 1307 |
$query = <<SQL; |
1308 |
SELECT b.*, |
|
1309 |
( EXISTS(SELECT i.bin_id FROM inventory i WHERE i.bin_id = b.id LIMIT 1) |
|
1310 |
OR EXISTS(SELECT p.bin_id FROM parts p WHERE p.bin_id = b.id LIMIT 1)) |
|
1311 |
AS in_use |
|
1312 |
FROM bin b |
|
1313 |
WHERE b.warehouse_id = ? |
|
1308 |
SELECT b.*, use.in_use |
|
1309 |
FROM bin b |
|
1310 |
LEFT JOIN ( |
|
1311 |
SELECT DISTINCT bin_id, TRUE AS in_use FROM inventory |
|
1312 |
UNION |
|
1313 |
SELECT DISTINCT bin_id, TRUE AS in_use FROM parts |
|
1314 |
) use ON use.bin_id = b.id |
|
1315 |
WHERE b.warehouse_id = ?; |
|
1314 | 1316 |
SQL |
1315 | 1317 |
|
1316 | 1318 |
$form->{BINS} = selectall_hashref_query($form, $dbh, $query, conv_i($form->{id})); |
Auch abrufbar als: Unified diff
AM::_get_warehouse: schnelleres Query
Das alte war extrem langsam für Installationen mit vielen Lagerplätzen