fix Hiltes import
This commit is contained in:
parent
5bca054a32
commit
20a96ed78b
@ -1 +0,0 @@
|
|||||||
22.06.2023 16:25:46
|
|
@ -1 +0,0 @@
|
|||||||
13.09.2023 14:22:44
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
17926
jtl/cds-export.csv
17926
jtl/cds-export.csv
File diff suppressed because it is too large
Load Diff
@ -42,10 +42,7 @@ class HiltesImportCommand extends Command
|
|||||||
}
|
}
|
||||||
protected function configure(): void
|
protected function configure(): void
|
||||||
{
|
{
|
||||||
$this
|
$this->addOption('delta', 'd', InputOption::VALUE_NONE, 'Delta Import');
|
||||||
->addArgument('arg1', InputArgument::OPTIONAL, 'Argument description')
|
|
||||||
->addOption('option1', null, InputOption::VALUE_NONE, 'Option description')
|
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||||
|
@ -55,6 +55,9 @@ class HiltesImport
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
dump("Imported $count stocks");
|
dump("Imported $count stocks");
|
||||||
|
//remove fertig file
|
||||||
|
unlink($this->currentDirPath.'/hiltes/h2c/WS.FERTIG');
|
||||||
|
|
||||||
}else
|
}else
|
||||||
return array('success'=>1,'text'=>'No Files');
|
return array('success'=>1,'text'=>'No Files');
|
||||||
}else
|
}else
|
||||||
@ -77,10 +80,10 @@ class HiltesImport
|
|||||||
if ($finder->hasResults()) {
|
if ($finder->hasResults()) {
|
||||||
#dump($finder);
|
#dump($finder);
|
||||||
foreach ($finder as $file) {
|
foreach ($finder as $file) {
|
||||||
if($file->getRelativePathname()=='WS.FERTIG'){
|
// if($file->getRelativePathname()=='WS.FERTIG'){
|
||||||
$hasFoundFertigFile = true;
|
$hasFoundFertigFile = true;
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
$this->arrData['orgFiles']['data'][] = array(
|
$this->arrData['orgFiles']['data'][] = array(
|
||||||
'realPath' => $file->getRealPath(),
|
'realPath' => $file->getRealPath(),
|
||||||
'fileSize' => $file->getFileInfo()->getSize(),
|
'fileSize' => $file->getFileInfo()->getSize(),
|
||||||
@ -134,6 +137,8 @@ class HiltesImport
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unlink($file->getRealPath());
|
||||||
|
|
||||||
dump($c . ' Datensätze importiert');
|
dump($c . ' Datensätze importiert');
|
||||||
return $c;
|
return $c;
|
||||||
}
|
}
|
||||||
@ -170,56 +175,27 @@ class HiltesImport
|
|||||||
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[3]);
|
||||||
|
|
||||||
#*** PRodukt wird angelegt oder geholt ****
|
#*** PRodukt wird angelegt oder geholt ****
|
||||||
#filiale;etikettnr;menge;
|
#filiale;etikettnr;menge;
|
||||||
$prodId = $this->checkProduct($arr[0]);
|
$gtin = $this->checkProduct(substr($arr[0],1));
|
||||||
#*** Ermitteln ob schon ein ID vorhadnen für ProdId und WareHouseId
|
#*** Ermitteln ob schon ein ID vorhanden für ProdId und WareHouseId
|
||||||
if(!empty($wareHouse) && !empty($this->cachedStockIds[$prodId][$wareHouse->getId()])){
|
if(!empty($wareHouse) && !empty($this->cachedStockIds[$gtin][$wareHouse->getId()])){
|
||||||
$stock = $this->cachedStockIds[$prodId][$wareHouse->getId()];
|
$stock = $this->cachedStockIds[$gtin][$wareHouse->getId()];
|
||||||
//dd('JAAAAA');
|
//dd('JAAAAA');
|
||||||
}else{
|
}else{
|
||||||
$stock = new Stock();
|
$stock = new Stock();
|
||||||
$stock->setProductId($prodId);
|
$stock->setProductId($gtin);
|
||||||
$stock->setWarehouse($wareHouse);
|
$stock->setWarehouse($wareHouse);
|
||||||
}
|
}
|
||||||
//dd('CHCEK');
|
//dd('CHCEK');
|
||||||
$stock->setInstock((int)$arr[1]);
|
$stock->setInstock((int)$arr[1]/100);
|
||||||
#$stock->setWarehouseId($wareHouseId);
|
#$stock->setWarehouseId($wareHouseId);
|
||||||
//dump($stock);
|
//dump($stock);
|
||||||
$this->stockRepository->save($stock,true);
|
$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
|
* @return Warehouse|false|int|mixed|null
|
||||||
*/
|
*/
|
||||||
private function checkWareHouseName(string $wareHouseName){
|
private function checkWareHouseName(string $wareHouseName){
|
||||||
|
|
||||||
|
$wareHouseName = ltrim($wareHouseName,0);
|
||||||
#*** WEnn keine geCached Id Vorhanden
|
#*** WEnn keine geCached Id Vorhanden
|
||||||
if(empty($this->cachedWarehouseIds[$wareHouseName])){
|
if(empty($this->cachedWarehouseIds[$wareHouseName])){
|
||||||
#*** Check
|
#*** Check
|
||||||
|
@ -16,6 +16,18 @@ class Jtl
|
|||||||
private $warehouseRepository;
|
private $warehouseRepository;
|
||||||
private $logger;
|
private $logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string[] $arrLager
|
||||||
|
* Lagernamen aus der JTL Wawi
|
||||||
|
*/
|
||||||
|
private $arrLager = array(
|
||||||
|
1 => 'Lager 1 - Standardlager',
|
||||||
|
3 => 'Lager 3 - DLX',
|
||||||
|
5 => 'Lager 5 - Verkaufsfilale',
|
||||||
|
8 => 'Lager 8 - Standardlager',
|
||||||
|
10 => 'Lager 10 - OJ EF',
|
||||||
|
);
|
||||||
|
|
||||||
public function __construct(ProductRepository $productRepository,WarehouseRepository $warehouseRepository,StockRepository $stockRepository, LoggerInterface $logger)
|
public function __construct(ProductRepository $productRepository,WarehouseRepository $warehouseRepository,StockRepository $stockRepository, LoggerInterface $logger)
|
||||||
{
|
{
|
||||||
$this->productRepository = $productRepository;
|
$this->productRepository = $productRepository;
|
||||||
@ -41,12 +53,12 @@ class Jtl
|
|||||||
if($stock){
|
if($stock){
|
||||||
foreach($stock as $s){
|
foreach($stock as $s){
|
||||||
$warehouse = $s->getWarehouse();
|
$warehouse = $s->getWarehouse();
|
||||||
$warehouseId = $warehouse->getId();
|
$warehouseName = $warehouse->getName();
|
||||||
|
|
||||||
$data[$product->getId().$warehouseId] = [
|
$data[$product->getId().$warehouseName] = [
|
||||||
'gtin' => $product->getGtin(),
|
'gtin' => $product->getGtin(),
|
||||||
'stock' => $s->getInstock(),
|
'stock' => $s->getInstock(),
|
||||||
'warehouse' => $warehouseId
|
'warehouse' => $this->arrLager[$warehouseName] ?? 'Lager ' . $warehouseName
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user