refactor: 重构工艺工序相关命名与数据模型

1.  全局替换"工序"为"工艺"统一术语,包括页面文案、枚举、注释
2.  重构工单与工件工艺数据模型:
    - 新增工艺组合表flow_material作为备料/齐套唯一源头
    - 新增工位状态表station_state支持自主停单/恢复接单
    - 移除station_process派工表,改用工单工艺组合作为路线唯一源头
    - 替换processCode为flowId作为工艺关联标识
    - 重构工件当前进度字段为currentStationNo
3.  删除冗余的静态备份资源文件
4.  调整物料选择组件默认启用仅显示激活物料
5.  优化工单创建/编辑逻辑,新增工艺组合校验与保存
This commit is contained in:
SunYF
2026-09-22 11:32:29 +08:00
parent 932700ca65
commit d609ff8a9e
185 changed files with 8623 additions and 4501 deletions
+12 -11
View File
@@ -10,18 +10,18 @@ import (
"bj_power_workstation/internal/svc"
)
// bindPanelHandler 代理 MES GET /api/internal/workpiece/bind-panel?sn=&processCode=。
// 工位终端扫码工件后拉取本工序应装/已装物料清单(装机绑定引导),响应原样透传。
// bindPanelHandler 代理 MES GET /api/internal/workpiece/bind-panel?sn=&flowId=。
// 工位终端扫码工件后按工位绑定工艺(flowId)拉取应装/已装物料清单(装机绑定引导),响应原样透传。
func bindPanelHandler(ctx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
sn := strings.TrimSpace(r.URL.Query().Get("sn"))
processCode := strings.TrimSpace(r.URL.Query().Get("processCode"))
if sn == "" || processCode == "" {
fail(w, http.StatusBadRequest, "缺少 sn / processCode 参数")
flowId := strings.TrimSpace(r.URL.Query().Get("flowId"))
if sn == "" || flowId == "" {
fail(w, http.StatusBadRequest, "缺少 sn / flowId 参数")
return
}
body, _, err := ctx.Mes.Get("/api/internal/workpiece/bind-panel",
url.Values{"sn": {sn}, "processCode": {processCode}})
url.Values{"sn": {sn}, "flowId": {flowId}})
if err != nil {
fail(w, http.StatusBadGateway, "MES 服务不可达:"+errString(err))
return
@@ -33,7 +33,8 @@ func bindPanelHandler(ctx *svc.ServiceContext) http.HandlerFunc {
}
// bindRecordHandler POST /api/bind/record —— 工位扫/录一个物料(SN/批次)→ MES 装机绑定。
// 透传原 body,MES 负责校验(料是否属于本产品本工序 / 电气件SN防重 / 幂等)。
// 透传原 body,MES 负责校验(料是否属于本工艺装配 / 电气件SN防重 / 幂等)。
// 请求体按定稿契约:{sn, flowId, stationNo, items:[{materialCode, bindValue}]}。
func bindRecordHandler(ctx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
payload, err := io.ReadAll(r.Body)
@@ -42,12 +43,12 @@ func bindRecordHandler(ctx *svc.ServiceContext) http.HandlerFunc {
return
}
var probe struct {
Sn string `json:"sn"`
ProcessCode int `json:"processCode"`
Sn string `json:"sn"`
FlowId int `json:"flowId"`
}
_ = json.Unmarshal(payload, &probe)
if probe.Sn == "" || probe.ProcessCode <= 0 {
fail(w, http.StatusBadRequest, "sn / processCode 必填")
if probe.Sn == "" || probe.FlowId <= 0 {
fail(w, http.StatusBadRequest, "sn / flowId 必填")
return
}
body, _, err := ctx.Mes.Post("/api/internal/workpiece/binds", json.RawMessage(payload))