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

import com.prolog.rdc.tms.app.model.vo.business.*;
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.WaitPickUpGoodsQueryByShipbillDTO;
import com.prolog.rdc.tms.app.service.business.WaitPickUpGoodsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import javax.validation.Valid;

/**
 * 业务APP-待提货控制层
 *
 *
 * @author xiaoyf
 * @since 2022/6/8 10:38
 */
@RestController
@Api(tags = "业务APP-待提货控制层")
@RequestMapping("/waitPickUpGoods")
public class WaitPickUpGoodsController {

	@Autowired
	private WaitPickUpGoodsService service;

	@UserLog("运单分页查询")
	@ApiOperation(value = "运单分页查询", notes = "运单分页查询")
	@PostMapping("/query_shipbill")
	public RestMessage<Page<WaitPickUpGoodsQueryByShipbillDTO>> queryShipbill(@RequestBody WaitPickUpGoodsQueryByShipbillVO waitPickUpGoodsQueryByShipbillVO) {
		Page<WaitPickUpGoodsQueryByShipbillDTO> page = service.queryShipbill(waitPickUpGoodsQueryByShipbillVO);
		return RestMessage.newInstance(true, "查询成功！", page);
	}

	@UserLog("签到")
	@ApiOperation(value = "签到", notes = "签到")
	@PostMapping("/sign")
	public RestMessage<Object> sign(@RequestBody @Valid WaitDeliveredSignVO vo) throws Exception {
		service.sign(vo);
		return RestMessage.newInstance(true, "操作成功！", null);
	}

	@UserLog("启运登记")
	@ApiOperation(value = "启运登记", notes = "启运登记")
	@PostMapping("/start_shipment")
	public RestMessage<Boolean> startShipmentExecute(@RequestBody WaitPickUpGoodsStartShipmentVO waitPickUpGoodsStartShipmentVO) {
		return RestMessage.newInstance(true, "操作成功！", service.startShipmentData(waitPickUpGoodsStartShipmentVO));
	}

}
