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

SILAGE_HISTORY_INFO

 

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

Параметр

Тип

Описание

ENDDATE

TIMESTAMP

 

STORAGEID

INTEGER

 

ID_SILAGE

INTEGER

 

ID_SILAGEPACKS

INTEGER

 

ID_SILAGE_WEIGHT

INTEGER

 

ID_SILAGEPACKS_QUALITYID

INTEGER

 

ID_SILAGEPACKS_SILAGEQUALITYID

INTEGER

 

ID_SILAGEPACKS_STATE

INTEGER

 

ID_SILAGEPACKS_RECIPEID

INTEGER

 

 

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

Параметр

Тип

Описание

SILAGEID

INTEGER

 

QUALITYID

INTEGER

 

WEIGHT

INTEGER

 

STATE

INTEGER

 

RECIPEID

INTEGER

 

SILAGEQUALITYID

INTEGER

 

CREATETIME

TIMESTAMP

 

 

Описание

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

 

Определение

CREATE PROCEDURE SILAGE_HISTORY_INFO(
    ENDDATE TIMESTAMP,
    STORAGEID INTEGER,
    ID_SILAGE INTEGER,
    ID_SILAGEPACKS INTEGER,
    ID_SILAGE_WEIGHT INTEGER,
    ID_SILAGEPACKS_QUALITYID INTEGER,
    ID_SILAGEPACKS_SILAGEQUALITYID INTEGER,
    ID_SILAGEPACKS_STATE INTEGER,
    ID_SILAGEPACKS_RECIPEID INTEGER)
RETURNS (
    SILAGEID INTEGER,
    QUALITYID INTEGER,
    WEIGHT INTEGER,
    STATE INTEGER,
    RECIPEID INTEGER,
    SILAGEQUALITYID INTEGER,
    CREATETIME TIMESTAMP)
AS
DECLARE VARIABLE FIELDID INTEGER;
DECLARE VARIABLE FIELDVALUE INTEGER;
DECLARE VARIABLE TABLEID INTEGER;
DECLARE VARIABLE ASILAGEID INTEGER;
DECLARE VARIABLE ATIME TIMESTAMP;
begin
  SilageID = null;
  for
    select
      coalesce(Silage.silageid, ilt$tableoperation.recordid) silageid,
      ilt$fieldinteger.fieldid,
      ilt$fieldinteger.fieldvalue,
      ilt$tableoperation.tableid,
      ilt$tableoperation.createtime
    from ilt$tableoperation
      left join ilt$fieldinteger on (ilt$tableoperation.tableoperationid = ilt$fieldinteger.tableoperationid)
      left join silage on (ilt$tableoperation.tableid = :id_silagepacks and Silage.silagepackid = ilt$tableoperation.recordid)
    where ((ilt$tableoperation.tableid = :id_silage and ilt$fieldinteger.fieldid = :ID_silage_weight)
           or ilt$tableoperation.tableid = :id_silagepacks
          )
      and ilt$tableoperation.createtime <= :EndDate
      and ilt$fieldinteger.fieldid is not null
      and (coalesce(Silage.silageid, ilt$tableoperation.recordid) between 1 and 102 or :storageid <> 1 )
    order by 1, ilt$tableoperation.tableoperationid
    into :ASILAGEID, :FIELDID, :FIELDVALUE, :TABLEID, :ATIME
  do begin
    if (:SILAGEID is not null and :SILAGEID <> :ASILAGEID) then begin
      suspend;
      QUALITYID = null;
      WEIGHT = null;
      STATE = null;
      RECIPEID = null;
      SILAGEQUALITYID = null;
      CREATETIME = null;
    end
    SILAGEID = :ASILAGEID;
    if (:TABLEID = :id_silage and :FIELDID = :id_silage_weight) then begin
      WEIGHT = :FIELDVALUE;
      CREATETIME = :ATIME;
    end
    if (:TABLEID = :id_silagepacks and :FIELDID = :id_silagepacks_qualityid) then QUALITYID = :FIELDVALUE;
    if (:TABLEID = :id_silagepacks and :FIELDID = :id_silagepacks_silagequalityid) then SILAGEQUALITYID = :FIELDVALUE;
    if (:TABLEID = :id_silagepacks and :FIELDID = :id_silagepacks_state) then STATE = :FIELDVALUE;
    if (:TABLEID = :id_silagepacks and :FIELDID = :id_silagepacks_recipeid) then RECIPEID = :FIELDVALUE;
  end
  suspend;
end

 

     Previous topic Chapter index Next topic