feat: 移除工位模板、AGV 链路增强与产品BOM/混产模板完善

- 移除工位模板体系(handler/logic 全删),同步路由与 seed
- AGV 链路增强:点位锁、车辆状态、退料派车调整,新增海康 RCS Postman 调试集合
- MES 产品BOM/混产模板完善:新增 ProductBOMDialog 组件,调整 handler/logic;日排产达成对比调整
- WMS 业务完善:出入库、检验、备料、退料、成品入库、缺料代报等 handler 与前端页面调整
- 前端通用:双端新增 RemotePageSelect 组件,统一 nextStep 规则/帮助文档/布局/请求拦截
- 文档:更新产线API/案例/部署手册/问题记录等
This commit is contained in:
SunYF
2026-11-18 09:53:42 +08:00
parent 5c9a7e32d2
commit f8482b18f6
122 changed files with 3381 additions and 2004 deletions
+86 -87
View File
@@ -56,8 +56,11 @@ const (
CfgDashboardAnimationLevel = "dashboard.animation.level"
// CfgDashboardBoardTitleScroll 门口看板标题滚动开关(0 不滚动/1 滚动;默认 0)
CfgDashboardBoardTitleScroll = "dashboard.board.title.scroll"
CfgAgvTaskTypLift = "agv.task.typ.lift"
CfgAgvTaskTypPlain = "agv.task.typ.plain"
CfgAgvTaskTypLift = "agv.task.typ.lift"
CfgAgvTaskTypPlain = "agv.task.typ.plain"
// CfgAgvTaskTypEmpty 人工派车首段「空车去接货点」模板(2026-11-17 用户拍板 C01):
// 只传到达点(单点 path)、不指定 agv、不举升;到位后停住等人工选下一站,下一站按目标点走 B01/B02。
CfgAgvTaskTypEmpty = "agv.task.typ.empty"
// 2026-11-09:全局 torque.manual.input 开关已废弃;「允许手填」改由拧紧枪配置页按工位维护,见 torque_gun_config.go。
)
@@ -67,26 +70,27 @@ var startedAt = time.Now()
// SettingsVO 基础设置视图:可配置项 + 本机基础信息(只读展示)
type SettingsVO struct {
// 可配置项
WmsBaseURL string `json:"wmsBaseURL"` // WMS 地址(空=未自定义,走 YAML/默认)
DemandDays int `json:"demandDays"` // 需求窗口天数
ExtrapWindow int `json:"extrapWindow"` // 外推均值窗口天数
ExtrapCap int `json:"extrapCap"` // 外推封顶天数
LogRetentionDays int `json:"logRetentionDays"` // 事件日志保留天数(0=不清理)
PipelineCache int `json:"pipelineCache"` // 滚筒线缓存模式(1=缓存并行,0=串行;预留,PLC 真机接入时生效)
AllowCrossDay int `json:"allowCrossDay"` // 允许叫非今日排产的料(1=允许(默认),0=禁止)
AllowBorrow int `json:"allowBorrow"` // 允许跨工位借料(1=允许(默认),0=禁止;关闭后超额叫料直接拒绝)
TorqueNgAlert bool `json:"torqueNgAlert"` // 拧紧不合格报警开关(1=开启,0=关闭)
DashboardRefreshSeconds int `json:"dashboardRefreshSeconds"` // 看板轮询兜底刷新间隔(秒,1~10)
ArchiveRemindDays int `json:"archiveRemindDays"` // 数据归档提醒周期(天,0=关闭)
DashboardTitle string `json:"dashboardTitle"` // 门口看板标题文字(空=不显示)
DashboardVoice bool `json:"dashboardVoice"` // 门口看板语音播报开关
AgvUnloadTimeoutMinutes int `json:"agvUnloadTimeoutMinutes"` // AGV 卸货超时报警(分钟,默认 5)
MultiOrderCachePolicy string `json:"multiOrderCachePolicy"` // 多工单缓存策略:physical/strict
DashboardKpiVisible string `json:"dashboardKpiVisible"` // 门口看板 KPI 显示项(JSON 数组字符串,默认 [])
DashboardAnimationLevel string `json:"dashboardAnimationLevel"` // 门口看板动画级别 full/simple/off(默认 full)
AgvTaskTypLift string `json:"agvTaskTypLift"`
AgvTaskTypPlain string `json:"agvTaskTypPlain"`
DashboardBoardTitleScroll int `json:"dashboardBoardTitleScroll"` // 门口看板标题滚动 0/1(默认 0)
WmsBaseURL string `json:"wmsBaseURL"` // WMS 地址(空=未自定义,走 YAML/默认)
DemandDays int `json:"demandDays"` // 需求窗口天数
ExtrapWindow int `json:"extrapWindow"` // 外推均值窗口天数
ExtrapCap int `json:"extrapCap"` // 外推封顶天数
LogRetentionDays int `json:"logRetentionDays"` // 事件日志保留天数(0=不清理)
PipelineCache int `json:"pipelineCache"` // 滚筒线缓存模式(1=缓存并行,0=串行;预留,PLC 真机接入时生效)
AllowCrossDay int `json:"allowCrossDay"` // 允许叫非今日排产的料(1=允许(默认),0=禁止)
AllowBorrow int `json:"allowBorrow"` // 允许跨工位借料(1=允许(默认),0=禁止;关闭后超额叫料直接拒绝)
TorqueNgAlert bool `json:"torqueNgAlert"` // 拧紧不合格报警开关(1=开启,0=关闭)
DashboardRefreshSeconds int `json:"dashboardRefreshSeconds"` // 看板轮询兜底刷新间隔(秒,1~10)
ArchiveRemindDays int `json:"archiveRemindDays"` // 数据归档提醒周期(天,0=关闭)
DashboardTitle string `json:"dashboardTitle"` // 门口看板标题文字(空=不显示)
DashboardVoice bool `json:"dashboardVoice"` // 门口看板语音播报开关
AgvUnloadTimeoutMinutes int `json:"agvUnloadTimeoutMinutes"` // AGV 卸货超时报警(分钟,默认 5)
MultiOrderCachePolicy string `json:"multiOrderCachePolicy"` // 多工单缓存策略:physical/strict
DashboardKpiVisible string `json:"dashboardKpiVisible"` // 门口看板 KPI 显示项(JSON 数组字符串,默认 [])
DashboardAnimationLevel string `json:"dashboardAnimationLevel"` // 门口看板动画级别 full/simple/off(默认 full)
AgvTaskTypLift string `json:"agvTaskTypLift"`
AgvTaskTypPlain string `json:"agvTaskTypPlain"`
AgvTaskTypEmpty string `json:"agvTaskTypEmpty"`
DashboardBoardTitleScroll int `json:"dashboardBoardTitleScroll"` // 门口看板标题滚动 0/1(默认 0)
// 本机基础信息(只读)
LocalIPs []string `json:"localIPs"` // 本机内网 IPv4 列表
@@ -99,43 +103,44 @@ type SettingsVO struct {
// SettingsReq 基础设置保存请求(nil 字段不改,便于部分保存)
type SettingsReq struct {
WmsBaseURL *string `json:"wmsBaseURL"`
DemandDays *int `json:"demandDays"`
ExtrapWindow *int `json:"extrapWindow"`
ExtrapCap *int `json:"extrapCap"`
LogRetentionDays *int `json:"logRetentionDays"`
PipelineCache *int `json:"pipelineCache"`
AllowCrossDay *int `json:"allowCrossDay"`
AllowBorrow *int `json:"allowBorrow"`
TorqueNgAlert *bool `json:"torqueNgAlert"` // B2.1 拧紧不合格报警开关(nil=不改)
DashboardRefreshSeconds *int `json:"dashboardRefreshSeconds"` // 看板轮询兜底刷新间隔(秒,nil=不改)
ArchiveRemindDays *int `json:"archiveRemindDays"` // 数据归档提醒周期(天,nil=不改)
DashboardTitle *string `json:"dashboardTitle"` // 门口看板标题文字(nil=不改)
DashboardVoice *bool `json:"dashboardVoice"` // 门口看板语音播报开关(nil=不改)
AgvUnloadTimeoutMinutes *int `json:"agvUnloadTimeoutMinutes"` // AGV 卸货超时报警(分钟,nil=不改)
MultiOrderCachePolicy *string `json:"multiOrderCachePolicy"` // 多工单缓存策略(nil=不改)
DashboardKpiVisible *string `json:"dashboardKpiVisible"` // 门口看板 KPI 显示项(JSON 数组字符串,nil=不改)
DashboardAnimationLevel *string `json:"dashboardAnimationLevel"` // 门口看板动画级别 full/simple/off(nil=不改)
AgvTaskTypLift *string `json:"agvTaskTypLift"`
AgvTaskTypPlain *string `json:"agvTaskTypPlain"`
WmsBaseURL *string `json:"wmsBaseURL"`
DemandDays *int `json:"demandDays"`
ExtrapWindow *int `json:"extrapWindow"`
ExtrapCap *int `json:"extrapCap"`
LogRetentionDays *int `json:"logRetentionDays"`
PipelineCache *int `json:"pipelineCache"`
AllowCrossDay *int `json:"allowCrossDay"`
AllowBorrow *int `json:"allowBorrow"`
TorqueNgAlert *bool `json:"torqueNgAlert"` // B2.1 拧紧不合格报警开关(nil=不改)
DashboardRefreshSeconds *int `json:"dashboardRefreshSeconds"` // 看板轮询兜底刷新间隔(秒,nil=不改)
ArchiveRemindDays *int `json:"archiveRemindDays"` // 数据归档提醒周期(天,nil=不改)
DashboardTitle *string `json:"dashboardTitle"` // 门口看板标题文字(nil=不改)
DashboardVoice *bool `json:"dashboardVoice"` // 门口看板语音播报开关(nil=不改)
AgvUnloadTimeoutMinutes *int `json:"agvUnloadTimeoutMinutes"` // AGV 卸货超时报警(分钟,nil=不改)
MultiOrderCachePolicy *string `json:"multiOrderCachePolicy"` // 多工单缓存策略(nil=不改)
DashboardKpiVisible *string `json:"dashboardKpiVisible"` // 门口看板 KPI 显示项(JSON 数组字符串,nil=不改)
DashboardAnimationLevel *string `json:"dashboardAnimationLevel"` // 门口看板动画级别 full/simple/off(nil=不改)
AgvTaskTypLift *string `json:"agvTaskTypLift"`
AgvTaskTypPlain *string `json:"agvTaskTypPlain"`
AgvTaskTypEmpty *string `json:"agvTaskTypEmpty"`
DashboardBoardTitleScroll *int `json:"dashboardBoardTitleScroll"` // 门口看板标题滚动 0/1(nil=不改)
}
// defaults 建议默认值(未配置时生效)
var settingsDefaults = map[string]int{
CfgDemandDays: 5,
CfgExtrapWindow: 3,
CfgExtrapCap: 365,
CfgLogRetention: 0,
CfgPipelineCache: 0,
CfgAllowCrossDay: 1,
CfgAllowBorrow: 1,
CfgTorqueNgAlert: 1, // B2.1 默认开启拧紧不合格报警
CfgDashboardRefreshSeconds: 5, // 看板轮询兜底刷新间隔(秒)
CfgArchiveRemindDays: 7, // 数据归档提醒周期(天)
CfgArchiveProtectDays: 180, // 数据保护期(天)
CfgAgvUnloadTimeoutMinutes: 5, // AGV 卸货超时报警(分钟)
CfgDashboardBoardTitleScroll: 0, // 门口看板标题滚动(默认 0=不滚动)
CfgDemandDays: 5,
CfgExtrapWindow: 3,
CfgExtrapCap: 365,
CfgLogRetention: 0,
CfgPipelineCache: 0,
CfgAllowCrossDay: 1,
CfgAllowBorrow: 1,
CfgTorqueNgAlert: 1, // B2.1 默认开启拧紧不合格报警
CfgDashboardRefreshSeconds: 5, // 看板轮询兜底刷新间隔(秒)
CfgArchiveRemindDays: 7, // 数据归档提醒周期(天)
CfgArchiveProtectDays: 180, // 数据保护期(天)
CfgAgvUnloadTimeoutMinutes: 5, // AGV 卸货超时报警(分钟)
CfgDashboardBoardTitleScroll: 0, // 门口看板标题滚动(默认 0=不滚动)
}
// GetSettings 读取基础设置 + 本机信息。DB 读失败时按默认值返回(设置页必须能打开)。
@@ -147,32 +152,33 @@ func (s *Service) GetSettings(ctx context.Context) (*SettingsVO, error) {
}
}
vo := &SettingsVO{
WmsBaseURL: kv[CfgWmsBaseURL],
DemandDays: cfgIntFrom(kv, CfgDemandDays),
ExtrapWindow: cfgIntFrom(kv, CfgExtrapWindow),
ExtrapCap: cfgIntFrom(kv, CfgExtrapCap),
LogRetentionDays: cfgIntFrom(kv, CfgLogRetention),
PipelineCache: cfgIntFrom(kv, CfgPipelineCache),
AllowCrossDay: cfgIntFrom(kv, CfgAllowCrossDay),
AllowBorrow: cfgIntFrom(kv, CfgAllowBorrow),
TorqueNgAlert: s.CfgInt(ctx, CfgTorqueNgAlert, 1) == 1, // B2.1 默认开启
DashboardRefreshSeconds: cfgIntFrom(kv, CfgDashboardRefreshSeconds),
ArchiveRemindDays: cfgIntFrom(kv, CfgArchiveRemindDays),
DashboardTitle: kv[CfgDashboardTitle],
DashboardVoice: s.CfgInt(ctx, CfgDashboardVoice, 1) == 1,
AgvUnloadTimeoutMinutes: cfgIntFrom(kv, CfgAgvUnloadTimeoutMinutes),
MultiOrderCachePolicy: cfgStrFrom(kv, CfgMultiOrderCachePolicy, "physical"),
AgvTaskTypLift: cfgStrFrom(kv, CfgAgvTaskTypLift, "B01"),
AgvTaskTypPlain: cfgStrFrom(kv, CfgAgvTaskTypPlain, "B02"),
WmsBaseURL: kv[CfgWmsBaseURL],
DemandDays: cfgIntFrom(kv, CfgDemandDays),
ExtrapWindow: cfgIntFrom(kv, CfgExtrapWindow),
ExtrapCap: cfgIntFrom(kv, CfgExtrapCap),
LogRetentionDays: cfgIntFrom(kv, CfgLogRetention),
PipelineCache: cfgIntFrom(kv, CfgPipelineCache),
AllowCrossDay: cfgIntFrom(kv, CfgAllowCrossDay),
AllowBorrow: cfgIntFrom(kv, CfgAllowBorrow),
TorqueNgAlert: s.CfgInt(ctx, CfgTorqueNgAlert, 1) == 1, // B2.1 默认开启
DashboardRefreshSeconds: cfgIntFrom(kv, CfgDashboardRefreshSeconds),
ArchiveRemindDays: cfgIntFrom(kv, CfgArchiveRemindDays),
DashboardTitle: kv[CfgDashboardTitle],
DashboardVoice: s.CfgInt(ctx, CfgDashboardVoice, 1) == 1,
AgvUnloadTimeoutMinutes: cfgIntFrom(kv, CfgAgvUnloadTimeoutMinutes),
MultiOrderCachePolicy: cfgStrFrom(kv, CfgMultiOrderCachePolicy, "physical"),
AgvTaskTypLift: cfgStrFrom(kv, CfgAgvTaskTypLift, "B01"),
AgvTaskTypPlain: cfgStrFrom(kv, CfgAgvTaskTypPlain, "B02"),
AgvTaskTypEmpty: cfgStrFrom(kv, CfgAgvTaskTypEmpty, "C01"),
DashboardKpiVisible: cfgStrFrom(kv, CfgDashboardKpiVisible, "[]"),
DashboardAnimationLevel: cfgStrFrom(kv, CfgDashboardAnimationLevel, "full"),
DashboardBoardTitleScroll: cfgIntFrom(kv, CfgDashboardBoardTitleScroll),
LocalIPs: localIPv4s(),
ListenAddr: fmt.Sprintf("%s:%d", s.ctx.Config.Host, s.ctx.Config.Port),
DBInfo: fmt.Sprintf("%s:%d/%s", s.ctx.Config.Database.Host, s.ctx.Config.Database.Port, s.ctx.Config.Database.Dbname),
EffectiveWms: strings.TrimSuffix(s.ctx.Wms.BaseURL(), "/"),
GoVersion: runtime.Version(),
StartedAt: startedAt.Format("2006-01-02 15:04:05"),
LocalIPs: localIPv4s(),
ListenAddr: fmt.Sprintf("%s:%d", s.ctx.Config.Host, s.ctx.Config.Port),
DBInfo: fmt.Sprintf("%s:%d/%s", s.ctx.Config.Database.Host, s.ctx.Config.Database.Port, s.ctx.Config.Database.Dbname),
EffectiveWms: strings.TrimSuffix(s.ctx.Wms.BaseURL(), "/"),
GoVersion: runtime.Version(),
StartedAt: startedAt.Format("2006-01-02 15:04:05"),
}
return vo, nil
}
@@ -205,16 +211,9 @@ func (s *Service) SaveSettings(ctx context.Context, req SettingsReq, operator st
{CfgArchiveRemindDays, req.ArchiveRemindDays, 0, 365, "数据归档提醒周期(天,0=关闭;距上次成功备份超过该天数时提醒)"},
{CfgAgvUnloadTimeoutMinutes, req.AgvUnloadTimeoutMinutes, 1, 1440, "AGV 卸货超时报警(分钟,1~1440;任务派发后超过该时长未卸货完成则落预警)"},
}
if req.AgvTaskTypLift != nil {
if v := strings.TrimSpace(*req.AgvTaskTypLift); v != "" {
if err := s.upsertConfig(ctx, CfgAgvTaskTypLift, v, "AGV 举升任务模板编号(B01)"); err != nil { return err }
}
}
if req.AgvTaskTypPlain != nil {
if v := strings.TrimSpace(*req.AgvTaskTypPlain); v != "" {
if err := s.upsertConfig(ctx, CfgAgvTaskTypPlain, v, "AGV 移动任务模板编号(B02)"); err != nil { return err }
}
}
// AGV 三个任务模板(举升 B01 / 移动 B02 / 空车接货 C01)2026-11-17 用户裁决改为只读:
// 基础设置页仅展示不可修改,保存请求即使带上这两个字段也一律忽略,模板编号由出厂常量+seed 锁定。
// 地图简称同样只读且已迁至 yaml Agv.MapShortName(本接口不再接收 agvMapShortName 字段)。
for _, it := range items {
if it.val == nil {
continue