1
hao
2025-05-20 8e24c6fea30d9b179375ee2893710cdec2443b13
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
package com.web.report.controller;
 
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
 
import javax.servlet.http.HttpServletRequest;
 
import org.springframework.beans.factory.annotation.Autowired;
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.RequestParam;
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.utils.UserUtil;
import com.web.report.service.ReportService;
 
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
 
@Api(description = "批次追溯")
@CrossOrigin
@ControllerAdvice
//@RestController
@Controller
@RequestMapping(value = "/report")
public class ReportController extends WebController {
 
    @Autowired
    private ReportService reportService;
    
    /**
     * 权限列表
     * @return ok/fail
     */
    @RequestMapping(value = "/toList", method = RequestMethod.GET)
    @ResponseBody
    public ModelAndView permList() {
        String method = "/report/toList";String methodName ="批次追溯列表";
        //getSysLogService().debug(method,methodName);
        logger.debug(method);
        ModelAndView mav = new ModelAndView("/report/batch");
        try {
            String barcode = "1C200327700010001";
            //String factory, String company, String in_str, String usercode, String ip, int page, int size
            //List<Object> permList = reportService.getTreeList("10000","1000",barcode,UserUtil.getSessionUser().getFcode(),"123",5,1);
            //logger.debug("批次追溯列表查询=permList:" + permList);
            //getSysLogService().success(method,methodName,permList);
            mav.addObject("permList", reportService.getTreeList("10000","1000",barcode,UserUtil.getSessionUser().getFcode(),"123",5,1));
            mav.addObject("msg", "ok");
        } catch (Exception e) {
            e.printStackTrace();
            logger.error("权限查询异常!", e);
            getSysLogService().error(method,methodName,e.toString());
        }
        return mav;
    }
    
    @RequestMapping(value = "/toFrhcDetail", method = RequestMethod.GET)
    @ResponseBody
    public ModelAndView toFrhcDetail(HttpServletRequest request) {
        String method = "/report/toFrhcDetail";String methodName ="批次追溯列表";
        //getSysLogService().debug(method,methodName);
        logger.debug(method);
        ModelAndView mav = new ModelAndView("/report/hcfr");
        try {
            
            String keyword = request.getParameter("keyword");
            System.out.println(keyword);
            mav.addObject("msg", "ok");
        } catch (Exception e) {
            e.printStackTrace();
            logger.error("权限查询异常!", e);
            getSysLogService().error(method,methodName,e.toString());
        }
        return mav;
    }
    @RequestMapping(value = "/toPZ", method = RequestMethod.GET)
    @ResponseBody
    public ModelAndView toPZ(String p) {
        String method = "/report/toPZ";String methodName ="品质信息";
        ModelAndView mav=new ModelAndView();
        mav.addObject("pname", p);
        mav.setViewName("/report/pz");//返回路径
        return mav;
    }
    
    @RequestMapping(value = "/toInout", method = RequestMethod.GET)
    @ResponseBody
    public ModelAndView toInout(String p) {
        String method = "/report/toInout";String methodName ="投入产出列表";
        ModelAndView mav=new ModelAndView();
        mav.addObject("pname", p);
        mav.setViewName("/report/inout");//返回路径
        return mav;
    }
    
    @RequestMapping(value = "/toInoutDetail", method = RequestMethod.GET)
    @ResponseBody
    public ModelAndView toInoutDetail(String p,String stime,String etime,String task_no) {
        String method = "/report/toInout";String methodName ="投入产出列表";
        ModelAndView mav=new ModelAndView();
        mav.addObject("pname", p);
        mav.addObject("stime", stime);
        mav.addObject("etime", etime);
        mav.addObject("task_no", task_no);
        mav.setViewName("/report/inout_detail");//返回路径
        return mav;
    }
    
