feat: 重构BOM架构,新增基础设置与虚拟工位管理功能

本次重构删除原有BOM物料清单表,改用工单工艺组合×工艺物料清单作为唯一用料来源;新增系统基础设置表支持WMS地址、日志保留天数等配置,新增虚拟工位作业管理后台接口与前端页签控制功能,同时优化工位号校验逻辑、事件日志自动清理与工单用料查询能力。
This commit is contained in:
SunYF
2026-09-23 11:41:28 +08:00
parent d3eda6b588
commit f274da044c
74 changed files with 3637 additions and 5586 deletions
+5 -10
View File
@@ -6,7 +6,6 @@ import (
"fmt"
"strings"
"bj_power_mes/ent/bomitem"
"bj_power_mes/ent/workorder"
"bj_power_mes/internal/wmsclient"
)
@@ -16,11 +15,11 @@ import (
// 不降级读本地缓存,避免给界面喂空/陈旧数据)。
type ProductTypeReq struct {
Id int `json:"id"`
Name string `json:"name"`
Code string `json:"code"`
Spec string `json:"spec"`
Unit string `json:"unit"`
Id int `json:"id"`
Name string `json:"name"`
Code string `json:"code"`
Spec string `json:"spec"`
Unit string `json:"unit"`
Category string `json:"category"`
ManageMode int `json:"manageMode"` // 1结构件(批次)/2电气件(SN);MES 成品只列这两个
IsActive bool `json:"isActive"`
@@ -76,10 +75,6 @@ func (s *Service) DeleteProductType(ctx context.Context, id int) error {
if woCnt > 0 {
return fmt.Errorf("该物料档案已被 %d 张工单引用,不可删除;建议停用(下架)", woCnt)
}
bomCnt, _ := s.ctx.EntClient.BomItem.Query().Where(bomitem.ProductCode(row.Code)).Count(ctx)
if bomCnt > 0 {
return fmt.Errorf("该物料档案在物料清单中有 %d 条配置,不可删除;建议停用(下架)", bomCnt)
}
if err := s.ctx.Wms.DeleteProductType(ctx, id); err != nil {
return errors.New("WMS 不可达或拒绝删除:" + err.Error())
}