A wireless tag communication system that includes a wireless tag communication apparatus that communicates with wireless tags and a primary apparatus that is connected to the wireless tag communication apparatus and controls the wireless tag communication apparatus, comprising:
- a wireless communication device that transmits, to the wireless tags, a sequence of read commands for reading identification information of the wireless tags and receives the identification information from the wireless tags, each read command in the sequence designating a flag state of a flag set in the wireless tag, the flag state being set to one of a first state when reading is incomplete and a second state when reading is complete, each of the wireless tags returning the identification information upon receiving a corresponding one of the read commands in the sequence that designates the flag state only where the flag state corresponds to the designated flag state;
- a state detector that detects a communication state with the wireless tag by the wireless communication device;
- a memory that includes a detection target storage unit that stores detected information in association with identification information of each of one or more wireless tags whose positions are to be detected, the detected information indicating whether or not the position of the corresponding wireless tag has been detected;
- and
- a processor configured to
- transmit, by the wireless communication device, a first read command designating the first state as the flag state and acquire, by the wireless communication device, the identification information returned from a first wireless tag of the wireless tags whose flag state is the first state,
- detect a position of the first wireless tag on a basis of the communication state detected by the state detector,
- determine, on a basis of the detected information stored in the detection target storage unit of the memory in association with the acquired identification information, whether or not a position of the first wireless tag has been detected,
- where it is determined that the position of the first wireless tag has not been detected, transmit, by the wireless communication device, an instruction that instructs the first wireless tag to maintain the flag state to be the first state, and
- where it is determined that the position of the first wireless tag has been detected, transmit, by the wireless communication device, a second read command designating the first state as the flag state, the second read command causing the first wireless tag to rewrite the flag state to the second state.