feat: 完成产线MES系统全流程功能迭代与优化
本提交完成了多个核心模块的功能完善与业务对齐: 1. 工位终端:固定工位配置、移除自选工位逻辑、适配配置化工位号 2. MES核心:重构工位组合逻辑、新增工单/流程状态管理、补全报工/追溯逻辑 3. WMS客户端:新增修改密码功能、优化帮助弹窗逻辑 4. 文档与权限:补充完整操作手册、统一菜单名称与权限描述 5. 修复多业务校验:排产数量校验、工单状态校验、工位绑定规则
This commit is contained in:
@@ -104,20 +104,16 @@ func ScanRecordsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
}
|
||||
}
|
||||
|
||||
// ProcessStepsHandler 查询工位工序的步骤模板(参数采集模板),供手动报工页动态渲染
|
||||
// ProcessStepsHandler 查询工位的工序步骤(参数采集模板),供手动报工页动态渲染。
|
||||
// 按 stationNo 加载该工位启用工艺流程的工序步骤。
|
||||
func ProcessStepsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
code := atoiDefault(r.URL.Query().Get("processCode"), 0)
|
||||
if code <= 0 {
|
||||
data, err := logic.New(svcCtx).AllProcessSteps(r.Context(), 0)
|
||||
if err != nil {
|
||||
httpx.Fail(w, 3207, err.Error())
|
||||
return
|
||||
}
|
||||
httpx.Ok(w, data)
|
||||
stationNo := atoiDefault(r.URL.Query().Get("stationNo"), 0)
|
||||
if stationNo <= 0 {
|
||||
httpx.Fail(w, 3207, "缺少 stationNo 参数")
|
||||
return
|
||||
}
|
||||
data, err := logic.New(svcCtx).ListProcessSteps(r.Context(), code)
|
||||
data, err := logic.New(svcCtx).ListStationSteps(r.Context(), stationNo)
|
||||
if err != nil {
|
||||
httpx.Fail(w, 3207, err.Error())
|
||||
return
|
||||
@@ -125,19 +121,3 @@ func ProcessStepsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
httpx.Ok(w, data)
|
||||
}
|
||||
}
|
||||
|
||||
// SaveProcessStepsHandler 覆盖式保存某工序的步骤模板及考核标准
|
||||
func SaveProcessStepsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req []logic.StepItemReq
|
||||
if err := httpx.ParseJSON(r, &req); err != nil {
|
||||
httpx.BadRequest(w, "请求体解析失败")
|
||||
return
|
||||
}
|
||||
if err := logic.New(svcCtx).SaveProcessSteps(r.Context(), req, operator(r, "")); err != nil {
|
||||
httpx.Fail(w, 3208, err.Error())
|
||||
return
|
||||
}
|
||||
httpx.OkMessage(w, "工艺参数已保存", nil)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ func WorkpieceTraceInternalHandler(svcCtx *svc.ServiceContext) http.HandlerFunc
|
||||
func OrderQueryInternalHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
orderNo := r.URL.Query().Get("orderNo")
|
||||
list, err := logic.New(svcCtx).ListWorkOrders(r.Context(), orderNo, "")
|
||||
list, err := logic.New(svcCtx).ListWorkOrders(r.Context(), orderNo, "", "", "")
|
||||
if err != nil {
|
||||
httpx.Fail(w, 2004, err.Error())
|
||||
return
|
||||
|
||||
@@ -75,9 +75,9 @@ func DeleteProductTypeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
|
||||
func ListWorkOrdersHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
orderNo := r.URL.Query().Get("orderNo")
|
||||
status := r.URL.Query().Get("status")
|
||||
data, err := logic.New(svcCtx).ListWorkOrders(r.Context(), orderNo, status)
|
||||
q := r.URL.Query()
|
||||
data, err := logic.New(svcCtx).ListWorkOrders(r.Context(),
|
||||
q.Get("orderNo"), q.Get("status"), q.Get("productCode"), q.Get("productName"))
|
||||
if err != nil {
|
||||
httpx.Fail(w, 3004, err.Error())
|
||||
return
|
||||
@@ -127,6 +127,36 @@ func GetWorkOrderHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
}
|
||||
}
|
||||
|
||||
// SetWorkOrderStatusHandler POST /work-orders/status(工单状态流转)
|
||||
func SetWorkOrderStatusHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req struct {
|
||||
Id int `json:"id"`
|
||||
Status string `json:"status"`
|
||||
}
|
||||
if err := httpx.ParseJSON(r, &req); err != nil {
|
||||
httpx.BadRequest(w, "请求体解析失败")
|
||||
return
|
||||
}
|
||||
if err := logic.New(svcCtx).SetWorkOrderStatus(r.Context(), req.Id, req.Status, operator(r, "")); err != nil {
|
||||
httpx.Fail(w, 3008, err.Error())
|
||||
return
|
||||
}
|
||||
httpx.OkMessage(w, "状态已更新", nil)
|
||||
}
|
||||
}
|
||||
|
||||
// DeleteWorkOrderHandler DELETE /work-orders/:id(满足安全条件时删除)
|
||||
func DeleteWorkOrderHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
if err := logic.New(svcCtx).DeleteWorkOrder(r.Context(), pathID(r), operator(r, "")); err != nil {
|
||||
httpx.Fail(w, 3009, err.Error())
|
||||
return
|
||||
}
|
||||
httpx.OkMessage(w, "工单已删除", nil)
|
||||
}
|
||||
}
|
||||
|
||||
// ---------- 日排产 ----------
|
||||
|
||||
func SaveDailyPlanHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
|
||||
Reference in New Issue
Block a user