diff --git a/src/Command/JtlExportCommand.php b/src/Command/JtlExportCommand.php index 8e1f7c2..0cfd8c3 100644 --- a/src/Command/JtlExportCommand.php +++ b/src/Command/JtlExportCommand.php @@ -58,11 +58,12 @@ class JtlExportCommand extends Command */ $jtl = new Jtl($this->productRepository, $this->warehouseRepository, $this->stockRepository, $this->logger, $rootPath); + //Export für Standartlager - $jtl->createExportFile($jtl->getProducts(['1', '3', '5', '10']), 'standard' . ($delta ? '_delta' : '')); + $jtl->createExportFile($jtl->getProducts([0], ['1', '3', '5', '10']), 'standard' . ($delta ? '_delta' : '')); //Export für WMS Lager - $jtl->createExportFile($jtl->getProducts(['8']), 'wms' . ($delta ? '_delta' : '')); + $jtl->createExportFile($jtl->getProducts([0], ['8']), 'wms' . ($delta ? '_delta' : '')); $io->success('Ende JTL Export'); diff --git a/src/Helper/Jtl.php b/src/Helper/Jtl.php index 1407c00..461ddd0 100644 --- a/src/Helper/Jtl.php +++ b/src/Helper/Jtl.php @@ -62,7 +62,12 @@ class Jtl public function getProducts(array $prodIds, array $warehousesName): array { $data = array(); - $products = $this->productRepository->findById($prodIds); + if ($prodIds == array(0)) { + $products = $this->productRepository->findAll(); + } else { + $products = $this->productRepository->findById($prodIds); + } + $warehouse = $this->warehouseRepository->findByWarehouseByName($warehousesName); @@ -82,8 +87,13 @@ class Jtl 'lager' => '01' ]; } else { - //Wenn Product nicht gefunden werden kann, dann setzte Bestand auf Null - $this->logger->info('No stock for warehouse ' . $w->getName()); + //setze Produkt auf 0 wenn kein Bestand vorhanden + $data[$p->getId() . $warehousesName] = [ + 'gtin' => $p->getGtin(), + 'stock' => 0, + 'warehouse' => $this->arrLager[$warehousesName] ?? 'Lager_' . $warehousesName, + 'lager' => '01' + ]; } }