TvStatisticController.java 5.68 KB
package com.huaheng.api.tv.controller;

import java.util.Collections;
import java.util.List;

import javax.annotation.Resource;

import com.huaheng.api.tv.domain.TvStatisticBean;
import com.huaheng.api.tv.service.TvStatisticService;
import com.huaheng.common.utils.StringUtils;
import com.huaheng.common.utils.WarehouseEnum;
import com.huaheng.framework.aspectj.lang.annotation.ApiLogger;
import com.huaheng.framework.web.domain.AjaxResultTv;
import org.springframework.web.bind.annotation.*;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.huaheng.api.tv.domain.TvBean;
import com.huaheng.api.wcs.domain.WcsTask;
import com.huaheng.common.constant.QuantityConstant;
import com.huaheng.common.utils.Wrappers;
import com.huaheng.framework.web.controller.BaseController;
import com.huaheng.framework.web.domain.AjaxResult;
import com.huaheng.pc.config.container.domain.Container;
import com.huaheng.pc.config.container.service.ContainerService;
import com.huaheng.pc.config.location.domain.Location;
import com.huaheng.pc.config.location.service.LocationService;
import com.huaheng.pc.config.material.domain.Material;
import com.huaheng.pc.config.material.service.MaterialService;
import com.huaheng.pc.config.zone.domain.Zone;
import com.huaheng.pc.config.zone.service.ZoneService;
import com.huaheng.pc.inventory.InventoryMaterialSummary.domain.InventoryMaterialSummary;
import com.huaheng.pc.inventory.InventoryMaterialSummary.service.InventoryMaterialSummaryService;
import com.huaheng.pc.inventory.inventoryDetail.domain.InventoryDetail;
import com.huaheng.pc.inventory.inventoryDetail.service.InventoryDetailService;
import com.huaheng.pc.inventory.inventoryTransaction.service.InventoryTransactionService;
import com.huaheng.pc.task.taskHeader.domain.TaskHeader;
import com.huaheng.pc.task.taskHeader.service.TaskHeaderService;

import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping("/api")
public class TvStatisticController extends BaseController {


    @Resource
    private TvStatisticService tvStatisticService;




    @PostMapping("/getInventoryData")
    @ApiOperation("立库信息查询接口")
    @ResponseBody
    @CrossOrigin
//    @ApiLogger(apiName = "立库库存查询接口", from = "tv")
    public AjaxResultTv getInventoryData(@RequestBody TvStatisticBean tvStatisticBean) {
        String Requestor= tvStatisticBean.getRequestor();
        String InventoryCode= tvStatisticBean.getInventoryCode();
        if(StringUtils.isEmpty(Requestor)){
            return AjaxResultTv.error("Requestor为空");
        }
        String warehouseCode=WarehouseEnum.getWarehouseCode(Requestor);
        if(StringUtils.isEmpty(warehouseCode)){
            return AjaxResultTv.error("Requestor错误");
        }
        return tvStatisticService.getInventoryData(warehouseCode,InventoryCode);
    }
    @PostMapping("/getMaterialData")
    @ApiOperation("立库信息查询接口")
    @ResponseBody
    @CrossOrigin
//    @ApiLogger(apiName = "立库物料查询接口", from = "tv")
    public AjaxResultTv getMaterialData(@RequestBody TvStatisticBean tvStatisticBean) {
        String Requestor= tvStatisticBean.getRequestor();
        String container= tvStatisticBean.getContainer();
        if(StringUtils.isEmpty(Requestor)||StringUtils.isEmpty(container)){
            return AjaxResultTv.error("Requestor或container为空");
        }
        String warehouseCode=WarehouseEnum.getWarehouseCode(Requestor);
        if(StringUtils.isEmpty(warehouseCode)){
            return AjaxResultTv.error("Requestor错误");
        }
        return tvStatisticService.getMaterialData(warehouseCode,container);
    }
    @PostMapping("/getTaskData")
    @ApiOperation("立库任务信息查询接口")
    @ResponseBody
    @CrossOrigin
    @ApiLogger(apiName = "立库任务查询接口", from = "tv")
    public AjaxResultTv getTaskData(@RequestBody TvStatisticBean tvStatisticBean) {
        String Requestor= tvStatisticBean.getRequestor();
        String InventoryCode= tvStatisticBean.getInventoryCode();
        if(StringUtils.isEmpty(Requestor)){
            return AjaxResultTv.error("Requestor");
        }
        String warehouseCode=WarehouseEnum.getWarehouseCode(Requestor);
        if(StringUtils.isEmpty(warehouseCode)){
            return AjaxResultTv.error("Requestor错误");
        }
        return tvStatisticService.getTaskData(warehouseCode,InventoryCode);
    }
    @PostMapping("/getTaskDetailData")
    @ApiOperation("立库信息查询接口")
    @ResponseBody
    public AjaxResultTv getTaskDetailData(@RequestBody TvStatisticBean tvStatisticBean) {
        Integer id= tvStatisticBean.getId();
        if(StringUtils.isNull(id)){
            return AjaxResultTv.error("id为空");
        }

        return tvStatisticService.getTaskDetailData(id);
    }

    @PostMapping("/getReportData")
    @ApiOperation("立库报表查询接口")
    @ResponseBody
    @CrossOrigin
    @ApiLogger(apiName = "立库报表查询接口", from = "tv")
    public AjaxResultTv getReportData(@RequestBody TvStatisticBean tvStatisticBean)throws Exception {
        String Requestor= tvStatisticBean.getRequestor();
        String InventoryCode= tvStatisticBean.getInventoryCode();
        String dateType=tvStatisticBean.getDateType();
        if(StringUtils.isEmpty(Requestor)||StringUtils.isEmpty(InventoryCode)||StringUtils.isEmpty(dateType)){
            return AjaxResultTv.error("Requestor或InventoryCode或dateType为空");
        }
        String warehouseCode=WarehouseEnum.getWarehouseCode(Requestor);
        if(StringUtils.isEmpty(warehouseCode)){
            return AjaxResultTv.error("Requestor错误");
        }

        return tvStatisticService.getReportData(warehouseCode,InventoryCode,dateType);
    }
}