Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
12
Erster Beitrag:
vor 4 Jahren, 10 Monaten
Letzter Beitrag:
vor 4 Jahren, 7 Monaten
Beteiligte Autoren:
Mujahid, mariah, Marc De Swert, GuenterP, DarrenF

[WD14] How to adding barcode number

Startbeitrag von Mujahid am 21.09.2013 09:19

Hi all,


i is int

FOR i = 1 TO TableCount(TABLE_BarcodeList)
TableSelectPlus(TABLE_BarcodeList,i)
TablePosition(TABLE_BarcodeList,i)
END

EDT_Barcode = 1000000 + i

FOR ALL ROW OF TABLE_BarcodeList
HReadSeekFirst(ItemUOM,sBarCode,EDT_Barcode)
IF HFound(ItemUOM) THEN
EDT_Barcode = 1000001 + i
HReadSeekFirst(ItemUOM,sBarCode,EDT_Barcode)
IF HFound(ItemUOM) THEN
EDT_Barcode = 1000002 + i
END
HReadSeekFirst(ItemUOM,sBarCode,EDT_Barcode)
IF HFound(ItemUOM) THEN
EDT_Barcode = 1000003 + i
END
END
END


From the coding as above, i want to creating 7 digits barcode automatically using a button.
How to improving this code?
If the barcode number is same at the file records then, it will not proceed the barcode and will continuously adding 1 until the number is not same with the file records. If not same then it will stop and proceed that barcode.

Thanks a lot

Mujahid

Antworten:

Mayby sort first the tabel to receive the highisth barcodenumber
then use that value and +1
now you have the newest number to use

or you can create a table for keeping the last used number

Marc :cool:

von Marc De Swert - am 24.09.2013 13:12
Hi Marc,

Let say i have 5 lines product :

1) Product A = Barcode (1000001)
2) Product B = Barcode (1000002)
3) Product C = Barcode (1000003)
4) Product D = Barcode (1000004)
5) Product E = Barcode (1000005)

Im decide to delete the Product C.
So now the total line is 4.
From my first coding, how i create the next barcode number is total line + 1.
So if i create new product line (Product F), then the barcode will be 1000005.

It is same with the Product E barcode.

How to make loop coding, so if the barcode number is same with the current barcode list then, it will add quantity 1 until it is not same.

The below coding is work but i need some improving to continuous loop until it become unique.

FOR ALL ROW OF TABLE_BarcodeList
HReadSeekFirst(ItemUOM,sBarCode,EDT_Barcode)
IF HFound(ItemUOM) THEN
EDT_Barcode = 1000001 + i
HReadSeekFirst(ItemUOM,sBarCode,EDT_Barcode)
IF HFound(ItemUOM) THEN
EDT_Barcode = 1000002 + i
END
HReadSeekFirst(ItemUOM,sBarCode,EDT_Barcode)
IF HFound(ItemUOM) THEN
EDT_Barcode = 1000003 + i
END
END
END


Thanks a lot.

Regards,
Mujahid

von Mujahid - am 24.09.2013 16:35
Hi Marc,

Additional info:

The barcode is contain many digit barcode. So cannot doing last read file. Maybe the last file is barcode with 13 digits. I just want to do automatically for 7 digit barcode.

:D. sorry.

von Mujahid - am 24.09.2013 16:43
Hi,

Just an example of how I create and format my barcode values:

When user clicks on Add a new product:

// Work out the last ID(+1) on the customer database as we are now in NEW mode
HReadLast(Product_Variants,ID,hLockNo)
gwinviTempRecs = Product_Variants.ID + 1

The it can be formatted, for example:

// Set the window field with as much as we know at this stage
WEDIT_CCode_Internal = NumToString(9000000000000 + gwinviTempRecs, "12d")

von DarrenF - am 24.09.2013 18:45
Sorry Mujahid

but when i read your first post.. nothing says that you delete a record , nothing that you have 13 digits barcode


* mayby when you delete the record, store that barcode that will be deleted in an usebackfile so that you can use that number again

when you create an new line than pick up this number, used it and delete it from the usebackfile

otherwise is stupid to count the lines and do +1 because by deleting records you never know exactly what the numbers are, you can have highist number say: 10 and having 6 records

in my first post there was a table sort so the maxnumber is the last that you received

fior the future, please give more information si that we can answer more directly and not having a reply with different information

and NumToString(9000000000000 + gwinviTempRecs, "12d")
is an good idea to do the cast, use then 7 digits
marc :cool:

