Procurement Workflow Fixes: Vendor Query Logic, Contact Creation, 163 IMAP…

Procurement Workflow Fixes: Vendor Query Logic, Contact Creation, 163 IMAP Disabling, Encoding Fix

Issues Fixed

1. Vendor Query Logic (Filter by Product Name)

File: server/tools/procurement-workflow-v2.js

  • Step1 SCSAI Query AML adds name condition="like" filter by product name: %${product}%
  • If no match by product name, perform a broad query for all Vendors (maxRecords="50", no filter conditions)
  • Only if the broad query also finds nothing, then automatically create a vendor

2. Contact Creation Failure (Bypass Contact, directly write to Vendor.contact_email)

File: server/tools/procurement-workflow-v2.js

  • findOrCreateVendor() rewritten: Skip the three-step pattern of Contact → Vendor → VendorContact
  • Changed to one-step Vendor creation, directly writing the contact_email field: { name, contact_name, contact_email }
  • Error logs now output complete fault details

3. Vendor Naming Convention

File: server/tools/procurement-workflow-v2.js

  • Automatically created vendor names changed to {product}供应商{sequence number}
  • For example, purchasing "Servo Motor" creates "Servo Motor供应商1", "Servo Motor供应商2"
  • Facilitates subsequent searches by product name

4. Comprehensive 163 Email Disabling

File: server/services/email-service.js

  • getImapConfigs() adds DISABLE_163_IMAP environment variable switch
  • By default, skip 163 IMAP (skip when DISABLE_163_IMAP is not set or is true)
  • Only enabled when explicitly set to false

File: server/tools/procurement-workflow-v2.js

  • Added skipEmails filter to vendor creation list: 18601921816@163.com, tuan_zhang@sina.com
  • Second fallback entry also filtered

5. IMAP duplicate fetching

File: server/services/email-service.js

  • Added _lastProcessedSeq[label] tracking in fetchNewEmails()
  • Skip directly if no new emails (startSeq > total)

6. Encoding fixes

  • nodemailer already set defaults: { charset: 'UTF-8' }, email Subject automatically UTF-8 base64 encoded
  • All ?? display issues are caused by terminal encoding (strings in Node.js memory are correct)

Environment variable changes

  • DISABLE_163_IMAP=true - Disable 163 IMAP (already set, needs injection via .env or at startup)
  • SKIP_EMAILS - Comma-separated list of emails to skip (default 163/sina)
  • COZE_SUPPLIER_1/2/3 - Custom backup supplier emails

Trigger method

After DS-PROC-001 Procurement Assistant starts:

  1. Query SCSAI Vendor where name LIKE '%servo motor%'
  2. If found → use; if not found → full query (no filter)
  3. If still not found → automatically create "Servo Motor Supplier 1/2" (skip 163/sina emails)
  4. Send RFQ emails (filter own email + 163/sina)
  5. Wait for quotes (only QQ IMAP listening, 163 not started)
  6. Compare prices + report + confirm + PO

File modification list

  • D:\openclaw\bossagents\server\tools\procurement-workflow-v2.js: Vendor query AML, findOrCreateVendor, fallback supplier name, 163 filter, self-email filter
  • D:\openclaw\bossagents\server\services\email-service.js: 163 IMAP disable switch, IMAP deduplication tracking
← 返回案例列表

Try 左帮右臂 Industrial Agent — your digital workforce

Available as a WeChat mini program, web app (ylxt.chat) and desktop client. Start from whichever fits your workflow.

🌐 Web App 💻 Desktop Download 📞 Call 189-8606-6876
WeChat mini program QR
Scan for the WeChat mini program
Share:
🤖 Try Now →
🤖
🎁