From d425460023114e81caedc7a0430f9246ed3bb839 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期四, 23 十月 2025 17:04:07 +0800
Subject: [PATCH] 报检:批次号字母转大写

---
 inspect-server/src/main/java/com/ruoyi/inspect/service/impl/RawMaterialOrderServiceImpl.java |   86 ++++++++++++++++++++++++++-----------------
 1 files changed, 52 insertions(+), 34 deletions(-)

diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/RawMaterialOrderServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/RawMaterialOrderServiceImpl.java
index 829cd4c..176775d 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/RawMaterialOrderServiceImpl.java
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/RawMaterialOrderServiceImpl.java
@@ -25,6 +25,7 @@
 import com.ruoyi.common.core.domain.Result;
 import com.ruoyi.common.core.domain.entity.User;
 import com.ruoyi.common.config.WechatProperty;
+import com.ruoyi.common.enums.OrderType;
 import com.ruoyi.common.utils.LimsDateUtil;
 import com.ruoyi.common.utils.QueryWrappers;
 import com.ruoyi.common.utils.SecurityUtils;
@@ -42,9 +43,11 @@
 import com.ruoyi.inspect.mapper.InsOrderMapper;
 import com.ruoyi.inspect.mapper.InsProductMapper;
 import com.ruoyi.inspect.mapper.InsSampleMapper;
+import com.ruoyi.inspect.mapper.InsUnqualifiedHandlerMapper;
 import com.ruoyi.inspect.pojo.IfsSplitOrderRecord;
 import com.ruoyi.inspect.pojo.InsOrder;
 import com.ruoyi.inspect.pojo.InsReport;
+import com.ruoyi.inspect.pojo.InsUnqualifiedHandler;
 import com.ruoyi.inspect.service.IfsSplitOrderRecordService;
 import com.ruoyi.inspect.service.InsOrderService;
 import com.ruoyi.inspect.service.InsReportService;
@@ -101,6 +104,8 @@
 
     private IfsSplitOrderRecordService ifsSplitOrderRecordService;
 
