zoaoo

博客园 首页 新随笔 联系 订阅 管理
static void Job649(Args _args) 
{ 
    ItemId                  ItemId          "000XA00612R1"; 
    InventDimId             InventDimId     "K00811600"; 
    InventQty               qty             5; 
    InventQty               physicalQty; 
 
    NumberSeq               numberSeq; 
    InventJournalVoucherId  voucherId; 
    InventTransId           InventTransId; 
     
    InventUpd_Financial     financial; 
    InventMov_Vir_Counting  movement; 
 
    TransactionTxt          transactionTxt; 
 
    LedgerVoucher           ledgerVoucher; 
    LedgerVoucherObject     ledgerVoucherObject; 
     
    THK_2ndInventQty        THK_2ndqty; 
    CostAmount calcCostAmount() 
    { 
        InventPriceMap      inventPriceMap      = InventTable::find(ItemId).inventCostPriceMap(InventDimId); 
        ; 
        return PriceDisc::price2Amount(inventPriceMap.price(), 
                                       inventPriceMap.priceUnit(), 
                                       0, 
                                       qty, 
                                       qty, 
                                       inventPriceMap.markup(), 
                                       0, 
                                       '', 
                                       0); 
    } 
    ; 
    physicalQty = InventSum::find(ItemId,InventDimId).PhysicalInvent; 
    qty = qty - physicalQty; 
    if (qty != 0) 
    { 
        if (!InventTransId) 
        { 
            InventTransId = NumberSeq::newGetNum(InventParameters::numRefInventTransId()).num(); 
        } 
         
        numberSeq = NumberSeq::newGetNum(InventParameters::numRefInventJournalVoucherId()); 
         
        voucherId = numberSeq.num(); 
 
        transactionTxt   new TransactionTxt(); 
        transactionTxt.setType(LedgerTransTxt::InventJournalCount); 
        transactionTxt.setDate(systemdateget()); 
        transactionTxt.setVoucher(voucherId); 
         
        ledgerVoucher = LedgerVoucher::newLedgerPost(DetailSummary::Summary, 
                                                    SysModule::Invent, 
                                                    numberSeq.parmVoucherSequenceCode()); 
        ledgerVoucherObject = LedgerVoucherObject::newVoucher(voucherId, 
                                                              systemdateget(), 
                                                              SysModule::Invent, 
                                                              LedgerTransType::Invent); 
        ledgerVoucherObject.lastTransTxt(transactionTxt.txt()); 
        ledgerVoucher.addVoucher(ledgerVoucherObject); 
 
        movement = InventMov_Vir_Counting::newParameters( 
            InventTransId, 
            ItemId, 
            InventDimId, 
            systemdateget(), 
            qty, 
            THK_2ndqty); 
             
        financial = InventUpd_Financial::newVirtuelCounting(movement, ledgerVoucher, abs(calcCostAmount()) * movement.transSign()); 
        financial.updateNow(); 
    } 
}

 

posted on 2017-04-25 15:13  zoaoo  阅读(175)  评论(0编辑  收藏  举报