4
hao
2025-04-16 c5fb1fbcbb2bf4d511773d348f9ef625855c61fc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
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+"送货计划失败!");
        }
    }
}