From 5985a3693d4d902455b9fd46b052362417b044d7 Mon Sep 17 00:00:00 2001 From: wu <731351411@qq.com> Date: 星期五, 16 八月 2024 16:32:09 +0800 Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/HangZhouMes --- hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/service/impl/DownGlassInfoServiceImpl.java | 82 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 82 insertions(+), 0 deletions(-) diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/service/impl/DownGlassInfoServiceImpl.java b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/service/impl/DownGlassInfoServiceImpl.java index df42fe4..6cd6519 100644 --- a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/service/impl/DownGlassInfoServiceImpl.java +++ b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/service/impl/DownGlassInfoServiceImpl.java @@ -1,7 +1,9 @@ package com.mes.downglassinfo.service.impl; import cn.smallbun.screw.core.util.CollectionUtils; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -18,14 +20,20 @@ import com.mes.downworkstation.service.DownWorkstationService; import com.mes.glassinfo.entity.GlassInfo; import com.mes.job.DownLoadCacheGlassTask; +import com.mes.pp.service.FlowCardService; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.math.BigDecimal; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.stream.Collectors; +@Slf4j @Service public class DownGlassInfoServiceImpl extends ServiceImpl<DownGlassInfoMapper, DownGlassInfo> implements DownGlassInfoService { @@ -41,6 +49,9 @@ @Autowired RedisUtil redisUtil; + + @Autowired + FlowCardService flowCardService; /** * 鏍规嵁娴佺▼鍗″彿鏌ヨ鏈�澶у簭鍙� @@ -97,6 +108,7 @@ BeanUtils.copyProperties(details, downGlassInfo); //鑾峰彇褰撳墠娴佺▼鍗℃渶澶х墖搴� downGlassInfo.setSequence(this.getMaxSequenceByFlowCardId(details.getFlowCardId(), details.getLayer()) + 1); + downGlassInfo.setWorkStationId(Const.G13_WORK_STATION); this.save(downGlassInfo); //鐢熸垚浠诲姟淇℃伅 骞跺悜plc鍙戦�佸嚭鐗囦换鍔� GlassInfo glassInfo = new GlassInfo(); @@ -138,4 +150,74 @@ } return workstationFull; } + + @Override + public List<Map<String, List<Map<String, Object>>>> downGlassPrint(DownGlassInfo downGlassInfo) { + log.info("鎵撳嵃鍙傛暟:{}", downGlassInfo); + QueryWrapper<DownGlassInfo> queryWrapper = Wrappers.query(); + queryWrapper.eq("flow_card_id", downGlassInfo.getFlowCardId()) + .eq("layer", downGlassInfo.getLayer()) + .select("flow_card_id", "layer", "width", "height", "filmsid", "thickness", "glass_type", "COUNT(*) AS quantity") + .groupBy("flow_card_id", "layer", "width", "height", "filmsid", "thickness", "glass_type","id") + .orderByAsc("id"); + List<Map<String, Object>> resultList = baseMapper.selectMaps(queryWrapper); + log.info("MES钀芥灦鏁版嵁:{}", resultList); + + List<Map<String, Object>> projectInfo = flowCardService.selectProject(downGlassInfo.getFlowCardId(), downGlassInfo.getLayer()); + log.info("娴佺▼鍗″ご閮ㄦ暟鎹�:{}", projectInfo); + List<Map<String, Object>> flowCardInfo = flowCardService.selectFlowCard(downGlassInfo.getFlowCardId(), downGlassInfo.getLayer()); + log.info("娴佺▼鍗$幓鐠冩暟鎹�:{}", flowCardInfo); + for (Map<String, Object> row : resultList) { + int glass_type = (int) row.get("glass_type"); + int layer = (int) row.get("layer"); + Long quantity1 = (Long) row.get("quantity"); + + for (Map<String, Object> row1 : flowCardInfo) { + int order_number = (int) row1.get("order_number"); + int technology_number = (int) row1.get("technology_number"); + String child_width = (String) row1.get("child_width"); + Long quantity = (Long) row1.get("quantity"); + BigDecimal total_area = (BigDecimal) row1.get("total_area"); + String separation = (String) row1.get("separation"); + String perimeter = (String) row1.get("perimeter"); + BigDecimal width = (BigDecimal) row1.get("width"); + String other_columns = (String) row1.get("other_columns"); + String remarks = (String) row1.get("remarks"); + BigDecimal height = (BigDecimal) row1.get("height"); + if (order_number == glass_type && technology_number == layer) { +// row.put("quantity1", quantity1); +// row.put("quantity", quantity); + row.put("order_number", order_number); + row.put("technology_number", technology_number); + row.put("child_width", child_width); + row.put("total_area", total_area); + row.put("separation", separation); + row.put("perimeter", perimeter); + row.put("width", width); + row.put("other_columns", other_columns); + row.put("remarks", remarks); + row.put("height", height); + } + } + } + log.info("娴佺▼鍗$幓鐠冩暟鎹�2:{}", flowCardInfo); + List<Map<String, List<Map<String, Object>>>> listMap = new ArrayList<>(); + Map<String, List<Map<String, Object>>> result = new HashMap<>(); + result.put("detail", projectInfo); + result.put("detailList", resultList); + for (Map<String, Object> row : projectInfo) { + String order_number = (String) row.get("process"); + String[] processes = order_number.split("->"); + List<Map<String, Object>> processList = new ArrayList<>(); + for (int i = 0; i < processes.length; i++) { + Map<String, Object> processMap = new JSONObject(); + processMap.put("process", processes[i]); + processMap.put("id", i); + processList.add(processMap); + } + result.put("processList", processList); + } + listMap.add(result); + return listMap; + } } -- Gitblit v1.8.0