Search in sources :

Example 1 with TaskQualityRecordDetail

use of com.eservice.api.model.task_quality_record.TaskQualityRecordDetail in project sinsim by WilsonHu.

the class TaskQualityRecordController method updateTaskQualityRecordDetail.

/**
 * 根据传入的strTaskQualityRecordDetail,更新对应多表:
 *     "machine_id":"",  --> machine.machine_id
 *     "检验是否合格":"", --> task_quality_record.status 质检结果: "1"==>通过; “0”==>不通过
 *     "不合格原因":"",	--> task_quality_record.comment
 *     "不合格照片":"",	--> quality_record_image.image
 *     "检验完成":"",		--> task_record.status  task状态,“1”==>未开始, “2”==>进行中,“3”==>安装完成, “4”==>质检完成,“5“===>异常
 * @param strTaskQualityRecordDetail
 * @return
 */
@PostMapping("updateTaskQualityRecordDetail")
public Result updateTaskQualityRecordDetail(@RequestParam String strTaskQualityRecordDetail) {
    TaskQualityRecordDetail taskQualityRecordDetail = JSON.parseObject(strTaskQualityRecordDetail, TaskQualityRecordDetail.class);
    Integer taskQualityRecordDetail_ID = taskQualityRecordDetail.getId();
    TaskQualityRecord taskQualityRecord = taskQualityRecordService.findById(taskQualityRecordDetail_ID);
    taskQualityRecord.setTaskRecordId(taskQualityRecordDetail.getTaskRecordId());
    taskQualityRecord.setName(taskQualityRecordDetail.getName());
    taskQualityRecord.setStatus(taskQualityRecordDetail.getStatus());
    taskQualityRecord.setCreateTime(taskQualityRecordDetail.getCreateTime());
    taskQualityRecord.setComment(taskQualityRecordDetail.getComment());
    QualityRecordImage qualityRecordImage = taskQualityRecordDetail.getQualityRecordImage();
    TaskRecord taskRecord = taskQualityRecordDetail.getTaskRecord();
    taskQualityRecordService.update(taskQualityRecord);
    qualityRecordImageService.update(qualityRecordImage);
    taskRecordService.update(taskRecord);
    return ResultGenerator.genSuccessResult();
}
Also used : TaskQualityRecordDetail(com.eservice.api.model.task_quality_record.TaskQualityRecordDetail) TaskRecord(com.eservice.api.model.task_record.TaskRecord) TaskQualityRecord(com.eservice.api.model.task_quality_record.TaskQualityRecord) QualityRecordImage(com.eservice.api.model.quality_record_image.QualityRecordImage) PostMapping(org.springframework.web.bind.annotation.PostMapping)

Example 2 with TaskQualityRecordDetail

use of com.eservice.api.model.task_quality_record.TaskQualityRecordDetail in project sinsim by WilsonHu.

the class TaskQualityRecordController method export.

/**
 * 生成 质检异常的excel表格
 */
