Revision 3b322be4
Von Martin Helmling martin.helmling@octosoft.eu vor fast 4 Jahren hinzugefügt
SL/Helper/Inventory.pm | ||
---|---|---|
4 | 4 |
use Carp; |
5 | 5 |
use DateTime; |
6 | 6 |
use Exporter qw(import); |
7 |
use List::Util qw(min); |
|
7 |
use List::Util qw(min sum);
|
|
8 | 8 |
use List::UtilsBy qw(sort_by); |
9 | 9 |
use List::MoreUtils qw(any); |
10 | 10 |
|
... | ... | |
12 | 12 |
use SL::MoreCommon qw(listify); |
13 | 13 |
use SL::DBUtils qw(selectall_hashref_query selectrow_query); |
14 | 14 |
use SL::DB::TransferType; |
15 |
use SL::Helper::Number qw(_round_qty _qty); |
|
15 | 16 |
use SL::X; |
16 | 17 |
|
17 | 18 |
our @EXPORT_OK = qw(get_stock get_onhand allocate allocate_for_assembly produce_assembly check_constraints); |
... | ... | |
216 | 217 |
} |
217 | 218 |
if ($rest_qty > 0) { |
218 | 219 |
die SL::X::Inventory::Allocation->new( |
219 |
error => t8('not enough to allocate'),
|
|
220 |
error => 'not enough to allocate',
|
|
220 | 221 |
msg => t8("can not allocate #1 units of #2, missing #3 units", $qty, $part->displayable_name, $rest_qty), |
221 | 222 |
); |
222 | 223 |
} else { |
... | ... | |
282 | 283 |
warehouse_id => t8('Warehouses'), |
283 | 284 |
chargenumber => t8('Chargenumbers'), |
284 | 285 |
); |
285 |
my @allocs = grep { !$whitelist{$_->$accessor} } @$allocations; |
|
286 |
my @allocs = grep { $whitelist{$_->$accessor} } @$allocations; |
|
287 |
my $needed = sum map { $_->qty } grep { !$whitelist{$_->$accessor} } @$allocations; |
|
288 |
my $err = t8("Cannot allocate parts."); |
|
289 |
$err .= ' '.t8('part \'#\'1 in bin \'#2\' only with qty #3 (need additional #4) and chargenumber \'#5\'.', |
|
290 |
SL::DB::Part->load_cached($_->parts_id)->description, |
|
291 |
SL::DB::Bin->load_cached($_->bin_id)->full_description, |
|
292 |
_qty($_->qty), _qty($needed), $_->chargenumber ? $_->chargenumber : '--') for @allocs; |
|
286 | 293 |
die SL::X::Inventory::Allocation->new( |
287 |
accessor => $accessor, |
|
288 |
allocations => \@allocs, |
|
289 |
error => 'allocation constraints failure', |
|
290 |
msg => t8("Allocations didn't pass constraints for #1",$error_constraints{$_}), |
|
294 |
error => 'allocation constraints failure', |
|
295 |
msg => $err, |
|
291 | 296 |
); |
292 | 297 |
} |
293 | 298 |
} |
Auch abrufbar als: Unified diff
Inventory-Helper: falscher Fehlermeldung
Bei der Fehlermeldung wird das falsche Lager angezeigt.
Bisher wurde das Lager mit vorhandener Menge angezeigt, das nicht der Einschränkung entspricht.
Es muss aber entweder kein Lager oder ein Lager angezeigt werden, das den Einschränkungen entspricht
aber zuwenig Menge hat.
zu #11438