package com.prolog.cs.biz.inbound.controller.rqc;

import com.prolog.cs.biz.inbound.dto.rqc.RqcLinesDTO;
import com.prolog.cs.biz.inbound.dto.rqc.WmsInRqcSampleDTO;
import com.prolog.cs.biz.inbound.service.rqc.WmsInRqcSampleService;
import com.prolog.framework.common.message.RestMessage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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 javax.annotation.Resource;
import java.util.List;

/**
 * @Description // TODO
 * @Date 2021-05-20
 */

@Api(tags = "质检抽样")
@RestController
@RequestMapping("/wmsInRqcSample")
public class WmsInRqcSampleController {

	@Resource
	private WmsInRqcSampleService wmsInRqcSampleService;

	/**
	 * 获取抽检的集合
	 */
	@ApiOperation("获取预抽样集合")
	@PostMapping("v1/get-prelist")
	public RestMessage<List<WmsInRqcSampleDTO>> getPreList(@RequestBody List<RqcLinesDTO> rqcLinesDTOList) {
		return RestMessage.newInstance(true, "getPreList", wmsInRqcSampleService.getPreList(rqcLinesDTOList));
	}

	/**
	 * 批量添加抽检
	 */
	@ApiOperation(value = "批量添加抽检")
//	@ApiResponse(message = "返回数据为List<Map>的结构", code = 200)
	@PostMapping("v1/batchAdd")
	public RestMessage<Object> batchAdd(@RequestBody List<WmsInRqcSampleDTO> wmsInRqcSampleDTOList) {
		String type ="normal";
		return RestMessage.newInstance(true, "batchAddSuccess", wmsInRqcSampleService.batchAdd(wmsInRqcSampleDTOList,type));
	}
	/**
	 * 获取抽检的集合pad
	 * 
	 */
	@ApiOperation("Pad获取预抽样集合")
	@PostMapping("v1/pad/get-prelist")
	public RestMessage<List<WmsInRqcSampleDTO>> getPreListByPad(@RequestBody List<RqcLinesDTO> rqcLinesDTOList) {
		return RestMessage.newInstance(true, "getPreList", wmsInRqcSampleService.getPreListByPad(rqcLinesDTOList));
	}
	
	/**
	 * 批量添加抽检pad
	 */
	@ApiOperation(value = "Pad批量添加抽检")
	@PostMapping("v1/pad/batchAdd")
	public RestMessage<Object> batchAddByPad(@RequestBody List<WmsInRqcSampleDTO> wmsInRqcSampleDTOList) {
		return RestMessage.newInstance(true, "batchAddSuccess", wmsInRqcSampleService.batchAddByPad(wmsInRqcSampleDTOList));
	}

}
