Входные параметры
Параметр | Тип | Описание |
---|---|---|
REGDATE |
DATE |
|
OPERATIONID |
INTEGER |
|
INVOICEID |
INTEGER |
|
SOURCESILAGEPACKID |
INTEGER |
|
DESTSILAGEID |
INTEGER |
|
NET |
INTEGER |
|
GROSSTIME |
TIMESTAMP |
|
STATE |
INTEGER |
|
CLASSID |
INTEGER |
|
Выходные параметры
Параметр | Тип | Описание |
---|---|---|
INVENTORYID |
INTEGER |
|
RSLT_INVOICEID |
INTEGER |
|
QUALITYID |
INTEGER |
|
Описание
(Нет описания для процедуры IT_MOVEGRAIN)
Определение
CREATE PROCEDURE IT_MOVEGRAIN(
REGDATE DATE,
OPERATIONID INTEGER,
INVOICEID INTEGER,
SOURCESILAGEPACKID INTEGER,
DESTSILAGEID INTEGER,
NET INTEGER,
GROSSTIME TIMESTAMP,
STATE INTEGER,
CLASSID INTEGER)
RETURNS (
INVENTORYID INTEGER,
RSLT_INVOICEID INTEGER,
QUALITYID INTEGER)
AS
declare variable SOURCESTORAGEID integer;
declare variable DESTSTORAGEID integer;
begin
if (:OPERATIONID in (12,29,31,54,164)) then begin
select SILAGEPACKS.STORAGEID, SILAGEQUALITY.QUALITYID
from SILAGEPACKS
left join SILAGEQUALITY on (SILAGEQUALITY.SILAGEQUALITYID = SILAGEPACKS.SILAGEQUALITYID) -- added
left join QUALITY on (QUALITY.QUALITYID = SILAGEQUALITY.QUALITYID) -- added
where (SILAGEPACKS.SILAGEPACKID = :SOURCESILAGEPACKID)
and (QUALITY.CLASSID = :CLASSID) -- added
into :SOURCESTORAGEID, :QUALITYID;
select SILAGEPACKS.STORAGEID
from SILAGE
left join SILAGEPACKS on (SILAGEPACKS.SILAGEPACKID = SILAGE.SILAGEPACKID)
where (SILAGE.SILAGEID = :DESTSILAGEID)
into :DESTSTORAGEID;
INVENTORYID = gen_id(INVENTORYIDGEN, 1);
insert into IT (INVENTORYID, REGDATE, OPERATIONID, INVOICEID, NET, GROSSTIME, PROVIDERID, SAMPLERQUALITYID, SILAGEID, ROUTEID, STORAGEID, STATE)
values (:INVENTORYID, :REGDATE, :OPERATIONID, :INVOICEID, :NET, :GROSSTIME,
case
when (:OPERATIONID = 164) then
null
else :SOURCESTORAGEID
end,
:QUALITYID, :DESTSILAGEID,
case
when (:OPERATIONID = 164) then
null
else :SOURCESILAGEPACKID
end,
:DESTSTORAGEID, :STATE);
end
else exception REPLACEOPERATIONNOTEXISTS;
suspend;
end