package com.aucma.report.controller;

import com.aucma.common.annotation.Anonymous;
import com.aucma.common.core.controller.BaseController;
import com.aucma.common.core.domain.AjaxResult;
import com.aucma.report.service.IBoard4Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Board4看板数据Controller
 * 数字化注塑车间管控中心
 *
 * @author YinQ
 */
@RestController
@RequestMapping("/board4")
public class Board4Controller extends BaseController {

    @Autowired
    private IBoard4Service board4Service;

    /**
     * 获取产量统计（年累计、月累计、日累计）
     */
    @Anonymous
    @GetMapping("/productionTotal")
    public AjaxResult getProductionTotal() {
        return success(board4Service.getProductionTotal());
    }

    /**
     * 获取今日工单统计（计划数、完成数、差异数、完成率）
     */
    @Anonymous
    @GetMapping("/orderStatistics")
    public AjaxResult getOrderStatistics() {
        return success(board4Service.getOrderStatistics());
    }

    /**
     * 获取今日工单进度列表
     */
    @Anonymous
    @GetMapping("/orderProgressList")
    public AjaxResult getOrderProgressList() {
        return success(board4Service.getOrderProgressList());
    }

    /**
     * 获取设备状态统计
     */
    @Anonymous
    @GetMapping("/deviceStatus")
    public AjaxResult getDeviceStatus() {
        return success(board4Service.getDeviceStatus());
    }

    /**
     * 获取最新报警信息
     */
    @Anonymous
    @GetMapping("/alarmInfo")
    public AjaxResult getAlarmInfo() {
        return success(board4Service.getAlarmInfo());
    }

    /**
     * 获取维修分析列表（按设备聚合）
     */
    @Anonymous
    @GetMapping("/repairAnalysisList")
    public AjaxResult getRepairAnalysisList() {
        return success(board4Service.getRepairAnalysisList());
    }

    /**
     * 获取报修趋势列表
     */
    @Anonymous
    @GetMapping("/repairTrendList")
    public AjaxResult getRepairTrendList() {
        return success(board4Service.getRepairTrendList());
    }

    /**
     * 获取质量统计
     */
    @Anonymous
    @GetMapping("/qualityStatistics")
    public AjaxResult getQualityStatistics() {
        return success(board4Service.getQualityStatistics());
    }

    /**
     * 获取质量追溯列表
     */
    @Anonymous
    @GetMapping("/qualityTraceList")
    public AjaxResult getQualityTraceList() {
        return success(board4Service.getQualityTraceList());
    }

    /**
     * 获取设备分析/产量列表
     */
    @Anonymous
    @GetMapping("/deviceProductionList")
    public AjaxResult getDeviceProductionList() {
        return success(board4Service.getDeviceProductionList());
    }

    /**
     * 获取18台设备开模数列表（昨日07:00-今日07:00）
     */
    @Anonymous
    @GetMapping("/deviceOpeningCountList")
    public AjaxResult getDeviceOpeningCountList() {
        return success(board4Service.getDeviceOpeningCountList());
    }
}
