Implementation method for supporting only code scanning gun code input

CN117556846BActive Publication Date: 2026-10-30四川启睿克科技有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311623825.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-30
Publication Date
2026-10-30
Estimated Expiration
2043-11-30

AI Technical Summary

Technical Problem

[0004]本发明所解决的技术问题:提供一种只支持扫码枪扫码输入的实现方法,解决现有的扫码输入中拦截手动输入不准确的问题

Benefits of technology

[0013]本发明的有益效果:本发明只支持扫码枪扫码输入的实现方法,以Enter键的ASCII值的作为输入完成标志,为输入框绑定事件paste,用于检测粘贴,当触发paste时,则为非扫码输入,清空输入框中值,为输入框绑定事件keyup,用于检测是否有值输入进输入框,设置数组asciiArr,对于中文输入和英文输入分别存入不同的数据,利用数组asciiArr以及输入框中的两个字符输入间隔时间来区分手动输入和扫码输入,以此,清空手动输入的内容,支持扫码枪扫码输入,解决了现有的扫码输入中拦截手动输入不准确的问题。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117556846B_ABST
    Figure CN117556846B_ABST
Patent Text Reader

Abstract

The application only supports the realization method of the code scanning gun code scanning input, relates to the technical field of data input, takes the ASCII value of the Enter key as an input completion flag, binds the event paste for the input box, is used for detecting pasting, when the paste is triggered, is non-code scanning input, clears the value in the input box, binds the event keyup for the input box, is used for detecting whether there is value input into the input box, sets the array asciiArr, respectively stores different data for Chinese input and English input, uses the array asciiArr and the interval time between two character inputs in the input box to distinguish the manual input and the code scanning input, in this way, clears the content of the manual input, supports the code scanning gun code scanning input, solves the problem that the existing code scanning input is inaccurate in intercepting the manual input, and the application is suitable for a production system which only supports code scanning input.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data input technology, and in particular to an implementation method that only supports barcode scanning input using barcode scanners. Background Technology

[0002] In production systems, barcode scanners are widely used, especially in areas involving labels (barcodes, QR codes, etc.). To ensure the accuracy of label data acquisition, interactive systems will mandate that data can only be obtained through barcode scanning. Barcode input simulates inputting characters one by one, and any manual input operations must be prohibited. Manual input operations include: pasting, direct input of non-Chinese characters, Chinese characters + Shift key, and Chinese characters + space key. All manual input operations are blocked, and other acceptable input operations are considered barcode scanning input.

[0003] So how do we determine if it's manual input? A common approach is to use JavaScript to listen for key events. Keys have three states: pressed, pressed, and released. We use these three states and the time interval between two presses to determine if it's manual input. This method involves listening for many events, handling many intermediate states, and processing complex logic. Furthermore, it cannot solve the problem of combined operations like 'Chinese input + Shift key' or 'Chinese input + space key'. Summary of the Invention

[0004] The technical problem solved by this invention is to provide an implementation method that only supports barcode scanner input, thereby solving the problem of inaccurate manual input interception in existing barcode scanning methods.

[0005] The technical solution adopted by the present invention to solve the above-mentioned technical problems is: a method for implementing input that only supports barcode scanner scanning, including the following steps: S1, setting the input completion flag of the input box to the ASCII value of the Enter key;

[0006] S2. Set the variable value of the input box, which is used to get the input value in the input box;

[0007] S3. Bind the paste event to the input box to detect pasting. When paste is triggered, it indicates that the input is not scanned and the value in the input box is cleared.

[0008] S4. Bind the keyup event to the input box to detect whether a value has been entered into the input box, and set the array asciiArr; if the input method is Chinese, when the Shift key or space key is pressed, two ASCII values ​​are triggered, one of which is the ASCII value of the Shift key or space key, and the other key value is the ASCII value of the last Chinese character entered. Store the two ASCII values ​​into the array asciiArr and proceed to S5; if the input method is English, display the input value in the input box synchronously, and synchronously obtain the ASCII values ​​of the keys, and store them into the array asciiArr in sequence, and proceed to S6;

[0009] S5. If the length of the variable value in the input box plus 1 equals the length of the array asciiArr, then proceed to S6. If the length of the variable value in the input box plus 1 is greater than the length of the array asciiArr, then it is manual input, and the value in the input box and the array asciiArr are cleared.

