Procedura-PLMPrintPiecelist

Popis:
Slouží pro tisk stromu kusovníků

Parametry:

NázevPopisDatový typ
inpiecelist_idChar(10)
inquantityNumeric(15, 6)
inlevelInteger
inpathplInteger

Návratové hodnoty:

NázevPopisDatový typ
storecard_idChar(10)
posindexInteger
quantityNumeric(15, 6)
unitrateNumeric(15, 3)
qunitVarChar(5)
issueInteger
outlevelInteger
overallquantityNumeric(15, 6)
plmpiecelist2_idChar(10)
pathplInteger

Tělo:

BEGIN
  if (inlevel is Null) then
    inlevel = 0;
  inlevel = inlevel + 1;
  if (InPathPL is Null) then
    inPathPL = 0;
  if (INPIECELIST_ID is not Null) then begin
    FOR
      SELECT 
        PPL2.StoreCard_ID, 
        PPL2.POSINDEX, 
        PPL2.Quantity * (CAST(1 AS Float) + (CAST(PPL2.WastePercentage as Numeric(15,6)) / CAST(100 as Float))), 
        PPL2.unitrate, 
        PPL2.QUnit, 
        PPL2.issue, 
        PPL2.Quantity * :InQuantity * (CAST(1 AS Float) + (CAST(PPL2.WastePercentage as Numeric(15,6)) / CAST(100 as Float))), 
        PPL2.ID
      FROM PLMPieceLists2 PPL2
      WHERE PPL2.Parent_ID = :INPIECELIST_ID
      order by PPL2.PosIndex
      INTO :StoreCard_ID, :POSINDEX, :Quantity, :unitrate, :QUnit, :issue, :Overallquantity, :PLMPIECELIST2_ID
    DO BEGIN
      outlevel = inlevel;
      inPathPL = inPathPL + 1;
      PathPL = inPathPL;
      SUSPEND;
      pl_id = null;
      Select PPL.id from Plmpiecelists PPL Where PPL.storecard_id = :storecard_id and PPL.Revided_id is null into :PL_ID;
      if (pl_id is not null) then
        FOR
          SELECT 
            PPPL.StoreCard_ID, 
            PPPL.POSINDEX, 
            PPPL.Quantity, 
            PPPL.unitrate, 
            PPPL.QUnit, 
            PPPL.issue, 
            PPPL.outlevel, 
            PPPL.overallquantity, 
            PPPL.PLMPIECELIST2_ID, 
            PPPL.PathPL
          FROM PLMPRINTPieceList(:PL_ID, :OverallQuantity, :outlevel, :PathPL) PPPL
          INTO :StoreCard_ID, :POSINDEX, :Quantity, :unitrate, :QUnit, :issue, :outlevel, :overallquantity, :PLMPIECELIST2_ID, :PathPL
        DO BEGIN
          inPathPL = inPathPL + 1;
          PathPL = inPathPL;
          SUSPEND;
        END
    END
  end
END;

Generated by ABRA Software a.s. 27.10.2021 16:34:50