| | |
| | | package com.ruoyi.production.service.impl; |
| | | |
| | | |
| | | import cn.hutool.core.lang.Assert; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.deepoove.poi.XWPFTemplate; |
| | | import com.deepoove.poi.config.Configure; |
| | | import com.deepoove.poi.data.PictureRenderData; |
| | | import com.deepoove.poi.data.Pictures; |
| | | import com.ruoyi.common.utils.HackLoopTableRenderPolicy; |
| | | import com.ruoyi.common.utils.MatrixToImageWriter; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.production.dto.ProductWorkOrderDto; |
| | | import com.ruoyi.production.mapper.ProductWorkOrderFileMapper; |
| | | import com.ruoyi.production.mapper.ProductWorkOrderMapper; |
| | | import com.ruoyi.production.pojo.ProductWorkOrder; |
| | | import com.ruoyi.production.pojo.ProductWorkOrderFile; |
| | | import com.ruoyi.production.service.ProductWorkOrderService; |
| | | import com.ruoyi.quality.pojo.QualityInspectParam; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | public class ProductWorkOrderServiceImpl extends ServiceImpl<ProductWorkOrderMapper, ProductWorkOrder> implements ProductWorkOrderService { |
| | | |
| | | @Autowired |
| | | private ProductWorkOrderMapper productWorkOrdermapper; |
| | | private ProductWorkOrderMapper productWorkOrderMapper; |
| | | @Autowired |
| | | private ProductWorkOrderFileMapper productWorkOrderFileMapper; |
| | | |
| | |
| | | |
| | | @Override |
| | | public IPage<ProductWorkOrderDto> listPage(Page<ProductWorkOrderDto> page, ProductWorkOrderDto productWorkOrder) { |
| | | return productWorkOrdermapper.pageProductWorkOrder(page, productWorkOrder); |
| | | return productWorkOrderMapper.pageProductWorkOrder(page, productWorkOrder); |
| | | } |
| | | |
| | | @Override |
| | | public int updateProductWorkOrder(ProductWorkOrderDto productWorkOrderDto) { |
| | | return productWorkOrdermapper.updateById(productWorkOrderDto); |
| | | return productWorkOrderMapper.updateById(productWorkOrderDto); |
| | | } |
| | | |
| | | @Override |
| | | public void down(HttpServletResponse response, ProductWorkOrder productWorkOrder) { |
| | | ProductWorkOrderDto productWorkOrderDto = productWorkOrdermapper.getProductWorkOrderFlowCard(productWorkOrder.getId()); |
| | | ProductWorkOrderDto productWorkOrderDto = productWorkOrderMapper.getProductWorkOrderFlowCard(productWorkOrder.getId()); |
| | | String codePath; |
| | | try { |
| | | codePath = new MatrixToImageWriter().code(productWorkOrderDto.getId().toString(), tempDir); |
| | |
| | | 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 ProductWorkOrderDto getProductWorkOrderById(Long id) { |
| | | return productWorkOrderMapper.getProductWorkOrderFlowCard(id); |
| | | } |
| | | |
| | | @Override |
| | | public String generateProductWorkOrder(String processName, String npsNo) { |
| | | processName = StrUtil.isBlank(processName) ? "未知" : processName; |
| | | Assert.notNull(npsNo, "生产订单号编号不能为空"); |
| | | Integer maxNo = productWorkOrderMapper.selectMax(npsNo); |
| | | int sequenceNumber = maxNo + 1; // 默认序号 |
| | | String processPinyin = StringUtils.getProcessNo(processName); |
| | | return StrUtil.format("{}{}", processPinyin, npsNo, String.format("%03d", sequenceNumber)); |
| | | } |
| | | |
| | | } |