Входные параметры
Параметр | Тип | Описание |
---|---|---|
OPERATIONID |
INTEGER |
|
TRANSPORTTYPEID |
INTEGER |
|
STEP |
INTEGER |
|
ALABQUALITYNUMBER |
VARCHAR(10) |
|
Выходные параметры
Параметр | Тип | Описание |
---|---|---|
LABQUALITYNUMBER |
INTEGER |
|
AUTONUMBERINGANALYSES |
INTEGER |
|
GENERATORNAME |
VARCHAR(31) |
|
Описание
(Нет описания для процедуры GET_LABQUALITYNUMBER)
Определение
CREATE PROCEDURE GET_LABQUALITYNUMBER(
OPERATIONID INTEGER,
TRANSPORTTYPEID INTEGER,
STEP INTEGER,
ALABQUALITYNUMBER VARCHAR(10))
RETURNS (
LABQUALITYNUMBER INTEGER,
AUTONUMBERINGANALYSES INTEGER,
GENERATORNAME VARCHAR(31))
AS
begin
select coalesce(ENVIRONMENTOPTIONS.AUTONUMBERINGANALYSES,0)
from ENVIRONMENTOPTIONS
into :AUTONUMBERINGANALYSES;
if (AUTONUMBERINGANALYSES > 0) then begin
if (AUTONUMBERINGANALYSES > 1) then begin
if (bin_and(AUTONUMBERINGANALYSES,2) = 2) then begin
GENERATORNAME = 'LABQUALITYNUMBER_GEN' || coalesce('_OP' || OPERATIONID,'');
if (not exists (select * from rdb$generators where rdb$generators.rdb$generator_name = :GENERATORNAME)) then
execute statement 'create generator ' || :GENERATORNAME;
end
if (bin_and(AUTONUMBERINGANALYSES,4) = 4) then begin
if (AUTONUMBERINGANALYSES = 4) then
GENERATORNAME = 'LABQUALITYNUMBER_GEN';
if (TRANSPORTTYPEID in (2,3)) then
GENERATORNAME = GENERATORNAME || '_F59';
else GENERATORNAME = GENERATORNAME || '_F49';
if (not exists (select * from rdb$generators where rdb$generators.rdb$generator_name = :GENERATORNAME)) then
execute statement 'create generator ' || :GENERATORNAME;
end
end
else GENERATORNAME = 'LABQUALITYNUMBER_GEN';
if (:STEP = 0) then
execute statement 'select cast(gen_id(' || :GENERATORNAME || ',0) + 1 as integer) from rdb$database'
into :LABQUALITYNUMBER;
else
if (:ALABQUALITYNUMBER <> '') then begin
if (:ALABQUALITYNUMBER <> '-1') then
execute statement 'alter sequence ' || :GENERATORNAME || ' restart with ' || :ALABQUALITYNUMBER;
end
else
execute statement 'select cast(gen_id(' || :GENERATORNAME || ',1) as integer) from rdb$database'
into :LABQUALITYNUMBER;
end
suspend;
end