Cross-platform Web end weighing equipment data acquisition and instruction interaction method and system
By adopting a cross-platform web-based method for data acquisition and command interaction of weighing equipment, the platform dependency and hardware integration challenges of weighing systems have been solved, enabling real-time and reliable interaction of weighing data and multi-terminal data sharing, thereby improving the system's scalability and deployment flexibility.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HUNAN DATANG XIANYI TECH CO LTD
- Filing Date
- 2025-12-04
- Publication Date
- 2026-05-01
AI Technical Summary
Weighing systems are highly dependent on the platform, have difficulties in hardware integration and maintenance, are inconvenient for multi-terminal data sharing, and cannot directly and stably access the underlying hardware via the web interface. They are difficult to expand and migrate in heterogeneous computing environments, and data cannot be acquired and utilized in real time.
It provides a cross-platform web-based method for data acquisition and command interaction of weighing equipment. By deploying a cross-platform server program, it establishes a communication connection between the hardware adaptation layer and the weighing equipment and card reader/writer, enabling real-time data monitoring and parsing. It utilizes WebSocket long connections for data push and command feedback, supports multi-channel concurrent processing and data security modules, and provides a unified configuration management interface and data credibility assessment.
It enables real-time, reliable, and centralized interaction of weighing data commands, improves the system's scalability, deployment flexibility, and integration efficiency, and supports multi-terminal data sharing and flexible expansion of hardware devices.
Smart Images

