package com.fizz.business.controller;

import com.fizz.business.service.DashboardService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 首页仪表板相关接口
 */
@RestController
public class DashboardController extends BaseController {

    @Resource
    private DashboardService dashboardService;

    /**
     * 当前生产中的计划信息（crm_pdi_plan.status = 'PRODUCING'）
     */
    @GetMapping("/api/business/dashboard/currentPlan")
    public AjaxResult getCurrentProducingPlan() {
        return AjaxResult.success(dashboardService.getCurrentProducingPlan());
    }

    /**
     * 当前生产卷的关键工艺参数
     * - 从 cpl_segment_total.total_values_json 解析
     * - 键名来自 DeviceEnum.paramFields
     */
    @GetMapping("/api/business/dashboard/currentProcess")
    public AjaxResult getCurrentProcessParams() {
        return AjaxResult.success(dashboardService.getCurrentProcessParams());
    }
}

