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

ACN_COMESELECT_S

 

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

Параметр

Тип

Описание

ARECORDID

INTEGER

 

ATABID

INTEGER

 

AUSER

VARCHAR(50)

 

ADATE

TIMESTAMP

 

 

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

Параметр

Тип

Описание

CREATERECDATE

TIMESTAMP

 

CREATEUSER

VARCHAR(50)

 

NET

INTEGER

 

NETDATE

TIMESTAMP

 

NETUSER

VARCHAR(50)

 

SQDATE

TIMESTAMP

 

SQUSER

VARCHAR(50)

 

DELDATE

TIMESTAMP

 

DELUSER

VARCHAR(50)

 

REGDATE

DATE

 

LQDATE

TIMESTAMP

 

LQUSER

VARCHAR(50)

 

HUMIDITY

NUMERIC(9,2)

 

GRAINUNIT

INTEGER

 

DIRT

NUMERIC(9,2)

 

SCREENING

NUMERIC(9,2)

 

OILSEED

NUMERIC(9,2)

 

PROTEIN

NUMERIC(9,2)

 

GLUTEN

NUMERIC(9,1)

 

GLUTENQUALITY

INTEGER

 

DROPNUMBER

INTEGER

 

ACIDITY

NUMERIC(9,2)

 

GLASSNESS

INTEGER

 

 

Описание

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

 

Определение

CREATE PROCEDURE ACN_COMESELECT_S(
    ARECORDID INTEGER,
    ATABID INTEGER,
    AUSER VARCHAR(50),
    ADATE TIMESTAMP)
RETURNS (
    CREATERECDATE TIMESTAMP,
    CREATEUSER VARCHAR(50),
    NET INTEGER,
    NETDATE TIMESTAMP,
    NETUSER VARCHAR(50),
    SQDATE TIMESTAMP,
    SQUSER VARCHAR(50),
    DELDATE TIMESTAMP,
    DELUSER VARCHAR(50),
    REGDATE DATE,
    LQDATE TIMESTAMP,
    LQUSER VARCHAR(50),
    HUMIDITY NUMERIC(9,2),
    GRAINUNIT INTEGER,
    DIRT NUMERIC(9,2),
    SCREENING NUMERIC(9,2),
    OILSEED NUMERIC(9,2),
    PROTEIN NUMERIC(9,2),
    GLUTEN NUMERIC(9,1),
    GLUTENQUALITY INTEGER,
    DROPNUMBER INTEGER,
    ACIDITY NUMERIC(9,2),
    GLASSNESS INTEGER)
AS
declare variable TMPFID integer;
declare variable TMPFVAL integer;
begin
  -- зарегистрировано
  select ILT2.CREATETIME, US2.USERSHORTNAME
    from ILT$TABLEOPERATION ILT2
      left join USERS_SHORTNAME(ILT2.USERID) US2 on (0=0)
    where (ILT2.RECORDID = :ARECORDID) and (ILT2.OPERATIONID = 1)
  into :CREATERECDATE, :CREATEUSER;

  select ILD.FIELDVALUE
    from ILT$FIELDDATE ILD
    where (ILD.TABLEOPERATIONID = :ATABID) and (ILD.FIELDID = 3)
  into :REGDATE;

  if (:REGDATE is null) then
    select first 1 ILD.FIELDVALUE
      from ILT$TABLEOPERATION ILT
        left join ILT$FIELDDATE ILD on ((ILT.TABLEOPERATIONID = ILD.TABLEOPERATIONID) and (ILD.FIELDID = 3))
      where (ILT.RECORDID = :ARECORDID) and (ILT.TABLEID = 149) and (ILD.FIELDID = 3)
    order by ILT.CREATETIME desc
    into :REGDATE;

  for
    select ILI.FIELDID, ILI.FIELDVALUE
      from ILT$FIELDINTEGER ILI
      where (ILI.TABLEOPERATIONID = :ATABID)
        and ((ILI.FIELDID in (13,29,30))
             or ((ILI.FIELDID = 44) and (ILI.FIELDVALUE = -1)))
    into :TMPFID, :TMPFVAL
    do begin --Net
      if (:TMPFID = 13) then begin
        NET = :TMPFVAL;
        NETDATE = :ADATE;
        NETUSER = :AUSER;
      end

      if (:TMPFID = 29) then begin -- SQ
        SQDATE = :ADATE;
        SQUSER = :AUSER;
      end

      if ((:TMPFID = 44) and (:TMPFVAL = -1)) then begin -- Del
        DELDATE = :ADATE;
        DELUSER = :AUSER;
      end

      if (:TMPFID = 30) then begin -- LQ
        LQDATE = :ADATE;
        LQUSER = :AUSER;   -- + качество

        select QUALITY_SELECT.HUMIDITY, QUALITY_SELECT.GRAINUNIT, QUALITY_SELECT.DIRT,
            QUALITY_SELECT.SCREENING, QUALITY_SELECT.OILSEED, QUALITY_SELECT.PROTEIN,
            QUALITY_SELECT.GLUTEN, QUALITY_SELECT.GLUTENQUALITY, QUALITY_SELECT.DROPNUMBER,
            QUALITY_SELECT.ACIDITY, QUALITY_SELECT.GLASSNESS
          from QUALITY_SELECT(:TMPFVAL)
        into :HUMIDITY, :GRAINUNIT, :DIRT, :SCREENING, :OILSEED, :PROTEIN,
             :GLUTEN, :GLUTENQUALITY, :DROPNUMBER,:ACIDITY, :GLASSNESS;
      end
    end
    --
    suspend;
end

 

     Previous topic Chapter index Next topic