package com.fizz.business.controller;

import com.fizz.business.form.CalcPdiPlanForm;
import com.fizz.business.form.ModSetupResultForm;
import com.fizz.business.service.ModSetupResultService;
import com.fizz.business.vo.ModSetupResultVO;
import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.domain.R;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/api/setup")
@Tag(name ="设定值管理")
@Anonymous
public class ModSetupResultController {

    @Resource
    private ModSetupResultService modSetupResultService;

    // 查询所有记录
    @PostMapping("/list")
    @Operation(summary = "查询设定值列表")
    public R<List<ModSetupResultVO>> list(@RequestBody  ModSetupResultForm form) {
        return R.ok(modSetupResultService.list(form));
    }


    @PostMapping("/calc")
    @Operation(summary ="计算设定值")
    public R<String> calcSetup(@RequestBody CalcPdiPlanForm form) {
        return R.ok(modSetupResultService.calcSetup(form));
    }

    @GetMapping("/retry")
    @Operation(summary ="手动下发设定值")
    public R<String> retrySetup(@RequestParam  String coilid) {
        return R.ok(modSetupResultService.retrySetup(coilid));
    }

}