Search in sources :

Example 6 with TaskRecordDetail

use of com.eservice.api.model.task_record.TaskRecordDetail in project sinsim by WilsonHu.

the class TaskRecordController method selectAllInstallTaskRecordDetailByUserAccount.

/**
 * 根据用户返回所有安装组detail,(除去status为初始化、已计划和质检完成的task_record) ,其中不限于包括:
 * "machine_id":"", 	-->machine.machine_id
 * "task_name":"",	-->task_record.task_name
 * "status":"",		-->task_record.status
 * "交货日期":"",		-->machine_order.contract_ship_date
 * "计划日期":"",		-->machine_order.plan_ship_date
 *
 * @param userAccount
 * @return
 */
@PostMapping("selectAllInstallTaskRecordDetailByUserAccount")
public Result selectAllInstallTaskRecordDetailByUserAccount(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "0") Integer size, @RequestParam String userAccount) {
    PageHelper.startPage(page, size);
    List<TaskRecordDetail> ListTaskRecordDetail = taskRecordService.selectAllInstallTaskRecordDetailByUserAccount(userAccount);
    PageInfo pageInfo = new PageInfo(ListTaskRecordDetail);
    return ResultGenerator.genSuccessResult(pageInfo);
}
Also used : PageInfo(com.github.pagehelper.PageInfo) TaskRecordDetail(com.eservice.api.model.task_record.TaskRecordDetail) PostMapping(org.springframework.web.bind.annotation.PostMapping)

Example 7 with TaskRecordDetail

use of com.eservice.api.model.task_record.TaskRecordDetail in project sinsim by WilsonHu.

the class TaskRecordController method selectUnplandTaskRecordByAccount.

/**
 * 根据account返回该用户的的待计划安装任务
 *
 * @param page
 * @param size
 * @param account
 * @return
 */
@PostMapping("/selectUnplannedTaskRecordByAccount")
public Result selectUnplandTaskRecordByAccount(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "0") Integer size, @RequestParam(defaultValue = "0") String account) {
    PageHelper.startPage(page, size);
    List<TaskRecordDetail> list = taskRecordService.selectUnplannedTaskRecordByAccount(account);
    PageInfo pageInfo = new PageInfo(list);
    return ResultGenerator.genSuccessResult(pageInfo);
}
Also used : PageInfo(com.github.pagehelper.PageInfo) TaskRecordDetail(com.eservice.api.model.task_record.TaskRecordDetail) PostMapping(org.springframework.web.bind.annotation.PostMapping)

Example 8 with TaskRecordDetail

use of com.eservice.api.model.task_record.TaskRecordDetail in project sinsim by WilsonHu.

the class TaskRecordController method selectQATaskRecordDetailByAccountAndNamePlate.

/**
 * 返回满足user+nameplate 且处于安装完成待质检和质检异常状态的质检任务
 *
 * @param page
 * @param size
 * @param namePlate
 * @param account
 * @return
 */
@PostMapping("selectQATaskRecordDetailByAccountAndNamePlate")
public Result selectQATaskRecordDetailByAccountAndNamePlate(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "0") Integer size, @RequestParam(defaultValue = "0") String namePlate, @RequestParam(defaultValue = "0") String account) {
    PageHelper.startPage(page, size);
    List<TaskRecordDetail> list = taskRecordService.selectQATaskRecordDetailByAccountAndNamePlate(namePlate, account);
    PageInfo pageInfo = new PageInfo(list);
    return ResultGenerator.genSuccessResult(pageInfo);
}
Also used : PageInfo(com.github.pagehelper.PageInfo) TaskRecordDetail(com.eservice.api.model.task_record.TaskRecordDetail) PostMapping(org.springframework.web.bind.annotation.PostMapping)

Example 9 with TaskRecordDetail

use of com.eservice.api.model.task_record.TaskRecordDetail in project sinsim by WilsonHu.

the class TaskRecordController method selectTaskRecordByNamePlate.

/**
 * 根据机器的铭牌号(nameplate)查询对应的机器正在操作的taskRecordDetail(全部状态)。
 *
 * @param page
 * @param size
 * @param namePlate
 * @return
 */
