package com.fjhx.controller.stock;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.base.Condition;
import com.fjhx.service.contract.ContractDetailsService;
import com.fjhx.service.water.WaterDetailService;
import org.springblade.core.tool.api.R;
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;

/**
 * 库存报表相关接口
 */
@RestController
@RequestMapping("/reportForm")
public class ReportFormController {

    @Autowired
    private WaterDetailService waterDetailService;

    @Autowired
    private ContractDetailsService contractDetailsService;

    /**
     * 领料序时浦 统计
     */
    @PostMapping("pickingStatistics")
    public R pickingStatistics(@RequestBody Condition condition) {
        Map<String, Object> result = waterDetailService.pickingStatistics(condition);
        return R.success(result);
    }

    /**
     * 领料序时浦 领料类型统计
     */
    @PostMapping("pickingTypeStatistics")
    public R pickingTypeStatistics(@RequestBody Condition condition) {
        Map<String, Integer> result = waterDetailService.pickingTypeStatistics(condition);
        return R.success(result);
    }

    /**
     * 领料序时浦 分页
     */
    @PostMapping("pickingPage")
    public R pickingPage(@RequestBody Condition condition) {
        Page<Map<String, Object>> result = waterDetailService.pickingPage(condition);
        return R.success(result);
    }

    /**
     * 入库序时浦 分页
     */
    @PostMapping("warehousingPage")
    public R warehousingPage(@RequestBody Condition condition) {
        Page<Map<String, Object>> result = contractDetailsService.warehousingPage(condition);
        return R.success(result);
    }


}
