This commit is contained in:
2026-09-15 10:35:56 +08:00
commit 782f8ea7aa
4086 changed files with 631288 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
<acl>
<resources>
<resource id="Magento_Backend::admin">
<resource id="Esun_LingxingErp::root" title="Lingxing ERP" sortOrder="80">
<resource id="Esun_LingxingErp::stores" title="View Lingxing Stores" sortOrder="5">
<resource id="Esun_LingxingErp::sync_stores" title="Synchronize Lingxing Stores" sortOrder="10"/>
<resource id="Esun_LingxingErp::sync_sku_mappings" title="Synchronize Product ERP SKUs" sortOrder="20"/>
</resource>
<resource id="Esun_LingxingErp::orders" title="View Order Synchronization" sortOrder="10"/>
<resource id="Esun_LingxingErp::warehouses" title="View Lingxing Warehouses" sortOrder="15">
<resource id="Esun_LingxingErp::sync_warehouses" title="Synchronize Lingxing Warehouses" sortOrder="10"/>
<resource id="Esun_LingxingErp::sync_inventory" title="Synchronize Lingxing Inventory" sortOrder="20"/>
</resource>
<resource id="Esun_LingxingErp::shipments" title="View Shipment Synchronization" sortOrder="20"/>
<resource id="Esun_LingxingErp::logs" title="View Synchronization Logs" sortOrder="30"/>
<resource id="Esun_LingxingErp::retry" title="Retry Synchronization" sortOrder="40"/>
<resource id="Esun_LingxingErp::config" title="Configure Lingxing ERP" sortOrder="50"/>
</resource>
</resource>
</resources>
</acl>
</config>
@@ -0,0 +1,8 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\InventoryAdminUi\Ui\DataProvider\SourceDataProvider">
<plugin name="esun_lingxing_source_warehouse_data"
type="Esun\LingxingErp\Plugin\InventoryAdminUi\SourceDataProviderPlugin"/>
</type>
</config>
@@ -0,0 +1,8 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="controller_action_inventory_source_save_after">
<observer name="esun_lingxing_save_source_warehouse_mapping"
instance="Esun\LingxingErp\Observer\SaveSourceWarehouseMapping"/>
</event>
</config>
@@ -0,0 +1,23 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
<menu>
<add id="Esun_LingxingErp::root" title="Lingxing ERP" module="Esun_LingxingErp"
sortOrder="80" parent="Esun_ImageManager::esun" resource="Esun_LingxingErp::root"/>
<add id="Esun_LingxingErp::orders" title="Order Synchronization" module="Esun_LingxingErp"
sortOrder="20" parent="Esun_LingxingErp::root" action="esun_lingxing/order/index"
resource="Esun_LingxingErp::orders"/>
<add id="Esun_LingxingErp::store_list" title="Stores" module="Esun_LingxingErp"
sortOrder="10" parent="Esun_LingxingErp::root" action="esun_lingxing/store/index"
resource="Esun_LingxingErp::stores"/>
<add id="Esun_LingxingErp::shipments" title="Shipment Synchronization" module="Esun_LingxingErp"
sortOrder="30" parent="Esun_LingxingErp::root" action="esun_lingxing/shipment/index"
resource="Esun_LingxingErp::shipments"/>
<add id="Esun_LingxingErp::warehouses" title="Warehouses and Inventory" module="Esun_LingxingErp"
sortOrder="15" parent="Esun_LingxingErp::root" action="esun_lingxing/warehouse/index"
resource="Esun_LingxingErp::warehouses"/>
<add id="Esun_LingxingErp::logs" title="Synchronization Logs" module="Esun_LingxingErp"
sortOrder="40" parent="Esun_LingxingErp::root" action="esun_lingxing/log/index"
resource="Esun_LingxingErp::logs"/>
</menu>
</config>
@@ -0,0 +1,9 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="admin">
<route id="esun_lingxing" frontName="esun_lingxing">
<module name="Esun_LingxingErp" before="Magento_Backend"/>
</route>
</router>
</config>
@@ -0,0 +1,85 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<tab id="esun" translate="label" sortOrder="300"><label>Esun</label></tab>
<section id="esun_lingxing" translate="label" sortOrder="160" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Lingxing ERP</label>
<tab>esun</tab>
<resource>Esun_LingxingErp::config</resource>
<group id="general" translate="label" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Connection and Order Mapping</label>
<field id="enabled" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Enabled</label><source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
<field id="api_base_url" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="0">
<label>API Base URL</label>
</field>
<field id="app_id" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0">
<label>App ID</label>
</field>
<field id="app_secret" translate="label" type="obscure" sortOrder="40" showInDefault="1" showInWebsite="0" showInStore="0">
<label>App Secret</label><backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model>
</field>
<field id="store_mapping" translate="label comment" type="select" sortOrder="50" showInDefault="0" showInWebsite="1" showInStore="0" canRestore="1">
<label>Lingxing Store</label>
<source_model>Esun\LingxingErp\Model\Source\LingxingStore</source_model>
<comment>Read from the locally synchronized store list. The selected option stores both Platform Code and Lingxing Store ID for this Magento Website.</comment>
</field>
<field id="warehouse_id" translate="label comment" type="select" sortOrder="70" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
<label>Default Lingxing Warehouse</label>
<source_model>Esun\LingxingErp\Model\Source\LingxingWarehouse</source_model>
<comment>Read from synchronized warehouses. Leave both warehouse and logistics type blank to let Lingxing route the order.</comment>
</field>
<field id="logistics_type_id" translate="label" type="text" sortOrder="80" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
<label>Default Logistics Type ID</label>
</field>
<field id="eligible_statuses" translate="label comment" type="text" sortOrder="90" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Order Statuses to Export</label><comment>Comma-separated Magento order status codes, for example: processing.</comment>
</field>
</group>
<group id="orders" translate="label" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Order Synchronization</label>
<field id="batch_size" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0"><label>Batch Size</label></field>
<field id="max_attempts" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="0"><label>Maximum Attempts</label></field>
<field id="stock_deduction_type" translate="label comment" type="text" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Stock Deduction Type</label><comment>Lingxing value 1 means no store-specific stock dimension; 2 means SKU plus order store.</comment>
</field>
</group>
<group id="shipments" translate="label" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Shipment Synchronization</label>
<field id="page_size" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0"><label>Pull Page Size</label></field>
<field id="max_pages" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="0"><label>Maximum Pages per Run</label></field>
<field id="max_attempts" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0"><label>Maximum Processing Attempts</label></field>
<field id="notify_customer" translate="label" type="select" sortOrder="40" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Email Shipment to Customer</label><source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
</group>
<group id="sku_sync" translate="label" sortOrder="40" showInDefault="1" showInWebsite="0" showInStore="0">
<label>ERP SKU Synchronization</label>
<field id="enabled" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Daily Synchronization Enabled</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<comment>Runs once per day. Manual synchronization remains available under Esun &gt; Lingxing ERP &gt; Stores.</comment>
</field>
<field id="page_size" translate="label comment" type="text" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Pair List Page Size</label>
<comment>Number of Lingxing SKU pairs requested per API page, from 1 to 200.</comment>
</field>
</group>
<group id="logging" translate="label" sortOrder="50" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Synchronization Log Retention</label>
<field id="success_retention_days" translate="label comment" type="text" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Success Log Retention (Days)</label>
<validate>validate-number validate-greater-than-zero</validate>
<comment>Successful and ignored logs store compact summaries and are deleted after this many days.</comment>
</field>
<field id="error_retention_days" translate="label comment" type="text" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Error Log Retention (Days)</label>
<validate>validate-number validate-greater-than-zero</validate>
<comment>Failed and retrying logs retain sanitized request and response payloads for this many days.</comment>
</field>
</group>
</section>
</system>
</config>
+32
View File
@@ -0,0 +1,32 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<esun_lingxing>
<general>
<enabled>0</enabled>
<api_base_url>https://openapi.lingxing.com</api_base_url>
<eligible_statuses>processing</eligible_statuses>
</general>
<orders>
<batch_size>20</batch_size>
<max_attempts>8</max_attempts>
<stock_deduction_type>1</stock_deduction_type>
</orders>
<shipments>
<page_size>200</page_size>
<max_pages>20</max_pages>
<max_attempts>8</max_attempts>
<notify_customer>0</notify_customer>
</shipments>
<sku_sync>
<enabled>1</enabled>
<page_size>200</page_size>
</sku_sync>
<logging>
<success_retention_days>14</success_retention_days>
<error_retention_days>90</error_retention_days>
</logging>
</esun_lingxing>
</default>
</config>
+24
View File
@@ -0,0 +1,24 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/crontab.xsd">
<group id="default">
<job name="esun_lingxing_process_orders" instance="Esun\LingxingErp\Cron\ProcessOrders" method="execute">
<schedule>* * * * *</schedule>
</job>
<job name="esun_lingxing_pull_shipments" instance="Esun\LingxingErp\Cron\PullShipments" method="execute">
<schedule>*/3 * * * *</schedule>
</job>
<job name="esun_lingxing_process_shipments" instance="Esun\LingxingErp\Cron\ProcessShipments" method="execute">
<schedule>* * * * *</schedule>
</job>
<job name="esun_lingxing_sync_sku_mappings" instance="Esun\LingxingErp\Cron\SyncSkuMappings" method="execute">
<schedule>17 2 * * *</schedule>
</job>
<job name="esun_lingxing_sync_inventory" instance="Esun\LingxingErp\Cron\SyncInventory" method="execute">
<schedule>47 2 * * *</schedule>
</job>
<job name="esun_lingxing_clean_sync_logs" instance="Esun\LingxingErp\Cron\CleanSyncLogs" method="execute">
<schedule>23 3 * * *</schedule>
</job>
</group>
</config>
+132
View File
@@ -0,0 +1,132 @@
<?xml version="1.0"?>
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
<table name="esun_lingxing_store" resource="default" engine="innodb" comment="Lingxing ERP Stores">
<column xsi:type="int" name="entity_id" unsigned="true" nullable="false" identity="true" comment="Entity ID"/>
<column xsi:type="int" name="platform_code" unsigned="true" nullable="false" comment="Lingxing Platform Code"/>
<column xsi:type="varchar" name="platform_name" nullable="false" length="100" default="" comment="Platform Name"/>
<column xsi:type="varchar" name="store_id" nullable="false" length="100" comment="Lingxing Store ID"/>
<column xsi:type="varchar" name="sid" nullable="false" length="100" default="" comment="Lingxing Seller ID"/>
<column xsi:type="varchar" name="store_name" nullable="false" length="255" default="" comment="Lingxing Store Name"/>
<column xsi:type="varchar" name="currency" nullable="false" length="16" default="" comment="Store Currency"/>
<column xsi:type="smallint" name="is_sync" unsigned="true" nullable="false" default="0" comment="Store Sync Enabled"/>
<column xsi:type="smallint" name="status" unsigned="true" nullable="false" default="0" comment="Authorization Status"/>
<column xsi:type="timestamp" name="last_synced_at" nullable="false" on_update="false" comment="Last Synchronized At"/>
<column xsi:type="timestamp" name="created_at" nullable="false" default="CURRENT_TIMESTAMP" on_update="false" comment="Created At"/>
<column xsi:type="timestamp" name="updated_at" nullable="false" default="CURRENT_TIMESTAMP" on_update="true" comment="Updated At"/>
<constraint xsi:type="primary" referenceId="PRIMARY"><column name="entity_id"/></constraint>
<constraint xsi:type="unique" referenceId="ESUN_LINGXING_STORE_STORE_ID"><column name="store_id"/></constraint>
<index referenceId="ESUN_LINGXING_STORE_PLATFORM" indexType="btree"><column name="platform_code"/></index>
<index referenceId="ESUN_LINGXING_STORE_ACTIVE" indexType="btree"><column name="is_sync"/><column name="status"/></index>
</table>
<table name="esun_lingxing_warehouse" resource="default" engine="innodb" comment="Lingxing ERP Warehouses">
<column xsi:type="int" name="entity_id" unsigned="true" nullable="false" identity="true" comment="Entity ID"/>
<column xsi:type="bigint" name="wid" unsigned="true" nullable="false" comment="Lingxing Warehouse ID"/>
<column xsi:type="varchar" name="source_code" nullable="true" length="64" comment="Mapped Magento Inventory Source Code"/>
<column xsi:type="varchar" name="warehouse_name" nullable="false" length="255" comment="Lingxing Warehouse Name"/>
<column xsi:type="smallint" name="warehouse_type" unsigned="true" nullable="false" comment="Lingxing Warehouse Type"/>
<column xsi:type="varchar" name="country_code" nullable="true" length="8" comment="Country Code"/>
<column xsi:type="varchar" name="third_party_code" nullable="true" length="100" comment="Third-party Warehouse Code"/>
<column xsi:type="varchar" name="third_party_name" nullable="true" length="255" comment="Third-party Warehouse Name"/>
<column xsi:type="smallint" name="lingxing_status" unsigned="true" nullable="false" default="1" comment="Lingxing Enabled Status"/>
<column xsi:type="smallint" name="is_deleted" unsigned="true" nullable="false" default="0" comment="Lingxing Deleted Status"/>
<column xsi:type="timestamp" name="last_synced_at" nullable="true" on_update="false" comment="Last Warehouse Synchronization At"/>
<column xsi:type="timestamp" name="last_inventory_synced_at" nullable="true" on_update="false" comment="Last Inventory Synchronization At"/>
<column xsi:type="timestamp" name="created_at" nullable="false" default="CURRENT_TIMESTAMP" on_update="false" comment="Created At"/>
<column xsi:type="timestamp" name="updated_at" nullable="false" default="CURRENT_TIMESTAMP" on_update="true" comment="Updated At"/>
<constraint xsi:type="primary" referenceId="PRIMARY"><column name="entity_id"/></constraint>
<constraint xsi:type="unique" referenceId="ESUN_LINGXING_WAREHOUSE_WID"><column name="wid"/></constraint>
<constraint xsi:type="unique" referenceId="ESUN_LINGXING_WAREHOUSE_SOURCE"><column name="source_code"/></constraint>
<index referenceId="ESUN_LINGXING_WAREHOUSE_STATUS" indexType="btree"><column name="lingxing_status"/><column name="is_deleted"/></index>
</table>
<table name="esun_lingxing_order_sync" resource="default" engine="innodb" comment="Lingxing Order Synchronization">
<column xsi:type="int" name="entity_id" unsigned="true" nullable="false" identity="true" comment="Entity ID"/>
<column xsi:type="int" name="order_id" unsigned="true" nullable="false" comment="Magento Order ID"/>
<column xsi:type="varchar" name="increment_id" nullable="false" length="50" comment="Magento Order Number"/>
<column xsi:type="varchar" name="platform_order_no" nullable="false" length="100" comment="Lingxing Platform Order Number"/>
<column xsi:type="varchar" name="global_order_no" nullable="true" length="100" comment="Lingxing Global Order Number"/>
<column xsi:type="varchar" name="status" nullable="false" length="20" default="pending" comment="Sync Status"/>
<column xsi:type="int" name="attempt_count" unsigned="true" nullable="false" default="0" comment="Attempt Count"/>
<column xsi:type="timestamp" name="next_retry_at" nullable="true" on_update="false" comment="Next Retry At"/>
<column xsi:type="varchar" name="last_error_code" nullable="true" length="64" comment="Last Error Code"/>
<column xsi:type="text" name="last_error_message" nullable="true" comment="Last Error Message"/>
<column xsi:type="varchar" name="request_id" nullable="true" length="128" comment="Lingxing Request ID"/>
<column xsi:type="varchar" name="payload_hash" nullable="true" length="64" comment="Payload SHA256"/>
<column xsi:type="timestamp" name="last_attempt_at" nullable="true" on_update="false" comment="Last Attempt At"/>
<column xsi:type="timestamp" name="synced_at" nullable="true" on_update="false" comment="Synchronized At"/>
<column xsi:type="varchar" name="cancel_status" nullable="true" length="20" comment="Cancellation Sync Status"/>
<column xsi:type="varchar" name="cancel_source" nullable="true" length="24" comment="Magento Cancellation Source"/>
<column xsi:type="int" name="cancel_attempt_count" unsigned="true" nullable="false" default="0" comment="Cancellation Attempt Count"/>
<column xsi:type="timestamp" name="cancel_next_retry_at" nullable="true" on_update="false" comment="Cancellation Next Retry At"/>
<column xsi:type="varchar" name="cancel_error_code" nullable="true" length="64" comment="Cancellation Error Code"/>
<column xsi:type="text" name="cancel_error_message" nullable="true" comment="Cancellation Error Message"/>
<column xsi:type="varchar" name="cancel_request_id" nullable="true" length="128" comment="Cancellation Request ID"/>
<column xsi:type="timestamp" name="cancel_requested_at" nullable="true" on_update="false" comment="Cancellation Requested At"/>
<column xsi:type="timestamp" name="cancel_synced_at" nullable="true" on_update="false" comment="Cancellation Synchronized At"/>
<column xsi:type="timestamp" name="created_at" nullable="false" default="CURRENT_TIMESTAMP" on_update="false" comment="Created At"/>
<column xsi:type="timestamp" name="updated_at" nullable="false" default="CURRENT_TIMESTAMP" on_update="true" comment="Updated At"/>
<constraint xsi:type="primary" referenceId="PRIMARY"><column name="entity_id"/></constraint>
<constraint xsi:type="unique" referenceId="ESUN_LINGXING_ORDER_SYNC_ORDER_ID"><column name="order_id"/></constraint>
<constraint xsi:type="unique" referenceId="ESUN_LINGXING_ORDER_SYNC_PLATFORM_NO"><column name="platform_order_no"/></constraint>
<index referenceId="ESUN_LINGXING_ORDER_SYNC_GLOBAL_NO" indexType="btree"><column name="global_order_no"/></index>
<index referenceId="ESUN_LINGXING_ORDER_SYNC_STATUS_RETRY" indexType="btree"><column name="status"/><column name="next_retry_at"/></index>
<index referenceId="ESUN_LINGXING_ORDER_CANCEL_STATUS_RETRY" indexType="btree"><column name="cancel_status"/><column name="cancel_next_retry_at"/></index>
</table>
<table name="esun_lingxing_shipment_sync" resource="default" engine="innodb" comment="Lingxing Shipment Synchronization">
<column xsi:type="int" name="entity_id" unsigned="true" nullable="false" identity="true" comment="Entity ID"/>
<column xsi:type="varchar" name="external_key" nullable="false" length="191" comment="Idempotency Key"/>
<column xsi:type="int" name="order_id" unsigned="true" nullable="true" comment="Magento Order ID"/>
<column xsi:type="varchar" name="increment_id" nullable="true" length="50" comment="Magento Order Number"/>
<column xsi:type="varchar" name="global_order_no" nullable="true" length="100" comment="Lingxing Global Order Number"/>
<column xsi:type="bigint" name="wo_id" unsigned="true" nullable="true" comment="Lingxing Outbound ID"/>
<column xsi:type="varchar" name="wo_number" nullable="false" length="100" comment="Lingxing Outbound Number"/>
<column xsi:type="varchar" name="package_no" nullable="true" length="100" comment="Lingxing Package Number"/>
<column xsi:type="varchar" name="tracking_no" nullable="true" length="255" comment="Tracking Numbers"/>
<column xsi:type="int" name="shipment_id" unsigned="true" nullable="true" comment="Magento Shipment ID"/>
<column xsi:type="varchar" name="status" nullable="false" length="20" default="pending" comment="Sync Status"/>
<column xsi:type="int" name="attempt_count" unsigned="true" nullable="false" default="0" comment="Attempt Count"/>
<column xsi:type="timestamp" name="next_retry_at" nullable="true" on_update="false" comment="Next Retry At"/>
<column xsi:type="varchar" name="last_error_code" nullable="true" length="64" comment="Last Error Code"/>
<column xsi:type="text" name="last_error_message" nullable="true" comment="Last Error Message"/>
<column xsi:type="varchar" name="request_id" nullable="true" length="128" comment="Lingxing Request ID"/>
<column xsi:type="mediumtext" name="payload_json" nullable="false" comment="Normalized Fulfillment Payload"/>
<column xsi:type="timestamp" name="last_attempt_at" nullable="true" on_update="false" comment="Last Attempt At"/>
<column xsi:type="timestamp" name="synced_at" nullable="true" on_update="false" comment="Synchronized At"/>
<column xsi:type="timestamp" name="created_at" nullable="false" default="CURRENT_TIMESTAMP" on_update="false" comment="Created At"/>
<column xsi:type="timestamp" name="updated_at" nullable="false" default="CURRENT_TIMESTAMP" on_update="true" comment="Updated At"/>
<constraint xsi:type="primary" referenceId="PRIMARY"><column name="entity_id"/></constraint>
<constraint xsi:type="unique" referenceId="ESUN_LINGXING_SHIPMENT_EXTERNAL_KEY"><column name="external_key"/></constraint>
<index referenceId="ESUN_LINGXING_SHIPMENT_WO_NUMBER" indexType="btree"><column name="wo_number"/></index>
<index referenceId="ESUN_LINGXING_SHIPMENT_ORDER_ID" indexType="btree"><column name="order_id"/></index>
<index referenceId="ESUN_LINGXING_SHIPMENT_STATUS_RETRY" indexType="btree"><column name="status"/><column name="next_retry_at"/></index>
</table>
<table name="esun_lingxing_sync_log" resource="default" engine="innodb" comment="Lingxing Synchronization Attempts">
<column xsi:type="bigint" name="entity_id" unsigned="true" nullable="false" identity="true" comment="Entity ID"/>
<column xsi:type="varchar" name="direction" nullable="false" length="10" comment="Push or Pull"/>
<column xsi:type="varchar" name="operation" nullable="false" length="40" comment="Operation"/>
<column xsi:type="varchar" name="api_path" nullable="true" length="255" comment="Lingxing API Endpoint"/>
<column xsi:type="varchar" name="entity_type" nullable="false" length="20" comment="Entity Type"/>
<column xsi:type="int" name="local_entity_id" unsigned="true" nullable="true" comment="Local Sync Entity ID"/>
<column xsi:type="varchar" name="increment_id" nullable="true" length="50" comment="Magento Order Number"/>
<column xsi:type="varchar" name="external_id" nullable="true" length="191" comment="Lingxing External ID"/>
<column xsi:type="varchar" name="status" nullable="false" length="20" comment="Attempt Status"/>
<column xsi:type="int" name="attempt_number" unsigned="true" nullable="false" default="1" comment="Attempt Number"/>
<column xsi:type="varchar" name="error_code" nullable="true" length="64" comment="Error Code"/>
<column xsi:type="text" name="error_message" nullable="true" comment="Error Message"/>
<column xsi:type="varchar" name="request_id" nullable="true" length="128" comment="Lingxing Request ID"/>
<column xsi:type="mediumtext" name="request_payload" nullable="true" comment="Sanitized Request Payload"/>
<column xsi:type="mediumtext" name="response_payload" nullable="true" comment="Sanitized Response Payload"/>
<column xsi:type="int" name="duration_ms" unsigned="true" nullable="true" comment="Duration Milliseconds"/>
<column xsi:type="timestamp" name="created_at" nullable="false" default="CURRENT_TIMESTAMP" on_update="false" comment="Created At"/>
<constraint xsi:type="primary" referenceId="PRIMARY"><column name="entity_id"/></constraint>
<index referenceId="ESUN_LINGXING_LOG_STATUS_CREATED" indexType="btree"><column name="status"/><column name="created_at"/></index>
<index referenceId="ESUN_LINGXING_LOG_API_PATH" indexType="btree"><column name="api_path"/></index>
<index referenceId="ESUN_LINGXING_LOG_ORDER" indexType="btree"><column name="increment_id"/></index>
<index referenceId="ESUN_LINGXING_LOG_EXTERNAL" indexType="btree"><column name="external_id"/></index>
<index referenceId="ESUN_LINGXING_LOG_REQUEST_ID" indexType="btree"><column name="request_id"/></index>
</table>
</schema>
+37
View File
@@ -0,0 +1,37 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Config\Model\Config\TypePool">
<arguments>
<argument name="sensitive" xsi:type="array">
<item name="esun_lingxing/general/app_secret" xsi:type="string">1</item>
</argument>
</arguments>
</type>
<type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
<arguments>
<argument name="collections" xsi:type="array">
<item name="esun_lingxing_order_listing_data_source" xsi:type="string">EsunLingxingOrderGridCollection</item>
<item name="esun_lingxing_store_listing_data_source" xsi:type="string">EsunLingxingStoreGridCollection</item>
<item name="esun_lingxing_shipment_listing_data_source" xsi:type="string">EsunLingxingShipmentGridCollection</item>
<item name="esun_lingxing_log_listing_data_source" xsi:type="string">EsunLingxingLogGridCollection</item>
<item name="esun_lingxing_warehouse_listing_data_source" xsi:type="string">EsunLingxingWarehouseGridCollection</item>
</argument>
</arguments>
</type>
<virtualType name="EsunLingxingOrderGridCollection" type="Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult">
<arguments><argument name="mainTable" xsi:type="string">esun_lingxing_order_sync</argument></arguments>
</virtualType>
<virtualType name="EsunLingxingStoreGridCollection" type="Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult">
<arguments><argument name="mainTable" xsi:type="string">esun_lingxing_store</argument></arguments>
</virtualType>
<virtualType name="EsunLingxingShipmentGridCollection" type="Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult">
<arguments><argument name="mainTable" xsi:type="string">esun_lingxing_shipment_sync</argument></arguments>
</virtualType>
<virtualType name="EsunLingxingLogGridCollection" type="Esun\LingxingErp\Model\ResourceModel\Log\Grid\Collection">
<arguments><argument name="mainTable" xsi:type="string">esun_lingxing_sync_log</argument></arguments>
</virtualType>
<virtualType name="EsunLingxingWarehouseGridCollection" type="Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult">
<arguments><argument name="mainTable" xsi:type="string">esun_lingxing_warehouse</argument></arguments>
</virtualType>
</config>
+10
View File
@@ -0,0 +1,10 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="sales_order_save_commit_after">
<observer name="esun_lingxing_enqueue_order" instance="Esun\LingxingErp\Observer\EnqueueOrder"/>
</event>
<event name="order_cancel_after">
<observer name="esun_lingxing_record_order_cancellation" instance="Esun\LingxingErp\Observer\RecordOrderCancellation"/>
</event>
</config>
+19
View File
@@ -0,0 +1,19 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Esun_LingxingErp">
<sequence>
<module name="Magento_Catalog"/>
<module name="Magento_Sales"/>
<module name="Magento_Store"/>
<module name="Magento_Ui"/>
<module name="Magento_Config"/>
<module name="Magento_Inventory"/>
<module name="Magento_InventoryApi"/>
<module name="Magento_InventoryAdminUi"/>
<module name="Magento_InventorySales"/>
<module name="Magento_InventoryShipping"/>
<module name="Esun_ImageManager"/>
</sequence>
</module>
</config>