[0010] S6. Determine if the last value in the current asciiArr is the ASCII value of the Enter key. If it is, the input is complete. If not, save the current value of the input box as value1, check the next input value, and within a certain period of time, retrieve the value of the input box as value2 and the array asciiArr again. If the last value in the array asciiArr is not the Enter key and value1 and value2 are equal, then it is manual input, and clear the value in the input box and the array asciiArr.

[0011] Furthermore, the time period is 30 milliseconds.

[0012] Furthermore, the time period is 35 milliseconds.

[0013] The beneficial effects of this invention are as follows: This invention only supports the implementation method of barcode scanner input. It uses the ASCII value of the Enter key as the input completion flag, binds the paste event to the input box to detect pasting. When paste is triggered, it indicates non-barcode input and clears the value in the input box. It also binds the keyup event to the input box to detect whether a value has been entered. An array asciiArr is set to store different data for Chinese and English input. The array asciiArr and the time interval between two characters in the input box are used to distinguish between manual input and barcode input. In this way, the content of manual input is cleared, and barcode scanner input is supported, solving the problem of inaccurate interception of manual input in existing barcode input methods. Attached Figure Description

[0014] Figure 1 This is a flowchart illustrating the implementation method of the present invention that only supports barcode scanner input. Detailed Implementation

[0015] This invention only supports the implementation method of barcode scanner input, such as... Figure 1 As shown, it includes the following steps:

[0016] S1. Set the input completion flag of the input box to the ASCII value of the Enter key;

[0017] Specifically, the end of the scan input is assumed to be the ASCII value of the Enter key. That is, when the ASCII value of the Enter key is detected in the input box, the scan input is considered complete.

[0018] S2. Set the variable value of the input box, which is used to get the input value in the input box;

[0019] S3. Bind the paste event to the input box to detect pasting. When paste is triggered, it indicates that the input is not scanned and the value in the input box is cleared.

[0020] Specifically, when paste is triggered in the input box, it indicates that pasting is being used, not QR code input. Therefore, the value in the input box is cleared.

[0021] S4. Bind the keyup event to the input box to detect whether a value has been entered into the input box, and set the array asciiArr; if the input method is Chinese, when the Shift key or space key is pressed, two ASCII values ​​are triggered, one of which is the ASCII value of the Shift key or space key, and the other key value is the ASCII value of the last Chinese character entered. Store the two ASCII values ​​into the array asciiArr and proceed to S5; if the input method is English, display the input value in the input box synchronously, and synchronously obtain the ASCII values ​​of the keys, and store them into the array asciiArr in sequence, and proceed to S6;

[0022] Specifically, the mouse clicks the input box to make the input box obtain the cursor. When using Chinese input, the desired content is typed at this time, but the value of the input box is still empty. Only when the Shift key or the space bar is pressed, the input box has a value. When the Shift key or the space bar is pressed, two ASCII values will be triggered, one of which is the ASCII value of the Shift key or the space bar, and the other key value is the ASCII value of the last character of the Chinese input. For example, if the key input is "shuruceshizhong" and the Chinese display is "输入测试中", there is no value in the input box at this time; if the space bar is pressed again, the value of the input box is "输入测试中", and the value of asciiArr is the ASCII value of the character "中" and the ASCII value of the space bar; if the Shift key is pressed, the value of the input box is "shuruceshizhong", and the value of asciiArr is the ASCII value of the character "g" and the ASCII value of the Shift key. In this way, during Chinese input, when the Shift key or the space bar is pressed, the keyup event is triggered, and the array asciiArr stores two ASCII values; when using English input, the input value is synchronously displayed in the input box, and the ASCII value of the key is synchronously obtained and stored in the array asciiArr in sequence. For example, if the key input is "shuruceshizhong", then "shuruceshizhong" is synchronously displayed in the input box, and what is stored in the array asciiArr is also "shuruceshizhong".

[0023] S5. If the length of the value of the variable value of the input box plus 1 is equal to the length of the array asciiArr, proceed to S6; if the length of the value of the variable value of the input box plus 1 is greater than the length of the array asciiArr, it is a manual input, and clear the value in the input box and the array asciiArr;

