package com.web.supplier.controller; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Sort; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; import com.app.base.control.WebController; import com.app.base.data.ApiResponseResult; import com.web.supplier.service.SearchService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @Api(description = "查询") @CrossOrigin @ControllerAdvice //@RestController @Controller @RequestMapping(value = "/search") public class SearchController extends WebController { @Autowired private SearchService searchService; /** * 查询-获取采购订单 * **/ @ApiOperation(value = "查询-获取采购订单", notes = "查询-获取采购订单", hidden = true) @RequestMapping(value = "/getPurchaseOrder", method = RequestMethod.POST) @ResponseBody public ApiResponseResult getPurchaseOrder(String billNo,String materialNo, String begTime, String endTime) { try { Sort sort = Sort.unsorted(); ApiResponseResult result = searchService.getPurchaseOrder(billNo,materialNo,begTime,endTime,super.getPageRequest(sort)); logger.debug("查询-获取采购订单:" + result); return result; } catch (Exception e) { e.printStackTrace(); logger.error("查询-获取采购订单失败!", e); return ApiResponseResult.failure("查询-获取采购订单失败!"); } } /** * 打开送货计划列表 * **/ @ApiOperation(value = "打开送货计划列表", notes = "打开送货计划列表", hidden = true) @RequestMapping(value = "/toDeliveryPlanByOrder", method = RequestMethod.GET) @ResponseBody public ModelAndView toDeliveryPlanByOrder(String materialNo) { ModelAndView mav=new ModelAndView(); try { mav.addObject("MATERIAL_NO", materialNo);//返回内容 mav.setViewName("/supplier0/search_deliveryplan_byorder.html");//返回路径 } catch (Exception e) { e.printStackTrace(); logger.error("查询-打开"+materialNo+"送货计划页失败!", e); } return mav; } /** * 查询-获取送货计划列表,通过采购订单带出 * **/ @ApiOperation(value = "查询-获取送货计划列表", notes = "查询-获取送货计划列表", hidden = true) @RequestMapping(value = "/getDeliveryPlanByOrder", method = RequestMethod.POST) @ResponseBody public ApiResponseResult getDeliveryPlanByOrder(String materialNo) { try { Sort sort = Sort.unsorted(); ApiResponseResult result = searchService.getDeliveryPlanByOrder(materialNo,super.getPageRequest(sort)); logger.debug("查询-获取物料"+materialNo+"送货计划:" + result); return result; } catch (Exception e) { e.printStackTrace(); logger.error("查询-获取"+materialNo+"送货计划失败!", e); return ApiResponseResult.failure("查询-获取"+materialNo+"送货计划失败!"); } } /** * 查询-获取送货明细列表 * **/ @ApiOperation(value = "查询-送货明细列表", notes = "查询-送货明细列表", hidden = true) @RequestMapping(value = "/getDeliveryDet", method = RequestMethod.POST) @ResponseBody public ApiResponseResult getDeliveryDet(String billNo,String lineNo,String materialNo) { try { Sort sort = Sort.unsorted(); ApiResponseResult result = searchService.getDeliveryDet(billNo,lineNo,materialNo,super.getPageRequest(sort)); logger.debug("查询-送货明细列表:" + result); return result; } catch (Exception e) { e.printStackTrace(); logger.error("查询-送货明细列表失败!", e); return ApiResponseResult.failure("查询-送货明细列表失败!"); } } /** * 查询-获取条码历史记录 * **/ @ApiOperation(value = "查询-条码历史记录", notes = "查询-条码历史记录", hidden = true) @RequestMapping(value = "/getBarcodeHistory", method = RequestMethod.POST) @ResponseBody public ApiResponseResult getBarcodeHistory(String billNo,String begTime, String endTime,String materialNo, String materialName,String barcode) { try { Sort sort = Sort.unsorted(); ApiResponseResult result = searchService.getBarcodeHistory(billNo,begTime,endTime,materialNo, materialName,barcode,super.getPageRequest(sort)); logger.debug("查询-条码历史记录:" + result); return result; } catch (Exception e) { e.printStackTrace(); logger.error("查询-条码历史记录失败!", e); return ApiResponseResult.failure("查询-条码历史记录失败!"); } } /** * 查询-获取送货单记录 * **/ @ApiOperation(value = "查询-送货单记录", notes = "查询-送货单记录", hidden = true) @RequestMapping(value = "/getDeliveryRecord", method = RequestMethod.POST) @ResponseBody public ApiResponseResult getDeliveryRecord(String deliveryNo,String billNo,String begTime, String endTime,String materialNo, String materialName) { try { Sort sort = Sort.unsorted(); ApiResponseResult result = searchService.getDeliveryRecord(deliveryNo,billNo,begTime,endTime,materialNo, materialName,super.getPageRequest(sort)); logger.debug("查询-送货单记录:" + result); return result; } catch (Exception e) { e.printStackTrace(); logger.error("查询-送货单记录失败!", e); return ApiResponseResult.failure("查询-送货单记录失败!"); } } /** * 查询-获取送货计划列表,单独报表,不与采购计划关联 * **/ @ApiOperation(value = "查询-获取送货计划列表", notes = "查询-获取送货计划列表", hidden = true) @RequestMapping(value = "/getDeliveryPlan", method = RequestMethod.POST) @ResponseBody public ApiResponseResult getDeliveryPlan(String planOrder,String materialNo,String materialName, String begTime, String endTime) { try { Sort sort = Sort.unsorted(); ApiResponseResult result = searchService.getDeliveryPlan(planOrder,materialNo,materialName, begTime,endTime,super.getPageRequest(sort)); logger.debug("查询-获取物料"+materialNo+"送货计划:" + result); return result; } catch (Exception e) { e.printStackTrace(); logger.error("查询-获取"+materialNo+"送货计划失败!", e); return ApiResponseResult.failure("查询-获取"+materialNo+"送货计划失败!"); } } }