Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 6c20bff1

Von Bernd Bleßmann vor mehr als 5 Jahren hinzugefügt

  • ID 6c20bff1fde66612b803b2716589f97b1441612a
  • Vorgänger 1b46f321
  • Nachfolger 7fa33ab3

Inventur: Schwellwert in Mandantenkonfig. für Warnung bei Mengenabweichung

In der Mandantenkonfiguration kann ein Mengenschwellwert eingegeben werden.
Wenn die bei der Inventur gezählte/eingegebene Zielmenge mehr als dieser
Schwellwert von der Menge in der Datenbank abweicht, dann wird eine Warnung
angezeigt.

Hintergrund: Mitarbeiter lesen den Artikel mit einem Barcode-Scanner ein und
vergessen manchmal, die vorher eingegebene Menge zu speichern. Dann wird die
Artikelnummer oder EAN in das Mengenfeld geschrieben und ein "Enter" ausgelöst.
Dann ist die Zielmenge sehr groß und falsch. Das kann damit verhindert bzw.
abgeschwächt werden.

Unterschiede anzeigen:

SL/Controller/Inventory.pm
30 30

  
31 31
__PACKAGE__->run_before('_check_auth');
32 32
__PACKAGE__->run_before('_check_warehouses');
33
__PACKAGE__->run_before('load_part_from_form',   only => [ qw(stock_in part_changed mini_stock stock stocktaking_part_changed save_stocktaking) ]);
34
__PACKAGE__->run_before('load_unit_from_form',   only => [ qw(stock_in part_changed mini_stock stock stocktaking_part_changed save_stocktaking) ]);
35
__PACKAGE__->run_before('load_wh_from_form',     only => [ qw(stock_in warehouse_changed stock stocktaking save_stocktaking) ]);
36
__PACKAGE__->run_before('load_bin_from_form',    only => [ qw(stock_in stock stocktaking save_stocktaking) ]);
33
__PACKAGE__->run_before('load_part_from_form',   only => [ qw(stock_in part_changed mini_stock stock stocktaking_part_changed stocktaking_get_warn_qty_threshold save_stocktaking) ]);
34
__PACKAGE__->run_before('load_unit_from_form',   only => [ qw(stock_in part_changed mini_stock stock stocktaking_part_changed stocktaking_get_warn_qty_threshold save_stocktaking) ]);
35
__PACKAGE__->run_before('load_wh_from_form',     only => [ qw(stock_in warehouse_changed stock stocktaking stocktaking_get_warn_qty_threshold save_stocktaking) ]);
36
__PACKAGE__->run_before('load_bin_from_form',    only => [ qw(stock_in stock stocktaking stocktaking_get_warn_qty_threshold save_stocktaking) ]);
37 37
__PACKAGE__->run_before('set_target_from_part',  only => [ qw(part_changed) ]);
38 38
__PACKAGE__->run_before('mini_stock',            only => [ qw(stock_in mini_stock) ]);
39
__PACKAGE__->run_before('sanitize_target',       only => [ qw(stock_usage stock_in warehouse_changed part_changed stocktaking stocktaking_part_changed save_stocktaking) ]);
39
__PACKAGE__->run_before('sanitize_target',       only => [ qw(stock_usage stock_in warehouse_changed part_changed stocktaking stocktaking_part_changed stocktaking_get_warn_qty_threshold save_stocktaking) ]);
40 40
__PACKAGE__->run_before('set_layout');
41 41

  
42 42
sub action_stock_in {
......
603 603
  $self->prepare_stocktaking_report(full => 1);
604 604
  $self->report_generator_list_objects(report => $self->{report}, objects => $self->stocktaking_models->get);
605 605
}
606

  
607
sub action_stocktaking_get_warn_qty_threshold {
608
  my ($self) = @_;
609

  
610
  return $_[0]->render(\ !!0, { type => 'text' }) if $::form->{target_qty} eq '';
611
  return $_[0]->render(\ !!0, { type => 'text' }) if 0 == $::instance_conf->get_stocktaking_qty_threshold;
612

  
613
  my $target_qty  = $::form->parse_amount(\%::myconfig, $::form->{target_qty});
614
  my $stocked_qty = _get_stocked_qty($self->part,
615
                                     warehouse_id => $self->warehouse->id,
616
                                     bin_id       => $self->bin->id,
617
                                     chargenumber => $::form->{chargenumber},
618
                                     bestbefore   => $::form->{bestbefore},);
619
  my $stocked_qty_in_form_units = $self->part->unit_obj->convert_to($stocked_qty, $self->unit);
620
  my $qty        = $target_qty - $stocked_qty_in_form_units;
621
  $qty           = abs($qty);
622

  
623
  my $warn;
624
  if ($qty > $::instance_conf->get_stocktaking_qty_threshold) {
625
    $warn  = t8('The target quantity of #1 differs more than the threshold quantity of #2.',
626
                $::form->{target_qty} . " " . $self->unit->name,
627
                $::form->format_amount(\%::myconfig, $::instance_conf->get_stocktaking_qty_threshold, 2));
628
    $warn .= "\n";
629
    $warn .= t8('Choose "continue" if you want to use this value. Choose "cancel" otherwise.');
630
  }
631
  return $_[0]->render(\ $warn, { type => 'text' });
632
}
633

  
606 634
#================================================================
607 635

  
608 636
sub _check_auth {
......
930 958
    $bar->add(
931 959
      action => [
932 960
        t8('Save'),
961
        checks    => [ 'kivi.Inventory.check_stocktaking_qty_threshold' ],
933 962
        call      => [ 'kivi.Inventory.save_stocktaking' ],
934 963
        accesskey => 'enter',
935 964
      ],
......
1016 1045

  
1017 1046
This action is called after the user selected or changed the part.
1018 1047

  
1048
=item C<action_stocktaking_get_warn_qty_threshold>
1049

  
1050
This action checks if a warning should be shown and returns the warning text via
1051
ajax. The warning will be shown if the given target value is greater than the
1052
threshold given in the client configuration.
1053

  
1019 1054
=item C<is_stocktaking>
1020 1055

  
1021 1056
This is a method to check if actions are called from stocktaking form.
1057
This actions should contain "stocktaking" in their name.
1022 1058

  
1023 1059
=back
1024 1060

  

Auch abrufbar als: Unified diff