From dc7300e21fe53f74e08eb2fa494a83430e2e54ca Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期四, 26 三月 2026 11:25:58 +0800
Subject: [PATCH] 绩效管理:人员考勤功能模块

---
 inspect-server/src/main/java/com/ruoyi/inspect/service/impl/RawMaterialOrderServiceImpl.java |   53 ++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 38 insertions(+), 15 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 a515e38..2bb2006 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
@@ -7,6 +7,7 @@
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.io.IoUtil;
 import cn.hutool.core.util.StrUtil;
+import cn.hutool.json.JSONUtil;
 import com.alibaba.excel.EasyExcel;
 import com.alibaba.excel.ExcelWriter;
 import com.alibaba.excel.support.ExcelTypeEnum;
@@ -27,6 +28,7 @@
 import com.ruoyi.common.constant.InsOrderTypeConstants;
 import com.ruoyi.common.core.domain.Result;
 import com.ruoyi.common.core.domain.entity.User;
+import com.ruoyi.common.enums.ContractType;
 import com.ruoyi.common.enums.OrderType;
 import com.ruoyi.common.numgen.NumberGenerator;
 import com.ruoyi.common.utils.LimsDateUtil;
@@ -35,10 +37,7 @@
 import com.ruoyi.common.utils.WxCpUtils;
 import com.ruoyi.common.utils.api.IfsApiUtils;
 import com.ruoyi.framework.exception.ErrorException;
-import com.ruoyi.inspect.dto.CopperInsOrderDto;
-import com.ruoyi.inspect.dto.OrderSplitDTO;
-import com.ruoyi.inspect.dto.RawMaterialStandardTreeDto;
-import com.ruoyi.inspect.dto.SampleProductDto;
+import com.ruoyi.inspect.dto.*;
 import com.ruoyi.inspect.excel.OrderSplitExcelData;
 import com.ruoyi.inspect.excel.OrderSplitExcelListener;
 import com.ruoyi.inspect.mapper.InsOrderMapper;
@@ -102,8 +101,7 @@
 
     private IfsSplitOrderRecordService ifsSplitOrderRecordService;
 
