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

FORWARDER_WEIGHTITEM_INVENTORY

 

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

Параметр

Тип

Описание

PARENTACTID

INTEGER

 

AEXPORTACTITEMID

INTEGER

 

AEXPORTACTID

INTEGER

 

 

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

Параметр

Тип

Описание

INCOMEWEIGHT

BIGINT

 

OUTCOMEWEIGHT

BIGINT

 

RESTWEIGHT

BIGINT

 

INV_WEIGHT

BIGINT

 

 

Описание

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

 

Определение

CREATE PROCEDURE FORWARDER_WEIGHTITEM_INVENTORY(
    PARENTACTID INTEGER,
    AEXPORTACTITEMID INTEGER,
    AEXPORTACTID INTEGER)
RETURNS (
    INCOMEWEIGHT BIGINT,
    OUTCOMEWEIGHT BIGINT,
    RESTWEIGHT BIGINT,
    INV_WEIGHT BIGINT)
AS
begin
  for
    select
        sum(case
              when (((EAIM.OPERATIONID in (1,17)) and (EAIM.EXPORTACTITEMID = :AEXPORTACTITEMID)) and (EAIM.EXPORTACTID = :AEXPORTACTID)) then
                EAIM.WEIGHT
            end) INCOMEWEIGHT,
        sum(case
              when ((EAIM.PARENTITEMID = :AEXPORTACTITEMID) and (EAIM.OPERATIONID in (17,5))) then
                EAIM.WEIGHT
              when ((EAIM.PARENTITEMID = :AEXPORTACTITEMID) and (EAIM.OPERATIONID in (22,64,65,70))) then
                -EAIM.WEIGHT
            end) OUTCOMEWEIGHT,
        sum(case
              when (((EAIM.OPERATIONID in (1,17)) and (EAIM.EXPORTACTITEMID = :AEXPORTACTITEMID)) and (EAIM.EXPORTACTID = :AEXPORTACTID)) then
                EAIM.WEIGHT
              when ((EAIM.PARENTITEMID = :AEXPORTACTITEMID) and (EAIM.OPERATIONID in (17,5))) then
                -EAIM.WEIGHT
              when ((EAIM.PARENTITEMID = :AEXPORTACTITEMID) and (EAIM.OPERATIONID in (22,64,65,70))) then
                EAIM.WEIGHT
            end) RESTWEIGHT,
        sum(case
              when (((EAIM.OPERATIONID = 5) and (EAIM.PARENTITEMID = :AEXPORTACTITEMID)) and (EAIM.EXPORTACTID = :PARENTACTID)) then
                EAIM.WEIGHT
            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, :INV_WEIGHT
  do begin
    suspend;
  end
end

 

     Previous topic Chapter index Next topic