This commit is contained in:
@@ -27,15 +27,17 @@ class HiltesImport
|
||||
private $logger;
|
||||
private $cachedProdIds;
|
||||
private $cachedStockIds;
|
||||
private $rootPath;
|
||||
|
||||
public function __construct(ProductRepository $productRepository, WarehouseRepository $warehouseRepository, StockRepository $stockRepository, LoggerInterface $logger)
|
||||
public function __construct(ProductRepository $productRepository, WarehouseRepository $warehouseRepository, StockRepository $stockRepository, LoggerInterface $logger, string $rootPath)
|
||||
{
|
||||
$this->productRepository = $productRepository;
|
||||
$this->warehouseRepository = $warehouseRepository;
|
||||
$this->stockRepository = $stockRepository;
|
||||
$this->logger = $logger;
|
||||
$this->rootPath = $rootPath;
|
||||
|
||||
$this->currentDirPath = getcwd() . '/www';
|
||||
$this->currentDirPath = $this->rootPath;
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +73,7 @@ class HiltesImport
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function getFiles($delta = false)
|
||||
protected function getFiles($delta = false): bool
|
||||
{
|
||||
$finder = Finder::create();
|
||||
$finder
|
||||
@@ -128,8 +130,10 @@ class HiltesImport
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
|
||||
unlink($srcFile);
|
||||
unlink($srcFile . '.Ende');
|
||||
// unlink($srcFile);
|
||||
// unlink($srcFile . '.Ende');
|
||||
|
||||
unlink($this->rootPath . '/hiltes/h2c/WS.FERTIG');
|
||||
|
||||
$this->logger->info($count . ' Datensätze importiert');
|
||||
|
||||
@@ -146,14 +150,22 @@ class HiltesImport
|
||||
}
|
||||
}
|
||||
|
||||
protected function trimArray(array &$arr)
|
||||
/**
|
||||
* @param array $arr
|
||||
* @return void
|
||||
*/
|
||||
protected function trimArray(array &$arr): void
|
||||
{
|
||||
foreach ($arr as $k => $v) {
|
||||
$arr[$k] = trim($v);
|
||||
}
|
||||
}
|
||||
|
||||
protected function saveData(array $data)
|
||||
/**
|
||||
* @param array $data
|
||||
* @return void
|
||||
*/
|
||||
protected function saveData(array $data): void
|
||||
{
|
||||
$warehouse = $this->checkWarehouseName($data[3]);
|
||||
$gtin = $this->checkProduct(substr($data[0], 1));
|
||||
@@ -170,6 +182,10 @@ class HiltesImport
|
||||
$this->stockRepository->save($stock, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $warehouseName
|
||||
* @return Warehouse|false|mixed|null
|
||||
*/
|
||||
private function checkWarehouseName(string $warehouseName)
|
||||
{
|
||||
$warehouseName = ltrim($warehouseName, 0);
|
||||
|
||||
Reference in New Issue
Block a user