    @RequestMapping(value = "/toTrace")
    public String toTrace(){
        return "/report/trace";
    }
    @RequestMapping(value = "/toFR")
    public String toFR(){
        return "/report/fr";
    }
    @RequestMapping(value = "/toHC")
    public String toHC(){
        return "/report/hc";
    }
    @RequestMapping(value = "/toOCV1")
    public String toOCV1(){
        return "/report/ocv1";
    }
    @RequestMapping(value = "/toOCV2")
    public String toOCV2(){
        return "/report/ocv2";
    }
    @RequestMapping(value = "/toOCV4")
    public String toOCV4(){
        return "/report/ocv4";
    }
    @RequestMapping(value = "/toOCV3")
    public String toOCV3(){
        return "/report/ocv3";
    }
    @RequestMapping(value = "/toHcfr")
    public String toHcfr(){
        return "/report/hcfr";
    }
    @RequestMapping(value = "/toJY")
    public String toJY(){
        return "/report/jy";
    }
    @RequestMapping(value = "/toKC")
    public String toKC(){
        return "/report/kc";
    }
    @RequestMapping(value = "/toBCP")
    public String toBCP(){
        return "/report/bcp";
    }
    //注液结果数据
    @RequestMapping(value = "/toZy")
    public String toZy(){
        return "/report/zy";
    }
    private Map<String, Object> emtyMap(){
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("rows", new ArrayList());
        map.put("page", 1);
        map.put("pageSize", 10);
        map.put("total", 0);
        return map;
    }
    
     @ApiOperation(value = "获取物料信息列表", notes = "获取物料信息列表")
        @RequestMapping(value = "/getMaterialsList", method = RequestMethod.GET)
        @ResponseBody
        public ApiResponseResult getMaterialsList(@RequestParam(value = "keyword", required = false) String keyword) {
            String method = "/report/getMaterialsList";String methodName ="获取物料信息列表";
            try {
                Sort sort = new Sort(Sort.Direction.DESC, "id");
                ApiResponseResult result = reportService.getMaterialsList(keyword, super.getPageRequest(sort));
                //logger.debug("获取应急处置信息列表=获取物料信息列表:");
                getSysLogService().success(method, methodName, null);
                return result;
            } catch (Exception e) {
                e.printStackTrace();
                logger.error("获取物料信息列表失败!", e);
                getSysLogService().error(method, methodName, e.toString());
                return ApiResponseResult.failure("获取物料信息列表失败!").data(emtyMap());
            }
        }
     
     @ApiOperation(value = "获取品质信息列表", notes = "获取品质信息列表")
        @RequestMapping(value = "/getQualityList", method = RequestMethod.GET)
        @ResponseBody
        public ApiResponseResult getQualityList(@RequestParam(value = "keyword", required = false) String keyword) {
            String method = "/report/getQualityList";String methodName ="获取品质信息列表";
            try {
                Sort sort = new Sort(Sort.Direction.DESC, "id");
                ApiResponseResult result = reportService.getQualityList(keyword, super.getPageRequest(sort));
                logger.debug("获取品质信息列表=getQualityList:");
                //getSysLogService().success(method, methodName, null);
                return result;
            } catch (Exception e) {
                e.printStackTrace();
                logger.error("获取品质信息列表失败!", e);
                getSysLogService().error(method, methodName, e.toString());
                return ApiResponseResult.failure("获取品质信息列表失败!").data(emtyMap());
            }
        }
     
     @ApiOperation(value = "获取设备人员信息列表", notes = "获取设备人员信息列表")
        @RequestMapping(value = "/getDeviceList", method = RequestMethod.GET)
        @ResponseBody
        public ApiResponseResult getDeviceList(@RequestParam(value = "keyword", required = false) String keyword) {
            String method = "/report/getDeviceList";String methodName ="获取设备人员信息列表";
            try {
                Sort sort = new Sort(Sort.Direction.DESC, "id");
                ApiResponseResult result = reportService.getDeviceList(keyword, super.getPageRequest(sort));
                logger.debug("获取设备人员信息列表=device:");
                //getSysLogService().success(method, methodName, null);
                return result;
            } catch (Exception e) {
                e.printStackTrace();
                logger.error("获取设备人员信息列表失败!", e);
                getSysLogService().error(method, methodName, e.toString());
                return ApiResponseResult.failure("获取设备人员信息列表失败!").data(emtyMap());
            }
        }
     
     
     @ApiOperation(value = "获取工装夹具信息列表", notes = "获取工装夹具信息列表")
        @RequestMapping(value = "/getFixtureList", method = RequestMethod.GET)
        @ResponseBody
        public ApiResponseResult getFixtureList(@RequestParam(value = "keyword", required = false) String keyword) {
            String method = "/report/getFixtureList";String methodName ="获取工装夹具信息列表";
            try {
                Sort sort = new Sort(Sort.Direction.DESC, "id");
                ApiResponseResult result = reportService.getFixtureList(keyword, super.getPageRequest(sort));
                logger.debug("获取工装夹具信息列表=getFixtureList:");
                //getSysLogService().success(method, methodName, null);
                return result;
            } catch (Exception e) {
                e.printStackTrace();
                logger.error("获取工装夹具信息列表失败!", e);
                getSysLogService().error(method, methodName, e.toString());
                return ApiResponseResult.failure("获取工装夹具信息列表失败!").data(emtyMap());
            }
        }
     
