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

IT_SET_ANALYSIS_ID

 

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

Параметр

Тип

Описание

ADATE

TIMESTAMP

 

AOPERATION

INTEGER

 

NEWQUALITYID

INTEGER

 

OLDQUALITYID

INTEGER

 

INVENTORYID

INTEGER

 

INVOICEID

INTEGER

 

SENDERQUALITYID

INTEGER

 

COPYSENDERQUALITY

INTEGER

 

 

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

(Нет выходных параметров)

 

Описание

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

 

Определение

CREATE PROCEDURE IT_SET_ANALYSIS_ID(
    ADATE TIMESTAMP,
    AOPERATION INTEGER,
    NEWQUALITYID INTEGER,
    OLDQUALITYID INTEGER,
    INVENTORYID INTEGER,
    INVOICEID INTEGER,
    SENDERQUALITYID INTEGER,
    COPYSENDERQUALITY INTEGER)
AS
begin
-- COPYSENDERQUALITY: 1 - копировать 0 - не копировать

  if (:AOPERATION not in (7,45)) then begin --in (1, 5, 12, 29, 30, 31, 54, 10, 22)
    if (:OLDQUALITYID is null) then begin
      update IT
      set LABQUALITYID = :NEWQUALITYID
      where (INVENTORYID = :INVENTORYID);

      if (:COPYSENDERQUALITY = 1) then
        update ITTRANSPORT
        set SENDERQUALITYID = :SENDERQUALITYID
        where (INVENTORYID = :INVENTORYID);
    end
    else begin
      update IT
      set LABQUALITYID = :NEWQUALITYID
      where (OPERATIONID = :AOPERATION) and (REGDATE = :ADATE) and (LABQUALITYID = :OLDQUALITYID);
    end

    update UWOUTACTS
    set AFTERQUALITYID = :NEWQUALITYID
    where (INVOICEID = :INVOICEID);
  end

  if (:AOPERATION = 7) then begin
    if (:OLDQUALITYID is null) then
      update UWOUTACTS
      set AFTERQUALITYID = :NEWQUALITYID
      where (INVOICEID = :INVOICEID);
    else
      update UWOUTACTS
      set AFTERQUALITYID = :NEWQUALITYID
      where (REGDATE = :ADATE) and (AFTERQUALITYID = :OLDQUALITYID);
  end

  if (:AOPERATION = 45) then begin --in (45)
    if (:OLDQUALITYID is null) then begin
      update IT
      set LABQUALITYID = :NEWQUALITYID
      where (INVENTORYID = :INVENTORYID);
      if (:COPYSENDERQUALITY = 1) then
        update ITTRANSPORT
        set SENDERQUALITYID = :SENDERQUALITYID
        where (INVENTORYID = :INVENTORYID);
    end
    else begin
      update IT
      set LABQUALITYID = :NEWQUALITYID
      where (OPERATIONID in (45,46)) and (REGDATE = :ADATE) and (LABQUALITYID = :OLDQUALITYID);
    end
  end
END

 

     Previous topic Chapter index Next topic