public void revSequenceByOne(ItemGroupId _groupId)
{
NumberSequenceTable numberSeqTableRev,numberSeqLastRec;
InventItemGroup invItemGroup;
str autonumber;
ttsBegin;
invItemGroup = InventItemGroup::find(_groupId);
if (invItemGroup && invItemGroup.NumberSequenceCode)
{
autonumber = invItemGroup.NumberSequenceCode;
numberSeqTableRev = NumberSequenceTable::findByNaturalKey(autonumber);
select forUpdate firstOnly numberSeqLastRec
where numberSeqLastRec.RecId == numberSeqTableRev.RecId;
if (numberSeqLastRec.RecId && numberSeqLastRec.NextRec != 1)
{
numberSeqLastRec.NextRec -= 1;
numberSeqLastRec.update();
}
}
ttsCommit;
}
{
NumberSequenceTable numberSeqTableRev,numberSeqLastRec;
InventItemGroup invItemGroup;
str autonumber;
ttsBegin;
invItemGroup = InventItemGroup::find(_groupId);
if (invItemGroup && invItemGroup.NumberSequenceCode)
{
autonumber = invItemGroup.NumberSequenceCode;
numberSeqTableRev = NumberSequenceTable::findByNaturalKey(autonumber);
select forUpdate firstOnly numberSeqLastRec
where numberSeqLastRec.RecId == numberSeqTableRev.RecId;
if (numberSeqLastRec.RecId && numberSeqLastRec.NextRec != 1)
{
numberSeqLastRec.NextRec -= 1;
numberSeqLastRec.update();
}
}
ttsCommit;
}
Single line code: NumberSeq::releaseNumber(REMParameters::numElvAccessId().NumberSequenceId, sel);
ReplyDelete//sel is Num seq regeneration such as sel = NumberSeq::newGetNum(REMParameters::numElvAccessId()).num();*/
thanks dude
ReplyDelete