8
n8n 中文网amn8n.com

质量控制文档与合规跟踪器

高级

这是一个自动化工作流,包含 21 个节点。主要使用 If, Code, Slack, EmailSend, GoogleDrive 等节点。 使用 Jotform 和 Google Workspace 自动化制造质量控制文档与合规

前置要求
  • Slack Bot Token 或 Webhook URL
  • Google Drive API 凭证
  • Google Sheets API 凭证

分类

-
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "MAgkC5xPvs1oSfOG",
  "meta": {
    "instanceId": "277842713620d9f5554de3b1518b865a152c8c4db680008bd8aec536fc18b4a8"
  },
  "name": "质量控制文档与合规跟踪器",
  "tags": [
    {
      "id": "CWardZYJBmejoyC4",
      "name": "under review",
      "createdAt": "2025-10-09T18:43:37.031Z",
      "updatedAt": "2025-10-09T18:43:37.031Z"
    },
    {
      "id": "DP1soi5mjVldqSt2",
      "name": "Manufacturing",
      "createdAt": "2025-10-16T07:01:03.515Z",
      "updatedAt": "2025-10-16T07:01:03.515Z"
    },
    {
      "id": "YsSinivD5gbLQ0t9",
      "name": "Quality Control",
      "createdAt": "2025-10-16T07:01:03.524Z",
      "updatedAt": "2025-10-16T07:01:03.524Z"
    },
    {
      "id": "fVuzFMBZ0wHzY3en",
      "name": "Compliance",
      "createdAt": "2025-10-16T07:01:03.521Z",
      "updatedAt": "2025-10-16T07:01:03.521Z"
    }
  ],
  "nodes": [
    {
      "id": "8f4dabc5-b0f6-4f4b-8e07-aec5b456c963",
      "name": "检查新检查项",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -656,
        160
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "minutes",
              "minutesInterval": 15
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "09bfd902-b390-418e-8b95-52f1e2b12853",
      "name": "读取检查队列",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -448,
        160
      ],
      "parameters": {
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        }
      },
      "typeVersion": 4
    },
    {
      "id": "9511a47d-58f0-4755-9f03-c36adfcffbe4",
      "name": "处理检查数据",
      "type": "n8n-nodes-base.code",
      "position": [
        -256,
        256
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "// Parse inspection data and determine compliance status\nconst item = $input.item.json;\n\n// Extract inspection details\nconst inspectionData = {\n  id: item.inspection_id || new Date().getTime().toString(),\n  timestamp: new Date().toISOString(),\n  product_name: item.product_name || item.answers?.product_name || '',\n  batch_number: item.batch_number || item.answers?.batch_number || '',\n  inspector_name: item.inspector_name || item.answers?.inspector_name || '',\n  inspection_type: item.inspection_type || item.answers?.inspection_type || 'Standard',\n  \n  // Measurement data\n  measurements: {\n    dimension_length: parseFloat(item.dimension_length || item.answers?.dimension_length || 0),\n    dimension_width: parseFloat(item.dimension_width || item.answers?.dimension_width || 0),\n    dimension_height: parseFloat(item.dimension_height || item.answers?.dimension_height || 0),\n    weight: parseFloat(item.weight || item.answers?.weight || 0),\n    temperature: parseFloat(item.temperature || item.answers?.temperature || 0)\n  },\n  \n  // Quality checks\n  visual_inspection: item.visual_inspection || item.answers?.visual_inspection || 'Pass',\n  surface_finish: item.surface_finish || item.answers?.surface_finish || 'Acceptable',\n  color_match: item.color_match || item.answers?.color_match || 'Yes',\n  defects_found: item.defects_found || item.answers?.defects_found || 'None',\n  \n  // Compliance calculation\n  specifications: {\n    length_min: 100,\n    length_max: 102,\n    width_min: 50,\n    width_max: 52,\n    height_min: 25,\n    height_max: 27,\n    weight_min: 450,\n    weight_max: 550\n  }\n};\n\n// Check compliance\nconst m = inspectionData.measurements;\nconst s = inspectionData.specifications;\n\nconst dimensionsCompliant = \n  m.dimension_length >= s.length_min && m.dimension_length <= s.length_max &&\n  m.dimension_width >= s.width_min && m.dimension_width <= s.width_max &&\n  m.dimension_height >= s.height_min && m.dimension_height <= s.height_max;\n\nconst weightCompliant = m.weight >= s.weight_min && m.weight <= s.weight_max;\n\nconst visualCompliant = \n  inspectionData.visual_inspection === 'Pass' &&\n  inspectionData.surface_finish === 'Acceptable' &&\n  inspectionData.color_match === 'Yes';\n\ninspectionData.compliance_status = \n  dimensionsCompliant && weightCompliant && visualCompliant ? 'PASS' : 'FAIL';\n\ninspectionData.non_conformities = [];\nif (!dimensionsCompliant) inspectionData.non_conformities.push('Dimensions out of spec');\nif (!weightCompliant) inspectionData.non_conformities.push('Weight out of spec');\nif (!visualCompliant) inspectionData.non_conformities.push('Visual inspection failed');\n\nreturn inspectionData;"
      },
      "typeVersion": 2
    },
    {
      "id": "5c1c11fe-848e-4951-9423-e86a0bb8b14b",
      "name": "存储到 Google Drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -48,
        160
      ],
      "parameters": {
        "name": "=QC_Report_{{$json.batch_number}}_{{$json.id}}.json",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "root",
          "cachedResultName": "/ (Root folder)"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "32d6c442-d011-4dd4-8755-ed62277041b5",
      "name": "记录到跟踪表",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        160,
        160
      ],
      "parameters": {
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        }
      },
      "typeVersion": 4
    },
    {
      "id": "8665c487-3083-4f39-b9de-69ad7bd68afd",
      "name": "检查是否失败",
      "type": "n8n-nodes-base.if",
      "position": [
        -48,
        352
      ],
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{$json.compliance_status}}",
              "value2": "FAIL"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "ae823af6-bfe5-4c77-8789-b5c27daf5327",
      "name": "提醒质量团队",
      "type": "n8n-nodes-base.slack",
      "position": [
        160,
        464
      ],
      "webhookId": "d22990c8-4a80-46f8-8071-c6a7aedd2934",
      "parameters": {
        "text": "🚨 *Quality Control Alert*\n\nProduct: {{$json.product_name}}\nBatch: {{$json.batch_number}}\nStatus: *{{$json.compliance_status}}*\n\nNon-conformities:\n{{$json.non_conformities.join('\\n• ')}}",
        "otherOptions": {}
      },
      "typeVersion": 2.1
    },
    {
      "id": "e1e70d0c-4d12-4e10-85fc-b42a062451d2",
      "name": "生成证书",
      "type": "n8n-nodes-base.code",
      "position": [
        352,
        160
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "// Generate HTML certificate of compliance\nconst data = $input.item.json;\n\nconst html = `\n<!DOCTYPE html>\n<html>\n<head>\n    <style>\n        body { font-family: Arial, sans-serif; margin: 40px; }\n        .header { text-align: center; margin-bottom: 30px; }\n        .certificate { border: 2px solid #333; padding: 30px; }\n        h1 { color: #2c5aa0; }\n        .details { margin: 20px 0; }\n        .signature { margin-top: 50px; }\n        .footer { text-align: center; margin-top: 30px; font-size: 12px; }\n    </style>\n</head>\n<body>\n    <div class=\"certificate\">\n        <div class=\"header\">\n            <h1>CERTIFICATE OF COMPLIANCE</h1>\n            <p>ISO 9001:2015 Quality Management System</p>\n        </div>\n        \n        <div class=\"details\">\n            <p><strong>Certificate No:</strong> ${data.id}</p>\n            <p><strong>Date:</strong> ${new Date(data.timestamp).toLocaleDateString()}</p>\n            <p><strong>Product:</strong> ${data.product_name}</p>\n            <p><strong>Batch Number:</strong> ${data.batch_number}</p>\n            <p><strong>Inspector:</strong> ${data.inspector_name}</p>\n            \n            <h3>Inspection Results</h3>\n            <table border=\"1\" style=\"width: 100%; border-collapse: collapse;\">\n                <tr>\n                    <th>Parameter</th>\n                    <th>Measured Value</th>\n                    <th>Specification</th>\n                    <th>Status</th>\n                </tr>\n                <tr>\n                    <td>Length (mm)</td>\n                    <td>${data.measurements.dimension_length}</td>\n                    <td>100-102</td>\n                    <td>${data.measurements.dimension_length >= 100 && data.measurements.dimension_length <= 102 ? '✓' : '✗'}</td>\n                </tr>\n                <tr>\n                    <td>Width (mm)</td>\n                    <td>${data.measurements.dimension_width}</td>\n                    <td>50-52</td>\n                    <td>${data.measurements.dimension_width >= 50 && data.measurements.dimension_width <= 52 ? '✓' : '✗'}</td>\n                </tr>\n                <tr>\n                    <td>Weight (g)</td>\n                    <td>${data.measurements.weight}</td>\n                    <td>450-550</td>\n                    <td>${data.measurements.weight >= 450 && data.measurements.weight <= 550 ? '✓' : '✗'}</td>\n                </tr>\n            </table>\n            \n            <h3>Compliance Status: ${data.compliance_status}</h3>\n        </div>\n        \n        <div class=\"signature\">\n            <p>_______________________</p>\n            <p>Quality Manager Signature</p>\n        </div>\n        \n        <div class=\"footer\">\n            <p>This certificate is electronically generated and valid without signature</p>\n        </div>\n    </div>\n</body>\n</html>\n`;\n\nreturn {\n  html: html,\n  filename: `Certificate_${data.batch_number}_${data.id}.html`\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "622adac3-cd64-44d5-839e-dca015951252",
      "name": "邮件发送证书",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        560,
        160
      ],
      "webhookId": "2f8295a5-2d25-49cb-b690-694a0ca8cd3a",
      "parameters": {
        "options": {
          "attachments": "={{$node['Generate Certificate'].json.html}}"
        },
        "subject": "Quality Certificate - Batch {{$json.batch_number}}",
        "toEmail": "={{$json.customer_email || 'customer@example.com'}}",
        "fromEmail": "quality@yourcompany.com"
      },
      "typeVersion": 2.1
    },
    {
      "id": "8bbe8307-48a8-4875-9e55-27988dc638af",
      "name": "每日报告触发器",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -656,
        656
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 8
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "1af14ece-11a2-44a0-a935-8cdbdc0cff3e",
      "name": "获取每日数据",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -448,
        656
      ],
      "parameters": {
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        }
      },
      "typeVersion": 4
    },
    {
      "id": "91204a97-f66a-4d3f-bc34-f9b06b25e21f",
      "name": "生成摘要",
      "type": "n8n-nodes-base.code",
      "position": [
        -256,
        656
      ],
      "parameters": {
        "jsCode": "// Generate daily compliance summary\nconst items = $input.all();\nconst today = new Date().toDateString();\n\nconst todaysInspections = items.filter(item => {\n  const itemDate = new Date(item.json.timestamp).toDateString();\n  return itemDate === today;\n});\n\nconst summary = {\n  date: today,\n  total_inspections: todaysInspections.length,\n  passed: todaysInspections.filter(i => i.json.compliance_status === 'PASS').length,\n  failed: todaysInspections.filter(i => i.json.compliance_status === 'FAIL').length,\n  pass_rate: 0,\n  products_inspected: [...new Set(todaysInspections.map(i => i.json.product_name))],\n  inspectors: [...new Set(todaysInspections.map(i => i.json.inspector_name))],\n  common_issues: {}\n};\n\nif (summary.total_inspections > 0) {\n  summary.pass_rate = ((summary.passed / summary.total_inspections) * 100).toFixed(1);\n}\n\n// Count non-conformities\ntodaysInspections.forEach(inspection => {\n  if (inspection.json.non_conformities) {\n    inspection.json.non_conformities.forEach(issue => {\n      summary.common_issues[issue] = (summary.common_issues[issue] || 0) + 1;\n    });\n  }\n});\n\nreturn summary;"
      },
      "typeVersion": 2
    },
    {
      "id": "4947aabe-e0be-4ea2-85f4-fa259b1f4290",
      "name": "发送每日报告",
      "type": "n8n-nodes-base.slack",
      "position": [
        -48,
        656
      ],
      "webhookId": "e8a8d211-7f01-45d0-a16b-64675b98d59f",
      "parameters": {
        "text": "📊 *Daily Quality Report*\nDate: {{$json.date}}\n\n*Summary:*\n• Total Inspections: {{$json.total_inspections}}\n• Passed: {{$json.passed}} ✅\n• Failed: {{$json.failed}} ❌\n• Pass Rate: {{$json.pass_rate}}%\n\n*Products Inspected:*\n{{$json.products_inspected.join('\\n• ')}}",
        "otherOptions": {}
      },
      "typeVersion": 2.1
    },
    {
      "id": "151db029-c3da-4324-b523-014be9200479",
      "name": "备注",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -944,
        112
      ],
      "parameters": {
        "width": 250,
        "height": 156,
        "content": "## 📥 输入来源"
      },
      "typeVersion": 1
    },
    {
      "id": "efd420c8-6496-4775-ae49-e9ddd0439deb",
      "name": "备注 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -304,
        384
      ],
      "parameters": {
        "width": 200,
        "height": 152,
        "content": "## 🔄 处理"
      },
      "typeVersion": 1
    },
    {
      "id": "97aad2cd-f193-48d2-91c4-271a5c2d3a11",
      "name": "备注 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        0
      ],
      "parameters": {
        "width": 372,
        "height": 136,
        "content": "## 💾 存储"
      },
      "typeVersion": 1
    },
    {
      "id": "d214ceff-a286-4941-aa49-a2e8ccad92f4",
      "name": "备注 4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        176,
        624
      ],
      "parameters": {
        "width": 180,
        "height": 136,
        "content": "## 🚨 警报"
      },
      "typeVersion": 1
    },
    {
      "id": "76539b89-3dab-4804-b6f8-c2f4b5dac0ec",
      "name": "备注 5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        336,
        320
      ],
      "parameters": {
        "width": 360,
        "height": 120,
        "content": "## 📋 文档"
      },
      "typeVersion": 1
    },
    {
      "id": "11a5eb71-0f1f-4d6e-8f40-11113c6513e0",
      "name": "备注 6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -912,
        688
      ],
      "parameters": {
        "width": 200,
        "height": 168,
        "content": "## 📊 每日报告"
      },
      "typeVersion": 1
    },
    {
      "id": "7191be65-1d4b-4ee1-8eb5-48dd0343c85a",
      "name": "注释1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1008,
        384
      ],
      "parameters": {
        "width": 314,
        "height": 156,
        "content": "## 📥 手动表单"
      },
      "typeVersion": 1
    },
    {
      "id": "db6112a6-2bfe-4242-b893-8c4ab757592b",
      "name": "Jotform触发器",
      "type": "n8n-nodes-base.jotFormTrigger",
      "position": [
        -640,
        416
      ],
      "webhookId": "7ea0164b-ac9b-46b6-a7fa-bcd4003fe8cf",
      "parameters": {
        "form": "252815424602048"
      },
      "credentials": {
        "jotFormApi": {
          "id": "cOSh16Q5l4e0EB1A",
          "name": "Jotform jitesh@mediajade.com"
        }
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "43118887-aa49-452b-81c1-4ad1fc98eabb",
  "connections": {
    "Get Daily Data": {
      "main": [
        [
          {
            "node": "Generate Summary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if Failed": {
      "main": [
        [
          {
            "node": "Alert Quality Team",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Jotform Trigger": {
      "main": [
        [
          {
            "node": "Process Inspection Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Summary": {
      "main": [
        [
          {
            "node": "Send Daily Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Daily Report Trigger": {
      "main": [
        [
          {
            "node": "Get Daily Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Certificate": {
      "main": [
        [
          {
            "node": "Email Certificate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log to Tracking Sheet": {
      "main": [
        [
          {
            "node": "Generate Certificate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Inspection Queue": {
      "main": [
        [
          {
            "node": "Process Inspection Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Store in Google Drive": {
      "main": [
        [
          {
            "node": "Log to Tracking Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process Inspection Data": {
      "main": [
        [
          {
            "node": "Store in Google Drive",
            "type": "main",
            "index": 0
          },
          {
            "node": "Check if Failed",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check for New Inspections": {
      "main": [
        [
          {
            "node": "Read Inspection Queue",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

高级

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
高级
节点数量21
分类-
节点类型9
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者
Jitesh Dugar

Jitesh Dugar

@jiteshdugar

AI Automation Specialist - OpenAI, CRM & Automation Expert with a solid understanding of various tools that include Zapier, Make, Zoho CRM, Hubspot, Google Sheets, Airtable, Pipedrive, Google Analytics, and more.

外部链接
在 n8n.io 查看

分享此工作流