22 Aralık 2011 Perşembe

AXAPTA stok transfer günlüğü

Normalde formla çalışırken InventJournalName'yi seçiyoruz ve parametreler otomatik geliyor. Burda bu işlemi kendimiz yapıyoruz:

    InventJournalTrans  inventJournalTrans;
    InventJournalTable  inventJournalTable;
    InventJournalName   inventJournalName;
    InventDim toInventDim;
    InventDim tempInventDimTo;
    ;
    // Journal Header işle
    inventJournalName   = "MyJournalName"
    inventJournalTable.initValue();
    inventJournalTable.JournalId        = NumberSeq::newGetNum(InventParameters::numRefInventJournalId()).num();
    inventJournalTable.Description      = InventJournalName.Description;
    inventJournalTable.Reservation      = ItemReservation::Automatic;
    inventJournalTable.JournalType      = inventJournalType::Transfer;

    inventJournalTable.BlockUserGroupId     = inventJournalName.BlockUserGroupId;
    inventJournalTable.JournalNameId        = inventJournalName.JournalNameId;
    inventJournalTable.ApprUserGroup        = inventJournalName.ApprUserGroup;
    inventJournalTable.ApprFromSiteId       = inventJournalName.ApprFromSiteId;
    inventJournalTable.ApprFromLocationId   = inventJournalName.ApprFromLocationId;
    inventJournalTable.ApprFromWMSLocationId= inventJournalName.ApprFromWMSLocationId;
    inventJournalTable.ApprFromBatchId      = inventJournalName.ApprFromBatchId;
    inventJournalTable.ApprToSiteId         = inventJournalName.ApprToSiteId;
    inventJournalTable.ApprToLocationId     = inventJournalName.ApprToLocationId;
    inventJournalTable.ApprToWMSLocationId  = inventJournalName.ApprToWMSLocationId;
    inventJournalTable.ApprToBatchId        = inventJournalName.ApprToBatchId;
    inventJournalTable.VoucherSeqId         = inventJournalName.VoucherSeqId;

    inventJournalTable.insert();
toInventDim.clear();
toInventDim.initValue();
toInventDim.wMSLocationId = inventJournalName.ApprtoWMSLocationId;
toInventDim.InventLocationId = inventJournalName.ApprtoLocationId;
toInventDim.InventSiteId      = inventJournalName.ApprtoSiteId;

tempInventDimTo.clear();
tempInventDimTo = InventDim::findOrCreate(toInventDim);
    // journal lines işle
    inventJournalTrans.initValue();
    inventjournaltrans.initFromInventJournalTable(inventJournalTable);
    inventJournalTrans.Voucher      = NumberSeq::newGetNum(InventParameters::numRefInventJournalVoucherId()).num();
    inventJournalTrans.ItemId       = "MyItem001";
    InventJournalTrans.initFromInventTable(Inventtable::find(InventJournalTrans.ItemId));
    inventJournalTrans.TransDate    = systemDateGet();
    inventJournalTrans.Qty          = -1;
    inventJournalTrans.InventDimId = tempInventDimto.inventDimId;
    // rezervasyon kontrolü
    if (!InventMoveMent::setAutoReserving(InventJournalTrans))
    {
        inventJournalTable.delete();
        return;
    }
    inventJournalTrans.insert();

Hiç yorum yok:

Yorum Gönderme