CalWin
  • Introduction
  • Code Snippets
  • Useful SQL statements
  • CalWin Script
    • Hardware Script
      • GetQty
      • DefineParts
      • WorkXXX
      • Script classes
        • TWorkWrapper
        • TFrameWrapper
        • TDividerWrapper
    • System script Events
      • OnAdjustStainLoad
      • OnAfterCalcItemRequirement
      • OnCalcPriceListAddition
      • OnCalcProductPurchaseDeliveryTime
      • OnCalcSalesHeaderAutoLineData
      • OnCalcSashLeadWeight
      • OnCheckFromSemiStock
      • OnCheckFromStock
      • OnCheckGlassFromStock
      • OnCheckProduct
      • OnCheckSalesheaderRules
      • OnCheckSaleslineDates
      • OnGetBatchGroup
      • OnGetClassification
      • OnGetDiscountGroup
      • OnGetElementProfile
      • OnGetLoadPoints
      • OnGetProductSourceAltParams
      • OnGetProductSourceParams
      • OnGetprofile (deprecated)
      • OnGetSaleslinesSourceParams
      • OnGetStockItemGroup
      • OnIncludeBottleneckLoad
      • OnIncludeCheckpoint
      • OnIsSpecialProduct
      • OnModifyEdgeList
      • OnModifyKickPlate
      • OnModifyVariants_Final
      • OnModifyVariants_Initial
      • OnSalesheaderPriceFinalization
      • OnSetElementJointType
      • OnSetSileDividersPos
      • OnSetTranMullDesignCode
      • OnSetTranMullDividersPos
      • Helper Procedure Repository
        • Loop ElementList
    • Machine Link
      • Machine Link Events
        • Initialize and Finalize
        • BeforeOptimization
        • PreParseMain_xxx
        • PostParseMain_xxx
        • ParseChild_xxx
        • BeforeOutput_xxx
      • How to use a search table in Machine Link
  • Brukerdokumentasjon (NOR)
    • Fullkostkalkyle
    • Bonus og markedsstøtte
    • CalWin enhet og faktor
    • Kalenderen
    • Budsjett
    • Eksport til Excel
    • Dokument-hÃ¥ndtering
  • Misc documentation
    • CalWin 64-bit Beta
    • CalWin E-Quote
    • CalWin WEB Dashboard
    • Oracle related
      • Oracle Database Server Requirements
      • Oracle DBA
        • Resize and rename data files
        • Arhivelog mode
        • LISTENER.ORA
        • Connection strings
        • Create Oracle user (schema) for CalWin
        • Create a database link
        • Password expiration
        • Add a Directory object
        • Show table space size
        • Recovery Area Space
        • ORA-00257 - not enough space in recovery file
    • CalWin Server
      • Legg til web certificate
Powered by GitBook
On this page
  • Example and syntax
  • Properties for the wrapper (TBeforeOptimizationRunScriptWrapper)
  • Properties for the individual items

Was this helpful?

  1. CalWin Script
  2. Machine Link
  3. Machine Link Events

BeforeOptimization

This events is called only when Optimization G2 is in use. It will be called before the profile selections dialog, and allows you to turn modify behavior and eventually turn off/on profiles.

Example and syntax

procedure BeforeOptimization(aWrapper: TBeforeOptimizationRunScriptWrapper);
var
  I: Integer;
  vItem: TBeforeOptimizationRunScriptWrapperItem;
  vIsWhite: boolean;
begin
  if aWrapper.Count = 0 then
  begin
    aWrapper.Aborted := True;
    exit;
  end;  

  vIsWhite := false;
  for I := 0 to aWrapper.Count-1 do
  begin
    vItem := aWrapper.GetItem(I);

    if IsWhiteColor(vItem.ColorCode) then
    begin
      vItem.IncludeStockBars := (gElumatecNo=1);
      vIsWhite := true;
    end;  
    
    //vItem.WastescoreProfileId := 0;
  end;
  
  aWrapper.DoUpdateProfileStocks := vIsWhite;
end;

Properties for the wrapper (TBeforeOptimizationRunScriptWrapper)

..
published
  property Count: Integer read GetCount;
  property Aborted: boolean read GetAborted write SetAborted;
  property DoUpdateProfileStocks: boolean read GetDoUpdateProfileStocks write SetDoUpdateProfileStocks;
  property ErrorList: TStrings read GetErrorList;
  property GroupKeyCaption: string read GetGroupKeyCaption;
  property HasColour: boolean read GetHasColour;
  property HasGrouping: boolean read GetHasGrouping;
  property LongestBar: TTenthOfAMillimeter read GetLongestBar;
  property MachineLinkErrorLIst: TStrings read GetMachineLinkErrorLIst;
  property RemainderHandlingMode: TRemainderHandlingMode read GetRemainderHandlingMode;
  property Test: boolean read GetTest;
  property UseScoreMap: Boolean read GetUseScoreMap;
end;
  ..

Properties for the individual items

These are available from aWrapper.GetItem(I)

..
published
  property ColorCode: string read GetColorCode;
  property Include: boolean read GetInclude write SetInclude;
  property GroupingCode: string read GetGroupingCode;
  property IncludeStockBars: boolean read GetIncludeStockBars write SetIncludeStockBars;
  property PiecesSumNetLength: TTenthOfAMillimeter read GetPiecesSumNetLength;
  property PiecesQty: Integer read GetPiecesQty;
  property PiecesSumGrossLength: TTenthOfAMillimeter read GetPiecesSumGrossLength;
 
  property BarLength: TTenthOfAMillimeter read GetBarLength;
  property CleanCut: TTenthOfAMillimeter read GetCleanCut write SetCleanCut;
  property Cutwaste: TTenthOfAMillimeter read GetCutwaste write SetCutwaste;
  property Description: string read GetDescription write SetDescription;
  property Itemnumber: string read GetItemnumber;
  property MinLength: TTenthOfAMillimeter read GetMinLength;
  property ProfileId: string read GetProfileId;
  property WastescoreProfileId: Integer read GetWastescoreProfileId write SetWastescoreProfileId;
end;
  ..
PreviousInitialize and FinalizeNextPreParseMain_xxx

Last updated 2 years ago

Was this helpful?