From 6edb8b29c0b4ab9dd81f824eb5f24fa17cf6fe13 Mon Sep 17 00:00:00 2001
From: chenlu <1320612696@qq.com>
Date: 星期三, 02 七月 2025 14:07:18 +0800
Subject: [PATCH] 可编辑标签打印添加订单总数字段
---
north-glass-erp/src/main/java/com/example/erp/service/pp/FlowCardService.java | 132 ++++++++++++++++++++++++++++++++++++-------
1 files changed, 109 insertions(+), 23 deletions(-)
diff --git a/north-glass-erp/src/main/java/com/example/erp/service/pp/FlowCardService.java b/north-glass-erp/src/main/java/com/example/erp/service/pp/FlowCardService.java
index d73bda6..ccc6c70 100644
--- a/north-glass-erp/src/main/java/com/example/erp/service/pp/FlowCardService.java
+++ b/north-glass-erp/src/main/java/com/example/erp/service/pp/FlowCardService.java
@@ -7,16 +7,14 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.erp.common.Constants;
import com.example.erp.entity.pp.FlowCard;
-import com.example.erp.entity.sd.OrderDetail;
-import com.example.erp.entity.sd.OrderGlassDetail;
-import com.example.erp.entity.sd.OrderProcessDetail;
+import com.example.erp.entity.sd.*;
import com.example.erp.entity.userInfo.Log;
import com.example.erp.exception.ServiceException;
import com.example.erp.mapper.pp.FlowCardMapper;
-import com.example.erp.mapper.sd.OrderGlassDetailMapper;
-import com.example.erp.mapper.sd.OrderProcessDetailMapper;
+import com.example.erp.mapper.sd.*;
import com.example.erp.service.userInfo.LogService;
import com.fasterxml.jackson.databind.ObjectMapper;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
@@ -45,12 +43,21 @@
OrderProcessDetailMapper orderProcessDetailMapper;
final
LogService logService;
+ private final ProductMapper productMapper;
+ private final ProductDetailMapper productDetailMapper;
- public FlowCardService(FlowCardMapper flowCardMapper, OrderGlassDetailMapper orderGlassDetailMapper, OrderProcessDetailMapper orderProcessDetailMapper, LogService logService) {
+ private final OrderDetailMapper orderDetailMapper;
+ private final OrderMapper orderMapper;
+
+ public FlowCardService(FlowCardMapper flowCardMapper, OrderGlassDetailMapper orderGlassDetailMapper, OrderProcessDetailMapper orderProcessDetailMapper, LogService logService, ProductMapper productMapper, ProductDetailMapper productDetailMapper, OrderDetailMapper orderDetailMapper, OrderMapper orderMapper) {
this.flowCardMapper = flowCardMapper;
this.orderGlassDetailMapper = orderGlassDetailMapper;
this.orderProcessDetailMapper = orderProcessDetailMapper;
this.logService = logService;
+ this.productMapper = productMapper;
+ this.productDetailMapper = productDetailMapper;
+ this.orderDetailMapper = orderDetailMapper;
+ this.orderMapper = orderMapper;
}
//娴佺▼鍗$鐞嗘煡璇�
@@ -304,8 +311,11 @@
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();//鏈�缁堢粨鏋�
List<FlowCard> flowCardList = JSONArray.parseArray(JSONObject.toJSONString(object.get("printList")), FlowCard.class);
if (!flowCardList.isEmpty()) {
- Set<String> processedProcessIds = new HashSet<>(); // 鐢ㄦ潵瀛樻斁宸插鐞嗚繃鐨� processId
+ Set<String> processedKeys = new HashSet<>();
for (FlowCard flowCard : flowCardList) {
+ String processId = flowCard.getProcessId();
+ Integer orderNumber = flowCard.getOrderNumber();
+ String uniqueKey = processId + "|" + orderNumber; // 鐢ㄧ壒娈婂瓧绗﹁繛鎺ラ槻姝㈠啿绐�
Map<String, Object> itemmap = new HashMap<>();
//娴佺▼鍗¤〃澶磋〃灏炬暟鎹�
//鏄惁浼犲叆鍚堝苟灞傛暟
@@ -323,11 +333,11 @@
} else {
if (merge.equals("1") && flowCard.getMerge().equals(1)) {
// 妫�鏌ユ槸鍚﹀凡缁忓鐞嗚繃璇� processId锛屽鏋滃鐞嗚繃鍒欒烦杩�
- if (processedProcessIds.contains(flowCard.getProcessId())) {
+ if (processedKeys.contains(uniqueKey)) {
continue;
}
// 灏嗚 processId 鍔犲叆宸插鐞嗛泦鍚�
- processedProcessIds.add(flowCard.getProcessId());
+ processedKeys.add(uniqueKey);
itemmap.put("detail", flowCardMapper.getPrimaryList(flowCard.getProcessId(), String.valueOf(flowCard.getTechnologyNumber()), flowCard.getGlassChild(), flowCard.getProcess(), flowCard.getOrderId()));
List<Map<String, Object>> detailList = flowCardMapper.getDetailListMerge(flowCard.getProcessId(), flowCard.getProcess());
@@ -400,11 +410,14 @@
}
List<FlowCard> flowCardList = flowCardMapper.getFlowCardListPrintProject(printProject);
if (!flowCardList.isEmpty()) {
- Set<String> processedProcessIds = new HashSet<>(); // 鐢ㄦ潵瀛樻斁宸插鐞嗚繃鐨� processId
+ Set<String> processedKeys = new HashSet<>();
+
for (FlowCard flowCard : flowCardList) {
Map<String, Object> itemmap = new HashMap<>();
-
+ String processId = flowCard.getProcessId();
+ Integer orderNumber = flowCard.getOrderNumber();
+ String uniqueKey = processId + "|" + orderNumber; // 鐢ㄧ壒娈婂瓧绗﹁繛鎺ラ槻姝㈠啿绐�
//鏄惁鍖呭惈鍒囧壊
//boolean containsCutting = flowCard.getProcess().contains("鍒囧壊");
String processSub = flowCard.getProcess().substring(0, 2);
@@ -425,11 +438,11 @@
if (flowCard.getPatchState().equals(0)) {
if (merge.equals("1") && flowCard.getMerge().equals(1)) {
// 妫�鏌ユ槸鍚﹀凡缁忓鐞嗚繃璇� processId锛屽鏋滃鐞嗚繃鍒欒烦杩�
- if (processedProcessIds.contains(flowCard.getProcessId())) {
+ if (processedKeys.contains(uniqueKey)) {
continue;
}
// 灏嗚 processId 鍔犲叆宸插鐞嗛泦鍚�
- processedProcessIds.add(flowCard.getProcessId());
+ processedKeys.add(uniqueKey);
itemmap.put("detail", flowCardMapper.getPrimaryList(flowCard.getProcessId(), String.valueOf(flowCard.getTechnologyNumber()), flowCard.getGlassChild(), flowCard.getProcess(), flowCard.getOrderId()));
List<Map<String, Object>> detailList = flowCardMapper.getDetailListMerge(flowCard.getProcessId(), flowCard.getProcess());
@@ -589,14 +602,15 @@
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();//鏈�缁堢粨鏋�
List<FlowCard> flowCardList = JSONArray.parseArray(JSONObject.toJSONString(object.get("printList")), FlowCard.class);
if (!flowCardList.isEmpty()) {
- Set<String> processedProcessIds = new HashSet<>(); // 鐢ㄦ潵瀛樻斁宸插鐞嗚繃鐨� processId
+ Set<String> processedKeys = new HashSet<>();
if (lableType != 2) {//鎴愬搧鏍囩
for (FlowCard flowCard : flowCardList) {
String processId = flowCard.getProcessId();
-
+ Integer orderNumber = flowCard.getOrderNumber();
+ String uniqueKey = processId + "|" + orderNumber; // 鐢ㄧ壒娈婂瓧绗﹁繛鎺ラ槻姝㈠啿绐�
// 妫�鏌ユ槸鍚﹀凡缁忓鐞嗚繃璇� processId锛屽鏋滃鐞嗚繃鍒欒烦杩�
- if (processedProcessIds.contains(processId)) {
+ if (processedKeys.contains(uniqueKey)) {
continue;
}
Map<String, Object> itemmap = new HashMap<>();
@@ -604,7 +618,7 @@
list.add(itemmap);
// 灏嗚 processId 鍔犲叆宸插鐞嗛泦鍚�
- processedProcessIds.add(processId);
+ processedKeys.add(uniqueKey);
}
} else {//灏忕墖鏍囩
for (FlowCard flowCard : flowCardList) {
@@ -624,14 +638,15 @@
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();//鏈�缁堢粨鏋�
List<FlowCard> flowCardList = JSONArray.parseArray(JSONObject.toJSONString(object.get("printList")), FlowCard.class);
if (!flowCardList.isEmpty()) {
- Set<String> processedProcessIds = new HashSet<>(); // 鐢ㄦ潵瀛樻斁宸插鐞嗚繃鐨� processId
-
+ Set<String> processedKeys = new HashSet<>();
if (lableType != 2) {//鎴愬搧鏍囩
for (FlowCard flowCard : flowCardList) {
String processId = flowCard.getProcessId();
+ Integer orderNumber = flowCard.getOrderNumber();
+ String uniqueKey = processId + "|" + orderNumber; // 鐢ㄧ壒娈婂瓧绗﹁繛鎺ラ槻姝㈠啿绐�
// 妫�鏌ユ槸鍚﹀凡缁忓鐞嗚繃璇� processId锛屽鏋滃鐞嗚繃鍒欒烦杩�
- if (processedProcessIds.contains(processId)) {
+ if (processedKeys.contains(uniqueKey)) {
continue;
}
Map<String, Object> itemmap = new HashMap<>();
@@ -639,7 +654,7 @@
list.add(itemmap);
// 灏嗚 processId 鍔犲叆宸插鐞嗛泦鍚�
- processedProcessIds.add(processId);
+ processedKeys.add(uniqueKey);
}
} else {//灏忕墖鏍囩
for (FlowCard flowCard : flowCardList) {
@@ -834,7 +849,13 @@
continue;
}
Map<String, Object> itemmap = new HashMap<>();
- itemmap.put("data", flowCardMapper.getPrintCustomDataDetails(flowCard.getProcessId(), flowCard.getOrderNumber(), flowCard.getPrintQuantity()));
+ Integer sumQuantity = flowCardMapper.getSumQuantity(flowCard.getOrderId());
+ List<Map<String, Object>> details = flowCardMapper.getPrintCustomDataDetails(flowCard.getProcessId(), flowCard.getOrderNumber(), flowCard.getPrintQuantity());
+
+ for (Map<String, Object> detail : details) {
+ detail.put("sumQuantity", sumQuantity);
+ }
+ itemmap.put("data", details);
list.add(itemmap);
// 灏嗚 processId 鍔犲叆宸插鐞嗛泦鍚�
@@ -949,6 +970,66 @@
return flowCardList;
}
+ public Map<String,Object> getProcessCardAll(Map<String, String> processCards) {
+ String processCard = processCards.get("processCard");
+ if (!processCard.contains("/")) {
+ throw new ServiceException(Constants.Code_600, "閿欒鐨勬祦绋嬪崱鍙凤紝璇锋鏌�!");
+ }
+
+ String[] processCardList = processCard.split("/");
+ List<String> result = IntStream.range(0, processCardList[1].length())
+ .mapToObj(i -> String.valueOf(processCardList[1].charAt(i)))
+ .collect(Collectors.toList());
+
+ List<FlowCard> flowCardList = flowCardMapper.selectList(
+ new QueryWrapper<FlowCard>()
+ .eq("process_id", processCardList[0])
+ .in("technology_number", result)
+ );
+ for (FlowCard flowCard : flowCardList) {
+ flowCard.setOrderGlassDetail(
+ orderGlassDetailMapper.selectOne(
+ new QueryWrapper<OrderGlassDetail>()
+ .eq("order_id", flowCard.getOrderId())
+ .eq("order_number", flowCard.getOrderNumber())
+ .eq("technology_number", flowCard.getTechnologyNumber())
+ )
+ );
+ String str = flowCard.getOrderGlassDetail().getGlassChild();
+ String delimiter = "mm";
+ int index = str.indexOf(delimiter);
+ Integer subString = Integer.valueOf(str.substring(0, index).trim());
+ flowCard.getOrderGlassDetail().setThickness(subString);
+ }
+ OrderDetail orderDetail = orderDetailMapper
+ .selectOne(new QueryWrapper<OrderDetail>()
+ .eq("order_id", flowCardList.get(0).getOrderId())
+ .eq("order_number", flowCardList.get(0).getOrderNumber())
+ );
+ Product product = productMapper
+ .selectOne(new QueryWrapper<Product>()
+ .eq("id",orderDetail.getProductId()));
+ product.setProductDetails(productDetailMapper
+ .selectList(new QueryWrapper<ProductDetail>()
+ .eq("prod_id",orderDetail.getProductId())
+ )
+ );
+
+ Order order = orderMapper.
+ selectOne(new QueryWrapper<Order>()
+ .eq("order_id", flowCardList.get(0).getOrderId()));
+ order.setMoney(null);
+
+ Map<String,Object> map = new HashMap<>();
+ map.put("product",product);
+ map.put("flowCard",flowCardList);
+ map.put("order",order);
+
+
+ return map;
+ }
+
+
public Boolean checkboxDeleteSv(Map<String, Object> object) {
String userName = "";
if (object.get("userName") != null) {
@@ -1008,7 +1089,6 @@
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();//鏈�缁堢粨鏋�
List<FlowCard> flowCardList = JSONArray.parseArray(JSONObject.toJSONString(object.get("printList")), FlowCard.class);
if (!flowCardList.isEmpty()) {
- Set<String> processedProcessIds = new HashSet<>(); // 鐢ㄦ潵瀛樻斁宸插鐞嗚繃鐨� processId
for (FlowCard flowCard : flowCardList) {
Map<String, Object> itemmap = new HashMap<>();
//鏄惁鏄伐绋嬫槑缁嗘墦鍗�
@@ -1250,6 +1330,12 @@
}
}
+
+
+ public List exportDateProcessSv(Map<String, Object> dates) {
+ List<LocalDate> date= (List<LocalDate>) dates.get("date");
+ return flowCardMapper.exportDateProcessMp(date);
+ }
}
--
Gitblit v1.8.0