Welcome to the ODK forum, @hogir.mir! We're glad you're here. When you get a chance, please introduce yourself on this forum thread. I'd also encourage you to add a real picture as your avatar because it helps build community!
Within a single form, if you are scanning multiple barcodes, then it should be possible to check for duplicates. @Lal_S has a good suggestion. It may be useful to also use a constraint
but you would want to also add a constraint_message
so that the user knows the issue preventing continuing is a duplicate barcode value.