[0024] Specifically, under Chinese input, the length of the array asciiArr is 2. If it is a single-character input, the length of the value of the variable value of the input box is 1, that is, the length of the value of the variable value of the input box plus 1 is equal to the length of the array asciiArr, and further judgment is required, that is, S6. If it is a multi-character input, the length of the value of the variable value of the input box is greater than 1, that is, if the length of the value of the variable value of the input box plus 1 is greater than the length of the array asciiArr, which is inconsistent with the scan code input, so it belongs to manual input, and the value in the input box and the array asciiArr are cleared.

[0025] S6. Determine if the last value in the current asciiArr is the ASCII value of the Enter key. If it is, the input is complete. If not, save the current value of the input box as value1, check the next input value, and within a certain period of time, retrieve the value of the input box as value2 and the array asciiArr again. If the last value in the array asciiArr is not the Enter key and value1 and value2 are equal, then it is manual input, and clear the value in the input box and the array asciiArr.

[0026] Specifically, in single-character input for Chinese and English input, the first character is usually not the Enter key. Therefore, if the first character is the Enter key, it indicates the end of input, but there is no actual input data in the input box. If the last value in the current asciiArr is not the ASCII value of the Enter key, the next input value is detected. Typically, the time interval between manually inputting two characters is greater than 100 milliseconds, while the time interval between scanning two characters is less than 30 milliseconds. Therefore, a time limit is set, such as 30ms or 35ms. Within the time limit, the value of the input box and the array asciiArr are retrieved again within a certain period of time. If the last value in the array asciiArr is not the Enter key and value1 and value2 are equal, it means that there is no new input within the time limit without completing the input, i.e., manual input clears the value in the input box and the array asciiArr. If there is, it means it is scanned input.

[0027] This invention distinguishes between manual input and QR code input by analyzing the changing patterns of the input box value and the key ASCII code value. Unlike methods that use three key states and the time interval between two key presses to determine whether it is manual input, this invention greatly reduces the role of event monitoring, focusing instead on analyzing the changing patterns of the bound value of the input box and the key ASCII code to determine whether it is manual input. It only monitors the keyup event of the input box, reducing the number of monitoring states. Moreover, it also has a good recognition effect for compound operations such as Chinese input + Shift key or Chinese input + space key.

Claims

1. A method that only supports barcode scanner input, characterized in that: Includes the following steps: S1. Set the input completion flag of the input box to the ASCII value of the Enter key; S2. Set the variable value of the input box, which is used to get the input value in the input box; S3. Bind the paste event to the input box to detect pasting. When paste is triggered, it indicates that the input is not scanned and the value in the input box is cleared. S4. Bind the keyup event to the input box to detect whether a value has been entered into the input box, and set the array asciiArr; if the input method is Chinese, when the Shift key or space key is pressed, two ASCII values ​​are triggered, one of which is the ASCII value of the Shift key or space key, and the other key value is the ASCII value of the last Chinese character entered. Store the two ASCII values ​​into the array asciiArr and proceed to S5; if the input method is English, display the input value in the input box synchronously, and synchronously obtain the ASCII values ​​of the keys, and store them into the array asciiArr in sequence, and proceed to S6; S5. If the length of the variable value in the input box plus 1 equals the length of the array asciiArr, then proceed to S6. If the length of the variable value in the input box plus 1 is greater than the length of the array asciiArr, then it is manual input, and the value in the input box and the array asciiArr are cleared. S6. Determine if the last value in the current asciiArr is the ASCII value of the Enter key. If it is, the input is complete. If not, save the current value of the input box as value1, check the next input value, and within a certain period of time, retrieve the value of the input box as value2 and the array asciiArr again. If the last value in the array asciiArr is not the Enter key and value1 and value2 are equal, then it is manual input, and clear the value in the input box and the array asciiArr.

2. The implementation method according to claim 1 that only supports barcode scanner input, characterized in that, In S6, the time period is 30 milliseconds.

3. The implementation method according to claim 1 that only supports barcode scanner input, characterized in that, In S6, the time period is 35 milliseconds.

Citation Information

Patent Citations

  • Data input method and system and related equipment

    CN111045529A

  • Code scanning recognition method and device, electronic equipment and readable storage medium

    CN111950233A