feat: 菜单按业务域重排为7组 + 预警中心更名异常告警 + AGV独立权限码与齐套测算分账明细
This commit is contained in:
@@ -152,7 +152,7 @@ func SeedHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------- 用户管理 ----------
|
||||
// ---------- 账号管理 ----------
|
||||
|
||||
func ListUsersHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
@@ -84,6 +84,15 @@ var pathPermMap = map[string]string{
|
||||
"POST:/api/v1/station-templates": "produce.station:edit",
|
||||
"POST:/api/v1/station-templates/delete": "produce.station:edit",
|
||||
"POST:/api/v1/stations/apply-template": "produce.station:edit",
|
||||
// AGV 两个菜单拆码后各自独立校验:
|
||||
// produce.agv = AGV管理(三段链确认 / 取消 / 重试);produce.agv.manual = 人工派车(用车生命周期)。
|
||||
// 两边共用的只读点位与刷新接口(/agv/points、/agv/refresh)不映射,避免互相挡住。
|
||||
"POST:/api/v1/agv/confirm": "produce.agv",
|
||||
"POST:/api/v1/agv/cancel": "produce.agv",
|
||||
"POST:/api/v1/agv/retry": "produce.agv",
|
||||
"POST:/api/v1/agv/free-dispatch": "produce.agv.manual",
|
||||
"POST:/api/v1/agv/chain/next": "produce.agv.manual",
|
||||
"POST:/api/v1/agv/chain/end": "produce.agv.manual",
|
||||
}
|
||||
|
||||
// userHasPerm 校验当前登录用户是否拥有某权限码(SUPER_ADMIN 或 * 放行)。
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package production
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"bj_power_mes/common/httpx"
|
||||
"bj_power_mes/internal/logic"
|
||||
"bj_power_mes/internal/svc"
|
||||
)
|
||||
|
||||
// LinePointSensorInternalHandler GET /api/internal/line/point-sensor?pointNo=
|
||||
// 建档前实物核对(只读):按所选点位读 PLC 传感器实时是否有货,不触发下流、不写台账。
|
||||
// 返回 {pointNo, hasGoods, plcOk, code}:plcOk=false 表示 PLC 不可达/模拟/无法映射/位不存在,
|
||||
// 前端降级为人工确认提示;code 为映射到的 PLC 位(无法映射时空串)。
|
||||
func LinePointSensorInternalHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
pointNo := strings.TrimSpace(r.URL.Query().Get("pointNo"))
|
||||
if pointNo == "" {
|
||||
httpx.BadRequest(w, "请先选择工件当前位置")
|
||||
return
|
||||
}
|
||||
hasGoods, plcOk, err := logic.New(svcCtx).PointSensorCheck(r.Context(), pointNo)
|
||||
if err != nil {
|
||||
httpx.Fail(w, 3010, err.Error())
|
||||
return
|
||||
}
|
||||
httpx.Ok(w, map[string]any{
|
||||
"pointNo": pointNo,
|
||||
"hasGoods": hasGoods,
|
||||
"plcOk": plcOk,
|
||||
"code": logic.PointNoToPlcCode(pointNo),
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,10 @@ package production
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"bj_power_mes/common/httpx"
|
||||
"bj_power_mes/ent/material"
|
||||
"bj_power_mes/internal/logic"
|
||||
"bj_power_mes/internal/svc"
|
||||
)
|
||||
@@ -17,6 +19,8 @@ func ShortageOnBehalfInternalHandler(svcCtx *svc.ServiceContext) http.HandlerFun
|
||||
var req struct {
|
||||
StationNo int `json:"stationNo"`
|
||||
MaterialCode string `json:"materialCode"`
|
||||
MaterialName string `json:"materialName"`
|
||||
Unit string `json:"unit"`
|
||||
Qty int `json:"qty"`
|
||||
Reason string `json:"reason"`
|
||||
Operator string `json:"operator"`
|
||||
@@ -32,8 +36,22 @@ func ShortageOnBehalfInternalHandler(svcCtx *svc.ServiceContext) http.HandlerFun
|
||||
if op == "" {
|
||||
op = "system"
|
||||
}
|
||||
// 物料名称/单位:WMS 未带出时按物料编码从 MES 物料档案回填,
|
||||
// 避免主管在「补料审批」看到只有图号、不知道补的是什么料和按什么计量单位补。
|
||||
materialName, unit := strings.TrimSpace(req.MaterialName), strings.TrimSpace(req.Unit)
|
||||
if materialName == "" || unit == "" {
|
||||
if m, merr := svcCtx.EntClient.Material.Query().
|
||||
Where(material.CodeEQ(strings.TrimSpace(req.MaterialCode))).Only(r.Context()); merr == nil && m != nil {
|
||||
if materialName == "" {
|
||||
materialName = m.Name
|
||||
}
|
||||
if unit == "" {
|
||||
unit = m.Unit
|
||||
}
|
||||
}
|
||||
}
|
||||
row, err := logic.New(svcCtx).CreateShortage(r.Context(), req.StationNo,
|
||||
req.MaterialCode, "", "", req.Qty, req.Reason, op)
|
||||
req.MaterialCode, materialName, unit, req.Qty, req.Reason, op)
|
||||
if err != nil {
|
||||
httpx.Fail(w, 500, err.Error())
|
||||
return
|
||||
|
||||
@@ -240,6 +240,10 @@ func RegisterProductionRoutes(server *rest.Server, serverCtx *svc.ServiceContext
|
||||
server.AddRoute(rest.Route{
|
||||
Method: http.MethodGet, Path: "/api/internal/line/points", Handler: internal(ListPointsHandler(serverCtx)),
|
||||
})
|
||||
// 建档前点位传感器实物核对(只读,不触发下流;PLC 不可达/模拟/无法映射时前端降级人工确认)
|
||||
server.AddRoute(rest.Route{
|
||||
Method: http.MethodGet, Path: "/api/internal/line/point-sensor", Handler: internal(production.LinePointSensorInternalHandler(serverCtx)),
|
||||
})
|
||||
// ---------- 叫料(B5,供工位终端/WMS 仓库端调用,X-API-TOKEN 保护)----------
|
||||
// 工位端点:StationSessionAuth 登录态鉴权(操作人/工位号可信注入)
|
||||
server.AddRoute(rest.Route{
|
||||
|
||||
Reference in New Issue
Block a user