From 25ae4025978ef7498db9790b237fa5a26698b1ec Mon Sep 17 00:00:00 2001
From: 廖井涛 <2265517004@qq.com>
Date: 星期三, 23 七月 2025 09:32:13 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/ERP_override
---
north-glass-erp/src/main/java/com/example/erp/service/pp/ReportService.java | 266 ++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 244 insertions(+), 22 deletions(-)
diff --git a/north-glass-erp/src/main/java/com/example/erp/service/pp/ReportService.java b/north-glass-erp/src/main/java/com/example/erp/service/pp/ReportService.java
index 62599e4..cedd67e 100644
--- a/north-glass-erp/src/main/java/com/example/erp/service/pp/ReportService.java
+++ b/north-glass-erp/src/main/java/com/example/erp/service/pp/ReportService.java
@@ -3,24 +3,30 @@
import com.baomidou.dynamic.datasource.annotation.DS;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.erp.dto.pp.*;
-import com.example.erp.entity.pp.DamageDetails;
import com.example.erp.entity.pp.Report;
+import com.example.erp.entity.sd.BasicData;
+import com.example.erp.entity.sd.OrderDetail;
+import com.example.erp.entity.sd.OrderGlassDetail;
+import com.example.erp.entity.sd.ProductDetail;
+import com.example.erp.mapper.pp.FlowCardMapper;
import com.example.erp.mapper.pp.ProductionSchedulingMapper;
import com.example.erp.mapper.pp.ReportMapper;
-import com.example.erp.mapper.sd.OrderProcessDetailMapper;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Bean;
-import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+import com.example.erp.mapper.pp.ReportingWorkMapper;
+import com.example.erp.mapper.sd.*;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
+import java.math.BigDecimal;
import java.sql.Date;
import java.time.LocalDate;
+import java.time.LocalDateTime;
import java.util.*;
-import java.util.concurrent.Executor;
import java.util.function.Function;
import java.util.stream.Collectors;
+
+import static cn.hutool.core.convert.Convert.toDouble;
@Service
@DS("pp")
@@ -30,11 +36,63 @@
private final OrderProcessDetailMapper orderProcessDetailMapper;
private final ProductionSchedulingMapper productionSchedulingMapper;
+ private final OrderGlassDetailMapper orderGlassDetailMapper;
+ private final BasicDataMapper basicDataMapper;
+ private final ProductDetailMapper productDetailMapper;
+ private final OrderDetailMapper orderDetailMapper;
- private void mergeTeamsGroupsName(
- List<WorkInProgressDTO> dataList1,
- List<WorkInProgressDTO> dataList2
- ) {
+ FlowCardMapper flowCardMapper;
+ private ReportingWorkMapper reportingWorkMapper;
+
+
+ //涓婂伐搴忔姤宸ョ彮缁�
+ private void mergeTeamsGroupsName( List<WorkInProgressDTO> dataList1,List<WorkInProgressDTO> dataList2) {
+
+ for (WorkInProgressDTO dto1 : dataList1) {
+ //鏍规嵁褰撳墠宸ュ簭鑾峰彇 鏄惁涓哄崟鐗囥�佸す鑳躲�佹垨鑰呭叏閮�
+ BasicData basicData = basicDataMapper.
+ selectOne(new QueryWrapper<BasicData>()
+ .eq("basic_name", dto1.getThisProcess())
+ .last("limit 1")
+ );
+
+ OrderDetail orderDetail = orderDetailMapper
+ .selectOne(
+ new QueryWrapper<OrderDetail>()
+ .eq("order_id", dto1.getOrderId())
+ .eq("order_number", dto1.getOrderNumber())
+ );
+
+ //濡傛灉涓哄崟鐗囷紝鍒欐牴鎹骇鍝佸悕绉板拰宸ヨ壓缂栧彿鑾峰彇鐜荤拑鍚嶇О
+ if(basicData.getNickname()==null || basicData.getNickname().isEmpty()){
+ ProductDetail productDetail = productDetailMapper.
+ selectOne(new QueryWrapper<ProductDetail>()
+ .eq("prod_id", orderDetail.getProductId())
+ .eq("glass_sort",dto1.getTechnologyNumber())
+ );
+ dto1.setGlassName(productDetail.getDetail());
+
+ }else if(basicData.getNickname().equals("stepC")){
+ OrderGlassDetail orderGlassDetailGroup = orderGlassDetailMapper
+ .selectOne(new QueryWrapper<OrderGlassDetail>()
+ .eq("order_id", dto1.getOrderId())
+ .eq("order_number", dto1.getOrderNumber())
+ .eq("technology_number",dto1.getTechnologyNumber())
+ );
+
+ String glassName = productDetailMapper.getGlassNameByGroup(
+ orderDetail.getProductId(),
+ orderGlassDetailMapper.getMinTechnologyNumberByGroup(dto1.getOrderId(),dto1.getOrderNumber(), String.valueOf(orderGlassDetailGroup.getGroup())),
+ orderGlassDetailMapper.getMaxTechnologyNumberByGroup(dto1.getOrderId(),dto1.getOrderNumber(), String.valueOf(orderGlassDetailGroup.getGroup()))
+ );
+ dto1.setGlassName(glassName);
+
+ }else{
+ dto1.setGlassName(dto1.getProductName());
+ }
+
+ }
+
Function<WorkInProgressDTO, String> keyFn = dto ->
dto.getProcessId() + "|" +
dto.getOrderNumber() + "|" +
@@ -59,10 +117,20 @@
}
- public ReportService(ReportMapper reportMapper, OrderProcessDetailMapper orderProcessDetailMapper, ProductionSchedulingMapper productionSchedulingMapper) {
+ public ReportService(ReportMapper reportMapper, OrderProcessDetailMapper orderProcessDetailMapper,
+ ProductionSchedulingMapper productionSchedulingMapper, FlowCardMapper flowCardMapper,
+ OrderGlassDetailMapper orderGlassDetailMapper, BasicDataMapper basicDataMapper,
+ ProductDetailMapper productDetailMapper, OrderDetailMapper orderDetailMapper,
+ ReportingWorkMapper reportingWorkMapper) {
this.reportMapper = reportMapper;
this.orderProcessDetailMapper = orderProcessDetailMapper;
this.productionSchedulingMapper = productionSchedulingMapper;
+ this.flowCardMapper = flowCardMapper;
+ this.orderGlassDetailMapper = orderGlassDetailMapper;
+ this.basicDataMapper = basicDataMapper;
+ this.productDetailMapper = productDetailMapper;
+ this.orderDetailMapper = orderDetailMapper;
+ this.reportingWorkMapper = reportingWorkMapper;
}
//娴佺▼鍗¤繘搴︽柟娉�
@@ -173,10 +241,11 @@
if ("null".equals(optionVal)) {
optionVal = ("");
}
-
+ if (selectProcesses.equals("鍏ㄩ儴")){
+ selectProcesses="";
+ }
Map<String, Object> map = new HashMap<>();
List<WorkInProgressDTO> dataList2 =reportMapper.workInProgressMpdataList2(offset, pageSize, orderId, inputProject, selectProcesses, workInProgressDTO);
-
if (optionVal.equals("1")){
/* 鏍规嵁閿�鍞崟鍙锋眹鎬�*/
//map.put("data", reportMapper.workInProgressOrderMp(offset, pageSize, orderId, inputProject, selectProcesses, workInProgressDTO));
@@ -225,7 +294,7 @@
return map;
}
- public Map<String, Object> selectDamageReportSv(Integer pageNum, Integer pageSize, Date selectTime1, Date selectTime2, DamageReportDTO damageReportDTO) {
+ public Map<String, Object> selectDamageReportSv(Integer pageNum, Integer pageSize, String selectTime1, String selectTime2, DamageReportDTO damageReportDTO) {
Integer offset = (pageNum - 1) * pageSize;
Map<String, Object> map = new HashMap<>();
map.put("data", reportMapper.selectDamageReportMp(offset, pageSize, selectTime1, selectTime2, damageReportDTO));
@@ -237,6 +306,7 @@
public Map<String, Object> splittingDetailsOutsideSv(String orderId, Report report) {
Map<String, Object> map = new HashMap<>();
map.put("data", reportMapper.splittingDetailsOutsideMp(orderId, report));
+ map.put("orderOtherMoney", flowCardMapper.selectorderOtherMoney());
return map;
}
@@ -413,12 +483,18 @@
return reportMapper.exportCrossProcessBreakingMp(dates);
}
- public List exportDamageReportSv(List<LocalDate> dates) {
- if (dates != null && dates.size() > 1) {
- dates.set(1, dates.get(1).plusDays(1)); // 灏嗙浜屼釜鏃ユ湡鍔犱竴澶�
- }
- System.out.println(dates);
- return reportMapper.exportDamageReportMp(dates);
+ // public List exportTeamOutputSv(Map<String, Object> dates) {
+// List<LocalDate> date= (List<LocalDate>) dates.get("date");
+// String process= (String) dates.get("processes");
+// if (process.equals("鍏ㄩ儴")){
+// process="";
+// }
+// String laminating = reportMapper.getLaminating(process);
+// return reportMapper.exportTeamOutputMp(date,process,laminating);
+// }
+ public List exportDamageReportSv(Map<String, Object> dates) {
+ List<LocalDate> date= (List<LocalDate>) dates.get("date");
+ return reportMapper.exportDamageReportMp(date);
}
public List exportOrderPlanDecompositionSv(List<LocalDate> dates) {
@@ -441,6 +517,9 @@
public List exportWorkInProgressSv(Map<String, Object> dates) {
String process= (String) dates.get("processes");
+ if (process.equals("鍏ㄩ儴")){
+ process="";
+ }
String inputVal= (String) dates.get("inputVal");
String project= (String) dates.get("project");
if ("null".equals(inputVal)) {
@@ -449,7 +528,11 @@
if ("null".equals(project)) {
project = "";
}
- return reportMapper.exportWorkInProgressMp(process,inputVal,project);
+ List<WorkInProgressDTO> dataList1 =reportMapper.exportWorkInProgressMp(process,inputVal,project);
+ List<WorkInProgressDTO> dataList2 =reportMapper.exportWorkInProgressMpdataList2(process);
+
+ mergeTeamsGroupsName(dataList1, dataList2);
+ return dataList1;
}
public List exportTaskCompletionStatusSv(Map<String, Object> dates) {
@@ -470,7 +553,7 @@
return reportMapper.exportYieldMp(date,process);
}
- public Map<String, Object> teamOutputSv(Integer pageNum, Integer pageSize, Date selectTime1, Date selectTime2, String selectProcesses, TeamOutputDTO teamOutputDTO) {
+ public Map<String, Object> teamOutputSv(Integer pageNum, Integer pageSize, String selectTime1, String selectTime2, String selectProcesses, TeamOutputDTO teamOutputDTO) {
if (selectProcesses.equals("鍏ㄩ儴")){
selectProcesses="";
}
@@ -508,4 +591,143 @@
String laminating = reportMapper.getLaminating(process);
return reportMapper.exportTeamOutputMp(date,process,laminating);
}
+
+ public Map<String, Object> workInProgressCombinationSv(
+ Integer pageNum, Integer pageSize,
+ String orderId, String inputProject, String selectProcesses,
+ String optionVal, WorkInProgressDTO workInProgressDTO) {
+
+ Integer offset = (pageNum - 1) * pageSize;
+
+ if ("null".equals(orderId)) {
+ orderId = "";
+ }
+ if ("null".equals(inputProject)) {
+ inputProject = "";
+ }
+ if ("null".equals(optionVal)) {
+ optionVal = "";
+ }
+ if ("鍏ㄩ儴".equals(selectProcesses)) {
+ selectProcesses = "";
+ }
+
+ String laminating = "";
+ Map<String, Object> map = new HashMap<>();
+ Map<String, Double> totalSumMap = new HashMap<>();
+
+ double totalStockNum = 0;
+ double totalStockArea = 0;
+
+ // 鑾峰彇鎵�鏈夊伐搴�
+ List<String> processList = reportMapper.selectProcess();
+
+ // 鏈�缁堟暟鎹泦鍚�
+ List<Map<String, Object>> resultList = new ArrayList<>();
+
+ if (!"".equals(selectProcesses)) {
+ laminating = reportingWorkMapper.getProcessLaminating(selectProcesses);
+ List<Map<String, Object>> singleResult =
+ reportMapper.getWorkInProgressCombination(selectProcesses, laminating, optionVal);
+ if (singleResult != null && !singleResult.isEmpty()) {
+ resultList.addAll(singleResult);
+ }
+
+ Map<String, Object> total =
+ reportMapper.getWorkInProgressCombinationFootSum(selectProcesses, laminating, optionVal);
+ if (total != null) {
+ BigDecimal stockNum = (BigDecimal) total.get("stockNum");
+ BigDecimal stockArea = (BigDecimal) total.get("stockArea");
+
+ if (stockNum != null) {
+ totalStockNum += stockNum.doubleValue();
+ }
+ if (stockArea != null) {
+ totalStockArea += stockArea.doubleValue();
+ }
+ }
+
+ } else {
+ for (String process : processList) {
+ laminating = reportingWorkMapper.getProcessLaminating(process);
+
+ List<Map<String, Object>> singleResult =
+ reportMapper.getWorkInProgressCombination(process, laminating, optionVal);
+
+ if (singleResult != null && !singleResult.isEmpty()) {
+ resultList.addAll(singleResult);
+ }
+
+ Map<String, Object> total =
+ reportMapper.getWorkInProgressCombinationFootSum(process, laminating, optionVal);
+ if (total != null) {
+ BigDecimal stockNum = (BigDecimal) total.get("stockNum");
+ BigDecimal stockArea = (BigDecimal) total.get("stockArea");
+
+ if (stockNum != null) {
+ totalStockNum += stockNum.doubleValue();
+ }
+ if (stockArea != null) {
+ totalStockArea += stockArea.doubleValue();
+ }
+ }
+ }
+ }
+
+ totalSumMap.put("stockNum", totalStockNum);
+ totalSumMap.put("stockArea", totalStockArea);
+
+ map.put("data", resultList);
+ map.put("total", totalSumMap);
+ map.put("process", productionSchedulingMapper.selectProcess());
+
+ return map;
+ }
+
+ public List exportWorkInProgressCombinationSv(Map<String, Object> dates) {
+ String process= (String) dates.get("processes");
+ if (process.equals("鍏ㄩ儴")){
+ process="";
+ }
+ String inputVal= (String) dates.get("inputVal");
+ String project= (String) dates.get("project");
+ if ("null".equals(inputVal)) {
+ inputVal = "";
+ }
+ if ("null".equals(project)) {
+ project = "";
+ }
+
+ String laminating = "";
+
+ // 鑾峰彇鎵�鏈夊伐搴�
+ List<String> processList = reportMapper.selectProcess();
+
+ // 鏈�缁堟暟鎹泦鍚�
+ List<WorkInProgressCombinationDTO> resultList = new ArrayList<>();
+
+ if (!"".equals(process)) {
+ laminating = reportingWorkMapper.getProcessLaminating(process);
+ List<WorkInProgressCombinationDTO> singleResult =
+ reportMapper.exportWorkInProgressCombination(process, laminating, inputVal);
+ if (singleResult != null && !singleResult.isEmpty()) {
+ resultList.addAll((Collection<? extends WorkInProgressCombinationDTO>) singleResult);
+ }
+
+
+ } else {
+ for (String processVal : processList) {
+ laminating = reportingWorkMapper.getProcessLaminating(processVal);
+
+ List<WorkInProgressCombinationDTO> singleResult =
+ reportMapper.exportWorkInProgressCombination(processVal, laminating, inputVal);
+
+ if (singleResult != null && !singleResult.isEmpty()) {
+ resultList.addAll((Collection<? extends WorkInProgressCombinationDTO>) singleResult);
+ }
+ }
+ }
+
+ return resultList;
+ }
}
--
Gitblit v1.8.0