Revision 4a8d696c
Von Bernd Bleßmann vor etwa 1 Jahr hinzugefügt
| SL/Helper/Inventory.pm | ||
|---|---|---|
|   my $part = $params{part} or Carp::croak('check_allocations_for_assembly needs a part');
 | ||
|   my $qty  = $params{qty}  or Carp::croak('check_allocations_for_assembly needs a qty');
 | ||
|  | ||
|   my $consume_service = $::instance_conf->get_produce_assembly_transfer_service;
 | ||
|   my $check_overfulfilment = !!$params{check_overfulfilment};
 | ||
|   my $allocations          = $params{allocations};
 | ||
|  | ||
|   my $allocations = $params{allocations};
 | ||
|   my $consume_service      = $::instance_conf->get_produce_assembly_transfer_service;
 | ||
|  | ||
|   my %allocations_by_part;
 | ||
|   for (@{ $allocations || []}) {
 | ||
| ... | ... | |
|     $allocations_by_part{ $assembly->parts_id } -= $assembly->qty * $qty;
 | ||
|   }
 | ||
|  | ||
|   return none { $_ < 0 } values %allocations_by_part;
 | ||
|   return (none { $_ < 0 } values %allocations_by_part) && (!$check_overfulfilment || (none { $_ > 0 } values %allocations_by_part));
 | ||
| }
 | ||
|  | ||
| sub default_show_bestbefore {
 | ||
| ... | ... | |
| =item * check_allocations_for_assembly PARAMS
 | ||
|  | ||
| Checks if enough quantity is allocated for production. Returns a trueish
 | ||
| value if there is enough allocated, a falsish one otherwise.
 | ||
| value if there is enough allocated, a falsish one otherwise (but see the
 | ||
| parameter C<check_overfulfilment>).
 | ||
|  | ||
| Accepted parameters:
 | ||
|  | ||
| ... | ... | |
|  | ||
| An array ref of the allocations.
 | ||
|  | ||
| =item * check_overfulfilment
 | ||
|  | ||
| Whether or not overfulfilment should be checked. If more quantity is allocated
 | ||
| than needed for production a falsish value is returned. Optional.
 | ||
|  | ||
| =back
 | ||
|  | ||
| =back
 | ||
Auch abrufbar als: Unified diff
S:H:Inventory: Optional Übererfüllung beachten bei Prüfung der Allokierung