Revision a0fa7bc1
Von Sven Schöling vor etwa 4 Jahren hinzugefügt
SL/Helper/Inventory.pm | ||
---|---|---|
217 | 217 |
for my $assembly ($part->assemblies) { |
218 | 218 |
next if $assembly->part->dispotype eq 'no_stock'; |
219 | 219 |
|
220 |
my $tmpqty = $assembly->assembly_part->is_recipe ? $assembly->qty * $qty / $assembly->assembly_part->scalebasis |
|
221 |
: $assembly->part->unit eq 'Stck' ? ceil($assembly->qty * $qty) |
|
220 |
my $tmpqty = $assembly->part->unit eq 'Stck' ? ceil($assembly->qty * $qty) |
|
222 | 221 |
: $assembly->qty * $qty; |
223 | 222 |
$parts_to_allocate{ $assembly->part->id } //= 0; |
224 | 223 |
$parts_to_allocate{ $assembly->part->id } += $tmpqty; |
... | ... | |
302 | 301 |
my $for_object_id = $params{for_object_id}; |
303 | 302 |
my $comment = $params{comment} // ''; |
304 | 303 |
|
305 |
my $production_order_item = $params{production_order_item}; |
|
306 | 304 |
my $invoice = $params{invoice}; |
307 | 305 |
my $project = $params{project}; |
308 | 306 |
|
... | ... | |
318 | 316 |
if (!$params{no_check_allocations} && !$params{auto_allocate}) { |
319 | 317 |
my %allocations_by_part = map { $_->parts_id => $_->qty } @$allocations; |
320 | 318 |
for my $assembly ($part->assemblies) { |
321 |
$allocations_by_part{ $assembly->parts_id } -= $assembly->qty * $qty; # TODO recipe factor
|
|
319 |
$allocations_by_part{ $assembly->parts_id } -= $assembly->qty * $qty; |
|
322 | 320 |
} |
323 | 321 |
|
324 | 322 |
die "allocations are insufficient for production" if any { $_ < 0 } values %allocations_by_part; |
... | ... | |
351 | 349 |
project => $project, |
352 | 350 |
invoice => $invoice, |
353 | 351 |
comment => $comment, |
354 |
prod => $production_order_item, |
|
355 | 352 |
employee => SL::DB::Manager::Employee->current, |
356 | 353 |
oe_id => $for_object_id, |
357 | 354 |
); |
... | ... | |
461 | 458 |
comment => $comment, # optional |
462 | 459 |
|
463 | 460 |
# links, all optional |
464 |
production_order_item => $item, |
|
465 | 461 |
); |
466 | 462 |
|
467 | 463 |
=head1 DESCRIPTION |
Auch abrufbar als: Unified diff
Inventory: production order und recipe features entfernt