feat: 新增装机绑定功能与权限、BOM工序配置

1.  新增装机绑定实体与相关CRUD逻辑,支持工件工序物料绑定/解绑
2.  为BOM物料新增装配工序字段,支持按工序校验绑定
3.  扩展权限表,新增父权限码字段支持菜单按钮关联
4.  统一各页面帮助弹窗参数,新增角色管理帮助文档
5.  新增公共格式化工具函数,优化侧边栏菜单展开逻辑
6.  新增工位终端绑定代理接口与MES内部绑定API
7.  修复主入口数据库连接与schema初始化逻辑,新增一键迁移工具
This commit is contained in:
SunYF
2026-09-07 11:58:19 +08:00
parent 92f0439d89
commit 6ee131a4bd
70 changed files with 6966 additions and 365 deletions
+90 -9
View File
@@ -26,6 +26,7 @@ import (
"bj_power_mes/ent/userstation"
"bj_power_mes/ent/workorder"
"bj_power_mes/ent/workpiece"
"bj_power_mes/ent/workpiecebind"
"bj_power_mes/ent/workpieceprocess"
"bj_power_mes/schema"
"time"
@@ -103,20 +104,24 @@ func init() {
bomitem.DefaultManageMode = bomitemDescManageMode.Default.(string)
// bomitem.ManageModeValidator is a validator for the "manageMode" field. It is called by the builders before save.
bomitem.ManageModeValidator = bomitemDescManageMode.Validators[0].(func(string) error)
// bomitemDescProcessCode is the schema descriptor for processCode field.
bomitemDescProcessCode := bomitemFields[7].Descriptor()
// bomitem.DefaultProcessCode holds the default value on creation for the processCode field.
bomitem.DefaultProcessCode = bomitemDescProcessCode.Default.(int)
// bomitemDescUnitQty is the schema descriptor for unitQty field.
bomitemDescUnitQty := bomitemFields[7].Descriptor()
bomitemDescUnitQty := bomitemFields[8].Descriptor()
// bomitem.DefaultUnitQty holds the default value on creation for the unitQty field.
bomitem.DefaultUnitQty = bomitemDescUnitQty.Default.(float64)
// bomitemDescLossRate is the schema descriptor for lossRate field.
bomitemDescLossRate := bomitemFields[8].Descriptor()
bomitemDescLossRate := bomitemFields[9].Descriptor()
// bomitem.DefaultLossRate holds the default value on creation for the lossRate field.
bomitem.DefaultLossRate = bomitemDescLossRate.Default.(float64)
// bomitemDescRequiredQty is the schema descriptor for requiredQty field.
bomitemDescRequiredQty := bomitemFields[9].Descriptor()
bomitemDescRequiredQty := bomitemFields[10].Descriptor()
// bomitem.DefaultRequiredQty holds the default value on creation for the requiredQty field.
bomitem.DefaultRequiredQty = bomitemDescRequiredQty.Default.(float64)
// bomitemDescCreatedAt is the schema descriptor for createdAt field.
bomitemDescCreatedAt := bomitemFields[11].Descriptor()
bomitemDescCreatedAt := bomitemFields[12].Descriptor()
// bomitem.DefaultCreatedAt holds the default value on creation for the createdAt field.
bomitem.DefaultCreatedAt = bomitemDescCreatedAt.Default.(func() time.Time)
// bomitemDescID is the schema descriptor for id field.
@@ -359,30 +364,36 @@ func init() {
permission.DefaultType = permissionDescType.Default.(string)
// permission.TypeValidator is a validator for the "type" field. It is called by the builders before save.
permission.TypeValidator = permissionDescType.Validators[0].(func(string) error)
// permissionDescParentCode is the schema descriptor for parentCode field.
permissionDescParentCode := permissionFields[4].Descriptor()
// permission.DefaultParentCode holds the default value on creation for the parentCode field.
permission.DefaultParentCode = permissionDescParentCode.Default.(string)
// permission.ParentCodeValidator is a validator for the "parentCode" field. It is called by the builders before save.
permission.ParentCodeValidator = permissionDescParentCode.Validators[0].(func(string) error)
// permissionDescPath is the schema descriptor for path field.
permissionDescPath := permissionFields[4].Descriptor()
permissionDescPath := permissionFields[5].Descriptor()
// permission.DefaultPath holds the default value on creation for the path field.
permission.DefaultPath = permissionDescPath.Default.(string)
// permission.PathValidator is a validator for the "path" field. It is called by the builders before save.
permission.PathValidator = permissionDescPath.Validators[0].(func(string) error)
// permissionDescIcon is the schema descriptor for icon field.
permissionDescIcon := permissionFields[5].Descriptor()
permissionDescIcon := permissionFields[6].Descriptor()
// permission.DefaultIcon holds the default value on creation for the icon field.
permission.DefaultIcon = permissionDescIcon.Default.(string)
// permission.IconValidator is a validator for the "icon" field. It is called by the builders before save.
permission.IconValidator = permissionDescIcon.Validators[0].(func(string) error)
// permissionDescSort is the schema descriptor for sort field.
permissionDescSort := permissionFields[6].Descriptor()
permissionDescSort := permissionFields[7].Descriptor()
// permission.DefaultSort holds the default value on creation for the sort field.
permission.DefaultSort = permissionDescSort.Default.(int)
// permissionDescRemark is the schema descriptor for remark field.
permissionDescRemark := permissionFields[7].Descriptor()
permissionDescRemark := permissionFields[8].Descriptor()
// permission.DefaultRemark holds the default value on creation for the remark field.
permission.DefaultRemark = permissionDescRemark.Default.(string)
// permission.RemarkValidator is a validator for the "remark" field. It is called by the builders before save.
permission.RemarkValidator = permissionDescRemark.Validators[0].(func(string) error)
// permissionDescCreatedAt is the schema descriptor for createdAt field.
permissionDescCreatedAt := permissionFields[8].Descriptor()
permissionDescCreatedAt := permissionFields[9].Descriptor()
// permission.DefaultCreatedAt holds the default value on creation for the createdAt field.
permission.DefaultCreatedAt = permissionDescCreatedAt.Default.(func() time.Time)
// permissionDescID is the schema descriptor for id field.
@@ -995,6 +1006,76 @@ func init() {
workpieceDescID := workpieceFields[0].Descriptor()
// workpiece.IDValidator is a validator for the "id" field. It is called by the builders before save.
workpiece.IDValidator = workpieceDescID.Validators[0].(func(int) error)
workpiecebindFields := schema.WorkpieceBind{}.Fields()
_ = workpiecebindFields
// workpiecebindDescSn is the schema descriptor for sn field.
workpiecebindDescSn := workpiecebindFields[1].Descriptor()
// workpiecebind.SnValidator is a validator for the "sn" field. It is called by the builders before save.
workpiecebind.SnValidator = workpiecebindDescSn.Validators[0].(func(string) error)
// workpiecebindDescOrderNo is the schema descriptor for orderNo field.
workpiecebindDescOrderNo := workpiecebindFields[2].Descriptor()
// workpiecebind.DefaultOrderNo holds the default value on creation for the orderNo field.
workpiecebind.DefaultOrderNo = workpiecebindDescOrderNo.Default.(string)
// workpiecebind.OrderNoValidator is a validator for the "orderNo" field. It is called by the builders before save.
workpiecebind.OrderNoValidator = workpiecebindDescOrderNo.Validators[0].(func(string) error)
// workpiecebindDescStationNo is the schema descriptor for stationNo field.
workpiecebindDescStationNo := workpiecebindFields[4].Descriptor()
// workpiecebind.DefaultStationNo holds the default value on creation for the stationNo field.
workpiecebind.DefaultStationNo = workpiecebindDescStationNo.Default.(string)
// workpiecebind.StationNoValidator is a validator for the "stationNo" field. It is called by the builders before save.
workpiecebind.StationNoValidator = workpiecebindDescStationNo.Validators[0].(func(string) error)
// workpiecebindDescMaterialCode is the schema descriptor for materialCode field.
workpiecebindDescMaterialCode := workpiecebindFields[5].Descriptor()
// workpiecebind.MaterialCodeValidator is a validator for the "materialCode" field. It is called by the builders before save.
workpiecebind.MaterialCodeValidator = workpiecebindDescMaterialCode.Validators[0].(func(string) error)
// workpiecebindDescMaterialName is the schema descriptor for materialName field.
workpiecebindDescMaterialName := workpiecebindFields[6].Descriptor()
// workpiecebind.DefaultMaterialName holds the default value on creation for the materialName field.
workpiecebind.DefaultMaterialName = workpiecebindDescMaterialName.Default.(string)
// workpiecebind.MaterialNameValidator is a validator for the "materialName" field. It is called by the builders before save.
workpiecebind.MaterialNameValidator = workpiecebindDescMaterialName.Validators[0].(func(string) error)
// workpiecebindDescSpec is the schema descriptor for spec field.
workpiecebindDescSpec := workpiecebindFields[7].Descriptor()
// workpiecebind.DefaultSpec holds the default value on creation for the spec field.
workpiecebind.DefaultSpec = workpiecebindDescSpec.Default.(string)
// workpiecebind.SpecValidator is a validator for the "spec" field. It is called by the builders before save.
workpiecebind.SpecValidator = workpiecebindDescSpec.Validators[0].(func(string) error)
// workpiecebindDescUnit is the schema descriptor for unit field.
workpiecebindDescUnit := workpiecebindFields[8].Descriptor()
// workpiecebind.DefaultUnit holds the default value on creation for the unit field.
workpiecebind.DefaultUnit = workpiecebindDescUnit.Default.(string)
// workpiecebind.UnitValidator is a validator for the "unit" field. It is called by the builders before save.
workpiecebind.UnitValidator = workpiecebindDescUnit.Validators[0].(func(string) error)
// workpiecebindDescManageMode is the schema descriptor for manageMode field.
workpiecebindDescManageMode := workpiecebindFields[9].Descriptor()
// workpiecebind.DefaultManageMode holds the default value on creation for the manageMode field.
workpiecebind.DefaultManageMode = workpiecebindDescManageMode.Default.(string)
// workpiecebind.ManageModeValidator is a validator for the "manageMode" field. It is called by the builders before save.
workpiecebind.ManageModeValidator = workpiecebindDescManageMode.Validators[0].(func(string) error)
// workpiecebindDescBindValue is the schema descriptor for bindValue field.
workpiecebindDescBindValue := workpiecebindFields[10].Descriptor()
// workpiecebind.BindValueValidator is a validator for the "bindValue" field. It is called by the builders before save.
workpiecebind.BindValueValidator = workpiecebindDescBindValue.Validators[0].(func(string) error)
// workpiecebindDescBindType is the schema descriptor for bindType field.
workpiecebindDescBindType := workpiecebindFields[11].Descriptor()
// workpiecebind.DefaultBindType holds the default value on creation for the bindType field.
workpiecebind.DefaultBindType = workpiecebindDescBindType.Default.(string)
// workpiecebind.BindTypeValidator is a validator for the "bindType" field. It is called by the builders before save.
workpiecebind.BindTypeValidator = workpiecebindDescBindType.Validators[0].(func(string) error)
// workpiecebindDescOperator is the schema descriptor for operator field.
workpiecebindDescOperator := workpiecebindFields[12].Descriptor()
// workpiecebind.DefaultOperator holds the default value on creation for the operator field.
workpiecebind.DefaultOperator = workpiecebindDescOperator.Default.(string)
// workpiecebind.OperatorValidator is a validator for the "operator" field. It is called by the builders before save.
workpiecebind.OperatorValidator = workpiecebindDescOperator.Validators[0].(func(string) error)
// workpiecebindDescCreatedAt is the schema descriptor for createdAt field.
workpiecebindDescCreatedAt := workpiecebindFields[13].Descriptor()
// workpiecebind.DefaultCreatedAt holds the default value on creation for the createdAt field.
workpiecebind.DefaultCreatedAt = workpiecebindDescCreatedAt.Default.(func() time.Time)
// workpiecebindDescID is the schema descriptor for id field.
workpiecebindDescID := workpiecebindFields[0].Descriptor()
// workpiecebind.IDValidator is a validator for the "id" field. It is called by the builders before save.
workpiecebind.IDValidator = workpiecebindDescID.Validators[0].(func(int) error)
workpieceprocessFields := schema.WorkpieceProcess{}.Fields()
_ = workpieceprocessFields
// workpieceprocessDescSn is the schema descriptor for sn field.