This commit is contained in:
parent
9c2e2b6ade
commit
8554cf714d
@ -1,6 +1,7 @@
|
|||||||
kind: pipeline
|
kind: pipeline
|
||||||
name: default
|
name: default
|
||||||
|
|
||||||
|
load: [docker, composer]
|
||||||
steps:
|
steps:
|
||||||
- name: install
|
- name: install
|
||||||
image: composer
|
image: composer
|
||||||
@ -17,7 +18,9 @@ steps:
|
|||||||
- chmod +x /usr/local/bin/phpcs
|
- chmod +x /usr/local/bin/phpcs
|
||||||
- chmod +x /usr/local/bin/phpcbf
|
- chmod +x /usr/local/bin/phpcbf
|
||||||
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
||||||
- phpcs -d memory_limit=512M --extensions=php --standard=PSR2 ./src/
|
|
||||||
|
- phpcbf -w ./src/
|
||||||
|
|
||||||
|
|
||||||
- name: test
|
- name: test
|
||||||
image: php:8.1
|
image: php:8.1
|
||||||
|
@ -8,13 +8,13 @@
|
|||||||
<jdbc-url>jdbc:mysql://127.0.0.1:3306</jdbc-url>
|
<jdbc-url>jdbc:mysql://127.0.0.1:3306</jdbc-url>
|
||||||
<working-dir>$ProjectFileDir$</working-dir>
|
<working-dir>$ProjectFileDir$</working-dir>
|
||||||
</data-source>
|
</data-source>
|
||||||
<data-source source="LOCAL" name="DDEV" uuid="460f8880-31b0-4942-b249-e8c664c61f08">
|
<data-source source="LOCAL" name="DDEV" uuid="5149739e-7c31-440b-a2ab-9c77c78be0cd">
|
||||||
<driver-ref>mariadb</driver-ref>
|
<driver-ref>mariadb</driver-ref>
|
||||||
<synchronize>true</synchronize>
|
<synchronize>true</synchronize>
|
||||||
<configured-by-url>true</configured-by-url>
|
<configured-by-url>true</configured-by-url>
|
||||||
<remarks>DDEV generated data source</remarks>
|
<remarks>DDEV generated data source</remarks>
|
||||||
<jdbc-driver>org.mariadb.jdbc.Driver</jdbc-driver>
|
<jdbc-driver>org.mariadb.jdbc.Driver</jdbc-driver>
|
||||||
<jdbc-url>jdbc:mariadb://127.0.0.1:51773/db?user=db&password=db</jdbc-url>
|
<jdbc-url>jdbc:mariadb://127.0.0.1:55034/db?user=db&password=db</jdbc-url>
|
||||||
<working-dir>$ProjectFileDir$</working-dir>
|
<working-dir>$ProjectFileDir$</working-dir>
|
||||||
</data-source>
|
</data-source>
|
||||||
</component>
|
</component>
|
||||||
|
458
composer.lock
generated
458
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -22,9 +22,6 @@ services:
|
|||||||
App\EventSubscriber\SlackNotifySubscriber:
|
App\EventSubscriber\SlackNotifySubscriber:
|
||||||
arguments:
|
arguments:
|
||||||
$slackWebhookUrl: '%env(SLACK_DSN)%'
|
$slackWebhookUrl: '%env(SLACK_DSN)%'
|
||||||
# App\Helper\Hiltes:
|
|
||||||
# arguments:
|
|
||||||
# $orderRepository: '@App\Repository\OrderRepository'
|
|
||||||
|
|
||||||
# add more service definitions when explicit configuration is needed
|
# add more service definitions when explicit configuration is needed
|
||||||
# please note that last definitions always *replace* previous ones
|
# please note that last definitions always *replace* previous ones
|
33
migrations/Version20231110153931.php
Normal file
33
migrations/Version20231110153931.php
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace DoctrineMigrations;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-generated Migration: Please modify to your needs!
|
||||||
|
*/
|
||||||
|
final class Version20231110153931 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this up() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('ALTER TABLE `order` CHANGE data data JSON NOT NULL COMMENT \'(DC2Type:json)\'');
|
||||||
|
$this->addSql('CREATE UNIQUE INDEX UNIQ_F52993988D9F6D38 ON `order` (order_id)');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('DROP INDEX UNIQ_F52993988D9F6D38 ON `order`');
|
||||||
|
$this->addSql('ALTER TABLE `order` CHANGE data data JSON NOT NULL COMMENT \'(DC2Type:json)\'');
|
||||||
|
}
|
||||||
|
}
|
@ -2,9 +2,9 @@
|
|||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Open Sans';
|
font-family: 'Open Sans';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-display: swap;
|
font-display: var(--fontsource-display, swap);
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
src: url(./files/open-sans-cyrillic-ext-400-normal.woff2) format('woff2'), url(./files/open-sans-cyrillic-ext-400-normal.woff) format('woff');
|
src: url(./files/open-sans-cyrillic-ext-400-normal.woff2) format('woff2');
|
||||||
unicode-range: U+0460-052F,U+1C80-1C88,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F;
|
unicode-range: U+0460-052F,U+1C80-1C88,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12,9 +12,9 @@
|
|||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Open Sans';
|
font-family: 'Open Sans';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-display: swap;
|
font-display: var(--fontsource-display, swap);
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
src: url(./files/open-sans-cyrillic-400-normal.woff2) format('woff2'), url(./files/open-sans-cyrillic-400-normal.woff) format('woff');
|
src: url(./files/open-sans-cyrillic-400-normal.woff2) format('woff2');
|
||||||
unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
|
unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -22,9 +22,9 @@
|
|||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Open Sans';
|
font-family: 'Open Sans';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-display: swap;
|
font-display: var(--fontsource-display, swap);
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
src: url(./files/open-sans-greek-ext-400-normal.woff2) format('woff2'), url(./files/open-sans-greek-ext-400-normal.woff) format('woff');
|
src: url(./files/open-sans-greek-ext-400-normal.woff2) format('woff2');
|
||||||
unicode-range: U+1F00-1FFF;
|
unicode-range: U+1F00-1FFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,9 +32,9 @@
|
|||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Open Sans';
|
font-family: 'Open Sans';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-display: swap;
|
font-display: var(--fontsource-display, swap);
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
src: url(./files/open-sans-greek-400-normal.woff2) format('woff2'), url(./files/open-sans-greek-400-normal.woff) format('woff');
|
src: url(./files/open-sans-greek-400-normal.woff2) format('woff2');
|
||||||
unicode-range: U+0370-03FF;
|
unicode-range: U+0370-03FF;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,9 +42,9 @@
|
|||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Open Sans';
|
font-family: 'Open Sans';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-display: swap;
|
font-display: var(--fontsource-display, swap);
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
src: url(./files/open-sans-hebrew-400-normal.woff2) format('woff2'), url(./files/open-sans-hebrew-400-normal.woff) format('woff');
|
src: url(./files/open-sans-hebrew-400-normal.woff2) format('woff2');
|
||||||
unicode-range: U+0590-05FF,U+200C-2010,U+20AA,U+25CC,U+FB1D-FB4F;
|
unicode-range: U+0590-05FF,U+200C-2010,U+20AA,U+25CC,U+FB1D-FB4F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,9 +52,9 @@
|
|||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Open Sans';
|
font-family: 'Open Sans';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-display: swap;
|
font-display: var(--fontsource-display, swap);
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
src: url(./files/open-sans-vietnamese-400-normal.woff2) format('woff2'), url(./files/open-sans-vietnamese-400-normal.woff) format('woff');
|
src: url(./files/open-sans-vietnamese-400-normal.woff2) format('woff2');
|
||||||
unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
|
unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,18 +62,18 @@
|
|||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Open Sans';
|
font-family: 'Open Sans';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-display: swap;
|
font-display: var(--fontsource-display, swap);
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
src: url(./files/open-sans-latin-ext-400-normal.woff2) format('woff2'), url(./files/open-sans-latin-ext-400-normal.woff) format('woff');
|
src: url(./files/open-sans-latin-ext-400-normal.woff2) format('woff2');
|
||||||
unicode-range: U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF;
|
unicode-range: U+0100-02AF,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1E00-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* open-sans-latin-400-normal */
|
/* open-sans-latin-400-normal */
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Open Sans';
|
font-family: 'Open Sans';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-display: swap;
|
font-display: var(--fontsource-display, swap);
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
src: url(./files/open-sans-latin-400-normal.woff2) format('woff2'), url(./files/open-sans-latin-400-normal.woff) format('woff');
|
src: url(./files/open-sans-latin-400-normal.woff2) format('woff2');
|
||||||
unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
|
unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Open Sans';
|
font-family: 'Open Sans';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-display: swap;
|
font-display: var(--fontsource-display, swap);
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
src: url(./files/open-sans-cyrillic-ext-700-normal.woff2) format('woff2'), url(./files/open-sans-cyrillic-ext-700-normal.woff) format('woff');
|
src: url(./files/open-sans-cyrillic-ext-700-normal.woff2) format('woff2');
|
||||||
unicode-range: U+0460-052F,U+1C80-1C88,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F;
|
unicode-range: U+0460-052F,U+1C80-1C88,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12,9 +12,9 @@
|
|||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Open Sans';
|
font-family: 'Open Sans';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-display: swap;
|
font-display: var(--fontsource-display, swap);
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
src: url(./files/open-sans-cyrillic-700-normal.woff2) format('woff2'), url(./files/open-sans-cyrillic-700-normal.woff) format('woff');
|
src: url(./files/open-sans-cyrillic-700-normal.woff2) format('woff2');
|
||||||
unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
|
unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -22,9 +22,9 @@
|
|||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Open Sans';
|
font-family: 'Open Sans';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-display: swap;
|
font-display: var(--fontsource-display, swap);
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
src: url(./files/open-sans-greek-ext-700-normal.woff2) format('woff2'), url(./files/open-sans-greek-ext-700-normal.woff) format('woff');
|
src: url(./files/open-sans-greek-ext-700-normal.woff2) format('woff2');
|
||||||
unicode-range: U+1F00-1FFF;
|
unicode-range: U+1F00-1FFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,9 +32,9 @@
|
|||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Open Sans';
|
font-family: 'Open Sans';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-display: swap;
|
font-display: var(--fontsource-display, swap);
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
src: url(./files/open-sans-greek-700-normal.woff2) format('woff2'), url(./files/open-sans-greek-700-normal.woff) format('woff');
|
src: url(./files/open-sans-greek-700-normal.woff2) format('woff2');
|
||||||
unicode-range: U+0370-03FF;
|
unicode-range: U+0370-03FF;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,9 +42,9 @@
|
|||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Open Sans';
|
font-family: 'Open Sans';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-display: swap;
|
font-display: var(--fontsource-display, swap);
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
src: url(./files/open-sans-hebrew-700-normal.woff2) format('woff2'), url(./files/open-sans-hebrew-700-normal.woff) format('woff');
|
src: url(./files/open-sans-hebrew-700-normal.woff2) format('woff2');
|
||||||
unicode-range: U+0590-05FF,U+200C-2010,U+20AA,U+25CC,U+FB1D-FB4F;
|
unicode-range: U+0590-05FF,U+200C-2010,U+20AA,U+25CC,U+FB1D-FB4F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,9 +52,9 @@
|
|||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Open Sans';
|
font-family: 'Open Sans';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-display: swap;
|
font-display: var(--fontsource-display, swap);
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
src: url(./files/open-sans-vietnamese-700-normal.woff2) format('woff2'), url(./files/open-sans-vietnamese-700-normal.woff) format('woff');
|
src: url(./files/open-sans-vietnamese-700-normal.woff2) format('woff2');
|
||||||
unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
|
unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,18 +62,18 @@
|
|||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Open Sans';
|
font-family: 'Open Sans';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-display: swap;
|
font-display: var(--fontsource-display, swap);
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
src: url(./files/open-sans-latin-ext-700-normal.woff2) format('woff2'), url(./files/open-sans-latin-ext-700-normal.woff) format('woff');
|
src: url(./files/open-sans-latin-ext-700-normal.woff2) format('woff2');
|
||||||
unicode-range: U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF;
|
unicode-range: U+0100-02AF,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1E00-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* open-sans-latin-700-normal */
|
/* open-sans-latin-700-normal */
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Open Sans';
|
font-family: 'Open Sans';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-display: swap;
|
font-display: var(--fontsource-display, swap);
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
src: url(./files/open-sans-latin-700-normal.woff2) format('woff2'), url(./files/open-sans-latin-700-normal.woff) format('woff');
|
src: url(./files/open-sans-latin-700-normal.woff2) format('woff2');
|
||||||
unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
|
unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
namespace App\Command;
|
namespace App\Command;
|
||||||
|
|
||||||
use App\Entity\Order;
|
use App\Entity\Order;
|
||||||
|
use App\Helper\Hiltes;
|
||||||
use App\Repository\OrderRepository;
|
use App\Repository\OrderRepository;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use Symfony\Component\Console\Attribute\AsCommand;
|
use Symfony\Component\Console\Attribute\AsCommand;
|
||||||
@ -12,7 +13,6 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||||
use App\Helper\Hiltes;
|
|
||||||
|
|
||||||
#[AsCommand(
|
#[AsCommand(
|
||||||
name: 'hiltes:export',
|
name: 'hiltes:export',
|
||||||
@ -22,10 +22,10 @@ class HiltesExportCommand extends Command
|
|||||||
{
|
{
|
||||||
public function __construct(OrderRepository $orderRepository, LoggerInterface $logger, private Hiltes $hiltes)
|
public function __construct(OrderRepository $orderRepository, LoggerInterface $logger, private Hiltes $hiltes)
|
||||||
{
|
{
|
||||||
$this->orderRepository = $orderRepository;
|
$this->orderRepository = $orderRepository;
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -33,8 +33,7 @@ class HiltesExportCommand extends Command
|
|||||||
{
|
{
|
||||||
$this
|
$this
|
||||||
->addArgument('arg1', InputArgument::OPTIONAL, 'Argument description')
|
->addArgument('arg1', InputArgument::OPTIONAL, 'Argument description')
|
||||||
->addOption('option1', null, InputOption::VALUE_NONE, 'Option description')
|
->addOption('option1', null, InputOption::VALUE_NONE, 'Option description');
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -46,131 +45,131 @@ class HiltesExportCommand extends Command
|
|||||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||||
{
|
{
|
||||||
|
|
||||||
$io = new SymfonyStyle($input, $output);
|
$io = new SymfonyStyle($input, $output);
|
||||||
|
|
||||||
$io->info('Start Hiltes Export');
|
$io->info('Start Hiltes Export');
|
||||||
|
|
||||||
$l = $this->hiltes->loginToHiltes('','');
|
$l = $this->hiltes->loginToHiltes('', '');
|
||||||
if(!$l){
|
if (!$l) {
|
||||||
dd('Login faild'.'STOP '.__METHOD__.' / '.__LINE__);
|
dd('Login faild' . 'STOP ' . __METHOD__ . ' / ' . __LINE__);
|
||||||
}
|
}
|
||||||
$orders = $this->orderRepository->findAll();
|
$orders = $this->orderRepository->findAll();
|
||||||
#dump($orders);
|
#dump($orders);
|
||||||
/**
|
/**
|
||||||
* @var Order
|
* @var Order
|
||||||
*/
|
*/
|
||||||
$order = false;
|
$order = false;
|
||||||
foreach ($orders as $order) {
|
foreach ($orders as $order) {
|
||||||
if($order->getStatus()>0) continue;
|
if ($order->getStatus() > 0) continue;
|
||||||
$tA = $order->getData();#json_decode($order->getData());
|
$tA = $order->getData();#json_decode($order->getData());
|
||||||
$tA['orderdate'] = "2023-08-30T12:05:24.000Z";
|
$tA['orderdate'] = "2023-08-30T12:05:24.000Z";
|
||||||
|
|
||||||
#dd($order->getData());
|
#dd($order->getData());
|
||||||
#dd(array(
|
#dd(array(
|
||||||
# 'orderdate'=> $tA['orderdate'],
|
# 'orderdate'=> $tA['orderdate'],
|
||||||
# 'time'=> strtotime($tA['orderdate']),
|
# 'time'=> strtotime($tA['orderdate']),
|
||||||
# 'gmdate '=> gmdate ('d-m-Y\TH:i:s.v\Z',strtotime($tA['orderdate'])),
|
# 'gmdate '=> gmdate ('d-m-Y\TH:i:s.v\Z',strtotime($tA['orderdate'])),
|
||||||
#));
|
#));
|
||||||
#*** Umkonvertieren des Datumstings *****************
|
#*** Umkonvertieren des Datumstings *****************
|
||||||
$tA['orderdate'] = gmdate ('Y-m-d\TH:i:s.v\Z',strtotime($tA['orderdate']));
|
$tA['orderdate'] = gmdate('Y-m-d\TH:i:s.v\Z', strtotime($tA['orderdate']));
|
||||||
#****
|
#****
|
||||||
$arr = array(
|
$arr = array(
|
||||||
'SalesDate' => $tA['orderdate'],
|
'SalesDate' => $tA['orderdate'],
|
||||||
"BranchNumber" => 8, #Die Filialnummer
|
"BranchNumber" => 8, #Die Filialnummer
|
||||||
"ShopNumber" => 1, #Die Shopnummer
|
"ShopNumber" => 1, #Die Shopnummer
|
||||||
"DistributionChannel" => 5, #Der Vertriebskanal
|
"DistributionChannel" => 5, #Der Vertriebskanal
|
||||||
'SaleList' => array(),
|
'SaleList' => array(),
|
||||||
'CustomerList' => array(),
|
'CustomerList' => array(),
|
||||||
);
|
);
|
||||||
#*** Items ***************
|
#*** Items ***************
|
||||||
if(!empty($tA['data']) && is_array($tA['data'])){
|
if (!empty($tA['data']) && is_array($tA['data'])) {
|
||||||
# Noch nötig
|
# Noch nötig
|
||||||
# "CalculatedSellingPrice" => 0, #X Kalkulierter Verkaufspreis
|
# "CalculatedSellingPrice" => 0, #X Kalkulierter Verkaufspreis
|
||||||
# "AchievedSalesPrice" => 0, #X Erzielter Verkaufspreis
|
# "AchievedSalesPrice" => 0, #X Erzielter Verkaufspreis
|
||||||
$tSalNr = array();
|
$tSalNr = array();
|
||||||
foreach ($tA['data'] as $v){
|
foreach ($tA['data'] as $v) {
|
||||||
$SalesNumber = (!empty($v['gtin']) ? $v['gtin'] : $v['sku']);
|
$SalesNumber = (!empty($v['gtin']) ? $v['gtin'] : $v['sku']);
|
||||||
if(preg_match('/^([0-9]+)_/',$SalesNumber,$tP)){
|
if (preg_match('/^([0-9]+)_/', $SalesNumber, $tP)) {
|
||||||
$SalesNumber = $tP[1];
|
$SalesNumber = $tP[1];
|
||||||
}
|
}
|
||||||
if(isset($tSalNr[$SalesNumber])){
|
if (isset($tSalNr[$SalesNumber])) {
|
||||||
$tSalNr[$SalesNumber]++;
|
$tSalNr[$SalesNumber]++;
|
||||||
$SalesNumber.= $tSalNr[$SalesNumber];
|
$SalesNumber .= $tSalNr[$SalesNumber];
|
||||||
}else{
|
} else {
|
||||||
$tSalNr[$SalesNumber] = 0;
|
$tSalNr[$SalesNumber] = 0;
|
||||||
}
|
}
|
||||||
#dump($SalesNumber);
|
#dump($SalesNumber);
|
||||||
#********
|
#********
|
||||||
$v['CalculatedSellingPrice'] = 100.00;
|
$v['CalculatedSellingPrice'] = 100.00;
|
||||||
$v['AchievedSalesPrice'] = 90.00;
|
$v['AchievedSalesPrice'] = 90.00;
|
||||||
$arr['SaleList'][] = array(
|
$arr['SaleList'][] = array(
|
||||||
"SalesLabel" => 'Ean',#$v['sku'],#X
|
"SalesLabel" => 'Ean',#$v['sku'],#X
|
||||||
"SalesLabelNumber" => $SalesNumber,#X
|
"SalesLabelNumber" => $SalesNumber,#X
|
||||||
"SalesGoodsGroupNumber" => 0,
|
"SalesGoodsGroupNumber" => 0,
|
||||||
"SizeDescription" => '',#"string",
|
"SizeDescription" => '',#"string",
|
||||||
"CustomerNumber" => 0,
|
"CustomerNumber" => 0,
|
||||||
"TypeOfEstate" => 0,
|
"TypeOfEstate" => 0,
|
||||||
"Amount" => $v['menge'],#X
|
"Amount" => $v['menge'],#X
|
||||||
"CalculatedSellingPrice" => $v['CalculatedSellingPrice'], #X Kalkulierter Verkaufspreis
|
"CalculatedSellingPrice" => $v['CalculatedSellingPrice'], #X Kalkulierter Verkaufspreis
|
||||||
"AchievedSalesPrice" => $v['AchievedSalesPrice'], #X Erzielter Verkaufspreis
|
"AchievedSalesPrice" => $v['AchievedSalesPrice'], #X Erzielter Verkaufspreis
|
||||||
"TransactionType" => "Sale", #X Die Vorgangsart Sale=Verkauf Exchange=Umtausch / Storno
|
"TransactionType" => "Sale", #X Die Vorgangsart Sale=Verkauf Exchange=Umtausch / Storno
|
||||||
"ReceiptNumber" => 0, #Die Belegnummer
|
"ReceiptNumber" => 0, #Die Belegnummer
|
||||||
"DateOfSale" => $tA['orderdate'],#X das Verkaufsdatum mit Verkaufszeit
|
"DateOfSale" => $tA['orderdate'],#X das Verkaufsdatum mit Verkaufszeit
|
||||||
"PaymentMethod" => 'Invoice',#X "CreditCard",
|
"PaymentMethod" => 'Invoice',#X "CreditCard",
|
||||||
"Currency" => 'EUR',#X "string",
|
"Currency" => 'EUR',#X "string",
|
||||||
"Unit" => "Piece",#X
|
"Unit" => "Piece",#X
|
||||||
"DistributionChannel" => 'JTL',#"string"
|
"DistributionChannel" => 'JTL',#"string"
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#*** Kundne *******************************
|
#*** Kundne *******************************
|
||||||
$arr['CustomerList'][] = array(
|
$arr['CustomerList'][] = array(
|
||||||
"CustomerNumber" => 99999, # Fake Daten
|
"CustomerNumber" => 99999, # Fake Daten
|
||||||
"Surname" => 'MAX',#"string",
|
"Surname" => 'MAX',#"string",
|
||||||
"Forename" => 'MUSTERMANN',#"string",
|
"Forename" => 'MUSTERMANN',#"string",
|
||||||
"AddressCity" => 'ERFURT',#"string",
|
"AddressCity" => 'ERFURT',#"string",
|
||||||
"AddressZipCode" => '99084',"string",
|
"AddressZipCode" => '99084', "string",
|
||||||
"AddressStreet" => 'MusterStrasse 22',#"string",
|
"AddressStreet" => 'MusterStrasse 22',#"string",
|
||||||
"AddressCountry" => 'DE',#"string",
|
"AddressCountry" => 'DE',#"string",
|
||||||
#*** Nicht nötig
|
#*** Nicht nötig
|
||||||
#"CardNumber" => 0,
|
#"CardNumber" => 0,
|
||||||
#"SalutionNumber" => 0,
|
#"SalutionNumber" => 0,
|
||||||
#"PostOfficeBox" => '',#"string",
|
#"PostOfficeBox" => '',#"string",
|
||||||
#"PostOfficeBoxZipCode" => '',#"string",
|
#"PostOfficeBoxZipCode" => '',#"string",
|
||||||
#"Title" => '',#"string",
|
#"Title" => '',#"string",
|
||||||
#"PhoneNumber1" => '',#"string",
|
#"PhoneNumber1" => '',#"string",
|
||||||
#"PhoneNumber2" => '',#"string",
|
#"PhoneNumber2" => '',#"string",
|
||||||
#"FaxNumber" => '',#"string",
|
#"FaxNumber" => '',#"string",
|
||||||
#"BirthDay" => '',#"2023-09-14T11:54:26.708Z",
|
#"BirthDay" => '',#"2023-09-14T11:54:26.708Z",
|
||||||
#"Gender" => 'Male',
|
#"Gender" => 'Male',
|
||||||
#"EmailAddress" => '',#"string",
|
#"EmailAddress" => '',#"string",
|
||||||
#"Discount" => 0,
|
#"Discount" => 0,
|
||||||
#"Limit" => 0,
|
#"Limit" => 0,
|
||||||
#"LockMark" => 'Unblocked',
|
#"LockMark" => 'Unblocked',
|
||||||
#"DubiousMark" => 'Undubious',
|
#"DubiousMark" => 'Undubious',
|
||||||
#"DubiousText" => '',#"string",
|
#"DubiousText" => '',#"string",
|
||||||
#"DirectDebit" => '',#true,
|
#"DirectDebit" => '',#true,
|
||||||
#"BankName1" => '',#"string",
|
#"BankName1" => '',#"string",
|
||||||
#"BankAccountNumber1" => '',#"string",
|
#"BankAccountNumber1" => '',#"string",
|
||||||
#"BankCodeNumber1" => '',#"string",
|
#"BankCodeNumber1" => '',#"string",
|
||||||
#"BankName2" => '',#"string",
|
#"BankName2" => '',#"string",
|
||||||
#"BankAccountNumber2" => '',#"string",
|
#"BankAccountNumber2" => '',#"string",
|
||||||
#"BankCodeNumber2" => '',#"string",
|
#"BankCodeNumber2" => '',#"string",
|
||||||
#"BankName3" => '',#"string",
|
#"BankName3" => '',#"string",
|
||||||
#"BankAccountNumber3" => '',#"string",
|
#"BankAccountNumber3" => '',#"string",
|
||||||
#"BankCodeNumber3" => '',#"string",
|
#"BankCodeNumber3" => '',#"string",
|
||||||
#"CreditcardNumber1" => '',#"string",
|
#"CreditcardNumber1" => '',#"string",
|
||||||
#"CreditcardNumber2" => '',#"string",
|
#"CreditcardNumber2" => '',#"string",
|
||||||
#"CreditcardNumber3" => '',#"string",
|
#"CreditcardNumber3" => '',#"string",
|
||||||
#"CreditcardNumber4" => '',#"string",
|
#"CreditcardNumber4" => '',#"string",
|
||||||
#"ChangeIndicator" => '',#true,
|
#"ChangeIndicator" => '',#true,
|
||||||
#"Newsletter" => '',#true,
|
#"Newsletter" => '',#true,
|
||||||
#"Password" => '',#"string",
|
#"Password" => '',#"string",
|
||||||
#"AdBan" => '',#true
|
#"AdBan" => '',#true
|
||||||
);
|
);
|
||||||
$data = $this->hiltes->createJson($arr);
|
$data = $this->hiltes->createJson($arr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$this->hiltes->sendOrderToHiltes($data);
|
$this->hiltes->sendOrderToHiltes($data);
|
||||||
|
@ -10,14 +10,11 @@ use App\Repository\WarehouseRepository;
|
|||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use Symfony\Component\Console\Attribute\AsCommand;
|
use Symfony\Component\Console\Attribute\AsCommand;
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||||
|
|
||||||
use Symfony\Component\Finder\Finder;
|
|
||||||
|
|
||||||
#[AsCommand(
|
#[AsCommand(
|
||||||
name: 'hiltes:import',
|
name: 'hiltes:import',
|
||||||
description: 'Importiert die Bestandsdaten von Hiltes',
|
description: 'Importiert die Bestandsdaten von Hiltes',
|
||||||
@ -28,11 +25,12 @@ class HiltesImportCommand extends Command
|
|||||||
private $warehouseRepository;
|
private $warehouseRepository;
|
||||||
private $productRepository;
|
private $productRepository;
|
||||||
private $logger;
|
private $logger;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
ProductRepository $productRepository,
|
ProductRepository $productRepository,
|
||||||
StockRepository $stockRepository,
|
StockRepository $stockRepository,
|
||||||
WarehouseRepository $warehouseRepository,
|
WarehouseRepository $warehouseRepository,
|
||||||
LoggerInterface $logger
|
LoggerInterface $logger
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
$this->productRepository = $productRepository;
|
$this->productRepository = $productRepository;
|
||||||
@ -41,6 +39,7 @@ class HiltesImportCommand extends Command
|
|||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function configure(): void
|
protected function configure(): void
|
||||||
{
|
{
|
||||||
$this->addOption('delta', 'd', InputOption::VALUE_NONE, 'Delta Import');
|
$this->addOption('delta', 'd', InputOption::VALUE_NONE, 'Delta Import');
|
||||||
@ -52,22 +51,22 @@ class HiltesImportCommand extends Command
|
|||||||
|
|
||||||
$io->success('Start Hiltes Import');
|
$io->success('Start Hiltes Import');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var HiltesImport
|
* @var HiltesImport
|
||||||
*/
|
*/
|
||||||
$hiltesImport = new HiltesImport($this->productRepository,$this->warehouseRepository,$this->stockRepository,$this->logger);
|
$hiltesImport = new HiltesImport($this->productRepository, $this->warehouseRepository, $this->stockRepository, $this->logger);
|
||||||
|
|
||||||
|
|
||||||
$r = $hiltesImport->startImport($input->getOption('delta'));
|
$r = $hiltesImport->startImport($input->getOption('delta'));
|
||||||
|
|
||||||
if(isset($r['error'])){
|
if (isset($r['error'])) {
|
||||||
$io->error($r['text']);
|
$io->error($r['text']);
|
||||||
$this->logger->error($r['text']);
|
$this->logger->error($r['text']);
|
||||||
return Command::FAILURE;
|
return Command::FAILURE;
|
||||||
}else{
|
} else {
|
||||||
$io->info('Start Hiltes Push JTL');
|
$io->info('Start Hiltes Push JTL');
|
||||||
|
|
||||||
$jtl = new Jtl($this->productRepository,$this->warehouseRepository,$this->stockRepository,$this->logger);
|
$jtl = new Jtl($this->productRepository, $this->warehouseRepository, $this->stockRepository, $this->logger);
|
||||||
$jtl->createExportFile($jtl->getProducts());
|
$jtl->createExportFile($jtl->getProducts());
|
||||||
|
|
||||||
$io->success('Done.');
|
$io->success('Done.');
|
||||||
|
@ -26,11 +26,12 @@ class JtlExportCommand extends Command
|
|||||||
private $warehouseRepository;
|
private $warehouseRepository;
|
||||||
private $productRepository;
|
private $productRepository;
|
||||||
private $logger;
|
private $logger;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
ProductRepository $productRepository,
|
ProductRepository $productRepository,
|
||||||
StockRepository $stockRepository,
|
StockRepository $stockRepository,
|
||||||
WarehouseRepository $warehouseRepository,
|
WarehouseRepository $warehouseRepository,
|
||||||
LoggerInterface $logger
|
LoggerInterface $logger
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
$this->productRepository = $productRepository;
|
$this->productRepository = $productRepository;
|
||||||
@ -44,8 +45,7 @@ class JtlExportCommand extends Command
|
|||||||
{
|
{
|
||||||
$this
|
$this
|
||||||
->addArgument('arg1', InputArgument::OPTIONAL, 'Argument description')
|
->addArgument('arg1', InputArgument::OPTIONAL, 'Argument description')
|
||||||
->addOption('option1', null, InputOption::VALUE_NONE, 'Option 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
|
||||||
@ -68,13 +68,12 @@ class JtlExportCommand extends Command
|
|||||||
/**
|
/**
|
||||||
* @var HiltesImport
|
* @var HiltesImport
|
||||||
*/
|
*/
|
||||||
$jtl = new Jtl($this->productRepository,$this->warehouseRepository,$this->stockRepository,$this->logger);
|
$jtl = new Jtl($this->productRepository, $this->warehouseRepository, $this->stockRepository, $this->logger);
|
||||||
|
|
||||||
$data = $jtl->getProducts();
|
$data = $jtl->getProducts();
|
||||||
$jtl->createExportFile($data);
|
$jtl->createExportFile($data);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$io->success('Ende JTL Export');
|
$io->success('Ende JTL Export');
|
||||||
|
|
||||||
return Command::SUCCESS;
|
return Command::SUCCESS;
|
||||||
|
@ -11,7 +11,6 @@ use Symfony\Component\Console\Output\OutputInterface;
|
|||||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||||
use Symfony\Component\Notifier\Chatter;
|
use Symfony\Component\Notifier\Chatter;
|
||||||
use Symfony\Component\Notifier\Message\ChatMessage;
|
use Symfony\Component\Notifier\Message\ChatMessage;
|
||||||
use Symfony\Component\Notifier\ChatterInterface;
|
|
||||||
use Symfony\Component\Notifier\Transport;
|
use Symfony\Component\Notifier\Transport;
|
||||||
|
|
||||||
#[AsCommand(
|
#[AsCommand(
|
||||||
@ -24,8 +23,7 @@ class JtlImportCommand extends Command
|
|||||||
{
|
{
|
||||||
$this
|
$this
|
||||||
->addArgument('arg1', InputArgument::OPTIONAL, 'Argument description')
|
->addArgument('arg1', InputArgument::OPTIONAL, 'Argument description')
|
||||||
->addOption('option1', null, InputOption::VALUE_NONE, 'Option 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
|
||||||
@ -50,7 +48,6 @@ class JtlImportCommand extends Command
|
|||||||
->transport('slack');
|
->transport('slack');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$sentMessage = $chatter->send($message);
|
$sentMessage = $chatter->send($message);
|
||||||
|
|
||||||
$io->success('You have a new command! Now make it your own! Pass --help to see your options.');
|
$io->success('You have a new command! Now make it your own! Pass --help to see your options.');
|
||||||
|
@ -1,40 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Controller;
|
|
||||||
|
|
||||||
use App\Entity\Orders;
|
|
||||||
use App\Form\OrdersType;
|
|
||||||
use App\Repository\OrdersRepository;
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
|
||||||
use Psr\Log\LoggerInterface;
|
|
||||||
|
|
||||||
#[Route('/orders')]
|
|
||||||
class OrdersController extends AbstractController
|
|
||||||
{
|
|
||||||
private $logger;
|
|
||||||
private $ordersRepository;
|
|
||||||
|
|
||||||
public function index(
|
|
||||||
OrdersRepository $ordersRepository,
|
|
||||||
LoggerInterface $logger
|
|
||||||
)
|
|
||||||
{
|
|
||||||
$this->logger = $logger;
|
|
||||||
$this->ordersRepository = $ordersRepository;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function getOrders(): Orders
|
|
||||||
{
|
|
||||||
$this->logger->info('I just got the logger');
|
|
||||||
|
|
||||||
$orders = $this->ordersRepository->findAll();
|
|
||||||
|
|
||||||
|
|
||||||
return $orders->getData();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -2,8 +2,10 @@
|
|||||||
|
|
||||||
namespace App\Entity;
|
namespace App\Entity;
|
||||||
|
|
||||||
|
use ApiPlatform\Metadata\ApiProperty;
|
||||||
use ApiPlatform\Metadata\ApiResource;
|
use ApiPlatform\Metadata\ApiResource;
|
||||||
use App\Repository\OrderRepository;
|
use App\Repository\OrderRepository;
|
||||||
|
use DateTimeInterface;
|
||||||
use Doctrine\DBAL\Types\Types;
|
use Doctrine\DBAL\Types\Types;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
@ -14,6 +16,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||||||
* 2 = Bestellung in Bearbeitung
|
* 2 = Bestellung in Bearbeitung
|
||||||
* 3 = Bestellung versendet
|
* 3 = Bestellung versendet
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#[ORM\Entity(repositoryClass: OrderRepository::class)]
|
#[ORM\Entity(repositoryClass: OrderRepository::class)]
|
||||||
#[ORM\Table(name: '`order`')]
|
#[ORM\Table(name: '`order`')]
|
||||||
#[ApiResource]
|
#[ApiResource]
|
||||||
@ -22,9 +25,12 @@ class Order
|
|||||||
#[ORM\Id]
|
#[ORM\Id]
|
||||||
#[ORM\GeneratedValue]
|
#[ORM\GeneratedValue]
|
||||||
#[ORM\Column]
|
#[ORM\Column]
|
||||||
|
#[ApiProperty(identifier: false)]
|
||||||
private ?int $id = null;
|
private ?int $id = null;
|
||||||
|
|
||||||
#[ORM\Column(length: 255)]
|
#[ORM\Column(length: 255,unique: true)]
|
||||||
|
#[ApiProperty(identifier: true)]
|
||||||
|
|
||||||
private ?string $orderId = null;
|
private ?string $orderId = null;
|
||||||
|
|
||||||
#[ORM\Column]
|
#[ORM\Column]
|
||||||
@ -33,8 +39,8 @@ class Order
|
|||||||
#[ORM\Column]
|
#[ORM\Column]
|
||||||
private array $data = [];
|
private array $data = [];
|
||||||
|
|
||||||
#[ORM\Column(name: 'change_date',type: Types::DATETIME_MUTABLE, nullable: true, options: ['default' => 'CURRENT_TIMESTAMP'])]
|
#[ORM\Column(name: 'change_date', type: Types::DATETIME_MUTABLE, nullable: true, options: ['default' => 'CURRENT_TIMESTAMP'])]
|
||||||
private ?\DateTimeInterface $changeDate = null;
|
private ?DateTimeInterface $changeDate = null;
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
{
|
{
|
||||||
@ -77,12 +83,12 @@ class Order
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getChangeDate(): ?\DateTimeInterface
|
public function getChangeDate(): ?DateTimeInterface
|
||||||
{
|
{
|
||||||
return $this->changeDate;
|
return $this->changeDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setChangeDate(\DateTimeInterface $changeDate): static
|
public function setChangeDate(DateTimeInterface $changeDate): static
|
||||||
{
|
{
|
||||||
$this->changeDate = $changeDate;
|
$this->changeDate = $changeDate;
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ namespace App\Entity;
|
|||||||
|
|
||||||
use ApiPlatform\Metadata\ApiResource;
|
use ApiPlatform\Metadata\ApiResource;
|
||||||
use App\Repository\ProductRepository;
|
use App\Repository\ProductRepository;
|
||||||
use App\Repository\StockRepository;
|
use DateTimeInterface;
|
||||||
use Doctrine\DBAL\Types\Types;
|
use Doctrine\DBAL\Types\Types;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ class Product
|
|||||||
private ?string $gtin = null;
|
private ?string $gtin = null;
|
||||||
|
|
||||||
#[ORM\Column(name: 'update_time', type: Types::DATETIME_MUTABLE, nullable: true, options: ['default' => 'CURRENT_TIMESTAMP'])]
|
#[ORM\Column(name: 'update_time', type: Types::DATETIME_MUTABLE, nullable: true, options: ['default' => 'CURRENT_TIMESTAMP'])]
|
||||||
private ?\DateTimeInterface $updateTime = null;
|
private ?DateTimeInterface $updateTime = null;
|
||||||
|
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
@ -41,12 +41,12 @@ class Product
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUpdateTime(): ?\DateTimeInterface
|
public function getUpdateTime(): ?DateTimeInterface
|
||||||
{
|
{
|
||||||
return $this->updateTime;
|
return $this->updateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setUpdateTime(\DateTimeInterface $updateTime): self
|
public function setUpdateTime(DateTimeInterface $updateTime): self
|
||||||
{
|
{
|
||||||
$this->updateTime = $updateTime;
|
$this->updateTime = $updateTime;
|
||||||
|
|
||||||
|
@ -3,16 +3,17 @@
|
|||||||
namespace App\Entity;
|
namespace App\Entity;
|
||||||
|
|
||||||
use App\Repository\StockRepository;
|
use App\Repository\StockRepository;
|
||||||
#use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
use DateTimeInterface;
|
||||||
|
|
||||||
use Doctrine\DBAL\Types\Types;
|
use Doctrine\DBAL\Types\Types;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
|
#use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||||
|
|
||||||
#[ORM\Entity(repositoryClass: StockRepository::class)]
|
#[ORM\Entity(repositoryClass: StockRepository::class)]
|
||||||
#[ORM\UniqueEntity(['warehouse_id', 'product_id'])]
|
#[ORM\UniqueEntity(['warehouse_id', 'product_id'])]
|
||||||
#[ORM\UniqueConstraint(
|
#[ORM\UniqueConstraint(
|
||||||
name: 'UNIQ_D34A04ADDCD6110',
|
name: 'UNIQ_D34A04ADDCD6110',
|
||||||
columns: ['warehouse_id', 'product_id']
|
columns: ['warehouse_id', 'product_id']
|
||||||
)]
|
)]
|
||||||
class Stock
|
class Stock
|
||||||
{
|
{
|
||||||
@ -29,19 +30,19 @@ class Stock
|
|||||||
#[ORM\ManyToOne(inversedBy: 'stocks')]
|
#[ORM\ManyToOne(inversedBy: 'stocks')]
|
||||||
private ?Warehouse $warehouse = null;
|
private ?Warehouse $warehouse = null;
|
||||||
|
|
||||||
#[ORM\Column(name: 'update_time',type: Types::DATETIME_MUTABLE, nullable: true, options: ['default' => 'CURRENT_TIMESTAMP'])]
|
#[ORM\Column(name: 'update_time', type: Types::DATETIME_MUTABLE, nullable: true, options: ['default' => 'CURRENT_TIMESTAMP'])]
|
||||||
private ?\DateTimeInterface $update_time = null;
|
private ?DateTimeInterface $update_time = null;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setId(int $id): ?self
|
public function setId(int $id): ?self
|
||||||
{
|
{
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getInstock(): ?int
|
public function getInstock(): ?int
|
||||||
@ -55,6 +56,7 @@ class Stock
|
|||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getProductId(): ?int
|
public function getProductId(): ?int
|
||||||
{
|
{
|
||||||
return $this->product_id;
|
return $this->product_id;
|
||||||
@ -66,6 +68,7 @@ class Stock
|
|||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getWarehouseId(): ?int
|
public function getWarehouseId(): ?int
|
||||||
{
|
{
|
||||||
return $this->warehouse_id;
|
return $this->warehouse_id;
|
||||||
@ -112,12 +115,12 @@ class Stock
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUpdateTime(): ?\DateTimeInterface
|
public function getUpdateTime(): ?DateTimeInterface
|
||||||
{
|
{
|
||||||
return $this->update_time;
|
return $this->update_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setUpdateTime(?\DateTimeInterface $update_time): self
|
public function setUpdateTime(?DateTimeInterface $update_time): self
|
||||||
{
|
{
|
||||||
$this->update_time = $update_time;
|
$this->update_time = $update_time;
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@ class Warehouse
|
|||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setId(int $id): self
|
public function setId(int $id): self
|
||||||
{
|
{
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
@ -92,4 +93,4 @@ class Warehouse
|
|||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -3,16 +3,15 @@
|
|||||||
namespace App\EventSubscriber;
|
namespace App\EventSubscriber;
|
||||||
|
|
||||||
use ApiPlatform\Symfony\EventListener\EventPriorities;
|
use ApiPlatform\Symfony\EventListener\EventPriorities;
|
||||||
|
use App\Entity\Order;
|
||||||
use App\Helper\Hiltes;
|
use App\Helper\Hiltes;
|
||||||
use App\Helper\Slack;
|
use App\Helper\Slack;
|
||||||
use App\Entity\Order;
|
|
||||||
use Maknz\Slack\Client;
|
use Maknz\Slack\Client;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpKernel\Event\ViewEvent;
|
use Symfony\Component\HttpKernel\Event\ViewEvent;
|
||||||
use Symfony\Component\HttpKernel\KernelEvents;
|
use Symfony\Component\HttpKernel\KernelEvents;
|
||||||
use Symfony\Component\Notifier\ChatterInterface;
|
|
||||||
|
|
||||||
|
|
||||||
class SlackNotifySubscriber implements EventSubscriberInterface
|
class SlackNotifySubscriber implements EventSubscriberInterface
|
||||||
@ -26,7 +25,7 @@ class SlackNotifySubscriber implements EventSubscriberInterface
|
|||||||
|
|
||||||
private $hiltes;
|
private $hiltes;
|
||||||
|
|
||||||
public function __construct(string $slackWebhookUrl, LoggerInterface $logger, Hiltes $hiltes)
|
public function __construct(string $slackWebhookUrl, LoggerInterface $logger, Hiltes $hiltes)
|
||||||
{
|
{
|
||||||
$this->slackWebhookUrl = $slackWebhookUrl;
|
$this->slackWebhookUrl = $slackWebhookUrl;
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
@ -58,29 +57,29 @@ class SlackNotifySubscriber implements EventSubscriberInterface
|
|||||||
$order = $event->getControllerResult();
|
$order = $event->getControllerResult();
|
||||||
$method = $event->getRequest()->getMethod();
|
$method = $event->getRequest()->getMethod();
|
||||||
|
|
||||||
//wenn es keine Bestellung ist oder es kein POST Request ist, dann return
|
//wenn es keine Bestellung ist oder es kein POST Request ist, dann return
|
||||||
if (!$order instanceof Order || Request::METHOD_POST !== $method) {
|
if (!$order instanceof Order || Request::METHOD_POST !== $method) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$msg = "Bestellung {$order->getOrderId()}: \n";
|
$msg = "Bestellung {$order->getOrderId()}: \n";
|
||||||
|
|
||||||
foreach($order->getData() as $item) {
|
foreach ($order->getData() as $item) {
|
||||||
if($item['menge'] > 0 && strlen($item['sku']) > 0) {
|
if ($item['menge'] > 0 && strlen($item['sku']) > 0) {
|
||||||
$msg .= $item['name'];
|
$msg .= $item['name'];
|
||||||
$msg .= ' '.$item['sku'];
|
$msg .= ' ' . $item['sku'];
|
||||||
$msg .= ' Menge: '.$item['menge']."\n";
|
$msg .= ' Menge: ' . $item['menge'] . "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($order->getStatus() == 1) {
|
if ($order->getStatus() == 1) {
|
||||||
$slack->from('CDS-Notify')
|
$slack->from('CDS-Notify')
|
||||||
->send($msg);
|
->send($msg);
|
||||||
}elseif($order->getStatus() == 2){
|
} elseif ($order->getStatus() == 2) {
|
||||||
//Send to Hiltes
|
//Send to Hiltes
|
||||||
$this->hiltes->createRequest($order);
|
$this->hiltes->createRequest($order);
|
||||||
}else{
|
} else {
|
||||||
$this->logger->error('Status ist nicht 1 oder 2');
|
$this->logger->error('Status ist nicht 1 oder 2');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -3,6 +3,8 @@
|
|||||||
namespace App\Helper;
|
namespace App\Helper;
|
||||||
|
|
||||||
|
|
||||||
|
use Exception;
|
||||||
|
|
||||||
class Ftp
|
class Ftp
|
||||||
{
|
{
|
||||||
private string $host;
|
private string $host;
|
||||||
@ -23,6 +25,55 @@ class Ftp
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uploads a local file to a remote FTP server.
|
||||||
|
*
|
||||||
|
* @param string $localFile The local file path to upload.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @throws Exception If the upload fails or encounters an error.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function uploadFile(string $localFile): void
|
||||||
|
{
|
||||||
|
$ftp = ftp_ssl_connect($this->getHost(), $this->getPort());
|
||||||
|
|
||||||
|
if (!$ftp) {
|
||||||
|
throw new Exception("Failed to connect to FTP server");
|
||||||
|
}
|
||||||
|
|
||||||
|
$ftp_login = ftp_login($ftp, $this->getUser(), $this->getPassword());
|
||||||
|
|
||||||
|
if (!$ftp_login) {
|
||||||
|
throw new Exception("FTP login failed");
|
||||||
|
}
|
||||||
|
|
||||||
|
ftp_pasv($ftp, true);
|
||||||
|
|
||||||
|
$remoteFile = 'stock_hiltes.csv';
|
||||||
|
|
||||||
|
if (!file_exists($localFile)) {
|
||||||
|
throw new Exception("Local file does not exist: $localFile");
|
||||||
|
}
|
||||||
|
|
||||||
|
$r = ftp_nb_put($ftp, $this->getRemoteDir() . $remoteFile, $localFile, FTP_BINARY);
|
||||||
|
|
||||||
|
while ($r == FTP_MOREDATA) {
|
||||||
|
// Continue uploading...
|
||||||
|
$r = ftp_nb_continue($ftp);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($r != FTP_FINISHED) {
|
||||||
|
throw new Exception("File upload failed");
|
||||||
|
}
|
||||||
|
|
||||||
|
ftp_close($ftp);
|
||||||
|
|
||||||
|
if (!unlink($localFile)) {
|
||||||
|
throw new Exception("Failed to delete local file: $localFile");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function getHost(): string
|
public function getHost(): string
|
||||||
{
|
{
|
||||||
return $this->host;
|
return $this->host;
|
||||||
@ -32,6 +83,7 @@ class Ftp
|
|||||||
{
|
{
|
||||||
$this->host = $host;
|
$this->host = $host;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPort(): int
|
public function getPort(): int
|
||||||
{
|
{
|
||||||
return $this->port;
|
return $this->port;
|
||||||
@ -71,53 +123,4 @@ class Ftp
|
|||||||
{
|
{
|
||||||
$this->remoteDir = $remoteDir;
|
$this->remoteDir = $remoteDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Uploads a local file to a remote FTP server.
|
|
||||||
*
|
|
||||||
* @param string $localFile The local file path to upload.
|
|
||||||
*
|
|
||||||
* @throws \Exception If the upload fails or encounters an error.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function uploadFile(string $localFile): void
|
|
||||||
{
|
|
||||||
$ftp = ftp_ssl_connect($this->getHost(), $this->getPort());
|
|
||||||
|
|
||||||
if (!$ftp) {
|
|
||||||
throw new \Exception("Failed to connect to FTP server");
|
|
||||||
}
|
|
||||||
|
|
||||||
$ftp_login = ftp_login($ftp, $this->getUser(), $this->getPassword());
|
|
||||||
|
|
||||||
if (!$ftp_login) {
|
|
||||||
throw new \Exception("FTP login failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
ftp_pasv($ftp, true);
|
|
||||||
|
|
||||||
$remoteFile = 'stock_hiltes.csv';
|
|
||||||
|
|
||||||
if (!file_exists($localFile)) {
|
|
||||||
throw new \Exception("Local file does not exist: $localFile");
|
|
||||||
}
|
|
||||||
|
|
||||||
$r = ftp_nb_put($ftp, $this->getRemoteDir() . $remoteFile, $localFile, FTP_BINARY);
|
|
||||||
|
|
||||||
while ($r == FTP_MOREDATA) {
|
|
||||||
// Continue uploading...
|
|
||||||
$r = ftp_nb_continue($ftp);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($r != FTP_FINISHED) {
|
|
||||||
throw new \Exception("File upload failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
ftp_close($ftp);
|
|
||||||
|
|
||||||
if (!unlink($localFile)) {
|
|
||||||
throw new \Exception("Failed to delete local file: $localFile");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -4,7 +4,6 @@ namespace App\Helper;
|
|||||||
|
|
||||||
use App\Entity\Order;
|
use App\Entity\Order;
|
||||||
use App\Repository\OrderRepository;
|
use App\Repository\OrderRepository;
|
||||||
use Doctrine\Common\Collections\Criteria;
|
|
||||||
use Symfony\Component\Filesystem\Exception\IOExceptionInterface;
|
use Symfony\Component\Filesystem\Exception\IOExceptionInterface;
|
||||||
use Symfony\Component\Filesystem\Filesystem;
|
use Symfony\Component\Filesystem\Filesystem;
|
||||||
use Symfony\Component\Finder\Finder;
|
use Symfony\Component\Finder\Finder;
|
||||||
@ -97,8 +96,8 @@ class Hiltes
|
|||||||
if ($order) {
|
if ($order) {
|
||||||
|
|
||||||
|
|
||||||
//foreach ($orders as $order) {
|
//foreach ($orders as $order) {
|
||||||
// if ($order->getStatus() > 0) continue;
|
// if ($order->getStatus() > 0) continue;
|
||||||
$tA = $order->getData();#json_decode($order->getData());
|
$tA = $order->getData();#json_decode($order->getData());
|
||||||
#$tA['orderdate'] = "2023-08-30T12:05:24.000Z";
|
#$tA['orderdate'] = "2023-08-30T12:05:24.000Z";
|
||||||
|
|
||||||
@ -211,7 +210,7 @@ class Hiltes
|
|||||||
dd($arr);
|
dd($arr);
|
||||||
|
|
||||||
$data = $this->createJson($arr);
|
$data = $this->createJson($arr);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
return $this->sendOrderToHiltes($data);
|
return $this->sendOrderToHiltes($data);
|
||||||
|
|
||||||
|
@ -9,118 +9,122 @@ use App\Entity\Warehouse;
|
|||||||
use App\Repository\ProductRepository;
|
use App\Repository\ProductRepository;
|
||||||
use App\Repository\StockRepository;
|
use App\Repository\StockRepository;
|
||||||
use App\Repository\WarehouseRepository;
|
use App\Repository\WarehouseRepository;
|
||||||
|
use Exception;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
use RuntimeException;
|
||||||
|
use SplFileObject;
|
||||||
use Symfony\Component\Finder\Finder;
|
use Symfony\Component\Finder\Finder;
|
||||||
|
|
||||||
|
|
||||||
class HiltesImport
|
class HiltesImport
|
||||||
{
|
{
|
||||||
|
protected $currentDirPath;
|
||||||
|
protected $cachedWarehouseIds;
|
||||||
|
protected $arrData = array();
|
||||||
private $productRepository;
|
private $productRepository;
|
||||||
private $stockRepository;
|
private $stockRepository;
|
||||||
private $warehouseRepository;
|
private $warehouseRepository;
|
||||||
private $logger;
|
private $logger;
|
||||||
protected $currentDirPath;
|
private $cachedProdIds;
|
||||||
protected $cachedWarehouseIds;
|
private $cachedStockIds;
|
||||||
private $cachedProdIds;
|
|
||||||
private $cachedStockIds;
|
|
||||||
protected $arrData = array();
|
|
||||||
|
|
||||||
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;
|
||||||
$this->warehouseRepository = $warehouseRepository;
|
$this->warehouseRepository = $warehouseRepository;
|
||||||
$this->stockRepository = $stockRepository;
|
$this->stockRepository = $stockRepository;
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
|
|
||||||
$this->currentDirPath = getcwd();
|
$this->currentDirPath = getcwd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array|void
|
* @return array|void
|
||||||
*/
|
*/
|
||||||
public function startImport($delta = false)
|
public function startImport($delta = false)
|
||||||
{
|
{
|
||||||
#*** Holt alle Dateien
|
#*** Holt alle Dateien
|
||||||
if($this->getFiles($delta)){
|
if ($this->getFiles($delta)) {
|
||||||
#*** Holt alle Stocks und setzt ein Array **************
|
#*** Holt alle Stocks und setzt ein Array **************
|
||||||
$this->getStocks();
|
$this->getStocks();
|
||||||
$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']);
|
$count += $this->loadFiles($file['realPath']);
|
||||||
}else{
|
} else {
|
||||||
throw new \RuntimeException("Error: File not found - " . $file['realPath']);
|
throw new RuntimeException("Error: File not found - " . $file['realPath']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->logger->info("Imported $count stocks");
|
$this->logger->info("Imported $count stocks");
|
||||||
} else {
|
} else {
|
||||||
$this->logger->info('No Files');
|
$this->logger->info('No Files');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new \RuntimeException('Error in getFiles or no file WS.FERTIG');
|
throw new RuntimeException('Error in getFiles or no file WS.FERTIG');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
protected function getFiles($delta = false)
|
protected function getFiles($delta = false)
|
||||||
{
|
{
|
||||||
$finder = Finder::create();
|
$finder = Finder::create();
|
||||||
$finder
|
$finder
|
||||||
->in($this->currentDirPath.'/hiltes/h2c/')
|
->in($this->currentDirPath . '/hiltes/h2c/')
|
||||||
->depth(0);
|
->depth(0);
|
||||||
|
|
||||||
if($delta) {
|
if ($delta) {
|
||||||
$finder->name('/_D/');
|
$finder->name('/_D/');
|
||||||
}else{
|
} else {
|
||||||
$finder->notName('/_D/');
|
$finder->notName('/_D/');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($finder->hasResults()) {
|
if ($finder->hasResults()) {
|
||||||
foreach ($finder as $file) {
|
foreach ($finder as $file) {
|
||||||
if($file->getExtension() != 'Ende') {
|
if ($file->getExtension() != 'Ende') {
|
||||||
//prüfen ob Ende Datei vorhanden ist
|
//prüfen ob Ende Datei vorhanden ist
|
||||||
if(file_exists($this->currentDirPath.'/hiltes/h2c/'.$file->getRelativePathname().'.Ende')) {
|
if (file_exists($this->currentDirPath . '/hiltes/h2c/' . $file->getRelativePathname() . '.Ende')) {
|
||||||
$this->arrData['orgFiles']['data'][] = array(
|
$this->arrData['orgFiles']['data'][] = array(
|
||||||
'realPath' => $file->getRealPath(),
|
'realPath' => $file->getRealPath(),
|
||||||
'fileSize' => $file->getFileInfo()->getSize(),
|
'fileSize' => $file->getFileInfo()->getSize(),
|
||||||
'onlyFileName' => $file->getRelativePathname(),
|
'onlyFileName' => $file->getRelativePathname(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
protected function getStocks()
|
|
||||||
{
|
protected function getStocks()
|
||||||
|
{
|
||||||
$stocks = $this->stockRepository->findAll();
|
$stocks = $this->stockRepository->findAll();
|
||||||
|
|
||||||
foreach ($stocks as $stock) {
|
foreach ($stocks as $stock) {
|
||||||
$this->cachedStockIds[$stock->getProductId()][$stock->getWarehouse()->getId()] = $stock;
|
$this->cachedStockIds[$stock->getProductId()][$stock->getWarehouse()->getId()] = $stock;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function loadFiles($srcFile)
|
protected function loadFiles($srcFile)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$file = new \SplFileObject($srcFile);
|
$file = new SplFileObject($srcFile);
|
||||||
$this->logger->info('Starte Import von ' . $file->getRealPath());
|
$this->logger->info('Starte Import von ' . $file->getRealPath());
|
||||||
$count = 0;
|
$count = 0;
|
||||||
|
|
||||||
while (!$file->eof()) {
|
while (!$file->eof()) {
|
||||||
$this->processLine($file->fgets());
|
$this->processLine($file->fgets());
|
||||||
$count++;
|
$count++;
|
||||||
}
|
}
|
||||||
}catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->logger->error($e->getMessage());
|
$this->logger->error($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,7 +134,7 @@ class HiltesImport
|
|||||||
$this->logger->info($count . ' Datensätze importiert');
|
$this->logger->info($count . ' Datensätze importiert');
|
||||||
|
|
||||||
return $count;
|
return $count;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function processLine($line)
|
protected function processLine($line)
|
||||||
{
|
{
|
||||||
@ -139,15 +143,15 @@ class HiltesImport
|
|||||||
if (!empty($data[0])) {
|
if (!empty($data[0])) {
|
||||||
$this->trimArray($data);
|
$this->trimArray($data);
|
||||||
$this->saveData($data);
|
$this->saveData($data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function trimArray(array &$arr)
|
protected function trimArray(array &$arr)
|
||||||
{
|
{
|
||||||
foreach ($arr as $k=>$v) {
|
foreach ($arr as $k => $v) {
|
||||||
$arr[$k] = trim($v);
|
$arr[$k] = trim($v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function saveData(array $data)
|
protected function saveData(array $data)
|
||||||
{
|
{
|
||||||
@ -156,63 +160,64 @@ class HiltesImport
|
|||||||
|
|
||||||
if (!empty($warehouse) && !empty($this->cachedStockIds[$gtin][$warehouse->getId()])) {
|
if (!empty($warehouse) && !empty($this->cachedStockIds[$gtin][$warehouse->getId()])) {
|
||||||
$stock = $this->cachedStockIds[$gtin][$warehouse->getId()];
|
$stock = $this->cachedStockIds[$gtin][$warehouse->getId()];
|
||||||
}else{
|
} else {
|
||||||
$stock = new Stock();
|
$stock = new Stock();
|
||||||
$stock->setProductId($gtin);
|
$stock->setProductId($gtin);
|
||||||
$stock->setWarehouse($warehouse);
|
$stock->setWarehouse($warehouse);
|
||||||
}
|
}
|
||||||
|
|
||||||
$stock->setInstock((int) $data[1] / 100);
|
$stock->setInstock((int)$data[1] / 100);
|
||||||
$this->stockRepository->save($stock,true);
|
$this->stockRepository->save($stock, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function checkWarehouseName(string $warehouseName)
|
private function checkWarehouseName(string $warehouseName)
|
||||||
{
|
{
|
||||||
$warehouseName = ltrim($warehouseName, 0);
|
$warehouseName = ltrim($warehouseName, 0);
|
||||||
|
|
||||||
if (empty($this->cachedWarehouseIds[$warehouseName])) {
|
if (empty($this->cachedWarehouseIds[$warehouseName])) {
|
||||||
$warehouse = $this->warehouseRepository->findOneBy(['id' => (int) $warehouseName]);
|
$warehouse = $this->warehouseRepository->findOneBy(['id' => (int)$warehouseName]);
|
||||||
|
|
||||||
if (empty($warehouse)) {
|
if (empty($warehouse)) {
|
||||||
$warehouse = new Warehouse();
|
$warehouse = new Warehouse();
|
||||||
$warehouse->setId((int) $warehouseName);
|
$warehouse->setId((int)$warehouseName);
|
||||||
$warehouse->setName($warehouseName);
|
$warehouse->setName($warehouseName);
|
||||||
$this->warehouseRepository->save($warehouse,true);
|
$this->warehouseRepository->save($warehouse, true);
|
||||||
$this->cachedWarehouseIds[$warehouseName] = $warehouse;
|
$this->cachedWarehouseIds[$warehouseName] = $warehouse;
|
||||||
}else{
|
} else {
|
||||||
$this->cachedWarehouseIds[$warehouseName] = $warehouse;
|
$this->cachedWarehouseIds[$warehouseName] = $warehouse;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($this->cachedWarehouseIds[$warehouseName])) {
|
if (!empty($this->cachedWarehouseIds[$warehouseName])) {
|
||||||
return $this->cachedWarehouseIds[$warehouseName];
|
return $this->cachedWarehouseIds[$warehouseName];
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $gtin
|
* @param string $gtin
|
||||||
* @return false|int|mixed|null
|
* @return false|int|mixed|null
|
||||||
*/
|
*/
|
||||||
private function checkProduct(string $gtin){
|
private function checkProduct(string $gtin)
|
||||||
#*** WEnn keine geCached Id Vorhanden
|
{
|
||||||
if(empty($this->cachedProdIds[$gtin])){
|
#*** WEnn keine geCached Id Vorhanden
|
||||||
|
if (empty($this->cachedProdIds[$gtin])) {
|
||||||
$product = $this->productRepository->findOneBy(['gtin' => $gtin]);
|
$product = $this->productRepository->findOneBy(['gtin' => $gtin]);
|
||||||
|
|
||||||
if (empty($product)) {
|
if (empty($product)) {
|
||||||
$product = new Product();
|
$product = new Product();
|
||||||
$product->setGtin($gtin);
|
$product->setGtin($gtin);
|
||||||
$this->cachedProdIds[$gtin] = $this->productRepository->save($product, true);
|
$this->cachedProdIds[$gtin] = $this->productRepository->save($product, true);
|
||||||
}else{
|
} else {
|
||||||
$this->cachedProdIds[$gtin] = $product->getId();
|
$this->cachedProdIds[$gtin] = $product->getId();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($this->cachedProdIds[$gtin])) {
|
|
||||||
return $this->cachedProdIds[$gtin];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
if (!empty($this->cachedProdIds[$gtin])) {
|
||||||
}
|
return $this->cachedProdIds[$gtin];
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
@ -5,8 +5,10 @@ namespace App\Helper;
|
|||||||
use App\Repository\ProductRepository;
|
use App\Repository\ProductRepository;
|
||||||
use App\Repository\StockRepository;
|
use App\Repository\StockRepository;
|
||||||
use App\Repository\WarehouseRepository;
|
use App\Repository\WarehouseRepository;
|
||||||
use Psr\Log\LoggerInterface;
|
use ArrayIterator;
|
||||||
|
use Exception;
|
||||||
use League\Csv\Writer;
|
use League\Csv\Writer;
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
|
|
||||||
class Jtl
|
class Jtl
|
||||||
@ -28,7 +30,7 @@ class Jtl
|
|||||||
10 => 'Lager 10 - OJ EF',
|
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;
|
||||||
$this->warehouseRepository = $warehouseRepository;
|
$this->warehouseRepository = $warehouseRepository;
|
||||||
@ -47,31 +49,31 @@ class Jtl
|
|||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
|
|
||||||
foreach($r as $product){
|
foreach ($r as $product) {
|
||||||
$stock = $this->stockRepository->findBy(['product_id'=>$product->getId()]);
|
$stock = $this->stockRepository->findBy(['product_id' => $product->getId()]);
|
||||||
|
|
||||||
if($stock){
|
if ($stock) {
|
||||||
foreach($stock as $s){
|
foreach ($stock as $s) {
|
||||||
$warehouse = $s->getWarehouse();
|
$warehouse = $s->getWarehouse();
|
||||||
$warehouseName = $warehouse->getName();
|
$warehouseName = $warehouse->getName();
|
||||||
|
|
||||||
$data[$product->getId().$warehouseName] = [
|
$data[$product->getId() . $warehouseName] = [
|
||||||
'gtin' => $product->getGtin(),
|
'gtin' => $product->getGtin(),
|
||||||
'stock' => $s->getInstock(),
|
'stock' => $s->getInstock(),
|
||||||
'warehouse' => $this->arrLager[$warehouseName] ?? 'Lager ' . $warehouseName
|
'warehouse' => $this->arrLager[$warehouseName] ?? 'Lager ' . $warehouseName
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
$data[$product->getId()] = [
|
$data[$product->getId()] = [
|
||||||
'gtin' => $product->getGtin(),
|
'gtin' => $product->getGtin(),
|
||||||
'stock' => 0,
|
'stock' => 0,
|
||||||
'warehouse' => 0
|
'warehouse' => 0
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->logger->info('No stock for product '.$product->getId());
|
$this->logger->info('No stock for product ' . $product->getId());
|
||||||
}
|
}
|
||||||
// dump($data);
|
// dump($data);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,22 +88,20 @@ class Jtl
|
|||||||
public function createExportFile($data): void
|
public function createExportFile($data): void
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$writer = Writer::createFromPath(getcwd().'/jtl/cds-export.csv', 'w+');
|
$writer = Writer::createFromPath(getcwd() . '/jtl/cds-export.csv', 'w+');
|
||||||
$bytes = $writer->insertAll(new \ArrayIterator($data));
|
$bytes = $writer->insertAll(new ArrayIterator($data));
|
||||||
|
|
||||||
if($bytes){
|
if ($bytes) {
|
||||||
$this->logger->info('Exported '.$bytes.' bytes');
|
$this->logger->info('Exported ' . $bytes . ' bytes');
|
||||||
|
|
||||||
$FTP = new Ftp();
|
$FTP = new Ftp();
|
||||||
$FTP->uploadFile(getcwd().'/jtl/cds-export.csv');
|
$FTP->uploadFile(getcwd() . '/jtl/cds-export.csv');
|
||||||
}
|
}
|
||||||
|
|
||||||
}catch (\Exception $e){
|
} catch (Exception $e) {
|
||||||
$this->logger->error($e->getMessage());
|
$this->logger->error($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Helper;
|
namespace App\Helper;
|
||||||
|
|
||||||
use Symfony\Component\Notifier\Chatter;
|
|
||||||
use Symfony\Component\Notifier\ChatterInterface;
|
use Symfony\Component\Notifier\ChatterInterface;
|
||||||
use Symfony\Component\Notifier\Exception\TransportExceptionInterface;
|
use Symfony\Component\Notifier\Exception\TransportExceptionInterface;
|
||||||
use Symfony\Component\Notifier\Message\ChatMessage;
|
use Symfony\Component\Notifier\Message\ChatMessage;
|
||||||
@ -16,7 +15,7 @@ class Slack
|
|||||||
$this->chatter = $chatter;
|
$this->chatter = $chatter;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sendMessage(String $message): void
|
public function sendMessage(string $message): void
|
||||||
{
|
{
|
||||||
$message = (new ChatMessage($message))
|
$message = (new ChatMessage($message))
|
||||||
->transport('slack');
|
->transport('slack');
|
||||||
|
@ -5,6 +5,7 @@ namespace App\Repository;
|
|||||||
use App\Entity\Order;
|
use App\Entity\Order;
|
||||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||||
use Doctrine\Persistence\ManagerRegistry;
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
|
use Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @extends ServiceEntityRepository<Order>
|
* @extends ServiceEntityRepository<Order>
|
||||||
@ -39,6 +40,22 @@ class OrderRepository extends ServiceEntityRepository
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function update(Order $entity, bool $flush = false): void
|
||||||
|
{
|
||||||
|
$order = $this->getEntityManager()->find(Order::class, $entity->getId());
|
||||||
|
|
||||||
|
if (!$order) {
|
||||||
|
throw $this->createNotFoundException('Order not found: ' . $entity->getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($flush) {
|
||||||
|
$this->getEntityManager()->flush();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * @return Order[] Returns an array of Order objects
|
// * @return Order[] Returns an array of Order objects
|
||||||
// */
|
// */
|
||||||
@ -63,4 +80,11 @@ class OrderRepository extends ServiceEntityRepository
|
|||||||
// ->getOneOrNullResult()
|
// ->getOneOrNullResult()
|
||||||
// ;
|
// ;
|
||||||
// }
|
// }
|
||||||
}
|
/**
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private function createNotFoundException(string $string)
|
||||||
|
{
|
||||||
|
throw new Exception($string);
|
||||||
|
}
|
||||||
|
}
|
@ -1,105 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Repository;
|
|
||||||
|
|
||||||
use App\Entity\Orders;
|
|
||||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
|
||||||
use Doctrine\Persistence\ManagerRegistry;
|
|
||||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @extends ServiceEntityRepository<Orders>
|
|
||||||
*
|
|
||||||
* @method Orders|null find($id, $lockMode = null, $lockVersion = null)
|
|
||||||
* @method Orders|null findOneBy(array $criteria, array $orderBy = null)
|
|
||||||
* @method Orders[] findAll()
|
|
||||||
* @method Orders[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
|
||||||
*/
|
|
||||||
class OrdersRepository extends ServiceEntityRepository
|
|
||||||
{
|
|
||||||
private ValidatorInterface $validator;
|
|
||||||
|
|
||||||
public function __construct(ManagerRegistry $registry, ValidatorInterface $validator)
|
|
||||||
{
|
|
||||||
parent::__construct($registry, Orders::class);
|
|
||||||
$this->validator = $validator;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Orders $entity
|
|
||||||
* @param bool $flush
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function add(Orders $entity, bool $flush = false): void
|
|
||||||
{
|
|
||||||
|
|
||||||
$errors = $this->validator->validate($entity);
|
|
||||||
if (count($errors) > 0) {
|
|
||||||
var_dump($errors);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->getEntityManager()->persist($entity);
|
|
||||||
|
|
||||||
if ($flush) {
|
|
||||||
$this->getEntityManager()->flush();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Orders $entity
|
|
||||||
* @param bool $flush
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function update(Orders $entity, bool $flush = false): void
|
|
||||||
{
|
|
||||||
$order = $this->getEntityManager()->find(Orders::class, $entity->getId());
|
|
||||||
|
|
||||||
if (!$order) {
|
|
||||||
throw $this->createNotFoundException('Order not found: '.$entity->getId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Orders $entity
|
|
||||||
* @param bool $flush
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function remove(Orders $entity, bool $flush = false): void
|
|
||||||
{
|
|
||||||
$this->getEntityManager()->remove($entity);
|
|
||||||
|
|
||||||
if ($flush) {
|
|
||||||
$this->getEntityManager()->flush();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Orders[] Returns an array of Orders objects
|
|
||||||
*/
|
|
||||||
public function findByStatus($status): array
|
|
||||||
{
|
|
||||||
return $this->createQueryBuilder('o')
|
|
||||||
->andWhere('o.status = :val')
|
|
||||||
->setParameter('val', $status)
|
|
||||||
->orderBy('o.id', 'ASC')
|
|
||||||
->setMaxResults(100)
|
|
||||||
->getQuery()
|
|
||||||
->getResult()
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $orderId
|
|
||||||
* @return Orders|null
|
|
||||||
* @throws \Doctrine\ORM\NonUniqueResultException
|
|
||||||
*/
|
|
||||||
public function findOneByOrderId($orderId): ?Orders
|
|
||||||
{
|
|
||||||
return $this->createQueryBuilder('o')
|
|
||||||
->andWhere('o.order_id = :val')
|
|
||||||
->setParameter('val', $orderId)
|
|
||||||
->getQuery()
|
|
||||||
->getOneOrNullResult()
|
|
||||||
;
|
|
||||||
}
|
|
||||||
}
|
|
@ -3,6 +3,7 @@
|
|||||||
namespace App\Repository;
|
namespace App\Repository;
|
||||||
|
|
||||||
use App\Entity\Product;
|
use App\Entity\Product;
|
||||||
|
use DateTime;
|
||||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||||
use Doctrine\Persistence\ManagerRegistry;
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
|
|
||||||
@ -24,7 +25,7 @@ class ProductRepository extends ServiceEntityRepository
|
|||||||
public function save(Product $entity, bool $flush = false): ?int
|
public function save(Product $entity, bool $flush = false): ?int
|
||||||
{
|
{
|
||||||
|
|
||||||
$entity->setUpdateTime(new \DateTime());
|
$entity->setUpdateTime(new DateTime());
|
||||||
|
|
||||||
$this->getEntityManager()->persist($entity);
|
$this->getEntityManager()->persist($entity);
|
||||||
|
|
||||||
@ -68,4 +69,4 @@ class ProductRepository extends ServiceEntityRepository
|
|||||||
// ->getOneOrNullResult()
|
// ->getOneOrNullResult()
|
||||||
// ;
|
// ;
|
||||||
// }
|
// }
|
||||||
}
|
}
|
@ -3,6 +3,7 @@
|
|||||||
namespace App\Repository;
|
namespace App\Repository;
|
||||||
|
|
||||||
use App\Entity\Stock;
|
use App\Entity\Stock;
|
||||||
|
use DateTime;
|
||||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||||
use Doctrine\Persistence\ManagerRegistry;
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
|
|
||||||
@ -23,7 +24,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);
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ class WarehouseRepository extends ServiceEntityRepository
|
|||||||
|
|
||||||
public function save(Warehouse $entity, bool $flush = false): ?int
|
public function save(Warehouse $entity, bool $flush = false): ?int
|
||||||
{
|
{
|
||||||
$entity->setPrio(0);
|
$entity->setPrio(0);
|
||||||
$this->getEntityManager()->persist($entity);
|
$this->getEntityManager()->persist($entity);
|
||||||
|
|
||||||
if ($flush) {
|
if ($flush) {
|
||||||
@ -66,4 +66,4 @@ class WarehouseRepository extends ServiceEntityRepository
|
|||||||
// ->getOneOrNullResult()
|
// ->getOneOrNullResult()
|
||||||
// ;
|
// ;
|
||||||
// }
|
// }
|
||||||
}
|
}
|
@ -52,7 +52,7 @@ class ApiKeyAuthenticator extends AbstractAuthenticator
|
|||||||
|
|
||||||
public function onAuthenticationFailure(Request $request, AuthenticationException $exception): ?Response
|
public function onAuthenticationFailure(Request $request, AuthenticationException $exception): ?Response
|
||||||
{
|
{
|
||||||
# dump($exception);
|
# dump($exception);
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'message' => $exception->getMessage()
|
'message' => $exception->getMessage()
|
||||||
|
Loading…
Reference in New Issue
Block a user