AAIT#33506 de overload werd door aaey gebruikt
svn path=/Database/trunk/; revision=27276
This commit is contained in:
@@ -126,6 +126,7 @@ CREATE OR REPLACE PACKAGE fac
|
|||||||
FUNCTION isdatefeestdag(p_date IN DATE) RETURN BOOLEAN;
|
FUNCTION isdatefeestdag(p_date IN DATE) RETURN BOOLEAN;
|
||||||
FUNCTION calcnextcyclusdate (p_date IN DATE, p_mode IN NUMBER, p_eenheid IN NUMBER, p_periode IN NUMBER, p_bits IN NUMBER) RETURN DATE;
|
FUNCTION calcnextcyclusdate (p_date IN DATE, p_mode IN NUMBER, p_eenheid IN NUMBER, p_periode IN NUMBER, p_bits IN NUMBER) RETURN DATE;
|
||||||
FUNCTION nextcyclusdate (p_date IN DATE, p_mode IN NUMBER, p_eenheid IN NUMBER, p_periode IN NUMBER, p_bits IN NUMBER, p_steps IN NUMBER DEFAULT 0) RETURN DATE;
|
FUNCTION nextcyclusdate (p_date IN DATE, p_mode IN NUMBER, p_eenheid IN NUMBER, p_periode IN NUMBER, p_bits IN NUMBER, p_steps IN NUMBER DEFAULT 0) RETURN DATE;
|
||||||
|
FUNCTION nextcyclusdatedeel (p_insdeel IN NUMBER, p_srtcontrole IN NUMBER, p_steps IN NUMBER DEFAULT 0) RETURN DATE;
|
||||||
FUNCTION nextcyclusdatesteps (p_date IN DATE, p_mode IN NUMBER, p_eenheid IN NUMBER, p_periode IN NUMBER, p_bits IN NUMBER, p_steps IN NUMBER DEFAULT 1, p_enddate IN DATE DEFAULT SYSDATE) RETURN NUMBER;
|
FUNCTION nextcyclusdatesteps (p_date IN DATE, p_mode IN NUMBER, p_eenheid IN NUMBER, p_periode IN NUMBER, p_bits IN NUMBER, p_steps IN NUMBER DEFAULT 1, p_enddate IN DATE DEFAULT SYSDATE) RETURN NUMBER;
|
||||||
FUNCTION makehash (p_in VARCHAR2, method IN VARCHAR2 DEFAULT 'MD5') RETURN VARCHAR2;
|
FUNCTION makehash (p_in VARCHAR2, method IN VARCHAR2 DEFAULT 'MD5') RETURN VARCHAR2;
|
||||||
FUNCTION testhash (p_hash VARCHAR2, p_in VARCHAR2) RETURN NUMBER;
|
FUNCTION testhash (p_hash VARCHAR2, p_in VARCHAR2) RETURN NUMBER;
|
||||||
@@ -4362,6 +4363,70 @@ CREATE OR REPLACE PACKAGE BODY fac AS
|
|||||||
END IF;
|
END IF;
|
||||||
END;
|
END;
|
||||||
|
|
||||||
|
-- Berekent de n-de (p_steps) controledatum van een object na p_date.
|
||||||
|
-- Indien p_steps niet is meegegeven dan wordt de eerstvolgende controledatum na nu teruggegeven.
|
||||||
|
-- steps = 0, (NULL): 1-ste vandaag of in de toekomst (als meegegeven datum (p_date) de huidige datum is, dan deze weer teruggeven).
|
||||||
|
-- steps = n: n-volgende vanaf meegegeven datum (p_date).
|
||||||
|
-- Als deze berekende datum in de toekomst ligt en steps is nog niet null, dan wordt NULL teruggegeven).
|
||||||
|
FUNCTION nextcyclusdatedeel (p_insdeel IN NUMBER,
|
||||||
|
p_srtcontrole IN NUMBER,
|
||||||
|
p_steps IN NUMBER DEFAULT 0)
|
||||||
|
RETURN DATE
|
||||||
|
IS
|
||||||
|
inspdate DATE;
|
||||||
|
BEGIN
|
||||||
|
SELECT inspectie_next
|
||||||
|
INTO inspdate
|
||||||
|
FROM (WITH defined_inspect AS (SELECT isc.ins_srtcontrole_key,
|
||||||
|
isc.ins_srtcontrole_mode,
|
||||||
|
isc.ins_srtcontrole_eenheid,
|
||||||
|
isc.ins_srtcontrole_bits,
|
||||||
|
isc.ins_srtcontrole_periode,
|
||||||
|
id.ins_deel_key,
|
||||||
|
id.ins_deel_aanmaak
|
||||||
|
FROM ins_deel id,
|
||||||
|
ins_srtdeel s,
|
||||||
|
ins_srtcontrole isc
|
||||||
|
WHERE s.ins_srtdeel_key = id.ins_srtdeel_key
|
||||||
|
AND (isc.ins_srtcontrole_niveau = 'S'
|
||||||
|
AND isc.ins_srtinstallatie_key = id.ins_srtdeel_key
|
||||||
|
OR isc.ins_srtcontrole_niveau = 'G'
|
||||||
|
AND isc.ins_srtinstallatie_key = s.ins_srtgroep_key
|
||||||
|
OR isc.ins_srtcontrole_niveau = 'D'
|
||||||
|
AND isc.ins_srtinstallatie_key = id.ins_discipline_key)
|
||||||
|
AND id.ins_deel_key = p_insdeel)
|
||||||
|
|
||||||
|
SELECT fac.nextcyclusdate (COALESCE ( (SELECT MAX ( GREATEST (COALESCE (idsc.ins_deelsrtcontrole_datum_xcp,
|
||||||
|
CASE di.ins_srtcontrole_mode
|
||||||
|
WHEN 0
|
||||||
|
THEN idsc.ins_deelsrtcontrole_datum_org
|
||||||
|
ELSE idsc.ins_deelsrtcontrole_datum END),
|
||||||
|
CASE di.ins_srtcontrole_mode
|
||||||
|
WHEN 0
|
||||||
|
THEN idsc.ins_deelsrtcontrole_datum_org
|
||||||
|
ELSE idsc.ins_deelsrtcontrole_datum
|
||||||
|
END)
|
||||||
|
) ins_deelsrtcontrole_datum
|
||||||
|
FROM ins_deelsrtcontrole idsc
|
||||||
|
WHERE idsc.ins_srtcontrole_key = di.ins_srtcontrole_key
|
||||||
|
AND idsc.ins_deel_key = di.ins_deel_key),
|
||||||
|
di.ins_deel_aanmaak),
|
||||||
|
di.ins_srtcontrole_mode,
|
||||||
|
COALESCE(xcp.ins_srtcontroledl_xcp_eenheid, di.ins_srtcontrole_eenheid),
|
||||||
|
COALESCE(xcp.ins_srtcontroledl_xcp_periode, di.ins_srtcontrole_periode),
|
||||||
|
COALESCE(xcp.ins_srtcontroledl_xcp_bits, di.ins_srtcontrole_bits),
|
||||||
|
p_steps
|
||||||
|
) inspectie_next
|
||||||
|
FROM defined_inspect di,
|
||||||
|
ins_srtcontroledl_xcp xcp
|
||||||
|
WHERE di.ins_srtcontrole_key = xcp.ins_srtcontrole_key(+)
|
||||||
|
AND di.ins_deel_key = xcp.ins_deel_key(+)
|
||||||
|
AND di.ins_deel_key = p_insdeel
|
||||||
|
AND di.ins_srtcontrole_key = p_srtcontrole
|
||||||
|
AND (xcp.ins_srtcontroledl_xcp_eind(+) IS NULL OR xcp.ins_srtcontroledl_xcp_eind(+) > TRUNC(SYSDATE, 'DD')));
|
||||||
|
|
||||||
|
RETURN inspdate;
|
||||||
|
END;
|
||||||
|
|
||||||
-- Bereken hoeveel controlestappen het is naar de eerste controle datum in de toekomst (standaard) of na de meegegeven datum.
|
-- Bereken hoeveel controlestappen het is naar de eerste controle datum in de toekomst (standaard) of na de meegegeven datum.
|
||||||
FUNCTION nextcyclusdatesteps (p_date IN DATE,
|
FUNCTION nextcyclusdatesteps (p_date IN DATE,
|
||||||
@@ -4379,7 +4444,7 @@ CREATE OR REPLACE PACKAGE BODY fac AS
|
|||||||
inspdate DATE;
|
inspdate DATE;
|
||||||
enddate DATE;
|
enddate DATE;
|
||||||
BEGIN
|
BEGIN
|
||||||
-- Calulate next cyclus date
|
-- Calculate next cyclus date
|
||||||
inspdate := calcnextcyclusdate (p_date, p_mode, p_eenheid, p_periode, p_bits);
|
inspdate := calcnextcyclusdate (p_date, p_mode, p_eenheid, p_periode, p_bits);
|
||||||
IF ((p_eenheid = 0 AND TRUNC(inspdate, 'HH24') >= TRUNC(p_enddate, 'HH24')) OR
|
IF ((p_eenheid = 0 AND TRUNC(inspdate, 'HH24') >= TRUNC(p_enddate, 'HH24')) OR
|
||||||
(p_eenheid > 0 AND TRUNC(inspdate, 'DDD') >= TRUNC(p_enddate, 'DDD')))
|
(p_eenheid > 0 AND TRUNC(inspdate, 'DDD') >= TRUNC(p_enddate, 'DDD')))
|
||||||
|
|||||||
Reference in New Issue
Block a user