Files
bj_power/bj_power_mes/schema/station_state.go
T
SunYF d609ff8a9e refactor: 重构工艺工序相关命名与数据模型
1.  全局替换"工序"为"工艺"统一术语,包括页面文案、枚举、注释
2.  重构工单与工件工艺数据模型:
    - 新增工艺组合表flow_material作为备料/齐套唯一源头
    - 新增工位状态表station_state支持自主停单/恢复接单
    - 移除station_process派工表,改用工单工艺组合作为路线唯一源头
    - 替换processCode为flowId作为工艺关联标识
    - 重构工件当前进度字段为currentStationNo
3.  删除冗余的静态备份资源文件
4.  调整物料选择组件默认启用仅显示激活物料
5.  优化工单创建/编辑逻辑,新增工艺组合校验与保存
2026-09-22 11:32:29 +08:00

42 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"
)
// StationState 工位运行状态(当日有效):工人自主 停止接单/恢复接单。
// 停单后上位机不再向该工位下发工件流转指令;某工艺全部工位停单=工件目的地不可达,报警。
// 跨天自动失效(只认当天记录),次日默认全部恢复接单。
type StationState struct {
ent.Schema
}
func (StationState) Annotations() []schema.Annotation {
return []schema.Annotation{entsql.Annotation{Table: "station_state"}}
}
func (StationState) Fields() []ent.Field {
return []ent.Field{
field.Int("id").Positive(),
field.Int("stationNo").Comment("工位号"),
field.String("date").MaxLen(10).Comment("生效日期 yyyy-MM-dd(只认当天)"),
field.Bool("paused").Default(false).Comment("是否停止接单"),
field.String("reason").Default("").MaxLen(255).Comment("停单原因(缺料/故障/其他)"),
field.String("operator").Default("").MaxLen(64).Comment("操作人"),
field.Time("createdAt").Default(time.Now).Immutable(),
field.Time("updatedAt").Default(time.Now).UpdateDefault(time.Now).Optional().Nillable(),
}
}
func (StationState) Indexes() []ent.Index {
return []ent.Index{
index.Fields("stationNo", "date").Unique(),
}
}