von Marc De Swert - am 25.09.2013 07:09
Hi Darren and Mirc,

Thanks for the solution.
Actually im doing trial and error. That's why my question not fully inform. :D
When im test, then i found the problem.

Will try your next solution.

Thanks a lot. :spos:

Regards,
Mujahid

von Mujahid - am 25.09.2013 09:20
hey,does every barcode can be done like this you guys said?

von mariah - am 24.10.2013 04:15
Hi Mujahid,

1) you should be aware of the fact that there is a big number of barcode methodologies. http://en.wikipedia.org/wiki/Barcode

e.g. UPC / EAN / GLN / GTIN are 13 numeric characters long, are internally surrounded by the company's GLN number and there's a check digit at the end (the 13th character) to be calculated. There are three different types of GLN:
GLN-1 - no item numbers possible
GLN-2 - 99999 item numbers
GLN-3 - 999 item numbers

Which methodology are you writing about?

von GuenterP - am 24.10.2013 04:42
Hi Guenter,

In my product file, the barcode im set as string with 200 character. My objective is i just can set any number or string to the barcode. My software also can share barcode. So when make sales, after scanning the product, then the product with same barcode will all appear first, then the cashier will select the right product to the list. In reality at my country, some of the product use dummy barcode (same barcode with different product). I know its wrong, but my job is just give solution to the retailer.

At the barcode report setting, im choosing code 128. Actually i havent knowledge on this. Just try and its work for me. Its can produce barcode label (any string or number) using barcode printer and also can scan on it without problem.

The product also have unlimited Unit Of Measure. So one product will have many barcode. Normally its use for unit, pack and carton solution. But in reality the user use it more creative.

So for the physical product that doesnt have any barcode printed, i will standardise to creating 7 character of barcode.

This is the coding as im get from Darren and Marc advise:

As you know that my Product file for barcode im set as string. The TABLE_BarcodeList.nBarcode im set as numeric.

// Listing all barcode with 7 character only.


TableDeleteAll(TABLE_BarcodeList)

QRY_BarcodeList.psBarCode = ""
IF NOT HExecuteQuery(QRY_BarcodeList) THEN
Error("Query initialization error"+CR+HErrorInfo())
RETURN
END

HReadFirst(QRY_BarcodeList)

WHILE NOT HOut()
IF Length(QRY_BarcodeList.sBarCode) = 7 THEN
TableAddLine(TABLE_BarcodeList,QRY_BarcodeList.sBarCode)
END
HReadNext(QRY_BarcodeList)

END

HCancelDeclaration(QRY_BarcodeList)




// Checking all barcode listing at the Unit Of Measure list. If its still not on the file record then put it to the TABLE_BarcodeList



FOR ALL ROW OF WIN_Item.TABLE_ItemUOM
IF WIN_Item.TABLE_ItemUOM.COL_sBarcode > "" THEN
HReadSeekFirst(ItemUOM,sBarCode,WIN_Item.TABLE_ItemUOM.COL_sBarcode)
IF NOT HFound(ItemUOM) THEN
TableAddLine(TABLE_BarcodeList,WIN_Item.TABLE_ItemUOM.COL_sBarcode)
END
END
END

TableSort(TABLE_BarcodeList,"TABLE_BarcodeList.COL_nBarcode")


i is int

FOR i = 1 TO TableCount(TABLE_BarcodeList)
TableSelectPlus(TABLE_BarcodeList,i)
TablePosition(TABLE_BarcodeList,i)
END

EDT_Barcode = NumToString(TABLE_BarcodeList.COL_nBarcode + 1,"%7d")



Some barcode list example can be view here Barcode Example


Hope its also work for you.

Thanks,

Regards,
Mujahid

von Mujahid - am 24.10.2013 10:26
Hi Mujahid,

the main problem in barcodes is to check for the validity of the barcode-information read through the barcode reader. Especially for big barcodes. The EAN-128 / GS1-128 barcodes http://en.wikipedia.org/wiki/GS1-128 do provide that and are standard barcodes where you can extend the length while keeping some standard organisation within the code.

von GuenterP - am 25.10.2013 07:18
Quote
Mujahid
Hi Guenter,
Some barcode list example can be view here Barcode Example


Hope its also work for you.

Thanks,

Regards,
Mujahid

wow, this is a good site ! thanx

von mariah - am 29.11.2013 03:24
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.