Входные параметры
Параметр | Тип | Описание |
---|---|---|
APARENTITEMID |
INTEGER |
|
AORDERITEMID |
INTEGER |
|
AINVENTORYID |
INTEGER |
|
AOPERATIONID |
INTEGER |
|
AEXPORTACTITEMID |
INTEGER |
|
AEXPORTACTID |
INTEGER |
|
ISWEIGHT |
INTEGER |
|
Выходные параметры
Параметр | Тип | Описание |
---|---|---|
TRANSPORTWEIGHT |
BIGINT |
|
TRANSPORTTESTWEIGHT |
BIGINT |
|
CUSTOMOUTNET |
BIGINT |
|
Описание
(Нет описания для процедуры FORWARDER_WEIGHTOUT)
Определение
CREATE PROCEDURE FORWARDER_WEIGHTOUT(
APARENTITEMID INTEGER,
AORDERITEMID INTEGER,
AINVENTORYID INTEGER,
AOPERATIONID INTEGER,
AEXPORTACTITEMID INTEGER,
AEXPORTACTID INTEGER,
ISWEIGHT INTEGER)
RETURNS (
TRANSPORTWEIGHT BIGINT,
TRANSPORTTESTWEIGHT BIGINT,
CUSTOMOUTNET BIGINT)
AS
begin
for
select
sum
(case
when (:ISWEIGHT = 1) then
case
when (:AOPERATIONID in (1,17)) then
case
when (((EAIMAIN.EXPORTACTITEMID = :AEXPORTACTITEMID) and (EAIMAIN.OPERATIONID in (1,17)))
or ((EAIMAIN.OPERATIONID in (22,64,65,70)) and (EAIMAIN.PARENTITEMID = :AEXPORTACTITEMID))) then
EAIMAIN.TESTWEIGHT
when ((EAIMAIN.OPERATIONID in (5,17,1005)) and (EAIMAIN.TESTWEIGHT > 0) and (EAIMAIN.PARENTITEMID = :AEXPORTACTITEMID)) then
-EAIMAIN.TESTWEIGHT
end
when (:AOPERATIONID in (22,70)) then
case
when (EAIMAIN.EXPORTACTITEMID = :AEXPORTACTITEMID) then
-EAIMAIN.WEIGHT
when ((EAIV.PARENTITEMID = :APARENTITEMID) and (EAIMAIN.INVENTORYID = :AINVENTORYID)
and (EAIMAIN.OPERATIONID = 5) and (EAIMAIN.TESTWEIGHT < 0)) then
EAIMAIN.WEIGHT
end
end
else
case
when (:AOPERATIONID in (1,17)) then
case
when (((EAIMAIN.EXPORTACTITEMID = :AEXPORTACTITEMID) and (EAIMAIN.OPERATIONID in (1,17)))
or ((EAIMAIN.OPERATIONID in (22,64,65,70)) and (EAIMAIN.PARENTITEMID = :AEXPORTACTITEMID))) then
EAIMAIN.WEIGHT
when ((EAIMAIN.OPERATIONID in (5,17,1005)) and (EAIMAIN.WEIGHT > 0) and (EAIMAIN.PARENTITEMID = :AEXPORTACTITEMID)) then
-EAIMAIN.WEIGHT
end
when (:AOPERATIONID in (22,70)) then
case
when (EAIMAIN.EXPORTACTITEMID = :AEXPORTACTITEMID) then
-EAIMAIN.WEIGHT
when ((EAIV.PARENTITEMID = :APARENTITEMID) and (EAIMAIN.INVENTORYID = :AINVENTORYID) and (EAIMAIN.OPERATIONID = 5) and (EAIMAIN.WEIGHT < 0)) then
EAIMAIN.WEIGHT
end
end
end) TRANSPORTWEIGHT,
sum
(case
when (:AOPERATIONID in (1,17)) then
case
when (((EAIMAIN.EXPORTACTITEMID = :AEXPORTACTITEMID) and (EAIMAIN.OPERATIONID in (1,17)))
or ((EAIMAIN.OPERATIONID in (22,64,65,70))
and (EAIMAIN.PARENTITEMID = :AEXPORTACTITEMID))) then
EAIMAIN.TESTWEIGHT
when ((EAIMAIN.OPERATIONID in (5,17,1005)) and (EAIMAIN.TESTWEIGHT > 0)
and (EAIMAIN.PARENTITEMID = :AEXPORTACTITEMID)) then
-EAIMAIN.TESTWEIGHT
end
when (:AOPERATIONID in (22,70)) then
case
when (EAIMAIN.EXPORTACTITEMID = :AEXPORTACTITEMID) then
-EAIMAIN.TESTWEIGHT
when ((EAIV.PARENTITEMID = :APARENTITEMID) and (EAIMAIN.INVENTORYID = :AINVENTORYID)
and (EAIMAIN.OPERATIONID in (5)) and (EAIMAIN.TESTWEIGHT < 0)) then
EAIMAIN.TESTWEIGHT
end
end) TRANSPORTTESTWEIGHT,
sum
(case
when (:ISWEIGHT = 1) then
case
when ((:AOPERATIONID in (1,17)) and (EAIMAIN.PARENTITEMID = :AEXPORTACTITEMID) and (EAIMAIN.OPERATIONID in (5,1005))
and ((EA.ORDERITEMID = :AORDERITEMID) or ((EA.ORDERITEMID is null) and (EA.EXPORTACTID = :AEXPORTACTID)))) then
EAIMAIN.TESTWEIGHT
when ((:AOPERATIONID not in (1,17)) and (EAIV.PARENTITEMID = :APARENTITEMID) and (EAIMAIN.INVENTORYID = :AINVENTORYID)
and ((EA.ORDERITEMID = :AORDERITEMID) or ((EA.ORDERITEMID is null) and (EA.EXPORTACTID = :AEXPORTACTID)))
and (EAIMAIN.OPERATIONID = 5) and (EAIMAIN.WEIGHT < 0)) then
-EAIMAIN.TESTWEIGHT
end
else
case
when ((:AOPERATIONID in (1,17)) and (EAIMAIN.PARENTITEMID = :AEXPORTACTITEMID) and (EAIMAIN.OPERATIONID in (5,1005))
and ((EA.ORDERITEMID = :AORDERITEMID) or ((EA.ORDERITEMID is null) and (EA.EXPORTACTID = :AEXPORTACTID)))) then
EAIMAIN.WEIGHT
when ((:AOPERATIONID not in (1,17)) and (EAIV.PARENTITEMID = :APARENTITEMID) and (EAIMAIN.INVENTORYID = :AINVENTORYID)
and ((EA.ORDERITEMID = :AORDERITEMID) or ((EA.ORDERITEMID is null) and (EA.EXPORTACTID = :AEXPORTACTID)))
and (EAIMAIN.OPERATIONID = 5) and (EAIMAIN.WEIGHT < 0)) then
-EAIMAIN.WEIGHT
end
end) CUSTOMOUTNET
from EXPORTACTITEMS EAIMAIN
left join EXPORTACTS EA on (EA.EXPORTACTID = EAIMAIN.EXPORTACTID)
left join EXPORTACTITEMS_VIEW EAIV on (EAIV.EXPORTACTITEMID = EAIMAIN.PARENTITEMID)
where ((EAIMAIN.EXPORTACTITEMID = :AEXPORTACTITEMID) or (EAIMAIN.PARENTITEMID = :AEXPORTACTITEMID)
or (EAIMAIN.INVENTORYID = :AINVENTORYID))
and (EA.STATE >= 0)
and ((EA.STATE <> 10)
or ((EA.STATE = 10) and (EA.ORDERITEMID = :AORDERITEMID))
or ((EA.STATE = 10) and (EA.ORDERITEMID is null) and (EA.EXPORTACTID = :AEXPORTACTID)))
into :TRANSPORTWEIGHT, :TRANSPORTTESTWEIGHT, :CUSTOMOUTNET
do begin
suspend;
end
end