we are currently workin on a RFID project and we need to generate the RFID serial numbers which is in a specific format (eg: 0101i0010001).
in this the 1st 4 numbers are constant (0101)
the next 4 digit numbers are item id which is got from the JSP textbox(i001)
the last 4 digit numbers are the RFID serial numbers which needs to be generated automatically.. depending upon the item id the series wil vary..
for eg:
for i001 - the seires wil start from 0000
and the number needs to get incremented according to the ordered qty which is another textbox in the same JSP page(eg: if ordered qty is 5 ... then the RFID start no sud be
0101i0010000 and the end no sud be 0101i0010004
this value sud get inserted in the database.. we are using ACCESS..
and the next value for the same item no sud be incremented by 1 from the RFID end no
tat value sud be the start no of the same item only....

(THE BELOW CODE IS IN JAVA AND IT NEEDS TO INSERT THE DATA TO THE DATABASE AS WELL AS RETURN THE VALUE TO THE JSP FORM)

import java.io.*;
import java.lang.*;

public class testsam
{
public void call(String itemno, int qty)
{
//String itemno;
//int qty;

String a="0101";
String b=a+itemno;
String start;
String end;
if(itemno.equals("i001"))
{
String c="1000";
start=b+"1000";
int i=Integer.parseInt(c)+qty;
end=b+i;
System.out.println("start no = "+start);
System.out.println("end no=" +end);
}
else if(itemno.equals("i002"))
{
String c="1200";
start=b+"1200";
int i=Integer.parseInt(c)+qty;
end=b+i;
System.out.println("start no = "+start);
System.out.println("end no=" +end);
}
else if(itemno.equals("i003"))
{
String c="1400";
start=b+"1400";
int i=Integer.parseInt(c)+qty;
end=b+i;
System.out.println("start no = "+start);
System.out.println("end no=" +end);
}
else if(itemno.equals("i004"))
{
String c="1600";
start=b+"1600";
int i=Integer.parseInt(c)+qty;
end=b+i;
System.out.println("start no = "+start);
System.out.println("end no=" +end);
}
else if(itemno.equals("i005"))
{
String c="1800";
start=b+"1800";
int i=Integer.parseInt(c)+qty;
end=b+i;
System.out.println("start no = "+start);
System.out.println("end no=" +end);
}
else
{
String c="2000";
start=b+"2000";
int i=Integer.parseInt(c)+qty;
end=b+i;
System.out.println("start no = "+start);
System.out.println("end no=" +end);
}
//end=start+qty;
//System.out.println("start no = "+start);
//System.out.println("end no=" +end);
}

public static void main(String args[]) throws IOException
{
testsam t=new testsam();
String itemno;
int qty;
BufferedReader bb=new BufferedReader(new InputStreamReader(System.in));
System.out.println("enter values");
itemno=bb.readLine();
qty=Integer.parseInt(bb.readLine());
t.call(itemno,qty);
}
}

Recommended Answers

All 3 Replies

take more care in crafting your posts so that they're actually readable and understandable and maybe someone may go to the effort to try and help you out.

in which format do u want us to craft the query..
v re new to this site.. :(

start by when posting code use the '[ code ] '[ /code ]' tags without the ''

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.