spec.md 2.1 KB

ADDED Requirements

Requirement: Unified production material stock batch

系统 SHALL 新建 biz_production_material_stock_batch,结构对齐 biz_qc_material_stock_batch,含 material_id → biz_production_material.id,快照含 material_type。

批次必填:stock_in_no(租户唯一)、stock_in_date、expire_date、catalog_no、batch_no、manufacturer、unit_price、amount、in_qty、remaining_qty。

biz_production_material.stock_qty = Σ 下属批次 remaining_qty。

Scenario: Batch inbound updates typed material stock

  • WHEN 对 material_type=consumable 的物料入库一批
  • THEN 批次行与汇总 stock_qty 增加,usage 写 manual_in

Requirement: Unified production material usage log

系统 SHALL 新建 biz_production_material_usage 作为 唯一 变动流水表,对齐 QC usage 字段,并扩展生产域溯源:

source_type 说明
manual_in 入库
manual_out 领用出库
step_save 生产工单步骤登记

生产步骤字段:step_id、step_name、task_id、task_no;领用关联:parent_usage_id、receiver、purpose;批次快照字段同 QC。

SHALL NOT 继续使用 biz_consumable_stock_log / biz_reagent_stock_log 写入新流水。

Scenario: Manual out writes to unified usage table

  • WHEN 用户对某批次领用出库
  • THEN INSERT biz_production_material_usage,source_type=manual_out

Requirement: Batch list tab data source

【生产物料库】批次列表 Tab SHALL 调用 GET /production-material-batches,支持 keyword、materialId、materialType、status 筛选;一行 = 一条批次。

Scenario: Filter batches by reagent only

  • WHEN 用户筛选 materialType=reagent
  • THEN 列表仅展示试剂批次

Requirement: Inbound and outbound by batch

入库/批量入库、领用出库/批量出库 SHALL 按 batchId 操作,逻辑对齐 QC qc_material_stock_batch CRUD。

Scenario: Outbound requires batch selection

  • WHEN 领用出库未选 batchId
  • THEN 拒绝并提示选择入库批次