fix Hiltes import

This commit is contained in:
Marko 2023-09-13 16:09:09 +02:00
parent 88dd4a4c3d
commit 5bca054a32
No known key found for this signature in database
4 changed files with 6415 additions and 10962 deletions

File diff suppressed because it is too large Load Diff

View File

@ -168,7 +168,7 @@ class HiltesImport
* @return void * @return void
*/ */
protected function saveData(Array $arr){ protected function saveData(Array $arr){
dump($arr); //dump($arr);
#*** Speichert und/oder Holt WareHouse ab #*** Speichert und/oder Holt WareHouse ab
$wareHouse = $this->checkWareHouseName($arr[2]); $wareHouse = $this->checkWareHouseName($arr[2]);
@ -178,16 +178,16 @@ class HiltesImport
#*** Ermitteln ob schon ein ID vorhadnen für ProdId und WareHouseId #*** Ermitteln ob schon ein ID vorhadnen für ProdId und WareHouseId
if(!empty($wareHouse) && !empty($this->cachedStockIds[$prodId][$wareHouse->getId()])){ if(!empty($wareHouse) && !empty($this->cachedStockIds[$prodId][$wareHouse->getId()])){
$stock = $this->cachedStockIds[$prodId][$wareHouse->getId()]; $stock = $this->cachedStockIds[$prodId][$wareHouse->getId()];
#dd('JAAAAA'); //dd('JAAAAA');
}else{ }else{
$stock = new Stock(); $stock = new Stock();
$stock->setProductId($prodId); $stock->setProductId($prodId);
$stock->setWarehouse($wareHouse); $stock->setWarehouse($wareHouse);
} }
#dd('CHCEK'); //dd('CHCEK');
$stock->setInstock((int)$arr[2]); $stock->setInstock((int)$arr[1]);
#$stock->setWarehouseId($wareHouseId); #$stock->setWarehouseId($wareHouseId);
#dump($stock); //dump($stock);
$this->stockRepository->save($stock,true); $this->stockRepository->save($stock,true);
#dd($stock); #dd($stock);
@ -263,9 +263,9 @@ class HiltesImport
#*** WEnn keine geCached Id Vorhanden #*** WEnn keine geCached Id Vorhanden
if(empty($this->cachedProdIds[$gtin])){ if(empty($this->cachedProdIds[$gtin])){
#*** Check #*** Check
dump($gtin); //dump($gtin);
$prod2 = $this->productRepository->findOneBy(['gtin'=> $gtin]); $prod2 = $this->productRepository->findOneBy(['gtin'=> $gtin]);
dump($prod2); //dump($prod2);
if(empty($prod2)){ if(empty($prod2)){
$prod = new Product(); $prod = new Product();
$prod->setGtin($gtin); $prod->setGtin($gtin);

View File

@ -74,7 +74,7 @@ class Jtl
public function createExportFile($data): void public function createExportFile($data): void
{ {
try { try {
$writer = Writer::createFromPath('./jtl/cds-export.csv', 'x'); $writer = Writer::createFromPath(getcwd().'/jtl/cds-export.csv', 'w+');
$writer->insertAll(new \ArrayIterator($data)); $writer->insertAll(new \ArrayIterator($data));
}catch (\Exception $e){ }catch (\Exception $e){

View File

@ -23,7 +23,7 @@ class StockRepository extends ServiceEntityRepository
public function save(Stock $entity, bool $flush = false): void public function save(Stock $entity, bool $flush = false): void
{ {
//$entity->setUpdateTime(new \DateTime()); $entity->setUpdateTime(new \DateTime());
$this->getEntityManager()->persist($entity); $this->getEntityManager()->persist($entity);