feat: 解耦管理类型与SN管理方式,新增sn_mode字段实现全链路SN管理标准化
本次重构将原manage_mode字段拆分为独立的分类维度(manage_mode)和SN管理维度(sn_mode),实现全链路(MES/WMS/工位终端)的SN管理行为统一依据: 1. 新增sn_mode字段,定义1=序列号件、2=批次件、0=未选择,替代原manage_mode的SN判断逻辑 2. 移除冗余的manage_mode字段在多个实体中的使用,统一使用sn_mode决定业务行为 3. 新增工位接驳台配置,服务端固定接驳台,前端不可修改,确保AGV送达准确性 4. 优化检验记录导出,新增装配物料绑定明细,满足客户追溯需求 5. 修正前端提示文本,统一使用序列号件/批次件表述,与后端逻辑对齐
This commit is contained in:
@@ -148,10 +148,12 @@ type InterProcessInspection struct {
|
||||
Photo string `json:"photo"`
|
||||
Operator string `json:"operator"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
// 装配物料绑定明细(按 SN 跨工艺汇总;客户需求:检验单附装配明细)
|
||||
Binds []InspectionBindItem `json:"binds,omitempty"`
|
||||
}
|
||||
|
||||
// GenerateInterProcessInspection 汇总某工单 PROCESS 类巡检记录(按步骤维度)生成工序间检验记录。
|
||||
// 返回结构化列表,前端/H5 据此渲染打印(PDF/Excel)。
|
||||
// 返回结构化列表,前端/H5 据此渲染打印(PDF/Excel);每条记录附该 SN 的装配物料绑定明细。
|
||||
func (s *Service) GenerateInterProcessInspection(ctx context.Context, orderNo string) ([]*InterProcessInspection, error) {
|
||||
if orderNo == "" {
|
||||
return nil, errors.New("工单号必填")
|
||||
@@ -169,8 +171,17 @@ func (s *Service) GenerateInterProcessInspection(ctx context.Context, orderNo st
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// 同 SN 的绑定明细只查一次(多条巡检记录常指向同一工件)
|
||||
bindCache := map[string][]InspectionBindItem{}
|
||||
out := make([]*InterProcessInspection, 0, len(rows))
|
||||
for _, r := range rows {
|
||||
var binds []InspectionBindItem
|
||||
if r.Sn != "" {
|
||||
if _, ok := bindCache[r.Sn]; !ok {
|
||||
bindCache[r.Sn] = s.inspectionBindItems(ctx, r.Sn)
|
||||
}
|
||||
binds = bindCache[r.Sn]
|
||||
}
|
||||
out = append(out, &InterProcessInspection{
|
||||
OrderNo: r.OrderNo,
|
||||
StationNo: atoiSafe(r.StationNo),
|
||||
@@ -182,6 +193,7 @@ func (s *Service) GenerateInterProcessInspection(ctx context.Context, orderNo st
|
||||
Photo: r.Photo,
|
||||
Operator: r.Operator,
|
||||
CreatedAt: r.CreatedAt,
|
||||
Binds: binds,
|
||||
})
|
||||
}
|
||||
return out, nil
|
||||
|
||||
Reference in New Issue
Block a user