package com.wms_main.service.controller.serviceImpl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.wms_main.dao.impl.TAppOutsServiceImpl;
import com.wms_main.dao.impl.TAppPickTaskServiceImpl;
import com.wms_main.dao.impl.TAppTaskServiceImpl;
import com.wms_main.model.po.TAppOuts;
import com.wms_main.model.po.TAppPickTask;
import com.wms_main.service.controller.IDataControllerService;
import com.wms_main.model.po.TAppTask;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 数据控制器服务实现类
 */
@Service
@RequiredArgsConstructor
public class DataControllerServiceImpl implements IDataControllerService {

    private final TAppTaskServiceImpl tAppTaskService;
    private final TAppOutsServiceImpl tAppOutsService;
    private final TAppPickTaskServiceImpl tAppPickTaskService;

    /**
     * 获取任务类型为1的任务数据
     * @return 任务类型为1的任务列表
     */
    @Override
    public List<TAppTask> getTaskTypInData(int pageNum,int pageSize) {
        LambdaQueryWrapper<TAppTask> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(TAppTask::getTaskType, 1);
        return tAppTaskService.page(new Page<>(pageNum, pageSize), queryWrapper).getRecords();
    }

    /**
     * 获取出库数据
     * @return 出库数据列表
     */
    @Override
    public List<TAppOuts> getOutsData(int pageNum, int pageSize) {
        LambdaQueryWrapper<TAppOuts> queryWrapper = new LambdaQueryWrapper<>();
        return tAppOutsService.page(new Page<>(pageNum, pageSize), queryWrapper).getRecords();
    }

    /**
     * 获取拣选任务数据
     * @return 拣选任务数据列表
     */
    @Override
    public List<TAppPickTask> getPickTaskData(int pageNum, int pageSize) {
        LambdaQueryWrapper<TAppPickTask> queryWrapper = new LambdaQueryWrapper<>();
        return tAppPickTaskService.page(new Page<>(pageNum, pageSize), queryWrapper).getRecords();
    }
}
