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
package com.web.pda.lyt.lytPda.controller;
 
import com.app.base.control.WebController;
import com.app.base.data.ApiResponseResult;
import com.web.pda.lyt.lytPda.service.EquipmentInspectionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
 
@Api(description = "设备点检")
@CrossOrigin
@ControllerAdvice
@RestController
@RequestMapping(value = "equipment_inspection")
public class EquipmentInspectionController extends WebController {
    @Autowired
    private EquipmentInspectionService equipmentInspectionService;
 
    @ApiOperation(value = "根据设备编码获取数据", notes = "根据设备编码获取数据")
    @RequestMapping(value = "/getDateByDianJianCode", method = RequestMethod.POST, produces = "application/json")
    @ResponseBody
    public ApiResponseResult getDateByDianJianCode(
            @RequestParam(value = "dianJianCode") String dianJianCode,
            @RequestParam(value = "type") String type,
            @RequestParam(value = "user") String user,
            @RequestParam(value = "billNo") String billNo) {
        try {
            return equipmentInspectionService.getDateByDianJianCode(dianJianCode, type, user, billNo);
        } catch (Exception e) {
            e.printStackTrace();
            return ApiResponseResult.failure(e.toString());
        }
    }
 
    @ApiOperation(value = "修改点检值", notes = "修改点检值")
    @RequestMapping(value = "/updataValue", method = RequestMethod.POST, produces = "application/json")
    @ResponseBody
    public ApiResponseResult updataValue(
            @RequestParam(value = "factory") String factory,
            @RequestParam(value = "company") String company,
            @RequestParam(value = "user") String user,
            @RequestParam(value = "id") String id,
            @RequestParam(value = "tableName") String tableName,
            @RequestParam(value = "fieldName") String fieldName,
            @RequestParam(value = "fieldVal") String fieldVal) {
        try {
            return equipmentInspectionService.updataValue(factory, company, user, id, tableName, fieldName, fieldVal);
        } catch (Exception e) {
            e.printStackTrace();
            return ApiResponseResult.failure(e.toString());
        }
    }
 
    @ApiOperation(value = "获取全部设备编码/对应点检单号/单号对应数据", notes = "获取全部设备编码/对应点检单号/单号对应数据")
    @RequestMapping(value = "/getMachineCode", method = RequestMethod.POST, produces = "application/json")
    @ResponseBody
    public ApiResponseResult getMachineCode(
            @RequestParam(value = "machineCode") String machineCode,
            @RequestParam(value = "keyword") String keyword,
            @RequestParam(value = "type") String type,
            @RequestParam(value = "searchType") String searchType,
            @RequestParam(value = "billNo") String billNo
 
    ) {
        try {
            return equipmentInspectionService.getMachineCode(machineCode,keyword,type,searchType,billNo);
        } catch (Exception e) {
            e.printStackTrace();
            return ApiResponseResult.failure(e.toString());
        }
    }
 
    @ApiOperation(value = "获取点检操作记录", notes = "获取点检操作记录")
    @RequestMapping(value = "/getRecordList", method = RequestMethod.POST, produces = "application/json")
    @ResponseBody
    public ApiResponseResult getRecordList(
            @RequestParam(value = "type") String type,
            @RequestParam(value = "page") String page,
            @RequestParam(value = "size") String size,
            @RequestParam(value = "keyword") String keyword,
            @RequestParam(value = "id") String id){
        try {
            return equipmentInspectionService.getRecordList(type,id,keyword,size,page);
        } catch (Exception e) {
            e.printStackTrace();
            return ApiResponseResult.failure(e.toString());
        }
    }
 
    @ApiOperation(value = "获取ftp的基础数据", notes = "获取ftp的基础数据")
    @RequestMapping(value = "/uploadFileDianjian", method = RequestMethod.POST)
    public ApiResponseResult uploadFileDianjian(@RequestParam(value = "type1") String type,
                                           @RequestParam(value = "company") String company,
                                           @RequestParam(value = "factory") String factory,
                                           @RequestParam(value = "mid") String mid,
                                           @RequestParam(value = "username") String username,
                                           @RequestParam(value = "note") String note,
                                           @RequestParam("file0") MultipartFile[] files0,
                                           @RequestParam("file1") MultipartFile[] files1,
                                           @RequestParam("file2") MultipartFile[] files2,
                                           @RequestParam("file3") MultipartFile[] files3,
                                           @RequestParam("file4") MultipartFile[] files4,
                                           @RequestParam("file5") MultipartFile[] files5,
                                           @RequestParam("file6") MultipartFile[] files6,
                                           @RequestParam("file7") MultipartFile[] files7,
                                           @RequestParam("file8") MultipartFile[] files8) {
        try {
            //11是IQC检验,71是IQC定期检验
            MultipartFile[]  files =  new MultipartFile[9];
            if(files0.length > 0){
                files[0] = files0[0];
            }
            if(files1.length > 0){
                files[1] = files1[0];
            }
            if(files2.length > 0){
                files[2] = files2[0];
            }
            if(files3.length > 0){
                files[3] = files3[0];
            }
            if(files4.length > 0){
                files[4] = files4[0];
            }
            if(files5.length > 0){
                files[5] = files5[0];
            }
            if(files6.length > 0){
                files[6] = files6[0];
            }
            if(files7.length > 0){
                files[7] = files7[0];
            }
            if(files8.length > 0){
                files[8] = files8[0];
            }
            return equipmentInspectionService.uploadFileDianjian(factory,company,username,Integer.parseInt(mid),Integer.parseInt(type),note,files);
        } catch (Exception e) {
            System.out.println(e.toString());
            return ApiResponseResult.failure("获取ftp的基础数据失败!");
        }
    }
 
    @ApiOperation(value = "查询该检验项目的所有照片", notes = "查询该检验项目的所有照片")
    @RequestMapping(value = "/getFilesList", method = RequestMethod.POST, produces = "application/json")
    public ApiResponseResult getFilesList(@RequestParam(value = "mid") String mid) {
        try {
            return equipmentInspectionService.getFilesList(mid);
        } catch (Exception e) {
            System.out.println(e.toString());
            return ApiResponseResult.failure("查询文件列表失败!");
        }
    }
 
    @ApiOperation(value="图片在线预览", notes="图片在线预览")
    @RequestMapping(value = "/view", method = RequestMethod.GET)
    public void view(@RequestParam(value = "url", required = true) String url,@RequestParam(value = "fname", required = true) String fname) {
        try {
            equipmentInspectionService.onlineView(url, fname,getResponse());
        } catch (Exception e) {
            System.out.println(e.toString());
            // return ApiResponseResult.failure("查询批次号失败!");
        }
    }
}