+    private InsUnqualifiedHandlerMapper insUnqualifiedHandlerMapper;
+
 
     @Override
     public Result selectStandardTreeListByPartNo(String partNo) {
@@ -148,11 +153,15 @@
 
     @Override
     public IPage<IfsInventoryQuantity> getWarehouseSubmit(IPage<IfsInventoryQuantity> page, IfsInventoryQuantity ifsInventoryQuantity) {
+        if(ifsInventoryQuantity.getIsInspect().equals(1)){
+            ifsInventoryQuantity.setOrderType(OrderType.RAW.getValue());
+        }
         return standardTreeMapper.selectIfsPage(page, QueryWrappers.queryWrappers(ifsInventoryQuantity));
     }
 
     @Override
     public IPage<IfsInventoryQuantityDto> getIfsByStateOne(IPage<IfsInventoryQuantityDto> page, IfsInventoryQuantityDto ifsInventoryQuantityDto) {
+        ifsInventoryQuantityDto.setOrderType(OrderType.RAW.getValue());
         return standardTreeMapper.getIfsByStateOne(page, QueryWrappers.queryWrappers(ifsInventoryQuantityDto));
     }
 
@@ -163,40 +172,41 @@
      * @return
      */
     @Override
-    public int inspectionReport(List<Long> ids) {
+    public int inspectionReport(List<Long> ids,String orderType) {
         Integer userId = SecurityUtils.getUserId().intValue();
         ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate()
                 .in(IfsInventoryQuantity::getId, ids)
                 .set(IfsInventoryQuantity::getDeclareUser, userMapper.selectById(userId).getName())
                 .set(IfsInventoryQuantity::getDeclareUserId, userId)
                 .set(IfsInventoryQuantity::getIsInspect, 1)
+                .set(IfsInventoryQuantity::getOrderType,orderType)
                 .set(IfsInventoryQuantity::getDeclareDate, LocalDateTime.now())
         );
-//        threadPoolTaskExecutor.execute(() -> {
-//            List<IfsInventoryQuantity> quantityList = ifsInventoryQuantityMapper.selectList(Wrappers.<IfsInventoryQuantity>lambdaQuery()
-//                    .in(IfsInventoryQuantity::getId, ids));
-//            // 浼佷笟寰俊閫氱煡
-//            String message = "";
-//            message += "鏂板鎶ユ閫氱煡";
-//            for (IfsInventoryQuantity inventoryQuantity : quantityList) {
-//                message += "\n鎵规鍙�: " + inventoryQuantity.getUpdateBatchNo();
-//                message += "\n闆朵欢鎻忚堪: " + inventoryQuantity.getPartDesc();
-//                message += "\n鎶佃揪鏁伴噺: " + inventoryQuantity.getQtyArrived().stripTrailingZeros().toPlainString() + inventoryQuantity.getBuyUnitMeas();
-//
-//                // 鍒ゆ柇鏈夋病鏈夊埌20鍚�. 鎴栬�呰兘鍚﹀厤妫�
-//                int result = notificationRawOrder(inventoryQuantity.getId());
-//                switch (result) {
-//                    case 1:
-//                        message += "\n褰撳墠鏍峰搧宸叉楠岃繃, 鍙互鍏嶆";
-//                        break;
-//                    case 2:
-//                        message += "\n褰撳墠鏍峰搧宸茶秴杩�20鍚�";
-//                        break;
-//                }
-//                message += "\n";
-//            }
-//            WxCpUtils.informWebHook(wechatProperty.getExaminingUrl(), message);
-//        });
+        threadPoolTaskExecutor.execute(() -> {
+            List<IfsInventoryQuantity> quantityList = ifsInventoryQuantityMapper.selectList(Wrappers.<IfsInventoryQuantity>lambdaQuery()
+                    .in(IfsInventoryQuantity::getId, ids));
+            // 浼佷笟寰俊閫氱煡
+            String message = "";
+            message += "鏂板鎶ユ閫氱煡";
+            for (IfsInventoryQuantity inventoryQuantity : quantityList) {
+                message += "\n鎵规鍙�: " + inventoryQuantity.getUpdateBatchNo();
+                message += "\n闆朵欢鎻忚堪: " + inventoryQuantity.getPartDesc();
+                message += "\n鎶佃揪鏁伴噺: " + inventoryQuantity.getQtyArrived().stripTrailingZeros().toPlainString() + inventoryQuantity.getBuyUnitMeas();
+
+                // 鍒ゆ柇鏈夋病鏈夊埌20鍚�. 鎴栬�呰兘鍚﹀厤妫�
+                int result = notificationRawOrder(inventoryQuantity.getId());
+                switch (result) {
+                    case 1:
+                        message += "\n褰撳墠鏍峰搧宸叉楠岃繃, 鍙互鍏嶆";
+                        break;
+                    case 2:
+                        message += "\n褰撳墠鏍峰搧宸茶秴杩�20鍚�";
+                        break;
+                }
+                message += "\n";
+            }
+            WxCpUtils.informWebHook(wechatProperty.getExaminingUrl(), message);
+        });
         return 1;
     }
 
@@ -231,6 +241,12 @@
     @Override
     public int inspectionReportOne(IfsInventoryQuantity ifsInventoryQuantity) {
         Integer userId = SecurityUtils.getUserId().intValue();
+        boolean validateValue = OrderType.validateValue(ifsInventoryQuantity.getOrderType());
+        if(!validateValue){
+            throw new ErrorException("鎶ユ澶辫触锛岄潪娉曠殑閿�鍞鍗曞垎绫绘灇涓�");
+        }
+        //鎵规鍙峰瓧姣嶈浆澶у啓
+        ifsInventoryQuantity.setUpdateBatchNo(ifsInventoryQuantity.getUpdateBatchNo().toUpperCase(Locale.ROOT));
         ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate()
                 .eq(IfsInventoryQuantity::getId, ifsInventoryQuantity.getId())
                 .set(IfsInventoryQuantity::getDeclareUser, userMapper.selectById(userId).getName())
@@ -238,6 +254,7 @@
                 .set(IfsInventoryQuantity::getIsInspect, 1)
                 .set(IfsInventoryQuantity::getDeclareDate, LocalDateTime.now())
                 .set(IfsInventoryQuantity::getUpdateBatchNo, ifsInventoryQuantity.getUpdateBatchNo())
+                .set(IfsInventoryQuantity::getOrderType,ifsInventoryQuantity.getOrderType())
         );
 
         threadPoolTaskExecutor.execute(() -> {
@@ -389,8 +406,9 @@
         String endDeclareDate = ifsInventoryQuantityDto.getEndDeclareDate();
         ifsInventoryQuantityDto.setBeginDeclareDate(null);
         ifsInventoryQuantityDto.setEndDeclareDate(null);
-
+        ifsInventoryQuantityDto.setOrderType(OrderType.RAW.getValue());
         IPage<IfsInventoryQuantitySupplierDto> ifsByOver = standardTreeMapper.getIfsByOver(page, QueryWrappers.queryWrappers(ifsInventoryQuantityDto), beginDeclareDate, endDeclareDate);
+        ifsByOver.getRecords().forEach(r->r.setOrderTypeName(OrderType.getLabelByValue(r.getOrderType())));
         return ifsByOver;
     }
 
@@ -507,6 +525,9 @@
         ifsInventoryQuantity.setIsSource(0);
         ifsInventoryQuantity.setState(0);
         ifsInventoryQuantity.setIsFinish(0);
+        if(!OrderType.validateValue(ifsInventoryQuantity.getOrderType())){
+            throw new ErrorException("鏂板鎶ユ淇℃伅澶辫触锛岄潪娉曠殑閿�鍞鍗曞垎绫绘灇涓�");
+        }
         ifsInventoryQuantityMapper.insert(ifsInventoryQuantity);
     }
 
@@ -597,16 +618,13 @@
         if (!ifsInventoryQuantity.getInspectStatus().equals(2)) {
             throw new ErrorException("涓嶅悎鏍肩殑鍘熸潗鏂欐墠鑳借姝ユ斁琛�");
         }
-
         // todo:闇�瑕佸垽鏂璷a娴佺▼鏄惁鏄姝ユ斁琛�
         String toLocation = insOrderService.moveRawMaterial(ifsInventoryQuantity);
 
-        ifsInventoryQuantityMapper.update(null, new LambdaUpdateWrapper<IfsInventoryQuantity>()
+        return ifsInventoryQuantityMapper.update(null, new LambdaUpdateWrapper<IfsInventoryQuantity>()
                 .set(IfsInventoryQuantity::getInspectStatus, 4)
                 .set(IfsInventoryQuantity::getToLocation, toLocation)
-                .eq(IfsInventoryQuantity::getId, ifsInventoryId));
-
-        return true;
+                .eq(IfsInventoryQuantity::getId, ifsInventoryId))>0;
     }
 
     /**
@@ -770,7 +788,7 @@
         String endDeclareDate = ifsInventoryQuantityDto.getEndDeclareDate();
         ifsInventoryQuantityDto.setBeginDeclareDate(null);
         ifsInventoryQuantityDto.setEndDeclareDate(null);
-
+        ifsInventoryQuantityDto.setOrderType(OrderType.RAW.getValue());
         return standardTreeMapper.getIfsByQuarter(page, QueryWrappers.queryWrappers(ifsInventoryQuantityDto), beginDeclareDate, endDeclareDate);
     }
 
@@ -922,7 +940,7 @@
         if(Objects.nonNull(splitOrderList) && !splitOrderList.isEmpty()){
             List<Long> ids = splitOrderList.stream().map(IfsInventoryQuantity::getId).collect(Collectors.toList());
             ids.add(ifsInventoryQuantity.getId());
-            this.inspectionReport(ids);
+            this.inspectionReport(ids,OrderType.RAW.getValue());
         }
         //鍕鹃�夊悓姝ュ埌MES锛屼繚瀛樿鍗曟媶鍒嗚褰�
         if(orderSplitDTO.getPushToMes()){

--
Gitblit v1.9.3