Revision 1d7143e9
Von Bernd Bleßmann vor fast 10 Jahren hinzugefügt
SL/Controller/CsvImport/Inventory.pm | ||
---|---|---|
286 | 286 |
} |
287 | 287 |
|
288 | 288 |
# Actual quantity is read from stock or is the result of transfers for the |
289 |
# same part, warehouse and bin done before.
|
|
290 |
my $key = join '+', $object->parts_id, $object->warehouse_id, $object->bin_id; |
|
289 |
# same part, warehouse, bin and chargenumber done before.
|
|
290 |
my $key = join '+', $object->parts_id, $object->warehouse_id, $object->bin_id, $object->chargenumber;
|
|
291 | 291 |
if (!exists $self->{resulting_quantities}->{$key}) { |
292 |
my $stock = $object->part->get_simple_stock; |
|
293 |
my @stocked = grep { $_->{warehouse_id} == $object->warehouse_id && $_->{bin_id} == $object->bin_id } @$stock; |
|
294 |
my $stocked_qty = 0; |
|
295 |
foreach (@stocked) { |
|
296 |
$stocked_qty += $stocked[0]->{sum} * 1; |
|
297 |
} |
|
292 |
my $query = <<SQL; |
|
293 |
SELECT sum(qty) FROM inventory |
|
294 |
WHERE parts_id = ? AND warehouse_id = ? AND bin_id = ? AND chargenumber = ? |
|
295 |
GROUP BY warehouse_id, bin_id, chargenumber |
|
296 |
SQL |
|
297 |
|
|
298 |
my ($stocked_qty) = selectrow_query($::form, $::form->get_standard_dbh, $query, |
|
299 |
$object->parts_id, $object->warehouse_id, $object->bin_id, $object->chargenumber); |
|
298 | 300 |
$self->{resulting_quantities}->{$key} = $stocked_qty; |
299 | 301 |
} |
300 | 302 |
my $actual_qty = $self->{resulting_quantities}->{$key}; |
Auch abrufbar als: Unified diff
Lagerbewegungs-Import: Charge beim Ermitteln des Bestands berücksichtigen.