From 29f942cefe9d9f4272332eec0276f2c5a60d9d9e Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期三, 08 一月 2025 09:13:42 +0800
Subject: [PATCH] 添加自动下片机打印标签功能
---
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/service/impl/DownGlassInfoServiceImpl.java | 186 ++++++++++++++++++++++++++-------------------
1 files changed, 107 insertions(+), 79 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 f60ea51..bacf1e0 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
@@ -4,13 +4,16 @@
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.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mes.common.config.Const;
import com.mes.downglassinfo.entity.DownGlassInfo;
+import com.mes.downglassinfo.entity.DownGlassTask;
import com.mes.downglassinfo.entity.request.DownGlassInfoRequest;
import com.mes.downglassinfo.mapper.DownGlassInfoMapper;
import com.mes.downglassinfo.service.DownGlassInfoService;
+import com.mes.downglassinfo.service.DownGlassTaskService;
import com.mes.downstorage.entity.DownStorageCageDetails;
import com.mes.downstorage.service.DownStorageCageDetailsService;
import com.mes.downworkstation.entity.DownWorkstation;
@@ -25,11 +28,13 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import javax.annotation.Resource;
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
@@ -50,6 +55,9 @@
@Autowired
FlowCardService flowCardService;
+
+ @Resource
+ DownGlassTaskService downGlassTaskService;
/**
* 鏍规嵁娴佺▼鍗″彿鏌ヨ鏈�澶у簭鍙�
@@ -222,90 +230,110 @@
@Override
public List<Map<String, Object>> downGlassLabelPrint(DownGlassInfo downGlassInfo) {
-
- List<Map<String, Object>> resultList = baseMapper.downGlassLabelPrint(downGlassInfo.getFlowCardId(), downGlassInfo.getLayer());
- log.info("MES钀芥灦鏁版嵁:{}", resultList);
- //鑾峰彇ERP鏍囩鎵�闇�鐨勪俊鎭�
- List<Map<String, Object>> labelInfo;
- if (downGlassInfo.getLayer() != 0) {
- labelInfo = flowCardService.selectLabel(downGlassInfo.getFlowCardId(), downGlassInfo.getLayer());
+ List<Map<String, Object>> resultList = new ArrayList<>();
+ if (downGlassInfo.getFlowCardId() == null) {
+ List<DownGlassTask> downGlassTasks = downGlassTaskService.list(
+ new LambdaQueryWrapper<DownGlassTask>()
+ .eq(DownGlassTask::getEndCell, 7)
+ .eq(DownGlassTask::getTaskType, 3)
+ .lt(DownGlassTask::getTaskStatus, 3)
+ );
+ List<String> glassIds = downGlassTasks.stream().map(DownGlassTask::getGlassId).collect(Collectors.toList());
+ resultList = baseMapper.downGlassLabelPrint(null, null, glassIds);
} else {
- labelInfo = flowCardService.selectLabel(downGlassInfo.getFlowCardId(), 1);
+ resultList = baseMapper.downGlassLabelPrint(downGlassInfo.getFlowCardId(), downGlassInfo.getLayer(), null);
}
- log.info("鏍囩鏁版嵁:{}", labelInfo);
+ if (CollectionUtils.isNotEmpty(resultList)) {
+ List<String> flowCardIds = resultList.stream()
+ .map(map -> (String) map.get("flow_card_id"))
+ .distinct()
+ .collect(Collectors.toList());
+ log.info("MES钀芥灦鏁版嵁:{}", resultList);
+ //鑾峰彇ERP鏍囩鎵�闇�鐨勪俊鎭�
+ List<Map<String, Object>> labelInfo;
+ if (downGlassInfo.getFlowCardId() != null) {
+ flowCardIds.add(downGlassInfo.getFlowCardId());
+ labelInfo = flowCardService.selectLabel(flowCardIds, 1);
+ } else {
+ labelInfo = flowCardService.selectLabel(flowCardIds, 1);
+ }
+ log.info("鏍囩鏁版嵁:{}", labelInfo);
- for (Map<String, Object> row : resultList) {
- int glass_type = (int) row.get("glass_type");
- int layer = (int) row.get("layer");
- for (Map<String, Object> row1 : labelInfo) {
- int orderNumber = (int) row1.get("orderNumber");
- int technologyNumber = (int) row1.get("technologyNumber");
- if (downGlassInfo.getLayer() != 0) {
- if (orderNumber == glass_type && technologyNumber == layer) {
+ for (Map<String, Object> row : resultList) {
+ int glass_type = (int) row.get("glass_type");
+ int layer = (int) row.get("layer");
+ String flowCardId = (String) row.get("flow_card_id");
+ for (Map<String, Object> row1 : labelInfo) {
+ int orderNumber = (int) row1.get("orderNumber");
+ int technologyNumber = (int) row1.get("technologyNumber");
+ String processId = (String) row1.get("process_id");
+// if (downGlassInfo.getLayer() != 0) {
+ if (orderNumber == glass_type && processId.equals(flowCardId)) {
- String order_id = (String) row1.get("order_id");
- String project = (String) row1.get("project");
- Long customer_id = (Long) row1.get("customer_id");
- BigDecimal width = (BigDecimal) row1.get("width");
- BigDecimal height = (BigDecimal) row1.get("height");
- Long quantity = (Long) row1.get("quantity");
- String glass_child = (String) row1.get("glass_child");
- String process = (String) row1.get("process");
- String customer_name = (String) row1.get("customer_name");
- String processing_note = (String) row1.get("processing_note");
- String other_colunmns = (String) row1.get("other_colunmns");
- String building_number = (String) row1.get("building_number");
- String bend_radius = (String) row1.get("bend_radius");
+ String order_id = (String) row1.get("order_id");
+ String project = (String) row1.get("project");
+ Long customer_id = (Long) row1.get("customer_id");
+ BigDecimal width = (BigDecimal) row1.get("width");
+ BigDecimal height = (BigDecimal) row1.get("height");
+ Long quantity = (Long) row1.get("quantity");
+ String glass_child = (String) row1.get("glass_child");
+ String process = (String) row1.get("process");
+ String customer_name = (String) row1.get("customer_name");
+ String processing_note = (String) row1.get("processing_note");
+ String other_colunmns = (String) row1.get("other_colunmns");
+ String building_number = (String) row1.get("building_number");
+ String bend_radius = (String) row1.get("bend_radius");
- row.put("orderNumber", orderNumber);
- row.put("technology_number", technologyNumber);
- row.put("order_id", order_id);
- row.put("project", project);
- row.put("customer_id", customer_id);
- row.put("width", width);
- row.put("height", height);
- row.put("quantity", quantity);
- row.put("glass_child", glass_child);
- row.put("process", process);
- row.put("customer_name", customer_name);
- row.put("processing_note", processing_note);
- row.put("other_colunmns", other_colunmns);
- row.put("building_number", building_number);
- row.put("bend_radius", bend_radius);
- }
- } else {
- if (orderNumber == glass_type) {
-
- String order_id = (String) row1.get("order_id");
- String project = (String) row1.get("project");
- Long customer_id = (Long) row1.get("customer_id");
- BigDecimal width = (BigDecimal) row1.get("width");
- BigDecimal height = (BigDecimal) row1.get("height");
- Long quantity = (Long) row1.get("quantity");
- String glass_child = (String) row1.get("glass_child");
- String process = (String) row1.get("process");
- String customer_name = (String) row1.get("customer_name");
- String processing_note = (String) row1.get("processing_note");
- String other_colunmns = (String) row1.get("other_colunmns");
- String building_number = (String) row1.get("building_number");
- String bend_radius = (String) row1.get("bend_radius");
-
- row.put("orderNumber", orderNumber);
- row.put("technology_number", technologyNumber);
- row.put("order_id", order_id);
- row.put("project", project);
- row.put("customer_id", customer_id);
- row.put("width", width);
- row.put("height", height);
- row.put("quantity", quantity);
- row.put("glass_child", glass_child);
- row.put("process", process);
- row.put("customer_name", customer_name);
- row.put("processing_note", processing_note);
- row.put("other_colunmns", other_colunmns);
- row.put("building_number", building_number);
- row.put("bend_radius", bend_radius);
- }
+ row.put("orderNumber", orderNumber);
+ row.put("technology_number", technologyNumber);
+ row.put("order_id", order_id);
+ row.put("project", project);
+ row.put("customer_id", customer_id);
+ row.put("width", width);
+ row.put("height", height);
+ row.put("quantity", quantity);
+ row.put("glass_child", glass_child);
+ row.put("process", process);
+ row.put("customer_name", customer_name);
+ row.put("processing_note", processing_note);
+ row.put("other_colunmns", other_colunmns);
+ row.put("building_number", building_number);
+ row.put("bend_radius", bend_radius);
+ }
+// } else {
+// if (orderNumber == glass_type) {
+//
+// String order_id = (String) row1.get("order_id");
+// String project = (String) row1.get("project");
+// Long customer_id = (Long) row1.get("customer_id");
+// BigDecimal width = (BigDecimal) row1.get("width");
+// BigDecimal height = (BigDecimal) row1.get("height");
+// Long quantity = (Long) row1.get("quantity");
+// String glass_child = (String) row1.get("glass_child");
+// String process = (String) row1.get("process");
+// String customer_name = (String) row1.get("customer_name");
+// String processing_note = (String) row1.get("processing_note");
+// String other_colunmns = (String) row1.get("other_colunmns");
+// String building_number = (String) row1.get("building_number");
+// String bend_radius = (String) row1.get("bend_radius");
+//
+// row.put("orderNumber", orderNumber);
+// row.put("technology_number", technologyNumber);
+// row.put("order_id", order_id);
+// row.put("project", project);
+// row.put("customer_id", customer_id);
+// row.put("width", width);
+// row.put("height", height);
+// row.put("quantity", quantity);
+// row.put("glass_child", glass_child);
+// row.put("process", process);
+// row.put("customer_name", customer_name);
+// row.put("processing_note", processing_note);
+// row.put("other_colunmns", other_colunmns);
+// row.put("building_number", building_number);
+// row.put("bend_radius", bend_radius);
+// }
+// }
}
}
}
--
Gitblit v1.8.0