package com.prolog.rdc.tms.app.controller.business;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
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 com.prolog.framework.common.message.RestMessage;
import com.prolog.framework.core.pojo.Page;
import com.prolog.framework.log.aop.annotation.UserLog;
import com.prolog.rdc.tms.app.model.dto.business.WaitForArrangeGoodsDTO;
import com.prolog.rdc.tms.app.model.dto.business.WaitForArrangeGoodsQueryDTO;
import com.prolog.rdc.tms.app.model.vo.business.WaitForArrangeGoodsQueryVO;
import com.prolog.rdc.tms.app.model.vo.business.WaitForArrangeGoodsVO;
import com.prolog.rdc.tms.app.service.business.WaitForArrangeGoodsService;

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

/**
 * 待理货控制层
 *
 * Company: 湖北普罗格科技股份有限公司
 *
 * @author zhangsj
 * @since 2022/7/22 12:42
 */
@RestController
@Api(tags = "业务APP-待理货控制层")
@RequestMapping("/waitForArrangeGoods")
public class WaitForArrangeGoodsController {

	@Autowired
	private WaitForArrangeGoodsService waitForArrangeGoodsService;

	@UserLog("主页查询")
	@ApiOperation(value = "主页查询", notes = "主页查询")
	@PostMapping("/query")
	public RestMessage<Page<WaitForArrangeGoodsDTO>> queryExecute(@RequestBody WaitForArrangeGoodsVO waitForArrangeGoodsVO) throws Exception {
		Page<WaitForArrangeGoodsDTO> dto = waitForArrangeGoodsService.queryData(waitForArrangeGoodsVO);
		return RestMessage.newInstance(true, "查询成功！", dto);
	}

	@UserLog("开始理货")
	@ApiOperation(value = "开始理货", notes = "开始理货")
	@PostMapping("/startArrangeGoods")
	public RestMessage<Object> startArrangeGoods(@RequestBody List<String> ids) {
		waitForArrangeGoodsService.startArrangeGoods(ids);
		return RestMessage.newInstance(true, "审核成功！", null);
	}

	@UserLog("理货完成")
	@ApiOperation(value = "理货完成", notes = "理货完成")
	@PostMapping("/completeArrangeGoods")
	public RestMessage<Object> completeArrangeGoods(@RequestBody List<String> ids) {
		waitForArrangeGoodsService.completeArrangeGoods(ids);
		return RestMessage.newInstance(true, "审核成功！", null);
	}

	@UserLog("查询运单")
	@ApiOperation(value = "查询运单", notes = "查询运单")
	@PostMapping("/query_shipbill")
	public RestMessage<Page<WaitForArrangeGoodsQueryDTO>> queryShipbillExecute(@RequestBody WaitForArrangeGoodsQueryVO waitForArrangeGoodsQueryVO) {
		Page<WaitForArrangeGoodsQueryDTO> list = waitForArrangeGoodsService.queryShipbillData(waitForArrangeGoodsQueryVO);
		return RestMessage.newInstance(true, "查询成功！", list);
	}

}
