Recommend this page to a friend! |
Download .zip |
Info | Documentation | Screenshots | View files (35) | Download .zip | Reputation | Support forum | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2021-11-18 (9 days ago) | Not yet rated by the users | Total: 20 This week: 6 | All time: 10,435 This week: 78 |
Version | License | PHP version | Categories | |||
d3edi 1.0 | Freeware | 7.2 | PHP 5, Databases, Content management |
Description | Author | ||||||||||||||
This package can process information exchanged electronically. |
|
- Collect EDI messages in DB - Other processes process collected messages and registries * status processed and ref records * status error and error message
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.
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);
}
}
}
$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;
}
For showing unprocessed messages can use panel solution Yii2Panel
echo \unyii2\yii2panel\PanelWidget::widget([
'name' => 'MyAllerts',
]);
class MyModule extends Module
{
/
* @var array panels for PanelWidgets
*/
public $panels;
'mymodule' => [
'class' => 'MyModule',
'panels' => [
'MyAllerts' =>
[
[
'route' => 'edi/panel/message',
]
]
],
],
'edi' => [
'class' => 'd3yii2\d3edi\Module',
'accessRulesMessageRoles' => ['Depo3EdiFull']
],
Screenshots | ||
Files |
File | Role | Description | ||
---|---|---|---|---|
components (1 file) | ||||
controllers (3 files) | ||||
dictionaries (2 files) | ||||
doc (2 files) | ||||
gii (5 files) | ||||
logic (1 file) | ||||
messages (1 directory) | ||||
migrations (3 files) | ||||
models (8 files, 1 directory) | ||||
views (1 directory) | ||||
composer.json | Data | Auxiliary data | ||
LeftMenu.php | Aux. | Auxiliary script | ||
Module.php | Class | Class source | ||
README.md | Doc. | Documentation |
Files | / | controllers |
File | Role | Description |
---|---|---|
PanelController.php | Class | Class source |
ProcessIncomingEdiController.php | Class | Class source |
TestController.php | Class | Class source |
Files | / | dictionaries |
File | Role | Description |
---|---|---|
EdiCompanyDictionary.php | Class | Class source |
EdiMessageTypeDictionary.php | Class | Class source |
Files | / | doc |
File | Role | Description |
---|---|---|
DbSchema.png | Data | Auxiliary data |
DbSchema.schemaxml | Data | Auxiliary data |
Files | / | gii |
File | Role | Description |
---|---|---|
ediGiiantNModule.json | Data | Auxiliary data |
edi_companyGiiantModel.json | Data | Auxiliary data |
edi_messageGiiantModel.json | Data | Auxiliary data |
edi_message_refGiiantModel.json | Data | Auxiliary data |
edi_message_typeGiiantModel.json | Data | Auxiliary data |
Files | / | migrations |
File | Role | Description |
---|---|---|
m200814_220707_init.php | Class | Class source |
m201130_200707_messages_add_filename.php | Class | Class source |
m210404_080707_message_add_compnent.php | Class | Class source |
Files | / | models |
File | Role | Description | ||
---|---|---|---|---|
base (4 files) | ||||
EdiCompany.php | Class | Class source | ||
EdiMessage.php | Class | Class source | ||
EdiMessageQuery.php | Class | Class source | ||
EdiMessageRef.php | Class | Class source | ||
EdiMessageRefQuery.php | Class | Class source | ||
EdiMessageType.php | Class | Class source | ||
EdiMessageTypeQuery.php | Class | Class source | ||
SysModels.php | Class | Class source |
Files | / | models | / | base |
File | Role | Description |
---|---|---|
EdiCompany.php | Class | Class source |
EdiMessage.php | Class | Class source |
EdiMessageRef.php | Class | Class source |
EdiMessageType.php | Class | Class source |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
97% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.