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;
}
No comments:
Post a Comment