feat(cost): 成本模型加研发归集维度 research_flag/project_type (cma-rd-dimension-20260905)
- StandardCost/ActualCost 增加 research_flag(int,idx)/project_type(varchar30,idx) project_type: platform_dev平台研发/client_delivery客户交付/internal内部管理 - 生产库两表 ALTER 完成, 存量 29+134 行默认 internal(保守防误归研发) - API: create/update 支持写入维度, 未传默认 client_delivery(录入默认), research_flag 未显式传入按 project_type 联动(platform_dev=1); create/update/delete 绑定 entity_id(token优先, 防跨账套) - API: standard/actual 列表支持 project_type/research_flag 过滤 - 前端 CostDashboard: 表单加归集类型下拉(默认客户交付+研发提示), 列表加归集类型列(标签), 工具栏按归集类型过滤 - tests: test_cost.py +6 用例(默认值/联动/过滤/更新) - scripts: verify_cost_research_dimension_e2e.py 生产E2E(标记+清理+回查)
This commit is contained in:
@@ -5,12 +5,17 @@ from sqlalchemy import Column, Integer, String, Float, DateTime, Text, ForeignKe
|
||||
from app.database import Base
|
||||
|
||||
|
||||
RESEARCH_PROJECT_TYPES = ("platform_dev", "client_delivery", "internal")
|
||||
|
||||
|
||||
class StandardCost(Base):
|
||||
"""标准成本卡片 — 每项产品或服务的标准成本构成"""
|
||||
__tablename__ = "standard_costs"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
entity_id = Column(Integer, default=1, comment="企业ID (P2多租户隔离 2026-08-23)")
|
||||
research_flag = Column(Integer, default=0, index=True, comment="是否研发投入 0/1(研发费用加计扣除归集 2026-09-05)")
|
||||
project_type = Column(String(30), default="internal", index=True, comment="归集类型: platform_dev平台研发/client_delivery客户交付/internal内部管理(默认internal保守防误归研发)")
|
||||
product_code = Column(String(50), nullable=False, comment="产品/服务编码")
|
||||
product_name = Column(String(200), nullable=False, comment="产品/服务名称")
|
||||
cost_type = Column(String(20), nullable=False, comment="成本类型: material/labor/overhead")
|
||||
@@ -32,6 +37,8 @@ class ActualCost(Base):
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
entity_id = Column(Integer, default=1, comment="企业ID (P2多租户隔离 2026-08-23)")
|
||||
research_flag = Column(Integer, default=0, index=True, comment="是否研发投入 0/1(研发费用加计扣除归集 2026-09-05)")
|
||||
project_type = Column(String(30), default="internal", index=True, comment="归集类型: platform_dev平台研发/client_delivery客户交付/internal内部管理(默认internal保守防误归研发)")
|
||||
period = Column(String(20), nullable=False, comment="期间 2026-05")
|
||||
product_code = Column(String(50), nullable=False, comment="产品/服务编码")
|
||||
product_name = Column(String(200), nullable=False, comment="产品/服务名称")
|
||||
|
||||
Reference in New Issue
Block a user