From 1f7a42fc38481c76c9613c6797f797a69308b4e0 Mon Sep 17 00:00:00 2001 From: SunYF <123@hard_man.com> Date: Thu, 8 Oct 2026 13:09:53 +0800 Subject: [PATCH] =?UTF-8?q?refactor(mes):=20=E7=A7=BB=E9=99=A4=E5=B7=A5?= =?UTF-8?q?=E4=BD=8D=E6=8E=A5=E9=A9=B3=E5=8F=B0=E7=BB=91=E5=AE=9A=E9=80=BB?= =?UTF-8?q?=E8=BE=91=EF=BC=8C=E6=94=B9=E4=B8=BA=E7=8B=AC=E7=AB=8Bdock?= =?UTF-8?q?=E4=B8=BB=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除station表的hasDock、dockCode字段及相关代码 - 新增dock表注释及关联逻辑,支持一个工位绑定多个接驳台 - 更新工位相关的seed、logic、schema及前端代码,适配新的接驳台管理方式 - 新增SQL注释固化脚本,完善MES表注释 --- bj_power_mes/ent/alert.go | 2 +- bj_power_mes/ent/alertrule.go | 2 +- bj_power_mes/ent/associationtrace.go | 2 +- bj_power_mes/ent/attachment.go | 2 +- bj_power_mes/ent/dailyplan.go | 2 +- bj_power_mes/ent/dock.go | 2 +- bj_power_mes/ent/eventlog.go | 2 +- bj_power_mes/ent/flowmaterial.go | 2 +- bj_power_mes/ent/inspectionrecord.go | 2 +- bj_power_mes/ent/linepoint.go | 2 +- bj_power_mes/ent/material.go | 2 +- bj_power_mes/ent/materialqtyreport.go | 2 +- bj_power_mes/ent/materialrequest.go | 2 +- bj_power_mes/ent/migrate/schema.go | 566 ++++++++-------- bj_power_mes/ent/mutation.go | 110 +-- bj_power_mes/ent/permission.go | 2 +- bj_power_mes/ent/plcsendlog.go | 2 +- bj_power_mes/ent/processflow.go | 2 +- bj_power_mes/ent/processstep.go | 2 +- bj_power_mes/ent/role.go | 2 +- bj_power_mes/ent/runtime.go | 12 +- bj_power_mes/ent/semiflow.go | 2 +- bj_power_mes/ent/station.go | 28 +- bj_power_mes/ent/station/station.go | 22 - bj_power_mes/ent/station/where.go | 85 --- bj_power_mes/ent/station_create.go | 55 -- bj_power_mes/ent/station_update.go | 78 --- bj_power_mes/ent/stationstate.go | 2 +- bj_power_mes/ent/stepcriterion.go | 2 +- bj_power_mes/ent/stepdata.go | 2 +- bj_power_mes/ent/stepsignrecord.go | 2 +- bj_power_mes/ent/sysconfig.go | 2 +- bj_power_mes/ent/torquerecord.go | 2 +- bj_power_mes/ent/user.go | 2 +- bj_power_mes/ent/userstation.go | 2 +- bj_power_mes/ent/workorder.go | 2 +- bj_power_mes/ent/workpiece.go | 2 +- bj_power_mes/ent/workpiecebind.go | 2 +- bj_power_mes/ent/workpieceprocess.go | 2 +- .../frontend/src/pages/ProductType.vue | 12 +- bj_power_mes/frontend/src/pages/Station.vue | 13 +- bj_power_mes/internal/logic/processflow.go | 10 +- bj_power_mes/internal/logic/product.go | 3 + bj_power_mes/internal/logic/qty_report.go | 10 +- bj_power_mes/internal/logic/seed.go | 31 +- bj_power_mes/public/index.html | 2 +- bj_power_mes/schema/alert.go | 2 +- bj_power_mes/schema/alert_rule.go | 2 +- bj_power_mes/schema/association_trace.go | 4 +- bj_power_mes/schema/attachment.go | 2 +- bj_power_mes/schema/daily_plan.go | 2 +- bj_power_mes/schema/dock.go | 2 +- bj_power_mes/schema/event_log.go | 4 +- bj_power_mes/schema/flow_material.go | 2 +- bj_power_mes/schema/inspection_record.go | 2 +- bj_power_mes/schema/line_point.go | 2 +- bj_power_mes/schema/material.go | 2 +- bj_power_mes/schema/material_qty_report.go | 2 +- bj_power_mes/schema/material_request.go | 2 +- bj_power_mes/schema/permission.go | 2 +- bj_power_mes/schema/plc_send_log.go | 2 +- bj_power_mes/schema/process_flow.go | 2 +- bj_power_mes/schema/process_step.go | 2 +- bj_power_mes/schema/role.go | 4 +- bj_power_mes/schema/semi_flow.go | 2 +- bj_power_mes/schema/station.go | 7 +- bj_power_mes/schema/station_state.go | 2 +- bj_power_mes/schema/step_criterion.go | 2 +- bj_power_mes/schema/step_data.go | 2 +- bj_power_mes/schema/step_sign_record.go | 2 +- bj_power_mes/schema/sys_config.go | 2 +- bj_power_mes/schema/torque_record.go | 2 +- bj_power_mes/schema/user.go | 2 +- bj_power_mes/schema/user_station.go | 2 +- bj_power_mes/schema/work_order.go | 2 +- bj_power_mes/schema/workpiece.go | 2 +- bj_power_mes/schema/workpiece_bind.go | 2 +- bj_power_mes/schema/workpiece_process.go | 2 +- bj_power_wms/ent/agvtask.go | 2 +- bj_power_wms/ent/attachment.go | 2 +- bj_power_wms/ent/eventlog.go | 2 +- bj_power_wms/ent/inbounddetail.go | 2 +- bj_power_wms/ent/inboundorder.go | 2 +- bj_power_wms/ent/inspectionrecord.go | 4 +- bj_power_wms/ent/inventory.go | 2 +- bj_power_wms/ent/inventorylock.go | 2 +- bj_power_wms/ent/material.go | 2 +- bj_power_wms/ent/materialdemand.go | 2 +- bj_power_wms/ent/migrate/schema.go | 629 ++++++++++-------- bj_power_wms/ent/ordermaterialledger.go | 2 +- bj_power_wms/ent/outbounddetail.go | 2 +- bj_power_wms/ent/outboundorder.go | 2 +- bj_power_wms/ent/permission.go | 2 +- bj_power_wms/ent/returnorder.go | 2 +- bj_power_wms/ent/role.go | 2 +- bj_power_wms/ent/semifinished.go | 2 +- bj_power_wms/ent/stocktakeitem.go | 2 +- bj_power_wms/ent/stocktakeorder.go | 2 +- bj_power_wms/ent/user.go | 2 +- bj_power_wms/ent/zone.go | 2 +- bj_power_wms/frontend/src/pages/BaseData.vue | 21 +- bj_power_wms/internal/handler/zone.go | 24 +- bj_power_wms/schema/agv_task.go | 7 +- bj_power_wms/schema/attachment.go | 5 + bj_power_wms/schema/event_log.go | 2 +- bj_power_wms/schema/inbound_detail.go | 5 + bj_power_wms/schema/inbound_order.go | 5 + bj_power_wms/schema/inspection_record.go | 5 + bj_power_wms/schema/inventory.go | 5 + bj_power_wms/schema/inventory_lock.go | 5 + bj_power_wms/schema/material.go | 5 + bj_power_wms/schema/material_demand.go | 5 + bj_power_wms/schema/order_material_ledger.go | 5 + bj_power_wms/schema/outbound_detail.go | 5 + bj_power_wms/schema/outbound_order.go | 5 + bj_power_wms/schema/permission.go | 2 +- bj_power_wms/schema/return_order.go | 5 + bj_power_wms/schema/role.go | 2 +- bj_power_wms/schema/semi_finished.go | 5 + bj_power_wms/schema/stocktake.go | 8 + bj_power_wms/schema/user.go | 5 + bj_power_wms/schema/zone.go | 5 + bj_power_wms/web/static/index.html | 2 +- go.work | 7 + go.work.sum | 1 + sql/_mes_catalog.tsv | 402 +++++++++++ sql/_wms_catalog.tsv | 318 +++++++++ sql/bake_comments.py | 110 +++ sql/bake_comments_mes.py | 62 ++ sql/db_comments_mes.sql | 426 ++++++++++++ sql/db_comments_wms.sql | 342 ++++++++++ sql/gen_comments.py | 231 +++++++ 132 files changed, 2799 insertions(+), 1090 deletions(-) create mode 100644 go.work create mode 100644 go.work.sum create mode 100644 sql/_mes_catalog.tsv create mode 100644 sql/_wms_catalog.tsv create mode 100644 sql/bake_comments.py create mode 100644 sql/bake_comments_mes.py create mode 100644 sql/db_comments_mes.sql create mode 100644 sql/db_comments_wms.sql create mode 100644 sql/gen_comments.py diff --git a/bj_power_mes/ent/alert.go b/bj_power_mes/ent/alert.go index c0049d5..95f7709 100644 --- a/bj_power_mes/ent/alert.go +++ b/bj_power_mes/ent/alert.go @@ -12,7 +12,7 @@ import ( "entgo.io/ent/dialect/sql" ) -// Alert is the model entity for the Alert schema. +// Alert 预警消息:规则命中或手动触发后写入,供前端预警中心收件箱展示 type Alert struct { config `json:"-"` // ID of the ent. diff --git a/bj_power_mes/ent/alertrule.go b/bj_power_mes/ent/alertrule.go index 31f346e..479ed8d 100644 --- a/bj_power_mes/ent/alertrule.go +++ b/bj_power_mes/ent/alertrule.go @@ -12,7 +12,7 @@ import ( "entgo.io/ent/dialect/sql" ) -// AlertRule is the model entity for the AlertRule schema. +// AlertRule 预警规则:按类型 + 阈值触发,命中后写入 alert 消息表 type AlertRule struct { config `json:"-"` // ID of the ent. diff --git a/bj_power_mes/ent/associationtrace.go b/bj_power_mes/ent/associationtrace.go index 2e14ae0..b56253e 100644 --- a/bj_power_mes/ent/associationtrace.go +++ b/bj_power_mes/ent/associationtrace.go @@ -13,7 +13,7 @@ import ( "entgo.io/ent/dialect/sql" ) -// AssociationTrace is the model entity for the AssociationTrace schema. +// AssociationTrace 成品追溯关联:成品SN ↔ 结构件批次 + 电气件SN type AssociationTrace struct { config `json:"-"` // ID of the ent. diff --git a/bj_power_mes/ent/attachment.go b/bj_power_mes/ent/attachment.go index 72b09f9..08cc877 100644 --- a/bj_power_mes/ent/attachment.go +++ b/bj_power_mes/ent/attachment.go @@ -12,7 +12,7 @@ import ( "entgo.io/ent/dialect/sql" ) -// Attachment is the model entity for the Attachment schema. +// Attachment 业务附件:图纸 / 照片 / 文档等,按 bizType+bizId 关联业务单据。 type Attachment struct { config `json:"-"` // ID of the ent. diff --git a/bj_power_mes/ent/dailyplan.go b/bj_power_mes/ent/dailyplan.go index 055cd6e..acdb3e1 100644 --- a/bj_power_mes/ent/dailyplan.go +++ b/bj_power_mes/ent/dailyplan.go @@ -13,7 +13,7 @@ import ( "entgo.io/ent/dialect/sql" ) -// DailyPlan is the model entity for the DailyPlan schema. +// DailyPlan 日排产:仅预告,不触发出库/领料 type DailyPlan struct { config `json:"-"` // ID of the ent. diff --git a/bj_power_mes/ent/dock.go b/bj_power_mes/ent/dock.go index 72aedba..f244319 100644 --- a/bj_power_mes/ent/dock.go +++ b/bj_power_mes/ent/dock.go @@ -12,7 +12,7 @@ import ( "entgo.io/ent/dialect/sql" ) -// Dock is the model entity for the Dock schema. +// Dock 接驳台主数据:DOCK01~DOCK20(产线,DOCKn↔工位n)+ DOCK21(库房收货)。 type Dock struct { config `json:"-"` // ID of the ent. diff --git a/bj_power_mes/ent/eventlog.go b/bj_power_mes/ent/eventlog.go index 8724ea3..4aaf6e8 100644 --- a/bj_power_mes/ent/eventlog.go +++ b/bj_power_mes/ent/eventlog.go @@ -13,7 +13,7 @@ import ( "entgo.io/ent/dialect/sql" ) -// EventLog is the model entity for the EventLog schema. +// EventLog 操作日志:必须含 workOrderNo(工单号)、operator(操作人) type EventLog struct { config `json:"-"` // ID of the ent. diff --git a/bj_power_mes/ent/flowmaterial.go b/bj_power_mes/ent/flowmaterial.go index 8baa5c7..092ddda 100644 --- a/bj_power_mes/ent/flowmaterial.go +++ b/bj_power_mes/ent/flowmaterial.go @@ -12,7 +12,7 @@ import ( "entgo.io/ent/dialect/sql" ) -// FlowMaterial is the model entity for the FlowMaterial schema. +// FlowMaterial 工艺物料清单:一道工艺装什么料、单台用多少(备料/齐套校验的唯一源头)。 type FlowMaterial struct { config `json:"-"` // ID of the ent. diff --git a/bj_power_mes/ent/inspectionrecord.go b/bj_power_mes/ent/inspectionrecord.go index c842632..035c1ea 100644 --- a/bj_power_mes/ent/inspectionrecord.go +++ b/bj_power_mes/ent/inspectionrecord.go @@ -13,7 +13,7 @@ import ( "entgo.io/ent/dialect/sql" ) -// InspectionRecord is the model entity for the InspectionRecord schema. +// InspectionRecord 巡检与质量检验记录(PAD 巡检终端 + MES 质量检验录入共用): type InspectionRecord struct { config `json:"-"` // ID of the ent. diff --git a/bj_power_mes/ent/linepoint.go b/bj_power_mes/ent/linepoint.go index 0b78806..93475d2 100644 --- a/bj_power_mes/ent/linepoint.go +++ b/bj_power_mes/ent/linepoint.go @@ -12,7 +12,7 @@ import ( "entgo.io/ent/dialect/sql" ) -// LinePoint is the model entity for the LinePoint schema. +// LinePoint 产线点位台账:记录每个点位当前存放的工件(唯一事实源)。 type LinePoint struct { config `json:"-"` // ID of the ent. diff --git a/bj_power_mes/ent/material.go b/bj_power_mes/ent/material.go index 60da3ba..a975460 100644 --- a/bj_power_mes/ent/material.go +++ b/bj_power_mes/ent/material.go @@ -12,7 +12,7 @@ import ( "entgo.io/ent/dialect/sql" ) -// Material is the model entity for the Material schema. +// Material 物料主数据 MES 本地副本(两库对等双向同步,2026-09-29 定稿 M1)。 type Material struct { config `json:"-"` // ID of the ent. diff --git a/bj_power_mes/ent/materialqtyreport.go b/bj_power_mes/ent/materialqtyreport.go index 4373e1d..1dbb5ec 100644 --- a/bj_power_mes/ent/materialqtyreport.go +++ b/bj_power_mes/ent/materialqtyreport.go @@ -12,7 +12,7 @@ import ( "entgo.io/ent/dialect/sql" ) -// MaterialQtyReport is the model entity for the MaterialQtyReport schema. +// MaterialQtyReport 工位数量不符上报(客户诉求 问题记录 L482/L486): type MaterialQtyReport struct { config `json:"-"` // ID of the ent. diff --git a/bj_power_mes/ent/materialrequest.go b/bj_power_mes/ent/materialrequest.go index ae5b786..1d50994 100644 --- a/bj_power_mes/ent/materialrequest.go +++ b/bj_power_mes/ent/materialrequest.go @@ -12,7 +12,7 @@ import ( "entgo.io/ent/dialect/sql" ) -// MaterialRequest is the model entity for the MaterialRequest schema. +// MaterialRequest 备料单:按日排产自动算料生成 type MaterialRequest struct { config `json:"-"` // ID of the ent. diff --git a/bj_power_mes/ent/migrate/schema.go b/bj_power_mes/ent/migrate/schema.go index f528bad..40a7f44 100644 --- a/bj_power_mes/ent/migrate/schema.go +++ b/bj_power_mes/ent/migrate/schema.go @@ -12,20 +12,21 @@ var ( // AlertColumns holds the columns for the "alert" table. AlertColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, - {Name: "rule_id", Type: field.TypeInt, Default: 0}, - {Name: "type", Type: field.TypeString, Size: 40}, - {Name: "title", Type: field.TypeString, Size: 120}, - {Name: "content", Type: field.TypeString, Size: 500, Default: ""}, - {Name: "ref_type", Type: field.TypeString, Size: 40, Default: ""}, - {Name: "ref_id", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "order_no", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "status", Type: field.TypeString, Size: 10, Default: "UNREAD"}, - {Name: "receiver", Type: field.TypeString, Size: 255, Default: ""}, + {Name: "rule_id", Type: field.TypeInt, Comment: "关联规则ID,0=手动触发", Default: 0}, + {Name: "type", Type: field.TypeString, Size: 40, Comment: "预警类型"}, + {Name: "title", Type: field.TypeString, Size: 120, Comment: "标题"}, + {Name: "content", Type: field.TypeString, Size: 500, Comment: "内容", Default: ""}, + {Name: "ref_type", Type: field.TypeString, Size: 40, Comment: "关联业务类型", Default: ""}, + {Name: "ref_id", Type: field.TypeString, Size: 64, Comment: "关联业务ID", Default: ""}, + {Name: "order_no", Type: field.TypeString, Size: 64, Comment: "关联工单号(按工单号查询用)", Default: ""}, + {Name: "status", Type: field.TypeString, Size: 10, Comment: "UNREAD/READ", Default: "UNREAD"}, + {Name: "receiver", Type: field.TypeString, Size: 255, Comment: "接收人", Default: ""}, {Name: "created_at", Type: field.TypeTime}, } // AlertTable holds the schema information for the "alert" table. AlertTable = &schema.Table{ Name: "alert", + Comment: "Alert 预警消息:规则命中或手动触发后写入,供前端预警中心收件箱展示", Columns: AlertColumns, PrimaryKey: []*schema.Column{AlertColumns[0]}, Indexes: []*schema.Index{ @@ -49,17 +50,18 @@ var ( // AlertRuleColumns holds the columns for the "alert_rule" table. AlertRuleColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, - {Name: "name", Type: field.TypeString, Size: 80}, - {Name: "type", Type: field.TypeString, Size: 40}, - {Name: "threshold", Type: field.TypeFloat64, Default: 0}, - {Name: "receiver", Type: field.TypeString, Size: 255, Default: ""}, - {Name: "enabled", Type: field.TypeBool, Default: true}, - {Name: "created_by", Type: field.TypeString, Size: 64, Default: ""}, + {Name: "name", Type: field.TypeString, Size: 80, Comment: "规则名称"}, + {Name: "type", Type: field.TypeString, Size: 40, Comment: "预警类型 torque_ng/inspection_ng/inventory_low/task_overdue"}, + {Name: "threshold", Type: field.TypeFloat64, Comment: "阈值(不同类含义不同)", Default: 0}, + {Name: "receiver", Type: field.TypeString, Size: 255, Comment: "接收人,逗号分隔", Default: ""}, + {Name: "enabled", Type: field.TypeBool, Comment: "是否启用", Default: true}, + {Name: "created_by", Type: field.TypeString, Size: 64, Comment: "创建人", Default: ""}, {Name: "created_at", Type: field.TypeTime}, } // AlertRuleTable holds the schema information for the "alert_rule" table. AlertRuleTable = &schema.Table{ Name: "alert_rule", + Comment: "AlertRule 预警规则:按类型 + 阈值触发,命中后写入 alert 消息表", Columns: AlertRuleColumns, PrimaryKey: []*schema.Column{AlertRuleColumns[0]}, Indexes: []*schema.Index{ @@ -78,17 +80,18 @@ var ( // AssociationTraceColumns holds the columns for the "association_trace" table. AssociationTraceColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, - {Name: "finished_sn", Type: field.TypeString, Unique: true, Size: 64}, + {Name: "finished_sn", Type: field.TypeString, Unique: true, Size: 64, Comment: "成品SN(主件)"}, {Name: "order_no", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "process_code", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "batch_items", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}}, - {Name: "serial_items", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}}, - {Name: "operator", Type: field.TypeString, Size: 64, Default: ""}, + {Name: "process_code", Type: field.TypeString, Size: 64, Comment: "成品的工序组合", Default: ""}, + {Name: "batch_items", Type: field.TypeJSON, Nullable: true, Comment: "结构件批次号列表", SchemaType: map[string]string{"postgres": "jsonb"}}, + {Name: "serial_items", Type: field.TypeJSON, Nullable: true, Comment: "电气件SN码列表", SchemaType: map[string]string{"postgres": "jsonb"}}, + {Name: "operator", Type: field.TypeString, Size: 64, Comment: "完工关联登记人", Default: ""}, {Name: "created_at", Type: field.TypeTime}, } // AssociationTraceTable holds the schema information for the "association_trace" table. AssociationTraceTable = &schema.Table{ Name: "association_trace", + Comment: "AssociationTrace 成品追溯关联:成品SN ↔ 结构件批次 + 电气件SN", Columns: AssociationTraceColumns, PrimaryKey: []*schema.Column{AssociationTraceColumns[0]}, Indexes: []*schema.Index{ @@ -102,26 +105,27 @@ var ( // AttachmentColumns holds the columns for the "attachment" table. AttachmentColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, - {Name: "biz_type", Type: field.TypeString, Size: 40}, - {Name: "biz_id", Type: field.TypeString, Size: 64}, - {Name: "file_name", Type: field.TypeString, Size: 255}, - {Name: "file_path", Type: field.TypeString, Size: 255}, - {Name: "file_size", Type: field.TypeInt, Default: 0}, - {Name: "uploader", Type: field.TypeString, Size: 64, Default: ""}, + {Name: "biz_type", Type: field.TypeString, Size: 40, Comment: "业务类型 work_order/material/process_flow/inspection"}, + {Name: "biz_id", Type: field.TypeString, Size: 64, Comment: "业务ID"}, + {Name: "file_name", Type: field.TypeString, Size: 255, Comment: "原始文件名"}, + {Name: "file_path", Type: field.TypeString, Size: 255, Comment: "上传目录相对路径"}, + {Name: "file_size", Type: field.TypeInt, Comment: "字节数", Default: 0}, + {Name: "uploader", Type: field.TypeString, Size: 64, Comment: "上传人", Default: ""}, {Name: "created_at", Type: field.TypeTime}, - {Name: "file_type", Type: field.TypeString, Size: 32, Default: "OTHER"}, - {Name: "file_ext", Type: field.TypeString, Size: 16, Default: ""}, - {Name: "file_md5", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "mime_type", Type: field.TypeString, Size: 128, Default: ""}, - {Name: "archived", Type: field.TypeBool, Default: false}, - {Name: "archived_at", Type: field.TypeInt64, Default: 0}, - {Name: "deleted", Type: field.TypeBool, Default: false}, - {Name: "deleted_at", Type: field.TypeInt64, Default: 0}, - {Name: "deleted_by", Type: field.TypeString, Size: 64, Default: ""}, + {Name: "file_type", Type: field.TypeString, Size: 32, Comment: "文件类型 大写枚举 PROCESS_PDF/INSPECTION_PHOTO/...", Default: "OTHER"}, + {Name: "file_ext", Type: field.TypeString, Size: 16, Comment: "扩展名(小写,不含点)", Default: ""}, + {Name: "file_md5", Type: field.TypeString, Size: 64, Comment: "文件MD5(秒传/去重)", Default: ""}, + {Name: "mime_type", Type: field.TypeString, Size: 128, Comment: "MIME类型", Default: ""}, + {Name: "archived", Type: field.TypeBool, Comment: "是否已归档", Default: false}, + {Name: "archived_at", Type: field.TypeInt64, Comment: "归档时间(unix秒)", Default: 0}, + {Name: "deleted", Type: field.TypeBool, Comment: "逻辑删除", Default: false}, + {Name: "deleted_at", Type: field.TypeInt64, Comment: "删除时间(unix秒)", Default: 0}, + {Name: "deleted_by", Type: field.TypeString, Size: 64, Comment: "删除人", Default: ""}, } // AttachmentTable holds the schema information for the "attachment" table. AttachmentTable = &schema.Table{ Name: "attachment", + Comment: "Attachment 业务附件:图纸 / 照片 / 文档等,按 bizType+bizId 关联业务单据。", Columns: AttachmentColumns, PrimaryKey: []*schema.Column{AttachmentColumns[0]}, Indexes: []*schema.Index{ @@ -150,11 +154,11 @@ var ( // DailyPlanColumns holds the columns for the "daily_plan" table. DailyPlanColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, - {Name: "order_no", Type: field.TypeString, Size: 64}, - {Name: "plan_date", Type: field.TypeString, Size: 10}, - {Name: "plan_qty", Type: field.TypeInt, Default: 0}, - {Name: "completed_qty", Type: field.TypeInt, Default: 0}, - {Name: "station_plan_qty", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}}, + {Name: "order_no", Type: field.TypeString, Size: 64, Comment: "工单号"}, + {Name: "plan_date", Type: field.TypeString, Size: 10, Comment: "排产日期 yyyy-MM-dd"}, + {Name: "plan_qty", Type: field.TypeInt, Comment: "计划数量", Default: 0}, + {Name: "completed_qty", Type: field.TypeInt, Comment: "已完成数量", Default: 0}, + {Name: "station_plan_qty", Type: field.TypeJSON, Nullable: true, Comment: "各工位产量分配 stationNo→计划产量", SchemaType: map[string]string{"postgres": "jsonb"}}, {Name: "status", Type: field.TypeString, Size: 20, Default: "PENDING"}, {Name: "operator", Type: field.TypeString, Size: 64, Default: ""}, {Name: "created_at", Type: field.TypeTime}, @@ -163,6 +167,7 @@ var ( // DailyPlanTable holds the schema information for the "daily_plan" table. DailyPlanTable = &schema.Table{ Name: "daily_plan", + Comment: "DailyPlan 日排产:仅预告,不触发出库/领料", Columns: DailyPlanColumns, PrimaryKey: []*schema.Column{DailyPlanColumns[0]}, Indexes: []*schema.Index{ @@ -186,18 +191,19 @@ var ( // DockColumns holds the columns for the "dock" table. DockColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, - {Name: "dock_code", Type: field.TypeString, Unique: true, Size: 20}, - {Name: "name", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "dock_type", Type: field.TypeString, Size: 16, Default: "line"}, - {Name: "station_no", Type: field.TypeInt, Default: 0}, - {Name: "has_pallet", Type: field.TypeBool, Default: false}, - {Name: "pallet_ref", Type: field.TypeString, Nullable: true, Size: 64, Default: ""}, + {Name: "dock_code", Type: field.TypeString, Unique: true, Size: 20, Comment: "接驳台编码 DOCK01..21"}, + {Name: "name", Type: field.TypeString, Size: 64, Comment: "接驳台名称", Default: ""}, + {Name: "dock_type", Type: field.TypeString, Size: 16, Comment: "类型 line产线/store库房/other其他", Default: "line"}, + {Name: "station_no", Type: field.TypeInt, Comment: "关联工位号(与工位1:1,非产线为0)", Default: 0}, + {Name: "has_pallet", Type: field.TypeBool, Comment: "当前是否有托盘", Default: false}, + {Name: "pallet_ref", Type: field.TypeString, Nullable: true, Size: 64, Comment: "托盘关联(出库单号/备料单号)", Default: ""}, {Name: "status", Type: field.TypeString, Size: 20, Default: "ENABLED"}, {Name: "created_at", Type: field.TypeTime}, } // DockTable holds the schema information for the "dock" table. DockTable = &schema.Table{ Name: "dock", + Comment: "Dock 接驳台主数据:DOCK01~DOCK20(产线,DOCKn↔工位n)+ DOCK21(库房收货)。", Columns: DockColumns, PrimaryKey: []*schema.Column{DockColumns[0]}, Indexes: []*schema.Index{ @@ -216,18 +222,19 @@ var ( // EventLogColumns holds the columns for the "event_log" table. EventLogColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, - {Name: "event_type", Type: field.TypeString, Size: 50}, - {Name: "work_order_no", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "operator", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "entity_type", Type: field.TypeString, Size: 30, Default: ""}, - {Name: "entity_id", Type: field.TypeString, Size: 50, Default: ""}, - {Name: "description", Type: field.TypeString, Size: 2147483647, Default: ""}, - {Name: "payload", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}}, - {Name: "created_at", Type: field.TypeTime}, + {Name: "event_type", Type: field.TypeString, Size: 50, Comment: "事件类型,如 work.order.create"}, + {Name: "work_order_no", Type: field.TypeString, Size: 64, Comment: "关联工单号", Default: ""}, + {Name: "operator", Type: field.TypeString, Size: 64, Comment: "操作人", Default: ""}, + {Name: "entity_type", Type: field.TypeString, Size: 30, Comment: "实体类型", Default: ""}, + {Name: "entity_id", Type: field.TypeString, Size: 50, Comment: "实体标识", Default: ""}, + {Name: "description", Type: field.TypeString, Size: 2147483647, Comment: "描述", Default: ""}, + {Name: "payload", Type: field.TypeJSON, Nullable: true, Comment: "载荷", SchemaType: map[string]string{"postgres": "jsonb"}}, + {Name: "created_at", Type: field.TypeTime, Comment: "创建时间"}, } // EventLogTable holds the schema information for the "event_log" table. EventLogTable = &schema.Table{ Name: "event_log", + Comment: "EventLog 操作日志:必须含 workOrderNo(工单号)、operator(操作人)", Columns: EventLogColumns, PrimaryKey: []*schema.Column{EventLogColumns[0]}, Indexes: []*schema.Index{ @@ -256,19 +263,20 @@ var ( // FlowMaterialColumns holds the columns for the "flow_material" table. FlowMaterialColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, - {Name: "flow_id", Type: field.TypeInt}, - {Name: "material_code", Type: field.TypeString, Size: 64}, + {Name: "flow_id", Type: field.TypeInt, Comment: "所属工艺ID"}, + {Name: "material_code", Type: field.TypeString, Size: 64, Comment: "物料编码"}, {Name: "material_name", Type: field.TypeString, Size: 128, Default: ""}, {Name: "spec", Type: field.TypeString, Size: 128, Default: ""}, {Name: "unit", Type: field.TypeString, Size: 16, Default: ""}, {Name: "sn_mode", Type: field.TypeInt, Default: 2}, - {Name: "unit_qty", Type: field.TypeFloat64, Default: 0}, - {Name: "loss_rate", Type: field.TypeFloat64, Default: 0}, + {Name: "unit_qty", Type: field.TypeFloat64, Comment: "单台用量", Default: 0}, + {Name: "loss_rate", Type: field.TypeFloat64, Comment: "损耗率%", Default: 0}, {Name: "created_at", Type: field.TypeTime}, } // FlowMaterialTable holds the schema information for the "flow_material" table. FlowMaterialTable = &schema.Table{ Name: "flow_material", + Comment: "FlowMaterial 工艺物料清单:一道工艺装什么料、单台用多少(备料/齐套校验的唯一源头)。", Columns: FlowMaterialColumns, PrimaryKey: []*schema.Column{FlowMaterialColumns[0]}, Indexes: []*schema.Index{ @@ -287,36 +295,37 @@ var ( // InspectionRecordColumns holds the columns for the "inspection_record" table. InspectionRecordColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, - {Name: "category", Type: field.TypeString, Size: 20}, - {Name: "station_no", Type: field.TypeString, Size: 32, Default: ""}, - {Name: "shift", Type: field.TypeString, Size: 20, Default: ""}, - {Name: "order_no", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "sn", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "result", Type: field.TypeString, Size: 10, Default: "OK"}, - {Name: "items", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}}, - {Name: "photo", Type: field.TypeString, Size: 255, Default: ""}, - {Name: "remark", Type: field.TypeString, Size: 500, Default: ""}, - {Name: "operator", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "process_code", Type: field.TypeInt, Default: 0}, - {Name: "step_id", Type: field.TypeInt, Default: 0}, - {Name: "step_name", Type: field.TypeString, Size: 128, Default: ""}, - {Name: "measured_value", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "report_no", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "material_code", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "material_name", Type: field.TypeString, Size: 128, Default: ""}, - {Name: "manufacturer", Type: field.TypeString, Size: 128, Default: ""}, - {Name: "inspection_no", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "attachment_ids", Type: field.TypeString, Size: 512, Default: ""}, - {Name: "disposal_type", Type: field.TypeString, Size: 20, Default: ""}, - {Name: "disposal_remark", Type: field.TypeString, Size: 500, Default: ""}, - {Name: "batch_sn", Type: field.TypeString, Nullable: true, Size: 128}, - {Name: "related_standard", Type: field.TypeString, Nullable: true, Size: 255}, - {Name: "test_record_no", Type: field.TypeString, Nullable: true, Size: 128}, + {Name: "category", Type: field.TypeString, Size: 20, Comment: "记录类型 CHECKIN/POINT/PROCESS/DONE/ALARM/INCOMING/FINAL/QC_PROCESS"}, + {Name: "station_no", Type: field.TypeString, Size: 32, Comment: "工位号", Default: ""}, + {Name: "shift", Type: field.TypeString, Size: 20, Comment: "班次 早/中/晚", Default: ""}, + {Name: "order_no", Type: field.TypeString, Size: 64, Comment: "工单号", Default: ""}, + {Name: "sn", Type: field.TypeString, Size: 64, Comment: "工件SN", Default: ""}, + {Name: "result", Type: field.TypeString, Size: 10, Comment: "结论", Default: "OK"}, + {Name: "items", Type: field.TypeJSON, Nullable: true, Comment: "点检项/异常类型列表", SchemaType: map[string]string{"postgres": "jsonb"}}, + {Name: "photo", Type: field.TypeString, Size: 255, Comment: "拍照文件名", Default: ""}, + {Name: "remark", Type: field.TypeString, Size: 500, Comment: "文字描述/签字", Default: ""}, + {Name: "operator", Type: field.TypeString, Size: 64, Comment: "操作人", Default: ""}, + {Name: "process_code", Type: field.TypeInt, Comment: "所属工位号(过程巡检所在工位)", Default: 0}, + {Name: "step_id", Type: field.TypeInt, Comment: "工艺步骤ID(过程巡检逐条关联)", Default: 0}, + {Name: "step_name", Type: field.TypeString, Size: 128, Comment: "工艺步骤名称", Default: ""}, + {Name: "measured_value", Type: field.TypeString, Size: 64, Comment: "实测值(过程巡检录入)", Default: ""}, + {Name: "report_no", Type: field.TypeString, Size: 64, Comment: "报检单号", Default: ""}, + {Name: "material_code", Type: field.TypeString, Size: 64, Comment: "物料编码(图号)", Default: ""}, + {Name: "material_name", Type: field.TypeString, Size: 128, Comment: "物料名称", Default: ""}, + {Name: "manufacturer", Type: field.TypeString, Size: 128, Comment: "生产厂家", Default: ""}, + {Name: "inspection_no", Type: field.TypeString, Size: 64, Comment: "检验单号", Default: ""}, + {Name: "attachment_ids", Type: field.TypeString, Size: 512, Comment: "附件ID,逗号分隔(关联 attachment 表)", Default: ""}, + {Name: "disposal_type", Type: field.TypeString, Size: 20, Comment: "处置类型 退货/返修/退换/报废", Default: ""}, + {Name: "disposal_remark", Type: field.TypeString, Size: 500, Comment: "处置说明", Default: ""}, + {Name: "batch_sn", Type: field.TypeString, Nullable: true, Size: 128, Comment: "批次号/SN(联动 WMS 在库处置:序列号件=SN 批次件=批次)"}, + {Name: "related_standard", Type: field.TypeString, Nullable: true, Size: 255, Comment: "相关标准/试验方案号(完工检用,随成品回流 WMS)"}, + {Name: "test_record_no", Type: field.TypeString, Nullable: true, Size: 128, Comment: "试验记录单号(完工检用,随成品回流 WMS)"}, {Name: "created_at", Type: field.TypeTime}, } // InspectionRecordTable holds the schema information for the "inspection_record" table. InspectionRecordTable = &schema.Table{ Name: "inspection_record", + Comment: "InspectionRecord 巡检与质量检验记录(PAD 巡检终端 + MES 质量检验录入共用):", Columns: InspectionRecordColumns, PrimaryKey: []*schema.Column{InspectionRecordColumns[0]}, Indexes: []*schema.Index{ @@ -345,19 +354,20 @@ var ( // LinePointColumns holds the columns for the "line_point" table. LinePointColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, - {Name: "point_type", Type: field.TypeString, Size: 20}, - {Name: "point_no", Type: field.TypeString, Size: 32}, - {Name: "label", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "seq", Type: field.TypeInt, Default: 0}, - {Name: "station_no", Type: field.TypeInt, Default: 0}, - {Name: "current_sn", Type: field.TypeString, Size: 128, Default: ""}, - {Name: "order_no", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "occupied", Type: field.TypeBool, Default: false}, + {Name: "point_type", Type: field.TypeString, Size: 20, Comment: "FEED上料位/STATION工位/CACHE缓存位/DOCK接驳台/END末端"}, + {Name: "point_no", Type: field.TypeString, Size: 32, Comment: "点位编号:IN上料位 / 1~10工位 / C1~C8缓存位 / 1-R1接驳台 / END-U上排末端 / END-D下排末端"}, + {Name: "label", Type: field.TypeString, Size: 64, Comment: "点位名称", Default: ""}, + {Name: "seq", Type: field.TypeInt, Comment: "传送带顺序(上料位→工位→末端,用于相邻缓存位判定)", Default: 0}, + {Name: "station_no", Type: field.TypeInt, Comment: "所属工位号(DOCK/CACHE 归属;0=无)", Default: 0}, + {Name: "current_sn", Type: field.TypeString, Size: 128, Comment: "当前存放工件SN(空=空闲)", Default: ""}, + {Name: "order_no", Type: field.TypeString, Size: 64, Comment: "当前工件所属工单号", Default: ""}, + {Name: "occupied", Type: field.TypeBool, Comment: "是否占用", Default: false}, {Name: "updated_at", Type: field.TypeTime}, } // LinePointTable holds the schema information for the "line_point" table. LinePointTable = &schema.Table{ Name: "line_point", + Comment: "LinePoint 产线点位台账:记录每个点位当前存放的工件(唯一事实源)。", Columns: LinePointColumns, PrimaryKey: []*schema.Column{LinePointColumns[0]}, Indexes: []*schema.Index{ @@ -371,24 +381,25 @@ var ( // MaterialsColumns holds the columns for the "materials" table. MaterialsColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, - {Name: "code", Type: field.TypeString, Unique: true, Size: 64}, - {Name: "name", Type: field.TypeString, Size: 128}, - {Name: "spec", Type: field.TypeString, Size: 128, Default: ""}, - {Name: "unit", Type: field.TypeString, Size: 32, Default: ""}, - {Name: "description", Type: field.TypeString, Size: 255, Default: ""}, - {Name: "item_type", Type: field.TypeInt, Default: 1}, - {Name: "manage_mode", Type: field.TypeInt, Default: 1}, - {Name: "sn_mode", Type: field.TypeInt, Default: 0}, - {Name: "template_code", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "safety_stock", Type: field.TypeInt, Default: 0}, - {Name: "is_active", Type: field.TypeBool, Default: true}, - {Name: "sync_pending", Type: field.TypeBool, Default: false}, + {Name: "code", Type: field.TypeString, Unique: true, Size: 64, Comment: "物料编码(图号),两库同步唯一业务键"}, + {Name: "name", Type: field.TypeString, Size: 128, Comment: "物料名称"}, + {Name: "spec", Type: field.TypeString, Size: 128, Comment: "规格型号", Default: ""}, + {Name: "unit", Type: field.TypeString, Size: 32, Comment: "计量单位", Default: ""}, + {Name: "description", Type: field.TypeString, Size: 255, Comment: "说明", Default: ""}, + {Name: "item_type", Type: field.TypeInt, Comment: "品类 1原材料/3成品/4其他(半成品不是物料品类)", Default: 1}, + {Name: "manage_mode", Type: field.TypeInt, Comment: "类型 1结构件/2电气件/3其他(仅分类,不决定SN行为)", Default: 1}, + {Name: "sn_mode", Type: field.TypeInt, Comment: "是否逐件SN管理 0未选择(必填)/1序列号件(录SN)/2批次件(不录SN)", Default: 0}, + {Name: "template_code", Type: field.TypeString, Size: 64, Comment: "模板编码", Default: ""}, + {Name: "safety_stock", Type: field.TypeInt, Comment: "安全库存(低于触发缺货预警)", Default: 0}, + {Name: "is_active", Type: field.TypeBool, Comment: "启用/停用(两库均不物理删除)", Default: true}, + {Name: "sync_pending", Type: field.TypeBool, Comment: "推送WMS失败标记,列表请求时异步重推", Default: false}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, } // MaterialsTable holds the schema information for the "materials" table. MaterialsTable = &schema.Table{ Name: "materials", + Comment: "Material 物料主数据 MES 本地副本(两库对等双向同步,2026-09-29 定稿 M1)。", Columns: MaterialsColumns, PrimaryKey: []*schema.Column{MaterialsColumns[0]}, Indexes: []*schema.Index{ @@ -407,28 +418,29 @@ var ( // MaterialQtyReportColumns holds the columns for the "material_qty_report" table. MaterialQtyReportColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, - {Name: "station_no", Type: field.TypeInt, Default: 0}, - {Name: "order_no", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "sn", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "material_code", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "material_name", Type: field.TypeString, Size: 128, Default: ""}, - {Name: "plan_qty", Type: field.TypeInt, Default: 0}, - {Name: "actual_qty", Type: field.TypeInt, Default: 0}, - {Name: "diff_qty", Type: field.TypeInt, Default: 0}, - {Name: "cause", Type: field.TypeString, Size: 255, Default: ""}, - {Name: "status", Type: field.TypeString, Size: 16, Default: "PENDING"}, - {Name: "handle_type", Type: field.TypeString, Size: 16, Default: ""}, - {Name: "handle_doc_no", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "handle_note", Type: field.TypeString, Size: 255, Default: ""}, - {Name: "handled_by", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "handled_at", Type: field.TypeInt64, Default: 0}, - {Name: "operator", Type: field.TypeString, Size: 64, Default: ""}, + {Name: "station_no", Type: field.TypeInt, Comment: "工位号", Default: 0}, + {Name: "order_no", Type: field.TypeString, Size: 64, Comment: "工单号", Default: ""}, + {Name: "sn", Type: field.TypeString, Size: 64, Comment: "工件SN", Default: ""}, + {Name: "material_code", Type: field.TypeString, Size: 64, Comment: "物料编码", Default: ""}, + {Name: "material_name", Type: field.TypeString, Size: 128, Comment: "物料名称", Default: ""}, + {Name: "plan_qty", Type: field.TypeInt, Comment: "应发数量", Default: 0}, + {Name: "actual_qty", Type: field.TypeInt, Comment: "实收数量", Default: 0}, + {Name: "diff_qty", Type: field.TypeInt, Comment: "差异=应发-实收", Default: 0}, + {Name: "cause", Type: field.TypeString, Size: 255, Comment: "差异原因", Default: ""}, + {Name: "status", Type: field.TypeString, Size: 16, Comment: "PENDING/PROCESSING/REPLENISHED/RETURNED/ADJUSTED/CLOSED", Default: "PENDING"}, + {Name: "handle_type", Type: field.TypeString, Size: 16, Comment: "处理方式 REPLENISH补发/RETURN退库/ADJUST调整", Default: ""}, + {Name: "handle_doc_no", Type: field.TypeString, Size: 64, Comment: "处理生成的单据号(补料单号/退库单号)", Default: ""}, + {Name: "handle_note", Type: field.TypeString, Size: 255, Comment: "处理说明", Default: ""}, + {Name: "handled_by", Type: field.TypeString, Size: 64, Comment: "处理人", Default: ""}, + {Name: "handled_at", Type: field.TypeInt64, Comment: "处理时间(unix 秒)", Default: 0}, + {Name: "operator", Type: field.TypeString, Size: 64, Comment: "上报人", Default: ""}, {Name: "created_at", Type: field.TypeTime}, {Name: "resolved_at", Type: field.TypeTime, Nullable: true}, } // MaterialQtyReportTable holds the schema information for the "material_qty_report" table. MaterialQtyReportTable = &schema.Table{ Name: "material_qty_report", + Comment: "MaterialQtyReport 工位数量不符上报(客户诉求 问题记录 L482/L486):", Columns: MaterialQtyReportColumns, PrimaryKey: []*schema.Column{MaterialQtyReportColumns[0]}, Indexes: []*schema.Index{ @@ -457,28 +469,28 @@ var ( // MaterialRequestColumns holds the columns for the "material_request" table. MaterialRequestColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, - {Name: "request_no", Type: field.TypeString, Size: 64}, - {Name: "order_no", Type: field.TypeString, Size: 64}, - {Name: "plan_date", Type: field.TypeString, Size: 10}, - {Name: "material_code", Type: field.TypeString, Size: 64}, + {Name: "request_no", Type: field.TypeString, Size: 64, Comment: "备料单号"}, + {Name: "order_no", Type: field.TypeString, Size: 64, Comment: "工单号"}, + {Name: "plan_date", Type: field.TypeString, Size: 10, Comment: "对应排产日"}, + {Name: "material_code", Type: field.TypeString, Size: 64, Comment: "物料编码"}, {Name: "material_name", Type: field.TypeString, Size: 128, Default: ""}, {Name: "unit", Type: field.TypeString, Size: 16, Default: ""}, {Name: "sn_mode", Type: field.TypeInt, Default: 2}, - {Name: "req_qty", Type: field.TypeFloat64, Default: 0}, + {Name: "req_qty", Type: field.TypeFloat64, Comment: "需备数量", Default: 0}, {Name: "status", Type: field.TypeString, Size: 20, Default: "PENDING"}, - {Name: "target_dock", Type: field.TypeString, Size: 20, Default: ""}, - {Name: "station_no", Type: field.TypeInt, Default: 0}, - {Name: "flow_id", Type: field.TypeInt, Default: 0}, - {Name: "sent_qty", Type: field.TypeFloat64, Default: 0}, - {Name: "received_qty", Type: field.TypeFloat64, Default: 0}, - {Name: "received_at", Type: field.TypeInt64, Default: 0}, - {Name: "receive_by", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "source", Type: field.TypeString, Size: 16, Default: "PLAN"}, - {Name: "over_qty", Type: field.TypeFloat64, Default: 0}, - {Name: "over_reason", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "ref_report_no", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "need_agv", Type: field.TypeBool, Default: false}, - {Name: "batch_no", Type: field.TypeString, Size: 64, Default: ""}, + {Name: "target_dock", Type: field.TypeString, Size: 20, Comment: "目标接驳台 DOCK01..20", Default: ""}, + {Name: "station_no", Type: field.TypeInt, Comment: "目标工位号(0=未指定)", Default: 0}, + {Name: "flow_id", Type: field.TypeInt, Comment: "该物料所属工艺ID(0=整线共用)", Default: 0}, + {Name: "sent_qty", Type: field.TypeFloat64, Comment: "已发出量(分批出库累加;幂等基准,勿与已接料混用)", Default: 0}, + {Name: "received_qty", Type: field.TypeFloat64, Comment: "已接料量(工位扫码接料累加)", Default: 0}, + {Name: "received_at", Type: field.TypeInt64, Comment: "最近接料时间(unix 秒)", Default: 0}, + {Name: "receive_by", Type: field.TypeString, Size: 64, Comment: "接料人", Default: ""}, + {Name: "source", Type: field.TypeString, Size: 16, Comment: "来源 PLAN/REFILL", Default: "PLAN"}, + {Name: "over_qty", Type: field.TypeFloat64, Comment: "超出 BOM 需求的数量", Default: 0}, + {Name: "over_reason", Type: field.TypeString, Size: 64, Comment: "超领原因 损耗/报废/返修/其他", Default: ""}, + {Name: "ref_report_no", Type: field.TypeString, Size: 64, Comment: "关联数量不符单号", Default: ""}, + {Name: "need_agv", Type: field.TypeBool, Comment: "是否需要AGV配送到接驳台", Default: false}, + {Name: "batch_no", Type: field.TypeString, Size: 64, Comment: "发料批次号(分批出库时填写)", Default: ""}, {Name: "operator", Type: field.TypeString, Size: 64, Default: ""}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime, Nullable: true}, @@ -486,6 +498,7 @@ var ( // MaterialRequestTable holds the schema information for the "material_request" table. MaterialRequestTable = &schema.Table{ Name: "material_request", + Comment: "MaterialRequest 备料单:按日排产自动算料生成", Columns: MaterialRequestColumns, PrimaryKey: []*schema.Column{MaterialRequestColumns[0]}, Indexes: []*schema.Index{ @@ -509,11 +522,11 @@ var ( // PermissionColumns holds the columns for the "permission" table. PermissionColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, - {Name: "code", Type: field.TypeString, Unique: true, Size: 64}, - {Name: "name", Type: field.TypeString, Size: 64}, + {Name: "code", Type: field.TypeString, Unique: true, Size: 64, Comment: "权限编码"}, + {Name: "name", Type: field.TypeString, Size: 64, Comment: "名称"}, {Name: "type", Type: field.TypeString, Size: 20, Default: "MENU"}, - {Name: "parent_code", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "path", Type: field.TypeString, Size: 128, Default: ""}, + {Name: "parent_code", Type: field.TypeString, Size: 64, Comment: "所属菜单权限码(按钮必填)", Default: ""}, + {Name: "path", Type: field.TypeString, Size: 128, Comment: "前端路由", Default: ""}, {Name: "icon", Type: field.TypeString, Size: 64, Default: ""}, {Name: "sort", Type: field.TypeInt, Nullable: true, Default: 0}, {Name: "remark", Type: field.TypeString, Size: 255, Default: ""}, @@ -522,6 +535,7 @@ var ( // PermissionTable holds the schema information for the "permission" table. PermissionTable = &schema.Table{ Name: "permission", + Comment: "Permission 权限/菜单", Columns: PermissionColumns, PrimaryKey: []*schema.Column{PermissionColumns[0]}, Indexes: []*schema.Index{ @@ -535,15 +549,15 @@ var ( // PlcSendLogColumns holds the columns for the "plc_send_log" table. PlcSendLogColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, - {Name: "order_no", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "sn", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "station_no", Type: field.TypeInt, Nullable: true}, - {Name: "process_combination", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "process_codes", Type: field.TypeJSON, Nullable: true}, + {Name: "order_no", Type: field.TypeString, Size: 64, Comment: "工单号", Default: ""}, + {Name: "sn", Type: field.TypeString, Size: 64, Comment: "工件SN", Default: ""}, + {Name: "station_no", Type: field.TypeInt, Nullable: true, Comment: "工位号"}, + {Name: "process_combination", Type: field.TypeString, Size: 64, Comment: "工序组合,如 135", Default: ""}, + {Name: "process_codes", Type: field.TypeJSON, Nullable: true, Comment: "工序码表"}, {Name: "status", Type: field.TypeString, Size: 20, Default: "PENDING"}, - {Name: "send_time", Type: field.TypeTime, Nullable: true}, - {Name: "done_time", Type: field.TypeTime, Nullable: true}, - {Name: "ack", Type: field.TypeBool, Default: false}, + {Name: "send_time", Type: field.TypeTime, Nullable: true, Comment: "下发时间"}, + {Name: "done_time", Type: field.TypeTime, Nullable: true, Comment: "收到完成信号时间"}, + {Name: "ack", Type: field.TypeBool, Comment: "是否收到完成信号", Default: false}, {Name: "remark", Type: field.TypeString, Size: 255, Default: ""}, {Name: "operator", Type: field.TypeString, Size: 64, Default: ""}, {Name: "created_at", Type: field.TypeTime}, @@ -551,6 +565,7 @@ var ( // PlcSendLogTable holds the schema information for the "plc_send_log" table. PlcSendLogTable = &schema.Table{ Name: "plc_send_log", + Comment: "PlcSendLog PLC 工序码下发日志", Columns: PlcSendLogColumns, PrimaryKey: []*schema.Column{PlcSendLogColumns[0]}, Indexes: []*schema.Index{ @@ -574,8 +589,8 @@ var ( // ProcessFlowColumns holds the columns for the "process_flow" table. ProcessFlowColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, - {Name: "name", Type: field.TypeString, Size: 128}, - {Name: "pdf_file", Type: field.TypeString, Size: 255, Default: ""}, + {Name: "name", Type: field.TypeString, Size: 128, Comment: "流程名称,如 3号工位装配流程"}, + {Name: "pdf_file", Type: field.TypeString, Size: 255, Comment: "工艺图纸文件名", Default: ""}, {Name: "status", Type: field.TypeString, Size: 20, Default: "ACTIVE"}, {Name: "remark", Type: field.TypeString, Size: 255, Default: ""}, {Name: "created_at", Type: field.TypeTime}, @@ -584,6 +599,7 @@ var ( // ProcessFlowTable holds the schema information for the "process_flow" table. ProcessFlowTable = &schema.Table{ Name: "process_flow", + Comment: "ProcessFlow 工艺流程图(菜谱):描述“这个工位怎么干”,承载工艺图纸 PDF + 工序步骤模板。", Columns: ProcessFlowColumns, PrimaryKey: []*schema.Column{ProcessFlowColumns[0]}, Indexes: []*schema.Index{ @@ -597,21 +613,22 @@ var ( // ProcessStepColumns holds the columns for the "process_step" table. ProcessStepColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, - {Name: "flow_id", Type: field.TypeInt, Nullable: true}, - {Name: "seq", Type: field.TypeInt, Default: 1}, - {Name: "name", Type: field.TypeString, Size: 128}, - {Name: "collect_type", Type: field.TypeString, Size: 20, Default: "NONE"}, - {Name: "is_torque", Type: field.TypeBool, Default: false}, - {Name: "need_check", Type: field.TypeBool, Default: false}, - {Name: "need_operator_sign", Type: field.TypeBool, Default: false}, - {Name: "need_inspector_sign", Type: field.TypeBool, Default: false}, - {Name: "attachment", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}}, + {Name: "flow_id", Type: field.TypeInt, Nullable: true, Comment: "所属工艺流程图ID"}, + {Name: "seq", Type: field.TypeInt, Comment: "步骤序号", Default: 1}, + {Name: "name", Type: field.TypeString, Size: 128, Comment: "步骤名称"}, + {Name: "collect_type", Type: field.TypeString, Size: 20, Comment: "AUTO/MANUAL/NONE", Default: "NONE"}, + {Name: "is_torque", Type: field.TypeBool, Comment: "是否拧紧采集", Default: false}, + {Name: "need_check", Type: field.TypeBool, Comment: "是否需要检测确认(报工前须检验通过)", Default: false}, + {Name: "need_operator_sign", Type: field.TypeBool, Comment: "是否需要操作工签字(报工前须签字确认)", Default: false}, + {Name: "need_inspector_sign", Type: field.TypeBool, Comment: "是否需要检验员签字(审核通过并签字后放行)", Default: false}, + {Name: "attachment", Type: field.TypeJSON, Nullable: true, Comment: "本步骤图纸/附件列表 [{name,url}]", SchemaType: map[string]string{"postgres": "jsonb"}}, {Name: "remark", Type: field.TypeString, Size: 255, Default: ""}, {Name: "created_at", Type: field.TypeTime}, } // ProcessStepTable holds the schema information for the "process_step" table. ProcessStepTable = &schema.Table{ Name: "process_step", + Comment: "ProcessStep 工序步骤模板:一份工艺流程包含多个采集/考核步骤(按 seq 顺序执行)", Columns: ProcessStepColumns, PrimaryKey: []*schema.Column{ProcessStepColumns[0]}, Indexes: []*schema.Index{ @@ -625,15 +642,16 @@ var ( // RoleColumns holds the columns for the "role" table. RoleColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, - {Name: "name", Type: field.TypeString, Size: 64}, - {Name: "code", Type: field.TypeString, Unique: true, Size: 64}, + {Name: "name", Type: field.TypeString, Size: 64, Comment: "角色名称"}, + {Name: "code", Type: field.TypeString, Unique: true, Size: 64, Comment: "角色编码"}, {Name: "remark", Type: field.TypeString, Size: 255, Default: ""}, - {Name: "permission_codes", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}}, + {Name: "permission_codes", Type: field.TypeJSON, Nullable: true, Comment: "权限编码列表,如 produce.workorder:view", SchemaType: map[string]string{"postgres": "jsonb"}}, {Name: "created_at", Type: field.TypeTime}, } // RoleTable holds the schema information for the "role" table. RoleTable = &schema.Table{ Name: "role", + Comment: "Role 角色:承载菜单/按钮权限", Columns: RoleColumns, PrimaryKey: []*schema.Column{RoleColumns[0]}, Indexes: []*schema.Index{ @@ -647,10 +665,10 @@ var ( // SemiFlowColumns holds the columns for the "semi_flow" table. SemiFlowColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, - {Name: "sn", Type: field.TypeString, Size: 64}, + {Name: "sn", Type: field.TypeString, Size: 64, Comment: "工件SN"}, {Name: "order_no", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "done_process_codes", Type: field.TypeJSON, Nullable: true}, - {Name: "completed_text", Type: field.TypeString, Size: 64, Default: ""}, + {Name: "done_process_codes", Type: field.TypeJSON, Nullable: true, Comment: "已完成工序码(已废除,历史数据保留)"}, + {Name: "completed_text", Type: field.TypeString, Size: 64, Comment: "完成至工位快照(如:已完成至工位3;空=尚未报工)", Default: ""}, {Name: "action", Type: field.TypeString, Size: 20, Default: "INBOUND"}, {Name: "target_dock", Type: field.TypeString, Size: 20, Default: ""}, {Name: "operator", Type: field.TypeString, Size: 64, Default: ""}, @@ -659,6 +677,7 @@ var ( // SemiFlowTable holds the schema information for the "semi_flow" table. SemiFlowTable = &schema.Table{ Name: "semi_flow", + Comment: "SemiFlow 半成品流转记录:进度快照(完成至工位N),调用 WMS /api/internal/semi/*", Columns: SemiFlowColumns, PrimaryKey: []*schema.Column{SemiFlowColumns[0]}, Indexes: []*schema.Index{ @@ -682,20 +701,19 @@ var ( // StationColumns holds the columns for the "station" table. StationColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, - {Name: "station_no", Type: field.TypeInt, Unique: true}, - {Name: "name", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "flow_id", Type: field.TypeInt, Nullable: true}, - {Name: "station_type", Type: field.TypeString, Size: 20, Default: "LINE"}, + {Name: "station_no", Type: field.TypeInt, Unique: true, Comment: "工位号 1..12"}, + {Name: "name", Type: field.TypeString, Size: 64, Comment: "工位名称", Default: ""}, + {Name: "flow_id", Type: field.TypeInt, Nullable: true, Comment: "绑定工艺流程图ID"}, + {Name: "station_type", Type: field.TypeString, Size: 20, Comment: "工位类型 LINE/OFFLINE", Default: "LINE"}, {Name: "status", Type: field.TypeString, Size: 20, Default: "ENABLED"}, - {Name: "is_builtin", Type: field.TypeBool, Default: false}, - {Name: "has_dock", Type: field.TypeBool, Default: false}, - {Name: "dock_code", Type: field.TypeString, Size: 20, Default: ""}, + {Name: "is_builtin", Type: field.TypeBool, Comment: "内置工位:不可改类型/不可删除", Default: false}, {Name: "visible_tabs", Type: field.TypeJSON, Nullable: true}, {Name: "created_at", Type: field.TypeTime}, } // StationTable holds the schema information for the "station" table. StationTable = &schema.Table{ Name: "station", + Comment: "Station 工位主数据:工位固定只对应一个工序编号,绑定一个工艺流程图(flowId)", Columns: StationColumns, PrimaryKey: []*schema.Column{StationColumns[0]}, Indexes: []*schema.Index{ @@ -709,17 +727,18 @@ var ( // StationStateColumns holds the columns for the "station_state" table. StationStateColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, - {Name: "station_no", Type: field.TypeInt}, - {Name: "date", Type: field.TypeString, Size: 10}, - {Name: "paused", Type: field.TypeBool, Default: false}, - {Name: "reason", Type: field.TypeString, Size: 255, Default: ""}, - {Name: "operator", Type: field.TypeString, Size: 64, Default: ""}, + {Name: "station_no", Type: field.TypeInt, Comment: "工位号"}, + {Name: "date", Type: field.TypeString, Size: 10, Comment: "生效日期 yyyy-MM-dd(只认当天)"}, + {Name: "paused", Type: field.TypeBool, Comment: "是否停止接单", Default: false}, + {Name: "reason", Type: field.TypeString, Size: 255, Comment: "停单原因(缺料/故障/其他)", Default: ""}, + {Name: "operator", Type: field.TypeString, Size: 64, Comment: "操作人", Default: ""}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime, Nullable: true}, } // StationStateTable holds the schema information for the "station_state" table. StationStateTable = &schema.Table{ Name: "station_state", + Comment: "StationState 工位运行状态(当日有效):工人自主 停止接单/恢复接单。", Columns: StationStateColumns, PrimaryKey: []*schema.Column{StationStateColumns[0]}, Indexes: []*schema.Index{ @@ -733,18 +752,19 @@ var ( // StepCriterionColumns holds the columns for the "step_criterion" table. StepCriterionColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, - {Name: "step_id", Type: field.TypeInt}, - {Name: "name", Type: field.TypeString, Size: 64}, + {Name: "step_id", Type: field.TypeInt, Comment: "步骤ID"}, + {Name: "name", Type: field.TypeString, Size: 64, Comment: "指标名,如 扭矩/角度"}, {Name: "unit", Type: field.TypeString, Size: 16, Default: ""}, {Name: "logic", Type: field.TypeString, Size: 16, Default: "NONE"}, - {Name: "target", Type: field.TypeFloat64, Default: 0}, - {Name: "min", Type: field.TypeFloat64, Nullable: true}, - {Name: "max", Type: field.TypeFloat64, Nullable: true}, + {Name: "target", Type: field.TypeFloat64, Comment: "目标值", Default: 0}, + {Name: "min", Type: field.TypeFloat64, Nullable: true, Comment: "范围下限"}, + {Name: "max", Type: field.TypeFloat64, Nullable: true, Comment: "范围上限"}, {Name: "created_at", Type: field.TypeTime}, } // StepCriterionTable holds the schema information for the "step_criterion" table. StepCriterionTable = &schema.Table{ Name: "step_criterion", + Comment: "StepCriterion 工序步骤考核标准:如 扭矩在RANGE[35,45] 自动判定 OK", Columns: StepCriterionColumns, PrimaryKey: []*schema.Column{StepCriterionColumns[0]}, Indexes: []*schema.Index{ @@ -758,22 +778,23 @@ var ( // StepDataColumns holds the columns for the "step_data" table. StepDataColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, - {Name: "sn", Type: field.TypeString, Size: 64}, - {Name: "process_id", Type: field.TypeInt, Nullable: true}, - {Name: "step_id", Type: field.TypeInt}, + {Name: "sn", Type: field.TypeString, Size: 64, Comment: "工件SN"}, + {Name: "process_id", Type: field.TypeInt, Nullable: true, Comment: "工件工序实绩ID"}, + {Name: "step_id", Type: field.TypeInt, Comment: "步骤ID"}, {Name: "step_name", Type: field.TypeString, Size: 128, Default: ""}, - {Name: "criterion_id", Type: field.TypeInt, Nullable: true}, + {Name: "criterion_id", Type: field.TypeInt, Nullable: true, Comment: "考核标准ID"}, {Name: "criterion_name", Type: field.TypeString, Size: 64, Default: ""}, {Name: "criterion_logic", Type: field.TypeString, Size: 16, Default: "NONE"}, - {Name: "value", Type: field.TypeFloat64, Default: 0}, - {Name: "value_text", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "is_ok", Type: field.TypeBool, Default: true}, + {Name: "value", Type: field.TypeFloat64, Comment: "实际测量值", Default: 0}, + {Name: "value_text", Type: field.TypeString, Size: 64, Comment: "文本值(OK/NG/钢印号)", Default: ""}, + {Name: "is_ok", Type: field.TypeBool, Comment: "是否合格(可人工修正)", Default: true}, {Name: "operator", Type: field.TypeString, Size: 64, Default: ""}, {Name: "created_at", Type: field.TypeTime}, } // StepDataTable holds the schema information for the "step_data" table. StepDataTable = &schema.Table{ Name: "step_data", + Comment: "StepData 步骤考核数据:某工件某工序步骤采集/手填实际值,按考核标准判定 OK/NG", Columns: StepDataColumns, PrimaryKey: []*schema.Column{StepDataColumns[0]}, Indexes: []*schema.Index{ @@ -797,28 +818,29 @@ var ( // StepSignRecordColumns holds the columns for the "step_sign_record" table. StepSignRecordColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, - {Name: "sn", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "order_no", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "flow_id", Type: field.TypeInt, Default: 0}, - {Name: "station_no", Type: field.TypeString, Size: 32, Default: ""}, - {Name: "step_id", Type: field.TypeInt, Default: 0}, - {Name: "step_name", Type: field.TypeString, Size: 128, Default: ""}, - {Name: "sign_role", Type: field.TypeString, Size: 16, Default: "OPERATOR"}, - {Name: "result", Type: field.TypeString, Size: 10, Default: "OK"}, - {Name: "signed_by", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "signed_at", Type: field.TypeTime}, - {Name: "round", Type: field.TypeInt, Default: 1}, - {Name: "source", Type: field.TypeString, Size: 20, Default: "station"}, - {Name: "remark", Type: field.TypeString, Size: 256, Default: ""}, - {Name: "revoked", Type: field.TypeBool, Default: false}, - {Name: "revoked_by", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "revoked_at", Type: field.TypeTime, Nullable: true}, - {Name: "revoke_reason", Type: field.TypeString, Size: 256, Default: ""}, + {Name: "sn", Type: field.TypeString, Size: 64, Comment: "工件SN", Default: ""}, + {Name: "order_no", Type: field.TypeString, Size: 64, Comment: "工单号", Default: ""}, + {Name: "flow_id", Type: field.TypeInt, Comment: "工艺流程ID", Default: 0}, + {Name: "station_no", Type: field.TypeString, Size: 32, Comment: "工位号", Default: ""}, + {Name: "step_id", Type: field.TypeInt, Comment: "工艺步骤ID", Default: 0}, + {Name: "step_name", Type: field.TypeString, Size: 128, Comment: "步骤名称", Default: ""}, + {Name: "sign_role", Type: field.TypeString, Size: 16, Comment: "签字角色 OPERATOR/INSPECTOR", Default: "OPERATOR"}, + {Name: "result", Type: field.TypeString, Size: 10, Comment: "签字时点的结论 OK/NG", Default: "OK"}, + {Name: "signed_by", Type: field.TypeString, Size: 64, Comment: "签字人(登录账号)", Default: ""}, + {Name: "signed_at", Type: field.TypeTime, Comment: "签字时间"}, + {Name: "round", Type: field.TypeInt, Comment: "返修重做轮次(1=首做)", Default: 1}, + {Name: "source", Type: field.TypeString, Size: 20, Comment: "签字来源 station/inspect/migrate", Default: "station"}, + {Name: "remark", Type: field.TypeString, Size: 256, Comment: "签字备注(签字弹框选填)", Default: ""}, + {Name: "revoked", Type: field.TypeBool, Comment: "是否已撤销", Default: false}, + {Name: "revoked_by", Type: field.TypeString, Size: 64, Comment: "撤销人", Default: ""}, + {Name: "revoked_at", Type: field.TypeTime, Nullable: true, Comment: "撤销时间"}, + {Name: "revoke_reason", Type: field.TypeString, Size: 256, Comment: "撤销原因", Default: ""}, {Name: "created_at", Type: field.TypeTime}, } // StepSignRecordTable holds the schema information for the "step_sign_record" table. StepSignRecordTable = &schema.Table{ Name: "step_sign_record", + Comment: "StepSignRecord 步骤签字记录:工艺步骤配置 need_operator_sign/need_inspector_sign 后,", Columns: StepSignRecordColumns, PrimaryKey: []*schema.Column{StepSignRecordColumns[0]}, Indexes: []*schema.Index{ @@ -842,35 +864,37 @@ var ( // SysConfigColumns holds the columns for the "sys_config" table. SysConfigColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, - {Name: "key", Type: field.TypeString, Unique: true, Size: 64}, - {Name: "value", Type: field.TypeString, Size: 512}, - {Name: "remark", Type: field.TypeString, Nullable: true, Size: 255}, + {Name: "key", Type: field.TypeString, Unique: true, Size: 64, Comment: "配置键,如 wms.base_url"}, + {Name: "value", Type: field.TypeString, Size: 512, Comment: "配置值"}, + {Name: "remark", Type: field.TypeString, Nullable: true, Size: 255, Comment: "说明"}, } // SysConfigTable holds the schema information for the "sys_config" table. SysConfigTable = &schema.Table{ Name: "sys_config", + Comment: "SysConfig 系统基础设置(key/value)。", Columns: SysConfigColumns, PrimaryKey: []*schema.Column{SysConfigColumns[0]}, } // TorqueRecordColumns holds the columns for the "torque_record" table. TorqueRecordColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, - {Name: "work_order_no", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "sn", Type: field.TypeString, Size: 64}, - {Name: "screw_no", Type: field.TypeString, Size: 32, Default: ""}, - {Name: "strain", Type: field.TypeFloat64, Default: 0}, - {Name: "torque", Type: field.TypeFloat64, Default: 0}, - {Name: "angle", Type: field.TypeFloat64, Default: 0}, + {Name: "work_order_no", Type: field.TypeString, Size: 64, Comment: "workOrder 工单号", Default: ""}, + {Name: "sn", Type: field.TypeString, Size: 64, Comment: "工件SN"}, + {Name: "screw_no", Type: field.TypeString, Size: 32, Comment: "螺丝编号 S1..Sn", Default: ""}, + {Name: "strain", Type: field.TypeFloat64, Comment: "扭矩 Nm", Default: 0}, + {Name: "torque", Type: field.TypeFloat64, Comment: "扭矩别名,与 strain 一致", Default: 0}, + {Name: "angle", Type: field.TypeFloat64, Comment: "角度 °", Default: 0}, {Name: "result", Type: field.TypeString, Size: 10, Default: "OK"}, - {Name: "operator", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "operator_id", Type: field.TypeInt, Default: 0}, - {Name: "station_no", Type: field.TypeString, Size: 32, Default: ""}, - {Name: "time", Type: field.TypeTime}, + {Name: "operator", Type: field.TypeString, Size: 64, Comment: "操作人", Default: ""}, + {Name: "operator_id", Type: field.TypeInt, Comment: "操作人用户ID(0=未采集:虚拟工位/PLC路径或历史数据)", Default: 0}, + {Name: "station_no", Type: field.TypeString, Size: 32, Comment: "工位", Default: ""}, + {Name: "time", Type: field.TypeTime, Comment: "采集时间"}, {Name: "created_at", Type: field.TypeTime}, } // TorqueRecordTable holds the schema information for the "torque_record" table. TorqueRecordTable = &schema.Table{ Name: "torque_record", + Comment: "TorqueRecord 拧紧数据(工位终端上报,sn,strain扭矩,angle角度,result,operator,workOrder,time)", Columns: TorqueRecordColumns, PrimaryKey: []*schema.Column{TorqueRecordColumns[0]}, Indexes: []*schema.Index{ @@ -899,20 +923,21 @@ var ( // UserColumns holds the columns for the "user" table. UserColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, - {Name: "username", Type: field.TypeString, Unique: true, Size: 64}, - {Name: "password", Type: field.TypeString, Size: 128}, - {Name: "name", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "role_id", Type: field.TypeInt, Nullable: true}, - {Name: "can_login_workstation", Type: field.TypeBool, Default: false}, - {Name: "workstation_password", Type: field.TypeString, Nullable: true, Size: 128}, + {Name: "username", Type: field.TypeString, Unique: true, Size: 64, Comment: "登录名"}, + {Name: "password", Type: field.TypeString, Size: 128, Comment: "bcrypt 密码"}, + {Name: "name", Type: field.TypeString, Size: 64, Comment: "姓名/显示名", Default: ""}, + {Name: "role_id", Type: field.TypeInt, Nullable: true, Comment: "角色ID"}, + {Name: "can_login_workstation", Type: field.TypeBool, Comment: "是否允许登录工位终端", Default: false}, + {Name: "workstation_password", Type: field.TypeString, Nullable: true, Size: 128, Comment: "工位终端密码(bcrypt)"}, {Name: "status", Type: field.TypeString, Size: 20, Default: "ENABLED"}, - {Name: "last_login_at", Type: field.TypeInt64, Nullable: true}, + {Name: "last_login_at", Type: field.TypeInt64, Nullable: true, Comment: "最近登录时间(unix秒,后台登录更新;工位终端登录不计)"}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime, Nullable: true}, } // UserTable holds the schema information for the "user" table. UserTable = &schema.Table{ Name: "user", + Comment: "User 用户", Columns: UserColumns, PrimaryKey: []*schema.Column{UserColumns[0]}, Indexes: []*schema.Index{ @@ -931,13 +956,14 @@ var ( // UserStationColumns holds the columns for the "user_station" table. UserStationColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, - {Name: "user_id", Type: field.TypeInt}, - {Name: "station_no", Type: field.TypeInt}, + {Name: "user_id", Type: field.TypeInt, Comment: "用户ID"}, + {Name: "station_no", Type: field.TypeInt, Comment: "工位号 1..12"}, {Name: "created_at", Type: field.TypeTime}, } // UserStationTable holds the schema information for the "user_station" table. UserStationTable = &schema.Table{ Name: "user_station", + Comment: "UserStation 用户-工位 关联(一个操作员可绑定多个工位)", Columns: UserStationColumns, PrimaryKey: []*schema.Column{UserStationColumns[0]}, Indexes: []*schema.Index{ @@ -961,24 +987,24 @@ var ( // WorkOrderColumns holds the columns for the "work_order" table. WorkOrderColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, - {Name: "work_order_no", Type: field.TypeString, Size: 64}, - {Name: "product_type_id", Type: field.TypeInt}, - {Name: "product_code", Type: field.TypeString, Size: 64, Default: ""}, + {Name: "work_order_no", Type: field.TypeString, Size: 64, Comment: "工单号"}, + {Name: "product_type_id", Type: field.TypeInt, Comment: "产品类型ID"}, + {Name: "product_code", Type: field.TypeString, Size: 64, Comment: "产品编码", Default: ""}, {Name: "product_name", Type: field.TypeString, Size: 128, Default: ""}, - {Name: "quantity", Type: field.TypeInt, Default: 1}, - {Name: "finished_num", Type: field.TypeInt, Default: 0}, - {Name: "fail_num", Type: field.TypeInt, Default: 0}, - {Name: "contract_no", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "ownership_type", Type: field.TypeString, Size: 20, Default: ""}, - {Name: "project_no", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "product_serial", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "created_by", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "due_date", Type: field.TypeTime, Nullable: true}, - {Name: "flow_combination", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}}, + {Name: "quantity", Type: field.TypeInt, Comment: "工件数量", Default: 1}, + {Name: "finished_num", Type: field.TypeInt, Comment: "完成数量", Default: 0}, + {Name: "fail_num", Type: field.TypeInt, Comment: "NG数量", Default: 0}, + {Name: "contract_no", Type: field.TypeString, Size: 64, Comment: "归属编号(合同号或科技项目号,随归属类型二选一)", Default: ""}, + {Name: "ownership_type", Type: field.TypeString, Size: 20, Comment: "归属类型:workorder=合同号/project=科技项目号/other=其他", Default: ""}, + {Name: "project_no", Type: field.TypeString, Size: 64, Comment: "工程编号(已废弃,保留防历史数据迁移)", Default: ""}, + {Name: "product_serial", Type: field.TypeString, Size: 64, Comment: "产品序号(工单内每台产品的序号)", Default: ""}, + {Name: "created_by", Type: field.TypeString, Size: 64, Comment: "创建人", Default: ""}, + {Name: "due_date", Type: field.TypeTime, Nullable: true, Comment: "完成日期(必填)"}, + {Name: "flow_combination", Type: field.TypeJSON, Nullable: true, Comment: "工艺组合 [{flowId,stationNo}] 按工位号升序", SchemaType: map[string]string{"postgres": "jsonb"}}, {Name: "status", Type: field.TypeString, Size: 20, Default: "CREATED"}, - {Name: "plan_start", Type: field.TypeTime, Nullable: true}, - {Name: "plan_end", Type: field.TypeTime, Nullable: true}, - {Name: "context", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}}, + {Name: "plan_start", Type: field.TypeTime, Nullable: true, Comment: "计划开始"}, + {Name: "plan_end", Type: field.TypeTime, Nullable: true, Comment: "计划结束"}, + {Name: "context", Type: field.TypeJSON, Nullable: true, Comment: "扩展字段", SchemaType: map[string]string{"postgres": "jsonb"}}, {Name: "completed_at", Type: field.TypeTime, Nullable: true}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime, Nullable: true}, @@ -986,6 +1012,7 @@ var ( // WorkOrderTable holds the schema information for the "work_order" table. WorkOrderTable = &schema.Table{ Name: "work_order", + Comment: "WorkOrder 工单:一个合同 = 一个工单", Columns: WorkOrderColumns, PrimaryKey: []*schema.Column{WorkOrderColumns[0]}, Indexes: []*schema.Index{ @@ -1009,19 +1036,20 @@ var ( // WorkpieceColumns holds the columns for the "workpiece" table. WorkpieceColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, - {Name: "sn", Type: field.TypeString, Unique: true, Size: 64}, - {Name: "order_no", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "work_order_id", Type: field.TypeInt, Nullable: true}, - {Name: "current_station_no", Type: field.TypeInt, Nullable: true}, + {Name: "sn", Type: field.TypeString, Unique: true, Size: 64, Comment: "工件唯一SN"}, + {Name: "order_no", Type: field.TypeString, Size: 64, Comment: "所属工单", Default: ""}, + {Name: "work_order_id", Type: field.TypeInt, Nullable: true, Comment: "工单ID"}, + {Name: "current_station_no", Type: field.TypeInt, Nullable: true, Comment: "最后完成报工的工位号(0=未报任何工艺;下一道=工艺组合中工位号更大的下一条)"}, {Name: "status", Type: field.TypeString, Size: 20, Default: "ONLINE"}, - {Name: "online_at", Type: field.TypeTime, Nullable: true}, - {Name: "done_at", Type: field.TypeTime, Nullable: true}, + {Name: "online_at", Type: field.TypeTime, Nullable: true, Comment: "进线时间"}, + {Name: "done_at", Type: field.TypeTime, Nullable: true, Comment: "完工时间"}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime, Nullable: true}, } // WorkpieceTable holds the schema information for the "workpiece" table. WorkpieceTable = &schema.Table{ Name: "workpiece", + Comment: "Workpiece 工件(SN):序列号管理的成品/主件", Columns: WorkpieceColumns, PrimaryKey: []*schema.Column{WorkpieceColumns[0]}, Indexes: []*schema.Index{ @@ -1045,23 +1073,24 @@ var ( // WorkpieceBindColumns holds the columns for the "workpiece_bind" table. WorkpieceBindColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, - {Name: "sn", Type: field.TypeString, Size: 64}, - {Name: "order_no", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "flow_id", Type: field.TypeInt}, - {Name: "station_no", Type: field.TypeString, Size: 32, Default: ""}, - {Name: "material_code", Type: field.TypeString, Size: 64}, - {Name: "material_name", Type: field.TypeString, Size: 128, Default: ""}, - {Name: "spec", Type: field.TypeString, Size: 128, Default: ""}, - {Name: "unit", Type: field.TypeString, Size: 16, Default: ""}, + {Name: "sn", Type: field.TypeString, Size: 64, Comment: "工件SN"}, + {Name: "order_no", Type: field.TypeString, Size: 64, Comment: "工单号", Default: ""}, + {Name: "flow_id", Type: field.TypeInt, Comment: "装配工艺ID"}, + {Name: "station_no", Type: field.TypeString, Size: 32, Comment: "绑定工位", Default: ""}, + {Name: "material_code", Type: field.TypeString, Size: 64, Comment: "物料编码"}, + {Name: "material_name", Type: field.TypeString, Size: 128, Comment: "物料名称", Default: ""}, + {Name: "spec", Type: field.TypeString, Size: 128, Comment: "规格", Default: ""}, + {Name: "unit", Type: field.TypeString, Size: 16, Comment: "单位", Default: ""}, {Name: "sn_mode", Type: field.TypeInt, Default: 2}, - {Name: "bind_value", Type: field.TypeString, Size: 128}, + {Name: "bind_value", Type: field.TypeString, Size: 128, Comment: "绑定值:批次号 或 SN"}, {Name: "bind_type", Type: field.TypeString, Size: 10, Default: "SN"}, - {Name: "operator", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "created_at", Type: field.TypeTime}, + {Name: "operator", Type: field.TypeString, Size: 64, Comment: "操作人", Default: ""}, + {Name: "created_at", Type: field.TypeTime, Comment: "绑定时间"}, } // WorkpieceBindTable holds the schema information for the "workpiece_bind" table. WorkpieceBindTable = &schema.Table{ Name: "workpiece_bind", + Comment: "WorkpieceBind 装机绑定:某工件在某一工序装配时,把实际装上的部件(结构件=批次号 / 电气件=SN)", Columns: WorkpieceBindColumns, PrimaryKey: []*schema.Column{WorkpieceBindColumns[0]}, Indexes: []*schema.Index{ @@ -1095,24 +1124,25 @@ var ( // WorkpieceProcessColumns holds the columns for the "workpiece_process" table. WorkpieceProcessColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, - {Name: "sn", Type: field.TypeString, Size: 64}, - {Name: "flow_id", Type: field.TypeInt}, - {Name: "station_no", Type: field.TypeString, Size: 32, Default: ""}, + {Name: "sn", Type: field.TypeString, Size: 64, Comment: "工件SN"}, + {Name: "flow_id", Type: field.TypeInt, Comment: "完成的工艺ID"}, + {Name: "station_no", Type: field.TypeString, Size: 32, Comment: "工位号", Default: ""}, {Name: "order_no", Type: field.TypeString, Size: 64, Default: ""}, {Name: "process_name", Type: field.TypeString, Size: 64, Default: ""}, {Name: "status", Type: field.TypeString, Size: 20, Default: "DONE"}, {Name: "operator", Type: field.TypeString, Size: 64, Default: ""}, - {Name: "operator_id", Type: field.TypeInt, Default: 0}, - {Name: "result", Type: field.TypeString, Size: 10, Default: "OK"}, + {Name: "operator_id", Type: field.TypeInt, Comment: "操作人用户ID(0=未采集:虚拟工位/PLC路径或历史数据)", Default: 0}, + {Name: "result", Type: field.TypeString, Size: 10, Comment: "总判定 OK/NG", Default: "OK"}, {Name: "started_at", Type: field.TypeTime, Nullable: true}, {Name: "ended_at", Type: field.TypeTime, Nullable: true}, - {Name: "duration_sec", Type: field.TypeInt, Default: 0}, + {Name: "duration_sec", Type: field.TypeInt, Comment: "作业时长(秒)=endedAt-startedAt", Default: 0}, {Name: "remark", Type: field.TypeString, Size: 255, Default: ""}, {Name: "created_at", Type: field.TypeTime}, } // WorkpieceProcessTable holds the schema information for the "workpiece_process" table. WorkpieceProcessTable = &schema.Table{ Name: "workpiece_process", + Comment: "WorkpieceProcess 工件-工艺实绩(某工件在某工位完成某道工艺的一次记录,构成工艺时间线)。", Columns: WorkpieceProcessColumns, PrimaryKey: []*schema.Column{WorkpieceProcessColumns[0]}, Indexes: []*schema.Index{ diff --git a/bj_power_mes/ent/mutation.go b/bj_power_mes/ent/mutation.go index be239e5..c0982aa 100644 --- a/bj_power_mes/ent/mutation.go +++ b/bj_power_mes/ent/mutation.go @@ -18933,8 +18933,6 @@ type StationMutation struct { stationType *string status *string isBuiltin *bool - hasDock *bool - dockCode *string visibleTabs *[]string appendvisibleTabs []string createdAt *time.Time @@ -19318,78 +19316,6 @@ func (m *StationMutation) ResetIsBuiltin() { m.isBuiltin = nil } -// SetHasDock sets the "hasDock" field. -func (m *StationMutation) SetHasDock(b bool) { - m.hasDock = &b -} - -// HasDock returns the value of the "hasDock" field in the mutation. -func (m *StationMutation) HasDock() (r bool, exists bool) { - v := m.hasDock - if v == nil { - return - } - return *v, true -} - -// OldHasDock returns the old "hasDock" field's value of the Station entity. -// If the Station object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *StationMutation) OldHasDock(ctx context.Context) (v bool, err error) { - if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldHasDock is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, errors.New("OldHasDock requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldHasDock: %w", err) - } - return oldValue.HasDock, nil -} - -// ResetHasDock resets all changes to the "hasDock" field. -func (m *StationMutation) ResetHasDock() { - m.hasDock = nil -} - -// SetDockCode sets the "dockCode" field. -func (m *StationMutation) SetDockCode(s string) { - m.dockCode = &s -} - -// DockCode returns the value of the "dockCode" field in the mutation. -func (m *StationMutation) DockCode() (r string, exists bool) { - v := m.dockCode - if v == nil { - return - } - return *v, true -} - -// OldDockCode returns the old "dockCode" field's value of the Station entity. -// If the Station object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *StationMutation) OldDockCode(ctx context.Context) (v string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldDockCode is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, errors.New("OldDockCode requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldDockCode: %w", err) - } - return oldValue.DockCode, nil -} - -// ResetDockCode resets all changes to the "dockCode" field. -func (m *StationMutation) ResetDockCode() { - m.dockCode = nil -} - // SetVisibleTabs sets the "visibleTabs" field. func (m *StationMutation) SetVisibleTabs(s []string) { m.visibleTabs = &s @@ -19525,7 +19451,7 @@ func (m *StationMutation) Type() string { // order to get all numeric fields that were incremented/decremented, call // AddedFields(). func (m *StationMutation) Fields() []string { - fields := make([]string, 0, 10) + fields := make([]string, 0, 8) if m.stationNo != nil { fields = append(fields, station.FieldStationNo) } @@ -19544,12 +19470,6 @@ func (m *StationMutation) Fields() []string { if m.isBuiltin != nil { fields = append(fields, station.FieldIsBuiltin) } - if m.hasDock != nil { - fields = append(fields, station.FieldHasDock) - } - if m.dockCode != nil { - fields = append(fields, station.FieldDockCode) - } if m.visibleTabs != nil { fields = append(fields, station.FieldVisibleTabs) } @@ -19576,10 +19496,6 @@ func (m *StationMutation) Field(name string) (ent.Value, bool) { return m.Status() case station.FieldIsBuiltin: return m.IsBuiltin() - case station.FieldHasDock: - return m.HasDock() - case station.FieldDockCode: - return m.DockCode() case station.FieldVisibleTabs: return m.VisibleTabs() case station.FieldCreatedAt: @@ -19605,10 +19521,6 @@ func (m *StationMutation) OldField(ctx context.Context, name string) (ent.Value, return m.OldStatus(ctx) case station.FieldIsBuiltin: return m.OldIsBuiltin(ctx) - case station.FieldHasDock: - return m.OldHasDock(ctx) - case station.FieldDockCode: - return m.OldDockCode(ctx) case station.FieldVisibleTabs: return m.OldVisibleTabs(ctx) case station.FieldCreatedAt: @@ -19664,20 +19576,6 @@ func (m *StationMutation) SetField(name string, value ent.Value) error { } m.SetIsBuiltin(v) return nil - case station.FieldHasDock: - v, ok := value.(bool) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetHasDock(v) - return nil - case station.FieldDockCode: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetDockCode(v) - return nil case station.FieldVisibleTabs: v, ok := value.([]string) if !ok { @@ -19801,12 +19699,6 @@ func (m *StationMutation) ResetField(name string) error { case station.FieldIsBuiltin: m.ResetIsBuiltin() return nil - case station.FieldHasDock: - m.ResetHasDock() - return nil - case station.FieldDockCode: - m.ResetDockCode() - return nil case station.FieldVisibleTabs: m.ResetVisibleTabs() return nil diff --git a/bj_power_mes/ent/permission.go b/bj_power_mes/ent/permission.go index fd4b9e0..54ea5bd 100644 --- a/bj_power_mes/ent/permission.go +++ b/bj_power_mes/ent/permission.go @@ -12,7 +12,7 @@ import ( "entgo.io/ent/dialect/sql" ) -// Permission is the model entity for the Permission schema. +// Permission 权限/菜单 type Permission struct { config `json:"-"` // ID of the ent. diff --git a/bj_power_mes/ent/plcsendlog.go b/bj_power_mes/ent/plcsendlog.go index 8e6aa78..be57154 100644 --- a/bj_power_mes/ent/plcsendlog.go +++ b/bj_power_mes/ent/plcsendlog.go @@ -13,7 +13,7 @@ import ( "entgo.io/ent/dialect/sql" ) -// PlcSendLog is the model entity for the PlcSendLog schema. +// PlcSendLog PLC 工序码下发日志 type PlcSendLog struct { config `json:"-"` // ID of the ent. diff --git a/bj_power_mes/ent/processflow.go b/bj_power_mes/ent/processflow.go index 43bf509..4206880 100644 --- a/bj_power_mes/ent/processflow.go +++ b/bj_power_mes/ent/processflow.go @@ -12,7 +12,7 @@ import ( "entgo.io/ent/dialect/sql" ) -// ProcessFlow is the model entity for the ProcessFlow schema. +// ProcessFlow 工艺流程图(菜谱):描述“这个工位怎么干”,承载工艺图纸 PDF + 工序步骤模板。 type ProcessFlow struct { config `json:"-"` // ID of the ent. diff --git a/bj_power_mes/ent/processstep.go b/bj_power_mes/ent/processstep.go index f642aa2..2e677ce 100644 --- a/bj_power_mes/ent/processstep.go +++ b/bj_power_mes/ent/processstep.go @@ -13,7 +13,7 @@ import ( "entgo.io/ent/dialect/sql" ) -// ProcessStep is the model entity for the ProcessStep schema. +// ProcessStep 工序步骤模板:一份工艺流程包含多个采集/考核步骤(按 seq 顺序执行) type ProcessStep struct { config `json:"-"` // ID of the ent. diff --git a/bj_power_mes/ent/role.go b/bj_power_mes/ent/role.go index 2927c93..0262d30 100644 --- a/bj_power_mes/ent/role.go +++ b/bj_power_mes/ent/role.go @@ -13,7 +13,7 @@ import ( "entgo.io/ent/dialect/sql" ) -// Role is the model entity for the Role schema. +// Role 角色:承载菜单/按钮权限 type Role struct { config `json:"-"` // ID of the ent. diff --git a/bj_power_mes/ent/runtime.go b/bj_power_mes/ent/runtime.go index 024c142..017adc0 100644 --- a/bj_power_mes/ent/runtime.go +++ b/bj_power_mes/ent/runtime.go @@ -1187,18 +1187,8 @@ func init() { stationDescIsBuiltin := stationFields[6].Descriptor() // station.DefaultIsBuiltin holds the default value on creation for the isBuiltin field. station.DefaultIsBuiltin = stationDescIsBuiltin.Default.(bool) - // stationDescHasDock is the schema descriptor for hasDock field. - stationDescHasDock := stationFields[7].Descriptor() - // station.DefaultHasDock holds the default value on creation for the hasDock field. - station.DefaultHasDock = stationDescHasDock.Default.(bool) - // stationDescDockCode is the schema descriptor for dockCode field. - stationDescDockCode := stationFields[8].Descriptor() - // station.DefaultDockCode holds the default value on creation for the dockCode field. - station.DefaultDockCode = stationDescDockCode.Default.(string) - // station.DockCodeValidator is a validator for the "dockCode" field. It is called by the builders before save. - station.DockCodeValidator = stationDescDockCode.Validators[0].(func(string) error) // stationDescCreatedAt is the schema descriptor for createdAt field. - stationDescCreatedAt := stationFields[10].Descriptor() + stationDescCreatedAt := stationFields[8].Descriptor() // station.DefaultCreatedAt holds the default value on creation for the createdAt field. station.DefaultCreatedAt = stationDescCreatedAt.Default.(func() time.Time) // stationDescID is the schema descriptor for id field. diff --git a/bj_power_mes/ent/semiflow.go b/bj_power_mes/ent/semiflow.go index 4190d6f..b62e4d2 100644 --- a/bj_power_mes/ent/semiflow.go +++ b/bj_power_mes/ent/semiflow.go @@ -13,7 +13,7 @@ import ( "entgo.io/ent/dialect/sql" ) -// SemiFlow is the model entity for the SemiFlow schema. +// SemiFlow 半成品流转记录:进度快照(完成至工位N),调用 WMS /api/internal/semi/* type SemiFlow struct { config `json:"-"` // ID of the ent. diff --git a/bj_power_mes/ent/station.go b/bj_power_mes/ent/station.go index ba6bbda..624cdec 100644 --- a/bj_power_mes/ent/station.go +++ b/bj_power_mes/ent/station.go @@ -13,7 +13,7 @@ import ( "entgo.io/ent/dialect/sql" ) -// Station is the model entity for the Station schema. +// Station 工位主数据:工位固定只对应一个工序编号,绑定一个工艺流程图(flowId) type Station struct { config `json:"-"` // ID of the ent. @@ -30,10 +30,6 @@ type Station struct { Status string `json:"status,omitempty"` // 内置工位:不可改类型/不可删除 IsBuiltin bool `json:"isBuiltin,omitempty"` - // 是否有接驳台(实体位置,内置不可改) - HasDock bool `json:"hasDock,omitempty"` - // 接驳台编码 DOCK01..21 - DockCode string `json:"dockCode,omitempty"` // VisibleTabs holds the value of the "visibleTabs" field. VisibleTabs []string `json:"visibleTabs,omitempty"` // CreatedAt holds the value of the "createdAt" field. @@ -48,11 +44,11 @@ func (*Station) scanValues(columns []string) ([]any, error) { switch columns[i] { case station.FieldVisibleTabs: values[i] = new([]byte) - case station.FieldIsBuiltin, station.FieldHasDock: + case station.FieldIsBuiltin: values[i] = new(sql.NullBool) case station.FieldID, station.FieldStationNo, station.FieldFlowId: values[i] = new(sql.NullInt64) - case station.FieldName, station.FieldStationType, station.FieldStatus, station.FieldDockCode: + case station.FieldName, station.FieldStationType, station.FieldStatus: values[i] = new(sql.NullString) case station.FieldCreatedAt: values[i] = new(sql.NullTime) @@ -113,18 +109,6 @@ func (_m *Station) assignValues(columns []string, values []any) error { } else if value.Valid { _m.IsBuiltin = value.Bool } - case station.FieldHasDock: - if value, ok := values[i].(*sql.NullBool); !ok { - return fmt.Errorf("unexpected type %T for field hasDock", values[i]) - } else if value.Valid { - _m.HasDock = value.Bool - } - case station.FieldDockCode: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field dockCode", values[i]) - } else if value.Valid { - _m.DockCode = value.String - } case station.FieldVisibleTabs: if value, ok := values[i].(*[]byte); !ok { return fmt.Errorf("unexpected type %T for field visibleTabs", values[i]) @@ -193,12 +177,6 @@ func (_m *Station) String() string { builder.WriteString("isBuiltin=") builder.WriteString(fmt.Sprintf("%v", _m.IsBuiltin)) builder.WriteString(", ") - builder.WriteString("hasDock=") - builder.WriteString(fmt.Sprintf("%v", _m.HasDock)) - builder.WriteString(", ") - builder.WriteString("dockCode=") - builder.WriteString(_m.DockCode) - builder.WriteString(", ") builder.WriteString("visibleTabs=") builder.WriteString(fmt.Sprintf("%v", _m.VisibleTabs)) builder.WriteString(", ") diff --git a/bj_power_mes/ent/station/station.go b/bj_power_mes/ent/station/station.go index 26fa678..45be2c3 100644 --- a/bj_power_mes/ent/station/station.go +++ b/bj_power_mes/ent/station/station.go @@ -25,10 +25,6 @@ const ( FieldStatus = "status" // FieldIsBuiltin holds the string denoting the isbuiltin field in the database. FieldIsBuiltin = "is_builtin" - // FieldHasDock holds the string denoting the hasdock field in the database. - FieldHasDock = "has_dock" - // FieldDockCode holds the string denoting the dockcode field in the database. - FieldDockCode = "dock_code" // FieldVisibleTabs holds the string denoting the visibletabs field in the database. FieldVisibleTabs = "visible_tabs" // FieldCreatedAt holds the string denoting the createdat field in the database. @@ -46,8 +42,6 @@ var Columns = []string{ FieldStationType, FieldStatus, FieldIsBuiltin, - FieldHasDock, - FieldDockCode, FieldVisibleTabs, FieldCreatedAt, } @@ -77,12 +71,6 @@ var ( StatusValidator func(string) error // DefaultIsBuiltin holds the default value on creation for the "isBuiltin" field. DefaultIsBuiltin bool - // DefaultHasDock holds the default value on creation for the "hasDock" field. - DefaultHasDock bool - // DefaultDockCode holds the default value on creation for the "dockCode" field. - DefaultDockCode string - // DockCodeValidator is a validator for the "dockCode" field. It is called by the builders before save. - DockCodeValidator func(string) error // DefaultCreatedAt holds the default value on creation for the "createdAt" field. DefaultCreatedAt func() time.Time // IDValidator is a validator for the "id" field. It is called by the builders before save. @@ -127,16 +115,6 @@ func ByIsBuiltin(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldIsBuiltin, opts...).ToFunc() } -// ByHasDock orders the results by the hasDock field. -func ByHasDock(opts ...sql.OrderTermOption) OrderOption { - return sql.OrderByField(FieldHasDock, opts...).ToFunc() -} - -// ByDockCode orders the results by the dockCode field. -func ByDockCode(opts ...sql.OrderTermOption) OrderOption { - return sql.OrderByField(FieldDockCode, opts...).ToFunc() -} - // ByCreatedAt orders the results by the createdAt field. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldCreatedAt, opts...).ToFunc() diff --git a/bj_power_mes/ent/station/where.go b/bj_power_mes/ent/station/where.go index 0736346..0986238 100644 --- a/bj_power_mes/ent/station/where.go +++ b/bj_power_mes/ent/station/where.go @@ -84,16 +84,6 @@ func IsBuiltin(v bool) predicate.Station { return predicate.Station(sql.FieldEQ(FieldIsBuiltin, v)) } -// HasDock applies equality check predicate on the "hasDock" field. It's identical to HasDockEQ. -func HasDock(v bool) predicate.Station { - return predicate.Station(sql.FieldEQ(FieldHasDock, v)) -} - -// DockCode applies equality check predicate on the "dockCode" field. It's identical to DockCodeEQ. -func DockCode(v string) predicate.Station { - return predicate.Station(sql.FieldEQ(FieldDockCode, v)) -} - // CreatedAt applies equality check predicate on the "createdAt" field. It's identical to CreatedAtEQ. func CreatedAt(v time.Time) predicate.Station { return predicate.Station(sql.FieldEQ(FieldCreatedAt, v)) @@ -394,81 +384,6 @@ func IsBuiltinNEQ(v bool) predicate.Station { return predicate.Station(sql.FieldNEQ(FieldIsBuiltin, v)) } -// HasDockEQ applies the EQ predicate on the "hasDock" field. -func HasDockEQ(v bool) predicate.Station { - return predicate.Station(sql.FieldEQ(FieldHasDock, v)) -} - -// HasDockNEQ applies the NEQ predicate on the "hasDock" field. -func HasDockNEQ(v bool) predicate.Station { - return predicate.Station(sql.FieldNEQ(FieldHasDock, v)) -} - -// DockCodeEQ applies the EQ predicate on the "dockCode" field. -func DockCodeEQ(v string) predicate.Station { - return predicate.Station(sql.FieldEQ(FieldDockCode, v)) -} - -// DockCodeNEQ applies the NEQ predicate on the "dockCode" field. -func DockCodeNEQ(v string) predicate.Station { - return predicate.Station(sql.FieldNEQ(FieldDockCode, v)) -} - -// DockCodeIn applies the In predicate on the "dockCode" field. -func DockCodeIn(vs ...string) predicate.Station { - return predicate.Station(sql.FieldIn(FieldDockCode, vs...)) -} - -// DockCodeNotIn applies the NotIn predicate on the "dockCode" field. -func DockCodeNotIn(vs ...string) predicate.Station { - return predicate.Station(sql.FieldNotIn(FieldDockCode, vs...)) -} - -// DockCodeGT applies the GT predicate on the "dockCode" field. -func DockCodeGT(v string) predicate.Station { - return predicate.Station(sql.FieldGT(FieldDockCode, v)) -} - -// DockCodeGTE applies the GTE predicate on the "dockCode" field. -func DockCodeGTE(v string) predicate.Station { - return predicate.Station(sql.FieldGTE(FieldDockCode, v)) -} - -// DockCodeLT applies the LT predicate on the "dockCode" field. -func DockCodeLT(v string) predicate.Station { - return predicate.Station(sql.FieldLT(FieldDockCode, v)) -} - -// DockCodeLTE applies the LTE predicate on the "dockCode" field. -func DockCodeLTE(v string) predicate.Station { - return predicate.Station(sql.FieldLTE(FieldDockCode, v)) -} - -// DockCodeContains applies the Contains predicate on the "dockCode" field. -func DockCodeContains(v string) predicate.Station { - return predicate.Station(sql.FieldContains(FieldDockCode, v)) -} - -// DockCodeHasPrefix applies the HasPrefix predicate on the "dockCode" field. -func DockCodeHasPrefix(v string) predicate.Station { - return predicate.Station(sql.FieldHasPrefix(FieldDockCode, v)) -} - -// DockCodeHasSuffix applies the HasSuffix predicate on the "dockCode" field. -func DockCodeHasSuffix(v string) predicate.Station { - return predicate.Station(sql.FieldHasSuffix(FieldDockCode, v)) -} - -// DockCodeEqualFold applies the EqualFold predicate on the "dockCode" field. -func DockCodeEqualFold(v string) predicate.Station { - return predicate.Station(sql.FieldEqualFold(FieldDockCode, v)) -} - -// DockCodeContainsFold applies the ContainsFold predicate on the "dockCode" field. -func DockCodeContainsFold(v string) predicate.Station { - return predicate.Station(sql.FieldContainsFold(FieldDockCode, v)) -} - // VisibleTabsIsNil applies the IsNil predicate on the "visibleTabs" field. func VisibleTabsIsNil() predicate.Station { return predicate.Station(sql.FieldIsNull(FieldVisibleTabs)) diff --git a/bj_power_mes/ent/station_create.go b/bj_power_mes/ent/station_create.go index 45a45e6..da76526 100644 --- a/bj_power_mes/ent/station_create.go +++ b/bj_power_mes/ent/station_create.go @@ -96,34 +96,6 @@ func (_c *StationCreate) SetNillableIsBuiltin(v *bool) *StationCreate { return _c } -// SetHasDock sets the "hasDock" field. -func (_c *StationCreate) SetHasDock(v bool) *StationCreate { - _c.mutation.SetHasDock(v) - return _c -} - -// SetNillableHasDock sets the "hasDock" field if the given value is not nil. -func (_c *StationCreate) SetNillableHasDock(v *bool) *StationCreate { - if v != nil { - _c.SetHasDock(*v) - } - return _c -} - -// SetDockCode sets the "dockCode" field. -func (_c *StationCreate) SetDockCode(v string) *StationCreate { - _c.mutation.SetDockCode(v) - return _c -} - -// SetNillableDockCode sets the "dockCode" field if the given value is not nil. -func (_c *StationCreate) SetNillableDockCode(v *string) *StationCreate { - if v != nil { - _c.SetDockCode(*v) - } - return _c -} - // SetVisibleTabs sets the "visibleTabs" field. func (_c *StationCreate) SetVisibleTabs(v []string) *StationCreate { _c.mutation.SetVisibleTabs(v) @@ -201,14 +173,6 @@ func (_c *StationCreate) defaults() { v := station.DefaultIsBuiltin _c.mutation.SetIsBuiltin(v) } - if _, ok := _c.mutation.HasDock(); !ok { - v := station.DefaultHasDock - _c.mutation.SetHasDock(v) - } - if _, ok := _c.mutation.DockCode(); !ok { - v := station.DefaultDockCode - _c.mutation.SetDockCode(v) - } if _, ok := _c.mutation.CreatedAt(); !ok { v := station.DefaultCreatedAt() _c.mutation.SetCreatedAt(v) @@ -247,17 +211,6 @@ func (_c *StationCreate) check() error { if _, ok := _c.mutation.IsBuiltin(); !ok { return &ValidationError{Name: "isBuiltin", err: errors.New(`ent: missing required field "Station.isBuiltin"`)} } - if _, ok := _c.mutation.HasDock(); !ok { - return &ValidationError{Name: "hasDock", err: errors.New(`ent: missing required field "Station.hasDock"`)} - } - if _, ok := _c.mutation.DockCode(); !ok { - return &ValidationError{Name: "dockCode", err: errors.New(`ent: missing required field "Station.dockCode"`)} - } - if v, ok := _c.mutation.DockCode(); ok { - if err := station.DockCodeValidator(v); err != nil { - return &ValidationError{Name: "dockCode", err: fmt.Errorf(`ent: validator failed for field "Station.dockCode": %w`, err)} - } - } if _, ok := _c.mutation.CreatedAt(); !ok { return &ValidationError{Name: "createdAt", err: errors.New(`ent: missing required field "Station.createdAt"`)} } @@ -322,14 +275,6 @@ func (_c *StationCreate) createSpec() (*Station, *sqlgraph.CreateSpec) { _spec.SetField(station.FieldIsBuiltin, field.TypeBool, value) _node.IsBuiltin = value } - if value, ok := _c.mutation.HasDock(); ok { - _spec.SetField(station.FieldHasDock, field.TypeBool, value) - _node.HasDock = value - } - if value, ok := _c.mutation.DockCode(); ok { - _spec.SetField(station.FieldDockCode, field.TypeString, value) - _node.DockCode = value - } if value, ok := _c.mutation.VisibleTabs(); ok { _spec.SetField(station.FieldVisibleTabs, field.TypeJSON, value) _node.VisibleTabs = value diff --git a/bj_power_mes/ent/station_update.go b/bj_power_mes/ent/station_update.go index 8f28ce1..a639e4d 100644 --- a/bj_power_mes/ent/station_update.go +++ b/bj_power_mes/ent/station_update.go @@ -133,34 +133,6 @@ func (_u *StationUpdate) SetNillableIsBuiltin(v *bool) *StationUpdate { return _u } -// SetHasDock sets the "hasDock" field. -func (_u *StationUpdate) SetHasDock(v bool) *StationUpdate { - _u.mutation.SetHasDock(v) - return _u -} - -// SetNillableHasDock sets the "hasDock" field if the given value is not nil. -func (_u *StationUpdate) SetNillableHasDock(v *bool) *StationUpdate { - if v != nil { - _u.SetHasDock(*v) - } - return _u -} - -// SetDockCode sets the "dockCode" field. -func (_u *StationUpdate) SetDockCode(v string) *StationUpdate { - _u.mutation.SetDockCode(v) - return _u -} - -// SetNillableDockCode sets the "dockCode" field if the given value is not nil. -func (_u *StationUpdate) SetNillableDockCode(v *string) *StationUpdate { - if v != nil { - _u.SetDockCode(*v) - } - return _u -} - // SetVisibleTabs sets the "visibleTabs" field. func (_u *StationUpdate) SetVisibleTabs(v []string) *StationUpdate { _u.mutation.SetVisibleTabs(v) @@ -228,11 +200,6 @@ func (_u *StationUpdate) check() error { return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "Station.status": %w`, err)} } } - if v, ok := _u.mutation.DockCode(); ok { - if err := station.DockCodeValidator(v); err != nil { - return &ValidationError{Name: "dockCode", err: fmt.Errorf(`ent: validator failed for field "Station.dockCode": %w`, err)} - } - } return nil } @@ -281,12 +248,6 @@ func (_u *StationUpdate) sqlSave(ctx context.Context) (_node int, err error) { if value, ok := _u.mutation.IsBuiltin(); ok { _spec.SetField(station.FieldIsBuiltin, field.TypeBool, value) } - if value, ok := _u.mutation.HasDock(); ok { - _spec.SetField(station.FieldHasDock, field.TypeBool, value) - } - if value, ok := _u.mutation.DockCode(); ok { - _spec.SetField(station.FieldDockCode, field.TypeString, value) - } if value, ok := _u.mutation.VisibleTabs(); ok { _spec.SetField(station.FieldVisibleTabs, field.TypeJSON, value) } @@ -424,34 +385,6 @@ func (_u *StationUpdateOne) SetNillableIsBuiltin(v *bool) *StationUpdateOne { return _u } -// SetHasDock sets the "hasDock" field. -func (_u *StationUpdateOne) SetHasDock(v bool) *StationUpdateOne { - _u.mutation.SetHasDock(v) - return _u -} - -// SetNillableHasDock sets the "hasDock" field if the given value is not nil. -func (_u *StationUpdateOne) SetNillableHasDock(v *bool) *StationUpdateOne { - if v != nil { - _u.SetHasDock(*v) - } - return _u -} - -// SetDockCode sets the "dockCode" field. -func (_u *StationUpdateOne) SetDockCode(v string) *StationUpdateOne { - _u.mutation.SetDockCode(v) - return _u -} - -// SetNillableDockCode sets the "dockCode" field if the given value is not nil. -func (_u *StationUpdateOne) SetNillableDockCode(v *string) *StationUpdateOne { - if v != nil { - _u.SetDockCode(*v) - } - return _u -} - // SetVisibleTabs sets the "visibleTabs" field. func (_u *StationUpdateOne) SetVisibleTabs(v []string) *StationUpdateOne { _u.mutation.SetVisibleTabs(v) @@ -532,11 +465,6 @@ func (_u *StationUpdateOne) check() error { return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "Station.status": %w`, err)} } } - if v, ok := _u.mutation.DockCode(); ok { - if err := station.DockCodeValidator(v); err != nil { - return &ValidationError{Name: "dockCode", err: fmt.Errorf(`ent: validator failed for field "Station.dockCode": %w`, err)} - } - } return nil } @@ -602,12 +530,6 @@ func (_u *StationUpdateOne) sqlSave(ctx context.Context) (_node *Station, err er if value, ok := _u.mutation.IsBuiltin(); ok { _spec.SetField(station.FieldIsBuiltin, field.TypeBool, value) } - if value, ok := _u.mutation.HasDock(); ok { - _spec.SetField(station.FieldHasDock, field.TypeBool, value) - } - if value, ok := _u.mutation.DockCode(); ok { - _spec.SetField(station.FieldDockCode, field.TypeString, value) - } if value, ok := _u.mutation.VisibleTabs(); ok { _spec.SetField(station.FieldVisibleTabs, field.TypeJSON, value) } diff --git a/bj_power_mes/ent/stationstate.go b/bj_power_mes/ent/stationstate.go index 77bb4f0..4242f1e 100644 --- a/bj_power_mes/ent/stationstate.go +++ b/bj_power_mes/ent/stationstate.go @@ -12,7 +12,7 @@ import ( "entgo.io/ent/dialect/sql" ) -// StationState is the model entity for the StationState schema. +// StationState 工位运行状态(当日有效):工人自主 停止接单/恢复接单。 type StationState struct { config `json:"-"` // ID of the ent. diff --git a/bj_power_mes/ent/stepcriterion.go b/bj_power_mes/ent/stepcriterion.go index b456884..910c714 100644 --- a/bj_power_mes/ent/stepcriterion.go +++ b/bj_power_mes/ent/stepcriterion.go @@ -12,7 +12,7 @@ import ( "entgo.io/ent/dialect/sql" ) -// StepCriterion is the model entity for the StepCriterion schema. +// StepCriterion 工序步骤考核标准:如 扭矩在RANGE[35,45] 自动判定 OK type StepCriterion struct { config `json:"-"` // ID of the ent. diff --git a/bj_power_mes/ent/stepdata.go b/bj_power_mes/ent/stepdata.go index 969527f..a689654 100644 --- a/bj_power_mes/ent/stepdata.go +++ b/bj_power_mes/ent/stepdata.go @@ -12,7 +12,7 @@ import ( "entgo.io/ent/dialect/sql" ) -// StepData is the model entity for the StepData schema. +// StepData 步骤考核数据:某工件某工序步骤采集/手填实际值,按考核标准判定 OK/NG type StepData struct { config `json:"-"` // ID of the ent. diff --git a/bj_power_mes/ent/stepsignrecord.go b/bj_power_mes/ent/stepsignrecord.go index 3c9924d..5aaa1ff 100644 --- a/bj_power_mes/ent/stepsignrecord.go +++ b/bj_power_mes/ent/stepsignrecord.go @@ -12,7 +12,7 @@ import ( "entgo.io/ent/dialect/sql" ) -// StepSignRecord is the model entity for the StepSignRecord schema. +// StepSignRecord 步骤签字记录:工艺步骤配置 need_operator_sign/need_inspector_sign 后, type StepSignRecord struct { config `json:"-"` // ID of the ent. diff --git a/bj_power_mes/ent/sysconfig.go b/bj_power_mes/ent/sysconfig.go index 60d2bb5..efc129b 100644 --- a/bj_power_mes/ent/sysconfig.go +++ b/bj_power_mes/ent/sysconfig.go @@ -11,7 +11,7 @@ import ( "entgo.io/ent/dialect/sql" ) -// SysConfig is the model entity for the SysConfig schema. +// SysConfig 系统基础设置(key/value)。 type SysConfig struct { config `json:"-"` // ID of the ent. diff --git a/bj_power_mes/ent/torquerecord.go b/bj_power_mes/ent/torquerecord.go index 3032de7..135caee 100644 --- a/bj_power_mes/ent/torquerecord.go +++ b/bj_power_mes/ent/torquerecord.go @@ -12,7 +12,7 @@ import ( "entgo.io/ent/dialect/sql" ) -// TorqueRecord is the model entity for the TorqueRecord schema. +// TorqueRecord 拧紧数据(工位终端上报,sn,strain扭矩,angle角度,result,operator,workOrder,time) type TorqueRecord struct { config `json:"-"` // ID of the ent. diff --git a/bj_power_mes/ent/user.go b/bj_power_mes/ent/user.go index 53086c7..9af71df 100644 --- a/bj_power_mes/ent/user.go +++ b/bj_power_mes/ent/user.go @@ -12,7 +12,7 @@ import ( "entgo.io/ent/dialect/sql" ) -// User is the model entity for the User schema. +// User 用户 type User struct { config `json:"-"` // ID of the ent. diff --git a/bj_power_mes/ent/userstation.go b/bj_power_mes/ent/userstation.go index 4dfde31..d6d4922 100644 --- a/bj_power_mes/ent/userstation.go +++ b/bj_power_mes/ent/userstation.go @@ -12,7 +12,7 @@ import ( "entgo.io/ent/dialect/sql" ) -// UserStation is the model entity for the UserStation schema. +// UserStation 用户-工位 关联(一个操作员可绑定多个工位) type UserStation struct { config `json:"-"` // ID of the ent. diff --git a/bj_power_mes/ent/workorder.go b/bj_power_mes/ent/workorder.go index b2aba36..fce9abc 100644 --- a/bj_power_mes/ent/workorder.go +++ b/bj_power_mes/ent/workorder.go @@ -13,7 +13,7 @@ import ( "entgo.io/ent/dialect/sql" ) -// WorkOrder is the model entity for the WorkOrder schema. +// WorkOrder 工单:一个合同 = 一个工单 type WorkOrder struct { config `json:"-"` // ID of the ent. diff --git a/bj_power_mes/ent/workpiece.go b/bj_power_mes/ent/workpiece.go index e1291fd..4c3ef6d 100644 --- a/bj_power_mes/ent/workpiece.go +++ b/bj_power_mes/ent/workpiece.go @@ -12,7 +12,7 @@ import ( "entgo.io/ent/dialect/sql" ) -// Workpiece is the model entity for the Workpiece schema. +// Workpiece 工件(SN):序列号管理的成品/主件 type Workpiece struct { config `json:"-"` // ID of the ent. diff --git a/bj_power_mes/ent/workpiecebind.go b/bj_power_mes/ent/workpiecebind.go index be193d4..8912a90 100644 --- a/bj_power_mes/ent/workpiecebind.go +++ b/bj_power_mes/ent/workpiecebind.go @@ -12,7 +12,7 @@ import ( "entgo.io/ent/dialect/sql" ) -// WorkpieceBind is the model entity for the WorkpieceBind schema. +// WorkpieceBind 装机绑定:某工件在某一工序装配时,把实际装上的部件(结构件=批次号 / 电气件=SN) type WorkpieceBind struct { config `json:"-"` // ID of the ent. diff --git a/bj_power_mes/ent/workpieceprocess.go b/bj_power_mes/ent/workpieceprocess.go index 04cbcf3..ce77133 100644 --- a/bj_power_mes/ent/workpieceprocess.go +++ b/bj_power_mes/ent/workpieceprocess.go @@ -12,7 +12,7 @@ import ( "entgo.io/ent/dialect/sql" ) -// WorkpieceProcess is the model entity for the WorkpieceProcess schema. +// WorkpieceProcess 工件-工艺实绩(某工件在某工位完成某道工艺的一次记录,构成工艺时间线)。 type WorkpieceProcess struct { config `json:"-"` // ID of the ent. diff --git a/bj_power_mes/frontend/src/pages/ProductType.vue b/bj_power_mes/frontend/src/pages/ProductType.vue index 2cf29e1..a143073 100644 --- a/bj_power_mes/frontend/src/pages/ProductType.vue +++ b/bj_power_mes/frontend/src/pages/ProductType.vue @@ -59,8 +59,12 @@ + + + + @@ -111,7 +115,7 @@ const pageSize = ref(20) const filters = reactive({ code: '', name: '', isActive: '', startDate: '', endDate: '' }) // 类型(manageMode)与是否逐件SN管理(snMode)解耦(2026-09-30): // snMode 必选(0=未选择不可保存);选类型自动带默认(电气件→1序列号件,结构件/其他→2批次件),可手改 -const dialog = reactive({ show: false, id: 0, name: '', code: '', spec: '', unit: '', manageMode: 0, snMode: 0, isActive: true }) +const dialog = reactive({ show: false, id: 0, name: '', code: '', spec: '', unit: '', manageMode: 0, snMode: 0, description: '', isActive: true }) const attachDrawer = reactive({ visible: false, code: '', name: '' }) function onTypeChange(v) { @@ -148,12 +152,12 @@ async function load() { function search() { page.value = 1; load() } async function openAdd() { - Object.assign(dialog, { show: true, id: 0, name: '', code: '', spec: '', unit: '', manageMode: 0, snMode: 0, isActive: true }) + Object.assign(dialog, { show: true, id: 0, name: '', code: '', spec: '', unit: '', manageMode: 0, snMode: 0, description: '', isActive: true }) } function openEdit(row) { Object.assign(dialog, { show: true, id: row.id, name: row.name, code: row.code, spec: row.spec || '', unit: row.unit || '', - manageMode: row.manageMode ?? 0, snMode: row.snMode ?? 0, isActive: row.isActive + manageMode: row.manageMode ?? 0, snMode: row.snMode ?? 0, description: row.description || '', isActive: row.isActive }) } async function save() { @@ -165,7 +169,7 @@ async function save() { if (![1, 2, 3].includes(dialog.manageMode)) return ElMessage.warning('请选择类型') if (dialog.snMode !== 1 && dialog.snMode !== 2) return ElMessage.warning('请选择序列号件(序列号件/批次件)') const body = { - name: trim(dialog.name), spec: trim(dialog.spec), unit: trim(dialog.unit), + name: trim(dialog.name), spec: trim(dialog.spec), unit: trim(dialog.unit), description: dialog.description, manageMode: dialog.manageMode, snMode: dialog.snMode, isActive: dialog.isActive } if (dialog.id) await request.put('/product-types', { id: dialog.id, ...body }) diff --git a/bj_power_mes/frontend/src/pages/Station.vue b/bj_power_mes/frontend/src/pages/Station.vue index f7d8a49..803d21d 100644 --- a/bj_power_mes/frontend/src/pages/Station.vue +++ b/bj_power_mes/frontend/src/pages/Station.vue @@ -84,11 +84,6 @@ - -
- 接驳台与工位的 1:1 绑定由系统预置(种子初始化),页面不可更改。 -
-