package com.wms_main.controller.wms;

import com.wms_main.model.po.TAppInventory;
import com.wms_main.model.po.TAppOuts;
import com.wms_main.model.po.TAppPickTask;
import com.wms_main.model.po.TAppTask;
import com.wms_main.service.controller.IDataControllerService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.List;

/**
 * 看板数据类
 */
@RestController
@ResponseBody
@CrossOrigin
@RequiredArgsConstructor
@RequestMapping("/wms/board")
public class DataController {
    private final IDataControllerService dataControllerService;


    /**
     * 获取入库数据
     */
    @GetMapping("/getTaskTypInData")
    public Object getTaskTypInData(@RequestParam(defaultValue = "1") int pageNum,
                                   @RequestParam(defaultValue = "10") int pageSize,
                                   @RequestParam(defaultValue = "1") int standId) {
        try {
            return dataControllerService.getTaskTypInData(pageNum, pageSize, standId);
        } catch (Exception e) {
            return "获取入库数据失败: " + e.getMessage();
        }
    }

    /**
     * 获取出库数据
     */
    @GetMapping("/getOutsData")
    public Object getOutsData(@RequestParam(defaultValue = "1") int pageNum,
                              @RequestParam(defaultValue = "10") int pageSize) {
        try {
            return dataControllerService.getOutsData(pageNum, pageSize);
        } catch (Exception e) {
            return "获取出库数据失败: " + e.getMessage();
        }
    }

    /**
     * 获取拣选任务
     */
    @GetMapping("/getPickTaskDataP1")
    public Object getPickTaskDataP1(@RequestParam(defaultValue = "1") int pageNum,
                                   @RequestParam(defaultValue = "10") int pageSize) {
        try {
            return dataControllerService.getPickTaskDataP1(pageNum, pageSize);
        } catch (Exception e) {
            return "获取拣选任务失败: " + e.getMessage();
        }
    }

    @GetMapping("/getPickTaskDataP2")
    public Object getPickTaskDataP2(@RequestParam(defaultValue = "1") int pageNum,
                                    @RequestParam(defaultValue = "10") int pageSize) {
        try {
            return dataControllerService.getPickTaskDataP2(pageNum, pageSize);
        } catch (Exception e) {
            return "获取拣选任务失败: " + e.getMessage();
        }
    }

    @GetMapping("/getPickTaskDataP3")
    public Object getPickTaskDataP3(@RequestParam(defaultValue = "1") int pageNum,
                                    @RequestParam(defaultValue = "10") int pageSize) {
        try {
            return dataControllerService.getPickTaskDataP3(pageNum, pageSize);
        } catch (Exception e) {
            return "获取拣选任务失败: " + e.getMessage();
        }
    }
}
