package com.prolog.cs.biz.outbound.controller;

import com.prolog.cs.biz.outbound.model.entity.BillDPrePositionDO;
import com.prolog.cs.biz.outbound.model.vo.BillDPrePositionVO;
import com.prolog.cs.biz.outbound.model.vo.check.InnerCheckBillVO;
import com.prolog.cs.biz.outbound.service.BillDPrePositionService;
import com.prolog.framework.common.message.RestMessage;
import com.prolog.framework.log.aop.annotation.UserLog;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author denglt
 * @since 2021-06-12
 */
@RestController
@RequestMapping("/billDPrePosition")
@Api(tags = "指定货位下发")
public class BillDPrePositionController {
    @Autowired
    private BillDPrePositionService billDPrePositionService;

    @UserLog
    @ApiOperation(value = "指定货位")
    @PostMapping("/assignPosition")
    public RestMessage<Boolean> assignPosition(@RequestBody List<BillDPrePositionVO> positions) {
        return billDPrePositionService.assignPosition(positions);
    }

    @UserLog
    @ApiOperation(value = "指定货位")
    @GetMapping ("/getPositions")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "billDId", value = "订单明细id", required = true)
    })
    public RestMessage<List<BillDPrePositionDO>> getPositions(String billDId) {

        return billDPrePositionService.getPositions(billDId);

    }

}

