feat: 多系统新增扫码中间件与 AGV 对接,优化拧紧与退库流程

新增扫码中间件支持网络型扫码枪键盘注入,AGV 对接从 WMS 迁至 MES 统一管理;新增拧紧不合格人工处置与 PLC 对账机制,优化退库单关联与工位终端功能,同时清理旧 AGV 任务表,完善数据库与配置项。
This commit is contained in:
SunYF
2026-10-14 17:24:59 +08:00
parent 8e6048c64b
commit f65a52d9e1
170 changed files with 15415 additions and 10572 deletions
+23 -2
View File
@@ -31,12 +31,12 @@ var seedPermissions = []seedPerm{
{"dashboard:view", "工作台", "MENU", "/", "HomeFilled", 10, ""},
{"inbound:view", "入库管理", "MENU", "/inbound", "Download", 20, ""},
{"outbound:view", "出库管理", "MENU", "/outbound", "Upload", 30, ""},
{"call:view", "叫料队列", "MENU", "/call-queue", "Bell", 35, ""},
{"inventory:view", "库存查询", "MENU", "/inventory", "Search", 40, ""},
{"inspection:view", "来料检验", "MENU", "/inspection-incoming", "CircleCheck", 50, ""},
{"stocktake:view", "库存盘点", "MENU", "/stocktake", "List", 60, ""},
{"semi:view", "半成品/成品", "MENU", "/semi", "Box", 70, ""},
{"wms.finished:edit", "成品入库", "MENU", "/finished-inbound", "Box", 72, ""},
{"ledger:view", "备料台账", "MENU", "/ledger", "Tickets", 80, ""},
{"return:view", "退库确认", "MENU", "/return-order", "RefreshLeft", 85, ""},
{"prodreturn:manage", "生产退不良", "MENU", "/production-return", "WarningFilled", 87, ""},
{"zone:view", "区域维护", "MENU", "/zone", "Location", 90, ""},
@@ -53,6 +53,7 @@ var seedPermissions = []seedPerm{
{"inbound:void", "作废入库单", "BUTTON", "", "", 203, "inbound:view"},
{"outbound:create", "发起出库", "BUTTON", "", "", 210, "outbound:view"},
{"outbound:export", "导出", "BUTTON", "", "", 211, "outbound:view"},
{"call:manage", "叫料-完成备料/驳回", "BUTTON", "", "", 240, "call:view"},
{"inspection:create", "录入检验", "BUTTON", "", "", 220, "inspection:view"},
{"inspection:export", "导出", "BUTTON", "", "", 221, "inspection:view"},
{"inventory:export", "导出", "BUTTON", "", "", 204, "inventory:view"},
@@ -97,7 +98,7 @@ func seedRoleCodes() map[string][]string {
}
insp := []string{
"dashboard:view", "inventory:view", "inspection:view", "inspection:create",
"stocktake:view", "ledger:view", "zone:view", "material:view",
"stocktake:view", "zone:view", "material:view",
"inventory:export", "inspection:export", "material:export",
}
return map[string][]string{"admin": all, "operator": oper, "inspector": insp}
@@ -138,6 +139,26 @@ func SeedRBAC(ctx *svc.ServiceContext, operator string) (createdP, createdR, bou
}
}
codes := seedRoleCodes()
// 退役权限码清理(B5 2026-10-13):工单备料台账页随「自动备料流」退役,ledger:view 及存量角色里的旧码一并摘除(幂等)
for _, dead := range []string{"ledger:view"} {
_, _ = ctx.EntClient.Permission.Delete().Where(permission.CodeEQ(dead)).Exec(ctx0())
}
if allRoles, _ := ctx.EntClient.Role.Query().All(ctx0()); len(allRoles) > 0 {
for _, rl := range allRoles {
kept := make([]string, 0, len(rl.PermissionCodes))
changed := false
for _, c := range rl.PermissionCodes {
if c == "ledger:view" {
changed = true
continue
}
kept = append(kept, c)
}
if changed {
_, _ = ctx.EntClient.Role.UpdateOneID(rl.ID).SetPermissionCodes(kept).Save(ctx0())
}
}
}
for _, m := range seedRoleMeta {
rl, err := ctx.EntClient.Role.Query().
Where(role.CodeEQ(m.Code)).Only(ctx0())