feat: 核心业务实体扩充(混产模板/产品BOM/试制记录)、WMS 库存检验增强与前端通用能力

- MES 新增实体:混产模板、产品BOM、产品工艺物料、试制记录(schema + ent 生成码 + logic/handler/前端页)
- WMS 实体增强:检验记录、库存、半成品重构;新增序列号库存与短缺代报
- AGV 与产能:AGV 手动点位与链路、物料守卫、短缺预测、原因字典
- 前端通用能力:新增下一步引导组件 NextStepBar,统一帮助文档/布局/请求拦截与操作列
- 工位终端:界面与各 handler 调整(api/store/绑定/PLC/拧紧/上报等)
- 配置与文档:更新 mes-api.yaml、WMS README 及案例/产线API/问题记录/项目说明/流程说明
This commit is contained in:
SunYF
2026-11-15 12:17:39 +08:00
parent 7e8066ab66
commit 1e92b2a596
221 changed files with 26421 additions and 2230 deletions
+13 -10
View File
@@ -11,7 +11,6 @@ import (
"bj_power_mes/ent"
"bj_power_mes/ent/dock"
"bj_power_mes/ent/flowmaterial"
"bj_power_mes/ent/workpiece"
"bj_power_mes/ent/workpiecebind"
"bj_power_mes/ent/workpieceprocess"
@@ -101,15 +100,19 @@ func (s *Service) workpieceProduct(ctx context.Context, client *ent.Client, sn s
return wp, wo, nil
}
// stationBindTargets 取某工艺(flowId)要求装配的物料清单(工艺物料清单 flow_material)。
func (s *Service) stationBindTargets(ctx context.Context, client *ent.Client, flowId int) ([]bindTarget, error) {
items, err := client.FlowMaterial.Query().
Where(flowmaterial.FlowId(flowId)).All(ctx)
// stationBindTargets 取某工艺(flowId)要求装配的物料清单(2026-11-13 总分制:按工件所属工单的
// 来源产品工艺分账优先,无分账行回退工艺物料清单 flow_material)。
func (s *Service) stationBindTargets(ctx context.Context, client *ent.Client, sn string, flowId int) ([]bindTarget, error) {
_, wo, err := s.workpieceProduct(ctx, client, sn)
if err != nil {
return nil, err
}
out := make([]bindTarget, 0, len(items))
for _, it := range items {
fmByFlow, err := s.MaterialsByFlowForWO(ctx, client, wo, []int{flowId})
if err != nil {
return nil, err
}
out := make([]bindTarget, 0, len(fmByFlow[flowId]))
for _, it := range fmByFlow[flowId] {
out = append(out, bindTarget{
MaterialCode: it.MaterialCode, MaterialName: it.MaterialName, Spec: it.Spec,
Unit: it.Unit, SnMode: it.SnMode, UnitQty: it.UnitQty,
@@ -136,7 +139,7 @@ func (s *Service) applyBinds(ctx context.Context, client *ent.Client, sn, orderN
}
// 本工艺物料清单全集:materialCode → 定义(校验料合法性 + 取物料快照)
fmMap := map[string]*ent.FlowMaterial{}
targets, err := s.stationBindTargets(ctx, client, flowId)
targets, err := s.stationBindTargets(ctx, client, sn, flowId)
if err != nil {
return 0, err
}
@@ -252,7 +255,7 @@ func (s *Service) validateStationBinds(ctx context.Context, client *ent.Client,
if !requireBinds {
return "", nil // 工位无启用产线接驳台(虚拟/线下位)→ 不采集绑定,放行
}
targets, err := s.stationBindTargets(ctx, client, flowId)
targets, err := s.stationBindTargets(ctx, client, sn, flowId)
if err != nil {
return "", err
}
@@ -466,7 +469,7 @@ func (s *Service) StationBindPanelData(ctx context.Context, sn string, flowId in
if err != nil {
return nil, err
}
targets, err := s.stationBindTargets(ctx, s.ctx.EntClient, flowId)
targets, err := s.stationBindTargets(ctx, s.ctx.EntClient, sn, flowId)
if err != nil {
return nil, err
}