     @ApiOperation(value = "获取化成过程数据信息列表", notes = "获取化成过程数据信息列表")
        @RequestMapping(value = "/getHcfrList", method = RequestMethod.GET)
        @ResponseBody
        public ApiResponseResult getHcfrList(@RequestParam(value = "keyword", required = false) String keyword,
                @RequestParam(value = "ptype", required = false) String ptype) {
            String method = "/report/getHcfrList";String methodName ="获取化成过程数据信息列表";
            try {
                Sort sort = new Sort(Sort.Direction.DESC, "id");
                ApiResponseResult result = reportService.getHcfrList(keyword,ptype, super.getPageRequest(sort));
                logger.debug("获取化成过程数据信息列表=getHcfrList:");
                //getSysLogService().success(method, methodName, null);
                return result;
            } catch (Exception e) {
                e.printStackTrace();
                logger.error("获取化成过程数据信息列表失败!", e);
                getSysLogService().error(method, methodName, e.toString());
                return ApiResponseResult.failure("获取化成过程数据信息列表失败!").data(emtyMap());
            }
        }
     
     @ApiOperation(value = "获取OCV1信息列表", notes = "获取OCV1信息列表")
        @RequestMapping(value = "/getFRList", method = RequestMethod.GET)
        @ResponseBody
        public ApiResponseResult getFRList(@RequestParam(value = "keyword", required = false) String keyword,
                @RequestParam(value = "stime", required = false) String stime,@RequestParam(value = "etime", required = false) String etime,
                @RequestParam(value = "ptype", required = false) String ptype) {
            String method = "/report/getFRList";String methodName ="获取OCV1信息列表";
            try {
                Sort sort = new Sort(Sort.Direction.DESC, "id");
                ApiResponseResult result = reportService.getFRList(keyword,stime,etime,ptype, super.getPageRequest(sort));
                logger.debug("获取OCV1信息列表=getOCV1List:");
                //getSysLogService().success(method, methodName, null);
                return result;
            } catch (Exception e) {
                e.printStackTrace();
                logger.error("获取OCV1信息列表失败!", e);
                getSysLogService().error(method, methodName, e.toString());
                return ApiResponseResult.failure("获取OCV1信息列表失败!").data(emtyMap());
            }
        }
     
     @ApiOperation(value = "获取OCV1信息列表", notes = "获取OCV1信息列表")
        @RequestMapping(value = "/getOCVList", method = RequestMethod.GET)
        @ResponseBody
        public ApiResponseResult getOCV1ist(@RequestParam(value = "keyword", required = false) String keyword,
                @RequestParam(value = "stime", required = false) String stime,@RequestParam(value = "etime", required = false) String etime,
                @RequestParam(value = "lineno", required = false) String lineno
                ,@RequestParam(value = "pmodel", required = false) String pmodel
                ,@RequestParam(value = "prc_name", required = false) String prc_name) {
            String method = "/report/getOCVList";String methodName ="获取OCV1信息列表";
            try {
                Sort sort = new Sort(Sort.Direction.DESC, "id");
                ApiResponseResult result = reportService.getOCVList(prc_name,keyword,stime,etime,lineno,pmodel, super.getPageRequest(sort));
                logger.debug("获取OCV1信息列表=getOCV1List:");
                //getSysLogService().success(method, methodName, null);
                return result;
            } catch (Exception e) {
                e.printStackTrace();
                logger.error("获取OCV1信息列表失败!", e);
                getSysLogService().error(method, methodName, e.toString());
                return ApiResponseResult.failure("获取OCV1信息列表失败!").data(emtyMap());
            }
        }
     
