feat(mes): 添加定时同步可生产数量到WMS及BOM项相关标准字段

- 在main.go中添加定时任务每10分钟同步可生产数量到WMS系统
- 为BomItem实体添加relatedStandard字段及相关CRUD方法
- 为InspectionRecord实体添加reportNo、materialCode、materialName等字段
- 更新ent schema确保新字段的验证和默认值设置
- 添加必要的数据库迁移和字段映射逻辑
This commit is contained in:
SunYF
2026-09-17 12:49:07 +08:00
parent b4b274301d
commit 1cc93795ce
191 changed files with 24504 additions and 1250 deletions
+8 -9
View File
@@ -14,7 +14,6 @@ import (
"bj_power_workstation/internal/store"
"bj_power_workstation/internal/svc"
"bj_power_workstation/internal/syncer"
"bj_power_workstation/internal/tightening"
"github.com/zeromicro/go-zero/core/conf"
"github.com/zeromicro/go-zero/core/logx"
@@ -32,11 +31,12 @@ func main() {
var c config.Config
conf.MustLoad(*configFile, &c)
// 工位号:由服务端配置文件加载(终端不允许修改),启动时强校验必须 > 0(工位数以数据库/配置为准,不写死 12)。
if c.Station.StationNo < 1 {
panic(fmt.Sprintf("Station.StationNo 必须 > 0,当前配置为 %d(请修改 yaml 后重启)", c.Station.StationNo))
// 工位号:由服务端配置文件加载(终端不允许修改)。0=上线位、13=下线位为虚拟工位
// (PAD 上线建档 / 下线完工),1~12 为物理装配工位;启动时强校验 >= 0(工位数以数据库/配置为准,不写死 12)。
if c.Station.StationNo < 0 {
panic(fmt.Sprintf("Station.StationNo 必须 >= 0,当前配置为 %d(请修改 yaml 后重启)", c.Station.StationNo))
}
logx.Infof("固定工位号: %d, 本工位螺丝颗数: %d", c.Station.StationNo, c.Station.ScrewCount)
logx.Infof("固定工位号: %d", c.Station.StationNo)
staticFS, err := fs.Sub(webFS, "web/static")
if err != nil {
@@ -63,10 +63,9 @@ func main() {
sy := syncer.New(st, mc)
go sy.Run(rootCtx)
// 内置模拟拧紧数据源(Sim.Enable=true 时启动;正式丹尼科尔协议接入后由 NetSource 替代)
if c.Sim.Enable {
go tightening.NewMockSource(st, mc, c.Station.StationNo).Start(rootCtx)
}
// 拧紧数据由「工艺步骤 + 人工拧枪」驱动:工件走到需要拧紧枪的工艺步骤时,界面聚焦拧紧输入框,
// 人工拧枪把扭矩值打入回车 → POST /api/tightening/record 落本地库并经同步器上报 MES。
// 故此处不再启动任何后台模拟拧紧数据源。
// 工艺文件 PDF 本地预缓存
pdc := pdfcache.New(c.PdfCache.Dir)