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

import com.prolog.cs.biz.outbound.model.SaleRedRecord;
import com.prolog.cs.biz.outbound.model.dto.RedDTO;
import com.prolog.cs.biz.outbound.service.RedService;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

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

@Api(tags = "红冲")
@RestController
@RequestMapping("/red")
public class RedController {
    @Autowired
    private RedService redService;

    @UserLog
    @ApiOperation(value = "oms订单整单冲红")
    @PostMapping("/omsbill")
    public RestMessage<Boolean> makeRed(@RequestBody RedDTO redDTO) {
        return redService.makeOmsBillRed(redDTO);
    }


    @UserLog
    @ApiOperation(value = "oms订单商品冲红")
    @PostMapping("/omsbill/item")
    public RestMessage<Boolean> makeBillItemRed(@RequestBody RedDTO redDTO) {
        return redService.makeOmsBillItemRed(redDTO);
    }

    @UserLog
    @ApiOperation(value = "oms订单商品查询")
    @GetMapping("/omsbill/item/query")
    public RestMessage<List<SaleRedRecord>> omsRedRecordQuery(@RequestParam String billId, @RequestParam String lineBillId) {
        return redService.omsRedRecordQuery(billId,lineBillId);
    }


}