-    private InsUnqualifiedHandlerMapper insUnqualifiedHandlerMapper;
-
+    private final NumberGenerator<IfsSplitOrderRecord> splitOrderRecordNumberGenerator;
 
     @Override
     public Result selectStandardTreeListByPartNo(String partNo) {
@@ -115,7 +113,7 @@
         for (FactoryDto factoryDto : factoryDtos) {
             for (LaboratoryDto laboratoryDto : factoryDto.getChildren()) {
                 for (SampleTypeDto sampleTypeDto : laboratoryDto.getChildren()) {
-                    if (sampleTypeDto.getChildren().size() == 0) {
+                    if (sampleTypeDto.getChildren().isEmpty()) {
                         sampleTypeDto.setChildren(standardTreeMapper.getStandardTree3(sampleTypeDto.getValue()));
                     }
                     // 鍒ゆ柇缁戝畾鐨勬槸鍚︽槸褰撳墠闆朵欢鍙�
@@ -170,7 +168,7 @@
      * @return
      */
     @Override
-    public int inspectionReport(List<Long> ids,String orderType) {
+    public int inspectionReport(List<Long> ids,String orderType,String materialProp) {
         Integer userId = SecurityUtils.getUserId().intValue();
         ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate()
                 .in(IfsInventoryQuantity::getId, ids)
@@ -178,6 +176,7 @@
                 .set(IfsInventoryQuantity::getDeclareUserId, userId)
                 .set(IfsInventoryQuantity::getIsInspect, 1)
                 .set(IfsInventoryQuantity::getOrderType,orderType)
+                .set(IfsInventoryQuantity::getMaterialProp,materialProp)
                 .set(IfsInventoryQuantity::getDeclareDate, LocalDateTime.now())
         );
         threadPoolTaskExecutor.execute(() -> {
@@ -243,6 +242,7 @@
         if(!validateValue){
             throw new ErrorException("鎶ユ澶辫触锛岄潪娉曠殑閿�鍞鍗曞垎绫绘灇涓�");
         }
+        validateUpdateBatchNo(ifsInventoryQuantity);
         //鎵规鍙峰瓧姣嶈浆澶у啓
         ifsInventoryQuantity.setUpdateBatchNo(ifsInventoryQuantity.getUpdateBatchNo().toUpperCase(Locale.ROOT));
         ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate()
@@ -253,6 +253,7 @@
                 .set(IfsInventoryQuantity::getDeclareDate, LocalDateTime.now())
                 .set(IfsInventoryQuantity::getUpdateBatchNo, ifsInventoryQuantity.getUpdateBatchNo())
                 .set(IfsInventoryQuantity::getOrderType,ifsInventoryQuantity.getOrderType())
+                .set(IfsInventoryQuantity::getMaterialProp,ifsInventoryQuantity.getMaterialProp())
         );
 
         threadPoolTaskExecutor.execute(() -> {
@@ -266,6 +267,26 @@
             WxCpUtils.informWebHook(wechatProperty.getExaminingUrl(), message);
         });
         return 1;
+    }
+
+    /**
+     * 鏍¢獙澶栬喘璁㈠崟鎶ユ鐨勬壒娆″彿鏄惁閲嶅
+     * @param ifsInventoryQuantity
+     */
+    public void validateUpdateBatchNo(IfsInventoryQuantity ifsInventoryQuantity){
+        if(StringUtils.equals(ifsInventoryQuantity.getOrderType(),OrderType.WG.getValue())){
+            //鏌ヨ鍘嗗彶璁板綍
+            Long count = ifsInventoryQuantityMapper.selectCount(Wrappers.<IfsInventoryQuantity>lambdaQuery()
+                    .eq(IfsInventoryQuantity::getContract,ifsInventoryQuantity.getContract())
+                    .eq(IfsInventoryQuantity::getPartNo,ifsInventoryQuantity.getPartNo())
+                    .eq(IfsInventoryQuantity::getUpdateBatchNo,ifsInventoryQuantity.getUpdateBatchNo())
+                    .eq(IfsInventoryQuantity::getOrderType,OrderType.WG.getValue())
+                    .ne(IfsInventoryQuantity::getState,0)
+            );
+            if(count>0){
+                throw new RuntimeException("鎶ユ澶辫触锛岄浂浠�"+ifsInventoryQuantity.getPartNo()+"鎵�鎶ユ鐨勬壒娆″彿銆�"+ifsInventoryQuantity.getUpdateBatchNo()+"銆戝凡瀛樺湪锛�");
+            }
+        }
     }
 
     /**
@@ -526,6 +547,7 @@
         if(!OrderType.validateValue(ifsInventoryQuantity.getOrderType())){
             throw new ErrorException("鏂板鎶ユ淇℃伅澶辫触锛岄潪娉曠殑閿�鍞鍗曞垎绫绘灇涓�");
         }
+        validateUpdateBatchNo(ifsInventoryQuantity);
         ifsInventoryQuantityMapper.insert(ifsInventoryQuantity);
     }
 
@@ -892,7 +914,7 @@
         inAttrMap.put("BATCH_INFO", batchInfoData);
         String inAttr = JSONObject.toJSONString(inAttrMap);
         //璋冪敤ifs鎺ュ彛
-        Result result = ifsApiUtils.updateMoveReceiptLot(inAttr);
+        Result result = ifsApiUtils.updateMoveReceiptLot(ifsInventoryQuantity.getContract(),inAttr);
         if(result.getCode()!=200){
             throw new RuntimeException("IFS閲囪喘鎺ユ敹鏇存敼鎵瑰彿璇锋眰寮傚父锛�"+result.getMessage());
         }
@@ -914,7 +936,7 @@
         }
         //ifs鏇存敼鎵瑰彿鎺ュ彛璋冪敤鎴愬姛锛屾媺鍙栨柊鎷嗗垎鐨刬fs璁㈠崟骞舵姤妫�
         Map<String, Object> map = new HashMap<>();
-        map.put("LOCATION_NO","1302");
+//        map.put("LOCATION_NO","1302");
         map.put("STATE_DB","To be Inspected");
         map.put("PART_NO",ifsInventoryQuantity.getPartNo());
         map.put("ORDER_NO",ifsInventoryQuantity.getOrderNo());
@@ -938,20 +960,21 @@
         if(Objects.nonNull(splitOrderList) && !splitOrderList.isEmpty()){
             List<Long> ids = splitOrderList.stream().map(IfsInventoryQuantity::getId).collect(Collectors.toList());
             ids.add(ifsInventoryQuantity.getId());
-            this.inspectionReport(ids,OrderType.RAW.getValue());
+            this.inspectionReport(ids,OrderType.RAW.getValue(),orderSplitDTO.getMaterialProp());
         }
         //鍕鹃�夊悓姝ュ埌MES锛屼繚瀛樿鍗曟媶鍒嗚褰�
         if(orderSplitDTO.getPushToMes()){
-            List<IfsSplitOrderRecord> collect = orderSplitDTO.getSplitDetailList().stream().map(m -> {
+            orderSplitDTO.getSplitDetailList().forEach(m -> {
                 IfsSplitOrderRecord record = new IfsSplitOrderRecord();
                 BeanUtil.copyProperties(m, record);
+                record.setSystemNo(splitOrderRecordNumberGenerator.generateNumberWithPrefix(IfsSplitOrderRecord.DIGIT, IfsSplitOrderRecord.PREFIX, IfsSplitOrderRecord::getSystemNo));
                 record.setOrderNo(ifsInventoryQuantity.getOrderNo());
                 record.setLineNo(ifsInventoryQuantity.getLineNo());
                 record.setReleaseNo(ifsInventoryQuantity.getReleaseNo());
                 record.setReceiptNo(ifsInventoryQuantity.getReceiptNo());
-                return record;
-            }).collect(Collectors.toList());
-            return ifsSplitOrderRecordService.saveBatch(collect);
+                ifsSplitOrderRecordService.save(record);
+            });
+            return true;
         }
         return false;
     }

--
Gitblit v1.9.3