@PostMapping("/export")
public Result export(String nameplate, String orderNum, String taskName, Integer submitUser, Integer solutionUser, Integer finishStatus, String queryStartTime, String queryFinishTime) {
    List<TaskQualityRecordDetail> list = taskQualityRecordService.selectTaskQualityList(nameplate, orderNum, taskName, submitUser, solutionUser, finishStatus, queryStartTime, queryFinishTime);
    HSSFWorkbook wb = null;
    FileOutputStream out = null;
    String downloadPath = "";
    /*
        返回给docker外部下载
         */
    String downloadPathForNginx = "";
    SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd HH:mm");
    String dateString;
    try {
        // 生成一个空的Excel文件
        wb = new HSSFWorkbook();
        Sheet sheet1 = wb.createSheet("sheet1");
        // 设置标题行格式
        HSSFCellStyle headcellstyle = wb.createCellStyle();
        HSSFFont headfont = wb.createFont();
        headfont.setFontHeightInPoints((short) 10);
        headfont.setBold(true);
        headcellstyle.setFont(headfont);
        Row row;
        // 创建行和列
        for (int r = 0; r < list.size() + 1; r++) {
            row = sheet1.createRow(r);
            for (int c = 0; c < 8; c++) {
                row.createCell(c);
                sheet1.getRow(0).getCell(c).setCellStyle(headcellstyle);
            }
        }
        sheet1.setColumnWidth(0, 1500);
        sheet1.setColumnWidth(1, 4000);
        sheet1.setColumnWidth(2, 4000);
        sheet1.setColumnWidth(3, 4000);
        sheet1.setColumnWidth(4, 4000);
        sheet1.setColumnWidth(5, 10000);
        sheet1.setColumnWidth(6, 4000);
        sheet1.setColumnWidth(7, 4000);
        // 第一行为标题
        sheet1.getRow(0).getCell(0).setCellValue("序号");
        sheet1.getRow(0).getCell(1).setCellValue("机器编号");
        sheet1.getRow(0).getCell(2).setCellValue("工序");
        sheet1.getRow(0).getCell(3).setCellValue("提交者");
        sheet1.getRow(0).getCell(4).setCellValue("解决者");
        sheet1.getRow(0).getCell(5).setCellValue("解决方法");
        sheet1.getRow(0).getCell(6).setCellValue("创建时间");
        sheet1.getRow(0).getCell(7).setCellValue("解决时间");
        // 第二行开始,填入值
        for (int r = 0; r < list.size(); r++) {
            row = sheet1.getRow(r + 1);
            row.getCell(0).setCellValue(r + 1);
            row.getCell(1).setCellValue(list.get(r).getMachine().getNameplate());
            row.getCell(2).setCellValue(list.get(r).getTaskRecord().getTaskName());
            row.getCell(3).setCellValue(list.get(r).getSubmitUser());
            // 安装异常时, 还不知道SolutionUser, SolutionUser是null
            if (list.get(r).getSolutionUser() != null) {
                row.getCell(4).setCellValue(list.get(r).getSolutionUser());
            }
            row.getCell(5).setCellValue(list.get(r).getSolution());
            dateString = formatter.format(list.get(r).getCreateTime());
            row.getCell(6).setCellValue(dateString);
            if (list.get(r).getSolveTime() != null) {
                dateString = formatter.format(list.get(r).getSolveTime());
                row.getCell(7).setCellValue(dateString);
            }
        }
        downloadPath = taskQualityRecordExcelOutputDir + "质检异常统计" + ".xls";
        downloadPathForNginx = "/excel/" + "质检异常统计" + ".xls";
        out = new FileOutputStream(downloadPath);
        wb.write(out);
        out.close();
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
    if ("".equals(downloadPath)) {
        return ResultGenerator.genFailResult("质检异常导出失败!");
    } else {
        return ResultGenerator.genSuccessResult(downloadPathForNginx);
    }
}
Also used : FileNotFoundException(java.io.FileNotFoundException) IOException(java.io.IOException) HSSFWorkbook(org.apache.poi.hssf.usermodel.HSSFWorkbook) HSSFCellStyle(org.apache.poi.hssf.usermodel.HSSFCellStyle) TaskQualityRecordDetail(com.eservice.api.model.task_quality_record.TaskQualityRecordDetail) FileOutputStream(java.io.FileOutputStream) HSSFFont(org.apache.poi.hssf.usermodel.HSSFFont) Row(org.apache.poi.ss.usermodel.Row) SimpleDateFormat(java.text.SimpleDateFormat) Sheet(org.apache.poi.ss.usermodel.Sheet) PostMapping(org.springframework.web.bind.annotation.PostMapping)

Example 3 with TaskQualityRecordDetail

use of com.eservice.api.model.task_quality_record.TaskQualityRecordDetail in project sinsim by WilsonHu.

the class TaskQualityRecordController method selectTaskQualityRecordDetail.

/**
 * 根据  task_record.id 返回QualityRecordDetail,包括 qurlity_record_image,task_quality_record等
 *
 * @param page
 * @param size
 * @param taskRecordId
 * @return
 */
@PostMapping("/selectTaskQualityRecordDetails")
public Result selectTaskQualityRecordDetail(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "0") Integer size, @RequestParam Integer taskRecordId) {
    PageHelper.startPage(page, size);
    List<TaskQualityRecordDetail> list = taskQualityRecordService.selectTaskQualityRecordDetails(taskRecordId);
    PageInfo pageInfo = new PageInfo(list);
    return ResultGenerator.genSuccessResult(pageInfo);
}
Also used : TaskQualityRecordDetail(com.eservice.api.model.task_quality_record.TaskQualityRecordDetail) PageInfo(com.github.pagehelper.PageInfo) PostMapping(org.springframework.web.bind.annotation.PostMapping)

Example 4 with TaskQualityRecordDetail

use of com.eservice.api.model.task_quality_record.TaskQualityRecordDetail in project sinsim by WilsonHu.

the class TaskQualityRecordController method selectTaskQualityList.

/**
 * 根据异常类型、异常提交时间、提交者、解决者,返回abnormalRecordDetail
 *
 * @return
 */
@PostMapping("/selectTaskQualityList")
public Result selectTaskQualityList(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "0") Integer size, String nameplate, String orderNum, String taskName, Integer submitUser, Integer solutionUser, Integer finishStatus, String queryStartTime, String queryFinishTime) {
    PageHelper.startPage(page, size);
    List<TaskQualityRecordDetail> abnormalRecordDetailList = taskQualityRecordService.selectTaskQualityList(nameplate, orderNum, taskName, submitUser, solutionUser, finishStatus, queryStartTime, queryFinishTime);
    PageInfo pageInfo = new PageInfo(abnormalRecordDetailList);
    return ResultGenerator.genSuccessResult(pageInfo);
}
Also used : TaskQualityRecordDetail(com.eservice.api.model.task_quality_record.TaskQualityRecordDetail) PageInfo(com.github.pagehelper.PageInfo) PostMapping(org.springframework.web.bind.annotation.PostMapping)

Aggregations

TaskQualityRecordDetail (com.eservice.api.model.task_quality_record.TaskQualityRecordDetail)4 PostMapping (org.springframework.web.bind.annotation.PostMapping)4 PageInfo (com.github.pagehelper.PageInfo)2 QualityRecordImage (com.eservice.api.model.quality_record_image.QualityRecordImage)1 TaskQualityRecord (com.eservice.api.model.task_quality_record.TaskQualityRecord)1 TaskRecord (com.eservice.api.model.task_record.TaskRecord)1 FileNotFoundException (java.io.FileNotFoundException)1 FileOutputStream (java.io.FileOutputStream)1 IOException (java.io.IOException)1 SimpleDateFormat (java.text.SimpleDateFormat)1 HSSFCellStyle (org.apache.poi.hssf.usermodel.HSSFCellStyle)1 HSSFFont (org.apache.poi.hssf.usermodel.HSSFFont)1 HSSFWorkbook (org.apache.poi.hssf.usermodel.HSSFWorkbook)1 Row (org.apache.poi.ss.usermodel.Row)1 Sheet (org.apache.poi.ss.usermodel.Sheet)1