     @ApiOperation(value = "获取OCV2信息列表", notes = "获取OCV2信息列表")
        @RequestMapping(value = "/getOCV2List", method = RequestMethod.GET)
        @ResponseBody
        public ApiResponseResult getOCV2List(@RequestParam(value = "keyword", required = false) String keyword,
                @RequestParam(value = "stime", required = false) String stime,@RequestParam(value = "etime", required = false) String etime,
                @RequestParam(value = "lineno", required = false) String lineno
                ,@RequestParam(value = "pmodel", required = false) String pmodel) {
            String method = "/report/getOCV2List";String methodName ="获取OCV2信息列表";
            try {
                Sort sort = new Sort(Sort.Direction.DESC, "id");
                ApiResponseResult result = reportService.getOCV2List(keyword,stime,etime,lineno,pmodel, super.getPageRequest(sort));
                logger.debug("获取OCV2信息列表=getOCV2List:");
                //getSysLogService().success(method, methodName, null);
                return result;
            } catch (Exception e) {
                e.printStackTrace();
                logger.error("获取OCV2信息列表失败!", e);
                getSysLogService().error(method, methodName, e.toString());
                return ApiResponseResult.failure("获取OCV2信息列表失败!");
            }
        }
     
     @ApiOperation(value = "获取线体信息列表", notes = "获取线体信息列表")
        @RequestMapping(value = "/getLineList", method = RequestMethod.GET)
        @ResponseBody
        public ApiResponseResult getLineList() {
            String method = "/report/getLineList";String methodName ="获取线体信息列表";
            try {
                ApiResponseResult result = reportService.getLineList();
                logger.debug("获取线体信息列表=getLineList:");
                //getSysLogService().success(method, methodName, null);
                return result;
            } catch (Exception e) {
                e.printStackTrace();
                logger.error("获取线体信息列表失败!", e);
                getSysLogService().error(method, methodName, e.toString());
                return ApiResponseResult.failure("获取线体信息列表失败!").data(emtyMap());
            }
        }
 
    @ApiOperation(value = "获取物料条码交易明细列表", notes = "获取物料条码交易明细列表")
    @RequestMapping(value = "/getJYList", method = RequestMethod.GET)
    @ResponseBody
    public ApiResponseResult getJYList(@RequestParam(value = "keyword", required = false) String keyword
            ,@RequestParam(value = "stime", required = false) String stime
            ,@RequestParam(value = "etime", required = false) String etime) {
        String method = "/report/getJYList";String methodName ="获取物料条码交易明细列表";
        try {
            Sort sort = new Sort(Sort.Direction.DESC, "id");
            ApiResponseResult result = reportService.getJYList(keyword, stime,etime, super.getPageRequest(sort));
            logger.debug("获取物料条码交易明细列表=getJYList:");
            //getSysLogService().success(method, methodName, null);
            return result;
        } catch (Exception e) {
            e.printStackTrace();
            logger.error("获取物料条码交易明细列表失败!", e);
            //getSysLogService().error(method, methodName, e.toString());
            return ApiResponseResult.failure("获取物料条码交易明细列表失败!").data(emtyMap());
        }
    }
 
    @ApiOperation(value = "获取物料条码库存明细列表", notes = "获取物料条码库存明细列表")
    @RequestMapping(value = "/getKCList", method = RequestMethod.GET)
    @ResponseBody
    public ApiResponseResult getKCList(@RequestParam(value = "keyword", required = false) String keyword
            ) {
        String method = "/report/getKCList";String methodName ="获取物料条码库存明细列表";
        try {
            Sort sort = new Sort(Sort.Direction.DESC, "id");
            ApiResponseResult result = reportService.getKCList(keyword,super.getPageRequest(sort));
            logger.debug("获取物料条码库存明细列表=getKCList:");
            //getSysLogService().success(method, methodName, null);
            return result;
        } catch (Exception e) {
            e.printStackTrace();
            logger.error("获取物料条码库存明细列表失败!", e);
            //getSysLogService().error(method, methodName, e.toString());
            return ApiResponseResult.failure("获取物料条码库存明细列表失败!").data(emtyMap());
        }
    }
 
