Implementation of registration system for queuing system of station-station system (Java queue)

Source: Internet
Author: User
Tags ticket

There are many places to use in the queue.

There are many examples in the real world.

For example, the hospital registration system, the bank's station-to-station system, the cafeteria in line to play rice and so on. In the market, this is the line to pick up the number of equipment. Their functions are basic such as the following:

1, the system can be networked online unified issuing number.
2, the system can be wireless docking, can also be wired connection;
3, the system supports more than 100 kinds of business;
4, the system supports multiple waiting area prompt waiting information, each waiting area voice and display can be independent.
5, personalized voice can call the customer's business name (hospital version can call Patient name) and other information.
6, the number can be transferred between the counter forms of different service categories, customers do not have to queue up and down;
7, with login operation function and exit operation function: Before the start of work, enter the employee login number to log in. After the work is over, exit the queuing system, which is very accurate for statistics.
8, the image of the machine interface can be completely customized according to individual design replacement.
9, the key customers of each business can be completely changed according to the personalized design;
10, support through the reader to read the relevant information of customers, their own initiative to distinguish between VIP customers and ordinary customers, their own initiative to distinguish between public and private customers, and according to the rules of the establishment of self-organizing queue of their own initiative; The display on the
11, the ticket and the issuing machine will show the number of people waiting in front of each customer;
12. Each business queue customer can freely increase or decrease on demand.
13, the number of business waiting customers can be fully self-setting on the interface display and can be freely typesetting.
14, the business hours and the period of pause customers can be fully self-setting.
15, the operation of the staff of the increase or decrease and login account can be completely self-change;
16. Voice Call information customers are fully able to personalize changes,
17, display of whatever display information the customer is fully capable of personalized changes;
18. Customer to handle the serial number of the business customers can be fully self-setting, such as: VIP business or financial services can be set to 1-200, foreign currency business can be set to 201-500, RMB business set in 501-9999;
19, The business queue customers handled by the workers are fully able to set priorities at their own discretion.
20, the text content on the ticket, the pattern, the business name, the time format, changes the font and the size, the paper length and so on the customer completely can independently press the personalization;
21. The system supports playing background music. Music tracks are completely self-selected by the customer;
22, the system support on duty Manager to add monitoring software to handle a variety of special situations;
23, the system supports high-definition plasma display, large screen, TV wall and other display equipment. Displays rich queuing information.
24, the system supports connecting the Internet, can realize remote monitoring;
25. The system has an extended function, when it is necessary to statistics and management data. Can activate the management software and printing;
26, the system can be configured according to the needs of the customer evaluation and queuing information (SMS) prompt function.

OK, now that we've learned this, let's implement a simple example. First Look at:


Don't say much nonsense. Look at the code:

Callnum.java

Package Com.test;import Java.util.concurrent.executorservice;import Java.util.concurrent.executors;import java.util.concurrent.timeunit;/** * @see SIM card System * @author Herman.xiong * @date November 17, 2014 14:48:48 * @version V1.0 */pu Blic class Callnum {public static void main (string[] args) throws Interruptedexception {  //Create service center, such as a bank's Business Hall center CEN ter = new Center ();          Executorservice exec = Executors.newcachedthreadpool ();          Analog generation service personnel        Producer Producer = new Producer (center);          Simulation generates n multi-client        Consumer Consumer = new Consumer (center);          Exec.execute (producer);          Simulate 10 clients for        (int i = 0; i < i++) {              Exec.execute (consumer);          }          TimeUnit.SECONDS.sleep (ten);          Exec.shutdown ();          If in doubt, please add QQ Group: 135430763 Study together!    }}
Center.java

Package Com.test;import Java.util.random;import Java.util.concurrent.blockingqueue;import Java.util.concurrent.linkedblockingqueue;import java.util.concurrent.timeunit;/** * @see Service Center * @author Herman.Xiong *  @date November 17, 2014 14:41:28 * @version V1.0 */public class Center extends Thread {private final static int MAXCOUNT =        10;      Private blockingqueue<waiter> waiters;        Private blockingqueue<customer> customers;        Private random Rand = new Random (47);      Private final static int producersleepseed = 100;        Private final static int consumersleepseed = 10000;          Public Center () {//Create 10 service-Providing workers this.waiters = new linkedblockingqueue<waiter> (MAXCOUNT);          for (int i = 0; i < MAXCOUNT; i++) {Waiters.add (new Waiter ());      }//10 workers are working ready to create customer queue this.customers = new linkedblockingqueue<customer> (); } public void produce () {try {Timeunit.millisecoNds.sleep (Rand.nextint (producersleepseed));          } catch (Interruptedexception e) {e.printstacktrace ();      } this.customers.add (New Customer ()); } public void consume () {try {//service form available Waiter waiter = THIS.WAITERS.T              Ake ();                          This.waiters.remove (waiter);              Customers can use customer customer = This.customers.take ();                This.customers.remove (customer);              The form displays System.out.println (Waiter + "being" + customer + "service ...");                TimeUnit.MILLISECONDS.sleep (Rand.nextint (consumersleepseed));          This.waiters.add (waiter);          } catch (Interruptedexception e) {System.err.println ("---" + e.getmessage ());  }      }  }
Producer.java

Package com.test;/** * @see producer threads, simulation bank staff service completed after a customer is ready to serve the next customer * @author Herman.xiong * @date November 17, 2014 14:55:43 * @vers Ion V1.0 */public class Producer implements Runnable {      Private Center center;        Public Producer (center center) {          this.center = center;      }        @Override public      Void Run () {while          (! Thread.interrupted ()) {          //Generate Customer            center.produce ();          }      }  }  
Consumer.java

Package com.test;/** * @see simulated customer completed business requirements, service personnel spare ready * @author Herman.xiong * @date November 17, 2014 14:57:11 * @version V1.0 */pub Lic class Consumer implements Runnable {      Private Center center;        Public Consumer (center center) {          this.center = center;      }        @Override public      Void Run () {while          (! Thread.interrupted ()) {              center.consume ();}}    }  
Click Source Download: http://download.csdn.net/download/xmt1139057136/8167619

About people follow my blog! If in doubt, please add QQ Group: 135430763 Study together!


Implementation of registration system for queuing system of station-station system (Java queue)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.