From 0d9b0dab20eae44c817944e98c967dfd8832f580 Mon Sep 17 00:00:00 2001
From: liyong <18434998025@163.com>
Date: 星期六, 25 四月 2026 17:13:16 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_天津_阳光彩印' into dev_天津_阳光彩印
---
src/main/java/com/ruoyi/production/service/impl/ProductionPrintOrderServiceImpl.java | 108 ++++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 100 insertions(+), 8 deletions(-)
diff --git a/src/main/java/com/ruoyi/production/service/impl/ProductionPrintOrderServiceImpl.java b/src/main/java/com/ruoyi/production/service/impl/ProductionPrintOrderServiceImpl.java
index e8587ac..3716dec 100644
--- a/src/main/java/com/ruoyi/production/service/impl/ProductionPrintOrderServiceImpl.java
+++ b/src/main/java/com/ruoyi/production/service/impl/ProductionPrintOrderServiceImpl.java
@@ -1,22 +1,33 @@
package com.ruoyi.production.service.impl;
import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.io.IoUtil;
+import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.IdUtil;
+import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.basic.excel.ProductionPrintOrderExcel;
+import com.ruoyi.basic.service.CustomerFollowUpFileService;
+import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.dto.SimplePersonDto;
-import com.ruoyi.production.dto.ProcessContentDto;
-import com.ruoyi.production.dto.ProcessRouteAnticlockwiseDto;
-import com.ruoyi.production.dto.SaveProductionPrintOrderDto;
+import com.ruoyi.production.dto.*;
import com.ruoyi.production.mapper.ProductOrderMapper;
import com.ruoyi.production.mapper.ProductionPrintOrderMapper;
import com.ruoyi.production.pojo.ProductOrder;
import com.ruoyi.production.pojo.ProductionPrintOrder;
import com.ruoyi.production.service.ProductionPrintOrderService;
import lombok.RequiredArgsConstructor;
+import org.jetbrains.annotations.Nullable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import java.io.File;
+import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@@ -34,6 +45,9 @@
private final ProductOrderMapper productOrderMapper;
private final ProcessRouteServiceImpl processRouteService;
+ private final ProductionPrintOrderExcel productionPrintOrderExcel;
+
+ private final CustomerFollowUpFileService customerFollowUpFileService;
@Override
@Transactional
public void save(SaveProductionPrintOrderDto dto) {
@@ -46,30 +60,108 @@
processContentDto.setId(IdUtil.simpleUUID());
}
});
+ MaterialInfoDto materialInfoDtoFirst = dto.getMaterialInfo().get(0);
// 璋冪敤宸ュ簭鏂瑰 鍑芥暟
List<ProcessRouteAnticlockwiseDto> processRouteAnticlockwiseDtos = processContentDtoList.stream().map(it -> {
ProcessRouteAnticlockwiseDto pdto = new ProcessRouteAnticlockwiseDto();
pdto.setProcessId(it.getProcessId());
- pdto.setProcessRouteName(it.getProcessContent());
+ pdto.setProcessRouteName(it.getProcessName());
pdto.setProcessRouteOpenNum(it.getOpenCount());
pdto.setProcessRouteNum(it.getProcessPositive());
- pdto.setProcessRouteAddNum(it.getProcessPositive());
+ pdto.setProcessRouteAddNum(it.getAllowanceQty());
// pdto.setProcessRouteRequire(); 宸ヨ壓瑕佹眰
- pdto.setProductModelId(dto.getProductModelId());
- pdto.setUserIds(it.getReportWorkerList().stream().map(SimplePersonDto::getUserName).collect(Collectors.joining(",")));
+ pdto.setProductModelId(Long.valueOf(materialInfoDtoFirst.getProductModelId()));
+ pdto.setUserIds(it.getReportWorkerList().stream().map(SimplePersonDto::getUserId).map(String::valueOf).collect(Collectors.joining(",")));
+ pdto.setUserNames(it.getReportWorkerList().stream().map(SimplePersonDto::getUserName).collect(Collectors.joining(",")));
pdto.setDeviceId(it.getDeviceId());
+ pdto.setUuid(it.getId());
return pdto;
}).collect(Collectors.toList());
processRouteService.processRouteAnticlockwise(processRouteAnticlockwiseDtos,dto.getProductModelId(),dto.getProductOrderId());
// 鐢熸垚澶囨敞 澶囨敞鐢卞叏閮ㄥ伐搴忓悕绉版潵 缁勬垚
- String remark = processContentDtoList.stream().map(ProcessContentDto::getProcessContent).collect(Collectors.joining("銆�"));
+ String remark = processContentDtoList.stream().map(ProcessContentDto::getProcessName).collect(Collectors.joining("銆�"));
ProductOrder productOrder = new ProductOrder();
productOrder.setId(dto.getProductOrderId());
productOrder.setRemark(remark);
productOrderMapper.updateById(productOrder);
int i = dto.getId() == null ? productionPrintOrderMapper.insert(productionPrintOrder) : productionPrintOrderMapper.updateById(productionPrintOrder);
}
+
+ @Override
+ public ProductionPrintOrderDto getByProductWordId(Long id) {
+ LambdaQueryWrapper<ProductionPrintOrder> queryWrapper = new LambdaQueryWrapper<>();
+ queryWrapper.eq(ProductionPrintOrder::getProductOrderId, id);
+ queryWrapper.orderByDesc(ProductionPrintOrder::getCreateTime);
+ queryWrapper.last("limit 1");
+ ProductionPrintOrder productionPrintOrder = productionPrintOrderMapper.selectOne(queryWrapper);
+ ProductionPrintOrderDto productionPrintOrderDto = BeanUtil.copyProperties(productionPrintOrder, ProductionPrintOrderDto.class);
+
+ // 鑾峰彇闄勪欢淇℃伅
+ productionPrintOrderDto.setCuttingFileVo(customerFollowUpFileService.getSimpleFileVoById(productionPrintOrderDto.getCuttingFileId()));
+
+ return productionPrintOrderDto;
+ }
+
+ @Override
+ public List<ProductionPrintOrder> getListByOrders(List<Long> orderIds) {
+ if(CollUtil.isEmpty(orderIds)){
+ return new ArrayList<>();
+ }
+ LambdaQueryWrapper<ProductionPrintOrder> queryWrapper = new LambdaQueryWrapper<>();
+ queryWrapper.in(ProductionPrintOrder::getProductOrderId, orderIds);
+ List<ProductionPrintOrder> productionPrintOrders = productionPrintOrderMapper.selectList(queryWrapper);
+ // 鍘婚櫎閲嶅鐨刼rderIds鐨勮褰曞彧淇濈暀id鏈�澶х殑涓�涓�
+ return productionPrintOrders.stream().collect(Collectors.collectingAndThen(
+ Collectors.toMap(
+ ProductionPrintOrder::getProductOrderId,
+ productionPrintOrder -> productionPrintOrder,
+ (existing, replacement) -> existing.getId() > replacement.getId() ? existing : replacement
+ ),
+ map -> new ArrayList<>(map.values())
+ ));
+ }
+
+ @Override
+ public byte[] exportPrintExcelByWordId(@Nullable Long orderId) {
+ ProductionPrintOrderDto printOrderDto = this.getByProductWordId(orderId);
+ List<MaterialInfoDto> materialInfo = printOrderDto.getMaterialInfo();
+ Assert.isTrue(CollUtil.isNotEmpty(materialInfo),"鏈湁鏉愭枡淇℃伅锛岃娣诲姞鏀逛俊鎭�!");
+ MaterialInfoDto materialInfoDto = materialInfo.get(0);
+ ExportProductionPrintOrderDto exportProductionPrintOrderDto = BeanUtil.copyProperties(printOrderDto, ExportProductionPrintOrderDto.class);
+ exportProductionPrintOrderDto.setNumSuffix(materialInfoDto.getNumSuffix());
+ exportProductionPrintOrderDto.setUnitSuffix(materialInfoDto.getUnitSuffix());
+ exportProductionPrintOrderDto.setPriceSuffix(materialInfoDto.getPriceSuffix());
+ StringUtils.fillStringNull(exportProductionPrintOrderDto);
+ // 鏃ユ湡淇涓� yyyy骞� MM 鏈� mm 鏃�
+ exportProductionPrintOrderDto.setPrintOrderTimeStr(DateUtil.format(exportProductionPrintOrderDto.getPrintOrderTime(),"yyyy骞� MM 鏈� mm 鏃�"));
+ exportProductionPrintOrderDto.setFinishTimeStr(DateUtil.format(exportProductionPrintOrderDto.getFinishTime(),"yyyy骞� MM 鏈� mm 鏃�"));
+
+ // 浠嬬粛淇� 鍕鹃�夋
+ String introductionLetter = exportProductionPrintOrderDto.getIntroductionLetter();
+ List<String> introductionLetterItem = StrUtil.split(introductionLetter, ",");
+ exportProductionPrintOrderDto.setIntroductionLetter1(introductionLetterItem.contains("浠嬬粛淇�")?"R" : "拢");
+ exportProductionPrintOrderDto.setIntroductionLetter2(introductionLetterItem.contains("鍟嗘爣娉ㄥ唽")?"R" : "拢");
+ exportProductionPrintOrderDto.setIntroductionLetter3(introductionLetterItem.contains("濮斿嵃鍗�")?"R" : "拢");
+ exportProductionPrintOrderDto.setIntroductionLetter4(introductionLetterItem.contains("涔﹀彿")?"R" : "拢");
+
+ // 鍒囨枡鍥剧ず
+ exportProductionPrintOrderDto.setCuttingDiagramCheckout1("骞冲紶".equals(exportProductionPrintOrderDto.getCuttingDiagramCheckout())?"R" : "拢");
+ exportProductionPrintOrderDto.setCuttingDiagramCheckout2("鍗风瓛".equals(exportProductionPrintOrderDto.getCuttingDiagramCheckout())?"R" : "拢");
+
+ // 璇诲彇鍥剧墖淇℃伅
+ if(exportProductionPrintOrderDto.getCuttingFileVo() != null){
+ byte[] bytes = FileUtil.readBytes(exportProductionPrintOrderDto.getCuttingFileVo().getFileUrl());
+ exportProductionPrintOrderDto.setCuttingImage(bytes);
+ }
+ // cutNum 涓哄皬鐩掓暟閲�+涓洅鏁伴噺
+ exportProductionPrintOrderDto.setCutNum(String.valueOf(NumberUtil.add(exportProductionPrintOrderDto.getSmallBoxQty(),exportProductionPrintOrderDto.getMediumBoxQty())));
+
+ byte[] printOrderTemplate = productionPrintOrderExcel.createPrintOrderTemplate(exportProductionPrintOrderDto, this.getClass().getResourceAsStream("/static/printOrderTemp.xlsx"));
+ return printOrderTemplate;
+ }
+
+
}
--
Gitblit v1.9.3