refactor: 重构工艺工序相关命名与数据模型
1. 全局替换"工序"为"工艺"统一术语,包括页面文案、枚举、注释
2. 重构工单与工件工艺数据模型:
- 新增工艺组合表flow_material作为备料/齐套唯一源头
- 新增工位状态表station_state支持自主停单/恢复接单
- 移除station_process派工表,改用工单工艺组合作为路线唯一源头
- 替换processCode为flowId作为工艺关联标识
- 重构工件当前进度字段为currentStationNo
3. 删除冗余的静态备份资源文件
4. 调整物料选择组件默认启用仅显示激活物料
5. 优化工单创建/编辑逻辑,新增工艺组合校验与保存
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/entsql"
|
||||
"entgo.io/ent/schema"
|
||||
"entgo.io/ent/schema/field"
|
||||
"entgo.io/ent/schema/index"
|
||||
)
|
||||
|
||||
// FlowMaterial 工艺物料清单:一道工艺装什么料、单台用多少(备料/齐套校验的唯一源头)。
|
||||
// 约束:物料必须属于产品物料清单(BOM)子集(写入时校验)。
|
||||
type FlowMaterial struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (FlowMaterial) Annotations() []schema.Annotation {
|
||||
return []schema.Annotation{entsql.Annotation{Table: "flow_material"}}
|
||||
}
|
||||
|
||||
func (FlowMaterial) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.Int("id").Positive(),
|
||||
field.Int("flowId").Comment("所属工艺ID"),
|
||||
field.String("materialCode").MaxLen(64).Comment("物料编码"),
|
||||
field.String("materialName").Default("").MaxLen(128),
|
||||
field.String("spec").Default("").MaxLen(128),
|
||||
field.String("unit").Default("").MaxLen(16),
|
||||
// 1 批次(结构件) / 2 序列号(电气件)
|
||||
field.String("manageMode").Default("2").MaxLen(10),
|
||||
field.Float("unitQty").Default(0).Comment("单台用量"),
|
||||
field.Float("lossRate").Default(0).Comment("损耗率%"),
|
||||
field.Time("createdAt").Default(time.Now).Immutable(),
|
||||
}
|
||||
}
|
||||
|
||||
func (FlowMaterial) Indexes() []ent.Index {
|
||||
return []ent.Index{
|
||||
index.Fields("flowId"),
|
||||
index.Fields("flowId", "materialCode").Unique(),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user