feat: 菜单按业务域重排为7组 + 预警中心更名异常告警 + AGV独立权限码与齐套测算分账明细
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user