Order printing method and device
By determining the order printing order and creating a task queue, the problem of out-of-order or missed order printing in the prior art is solved, and efficient and accurate order printing is achieved.
Patent Information
- Application Number
- CN202411579366.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-06
- Publication Date
- 2025-02-18
AI Technical Summary
The prior art is prone to outdated orders or missed orders when batch printing of order sets of multiple printing plug-ins, resulting in low production efficiency and high error rate.
By determining the target order and its printing order in response to the received order printing requests from multiple platforms, a task queue is created, and a task to be printed from the task queue is obtained based on a pre-set task scheduler, and sending it to the corresponding printing plug-in for Order printing.
In the case of mixed platform batch printing, order printing is carried out in the actual order of orders, which improves production efficiency and reduces error rate.
Smart Images

Figure CN119473186A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method and device for order printing. Background Art
[0002] In the prior art, when batch printing is performed on an order set involving multiple printing plug-ins, due to the different execution strategies or execution efficiencies of each printing plug-in, disorder or missing orders are often prone to occur during order printing, and can only be processed through manual verification or reprinting.
[0003] In the process of implementing the present invention, the inventors found that there are at least the following problems in the related art:
[0004] It is impossible to print orders in the actual order of the orders, and manual verification or reprinting has low production efficiency and high error rate. Summary of the invention
[0005] In view of this, an embodiment of the present invention provides a method and device for order printing, which can print orders according to the actual order of orders in the case of mixed platform batch sequential printing, with high production efficiency and low error rate.
[0006] To achieve the above object, according to one aspect of an embodiment of the present invention, a method for printing an order is provided, comprising:
[0007] In response to the received order printing requests of the multiple platforms, determining the target orders of the multiple platforms and the printing order of the target orders;
[0008] Arranging the target orders according to the printing order, and creating a task queue for the sorted target orders;
[0009] Based on a preset task scheduler, the tasks to be printed are obtained from the task queue, and the tasks to be printed are sent to multiple printing plug-ins corresponding to the tasks to be printed for order printing.
[0010] Further, in response to receiving order printing requests from multiple platforms, the method further includes:
[0011] Determine whether the user turns on a pre-configured multi-platform printing control switch; wherein the multi-platform printing control switch is used to control batch printing of multi-platform orders.
[0012] Furthermore, the multi-platform printing control switch is configured by the following steps:
[0013] Determine the scope of action and trigger conditions of the multi-platform printing control switch, determine configuration parameters based on the scope of action and trigger conditions, and set the multi-platform printing control switch according to the configuration parameters.
[0014] Furthermore, the method further comprises:
[0015] Determine whether there is a task to be printed in the task queue;
[0016] If so, obtaining the to-be-printed task from the task queue based on a preset task scheduler;
[0017] If not, the order printing will be terminated.
[0018] Furthermore, after sending the to-be-printed tasks to a plurality of print plug-ins corresponding to the to-be-printed tasks for order printing, the method further includes:
[0019] Monitor the execution results of the multiple print plug-ins, determine the printing result of the task to be printed based on the execution results, and return the execution result to the task scheduler or feed back to the requester of the order printing request.
[0020] Further, monitoring the execution results of the multiple print plug-ins and determining the print result of the to-be-printed task based on the execution results includes:
[0021] Based on the pre-configured message callback mechanism corresponding to each print plug-in, monitor the message information returned by each print plug-in;
[0022] In response to the message information having a print success flag, marking the print result of the task to be printed as print completed and print successful;
[0023] In response to the message information not having a print success flag, marking the print result of the task to be printed as print completed and print failed.
[0024] Furthermore, when the printing result is a printing failure, the method further includes:
[0025] Based on the preset number of retries, a retry mechanism is used to redirect and reprint the failed print tasks.
[0026] According to a second aspect of an embodiment of the present invention, there is provided an order printing device, comprising:
[0027] A printing request module, in response to received order printing requests from multiple platforms, determines target orders of the multiple platforms and a printing order of the target orders;
[0028] A task queue module arranges the target orders according to the printing order and creates a task queue for the arranged target orders;
[0029] The order printing module obtains the tasks to be printed from the task queue based on a preset task scheduler, and sends the tasks to be printed to multiple printing plug-ins corresponding to the tasks to be printed for order printing.
[0030] According to a third aspect of an embodiment of the present invention, there is provided an electronic device, including:
[0031] one or more processors;
[0032] a memory for storing one or more programs,
[0033] When the one or more programs are executed by the one or more processors, the one or more processors are enabled to implement the method described in any one of the above embodiments.
[0034] According to a fourth aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored, and when the program is executed by a processor, the method described in any one of the above embodiments is implemented.
[0035] According to a fifth aspect of an embodiment of the present invention, there is provided a computer program product, including a computer program, which implements the method of any of the above embodiments when the computer program is executed by a processor.
[0036] An embodiment of the above invention has the following advantages or beneficial effects: by responding to the received order printing request, determining the target order and the printing order of the target order; arranging the target order according to the printing order, and creating a task queue; obtaining the task to be printed from the task queue based on a pre-set task scheduler, and sending the task to be printed to the print plug-in corresponding to the task to be printed for order printing; the embodiment of the present invention can print orders in the actual order of orders in the case of mixed platform batch sequential printing, with high production efficiency and low error rate.
[0037] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0039] Figure 1 is a schematic diagram of the main process of the order printing method according to an embodiment of the present invention;
[0040] Figure 2 It is a schematic diagram of the main process of a method for printing an order according to a reference embodiment of the present invention;
[0041] Figure 3is a schematic diagram of the main process of an order printing method according to another reference embodiment of the present invention;
[0042] Figure 4 is a schematic diagram of the main process of an order printing method according to another reference embodiment of the present invention;
[0043] Figure 5 is a schematic diagram of main modules of an order printing device according to an embodiment of the present invention;
[0044] Figure 6 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;
[0045] Figure 7 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0046] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0047] It should be noted that the acquisition, storage and application of personal information etc. involved in the embodiments of the present invention are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0048] At present, in the existing WMS (Warehouse Manage System) warehousing operations, there are generally orders from multiple platforms in a single warehouse. The orders can be printed after the wave is successfully assembled, but due to inconsistent order sources, the corresponding printing plug-ins for the orders are also different. When facing multiple sales platforms, mixed carriers, and orders involving multiple printing plug-ins, there are often problems of disorder or missing orders when placing orders in advance due to the execution strategies and execution efficiency of each printing plug-in. Since warehouse production is often produced in units of thousands, it is time-consuming and laborious to handle missed orders or disorder in actual operations, and the accuracy of the orders cannot be guaranteed, which will have a negative impact on the warehouse and users. Therefore, the warehouse mainly organizes waves for orders corresponding to a single printing plug-in, which conflicts with the actual order sequence and picking sequence received in the warehouse, and the production efficiency in the warehouse is limited. When the printing device is out of paper, stuck, or out of ink, the system cannot effectively determine whether the order should be printed at this time. It can only be processed through manual verification or reprinting, which greatly affects production efficiency and the probability of problems will be magnified. Due to errors in manual verification, multiple, wrong, and missed shipments often occur, which is not only inefficient but also causes economic losses.
[0049] In view of this, according to one aspect of an embodiment of the present invention, a method for order printing is provided.
[0050] Figure 1 FIG. 2 is a schematic diagram of the main process of the order printing method according to an embodiment of the present invention. Figure 1 As shown, the order printing method according to an embodiment of the present invention includes:
[0051] Step S101, in response to order printing requests received from multiple platforms, determining target orders of the multiple platforms and a printing order of the target orders;
[0052] Specifically, the order printing request of multiple platforms refers to the request for order printing operation from multiple platforms triggered according to user needs after the system or service receives the order information submitted by the user. The order printing request includes the specific information of the order and the setting requirements for printing to ensure that the order can be accurately printed and meet the needs of the user, wherein the order printing request may include the information of the goods or services ordered by the user, such as the name of the goods, quantity, price, total amount, user's contact information, delivery address and other related information; it may also include the settings and requirements for specifying printing, such as the printing format (such as PDF, text), paper size, printing color, etc.; it may also include specifying the location or target device for printing, such as the user specifies that the order is printed on a specific printer, or the print result is saved in a specific folder; it may also include the user providing additional instructions or remarks, or providing specific requirements or precautions; it may also include determining when the order should trigger the printing operation, such as triggering printing immediately when the user submits the order, or automatically triggering printing when the order status changes (such as order confirmation, payment completion, etc.).
[0053] Target orders refer to orders from multiple platforms that need to be printed and meet the printing conditions, which are selected by the system according to certain rules or conditions after receiving order printing requests from multiple platforms. The determination of target orders and the printing order of target orders includes but is not limited to the following situations: the system can only select orders in a specific state (such as pending, confirmed, paid, etc.) for printing; according to specific business rules or requirements, the target orders are determined by set strategies, such as classification and sorting by geographic location, customer type, etc.; the system can determine the printing order according to the priority of the order (such as urgent orders, high-value orders, etc.), and give priority to printing high-priority orders; the printing order can also be determined according to the time sequence of order submission, and the first submitted order is given priority; the user specifies a specific order or printing order through the system interface or other means, and the system determines the target order and printing order according to the user's settings.
[0054] The determination of target orders ensures that the system can handle printing requests from multiple platforms in an orderly manner and ensure that important orders are processed in a timely manner. By determining a reasonable printing order, the system can give priority to important orders and improve the efficiency and accuracy of order processing. At the same time, it can also meet the needs and expectations of users and ensure that orders are processed and delivered in a timely manner.
[0055] Step S102, arranging the target orders according to the printing order, and creating a task queue for the sorted target orders;
[0056] The target orders are arranged according to the printing order determined in the above step S101 to ensure that the target orders are processed and printed one by one according to certain rules and order. When arranging, the system needs to sort the target orders according to different factors of the printing order to ensure that the system can effectively process the orders and meet the needs of users. First, the system can sort the target orders according to the priority of the order, and the high-priority orders are placed in front of the task queue to ensure that these orders are processed and printed first to meet the requirements of urgent needs or important customers; second, the system can sort the target orders according to the time sequence of order submission, and the first submitted orders may be placed in front of the task queue, and processed and printed one by one according to the principle of first come first served to ensure that the orders can be processed in time; if the orders involve different geographical locations or delivery areas, the system can sort according to the delivery address or delivery area of the order, give priority to orders in similar areas, reduce delivery time and cost, and improve efficiency; the system can also consider the special requirements or settings of the user, and arrange the target orders according to the sorting rules specified by the user, which can meet the personalized needs of the user and improve the user experience; finally, the system can also dynamically adjust the order sorting according to the real-time situation, such as speeding up the processing speed during peak hours to ensure that the orders can be printed and processed in time.
[0057] A task queue is a data structure used to store and manage tasks that need to be processed in a certain order so that the system can process these tasks one by one according to specific rules. In an order printing system, a task queue can be used to store orders that need to be printed so that the system can process the print requests of these orders one by one according to a certain printing order. The specific steps to create a task queue are as follows: First, determine the data structure used by the task queue. Common data structures include queues, stacks, priority queues, etc. In order printing systems, FIFO queues (First In, First Out) are generally selected. Out, first in, first out) to store orders so that they can be processed one by one in the order they were submitted; secondly, determine the specific content and attributes of each task. In the order printing system, the task object can be the information of the order, including the order number, order content, printing settings, etc. Each task object must contain enough information so that the system can correctly process the order printing request; then, based on the selected data structure, create an empty task queue. In the order printing system, arrays, linked lists and other data structures can be used to implement queues, which are initialized to empty; then add the target order to the queue, and add the target order to the task queue one by one according to the above printing order. According to different sorting rules, you can choose to add orders from the head or tail of the queue; furthermore, the system can provide corresponding operation interfaces to manage the task queue, including operations such as adding tasks, deleting tasks, and viewing the head of the queue, to ensure that the system can obtain tasks from the queue in the correct order for processing; finally, the system takes out tasks from the task queue for processing as needed, for example, sending order information to a printing device (such as a printer, etc.) for printing. After processing a task, the system may need to remove the task from the queue in order to process the next task.
[0058] Through the above steps, a task queue can be created to store and manage pending orders, and the system can process order printing requests in the correct order, effectively ensuring that orders are printed in the preset order, improving printing efficiency and accuracy, ensuring that important orders are processed first, meeting user needs, simplifying management, and reducing operational risks.
[0059] Step S103, based on a preset task scheduler, obtain the tasks to be printed from the task queue, and send the tasks to be printed to multiple printing plug-ins corresponding to the tasks to be printed for order printing.
[0060] A task scheduler is a component or system used to manage and schedule task execution. In an order printing system, the task scheduler is responsible for obtaining orders to be printed from the task queue and allocating them to available printing resources for processing according to certain rules.
[0061] Among them, the task scheduler can be set up through the following steps: first, determine the scheduling strategy of the task scheduler according to system requirements and performance characteristics, such as first-in-first-out (FIFO), priority scheduling, shortest job first, time slice rotation, etc.; among them, set the parameters of the task scheduler, such as task queue size, scheduling interval, priority setting, etc., and you can also adjust the parameters according to system load and performance requirements to optimize the system's operating efficiency and resource utilization; then, write the logic code of the task scheduler, including obtaining tasks from the task queue, selecting appropriate tasks according to the scheduling strategy, assigning tasks to available resources, etc., to ensure that the scheduler can allocate and schedule tasks according to the expected strategies and rules; then integrate the task scheduler into the order printing system, and ensure normal interaction and collaboration with other components, and seamlessly connect with modules such as the task queue and print resource manager to achieve automated management and control of the order printing process.
[0062] The task scheduler obtains the next task to be printed from the task queue according to the preset scheduling strategy; according to the print plug-in information corresponding to the task to be printed, the task scheduler obtains the corresponding print plug-in instance and prepares to print the order; according to the content of the task to be printed, the order data to be sent to the print plug-in is prepared, including order information, print settings, etc.; the task scheduler sends the prepared order data to the obtained multiple print plug-ins; waits for the response of each print plug-in, at which time the asynchronous mechanism can be started to allow the system to perform other operations at the same time, such as obtaining the next task to be printed or handling abnormal situations; when the print plug-in completes printing and returns a response, the task scheduler will perform corresponding processing based on the response result. If printing is successful, the print log is recorded and the order is marked as printed; if printing fails, the error information is recorded, and retries are performed or the order is marked as unprinted according to the situation; the task scheduler continues to perform the next round of task scheduling, obtains the next task to be printed from the task queue, and repeats the above steps until the task queue is empty or the system stops.
[0063] Through the above steps, the task scheduler can effectively manage the orders in the task queue, schedule according to the set strategies and rules, improve the overall efficiency and performance of the printing system, effectively manage and distribute tasks to be printed, and interact with the corresponding printing plug-ins to realize sequential printing of orders.
[0064] The embodiment of the present invention determines the target order and the printing order of the target order by responding to the received order printing request; arranges the target order according to the printing order and creates a task queue; obtains the to-be-printed tasks from the task queue based on a pre-set task scheduler, and sends the to-be-printed tasks to the printing plug-in corresponding to the to-be-printed tasks for order printing; and can print orders in the actual order of the orders in the case of mixed platform batch sequential printing, with high production efficiency and low error rate.
[0065] Optionally, in step S101, after responding to order printing requests received from multiple platforms, the method further includes:
[0066] Determine whether the user turns on a pre-configured multi-platform printing control switch; wherein the multi-platform printing control switch is used to control batch printing of multi-platform orders.
[0067] The multi-platform printing control switch is a system function or mechanism used to temporarily shut down certain functions or services when system resources are limited or abnormal, so as to ensure the stability and availability of the system, such as a downgrade switch. In the order printing system, the multi-platform printing control switch is used to control the batch printing of multi-platform orders to avoid system performance degradation or system crash due to the printing of a large number of orders.
[0068] Specifically, a switch button or check box is provided in the user settings or management interface of the system so that the user can manually turn on or off the downgrade function. The user can set it according to his or her own needs and actual conditions. The system can monitor indicators such as system load and resource utilization, and automatically enable the downgrade function to protect system stability when the system pressure is too high or resources are tight. The automation mechanism can be carried out without user intervention, thereby improving the intelligence of the system. The system can also decide whether to enable the downgrade function based on user feedback and needs. For example, when a large number of users report that the system responds slowly or print tasks fail, the system administrator can enable the downgrade function to deal with the problem. The system can preset some conditions and policies, and automatically enable the downgrade function when the preset conditions are met. For example, the downgrade function is automatically enabled when the system load exceeds a certain threshold or a continuous abnormal situation occurs.
[0069] The multi-platform printing control switch is a compatible means adopted when users use batch printing of multi-platform waybills. It can be turned on for a single tenant or a single warehouse in a tenant, which can effectively protect user behavior and avoid order printing failures caused by changes in operating habits. The identity of the logged-in user can be controlled and the strategy of determining whether the user uses mixed-platform batch printing can be determined by diversion according to the interface. Taking WMS as an example, the configuration of the multi-platform printing control switch can be designed on the management side. The configuration can specify the key of the switch and whether it is turned on in the tenant dimension or the warehouse dimension. The warehouse and tenant are many-to-one, and the tenant and warehouse are one-to-many, that is, turning on the tenant dimension will turn on all warehouses. Turning on a single warehouse only affects the current warehouse and does not affect the remaining warehouses under the tenant. When the user enters the WMS system, the system reads the configuration without user perception, and obtains the diversion configuration of the printing strategy. When the user needs to turn this item off or on, just click the switch on the management side.
[0070] For example, the user first performs single sign-on; after obtaining the user identity, the system configuration is read to determine whether the user has permission in the current warehouse. If the user has permission, it is determined whether the user has enabled sequential printing. If it is enabled, mixed-platform and mixed-carrier printing can be performed when printing. Otherwise, the user cannot use the mixed-platform sequential printing function. If the user does not have permission, the user is prompted that he does not have operating permission and cannot operate any function in the WMS system. He needs to find a warehouse manager to add permission.
[0071] The embodiment of the present invention provides a clear and concise user interface, allowing users to easily find and operate switches. The system automatically enables the downgrade function according to preset conditions, which can ensure service stability when the system is under excessive pressure or abnormal conditions, and avoid system performance degradation or crash caused by printing a large number of orders, thereby improving user experience and order processing efficiency.
[0072] Optionally, Figure 2 FIG. 1 is a schematic diagram of the main process of a method for printing an order according to a reference embodiment of the present invention. Figure 2 As shown, the multi-platform printing control switch is configured through the following steps:
[0073] Step S201, determining the action range and triggering condition of the multi-platform printing control switch;
[0074] Step S202, determining configuration parameters based on the scope of action and trigger conditions;
[0075] Step S203: setting a multi-platform printing control switch according to the configuration parameters.
[0076] Among them, the scope of action refers to the scope of influence of the downgrade function, which can be the entire system, a specific tenant, or a specific warehouse, etc.; the trigger condition refers to the circumstances under which the downgrade function is enabled, such as the system load is higher than a certain threshold, an abnormal situation occurs, etc.; the specific content of the configuration parameters is determined according to the above-mentioned scope of action and trigger conditions, for example, the threshold of the system load, the type and severity of the abnormal situation, etc.; according to the determined configuration parameters, the multi-platform printing control switch is set accordingly, including turning on or off the downgrade function, adjusting the specific parameters of the downgrade function, etc.
[0077] For example, if the scope of action is the entire system and the trigger condition is that the system load is higher than 80%, then the configuration parameter can be to set the system load threshold to 80%. According to the configuration parameters, the system will automatically enable the degradation function when the system load exceeds 80%. The specific setting method can be performed through the system management interface or configuration file.
[0078] By clarifying the scope and trigger conditions of the multi-platform printing control switch, the embodiment of the present invention can enable the system to accurately determine when the downgrade function needs to be enabled; based on the scope and trigger conditions, the configuration parameters are determined to help system administrators better adjust and optimize the downgrade strategy and improve the system's adaptability to abnormal situations; setting the multi-platform printing control switch according to the configuration parameters can ensure the timely activation and accurate execution of the downgrade function, ensuring that the system can respond quickly and maintain stable operation when facing abnormal situations, thereby improving user experience and system reliability.
[0079] Optionally, Figure 3 FIG. 2 is a schematic diagram of the main process of an order printing method according to another reference embodiment of the present invention. Figure 3 As shown, the method also includes:
[0080] Determine whether there is a task to be printed in the task queue;
[0081] If so, obtaining the to-be-printed task from the task queue based on a preset task scheduler;
[0082] If not, the order printing will be terminated.
[0083] Specifically, before printing an order, first check whether there are any tasks to be printed in the task queue. If so, execute the next step, use the above-mentioned task scheduler to obtain the next task to be printed from the task queue, and send it to the corresponding print plug-in for order printing; if there are no tasks to be printed in the print queue, the order printing process stops, and the system no longer continues to execute the order printing operation.
[0084] The embodiment of the present invention can effectively manage and execute order printing tasks, ensuring that when there are tasks to be processed, they can be acquired and printed in a timely manner, and when there are no tasks, the printing process can be stopped to avoid wasting resources.
[0085] Optionally, after step S103 sends the to-be-printed task to multiple print plug-ins corresponding to the to-be-printed task for order printing, the method further includes:
[0086] Monitor the execution results of the multiple print plug-ins, determine the printing result of the task to be printed based on the execution results, and return the printing result to the task scheduler or feed back to the requester of the order printing request.
[0087] Specifically, during the order printing process, the system monitors the execution result of the print plug-in, determines the print result of the task to be printed according to the execution result, and returns the print result to the task scheduler, so that the system can timely understand the execution status of the print task and perform subsequent processing. The system monitors the execution status of the print plug-in in real time through the communication channel established with the print plug-in, which can be achieved through WebSocket (network socket), HTTP (Hypertext Transfer Protocol, Hypertext Transfer Protocol) request, etc. The system will continue to receive the execution result from the print plug-in; when the system receives the execution result of the print plug-in, it will perform corresponding processing. If the print task is successfully executed, the system will return the corresponding information to the task scheduler and mark the task as completed. If the print task fails to execute, the system will also return the failure information to the task scheduler for subsequent processing; according to the execution result, the system updates the corresponding task status. If the task is successfully executed, the task is marked as completed. If the task fails to execute, it can be retried, abandoned or otherwise processed according to the specific situation. The embodiment of the present invention monitors and manages the order printing process in real time by listening to the execution results of the print plug-in and returning them to the task scheduler in a timely manner. By obtaining the execution results in a timely manner, the system can quickly respond to the status changes of the print task, such as success, failure or exception, so as to perform subsequent processing, improve the reliability and stability of the system, ensure the smooth progress of the order printing process, reduce delays or interruptions caused by printing errors, and improve user satisfaction and order processing efficiency. At the same time, timely feedback on execution results also helps system administrators to discover and solve problems in a timely manner and ensure the normal operation of the system.
[0088] Specifically, in addition to simple success or failure feedback, the system can provide more detailed reports, including detailed logs of printing, printing status of each order, reasons for failure, and other information, so that users can have a more comprehensive understanding of each link in the printing process; the system can not only feedback the results after printing is completed, but also send the printing progress information to the user in real time, so that the user can monitor the printing of the order in real time, and find and solve problems in time; feedback the printing results through the system interface, or send the printing results to the user through multiple channels such as email and text messages to ensure that the user can receive feedback information in time; while feeding back the printing results, the system can also provide some self-service solutions, such as providing options for reprinting or canceling printing for failed orders, so that users can handle the problem by themselves and reduce the burden on the system. The feedback mechanism of the embodiment of the present invention helps to improve the user experience, allowing users to understand the printing of orders in a timely manner, and to handle problems in time when printing occurs, reducing user waiting time and enhancing the interactivity and user-friendliness of the system.
[0089] Optionally, monitoring the execution results of the multiple print plug-ins, and determining the print result of the task to be printed based on the execution results, includes:
[0090] Based on the pre-configured message callback mechanism corresponding to each print plug-in, monitor the message information returned by each print plug-in;
[0091] In response to the message information having a print success flag, marking the print result of the task to be printed as print completed and print successful;
[0092] In response to the message information not having a print success flag, marking the print result of the task to be printed as print completed and print failed.
[0093] Specifically, each print plug-in is pre-configured with a message callback mechanism, which is used to process and monitor the execution results of the print task. When the print task is sent to the print plug-ins of different platforms, the system will monitor the message information returned by each print plug-in in real time through these message callback mechanisms. These message information contains the execution status identification of the print task, such as whether the printing is successful, whether there is an error or other status information. When the system monitors that the message information returned by a print plug-in contains a print success mark, the system will mark the result of the print task as "printing completed and printing successful". This mark can be customized by each platform and can be a specific status code, iconic text, or other information that can clearly indicate that the printing is successful. After parsing this information, the system immediately updates the status of the task, records it as successful, and can store this result in the log or notify other related system modules. If there is no mark indicating successful printing in the message information, or if it clearly shows a failed printing status, the system will mark the result of the print task as "print completed and failed". In this case, although the task is marked as completed, the result is a failure. The system will update the status of the task accordingly and may trigger other error handling mechanisms, such as retrying printing, notifying the administrator, or recording in the log for subsequent troubleshooting and problem analysis. In this way, the system can effectively monitor and manage the execution status of multiple print tasks and ensure that the results of each task are accurately recorded and processed. Regardless of whether the result of the print task is success or failure, the system can respond in a timely manner to ensure the stability and reliability of the printing process.
[0094] Optionally, when the printing result is a printing failure, the method further includes:
[0095] Based on the preset number of retries, a retry mechanism is used to redirect and reprint the failed print tasks.
[0096] Specifically, the system first checks the preset number of retries to determine the maximum number of retries allowed; if the printing task fails, the system will automatically start the retry mechanism, and according to the preset number of retries, the system will try to resend the printing task; during the retry process, the system will re-add the failed task to be printed to the print queue and reprint it. The system skips the printing task being executed and gives priority to the tasks that need to be retried; the system will ensure that there will be no unlimited retries based on the preset retry limit; once the preset retry limit is reached, the system will stop retrying and mark the task as a printing failure; during the retry process, the system can send a notification to the user to inform him that the printing task has failed and that the system is trying to reprint; if the retry is successful, the user will be notified again that the printing is successful; if the retry times are exhausted and still fail, the user will be notified of the printing failure.
[0097] The embodiment of the present invention can automatically handle printing failures through the above-mentioned retry mechanism, thereby improving the success rate of order printing, reducing the manual intervention of users, and also reducing the work pressure on system operators.
[0098] As a preferred embodiment of the present invention, Figure 4 It is a schematic diagram of the main process of a method for printing an order according to another reference embodiment of the present invention.
[0099] like Figure 4As shown, after setting up the downgrade switch, the printing tasks are executed sequentially; based on the browser, a connection is established with the printing plug-ins of each platform through websockt (network socket) to send the printing tasks. Since the send (send) and onmessage (message receiving event) of websocket are triggered asynchronously, a queue mechanism is added to store all printing tasks, and a task scheduler is established, and a judgment of success or failure is added to the callback of each websocket instance. The specific steps are: First, all the orders selected by the user are arranged in the order selected by the user, and the selected orders are divided into groups of 20. In order not to affect the user's printing efficiency, ajax requests will be sent to obtain printing data in groups of 20 orders. The array divided at this time is called the total printing task. Secondly, take the first set of data when printing for the first time, and use async await (Asynchronous / Await) to make sequential Ajax requests (Asynchronous JavaScript andXML, asynchronously) obtains the current print data. After each successful data acquisition, the group of data will be deleted from the total print task and recorded in the current print task. Before entering the print task queue, it is first determined whether there are any tasks in the total print task that have not obtained data. Since Ajax requests are asynchronous, the system can initiate a data request first without waiting for the result to be returned to get the last acquired print data and enter the print task queue; then, in the print plug-in of each platform, a custom callback method of omessage is added to determine the successful printing mark based on the message defined by each platform, and modify the mark of whether the current print task is completed and the mark of whether the printing is successful. If the current message shows that the printing failed, the mark of whether the printing task is completed will be updated, but the printing The result will be defined as failure; in the print task queue, the system loops the print data and makes judgments based on the identifier in the print data, enters different websocket tasks based on the identifier, and after sending a single print task, polls to determine whether the print plug-in returns a print completion identifier. When it is determined that the current print task is completed, it will determine whether the print task is successful. If successful, it will be recorded in the print log and marked as print success, and it will be determined whether the current print data has been completely looped; finally, when all the above print data has been successfully printed, the queue loop mechanism is also used to poll whether the previous asynchronous print data acquisition task has returned successfully. When the data is successfully returned, it will be recorded in the current print data, and the loop will continue to jump to the loop print data and make judgments based on the identifier in the print data.
[0100] For example, the existing queues are self-operated, Douyin, Pinduoduo, etc. The first task is matched to the cloud printing plug-in according to the identifier, and assembled into the data required for printing, sent to the printing plug-in, and waits for the return of the printing plug-in. According to the return result, it is determined whether to continue printing or interrupt processing. Assuming that the existing task has been successful, the loop will continue and enter the Douyin loop logic according to the identifier. When the loop reaches the end of Pinduoduo printing, it is determined whether the total printing task is empty. If it is empty, it means that the print task without data is empty. Next, it is determined whether there is a task that has obtained data but has not been printed. If it exists, the loop printing continues. If it does not exist, it indicates that the printing task is completely completed. At this time, a pop-up window will prompt the user to print the total amount of tasks. And provide a one-click copy of the successful printing order.
[0101] The errors after entering the queue are captured and processed. Regardless of any interruption, the successfully printed orders and the orders that failed to obtain data will be displayed intuitively. A retry mechanism based on the current order is provided, and quick jumps are provided for reprinting and error information copying. When the print data is abnormal, it will automatically retry once. If the retry fails, the printing will be interrupted directly and a prompt will be given. After obtaining the print data, it enters the loop printing error. At this time, the error conditions include printer connection interruption, printer abnormality, print result failure, program abnormality, etc.; when the printer connection is interrupted, it will try to reconnect. If the reconnection is successful, printing will continue. If it fails, the user will be prompted to check whether the print plug-in and the real printer are connected normally; when the printer is abnormal, after the request data is sent successfully, it will wait for the return result for 3s. If the print data is not successfully returned, it is regarded as a printer abnormality. The user will be prompted to continue printing or skip the current failed order and continue printing. After continuing to print successfully, it will print normally. After continuing to print fails, the current failure information will be prompted and the user will be given the opportunity to select again. If skipping printing, the next order printing will be entered according to the loop data, and the current data will be recorded and prompted when all order printing is completed or subsequent printing is interrupted; when the printer is abnormal, the processing is the same as the printer abnormality; when the program is abnormal, the user is prompted to contact the operation and maintenance personnel and record the printing log on the server.
[0102] According to a second aspect of an embodiment of the present invention, there is provided an order printing device 500, comprising:
[0103] The printing request module 501 determines the target orders of the multiple platforms and the printing order of the target orders in response to the received order printing requests of the multiple platforms;
[0104] A task queue module 502 arranges the target orders according to the printing order and creates a task queue for the arranged target orders;
[0105] The order printing module 503 obtains the tasks to be printed from the task queue based on a preset task scheduler, and sends the tasks to be printed to multiple printing plug-ins corresponding to the tasks to be printed for order printing.
[0106] Optionally, the print request module 501 is further configured to:
[0107] Determine whether the user turns on a pre-configured multi-platform printing control switch; wherein the multi-platform printing control switch is used to control batch printing of multi-platform orders.
[0108] Optionally, the print request module 501 is further configured to:
[0109] Determine the scope of action and trigger conditions of the multi-platform printing control switch, determine configuration parameters based on the scope of action and trigger conditions, and set the multi-platform printing control switch according to the configuration parameters.
[0110] Optionally, the order printing device further includes a task determination module, which is used to:
[0111] Determine whether there is a task to be printed in the task queue;
[0112] If so, obtaining the to-be-printed task from the task queue based on a preset task scheduler;
[0113] If not, the order printing will be terminated.
[0114] Optionally, the order printing device further includes a task monitoring module, which is used to:
[0115] Monitor the execution result of the print plug-in, determine the print result of the task to be printed based on the execution result, and return the print result to the task scheduler or feed back to the requester of the order printing request.
[0116] Optionally, the task monitoring module is further used to:
[0117] Based on the pre-configured message callback mechanism corresponding to each print plug-in, monitor the message information returned by each print plug-in;
[0118] In response to the message information having a print success flag, marking the print result of the task to be printed as print completed and print successful;
[0119] In response to the message information not having a print success flag, marking the print result of the task to be printed as print completed and print failed.
[0120] Optionally, the task monitoring module is further used to:
[0121] When the printing result is a printing failure, based on a preset number of retries, a retry mechanism is used to jump and reprint the failed printing task.
[0122] It should be noted that the specific implementation content of the order printing device described in the present invention has been described in detail in the order printing method described above, so the repeated content will not be described here.
[0123] According to a third aspect of an embodiment of the present invention, there is provided an electronic device, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method provided by the first aspect of the embodiment of the present invention.
[0124] According to a fourth aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored, and when the program is executed by a processor, the method provided by the first aspect of the embodiment of the present invention is implemented.
[0125] According to a fifth aspect of an embodiment of the present invention, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the method provided by the first aspect of the embodiment of the present invention is implemented.
[0126] Figure 6 An exemplary system architecture 600 is shown to which an order printing method or an order printing device according to an embodiment of the present invention can be applied.
[0127] like Figure 6 As shown, system architecture 600 may include terminal devices 601, 602, 603, network 604 and server 605. Network 604 is used to provide a medium for communication links between terminal devices 601, 602, 603 and server 605. Network 604 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0128] The user can use the terminal devices 601, 602, 603 to interact with the server 605 through the network 604 to receive or send messages, etc. Various communication client applications can be installed on the terminal devices 601, 602, 603, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only for example).
[0129] The terminal devices 601 , 602 , and 603 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers, etc.
[0130] The server 605 may be a server that provides various services, such as a backend management server (only an example) that provides support for shopping websites browsed by users using the terminal devices 601, 602, and 603. The backend management server may analyze and process the received data such as the order printing request, and feed back the processing result (such as the printing result - only an example) to the terminal device.
[0131] It should be noted that the order printing method provided in the embodiment of the present invention is generally run by the server 605, and accordingly, the order printing device is generally set in the server 605.
[0132] It should be understood that Figure 6 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0133] Reference below Figure 7 , which shows a schematic diagram of the structure of a computer system 700 of a terminal device suitable for implementing an embodiment of the present invention. Figure 7 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0134] like Figure 7 As shown, the computer system 700 includes a central processing unit (CPU) 701, which can execute various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage part 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the system 700 are also stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0135] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, a modem, etc. The communication section 709 runs a communication process via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed, so that a computer program read therefrom is installed into the storage section 708 as needed.
[0136] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for running the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 709, and / or installed from the removable medium 711. When the computer program is executed by the central processing unit (CPU) 701, the above-mentioned functions defined in the system of the present invention are executed.
[0137] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0138] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually run basically in parallel, and they can sometimes run in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that runs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0139] The modules involved in the embodiments of the present invention may be implemented in software or hardware. The modules described may also be set in a processor, for example, they may be described as: a processor including a print request module, a task queue module, and an order printing module. The names of these modules do not, in some cases, constitute limitations on the modules themselves. For example, the print request module may also be described as "a module that determines the target orders of the multiple platforms and the printing order of the target orders in response to order printing requests received from the multiple platforms."
[0140] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by the device, the device includes: responding to order printing requests received from multiple platforms, determining the target orders of the multiple platforms and the printing order of the target orders; arranging the target orders according to the printing order, and creating a task queue for the sorted target orders; obtaining the tasks to be printed from the task queue based on a pre-set task scheduler, and sending the tasks to be printed to the multiple printing plug-ins corresponding to the tasks to be printed for order printing.
[0141] The computer program product provided by the embodiment of the present invention includes a computer program, and when the computer program is executed by a processor, the order printing method in the embodiment of the present invention is implemented.
[0142] The technical solution according to the embodiment of the present invention has the following advantages or beneficial effects: by responding to order printing requests received from multiple platforms, the target orders of the multiple platforms and the printing order of the target orders are determined; the target orders are arranged according to the printing order, and a task queue for the sorted target orders is created; based on a pre-set task scheduler, the tasks to be printed are obtained from the task queue, and the tasks to be printed are sent to multiple printing plug-ins corresponding to the tasks to be printed for order printing; in the case of mixed platform batch sequential printing, orders can be printed in the actual order of the orders, with high production efficiency and low error rate.
[0143] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
[0144] It should be noted that the acquisition, storage and application of user personal information involved in the technical solution of the present disclosure are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
Claims
1. A method for order printing, characterized in that: include: In response to the received order printing requests of the multiple platforms, determining the target orders of the multiple platforms and the printing order of the target orders; Arranging the target orders according to the printing order, and creating a task queue for the sorted target orders; Based on a preset task scheduler, the tasks to be printed are obtained from the task queue, and the tasks to be printed are sent to multiple printing plug-ins corresponding to the tasks to be printed for order printing.
2. The method according to claim 1, characterized in that: After responding to the order printing requests received from the multiple platforms, the method further includes: Determine whether the user turns on a pre-configured multi-platform printing control switch; wherein the multi-platform printing control switch is used to control batch printing of multi-platform orders.
3. The method according to claim 2, characterized in that The multi-platform printing control switch is configured by the following steps: Determine the scope of action and trigger conditions of the multi-platform printing control switch, determine configuration parameters based on the scope of action and trigger conditions, and set the multi-platform printing control switch according to the configuration parameters.
4. The method according to claim 1, characterized in that: The method further comprises: Determine whether there is a task to be printed in the task queue; If so, obtaining the to-be-printed task from the task queue based on a preset task scheduler; If not, the order printing will be terminated.
5. The method according to claim 1, characterized in that After sending the to-be-printed tasks to the plurality of print plug-ins corresponding to the to-be-printed tasks for order printing, the method further includes: Monitor the execution results of the multiple print plug-ins, determine the printing results of the task to be printed based on the execution results, and return the printing results to the task scheduler or feed back to the requester of the order printing request.
6. The method according to claim 5, characterized in that Monitoring the execution results of the multiple print plug-ins, and determining the print result of the to-be-printed task based on the execution results, includes: Based on the pre-configured message callback mechanism corresponding to each print plug-in, monitor the message information returned by each print plug-in; In response to the message information having a print success flag, marking the print result of the task to be printed as print completed and print successful; In response to the message information not having a print success flag, marking the print result of the task to be printed as print completed and print failed.
7. The method according to claim 5, characterized in that When the printing result is a printing failure, the method further includes: Based on the preset number of retries, a retry mechanism is used to redirect and reprint the failed print tasks.
8. A device for printing an order, characterized in that: include: A printing request module, in response to received order printing requests from multiple platforms, determines target orders of the multiple platforms and a printing order of the target orders; A task queue module arranges the target orders according to the printing order and creates a task queue for the arranged target orders; The order printing module obtains the tasks to be printed from the task queue based on a preset task scheduler, and sends the tasks to be printed to multiple printing plug-ins corresponding to the tasks to be printed for order printing.
9. An electronic device, characterized in that: include: one or more processors; a memory for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors are enabled to implement the method according to any one of claims 1 to 7.
10. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Data processing method and related equipment
CN120469657A