From e021ca7fe59647b483a8762f509cc708841cc9cf Mon Sep 17 00:00:00 2001
From: wangfei <3597712270@qq.com>
Date: 星期二, 22 四月 2025 15:25:58 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10105/r/YiWuProject
---
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java | 95 +++++++++++++++++++++++++++++++++++++++++------
1 files changed, 82 insertions(+), 13 deletions(-)
diff --git a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java
index 88f22a2..5b12e1a 100644
--- a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java
+++ b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java
@@ -6,6 +6,7 @@
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mes.common.config.Const;
+import com.mes.common.config.ConstSysConfig;
import com.mes.glassinfo.entity.GlassInfo;
import com.mes.glassinfo.service.GlassInfoService;
import com.mes.hollow.entity.HollowBigStorageCage;
@@ -16,20 +17,21 @@
import com.mes.hollow.entity.dto.HollowBigStorageDTO;
import com.mes.hollow.entity.dto.HollowGlassDetailsDTO;
import com.mes.hollow.entity.dto.LackDetailsDTO;
+import com.mes.hollow.entity.vo.HollowAllFlowCardVO;
import com.mes.hollow.entity.vo.HollowBigStorageDetailsQueryVO;
import com.mes.hollow.mapper.HollowGlassRelationInfoMapper;
import com.mes.hollow.service.HollowBigStorageCageDetailsService;
import com.mes.hollow.service.HollowBigStorageCageService;
import com.mes.hollow.service.HollowGlassOutRelationInfoService;
import com.mes.hollow.service.HollowGlassRelationInfoService;
+import com.mes.sysconfig.service.SysConfigService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
-import java.util.HashMap;
+import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@@ -54,13 +56,15 @@
HollowGlassOutRelationInfoService hollowGlassOutRelationInfoService;
@Resource
HollowBigStorageCageDetailsService hollowBigStorageCageDetailsService;
- @Value("${mes.slotWidth}")
- private Integer slotWidth;
- @Value("${mes.glassGap}")
- private Integer glassGap;
-
- @Value("${mes.outCarMaxSize}")
- private Integer outCarMaxSize;
+ @Resource
+ SysConfigService sysConfigService;
+// @Value("${mes.slotWidth}")
+// private Integer slotWidth;
+// @Value("${mes.glassGap}")
+// private Integer glassGap;
+//
+// @Value("${mes.outCarMaxSize}")
+// private Integer outCarMaxSize;
@Override
public HollowBigStorageDTO queryHollowTargetSlot(String flowCardId, double width, double height, int totalLayer, int layer) {
@@ -99,6 +103,7 @@
.last("limit 1")
);
}
+ Integer slotWidth = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_SLOT_WIDTH);
//璇︽儏琛ㄥ唴鑾峰彇鏈粍鏄惁宸茬粡鏈夌幓鐠冨湪绗煎瓙鍐咃紙0琛ㄧず鎻愬墠鍗犵敤锛�
int taskCount = hollowGlassOutRelationInfoService.count(new LambdaQueryWrapper<HollowGlassOutRelationInfo>()
.eq(HollowGlassOutRelationInfo::getFlowCardId, flowCardId));
@@ -192,7 +197,7 @@
public void generateHollowGlassInfo(String flowCardId, int totalLayer, int layer) {
GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getFlowCardId, flowCardId)
- .eq(GlassInfo::getLayer, layer).last("limit 1"));
+ .eq(GlassInfo::getLayer, layer).orderByDesc(GlassInfo::getId).last("limit 1"));
if (null == glassInfo) {
log.info("褰撳墠娴佺▼鍗′俊鎭负瀵煎叆mes绯荤粺娴佺▼鍗★細{}锛屽眰鏁皗}", flowCardId, layer);
return;
@@ -243,6 +248,10 @@
// List<HollowBigStorageCage> hollowSlotList = HollowBigStorageCageService.list(new LambdaQueryWrapper<HollowBigStorageCage>()
// .eq(HollowBigStorageCage::getEnableState, Const.SLOT_ON).eq(HollowBigStorageCage::getRemainWidth, slotWidth));
//鏂瑰紡浜岋細灏嗙幓鐠冩寜娴佺▼鍗°�佸昂瀵搞�佺増鍥俱�佺増搴� 锛屼紭鍏堝皢鏍煎瓙鍏ㄩ儴琛ュ叏鍚� 渚濇璁$畻鍚庨潰鐨勬牸瀛愬彿
+
+ Integer slotWidth = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_SLOT_WIDTH);
+ Integer glassGap = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_GLASS_GAP);
+ Integer outCarMaxSize = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_OUT_CAR_SIZE);
List<HollowGlassRelationInfo> relationInfoList = new ArrayList();
List<List<HollowGlassRelationInfo>> tempHollowList = new ArrayList<>();
int slotNumber = 1;
@@ -289,7 +298,7 @@
}
@Override
- public Map<String, List<FlowCardGlassInfoDTO>> queryHollowAllFlowCard(HollowBigStorageDetailsQueryVO query) {
+ public List<HollowAllFlowCardVO> queryHollowAllFlowCard(HollowBigStorageDetailsQueryVO query) {
List<HollowBigStorageCageDetails> detailsList = hollowBigStorageCageDetailsService.list(new LambdaQueryWrapper<HollowBigStorageCageDetails>()
.eq(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN)
.like(StringUtils.isNotBlank(query.getFilmsId()), HollowBigStorageCageDetails::getFilmsId, query.getFilmsId())
@@ -299,7 +308,42 @@
);
if (CollectionUtil.isEmpty(detailsList)) {
log.info("绗煎唴鏃犵幓鐠�");
- return new HashMap<>();
+ return new ArrayList<>();
+ }
+ Map<String, List<HollowBigStorageCageDetails>> listMap = detailsList.stream().collect(Collectors.groupingBy(HollowBigStorageCageDetails::getFlowCardId));
+ List<HollowAllFlowCardVO> resultList = new ArrayList<>();
+ listMap.forEach((e, v) -> {
+ HollowAllFlowCardVO hollowAllFlowCardVO = new HollowAllFlowCardVO();
+ HollowBigStorageCageDetails cageDetails = v.get(0);
+ hollowAllFlowCardVO.setFlowCardId(e);
+ if (cageDetails.getHollowSequence() == 0) {
+ hollowAllFlowCardVO.setIsThroughSlot(Boolean.TRUE);
+ } else {
+ hollowAllFlowCardVO.setIsThroughSlot(Boolean.FALSE);
+ }
+ //鎸夌収娴佺▼鍗¤幏鍙栧搴旂殑浜у搧鍚嶇О
+ String productName = baseMapper.queryProductNameByFlowCardId(cageDetails.getFlowCardId());
+ hollowAllFlowCardVO.setProductName(productName);
+ List<FlowCardGlassInfoDTO> flowCardInfoList = hollowBigStorageCageDetailsService.hollowIsAll(e, cageDetails.getTotalLayer(), Boolean.FALSE);
+ hollowAllFlowCardVO.setFlowCardGlassInfoDTOList(flowCardInfoList);
+ resultList.add(hollowAllFlowCardVO);
+ });
+ return resultList;
+// return dtos.stream().collect(Collectors.groupingBy(e -> e.getFlowCardId() + ":" + e.getProductName()));
+ }
+
+ @Override
+ public List<FlowCardGlassInfoDTO> queryHollowAllFlowCardSummary(HollowBigStorageDetailsQueryVO query) {
+ List<HollowBigStorageCageDetails> detailsList = hollowBigStorageCageDetailsService.list(new LambdaQueryWrapper<HollowBigStorageCageDetails>()
+ .eq(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN)
+ .like(StringUtils.isNotBlank(query.getFilmsId()), HollowBigStorageCageDetails::getFilmsId, query.getFilmsId())
+ .like(StringUtils.isNotBlank(query.getFlowCardId()), HollowBigStorageCageDetails::getFlowCardId, query.getFlowCardId())
+ .eq(query.getThickness() != 0, HollowBigStorageCageDetails::getThickness, query.getThickness())
+ .orderByAsc(HollowBigStorageCageDetails::getFlowCardId)
+ );
+ if (CollectionUtil.isEmpty(detailsList)) {
+ log.info("绗煎唴鏃犵幓鐠�");
+ return null;
}
Map<String, List<HollowBigStorageCageDetails>> listMap = detailsList.stream().collect(Collectors.groupingBy(HollowBigStorageCageDetails::getFlowCardId));
List<FlowCardGlassInfoDTO> dtos = new ArrayList<>();
@@ -307,7 +351,32 @@
HollowBigStorageCageDetails cageDetails = v.get(0);
dtos.addAll(hollowBigStorageCageDetailsService.hollowIsAll(e, cageDetails.getTotalLayer(), Boolean.FALSE));
});
- return dtos.stream().collect(Collectors.groupingBy(FlowCardGlassInfoDTO::getFlowCardId));
+ Map<String, FlowCardGlassInfoDTO> result = dtos.stream()
+ .collect(Collectors.toMap(
+ FlowCardGlassInfoDTO::getFlowCardId,
+ dto -> {
+ FlowCardGlassInfoDTO newDto = new FlowCardGlassInfoDTO();
+ newDto.setFlowCardId(dto.getFlowCardId());
+ newDto.setSumCount(dto.getSumCount());
+ newDto.setPairCount(dto.getPairCount());
+ newDto.setRealCount(dto.getRealCount());
+ newDto.setLayer(dto.getLayer());
+ newDto.setSlotCount(dto.getSlotCount());
+ return newDto;
+ },
+ (dto1, dto2) -> {
+ dto1.setRealCount(dto1.getRealCount() + dto2.getRealCount()); // 绱姞 realCount
+ dto1.setLayer(Math.max(dto1.getLayer(), dto2.getLayer())); // 绱姞 鏈�澶у眰鏁�
+ dto1.setSlotCount(dto1.getSlotCount() + dto2.getSlotCount());
+ return dto1; // 杩斿洖鍚堝苟鍚庣殑瀵硅薄
+ }
+ ));
+ List<FlowCardGlassInfoDTO> resultList = new ArrayList<>(result.values());
+ List<FlowCardGlassInfoDTO> sortedList = resultList.stream()
+ .sorted(Comparator.comparing(FlowCardGlassInfoDTO::getRealCount).reversed() // 绗竴涓瓧娈靛�掑簭
+ .thenComparing(FlowCardGlassInfoDTO::getSumCount, Comparator.reverseOrder())) // 绗簩涓瓧娈靛�掑簭
+ .collect(Collectors.toList());
+ return sortedList;
}
@Override
--
Gitblit v1.8.0