zoukankan      html  css  js  c++  java
  • When you are finished renamed the Item number Jobs

    When you are finished renamed the Item number, you must record original Item number, related configure  and so on!

     

    static void Jimmy_ItemRenamedAfterUpdate(Args _args)
    {
        InventTableCompany      ITCompany,delITCompany;
        InventTable             IT,ITUpdateOrg;
        ConfigTable             ConfigTable;
        InventDimCombination    Combination;
        Dialog                  dlg     = new Dialog("updated to comoany Items infomation");
        DialogField             dlgItem = dlg.addField(types::String,'after rename Items:',"Format such as :Items + ',' + Items + ','  + items");
        ListEnumerator          le;
        ItemId                  ItemConfig;
        InventTrans             InventTrans;
        int                     ITCompanys,Combinations,NoConfig;
    
        SysDataBaseLog          SysDataBaseLog;
        Container               Con;
        fieldId                 fieldId;
        List                    datalist;
        ListEnumerator          enumerator;
    ;
        dlgItem.displayHeight(20);
        dlgItem.displayLength(50);
        dlg.doInit();
        if(!dlg.run())
            return ;
    
        le = global::strSplit(dlgItem.value(),',').getEnumerator();
        while (le.moveNext())
        {
    
            ttsbegin;
            ITUpdateOrg = InventTable::find(le.current(),true);
            if(ITUpdateOrg)
            {
                select firstonly SysDataBaseLog
                        where SysDataBaseLog.table == tablenum(InventTable)
                        && SysDataBaseLog.LogType == DatabaseLogType::RenameKey
                        && SysDataBaseLog.Description like ITUpdateOrg.ItemId + '*';
                if(SysDataBaseLog)
                {
                    datalist = SysDataBaseLog.getDataAslist();
                    enumerator = datalist.getEnumerator();
                    while (enumerator.moveNext())
                    {
                        Con          = enumerator.current();
                        fieldId      = conpeek(Con, 1);
                        ITUpdateOrg.OrgItemId = sysdatabaselog.contents2Str(conpeek(Con, 3), fieldId);
                        break;
                    }
                }
                if(!ITUpdateOrg.OrgItemId)
                    ITUpdateOrg.OrgItemId = ITUpdateOrg.ItemId;
                ITUpdateOrg.Update();
            }
            ttscommit;
    
            select firstonly forupdate IT where IT.ItemId == le.current();
            if(IT)
            {
                /*
                select firstonly InventTrans where InventTrans.ItemId == le.current();
                if(InventTrans)
                    throw Error(StrFmt("The ItemId %1 Exists InventTrans,do not rename of Items!",le.current()));
                */
                select firstonly ConfigTable where ConfigTable.ItemId == IT.ItemId;
                //Have Configuration
                ItemConfig = '';
                if(ConfigTable)
                {
                    ConfigTable.clear();
    
                    while select ConfigTable where ConfigTable.ItemId == IT.ItemId
                    {
                        ItemConfig = IT.ItemId + '_' + ConfigTable.ConfigId;
    
                        ttsbegin;
                        select firstonly forupdate ITCompany where ITCompany.ItemId == ItemConfig;
                        if(!ITCompany)
                        {
                            ITCompany.initValue();
                            ITCompany.ItemId        = ItemConfig;
                            ITCompany.Name          = IT.itemName;
                            ITCompany.OrgItemId     = IT.OrgItemId;
                            ITCompany.NormalItemId  = IT.ItemId;
    
                            ITCompany.insert();
                            ITCompanys++;
                        }
                        else
                        {
                            ITCompany.ItemId        = ItemConfig;
                            ITCompany.Name          = IT.itemName;
                            ITCompany.OrgItemId     = IT.OrgItemId;
                            ITCompany.NormalItemId  = IT.ItemId;
                            ITCompany.update();
                        }
                        ttscommit;
    
                        ttsbegin;
                        delete_from delITCompany where delITCompany.ItemId == IT.OrgItemId + '_' + ConfigTable.ConfigId
                            && delITCompany.OrgItemId == '' && delITCompany.NormalItemId == '';
    
                        ttscommit;
    
                        ttsbegin;
                        select firstonly forupdate Combination
                            where Combination.ItemId == ConfigTable.ItemId
                            &&    Combination.ConfigId == ConfigTable.ConfigId;
                        if(Combination)
                        {
                            Combination.ItemIdCompany = ItemConfig;
                            Combination.update();
                            Combinations++;
                        }
                        ttscommit;
                    }
                }
                else //Have not Configuration
                {
                    ttsbegin;
                    select firstonly forupdate ITCompany where ITCompany.ItemId == IT.ItemId;
                    if(!ITCompany)
                    {
                        ITCompany.initValue();
                        ITCompany.ItemId        = IT.ItemId;
                        ITCompany.Name          = IT.itemName;
                        ITCompany.OrgItemId     = IT.OrgItemId;
                        ITCompany.NormalItemId  = IT.ItemId;
                        ITCompany.insert();
                    }
                    else
                    {
                        ITCompany.ItemId        = IT.ItemId;
                        ITCompany.Name          = IT.itemName;
                        ITCompany.OrgItemId     = IT.OrgItemId;
                        ITCompany.NormalItemId  = IT.ItemId;
                        ITCompany.update();
                    }
                    ttscommit;
                    ttsbegin;
                    IT.ItemIdCompany = it.ItemId;
                    IT.update();
                    ttscommit;
                    NoConfig ++;
                    info(IT.ItemId);
    
                }
            }
            ELSE
               info("Not exists Item detail " + le.current());
        }
        info(strfmt("NoConfig : %1,Combinations : %2,ITCompanys : %3",NoConfig,Combinations,ITCompanys));
    }
    
  • 相关阅读:
    云主机上搭建squid3代理服务器
    常见问题集锦
    [DFNews] Guidance推出EnCase v7.06以及EnCase Imager 7.06
    [计算机取证] JumpLists file names and AppID calculator
    [eDiscovery] The Longterm Preservation of Digital Evidence
    [DFNews] GSI发布EnCase v7.07
    [DFNews] eDEC发布“狼蛛”2.0手机取证系统
    [手机取证] CelleBrite Android Lock Bypass
    [DFNews] CelleBrite发布可视化关联分析软件Link Analysis 1.7
    [DFNews] EnCE认证变化,v6认证及相关课程即将取消
  • 原文地址:https://www.cnblogs.com/Fandyx/p/2105403.html
Copyright © 2011-2022 走看看