1. 全局替换"工序"为"工艺"统一术语,包括页面文案、枚举、注释
2. 重构工单与工件工艺数据模型:
- 新增工艺组合表flow_material作为备料/齐套唯一源头
- 新增工位状态表station_state支持自主停单/恢复接单
- 移除station_process派工表,改用工单工艺组合作为路线唯一源头
- 替换processCode为flowId作为工艺关联标识
- 重构工件当前进度字段为currentStationNo
3. 删除冗余的静态备份资源文件
4. 调整物料选择组件默认启用仅显示激活物料
5. 优化工单创建/编辑逻辑,新增工艺组合校验与保存
45 lines
1.4 KiB
Go
45 lines
1.4 KiB
Go
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"
|
|
)
|
|
|
|
// Workpiece 工件(SN):序列号管理的成品/主件
|
|
type Workpiece struct {
|
|
ent.Schema
|
|
}
|
|
|
|
func (Workpiece) Annotations() []schema.Annotation {
|
|
return []schema.Annotation{entsql.Annotation{Table: "workpiece"}}
|
|
}
|
|
|
|
func (Workpiece) Fields() []ent.Field {
|
|
return []ent.Field{
|
|
field.Int("id").Positive(),
|
|
field.String("sn").Unique().MaxLen(64).Comment("工件唯一SN"),
|
|
field.String("orderNo").Default("").MaxLen(64).Comment("所属工单"),
|
|
field.Int("workOrderId").Optional().Comment("工单ID"),
|
|
field.Int("currentStationNo").Optional().Comment("最后完成报工的工位号(0=未报任何工艺;下一道=工艺组合中工位号更大的下一条)"),
|
|
// ONLINE(已进线) / PROCESSING(在工位) / DONE(完工) / REPAIR / SCRAPPED
|
|
field.String("status").Default("ONLINE").MaxLen(20),
|
|
field.Time("onlineAt").Optional().Nillable().Comment("进线时间"),
|
|
field.Time("doneAt").Optional().Nillable().Comment("完工时间"),
|
|
field.Time("createdAt").Default(time.Now).Immutable(),
|
|
field.Time("updatedAt").Default(time.Now).UpdateDefault(time.Now).Optional().Nillable(),
|
|
}
|
|
}
|
|
|
|
func (Workpiece) Indexes() []ent.Index {
|
|
return []ent.Index{
|
|
index.Fields("sn").Unique(),
|
|
index.Fields("orderNo"),
|
|
index.Fields("status"),
|
|
}
|
|
}
|