"localhost:/firebird/data/ILICHEVSK2.FDB". Процедуры Previous topic Chapter index Next topic

QUALITY_IS_PARENT

 

Входные параметры

Параметр

Тип

Описание

ACROPID

INTEGER

 

ACLASSID

INTEGER

 

AQUALITYTYPEID

INTEGER

 

PARENT

INTEGER

 

AVALUE

NUMERIC(9,2)

 

 

Выходные параметры

Параметр

Тип

Описание

V

NUMERIC(9,2)

 

 

Описание

(Нет описания для процедуры QUALITY_IS_PARENT)

 

Определение

CREATE PROCEDURE QUALITY_IS_PARENT(
    ACROPID INTEGER,
    ACLASSID INTEGER,
    AQUALITYTYPEID INTEGER,
    PARENT INTEGER,
    AVALUE NUMERIC(9,2))
RETURNS (
    V NUMERIC(9,2))
AS
declare variable FQUALITYTYPEID integer;
declare variable FSTATE integer;
declare variable QUALITYTYPEID integer;
declare variable QPARENT integer;
begin
-- PARENT 0 - культурные, 1 - зерновая, 2 - сорная
  V = :AVALUE;
  QUALITYTYPEID = -1;

  select first 1 CROPPARAMS.QUALITYTYPEID, CROPPARAMS.STATE, CROPPARAMS.PARENTID
    from CROPPARAMS
    where (CROPPARAMS.CROPPARAMTYPEID = 10)
      and (CROPPARAMS.CROPID in (-1,:ACROPID))
      and ((CROPPARAMS.CLASSID is null) or (CROPPARAMS.CLASSID = :ACLASSID))
      and (CROPPARAMS.QUALITYTYPEID = :AQUALITYTYPEID)
  order by CROPPARAMS.CROPPARAMID desc
  into :FQUALITYTYPEID, :FSTATE, :QPARENT;

  if ((:FQUALITYTYPEID <> -1) and (:FSTATE > -1)) then begin
    if (((:PARENT = 1) and (:QPARENT in (14,110)))
        or ((:PARENT = 2) and (:QPARENT = 13))
        or ((:PARENT = 0) and (coalesce(:QPARENT,0) not in (13,14)))) then
      suspend;
  end
end

 

     Previous topic Chapter index Next topic