Changes between Version 22 and Version 23 of manual_regente_windows_postgres9.1.3-1
- Timestamp:
- 11/03/17 11:38:33 (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
manual_regente_windows_postgres9.1.3-1
v22 v23 133 133 ALTER TABLE remitos_detalles DROP CONSTRAINT chk_lote_articulo_correcto; 134 134 ALTER TABLE valores DROP CONSTRAINT chk_numero_en_chequera; 135 135 --WMS 136 ALTER TABLE wms.pallets_remitos DROP CONSTRAINT fk_pallets; 137 ALTER TABLE wms.pallets_remitos DROP CONSTRAINT fk_remitos_detalles; 138 ALTER TABLE wms.pallets_remitos DROP CONSTRAINT chk_cant_pallet_menor_cant_remito; 136 139 }}} 137 * Este es un error que salta al restaurar los datos si el backup tiene wms. (solo dejo el error no esta la solución.)138 {{{139 pg_restore: [archiver (bd)] COPY falló para la tabla «pallets_remitos»: ERROR: no existe la relación «remitos_detalles»140 LÍNEA 11: left join remitos_detalles rd on pr.id_remito = rd.id_remit...141 ^142 CONSULTA: --$1 id_remito $2 id_remito_det.143 --ticket:3174. Check para averiguar sobre un bug desde regente, al preingresar con dos remitos a la vez:144 -- Hay situaciones en las cuales asigna los pallets a un solo remito y al otro lo deja sin pallet, provocando145 -- en este ultimo que se elimine la fila al cerrar el remito por no haber ingresado.146 -- Se agrega esta func. como check en tabla wms.pallets_remitos para evitar que en el otro remito no se asignen147 -- cantidades sobrantes: va a dar error.148 --Primer version del mar 10/9/2013.149 --Devuelve verdadero si la cant. asignada al pallet asociado a la fila del remito es menor o a lo sumo igual a la cant. de la fila del remito.150 select (max(coalesce(rd.cant,0))::integer - sum(coalesce(pr.cantidad,0))::integer) >=0151 from wms.pallets_remitos pr152 left join remitos_detalles rd on pr.id_remito = rd.id_remito and pr.id_remito_det = rd.id_det153 where pr.id_remito = $1 and pr.id_remito_det = $2154 group by pr.id_remito,pr.id_remito_det155 156 CONTEXTO: función SQL «cant_pallet_menor_cant_remito», durante expansión en línea157 COPY pallets_remitos, línea 1: «5000401 118 4 10»158 }}}159 160 140 * 4) Restaurar solo los datos 161 141 {{{ … … 165 145 * 5) Volver a poner checks quitados: 166 146 {{{ 167 --Volver a poner checks quitados, quiza ajustando algo en los datos: 168 delete from remitos_detalles where id_lote IS NULL AND existencia_con_lote(id_articulo) 147 delete from remitos_detalles where id_lote IS NULL AND existencia_con_lote(id_articulo); 169 148 ALTER TABLE remitos_detalles ADD CONSTRAINT chk_existencia_especificar_lote CHECK (NOT (id_lote IS NULL AND existencia_con_lote(id_articulo))); 170 149 ALTER TABLE remitos_detalles ADD CONSTRAINT chk_existencia_especificar_lote_unitario CHECK (NOT (COALESCE(cant, 0::double precision) <> 1::double precision AND existencia_con_lote_unitario(id_articulo))); 171 150 ALTER TABLE remitos_detalles ADD CONSTRAINT chk_lote_articulo_correcto CHECK (id_lote IS NULL OR lote_articulo_correcto(id_lote, id_articulo)); 172 delete from valores where not valor_cheque_en_chequera(id_cuenta, nro, id_tipo_pago) 151 delete from valores where not valor_cheque_en_chequera(id_cuenta, nro, id_tipo_pago); 173 152 ALTER TABLE valores ADD CONSTRAINT chk_numero_en_chequera CHECK (valor_cheque_en_chequera(id_cuenta, nro, id_tipo_pago)); 153 --WMS 154 ALTER TABLE wms.pallets_remitos ADD CONSTRAINT fk_pallets FOREIGN KEY (id_pallet) REFERENCES wms.pallets (id_pallet) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE CASCADE; 155 ALTER TABLE wms.pallets_remitos ADD CONSTRAINT fk_remitos_detalles FOREIGN KEY (id_remito, id_remito_det) REFERENCES public.remitos_detalles (id_remito, id_det) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION; 156 ALTER TABLE wms.pallets_remitos ADD CONSTRAINT chk_cant_pallet_menor_cant_remito CHECK (wms.cant_pallet_menor_cant_remito(id_remito, id_remito_det) OR id_pallet <= 15291); -- ticket:3174. El criterio de id_pallet > 15291 es para evitar, en instalacion de agostini, el check de pallets anteriores ya que no respetan esta restriccion: en la version general de la base de datos no debe estar este criterio de pallet 174 157 }}} 175 158 * 6) Hacer un backup de todo el schema replicacion de la base de datos de origen y restaurarla. Restaurar el contenido de tabla replicacion.tolerancia_fallo_firmas de manera manual también.