| | |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | import java.net.URLEncoder; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | |
| | | qualityUnqualifiedMapper.insert(qualityUnqualified); |
| | | } else { |
| | | //合格直接入库 |
| | | if (inspect.getInspectType() == 2 || inspect.getInspectType() == 0) { |
| | | if (qualityInspect.getInspectType() == 2 || qualityInspect.getInspectType() == 0) { |
| | | stockUtils.addStock(qualityInspect.getProductModelId(), qualityInspect.getQuantity(), StockInQualifiedRecordTypeEnum.QUALITYINSPECT_STOCK_IN.getCode(), qualityInspect.getId(), "-", "-", "-"); |
| | | } |
| | | } |
| | |
| | | detail.setIndex(index); |
| | | index++; |
| | | } |
| | | |
| | | // 格式化检验日期 |
| | | String checkTimeStr; |
| | | if (inspect.getCheckTime() != null) { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | checkTimeStr = sdf.format(inspect.getCheckTime()); |
| | | } else { |
| | | checkTimeStr = ""; |
| | | } |
| | | |
| | | InputStream inputStream = this.getClass().getResourceAsStream("/static/report-template.docx"); |
| | | Configure configure = Configure.builder() |
| | | .bind("paramList", new HackLoopTableRenderPolicy()) |
| | |
| | | XWPFTemplate template = XWPFTemplate.compile(inputStream, configure).render( |
| | | new HashMap<String, Object>() {{ |
| | | put("inspect", inspect); |
| | | put("customerLabel", inspect.getInspectType() == 0 ? "供应商" : "客户"); |
| | | put("customer", inspect.getInspectType() == 0 ? inspect.getSupplier() : inspect.getCustomer()); |
| | | put("inspectType", finalInspectType); |
| | | put("paramList", paramList); |
| | | put("checkTime", checkTimeStr); |
| | | }}); |
| | | |
| | | try { |