Quality Problem Traceability and Defect Analysis for Dyeing and Finishing: Database and Operations

Data for this category comes from customer color swatches, formula libraries, dye chemical batches, dye vat control equipment, colorimeters, setting

What the data for this category looks like

Data for this category comes from customer color swatches, formula libraries, dye chemical batches, dye vat control equipment, colorimeters, setting machines, and environmental monitoring systems. Daily retained documents include dyeing formulas, chemical dosing records, dye vat curves, proofing confirmation sheets, color difference reports, setting process sheets, and sewage ledgers. Data updates follow a cadence per vat, batch, or shift. Fields include vat number, dyeing batch number, chemical dosing volume, temperature rise curve timestamps, colorimeter ΔE values, sewage COD concentration, and more. Some data is automatically collected by equipment. Other data consists of manually entered structured and unstructured content.

Constraints imposed on database and operations workflows

The high-frequency, small-batch data write cadence requires database connection pools to adapt to sudden single-vat data submissions, and avoid exhausting database connection resources. Multi-source heterogeneous data sources require compatibility with both structured business data and unstructured data such as dye vat curves and original color measurement data. Separate storage is needed to optimize read and write performance. The strongly correlated nature of data requires creating indexes on key fields such as vat number and batch number. Without these indexes, associated queries will trigger large numbers of full table scans. Long-term traceability requirements require planning a hot and cold storage tiering strategy, to prevent hot storage from being filled by historical data. Some factory servers cannot access the public internet. Both database and cache services must be deployed in an intranet environment, and support offline migration and upgrades.

Configuration Settings

These configurations apply to FastGPT v4.17.0.

Configuration ItemRecommended ValueRationale
MONGODB_URImongodb://[intranet username]:[intranet password]@[intranet IP]:27017/fastgpt?authSource=adminStores unstructured documents such as dye vat curves and color difference reports. Intranet deployment avoids public internet exposure risks, and supports offline upgrade scenarios
PG_URLpostgresql://[intranet username]:[intranet password]@[intranet IP]:5432/fastgptStores structured business data such as formula libraries and chemical batch records. Supports joint associated queries for vat numbers and batch numbers
DB_MAX_LINK20–30 connectionsAdapts to concurrent requirements of single-vat high-frequency writes and batch processing, and avoids exhausting database connection resources
REDIS_URLredis://[intranet IP]:6379/0Caches frequently accessed dyeing formulas and setting process sheet data, reducing query pressure on structured databases

Three Common Configuration Mistakes

  • Issue: getaddrinfo EAI_AGAIN mongo error appears after restarting the service. Cause: The intranet IP address in MONGODB_URI was not updated after database migration, causing the service to fail to resolve the target database node.
  • Issue: Hard disk space is exhausted when writing to the knowledge base, and storage errors persist after restarting. Cause: No historical data archiving policy was configured. Long-term retained original dye vat curves and colorimeter data were not transferred to cold storage, exhausting hot storage capacity.
  • Issue: Response timeout occurs when batch querying dyeing batch associated data. Cause: No joint index was created for vat number and batch number fields, causing associated queries to scan full table data and failing to adapt to fast retrieval requirements for multi-batch data.

How to Verify Proper Configuration

  • Run a database connection test command to verify the MONGODB_URI and PG_URL configurations, and confirm there are no resolution errors, permission errors, or connection timeout issues.
  • Write a test record with a simulated vat number, and query associated formula and chemical batch information, to confirm that multi-source data associated query functions work correctly.
  • Check Redis cache monitoring metrics, to confirm that frequently accessed process sheets and formula data hit the cache, reducing query load on structured databases.
  • Trigger a batch data write task, and observe that database connection counts do not exceed the threshold set by the DB_MAX_LINK configuration, with no connection exhaustion related errors.

The values listed here are common starting points, and should be assessed against local sample data and deployment environments.