Disclosure of Invention
An object of the embodiments of the present application is to provide a method, an apparatus, a device and a storage medium for reading barcodes of different types, so as to improve barcode scanning and identifying efficiency.
A first aspect of an embodiment of the present application provides a barcode reading method, including: acquiring code scanning task information; searching all reading rules which accord with the code scanning task information in a preset reading rule base based on the code scanning task information to obtain a target rule set; reading a first bar code for verification according to the reading rule in the target rule set; and storing the first bar code passing the verification to a bar code information table.
In an embodiment, the searching, based on the code scanning task information, all reading rules that meet the code scanning task information in a preset reading rule base to obtain a target rule set includes: determining the code scanning task type according to the code scanning task information; searching a corresponding target code from the code scanning task information according to the code scanning task type; and searching all the reading rules corresponding to the target codes in a preset reading rule base based on the target codes to obtain a target rule set.
In an embodiment, the searching for the corresponding target code from the code scanning task information according to the code scanning task type includes: when the code scanning task type is a first type, the target code is a first code; and when the code scanning task type is a second type, the target code is a second code.
In an embodiment, the reading the first barcode for verification according to the reading rule in the target rule set includes: selecting the reading rule with the highest preset priority from the target rule set as a target reading rule; reading a first bar code for verification according to the target reading rule; judging whether the verification passes; when the verification fails, selecting the reading rule with the next priority from the target rule set as a target reading rule according to the sequence of the preset priority from high to low; and reading the first bar code for verification according to the target reading rule until the verification is passed.
In an embodiment, the reading the first barcode for verification according to the target reading rule includes: intercepting the first bar code according to the target reading rule to obtain a second bar code; acquiring article information corresponding to the second bar code; and verifying the article information.
In an embodiment, the reading the first barcode for verification according to the target reading rule includes: reading a first bar code according to the target reading rule; acquiring a second bar code corresponding to the first bar code based on a preset incidence relation; acquiring article information corresponding to the second bar code; and verifying the article information.
In an embodiment, the reading rule includes encoding information, interception mode information, priority information, and valid status information.
A second aspect of the embodiments of the present application provides a barcode reading apparatus, including: the acquisition module is used for acquiring code scanning task information; the searching module is used for searching all reading rules which accord with the code scanning task information in a preset reading rule base based on the code scanning task information to obtain a target rule set; the reading module is used for reading the first bar code for verification according to the reading rule in the target rule set; and the storage module is used for storing the first bar code passing the verification to a bar code information table.
In one embodiment, the lookup module is configured to: determining the code scanning task type according to the code scanning task information; searching a corresponding target code from the code scanning task information according to the code scanning task type; and searching all the reading rules corresponding to the target codes in a preset reading rule base based on the target codes to obtain a target rule set.
In one embodiment, the reading module is configured to: selecting the reading rule with the highest preset priority from the target rule set as a target reading rule; reading a first bar code for verification according to the target reading rule; judging whether the verification passes; when the verification fails, selecting the reading rule with the next priority from the target rule set as a target reading rule according to the sequence of the preset priority from high to low; and reading the first bar code for verification according to the target reading rule until the verification is passed.
In one embodiment, the reading module is specifically configured to: intercepting the first bar code according to the target reading rule to obtain a second bar code; acquiring article information corresponding to the second bar code; and verifying the article information.
In one embodiment, the reading module is specifically configured to: reading a first bar code according to the target reading rule; acquiring a second bar code corresponding to the first bar code based on a preset incidence relation; acquiring article information corresponding to the second bar code; and verifying the article information.
A third aspect of embodiments of the present application provides an electronic device, including: a memory to store a computer program; a processor configured to perform the method of the first aspect of the embodiments of the present application and any of the embodiments of the present application.
A fourth aspect of embodiments of the present application provides a non-transitory electronic device-readable storage medium, including: a program which, when run by an electronic device, causes the electronic device to perform the method of the first aspect of an embodiment of the present application and any embodiment thereof.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.
In the description of the present application, the terms "first," "second," and the like are used for distinguishing between descriptions and do not denote an order of magnitude, nor are they to be construed as indicating or implying relative importance.
In the description of the present application, the terms "comprises," "comprising," and/or the like, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, steps, operations, elements, components, and/or groups thereof.
In the description of the present application, the terms "mounted," "disposed," "provided," "connected," and "configured" are to be construed broadly unless expressly stated or limited otherwise. For example, it may be a fixed connection, a removable connection, or a unitary construction; can be mechanically or electrically connected; either directly or indirectly through intervening media, or may be internal to two devices, elements or components. The specific meaning of the above terms in the present application can be understood by those of ordinary skill in the art as appropriate.
Please refer to fig. 1, which is a schematic structural diagram of an electronic device 100 according to an embodiment of the present application, and includes at least one processor 120 and a memory 130, where fig. 1 illustrates one processor as an example. The processor 120 and the memory 130 are connected by a bus 110, and the memory 130 stores instructions executable by the at least one processor 120, the instructions being executed by the at least one processor 120 to cause the at least one processor 120 to perform a barcode reading method as in the embodiments described below.
In one embodiment, the Processor 120 may be a general-purpose Processor, including but not limited to a Central Processing Unit (CPU), a Network Processor (NP), etc., a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. The general purpose processor may be a microprocessor or the processor may be any conventional processor or the like, and the processor 120 is the control center of the electronic device 100 and connects the various parts of the entire electronic device 100 using various interfaces and lines. The processor 120 may implement or perform the methods, steps, and logic blocks disclosed in the embodiments of the present application.
In one embodiment, the Memory 130 may be implemented by any type of volatile or non-volatile Memory device or combination thereof, including but not limited to Random Access Memory (RAM), Read Only Memory (ROM), Static Random Access Memory (SRAM), Programmable Read-Only Memory (PROM), Erasable Read-Only Memory (EPROM), electrically Erasable Read-Only Memory (EEPROM), and the like.
The structure of the electronic device 100 shown in fig. 1 is merely illustrative, and the electronic device 100 may also include more or fewer components than shown in fig. 1, or have a different configuration than shown in fig. 1. The components shown in fig. 1 may be implemented in hardware, software, or a combination thereof.
Fig. 2 is a flowchart illustrating a barcode reading method according to an embodiment of the present application, which can be executed by the electronic device 100 shown in fig. 1 to read different types of barcodes. The method comprises the following steps:
step 210: and acquiring code scanning task information.
In the above step, the code scanning task information may include a first barcode to be scanned and an operation node where the code scanning task is located. Taking the logistics storage scenario as an example, the first barcode can be scanned by a barcode scanner or other handheld devices at different operation nodes to record or query the information of the article, and the operation nodes may include, but are not limited to, receiving, putting on shelf, picking up, rechecking, checking, stock query, shifting, and the like.
The first barcode is an SN code (Serial Number, product Serial Number), which is a unique code of an article and can be used for precisely managing each article, the SN code is generally pasted or drawn on the article in the form of a barcode, and the barcode is a graphic identifier in which a plurality of black bars and spaces with different widths are arranged according to a certain coding rule to express a group of information. Common bar codes are a pattern of parallel lines of dark bars (simply bars) and white bars (simply spaces) of widely differing reflectivity.
The generation logics of different types of SN codes can be the same or different, for example, some types of SN codes can include 69 codes, some types of SN codes do not include 69 codes, China adopts an international general commodity code and bar code identification system, popularizes and applies commodity bar codes and establishes a commodity identification system of China, and the commodity codes of China are also called 69 codes since the beginning of the commodity codes of China is 69.
Step 220: and searching all reading rules which accord with the code scanning task information in a preset reading rule base based on the code scanning task information to obtain a target rule set.
In the foregoing step, different reading rules may be configured for different warehouses, the reading rules are associated with corresponding warehouse codes and stored in a preset reading rule base, each warehouse may be configured with one or more reading rules, and priorities among the multiple reading rules may be configured according to storage conditions of the articles in the warehouse, for example, the more articles in the warehouse having a certain type of SN code, the higher the priority of the reading rule applicable to the type of SN code.
In addition, different reading rules can be configured for different owners, the reading rules are associated with corresponding owner codes and stored in a preset reading rule base, each owner can be correspondingly configured with one or more reading rules, and the priority among the reading rules can be configured according to the article condition of the owner.
In an embodiment, the reading rule may include encoding information, interception mode information, priority information, and valid status information.
In the above steps, the code information refers to a goods owner code or warehouse code associated with the reading rule, and the interception mode information may include a start bit and a stop bit of reading, and may further include a special separator, such as ","; "the interception based on a special separator may be configured to start reading from the special separator, or to read the content between two special separators. The priority information can be represented by the size of a numerical value, the smaller the numerical value is, the higher the priority is represented, the valid state information is generally valid (Y) or invalid (N), and when all reading rules which accord with the code scanning task information are searched, the reading rules in the invalid state can be automatically skipped.
In an embodiment, based on the code scanning task information, searching all reading rules that conform to the code scanning task information in a preset reading rule base to obtain a target rule set, which may include: determining the code scanning task type according to the code scanning task information; searching a corresponding target code from the code scanning task information according to the code scanning task type; and searching all reading rules corresponding to the target codes in a preset reading rule base based on the target codes to obtain a target rule set.
In an embodiment, searching for a corresponding target code from code scanning task information according to a code scanning task type may include: when the code scanning task type is a first type, the target code is a first code; when the code scanning task type is a second type, the target code is a second code.
In the above step, it may be determined whether the code scanning task type is the first type or the second type according to the job node in the code scanning task information, when the code scanning task type is the first type, the first code is searched from the code scanning task information, when the code scanning task type is the second type, the second code is searched from the code scanning task information, and then, according to the first code or the second code, the corresponding associated reading rule is searched in a preset reading rule base, so as to obtain the target rule set.
In a logistics storage scene, the first type can be a job order type, the first code is a goods owner code, the second type can be an in-warehouse query type, the second code is a warehouse code, code scanning tasks in receiving, putting on shelves, picking and rechecking nodes belong to the first type, and code scanning tasks in checking, inventory query and shifting nodes belong to the second type.
Step 230: and reading the first bar code for verification according to the reading rule in the target rule set.
In one embodiment, reading the first barcode for verification according to a reading rule in the target rule set includes: selecting a reading rule with the highest preset priority from the target rule set as a target reading rule; reading the first bar code for verification according to a target reading rule; judging whether the verification passes; when the verification fails, selecting a reading rule of the next priority from the target rule set as a target reading rule according to the sequence of the preset priority from high to low; and reading the first bar code for verification according to the target reading rule until the verification is passed.
In an embodiment, reading the first barcode for verification according to the target reading rule may include: intercepting the first bar code according to a target reading rule to obtain a second bar code; acquiring article information corresponding to the second bar code; and verifying the article information.
In the above step, the first barcode is an SN code, the second barcode is a 69 code, the 69 code is included in the SN code, the SN code is intercepted and checked according to a reading rule with the highest priority preset in the target rule set, and if the SN code does not pass the checking, the SN code is intercepted and checked according to a reading rule of the next priority in the order from the highest priority to the lowest priority according to the preset priority. Intercepting the SN code may include: and judging whether the intercepted part is 69 codes, if not, the verification is not passed, if so, acquiring the article information corresponding to the 69 codes, judging whether the article information is consistent with the order information in the order system, if so, the verification is passed, and if not, the verification is not passed. Item information may include, but is not limited to, item name, model number, date of manufacture, lot, etc.
In one embodiment, reading the first barcode for verification according to a target reading rule includes: reading the first bar code according to a target reading rule; acquiring a second bar code corresponding to the first bar code based on a preset incidence relation; acquiring article information corresponding to the second bar code; and verifying the article information.
In the above step, the first barcode is an SN code, the second barcode is a 69 code, the 69 code is not included in the SN code, but a preset association relationship between the SN code and the 69 code is stored in the database, and the second barcode corresponding to the first barcode may be obtained based on the preset association relationship, so as to obtain the item information corresponding to the second barcode for verification.
In an embodiment, the code scanning task information may include a first barcode and a second barcode with scanning, the second barcode is read for verification, the first barcode is read, and the first barcode and the second barcode are associated.
Step 240: and storing the first bar code passing the verification to a bar code information table.
In the above steps, according to the reading rule in the target rule set, the first barcode is read for verification, and after the verification is passed, the first barcode and the operation information newly added or changed by the current operation node are stored in a barcode information table, where the operation information may include but is not limited to: code scanning time, article storage location, etc.
As shown in fig. 3, which is a schematic structural diagram of a barcode reading apparatus 300 according to an embodiment of the present application, the apparatus can be applied to the electronic device 100 shown in fig. 1, and includes: an acquisition module 310, a lookup module 320, a read module 330, and a storage module 340. The principle relationship of the modules is as follows:
an obtaining module 310, configured to obtain code scanning task information.
The searching module 320 is configured to search, based on the code scanning task information, all reading rules that meet the code scanning task information in a preset reading rule base to obtain a target rule set.
The reading module 330 is configured to read the first barcode for verification according to a reading rule in the target rule set.
The storage module 340 is configured to store the first barcode passing the verification to a barcode information table.
In one embodiment, the lookup module 320 is configured to: determining the code scanning task type according to the code scanning task information; searching a corresponding target code from the code scanning task information according to the code scanning task type; and searching all reading rules corresponding to the target codes in a preset reading rule base based on the target codes to obtain a target rule set.
In one embodiment, when the code scanning task type is a first type, the target code is a first code; when the code scanning task type is a second type, the target code is a second code.
In one embodiment, the reading module 330 is configured to: selecting a reading rule with the highest preset priority from the target rule set as a target reading rule; reading the first bar code for verification according to a target reading rule; judging whether the verification passes; when the verification fails, selecting a reading rule of the next priority from the target rule set as a target reading rule according to the sequence of the preset priority from high to low; and reading the first bar code for verification according to the target reading rule until the verification is passed.
In one embodiment, the reading module 330 is specifically configured to: intercepting the first bar code according to a target reading rule to obtain a second bar code; acquiring article information corresponding to the second bar code; and verifying the article information.
In one embodiment, the reading module 330 is specifically configured to: reading the first bar code according to a target reading rule; acquiring a second bar code corresponding to the first bar code based on a preset incidence relation; acquiring article information corresponding to the second bar code; and verifying the article information.
In one embodiment, the reading rule includes encoding information, interception mode information, priority information, and valid status information.
For a detailed description of the barcode reading apparatus 300, please refer to the description of the related method steps in the above embodiments.
An embodiment of the present invention further provides a storage medium readable by an electronic device, including: a program that, when run on an electronic device, causes the electronic device to perform all or part of the procedures of the methods in the above-described embodiments. The storage medium may be a magnetic Disk, an optical Disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a Flash Memory (Flash Memory), a Hard Disk (Hard Disk Drive, abbreviated as HDD), a Solid State Drive (SSD), or the like. The storage medium may also comprise a combination of memories of the kind described above.
In the embodiments provided in the present application, the disclosed apparatus and method can be implemented in other ways. The apparatus embodiments described above are merely illustrative, and for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s).
In some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. The above description is only a preferred embodiment of the present application, and is only for the purpose of illustrating the technical solutions of the present application, and not for the purpose of limiting the present application. Any modification, equivalent replacement, improvement or the like, which would be obvious to one of ordinary skill in the art and would be within the spirit and principle of the present application, should be included within the scope of the present application.