feat: 同步失败(SyncFailure)实体化与 ent 全量重生成

- 新增 SyncFailure 实体:MES/WMS 两端 schema 源 + ent 生成码(create/delete/query/update 及子包)
- ent 框架文件全量重生成:client/ent/hook/migrate/mutation/predicate/runtime/tx
- 清理旧代码生成入口:删除 schema/gen.go 与 schema/tools/generate.go
- 同步失败页面调整:MES/WMS SyncFailure.vue 接入新实体,MES 产品工艺页同步调整
- 主程序入口注册新实体:bj_power_mes.go / bj_power_wms.go,工作站 main.go 同步调整
- 更新文档:WMS README、案例、问题记录;刷新 MES/WMS 前端构建产物
This commit is contained in:
SunYF
2026-11-12 15:52:51 +08:00
parent 7b7d27d150
commit 7e8066ab66
45 changed files with 10797 additions and 105 deletions
+39
View File
@@ -1234,6 +1234,41 @@ var (
},
},
}
// SyncFailureColumns holds the columns for the "sync_failure" table.
SyncFailureColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "direction", Type: field.TypeString, Size: 2147483647, Comment: "调用方向,如 mes>wms / wms>mes", Default: ""},
{Name: "biz_type", Type: field.TypeString, Size: 2147483647, Comment: "业务类型,如 material.sync", Default: ""},
{Name: "biz_key", Type: field.TypeString, Size: 2147483647, Comment: "业务主键", Default: ""},
{Name: "endpoint", Type: field.TypeString, Size: 2147483647, Comment: "重试时原样重放的对端地址", Default: ""},
{Name: "payload_json", Type: field.TypeString, Size: 2147483647, Comment: "通知载荷(JSON)", Default: "{}"},
{Name: "error_msg", Type: field.TypeString, Size: 2147483647, Comment: "失败原因", Default: ""},
{Name: "idempotency_key", Type: field.TypeString, Size: 2147483647, Comment: "幂等键 direction|biz_type|biz_key"},
{Name: "status", Type: field.TypeString, Size: 2147483647, Comment: "PENDING/SUCCESS/DEAD", Default: "PENDING"},
{Name: "retry_count", Type: field.TypeInt32, Comment: "重试次数", Default: 0},
{Name: "created_at", Type: field.TypeInt64, Comment: "首次失败时刻(unix秒)", Default: 0},
{Name: "last_error_at", Type: field.TypeInt64, Comment: "最近失败时刻(unix秒)", Default: 0},
{Name: "handled_by", Type: field.TypeString, Size: 2147483647, Comment: "人工置 DEAD 的操作人", Default: ""},
}
// SyncFailureTable holds the schema information for the "sync_failure" table.
SyncFailureTable = &schema.Table{
Name: "sync_failure",
Comment: "SyncFailure 跨系统调用失败台账:本地已提交、对端通知失败,人工确认后重试",
Columns: SyncFailureColumns,
PrimaryKey: []*schema.Column{SyncFailureColumns[0]},
Indexes: []*schema.Index{
{
Name: "syncfailure_idempotency_key",
Unique: true,
Columns: []*schema.Column{SyncFailureColumns[7]},
},
{
Name: "syncfailure_status",
Unique: false,
Columns: []*schema.Column{SyncFailureColumns[8]},
},
},
}
// SysConfigColumns holds the columns for the "sys_config" table.
SysConfigColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
@@ -1626,6 +1661,7 @@ var (
StepCriterionTable,
StepDataTable,
StepSignRecordTable,
SyncFailureTable,
SysConfigTable,
TorqueRecordTable,
UserTable,
@@ -1741,6 +1777,9 @@ func init() {
StepSignRecordTable.Annotation = &entsql.Annotation{
Table: "step_sign_record",
}
SyncFailureTable.Annotation = &entsql.Annotation{
Table: "sync_failure",
}
SysConfigTable.Annotation = &entsql.Annotation{
Table: "sys_config",
}