From 5740eb93928f3cb8e17c3fa5f082f42072ebbc31 Mon Sep 17 00:00:00 2001
From: zhuguifei <312353457@qq.com>
Date: 星期四, 12 三月 2026 13:03:17 +0800
Subject: [PATCH] feat: 新增基础数据维护-判定规程维护界面和后端接口

---
 RuoYi-Vue-Plus/ruoyi-modules/ruoyi-qa/src/main/java/org/dromara/qa/analy/service/impl/StoreSilkInfoServiceImpl.java |  102 +++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 98 insertions(+), 4 deletions(-)

diff --git a/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-qa/src/main/java/org/dromara/qa/analy/service/impl/StoreSilkInfoServiceImpl.java b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-qa/src/main/java/org/dromara/qa/analy/service/impl/StoreSilkInfoServiceImpl.java
index eaf9a1c..03254ad 100644
--- a/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-qa/src/main/java/org/dromara/qa/analy/service/impl/StoreSilkInfoServiceImpl.java
+++ b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-qa/src/main/java/org/dromara/qa/analy/service/impl/StoreSilkInfoServiceImpl.java
@@ -219,9 +219,12 @@
             // 鍗峰寘浜ч噺缁熻
             Double rollerOutput = 0.0;
             Double packerOutput = 0.0;
-            // 鏄庣粏鍒楄〃
+            // 鏄庣粏鍒楄〃锛堜粎瀛樻渶缁堟鏁扮粨鏋滐級
             List<StoreSilkDetailVo> rollerDetailList = new ArrayList<>();
             List<StoreSilkDetailVo> packerDetailList = new ArrayList<>();
+            // 鎿嶄綔璁板綍鍒楄〃锛堝瓨鎵�鏈夊鍑忚繃绋嬶級
+            List<StoreSilkDetailVo> rollerRecordList = new ArrayList<>();
+            List<StoreSilkDetailVo> packerRecordList = new ArrayList<>();
 
             for (int s = 0; s < distShiftList.size(); s++) {
                 MdShiftBo shiftBo = distShiftList.get(s);
@@ -347,6 +350,20 @@
                         // 鍏堟妸缁熻缁撴潫鏃跺埢绱鍊煎姞杩涙潵锛歝urrent = Qty(calcEnd)
                         currentRollerOutput += rData.getQty();
 
+                        // 璁板綍杩囩▼锛氱彮娆℃埅姝㈢疮璁�
+                        StoreSilkDetailVo endRecord = new StoreSilkDetailVo();
+                        endRecord.setFsNum(fsNum.substring(2, 3));
+                        endRecord.setSiloNum(containerNum);
+                        endRecord.setPipeNum(channel);
+                        endRecord.setEquNo(equNo);
+                        endRecord.setShiftCode(shift);
+                        endRecord.setShiftStartTime(calcStartDate);
+                        endRecord.setShiftEndTime(calcEndDate);
+                        endRecord.setOutput(rData.getQty());
+                        endRecord.setCalcType("鐝鎴绱");
+                        endRecord.setHitTime(rData.getTime());
+                        rollerRecordList.add(endRecord);
+
                         // 2) 鎵b�滃ご鈥濓細濡傛灉缁熻寮�濮嬫椂鍒绘櫄浜庣彮娆″紑濮嬶紝鍒欏噺鍘� Qty(calcStart)
                         if (calcStartDate.after(stimDate)) {
                             LocalDateTime calcStartLdt = LocalDateTime.ofInstant(calcStartDate.toInstant(), zone);
@@ -365,6 +382,20 @@
                             RollerTimeData rBeginData = rollerTimeDataMapper.selectOne(beginRlqw);
                             if (rBeginData != null) {
                                 currentRollerOutput -= rBeginData.getQty();
+
+                                // 璁板綍杩囩▼锛氭墸闄ゅご閮ㄤ骇閲�
+                                StoreSilkDetailVo beginRecord = new StoreSilkDetailVo();
+                                beginRecord.setFsNum(fsNum.substring(2, 3));
+                                beginRecord.setSiloNum(containerNum);
+                                beginRecord.setPipeNum(channel);
+                                beginRecord.setEquNo(equNo);
+                                beginRecord.setShiftCode(shift);
+                                beginRecord.setShiftStartTime(calcStartDate);
+                                beginRecord.setShiftEndTime(calcEndDate);
+                                beginRecord.setOutput(-rBeginData.getQty()); // 璐熸暟琛ㄧず鎵i櫎
+                                beginRecord.setCalcType("鎵i櫎鍑烘枡鍓嶇疮璁�");
+                                beginRecord.setHitTime(rBeginData.getTime());
+                                rollerRecordList.add(beginRecord);
                             }
                         }
                     }
@@ -401,6 +432,20 @@
                         // 鍏堟妸缁熻缁撴潫鏃跺埢绱鍊煎姞杩涙潵锛歝urrent = Qty(calcEnd)
                         currentPackerOutput += pData.getTsQty();
 