@PostMapping("/selectTaskRecordByNamePlate")
public Result selectTaskRecordByNamePlate(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "0") Integer size, @RequestParam(defaultValue = "0") String namePlate) {
    PageHelper.startPage(page, size);
    List<TaskRecordDetail> list = taskRecordService.selectTaskRecordByNamePlate(namePlate);
    PageInfo pageInfo = new PageInfo(list);
    return ResultGenerator.genSuccessResult(pageInfo);
}
Also used : PageInfo(com.github.pagehelper.PageInfo) TaskRecordDetail(com.eservice.api.model.task_record.TaskRecordDetail) PostMapping(org.springframework.web.bind.annotation.PostMapping)

Example 10 with TaskRecordDetail

use of com.eservice.api.model.task_record.TaskRecordDetail in project sinsim by WilsonHu.

the class TaskRecordController method export.

/**
 * 导出计划到excel表格
 * @param orderNum
 * @param machineStrId
 * @param taskName
 * @param nameplate
 * @param installStatus
 * @param machineType
 * @param query_start_time
 * @param query_finish_time
 * @param is_fuzzy
 * @return
 */
@PostMapping("/export")
public Result export(String orderNum, String machineStrId, String taskName, String nameplate, Integer installStatus, Integer machineType, String query_start_time, String query_finish_time, @RequestParam(defaultValue = "true") Boolean is_fuzzy) {
    List<TaskRecordDetail> list = taskRecordService.selectPlanedTaskRecords(orderNum, machineStrId, taskName, nameplate, installStatus, machineType, query_start_time, query_finish_time, is_fuzzy);
    PageInfo pageInfo = new PageInfo(list);
    InputStream fs = null;
    POIFSFileSystem pfs = null;
    HSSFWorkbook wb = null;
    FileOutputStream out = null;
    String downloadPath = "";
    /*
        返回给docker外部下载
         */
    String downloadPathForNginx = "";
    SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd");
    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+1
            row = sheet1.createRow(r);
            // 计划完成时间,合同交货日期,计划交货日期
            for (int c = 0; c < 13; c++) {
                // 创建一个单元格,列号为col+1
                row.createCell(c);
                sheet1.getRow(0).getCell(c).setCellStyle(headcellstyle);
            }
        }
        for (int k = 1; k < 13; k++) {
            sheet1.setColumnWidth(k, 4500);
        }
        // 第一行为标题
        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("安装的结束时间");
        sheet1.getRow(0).getCell(8).setCellValue("质检的开始时间");
        sheet1.getRow(0).getCell(9).setCellValue("质检的结束时间");
        sheet1.getRow(0).getCell(10).setCellValue("计划完成时间");
        sheet1.getRow(0).getCell(11).setCellValue("合同交货日期");
        sheet1.getRow(0).getCell(12).setCellValue("计划交货日期");
        // 第二行开始,填入值
        Machine machine = null;
        MachineOrder machineOrder = null;
        MachineType machineType1 = null;
        Byte taskStatus = 0;
        for (int r = 0; r < list.size(); r++) {
            row = sheet1.getRow(r + 1);
            row.getCell(0).setCellValue(r + 1);
            // 需求单号
            if (list.get(r).getMachineOrder().getOrderNum() != null) {
                row.getCell(1).setCellValue(list.get(r).getMachineOrder().getOrderNum());
            }
            // 机器编号
            if (list.get(r).getMachine().getNameplate() != null) {
                row.getCell(2).setCellValue(list.get(r).getMachine().getNameplate());
            }
            int machineTypeID = list.get(r).getMachine().getMachineType();
            machine = machineService.selectMachinesByNameplate(list.get(r).getMachine().getNameplate());
            /**
             * 获取机型类型的名称 machine_type.name
             */
            machineType1 = machineTypeService.findById(machineTypeID);
            if (machineType1 != null) {
                // 机型
                row.getCell(3).setCellValue(machineType1.getName());
            }
            // 工序
            if (list.get(r).getTaskName() != null) {
                row.getCell(4).setCellValue(list.get(r).getTaskName());
            }
            // 状态
            taskStatus = list.get(r).getStatus();
            if (taskStatus == Constant.TASK_INITIAL) {
                row.getCell(5).setCellValue(Constant.STR_TASK_INITIAL);
            } else if (taskStatus == Constant.TASK_PLANED) {
                row.getCell(5).setCellValue(Constant.STR_TASK_PLANED);
            } else if (taskStatus == Constant.TASK_INSTALL_WAITING) {
                row.getCell(5).setCellValue(Constant.STR_TASK_INSTALL_WAITING);
            } else if (taskStatus == Constant.TASK_INSTALLING) {
                row.getCell(5).setCellValue(Constant.STR_TASK_INSTALLING);
            } else if (taskStatus == Constant.TASK_INSTALLED) {
                row.getCell(5).setCellValue(Constant.STR_TASK_INSTALLED);
            } else if (taskStatus == Constant.TASK_QUALITY_DOING) {
                row.getCell(5).setCellValue(Constant.STR_TASK_QUALITY_DOING);
            } else if (taskStatus == Constant.TASK_QUALITY_DONE) {
                row.getCell(5).setCellValue(Constant.STR_TASK_QUALITY_DONE);
            } else if (taskStatus == Constant.TASK_INSTALL_ABNORMAL) {
                row.getCell(5).setCellValue(Constant.STR_TASK_INSTALL_ABNORMAL);
            } else if (taskStatus == Constant.TASK_QUALITY_ABNORMAL) {
                row.getCell(5).setCellValue(Constant.STR_TASK_QUALITY_ABNORMAL);
            } else if (taskStatus == Constant.TASK_SKIP) {
                row.getCell(5).setCellValue(Constant.STR_TASK_SKIP);
            }
            // 安装的开始时间
            if (list.get(r).getInstallBeginTime() != null) {
                dateString = formatter.format(list.get(r).getInstallBeginTime());
                row.getCell(6).setCellValue(dateString);
            }
            // 安装的结束时间
            if (list.get(r).getInstallEndTime() != null) {
                dateString = formatter.format(list.get(r).getInstallEndTime());
                row.getCell(7).setCellValue(dateString);
            }
            // 质检的开始时间
            if (list.get(r).getQualityBeginTime() != null) {
                dateString = formatter.format(list.get(r).getQualityBeginTime());
                row.getCell(8).setCellValue(dateString);
            }
            // 质检的结束时间
            if (list.get(r).getQualityEndTime() != null) {
                dateString = formatter.format(list.get(r).getQualityEndTime());
                row.getCell(9).setCellValue(dateString);
            }
            // 计划完成时间
            if (list.get(r).getTaskPlan().getPlanTime() != null) {
                dateString = formatter.format(list.get(r).getTaskPlan().getPlanTime());
                row.getCell(10).setCellValue(dateString);
            }
            // 合同交货日期
            if (list.get(r).getMachineOrder().getContractShipDate() != null) {
                dateString = formatter.format(list.get(r).getMachineOrder().getContractShipDate());
                row.getCell(11).setCellValue(dateString);
            }
            // 计划交货日期
            if (list.get(r).getMachineOrder().getPlanShipDate() != null) {
                dateString = formatter.format(list.get(r).getMachineOrder().getPlanShipDate());
                row.getCell(12).setCellValue(dateString);
            }
        }
        downloadPath = abnoramlExcelOutputDir + "导出计划" + ".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 : MachineType(com.eservice.api.model.machine_type.MachineType) HSSFWorkbook(org.apache.poi.hssf.usermodel.HSSFWorkbook) Machine(com.eservice.api.model.machine.Machine) HSSFCellStyle(org.apache.poi.hssf.usermodel.HSSFCellStyle) PageInfo(com.github.pagehelper.PageInfo) POIFSFileSystem(org.apache.poi.poifs.filesystem.POIFSFileSystem) TaskRecordDetail(com.eservice.api.model.task_record.TaskRecordDetail) HSSFFont(org.apache.poi.hssf.usermodel.HSSFFont) Row(org.apache.poi.ss.usermodel.Row) MachineOrder(com.eservice.api.model.machine_order.MachineOrder) SimpleDateFormat(java.text.SimpleDateFormat) Sheet(org.apache.poi.ss.usermodel.Sheet) PostMapping(org.springframework.web.bind.annotation.PostMapping)

Aggregations

TaskRecordDetail (com.eservice.api.model.task_record.TaskRecordDetail)11 PageInfo (com.github.pagehelper.PageInfo)11 PostMapping (org.springframework.web.bind.annotation.PostMapping)11 Machine (com.eservice.api.model.machine.Machine)1 MachineOrder (com.eservice.api.model.machine_order.MachineOrder)1 MachineType (com.eservice.api.model.machine_type.MachineType)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 POIFSFileSystem (org.apache.poi.poifs.filesystem.POIFSFileSystem)1 Row (org.apache.poi.ss.usermodel.Row)1 Sheet (org.apache.poi.ss.usermodel.Sheet)1