static void CreateTransferJournal(Args _args)
{
InventJournalTable journalTable;
InventJournalTableData journalTableData;
InventJournalTrans inventJournalTrans;
InventDim toInventDim;
;
journalTable.clear();
journalTable.JournalNameId = 'ITrf';
journalTableData = JournalTableData::newTable(journalTable);
journalTable.JournalId = journalTableData.nextJournalId();
journalTable.Reservation = ItemReservation::Automatic;
journalTable.JournalType = InventJournalType::Transfer;
journalTableData.initFromJournalName(journalTableData.JournalStatic().findJournalName(journalTable.journalNameId));
journalTable.Description = 'Automatic Transfer Journal';
journalTable.insert();
inventJournalTrans.clear();
inventJournalTrans.JournalId = journalTable.JournalId;
inventJournalTrans.JournalType = InventJournalType::Transfer;
inventJournalTrans.TransDate = systemdateget();
inventJournalTrans.ItemId = 'P0001';
inventJournalTrans.Qty = 1;
// Dimensions from which the transfer performs
inventJournalTrans.InventDimId = '000031';
inventJournalTrans.initFromInventTable(InventTable::find(inventJournalTrans.ItemId), False, False);
// Dimensions To which the transfer performs
toInventDim.inventSiteId = '2';
toInventDim.InventLocationId = '21';
inventJournalTrans.ToInventDimId = InventDim::findOrCreate(toInventDim).inventDimId;
inventJournalTrans.insert();
}
{
InventJournalTable journalTable;
InventJournalTableData journalTableData;
InventJournalTrans inventJournalTrans;
InventDim toInventDim;
;
journalTable.clear();
journalTable.JournalNameId = 'ITrf';
journalTableData = JournalTableData::newTable(journalTable);
journalTable.JournalId = journalTableData.nextJournalId();
journalTable.Reservation = ItemReservation::Automatic;
journalTable.JournalType = InventJournalType::Transfer;
journalTableData.initFromJournalName(journalTableData.JournalStatic().findJournalName(journalTable.journalNameId));
journalTable.Description = 'Automatic Transfer Journal';
journalTable.insert();
inventJournalTrans.clear();
inventJournalTrans.JournalId = journalTable.JournalId;
inventJournalTrans.JournalType = InventJournalType::Transfer;
inventJournalTrans.TransDate = systemdateget();
inventJournalTrans.ItemId = 'P0001';
inventJournalTrans.Qty = 1;
// Dimensions from which the transfer performs
inventJournalTrans.InventDimId = '000031';
inventJournalTrans.initFromInventTable(InventTable::find(inventJournalTrans.ItemId), False, False);
// Dimensions To which the transfer performs
toInventDim.inventSiteId = '2';
toInventDim.InventLocationId = '21';
inventJournalTrans.ToInventDimId = InventDim::findOrCreate(toInventDim).inventDimId;
inventJournalTrans.insert();
}
No comments:
Post a Comment