_tmp_scan_int.py 987 B

12345678910111213141516171819202122232425
  1. # -*- coding: utf-8 -*-
  2. from pathlib import Path
  3. from docx import Document
  4. d = Path(r"C:\Users\skygu\OneDrive\Projects\AIDOP\项目\项目管理\产互联项目管理\交付文档\系统集成")
  5. OPENING = "本模块对接的第三方系统涉及 ERP、MES、WMS"
  6. for p in sorted(d.glob("*V0.4.docx")):
  7. if p.name.startswith("~$"):
  8. continue
  9. doc = Document(str(p))
  10. hits = []
  11. for para in doc.paragraphs:
  12. t = para.text.strip()
  13. if any(x in t for x in ("ERP", "MES", "WMS", "CRM", "SRM", "TMS")):
  14. hits.append(t)
  15. for table in doc.tables:
  16. for row in table.rows:
  17. for cell in row.cells:
  18. t = cell.text.strip()
  19. if any(x in t for x in ("ERP", "MES", "WMS", "CRM", "SRM", "TMS")):
  20. hits.append(t)
  21. leftover = [h for h in hits if OPENING not in h]
  22. print("====", p.name, "named", len(hits), "leftover", len(leftover))
  23. for h in leftover:
  24. print(" ", h[:160])