PHP Classes

D3 EDI: Process information exchanged electronically

Recommend this page to a friend!
  Info   Documentation   Screenshots   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 54 All time: 10,612 This week: 455Up
Version License PHP version Categories
d3edi 1.0.0Freeware7.2PHP 5, Databases, Content management
Description 

Author

This package can process information exchanged electronically.

It can perform operations to process messages to store and retrieve documents in a database.

Applications can extend base model classes to implement custom document support details for processing.

This package allows the creation and editing of customs documents using Web pages generated by the package.

The package can display documents on a Web page like widgets.

Innovation Award
PHP Programming Innovation award nominee
November 2021
Number 6
Electronic Data Exchange (EDI) is an activity that is essential to businesses that need to become more efficient by automating processes that companies need to execute.

Many businesses run applications that need to exchange documents produced by their users.

Each type of document has different characteristics and holds various types of information.

This package provides a solution that facilitates the processing of documents exchanged by applications.

It allows creating adapter components that can customize the processing of the types of documents that applications exchange.

Manuel Lemos
Picture of Uldis Nelsons
Name: Uldis Nelsons <contact>
Classes: 19 packages by
Country: Latvia Latvia
Age: 55
All time rank: 19476 in Latvia Latvia
Week rank: 164 Up1 in Latvia Latvia Up
Innovation award
Innovation award
Nominee: 12x

Winner: 2x

Documentation

