fix Hiltes import

This commit is contained in:
Marko 2023-09-19 15:29:22 +02:00
parent 0abbd0ab29
commit 86f28121aa
No known key found for this signature in database
11 changed files with 127 additions and 127 deletions

View File

@ -25,7 +25,6 @@
<excludeFolder url="file://$MODULE_DIR$/vendor/monolog/monolog" /> <excludeFolder url="file://$MODULE_DIR$/vendor/monolog/monolog" />
<excludeFolder url="file://$MODULE_DIR$/vendor/nikic/php-parser" /> <excludeFolder url="file://$MODULE_DIR$/vendor/nikic/php-parser" />
<excludeFolder url="file://$MODULE_DIR$/vendor/twig/twig" /> <excludeFolder url="file://$MODULE_DIR$/vendor/twig/twig" />
<excludeFolder url="file://$MODULE_DIR$/vendor/sensio/framework-extra-bundle" />
<excludeFolder url="file://$MODULE_DIR$/vendor/nelmio/cors-bundle" /> <excludeFolder url="file://$MODULE_DIR$/vendor/nelmio/cors-bundle" />
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/log" /> <excludeFolder url="file://$MODULE_DIR$/vendor/psr/log" />
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/event-dispatcher" /> <excludeFolder url="file://$MODULE_DIR$/vendor/psr/event-dispatcher" />

View File

@ -32,7 +32,6 @@
<path value="$PROJECT_DIR$/vendor/monolog/monolog" /> <path value="$PROJECT_DIR$/vendor/monolog/monolog" />
<path value="$PROJECT_DIR$/vendor/nikic/php-parser" /> <path value="$PROJECT_DIR$/vendor/nikic/php-parser" />
<path value="$PROJECT_DIR$/vendor/twig/twig" /> <path value="$PROJECT_DIR$/vendor/twig/twig" />
<path value="$PROJECT_DIR$/vendor/sensio/framework-extra-bundle" />
<path value="$PROJECT_DIR$/vendor/nelmio/cors-bundle" /> <path value="$PROJECT_DIR$/vendor/nelmio/cors-bundle" />
<path value="$PROJECT_DIR$/vendor/psr/log" /> <path value="$PROJECT_DIR$/vendor/psr/log" />
<path value="$PROJECT_DIR$/vendor/psr/event-dispatcher" /> <path value="$PROJECT_DIR$/vendor/psr/event-dispatcher" />

View File

