From b460ec7a380334516ec478544afe42df409f4c54 Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期二, 25 十一月 2025 09:50:20 +0800
Subject: [PATCH] 1、中空夹胶线出片逻辑优化 2、钢化前卧转新增协议卧转立允许信号
---
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 101 insertions(+), 2 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 2299c73..591ee47 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
@@ -7,6 +7,7 @@
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mes.common.config.Const;
import com.mes.common.config.ConstSysConfig;
+import com.mes.damage.entity.Damage;
import com.mes.damage.entity.request.DamageRequest;
import com.mes.damage.service.DamageService;
import com.mes.glassinfo.entity.GlassInfo;
@@ -15,7 +16,9 @@
import com.mes.hollow.entity.HollowBigStorageCageDetails;
import com.mes.hollow.entity.HollowGlassOutRelationInfo;
import com.mes.hollow.entity.HollowGlassRelationInfo;
-import com.mes.hollow.entity.dto.*;
+import com.mes.hollow.entity.dto.FlowCardGlassInfoDTO;
+import com.mes.hollow.entity.dto.HollowBigStorageDTO;
+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;
@@ -25,6 +28,7 @@
import com.mes.hollow.service.HollowGlassRelationInfoService;
import com.mes.order.entity.HollowGlassDetailsDTO;
import com.mes.order.entity.OrderDetailsDTO;
+import com.mes.order.entity.ProcessCardReport;
import com.mes.order.service.OrdersService;
import com.mes.sysconfig.service.SysConfigService;
import lombok.extern.slf4j.Slf4j;
@@ -112,11 +116,24 @@
if (null == relationInfoOne) {
throw new RuntimeException("鐩稿叧娴佺▼鍗℃湭鎵惧埌瀵瑰簲鐨勭粍鍙蜂俊鎭紝鐜荤拑娴佺▼鍗★細" + flowCardId + "锛屽簭鍙凤細" + glassType + "锛屾�诲眰鏁帮細" + totalLayer + "锛屽眰鏁帮細" + layer);
}
+ Integer slotMaxHeight = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_SLOT_MAX_HEIGHT);
Integer slotWidth = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_SLOT_WIDTH);
+ HollowBigStorageCage storageCage = null;
+ if (Math.min(width, height) > slotMaxHeight) {
+ storageCage = hollowBigStorageCageService.getOne(new LambdaQueryWrapper<HollowBigStorageCage>()
+ .eq(HollowBigStorageCage::getEnableState, Const.SLOT_ON).eq(HollowBigStorageCage::getRemainWidth, slotWidth)
+ .eq(HollowBigStorageCage::getDeviceId, 6)
+ .orderByAsc(HollowBigStorageCage::getMaxThickness).last("limit 1"));
+ HollowBigStorageDTO storageDTO = new HollowBigStorageDTO();
+ BeanUtils.copyProperties(storageCage, storageDTO);
+ BeanUtils.copyProperties(relationInfoOne, storageDTO);
+ return storageDTO;
+ }
+
//璇︽儏琛ㄥ唴鑾峰彇鏈粍鏄惁宸茬粡鏈夌幓鐠冨湪绗煎瓙鍐咃紙0琛ㄧず鎻愬墠鍗犵敤锛�
int taskCount = hollowGlassOutRelationInfoService.count(new LambdaQueryWrapper<HollowGlassOutRelationInfo>()
.eq(HollowGlassOutRelationInfo::getFlowCardId, flowCardId));
- HollowBigStorageCage storageCage = null;
+
//濡傛灉涓嶅瓨鍦ㄥ垯閫夋嫨绗煎唴鏈敤鐨勬柊鏍煎瓙
if (taskCount > 0) {
storageCage = hollowBigStorageCageService.getOne(new LambdaQueryWrapper<HollowBigStorageCage>()
@@ -419,6 +436,88 @@
}
@Override
+ public Map<Integer, List<LackDetailsDTO>> queryLackByFlowCardByERP(String flowCardId) {
+ List<ProcessCardReport> processCardReports = ordersService.queryLackByERP(flowCardId);
+ if (CollectionUtil.isEmpty(processCardReports)) {
+ return null;
+ }
+ List<HollowBigStorageCageDetails> hollowBigStorageCageDetails = hollowBigStorageCageDetailsService.list(
+ new LambdaQueryWrapper<HollowBigStorageCageDetails>()
+ .eq(HollowBigStorageCageDetails::getFlowCardId, flowCardId)
+ .in(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL)
+ );
+ // 1. 缁熻姣忎釜 (glassType, layer) 缁勫悎鐨勫嚭鐜版鏁�
+ Map<String, Long> typeLayerCountMap = hollowBigStorageCageDetails.stream()
+ .map(detail -> detail.getGlassType() + "_" + detail.getLayer())
+ .collect(Collectors.groupingBy(
+ key -> key, // 浠ュ鍚堥敭涓哄垎缁勪緷鎹�
+ Collectors.counting() // 缁熻姣忎釜閿殑鍑虹幇娆℃暟
+ ));
+ // 2. 閬嶅巻骞舵寜娆℃暟鍑� quantity锛堥伩鍏嶈礋鏁帮級
+ processCardReports.forEach(report -> {
+ String reportPair = report.getOrderNumber() + "_" + report.getTechnologyNumber();
+ Long count = typeLayerCountMap.getOrDefault(reportPair, 0L);
+ if (count > 0) {
+ int newQuantity = Math.max(0, report.getLackQuantity() - count.intValue());
+ report.setLackQuantity(newQuantity);
+ }
+ });
+ List<LackDetailsDTO> detailsDTOS = baseMapper.queryLackByFlowCardByERP(processCardReports);
+ List<Damage> damages = damageService.queryUnTempByFlowCardId(flowCardId);
+// 1. 鎸�(orderNumber+layer)鍒嗙粍锛屽悓鏃剁紦瀛楧TO鐨勫叾浠栧瓧娈典綔涓烘ā鏉�
+ Map<String, List<Damage>> damageMap = new HashMap<>();
+ Map<String, LackDetailsDTO> dtoTemplateMap = new HashMap<>(); // 瀛樺偍鍒嗙粍瀵瑰簲鐨凞TO妯℃澘
+
+// 1.1 鍒濆鍖杁amage鍒嗙粍鍜孌TO妯℃澘
+ damages.forEach(damage -> {
+ if (damage.getOrderNumber() == null || damage.getTechnologyNumber() == null) {
+ return;
+ }
+ String key = damage.getOrderNumber() + "_" + damage.getTechnologyNumber();
+ damageMap.computeIfAbsent(key, k -> new ArrayList<>()).add(damage);
+ });
+
+ detailsDTOS.forEach(dto -> {
+ if (dto.getGlassType() == null || dto.getLayer() == null) {
+ return;
+ }
+ String key = dto.getGlassType() + "_" + dto.getLayer();
+ // 缂撳瓨绗竴涓狣TO浣滀负妯℃澘锛堝寘鍚叾浠栧瓧娈靛�硷級
+ dtoTemplateMap.putIfAbsent(key, dto);
+ });
+
+// 2. 鍖归厤骞舵洿鏂板師濮婦TO
+ detailsDTOS.forEach(dto -> {
+ if (dto.getGlassType() == null || dto.getLayer() == null) {
+ return;
+ }
+ String key = dto.getGlassType() + "_" + dto.getLayer();
+ List<Damage> damagess = damageMap.get(key);
+ if (damagess != null && !damagess.isEmpty()) {
+ Damage damage = damagess.remove(0);
+ dto.setGlassId(damage.getGlassId());
+ dto.setWorkingProcedure(damage.getWorkingProcedure());
+ }
+ });
+
+// 3. 澶勭悊鍓╀綑damage锛氬鐢ㄥ悓缁凞TO妯℃澘鐨勫叾浠栧瓧娈�
+ damageMap.values().forEach(damagess -> damagess.forEach(damage -> {
+ String key = damage.getOrderNumber() + "_" + damage.getTechnologyNumber();
+ LackDetailsDTO template = dtoTemplateMap.get(key); // 鑾峰彇鍚岀粍妯℃澘
+ if (template == null) return; // 鏃犳ā鏉垮垯璺宠繃锛堢悊璁轰笂涓嶄細鍑虹幇锛�
+
+ LackDetailsDTO newDto = new LackDetailsDTO();
+ // 1. 澶嶅埗妯℃澘涓殑鍏朵粬瀛楁锛堥櫎浜唃lassId鍜寃orkproduce锛�
+ BeanUtils.copyProperties(template, newDto); // 鐢⊿pring鐨勫伐鍏风被澶嶅埗灞炴��
+ // 2. 瑕嗙洊glassId鍜寃orkproduce涓哄綋鍓峝amage鐨勫��
+ newDto.setGlassId(damage.getGlassId());
+ newDto.setWorkingProcedure("鏈煡");
+ detailsDTOS.add(newDto);
+ }));
+ return detailsDTOS.stream().collect(Collectors.groupingBy(item -> item.getLayer()));
+ }
+
+ @Override
public Integer getGlassGapByThickness(Double thickness) {
int sysKey = 0;
if (thickness >= 12) {
--
Gitblit v1.8.0