package com.shkj.wms.controller.temp;

import com.shkj.common.annotation.RepeatSubmit;
import com.shkj.common.core.controller.BaseController;
import com.shkj.common.core.domain.Result;
import com.shkj.wms.bo.BaseBarcodesOutQueryBo;
import com.shkj.wms.domain.BaseBarcodesIn;
import com.shkj.wms.service.IBaseBarcodesInService;
import com.shkj.wms.service.IBaseBarcodesOutService;
import com.shkj.wms.service.IBaseGoodsDataService;
import com.shkj.wms.vo.BaseBarcodesOutVo;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api("条码信息")
@RequiredArgsConstructor(onConstructor_ =@Autowired)
@RestController
@RequestMapping("/wms/barcodes")
public class BaseBarcodesController extends BaseController {

    @Autowired
    IBaseBarcodesInService iBaseBarcodesInService;
    @Autowired
    IBaseGoodsDataService iBaseGoodsDataService;

    @Autowired
    IBaseBarcodesOutService iBaseBarcodesOutService;

    /**
     * 获取入库条码信息
     */
    @GetMapping("/checkQrCode")
    @RepeatSubmit
    public Result<BaseBarcodesIn> checkQrCode(@RequestParam("qrCode") String qrCode){
        return iBaseBarcodesInService.getBaseBarcodesInByQrCode(qrCode);
    }


    /**
     * 获取保险杠所有颜色
     */
    @GetMapping("/getBumperColor")
    @RepeatSubmit
    public Result<String> getBumperColor(){
        return Result.ok().data(iBaseGoodsDataService.getBumperColor());
    }


    /**
     * 获取保险杠所有车型
     */
    @GetMapping("/getBumperVehicheModel")
    @RepeatSubmit
    public Result<String> getBumperVehicheModel(){
        return Result.ok().data(iBaseGoodsDataService.getBumperVehicheModel());
    }

    /**
     * 获取保险杠所有派生
     */
    @GetMapping("/getBumperDerive")
    @RepeatSubmit
    public Result<String> getBumperDerive(){
        return Result.ok().data(iBaseGoodsDataService.getBumperDerive());
    }

    /**
     * 根据车型代码/派生获取待出库数据
     */
    @GetMapping("/getBarcodesOutData")
    @RepeatSubmit
    public Result<Boolean> getBarcodesOutData(BaseBarcodesOutQueryBo bo){
        List<BaseBarcodesOutVo> outVoList = iBaseBarcodesOutService.getBarcodesOutData(bo);
        return Result.ok().data(outVoList);
    }

    /**
     * 查询获取位置代码
     */
    @GetMapping("/getBumperType")
    @RepeatSubmit
    public Result<String> getBumperType(){
        return Result.ok().data(iBaseGoodsDataService.getBumperLocationCode());
    }

}
