feat(production): 新增排产支撑功能并移除手动报工页面
- 在main.go中更新排产物料需求注释说明,明确WMS与MES系统间交互方式 - 从前端help.js中移除手动报工(helpScan)相关帮助文档 - 更新工艺流程、绩效报表等页面帮助文档中的报工流程说明 - 在主布局中添加排产支撑菜单项并移除手动报工菜单项 - 新增ProducibleSupport.vue组件实现排产支撑页面功能 - 移除Scan.vue手动报工页面组件 - 更新相关帮助文档内容以匹配新的业务流程
This commit is contained in:
@@ -37,22 +37,6 @@ func doBind(svcCtx *svc.ServiceContext, r *http.Request) (any, error) {
|
||||
return logic.New(svcCtx).BindWorkpiece(r.Context(), req.Sn, req.OrderNo, req.ProcessCode, stationNo, op, req.Items)
|
||||
}
|
||||
|
||||
// BindHandler POST /api/v1/binds —— MES 手动报工页/巡检录绑
|
||||
func BindHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
data, err := doBind(svcCtx, r)
|
||||
if err != nil {
|
||||
httpx.Fail(w, 3309, err.Error())
|
||||
return
|
||||
}
|
||||
if data == nil {
|
||||
httpx.BadRequest(w, "sn / processCode 必填")
|
||||
return
|
||||
}
|
||||
httpx.Ok(w, data)
|
||||
}
|
||||
}
|
||||
|
||||
// BindInternalHandler POST /api/internal/workpiece/binds —— 工位终端扫码绑料
|
||||
func BindInternalHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -83,17 +67,6 @@ func doUnbind(svcCtx *svc.ServiceContext, r *http.Request) error {
|
||||
return logic.New(svcCtx).RemoveBind(r.Context(), req.Sn, req.ProcessCode, req.MaterialCode, req.BindValue, operator(r, req.Operator))
|
||||
}
|
||||
|
||||
// UnbindHandler POST /api/v1/binds/remove —— 撤销误绑(未报工前)
|
||||
func UnbindHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
if err := doUnbind(svcCtx, r); err != nil {
|
||||
httpx.Fail(w, 3310, err.Error())
|
||||
return
|
||||
}
|
||||
httpx.OkMessage(w, "已撤销绑定", nil)
|
||||
}
|
||||
}
|
||||
|
||||
// UnbindInternalHandler POST /api/internal/workpiece/binds/remove
|
||||
func UnbindInternalHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -117,23 +90,6 @@ func bindPanelFromReq(svcCtx *svc.ServiceContext, r *http.Request) (any, error)
|
||||
return logic.New(svcCtx).StationBindPanelData(r.Context(), sn, processCode)
|
||||
}
|
||||
|
||||
// BindPanelHandler GET /api/v1/bind-panel?sn=&processCode=
|
||||
// 手动报工页在报工前拉取"本工件本工序应装什么料、已装什么",展示引导并做齐套校验。
|
||||
func BindPanelHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
data, err := bindPanelFromReq(svcCtx, r)
|
||||
if err != nil {
|
||||
httpx.Fail(w, 3308, err.Error())
|
||||
return
|
||||
}
|
||||
if data == nil {
|
||||
httpx.BadRequest(w, "缺少 sn / processCode 参数")
|
||||
return
|
||||
}
|
||||
httpx.Ok(w, data)
|
||||
}
|
||||
}
|
||||
|
||||
// BindPanelInternalHandler GET /api/internal/workpiece/bind-panel?sn=&processCode=
|
||||
// 工位终端(12 个触控一体机)扫码工件后拉取绑定面板,驱动工人扫码绑料。
|
||||
func BindPanelInternalHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
|
||||
@@ -126,24 +126,7 @@ func TorqueStatHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------- 报工记录 ----------
|
||||
|
||||
// ReportRecordsHandler GET /workpiece/process/records?sn=&orderNo=&stationNo=&page=&pageSize=
|
||||
// 报工记录列表:直查真实报工表 workpiece_process,手动报工与工位终端报工均在此可见(报工闭环)。
|
||||
func ReportRecordsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
q := r.URL.Query()
|
||||
data, total, err := logic.New(svcCtx).ListProcessRecords(r.Context(), q.Get("sn"), q.Get("orderNo"),
|
||||
atoiDefault(q.Get("stationNo"), 0), atoiDefault(q.Get("page"), 1), atoiDefault(q.Get("pageSize"), 20))
|
||||
if err != nil {
|
||||
httpx.Fail(w, 3206, err.Error())
|
||||
return
|
||||
}
|
||||
httpx.Ok(w, map[string]any{"list": data, "total": total})
|
||||
}
|
||||
}
|
||||
|
||||
// ProcessStepsHandler 查询工位的工序步骤(参数采集模板),供手动报工页动态渲染。
|
||||
// ProcessStepsHandler 查询工位的工序步骤(参数采集模板),供巡检终端等按工位动态渲染。
|
||||
// 按 stationNo 加载该工位启用工艺流程的工序步骤。
|
||||
func ProcessStepsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
@@ -2,19 +2,39 @@ package production
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"bj_power_mes/common/httpx"
|
||||
"bj_power_mes/internal/logic"
|
||||
"bj_power_mes/internal/svc"
|
||||
)
|
||||
|
||||
// ProducibleInternalHandler 内部接口:WMS 打开「可生产数量」时实时拉取。
|
||||
// 不做定时/批量同步——WMS 需要时来拉一次,MES 现算现返(BOM 单台用量在 MES、可用量在 WMS)。
|
||||
func ProducibleInternalHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
// MaterialDemandInternalHandler 内部接口:WMS「缺料补货」视图实时拉取排产物料需求量。
|
||||
// 数据链路:daily_plan → work_order → BOM,按物料汇总未来 N 天需求量。WMS 拿到后自己比本地可用量。
|
||||
func MaterialDemandInternalHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
res, err := logic.New(svcCtx).ComputeProducible(r.Context())
|
||||
days := 0
|
||||
if s := r.URL.Query().Get("days"); s != "" {
|
||||
if n, e := strconv.Atoi(s); e == nil {
|
||||
days = n
|
||||
}
|
||||
}
|
||||
res, err := logic.New(svcCtx).ComputeMaterialDemand(r.Context(), days)
|
||||
if err != nil {
|
||||
httpx.Fail(w, 3401, err.Error())
|
||||
httpx.Fail(w, 3402, err.Error())
|
||||
return
|
||||
}
|
||||
httpx.Ok(w, res)
|
||||
}
|
||||
}
|
||||
|
||||
// ProducibleSupportHandler 用户态接口:MES「排产支撑」视图。
|
||||
// 返回逐成品可生产套数 + 整体还能满产多少天/支撑到哪天/最先告罄短板物料。
|
||||
func ProducibleSupportHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
res, err := logic.New(svcCtx).ComputeProducibleSupport(r.Context())
|
||||
if err != nil {
|
||||
httpx.Fail(w, 3403, err.Error())
|
||||
return
|
||||
}
|
||||
httpx.Ok(w, res)
|
||||
|
||||
@@ -31,21 +31,6 @@ func OnlineWorkpieceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
}
|
||||
}
|
||||
|
||||
func ReportWorkpieceProcessHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req logic.ReportProcessReq
|
||||
if err := httpx.ParseJSON(r, &req); err != nil {
|
||||
httpx.BadRequest(w, "请求体解析失败")
|
||||
return
|
||||
}
|
||||
if err := logic.New(svcCtx).ReportProcess(r.Context(), req, operator(r, "")); err != nil {
|
||||
httpx.Fail(w, 3302, err.Error())
|
||||
return
|
||||
}
|
||||
httpx.OkMessage(w, "报工成功", nil)
|
||||
}
|
||||
}
|
||||
|
||||
func DoneWorkpieceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req logic.DoneReq
|
||||
|
||||
Reference in New Issue
Block a user