Files
bj_power/bj_power_mes/internal/sse/message.go
T
SunYF a2afd2f6dc feat: 五项目业务实现并对接完成
- MES(B): 工单/BOM/备料/工序字典/PLC下发/拧紧/扫码报工/半成品/AGV/追溯逻辑,WMS与海康RCS客户端,看板Redis缓存API(概览/设备/进度/报警/趋势)+SSE
- WMS(C): JWT滑动续签、Excel导入、盘点、内部API、种子数据、独立Postgres配置
- WMS客户端(E): Go网关8891反向代理+内嵌Vue3十页
- 工位终端(D): SQLite本地缓存+模拟拧紧源+内嵌Vue3页面
- Dashboard(A): 看板数据改接MES内部缓存API,SSE实时刷新+vite代理
- 清理各项目球形磨遗留代码,新增部署手册.md
2026-08-27 19:50:57 +08:00

80 lines
2.6 KiB
Go

/*
* Copyright (c) 2025 Beijing Hardman Automation Equipment Co., LTD. All rights reserved.
*
* Project: adapter
* File: message.go
* Last: 2025-04-15 16:59:49
* Author: wangcheng@bj-hardman.com
*/
package sse
// ToastType 'success' | 'warning' | 'error' | 'info' | 'default'
type ToastType string
const (
ToastTypeSuccess ToastType = "success"
ToastTypeWarning ToastType = "warning"
ToastTypeError ToastType = "error"
ToastTypeInfo ToastType = "info"
ToastTypeDefault ToastType = "default"
)
type ToastMessage struct {
Type ToastType `json:"type,omitempty"`
Content string `json:"content"`
Duration int `json:"duration,omitempty"` // 单位: 毫秒 默认:
ShowClose bool `json:"showClose,omitempty"`
}
type NoticeType string
const (
NoticeTypeSuccess NoticeType = "success"
NoticeTypeWarning NoticeType = "warning"
NoticeTypeError NoticeType = "error"
NoticeTypeInfo NoticeType = "info"
NoticeTypeDefault NoticeType = "default"
)
// NoticePosition 'top' | 'bottom' | 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight'
type NoticePosition string
const (
NoticePositionTop NoticePosition = "top"
NoticePositionBottom NoticePosition = "bottom"
NoticePositionTopLeft NoticePosition = "topLeft"
NoticePositionTopRight NoticePosition = "topRight"
NoticePositionBottomLeft NoticePosition = "bottomLeft"
NoticePositionBottomRight NoticePosition = "bottomRight"
)
type NoticeMessage struct {
Type NoticeType `json:"type,omitempty"`
Title string `json:"title"`
Content string `json:"content"`
Duration int `json:"duration,omitempty"` // 单位: 毫秒 默认: 3000 -1表示无限长
Position NoticePosition `json:"position,omitempty"`
}
// Progress event types for real-time task progress推送
const (
EventTaskStarted = "task_started"
EventTaskStepStarted = "task_step_started"
EventTaskStepCompleted = "task_step_completed"
EventTaskStepSkipped = "task_step_skipped"
EventTaskStepFailed = "task_step_failed"
EventTaskPaused = "task_paused"
EventTaskResumed = "task_resumed"
EventTaskError = "task_error"
EventTaskFinished = "task_finished"
EventTaskCancelled = "task_cancelled"
EventMachineComplete = "machine_complete"
EventWashComplete = "wash_complete"
EventDeburComplete = "debur_complete"
EventCleaningComplete = "cleaning_complete"
EventTempStationUpdate = "temp_station_update"
EventDockDataUpdate = "dock_data_update"
EventDashboardUpdate = "dashboard_update" // 看板数据变更通知(Dashboard A 通过 SSE 订阅)
)