Входные параметры
Параметр | Тип | Описание |
---|---|---|
ORDERLOADITEMID |
INTEGER |
|
AEXPORTACTITEMID |
INTEGER |
|
AEXPORTACTID |
INTEGER |
|
ISWEIGHT |
SMALLINT |
|
Выходные параметры
Параметр | Тип | Описание |
---|---|---|
INCOMEWEIGHT |
BIGINT |
|
OUTCOMEWEIGHT |
BIGINT |
|
RESTWEIGHT |
BIGINT |
|
REWEIGHT |
BIGINT |
|
Описание
(Нет описания для процедуры FORWARDER_WEIGHTITEM_STORAGE)
Определение
CREATE PROCEDURE FORWARDER_WEIGHTITEM_STORAGE(
ORDERLOADITEMID INTEGER,
AEXPORTACTITEMID INTEGER,
AEXPORTACTID INTEGER,
ISWEIGHT SMALLINT)
RETURNS (
INCOMEWEIGHT BIGINT,
OUTCOMEWEIGHT BIGINT,
RESTWEIGHT BIGINT,
REWEIGHT BIGINT)
AS
begin
for
select
sum(case
when (((EAIM.EXPORTACTITEMID = :AEXPORTACTITEMID) and (EAIM.OPERATIONID in (1,17)))
and (EAIM.EXPORTACTID = :AEXPORTACTID)) then
case
when (:ISWEIGHT = 1) then
EAIM.TESTWEIGHT
else EAIM.WEIGHT
end
end) INCOMEWEIGHT,
sum(case
when ((EAIM.PARENTITEMID = :AEXPORTACTITEMID) and (EAIM.OPERATIONID in (17,5))) then
case
when (:ISWEIGHT = 1) then
EAIM.TESTWEIGHT
else EAIM.WEIGHT
end
when (((EAIM.PARENTITEMID = :AEXPORTACTITEMID) or (EAIM.EXPORTACTITEMID = :AEXPORTACTITEMID))
and (EAIM.OPERATIONID in (22,64,65,70))) then
case
when (:ISWEIGHT = 1) then
-EAIM.TESTWEIGHT
else -EAIM.WEIGHT
end
end) OUTCOMEWEIGHT,
sum(case
when (((EAIM.EXPORTACTITEMID = :AEXPORTACTITEMID) and (EAIM.OPERATIONID in (1,17))
and (EAIM.EXPORTACTID = :AEXPORTACTID))) then
case
when (:ISWEIGHT = 1) then
EAIM.TESTWEIGHT
else EAIM.WEIGHT
end
when (((EAIM.PARENTITEMID = :AEXPORTACTITEMID) and (EAIM.OPERATIONID in (5,17)))
and (EAIM.ORDERITEMID <> coalesce(:ORDERLOADITEMID,-1))) then
case
when ((select EXPORTACTITEMS.OPERATIONID from EXPORTACTITEMS
where (EXPORTACTITEMS.EXPORTACTITEMID = :AEXPORTACTITEMID)) in (22,70)) then
case
when (:ISWEIGHT = 1) then
EAIM.TESTWEIGHT
else EAIM.WEIGHT
end
else
case
when (:ISWEIGHT = 1) then
-EAIM.TESTWEIGHT
else -EAIM.WEIGHT
end
end
when (EAIM.OPERATIONID in (22,64,65,70)) then
case
when (EAIM.PARENTITEMID = :AEXPORTACTITEMID) then
case
when (:ISWEIGHT = 1) then
EAIM.TESTWEIGHT
else EAIM.WEIGHT
end
when (EAIM.EXPORTACTITEMID = :AEXPORTACTITEMID) then
case
when (:ISWEIGHT = 1) then
-EAIM.TESTWEIGHT
else -EAIM.WEIGHT
end
end
end) RESTWEIGHT,
sum(case
when (((EAIM.OPERATIONID = 17) and (EAIM.PARENTITEMID = :AEXPORTACTITEMID))
and (EAIM.ORDERITEMID = :ORDERLOADITEMID)) then
case
when ((select EXPORTACTITEMS.OPERATIONID from EXPORTACTITEMS
where (EXPORTACTITEMS.EXPORTACTITEMID = :AEXPORTACTITEMID)) in (22,70)) then
case
when (:ISWEIGHT = 1) then
-EAIM.TESTWEIGHT
else (select -EXPORTACTITEMS.WEIGHT
from EXPORTACTITEMS
join EXPORTACTS on ((EXPORTACTS.EXPORTACTID = EXPORTACTITEMS.EXPORTACTID)
and (EXPORTACTS.ORDERITEMID = :ORDERLOADITEMID)
and (EXPORTACTS.OPERATIONID = -17))
where (EXPORTACTITEMS.PARENTITEMID = :AEXPORTACTITEMID))
end
else
case
when (:ISWEIGHT = 1) then
EAIM.TESTWEIGHT
else EAIM.WEIGHT
end
end
when (((EAIM.OPERATIONID = 64) and (EAIM.EXPORTACTITEMID = :AEXPORTACTITEMID))
and (EAIM.ORDERITEMID = :ORDERLOADITEMID)) then
case
when (:ISWEIGHT = 1) then
-EAIM.TESTWEIGHT
else -EAIM.WEIGHT
end
end) REWEIGHT
from EXPORTACTITEMS_VIEW EAIM
where ((EAIM.EXPORTACTITEMID = :AEXPORTACTITEMID) or (EAIM.PARENTITEMID = :AEXPORTACTITEMID))
and (EAIM.OPERATIONID in (1,5,17,22,64,65,70))
and (EAIM.STATE <> 10)
into :INCOMEWEIGHT, :OUTCOMEWEIGHT, :RESTWEIGHT, :REWEIGHT
do suspend;
end