InventDim inventDim;
InventJournalTrans journalTrans;
TmpImportInventJournal tableBuffer;
InventJournalTable inventJournal;
real lineNum = 1;
TmpImportInventJournal tmpTable; // tmpTable here is used to stored item counting data
InventJournalName inventJournalName;
NumberSeq numberSeq;
;
ttsbegin;
InventJournalTrans journalTrans;
TmpImportInventJournal tableBuffer;
InventJournalTable inventJournal;
real lineNum = 1;
TmpImportInventJournal tmpTable; // tmpTable here is used to stored item counting data
InventJournalName inventJournalName;
NumberSeq numberSeq;
;
ttsbegin;
select forupdate * from inventJournal
where inventJournal.JournalId == inventJournalId;
where inventJournal.JournalId == inventJournalId;
select firstonly inventJournalName
where inventJournalName.JournalNameId == InventParameters::find().CountJournalNameId;
numberSeq = NumberSeq::newGetVoucherFromCode(inventJournalName.VoucherSeqId);
where inventJournalName.JournalNameId == InventParameters::find().CountJournalNameId;
numberSeq = NumberSeq::newGetVoucherFromCode(inventJournalName.VoucherSeqId);
while select * from tmpTable
{
inventDim.clear();
journalTrans.clear();
inventDim.initValue();
inventDim.configId = tmpTable.configId;
inventDim.inventBatchId = tmpTable.inventBatchId;
inventDim.InventLocationId = tmpTable.InventLocationId;
inventDim.inventSerialId = tmpTable.inventSerialId;
inventDim.InventSiteId = tmpTable.InventSiteId;
inventDim.wMSLocationId = tmpTable.wMSLocationId;
{
inventDim.clear();
journalTrans.clear();
inventDim.initValue();
inventDim.configId = tmpTable.configId;
inventDim.inventBatchId = tmpTable.inventBatchId;
inventDim.InventLocationId = tmpTable.InventLocationId;
inventDim.inventSerialId = tmpTable.inventSerialId;
inventDim.InventSiteId = tmpTable.InventSiteId;
inventDim.wMSLocationId = tmpTable.wMSLocationId;
inventDim = InventDim::findOrCreate(inventDim);
journalTrans.Voucher = numberSeq.voucher();
journalTrans.initValue();
journalTrans.initFromInventJournalTable(inventJournal);
journalTrans.LineNum = lineNum;
journalTrans.JournalType = inventJournal.JournalType;
journalTrans.TransDate = tmpTable.TransDate;
journalTrans.initValue();
journalTrans.initFromInventJournalTable(inventJournal);
journalTrans.LineNum = lineNum;
journalTrans.JournalType = inventJournal.JournalType;
journalTrans.TransDate = tmpTable.TransDate;
journalTrans.ItemId = tmpTable.ItemId;
journalTrans.initFromInventTable(InventTable::find(tmpTable.ItemId));
journalTrans.initFromInventTable(InventTable::find(tmpTable.ItemId));
journalTrans.Counted = tmpTable.Counted;
Try replacing the statement journalTrans.Counted = tmpTable.Counted with:
//
journalTrans.Counted = tmpTable.Counted;
journalTrans.InventOnHand = InventSumDatePhysicalDim::onHandQty(countDate, itemId, inventDim,tmpInventDimParm);
//
//
journalTrans.Counted = tmpTable.Counted;
journalTrans.InventOnHand = InventSumDatePhysicalDim::onHandQty(countDate, itemId, inventDim,tmpInventDimParm);
//
journalTrans.InventDimId = inventDim.inventDimId;
if (journalTrans.validateWrite())
{
JournalTrans.insert(NoYes::Yes);
JournalTrans.inventMovement().journalSetCounted();
JournalTrans.update();
JournalTrans.insert(NoYes::Yes);
JournalTrans.inventMovement().journalSetCounted();
JournalTrans.update();
}
//
//
lineNum ++;
}
}
inventJournal.NumOfLines = lineNum -1;
inventJournal.update();
inventJournal.update();
tmpTable.clear();
delete_from tmpTable;
delete_from tmpTable;
ttscommit;
Nessun commento:
Posta un commento