This commit is contained in:
@@ -31,19 +31,19 @@ class Hiltes
|
||||
$this->hiltesPass = $_ENV['HILTES_API_PASS'];
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
|
||||
$finder = new Finder();
|
||||
$finder->files()->in($this->current_dir_path . "/hiltes/h2c/");
|
||||
|
||||
foreach ($finder as $file) {
|
||||
$contents = $file->getContents();
|
||||
|
||||
//var_dump($contents);
|
||||
}
|
||||
|
||||
}
|
||||
// public function import()
|
||||
// {
|
||||
//
|
||||
// $finder = new Finder();
|
||||
// $finder->files()->in($this->current_dir_path . "/hiltes/h2c/");
|
||||
//
|
||||
// foreach ($finder as $file) {
|
||||
// $contents = $file->getContents();
|
||||
//
|
||||
// //var_dump($contents);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
/**
|
||||
* @param string $data
|
||||
@@ -84,13 +84,14 @@ class Hiltes
|
||||
public function createRequest($orderData)
|
||||
{
|
||||
|
||||
$data = array();
|
||||
$this->loginToHiltes('', '');
|
||||
$order = $this->orderRepository->findOneBy(array('orderId' => $orderData->getOrderId()));
|
||||
|
||||
/**
|
||||
* @var Order
|
||||
*/
|
||||
$order = $this->orderRepository->findOneBy(array('orderId' => $orderData->getOrderId()));
|
||||
|
||||
|
||||
if ($order) {
|
||||
//foreach ($orders as $order) {
|
||||
if ($order->getStatus() != 2) return false;
|
||||
@@ -116,9 +117,12 @@ class Hiltes
|
||||
# "AchievedSalesPrice" => 0, #X Erzielter Verkaufspreis
|
||||
$tSalNr = array();
|
||||
foreach ($tA['positions'] as $v) {
|
||||
if ($v['type'] == 'versandposition') {
|
||||
$SalesNumber = '000001';
|
||||
$SalesGoodsGroupNumber = 9350;
|
||||
if ($v['type'] == 'versandposition' || $v['sku'] == '') {
|
||||
// $SalesNumber = '000001';
|
||||
// $SalesGoodsGroupNumber = 9350;
|
||||
|
||||
// Versandkosten werden nicht übermittelt
|
||||
continue;
|
||||
} else {
|
||||
$SalesNumber = (!empty($v['gtin']) ? $v['gtin'] : $v['sku']);
|
||||
if (preg_match('/^([0-9]+)_/', $SalesNumber, $tP)) {
|
||||
|
||||
@@ -40,7 +40,7 @@ class HiltesImport
|
||||
|
||||
|
||||
/**
|
||||
* @return array|void
|
||||
* @return void
|
||||
*/
|
||||
public function startImport($delta = false)
|
||||
{
|
||||
@@ -182,10 +182,8 @@ class HiltesImport
|
||||
$warehouse->setId((int)$warehouseName);
|
||||
$warehouse->setName($warehouseName);
|
||||
$this->warehouseRepository->save($warehouse, true);
|
||||
$this->cachedWarehouseIds[$warehouseName] = $warehouse;
|
||||
} else {
|
||||
$this->cachedWarehouseIds[$warehouseName] = $warehouse;
|
||||
}
|
||||
$this->cachedWarehouseIds[$warehouseName] = $warehouse;
|
||||
}
|
||||
|
||||
if (!empty($this->cachedWarehouseIds[$warehouseName])) {
|
||||
|
||||
@@ -42,15 +42,19 @@ class Jtl
|
||||
* Holt alle Produkte und deren Lagerbestände
|
||||
* @return array
|
||||
*/
|
||||
public function getProducts(): array
|
||||
public function getProducts(int $warehouseId): array
|
||||
{
|
||||
|
||||
$r = $this->productRepository->findAll();
|
||||
|
||||
$data = array();
|
||||
|
||||
foreach ($r as $product) {
|
||||
$stock = $this->stockRepository->findBy(['product_id' => $product->getId()]);
|
||||
|
||||
if ($warehouseId != 0) {
|
||||
$stock = $this->stockRepository->findBy(['product_id' => $product->getId(), 'warehouse_id' => $warehouseId]);
|
||||
} else {
|
||||
$stock = $this->stockRepository->findBy(['product_id' => $product->getId()]);
|
||||
}
|
||||
|
||||
if ($stock) {
|
||||
foreach ($stock as $s) {
|
||||
@@ -83,17 +87,17 @@ class Jtl
|
||||
* @param $data
|
||||
* @return void
|
||||
*/
|
||||
public function createExportFile($data): void
|
||||
public function createExportFile($data, $warehouse): void
|
||||
{
|
||||
try {
|
||||
$writer = Writer::createFromPath(getcwd() . '/www/jtl/cds-export.csv', 'w+');
|
||||
$writer = Writer::createFromPath(getcwd() . '/www/jtl/' . $warehouse . '.csv', 'w+');
|
||||
$bytes = $writer->insertAll(new ArrayIterator($data));
|
||||
|
||||
if ($bytes) {
|
||||
$this->logger->info('Exported ' . $bytes . ' bytes');
|
||||
|
||||
$FTP = new Ftp();
|
||||
$FTP->uploadFile(getcwd() . '/www/jtl/cds-export.csv');
|
||||
$FTP->uploadFile(getcwd() . '/www/jtl/' . $warehouse . '.csv');
|
||||
}
|
||||
|
||||
} catch (Exception $e) {
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Helper;
|
||||
|
||||
use Symfony\Component\Notifier\ChatterInterface;
|
||||
use Symfony\Component\Notifier\Exception\TransportExceptionInterface;
|
||||
use Symfony\Component\Notifier\Message\ChatMessage;
|
||||
|
||||
class Slack
|
||||
{
|
||||
private $chatter;
|
||||
|
||||
public function __construct(ChatterInterface $chatter)
|
||||
{
|
||||
$this->chatter = $chatter;
|
||||
}
|
||||
|
||||
public function sendMessage(string $message): void
|
||||
{
|
||||
$message = (new ChatMessage($message))
|
||||
->transport('slack');
|
||||
|
||||
try {
|
||||
$sentMessage = $this->chatter->send($message);
|
||||
} catch (TransportExceptionInterface $e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user