feat: 完成产线MES系统全流程功能迭代与优化
本提交完成了多个核心模块的功能完善与业务对齐: 1. 工位终端:固定工位配置、移除自选工位逻辑、适配配置化工位号 2. MES核心:重构工位组合逻辑、新增工单/流程状态管理、补全报工/追溯逻辑 3. WMS客户端:新增修改密码功能、优化帮助弹窗逻辑 4. 文档与权限:补充完整操作手册、统一菜单名称与权限描述 5. 修复多业务校验:排产数量校验、工单状态校验、工位绑定规则
This commit is contained in:
@@ -2,6 +2,7 @@ package plc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -12,7 +13,7 @@ import (
|
||||
// 生产对接西门子 S7:写入工序码寄存器,读完成信号位;未收到完成信号不下发下一条。
|
||||
// mock 模式下直接模拟:下发后置发送状态,可主动标记完成。
|
||||
type Client interface {
|
||||
// SendProcessCode 下发工序组合(如 "135"),返回已下发工序码
|
||||
// SendProcessCode 下发工位组合(如 "1,3,5"),返回已下发工位码
|
||||
SendProcessCode(ctx context.Context, processCombination string) ([]int, error)
|
||||
// QueryDone 查询最近一次下发是否收到完成信号,完成则返回 true
|
||||
QueryDone(ctx context.Context) (bool, error)
|
||||
@@ -40,13 +41,19 @@ func (m *Manager) Get() Client { return m.client }
|
||||
|
||||
func (m *Manager) IsMock() bool { return m.mock }
|
||||
|
||||
// parseCombination 解析 "135" -> [1,3,5]
|
||||
// parseCombination 解析工位组合 "1,3,5" / "10,11,12" -> [1,3,5] / [10,11,12]
|
||||
func parseCombination(s string) []int {
|
||||
var out []int
|
||||
for _, ch := range strings.TrimSpace(s) {
|
||||
if ch >= '1' && ch <= '9' {
|
||||
out = append(out, int(ch-'0'))
|
||||
for _, p := range strings.Split(s, ",") {
|
||||
p = strings.TrimSpace(p)
|
||||
if p == "" {
|
||||
continue
|
||||
}
|
||||
n, err := strconv.Atoi(p)
|
||||
if err != nil || n < 1 || n > 12 {
|
||||
continue
|
||||
}
|
||||
out = append(out, n)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user