This commit is contained in:
@@ -44,9 +44,10 @@ class HiltesImport
|
||||
|
||||
|
||||
/**
|
||||
* @return void
|
||||
* @param bool $delta
|
||||
* @return array
|
||||
*/
|
||||
public function startImport($delta = false)
|
||||
public function startImport(bool $delta = false): array
|
||||
{
|
||||
#*** Holt alle Dateien
|
||||
if ($this->getFiles($delta)) {
|
||||
@@ -63,18 +64,20 @@ class HiltesImport
|
||||
}
|
||||
}
|
||||
$this->logger->info("Imported $count stocks");
|
||||
return $this->cachedProdIds;
|
||||
} else {
|
||||
$this->logger->info('No Files');
|
||||
}
|
||||
} else {
|
||||
throw new RuntimeException('No Files to Import');
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function getFiles($delta = false): bool
|
||||
protected function getFiles(bool $delta = false): bool
|
||||
{
|
||||
$finder = Finder::create();
|
||||
$finder
|
||||
@@ -230,9 +233,9 @@ class HiltesImport
|
||||
if (empty($product)) {
|
||||
$product = new Product();
|
||||
$product->setGtin($gtin);
|
||||
$this->cachedProdIds[$gtin] = $this->productRepository->save($product, true);
|
||||
$this->cachedProdIds["$gtin"] = $this->productRepository->save($product, true);
|
||||
} else {
|
||||
$this->cachedProdIds[$gtin] = $product->getId();
|
||||
$this->cachedProdIds["$gtin"] = $product->getId();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -59,10 +59,10 @@ class Jtl
|
||||
* @param array $warehousesName
|
||||
* @return array
|
||||
*/
|
||||
public function getProducts(array $warehousesName): array
|
||||
public function getProducts(array $prodIds, array $warehousesName): array
|
||||
{
|
||||
$data = array();
|
||||
$products = $this->productRepository->findAll();
|
||||
$products = $this->productRepository->findById($prodIds);
|
||||
|
||||
foreach ($warehousesName as $wn) {
|
||||
$warehouse = $this->warehouseRepository->findByWarehouseByName($wn);
|
||||
@@ -82,7 +82,7 @@ class Jtl
|
||||
$data[$s->getProductId() . $warehouseName] = [
|
||||
'gtin' => $products[$s->getProductId()]->getGtin(),
|
||||
'stock' => $s->getInstock(),
|
||||
'warehouse' => $this->arrLager[$warehouseName] ?? 'Lager ' . $warehouseName,
|
||||
'warehouse' => $this->arrLager[$warehouseName] ?? 'Lager_' . $warehouseName,
|
||||
'lager' => '01'
|
||||
];
|
||||
|
||||
@@ -97,7 +97,7 @@ class Jtl
|
||||
// 'stock' => 0,
|
||||
// 'warehouse' => 0
|
||||
// ];
|
||||
// $this->logger->info('No stock for product ' . s->getProductId()->getId());
|
||||
$this->logger->info('No stock for product ' . s->getProductId()->getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user