JTL Import
This commit is contained in:
@@ -68,7 +68,7 @@ class HiltesImport
|
||||
{
|
||||
$finder = Finder::create();
|
||||
$finder
|
||||
->in($this->currentDirPath.'/hiltes/h2c/')
|
||||
->in($this->currentDirPath.'/hiltes/')
|
||||
->depth(0);
|
||||
#->filter(static function (SplFileInfo $file) {
|
||||
# return $file->isDir() || \preg_match('/\.(php|json)$/', $file->getPathname());
|
||||
@@ -168,12 +168,13 @@ class HiltesImport
|
||||
* @return void
|
||||
*/
|
||||
protected function saveData(Array $arr){
|
||||
#dump($arr);
|
||||
dump($arr);
|
||||
#*** Speichert und/oder Holt WareHouse ab
|
||||
$wareHouse = $this->checkWareHouseName($arr[0]);
|
||||
|
||||
#*** PRodukt wird angelegt oder geholt ****
|
||||
#filiale;etikettnr;menge;modellnr;modellbez
|
||||
$prodId = $this->checkProduct($arr[1],$arr[3],$arr[4]);
|
||||
#filiale;etikettnr;menge;
|
||||
$prodId = $this->checkProduct($arr[1]);
|
||||
#*** Ermitteln ob schon ein ID vorhadnen für ProdId und WareHouseId
|
||||
if(!empty($wareHouse) && !empty($this->cachedStockIds[$prodId][$wareHouse->getId()])){
|
||||
$stock = $this->cachedStockIds[$prodId][$wareHouse->getId()];
|
||||
@@ -231,13 +232,11 @@ class HiltesImport
|
||||
if(empty($this->cachedWarehouseIds[$wareHouseName])){
|
||||
#*** Check
|
||||
$warehouse2 = $this->warehouseRepository->findOneBy(['id'=> (int)$wareHouseName]);
|
||||
//dump($warehouse2);
|
||||
if(empty($warehouse2)){
|
||||
$warehouse = new Warehouse();
|
||||
$warehouse->setId((int)$wareHouseName);
|
||||
$warehouse->setName($wareHouseName);
|
||||
#
|
||||
|
||||
$this->warehouseRepository->save($warehouse,true);
|
||||
|
||||
$this->cachedWarehouseIds[$wareHouseName] = $warehouse;
|
||||
@@ -260,18 +259,19 @@ class HiltesImport
|
||||
* @param string $modellBez
|
||||
* @return false|int|mixed|null
|
||||
*/
|
||||
private function checkProduct(string $gtin,string $modellNr,string $modellBez){
|
||||
private function checkProduct(string $gtin){
|
||||
#*** WEnn keine geCached Id Vorhanden
|
||||
if(empty($this->cachedProdIds[$gtin])){
|
||||
#*** Check
|
||||
dump($gtin);
|
||||
$prod2 = $this->productRepository->findOneBy(['gtin'=> $gtin]);
|
||||
#dump($warehouse2);
|
||||
dump($prod2);
|
||||
if(empty($prod2)){
|
||||
$prod = new Product();
|
||||
$prod->setGtin($gtin);
|
||||
$prod->setModellNr($modellNr);
|
||||
$prod->setModellBez($modellBez);
|
||||
$prod->setShopwareId("");
|
||||
// $prod->setModellNr($modellNr);
|
||||
// $prod->setModellBez($modellBez);
|
||||
// $prod->setShopwareId("");
|
||||
#
|
||||
$this->cachedProdIds[$gtin] = $this->productRepository->save($prod,true);
|
||||
#*****************
|
||||
@@ -286,6 +286,4 @@ class HiltesImport
|
||||
return $this->cachedProdIds[$gtin];
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user