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

RRW_UPDATE

 

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

Параметр

Тип

Описание

INVENTORYID

INTEGER

 

REGDATE

DATE

 

TRANSPORTNUMBER

VARCHAR(31)

 

CAPACITYWEIGHT

INTEGER

 

CAPACITYVOLUME

INTEGER

 

INVOICEID

INTEGER

 

ORDERLOADITEMID

INTEGER

 

STORAGEID

INTEGER

 

OWNERID

INTEGER

 

PROVIDERID

INTEGER

 

TARETIME

TIMESTAMP

 

GROSSTIME

TIMESTAMP

 

SAMPLERINDATE

DATE

 

GROSS

INTEGER

 

TARE

INTEGER

 

NET

INTEGER

 

INVOICEGROSS

INTEGER

 

INVOICETARE

INTEGER

 

INVOICENET

INTEGER

 

CONTRACTID

INTEGER

 

WEIGHTNUMBER

INTEGER

 

SAMPLERQUALITYID

INTEGER

 

TRANSPORTTYPEID

INTEGER

 

OPERATIONID

INTEGER

 

STATE

INTEGER

 

STORINGID

INTEGER

 

WEIGHTSESSION

INTEGER

 

SAMPLEROUTDATE

DATE

 

 

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

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

 

Описание

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

 

Определение

CREATE PROCEDURE RRW_UPDATE(
    INVENTORYID INTEGER,
    REGDATE DATE,
    TRANSPORTNUMBER VARCHAR(31),
    CAPACITYWEIGHT INTEGER,
    CAPACITYVOLUME INTEGER,
    INVOICEID INTEGER,
    ORDERLOADITEMID INTEGER,
    STORAGEID INTEGER,
    OWNERID INTEGER,
    PROVIDERID INTEGER,
    TARETIME TIMESTAMP,
    GROSSTIME TIMESTAMP,
    SAMPLERINDATE DATE,
    GROSS INTEGER,
    TARE INTEGER,
    NET INTEGER,
    INVOICEGROSS INTEGER,
    INVOICETARE INTEGER,
    INVOICENET INTEGER,
    CONTRACTID INTEGER,
    WEIGHTNUMBER INTEGER,
    SAMPLERQUALITYID INTEGER,
    TRANSPORTTYPEID INTEGER,
    OPERATIONID INTEGER,
    STATE INTEGER,
    STORINGID INTEGER,
    WEIGHTSESSION INTEGER,
    SAMPLEROUTDATE DATE)
AS
declare variable PARTYID integer;
begin

  if (not exists (select INVENTORYID from ITTRANSPORT where INVENTORYID = :INVENTORYID)) then
    insert into ITTRANSPORT (INVENTORYID, TRANSPORTNUMBER, CAPACITYWEIGHT, CAPACITYVOLUME,
      INVOICEGROSS, INVOICETARE, INVOICENET, SAMPLERINDATE, TRANSPORTTYPEID,
      WEIGHTSESSION, SAMPLEROUTDATE)
    values (:INVENTORYID, :TRANSPORTNUMBER, :CAPACITYWEIGHT, :CAPACITYVOLUME,
      :INVOICEGROSS, :INVOICETARE, :INVOICENET, :SAMPLERINDATE, :TRANSPORTTYPEID,
      :WEIGHTSESSION, :SAMPLEROUTDATE);
  else
    update ITTRANSPORT
    set TRANSPORTNUMBER = :TRANSPORTNUMBER,
        CAPACITYWEIGHT = :CAPACITYWEIGHT,
        CAPACITYVOLUME = :CAPACITYVOLUME,
        INVOICEGROSS = :INVOICEGROSS,
        INVOICETARE = :INVOICETARE,
        INVOICENET = :INVOICENET,
        SAMPLERINDATE = :SAMPLERINDATE,
        TRANSPORTTYPEID = :TRANSPORTTYPEID,
        WEIGHTSESSION = :WEIGHTSESSION,
        SAMPLEROUTDATE = :SAMPLEROUTDATE
    where (INVENTORYID = :INVENTORYID);

  select
      QUALITY.PARTYID
    from QUALITY
      left join ORDERLOADITEMS on (ORDERLOADITEMS.ORDERLOADITEMID = :ORDERLOADITEMID)
    where (QUALITY.QUALITYID = ORDERLOADITEMS.QUALITYID)
  into :PARTYID;

  if (not exists (select INVENTORYID from IT where INVENTORYID = :INVENTORYID)) then
    insert into IT (INVENTORYID, REGDATE, PARTYID, INVOICEID, ORDERLOADITEMID, STORAGEID,
      OWNERID, PROVIDERID, TARETIME, GROSSTIME, GROSS, TARE, NET, CONTRACTID,
      WEIGHTNUMBER, SAMPLERQUALITYID, OPERATIONID, STATE, STORINGID)
    values (:INVENTORYID, :REGDATE, :PARTYID, :INVOICEID, :ORDERLOADITEMID, :STORAGEID,
      :OWNERID, :PROVIDERID, :TARETIME, :GROSSTIME, :GROSS, :TARE, :NET, :CONTRACTID,
      :WEIGHTNUMBER, :SAMPLERQUALITYID, :OPERATIONID, :STATE, :STORINGID);
  else
    update IT
    set REGDATE = :REGDATE,
        INVOICEID = :INVOICEID,
        ORDERLOADITEMID = :ORDERLOADITEMID,
        STORAGEID = :STORAGEID,
        OWNERID = :OWNERID,
        PROVIDERID = :PROVIDERID,
        TARETIME = :TARETIME,
        GROSSTIME = :GROSSTIME,
        GROSS = :GROSS,
        TARE = :TARE,
        NET = :NET,
        CONTRACTID = :CONTRACTID,
        WEIGHTNUMBER = :WEIGHTNUMBER,
        SAMPLERQUALITYID = :SAMPLERQUALITYID,
        OPERATIONID = :OPERATIONID,
        STATE = :STATE,
        STORINGID = :STORINGID
    where (INVENTORYID = :INVENTORYID);

end

 

     Previous topic Chapter index Next topic