package com.yh.saas.plugin.yiliangyiyun.controller;


import com.yh.saas.plugin.yiliangyiyun.entity.SourceRelationInfo;
import com.yh.saas.plugin.yiliangyiyun.entity.WarehouseInOutInfo;
import com.yh.saas.plugin.yiliangyiyun.entity.WarehousingOrder;
import com.yh.saas.plugin.yiliangyiyun.entity.view.PaymentView;
import com.yh.saas.plugin.yiliangyiyun.service.IWarehousingOrderService;
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.RequestMapping;
import com.baomidou.mybatisplus.plugins.Page;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;

import java.util.List;

/**
 * <p>
 * 记录入库单信息 前端控制器
 * </p>
 *
 * @author Gdc
 * @since 2022-05-17
 */
@RestController
@RequestMapping("/warehousingOrder")
public class WarehousingOrderController {
    @Autowired
    private IWarehousingOrderService warehousingOrderService;


    /**
     * 退库货源列表
     * @param warehouseInOutInfo
     * @return
     */
    @GetMapping("/getSourceOfGoodsList")
    public Page<SourceRelationInfo> getReturnSourceList(WarehouseInOutInfo warehouseInOutInfo){
        return warehousingOrderService.getReturnSourceList(warehouseInOutInfo);
    }
    /**
     * 出库货源列表
     *
     * @param warehousingOrder
     * @return
     */
    @GetMapping("/selectGoodSourceInfo")
    public Page<WarehousingOrder> selectGoodSourceInfo(WarehousingOrder warehousingOrder) {
        return warehousingOrderService.selectGoodSourceInfo(warehousingOrder);
    }
    /**
     * 入库单列表查询
     *
     * @param warehousingOrder
     * @return
     */
    @GetMapping("/selectInfo")
    public Page<WarehousingOrder> selectInfo(WarehousingOrder warehousingOrder) {
        return warehousingOrderService.selectInfo(warehousingOrder);
    }
    /**
     * 编辑
     */
    @PostMapping("/editInfo")
    public String editInfo(@RequestBody WarehousingOrder warehousingOrder) {
        return warehousingOrderService.editInfo(warehousingOrder);
    }
    /**
     * 付款
     * @param warehousingOrder
     * @return
     */
    @PostMapping("/api/payMoney")
    public String payMoney(@RequestBody WarehousingOrder warehousingOrder){
        return warehousingOrderService.payMoney(warehousingOrder);
    }
    /**
     * 手机审核文件下载
     *
     * @return
     * @throws Exception
     */
    @PostMapping("/exportPhone")
    public String exportPhone(@RequestBody WarehousingOrder example, HttpServletResponse response) throws Exception {
        return warehousingOrderService.exportPhone(example,response);
    }

    /**
     * 手机审核数据
     *
     * @return
     * @throws Exception
     */
    @PostMapping("/exportPhoneData")
    public WarehousingOrder exportPhoneData(@RequestBody WarehousingOrder warehousingOrder) {
        return warehousingOrderService.exportPhoneData(warehousingOrder);
    }

}