[EDIFACT messaging[(https://en.wikipedia.org/wiki/EDIFACT)

Features

- Collect EDI messages in DB - Other processes process collected messages and registries * status processed and ref records * status error and error message

used packages

DB Schema

DB Schema

Installation

The preferred way to install this extension is through composer.

Either run

$ composer require d3yii2/d3edi "*"

or add

"d3yii2/d3edi": "*"

to the require section of your composer.json file.

Methods

Usage

map edi fata to model attributes



class DepoEdiBooking extends BaseDepoEdiBooking
{
    public function loadEdi($ediMessage): void
    {
        $r = $ediMessage->readEdiMessage();
        $this->booking_ref_number = $r->readEdiDataValue(['RFF',['1'=>'BN']],1,0);
        $this->carier = $r->readEdiDataValue(['NAD',['1'=>'CA']],2,0);
        $this->containerType = $r->readEdiDataValue(['EQD',['1'=>'CN']],3,0);
        if(!$this->cont_type_id = CargoContTypeDictionary::getIdByEdiCode($containerType)){
            $this->cont_type_id = null;
            $this->addError('cont_type_id','Undefined container type: ' . $containerType);
        }
    }
}


procesing

        $cnt = 0;
        foreach(EdiMessage::find()->allNews() as $ediMessage){
            if(!$transaction = $this->module->db->begintransaction()){
                throw new \yii\db\Exception('can not start Begin transaction');
            }
            try {
                $ediBooking = new DepoEdiBooking();
                $ediBooking->loadEdi($ediMessage);
                if ($ediBooking->hasErrors() || !$ediBooking->validate()) {
                    $ediMessage->saveError($ediBooking->getErrors());
                    continue;
                }
                if (!$ediBooking->save()) {
                    throw new D3ActiveRecordException($ediBooking);
                }

                $ediMessage->saveProcessed($ediBooking);

                $transaction->commit();
                $cnt ++;
                continue;
            }catch (Exception $e){
                $transaction->rollBack();
                Yii::error($e->getMessage());
                Yii::error($e->getTraceAsString());
                $ediMessage->saveError($e->getMessage());
            }
        }

        return $cnt;

    }

Panle for unprocessed messages

For showing unprocessed messages can use panel solution Yii2Panel

add widget

echo \unyii2\yii2panel\PanelWidget::widget([
    'name' => 'MyAllerts',
]);

to module add parameter panels

class MyModule extends Module
{
    
    /
     * @var array panels for PanelWidgets
     */
    public $panels;

in module config add widget

        'mymodule' => [
            'class' => 'MyModule',
            'panels' => [
                'MyAllerts' =>
                [
                    [
                        'route' => 'edi/panel/message',
                     ]
                 ]
            ],
        ],

in EDI module can set role for access to panel. Otherwise every authorised user has access to panle widget

        'edi' => [
            'class' => 'd3yii2\d3edi\Module',
            'accessRulesMessageRoles' => ['Depo3EdiFull']
        ],

Screenshots (1)  
  • ContainerBookingList
  Files folder image Files (36)  
File Role Description
Files folder imagecomponents (1 file)
Files folder imagecontrollers (3 files)
Files folder imagedictionaries (2 files)
Files folder imagedoc (2 files)
Files folder imagegii (5 files)
Files folder imagelogic (1 file)
Files folder imagemessages (1 directory)
Files folder imagemigrations (3 files)
Files folder imagemodels (8 files, 1 directory)
Files folder imageviews (1 directory)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LeftMenu.php Aux. Auxiliary script
Plain text file Module.php Class Class source
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files (36)  /  components  
File Role Description
  Plain text file MessageProcessing.php Class Class source

  Files folder image Files (36)  /  controllers  
File Role Description
  Plain text file PanelController.php Class Class source
  Plain text file ProcessIncomingEdiController.php Class Class source
  Plain text file TestController.php Class Class source

  Files folder image Files (36)  /  dictionaries  
File Role Description
  Plain text file EdiCompanyDictionary.php Class Class source
  Plain text file EdiMessageTypeDictionary.php Class Class source

  Files folder image Files (36)  /  doc  
File Role Description
  Accessible without login Image file DbSchema.png Data Auxiliary data
  Accessible without login Plain text file DbSchema.schemaxml Data Auxiliary data

  Files folder image Files (36)  /  gii  
File Role Description
  Accessible without login Plain text file ediGiiantNModule.json Data Auxiliary data
  Accessible without login Plain text file edi_companyGiiantModel.json Data Auxiliary data
  Accessible without login Plain text file edi_messageGiiantModel.json Data Auxiliary data
  Accessible without login Plain text file edi_message_refGiiantModel.json Data Auxiliary data
  Accessible without login Plain text file edi_message_typeGiiantModel.json Data Auxiliary data

  Files folder image Files (36)  /  logic  
File Role Description
  Plain text file MessageLogic.php Class Class source

  Files folder image Files (36)  /  messages  
File Role Description
Files folder imagelv (1 file)

  Files folder image Files (36)  /  messages  /  lv  
File Role Description
  Accessible without login Plain text file depoedi.php Aux. Auxiliary script

  Files folder image Files (36)  /  migrations  
File Role Description
  Plain text file m200814_220707_init.php Class Class source
  Plain text file m201130_200707_messages_add_filename.php Class Class source
  Plain text file m210404_080707_message_add_compnent.php Class Class source

  Files folder image Files (36)  /  models  
File Role Description
Files folder imagebase (4 files)
  Plain text file EdiCompany.php Class Class source
  Plain text file EdiMessage.php Class Class source
  Plain text file EdiMessageQuery.php Class Class source
  Plain text file EdiMessageRef.php Class Class source
  Plain text file EdiMessageRefQuery.php Class Class source
  Plain text file EdiMessageType.php Class Class source
  Plain text file EdiMessageTypeQuery.php Class Class source
  Plain text file SysModels.php Class Class source

  Files folder image Files (36)  /  models  /  base  
File Role Description
  Plain text file EdiCompany.php Class Class source
  Plain text file EdiMessage.php Class Class source
  Plain text file EdiMessageRef.php Class Class source
  Plain text file EdiMessageType.php Class Class source

  Files folder image Files (36)  /  views  
File Role Description
Files folder imagepanel (1 file)

  Files folder image Files (36)  /  views  /  panel  
File Role Description
  Accessible without login Plain text file message.php Aux. Auxiliary script

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 97%
Total:54
This week:0
All time:10,612
This week:455Up