Phase 2 implementation: VFP Integration with Oracle synchronization

Major architectural changes:
- Convert Oracle IMPORT_PARTENERI.cauta_sau_creeaza_partener from FUNCTION to PROCEDURE with OUT parameter for VFP compatibility
- Add IS_PERSOANA_JURIDICA parameter to support individual vs company detection
- Implement sync-comenzi-web.prg orchestrator for generic web order processing with 5-minute timer automation
- Create ApplicationSetup class for proper object-oriented configuration management
- Add comprehensive Oracle connection and sync settings via settings.ini configuration system
- Implement generic web order processing functions (ProcessWebOrder, ValidateWebOrder, CleanWebText, ConvertWebDate)
- Add proper VFP-Oracle integration with correct procedure call syntax using OUT parameters
- Rename gomag-vending.prg to gomag-adapter.prg for clarity and platform-specific functionality
- Move CheckIniFile function to utils.prg for better code organization
- Add settings.ini.example template and update .gitignore to exclude actual settings files
- Implement comprehensive logging system with rotation and error handling
- Add connection validation and retry logic for robust Oracle integration

Technical improvements:
- Proper JSON processing integration with existing nfjson library
- Comprehensive error handling with categorized logging (INFO, ERROR, WARN)
- Timer-based automation with configurable intervals
- Settings validation and default value creation
- Generic function naming for multi-platform support
- Class-based setup system replacing procedural approach

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-09-10 16:01:42 +03:00
parent 86e9d32b76
commit d1858f86b6
10 changed files with 962 additions and 125 deletions

60
vfp/settings.ini.example Normal file
View File

@@ -0,0 +1,60 @@
[API]
ApiBaseUrl=https://api.gomag.ro/api/v1/product/read/json?enabled=1
OrderApiUrl=https://api.gomag.ro/api/v1/order/read/json
ApiKey=YOUR_API_KEY_HERE
ApiShop=https://yourstore.gomag.ro
UserAgent=Mozilla/5.0
ContentType=application/json
[PAGINATION]
Limit=100
[OPTIONS]
GetProducts=1
GetOrders=1
[FILTERS]
OrderDaysBack=7
[ORACLE]
OracleUser=MARIUSM_AUTO
OraclePassword=ROMFASTSOFT
OracleDSN=ROA_CENTRAL
[SYNC]
AdapterProgram=gomag-adapter.prg
JsonFilePattern=gomag_orders*.json
AutoRunAdapter=1
# ===============================================
# CONFIGURATIE SYNC COMENZI WEB → ORACLE ROA
# ===============================================
#
# [API] - Configurari pentru GoMag API
# - ApiKey: Cheia API de la GoMag (OBLIGATORIU)
# - ApiShop: URL-ul magazinului GoMag (OBLIGATORIU)
#
# [OPTIONS]
# - GetProducts: 1=descarca produse, 0=skip
# - GetOrders: 1=descarca comenzi, 0=skip
#
# [ORACLE] - Conexiune la database ROA
# - OracleUser: Utilizatorul Oracle (OBLIGATORIU)
# - OraclePassword: Parola Oracle (OBLIGATORIU)
# - OracleDSN: Data Source Name (OBLIGATORIU)
#
# [SYNC] - Configurari sincronizare
# - AdapterProgram: Numele programului adapter (ex: gomag-adapter.prg)
# - JsonFilePattern: Pattern pentru fisiere JSON (ex: gomag_orders*.json)
# - AutoRunAdapter: 1=ruleaza automat adapter, 0=foloseste doar JSON existent
#
# Pentru utilizare:
# 1. Copiaza settings.ini.example → settings.ini
# 2. Configureaza ApiKey si ApiShop pentru GoMag
# 3. Verifica datele Oracle (default: schema MARIUSM_AUTO)
# 4. Ruleaza sync-comenzi-web.prg
#
# Pentru scheduled task Windows:
# - Creeaza task care ruleaza sync-comenzi-web.prg la interval
# - Nu mai este nevoie de auto-sync-timer.prg
# - sync-comenzi-web.prg va apela automat gomag-adapter.prg