2025-05-26 | zhoushihao | ![]() |
2025-05-26 | zhoushihao | ![]() |
2025-05-26 | zhoushihao | ![]() |
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/impl/BigStorageCageDetailsServiceImpl.java
@@ -77,8 +77,6 @@ @Resource private SysConfigService sysConfigService; // @Resource // private PlcStorageCageTask plcStorageCageTask; @Resource private DamageService damageService; @@ -407,16 +405,26 @@ .eq(TemperingGlassInfo::getState, Const.TEMPERING_NEW); List<TemperingGlassInfo> temperingGlassInfoList = temperingGlassInfoMapper.selectList(temperingGlassInfoLambdaQueryWrapper); int dispatchCount = bigStorageCageHistoryTaskService.count(new LambdaQueryWrapper<BigStorageCageHistoryTask>() .eq(BigStorageCageHistoryTask::getTaskState, Const.GLASS_STATE_NEW) .eq(BigStorageCageHistoryTask::getTaskType, Const.BIG_STORAGE_BEFORE_DISPATCH)); if (temperingGlassInfoList.size() == 0) { List<TemperingGlassInfo> temperingGlassInfos = glassInfoService.selectJoinList(TemperingGlassInfo.class, JoinWrappers.lambda(GlassInfo.class) MPJLambdaWrapper<GlassInfo> wrapper = JoinWrappers.lambda(GlassInfo.class) .select("-1 as state,t.filmsid as films_id,t.glass_id,t.flow_card_id,t.glass_type,t.width,t.height" + ",t.thickness,t.ishorizontal,t.tempering_layout_id,t.tempering_feed_sequence,t.x_coordinate,t.y_coordinate," + "t.angle,t1.slot,t.engineer_id") .innerJoin(BigStorageCageDetails.class, BigStorageCageDetails::getGlassId, GlassInfo::getGlassId) .eq(GlassInfo::getTemperingLayoutId, temperingLayoutId) .eq(GlassInfo::getEngineerId, engineerId) .in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN) .orderBy(Boolean.TRUE, sequenceOrder, GlassInfo::getTemperingFeedSequence)); .orderBy(Boolean.TRUE, sequenceOrder, GlassInfo::getTemperingFeedSequence); if (dispatchCount > 0) { wrapper.in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL); } else { wrapper.in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN); } List<TemperingGlassInfo> temperingGlassInfos = glassInfoService.selectJoinList(TemperingGlassInfo.class, wrapper); if (CollectionUtils.isNotEmpty(temperingGlassInfos)) { if ("0".equals(temperingFeedSequence)) { if (CollectionUtils.isNotEmpty(temperingGlassInfos)) { @@ -504,18 +512,27 @@ .eq(TemperingGlassInfo::getState, Const.TEMPERING_NEW); List<TemperingGlassInfo> temperingGlassInfoList = temperingGlassInfoMapper.selectList(temperingGlassInfoLambdaQueryWrapper); int dispatchCount = bigStorageCageHistoryTaskService.count(new LambdaQueryWrapper<BigStorageCageHistoryTask>() .eq(BigStorageCageHistoryTask::getTaskState, Const.GLASS_STATE_NEW) .eq(BigStorageCageHistoryTask::getTaskType, Const.BIG_STORAGE_BEFORE_DISPATCH)); if (temperingGlassInfoList.size() == 0) { List<TemperingGlassInfo> temperingGlassInfos = glassInfoService.selectJoinList(TemperingGlassInfo.class, JoinWrappers.lambda(GlassInfo.class) MPJLambdaWrapper<GlassInfo> wrapper = JoinWrappers.lambda(GlassInfo.class) .select("-1 as state,t.filmsid as films_id,t.glass_id,t.flow_card_id,t.glass_type,t.width,t.height" + ",t.thickness,t.ishorizontal,t.tempering_layout_id,t.tempering_feed_sequence,t.x_coordinate,t.y_coordinate," + "t.angle,t1.slot,t.engineer_id") .innerJoin(BigStorageCageDetails.class, BigStorageCageDetails::getGlassId, GlassInfo::getGlassId) .eq(GlassInfo::getEngineerId, engineerId) .ne(GlassInfo::getTemperingLayoutId, 0) .in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN) .orderByAsc(BigStorageCageDetails::getTemperingLayoutId) .orderByAsc(BigStorageCageDetails::getTemperingFeedSequence) ); .orderByAsc(BigStorageCageDetails::getTemperingFeedSequence); if (dispatchCount > 0) { wrapper.in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL); } else { wrapper.in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN); } List<TemperingGlassInfo> temperingGlassInfos = glassInfoService.selectJoinList(TemperingGlassInfo.class, wrapper); if (CollectionUtils.isNotEmpty(temperingGlassInfos)) { //避免大量数据插入导致sqlserver数据库异常,分批次每调存储依次 List<List<TemperingGlassInfo>> temperingGlassInfoLists = Lists.partition(temperingGlassInfos, 50); hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageNewTask.java
@@ -494,7 +494,7 @@ //获取进片任务表 List<BigStorageCageTask> outTaskList = bigStorageCageTaskService.queryTaskMessage("big_storage_cage_out_one_task"); if (CollectionUtil.isEmpty(outTaskList)) { log.info("当前大车无进片玻璃,结束完成进片任务"); log.info("当前大车无出片玻璃,结束完成出片任务"); return; } List<BigStorageCageTask> unFinishTaskList = outTaskList.stream().filter(e -> e.getTaskState() <= 1 || e.getStartSlot() == 0).collect(Collectors.toList()); hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/entity/dto/OrderDetailsDTO.java
New file @@ -0,0 +1,21 @@ package com.mes.hollow.entity.dto; import lombok.Data; /** * @Author : zhoush * @Date: 2025/5/23 15:18 * @Description:客户相关信息 */ @Data public class OrderDetailsDTO { /** * 客户名称 */ private String customerName; /** * 产品名称 */ private String productName; } hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/entity/vo/HollowAllFlowCardVO.java
@@ -15,11 +15,15 @@ /** * 流程卡号 */ private String FlowCardId; private String flowCardId; /** * 客户名称 */ private String customerName; /** * 产品名称 */ private String ProductName; private String productName; /** * 是否直通 */ hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/mapper/HollowGlassRelationInfoMapper.java
@@ -4,6 +4,7 @@ import com.mes.hollow.entity.HollowGlassRelationInfo; import com.mes.hollow.entity.dto.HollowGlassDetailsDTO; import com.mes.hollow.entity.dto.LackDetailsDTO; import com.mes.hollow.entity.dto.OrderDetailsDTO; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -34,6 +35,6 @@ * @param flowCardId * @return */ String queryProductNameByFlowCardId(@Param("flowCardId") String flowCardId); OrderDetailsDTO queryProductNameByFlowCardId(@Param("flowCardId") String flowCardId); } hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java
@@ -13,10 +13,7 @@ import com.mes.hollow.entity.HollowBigStorageCageDetails; import com.mes.hollow.entity.HollowGlassOutRelationInfo; import com.mes.hollow.entity.HollowGlassRelationInfo; import com.mes.hollow.entity.dto.FlowCardGlassInfoDTO; 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.dto.*; import com.mes.hollow.entity.vo.HollowAllFlowCardVO; import com.mes.hollow.entity.vo.HollowBigStorageDetailsQueryVO; import com.mes.hollow.mapper.HollowGlassRelationInfoMapper; @@ -30,10 +27,13 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.math.BigInteger; import java.util.ArrayList; import java.util.Comparator; import java.util.List; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; /** @@ -315,21 +315,23 @@ listMap.forEach((e, v) -> { HollowAllFlowCardVO hollowAllFlowCardVO = new HollowAllFlowCardVO(); HollowBigStorageCageDetails cageDetails = v.get(0); //按照流程卡获取对应的产品名称 OrderDetailsDTO orderDetails = baseMapper.queryProductNameByFlowCardId(cageDetails.getFlowCardId()); if (null != orderDetails) { BeanUtils.copyProperties(orderDetails, hollowAllFlowCardVO); } 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); }); sortFlowCardIdList(resultList); return resultList; // return dtos.stream().collect(Collectors.groupingBy(e -> e.getFlowCardId() + ":" + e.getProductName())); } @Override @@ -396,5 +398,33 @@ // return lackDetailsList; // } private void sortFlowCardIdList(List<HollowAllFlowCardVO> list) { Pattern pattern = Pattern.compile("^NG(\\d+)([A-Za-z]+)(\\d+)$"); list.sort((v1, v2) -> { Matcher m1 = pattern.matcher(v1.getFlowCardId()); Matcher m2 = pattern.matcher(v2.getFlowCardId()); if (!m1.find() || !m2.find()) { throw new IllegalArgumentException("获取到的流程卡不符合校验规则"); } // 提取部分 BigInteger order1 = new BigInteger(m1.group(1)); BigInteger order2 = new BigInteger(m2.group(1)); String layer1 = m1.group(2); String layer2 = m2.group(2); BigInteger seq1 = new BigInteger(m1.group(3)); BigInteger seq2 = new BigInteger(m2.group(3)); // 优先级排序 int cmp = order1.compareTo(order2); if (cmp != 0) return cmp; cmp = layer1.compareTo(layer2); if (cmp != 0) return cmp; return seq1.compareTo(seq2); }); } } hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowGlassRelationInfoMapper.xml
@@ -129,10 +129,11 @@ from hollow_glass_relation_info where flow_card_id = #{flowCardId} </select> <select id="queryProductNameByFlowCardId" resultType="java.lang.String"> select product_name from sd.order_detail where (order_id, order_number) = ( <select id="queryProductNameByFlowCardId" resultType="com.mes.hollow.entity.dto.OrderDetailsDTO"> select t.product_name, t1.customer_name from sd.order_detail t inner join sd.order t1 on t.order_id = t1.order_id where (t.order_id, t.order_number) = ( select min(order_id) as order_id, min(order_number) as order_number from pp.flow_card where process_id = #{flowCardId}