    @ApiOperation(value = "获取半成品条码库存明细列表", notes = "获取半成品条码库存明细列表")
    @RequestMapping(value = "/getBCPList", method = RequestMethod.GET)
    @ResponseBody
    public ApiResponseResult getBCPList(@RequestParam(value = "keyword", required = false) String keyword) {
        String method = "/report/getBCPList";String methodName ="获取半成品条码库存明细列表";
        try {
            Sort sort = new Sort(Sort.Direction.DESC, "id");
            ApiResponseResult result = reportService.getBCPList(keyword, super.getPageRequest(sort));
            logger.debug("获取半成品条码库存明细列表=getBCPList:");
            //getSysLogService().success(method, methodName, null);
            return result;
        } catch (Exception e) {
            e.printStackTrace();
            logger.error("获取半成品条码库存明细列表失败!", e);
            //getSysLogService().error(method, methodName, e.toString());
            return ApiResponseResult.failure("获取半成品条码库存明细列表失败!").data(emtyMap());
        }
    }
    @ApiOperation(value = "获取列表", notes = "获取列表")
    @RequestMapping(value = "/getCom1List", method = RequestMethod.GET)
    @ResponseBody
    public ApiResponseResult getCom1List(@RequestParam(value = "prc_name", required = false) String prc_name
            ,@RequestParam(value = "keyword", required = false) String keyword
            ,@RequestParam(value = "pname", required = false) String pname
            ,@RequestParam(value = "stime", required = false) String stime
            ,@RequestParam(value = "etime", required = false) String etime) {
        String method = "/report/getCom1List?type="+prc_name;String methodName ="获取列表";
        try {
            Sort sort = new Sort(Sort.Direction.DESC, "id");
            String pname_ = URLDecoder.decode(pname,"UTF-8");
            ApiResponseResult result = reportService.getCom1List(prc_name,pname_,keyword, stime,etime,super.getPageRequest(sort));
            //getSysLogService().success(method, methodName, null);
            return result;
        } catch (Exception e) {
            e.printStackTrace();
            logger.error("获取列表失败!", e);
            //getSysLogService().error(method, methodName, e.toString());
            return ApiResponseResult.failure("获取列表失败!").data(emtyMap());
        }
    }
    @ApiOperation(value = "获取列表", notes = "获取列表")
    @RequestMapping(value = "/getComList", method = RequestMethod.GET)
    @ResponseBody
    public ApiResponseResult getComList(@RequestParam(value = "prc_name", required = false) String prc_name
            ,@RequestParam(value = "pname", required = false) String pname
            ,@RequestParam(value = "stime", required = false) String stime
            ,@RequestParam(value = "etime", required = false) String etime) {
        String method = "/report/getComList?type="+prc_name;String methodName ="获取列表";
        try {
            Sort sort = new Sort(Sort.Direction.DESC, "id");
            String pname_ = URLDecoder.decode(pname,"UTF-8");
            ApiResponseResult result = reportService.getComList(prc_name,pname_, stime,etime,super.getPageRequest(sort));
            //getSysLogService().success(method, methodName, null);
            return result;
        } catch (Exception e) {
            e.printStackTrace();
            logger.error("获取列表失败!", e);
            //getSysLogService().error(method, methodName, e.toString());
            return ApiResponseResult.failure("获取列表失败!").data(emtyMap());
        }
    }
 
    @ApiOperation(value="导出", notes="导出")
    @RequestMapping(value = "/getExcel", method = RequestMethod.GET)
    @ResponseBody
    public void getExcel(String keyword){
        try {
            reportService.getExcel(keyword, getResponse());
        } catch (Exception e) {
            logger.error(e.toString(), e);
        }
    }
}