| | |
| | | |
| | | import cn.hutool.core.lang.Assert; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.extra.pinyin.PinyinUtil; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | import java.net.URLEncoder; |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | |
| | | if (CollectionUtils.isNotEmpty(productWorkOrderFiles)) { |
| | | productWorkOrderFiles.forEach(productWorkOrderFile -> { |
| | | Map<String, Object> image = new HashMap<>(); |
| | | PictureRenderData pictureRenderData = Pictures.ofLocal( productWorkOrderFile.getUrl()).sizeInCm(17, 20).create(); |
| | | PictureRenderData pictureRenderData = Pictures.ofLocal(productWorkOrderFile.getUrl()).sizeInCm(17, 20).create(); |
| | | image.put("url", pictureRenderData); |
| | | images.add(image); |
| | | }); |
| | |
| | | put("actualEndTime", productWorkOrderDto.getActualEndTime()); |
| | | put("twoCode", Pictures.ofLocal(codePath).create()); |
| | | put("deviceName", productWorkOrderDto.getDeviceName()); |
| | | put("images", images.isEmpty()?null:images); |
| | | put("images", images.isEmpty() ? null : images); |
| | | }}); |
| | | |
| | | try { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public String generateProductWorkOrder(String datePrefix,String processName, String npsNo) { |
| | | datePrefix = StrUtil.isBlank(datePrefix) ? LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")) : datePrefix; |
| | | public String generateProductWorkOrder(String processName, String npsNo) { |
| | | processName = StrUtil.isBlank(processName) ? "未知" : processName; |
| | | Assert.notNull(npsNo, "生产订单号编号不能为空"); |
| | | ProductWorkOrder lastWorkOrder = productWorkOrderMapper.selectMax(datePrefix); |
| | | int sequenceNumber = 1; // 默认序号 |
| | | if (lastWorkOrder != null && lastWorkOrder.getWorkOrderNo() != null) { |
| | | String lastNo = lastWorkOrder.getWorkOrderNo().toString(); |
| | | if (lastNo.startsWith(datePrefix)) { |
| | | String seqStr = lastNo.substring(datePrefix.length()); |
| | | try { |
| | | sequenceNumber = Integer.parseInt(seqStr) + 1; |
| | | } catch (NumberFormatException e) { |
| | | sequenceNumber = 1; |
| | | } |
| | | } |
| | | } |
| | | String processPinyin = StringUtils.getProcessNo(processName); |
| | | return StrUtil.format("{}{}",processPinyin,npsNo,String.format("%03d", sequenceNumber)); |
| | | Integer maxNo = productWorkOrderMapper.selectMax(npsNo); |
| | | int sequenceNumber = maxNo + 1; // 默认序号 |
| | | String processPinyin = StringUtils.getProcessNo(processName); |
| | | return StrUtil.format("{}{}", processPinyin, npsNo, String.format("%03d", sequenceNumber)); |
| | | } |
| | | |
| | | } |