package com.sifang.modules.supply.stock.controller;

import com.sifang.modules.supply.stock.service.ExportService;
import com.sifang.modules.sys.web.BaseExceptionController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Map;

/**
 * @author hongzq
 */
@Controller
@RequestMapping(value = "${adminPath}/material/order/export")
public class ExportController extends BaseExceptionController {

    @Autowired
    ExportService exportService;

    /**
     * 供应链端 供应链仓下单的导出
     */
    @RequestMapping("exportDeliverOrder")
    public void exportDeliverOrder(HttpServletRequest request, HttpServletResponse response) throws IOException {
        Map<String, String> map = getParams(request);
        exportService.exportSupplyOrder(map, response);
    }

    /**
     * 供应商端发货单管理导出
     */
    @RequestMapping("exportSupplyDeliverOrder")
    public void exportSupplyDeliverOrder(HttpServletRequest request, HttpServletResponse response) throws IOException {
        Map<String, String> map = getParams(request);
        exportService.exportSupplyDeliverOrder(map, response);
    }

    /**
     * 订单查询导出
     */
    @RequestMapping("exportAllOrder")
    public void exportAllOrder(HttpServletRequest request, HttpServletResponse response) throws IOException {
        Map<String, String> map = getParams(request);
        exportService.exportAllOrder(map, response);
    }
}