+                        // 璁板綍杩囩▼锛氱彮娆℃埅姝㈢疮璁�
+                        StoreSilkDetailVo endRecord = new StoreSilkDetailVo();
+                        endRecord.setFsNum(fsNum.substring(2, 3));
+                        endRecord.setSiloNum(containerNum);
+                        endRecord.setPipeNum(channel);
+                        endRecord.setEquNo(equNo);
+                        endRecord.setShiftCode(shift);
+                        endRecord.setShiftStartTime(calcStartDate);
+                        endRecord.setShiftEndTime(calcEndDate);
+                        endRecord.setOutput(pData.getTsQty());
+                        endRecord.setCalcType("鐝鎴绱");
+                        endRecord.setHitTime(pData.getTime());
+                        packerRecordList.add(endRecord);
+
                         // 2) 鎵b�滃ご鈥濓細濡傛灉缁熻寮�濮嬫椂鍒绘櫄浜庣彮娆″紑濮嬶紝鍒欏噺鍘� Qty(calcStart)
                         if (calcStartDate.after(stimDate)) {
                             LocalDateTime calcStartLdt = LocalDateTime.ofInstant(calcStartDate.toInstant(), zone);
@@ -419,6 +464,20 @@
                             PackerTimeData pBeginData = packerTimeDataMapper.selectOne(beginPlqw);
                             if (pBeginData != null) {
                                 currentPackerOutput -= pBeginData.getTsQty();
+
+                                // 璁板綍杩囩▼锛氭墸闄ゅご閮ㄤ骇閲�
+                                StoreSilkDetailVo beginRecord = new StoreSilkDetailVo();
+                                beginRecord.setFsNum(fsNum.substring(2, 3));
+                                beginRecord.setSiloNum(containerNum);
+                                beginRecord.setPipeNum(channel);
+                                beginRecord.setEquNo(equNo);
+                                beginRecord.setShiftCode(shift);
+                                beginRecord.setShiftStartTime(calcStartDate);
+                                beginRecord.setShiftEndTime(calcEndDate);
+                                beginRecord.setOutput(-pBeginData.getTsQty()); // 璐熸暟琛ㄧず鎵i櫎
+                                beginRecord.setCalcType("鎵i櫎鍑烘枡鍓嶇疮璁�");
+                                beginRecord.setHitTime(pBeginData.getTime());
+                                packerRecordList.add(beginRecord);
                             }
                         }
                     }
@@ -444,6 +503,8 @@
             storeSilkInfoVo.setPackerOutput(packerOutput);
             storeSilkInfoVo.setRollerDetailList(rollerDetailList);
             storeSilkInfoVo.setPackerDetailList(packerDetailList);
+            storeSilkInfoVo.setRollerRecordList(rollerRecordList);
+            storeSilkInfoVo.setPackerRecordList(packerRecordList);
 
         }
 
@@ -558,11 +619,44 @@
         LambdaQueryWrapper<StoreSilkInfo> lqw = Wrappers.lambdaQuery();
         lqw.orderByAsc(StoreSilkInfo::getId);
         lqw.like(StringUtils.isNotBlank(bo.getMaterialname()), StoreSilkInfo::getMaterialname, bo.getMaterialname());
-        lqw.eq(StringUtils.isNotBlank(bo.getBatchcode()), StoreSilkInfo::getBatchcode, bo.getBatchcode());
-        lqw.eq(bo.getActualstarttime() != null, StoreSilkInfo::getActualstarttime, bo.getActualstarttime());
+        lqw.like(StringUtils.isNotBlank(bo.getBatchcode()), StoreSilkInfo::getBatchcode, bo.getBatchcode());
+        if (bo.getActualstarttime() != null) {
+            ZoneId zone = ZoneId.systemDefault();
+            LocalDate day = bo.getActualstarttime().toInstant().atZone(zone).toLocalDate();
+            Date dayStart = Date.from(day.atStartOfDay(zone).toInstant());
+            Date nextDayStart = Date.from(day.plusDays(1).atStartOfDay(zone).toInstant());
+            lqw.ge(StoreSilkInfo::getActualstarttime, dayStart);
+            lqw.lt(StoreSilkInfo::getActualstarttime, nextDayStart);
+        }
         lqw.eq(bo.getDistimebegin() != null, StoreSilkInfo::getDistimebegin, bo.getDistimebegin());
         lqw.eq(bo.getDistimeend() != null, StoreSilkInfo::getDistimeend, bo.getDistimeend());
-        lqw.eq(StringUtils.isNotBlank(bo.getSiloid()), StoreSilkInfo::getSiloid, bo.getSiloid());
+        if (StringUtils.isNotBlank(bo.getSiloid())) {
+            // 鏀寔澶氫釜鏌滃彿鏌ヨ锛屼互閫楀彿鍒嗛殧
+            String[] siloids = bo.getSiloid().split(",");
+            lqw.and(wrapper -> {
+                for (String val : siloids) {
+                    val = val.trim();
+                    if (StringUtils.isBlank(val)) {
+                        continue;
+                    }
+                    String finalVal = val;
+                    // 浣跨敤 OR 杩炴帴澶氫釜鏌滃彿鏉′欢
+                    wrapper.or(w -> {
+                        try {
+                            int num = Integer.parseInt(finalVal);
+                            String padded = String.format("%02d", num);
+                            // 鍖归厤 _1 鎴� _01 (鍏煎涓嶈ˉ闆跺拰琛ラ浂鐨勬儏鍐�)
+                            w.likeLeft(StoreSilkInfo::getSiloid, "_" + num)
+                                    .or()
+                                    .likeLeft(StoreSilkInfo::getSiloid, "_" + padded);
+                        } catch (NumberFormatException e) {
+                            // 闈炴暟瀛楀垯鎸夊師鍊煎尮閰�
+                            w.eq(StoreSilkInfo::getSiloid, finalVal);
+                        }
+                    });
+                }
+            });
+        }
         lqw.between(params.get("beginTime") != null && params.get("endTime") != null,
                 StoreSilkInfo::getDistimeend, params.get("beginTime"), params.get("endTime"));
         return lqw;

--
Gitblit v1.9.3