From: Bernd Bleßmann Date: Thu, 29 Jan 2015 14:27:38 +0000 (+0100) Subject: Lagerbewegungs-Import: Charge beim Ermitteln des Bestands berücksichtigen. X-Git-Tag: release-3.2.0beta~14 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=1d7143e9a364a438f828dd31c48a1e1fc3d89903;p=kivitendo-erp.git Lagerbewegungs-Import: Charge beim Ermitteln des Bestands berücksichtigen. --- 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};