Heaving error:
Cannot create a record in Customer transaction identifiers (CustTransIdRef). Transaction identifier: GLRT-112649, Payment voucher.
The record already exists.
First suspicion may come to next number of number sequence that is used. But actually it has nothing to do with it.
The real problems is reference CustTransIdRef.TransRecId -> CustTrans.RecId table.
So we should either delete dummy transactions in CustTransIdRef table that refer to non existing CustTrans or we can increase the next RecId number generated for CustTrans table. Sorting CustTransIdRef table by TransRecId we can find the last number that was used. Increase it by 1 and then update system table SystemSequences where TABID is equal to 78 (CustTrans):
update [dbo].[SYSTEMSEQUENCES]
set nextval=5637191850
where tabid=78
Then we should restart AOS as it caches a number (200 by default, afair) of RecId values for each table.
Heaving error:
Cannot create a record in Retail customer invoice journal (RetailCustInvoiceJourTable). Reference: 5637152082.
The record already exists.
Solution is same, problematic reference is RetailCustInvoiceJourTable.CustInvoiceJour -> CustInvoiceJour.RecId. Table id for CustInvoiceJour is 62.