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:
SunYF
2026-11-19 08:31:05 +08:00
parent f8482b18f6
commit 4c4cda1d41
148 changed files with 2511 additions and 9735 deletions
@@ -38,7 +38,7 @@ type ProductProcessReq struct {
Status string `json:"status"`
Remark string `json:"remark"`
Flows []ProductProcessItemReq `json:"flows"`
// 2026-11-13 拍板「总分制」:随产品工艺一起提交的分账行(总账物料分配到各工序)。
// 2026-11-13 拍板「总分制」:随产品工艺一起提交的分账行(总账物料分配到各工艺)。
// 总账存在时不分配完 / Σ分账≠总账 → 保存被硬拒。
Allocations []BOMAllocation `json:"allocations"`
}
@@ -168,7 +168,7 @@ func (s *Service) ListProductProcesses(ctx context.Context, productCode, status
vo.Executable, vo.NotReady = ppExecutable(vo)
out = append(out, vo)
}
// 工序数范围过滤:按产品工艺的工艺顺序/工序条目数(vo.Flows 长度)
// 工艺数范围过滤:按产品工艺的工艺顺序/工艺条目数(vo.Flows 长度)
if stepMin > 0 || stepMax > 0 {
kept := make([]*ProductProcessVO, 0, len(out))
for _, vo := range out {
@@ -283,7 +283,7 @@ func (s *Service) SaveProductProcess(ctx context.Context, req ProductProcessReq,
}
// 2026-11-13 拍板 P10:工艺配置与物料清单彻底分离、各自独立保存。
// 产品工艺的保存不再写入分账(保存物料清单不会再保存一遍工艺);
// 这里只校验「已有分账的工序仍在本次工艺路线内」,避免改路线后分账指向消失的工序。
// 这里只校验「已有分账的工艺仍在本次工艺路线内」,避免改路线后分账指向消失的工艺。
if req.Id > 0 && len(req.Flows) > 0 {
flowSet := map[int]bool{}
for _, f := range req.Flows {
@@ -296,7 +296,7 @@ func (s *Service) SaveProductProcess(ctx context.Context, req ProductProcessReq,
}
for _, a := range allocRows {
if !flowSet[a.FlowId] {
return 0, fmt.Errorf("工序 %d 已从工艺路线移除,但物料清单里仍有该工序的物料分配;请先在物料清单里重新分配", a.FlowId)
return 0, fmt.Errorf("工艺 %d 已从工艺路线移除,但物料清单里仍有该工艺的物料分配;请先在物料清单里重新分配", a.FlowId)
}
}
}
@@ -423,7 +423,7 @@ func (s *Service) CopyProductProcess(ctx context.Context, req CopyProductProcess
return 0, err
}
}
// 2026-11-13 拍板堵后门:复制产品工艺必须同步复制物料分账(按工序隔离)
// 2026-11-13 拍板堵后门:复制产品工艺必须同步复制物料分账(按工艺隔离)
allocRows, _ := s.ctx.EntClient.ProductProcessMaterial.Query().
Where(productprocessmaterial.ProductProcessId(src.ID)).All(ctx)
for _, a := range allocRows {
@@ -607,7 +607,7 @@ func ppContainsFold(list []string, kw string) bool {
}
// ProductProcessOverview 产品档案「工艺」抽屉用:按成品聚合出当前启用 + 历史版本 + 每套工艺关联的工单号。
// 复用 ListProductProcesses 的 VO(已含工序顺序/工位/可执行/工单计数),额外补工单号明细。
// 复用 ListProductProcesses 的 VO(已含工艺顺序/工位/可执行/工单计数),额外补工单号明细。
// 返回 {productCode, active:*VO|null, history:[]VO, workOrders:{ppId:[{id,workOrderNo,status}]}}。
func (s *Service) ProductProcessOverview(ctx context.Context, productCode string) (map[string]any, error) {
res := map[string]any{