feat: 完成WMS系统权限体系与业务功能迭代

本提交完成了WMS系统的多维度优化升级:
1. 新增RBAC权限系统,支持角色/菜单/按钮三级权限管控
2. 重构库存盘点、物料管理、区域维护等模块的查询筛选与展示逻辑
3. 优化入库/出库/质检等业务流程,完善数据冗余与业务闭环
4. 移除旧装箱表,将装箱逻辑合并到出库主表
5. 新增前端权限判断工具、导出工具与端到端测试用例
6. 补充完善各类注释与数据库字段说明
This commit is contained in:
SunYF
2026-09-03 14:20:37 +08:00
parent 665ff257dc
commit 572fa975bc
101 changed files with 14531 additions and 4692 deletions
+61 -27
View File
@@ -3,6 +3,7 @@
package migrate
import (
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/dialect/sql/schema"
"entgo.io/ent/schema/field"
)
@@ -83,6 +84,10 @@ var (
{Name: "inspection_type", Type: field.TypeString, Default: "incoming"},
{Name: "status", Type: field.TypeString, Default: "未检"},
{Name: "result_value", Type: field.TypeString, Nullable: true},
{Name: "inspect_qty", Type: field.TypeInt, Default: 0},
{Name: "pass_qty", Type: field.TypeInt, Default: 0},
{Name: "check_desc", Type: field.TypeString, Nullable: true},
{Name: "fail_reason", Type: field.TypeString, Nullable: true},
{Name: "inspector", Type: field.TypeString, Nullable: true},
{Name: "remark", Type: field.TypeString, Nullable: true},
{Name: "created_at", Type: field.TypeInt64},
@@ -326,6 +331,9 @@ var (
{Name: "reviewer", Type: field.TypeString, Nullable: true},
{Name: "target_dock", Type: field.TypeString, Nullable: true},
{Name: "remark", Type: field.TypeString, Nullable: true},
{Name: "box_no", Type: field.TypeString, Nullable: true},
{Name: "box_sn_list", Type: field.TypeString, Nullable: true},
{Name: "contract_no", Type: field.TypeString, Nullable: true},
{Name: "created_at", Type: field.TypeInt64},
}
// OutboundOrdersTable holds the schema information for the "outbound_orders" table.
@@ -349,41 +357,59 @@ var (
Unique: false,
Columns: []*schema.Column{OutboundOrdersColumns[2]},
},
{
Name: "outboundorder_box_no",
Unique: false,
Columns: []*schema.Column{OutboundOrdersColumns[14]},
},
},
}
// PackageBoxesColumns holds the columns for the "package_boxes" table.
PackageBoxesColumns = []*schema.Column{
// PermissionsColumns holds the columns for the "permissions" table.
PermissionsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "box_no", Type: field.TypeString, Unique: true},
{Name: "sn_list", Type: field.TypeString, Nullable: true},
{Name: "material_code", Type: field.TypeString, Nullable: true},
{Name: "quantity", Type: field.TypeInt, Default: 0},
{Name: "operator", Type: field.TypeString, Nullable: true},
{Name: "contract_no", Type: field.TypeString, Nullable: true},
{Name: "remark", Type: field.TypeString, Nullable: true},
{Name: "code", Type: field.TypeString, Unique: true, Size: 64},
{Name: "name", Type: field.TypeString, Size: 64},
{Name: "type", Type: field.TypeString, Size: 20, Default: "MENU"},
{Name: "path", Type: field.TypeString, Nullable: true, Size: 128, Default: ""},
{Name: "icon", Type: field.TypeString, Nullable: true, Size: 64, Default: ""},
{Name: "sort", Type: field.TypeInt, Nullable: true, Default: 0},
{Name: "remark", Type: field.TypeString, Nullable: true, Size: 255, Default: ""},
{Name: "created_at", Type: field.TypeInt64},
{Name: "updated_at", Type: field.TypeInt64, Nullable: true},
{Name: "updated_at", Type: field.TypeInt64},
}
// PackageBoxesTable holds the schema information for the "package_boxes" table.
PackageBoxesTable = &schema.Table{
Name: "package_boxes",
Columns: PackageBoxesColumns,
PrimaryKey: []*schema.Column{PackageBoxesColumns[0]},
// PermissionsTable holds the schema information for the "permissions" table.
PermissionsTable = &schema.Table{
Name: "permissions",
Columns: PermissionsColumns,
PrimaryKey: []*schema.Column{PermissionsColumns[0]},
Indexes: []*schema.Index{
{
Name: "packagebox_material_code",
Unique: false,
Columns: []*schema.Column{PackageBoxesColumns[3]},
Name: "permission_code",
Unique: true,
Columns: []*schema.Column{PermissionsColumns[1]},
},
},
}
// RolesColumns holds the columns for the "roles" table.
RolesColumns = []*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: "remark", Type: field.TypeString, Nullable: true, Size: 255, Default: ""},
{Name: "permission_codes", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}},
{Name: "created_at", Type: field.TypeInt64},
{Name: "updated_at", Type: field.TypeInt64},
}
// RolesTable holds the schema information for the "roles" table.
RolesTable = &schema.Table{
Name: "roles",
Columns: RolesColumns,
PrimaryKey: []*schema.Column{RolesColumns[0]},
Indexes: []*schema.Index{
{
Name: "packagebox_contract_no",
Unique: false,
Columns: []*schema.Column{PackageBoxesColumns[6]},
},
{
Name: "packagebox_operator",
Unique: false,
Columns: []*schema.Column{PackageBoxesColumns[5]},
Name: "role_code",
Unique: true,
Columns: []*schema.Column{RolesColumns[2]},
},
},
}
@@ -480,6 +506,7 @@ var (
{Name: "password", Type: field.TypeString},
{Name: "real_name", Type: field.TypeString, Nullable: true},
{Name: "role", Type: field.TypeString, Default: "operator"},
{Name: "role_id", Type: field.TypeInt, Nullable: true},
{Name: "dept", Type: field.TypeString, Nullable: true},
{Name: "phone", Type: field.TypeString, Nullable: true},
{Name: "is_active", Type: field.TypeBool, Default: true},
@@ -527,7 +554,8 @@ var (
OrderMaterialLedgersTable,
OutboundDetailsTable,
OutboundOrdersTable,
PackageBoxesTable,
PermissionsTable,
RolesTable,
SemiFinishedsTable,
StocktakeItemsTable,
StocktakeOrdersTable,
@@ -537,4 +565,10 @@ var (
)
func init() {
PermissionsTable.Annotation = &entsql.Annotation{
Table: "permissions",
}
RolesTable.Annotation = &entsql.Annotation{
Table: "roles",
}
}