diff --git a/Interfaces/GSD/Importer.php b/Interfaces/GSD/Importer.php index a4827a8..173f1cb 100755 --- a/Interfaces/GSD/Importer.php +++ b/Interfaces/GSD/Importer.php @@ -21,17 +21,17 @@ use Modules\Accounting\Models\CostObjectMapper; use Modules\ClientManagement\Models\Client; use Modules\Exchange\Interfaces\GSD\Model\GSDCostCenterMapper; use Modules\Exchange\Interfaces\GSD\Model\GSDCostObjectMapper; - use Modules\Exchange\Models\ImporterAbstract; - use phpOMS\DataStorage\Database\Connection\ConnectionAbstract; use phpOMS\DataStorage\Database\Connection\ConnectionFactory; use phpOMS\DataStorage\Database\DatabaseStatus; use phpOMS\DataStorage\Database\DataMapperAbstract; use phpOMS\Message\RequestAbstract; -use Modules\Exchange\Interfaces\GSD\Model\GSDAddressMapper; use Modules\Exchange\Interfaces\GSD\Model\GSDCustomerMapper; use Modules\ClientManagement\Models\ClientMapper; +use Modules\SupplierManagement\Models\SupplierMapper; +use Modules\Exchange\Interfaces\GSD\Model\GSDSupplierMapper; +use Modules\SupplierManagement\Models\Supplier; /** * GSD import class @@ -65,7 +65,6 @@ final class Importer extends ImporterAbstract { $this->importCostCenter($start, $end); $this->importCostObject($start, $end); - $this->importAddress($start, $end); $this->importCustomer($start, $end); $this->importSupplier($start, $end); $this->importArticle($start, $end); @@ -235,6 +234,21 @@ final class Importer extends ImporterAbstract */ public function importSupplier(\DateTime $start, \DateTime $end) : void { + DataMapperAbstract::setConnection($this->remote); + $query = GSDSupplierMapper::getQuery(); + $query->where('row_create_time', '=>', $start->format('Y-m-d H:i:s')) + ->andWhere('row_create_time', '<=', $end->format('Y-m-d H:i:s')); + + $suppliers = GSDSupplierMapper::getAllByQuery($query); + + DataMapperAbstract::setConnection($this->local); + + foreach ($suppliers as $supplier) { + $obj = new Supplier(); + $obj->setNumber($supplier->getNumber()); + + SupplierMapper::create($obj); + } } /** diff --git a/Interfaces/GSD/Model/GSDAddress.php b/Interfaces/GSD/Model/GSDAddress.php index 1035c3b..baa1349 100755 --- a/Interfaces/GSD/Model/GSDAddress.php +++ b/Interfaces/GSD/Model/GSDAddress.php @@ -24,4 +24,82 @@ namespace Modules\Exchange\Interfaces\GSD\Model; */ final class GSDAddress { + protected int $id = 0; + + private string $name1 = ''; + + private string $name2 = ''; + + private string $name3 = ''; + + private string $city = ''; + + private string $country = ''; + + private string $zip = ''; + + private string $street = ''; + + private string $phone = ''; + + private string $fax = ''; + + private string $email = ''; + + private string $website = ''; + + public function getName1() : string + { + return $this->name1; + } + + public function getName2() : string + { + return $this->name2; + } + + public function getName3() : string + { + return $this->name3; + } + + public function getCity() : string + { + return $this->city; + } + + public function getZip() : string + { + return $this->zip; + } + + public function getStreet() : string + { + return $this->street; + } + + public function getCountry() : string + { + return $this->country; + } + + public function getPhone() : string + { + return $this->phone; + } + + public function getEmail() : string + { + return $this->email; + } + + public function getFax() : string + { + return $this->fax; + } + + public function getWebsite() : string + { + return $this->website; + } } diff --git a/Interfaces/GSD/Model/GSDAddressMapper.php b/Interfaces/GSD/Model/GSDAddressMapper.php index 24cbb6a..cf16cf2 100755 --- a/Interfaces/GSD/Model/GSDAddressMapper.php +++ b/Interfaces/GSD/Model/GSDAddressMapper.php @@ -44,6 +44,9 @@ final class GSDAddressMapper extends DataMapperAbstract 'STRASSE' => ['name' => 'STRASSE', 'type' => 'string', 'internal' => 'street'], 'LAND' => ['name' => 'LAND', 'type' => 'string', 'internal' => 'country'], 'TELEFON' => ['name' => 'TELEFON', 'type' => 'string', 'internal' => 'phone'], + 'Fax' => ['name' => 'Fax', 'type' => 'string', 'internal' => 'fax'], + 'Email' => ['name' => 'Email', 'type' => 'string', 'internal' => 'email'], + 'InternetAdresse' => ['name' => 'InternetAdresse', 'type' => 'string', 'internal' => 'website'], ]; /** diff --git a/Interfaces/GSD/Model/GSDArticle.php b/Interfaces/GSD/Model/GSDArticle.php index 5ad67d7..ebf9932 100755 --- a/Interfaces/GSD/Model/GSDArticle.php +++ b/Interfaces/GSD/Model/GSDArticle.php @@ -24,4 +24,89 @@ namespace Modules\Exchange\Interfaces\GSD\Model; */ final class GSDArticle { + protected int $id = 0; + + private \DateTime $createdAt; + + private string $number = ''; + + private string $info = ''; + + private string $name1 = ''; + + private string $name2 = ''; + + private string $name1Eng = ''; + + private string $name2Eng = ''; + + private int $status = 0; + + private int $lotType = 0; + + private float $weight = 0.0; + + private int $leadTime = 0; + + private string $EUitemgroup = ''; + + public function __construct() + { + $this->createdAt = new \DateTime('now'); + } + + public function getNumber() : string + { + return $this->number; + } + + public function getInfo() : string + { + return $this->info; + } + + public function getName1() : string + { + return $this->name1; + } + + public function getName2() : string + { + return $this->name2; + } + + public function getName1Eng() : string + { + return $this->name1Eng; + } + + public function getName2Eng() : string + { + return $this->name2Eng; + } + + public function getStatus() : int + { + return $this->status; + } + + public function getLotType() : int + { + return $this->lotType; + } + + public function getWeight() : float + { + return $this->weight; + } + + public function getLeadTime() : int + { + return $this->leadTime; + } + + public function getEUItemGroup() : string + { + return $this->EUitemgroup; + } } diff --git a/Interfaces/GSD/Model/GSDArticleMapper.php b/Interfaces/GSD/Model/GSDArticleMapper.php index 1fac554..03c8231 100755 --- a/Interfaces/GSD/Model/GSDArticleMapper.php +++ b/Interfaces/GSD/Model/GSDArticleMapper.php @@ -37,9 +37,12 @@ final class GSDArticleMapper extends DataMapperAbstract 'row_create_time' => ['name' => 'row_create_time', 'type' => 'DateTime', 'internal' => 'createdAt', 'readonly' => true], 'row_create_user' => ['name' => 'row_create_user', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true], 'Artikelnummer' => ['name' => 'Artikelnummer', 'type' => 'string', 'internal' => 'number'], + 'Info' => ['name' => 'Info', 'type' => 'string', 'internal' => 'info'], 'Artikelbezeichnung' => ['name' => 'Artikelbezeichnung', 'type' => 'string', 'internal' => 'name1'], '_Artikelbezeichnung2' => ['name' => '_Artikelbezeichnung2', 'type' => 'string', 'internal' => 'name2'], - 'EUWarengruppe' => ['name' => 'EUWarengruppe', 'type' => 'string', 'internal' => 'euCustomId'], + '_Englisch1' => ['name' => '_Englisch1', 'type' => 'string', 'internal' => 'name1Eng'], + '_Englisch2' => ['name' => '_Englisch2', 'type' => 'string', 'internal' => 'name2Eng'], + 'EUWarengruppe' => ['name' => 'EUWarengruppe', 'type' => 'string', 'internal' => 'EUitemgroup'], ]; /** diff --git a/Interfaces/GSD/Model/GSDCostCenter.php b/Interfaces/GSD/Model/GSDCostCenter.php index e8cbdba..67bd912 100755 --- a/Interfaces/GSD/Model/GSDCostCenter.php +++ b/Interfaces/GSD/Model/GSDCostCenter.php @@ -43,10 +43,10 @@ final class GSDCostCenter implements \JsonSerializable /** * Created. * - * @var null|\DateTime + * @var \DateTime * @since 1.0.0 */ - protected ?\DateTime $createdAt = null; + protected \DateTime $createdAt; /** * Description. diff --git a/Interfaces/GSD/Model/GSDCostObject.php b/Interfaces/GSD/Model/GSDCostObject.php index e52ae4e..ba12500 100755 --- a/Interfaces/GSD/Model/GSDCostObject.php +++ b/Interfaces/GSD/Model/GSDCostObject.php @@ -43,10 +43,10 @@ final class GSDCostObject implements \JsonSerializable /** * Created. * - * @var null|\DateTime + * @var \DateTime * @since 1.0.0 */ - protected ?\DateTime $createdAt = null; + protected \DateTime $createdAt; /** * Description. diff --git a/Interfaces/GSD/Model/GSDCustomer.php b/Interfaces/GSD/Model/GSDCustomer.php index 083c558..a51419c 100755 --- a/Interfaces/GSD/Model/GSDCustomer.php +++ b/Interfaces/GSD/Model/GSDCustomer.php @@ -37,15 +37,84 @@ final class GSDCustomer /** * Created. * - * @var null|\DateTime + * @var \DateTime * @since 1.0.0 */ - protected ?\DateTime $createdAt = null; + protected \DateTime $createdAt; private string $number = ''; + private string $info = ''; + + private float $creditlimit = 0.0; + + private string $egustid = ''; + + private string $taxid = ''; + + private string $bic = ''; + + private string $iban = ''; + + private GSDAddress $addr; + + private int $deliveryStatus = 0; + + private int $salesRep = 0; + + public function __construct() + { + $this->addr = new GSDAddress(); + $this->createdAt = new \DateTime('now'); + } + public function getNumber() : string { return $this->number; } + + public function getInfo() : string + { + return $this->info; + } + + public function getCreditLimit() : float + { + return $this->creditlimit; + } + + public function getEGUstId() : string + { + return $this->egustid; + } + + public function getTaxId() : string + { + return $this->taxid; + } + + public function getBIC() : string + { + return $this->bic; + } + + public function getIban() : string + { + return $this->iban; + } + + public function getAddress() : GSDAddress + { + return $this->addr; + } + + public function getDeliveryStatus() : int + { + return $this->deliveryStatus; + } + + public function getSalesRep() : int + { + return $this->salesRep; + } } diff --git a/Interfaces/GSD/Model/GSDCustomerMapper.php b/Interfaces/GSD/Model/GSDCustomerMapper.php index dca31f0..3f8267c 100755 --- a/Interfaces/GSD/Model/GSDCustomerMapper.php +++ b/Interfaces/GSD/Model/GSDCustomerMapper.php @@ -33,14 +33,22 @@ final class GSDCustomerMapper extends DataMapperAbstract * @since 1.0.0 */ protected static array $columns = [ - 'row_id' => ['name' => 'row_id', 'type' => 'int', 'internal' => 'id'], - 'row_create_time' => ['name' => 'row_create_time', 'type' => 'DateTime', 'internal' => 'createdAt', 'readonly' => true], - 'row_create_user' => ['name' => 'row_create_user', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true], - 'Kundennummer' => ['name' => 'Kundennummer', 'type' => 'string', 'internal' => 'number'], + 'row_id' => ['name' => 'row_id', 'type' => 'int', 'internal' => 'id'], + 'row_create_time' => ['name' => 'row_create_time', 'type' => 'DateTime', 'internal' => 'createdAt', 'readonly' => true], + 'row_create_user' => ['name' => 'row_create_user', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true], + 'Kundennummer' => ['name' => 'Kundennummer', 'type' => 'string', 'internal' => 'number'], + 'Info' => ['name' => 'Info', 'type' => 'string', 'internal' => 'info'], + 'Auftragssperre' => ['name' => 'Auftragssperre', 'type' => 'string', 'internal' => 'deliveryStatus'], + 'KreditLimitintern' => ['name' => 'KreditLimitintern', 'type' => 'string', 'internal' => 'creditlimit'], + 'EGUstId' => ['name' => 'EGUstId', 'type' => 'string', 'internal' => 'egustid'], + 'Steuernummer' => ['name' => 'Steuernummer', 'type' => 'string', 'internal' => 'taxid'], + 'BIC' => ['name' => 'BIC', 'type' => 'string', 'internal' => 'bic'], + 'IBAN' => ['name' => 'IBAN', 'type' => 'string', 'internal' => 'iban'], + 'Verkaeufer' => ['name' => 'Verkaeufer', 'type' => 'int', 'internal' => 'salesRep'], ]; protected static array $ownsOne = [ - 'mainAddress' => [ + 'addr' => [ 'mapper' => GSDAddressMapper::class, 'self' => 'AddressId', ], diff --git a/Interfaces/GSD/Model/GSDSupplier.php b/Interfaces/GSD/Model/GSDSupplier.php new file mode 100755 index 0000000..1805049 --- /dev/null +++ b/Interfaces/GSD/Model/GSDSupplier.php @@ -0,0 +1,99 @@ +addr = new GSDAddress(); + $this->createdAt = new \DateTime('now'); + } + + public function getNumber() : string + { + return $this->number; + } + + public function getInfo() : string + { + return $this->info; + } + + public function getTaxId() : string + { + return $this->taxid; + } + + public function getBIC() : string + { + return $this->bic; + } + + public function getIban() : string + { + return $this->iban; + } + + public function getAddress() : GSDAddress + { + return $this->addr; + } + + public function getDeliveryStatus() : int + { + return $this->deliveryStatus; + } +} diff --git a/Interfaces/GSD/Model/GSDSupplierMapper.php b/Interfaces/GSD/Model/GSDSupplierMapper.php new file mode 100755 index 0000000..840ceb1 --- /dev/null +++ b/Interfaces/GSD/Model/GSDSupplierMapper.php @@ -0,0 +1,77 @@ + + * @since 1.0.0 + */ + protected static array $columns = [ + 'row_id' => ['name' => 'row_id', 'type' => 'int', 'internal' => 'id'], + 'row_create_time' => ['name' => 'row_create_time', 'type' => 'DateTime', 'internal' => 'createdAt', 'readonly' => true], + 'row_create_user' => ['name' => 'row_create_user', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true], + 'LieferantenNummer' => ['name' => 'LieferantenNummer', 'type' => 'string', 'internal' => 'number'], + 'Info' => ['name' => 'Info', 'type' => 'string', 'internal' => 'info'], + 'Auftragssperre' => ['name' => 'Auftragssperre', 'type' => 'string', 'internal' => 'deliveryStatus'], + 'Steuernummer' => ['name' => 'Steuernummer', 'type' => 'string', 'internal' => 'taxid'], + 'BIC' => ['name' => 'BIC', 'type' => 'string', 'internal' => 'bic'], + 'IBAN' => ['name' => 'IBAN', 'type' => 'string', 'internal' => 'iban'], + ]; + + protected static array $ownsOne = [ + 'addr' => [ + 'mapper' => GSDAddressMapper::class, + 'self' => 'AddressId', + ], + ]; + + /** + * Primary table. + * + * @var string + * @since 1.0.0 + */ + protected static string $table = 'Lieferanten'; + + /** + * Created at. + * + * @var string + * @since 1.0.0 + */ + protected static string $createdAt = 'row_create_time'; + + /** + * Primary field name. + * + * @var string + * @since 1.0.0 + */ + protected static string $primaryField = 'row_id'; +} diff --git a/Interfaces/GSD/Model/Supplier.php b/Interfaces/GSD/Model/Supplier.php deleted file mode 100755 index 31d28a6..0000000 --- a/Interfaces/GSD/Model/Supplier.php +++ /dev/null @@ -1,27 +0,0 @@ -