fix Hiltes import

This commit is contained in:
Marko
2023-09-15 17:13:06 +02:00
parent 5bca054a32
commit 20a96ed78b
9 changed files with 11553 additions and 17854 deletions

View File

@@ -55,6 +55,9 @@ class HiltesImport
}
}
dump("Imported $count stocks");
//remove fertig file
unlink($this->currentDirPath.'/hiltes/h2c/WS.FERTIG');
}else
return array('success'=>1,'text'=>'No Files');
}else
@@ -77,10 +80,10 @@ class HiltesImport
if ($finder->hasResults()) {
#dump($finder);
foreach ($finder as $file) {
if($file->getRelativePathname()=='WS.FERTIG'){
// if($file->getRelativePathname()=='WS.FERTIG'){
$hasFoundFertigFile = true;
continue;
}
// continue;
// }
$this->arrData['orgFiles']['data'][] = array(
'realPath' => $file->getRealPath(),
'fileSize' => $file->getFileInfo()->getSize(),
@@ -134,6 +137,8 @@ class HiltesImport
}
unlink($file->getRealPath());
dump($c . ' Datensätze importiert');
return $c;
}
@@ -170,56 +175,27 @@ class HiltesImport
protected function saveData(Array $arr){
//dump($arr);
#*** Speichert und/oder Holt WareHouse ab
$wareHouse = $this->checkWareHouseName($arr[2]);
$wareHouse = $this->checkWareHouseName($arr[3]);
#*** PRodukt wird angelegt oder geholt ****
#filiale;etikettnr;menge;
$prodId = $this->checkProduct($arr[0]);
#*** 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()];
$gtin = $this->checkProduct(substr($arr[0],1));
#*** Ermitteln ob schon ein ID vorhanden für ProdId und WareHouseId
if(!empty($wareHouse) && !empty($this->cachedStockIds[$gtin][$wareHouse->getId()])){
$stock = $this->cachedStockIds[$gtin][$wareHouse->getId()];
//dd('JAAAAA');
}else{
$stock = new Stock();
$stock->setProductId($prodId);
$stock->setProductId($gtin);
$stock->setWarehouse($wareHouse);
}
//dd('CHCEK');
$stock->setInstock((int)$arr[1]);
$stock->setInstock((int)$arr[1]/100);
#$stock->setWarehouseId($wareHouseId);
//dump($stock);
$this->stockRepository->save($stock,true);
#dd($stock);
//$stock->setStock((int)$arr[2]);
#filiale;
//
// $warehouse = $this->warehouseRepository->findOneBy(['id'=> $arr[2]]);
//
//
//
// if($warehouse instanceof Warehouse){
// $stock->setWarehouseId($warehouse->getId());
// }else{
// $warehouse = new Warehouse();
// $warehouse->setId((int)$arr[2]);
// $warehouse->setPriority(0);
// $id = $this->warehouseRepository->add($warehouse, true);
// # $stock->setWarehouseId($id);
// }
#
// $stock->setWarehouseId($warehouse->getId());
// try{
// $this->stockRepository->upsert($stock);
// }catch (\Exception $e){
// $this->logger->error($e->getMessage());
// dump($e->getMessage());
// }
}
@@ -228,6 +204,8 @@ class HiltesImport
* @return Warehouse|false|int|mixed|null
*/
private function checkWareHouseName(string $wareHouseName){
$wareHouseName = ltrim($wareHouseName,0);
#*** WEnn keine geCached Id Vorhanden
if(empty($this->cachedWarehouseIds[$wareHouseName])){
#*** Check