chore: init bj_power monorepo (dashboard/mes/wms/wms_client/workstation), clear subproject git metadata and align naming to folder names
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/entsql"
|
||||
"entgo.io/ent/schema"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// Signal PLC信号定义,配置PC与PLC之间的数据交换信号
|
||||
type Signal struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (Signal) Annotations() []schema.Annotation {
|
||||
return []schema.Annotation{
|
||||
entsql.Annotation{
|
||||
Table: "signal",
|
||||
Options: "COMMENT='PLC信号定义表,配置PC与PLC之间数据交换的地址映射、收发方向及回复偏移'",
|
||||
},
|
||||
entsql.WithComments(true),
|
||||
}
|
||||
}
|
||||
|
||||
func (Signal) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.Int("id").Positive().Comment("主键ID"),
|
||||
field.Int("isStatus").Comment("信号分类:0=任务信号(一次性触发),1=状态信号(持续读取)"),
|
||||
field.String("name").NotEmpty().Unique().Comment("信号名称,全局唯一,与PLC信号表name一致"),
|
||||
field.Int("sender").Default(1).Comment("发送方:1=PC端发送,2=PLC端发送"),
|
||||
field.String("address").Comment("PLC地址,对应PLC内存映射地址"),
|
||||
field.Int("replyOffset").Default(9).Comment("回复地址偏移量,PLC回复信号相对于发送地址的偏移"),
|
||||
field.String("dataType").Default("bool").Comment("数据类型:bool/byte/int/word,决定信号读取方式"),
|
||||
field.String("description").MaxLen(60).Optional().Comment("信号描述,说明此信号的功能和用途"),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user