From fcbce36f8734813b13c8f9c5b26b4bd192274534 Mon Sep 17 00:00:00 2001
From: 廖井涛 <2265517004@qq.com>
Date: 星期一, 17 十一月 2025 16:30:28 +0800
Subject: [PATCH] 工程打印明细新增玻璃编号显示
---
north-glass-erp/src/main/java/com/example/erp/service/pp/ReportingWorkService.java | 109 +++++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 95 insertions(+), 14 deletions(-)
diff --git a/north-glass-erp/src/main/java/com/example/erp/service/pp/ReportingWorkService.java b/north-glass-erp/src/main/java/com/example/erp/service/pp/ReportingWorkService.java
index 3252973..2fcd474 100644
--- a/north-glass-erp/src/main/java/com/example/erp/service/pp/ReportingWorkService.java
+++ b/north-glass-erp/src/main/java/com/example/erp/service/pp/ReportingWorkService.java
@@ -3,40 +3,45 @@
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
+import com.aspose.cad.internal.I.S;
+import com.baomidou.dynamic.datasource.annotation.DS;
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.conditions.update.UpdateWrapper;
import com.example.erp.common.AsyncQueryExecutor;
import com.example.erp.common.Constants;
+import com.example.erp.common.Result;
import com.example.erp.dto.pp.OrderNumberTransferDTO;
+import com.example.erp.dto.sd.OrderProcessSortDTO;
import com.example.erp.entity.pp.*;
-import com.example.erp.entity.sd.*;
+import com.example.erp.entity.sd.BasicData;
+import com.example.erp.entity.sd.Order;
+import com.example.erp.entity.sd.OrderDetail;
+import com.example.erp.entity.sd.OrderProcessDetail;
import com.example.erp.entity.userInfo.Log;
import com.example.erp.entity.userInfo.SysError;
import com.example.erp.exception.ServiceException;
import com.example.erp.mapper.mm.FinishedOperateLogMapper;
import com.example.erp.mapper.pp.*;
-import com.baomidou.dynamic.datasource.annotation.DS;
import com.example.erp.mapper.sd.*;
import com.example.erp.mapper.userInfo.LogMapper;
import com.example.erp.service.mm.FinishedGoodsInventoryService;
import com.example.erp.service.sd.OrderProcessDetailService;
import com.example.erp.service.userInfo.LogService;
import com.example.erp.service.userInfo.SysErrorService;
+import com.example.erp.tools.JacksonUtil;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import lombok.RequiredArgsConstructor;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
+import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.web.client.RestTemplate;
-
-import javax.annotation.PreDestroy;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
@@ -45,6 +50,7 @@
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.TimeUnit;
@Service
@DS("pp")
@@ -58,13 +64,9 @@
private final ReportingWorkDetailMapper reportingWorkDetailMapper;
private final OrderMapper orderMapper;
private final OrderDetailMapper orderDetailMapper;
-
private final FlowCardMapper flowCardMapper;
-
private final OrderProcessDetailService orderProcessDetailService;
-
private final LogService logService;
-
private final LogMapper logMapper;
private final OrderGlassDetailMapper orderGlassDetailMapper;
private final SysErrorService sysErrorService;
@@ -74,6 +76,7 @@
private final ReworkMapper reworkMapper;
private final BasicDataMapper basicDataMapper;
private final FinishedGoodsInventoryService finishedGoodsInventoryService;
+ private final StringRedisTemplate stringRedisTemplate;
@Resource
private AsyncQueryExecutor asyncExecutor;
@@ -1114,7 +1117,9 @@
List<ReportingWork> ReportingWorks = reportingWorkMapper.selectJoinList(ReportingWork.class,
new MPJLambdaWrapper<ReportingWork>()
.select(ReportingWork::getReportingWorkId)
- .leftJoin(ReportingWorkDetail.class, ReportingWorkDetail::getReportingWorkId, ReportingWork::getReportingWorkId)
+ .leftJoin(ReportingWorkDetail.class,
+ ReportingWorkDetail::getReportingWorkId,
+ ReportingWork::getReportingWorkId)
.eq(ReportingWork::getProcessId,reportingWork.getProcessId())
.eq(ReportingWork::getThisProcess,reportingWork.getThisProcess())
.eq(ReportingWork::getDeviceName,reportingWork.getDeviceName())
@@ -1197,7 +1202,7 @@
//灏嗗紓甯镐紶鍏ユ暟鎹簱
SysError sysError = new SysError();
sysError.setError(e +Arrays.toString(e.getStackTrace()));
- sysError.setFunc("姹夌幓mes鎶ュ伐");
+ sysError.setFunc("mes鎶ュ伐");
sysErrorService.insert(sysError);
throw new ServiceException(Constants.Code_500, "鏁版嵁璇锋眰寮傚父锛岃妫�鏌�");
@@ -1584,4 +1589,80 @@
map.put("breakageReason", reportingWorkMapper.selectBasicNameByType("breakagereason"));
return map;
}
+
+
+ //@Transactional(rollbackFor = Exception.class , noRollbackFor = ServiceException.class)
+ public Result mesReportingWorkSv1(Map<String, Object> reportingWorkMap) throws JsonProcessingException {
+
+ //璁剧疆鍥炴粴鐐�
+ //Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint();
+ //鎺ユ敹瑙f瀽涓婚檮琛ㄤ俊鎭�
+ String titleJson = JacksonUtil.writeValueAsString(reportingWorkMap.get("title"));
+ String detailJson = JacksonUtil.writeValueAsString(reportingWorkMap.get("detail"));
+ ReportingWork reportingWork = JacksonUtil.readValue(titleJson, ReportingWork.class);
+ ReportingWorkDetail reportingWorkDetail = JacksonUtil.readValue(detailJson, ReportingWorkDetail.class);
+ String Base_KEY = reportingWork.getProcessId()+":"+reportingWork.getThisProcess()+":"+reportingWork.getDeviceName();
+ String reportingWork_KEY = Base_KEY+":title";
+ String reportingWorkDetail_KEY = Base_KEY+":detail:"+reportingWorkDetail.getOrderNumber()+":"+reportingWorkDetail.getTechnologyNumber();
+
+ String process_KEY = reportingWork.getProcessId()+":process:"+reportingWorkDetail.getOrderNumber()+":"+reportingWorkDetail.getTechnologyNumber();
+
+ //鍒ゆ柇宸ュ簭鏄惁瀛樺湪redis涓�
+ if(!Boolean.TRUE.equals(stringRedisTemplate.hasKey(process_KEY+":"+reportingWork.getThisProcess()))){
+ List<OrderProcessSortDTO> orderProcessSortDTOList = orderProcessDetailMapper.selectProcessSort(
+ reportingWork.getOrderId(),
+ reportingWork.getProcessId(),
+ reportingWorkDetail.getOrderNumber(),
+ reportingWorkDetail.getTechnologyNumber()
+ );
+ if (orderProcessSortDTOList.isEmpty()){
+ throw new ServiceException(Constants.Code_600, "鏈娴嬪埌娴佺▼鍗′俊鎭紝璇锋鏌�");
+ }
+
+ orderProcessSortDTOList.forEach(orderProcessSortDTO -> {
+ Map<String, String> map = new HashMap<>();
+ map.put("sort",orderProcessSortDTO.getSort());
+ map.put("recombination",orderProcessSortDTO.getRecombination());
+ stringRedisTemplate.opsForHash().putAll(process_KEY+":"+orderProcessSortDTO.getProcess(), map);
+ });
+ }
+ String recombination = (String) stringRedisTemplate.opsForHash().get(process_KEY+":"+reportingWork.getThisProcess(),"recombination");
+
+ if (!recombination.isEmpty()){
+ throw new ServiceException(Constants.Code_600, "澶嶅悎宸ュ簭璇峰埌ERP涓繘琛屾姤宸�");
+ }
+
+
+
+
+
+ //鍒ゆ柇鏄惁redis姝ゆ姤宸ョ紪鍙穔ey鏄惁瀛樺湪
+ if(Boolean.TRUE.equals(stringRedisTemplate.hasKey(reportingWork_KEY))){
+ stringRedisTemplate.opsForHash().increment(
+ reportingWork_KEY,
+ "thisCompletedQuantity",
+ reportingWork.getThisCompletedQuantity()
+ );
+ }
+ else{
+ stringRedisTemplate.opsForHash().putAll(
+ reportingWork_KEY,
+ JacksonUtil.readValueObjectToString(reportingWork,new TypeReference<Map<String, String>>() {})
+ );
+ }
+ //鍒ゆ柇鏄惁redis姝ゆ姤宸ユ槑缁嗕腑key鏄惁瀛樺湪
+ if(Boolean.TRUE.equals(stringRedisTemplate.hasKey(reportingWorkDetail_KEY))){
+ stringRedisTemplate.opsForHash().increment(
+ reportingWorkDetail_KEY,
+ "completedQuantity",
+ reportingWorkDetail.getCompletedQuantity()
+ );
+ }else {
+ stringRedisTemplate.opsForHash().putAll(
+ reportingWorkDetail_KEY,
+ JacksonUtil.readValueObjectToString(reportingWorkDetail,new TypeReference<Map<String, String>>() {})
+ );
+ }
+ return Result.success("鎻愪氦鎴愬姛");
+ }
}
--
Gitblit v1.8.0