@ -6,6 +6,8 @@
"require": { "require": {
"php": ">=8.1", "php": ">=8.1",
"ext-ctype": "*", "ext-ctype": "*",
"ext-curl": "*",
"ext-ftp": "*",
"ext-iconv": "*", "ext-iconv": "*",
"api-platform/core": "^3.1", "api-platform/core": "^3.1",
"doctrine/annotations": "^1.0", "doctrine/annotations": "^1.0",
@ -16,7 +18,6 @@
"nelmio/cors-bundle": "^2.2", "nelmio/cors-bundle": "^2.2",
"phpdocumentor/reflection-docblock": "^5.3", "phpdocumentor/reflection-docblock": "^5.3",
"phpstan/phpdoc-parser": "^1.6", "phpstan/phpdoc-parser": "^1.6",
"sensio/framework-extra-bundle": "^6.2",
"symfony/apache-pack": "^1.0", "symfony/apache-pack": "^1.0",
"symfony/asset": "6.1.*", "symfony/asset": "6.1.*",
"symfony/console": "6.1.*", "symfony/console": "6.1.*",
@ -52,6 +53,7 @@
"config": { "config": {
"allow-plugins": { "allow-plugins": {
"composer/package-versions-deprecated": true, "composer/package-versions-deprecated": true,
"php-http/discovery": true,
"symfony/flex": true, "symfony/flex": true,
"symfony/runtime": true "symfony/runtime": true
}, },

133
composer.lock generated
View File

@ -4,20 +4,20 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "6dabdf9e03663a32cc97a8533121e3cc", "content-hash": "f834752699bf667645cf22b5cd2c6aa2",
"packages": [ "packages": [
{ {
"name": "api-platform/core", "name": "api-platform/core",
"version": "v3.1.17", "version": "v3.1.18",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/api-platform/core.git", "url": "https://github.com/api-platform/core.git",
"reference": "850f7356b6732d0edccf3ee773113c457afc771e" "reference": "198ca0f1f1c9f730a15e85762b04af43eb43424e"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/api-platform/core/zipball/850f7356b6732d0edccf3ee773113c457afc771e", "url": "https://api.github.com/repos/api-platform/core/zipball/198ca0f1f1c9f730a15e85762b04af43eb43424e",
"reference": "850f7356b6732d0edccf3ee773113c457afc771e", "reference": "198ca0f1f1c9f730a15e85762b04af43eb43424e",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -44,11 +44,10 @@
"elasticsearch/elasticsearch": ">=8.0", "elasticsearch/elasticsearch": ">=8.0",
"phpspec/prophecy": "<1.15", "phpspec/prophecy": "<1.15",
"phpunit/phpunit": "<9.5", "phpunit/phpunit": "<9.5",
"symfony/service-contracts": "<3",
"symfony/var-exporter": "<6.1.1" "symfony/var-exporter": "<6.1.1"
}, },
"require-dev": { "require-dev": {
"behat/behat": "^3.1", "behat/behat": "^3.11",
"behat/mink": "^1.9", "behat/mink": "^1.9",
"doctrine/cache": "^1.11 || ^2.1", "doctrine/cache": "^1.11 || ^2.1",
"doctrine/common": "^3.2.2", "doctrine/common": "^3.2.2",
@ -166,7 +165,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/api-platform/core/issues", "issues": "https://github.com/api-platform/core/issues",
"source": "https://github.com/api-platform/core/tree/v3.1.17" "source": "https://github.com/api-platform/core/tree/v3.1.18"
}, },
"funding": [ "funding": [
{ {
@ -174,7 +173,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-09-08T14:11:23+00:00" "time": "2023-09-15T13:45:54+00:00"
}, },
{ {
"name": "doctrine/annotations", "name": "doctrine/annotations",
@ -2028,16 +2027,16 @@
}, },
{ {
"name": "phpstan/phpdoc-parser", "name": "phpstan/phpdoc-parser",
"version": "1.24.0", "version": "1.24.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpdoc-parser.git", "url": "https://github.com/phpstan/phpdoc-parser.git",
"reference": "3510b0a6274cc42f7219367cb3abfc123ffa09d6" "reference": "9f854d275c2dbf84915a5c0ec9a2d17d2cd86b01"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/3510b0a6274cc42f7219367cb3abfc123ffa09d6", "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/9f854d275c2dbf84915a5c0ec9a2d17d2cd86b01",
"reference": "3510b0a6274cc42f7219367cb3abfc123ffa09d6", "reference": "9f854d275c2dbf84915a5c0ec9a2d17d2cd86b01",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2069,9 +2068,9 @@
"description": "PHPDoc parser with support for nullable, intersection and generic types", "description": "PHPDoc parser with support for nullable, intersection and generic types",
"support": { "support": {
"issues": "https://github.com/phpstan/phpdoc-parser/issues", "issues": "https://github.com/phpstan/phpdoc-parser/issues",
"source": "https://github.com/phpstan/phpdoc-parser/tree/1.24.0" "source": "https://github.com/phpstan/phpdoc-parser/tree/1.24.1"
}, },
"time": "2023-09-07T20:46:32+00:00" "time": "2023-09-18T12:18:02+00:00"
}, },
{ {
"name": "psr/cache", "name": "psr/cache",
@ -2331,84 +2330,6 @@
}, },
"time": "2021-07-14T16:46:02+00:00" "time": "2021-07-14T16:46:02+00:00"
}, },
{
"name": "sensio/framework-extra-bundle",
"version": "v6.2.10",
"source": {
"type": "git",
"url": "https://github.com/sensiolabs/SensioFrameworkExtraBundle.git",
"reference": "2f886f4b31f23c76496901acaedfedb6936ba61f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sensiolabs/SensioFrameworkExtraBundle/zipball/2f886f4b31f23c76496901acaedfedb6936ba61f",
"reference": "2f886f4b31f23c76496901acaedfedb6936ba61f",
"shasum": ""
},
"require": {
"doctrine/annotations": "^1.0|^2.0",
"php": ">=7.2.5",
"symfony/config": "^4.4|^5.0|^6.0",
"symfony/dependency-injection": "^4.4|^5.0|^6.0",
"symfony/framework-bundle": "^4.4|^5.0|^6.0",
"symfony/http-kernel": "^4.4|^5.0|^6.0"
},
"conflict": {
"doctrine/doctrine-cache-bundle": "<1.3.1",
"doctrine/persistence": "<1.3"
},
"require-dev": {
"doctrine/dbal": "^2.10|^3.0",
"doctrine/doctrine-bundle": "^1.11|^2.0",
"doctrine/orm": "^2.5",
"symfony/browser-kit": "^4.4|^5.0|^6.0",
"symfony/doctrine-bridge": "^4.4|^5.0|^6.0",
"symfony/dom-crawler": "^4.4|^5.0|^6.0",
"symfony/expression-language": "^4.4|^5.0|^6.0",
"symfony/finder": "^4.4|^5.0|^6.0",
"symfony/monolog-bridge": "^4.0|^5.0|^6.0",
"symfony/monolog-bundle": "^3.2",
"symfony/phpunit-bridge": "^4.4.9|^5.0.9|^6.0",
"symfony/security-bundle": "^4.4|^5.0|^6.0",
"symfony/twig-bundle": "^4.4|^5.0|^6.0",
"symfony/yaml": "^4.4|^5.0|^6.0",
"twig/twig": "^1.34|^2.4|^3.0"
},
"type": "symfony-bundle",
"extra": {
"branch-alias": {
"dev-master": "6.1.x-dev"
}
},
"autoload": {
"psr-4": {
"Sensio\\Bundle\\FrameworkExtraBundle\\": "src/"
},
"exclude-from-classmap": [
"/tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
}
],
"description": "This bundle provides a way to configure your controllers with annotations",
"keywords": [
"annotations",
"controllers"
],
"support": {
"source": "https://github.com/sensiolabs/SensioFrameworkExtraBundle/tree/v6.2.10"
},
"abandoned": "Symfony",
"time": "2023-02-24T14:57:12+00:00"
},
{ {
"name": "symfony/apache-pack", "name": "symfony/apache-pack",
"version": "v1.0.1", "version": "v1.0.1",
@ -7268,16 +7189,16 @@
}, },
{ {
"name": "phpunit/php-code-coverage", "name": "phpunit/php-code-coverage",
"version": "9.2.28", "version": "9.2.29",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "7134a5ccaaf0f1c92a4f5501a6c9f98ac4dcc0ef" "reference": "6a3a87ac2bbe33b25042753df8195ba4aa534c76"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/7134a5ccaaf0f1c92a4f5501a6c9f98ac4dcc0ef", "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/6a3a87ac2bbe33b25042753df8195ba4aa534c76",
"reference": "7134a5ccaaf0f1c92a4f5501a6c9f98ac4dcc0ef", "reference": "6a3a87ac2bbe33b25042753df8195ba4aa534c76",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -7334,7 +7255,7 @@
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
"security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy",
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.28" "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.29"
}, },
"funding": [ "funding": [
{ {
@ -7342,7 +7263,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2023-09-12T14:36:20+00:00" "time": "2023-09-19T04:57:46+00:00"
}, },
{ {
"name": "phpunit/php-file-iterator", "name": "phpunit/php-file-iterator",
@ -7587,16 +7508,16 @@
}, },
{ {
"name": "phpunit/phpunit", "name": "phpunit/phpunit",
"version": "9.6.12", "version": "9.6.13",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git", "url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "a122c2ebd469b751d774aa0f613dc0d67697653f" "reference": "f3d767f7f9e191eab4189abe41ab37797e30b1be"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a122c2ebd469b751d774aa0f613dc0d67697653f", "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f3d767f7f9e191eab4189abe41ab37797e30b1be",
"reference": "a122c2ebd469b751d774aa0f613dc0d67697653f", "reference": "f3d767f7f9e191eab4189abe41ab37797e30b1be",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -7670,7 +7591,7 @@
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues", "issues": "https://github.com/sebastianbergmann/phpunit/issues",
"security": "https://github.com/sebastianbergmann/phpunit/security/policy", "security": "https://github.com/sebastianbergmann/phpunit/security/policy",
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.12" "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.13"
}, },
"funding": [ "funding": [
{ {
@ -7686,7 +7607,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-09-12T14:39:31+00:00" "time": "2023-09-19T05:39:22+00:00"
}, },
{ {
"name": "sebastian/cli-parser", "name": "sebastian/cli-parser",
@ -9473,6 +9394,8 @@
"platform": { "platform": {
"php": ">=8.1", "php": ">=8.1",
"ext-ctype": "*", "ext-ctype": "*",
"ext-curl": "*",
"ext-ftp": "*",
"ext-iconv": "*" "ext-iconv": "*"
}, },
"platform-dev": [], "platform-dev": [],

View File

@ -11,6 +11,5 @@ return [
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true], Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true], Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true], Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true],
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
ApiPlatform\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true], ApiPlatform\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true],
]; ];

View File

@ -1,3 +0,0 @@
sensio_framework_extra:
router:
annotations: false

0
src/ApiResource/.gitignore vendored Normal file
View File

View File

@ -65,8 +65,6 @@ class HiltesImportCommand extends Command
return Command::FAILURE; return Command::FAILURE;
}else{ }else{
$io->info('Start Hiltes Push JTL'); $io->info('Start Hiltes Push JTL');
// $pushStock = new SwPushStockCommand($this->productRepository,$this->logger);
// $pushStock->execute($input,$output);
$jtl = new JtlExportCommand($this->productRepository,$this->stockRepository,$this->warehouseRepository,$this->logger); $jtl = new JtlExportCommand($this->productRepository,$this->stockRepository,$this->warehouseRepository,$this->logger);
$jtl->execute($input,$output); $jtl->execute($input,$output);

View File

@ -1,8 +1,101 @@
<?php <?php
namespace App\Helper; namespace App\Helper;
use phpseclib3\Net\SFTP;
class Ftp class Ftp
{ {
private string $host;
private int $port;
private string $user;
private string $password;
private string $remoteDir;
public function __construct()
{
$this->setHost($_ENV['FTP_HOST']);
$this->setPort((int)$_ENV['FTP_PORT']);
$this->setUser($_ENV['FTP_USER']);
$this->setPassword($_ENV['FTP_PASSWORD']);
$this->setRemoteDir($_ENV['FTP_REMOTE_DIR']);
} }
public function getHost(): string
{
return $this->host;
}
public function setHost(string $host): void
{
$this->host = $host;
}
public function getPort(): int
{
return $this->port;
}
public function setPort(int $port): void
{
$this->port = $port;
}
public function getUser(): string
{
return $this->user;
}
public function setUser(string $user): void
{
$this->user = $user;
}
public function getPassword(): string
{
return $this->password;
}
public function setPassword(string $password): void
{
$this->password = $password;
}
public function getRemoteDir(): string
{
return $this->remoteDir;
}
public function setRemoteDir(string $remoteDir): void
{
$this->remoteDir = $remoteDir;
}
/**
* @param string $localFile
* @return bool
*/
public function uploadFile(string $localFile): bool
{
#dd(array($localFile,$this->getHost(),$this->getUser(), $this->getPassword(),$this->getRemoteDir()));
$sftp = new SFTP($this->getHost(),$this->getPort());
$sftp_login = $sftp->login($this->getUser(), $this->getPassword());
//dump(array('$sftp_login'=>$sftp_login,'Line'=>__LINE__,'Method'=>__METHOD__));
$remoteFile = 'order_'.date('YmdHis').'.csv';
if($sftp_login){
$r = $sftp->put($this->getRemoteDir().$remoteFile.'.tmp', $localFile, SFTP::SOURCE_LOCAL_FILE);
//dump(array('$r'=>$r,$this->getRemoteDir().$remoteFile, $localFile,'Line'=>__LINE__));
if($r){
if($sftp->rename($this->getRemoteDir().$remoteFile.'.tmp',$this->getRemoteDir().$remoteFile))
return unlink($localFile); # löschen der datei
else
return false;
}else
return false;
}
return false;
}
}

View File

@ -47,6 +47,8 @@ class HiltesImport
$count = 0; $count = 0;
if(!empty($this->arrData['orgFiles']['data']) && count($this->arrData['orgFiles']['data'])){ if(!empty($this->arrData['orgFiles']['data']) && count($this->arrData['orgFiles']['data'])){
foreach ($this->arrData['orgFiles']['data'] as $file) { foreach ($this->arrData['orgFiles']['data'] as $file) {
if(is_file($file['realPath'])){ if(is_file($file['realPath'])){
$count += $this->loadFiles($file['realPath'],$file['fileSize']); $count += $this->loadFiles($file['realPath'],$file['fileSize']);
}else{ }else{
@ -56,7 +58,7 @@ class HiltesImport
} }
dump("Imported $count stocks"); dump("Imported $count stocks");
//remove fertig file //remove fertig file
unlink($this->currentDirPath.'/hiltes/h2c/WS.FERTIG'); //unlink($this->currentDirPath.'/hiltes/h2c/WS.FERTIG');
}else }else
return array('success'=>1,'text'=>'No Files'); return array('success'=>1,'text'=>'No Files');

View File

@ -74,18 +74,6 @@
"tests/bootstrap.php" "tests/bootstrap.php"
] ]
}, },
"sensio/framework-extra-bundle": {
"version": "6.2",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "5.2",
"ref": "fb7e19da7f013d0d422fa9bce16f5c510e27609b"
},
"files": [
"config/packages/sensio_framework_extra.yaml"
]
},
"symfony/apache-pack": { "symfony/apache-pack": {
"version": "1.0", "version": "1.0",
"recipe": { "recipe": {