feat: 移除工位模板、AGV 链路增强与产品BOM/混产模板完善
- 移除工位模板体系(handler/logic 全删),同步路由与 seed - AGV 链路增强:点位锁、车辆状态、退料派车调整,新增海康 RCS Postman 调试集合 - MES 产品BOM/混产模板完善:新增 ProductBOMDialog 组件,调整 handler/logic;日排产达成对比调整 - WMS 业务完善:出入库、检验、备料、退料、成品入库、缺料代报等 handler 与前端页面调整 - 前端通用:双端新增 RemotePageSelect 组件,统一 nextStep 规则/帮助文档/布局/请求拦截 - 文档:更新产线API/案例/部署手册/问题记录等
This commit is contained in:
@@ -409,9 +409,11 @@ func (s *Service) CopyProductProcess(ctx context.Context, req CopyProductProcess
|
||||
if newName == "" {
|
||||
newName = src.Name + "-副本"
|
||||
}
|
||||
// 2026-11-17 拍板:复制是「换版草稿」,默认停用,人工确认后再启用,
|
||||
// 杜绝复制启用中的工艺导致同一产品瞬间出现两套 ACTIVE。
|
||||
np, err := s.ctx.EntClient.ProductProcess.Create().
|
||||
SetProductCode(src.ProductCode).SetProductName(src.ProductName).
|
||||
SetName(newName).SetStatus(src.Status).SetRemark(src.Remark).Save(ctx)
|
||||
SetName(newName).SetStatus("INACTIVE").SetRemark(src.Remark).Save(ctx)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
@@ -603,3 +605,50 @@ func ppContainsFold(list []string, kw string) bool {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// ProductProcessOverview 产品档案「工艺」抽屉用:按成品聚合出当前启用 + 历史版本 + 每套工艺关联的工单号。
|
||||
// 复用 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{
|
||||
"productCode": productCode,
|
||||
"active": nil,
|
||||
"history": []*ProductProcessVO{},
|
||||
"workOrders": map[int][]map[string]any{},
|
||||
}
|
||||
if strings.TrimSpace(productCode) == "" {
|
||||
return res, nil
|
||||
}
|
||||
raw, err := s.ListProductProcesses(ctx, productCode, "", 0, "", "", 0, 0, 0, 0)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
list, _ := raw.([]*ProductProcessVO)
|
||||
|
||||
history := make([]*ProductProcessVO, 0)
|
||||
woMap := map[int][]map[string]any{}
|
||||
for _, vo := range list {
|
||||
if vo.Status == "ACTIVE" && res["active"] == nil {
|
||||
res["active"] = vo
|
||||
} else {
|
||||
history = append(history, vo)
|
||||
}
|
||||
}
|
||||
res["history"] = history
|
||||
|
||||
// 本成品全部工艺 ID → 查关联工单号(含历史工单,供抽屉展示「这套工艺被哪些工单用过」)
|
||||
ids := make([]int, 0, len(list))
|
||||
for _, vo := range list {
|
||||
ids = append(ids, vo.Id)
|
||||
}
|
||||
if len(ids) > 0 {
|
||||
wos, _ := s.ctx.EntClient.WorkOrder.Query().Where(workorder.ProductProcessIdIn(ids...)).All(ctx)
|
||||
for _, w := range wos {
|
||||
woMap[w.ProductProcessId] = append(woMap[w.ProductProcessId], map[string]any{
|
||||
"id": w.ID, "workOrderNo": w.WorkOrderNo, "status": w.Status,
|
||||
})
|
||||
}
|
||||
}
|
||||
res["workOrders"] = woMap
|
||||
return res, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user