feat: 移除工艺物料与混产模板实体、新增产线清线与 PLC 监控实时推送、看板双屏增强
- 移除实体:MES 删除 FlowMaterial(工艺物料)与 MixProductionTemplate(混产模板)全套(schema/ent 生成码/handler/logic),清理关联路由与种子 - 新增功能:产线清线(line_clearance handler + logic)、PLC 监控 WebSocket 实时推送(ws/plc_monitor_hub + handler) - 看板增强:新增管理屏与 KPI 组件(BoardManage/BoardKpi),调整演示屏 Mock 与各看板面板 - MES 完善:PLC 匹配/扭矩扫描/签收、工艺卡 PDF 与工单、AGV 链路、叫料/备料/在制品/短料预测等逻辑与前端调整 - 工位终端:删除离线面板 OfflinePanel,调整主界面/物料面板与 api/store/handler/路由 - WMS:AGV 托盘、物料与 MES 客户端调整及前端帮助/基础数据/叫料/托盘页 - 文档:更新产线API/客户问题/案例/部署手册/问题记录
This commit is contained in:
@@ -42,12 +42,8 @@ type Client interface {
|
||||
QueryTask(ctx context.Context, taskCode string) (status string, agvCode string, err error)
|
||||
// CancelTask 取消任务(按 taskCode)。
|
||||
CancelTask(ctx context.Context, taskCode, reason string) error
|
||||
// ContinueTask 继续任务(3.1.4):让 RCS 继续/完成当前挂起的任务。
|
||||
// C01「空车接货到位等待」专用——车到接货点停下后 RCS 任务挂起(taskStatus 恒 2、不发 end 回调),
|
||||
// 2026-11-17 用户定案:下发下一段前必须先 continueTask 让 C01 完结,再 genAgvSchedulingTask。
|
||||
// 触发方式 taskCode/agvCode/wbCode/podCode 四选一,文档推荐 taskCode,与模板触发类型一致。
|
||||
ContinueTask(ctx context.Context, taskCode string) error
|
||||
// QueryAgvStatus 只读获取车辆状态(3.1.7 queryAgvStatus):车辆闲忙/充电/电量/位置。
|
||||
// QueryAgvStatus 获取车辆状态(3.1.7 queryAgvStatus):车辆闲忙/充电/电量/位置。
|
||||
// 用于并发闸门取 AGV 总数 + 人工派车状态点展示。
|
||||
// 纯只读展示,不参与调度(调度完全交给 RCS 自身)。
|
||||
// mapShortName 地图简称由上层从「基础设置」sys_config 读入传入(yaml 不再配置);空值的硬校验在上层做。
|
||||
QueryAgvStatus(ctx context.Context, mapShortName string) ([]AgvVehicle, error)
|
||||
@@ -63,7 +59,8 @@ type AgvVehicle struct {
|
||||
PodCode string `json:"podCode"` // 背货架编号(0/空=未背货)
|
||||
PosX float64 `json:"posX"`
|
||||
PosY float64 `json:"posY"`
|
||||
Stop bool `json:"stop"` // 是否暂停
|
||||
Stop bool `json:"stop"` // 是否暂停
|
||||
ExclType string `json:"exclType"` // 1=该车已被排除调度(并发闸门 N 不计入)
|
||||
}
|
||||
|
||||
// New 依据配置返回真实或 Mock 客户端
|
||||
@@ -215,7 +212,15 @@ func (c *realClient) callAt(ctx context.Context, reqURL string, payload map[stri
|
||||
}
|
||||
var env envelope
|
||||
if err := json.Unmarshal(raw, &env); err != nil {
|
||||
return fmt.Errorf("agv parse envelope: %w", err)
|
||||
// 海康网关/部署机的拦截页常返回非 JSON 文本(如 "Internal Server Error" 以 'I' 开头),
|
||||
// 典型成因:本机 IP 不在海康 RCS 白名单。原始解析错误("invalid character ... looking for
|
||||
// beginning of value")用户看不懂,转成可操作提示;原文截断保留便于运维排查。
|
||||
snippet := strings.TrimSpace(string(raw))
|
||||
if len(snippet) > 160 {
|
||||
snippet = snippet[:160] + "…"
|
||||
}
|
||||
logx.WithContext(ctx).Errorf("[AGV]"+commTag+" <-- non-JSON response url=%s httpStatus=%d raw=%s parseErr=%v", reqURL, resp.StatusCode, snippet, err)
|
||||
return fmt.Errorf("网络配置错误:请检查本机IP是否在海康RCS白名单内(RCS返回非JSON内容,网关可能已拦截):%s", snippet)
|
||||
}
|
||||
// 成功码固定字符串 "0"(§1.5 结果码定义)
|
||||
if env.Code != "0" {
|
||||
@@ -336,14 +341,6 @@ func (c *realClient) CancelTask(ctx context.Context, taskCode, reason string) er
|
||||
return c.call(ctx, "/cancelTask", payload, nil)
|
||||
}
|
||||
|
||||
// ContinueTask 实现 Client:3.1.4 continueTask,让 RCS 继续/完成挂起任务(C01 到位等待收尾)。
|
||||
func (c *realClient) ContinueTask(ctx context.Context, taskCode string) error {
|
||||
if taskCode == "" {
|
||||
return fmt.Errorf("缺少任务单号")
|
||||
}
|
||||
return c.call(ctx, "/continueTask", map[string]any{"taskCode": taskCode}, nil)
|
||||
}
|
||||
|
||||
// queryAgvStatusData 3.1.7 单条车辆状态 data 项(字段兼容字符串/数字)
|
||||
type queryAgvStatusData struct {
|
||||
RobotCode flexString `json:"robotCode"`
|
||||
@@ -353,6 +350,7 @@ type queryAgvStatusData struct {
|
||||
PosX flexString `json:"posX"`
|
||||
PosY flexString `json:"posY"`
|
||||
Stop flexString `json:"stop"`
|
||||
ExclType flexString `json:"exclType"`
|
||||
}
|
||||
|
||||
// QueryAgvStatus 实现 Client:3.1.7 只读获取全部车辆状态。
|
||||
@@ -382,6 +380,7 @@ func (c *realClient) QueryAgvStatus(ctx context.Context, mapShortName string) ([
|
||||
PosX: atof(string(d.PosX)),
|
||||
PosY: atof(string(d.PosY)),
|
||||
Stop: d.Stop == "1" || d.Stop == "true",
|
||||
ExclType: string(d.ExclType),
|
||||
})
|
||||
}
|
||||
return vs, nil
|
||||
@@ -419,12 +418,6 @@ func (m *mockClient) CancelTask(ctx context.Context, taskCode, reason string) er
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContinueTask Mock:模拟继续成功(与真实语义一致:RCS 收到后完成挂起任务)。
|
||||
func (m *mockClient) ContinueTask(ctx context.Context, taskCode string) error {
|
||||
logx.WithContext(ctx).Infof("[AGV]"+commTag+"[MOCK] ContinueTask taskCode=%s(模拟继续成功)", taskCode)
|
||||
return nil
|
||||
}
|
||||
|
||||
// QueryAgvStatus Mock:返回两台示例车(一台空闲、一台执行中),便于联调展示。
|
||||
func (m *mockClient) QueryAgvStatus(ctx context.Context, mapShortName string) ([]AgvVehicle, error) {
|
||||
logx.WithContext(ctx).Infof("[AGV]" + commTag + "[MOCK] QueryAgvStatus(模拟返回样例车 9001/9002)")
|
||||
|
||||
Reference in New Issue
Block a user