Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 1d7143e9

Von Bernd Bleßmann vor fast 10 Jahren hinzugefügt

  • ID 1d7143e9a364a438f828dd31c48a1e1fc3d89903
  • Vorgänger 0af0977d
  • Nachfolger 6445a61e

Lagerbewegungs-Import: Charge beim Ermitteln des Bestands berücksichtigen.

Unterschiede anzeigen:

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