package com.uas.eis.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.uas.eis.sdk.entity.ApiResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.uas.eis.service.QueryService;

import javax.servlet.http.HttpServletRequest;

@RestController
public class QueryController {

	@Autowired
	private QueryService queryService;
	
	@RequestMapping("/api/query")
	public Object query(String code, String param){
		Map<String, Object> map = new HashMap<String, Object>();
		return queryService.query(code, param);
	}
	
	@RequestMapping("/api/doAction")
	public Object doAction(String code, String param){
		Map<String, Object> map = new HashMap<String, Object>();
		return queryService.doAction(code, param);
	}

	/**
	 * 获取生产进度接口
	 * @param request
	 * @param macode
	 * @return
	 */
	@RequestMapping(value = "/api/mes/getMakeProcess" , method = RequestMethod.GET)
	public ApiResult<List<Map<String,Object>>> getMakeProcess(HttpServletRequest request, String macode){
		String accessKey = request.getHeader("AccessKey");
		String requestId = request.getHeader("RequestId");
		return queryService.getMakeProcess(accessKey,requestId,macode);
	}
}
