update stock jtl export

This commit is contained in:
Marko 2024-03-07 17:28:33 +01:00
parent d5ad48e468
commit 7e36873da3
No known key found for this signature in database
2 changed files with 16 additions and 5 deletions

View File

@ -58,11 +58,12 @@ class JtlExportCommand extends Command
*/ */
$jtl = new Jtl($this->productRepository, $this->warehouseRepository, $this->stockRepository, $this->logger, $rootPath); $jtl = new Jtl($this->productRepository, $this->warehouseRepository, $this->stockRepository, $this->logger, $rootPath);
//Export für Standartlager //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 //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'); $io->success('Ende JTL Export');

View File

@ -62,7 +62,12 @@ class Jtl
public function getProducts(array $prodIds, array $warehousesName): array public function getProducts(array $prodIds, array $warehousesName): array
{ {
$data = 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); $warehouse = $this->warehouseRepository->findByWarehouseByName($warehousesName);
@ -82,8 +87,13 @@ class Jtl
'lager' => '01' 'lager' => '01'
]; ];
} else { } else {
//Wenn Product nicht gefunden werden kann, dann setzte Bestand auf Null //setze Produkt auf 0 wenn kein Bestand vorhanden
$this->logger->info('No stock for warehouse ' . $w->getName()); $data[$p->getId() . $warehousesName] = [
'gtin' => $p->getGtin(),
'stock' => 0,
'warehouse' => $this->arrLager[$warehousesName] ?? 'Lager_' . $warehousesName,
'lager' => '01'
];
} }
} }