Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision b36c1544

Von Bernd Bleßmann vor 10 Monaten hinzugefügt

t:inventory: Test f. produce_assembly: mehrere Allokierungen für ein Bestandteil

Unterschiede anzeigen:

t/wh/inventory.t
508 508
          "Comments for assembly with service productions are ok"
509 509
);
510 510

  
511
# check own allocations with more than one allocation per part
512
reset_db();
513
create_standard_stock();
514

  
515
set_stock(
516
  part => $part1,
517
  qty => 5,
518
  bin => $bin1,
519
  # no chargenumber
520
);
521
set_stock(
522
  part => $part1,
523
  qty => 5,
524
  bin => $bin1,
525
  chargenumber => 'CH1',
526
);
527
set_stock(
528
  part => $part1,
529
  qty => 2,
530
  bin => $bin1,
531
  chargenumber => 'CH2',
532
);
533
set_stock(
534
  part => $part2,
535
  qty => 6.34,
536
  bin => $bin1,
537
);
538

  
539
my @alloc1_1 = SL::Helper::Inventory::allocate(part => $part1, qty => 5);
540
my @alloc1_2 = SL::Helper::Inventory::allocate(part => $part1, qty => 5, chargenumber => 'CH1');
541
my @alloc1_3 = SL::Helper::Inventory::allocate(part => $part1, qty => 2, chargenumber => 'CH2');
542
@alloc2      = SL::Helper::Inventory::allocate(part => $part2, qty => 6.34);
543

  
544
local $::instance_conf->data->{produce_assembly_transfer_service} = 0;
545

  
546
lives_ok {
547
  SL::Helper::Inventory::produce_assembly(
548
    part          => $assembly_service,
549
    qty           => 1,
550
    allocations => [ @alloc1_1, @alloc1_2, @alloc1_3, @alloc2 ],
551

  
552
    # where to put it
553
    bin          => $bin1,
554
  );
555
} 'no exception on produce_assembly with more than one own allocation per part';
556

  
557
is(SL::Helper::Inventory::get_stock(part => $assembly_service), "1.00000", 'produce with own allocations works');
558
is(SL::Helper::Inventory::get_stock(part => $part1), "0.00000", 'and consumes...');
559
is(SL::Helper::Inventory::get_stock(part => $part2), "0.00000", '..the materials');
560

  
511 561

  
512 562

  
513 563
# bestbefore tests

Auch abrufbar als: Unified diff