feat: 完成产线MES系统全流程功能迭代与优化
本提交完成了多个核心模块的功能完善与业务对齐: 1. 工位终端:固定工位配置、移除自选工位逻辑、适配配置化工位号 2. MES核心:重构工位组合逻辑、新增工单/流程状态管理、补全报工/追溯逻辑 3. WMS客户端:新增修改密码功能、优化帮助弹窗逻辑 4. 文档与权限:补充完整操作手册、统一菜单名称与权限描述 5. 修复多业务校验:排产数量校验、工单状态校验、工位绑定规则
This commit is contained in:
@@ -20,7 +20,7 @@ type PlcSendReq struct {
|
||||
// 约束:上一条工序未收到完成信号,不下发下一条(模拟 S7 握手)。
|
||||
func (s *Service) SendProcess(ctx context.Context, req PlcSendReq, operator string) (*ent.PlcSendLog, error) {
|
||||
if req.ProcessCombination == "" {
|
||||
return nil, errors.New("工序组合不能为空")
|
||||
return nil, errors.New("工位组合不能为空")
|
||||
}
|
||||
// 检查是否存在未完成的同工位下发
|
||||
last, err := s.ctx.EntClient.PlcSendLog.Query().
|
||||
@@ -37,7 +37,7 @@ func (s *Service) SendProcess(ctx context.Context, req PlcSendReq, operator stri
|
||||
now := time.Now()
|
||||
rec, err := s.ctx.EntClient.PlcSendLog.Create().
|
||||
SetOrderNo(req.OrderNo).SetSn(req.Sn).SetStationNo(req.StationNo).
|
||||
SetProcessCombination(req.ProcessCombination).SetProcessCodes(parseCodes(req.ProcessCombination)).
|
||||
SetProcessCombination(req.ProcessCombination).SetProcessCodes(ParseProcessSeq(req.ProcessCombination)).
|
||||
SetStatus("SENT").SetSendTime(now).SetOperator(operator).Save(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -47,7 +47,7 @@ func (s *Service) SendProcess(ctx context.Context, req PlcSendReq, operator stri
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
s.ctx.EventLog.Write(ctx, "plc.send", req.OrderNo, operator, "plc_send_log", req.Sn, "PLC工序码下发", map[string]any{"combination": req.ProcessCombination})
|
||||
s.ctx.EventLog.Write(ctx, "plc.send", req.OrderNo, operator, "plc_send_log", req.Sn, "工位组合下发", map[string]any{"combination": req.ProcessCombination})
|
||||
|
||||
// mock 完成信号:延时后置为完成(演示"未完成不下发下一条"握手)
|
||||
go func(id int) {
|
||||
@@ -60,19 +60,6 @@ func (s *Service) SendProcess(ctx context.Context, req PlcSendReq, operator stri
|
||||
return rec, nil
|
||||
}
|
||||
|
||||
func parseCodes(combination string) []int {
|
||||
var out []int
|
||||
for _, ch := range combination {
|
||||
if ch >= '1' && ch <= '9' {
|
||||
out = append(out, int(ch-'0'))
|
||||
} else if ch == '1' || ch == '0' {
|
||||
// 允许 "10","11","12" 两位工序
|
||||
continue
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// ListPlcSendLogs 查询 PLC 下发日志
|
||||
func (s *Service) ListPlcSendLogs(ctx context.Context, orderNo, status string) ([]*ent.PlcSendLog, error) {
|
||||
q := s.ctx.EntClient.PlcSendLog.Query()
|
||||
|
||||
Reference in New Issue
Block a user