package com.rongwei.bsserver.controller;


import com.rongwei.bscommon.sys.service.ApsReportRecordsService;
import com.rongwei.bsentity.domain.ApsReportRecordsDo;
import com.rongwei.bsentity.vo.SaveReportReq;
import com.rongwei.bsentity.vo.SmallRollStartReportReq;
import com.rongwei.bsentity.vo.StartRePortReq;
import com.rongwei.rwcommon.base.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * <p>
 * 作业报工记录 前端控制器
 * </p>
 *
 * @author sc
 * @since 2024-03-28
 */
@Slf4j
@RestController
@RequestMapping("/apsReportRecord")
public class ApsReportRecordController {
    @Autowired
    private ApsReportRecordsService apsReportRecordsService;

    /**
     * 取消报工
     *
     * @param req
     * @return
     */
    @PostMapping("/cancelRecord")
    public R cancelRecord(@RequestBody Map<String, String> req) {
        log.info("取消报工;参数为：{}", req);
        return apsReportRecordsService.cancelRecord(req);

    }

    /**
     * 开工
     */
    @PostMapping("/startReport")
    public R startReport(@RequestBody StartRePortReq req) {
        log.info("开工;参数为：{}", req);
        return apsReportRecordsService.startReport(req);
    }

    /**
     * 报工保存
     */
    @PostMapping("/saveReport")
    public R saveReport(@RequestBody SaveReportReq req) {
        log.info("报工保存;参数为：{}", req);
        return apsReportRecordsService.saveReport(req);
    }

    /**
     * 开工之后，查询是否存在未开工的合并工序
     */
    @PostMapping("/checkMergeProcess")
    public R checkMergeProcess(@RequestBody ApsReportRecordsDo req) {
        log.info("开工之后，查询是否存在未开工的合并工序;参数为：{}", req);
        return apsReportRecordsService.checkMergeProcess(req);
    }

    /**
     * 小卷开工
     */
    @PostMapping("/smallRollStartReport")
    public R smallRollStartReport(@RequestBody SmallRollStartReportReq req) {
        log.info("小卷开工;参数为：{}", req);
        return apsReportRecordsService.smallRollStartReport(req);
    }
}

