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("查询批次号失败!");
|
}
|
}
|
}
|