diff --git a/assets/controllers/elements/project_select_controller.js b/assets/controllers/elements/project_select_controller.js
deleted file mode 100644
index 98702d41..00000000
--- a/assets/controllers/elements/project_select_controller.js
+++ /dev/null
@@ -1,70 +0,0 @@
-import {Controller} from "@hotwired/stimulus";
-
-import "tom-select/dist/css/tom-select.bootstrap5.css";
-import '../../css/components/tom-select_extensions.css';
-import TomSelect from "tom-select";
-import {marked} from "marked";
-
-export default class extends Controller {
- _tomSelect;
-
- connect() {
-
- let settings = {
- allowEmptyOption: true,
- plugins: ['dropdown_input', 'clear_button'],
- searchField: ["name", "description", "category", "footprint"],
- valueField: "id",
- labelField: "name",
- preload: "focus",
- render: {
- item: (data, escape) => {
- return '' + (data.image ? "" : "") + escape(data.name) + '';
- },
- option: (data, escape) => {
- if(data.text) {
- return '' + escape(data.text) + '';
- }
-
- let tmp = '
' + marked.parseInline(data.description) + '
' : "") + - (data.category ? '' + escape(data.category) : ""); - - return tmp + '
' + - '|
-
-
-
- |
- {% trans %}part.table.name{% endtrans %} | -{% trans %}assembly.bom.mountnames{% endtrans %} | -{% trans %}assembly.build.required_qty{% endtrans %} | -
|---|---|---|---|
|
-
-
- {#
- |
- - {% if bom_entry.part %} - {{ bom_entry.part.name }} {% if bom_entry.name %}({{ bom_entry.name }}){% endif %} - {% elseif bom_entry.referencedAssembly %} - {{ 'assembly.build.form.referencedAssembly'|trans({'%name%': bom_entry.referencedAssembly.name}) }} {% if bom_entry.name %}({{ bom_entry.name }}){% endif %} - {% else %} - {{ bom_entry.name }} - {% endif %} - | -- {% for tag in bom_entry.mountnames|split(',') %} - {{ tag | trim }} - {% endfor %} - | -- {{ build_request.neededAmountForBOMEntry(bom_entry) | format_amount(bom_entry.part.partUnit ?? null) }} {% trans %}assembly.builds.needed{% endtrans %} - (= {{ number_of_builds }} x {{ bom_entry.quantity | format_amount(bom_entry.part.partUnit ?? null) }}) - | -
|
- {% set lots = build_request.partLotsForBOMEntry(bom_entry) %}
- {% if lots is not null %}
- {% for lot in lots %}
- {# @var lot \App\Entity\Parts\PartLot #}
-
-
-
- {% endfor %}
- {% endif %}
-
- {{ form_errors(form["lot_"~lot.id]) }}
- {{ form_widget(form["lot_"~lot.id]) }}
-
-
- / {{ lot.amount | format_amount(lot.part.partUnit) }} {% trans %}assembly.builds.stocked{% endtrans %}
-
- |
- |||
{% trans %}assembly.build.help{% endtrans %}
- - {% include 'assemblies/build/_form.html.twig' %} - - -{% endblock %} \ No newline at end of file diff --git a/templates/assemblies/info/_builds.html.twig b/templates/assemblies/info/_builds.html.twig deleted file mode 100644 index 780c8c60..00000000 --- a/templates/assemblies/info/_builds.html.twig +++ /dev/null @@ -1,40 +0,0 @@ -{% set can_build = buildHelper.assemblyBuildable(assembly) %} - -{% import "components/assemblies.macro.html.twig" as assembly_macros %} - -{% if assembly.status is not empty and assembly.status != "in_production" %} -{% trans %}assembly.builds.no_stocked_builds{% endtrans %}: {{ assembly.buildPart.amountSum }}
-{% endif %} \ No newline at end of file diff --git a/templates/components/assemblies.macro.html.twig b/templates/components/assemblies.macro.html.twig deleted file mode 100644 index d59005e0..00000000 --- a/templates/components/assemblies.macro.html.twig +++ /dev/null @@ -1,8 +0,0 @@ -{% macro assembly_bom_entry_with_missing_instock(assembly_bom_entry, number_of_builds = 1) %} - {# @var \App\Entity\AssemblySystem\AssemblyBOMEntry assembly_bom_entry #} - {{ assembly_bom_entry.part.name }} - {% if assembly_bom_entry.name %} ({{ assembly_bom_entry.name }}){% endif %}: - {{ assembly_bom_entry.part.amountSum | format_amount(assembly_bom_entry.part.partUnit) }} {% trans %}assembly.builds.stocked{% endtrans %} - / - {{ (assembly_bom_entry.quantity * number_of_builds) | format_amount(assembly_bom_entry.part.partUnit) }} {% trans %}assembly.builds.needed{% endtrans %} -{% endmacro %} \ No newline at end of file diff --git a/tests/Helpers/Assemblies/AssemblyBuildRequestTest.php b/tests/Helpers/Assemblies/AssemblyBuildRequestTest.php deleted file mode 100644 index 210e3301..00000000 --- a/tests/Helpers/Assemblies/AssemblyBuildRequestTest.php +++ /dev/null @@ -1,177 +0,0 @@ -. - */ -namespace App\Tests\Helpers\Assemblies; - -use App\Entity\Parts\MeasurementUnit; -use App\Entity\Parts\Part; -use App\Entity\Parts\PartLot; -use App\Entity\AssemblySystem\Assembly; -use App\Entity\AssemblySystem\AssemblyBOMEntry; -use App\Helpers\Assemblies\AssemblyBuildRequest; -use PHPUnit\Framework\TestCase; - -class AssemblyBuildRequestTest extends TestCase -{ - - /** @var MeasurementUnit $float_unit */ - private MeasurementUnit $float_unit; - - /** @var Assembly */ - private Assembly $assembly1; - /** @var AssemblyBOMEntry */ - private AssemblyBOMEntry $bom_entry1a; - /** @var AssemblyBOMEntry */ - private AssemblyBOMEntry $bom_entry1b; - /** @var AssemblyBOMEntry */ - private AssemblyBOMEntry $bom_entry1c; - - private PartLot $lot1a; - private PartLot $lot1b; - private PartLot $lot2; - - /** @var Part */ - private Part $part1; - /** @var Part */ - private Part $part2; - - - public function setUp(): void - { - $this->float_unit = new MeasurementUnit(); - $this->float_unit->setName('float'); - $this->float_unit->setUnit('f'); - $this->float_unit->setIsInteger(false); - $this->float_unit->setUseSIPrefix(true); - - //Setup some example parts and part lots - $this->part1 = new Part(); - $this->part1->setName('Part 1'); - $this->lot1a = new class extends PartLot { - public function getID(): ?int - { - return 1; - } - }; - $this->part1->addPartLot($this->lot1a); - $this->lot1a->setAmount(10); - $this->lot1a->setDescription('Lot 1a'); - - $this->lot1b = new class extends PartLot { - public function getID(): ?int - { - return 2; - } - }; - $this->part1->addPartLot($this->lot1b); - $this->lot1b->setAmount(20); - $this->lot1b->setDescription('Lot 1b'); - - $this->part2 = new Part(); - - $this->part2->setName('Part 2'); - $this->part2->setPartUnit($this->float_unit); - $this->lot2 = new PartLot(); - $this->part2->addPartLot($this->lot2); - $this->lot2->setAmount(2.5); - $this->lot2->setDescription('Lot 2'); - - $this->bom_entry1a = new AssemblyBOMEntry(); - $this->bom_entry1a->setPart($this->part1); - $this->bom_entry1a->setQuantity(2); - - $this->bom_entry1b = new AssemblyBOMEntry(); - $this->bom_entry1b->setPart($this->part2); - $this->bom_entry1b->setQuantity(1.5); - - $this->bom_entry1c = new AssemblyBOMEntry(); - $this->bom_entry1c->setName('Non-part BOM entry'); - $this->bom_entry1c->setQuantity(4); - - - $this->assembly1 = new Assembly(); - $this->assembly1->setName('Assembly 1'); - $this->assembly1->addBomEntry($this->bom_entry1a); - $this->assembly1->addBomEntry($this->bom_entry1b); - $this->assembly1->addBomEntry($this->bom_entry1c); - } - - public function testInitialization(): void - { - //The values should be already prefilled correctly - $request = new AssemblyBuildRequest($this->assembly1, 10); - //We need totally 20: Take 10 from the first (maximum 10) and 10 from the second (maximum 20) - $this->assertEqualsWithDelta(10.0, $request->getLotWithdrawAmount($this->lot1a), PHP_FLOAT_EPSILON); - $this->assertEqualsWithDelta(10.0, $request->getLotWithdrawAmount($this->lot1b), PHP_FLOAT_EPSILON); - - //If the needed amount is higher than the maximum, we should get the maximum - $this->assertEqualsWithDelta(2.5, $request->getLotWithdrawAmount($this->lot2), PHP_FLOAT_EPSILON); - } - - public function testGetNumberOfBuilds(): void - { - $build_request = new AssemblyBuildRequest($this->assembly1, 5); - $this->assertSame(5, $build_request->getNumberOfBuilds()); - } - - public function testGetAssembly(): void - { - $build_request = new AssemblyBuildRequest($this->assembly1, 5); - $this->assertEquals($this->assembly1, $build_request->getAssembly()); - } - - public function testGetNeededAmountForBOMEntry(): void - { - $build_request = new AssemblyBuildRequest($this->assembly1, 5); - $this->assertEqualsWithDelta(10.0, $build_request->getNeededAmountForBOMEntry($this->bom_entry1a), PHP_FLOAT_EPSILON); - $this->assertEqualsWithDelta(7.5, $build_request->getNeededAmountForBOMEntry($this->bom_entry1b), PHP_FLOAT_EPSILON); - $this->assertEqualsWithDelta(20.0, $build_request->getNeededAmountForBOMEntry($this->bom_entry1c), PHP_FLOAT_EPSILON); - } - - public function testGetSetLotWithdrawAmount(): void - { - $build_request = new AssemblyBuildRequest($this->assembly1, 5); - - //We can set the amount for a lot either via the lot object or via the ID - $build_request->setLotWithdrawAmount($this->lot1a, 2); - $build_request->setLotWithdrawAmount($this->lot1b->getID(), 3); - - //And it should be possible to get the amount via the lot object or via the ID - $this->assertEqualsWithDelta(2.0, $build_request->getLotWithdrawAmount($this->lot1a->getID()), PHP_FLOAT_EPSILON); - $this->assertEqualsWithDelta(3.0, $build_request->getLotWithdrawAmount($this->lot1b), PHP_FLOAT_EPSILON); - } - - public function testGetWithdrawAmountSum(): void - { - //The sum of all withdraw amounts for an BOM entry (over all lots of the associated part) should be correct - $build_request = new AssemblyBuildRequest($this->assembly1, 5); - - $build_request->setLotWithdrawAmount($this->lot1a, 2); - $build_request->setLotWithdrawAmount($this->lot1b, 3); - - $this->assertEqualsWithDelta(5.0, $build_request->getWithdrawAmountSum($this->bom_entry1a), PHP_FLOAT_EPSILON); - $build_request->setLotWithdrawAmount($this->lot2, 1.5); - $this->assertEqualsWithDelta(1.5, $build_request->getWithdrawAmountSum($this->bom_entry1b), PHP_FLOAT_EPSILON); - } - - -} diff --git a/tests/Services/AssemblySystem/AssemblyBuildHelperTest.php b/tests/Services/AssemblySystem/AssemblyBuildHelperTest.php deleted file mode 100644 index c513ed8d..00000000 --- a/tests/Services/AssemblySystem/AssemblyBuildHelperTest.php +++ /dev/null @@ -1,117 +0,0 @@ -. - */ -namespace App\Tests\Services\AssemblySystem; - -use App\Entity\AssemblySystem\Assembly; -use App\Entity\AssemblySystem\AssemblyBOMEntry; -use App\Entity\Parts\Part; -use App\Entity\Parts\PartLot; -use App\Services\AssemblySystem\AssemblyBuildHelper; -use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; - -class AssemblyBuildHelperTest extends WebTestCase -{ - /** @var AssemblyBuildHelper */ - protected $service; - - protected function setUp(): void - { - self::bootKernel(); - $this->service = self::getContainer()->get(AssemblyBuildHelper::class); - } - - public function testGetMaximumBuildableCountForBOMEntryNonPartBomEntry(): void - { - $bom_entry = new AssemblyBOMEntry(); - $bom_entry->setPart(null); - $bom_entry->setQuantity(10); - $bom_entry->setName('Test'); - - $this->expectException(\InvalidArgumentException::class); - $this->service->getMaximumBuildableCountForBOMEntry($bom_entry); - } - - public function testGetMaximumBuildableCountForBOMEntry(): void - { - $assembly_bom_entry = new AssemblyBOMEntry(); - $assembly_bom_entry->setQuantity(10); - - $part = new Part(); - $lot1 = new PartLot(); - $lot1->setAmount(120); - $lot2 = new PartLot(); - $lot2->setAmount(5); - $part->addPartLot($lot1); - $part->addPartLot($lot2); - - $assembly_bom_entry->setPart($part); - - //We have 125 parts in stock, so we can build 12 times the assembly (125 / 10 = 12.5) - $this->assertSame(12, $this->service->getMaximumBuildableCountForBOMEntry($assembly_bom_entry)); - - - $lot1->setAmount(0); - //We have 5 parts in stock, so we can build 0 times the assembly (5 / 10 = 0.5) - $this->assertSame(0, $this->service->getMaximumBuildableCountForBOMEntry($assembly_bom_entry)); - } - - public function testGetMaximumBuildableCount(): void - { - $assembly = new Assembly(); - - $assembly_bom_entry1 = new AssemblyBOMEntry(); - $assembly_bom_entry1->setQuantity(10); - $part = new Part(); - $lot1 = new PartLot(); - $lot1->setAmount(120); - $lot2 = new PartLot(); - $lot2->setAmount(5); - $part->addPartLot($lot1); - $part->addPartLot($lot2); - $assembly_bom_entry1->setPart($part); - $assembly->addBomEntry($assembly_bom_entry1); - - $assembly_bom_entry2 = new AssemblyBOMEntry(); - $assembly_bom_entry2->setQuantity(5); - $part2 = new Part(); - $lot3 = new PartLot(); - $lot3->setAmount(10); - $part2->addPartLot($lot3); - $assembly_bom_entry2->setPart($part2); - $assembly->addBomEntry($assembly_bom_entry2); - - $assembly->addBomEntry((new AssemblyBOMEntry())->setName('Non part entry')->setQuantity(1)); - - //Restricted by the few parts in stock of part2 - $this->assertSame(2, $this->service->getMaximumBuildableCount($assembly)); - - $lot3->setAmount(1000); - //Now the build count is restricted by the few parts in stock of part1 - $this->assertSame(12, $this->service->getMaximumBuildableCount($assembly)); - - $lot3->setAmount(0); - //Now the build count must be 0, as we have no parts in stock - $this->assertSame(0, $this->service->getMaximumBuildableCount($assembly)); - - } -} diff --git a/tests/Services/AssemblySystem/AssemblyBuildPartHelperTest.php b/tests/Services/AssemblySystem/AssemblyBuildPartHelperTest.php deleted file mode 100644 index b8aa0ddc..00000000 --- a/tests/Services/AssemblySystem/AssemblyBuildPartHelperTest.php +++ /dev/null @@ -1,52 +0,0 @@ -. - */ -namespace App\Tests\Services\AssemblySystem; - -use App\Entity\AssemblySystem\Assembly; -use App\Services\AssemblySystem\AssemblyBuildPartHelper; -use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; - -class AssemblyBuildPartHelperTest extends WebTestCase -{ - /** @var AssemblyBuildPartHelper */ - protected $service; - - protected function setUp(): void - { - self::bootKernel(); - $this->service = self::getContainer()->get(AssemblyBuildPartHelper::class); - } - - public function testGetPartInitialization(): void - { - $assembly = new Assembly(); - $assembly->setName('Assembly 1'); - $assembly->setDescription('Description 1'); - - $part = $this->service->getPartInitialization($assembly); - $this->assertSame('Assembly 1', $part->getName()); - $this->assertSame('Description 1', $part->getDescription()); - $this->assertSame($assembly, $part->getBuiltAssembly()); - $this->assertSame($part, $assembly->getBuildPart()); - } -} diff --git a/translations/messages.cs.xlf b/translations/messages.cs.xlf index 9e3a0b61..b03cdc4a 100644 --- a/translations/messages.cs.xlf +++ b/translations/messages.cs.xlf @@ -13774,24 +13774,6 @@ Vezměte prosím na vědomí, že se nemůžete vydávat za uživatele se zakáz