add fixed export
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Marko
2023-12-15 17:51:24 +01:00
parent 5d9db25d73
commit 2747d53c50
5 changed files with 162 additions and 40 deletions

View File

@@ -69,34 +69,28 @@ class Jtl
if ($warehouse) {
foreach ($warehouse as $w) {
$stock = $this->stockRepository->findBy(['warehouse' => $w]);
$warehousesName = $w->getName();
if ($stock) {
foreach ($stock as $s) {
$warehouse = $s->getWarehouse();
$warehouseName = $warehouse->getName();
foreach ($products as $p) {
$stock = $this->stockRepository->findOneBy(['product_id' => $p->getId(), 'warehouse' => $w]);
if (isset($products[$s->getProductId()])) {
$data[$s->getProductId() . $warehouseName] = [
'gtin' => $products[$s->getProductId()]->getGtin(),
'stock' => $s->getInstock(),
'warehouse' => $this->arrLager[$warehouseName] ?? 'Lager_' . $warehouseName,
'lager' => '01'
];
} else {
$this->logger->info('No product for stock ' . $s->getProductId());
}
if ($stock) {
$data[$p->getId() . $warehousesName] = [
'gtin' => $p->getGtin(),
'stock' => $stock->getInstock(),
'warehouse' => $this->arrLager[$warehousesName] ?? 'Lager_' . $warehousesName,
'lager' => '01'
];
} else {
//Wenn Product nicht gefunden werden kann, dann setzte Bestand auf Null
$this->logger->info('No stock for warehouse ' . $w->getName());
}
if ($p->getGtin() == '0193128415976') {
dump($data[$p->getId() . $warehousesName]);
}
} else {
//Wenn Product nicht gefunden werden kann, dann setzte Bestand auf Null
// $data[] = [
// 'gtin' => $products[$s->getProductId()]->getGtin(),
// 'stock' => 0,
// 'warehouse' => 0
// ];
$this->logger->info('No stock for product ' . s->getProductId()->getId());
}
}
}