saletask_template.py 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. from typing import Any, Dict
  2. from core.document_processor.templates.base_template import DocumentTemplate
  3. class SaleTaskTemplate(DocumentTemplate):
  4. """销售订单模板"""
  5. @property
  6. def template_name(self) -> str:
  7. return "saletask"
  8. @property
  9. def description(self) -> str:
  10. return "销售订单识别模板"
  11. def get_hardcoded_guidance(self) -> Dict[str, Any]:
  12. """硬编码的字段指导信息(项目初期为空,验收后转移内容到这里)"""
  13. return {
  14. "field_guidance": {
  15. # 项目初期保持为空,验收后将template_config.json的内容转移到这里
  16. },
  17. "additional_rules": "", # 硬编码的额外规则
  18. }
  19. def output_schema(self) -> Dict[str, Any]:
  20. return {
  21. "cusname": "客户名称",
  22. "taskdate": "订货日期",
  23. "requiredate": "交货日期",
  24. "banktype": "结算方式",
  25. "relcode": "相关号码",
  26. "otheramt": "优惠金额",
  27. "damt": "订金",
  28. "cus_tele": "客户联系电话",
  29. "rel_rep": "客户联系人",
  30. "dscrp": "单据备注描述",
  31. "freight": "货运部",
  32. "items": [
  33. {
  34. "mtrlname": "货物\产品名称",
  35. "unit": "计量单位(例如张,台,件等)",
  36. "saleqty": "数量",
  37. "enprice": "单价",
  38. "rebate": "折扣",
  39. }
  40. ],
  41. }
  42. def extraction_rules(self) -> str:
  43. return """
  44. """