package com.shkj.wcs.controller.busin;


import com.shkj.common.annotation.Log;
import com.shkj.common.annotation.RepeatSubmit;
import com.shkj.common.core.controller.BaseController;
import com.shkj.common.core.domain.Result;
import com.shkj.common.enums.BusinessType;
import com.shkj.common.utils.SecurityUtils;
import com.shkj.wms.bo.BusinContainerUpkeepAddBo;
import com.shkj.wms.bo.BusinContainerUpkeepQueryBo;
import com.shkj.wcs.service.IBusinContainerUpkeepService;
import com.shkj.wms.vo.BusinContainerUpkeepVo;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

@Api("治具保养入库相关")
@RequiredArgsConstructor(onConstructor_ =@Autowired)
@RestController
@RequestMapping("/wcs/businContainer")
public class BusinContainerUpkeepController extends BaseController {

    @Resource
    IBusinContainerUpkeepService iBusinContainerUpkeepService;


    @Log(title = "根据托盘编号，获取托盘上次保养时间",businessType = BusinessType.UPDATE)
    @GetMapping("/getContainerUpkeepDate")
    @RepeatSubmit
    public Result<BusinContainerUpkeepVo> getContainerUpkeepDate(BusinContainerUpkeepQueryBo bo) {

        List<BusinContainerUpkeepVo> upkeepVos = iBusinContainerUpkeepService.getContainerUpkeepDate(bo);
        return Result.ok().data(upkeepVos);
    }


    @Log(title = "App治具入库-确认入库",businessType = BusinessType.UPDATE)
    @PostMapping("/saveBusintContainerPutInStorage")
    @RepeatSubmit
    public Result<Boolean> saveBusintContainerUpkeepEnd(@Valid @RequestBody BusinContainerUpkeepAddBo bo) {
        return iBusinContainerUpkeepService.saveBusintContainerUpkeepEnd(bo);

    }

    @Log(title = "App治具保养-确认取出",businessType = BusinessType.UPDATE)
    @PostMapping("/saveBusintContainerUpkeep")
    @RepeatSubmit
    public Result<Boolean> saveBusintContainerUpkeepStart(@Valid @RequestBody BusinContainerUpkeepAddBo bo) {
        return iBusinContainerUpkeepService.saveBusintContainerUpkeepStart(bo);

    }
}
