陈清红
2025-04-14 880f3c0257eeb8c37761d484258fdd102a369a19
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Quintiq file version 2.0
#parent: #root
Method EditKBBranch (
  String kbname,
  String branchname
) id:Method_ApplicationLibMacroPlanner_EditKBBranch_1
{
  #keys: '[11660.0.1765215333]'
  Body:
  [*
    //Edit a kb branch without active dataset
    editor := CKBEditor::Create();
    kbidset := editor.GetKBs();
    kbid := select( kbidset, Elements, e, true, e.Name() = kbname );
    
    kbfullidset := editor.GetKBStructure( kbid );
    kbfullid := maxselect( kbfullidset, Elements.KBFullID, e, e.Branch() = branchname, e.ChangeNr() );
    
    ckb := editor.LoadKB( kbfullid );
    dlg := construct( dlgKnowledgeBaseEditorNoMDS );
    dlg.EditKnowledgeBase( ckb, this );
    
    // BUG: Edit KB -> Scenario manager -> make changes -> Save & close -> Cancel
    // The above will leave the user stuck with a locked KB
    // Issue traced to standard Quintiq dialog dlgKnowledgeBaseEditorNoMDS, method ApplyData
    // Workaround while R&D fixes this
    editor.ForceUnlockKB( kbfullid );
  *]
}