Figure CN121967389A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data interaction technology, specifically to a cross-platform web-based method and system for data acquisition and command interaction of weighing equipment. Background Technology
[0002] With the expansion of application scenarios and the diversification of business models, weighing systems often need to be deeply integrated with other information systems such as identity recognition, data storage, and process control to achieve full-process automation and informatization. Traditional weighing systems usually rely on localized, closed software architectures, such as stand-alone or LAN applications based on specific operating systems. They interact with weighing instruments, card readers, and other devices by directly calling hardware drivers or proprietary communication protocols provided by the manufacturer. However, being tightly coupled to specific operating systems makes it difficult to deploy on server environments such as Linux and Unix or on emerging IoT edge computing nodes, limiting the ability to expand and migrate in heterogeneous computing environments. The communication protocols of hardware devices from different manufacturers vary, lacking a unified standard. Whenever a new model of equipment is introduced or a supplier is changed, the underlying code of the software needs to be modified and recompiled, resulting in high maintenance costs. Furthermore, client deployment is cumbersome, version upgrades and compatibility management are complex, and weight data is often limited to local databases, making it difficult for other web applications or mobile terminals to obtain and utilize it in real time. This fails to effectively support modern business needs such as remote monitoring, multi-terminal collaborative operation, and cloud data analysis.
[0003] Therefore, the current technologies in this field suffer from technical problems such as strong dependence on the weighing system platform, difficulties in hardware integration and maintenance, inconvenience in data sharing among multiple terminals, and the inability of the web terminal to directly and stably access the underlying hardware. Summary of the Invention
[0004] This application provides a cross-platform web-based method and system for data acquisition and command interaction of weighing equipment, which solves the technical problems existing in the prior art, such as strong platform dependence of weighing systems, difficulty in hardware integration and maintenance, inconvenience in data sharing among multiple terminals, and the inability of the web terminal to directly and stably access the underlying hardware. It achieves the technical effect of realizing real-time, reliable, and centralized interaction of weighing data commands, and improving the system's scalability, deployment flexibility, and integration efficiency.
[0005] This application provides a cross-platform web-based method for data acquisition and command interaction of weighing equipment. The method includes: deploying a cross-platform server program, which runs on multiple computing environments including Windows, Linux, and Unix; establishing communication connections with at least one weighing device and at least one card reader / writer through the hardware adaptation layer of the server program; configuring the user on the server to adapt to the weighing device or card reader / writer; and, based on the user configuration information, listening to and parsing the real-time data stream from the weighing device, standardizing the parsed weight data, pushing it to the web client, receiving card reader / writer commands from the web client, sending them to the card reader / writer, and providing feedback on the card reader / writer operation results.
[0006] In a possible implementation, the cross-platform web-based weighing device data acquisition and command interaction method further performs the following processing: obtaining user configuration parameters, including the specified device model, communication port, baud rate, and device-specific command set; based on the device configuration parameters, matching the corresponding communication protocol parsing logic from a pre-set protocol library, and establishing a configuration mapping relationship between the device and the protocol parsing logic; and based on the configuration mapping relationship, configuring the weighing device or card reader / writer using the corresponding user configuration parameters.
[0007] In a possible implementation, the cross-platform web-based weighing device data acquisition and command interaction method further performs the following processing: the server program uses a machine learning model to perform feature analysis and protocol identification on the raw data stream from the weighing device, and automatically identifies user configuration parameters; using the identified user configuration parameters, it automatically creates the configuration mapping relationship to configure the weighing device or card reader.
[0008] In a possible implementation, the cross-platform Web-based weighing device data acquisition and command interaction method further performs the following processing: establishing a full-duplex WebSocket long connection between the server and the Web client; wherein, based on the full-duplex WebSocket long connection, the server listens for data arrival events on the communication interface according to an event-driven mechanism, and when it captures the raw data stream from the weighing device, it calls the corresponding protocol parsing logic to convert the device-specific message into a structured weight data object; the server encapsulates the weight data object into a standard data format and actively pushes it to the Web client subscribing to the device data through the WebSocket long connection; and the server receives the card reader / writer command object issued by the Web client through the WebSocket long connection, matches the target card reader / writer and its protocol parsing logic according to the identification information in the command object, generates the underlying hardware command, and issues it through the communication interface; the server receives the response data returned by the card reader / writer, parses it to generate an operation result status object, and feeds it back to the Web client that initiated the command through the WebSocket long connection.
[0009] In a possible implementation, the cross-platform Web-based weighing device data acquisition and command interaction method further performs the following processing: the data interaction between the server and the Web client is compatible with HTTP API calls based on the request-response model. For HTTP requests, after completing the corresponding hardware operation, the server returns data or operation results in the form of an HTTP response.
[0010] In a possible implementation, the cross-platform web-based weighing device data acquisition and command interaction method further performs the following processing: the server has multi-channel concurrent processing capabilities, and through a resource pool and connection management mechanism, it supports a single server instance to simultaneously connect to and manage multiple weighing devices and card readers / writers; wherein, when the system starts, it initializes the serial port / network connection resource pool; establishes corresponding network connections according to user configuration information, independently allocates serial port resources, binds sessions to set tags for each channel, and creates a device session context to record the connection status, protocol parser, and communication parameters of the corresponding device; adopts an asynchronous I / O multiplexing mechanism, listens to the status of all connected devices based on tags, actively collects event-driven data, and performs processing push according to the event-driven data; after completing the command interaction corresponding to the event, the server returns the serial port resource control to the resource pool.
[0011] In a possible implementation, the cross-platform Web-based weighing device data acquisition and command interaction method also performs the following processing: during the interaction between the server and the card reader, a data security module is integrated to encrypt sensitive data written to the card before transmission and decrypt it when reading the card. At the same time, a verification mechanism is applied to the communication process to ensure the integrity of the data during transmission and storage.
[0012] In a possible implementation, the cross-platform Web-based weighing device data acquisition and command interaction method also performs the following processing: the server provides a unified configuration management interface, which supports users to register and configure the brand, model and communication protocol of newly added weighing devices or card readers online through the Web client for hardware device expansion.
[0013] In a possible implementation, the cross-platform web-based weighing equipment data acquisition and command interaction method further performs the following processing: real-time analysis of weight data sequences from the weighing equipment via a rule engine module to generate a weight-time dynamic curve; real-time calculation of the volatility and stability duration characteristics of the weight-time dynamic curve to determine whether the current weighing process is in a stable state, and configuration of a data credibility assessment tag for the weighing data; based on the data credibility assessment tag, visual warnings for untrustworthy data are displayed on the web client interface; when data is marked as untrustworthy, subsequent business operations dependent on the corresponding untrustworthy data are automatically blocked, including prohibiting the saving of records and prohibiting the writing of data to cards; during data storage, data is graded, marked, and managed according to the data credibility assessment tag, and equipment maintenance warnings are triggered based on continuous untrustworthiness judgments.
[0014] This application also provides a cross-platform web-based weighing device data acquisition and command interaction system. The system includes: a server-side program deployment module for deploying a cross-platform server-side program, which runs on at least multiple computing environments including Windows, Linux, and Unix, and establishes communication connections with at least one weighing device and at least one card reader / writer through the server-side program's hardware adaptation layer; a user configuration module for configuring users on the server side to adapt to the weighing device or card reader / writer; and a read / write operation feedback module, which, based on the user configuration information, allows the server-side program to listen to and parse the real-time data stream from the weighing device, standardize the parsed weight data, push it to the web client, receive card reader / writer commands from the web client, send them to the card reader / writer, and provide feedback on the card reader / writer operation results.
[0015] This application proposes a cross-platform web-based method and system for data acquisition and command interaction of weighing equipment. It deploys a cross-platform server program, establishing communication connections with at least one weighing device and at least one card reader / writer through a hardware adaptation layer. The server performs user configuration to adapt to the weighing device or card reader / writer. Based on the user configuration information, it listens to and parses real-time data streams, processes them in a standardized manner, and pushes them to the web client. It also receives card reader / writer commands from the web client, sends them to the card reader / writer, and provides feedback on the operation results. This solves the technical problems of existing weighing systems, such as strong platform dependence, difficulties in hardware integration and maintenance, inconvenience in multi-terminal data sharing, and the inability of the web client to directly and stably access the underlying hardware. It achieves real-time, reliable, and centralized interaction of weighing data commands, improving system scalability, deployment flexibility, and integration efficiency. Attached Figure Description
[0016] To more clearly illustrate the technical solutions of the embodiments of this disclosure, the accompanying drawings of the embodiments of this disclosure will be briefly described below. Flowcharts are used in this application to illustrate the operations performed by the system according to the embodiments of this application. It should be understood that the preceding or following operations are not necessarily performed precisely in sequence. Instead, various steps can be processed in reverse order or simultaneously as needed. Furthermore, other operations can be added to these processes, or one or more steps can be removed from these processes.
[0017] Figure 1 This is a schematic diagram of a cross-platform web-based weighing equipment data acquisition and command interaction method provided in an embodiment of this application.
[0018] Figure 2 A schematic diagram of the cross-platform web-based weighing equipment data acquisition and command interaction system provided in this application embodiment.
[0019] Figure labeling: Server program deployment module 10, user configuration module 20, read / write operation feedback module 30. Detailed Implementation
[0020] To further illustrate the technical means and effects adopted by the present invention in order to achieve the intended purpose, the following detailed description is provided in conjunction with the accompanying drawings and preferred embodiments, based on the specific implementation methods, structures, features and effects of the present invention.
[0021] This application provides a cross-platform web-based method for data acquisition and command interaction of weighing equipment, such as... Figure 1 As shown, the method includes: Step S100: Deploy a cross-platform server program. The server program is used to run multiple computing environments, including at least Windows, Linux, and Unix. It establishes communication connections with at least one weighing device and at least one read / write card through the hardware adaptation layer of the server program.
[0022] Preferably, the pre-compiled software entity serves as a cross-platform server program, capable of running directly on various operating systems with different architectures and kernels. This is achieved by using cross-platform programming languages such as Java and Python, or by compiling the source code into corresponding executable files for different target platforms, enabling operation on multiple computing environments including Windows, Linux, and Unix, without rewriting the core business logic code for each platform. The server program establishes communication connections with at least one weighing device and at least one card reader / writer through its hardware adaptation layer. This hardware adaptation layer is a software component within the server program, used to abstract and encapsulate the differences in low-level communication with weighing devices and card readers / writers of different brands, models, and interface types. This shields the differences in system call interfaces for accessing hardware resources such as serial ports, parallel ports, USB devices, or network sockets across different operating systems. For weighing devices, this layer is responsible for sending instructions, receiving data streams, and performing initial data frame recognition according to the device's specific communication protocol. For card readers / writers, this layer is responsible for sending card reading, card writing, and card searching instructions according to their dedicated protocols and receiving responses. Specifically, after the server program starts, the hardware adaptation layer determines the system port or network address to which the target hardware device is connected based on user configuration or an automatic discovery mechanism. On the corresponding operating system, it calls the standard APIs or library functions provided by that system to apply for and open the corresponding communication port or network connection. According to the device requirements, it sets communication parameters through system calls, such as baud rate, data bits, stop bits, parity bits, or IP address, port number, and protocol type. After completion, a stable data channel is established between the server program and the physical hardware. The adaptation layer continuously monitors the status of this connection to ensure its availability and is responsible for handling possible exceptions such as disconnection and reconnection, and timeout handling in the underlying communication.
[0023] Step S200: Configure the user on the server side to adapt to the weighing device or card reader / writer.
[0024] Step S200 further includes step S210, obtaining user configuration parameters, including specifying the device model, communication port, baud rate, and device-specific instruction set; step S220, based on the device configuration parameters, matching the corresponding communication protocol parsing logic from a preset protocol library, and establishing a configuration mapping relationship between the device and the protocol parsing logic; step S230, based on the configuration mapping relationship, configuring the weighing device or card reader / writer using the corresponding user configuration parameters.
[0025] Preferably, the configuration information received from the user is adapted to weighing equipment and card readers with different communication protocols through the configuration interface provided by the server program. Specifically, based on the configuration interface provided by the server, such as a configuration file, database configuration table, or web management interface, the user inputs or selects the connection and driver parameters of specific hardware, i.e., user configuration parameters, including the device model, communication port, baud rate, and device-specific instruction set. The server program internally maintains a pre-built protocol library containing multiple executable code units, scripts, or configuration description files, each encapsulating complete communication protocol parsing logic for a specific model. Upon receiving the user's device model and instruction set parameters, the system performs a search and matching operation in the protocol library. If a match is successful, the data is stored in memory or... The configuration storage creates a data structure for configuration mapping relationships, associating physical device instances with protocol parsing logic instances to determine the corresponding configuration mapping relationships. Then, based on these mapping relationships, specific device configuration and initialization operations are executed. Specifically, using user-provided "communication port" and "baud rate" parameters, the operating system API is called to open the specified port and set the correct communication parameters. The matched protocol parsing logic instance is bound to the opened communication port handle. After binding, some protocol parsing logic automatically sends handshake commands and sets working modes to the device according to the requirements of the device-specific instruction set, enabling the device to enter a normal working state. This achieves unified, flexible, and configurable management of heterogeneous hardware communication protocols.
[0026] Furthermore, step S200 also includes the server program using a machine learning model to perform feature analysis and protocol identification on the raw data stream from the weighing device, automatically identifying user configuration parameters; and using the identified user configuration parameters to automatically create the configuration mapping relationship and configure the weighing device or card reader.
[0027] Preferably, after the server program establishes a basic physical connection with the newly connected but unconfigured weighing device at its hardware adaptation layer, it begins to receive the raw data stream actively sent by the device upon power-on or inquiry, or returned by the server after sending a general probe command. This data stream is buffered and may undergo preprocessing, such as segmentation into potential data frames. Then, based on a trained neural network or random forest model, feature analysis and protocol identification are performed. The extracted features include, but are not limited to, byte-level features such as the start byte, end byte, frame length, and value range distribution of bytes at specific positions in the data frame; temporal features such as the sending interval pattern and response delay of the data frame; statistical features such as the distribution characteristics of values in the data stream; and structural features such as whether it conforms to the structural template of certain common protocols. Then, the extracted features are compared and classified with various device protocols learned during the training phase. The output result is the most likely identified The system identifies the device model or protocol type and can directly deduce key communication parameters such as baud rate, data frame structure, and device-specific instruction sets. It then converts the identified device model, protocol type, and baud rate into user-configurable parameters. Based on the identified device model or protocol type, the system automatically matches the corresponding, precise communication protocol parsing logic module from a pre-built protocol library. It automatically creates a data structure in memory, binding the current device's physical communication port to the matched protocol parsing logic instance to form a configuration mapping relationship. Finally, using the identified baud rate and other parameters, it precisely sets the parameters of the opened communication port. Using the bound protocol parsing logic, it automatically sends the initialization instruction sequence required by the protocol, completing the final configuration of the device and bringing it into normal working condition. This achieves plug-and-play hardware access and automated operation and maintenance.
[0028] In step S300, according to the user configuration information, the server program listens to and parses the real-time data stream from the weighing device, standardizes the parsed weight data, pushes it to the Web client, receives the card read / write instruction from the Web client, sends it to the card reader, and provides feedback on the card read / write operation result.
[0029] Step S300 further includes establishing a full-duplex WebSocket long connection between the server and the Web client; wherein, based on the full-duplex WebSocket long connection, the server listens for data arrival events on the communication interface according to an event-driven mechanism, and when it captures the raw data stream from the weighing device, it calls the corresponding protocol parsing logic to convert the device-specific message into a structured weight data object; the server encapsulates the weight data object into a standard data format and actively pushes it to the Web client subscribing to the device data through the WebSocket long connection; and the server receives the card reader / writer instruction object issued by the Web client through the WebSocket long connection, matches the target card reader / writer and its protocol parsing logic according to the identification information in the instruction object, generates the underlying hardware instruction, and issues it through the communication interface; the server receives the response data returned by the card reader / writer, parses it to generate an operation result status object, and feeds it back to the Web client that initiated the instruction through the WebSocket long connection.
[0030] Preferably, a full-duplex WebSocket persistent connection is established between the server and the web client. This means that the server and client can send data to each other simultaneously and independently without waiting for a request from the other. Specifically, the web client uses an API to initiate an HTTP Upgrade request to a specific URL on the server. The request header includes key fields such as Connection:Upgrade and Upgrade:websocket. The server, which runs a network service module that supports the WebSocket protocol, receives the request, verifies its validity, and returns an HTTP 101 Switching Protocols response, agreeing to upgrade the connection protocol from HTTP to WebSocket. After a successful handshake, the initial TCP connection is not closed but is transformed into a persistent, full-duplex WebSocket connection. This connection is maintained indefinitely unless there is a network failure or it is actively closed, becoming a dedicated channel for all subsequent data interactions. This provides a stable and efficient transmission channel for real-time data push and instant command interaction between the server and the web client.
[0031] Preferably, the server program locates the communication port corresponding to a specific weighing device and its bound protocol parsing logic based on the configuration mapping relationship. Through the I / O multiplexing or event-driven interface provided by the operating system, it continuously listens for data arrival events on that port. Once new data is detected, the server immediately reads the raw byte stream and decodes it according to the protocol parsing logic bound to the device. This process includes data frame integrity verification, extracting the payload field, converting binary or specifically encoded values into calculable decimal numbers, and then standardizing them. This involves converting the raw data parsed from devices of different brands and models into a unified, structured data object within the system, with predefined fields such as floating-point numbers, strings, timestamps, device identifiers, and boolean values. The server then pushes this standardized weight data object in real-time through an established WebSocket long connection, according to a predetermined data format, to web clients that have subscribed to the device's data. The push is based on a publish-subscribe or peer-to-peer model to ensure that data is only sent to the relevant client sessions.
[0032] Preferably, when a web client user triggers a card read / write operation on the interface, the operation request is encapsulated into a structured instruction object and sent to the server via the same WebSocket connection. The server receives the instruction object, looks up the corresponding configuration mapping relationship based on the identification information in the instruction object, determines the target card reader / writer and its bound protocol parsing logic, and calls the instruction generation module in the protocol parsing logic to convert the structured instruction object into a low-level hardware instruction byte sequence that the card reader / writer can recognize. The server sends this byte sequence out through the communication port corresponding to the card reader / writer. The card reader / writer executes the instruction and returns the success or failure result to the server in the form of a hardware response message. The server reads this response and calls the same protocol parsing logic to parse it, converting it into a structured operation result status object. Finally, the server feeds back this result object to the web client that initiated the instruction via the WebSocket connection. The client updates the interface accordingly, such as displaying "Write successful" or displaying an error message.
[0033] Furthermore, step S300 also includes data interaction between the server and the web client, which is compatible with HTTP API calls based on the request-response model. For HTTP requests, after completing the corresponding hardware operation, the server returns data or operation results in the form of an HTTP response.
[0034] Preferably, the server provides two independent communication endpoints: a WebSocket endpoint and an HTTP RESTful API endpoint. The WebSocket endpoint is used to handle data requiring real-time, bidirectional, streaming interaction, such as real-time weight push, instant command control, and feedback. The HTTP RESTful API endpoint... API endpoints are used to handle interactions conforming to the traditional request-response model, such as supplementary, on-demand data queries and one-time command operations. For HTTP requests, the web client initiates a standard HTTP request to a specific URL on the server. The server's HTTP server module receives and parses the request. Based on the request path, method, and parameters, the server program executes the corresponding business logic, including operations that may trigger underlying hardware, such as performing a one-time instant weight reading on a specific weighing device, sending a single card read or write command to a card reader, or querying device status or historical data. Unlike the asynchronous push of WebSocket, the HTTP request thread synchronously waits for the hardware operation to complete. After the server completes the corresponding hardware operation, such as successfully reading the weight value, receiving the response from the card reader, and obtaining the result, it constructs an HTTP response. The server encapsulates the operation result (data or status) into a structured data format (usually JSON) and returns it through a standard HTTP response message. The response includes an appropriate HTTP status code and response body, such as 200 for success and 500 for an internal server error, thus providing a more general and easier-to-integrate interface for environments that do not support or find it inconvenient to use WebSocket.
[0035] Furthermore, the cross-platform web-based method for data acquisition and command interaction of weighing equipment also includes a server-side system capable of multi-channel concurrent processing. Through a resource pool and connection management mechanism, it supports a single server instance to simultaneously connect to and manage multiple weighing devices and card readers / writers. Specifically, upon system startup, the serial port / network connection resource pool is initialized; corresponding network connections are established based on user configuration information, serial port resources are independently allocated, and sessions are bound to set tags for each path. A device session context is created to record the connection status, protocol parser, and communication parameters of the corresponding device. An asynchronous I / O multiplexing mechanism is adopted to monitor the status of all connected devices based on tags, actively collect event-driven data, and execute processing pushes based on event-driven actions. After completing the command interaction corresponding to the event, the server returns control of the serial port resources to the resource pool.
[0036] Preferably, the server has multi-channel concurrent processing capabilities. Specifically, when the server program starts, it creates a global communication resource pool to pre-allocate or dynamically manage all available serial port resource handles in the system, avoiding conflicts and overhead caused by repeated opening / closing. At the same time, it manages reusable network socket resources for connecting Ethernet-based weighing instruments or card readers. The server performs connection operations for each physical device to be managed according to the user's configuration information. For serial port devices, it requests and exclusively allocates specific serial port resources from the serial port resource pool to the device to ensure that the same physical port is used by only one device session at a time. For network devices, it establishes an independent network connection or allocates a connection channel from the network connection pool. For each successful device connection, the server creates an independent device session context object in memory. This object serves as the device's "identity card" and "file" in the entire system, is given a unique label, and records all key information, including at least the connection status, the bound protocol parser, communication parameters, and the associated WebSocket session.
[0037] Preferably, the server employs asynchronous I / O multiplexing technology to register the connection handles of all devices to a unified event listener. The server's main thread or I / O thread blocks and waits on this unified listener. When an event occurs on any of the monitored device connections, such as data arrival or connection termination, the listener immediately returns and notifies the device where the event occurred. When data is detected to be readable from a weighing device, the system quickly locates the corresponding device session context based on the tag carried by the event, retrieves the bound protocol parser, and assigns a worker thread or task to read, parse, and standardize the data from the connection non-blocking, ultimately pushing it to the subscribed web clients. When a command needs to be sent to a card reader / writer, the command task is submitted, and the system similarly finds the corresponding device session and connection through the tag, asynchronously writing the command data. When a device is removed or its connection is broken, the system cleans up its device session context and returns control of the serial port or network connection resources occupied by that device to the global resource pool, allowing the physical port or network address to be reassigned to other devices, achieving resource recycling and preventing resource leakage.
[0038] Furthermore, the cross-platform web-based weighing equipment data acquisition and command interaction method also includes integrating a data security module during the interaction between the server and the card reader / writer. This module encrypts sensitive data written to the card before transmission and decrypts it when reading the card. Simultaneously, a verification mechanism is applied to the communication process to ensure the integrity of the data during transmission and storage.
[0039] Preferably, a data security module is integrated into the interaction between the server and the card reader / writer. This module is embedded as a core component within the server's hardware adaptation layer, located between the protocol parsing logic and the underlying communication interface. It processes data entering and leaving the card reader / writer and provides encryption, decryption, and data integrity verification services. Specifically, when the web client submits plaintext sensitive data to be written to the card, the server sends this plaintext data to the data security module before calling the card reader / writer's protocol parsing logic to generate hardware instructions. The security module uses a preset encryption algorithm, such as AES-256, and a key to encrypt the plaintext data, generating ciphertext. The server then uses this ciphertext as the payload, encapsulates it in the card-writing instruction, and sends it to the card reader / writer to write the data to the card. The card-reading instruction reads the ciphertext data from the card. After the ciphertext data is returned to the server, the protocol parsing logic extracts the original byte stream, which is then sent to the data security module. The security module uses the corresponding decryption algorithm and key to restore the ciphertext to the original plaintext data. The server then normalizes this data before pushing or returning it to the web client. Simultaneously, a verification mechanism is applied to the communication process to prevent data from being tampered with or erroneous during transmission between the server and the card reader, ensuring data integrity during transmission and storage. Specifically, before the server sends instruction data to the physical communication port, the data security module calculates a checksum for the data segment, which is appended to the end of the instruction message. After receiving the instruction, the card reader recalculates the checksum of the received data using the same algorithm and compares it with the checksum at the end of the message. If they do not match, the instruction is discarded or an error is returned. Similarly, the response data returned by the card reader also contains a checksum, which the server verifies before parsing. This verification mechanism is used throughout the entire communication link of downlink instructions and uplink responses, ensuring the integrity of information is verified throughout the entire data path from the server to the card, achieving end-to-end data security protection from the Web application layer to the physical card storage medium.
[0040] Furthermore, the cross-platform web-based weighing equipment data acquisition and command interaction method also includes a unified configuration management interface provided by the server, which supports users to register and configure the brand, model and communication protocol of newly added weighing equipment or card readers online through a web client for hardware expansion.
[0041] Preferably, the server provides a unified configuration management interface, typically manifested as a set of RESTful API endpoints and / or an embedded web management page. This provides full capabilities for adding, deleting, modifying, and querying device protocol libraries and device configuration mappings. Specifically, users access the configuration management interface provided by the server through a web client. They can enter new device descriptions, i.e., fill in or select the brand and model of the device to be added; they can register communication protocols, i.e., upload a protocol description file conforming to the system specification format or define protocol parameters step by step through interface forms, such as frame headers, frame trailers, data length bits, byte offset of weight values, parsing formulas, etc.; and they can also configure connection parameter templates. The server backend receives the information submitted by the user and, based on... The protocol description automatically generates or dynamically loads the corresponding protocol parsing logic, and registers the newly generated parsing logic in the system's pre-built protocol library, establishing an index relationship with its brand and model. After successful registration, the brand and model of the new device will immediately appear in the device model drop-down list in the web client. When configuring the connection of physical devices, users can select the newly added model, and the system will automatically match and apply the correct parsing logic based on the protocol description provided during registration. This is then used for hardware device expansion, enabling online, self-service, and agile hardware device expansion, greatly reducing the technical threshold and expansion cycle, while improving the system's adaptability.
[0042] Furthermore, the cross-platform web-based weighing equipment data acquisition and command interaction method also includes: analyzing the weight data sequence from the weighing equipment in real time through a rule engine module to generate a weight-time dynamic curve; calculating the volatility and stability duration characteristics of the weight-time dynamic curve in real time to determine whether the current weighing process is in a stable state, and configuring a data credibility assessment tag for the weighing data; providing visual warnings for untrustworthy data on the web client interface based on the data credibility assessment tag; automatically blocking subsequent business operations that depend on the corresponding untrustworthy data when data is marked as untrustworthy, including prohibiting the saving of records and prohibiting the writing of data to the card; and during data storage, classifying and managing data according to the data credibility assessment tag, and triggering equipment maintenance warnings based on continuous untrustworthiness judgments.
[0043] Preferably, the rule engine module is the data processing and decision-making center within the server program. It is used to load and execute predefined business rules, receive the standardized real-time weight data sequence output from the protocol parsing layer. Each data point contains a weight value and an accurate timestamp. The rule engine maintains a temporary weight-time sequence in memory for each weighing process, and calculates its changing trend in real time to form a weight-time dynamic curve. Then, the rule engine calculates the standard deviation or variance of recent data points in real time to measure the jitter degree of the weight, determines the volatility, calculates the time when the weight remains in a stable state according to the predefined stability threshold, and determines the stable duration feature. Then, according to the calculated features, it uses rules to judge in real time whether the current weighing is in a stable state. For example, if the volatility > X and the stable duration < Y seconds, the state is unstable. Based on the judgment result, it assigns a data credibility evaluation label to each weight data point or weighing batch, such as credible, fluctuating, not stable, etc.
[0044] Preferably, when the server pushes the weight data to the Web client, it attaches the credibility label of the data. According to the label, the client interface visually warns the untrusted data in a prominent way, such as highlighting colors, flashing icons or text prompts, to remind the operator that the current reading is unreliable. When core business logics such as saving weighing records, generating bills, and writing data to cards are triggered, the system checks whether the weight data it depends on has an untrusted label. If so, it automatically blocks the execution of the operation and gives a clear prompt, such as "The weight is not stable, saving is prohibited". All weighing data carry their credibility labels when stored in the database, and are queried, statistically analyzed according to data quality. The rule engine continuously monitors the judgment results from the same device. If a certain device continuously and frequently generates untrusted data, the rule engine module triggers a higher-level rule. For example, if the number of untrusted judgments of device O exceeds Q times within P hours, an early warning is triggered. After being triggered, the system generates a device maintenance warning event, and through logs, dashboards or notification systems, prompts the maintenance personnel that there may be problems with this device, such as sensor failures, loose installations, environmental interference, etc., and maintenance is required, thereby discovering potential device failures in advance, changing after-the-fact maintenance to pre-warning, and improving device availability.
[0045] In the above text, reference is made to Figure 1 The cross-platform Web-side weighing device data acquisition and instruction interaction method according to an embodiment of the present invention is described in detail. Next, reference will be made to Figure 2 Describe the cross-platform Web-side weighing device data acquisition and instruction interaction system according to an embodiment of the present invention.
[0046] The cross-platform web-based weighing equipment data acquisition and command interaction system according to embodiments of the present invention addresses the technical problems in existing technologies, such as strong platform dependence of weighing systems, difficulties in hardware integration and maintenance, inconvenience in multi-terminal data sharing, and the inability of the web terminal to directly and stably access the underlying hardware. It achieves real-time, reliable, and centralized interaction of weighing data commands, improving system scalability, deployment flexibility, and integration efficiency. Figure 2 As shown, the cross-platform Web-based weighing equipment data acquisition and command interaction system includes: a server-side program deployment module 10, a user configuration module 20, and a read / write operation feedback module 30.
[0047] The server-side program deployment module 10 is used to deploy a cross-platform server-side program. The server-side program is used to run multiple computing environments, including at least Windows, Linux, and Unix. It establishes communication connections with at least one weighing device and at least one card reader / writer through the hardware adaptation layer of the server-side program. The user configuration module 20 is used to configure users on the server side and adapt to the weighing device or card reader / writer. The read / write operation feedback module 30 is used to listen to and parse the real-time data stream from the weighing device according to the user configuration information. After standardizing the parsed weight data, it pushes it to the Web client. It also receives card reader / writer instructions from the Web client, sends them to the card reader / writer, and provides feedback on the card reader / writer operation results.
[0048] The specific configuration of the user configuration module 20 will be described in detail below. The user configuration module 20 further includes: obtaining user configuration parameters, including specifying the device model, communication port, baud rate, and device-specific instruction set; based on the device configuration parameters, matching the corresponding communication protocol parsing logic from a preset protocol library, and establishing a configuration mapping relationship between the device and the protocol parsing logic; and configuring the weighing device or card reader / writer using the corresponding user configuration parameters based on the configuration mapping relationship.
[0049] The specific configuration of the user configuration module 20 will be described in detail below. The user configuration module 20 further includes: the server program using a machine learning model to perform feature analysis and protocol recognition on the raw data stream from the weighing device, and automatically identify user configuration parameters; using the identified user configuration parameters, it automatically creates the configuration mapping relationship to configure the weighing device or card reader / writer.
[0050] The specific configuration of the read / write operation feedback module 30 will be described in detail below. The read / write operation feedback module 30 further includes: establishing a full-duplex WebSocket long connection between the server and the Web client; wherein, based on the full-duplex WebSocket long connection, the server listens for data arrival events on the communication interface according to an event-driven mechanism; when it captures the raw data stream from the weighing device, it calls the corresponding protocol parsing logic to convert the device-specific message into a structured weight data object; the server encapsulates the weight data object into a standard data format and actively pushes it to the Web client subscribing to the device data via the WebSocket long connection; and the server receives the read / write card instruction object issued by the Web client through the WebSocket long connection, matches the target card reader and its protocol parsing logic according to the identification information in the instruction object, generates underlying hardware instructions, and issues them through the communication interface; the server receives the response data returned by the card reader, parses it to generate an operation result status object, and feeds it back to the Web client that initiated the instruction via the WebSocket long connection.
[0051] The specific configuration of the read / write operation feedback module 30 will be described in detail below. The read / write operation feedback module 30 further includes: data interaction between the server and the web client, compatible with HTTP API calls based on the request-response model. For HTTP requests, after completing the corresponding hardware operation, the server returns data or operation results in the form of an HTTP response.
[0052] The following section will continue to describe in detail the specific configuration of the cross-platform web-based weighing equipment data acquisition and command interaction system. It further includes: the server-side possesses multi-channel concurrent processing capabilities, supporting a single server instance to simultaneously connect to and manage multiple weighing devices and card readers / writers through a resource pool and connection management mechanism; specifically, upon system startup, it initializes the serial port / network connection resource pool; establishes corresponding network connections based on user configuration information, independently allocates serial port resources, binds sessions, sets tags for each channel, and creates a device session context to record the connection status, protocol parser, and communication parameters of the corresponding device; employs an asynchronous I / O multiplexing mechanism, listens to the status of all connected devices based on tags, actively collects event-driven data, and executes processing pushes based on event-driven actions; after completing the command interaction corresponding to the event, the server-side returns control of the serial port resources to the resource pool.
[0053] The following section will continue to describe in detail the specific configuration of the cross-platform web-based weighing equipment data acquisition and command interaction system. It further includes: during the interaction between the server and the card reader, an integrated data security module is used to encrypt sensitive data written to the card before transmission and decrypt it when reading the card. Simultaneously, a verification mechanism is applied to the communication process to ensure the integrity of the data during transmission and storage.
[0054] The following section will continue to describe in detail the specific configuration of the cross-platform web-based weighing equipment data acquisition and command interaction system. It further includes: the server providing a unified configuration management interface, supporting users to register and configure the brand, model, and communication protocol of newly added weighing equipment or card readers online via a web client, for hardware expansion.
[0055] The following section will continue to describe in detail the specific configuration of the cross-platform web-based weighing equipment data acquisition and command interaction system. It further includes: real-time analysis of weight data sequences from the weighing equipment via a rules engine module to generate a weight-time dynamic curve; real-time calculation of the volatility and stability duration characteristics of the weight-time dynamic curve to determine whether the current weighing process is in a stable state, and configuring a data credibility assessment label for the weighing data; based on the data credibility assessment label, providing visual warnings for untrustworthy data on the web client interface; automatically blocking subsequent business operations that depend on the corresponding untrustworthy data when data is marked as untrustworthy, including prohibiting the saving of records and prohibiting the writing of data to cards; during data storage, classifying and managing data according to the data credibility assessment label, and triggering equipment maintenance warnings based on continuous untrustworthiness judgments.
[0056] The cross-platform web-based weighing equipment data acquisition and command interaction system provided in this embodiment of the invention can execute the cross-platform web-based weighing equipment data acquisition and command interaction method provided in this embodiment of the invention, and has the corresponding functional modules and beneficial effects of the method execution. The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Although the present invention has been disclosed above with reference to preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can make some modifications or alterations to the above-disclosed technical content to create equivalent embodiments without departing from the scope of the present invention. Any simple modifications, equivalent changes and alterations made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the scope of the present invention.
Claims
1. A cross-platform web-based method for data acquisition and command interaction of weighing equipment, characterized in that: include: Deploy a cross-platform server program, which is used to run multiple computing environments including at least Windows, Linux, and Unix, and establishes a communication connection with at least one weighing device and at least one read / write card through the hardware adaptation layer of the server program; Configure users on the server side to adapt to weighing equipment or card readers; According to the user configuration information, the server program listens to and parses the real-time data stream from the weighing device, standardizes the parsed weight data, pushes it to the Web client, receives card read / write instructions from the Web client, sends them to the card reader, and provides feedback on the card read / write operation results.
2. The cross-platform web-based weighing equipment data acquisition and command interaction method according to claim 1, characterized in that, Configure users on the server side to adapt to weighing devices or card readers, including: Obtain user configuration parameters, including specified device model, communication port, baud rate, and device-specific instruction set; Based on the device configuration parameters, the corresponding communication protocol parsing logic is matched from the preset protocol library to establish a configuration mapping relationship between the device and the protocol parsing logic; Based on the configuration mapping relationship, the weighing device or card reader is configured using the corresponding user configuration parameters.
3. The cross-platform web-based weighing equipment data acquisition and command interaction method according to claim 1, characterized in that, User configuration on the server side to adapt to weighing devices or card readers also includes: The server program uses a machine learning model to perform feature analysis and protocol recognition on the raw data stream from the weighing equipment, and automatically identifies user-configured parameters. The configuration mapping relationship is automatically created using the identified user configuration parameters to configure the weighing device or card reader / writer.
4. The cross-platform web-based weighing equipment data acquisition and command interaction method according to claim 1, characterized in that, The server program listens to and parses the real-time data stream from the weighing device, standardizes the parsed weight data, pushes it to the web client, receives card read / write commands from the web client, sends them to the card reader, and provides feedback on the card read / write operation results, including: Establish a full-duplex WebSocket persistent connection between the server and the web client; Specifically, based on a full-duplex WebSocket long connection, the server listens for data arrival events at the communication interface according to an event-driven mechanism. When it captures the raw data stream from the weighing device, it calls the corresponding protocol parsing logic to convert the device-specific message into a structured weight data object. The server then encapsulates the weight data object into a standard data format and actively pushes it to the Web client that subscribes to the device data through the WebSocket long connection. Additionally, the server receives the card reader / writer instruction object sent by the Web client through the WebSocket long connection, matches the target card reader / writer and its protocol parsing logic according to the identification information in the instruction object, generates the underlying hardware instruction, and sends it through the communication interface; The server receives the response data returned by the card reader, parses it to generate an operation result status object, and feeds it back to the web client that initiated the command through the WebSocket long connection.
5. The cross-platform web-based weighing equipment data acquisition and command interaction method according to claim 4, characterized in that, The data interaction between the server and the web client is compatible with HTTP API calls based on the request-response model. For HTTP requests, the server returns data or operation results in the form of an HTTP response after completing the corresponding hardware operation.
6. The cross-platform web-based weighing equipment data acquisition and command interaction method according to claim 1, characterized in that, The server has multi-channel concurrent processing capability. Through resource pool and connection management mechanism, it supports a single server instance to connect to and manage multiple weighing devices and card readers at the same time. During system startup, the serial port / network connection resource pool is initialized. Establish corresponding network connections based on user configuration information, allocate serial port resources independently, bind sessions to set labels for each path, and create device session contexts to record the connection status, protocol parser, and communication parameters of the corresponding devices. It adopts an asynchronous I / O multiplexing mechanism, listens to the status of all connected devices based on tags, actively collects event-driven data, and performs processing and push based on the event-driven data. After completing the instruction interaction corresponding to the event, the server returns control of the serial port resources to the resource pool.
7. The cross-platform web-based weighing equipment data acquisition and command interaction method according to claim 1, characterized in that, During the interaction between the server and the card reader, a data security module is integrated to encrypt sensitive data written to the card before transmission and decrypt it when reading the card. At the same time, a verification mechanism is applied to the communication process to ensure the integrity of the data during transmission and storage.
8. The cross-platform web-based weighing equipment data acquisition and command interaction method according to claim 1, characterized in that, The server provides a unified configuration management interface, allowing users to register and configure the brand, model, and communication protocol of newly added weighing devices or card readers online via a web client for hardware expansion.
9. The cross-platform web-based weighing equipment data acquisition and command interaction method according to claim 1, characterized in that, The server-side program integrates a rule engine module for executing predefined business logic rules, including: The rule engine module analyzes the weight data sequence from the weighing equipment in real time to generate a weight-time dynamic curve. The volatility and stability duration characteristics of the weight-time dynamic curve are calculated in real time to determine whether the current weighing process is in a stable state, and a data reliability assessment label is configured for the weighing data. Based on data credibility assessment tags, visual warnings are displayed on the web client interface for untrustworthy data; When data is marked as untrusted, subsequent business operations that depend on the corresponding untrusted data are automatically blocked, including prohibiting the saving of records and prohibiting the writing of data to the card. During data storage, data is classified, labeled, and managed according to the data credibility assessment tags, and equipment maintenance warnings are triggered based on continuous untrustworthiness judgments.
10. A cross-platform web-based data acquisition and command interaction system for weighing equipment, characterized in that: The system is used to implement the cross-platform web-based weighing equipment data acquisition and command interaction method according to any one of claims 1 to 9, the system comprising: The server program deployment module is used to deploy a cross-platform server program. The server program is used to run multiple computing environments, including at least Windows, Linux, and Unix. It establishes a communication connection with at least one weighing device and at least one card reader through the hardware adaptation layer of the server program. The user configuration module is used to configure users on the server side and adapt to weighing equipment or card readers. The read / write operation feedback module is used to listen to and parse the real-time data stream from the weighing device according to the user configuration information. After standardizing the parsed weight data, it is pushed to the Web client. The module also receives the card read / write instructions from the Web client, sends them to the card reader, and provides feedback on the card read / write operation results.