| | |
| | | List<ReportingWorkDetail> reportingWorkDetails = JSONArray.parseArray( |
| | | JSONObject.toJSONString(reportingWorkJson.get("detail")), ReportingWorkDetail.class); |
| | | |
| | | // 报工编号 |
| | | Integer maxId = reportingWorkMapper.selectMaxReportingWorkId(); |
| | | if (maxId == null) { |
| | | maxId = 0; |
| | | } |
| | | String formattedNumber = String.format("%04d", maxId + 1); |
| | | |
| | | // 格式化当前日期 |
| | | Date currentDate = new Date(); |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyMMdd"); |
| | | String formattedDate = dateFormat.format(currentDate); |
| | | String reportingWorkId = "BG" + formattedDate + formattedNumber; |
| | | reportingWork.setReportingWorkId(reportingWorkId); |
| | | |
| | | // 处理工序 ID |
| | | String[] processIdStr = reportingWork.getProcessId() != null |
| | |
| | | reportingWork.setReportingWorkTime(LocalDateTime.now()); |
| | | } |
| | | |
| | | // 是否线补 1现补 0未现补 |
| | | // 是否现补 1现补 0未现补 |
| | | int isPatch = reportingWorkJson.getInteger("isPatch") != null |
| | | ? reportingWorkJson.getInteger("isPatch") : 0; |
| | | |
| | | // 报工编号 |
| | | Integer maxId = reportingWorkMapper.selectMaxReportingWorkId(); |
| | | if (maxId == null) { |
| | | maxId = 0; |
| | | } |
| | | String formattedNumber = String.format("%04d", maxId + 1); |
| | | |
| | | // 格式化当前日期 |
| | | Date currentDate = new Date(); |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyMMdd"); |
| | | String formattedDate = dateFormat.format(currentDate); |
| | | String reportingWorkId = "BG" + formattedDate + formattedNumber; |
| | | reportingWork.setReportingWorkId(reportingWorkId); |
| | | |
| | | // 主表插入 |
| | | reportingWorkMapper.insert(reportingWork); |
| | |
| | | reportingWorkDetailMapper.insert(reportingWorkDetail); |
| | | } |
| | | |
| | | // 更新流程卡报工数量 |
| | | // 判断最后一道工序,更新流程卡报工数量 |
| | | if (reportingWork.getNextProcess() == null || reportingWork.getNextProcess().isEmpty()) { |
| | | LambdaUpdateWrapper<FlowCard> flowCardLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); |
| | | flowCardLambdaUpdateWrapper |
| | |
| | | String nowDate = LocalDate.now().toString(); |
| | | //获取报工工序是否为复合工程 |
| | | String laminating = reportingWorkMapper.getProcessLaminating(thisProcess); |
| | | //合片工序 |
| | | if (laminating.indexOf("step")!=-1){ |
| | | LambdaUpdateWrapper |
| | | <ReportingWork> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper |
| | | .eq(ReportingWork::getProcessId, processIdStr[0]) |
| | | .eq(ReportingWork::getThisProcess, reportingWork.get("process")) |
| | | .eq(ReportingWork::getReviewedState, 0) |
| | | .setSql("reviewed_state =1") |
| | | .set(ReportingWork::getReviewed, userName) |
| | | .set(ReportingWork::getExamineTime, nowDate); |
| | | reportingWorkMapper.update(null, updateWrapper); |
| | | }else { |
| | | reportingWorkMapper.ReviewReportingWorkMp(processIdStr[0],reportingWork.get("process"),technologyStr,userName); |
| | | //合片工序 |
| | | if (laminating.indexOf("step")!=-1){ |
| | | LambdaUpdateWrapper |
| | | <ReportingWork> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper |
| | | .eq(ReportingWork::getProcessId, processIdStr[0]) |
| | | .eq(ReportingWork::getThisProcess, reportingWork.get("process")) |
| | | .eq(ReportingWork::getReviewedState, 0) |
| | | .setSql("reviewed_state =1") |
| | | .set(ReportingWork::getReviewed, userName) |
| | | .set(ReportingWork::getExamineTime, nowDate); |
| | | reportingWorkMapper.update(null, updateWrapper); |
| | | }else { |
| | | reportingWorkMapper.ReviewReportingWorkMp(processIdStr[0],reportingWork.get("process"),technologyStr,userName); |
| | | |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | |