将xpo分成多个xpo文件

时间:2015-02-08 20:51:38

标签: axapta dynamics-ax-2012

是否有工具允许将xpo文件拆分为多个xpo文件?与CombineXPOs完全相反。

我之所以提出这个问题是因为我需要将多个单个xpo / models版本放入源控件中,我希望每次都不要先导入它们,因为这太费时了。

1 个答案:

答案 0 :(得分:3)

在理解之后,我想更多你想要的东西。这是一份工作,几乎可以为您提供如何做您想做的大部分示例。

请注意需要完成的TODO's

static void JobImportXPOs(Args _args)
{
    SysVersionControlSystem vcs = versionControl.parmSysVersionControlSystem();
    SysImportElements       sysImportElements   = new SysImportElements();
    TmpAotImport            tmpAotImport;
    Filename                fileName = @"C:\Temp\testXPO.xpo";
    SysVersionControllable  controllable;
    TreeNode                treeNode;

    sysImportElements.newFile(fileName);
    sysImportElements.parmAddToProject(false);
    sysImportElements.parmImportAot(true);

    tmpAotImport = sysImportElements.getTmpImportAot();

    while select tmpAotImport
    {
        treeNode = TreeNode::findNode(tmpAotImport.TreeNodePath);

        if (!treeNode)
        {
            // New object being added to AX
            // TODO - Remember this object and add this to VCS system at the end for check-in
            continue;
        }

        controllable = SysTreeNode::newTreeNode(treeNode);

        if (!controllable)
        {
            error(strFmt("Error processing %1 (%2) from file %3", tmpAotImport.TreeNodeName, tmpAotImport.TreeNodePath, Filename));
            continue;
        }

        if (vcs.allowCreate(controllable))
        {
            info(strFmt("Planning to add to VCS %1 for import", tmpAotImport.TreeNodePath));
            // TODO - Remember to add this to VCS at the end of the import
        }
        else if (vcs.allowCheckOut(controllable))
        {
            info(strFmt("Checking out %1 for import", tmpAotImport.TreeNodePath));
            // TODO - Remember to check this specific object back in at the end of the import
        }
    }

    // Do the actual import
    sysImportElements.import();

    // TODO - Check in all of the objects we just handled

    info("Done");
}