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

FORWARDER_WEIGHTALL

 

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

Параметр

Тип

Описание

AORDERID

INTEGER

 

AINVENTORYID

INTEGER

 

AOPERATIONID

INTEGER

 

AEXPORTACTITEMID

INTEGER

 

 

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

Параметр

Тип

Описание

TRANSPORTWEIGHT

BIGINT

 

CUSTOMOUTNET

BIGINT

 

CUSTOMWASTE

BIGINT

 

 

Описание

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

 

Определение

CREATE PROCEDURE FORWARDER_WEIGHTALL(
    AORDERID INTEGER,
    AINVENTORYID INTEGER,
    AOPERATIONID INTEGER,
    AEXPORTACTITEMID INTEGER)
RETURNS (
    TRANSPORTWEIGHT BIGINT,
    CUSTOMOUTNET BIGINT,
    CUSTOMWASTE BIGINT)
AS
BEGIN
  FOR
    select
      sum(case
            when EAIMain.OperationID in (1, 17) then
            case
              when EAIMain.ExportActItemID = :AExportActItemID
                  or (EAIMain.OperationID in (22,64,70))
              then EAIMain.Weight
              else -EAIMain.Weight
            end
          end)    as TransportWeight,
      sum(case
            when EAIMain.OperationID in (22, 64, 70)
            then -EAIMain.Weight
          end) SumWasteNet,
     sum(case
           when EAIMain.InventoryID = :AInventoryID
           then -EAIMain.Weight
         end) as CustomWaste
    from ExportActItems_View EAIMain
    where (EAIMain.ExportActItemID = :AExportActItemID -- сама запись
            or (EAIMain.ParentItemID = :AExportActItemID)) -- child
          and EAIMain.State >=0 -- учесть удаленные
          and EAIMain.State <> 10 -- не учитывать предварительные
          and EAIMAin.OperationID <> -64 -- не учит. общие пред. списания
          and not (EAIMAin.OperationID = 5 and EAIMAin.Weight < 0) -- не учит. отгруж. отходы
    INTO :TRANSPORTWEIGHT,
         :CUSTOMOUTNET,
         :CUSTOMWASTE
  DO
  BEGIN
    SUSPEND;
  END
END

 

     Previous topic Chapter index Next topic