码迷,mamicode.com
首页 > 其他好文 > 详细

AX_CreateAndPostPurch

时间:2017-09-14 16:53:19      阅读:120      评论:0      收藏:0      [点我收藏+]

标签:virtual   let   emd   enum   rgs   mda   min   ack   system   

static void CreateAndPostPurch(Args _args)
{
    List                            il = new List(Types::Record);
    DocumentNum                     DocumentNum;
    TmpFrmVirtual                   TmpFrmVirtual;
    PurchLine                       localPurchLine;
    PurchTable                      localPurchTable;
    VendPackingSlipJour             ventPackingSlipJour;
    PurchFormLetter_PackingSlip     purchFormLetter_PackintSlip = PurchFormLetter::construct(DocumentStatus::PackingSlip);
    PurchFormLetter_PackingSlip     purchFormLetter_Invoice = PurchFormLetter::construct(DocumentStatus::Invoice);
    ;

    ttsbegin;
    localPurchTable.clear();
    localPurchTable.initValue();
    localPurchTable.PurchId = NumberSeq::newGetNumFromCode("PONUM").num();
    localPurchTable.initFromVendTable(VendTable::find("V-00001"));
    localPurchTable.PurchaseType = PurchaseType::Purch;
    localPurchTable.CurrencyCode = "RMB";
    localPurchTable.PurchPoolId = "NOR";
    localPurchTable.DeliveryDate = systemdateget();
    localPurchTable.insert();

    localPurchLine.clear();
    localPurchLine.initValue();
    localPurchLine.initFromPurchTable(localPurchTable);
    localPurchLine.ItemId                   = "100XA00125";
    localPurchLine.initFromInventTable(InventTable::find(localPurchLine.ItemId));
    localPurchLine.PurchQty                 = 1;
    localPurchLine.PurchUnit                = InventTableModule::find(localPurchLine.ItemId,ModuleInventPurchSales::Invent).UnitId;
    localPurchLine.THK_2ndPurchQty          = 0;
    localPurchLine.THK_2ndPurchUnit         = InventTableModule::find(localPurchLine.ItemId,ModuleInventPurchSales::Invent).THK_2ndUnit;
    localPurchLine.PurchPrice               = 1;
    localPurchLine.LineAmount               = localPurchLine.calcLineAmount();
    localPurchLine.THK_2ndQtyOrdered        = localPurchLine.THK_2ndcalcQtyOrdered();
    localPurchLine.QtyOrdered               = localPurchLine.calcQtyOrdered();
    localPurchLine.DeliveryDate             = systemdateget();
    localPurchLine.InventDimId              = "T00309533";
    localPurchLine.createLine();

    info(strfmt("@SYS82024", localPurchTable.PurchId),‘‘, SysInfoAction_TableField::newBuffer(localPurchTable));

    if(localPurchTable)
    {
        DocumentNum = NumberSeq::newGetNumFromCode("POPS").num();
        purchFormLetter_PackintSlip.update(localPurchTable,
                               DocumentNum,
                               systemDateGet(),
                               PurchUpdate::All,
                               AccountOrder::Account,
                               NoYes::No,
                               NoYes::No,
                               false,
                               noYes::Yes);
    }

    while select ventPackingSlipJour
        where ventPackingSlipJour.PurchId == localPurchTable.PurchId
    {
        tmpFrmVirtual.clear();
        tmpFrmVirtual.TableNum = tableNum(VendPackingSlipJour);
        tmpFrmVirtual.RecordNo = ventPackingSlipJour.recid;
        tmpFrmVirtual.insert();
        il.addEnd(tmpFrmVirtual);
    }
    purchFormLetter_Invoice.update(localPurchTable,
                           NumberSeq::newGetNumFromCode("POINV").num(),
                           systemDateGet(),
                           PurchUpdate::All,
                           AccountOrder::Account,
                           NoYes::No,
                           NoYes::No,
                           false,
                           noYes::Yes,
                           il.pack());

    ttscommit;
}

 

AX_CreateAndPostPurch

标签:virtual   let   emd   enum   rgs   mda   min   ack   system   

原文地址:http://www.cnblogs.com/zoao/p/7520716.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!