Add configurable ROA settings (IdPol, IdGestiune, IdSectie) to VFP integration
Implement global configuration for ROA system IDs via settings.ini: VFP Changes: - Add [ROA] section to settings.ini with IdPol, IdGestiune, IdSectie - Update ApplicationSetup.LoadSettings to read ROA configuration - Update ApplicationSetup.CreateDefaultIni with default values (0, 1, 2) - Modify sync-comenzi-web.prg to pass ROA settings to Oracle package Oracle Package Changes (06_pack_import_comenzi.pck): - Add optional parameters to importa_comanda signature with defaults * p_id_pol (default: 0) * p_id_gestiune (default: 1) * p_id_sectie (default: 2) - Remove hardcoded constants (c_id_pol, c_id_sectie, c_id_gestiune) - Update PACK_COMENZI.adauga_comanda call to use p_id_sectie parameter - Update PACK_COMENZI.adauga_articol_comanda to use p_id_pol and p_id_sectie Benefits: - Flexible configuration without code changes - Maintains backward compatibility with default values - Centralized ROA system configuration 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -30,6 +30,9 @@ CREATE OR REPLACE PACKAGE PACK_IMPORT_COMENZI AS
|
|||||||
p_json_articole IN CLOB,
|
p_json_articole IN CLOB,
|
||||||
p_id_adresa_livrare IN NUMBER DEFAULT NULL,
|
p_id_adresa_livrare IN NUMBER DEFAULT NULL,
|
||||||
p_id_adresa_facturare IN NUMBER DEFAULT NULL,
|
p_id_adresa_facturare IN NUMBER DEFAULT NULL,
|
||||||
|
p_id_pol IN NUMBER DEFAULT 0,
|
||||||
|
p_id_gestiune IN NUMBER DEFAULT 1,
|
||||||
|
p_id_sectie IN NUMBER DEFAULT 2,
|
||||||
v_id_comanda OUT NUMBER);
|
v_id_comanda OUT NUMBER);
|
||||||
|
|
||||||
-- Functii pentru managementul erorilor (similar cu PACK_JSON)
|
-- Functii pentru managementul erorilor (similar cu PACK_JSON)
|
||||||
@@ -41,9 +44,7 @@ END PACK_IMPORT_COMENZI;
|
|||||||
CREATE OR REPLACE PACKAGE BODY PACK_IMPORT_COMENZI AS
|
CREATE OR REPLACE PACKAGE BODY PACK_IMPORT_COMENZI AS
|
||||||
|
|
||||||
-- Constante pentru configurare
|
-- Constante pentru configurare
|
||||||
-- c_id_gestiune CONSTANT NUMBER := NULL; -- NULL pentru INTERNA=2 (comenzi client)
|
-- Nota: c_id_pol, c_id_gestiune, c_id_sectie sunt acum parametri ai procedurii importa_comanda
|
||||||
c_id_sectie CONSTANT NUMBER := NULL; -- Prima sectie disponibila
|
|
||||||
c_id_pol CONSTANT NUMBER := NULL;
|
|
||||||
c_id_util CONSTANT NUMBER := -3; -- Sistem
|
c_id_util CONSTANT NUMBER := -3; -- Sistem
|
||||||
c_interna CONSTANT NUMBER := 2; -- Comenzi de la client (web)
|
c_interna CONSTANT NUMBER := 2; -- Comenzi de la client (web)
|
||||||
|
|
||||||
@@ -217,6 +218,9 @@ CREATE OR REPLACE PACKAGE BODY PACK_IMPORT_COMENZI AS
|
|||||||
p_json_articole IN CLOB,
|
p_json_articole IN CLOB,
|
||||||
p_id_adresa_livrare IN NUMBER DEFAULT NULL,
|
p_id_adresa_livrare IN NUMBER DEFAULT NULL,
|
||||||
p_id_adresa_facturare IN NUMBER DEFAULT NULL,
|
p_id_adresa_facturare IN NUMBER DEFAULT NULL,
|
||||||
|
p_id_pol IN NUMBER DEFAULT 0,
|
||||||
|
p_id_gestiune IN NUMBER DEFAULT 1,
|
||||||
|
p_id_sectie IN NUMBER DEFAULT 2,
|
||||||
v_id_comanda OUT NUMBER) IS
|
v_id_comanda OUT NUMBER) IS
|
||||||
v_data_livrare DATE;
|
v_data_livrare DATE;
|
||||||
v_sku VARCHAR2(100);
|
v_sku VARCHAR2(100);
|
||||||
@@ -277,7 +281,7 @@ CREATE OR REPLACE PACKAGE BODY PACK_IMPORT_COMENZI AS
|
|||||||
V_PROC_DISCOUNT => 0, -- Fara discount implicit
|
V_PROC_DISCOUNT => 0, -- Fara discount implicit
|
||||||
V_INTERNA => c_interna,
|
V_INTERNA => c_interna,
|
||||||
V_ID_UTIL => c_id_util,
|
V_ID_UTIL => c_id_util,
|
||||||
V_ID_SECTIE => c_id_sectie,
|
V_ID_SECTIE => p_id_sectie,
|
||||||
V_ID_ADRESA_FACTURARE => p_id_adresa_facturare,
|
V_ID_ADRESA_FACTURARE => p_id_adresa_facturare,
|
||||||
V_ID_ADRESA_LIVRARE => p_id_adresa_livrare,
|
V_ID_ADRESA_LIVRARE => p_id_adresa_livrare,
|
||||||
V_ID_CODCLIENT => NULL, -- Nu folosim cod client
|
V_ID_CODCLIENT => NULL, -- Nu folosim cod client
|
||||||
@@ -333,11 +337,11 @@ CREATE OR REPLACE PACKAGE BODY PACK_IMPORT_COMENZI AS
|
|||||||
BEGIN
|
BEGIN
|
||||||
PACK_COMENZI.adauga_articol_comanda(V_ID_COMANDA => v_id_comanda,
|
PACK_COMENZI.adauga_articol_comanda(V_ID_COMANDA => v_id_comanda,
|
||||||
V_ID_ARTICOL => art_rec.id_articol,
|
V_ID_ARTICOL => art_rec.id_articol,
|
||||||
V_ID_POL => c_id_pol,
|
V_ID_POL => p_id_pol,
|
||||||
V_CANTITATE => art_rec.cantitate_roa,
|
V_CANTITATE => art_rec.cantitate_roa,
|
||||||
V_PRET => art_rec.pret_unitar,
|
V_PRET => art_rec.pret_unitar,
|
||||||
V_ID_UTIL => c_id_util,
|
V_ID_UTIL => c_id_util,
|
||||||
V_ID_SECTIE => c_id_sectie,
|
V_ID_SECTIE => p_id_sectie,
|
||||||
V_PTVA => art_rec.ptva);
|
V_PTVA => art_rec.ptva);
|
||||||
|
|
||||||
v_articole_procesate := v_articole_procesate + 1;
|
v_articole_procesate := v_articole_procesate + 1;
|
||||||
|
|||||||
@@ -64,6 +64,11 @@ DEFINE CLASS ApplicationSetup AS Custom
|
|||||||
ADDPROPERTY(loSettings, "JsonFilePattern", ReadPini("SYNC", "JsonFilePattern", tcIniFile))
|
ADDPROPERTY(loSettings, "JsonFilePattern", ReadPini("SYNC", "JsonFilePattern", tcIniFile))
|
||||||
ADDPROPERTY(loSettings, "AutoRunAdapter", ReadPini("SYNC", "AutoRunAdapter", tcIniFile) = "1")
|
ADDPROPERTY(loSettings, "AutoRunAdapter", ReadPini("SYNC", "AutoRunAdapter", tcIniFile) = "1")
|
||||||
|
|
||||||
|
*-- Sectiunea ROA - pentru configurarea sistemului ROA
|
||||||
|
ADDPROPERTY(loSettings, "IdPol", VAL(ReadPini("ROA", "IdPol", tcIniFile)))
|
||||||
|
ADDPROPERTY(loSettings, "IdGestiune", VAL(ReadPini("ROA", "IdGestiune", tcIniFile)))
|
||||||
|
ADDPROPERTY(loSettings, "IdSectie", VAL(ReadPini("ROA", "IdSectie", tcIniFile)))
|
||||||
|
|
||||||
*-- Salvare in proprietatea clasei
|
*-- Salvare in proprietatea clasei
|
||||||
THIS.oSettings = loSettings
|
THIS.oSettings = loSettings
|
||||||
|
|
||||||
@@ -110,6 +115,11 @@ DEFINE CLASS ApplicationSetup AS Custom
|
|||||||
WritePini("SYNC", "JsonFilePattern", "gomag_orders*.json", tcIniFile)
|
WritePini("SYNC", "JsonFilePattern", "gomag_orders*.json", tcIniFile)
|
||||||
WritePini("SYNC", "AutoRunAdapter", "1", tcIniFile)
|
WritePini("SYNC", "AutoRunAdapter", "1", tcIniFile)
|
||||||
|
|
||||||
|
*-- Sectiunea ROA - configurare sistem ROA
|
||||||
|
WritePini("ROA", "IdPol", "0", tcIniFile)
|
||||||
|
WritePini("ROA", "IdGestiune", "1", tcIniFile)
|
||||||
|
WritePini("ROA", "IdSectie", "2", tcIniFile)
|
||||||
|
|
||||||
CATCH
|
CATCH
|
||||||
llSuccess = .F.
|
llSuccess = .F.
|
||||||
ENDTRY
|
ENDTRY
|
||||||
|
|||||||
@@ -283,7 +283,7 @@ Function ProcessWebOrder
|
|||||||
|
|
||||||
*-- Apel package Oracle pentru import comanda
|
*-- Apel package Oracle pentru import comanda
|
||||||
If m.llSucces
|
If m.llSucces
|
||||||
lcSQL = "BEGIN PACK_IMPORT_COMENZI.importa_comanda(?lcOrderNumber, ?ldOrderDate, ?lnPartnerID, ?lcArticlesJSON, ?lnIdAdresaLivrare, ?lnIdAdresaFacturare, ?@lnIdComanda); END;"
|
lcSQL = "BEGIN PACK_IMPORT_COMENZI.importa_comanda(?lcOrderNumber, ?ldOrderDate, ?lnPartnerID, ?lcArticlesJSON, ?lnIdAdresaLivrare, ?lnIdAdresaFacturare, ?goSettings.IdPol, ?goSettings.IdGestiune, ?goSettings.IdSectie, ?@lnIdComanda); END;"
|
||||||
lnResult = SQLExec(goConnectie, lcSQL)
|
lnResult = SQLExec(goConnectie, lcSQL)
|
||||||
|
|
||||||
If lnResult > 0 And Nvl(m.lnIdComanda,0) > 0
|
If lnResult > 0 And Nvl(m.lnIdComanda,0) > 0
|
||||||
|
|||||||
Reference in New Issue
Block a user