feat: 移除工艺物料与混产模板实体、新增产线清线与 PLC 监控实时推送、看板双屏增强
- 移除实体:MES 删除 FlowMaterial(工艺物料)与 MixProductionTemplate(混产模板)全套(schema/ent 生成码/handler/logic),清理关联路由与种子 - 新增功能:产线清线(line_clearance handler + logic)、PLC 监控 WebSocket 实时推送(ws/plc_monitor_hub + handler) - 看板增强:新增管理屏与 KPI 组件(BoardManage/BoardKpi),调整演示屏 Mock 与各看板面板 - MES 完善:PLC 匹配/扭矩扫描/签收、工艺卡 PDF 与工单、AGV 链路、叫料/备料/在制品/短料预测等逻辑与前端调整 - 工位终端:删除离线面板 OfflinePanel,调整主界面/物料面板与 api/store/handler/路由 - WMS:AGV 托盘、物料与 MES 客户端调整及前端帮助/基础数据/叫料/托盘页 - 文档:更新产线API/客户问题/案例/部署手册/问题记录
This commit is contained in:
@@ -74,7 +74,7 @@ type BindItemReq struct {
|
||||
BindValue string `json:"bindValue"` // 序列号=否=批次号;序列号=是=SN
|
||||
}
|
||||
|
||||
// bindTarget 某工艺要求装配的物料定义(源自工艺物料清单 flow_material)
|
||||
// bindTarget 某工艺要求装配的物料定义(源自来源产品工艺分账)
|
||||
type bindTarget struct {
|
||||
MaterialCode string
|
||||
MaterialName string
|
||||
@@ -100,8 +100,8 @@ func (s *Service) workpieceProduct(ctx context.Context, client *ent.Client, sn s
|
||||
return wp, wo, nil
|
||||
}
|
||||
|
||||
// stationBindTargets 取某工艺(flowId)要求装配的物料清单(2026-11-13 总分制:按工件所属工单的
|
||||
// 来源产品工艺分账优先,无分账行回退工艺物料清单 flow_material)。
|
||||
// stationBindTargets 取某工艺(flowId)要求装配的物料清单(2026-11-13 总分制;
|
||||
// 2026-11-18 起纯分账口径:按工件所属工单来源产品工艺分账取数,无分账则无绑定目标)。
|
||||
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 {
|
||||
@@ -122,7 +122,7 @@ func (s *Service) stationBindTargets(ctx context.Context, client *ent.Client, sn
|
||||
}
|
||||
|
||||
// applyBinds 报工时应用装机绑定(落库 + 防错校验):
|
||||
// ① 料必须配置在该工位的工艺物料清单(flow_material)中;
|
||||
// ① 料必须在该工件来源产品工艺的分账中;
|
||||
// ② 电气件 SN 全局防重:已被其他工件绑定则拒绝(防错拿/防重复装机);
|
||||
// ③ 同一工件同一料同一绑定值幂等(重复扫码不报错,静默去重)。
|
||||
// 返回绑定成功条数。
|
||||
@@ -138,13 +138,13 @@ func (s *Service) applyBinds(ctx context.Context, client *ent.Client, sn, orderN
|
||||
return 0, errors.New("已完工/报废工件不能再绑定物料")
|
||||
}
|
||||
// 本工艺物料清单全集:materialCode → 定义(校验料合法性 + 取物料快照)
|
||||
fmMap := map[string]*ent.FlowMaterial{}
|
||||
fmMap := map[string]*MaterialDemand{}
|
||||
targets, err := s.stationBindTargets(ctx, client, sn, flowId)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
for i := range targets {
|
||||
fmMap[targets[i].MaterialCode] = &ent.FlowMaterial{
|
||||
fmMap[targets[i].MaterialCode] = &MaterialDemand{
|
||||
MaterialCode: targets[i].MaterialCode, MaterialName: targets[i].MaterialName,
|
||||
Spec: targets[i].Spec, Unit: targets[i].Unit,
|
||||
SnMode: targets[i].SnMode, UnitQty: targets[i].UnitQty,
|
||||
@@ -209,9 +209,9 @@ func (s *Service) stationHasEnabledLineDock(ctx context.Context, client *ent.Cli
|
||||
return err == nil && n > 0
|
||||
}
|
||||
|
||||
const bindSkipReason = "该工序未采集绑定(工位无接驳台)"
|
||||
const bindSkipReason = "该工艺未采集绑定(工位无接驳台)"
|
||||
|
||||
// BindNotCollected 追溯页:因候选工位无接驳台而未采集装配绑定的工序。
|
||||
// BindNotCollected 追溯页:因候选工位无接驳台而未采集装配绑定的工艺。
|
||||
type BindNotCollected struct {
|
||||
FlowId int `json:"flowId"`
|
||||
FlowName string `json:"flowName"`
|
||||
@@ -219,9 +219,9 @@ type BindNotCollected struct {
|
||||
Reason string `json:"reason"`
|
||||
}
|
||||
|
||||
// flowBindGate 按工单工艺组合判定每道工序是否需采集装配绑定:
|
||||
// flowBindGate 按工单工艺组合判定每道工艺是否需采集装配绑定:
|
||||
// 多工位同工艺=并行候选工位,任一候选工位有启用 line 接驳台即需采集;
|
||||
// 该工序全部候选均无接驳台(虚拟/线下位)时不采集,并返回追溯用未采集清单。
|
||||
// 该工艺全部候选均无接驳台(虚拟/线下位)时不采集,并返回追溯用未采集清单。
|
||||
func (s *Service) flowBindGate(ctx context.Context, client *ent.Client, wo *ent.WorkOrder) (map[int]bool, []BindNotCollected) {
|
||||
items, _ := RouteStationsFromWO(ctx, client, wo)
|
||||
required := map[int]bool{}
|
||||
@@ -297,7 +297,7 @@ func (s *Service) validateStationBinds(ctx context.Context, client *ent.Client,
|
||||
}
|
||||
|
||||
// validateAllFlows 完工兜底:按工单工艺组合(唯一路线源头)逐工艺校验装配物料齐套。
|
||||
// 同一工艺绑多工位时只校验一次(按 FlowId 去重);该工序候选工位全无启用 line 接驳台
|
||||
// 同一工艺绑多工位时只校验一次(按 FlowId 去重);该工艺候选工位全无启用 line 接驳台
|
||||
// (虚拟/线下位,未采集绑定)时跳过,不再把「没绑」误判成缺料。
|
||||
func (s *Service) validateAllFlows(ctx context.Context, client *ent.Client, sn string, wo *ent.WorkOrder) (string, error) {
|
||||
if _, _, err := s.workpieceProduct(ctx, client, sn); err != nil {
|
||||
@@ -313,7 +313,7 @@ func (s *Service) validateAllFlows(ctx context.Context, client *ent.Client, sn s
|
||||
}
|
||||
seen[it.FlowId] = true
|
||||
if !required[it.FlowId] {
|
||||
continue // 该工序全部候选工位无接驳台 → 未采集绑定,不参与齐套
|
||||
continue // 该工艺全部候选工位无接驳台 → 未采集绑定,不参与齐套
|
||||
}
|
||||
msg, err := s.validateStationBinds(ctx, client, sn, it.FlowId, true)
|
||||
if err != nil {
|
||||
@@ -391,7 +391,7 @@ type BindTraceVO struct {
|
||||
Complete bool `json:"complete"`
|
||||
Missing string `json:"missing"`
|
||||
BomTree []BindNode `json:"bomTree"` // 装机物料明细(按工单工艺组合×工艺物料清单平铺一层,无多级树)
|
||||
NotCollected []BindNotCollected `json:"notCollected"` // 无接驳台工序:未采集绑定原因
|
||||
NotCollected []BindNotCollected `json:"notCollected"` // 无接驳台工艺:未采集绑定原因
|
||||
}
|
||||
|
||||
// BindNode 追溯用的装机物料明细节点(平铺一层;多级 BOM 已于 2026-09-23 退役,无下级展开)
|
||||
@@ -418,7 +418,7 @@ func (s *Service) BuildBindTrace(ctx context.Context, sn string) (*BindTraceVO,
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// 无接驳台工序未采集绑定:追溯页显式给出原因,避免与「已绑齐」的空列表混淆
|
||||
// 无接驳台工艺未采集绑定:追溯页显式给出原因,避免与「已绑齐」的空列表混淆
|
||||
_, skipped := s.flowBindGate(ctx, s.ctx.EntClient, wo)
|
||||
// 物料组成:按工单工艺组合×工艺物料清单平铺一层(物料清单已删除,无多级树)
|
||||
var tree []BindNode
|
||||
@@ -483,7 +483,7 @@ func (s *Service) StationBindPanelData(ctx context.Context, sn string, flowId in
|
||||
}
|
||||
}
|
||||
}
|
||||
// B2(2026-11-08):候选工位无启用 line 接驳台 → 该工序不采集装配绑定,
|
||||
// B2(2026-11-08):候选工位无启用 line 接驳台 → 该工艺不采集装配绑定,
|
||||
// 面板不展示「需绑批次/需绑SN」,齐套恒为 true,前端不会拦截报工。
|
||||
hasDock := s.stationHasEnabledLineDock(ctx, s.ctx.EntClient, stationNo)
|
||||
panel := &StationBindPanel{
|
||||
|
||||
Reference in New Issue
Block a user