Revision 4a8d696c
Von Bernd Bleßmann vor 10 Monaten hinzugefügt
SL/Helper/Inventory.pm | ||
---|---|---|
406 | 406 |
my $part = $params{part} or Carp::croak('check_allocations_for_assembly needs a part'); |
407 | 407 |
my $qty = $params{qty} or Carp::croak('check_allocations_for_assembly needs a qty'); |
408 | 408 |
|
409 |
my $consume_service = $::instance_conf->get_produce_assembly_transfer_service; |
|
409 |
my $check_overfulfilment = !!$params{check_overfulfilment}; |
|
410 |
my $allocations = $params{allocations}; |
|
410 | 411 |
|
411 |
my $allocations = $params{allocations};
|
|
412 |
my $consume_service = $::instance_conf->get_produce_assembly_transfer_service;
|
|
412 | 413 |
|
413 | 414 |
my %allocations_by_part; |
414 | 415 |
for (@{ $allocations || []}) { |
... | ... | |
421 | 422 |
$allocations_by_part{ $assembly->parts_id } -= $assembly->qty * $qty; |
422 | 423 |
} |
423 | 424 |
|
424 |
return none { $_ < 0 } values %allocations_by_part;
|
|
425 |
return (none { $_ < 0 } values %allocations_by_part) && (!$check_overfulfilment || (none { $_ > 0 } values %allocations_by_part));
|
|
425 | 426 |
} |
426 | 427 |
|
427 | 428 |
sub default_show_bestbefore { |
... | ... | |
677 | 678 |
=item * check_allocations_for_assembly PARAMS |
678 | 679 |
|
679 | 680 |
Checks if enough quantity is allocated for production. Returns a trueish |
680 |
value if there is enough allocated, a falsish one otherwise. |
|
681 |
value if there is enough allocated, a falsish one otherwise (but see the |
|
682 |
parameter C<check_overfulfilment>). |
|
681 | 683 |
|
682 | 684 |
Accepted parameters: |
683 | 685 |
|
... | ... | |
695 | 697 |
|
696 | 698 |
An array ref of the allocations. |
697 | 699 |
|
700 |
=item * check_overfulfilment |
|
701 |
|
|
702 |
Whether or not overfulfilment should be checked. If more quantity is allocated |
|
703 |
than needed for production a falsish value is returned. Optional. |
|
704 |
|
|
698 | 705 |
=back |
699 | 706 |
|
700 | 707 |
=back |
Auch abrufbar als: Unified diff
S:H:Inventory: Optional Übererfüllung beachten bei Prüfung der Allokierung