From 1d7143e9a364a438f828dd31c48a1e1fc3d89903 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Thu, 29 Jan 2015 15:27:38 +0100 Subject: [PATCH] =?utf8?q?Lagerbewegungs-Import:=20Charge=20beim=20Ermitte?= =?utf8?q?ln=20des=20Bestands=20ber=C3=BCcksichtigen.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Controller/CsvImport/Inventory.pm | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/SL/Controller/CsvImport/Inventory.pm b/SL/Controller/CsvImport/Inventory.pm index 16debc093..cecb92bc5 100644 --- a/SL/Controller/CsvImport/Inventory.pm +++ b/SL/Controller/CsvImport/Inventory.pm @@ -286,15 +286,17 @@ sub check_qty{ } # Actual quantity is read from stock or is the result of transfers for the - # same part, warehouse and bin done before. - my $key = join '+', $object->parts_id, $object->warehouse_id, $object->bin_id; + # same part, warehouse, bin and chargenumber done before. + my $key = join '+', $object->parts_id, $object->warehouse_id, $object->bin_id, $object->chargenumber; if (!exists $self->{resulting_quantities}->{$key}) { - my $stock = $object->part->get_simple_stock; - my @stocked = grep { $_->{warehouse_id} == $object->warehouse_id && $_->{bin_id} == $object->bin_id } @$stock; - my $stocked_qty = 0; - foreach (@stocked) { - $stocked_qty += $stocked[0]->{sum} * 1; - } + my $query = <get_standard_dbh, $query, + $object->parts_id, $object->warehouse_id, $object->bin_id, $object->chargenumber); $self->{resulting_quantities}->{$key} = $stocked_qty; } my $actual_qty = $self->{resulting_quantities}->{$key}; -- 2.20.1