From b201e67291ead0ddd9f5d8e6e29133ea2ad48fbf Mon Sep 17 00:00:00 2001 From: Marcos Reifonas Date: Wed, 2 Sep 2026 14:15:55 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20convers=C3=A3o=20de=20tipo=20no=20Postgr?= =?UTF-8?q?eSQL=20e=20corre=C3=A7=C3=A3o=20de=20erro=20400=20Bad=20Request?= =?UTF-8?q?=20ao=20importar=20pe=C3=A7as=20em=20lote=20via=20XLS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fix_sync_of_data.sql | 19 +++++++++++ src/pages/CadastroOF.tsx | 2 +- ...500_fix_ficha_of_trigger_and_peso_type.sql | 23 +++++++++++++ test_float.cjs | 32 +++++++++++++++++++ test_insert.cjs | 32 +++++++++++++++++++ test_save.cjs | 25 +++++++++++++++ 6 files changed, 132 insertions(+), 1 deletion(-) create mode 100644 fix_sync_of_data.sql create mode 100644 supabase/migrations/20260902141500_fix_ficha_of_trigger_and_peso_type.sql create mode 100644 test_float.cjs create mode 100644 test_insert.cjs create mode 100644 test_save.cjs diff --git a/fix_sync_of_data.sql b/fix_sync_of_data.sql new file mode 100644 index 0000000..1c46fef --- /dev/null +++ b/fix_sync_of_data.sql @@ -0,0 +1,19 @@ +CREATE OR REPLACE FUNCTION "TS_ERP".sync_of_data() + RETURNS trigger + LANGUAGE plpgsql +AS $function$ +BEGIN + -- Atualizar dados na tabela ordens_fabricacao quando ficha_tecnica_contratos for alterada + IF TG_TABLE_NAME = 'ficha_tecnica_contratos' THEN + UPDATE "TS_ERP".ordens_fabricacao + SET + gestor = NEW.gestor, + data_termino_prev = NEW.data_termino_prev, + peso_total = NEW.quantidade, + descritivo = NEW.descricao_resumida + WHERE num_of = NEW.of_number; + END IF; + + RETURN NEW; +END; +$function$; diff --git a/src/pages/CadastroOF.tsx b/src/pages/CadastroOF.tsx index 1fcefa1..9221efb 100644 --- a/src/pages/CadastroOF.tsx +++ b/src/pages/CadastroOF.tsx @@ -488,7 +488,7 @@ const CadastroOF = () => { />
- +