zoukankan      html  css  js  c++  java
  • AX2009创建采购订单

    经常要用代码创建采购和销售订单,需要弄清楚哪些字段是必输的,这段代码经常需要拷贝,放在这里做个备份。
    static void CreatePurchDirectly(Args _args)
    {
        PurchTable  purchTable;
        PurchLine   purchLine;
        InventDim   inventDim;
        ;
        ttsbegin;
        
    //PurchTable
            
    //PurchId
        purchTable.PurchId          =    NumberSeq::newGetNum(PurchParameters::numRefPurchId()).num();
          purchTble.PurchaseType   =    PurchaseType::Purch;
        purchTable.initValue();
        
    //Vend Account
        purchTable.initFromVendTable(VendTable::find('3000'));
        purchTable.insert();
        
    //PurchLine
        purchLine.initFromPurchTable(purchTable);
            
    //ItemId
        purchLine.ItemId                = 'B-pack1';
        purchLine.initFromInventTable(InventTable::find(
    'B-pack1'));
            
    //Qty
        purchLine.PurchQty              = 100;
        purchLine.QtyOrdered            
    = 100;
        purchLine.RemainInventPhysical  
    = 100;
        purchLine.RemainPurchPhysical   
    = 100;
            
    //InventDim     Maybe should add some other dimensions.
        inventDim.InventLocationId      = 'GW';
        purchLine.InventDimId           
    = InventDim::findOrCreate(inventDim).inventDimId;
        purchLine.insert();
        ttscommit;



    }

    static void CreatePurchTableThroughAxPurch(Args _args)
    {
        AxPurchTable            axPurchTable    
    = new AxPurchTable();
        AxPurchLine             axPurchLine     
    = new AxPurchLine();
        AxInventDim_PurchLine   axInventDim     
    = new AxInventDim_PurchLine();
        ;
        
    //PurchTable
            
    //Order Account
        axPurchTable.parmOrderAccount("3000");
        axPurchTable.save();

        
    //PurchLine
            
    //PurchId
        axPurchLine.axPurchTable(axPurchTable);
            
    //ItemId
        axPurchLine.parmItemId("B-pack1");
            
    //Qty
        axPurchLine.parmPurchQty(100);

            
    //InventDim  Maybe should add some other dimensions
        axInventDim.axPurchLine(axPurchLine);
        axInventDim.parmInventLocationId(
    'MW');
        axPurchLine.axInventDim(axInventDim);

        axPurchLine.save();

    }
  • 相关阅读:
    React开发实时聊天招聘工具 -第六章 登陆注册(2)
    React开发实时聊天招聘工具 -第六章 登陆注册(1)
    温习 socket http tcp
    高阶组件简介
    计算机组成原理(7)——输入、输出系统
    计算机组成原理(6)——总线
    计算机组成原理(5)——中央处理器
    计算机组成原理(4)——指令系统
    计算机组成原理(3)——存储层次结构
    计算机组成原理(2)——数据的表示与运算
  • 原文地址:https://www.cnblogs.com/dingkui/p/2630972.html
Copyright © 2011-2022 走看看