From 1debc99339176e80b3baaf72b55032d191e99f6f Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期五, 15 五月 2026 20:37:09 +0800
Subject: [PATCH] Merge branch 'dev_New_pro' into dev_pro_河南鹤壁

---
 doc/20260515_设备巡检异常联动维修单_前端联调文档.md                                                                   |  170 +++++
 src/main/java/com/ruoyi/stock/service/StockInventoryService.java                                     |    2 
 src/main/resources/mapper/basic/CustomerMapper.xml                                                   |    3 
 src/main/java/com/ruoyi/purchase/pojo/ProductRecord.java                                             |    3 
 src/main/java/com/ruoyi/stock/execl/StockInRecordExportData.java                                     |    4 
 src/main/java/com/ruoyi/inspectiontask/service/impl/TimingTaskJob.java                               |   12 
 src/main/resources/logback.xml                                                                       |   16 
 src/main/java/com/ruoyi/account/service/impl/financial/FinLedgerServiceImpl.java                     |   33 +
 src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java                                      |    1 
 src/main/java/com/ruoyi/stock/service/impl/StockInRecordServiceImpl.java                             |    2 
 src/main/java/com/ruoyi/account/service/impl/financial/FinVoucherServiceImpl.java                    |    8 
 src/main/java/com/ruoyi/stock/execl/StockUnInventoryExportData.java                                  |    2 
 src/main/java/com/ruoyi/sales/service/impl/ShippingInfoServiceImpl.java                              |    8 
 src/main/resources/mapper/sales/SalesLedgerProductMapper.xml                                         |    1 
 src/main/java/com/ruoyi/device/service/impl/DeviceRepairServiceImpl.java                             |   99 +++
 src/main/java/com/ruoyi/device/service/impl/MaintenanceTaskJob.java                                  |    1 
 src/main/java/com/ruoyi/production/service/impl/ProductionOrderServiceImpl.java                      |  102 ++-
 src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java                            |   42 
 src/main/java/com/ruoyi/sales/pojo/SalesQuotationProduct.java                                        |    7 
 src/main/java/com/ruoyi/device/controller/DeviceRepairController.java                                |   10 
 src/main/java/com/ruoyi/inspectiontask/service/impl/TimingTaskServiceImpl.java                       |   53 +
 src/main/java/com/ruoyi/device/pojo/DeviceRepair.java                                                |   12 
 src/main/java/com/ruoyi/device/pojo/MaintenanceTask.java                                             |    4 
 src/main/java/com/ruoyi/approve/service/impl/ApproveNodeServiceImpl.java                             |    2 
 src/main/java/com/ruoyi/stock/execl/StockInventoryExportData.java                                    |    4 
 src/main/java/com/ruoyi/account/bean/vo/financial/FinLedgerRowVo.java                                |    2 
 src/main/java/com/ruoyi/stock/mapper/StockInventoryMapper.java                                       |    2 
 src/main/java/com/ruoyi/device/execl/DeviceRepairExeclDto.java                                       |   12 
 src/main/java/com/ruoyi/approve/bean/vo/ApproveProcessVO.java                                        |    2 
 src/main/java/com/ruoyi/account/bean/vo/financial/FinVoucherDetailVo.java                            |    3 
 doc/前端联调文档-设备报修保养财务模块改造.md                                                                           |  233 ++++++++
 src/main/java/com/ruoyi/framework/security/LoginUser.java                                            |    5 
 src/main/resources/mapper/measuringinstrumentledger/MeasuringInstrumentLedgerMapper.xml              |   14 
 src/main/java/com/ruoyi/inspectiontask/service/impl/InspectionTaskServiceImpl.java                   |  236 +++++++
 .gitignore                                                                                           |    4 
 src/main/java/com/ruoyi/collaborativeApproval/service/impl/SealApplicationManagementServiceImpl.java |    9 
 src/main/java/com/ruoyi/inspectiontask/pojo/TimingTask.java                                          |    8 
 src/main/resources/mapper/sales/SalesQuotationMapper.xml                                             |    2 
 src/main/resources/mapper/collaborativeApproval/SealApplicationManagementMapper.xml                  |   29 
 doc/20260515_device_maintenance_inspection_abnormal_acceptance.sql                                   |   22 
 src/main/java/com/ruoyi/collaborativeApproval/dto/SealApplicationManagementDTO.java                  |    8 
 src/main/java/com/ruoyi/device/service/IDeviceRepairService.java                                     |    4 
 src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java                            |    2 
 src/main/java/com/ruoyi/approve/service/impl/ApproveProcessServiceImpl.java                          |    2 
 src/main/java/com/ruoyi/collaborativeApproval/controller/SealApplicationManagementController.java    |   22 
 src/main/java/com/ruoyi/stock/dto/StockInventoryDto.java                                             |    3 
 src/main/java/com/ruoyi/inspectiontask/pojo/InspectionTask.java                                      |   20 
 src/main/resources/mapper/stock/StockInventoryMapper.xml                                             |  345 +++++++++--
 src/main/java/com/ruoyi/stock/controller/StockInventoryController.java                               |   20 
 src/main/java/com/ruoyi/stock/execl/StockOutRecordExportData.java                                    |    6 
 src/main/java/com/ruoyi/production/service/impl/ProductionBomStructureServiceImpl.java               |   76 +
 src/main/resources/mapper/device/DeviceRepairMapper.xml                                              |   14 
 src/main/java/com/ruoyi/account/bean/dto/financial/FinVoucherDto.java                                |    3 
 src/main/java/com/ruoyi/basic/enums/RecordTypeEnum.java                                              |    1 
 54 files changed, 1,477 insertions(+), 233 deletions(-)

diff --git a/.gitignore b/.gitignore
index b60b03f..d3f800c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,7 +4,7 @@
 .gradle
 /build/
 !gradle/wrapper/gradle-wrapper.jar
-
+claude.md
 target/
 !.mvn/wrapper/maven-wrapper.jar
 
@@ -43,4 +43,4 @@
 
 !*/build/*.java
 !*/build/*.html
-!*/build/*.xml
\ No newline at end of file
+!*/build/*.xml
diff --git a/doc/20260515_device_maintenance_inspection_abnormal_acceptance.sql b/doc/20260515_device_maintenance_inspection_abnormal_acceptance.sql
new file mode 100644
index 0000000..7f34fe0
--- /dev/null
+++ b/doc/20260515_device_maintenance_inspection_abnormal_acceptance.sql
@@ -0,0 +1,22 @@
+ALTER TABLE `inspection_task`
+    ADD COLUMN `inspection_project` VARCHAR(100) NULL COMMENT '宸℃椤圭洰' AFTER `task_name`;
+
+ALTER TABLE `inspection_task`
+    ADD COLUMN `inspection_result` VARCHAR(1) NULL COMMENT '宸℃缁撴灉 0寮傚父 1姝e父' AFTER `remarks`,
+    ADD COLUMN `abnormal_description` VARCHAR(500) NULL COMMENT '寮傚父鎻忚堪' AFTER `inspection_result`,
+    ADD COLUMN `device_repair_id` BIGINT NULL COMMENT '鍏宠仈缁翠慨鍗旾D' AFTER `abnormal_description`,
+    ADD COLUMN `acceptance_user_id` BIGINT NULL COMMENT '楠屾敹浜篒D' AFTER `device_repair_id`,
+    ADD COLUMN `acceptance_name` VARCHAR(100) NULL COMMENT '楠屾敹浜�' AFTER `acceptance_user_id`;
+
+ALTER TABLE `timing_task`
+    ADD COLUMN `inspection_project` VARCHAR(100) NULL COMMENT '宸℃椤圭洰' AFTER `task_name`,
+    ADD COLUMN `is_enabled` TINYINT(1) NOT NULL DEFAULT 1 COMMENT '鏄惁鍚敤 0鍚� 1鏄�' AFTER `is_active`;
+
+CREATE INDEX `idx_inspection_task_device_repair_id`
+    ON `inspection_task` (`device_repair_id`);
+
+CREATE INDEX `idx_inspection_task_inspection_result`
+    ON `inspection_task` (`inspection_result`);
+
+CREATE INDEX `idx_timing_task_is_enabled`
+    ON `timing_task` (`is_enabled`);
diff --git "a/doc/20260515_\350\256\276\345\244\207\345\267\241\346\243\200\345\274\202\345\270\270\350\201\224\345\212\250\347\273\264\344\277\256\345\215\225_\345\211\215\347\253\257\350\201\224\350\260\203\346\226\207\346\241\243.md" "b/doc/20260515_\350\256\276\345\244\207\345\267\241\346\243\200\345\274\202\345\270\270\350\201\224\345\212\250\347\273\264\344\277\256\345\215\225_\345\211\215\347\253\257\350\201\224\350\260\203\346\226\207\346\241\243.md"
new file mode 100644
index 0000000..0df5fcc
--- /dev/null
+++ "b/doc/20260515_\350\256\276\345\244\207\345\267\241\346\243\200\345\274\202\345\270\270\350\201\224\345\212\250\347\273\264\344\277\256\345\215\225_\345\211\215\347\253\257\350\201\224\350\260\203\346\226\207\346\241\243.md"
@@ -0,0 +1,170 @@
+# 璁惧宸℃涓庡畾鏃跺贰妫�鍓嶇鑱旇皟鏂囨。锛坕nspectiontask锛�
+
+> 鏇存柊鏃ユ湡锛�2026-05-15  
+> 閫傜敤妯″潡锛氳澶囧贰妫�浠诲姟 `inspectiontask`锛坄/inspectionTask`锛変笌瀹氭椂宸℃浠诲姟锛坄/timingTask`锛�
+
+## 1. 鏈鏀瑰姩
+
+1. 宸℃浠诲姟鏂板瀛楁锛�
+   - `inspectionProject`锛堝贰妫�椤圭洰锛�
+   - `inspectionResult`锛堝贰妫�缁撴灉锛宍0`寮傚父 / `1`姝e父锛屽繀濉級
+   - `abnormalDescription`锛堝紓甯告弿杩帮級
+   - `deviceRepairId`锛堝叧鑱旂淮淇崟ID锛屽紓甯告椂鍚庣鑷姩鍥炲~锛�
+   - `acceptanceUserId`锛堥獙鏀朵汉ID锛�
+   - `acceptanceName`锛堥獙鏀朵汉锛�
+2. 寮傚父鏍¢獙瑙勫垯锛�
+   - `inspectionResult=1`锛堟甯革級锛氱収鐗囬潪蹇呭~銆�
+   - `inspectionResult=0`锛堝紓甯革級锛氬繀椤绘湁鐓х墖锛屼笖蹇呴』濉啓 `abnormalDescription`銆�
+3. 寮傚父鑱斿姩瑙勫垯锛�
+   - 寮傚父淇濆瓨鍚庤嚜鍔ㄧ敓鎴� `device_repair` 骞跺洖濉� `deviceRepairId`銆�
+4. 瀹氭椂浠诲姟鏂板瀛楁锛�
+   - `inspectionProject`锛堝贰妫�椤圭洰锛�
+   - `isEnabled`锛堟槸鍚﹀惎鐢紝`0`鍚� / `1`鏄級
+5. 澶囨敞甯﹀叆瑙勫垯锛�
+   - 瀹氭椂浠诲姟鑷姩鐢熸垚宸℃璁板綍鏃讹紝鑻ュ畾鏃朵换鍔� `remarks` 鏈夊�硷紝浼氭嫾鎺ュ埌宸℃璁板綍澶囨敞涓��
+
+## 2. 鏁版嵁搴撳彉鏇�
+
+鑱旇皟鍓嶆墽琛� SQL锛�
+
+- [doc/20260515_device_maintenance_inspection_abnormal_acceptance.sql](/D:/鐗涢┈/鍗楅��/鍚庣/product-inventory-management-after-jdk25/doc/20260515_device_maintenance_inspection_abnormal_acceptance.sql)
+
+> 璇存槑锛氳鑴氭湰褰撳墠浣滅敤浜� `inspection_task` 涓� `timing_task` 涓ゅ紶琛紝鏂囦欢鍚嶅巻鍙蹭繚鐣欐湭鏀广��
+
+## 3. 宸℃浠诲姟鎺ュ彛
+
+### 3.1 淇濆瓨鎺ュ彛
+
+`POST /inspectionTask/addOrEditInspectionTask`
+
+| 瀛楁 | 绫诲瀷 | 蹇呭~ | 璇存槑 |
+|---|---|---|---|
+| id | long | 鍚� | 鏈夊��=淇敼锛屾棤鍊�=鏂板 |
+| taskId | int | 寤鸿蹇呭~ | 璁惧ID锛堢敤浜庡紓甯歌嚜鍔ㄥ缓缁翠慨鍗曪級 |
+| taskName | string | 寤鸿蹇呭~ | 璁惧鍚嶇О |
+| inspectionProject | string | 鍚� | 宸℃椤圭洰 |
+| inspectorId | string | 鍚� | 宸℃浜篒D锛屾敮鎸侀�楀彿鍒嗛殧 |
+| inspectionResult | string | 鏄� | `0`=寮傚父锛宍1`=姝e父 |
+| abnormalDescription | string | 鏉′欢蹇呭~ | 寮傚父鏃跺繀濉� |
+| acceptanceUserId | long | 鍚� | 楠屾敹浜篒D |
+| acceptanceName | string | 鍚� | 楠屾敹浜哄鍚� |
+| commonFileListDTO | array | 鏉′欢蹇呭~ | 闄勪欢缁�1锛堝紓甯告椂涓夌粍鑷冲皯涓�缁勬湁鍥撅級 |
+| commonFileListAfterDTO | array | 鏉′欢蹇呭~ | 闄勪欢缁�2锛堝紓甯告椂涓夌粍鑷冲皯涓�缁勬湁鍥撅級 |
+| commonFileListBeforeDTO | array | 鏉′欢蹇呭~ | 闄勪欢缁�3锛堝紓甯告椂涓夌粍鑷冲皯涓�缁勬湁鍥撅級 |
+
+寮傚父绀轰緥锛�
+
+```json
+{
+  "taskId": 1001,
+  "taskName": "绌哄帇鏈篈-01",
+  "inspectionProject": "娑︽粦绯荤粺",
+  "inspectorId": "12",
+  "inspectionResult": "0",
+  "abnormalDescription": "鐢垫満寮傚搷锛屾俯鍗囧亸楂�",
+  "acceptanceUserId": 20,
+  "commonFileListDTO": [
+    {
+      "id": 90001,
+      "application": "file"
+    }
+  ]
+}
+```
+
+姝e父绀轰緥锛�
+
+```json
+{
+  "taskId": 1001,
+  "taskName": "绌哄帇鏈篈-01",
+  "inspectionProject": "鐐规",
+  "inspectorId": "12",
+  "inspectionResult": "1",
+  "acceptanceUserId": 20
+}
+```
+
+### 3.2 鍒楄〃鎺ュ彛
+
+`GET /inspectionTask/list`
+
+杩斿洖鍖呭惈鏂板瀛楁锛�
+
+- `inspectionProject`
+- `inspectionResult`
+- `abnormalDescription`
+- `deviceRepairId`
+- `acceptanceUserId`
+- `acceptanceName`
+
+## 4. 瀹氭椂浠诲姟鎺ュ彛
+
+### 4.1 淇濆瓨鎺ュ彛
+
+`POST /timingTask/addOrEditTimingTask`
+
+鏂板/鏇存柊瀛楁锛�
+
+| 瀛楁 | 绫诲瀷 | 蹇呭~ | 璇存槑 |
+|---|---|---|---|
+| inspectionProject | string | 鍚� | 宸℃椤圭洰 |
+| remarks | string | 鍚� | 澶囨敞 |
+| isEnabled | int | 鍚� | `0`=绂佺敤锛宍1`=鍚敤锛涗笉浼犻粯璁ゅ惎鐢� |
+
+绀轰緥锛�
+
+```json
+{
+  "taskName": "绌哄帇鏈篈-01瀹氭椂宸℃",
+  "inspectionProject": "鏈堝害宸℃",
+  "taskId": 1001,
+  "inspectorIds": "12,13",
+  "frequencyType": "DAILY",
+  "frequencyDetail": "09:00",
+  "remarks": "閲嶇偣妫�鏌ヨ酱鎵挎俯搴�",
+  "isEnabled": 1
+}
+```
+
+### 4.2 鍚敤鐘舵�佽涓�
+
+1. `isEnabled=1`锛氫换鍔¤繘鍏ヨ皟搴︼紝鎸夐娆¤嚜鍔ㄧ敓鎴愬贰妫�璁板綍銆�
+2. `isEnabled=0`锛氫换鍔′笉璋冨害锛涘凡瀛樺湪璋冨害浼氳绉婚櫎銆�
+
+### 4.3 澶囨敞甯﹀叆瑙勫垯
+
+瀹氭椂浠诲姟鑷姩鐢熸垚宸℃璁板綍鏃讹細
+
+1. 宸℃璁板綍澶囨敞鍥哄畾鍓嶇紑锛歚鑷姩鐢熸垚鑷畾鏃朵换鍔D: {id}`
+2. 褰撳畾鏃朵换鍔� `remarks` 闈炵┖鏃讹紝鎷兼帴涓猴細  
+   `鑷姩鐢熸垚鑷畾鏃朵换鍔D: {id}锛泏remarks}`
+
+## 5. 寮傚父鑷姩寤虹淮淇崟瑙勫垯
+
+褰撳贰妫�璁板綍 `inspectionResult=0` 鏃讹細
+
+1. 鑻� `deviceRepairId` 涓虹┖锛屽悗绔嚜鍔ㄥ垱寤� `device_repair`锛�
+   - `deviceLedgerId`锛氭潵鑷� `taskId`
+   - `deviceName`锛氫紭鍏� `taskName`锛屽惁鍒欏彇璁惧鍙拌处鍚嶇О
+   - `remark`锛氬紓甯告弿杩�
+   - `status`锛歚0`锛堝緟缁翠慨锛�
+2. 鑻ュ凡鏈夊叧鑱旂淮淇崟锛屼粎鍚屾鏇存柊缁翠慨鍗� `remark`銆�
+
+## 6. 鍓嶇鏀归�犲缓璁�
+
+1. 宸℃琛ㄥ崟鏂板 `inspectionProject` 杈撳叆妗嗐��
+2. 宸℃琛ㄥ崟淇濈暀鈥滄甯�/寮傚父鈥濊仈鍔ㄦ牎楠岋細
+   - 寮傚父鏃跺己鍒跺紓甯告弿杩� + 鑷冲皯涓�缁勫浘鐗囥��
+3. 瀹氭椂浠诲姟琛ㄥ崟鏂板鈥滄槸鍚﹀惎鐢ㄢ�濆紑鍏冲苟鏄犲皠 `isEnabled`銆�
+4. 瀹氭椂浠诲姟琛ㄥ崟鏂板 `inspectionProject` 涓� `remarks` 杈撳叆椤广��
+5. 宸℃鍒楄〃灞曠ず `inspectionProject` 鍜� `deviceRepairId`锛堟敮鎸佽烦杞淮淇崟璇︽儏锛夈��
+
+## 7. 鑱旇皟楠屾敹娓呭崟
+
+1. 宸℃鏂板/淇敼鍙纭彁浜� `inspectionProject` 骞跺湪鍒楄〃鍥炴樉銆�
+2. 寮傚父宸℃锛堟湁鎻忚堪+鏈夊浘锛変繚瀛樻垚鍔熷苟鍥炲~ `deviceRepairId`銆�
+3. 寮傚父宸℃缂烘弿杩版垨缂哄浘鐗囨椂琚嫤鎴��
+4. 瀹氭椂浠诲姟 `isEnabled=0` 鏃朵笉鍐嶈Е鍙戣嚜鍔ㄥ贰妫�璁板綍銆�
+5. 瀹氭椂浠诲姟 `isEnabled=1` 鏃舵寜棰戞鐢熸垚宸℃璁板綍銆�
+6. 瀹氭椂浠诲姟鏈� `remarks` 鏃讹紝鑷姩宸℃璁板綍澶囨敞甯︿笂璇ュ唴瀹广��
diff --git "a/doc/\345\211\215\347\253\257\350\201\224\350\260\203\346\226\207\346\241\243-\350\256\276\345\244\207\346\212\245\344\277\256\344\277\235\345\205\273\350\264\242\345\212\241\346\250\241\345\235\227\346\224\271\351\200\240.md" "b/doc/\345\211\215\347\253\257\350\201\224\350\260\203\346\226\207\346\241\243-\350\256\276\345\244\207\346\212\245\344\277\256\344\277\235\345\205\273\350\264\242\345\212\241\346\250\241\345\235\227\346\224\271\351\200\240.md"
new file mode 100644
index 0000000..43c468c
--- /dev/null
+++ "b/doc/\345\211\215\347\253\257\350\201\224\350\260\203\346\226\207\346\241\243-\350\256\276\345\244\207\346\212\245\344\277\256\344\277\235\345\205\273\350\264\242\345\212\241\346\250\241\345\235\227\346\224\271\351\200\240.md"
@@ -0,0 +1,233 @@
+# 鍓嶇鑱旇皟鏂囨。锛堣澶囨姤淇� / 璁惧淇濆吇瀹氭椂浠诲姟 / 璐㈠姟绉戠洰鎬昏处锛�
+
+## 1. 鍙樻洿鑼冨洿
+
+鏈鑱旇皟娑夊強 3 涓ā鍧楋細
+
+1. 璐㈠姟妯″潡锛氱鐩�昏处鍘绘帀鍑瘉瀛楀彿銆佹憳瑕侊紝鍙繑鍥� 1 鏉″悎璁℃暟鎹��
+2. 璁惧淇濆吇瀹氭椂浠诲姟锛氭柊澧� `淇濆吇浜篳 瀛楁锛屽畾鏃朵换鍔$敓鎴愪繚鍏昏褰曟椂甯﹀叆銆�
+3. 璁惧鎶ヤ慨锛氱‘璁ゆ姤淇悗鏂板楠屾敹瀹℃壒锛岄獙鏀堕�氳繃鍚庢墠绠楀畬缁撱��
+
+---
+
+## 2. 鎺ュ彛娓呭崟
+
+### 2.1 璐㈠姟-绉戠洰鎬昏处
+
+- **GET** `/financial/ledger/general`
+- 璇存槑锛氳繑鍥炵鐩�昏处鍚堣锛屼粎 1 鏉¤褰曘��
+
+#### 璇锋眰鍙傛暟锛圦uery锛�
+
+| 鍙傛暟 | 绫诲瀷 | 蹇呭~ | 璇存槑 |
+|---|---|---|---|
+| `subjectCode` | string | 鏄� | 绉戠洰缂栫爜 |
+| `startMonth` | string | 鏄� | 寮�濮嬫湀浠斤紝鏍煎紡 `YYYY-MM` |
+| `endMonth` | string | 鏄� | 缁撴潫鏈堜唤锛屾牸寮� `YYYY-MM` |
+
+#### 杩斿洖缁撴瀯
+
+`R<List<FinLedgerRowVo>>`
+
+```json
+{
+  "code": 200,
+  "msg": "鎿嶄綔鎴愬姛",
+  "data": [
+    {
+      "rowType": "yearly_total",
+      "date": "2026-05-31",
+      "debit": 12000.00,
+      "credit": 8000.00,
+      "direction": "鍊�",
+      "balance": 4000.00
+    }
+  ]
+}
+```
+
+#### 鑱旇皟娉ㄦ剰
+
+1. `data` 鍥哄畾鍙湁 1 鏉★紙鍚堣锛夈��
+2. `voucherNo`銆乣summary` 涓嶈繑鍥烇紙涓嶅啀灞曠ず鍑瘉瀛楀彿銆佹憳瑕侊級銆�
+
+---
+
+### 2.2 璁惧淇濆吇瀹氭椂浠诲姟锛堟柊澧炰繚鍏讳汉锛�
+
+- 鍩虹璺緞锛歚/deviceMaintenanceTask`
+- 鐩稿叧鎺ュ彛锛�
+  - **POST** `/add`
+  - **POST** `/update`
+  - **GET** `/listPage`
+
+#### 鏂板瀛楁
+
+| 瀛楁 | 绫诲瀷 | 璇存槑 |
+|---|---|---|
+| `maintenancePerson` | string | 淇濆吇浜� |
+
+#### 鏂板/鏇存柊璇锋眰绀轰緥
+
+```json
+{
+  "id": 1,
+  "taskName": "绌哄帇鏈轰繚鍏讳换鍔�",
+  "taskId": 1001,
+  "maintenancePerson": "寮犱笁",
+  "frequencyType": "MONTHLY",
+  "frequencyDetail": "10,09:00",
+  "remarks": "姣忔湀渚嬭淇濆吇"
+}
+```
+
+#### 瀹氭椂浠诲姟涓嬪彂琛屼负
+
+瀹氭椂浠诲姟鎵ц鍚庯紝绯荤粺鑷姩鍒涘缓淇濆吇璁板綍锛坄device_maintenance`锛夋椂浼氬啓鍏ワ細
+
+- `maintenanceActuallyName = maintenancePerson`
+
+鍗冲墠绔湪瀹氭椂浠诲姟閲岀淮鎶ょ殑淇濆吇浜猴紝浼氳嚜鍔ㄥ甫鍏ュ埌淇濆吇璁板綍銆�
+
+---
+
+### 2.3 璁惧鎶ヤ慨锛堢‘璁ゅ悗楠屾敹瀹℃壒锛�
+
+- 鍩虹璺緞锛歚/device/repair`
+
+#### 鐘舵�佸畾涔�
+
+| 鐘舵�佸�� | 鍚箟 |
+|---|---|
+| `0` | 寰呯淮淇� |
+| `3` | 寰呴獙鏀� |
+| `1` | 瀹岀粨 |
+| `2` | 澶辫触 |
+
+#### 2.3.1 缁翠慨纭锛堝師纭鎶ヤ慨锛�
+
+- **POST** `/device/repair/repair`
+- 璇存槑锛氭彁浜ゅ悗鐘舵�佷粠 `寰呯淮淇�(0)` 杩涘叆 `寰呴獙鏀�(3)`锛屼笉鍐嶇洿鎺ュ畬缁撱��
+
+璇锋眰绀轰緥锛�
+
+```json
+{
+  "id": 10001,
+  "maintenanceName": "鏉庡洓",
+  "maintenanceTime": "2026-05-14 10:30:00",
+  "maintenanceResult": "鏇存崲杞存壙骞惰瘯杩愯姝e父",
+  "sparePartsUseList": [
+    {
+      "id": 501,
+      "quantity": 2
+    }
+  ]
+}
+```
+
+甯歌澶辫触鎻愮ず锛堢敤浜庡墠绔脊绐楋級锛�
+
+- `鎶ヤ慨璁板綍涓嶅瓨鍦╜
+- `璇ユ姤淇凡瀹岀粨锛屼笉鑳介噸澶嶇‘璁ょ淮淇甡
+- `璇ユ姤淇凡鎻愪氦楠屾敹瀹℃壒`
+- `澶囦欢 xxx 鏁伴噺涓嶈冻`
+
+#### 2.3.2 楠屾敹瀹℃壒锛堟柊澧烇級
+
+- **POST** `/device/repair/acceptance`
+- 璇存槑锛氫粎 `寰呴獙鏀�(3)` 鍙鎵癸紱瀹℃壒閫氳繃鍚庣姸鎬佹敼涓� `瀹岀粨(1)`銆�
+
+璇锋眰鍙傛暟锛圔ody锛夛細
+
+| 瀛楁 | 绫诲瀷 | 蹇呭~ | 璇存槑 |
+|---|---|---|---|
+| `id` | long | 鏄� | 鎶ヤ慨璁板綍ID |
+| `acceptanceName` | string | 鏄� | 楠屾敹浜� |
+| `acceptanceTime` | string | 鏄� | 楠屾敹鏃堕棿锛屾牸寮� `yyyy-MM-dd HH:mm:ss` |
+| `acceptanceRemark` | string | 鏄� | 楠屾敹澶囨敞 |
+
+璇锋眰绀轰緥锛�
+
+```json
+{
+  "id": 10001,
+  "acceptanceName": "鐜嬩簲",
+  "acceptanceTime": "2026-05-14 11:00:00",
+  "acceptanceRemark": "缁翠慨椤规牳楠岄�氳繃锛岃澶囪繍琛屾甯�"
+}
+```
+
+甯歌澶辫触鎻愮ず锛�
+
+- `鎶ヤ慨璁板綍id涓嶈兘涓虹┖`
+- `鎶ヤ慨璁板綍涓嶅瓨鍦╜
+- `璇ユ姤淇湭杩涘叆寰呴獙鏀剁姸鎬侊紝涓嶈兘瀹℃壒`
+- `楠屾敹浜轰笉鑳戒负绌篳
+- `楠屾敹鏃堕棿涓嶈兘涓虹┖`
+- `楠屾敹澶囨敞涓嶈兘涓虹┖`
+
+#### 2.3.3 鏅�氭洿鏂版帴鍙i檺鍒�
+
+- **PUT** `/device/repair`
+- 闄愬埗锛氫笉鑳介�氳繃鏅�氭洿鏂扮洿鎺ユ妸鐘舵�佹敼鎴� `瀹岀粨(1)`锛堝繀椤昏蛋楠屾敹瀹℃壒鎺ュ彛锛夈��
+- 澶辫触鎻愮ず锛歚璇峰厛鎻愪氦楠屾敹瀹℃壒锛岄獙鏀堕�氳繃鍚庢墠鍙畬缁揱
+
+---
+
+## 3. 杩斿洖瀛楁鍙樻洿锛堟姤淇垪琛�/璇︽儏锛�
+
+浠ヤ笅鎺ュ彛杩斿洖宸叉柊澧為獙鏀跺瓧娈碉細
+
+- **GET** `/device/repair/page`
+- **GET** `/device/repair/{id}`
+
+鏂板杩斿洖瀛楁锛�
+
+| 瀛楁 | 绫诲瀷 | 璇存槑 |
+|---|---|---|
+| `acceptanceName` | string | 楠屾敹浜� |
+| `acceptanceTime` | string | 楠屾敹鏃堕棿 |
+| `acceptanceRemark` | string | 楠屾敹澶囨敞 |
+
+---
+
+## 4. 鍓嶇鏀归�犲缓璁�
+
+1. 鎶ヤ慨鍒楄〃澧炲姞鐘舵�佸�� `3=寰呴獙鏀禶 鐨勫睍绀烘枃妗堜笌绛涢�夐」銆�
+2. 鈥滅‘璁ょ淮淇�濇寜閽皟鐢� `/device/repair/repair`锛屾垚鍔熷悗鍒锋柊涓哄緟楠屾敹鐘舵�併��
+3. 鏂板鈥滈獙鏀跺鎵光�濆脊绐楋紝蹇呭~锛�
+   - 楠屾敹浜�
+   - 楠屾敹鏃堕棿
+   - 楠屾敹澶囨敞
+4. 绂佹鍦ㄦ櫘閫氱紪杈戦〉鐩存帴灏嗙姸鎬佺疆涓哄畬缁撱��
+5. 璁惧淇濆吇瀹氭椂浠诲姟鏂板鈥滀繚鍏讳汉鈥濊緭鍏ラ」锛屽苟鍦ㄥ垪琛�/璇︽儏灞曠ず銆�
+6. 绉戠洰鎬昏处椤甸潰鎸夊崟琛屽悎璁℃覆鏌擄紝涓嶅啀鏄剧ず鍑瘉瀛楀彿銆佹憳瑕佸垪銆�
+
+---
+
+## 5. 鑱旇皟妫�鏌ユ竻鍗�
+
+1. 绉戠洰鎬昏处鏌ヨ杩斿洖 `data.length === 1`锛屼笖鏃� `voucherNo/summary`銆�
+2. 鏂板淇濆吇瀹氭椂浠诲姟鏃朵紶 `maintenancePerson`锛屽垪琛ㄨ兘鍥炴樉銆�
+3. 瀹氭椂浠诲姟瑙﹀彂鍚庯紝鐢熸垚鐨勪繚鍏昏褰� `maintenanceActuallyName` 涓庡畾鏃朵换鍔′繚鍏讳汉涓�鑷淬��
+4. 鎶ヤ慨鍗曟祦绋嬶細`0寰呯淮淇� -> 3寰呴獙鏀� -> 1瀹岀粨`銆�
+5. 寰呴獙鏀跺崟鎹湭濉獙鏀朵汉/楠屾敹鏃堕棿/楠屾敹澶囨敞鏃讹紝鍚庣杩斿洖瀵瑰簲閿欒鎻愮ず銆�
+6. 灏濊瘯閫氳繃 `PUT /device/repair` 鐩存帴璁句负瀹岀粨鏃讹紝鍚庣杩斿洖鎷︽埅鎻愮ず銆�
+
+---
+
+## 6. 鏁版嵁搴撳彉鏇达紙鑱旇皟鍓嶇‘璁わ級
+
+```sql
+ALTER TABLE maintenance_task
+  ADD COLUMN maintenance_person VARCHAR(100) NULL COMMENT '淇濆吇浜�';
+
+ALTER TABLE device_repair
+  ADD COLUMN acceptance_name VARCHAR(100) NULL COMMENT '楠屾敹浜�',
+  ADD COLUMN acceptance_time DATETIME NULL COMMENT '楠屾敹鏃堕棿',
+  ADD COLUMN acceptance_remark VARCHAR(500) NULL COMMENT '楠屾敹澶囨敞';
+```
+
+> 鑻ユ湭鎵ц浠ヤ笂 SQL锛岀浉鍏虫帴鍙d細鍑虹幇瀛楁涓嶅瓨鍦ㄥ紓甯搞��
+
diff --git a/src/main/java/com/ruoyi/account/bean/dto/financial/FinVoucherDto.java b/src/main/java/com/ruoyi/account/bean/dto/financial/FinVoucherDto.java
index c7c6258..3f90ea2 100644
--- a/src/main/java/com/ruoyi/account/bean/dto/financial/FinVoucherDto.java
+++ b/src/main/java/com/ruoyi/account/bean/dto/financial/FinVoucherDto.java
@@ -1,6 +1,7 @@
 package com.ruoyi.account.bean.dto.financial;
 
 import com.ruoyi.account.pojo.financial.FinVoucher;
+import com.ruoyi.basic.dto.StorageBlobDTO;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
@@ -17,4 +18,6 @@
      * 鍑瘉鏄庣粏鍒嗗綍銆�
      */
     private List<FinVoucherEntryDto> entries;
+
+    private List<StorageBlobDTO> storageBlobDTOs;
 }
diff --git a/src/main/java/com/ruoyi/account/bean/vo/financial/FinLedgerRowVo.java b/src/main/java/com/ruoyi/account/bean/vo/financial/FinLedgerRowVo.java
index d01baf5..da4131f 100644
--- a/src/main/java/com/ruoyi/account/bean/vo/financial/FinLedgerRowVo.java
+++ b/src/main/java/com/ruoyi/account/bean/vo/financial/FinLedgerRowVo.java
@@ -1,5 +1,6 @@
 package com.ruoyi.account.bean.vo.financial;
 
+import com.fasterxml.jackson.annotation.JsonInclude;
 import lombok.Data;
 
 import java.math.BigDecimal;
@@ -9,6 +10,7 @@
  * 绉戠洰璐﹁鏁版嵁杩斿洖瀵硅薄銆�
  */
 @Data
+@JsonInclude(JsonInclude.Include.NON_NULL)
 public class FinLedgerRowVo {
 
     /**
diff --git a/src/main/java/com/ruoyi/account/bean/vo/financial/FinVoucherDetailVo.java b/src/main/java/com/ruoyi/account/bean/vo/financial/FinVoucherDetailVo.java
index d1eab48..4b23545 100644
--- a/src/main/java/com/ruoyi/account/bean/vo/financial/FinVoucherDetailVo.java
+++ b/src/main/java/com/ruoyi/account/bean/vo/financial/FinVoucherDetailVo.java
@@ -2,6 +2,8 @@
 
 import com.ruoyi.account.pojo.financial.FinVoucher;
 import com.ruoyi.account.pojo.financial.FinVoucherEntry;
+import com.ruoyi.basic.dto.StorageBlobDTO;
+import com.ruoyi.basic.dto.StorageBlobVO;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
@@ -18,4 +20,5 @@
      * 鍑瘉鍒嗗綍鍒楄〃銆�
      */
     private List<FinVoucherEntry> entries;
+    private List<StorageBlobVO> storageBlobVOList;
 }
diff --git a/src/main/java/com/ruoyi/account/service/impl/financial/FinLedgerServiceImpl.java b/src/main/java/com/ruoyi/account/service/impl/financial/FinLedgerServiceImpl.java
index a489c67..a36b241 100644
--- a/src/main/java/com/ruoyi/account/service/impl/financial/FinLedgerServiceImpl.java
+++ b/src/main/java/com/ruoyi/account/service/impl/financial/FinLedgerServiceImpl.java
@@ -41,7 +41,7 @@
         if (startMonth.isAfter(endMonth)) {
             throw new ServiceException("寮�濮嬫湀浠戒笉鑳藉ぇ浜庣粨鏉熸湀浠�");
         }
-        return buildLedgerRows(queryDto.getSubjectCode(), startMonth, endMonth, null, null);
+        return Collections.singletonList(buildGeneralLedgerTotalRow(queryDto.getSubjectCode(), startMonth, endMonth));
     }
 
     @Override
@@ -117,6 +117,37 @@
         return rows;
     }
 
+    private FinLedgerRowVo buildGeneralLedgerTotalRow(String subjectCode, YearMonth startMonth, YearMonth endMonth) {
+        LocalDate startDate = startMonth.atDay(1);
+        LocalDate endDate = endMonth.atEndOfMonth();
+
+        List<FinLedgerEntryRecordVo> openingEntries = finVoucherEntryMapper.listPostedEntriesBefore(
+                subjectCode, startDate, null, null
+        );
+        BigDecimal openingBalance = calculateBalance(openingEntries);
+
+        List<FinLedgerEntryRecordVo> currentPeriodEntries = finVoucherEntryMapper.listPostedEntries(
+                subjectCode, startDate, endDate, null, null
+        );
+
+        BigDecimal totalDebit = ZERO;
+        BigDecimal totalCredit = ZERO;
+        for (FinLedgerEntryRecordVo entry : currentPeriodEntries) {
+            totalDebit = totalDebit.add(money(entry.getDebit()));
+            totalCredit = totalCredit.add(money(entry.getCredit()));
+        }
+
+        BigDecimal endingBalance = openingBalance.add(totalDebit).subtract(totalCredit);
+        FinLedgerRowVo totalRow = new FinLedgerRowVo();
+        totalRow.setRowType("yearly_total");
+        totalRow.setDate(endDate);
+        totalRow.setDebit(money(totalDebit));
+        totalRow.setCredit(money(totalCredit));
+        totalRow.setBalance(money(endingBalance));
+        totalRow.setDirection(resolveDirection(endingBalance));
+        return totalRow;
+    }
+
     private Map<YearMonth, List<FinLedgerEntryRecordVo>> groupEntriesByMonth(List<FinLedgerEntryRecordVo> entries) {
         Map<YearMonth, List<FinLedgerEntryRecordVo>> map = new LinkedHashMap<>();
         for (FinLedgerEntryRecordVo entry : entries) {
diff --git a/src/main/java/com/ruoyi/account/service/impl/financial/FinVoucherServiceImpl.java b/src/main/java/com/ruoyi/account/service/impl/financial/FinVoucherServiceImpl.java
index 9e09020..b7548ef 100644
--- a/src/main/java/com/ruoyi/account/service/impl/financial/FinVoucherServiceImpl.java
+++ b/src/main/java/com/ruoyi/account/service/impl/financial/FinVoucherServiceImpl.java
@@ -15,6 +15,9 @@
 import com.ruoyi.account.pojo.financial.FinVoucher;
 import com.ruoyi.account.pojo.financial.FinVoucherEntry;
 import com.ruoyi.account.service.financial.FinVoucherService;
+import com.ruoyi.basic.enums.ApplicationTypeEnum;
+import com.ruoyi.basic.enums.RecordTypeEnum;
+import com.ruoyi.basic.utils.FileUtil;
 import com.ruoyi.common.exception.ServiceException;
 import com.ruoyi.common.utils.StringUtils;
 import lombok.RequiredArgsConstructor;
@@ -38,6 +41,7 @@
 
     private final FinVoucherEntryMapper finVoucherEntryMapper;
     private final AccountSubjectMapper accountSubjectMapper;
+    private final FileUtil fileUtil;
 
     @Override
     public IPage<FinVoucher> pageList(Page<FinVoucher> page, FinVoucherPageDto queryDto) {
@@ -80,6 +84,8 @@
         }
         save(voucher);
         saveEntries(voucher.getId(), validEntries);
+        // 5. 淇濆瓨閿�鍞彴璐﹂檮浠�
+        fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.FIN_VOUCHER, voucher.getId(), dto.getStorageBlobDTOs());
         return true;
     }
 
@@ -113,6 +119,7 @@
         deleteWrapper.eq(FinVoucherEntry::getVoucherId, voucher.getId());
         finVoucherEntryMapper.delete(deleteWrapper);
         saveEntries(voucher.getId(), validEntries);
+        fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.FIN_VOUCHER, voucher.getId(), dto.getStorageBlobDTOs());
         return true;
     }
 
@@ -159,6 +166,7 @@
         FinVoucherDetailVo vo = new FinVoucherDetailVo();
         BeanUtils.copyProperties(voucher, vo);
         vo.setEntries(entries);
+        vo.setStorageBlobVOList(fileUtil.getStorageBlobVOsByRecordTypeAndRecordId(RecordTypeEnum.FIN_VOUCHER, id));
         return vo;
     }
 
diff --git a/src/main/java/com/ruoyi/approve/bean/vo/ApproveProcessVO.java b/src/main/java/com/ruoyi/approve/bean/vo/ApproveProcessVO.java
index 56d420e..8c5db04 100644
--- a/src/main/java/com/ruoyi/approve/bean/vo/ApproveProcessVO.java
+++ b/src/main/java/com/ruoyi/approve/bean/vo/ApproveProcessVO.java
@@ -75,5 +75,5 @@
      */
     private BigDecimal maintenancePrice;
 
-    private List<StorageBlobDTO> storageBlobDTOList;
+    private List<StorageBlobDTO> storageBlobDTOS;
 }
diff --git a/src/main/java/com/ruoyi/approve/service/impl/ApproveNodeServiceImpl.java b/src/main/java/com/ruoyi/approve/service/impl/ApproveNodeServiceImpl.java
index b0046d7..0b1a854 100644
--- a/src/main/java/com/ruoyi/approve/service/impl/ApproveNodeServiceImpl.java
+++ b/src/main/java/com/ruoyi/approve/service/impl/ApproveNodeServiceImpl.java
@@ -220,6 +220,8 @@
                     //鏇存敼鍑哄簱瀹℃牳鐘舵�侊紙寰呯‘璁ゆ敼鎴愬緟瀹℃牳锛�
                     stockUtils.shipmentStatus(StockOutQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode(), shippingInfo.getId());
                 } else if (status.equals(3)) {
+                    //鍒犻櫎鍘熸湰锛堝緟纭锛夌殑鍑哄簱瀹℃牳鐘舵��
+                    stockUtils.deleteStockOutRecord(shippingInfo.getId(), StockOutQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode());
                     shippingInfo.setStatus("瀹℃牳鎷掔粷");
                 } else if (status.equals(1)) {
                     shippingInfo.setStatus("瀹℃牳涓�");
diff --git a/src/main/java/com/ruoyi/approve/service/impl/ApproveProcessServiceImpl.java b/src/main/java/com/ruoyi/approve/service/impl/ApproveProcessServiceImpl.java
index bf2cdb2..c9d7aae 100644
--- a/src/main/java/com/ruoyi/approve/service/impl/ApproveProcessServiceImpl.java
+++ b/src/main/java/com/ruoyi/approve/service/impl/ApproveProcessServiceImpl.java
@@ -138,7 +138,7 @@
                 .collect(Collectors.joining(","));
         approveNodeService.initApproveNodes(nodeIdStr, no, approveProcessVO.getApproveDeptId());
         // 闄勪欢缁戝畾
-        fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.APPROVE_PROCESS, approveProcess.getId(), approveProcessVO.getStorageBlobDTOList());
+        fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.APPROVE_PROCESS, approveProcess.getId(), approveProcessVO.getStorageBlobDTOS());
         /*娑堟伅閫氱煡*/
         Long id = nodeIds.getFirst();
         if (approveProcess.getApproveType() == 8) {
diff --git a/src/main/java/com/ruoyi/basic/enums/RecordTypeEnum.java b/src/main/java/com/ruoyi/basic/enums/RecordTypeEnum.java
index 9c63efb..ef7e57c 100644
--- a/src/main/java/com/ruoyi/basic/enums/RecordTypeEnum.java
+++ b/src/main/java/com/ruoyi/basic/enums/RecordTypeEnum.java
@@ -204,6 +204,7 @@
     SALES_REFUND_AMOUNT_ORDER("sales_refund_amount_order"),
     SALES_RECEIPT_RETURN("sales_receipt_return"),
     ACCOUNT_EXPENSE("account_expense"),
+    FIN_VOUCHER("fin_voucher"),
     ACCOUNT_FILE("account_file");
 
     private final String type;
diff --git a/src/main/java/com/ruoyi/collaborativeApproval/controller/SealApplicationManagementController.java b/src/main/java/com/ruoyi/collaborativeApproval/controller/SealApplicationManagementController.java
index 6a3824d..dc6a64e 100644
--- a/src/main/java/com/ruoyi/collaborativeApproval/controller/SealApplicationManagementController.java
+++ b/src/main/java/com/ruoyi/collaborativeApproval/controller/SealApplicationManagementController.java
@@ -2,6 +2,10 @@
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ruoyi.approve.pojo.KnowledgeBase;
+import com.ruoyi.basic.enums.ApplicationTypeEnum;
+import com.ruoyi.basic.enums.RecordTypeEnum;
+import com.ruoyi.basic.utils.FileUtil;
+import com.ruoyi.collaborativeApproval.dto.SealApplicationManagementDTO;
 import com.ruoyi.collaborativeApproval.pojo.SealApplicationManagement;
 import com.ruoyi.collaborativeApproval.service.SealApplicationManagementService;
 import com.ruoyi.common.utils.SecurityUtils;
@@ -27,6 +31,7 @@
 public class SealApplicationManagementController {
     private SealApplicationManagementService sealApplicationManagementService;
     private ISysNoticeService sysNoticeService;
+    private FileUtil fileUtil;
 
     @GetMapping("/getList")
     @Operation(summary = "鍒嗛〉鏌ヨ")
@@ -36,8 +41,13 @@
 
     @PostMapping("/add")
     @Operation(summary = "鏂板")
-    public AjaxResult add(@RequestBody SealApplicationManagement sealApplicationManagement){
+    public AjaxResult add(@RequestBody SealApplicationManagementDTO sealApplicationManagement){
         sealApplicationManagementService.save(sealApplicationManagement);
+        // 5. 淇濆瓨閿�鍞彴璐﹂檮浠�
+        fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE,
+                RecordTypeEnum.SEAL_APPLICATION_MANAGEMENT,
+                sealApplicationManagement.getId(),
+                sealApplicationManagement.getStorageBlobDTOs());
         //娑堟伅閫氱煡
         sysNoticeService.simpleNoticeByUser("鐢ㄥ嵃瀹℃壒",
                 "鐢宠缂栧彿锛�"+sealApplicationManagement.getApplicationNum()+"\t"
@@ -49,7 +59,12 @@
 
     @PostMapping("/update")
     @Operation(summary = "淇敼")
-    public AjaxResult update(@RequestBody SealApplicationManagement sealApplicationManagement){
+    public AjaxResult update(@RequestBody SealApplicationManagementDTO sealApplicationManagement){
+        // 5. 淇濆瓨閿�鍞彴璐﹂檮浠�
+        fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE,
+                RecordTypeEnum.SEAL_APPLICATION_MANAGEMENT,
+                sealApplicationManagement.getId(),
+                sealApplicationManagement.getStorageBlobDTOs());
         return AjaxResult.success(sealApplicationManagementService.updateById(sealApplicationManagement));
     }
 
@@ -59,6 +74,9 @@
         if (CollectionUtils.isEmpty(ids)) {
             throw new RuntimeException("璇蜂紶鍏ヨ鍒犻櫎鐨処D");
         }
+        fileUtil.deleteStorageAttachmentsByApplicationAndRecordTypeAndRecordIds(ApplicationTypeEnum.FILE,
+                RecordTypeEnum.SEAL_APPLICATION_MANAGEMENT,
+                ids);
         return AjaxResult.success(sealApplicationManagementService.removeBatchByIds(ids));
     }
 
diff --git a/src/main/java/com/ruoyi/collaborativeApproval/dto/SealApplicationManagementDTO.java b/src/main/java/com/ruoyi/collaborativeApproval/dto/SealApplicationManagementDTO.java
index 8dc8454..7757490 100644
--- a/src/main/java/com/ruoyi/collaborativeApproval/dto/SealApplicationManagementDTO.java
+++ b/src/main/java/com/ruoyi/collaborativeApproval/dto/SealApplicationManagementDTO.java
@@ -1,7 +1,11 @@
 package com.ruoyi.collaborativeApproval.dto;
 
+import com.ruoyi.basic.dto.StorageBlobDTO;
+import com.ruoyi.basic.dto.StorageBlobVO;
 import com.ruoyi.collaborativeApproval.pojo.SealApplicationManagement;
 import lombok.Data;
+
+import java.util.List;
 
 @Data
 public class SealApplicationManagementDTO extends SealApplicationManagement {
@@ -11,4 +15,8 @@
 
     //瀹℃壒浜�
     private String approveUserName;
+
+    private List<StorageBlobDTO> storageBlobDTOs;
+    private List<StorageBlobVO> storageBlobVOList;
+
 }
diff --git a/src/main/java/com/ruoyi/collaborativeApproval/service/impl/SealApplicationManagementServiceImpl.java b/src/main/java/com/ruoyi/collaborativeApproval/service/impl/SealApplicationManagementServiceImpl.java
index d63f2d2..ba20ae2 100644
--- a/src/main/java/com/ruoyi/collaborativeApproval/service/impl/SealApplicationManagementServiceImpl.java
+++ b/src/main/java/com/ruoyi/collaborativeApproval/service/impl/SealApplicationManagementServiceImpl.java
@@ -3,6 +3,8 @@
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.basic.enums.RecordTypeEnum;
+import com.ruoyi.basic.utils.FileUtil;
 import com.ruoyi.collaborativeApproval.dto.SealApplicationManagementDTO;
 import com.ruoyi.collaborativeApproval.mapper.SealApplicationManagementMapper;
 import com.ruoyi.collaborativeApproval.pojo.SealApplicationManagement;
@@ -14,9 +16,14 @@
 @RequiredArgsConstructor
 public class SealApplicationManagementServiceImpl extends ServiceImpl<SealApplicationManagementMapper, SealApplicationManagement> implements SealApplicationManagementService {
     private final SealApplicationManagementMapper sealApplicationManagementMapper;
+    private final FileUtil fileUtil;
 
     @Override
     public IPage<SealApplicationManagementDTO> listPage(Page page, SealApplicationManagement sealApplicationManagement) {
-        return sealApplicationManagementMapper.listPage(page, sealApplicationManagement);
+        IPage<SealApplicationManagementDTO> sealApplicationManagementDTOIPage = sealApplicationManagementMapper.listPage(page, sealApplicationManagement);
+        sealApplicationManagementDTOIPage.getRecords().forEach(item -> {
+            item.setStorageBlobVOList(fileUtil.getStorageBlobVOsByRecordTypeAndRecordId(RecordTypeEnum.SEAL_APPLICATION_MANAGEMENT, item.getId()));
+        });
+        return sealApplicationManagementDTOIPage;
     }
 }
diff --git a/src/main/java/com/ruoyi/device/controller/DeviceRepairController.java b/src/main/java/com/ruoyi/device/controller/DeviceRepairController.java
index d3c19bb..7df7c26 100644
--- a/src/main/java/com/ruoyi/device/controller/DeviceRepairController.java
+++ b/src/main/java/com/ruoyi/device/controller/DeviceRepairController.java
@@ -46,10 +46,16 @@
         return deviceRepairService.updateDeviceRepair(deviceRepairDto);
     }
 
-    @PostMapping ("repair")
+    @PostMapping ("/repair")
     @Operation(summary = "璁惧缁翠慨")
     public AjaxResult repair( @RequestBody DeviceRepairDto deviceRepairDto) {
-        return deviceRepairService.updateDeviceRepair(deviceRepairDto);
+        return deviceRepairService.confirmRepair(deviceRepairDto);
+    }
+
+    @PostMapping ("/acceptance")
+    @Operation(summary = "璁惧鎶ヤ慨楠屾敹瀹℃壒")
+    public AjaxResult acceptance(@RequestBody DeviceRepairDto deviceRepairDto) {
+        return deviceRepairService.approveRepairAcceptance(deviceRepairDto);
     }
 
     @DeleteMapping("/{ids}")
diff --git a/src/main/java/com/ruoyi/device/execl/DeviceRepairExeclDto.java b/src/main/java/com/ruoyi/device/execl/DeviceRepairExeclDto.java
index c782da2..caf5c1a 100644
--- a/src/main/java/com/ruoyi/device/execl/DeviceRepairExeclDto.java
+++ b/src/main/java/com/ruoyi/device/execl/DeviceRepairExeclDto.java
@@ -47,6 +47,18 @@
     @Excel(name = "缁翠慨缁撴灉")
     private String maintenanceResult;
 
+    @Schema(description = "楠屾敹浜�")
+    @Excel(name = "楠屾敹浜�")
+    private String acceptanceName;
+
+    @Schema(description = "楠屾敹鏃堕棿")
+    @Excel(name = "楠屾敹鏃堕棿", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+    private LocalDateTime acceptanceTime;
+
+    @Schema(description = "楠屾敹澶囨敞")
+    @Excel(name = "楠屾敹澶囨敞")
+    private String acceptanceRemark;
+
     @Schema(description = "鐘舵��")
     @Excel(name = "鐘舵��")
     private String statusStr;
diff --git a/src/main/java/com/ruoyi/device/pojo/DeviceRepair.java b/src/main/java/com/ruoyi/device/pojo/DeviceRepair.java
index 9db134e..c9efa55 100644
--- a/src/main/java/com/ruoyi/device/pojo/DeviceRepair.java
+++ b/src/main/java/com/ruoyi/device/pojo/DeviceRepair.java
@@ -50,7 +50,19 @@
     @Schema(description = "缁翠慨缁撴灉")
     private String maintenanceResult;
 
+    @Schema(description = "楠屾敹浜�")
+    private String acceptanceName;
+
+    @Schema(description = "楠屾敹鏃堕棿")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private LocalDateTime acceptanceTime;
+
+    @Schema(description = "楠屾敹澶囨敞")
+    private String acceptanceRemark;
+
     @Schema(description = "鐘舵�� 0 寰呯淮淇� 1瀹岀粨 2 澶辫触")
+    // 0:寰呯淮淇� 1:瀹岀粨 2:澶辫触 3:寰呴獙鏀�
     private Integer status;
 
     @Schema(description = "鍒涘缓鏃堕棿")
diff --git a/src/main/java/com/ruoyi/device/pojo/MaintenanceTask.java b/src/main/java/com/ruoyi/device/pojo/MaintenanceTask.java
index 2e35584..350a09d 100644
--- a/src/main/java/com/ruoyi/device/pojo/MaintenanceTask.java
+++ b/src/main/java/com/ruoyi/device/pojo/MaintenanceTask.java
@@ -44,6 +44,10 @@
     @Schema(description = "璁惧id")
     private Long taskId;
 
+    @Schema(description = "淇濆吇浜�")
+    @Excel(name = "淇濆吇浜�")
+    private String maintenancePerson;
+
     @Schema(description = "棰戞")
     @Excel(name = "棰戞")
     private String frequencyType;
diff --git a/src/main/java/com/ruoyi/device/service/IDeviceRepairService.java b/src/main/java/com/ruoyi/device/service/IDeviceRepairService.java
index 8d20acd..ae0b913 100644
--- a/src/main/java/com/ruoyi/device/service/IDeviceRepairService.java
+++ b/src/main/java/com/ruoyi/device/service/IDeviceRepairService.java
@@ -19,6 +19,10 @@
 
     AjaxResult updateDeviceRepair(DeviceRepairDto deviceRepairDto);
 
+    AjaxResult confirmRepair(DeviceRepairDto deviceRepairDto);
+
+    AjaxResult approveRepairAcceptance(DeviceRepairDto deviceRepairDto);
+
     void export(HttpServletResponse response, Long[] ids);
 
     DeviceRepairVo detailById(Long id);
diff --git a/src/main/java/com/ruoyi/device/service/impl/DeviceRepairServiceImpl.java b/src/main/java/com/ruoyi/device/service/impl/DeviceRepairServiceImpl.java
index e3ebb0e..e5a73ac 100644
--- a/src/main/java/com/ruoyi/device/service/impl/DeviceRepairServiceImpl.java
+++ b/src/main/java/com/ruoyi/device/service/impl/DeviceRepairServiceImpl.java
@@ -47,6 +47,11 @@
     private final SparePartsRequisitionRecordService sparePartsRequisitionRecordService;
     private final FileUtil fileUtil;
 
+    private static final int STATUS_PENDING_REPAIR = 0;
+    private static final int STATUS_COMPLETED = 1;
+    private static final int STATUS_FAILED = 2;
+    private static final int STATUS_PENDING_ACCEPTANCE = 3;
+
     @Override
     public IPage<DeviceRepairVo> queryPage(Page page, DeviceRepairDto deviceRepairDto) {
         IPage<DeviceRepairVo> pageDto = deviceRepairMapper.queryPage(page, deviceRepairDto);
@@ -62,6 +67,9 @@
         DeviceLedger byId = deviceLedgerService.getById(deviceRepairDto.getDeviceLedgerId());
         deviceRepairDto.setDeviceName(byId.getDeviceName());
         deviceRepairDto.setDeviceModel(byId.getDeviceModel());
+        if (deviceRepairDto.getStatus() == null) {
+            deviceRepairDto.setStatus(STATUS_PENDING_REPAIR);
+        }
         boolean save = this.save(deviceRepairDto);
         if (save) {
             // 澶勭悊鍥剧墖涓婁紶
@@ -75,6 +83,15 @@
     @Transactional(rollbackFor = Exception.class)
     public AjaxResult updateDeviceRepair(DeviceRepairDto deviceRepairDto) {
         DeviceRepair oldDeviceRepair = this.getById(deviceRepairDto.getId());
+        if (oldDeviceRepair == null) {
+            return AjaxResult.error("鎶ヤ慨璁板綍涓嶅瓨鍦�");
+        }
+        if (deviceRepairDto.getStatus() != null
+                && deviceRepairDto.getStatus() == STATUS_COMPLETED
+                && (oldDeviceRepair.getStatus() == null
+                || oldDeviceRepair.getStatus() != STATUS_COMPLETED)) {
+            return AjaxResult.error("璇峰厛鎻愪氦楠屾敹瀹℃壒锛岄獙鏀堕�氳繃鍚庢墠鍙畬缁�");
+        }
         // 澶勭悊澶囦欢浣跨敤鎯呭喌
         if (CollectionUtils.isNotEmpty(deviceRepairDto.getSparePartsUseList())) {
             List<Long> sparePartIds = new ArrayList<>();
@@ -131,6 +148,58 @@
     }
 
     @Override
+    @Transactional(rollbackFor = Exception.class)
+    public AjaxResult confirmRepair(DeviceRepairDto deviceRepairDto) {
+        DeviceRepair oldDeviceRepair = this.getById(deviceRepairDto.getId());
+        if (oldDeviceRepair == null) {
+            return AjaxResult.error("鎶ヤ慨璁板綍涓嶅瓨鍦�");
+        }
+        if (oldDeviceRepair.getStatus() != null && oldDeviceRepair.getStatus() == STATUS_COMPLETED) {
+            return AjaxResult.error("璇ユ姤淇凡瀹岀粨锛屼笉鑳介噸澶嶇‘璁ょ淮淇�");
+        }
+        if (oldDeviceRepair.getStatus() != null && oldDeviceRepair.getStatus() == STATUS_PENDING_ACCEPTANCE) {
+            return AjaxResult.error("璇ユ姤淇凡鎻愪氦楠屾敹瀹℃壒");
+        }
+        deviceRepairDto.setStatus(STATUS_PENDING_ACCEPTANCE);
+        return updateDeviceRepair(deviceRepairDto);
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public AjaxResult approveRepairAcceptance(DeviceRepairDto deviceRepairDto) {
+        if (deviceRepairDto.getId() == null) {
+            return AjaxResult.error("鎶ヤ慨璁板綍id涓嶈兘涓虹┖");
+        }
+        DeviceRepair oldDeviceRepair = this.getById(deviceRepairDto.getId());
+        if (oldDeviceRepair == null) {
+            return AjaxResult.error("鎶ヤ慨璁板綍涓嶅瓨鍦�");
+        }
+        if (oldDeviceRepair.getStatus() == null || oldDeviceRepair.getStatus() != STATUS_PENDING_ACCEPTANCE) {
+            return AjaxResult.error("璇ユ姤淇湭杩涘叆寰呴獙鏀剁姸鎬侊紝涓嶈兘瀹℃壒");
+        }
+        if (StringUtils.isBlank(deviceRepairDto.getAcceptanceName())) {
+            return AjaxResult.error("楠屾敹浜轰笉鑳戒负绌�");
+        }
+        if (deviceRepairDto.getAcceptanceTime() == null) {
+            return AjaxResult.error("楠屾敹鏃堕棿涓嶈兘涓虹┖");
+        }
+        if (StringUtils.isBlank(deviceRepairDto.getAcceptanceRemark())) {
+            return AjaxResult.error("楠屾敹澶囨敞涓嶈兘涓虹┖");
+        }
+
+        DeviceRepair update = new DeviceRepair();
+        update.setId(deviceRepairDto.getId());
+        update.setAcceptanceName(deviceRepairDto.getAcceptanceName());
+        update.setAcceptanceTime(deviceRepairDto.getAcceptanceTime());
+        update.setAcceptanceRemark(deviceRepairDto.getAcceptanceRemark());
+        update.setStatus(STATUS_COMPLETED);
+        if (this.updateById(update)) {
+            return AjaxResult.success();
+        }
+        return AjaxResult.error("楠屾敹瀹℃壒澶辫触");
+    }
+
+    @Override
     public void export(HttpServletResponse response, Long[] ids) {
         if (ids == null || ids.length == 0) {
             List<DeviceRepair> supplierManageList = this.list();
@@ -138,24 +207,19 @@
             supplierManageList.stream().forEach(deviceRepair -> {
                 DeviceRepairExeclDto deviceRepairExeclDto = new DeviceRepairExeclDto();
                 BeanUtils.copyProperties(deviceRepair,deviceRepairExeclDto);
-                deviceRepairExeclDto.setStatusStr(deviceRepair.getStatus() == 0 ? "寰呯淮淇�" : deviceRepair.getStatus() == 1 ? "瀹岀粨" : "澶辫触");
-
+                deviceRepairExeclDto.setStatusStr(resolveStatusText(deviceRepair.getStatus()));
                 deviceLedgerExeclDtos.add(deviceRepairExeclDto);
             });
             ExcelUtil<DeviceRepairExeclDto> util = new ExcelUtil<DeviceRepairExeclDto>(DeviceRepairExeclDto.class);
             util.exportExcel(response, deviceLedgerExeclDtos, "璁惧鎶ヤ慨瀵煎嚭");
         }else {
-            ArrayList<Long> arrayList = new ArrayList<>();
-            Arrays.stream(ids).map(id -> {
-                return arrayList.add( id);
-            });
+            ArrayList<Long> arrayList = new ArrayList<>(Arrays.asList(ids));
             List<DeviceRepair> supplierManageList = deviceRepairMapper.selectBatchIds(arrayList);
             ArrayList<DeviceRepairExeclDto> deviceLedgerExeclDtos = new ArrayList<>();
             supplierManageList.stream().forEach(deviceRepair -> {
                 DeviceRepairExeclDto deviceRepairExeclDto = new DeviceRepairExeclDto();
                 BeanUtils.copyProperties(deviceRepair,deviceRepairExeclDto);
-                deviceRepairExeclDto.setStatusStr(deviceRepair.getStatus() == 0 ? "寰呯淮淇�" : deviceRepair.getStatus() == 1 ? "瀹岀粨" : "澶辫触");
-
+                deviceRepairExeclDto.setStatusStr(resolveStatusText(deviceRepair.getStatus()));
                 deviceLedgerExeclDtos.add(deviceRepairExeclDto);
             });
             ExcelUtil<DeviceRepairExeclDto> util = new ExcelUtil<DeviceRepairExeclDto>(DeviceRepairExeclDto.class);
@@ -164,6 +228,25 @@
 
     }
 
+    private String resolveStatusText(Integer status) {
+        if (status == null) {
+            return "";
+        }
+        if (status == STATUS_PENDING_REPAIR) {
+            return "寰呯淮淇�";
+        }
+        if (status == STATUS_COMPLETED) {
+            return "瀹岀粨";
+        }
+        if (status == STATUS_FAILED) {
+            return "澶辫触";
+        }
+        if (status == STATUS_PENDING_ACCEPTANCE) {
+            return "寰呴獙鏀�";
+        }
+        return "鏈煡";
+    }
+
     @Override
     public DeviceRepairVo detailById(Long id) {
         DeviceRepairVo vo = deviceRepairMapper.detailById(id);
diff --git a/src/main/java/com/ruoyi/device/service/impl/MaintenanceTaskJob.java b/src/main/java/com/ruoyi/device/service/impl/MaintenanceTaskJob.java
index 09d5d77..204667b 100644
--- a/src/main/java/com/ruoyi/device/service/impl/MaintenanceTaskJob.java
+++ b/src/main/java/com/ruoyi/device/service/impl/MaintenanceTaskJob.java
@@ -93,6 +93,7 @@
         inspectionTask.setMaintenanceTaskId(timingTask.getId());
         inspectionTask.setDeviceLedgerId(timingTask.getTaskId());
         inspectionTask.setMaintenancePlanTime(LocalDateTime.now());
+        inspectionTask.setMaintenanceActuallyName(timingTask.getMaintenancePerson());
         inspectionTask.setFrequencyType(timingTask.getFrequencyType());
         inspectionTask.setFrequencyDetail(timingTask.getFrequencyDetail());
         inspectionTask.setTenantId(timingTask.getTenantId());
diff --git a/src/main/java/com/ruoyi/framework/security/LoginUser.java b/src/main/java/com/ruoyi/framework/security/LoginUser.java
index 330ae43..aad84a9 100644
--- a/src/main/java/com/ruoyi/framework/security/LoginUser.java
+++ b/src/main/java/com/ruoyi/framework/security/LoginUser.java
@@ -301,7 +301,10 @@
     public void setUser(SysUser user)
     {
         this.user = user;
-        this.aiEnabled = user == null ? null : user.getAiEnabled();
+        if (user != null && user.getAiEnabled() != null)
+        {
+            this.aiEnabled = user.getAiEnabled();
+        }
     }
 
     @Override
diff --git a/src/main/java/com/ruoyi/inspectiontask/pojo/InspectionTask.java b/src/main/java/com/ruoyi/inspectiontask/pojo/InspectionTask.java
index c41d626..4e7efad 100644
--- a/src/main/java/com/ruoyi/inspectiontask/pojo/InspectionTask.java
+++ b/src/main/java/com/ruoyi/inspectiontask/pojo/InspectionTask.java
@@ -30,6 +30,10 @@
     @Excel(name = "宸℃浠诲姟鍚嶇О")
     private String taskName;
 
+    @Schema(description = "宸℃椤圭洰")
+    @Excel(name = "宸℃椤圭洰")
+    private String inspectionProject;
+
     @Schema(description = "璁惧id")
     private Integer taskId;
 
@@ -44,6 +48,22 @@
     @Excel(name = "澶囨敞")
     private String remarks;
 
+    @Schema(description = "宸℃缁撴灉 0 寮傚父 1 姝e父")
+    private String inspectionResult;
+
+    @Schema(description = "寮傚父鎻忚堪")
+    private String abnormalDescription;
+
+    @Schema(description = "鍏宠仈缁翠慨鍗旾D")
+    private Long deviceRepairId;
+
+    @Schema(description = "楠屾敹浜篒D")
+    private Long acceptanceUserId;
+
+    @Schema(description = "楠屾敹浜�")
+    @Excel(name = "楠屾敹浜�")
+    private String acceptanceName;
+
     @Schema(description = "浠诲姟鐧昏浜篒D")
     private Long registrantId;
 
diff --git a/src/main/java/com/ruoyi/inspectiontask/pojo/TimingTask.java b/src/main/java/com/ruoyi/inspectiontask/pojo/TimingTask.java
index 2d8722e..43a3edc 100644
--- a/src/main/java/com/ruoyi/inspectiontask/pojo/TimingTask.java
+++ b/src/main/java/com/ruoyi/inspectiontask/pojo/TimingTask.java
@@ -33,6 +33,10 @@
     @Excel(name = "宸℃浠诲姟鍚嶇О")
     private String taskName;
 
+    @Schema(description = "宸℃椤圭洰")
+    @Excel(name = "宸℃椤圭洰")
+    private String inspectionProject;
+
     @Schema(description = "璁惧id")
     private Integer taskId;
 
@@ -60,6 +64,10 @@
     @Schema(description = "鏄惁婵�娲�")
     private boolean isActive;
 
+    @Schema(description = "鏄惁鍚敤 0鍚� 1鏄�")
+    @Excel(name = "鏄惁鍚敤", readConverterExp = "0=鍚�,1=鏄�")
+    private Integer isEnabled;
+
     @Schema(description = "澶囨敞")
     @Excel(name = "澶囨敞")
     private String remarks;
diff --git a/src/main/java/com/ruoyi/inspectiontask/service/impl/InspectionTaskServiceImpl.java b/src/main/java/com/ruoyi/inspectiontask/service/impl/InspectionTaskServiceImpl.java
index 410336e..5826fa7 100644
--- a/src/main/java/com/ruoyi/inspectiontask/service/impl/InspectionTaskServiceImpl.java
+++ b/src/main/java/com/ruoyi/inspectiontask/service/impl/InspectionTaskServiceImpl.java
@@ -5,12 +5,17 @@
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.basic.dto.StorageBlobDTO;
 import com.ruoyi.basic.enums.ApplicationTypeEnum;
 import com.ruoyi.basic.enums.RecordTypeEnum;
 import com.ruoyi.basic.utils.FileUtil;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.bean.BeanUtils;
+import com.ruoyi.device.mapper.DeviceLedgerMapper;
+import com.ruoyi.device.mapper.DeviceRepairMapper;
+import com.ruoyi.device.pojo.DeviceLedger;
+import com.ruoyi.device.pojo.DeviceRepair;
 import com.ruoyi.inspectiontask.dto.InspectionTaskDto;
 import com.ruoyi.inspectiontask.mapper.InspectionTaskMapper;
 import com.ruoyi.inspectiontask.pojo.InspectionTask;
@@ -23,6 +28,7 @@
 import org.springframework.transaction.annotation.Transactional;
 
 import java.time.format.DateTimeFormatter;
+import java.util.Date;
 import java.util.*;
 import java.util.function.Function;
 import java.util.stream.Collectors;
@@ -43,6 +49,14 @@
 
     private final FileUtil fileUtil;
 
+    private final DeviceRepairMapper deviceRepairMapper;
+
+    private final DeviceLedgerMapper deviceLedgerMapper;
+
+    private static final String INSPECTION_RESULT_ABNORMAL = "0";
+    private static final String INSPECTION_RESULT_NORMAL = "1";
+    private static final int REPAIR_STATUS_PENDING = 0;
+
     @Override
     public IPage<InspectionTaskDto> selectInspectionTaskList(Page<InspectionTask> page, InspectionTaskDto inspectionTaskDto) {
         LambdaQueryWrapper<InspectionTask> queryWrapper = new LambdaQueryWrapper<>();
@@ -50,14 +64,15 @@
         if (StringUtils.isNotBlank(inspectionTaskDto.getTaskName())) {
             queryWrapper.like(InspectionTask::getTaskName, inspectionTaskDto.getTaskName());
         }
+        if (StringUtils.isNotBlank(inspectionTaskDto.getInspectionProject())) {
+            queryWrapper.like(InspectionTask::getInspectionProject, inspectionTaskDto.getInspectionProject());
+        }
         IPage<InspectionTask> entityPage = inspectionTaskMapper.selectPage(page, queryWrapper);
 
         //  鏃犳暟鎹彁鍓嶈繑鍥�
         if (CollectionUtils.isEmpty(entityPage.getRecords())) {
             return new Page<>(entityPage.getCurrent(), entityPage.getSize(), entityPage.getTotal());
         }
-        // 鑾峰彇id闆嗗悎
-        List<Long> ids = entityPage.getRecords().stream().map(InspectionTask::getId).collect(Collectors.toList());
         //鐧昏浜篿ds
         List<Long> registrantIds = entityPage.getRecords().stream().map(InspectionTask::getRegistrantId).collect(Collectors.toList());
         // 鎵归噺鏌ヨ鐧昏浜�
@@ -68,9 +83,6 @@
         } else {
             sysUserMap = new HashMap<>();
         }
-        //宸℃浜篿ds
-        List<String> inspectorIds = entityPage.getRecords().stream().map(InspectionTask::getInspectorId).collect(Collectors.toList());
-
         //鑾峰彇鎵�鏈変笉閲嶅鐨勭敤鎴稩D
         Set<Long> allUserIds = entityPage.getRecords().stream()
                 .map(InspectionTask::getInspectorId) // 鑾峰彇"2,3"杩欐牱鐨勫瓧绗︿覆
@@ -140,24 +152,230 @@
     @Override
     @Transactional(rollbackFor = Exception.class)
     public int addOrEditInspectionTask(InspectionTaskDto inspectionTaskDto) {
+        InspectionTask oldInspectionTask = null;
+        if (Objects.nonNull(inspectionTaskDto.getId())) {
+            oldInspectionTask = inspectionTaskMapper.selectById(inspectionTaskDto.getId());
+            if (oldInspectionTask == null) {
+                throw new IllegalArgumentException("宸℃浠诲姟涓嶅瓨鍦�");
+            }
+        }
+        validateInspectionInput(inspectionTaskDto, oldInspectionTask);
+
         InspectionTask inspectionTask = new InspectionTask();
         BeanUtils.copyProperties(inspectionTaskDto, inspectionTask);
         inspectionTask.setRegistrantId(SecurityUtils.getLoginUser().getUserId());
         inspectionTask.setRegistrant(SecurityUtils.getLoginUser().getUsername());
+        fillAcceptanceInfo(inspectionTask, oldInspectionTask);
         int i;
         if (Objects.isNull(inspectionTaskDto.getId())) {
             i = inspectionTaskMapper.insert(inspectionTask);
         } else {
             i = inspectionTaskMapper.updateById(inspectionTask);
         }
-        // 淇濆瓨鏂囦欢
-        fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.INSPECTION_TASK, inspectionTask.getId(), inspectionTaskDto.getCommonFileListDTO());
-        fileUtil.saveStorageAttachment(ApplicationTypeEnum.AFTER_FILE, RecordTypeEnum.INSPECTION_TASK, inspectionTask.getId(), inspectionTaskDto.getCommonFileListAfterDTO());
-        fileUtil.saveStorageAttachment(ApplicationTypeEnum.BEFORE_FILE, RecordTypeEnum.INSPECTION_TASK, inspectionTask.getId(), inspectionTaskDto.getCommonFileListBeforeDTO());
+        if (i <= 0) {
+            return i;
+        }
+        Long linkedRepairId = syncRepairOrderIfAbnormal(inspectionTask, oldInspectionTask);
+        if (linkedRepairId != null && !Objects.equals(linkedRepairId, inspectionTask.getDeviceRepairId())) {
+            InspectionTask relationUpdate = new InspectionTask();
+            relationUpdate.setId(inspectionTask.getId());
+            relationUpdate.setDeviceRepairId(linkedRepairId);
+            inspectionTaskMapper.updateById(relationUpdate);
+            inspectionTask.setDeviceRepairId(linkedRepairId);
+        }
+        // 淇濆瓨鏂囦欢锛堝瓧娈典笉浼犲垯淇濈暀鍘嗗彶锛�
+        saveInspectionAttachments(inspectionTask.getId(), inspectionTaskDto);
 
         return i;
     }
 
+    private void validateInspectionInput(InspectionTaskDto inspectionTaskDto, InspectionTask oldInspectionTask) {
+        String inspectionResult = inspectionTaskDto.getInspectionResult();
+        if (StringUtils.isBlank(inspectionResult) && oldInspectionTask != null) {
+            inspectionResult = oldInspectionTask.getInspectionResult();
+        }
+        if (StringUtils.isBlank(inspectionResult)) {
+            throw new IllegalArgumentException("璇烽�夋嫨宸℃缁撴灉");
+        }
+        if (!INSPECTION_RESULT_ABNORMAL.equals(inspectionResult) && !INSPECTION_RESULT_NORMAL.equals(inspectionResult)) {
+            throw new IllegalArgumentException("宸℃缁撴灉浠呮敮鎸侊細0-寮傚父锛�1-姝e父");
+        }
+        inspectionTaskDto.setInspectionResult(inspectionResult);
+
+        if (!INSPECTION_RESULT_ABNORMAL.equals(inspectionResult)) {
+            return;
+        }
+
+        String abnormalDescription = inspectionTaskDto.getAbnormalDescription();
+        if (StringUtils.isBlank(abnormalDescription) && oldInspectionTask != null) {
+            abnormalDescription = oldInspectionTask.getAbnormalDescription();
+        }
+        if (StringUtils.isBlank(abnormalDescription)) {
+            throw new IllegalArgumentException("宸℃缁撴灉涓哄紓甯告椂锛屽紓甯告弿杩颁笉鑳戒负绌�");
+        }
+        inspectionTaskDto.setAbnormalDescription(abnormalDescription);
+
+        if (!hasAnyInspectionPhotoAfterSave(inspectionTaskDto, oldInspectionTask)) {
+            throw new IllegalArgumentException("宸℃缁撴灉涓哄紓甯告椂锛屽繀椤讳笂浼犺嚦灏戜竴寮犵収鐗�");
+        }
+    }
+
+    private boolean hasAnyInspectionPhotoAfterSave(InspectionTaskDto inspectionTaskDto, InspectionTask oldInspectionTask) {
+        Long recordId = oldInspectionTask == null ? null : oldInspectionTask.getId();
+        return hasApplicationPhotoAfterSave(inspectionTaskDto.getCommonFileListDTO(), ApplicationTypeEnum.FILE, recordId)
+                || hasApplicationPhotoAfterSave(inspectionTaskDto.getCommonFileListAfterDTO(), ApplicationTypeEnum.AFTER_FILE, recordId)
+                || hasApplicationPhotoAfterSave(inspectionTaskDto.getCommonFileListBeforeDTO(), ApplicationTypeEnum.BEFORE_FILE, recordId);
+    }
+
+    private boolean hasApplicationPhotoAfterSave(List<StorageBlobDTO> requestPhotos, ApplicationTypeEnum applicationType, Long recordId) {
+        if (requestPhotos != null) {
+            return !requestPhotos.isEmpty();
+        }
+        if (recordId == null) {
+            return false;
+        }
+        return CollectionUtils.isNotEmpty(fileUtil.getStorageAttachmentsByApplicationAndRecordTypeAndRecordId(applicationType, RecordTypeEnum.INSPECTION_TASK, recordId));
+    }
+
+    private void fillAcceptanceInfo(InspectionTask inspectionTask, InspectionTask oldInspectionTask) {
+        Long acceptanceUserId = inspectionTask.getAcceptanceUserId();
+        if (acceptanceUserId == null && oldInspectionTask != null) {
+            acceptanceUserId = oldInspectionTask.getAcceptanceUserId();
+        }
+        if (acceptanceUserId != null) {
+            inspectionTask.setAcceptanceUserId(acceptanceUserId);
+        }
+
+        String acceptanceName = inspectionTask.getAcceptanceName();
+        if (StringUtils.isBlank(acceptanceName) && acceptanceUserId != null) {
+            SysUser acceptanceUser = sysUserMapper.selectUserById(acceptanceUserId);
+            if (acceptanceUser != null) {
+                acceptanceName = acceptanceUser.getNickName();
+            }
+        }
+        if (StringUtils.isBlank(acceptanceName) && oldInspectionTask != null) {
+            acceptanceName = oldInspectionTask.getAcceptanceName();
+        }
+        inspectionTask.setAcceptanceName(acceptanceName);
+    }
+
+    private Long syncRepairOrderIfAbnormal(InspectionTask inspectionTask, InspectionTask oldInspectionTask) {
+        if (!INSPECTION_RESULT_ABNORMAL.equals(inspectionTask.getInspectionResult())) {
+            return inspectionTask.getDeviceRepairId();
+        }
+        Long linkedRepairId = inspectionTask.getDeviceRepairId();
+        if (linkedRepairId == null && oldInspectionTask != null) {
+            linkedRepairId = oldInspectionTask.getDeviceRepairId();
+        }
+
+        if (linkedRepairId != null) {
+            DeviceRepair updateRepair = new DeviceRepair();
+            updateRepair.setId(linkedRepairId);
+            updateRepair.setRemark(inspectionTask.getAbnormalDescription());
+            deviceRepairMapper.updateById(updateRepair);
+            return linkedRepairId;
+        }
+
+        DeviceRepair deviceRepair = buildDeviceRepair(inspectionTask, oldInspectionTask);
+        deviceRepairMapper.insert(deviceRepair);
+        return deviceRepair.getId();
+    }
+
+    private DeviceRepair buildDeviceRepair(InspectionTask inspectionTask, InspectionTask oldInspectionTask) {
+        DeviceRepair deviceRepair = new DeviceRepair();
+        Long deviceLedgerId = resolveDeviceLedgerId(inspectionTask, oldInspectionTask);
+        DeviceLedger deviceLedger = resolveDeviceLedger(deviceLedgerId);
+        deviceRepair.setDeviceLedgerId(deviceLedgerId);
+        deviceRepair.setDeviceName(resolveDeviceName(inspectionTask, oldInspectionTask, deviceLedger));
+        deviceRepair.setDeviceModel(deviceLedger == null ? null : deviceLedger.getDeviceModel());
+        deviceRepair.setRepairName(resolveRepairReporter(inspectionTask, oldInspectionTask));
+        deviceRepair.setRepairTime(new Date());
+        deviceRepair.setRemark(inspectionTask.getAbnormalDescription());
+        deviceRepair.setMachineryCategory(deviceLedger == null ? null : deviceLedger.getType());
+        deviceRepair.setStatus(REPAIR_STATUS_PENDING);
+        return deviceRepair;
+    }
+
+    private Long resolveDeviceLedgerId(InspectionTask inspectionTask, InspectionTask oldInspectionTask) {
+        Integer taskId = inspectionTask.getTaskId();
+        if (taskId == null && oldInspectionTask != null) {
+            taskId = oldInspectionTask.getTaskId();
+        }
+        if (taskId == null || taskId <= 0) {
+            return null;
+        }
+        return taskId.longValue();
+    }
+
+    private DeviceLedger resolveDeviceLedger(Long deviceLedgerId) {
+        if (deviceLedgerId == null) {
+            return null;
+        }
+        return deviceLedgerMapper.selectById(deviceLedgerId);
+    }
+
+    private String resolveDeviceName(InspectionTask inspectionTask, InspectionTask oldInspectionTask, DeviceLedger deviceLedger) {
+        String taskName = inspectionTask.getTaskName();
+        if (StringUtils.isBlank(taskName) && oldInspectionTask != null) {
+            taskName = oldInspectionTask.getTaskName();
+        }
+        if (StringUtils.isNotBlank(taskName)) {
+            return taskName;
+        }
+        return deviceLedger == null ? null : deviceLedger.getDeviceName();
+    }
+
+    private String resolveRepairReporter(InspectionTask inspectionTask, InspectionTask oldInspectionTask) {
+        String reporter = inspectionTask.getInspector();
+        if (StringUtils.isBlank(reporter) && oldInspectionTask != null) {
+            reporter = oldInspectionTask.getInspector();
+        }
+        if (StringUtils.isNotBlank(reporter)) {
+            return reporter;
+        }
+        String inspectorNameByUserId = resolveInspectorNameByUserId(inspectionTask.getInspectorId());
+        if (StringUtils.isBlank(inspectorNameByUserId) && oldInspectionTask != null) {
+            inspectorNameByUserId = resolveInspectorNameByUserId(oldInspectionTask.getInspectorId());
+        }
+        if (StringUtils.isNotBlank(inspectorNameByUserId)) {
+            return inspectorNameByUserId;
+        }
+        try {
+            return SecurityUtils.getUsername();
+        } catch (Exception ignored) {
+            return "system";
+        }
+    }
+
+    private String resolveInspectorNameByUserId(String inspectorIds) {
+        if (StringUtils.isBlank(inspectorIds)) {
+            return null;
+        }
+        String firstInspectorId = Arrays.stream(inspectorIds.split(","))
+                .map(String::trim)
+                .filter(StringUtils::isNotBlank)
+                .findFirst()
+                .orElse(null);
+        if (!StringUtils.isNumeric(firstInspectorId)) {
+            return null;
+        }
+        SysUser sysUser = sysUserMapper.selectUserById(Long.parseLong(firstInspectorId));
+        return sysUser == null ? null : sysUser.getNickName();
+    }
+
+    private void saveInspectionAttachments(Long inspectionTaskId, InspectionTaskDto inspectionTaskDto) {
+        saveAttachmentIfPresent(inspectionTaskId, ApplicationTypeEnum.FILE, inspectionTaskDto.getCommonFileListDTO());
+        saveAttachmentIfPresent(inspectionTaskId, ApplicationTypeEnum.AFTER_FILE, inspectionTaskDto.getCommonFileListAfterDTO());
+        saveAttachmentIfPresent(inspectionTaskId, ApplicationTypeEnum.BEFORE_FILE, inspectionTaskDto.getCommonFileListBeforeDTO());
+    }
+
+    private void saveAttachmentIfPresent(Long inspectionTaskId, ApplicationTypeEnum applicationTypeEnum, List<StorageBlobDTO> storageBlobDTOS) {
+        if (storageBlobDTOS == null) {
+            return;
+        }
+        fileUtil.saveStorageAttachment(applicationTypeEnum, RecordTypeEnum.INSPECTION_TASK, inspectionTaskId, storageBlobDTOS);
+    }
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     public int delByIds(Long[] ids) {
diff --git a/src/main/java/com/ruoyi/inspectiontask/service/impl/TimingTaskJob.java b/src/main/java/com/ruoyi/inspectiontask/service/impl/TimingTaskJob.java
index d9c5f69..adc2416 100644
--- a/src/main/java/com/ruoyi/inspectiontask/service/impl/TimingTaskJob.java
+++ b/src/main/java/com/ruoyi/inspectiontask/service/impl/TimingTaskJob.java
@@ -3,7 +3,7 @@
 import com.ruoyi.inspectiontask.mapper.InspectionTaskMapper;
 import com.ruoyi.inspectiontask.pojo.InspectionTask;
 import com.ruoyi.inspectiontask.pojo.TimingTask;
-import lombok.RequiredArgsConstructor;
+import com.ruoyi.common.utils.StringUtils;
 import org.quartz.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
@@ -47,6 +47,9 @@
             TimingTask timingTask = tasks.isEmpty() ? null : tasks.get(0);
             if (timingTask == null) {
                 throw new JobExecutionException("鎵句笉鍒板畾鏃朵换鍔�: " + taskId);
+            }
+            if (timingTask.getIsEnabled() != null && timingTask.getIsEnabled() == 0) {
+                return;
             }
 
 //            if (!timingTask.isActive()) {
@@ -100,10 +103,15 @@
 
         // 澶嶅埗鍩烘湰灞炴��
         inspectionTask.setTaskName(timingTask.getTaskName());
+        inspectionTask.setInspectionProject(timingTask.getInspectionProject());
         inspectionTask.setTaskId(timingTask.getTaskId());
         inspectionTask.setInspectorId(timingTask.getInspectorIds());
         inspectionTask.setInspectionLocation(timingTask.getInspectionLocation());
-        inspectionTask.setRemarks("鑷姩鐢熸垚鑷畾鏃朵换鍔D: " + timingTask.getId());
+        String remarks = "鑷姩鐢熸垚鑷畾鏃朵换鍔D: " + timingTask.getId();
+        if (StringUtils.isNotBlank(timingTask.getRemarks())) {
+            remarks = remarks + "锛�" + timingTask.getRemarks();
+        }
+        inspectionTask.setRemarks(remarks);
         inspectionTask.setRegistrantId(timingTask.getRegistrantId());
         inspectionTask.setFrequencyType(timingTask.getFrequencyType());
         inspectionTask.setFrequencyDetail(timingTask.getFrequencyDetail());
diff --git a/src/main/java/com/ruoyi/inspectiontask/service/impl/TimingTaskServiceImpl.java b/src/main/java/com/ruoyi/inspectiontask/service/impl/TimingTaskServiceImpl.java
index 8772f48..779dc5f 100644
--- a/src/main/java/com/ruoyi/inspectiontask/service/impl/TimingTaskServiceImpl.java
+++ b/src/main/java/com/ruoyi/inspectiontask/service/impl/TimingTaskServiceImpl.java
@@ -35,6 +35,8 @@
     private final TimingTaskMapper timingTaskMapper;
     private final TimingTaskScheduler timingTaskScheduler;
     private final SysUserMapper sysUserMapper;
+    private static final int ENABLED = 1;
+    private static final int DISABLED = 0;
 
 
     @Override
@@ -44,6 +46,12 @@
         LambdaQueryWrapper<TimingTask> queryWrapper = new LambdaQueryWrapper<>();
         if (StringUtils.isNotBlank(timingTask.getTaskName())) {
             queryWrapper.like(TimingTask::getTaskName, timingTask.getTaskName());
+        }
+        if (StringUtils.isNotBlank(timingTask.getInspectionProject())) {
+            queryWrapper.like(TimingTask::getInspectionProject, timingTask.getInspectionProject());
+        }
+        if (timingTask.getIsEnabled() != null) {
+            queryWrapper.eq(TimingTask::getIsEnabled, timingTask.getIsEnabled());
         }
         IPage<TimingTask> taskPage = timingTaskMapper.selectPage(page, queryWrapper);
 
@@ -115,8 +123,17 @@
     @Override
     @Transactional
     public int addOrEditTimingTask(TimingTaskDto timingTaskDto) throws SchedulerException {
+        TimingTask oldTimingTask = null;
+        if (Objects.nonNull(timingTaskDto.getId())) {
+            oldTimingTask = timingTaskMapper.selectById(timingTaskDto.getId());
+            if (oldTimingTask == null) {
+                throw new IllegalArgumentException("瀹氭椂浠诲姟涓嶅瓨鍦�");
+            }
+        }
         TimingTask timingTask = new TimingTask();
         BeanUtils.copyProperties(timingTaskDto, timingTask);
+        timingTask.setIsEnabled(resolveEnabledValue(timingTask.getIsEnabled(), oldTimingTask));
+        timingTask.setActive(ENABLED == timingTask.getIsEnabled());
         // 1. 瑙f瀽瀛楃涓蹭负 LocalDate锛堝彧鍖呭惈骞存湀鏃ワ級
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
         LocalDate localDate = LocalDate.now();
@@ -132,13 +149,12 @@
         // 璁剧疆鍒涘缓浜轰俊鎭拰榛樿鍊�
         if (Objects.isNull(timingTaskDto.getId())) {
             timingTask.setRegistrationDate(LocalDate.now());
-            timingTask.setActive(true);
 
             // 璁$畻棣栨鎵ц鏃堕棿
             LocalDateTime firstExecutionTime = calculateFirstExecutionTime(timingTask);
             timingTask.setNextExecutionTime(firstExecutionTime);
             int result = timingTaskMapper.insert(timingTask);
-            if (result > 0) {
+            if (result > 0 && isEnabled(timingTask.getIsEnabled(), timingTask.isActive())) {
                 // 鏂板鎴愬姛鍚庢坊鍔犲埌璋冨害鍣�
                 timingTaskScheduler.scheduleTimingTask(timingTask);
             }
@@ -148,8 +164,17 @@
 
             int result = timingTaskMapper.updateById(timingTask);
             if (result > 0) {
-                // 鏇存柊鎴愬姛鍚庨噸鏂拌皟搴︿换鍔�
-                timingTaskScheduler.rescheduleTimingTask(timingTask);
+                boolean oldEnabled = isEnabled(oldTimingTask == null ? null : oldTimingTask.getIsEnabled(), oldTimingTask != null && oldTimingTask.isActive());
+                boolean newEnabled = isEnabled(timingTask.getIsEnabled(), timingTask.isActive());
+                if (!newEnabled) {
+                    timingTaskScheduler.unscheduleTimingTask(timingTask.getId());
+                } else if (oldEnabled) {
+                    // 鏇存柊鎴愬姛鍚庨噸鏂拌皟搴︿换鍔�
+                    timingTaskScheduler.rescheduleTimingTask(timingTask);
+                } else {
+                    // 浠庣鐢ㄦ敼涓哄惎鐢ㄦ椂閲嶆柊鍒涘缓璋冨害浠诲姟
+                    timingTaskScheduler.scheduleTimingTask(timingTask);
+                }
             }
             return result;
         }
@@ -451,6 +476,26 @@
         return days;
     }
 
+    private Integer resolveEnabledValue(Integer requestEnabled, TimingTask oldTimingTask) {
+        if (requestEnabled != null) {
+            return requestEnabled;
+        }
+        if (oldTimingTask != null) {
+            if (oldTimingTask.getIsEnabled() != null) {
+                return oldTimingTask.getIsEnabled();
+            }
+            return oldTimingTask.isActive() ? ENABLED : DISABLED;
+        }
+        return ENABLED;
+    }
+
+    private boolean isEnabled(Integer enabledValue, boolean activeFallback) {
+        if (enabledValue != null) {
+            return ENABLED == enabledValue;
+        }
+        return activeFallback;
+    }
+
 
 
     @Override
diff --git a/src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java b/src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java
index 8e004e4..0beecd2 100644
--- a/src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java
+++ b/src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java
@@ -160,6 +160,7 @@
 
     }
 
+    //鍒犻櫎鍑哄簱璁板綍
     public void deleteStockOutRecord(Long recordId, String recordType) {
         StockOutRecord one = stockOutRecordService.getOne(new QueryWrapper<StockOutRecord>()
                 .lambda().eq(StockOutRecord::getRecordId, recordId)
diff --git a/src/main/java/com/ruoyi/production/service/impl/ProductionBomStructureServiceImpl.java b/src/main/java/com/ruoyi/production/service/impl/ProductionBomStructureServiceImpl.java
index d0dab50..2bded77 100644
--- a/src/main/java/com/ruoyi/production/service/impl/ProductionBomStructureServiceImpl.java
+++ b/src/main/java/com/ruoyi/production/service/impl/ProductionBomStructureServiceImpl.java
@@ -220,7 +220,6 @@
         if (taskList == null || taskList.isEmpty()) {
             return;
         }
-
         Set<Long> routingOperationIds = taskList.stream()
                 .map(ProductionOperationTask::getProductionOrderRoutingOperationId)
                 .filter(Objects::nonNull)
@@ -228,14 +227,13 @@
         if (routingOperationIds.isEmpty()) {
             return;
         }
-
         Map<Long, ProductionOrderRoutingOperation> routingOperationMap = productionOrderRoutingOperationMapper
                 .selectBatchIds(routingOperationIds)
                 .stream()
                 .filter(item -> item != null && item.getId() != null)
                 .collect(Collectors.toMap(ProductionOrderRoutingOperation::getId, item -> item, (left, right) -> left));
-        Map<String, BigDecimal> demandedQuantityMap = buildOperationDemandedQuantityMap(structureList, rootProductModelId, orderQuantity);
-
+        // Keep task plan quantities aligned with the same order BOM snapshot demand used during snapshot creation.
+        Map<String, BigDecimal> demandedQuantityMap = buildOperationDemandedQuantityMap(structureList, rootProductModelId);
         for (ProductionOperationTask task : taskList) {
             if (task == null || task.getId() == null || task.getProductionOrderRoutingOperationId() == null) {
                 continue;
@@ -244,7 +242,11 @@
             if (routingOperation == null || routingOperation.getTechnologyRoutingOperationId() == null) {
                 continue;
             }
-            BigDecimal planQuantity = resolveTaskPlanQuantity(routingOperation, demandedQuantityMap, orderQuantity);
+            BigDecimal planQuantity = resolveTaskPlanQuantity(
+                    routingOperation,
+                    demandedQuantityMap,
+                    orderQuantity,
+                    rootProductModelId);
             if (compareDecimal(task.getPlanQuantity(), planQuantity) == 0) {
                 continue;
             }
@@ -254,10 +256,8 @@
             productionOperationTaskMapper.updateById(update);
         }
     }
-
     private Map<String, BigDecimal> buildOperationDemandedQuantityMap(List<ProductionBomStructure> structureList,
-                                                                      Long rootProductModelId,
-                                                                      BigDecimal orderQuantity) {
+                                                                      Long rootProductModelId) {
         if (structureList == null || structureList.isEmpty()) {
             return Collections.emptyMap();
         }
@@ -265,26 +265,43 @@
                 .filter(item -> item != null && item.getId() != null)
                 .collect(Collectors.toMap(ProductionBomStructure::getId, item -> item, (left, right) -> left));
         Map<String, BigDecimal> demandedQuantityMap = new HashMap<>();
+        Set<String> mergedOutputNodeKeySet = new HashSet<>();
         for (ProductionBomStructure bomStructure : structureList) {
-            if (bomStructure == null || bomStructure.getTechnologyOperationId() == null || bomStructure.getUnitQuantity() == null) {
+            if (bomStructure == null || bomStructure.getTechnologyOperationId() == null) {
                 continue;
             }
-            Long outputProductModelId = resolveOutputProductModelId(bomStructure, structureById, rootProductModelId);
+            // Resolve the output node first, then read the output node demand for the task plan quantity.
+            ProductionBomStructure outputNode = resolveOperationOutputNode(bomStructure, structureById);
+            Long outputProductModelId = resolveOutputProductModelId(outputNode, rootProductModelId);
+            if (outputProductModelId == null) {
+                continue;
+            }
+            String mergedOutputNodeKey = buildOperationOutputNodeKey(
+                    bomStructure.getTechnologyOperationId(),
+                    outputNode == null ? null : outputNode.getId(),
+                    outputProductModelId);
+            if (!mergedOutputNodeKeySet.add(mergedOutputNodeKey)) {
+                continue;
+            }
+            // Multiple input rows can point to the same output node, so only count that output demand once.
             String key = buildOperationDemandedQuantityKey(bomStructure.getTechnologyOperationId(), outputProductModelId);
-            demandedQuantityMap.merge(key, bomStructure.getUnitQuantity().multiply(orderQuantity), BigDecimal::add);
+            demandedQuantityMap.merge(key, defaultDecimal(outputNode == null ? null : outputNode.getDemandedQuantity()), BigDecimal::add);
         }
         return demandedQuantityMap;
     }
-
     private BigDecimal resolveTaskPlanQuantity(ProductionOrderRoutingOperation routingOperation,
                                                Map<String, BigDecimal> demandedQuantityMap,
-                                               BigDecimal orderQuantity) {
+                                               BigDecimal orderQuantity,
+                                               Long rootProductModelId) {
         if (routingOperation == null || demandedQuantityMap == null || demandedQuantityMap.isEmpty()) {
             return orderQuantity;
         }
+        Long outputProductModelId = routingOperation.getProductModelId() != null
+                ? routingOperation.getProductModelId()
+                : rootProductModelId;
         String key = buildOperationDemandedQuantityKey(
                 routingOperation.getTechnologyOperationId(),
-                routingOperation.getProductModelId());
+                outputProductModelId);
         BigDecimal planQuantity = demandedQuantityMap.get(key);
         return planQuantity != null ? planQuantity : orderQuantity;
     }
@@ -293,21 +310,28 @@
         return String.valueOf(operationId) + "#" + String.valueOf(outputProductModelId);
     }
 
-    private Long resolveOutputProductModelId(ProductionBomStructure bomStructure,
-                                             Map<Long, ProductionBomStructure> structureById,
-                                             Long rootProductModelId) {
+    private String buildOperationOutputNodeKey(Long operationId, Long outputNodeId, Long outputProductModelId) {
+        return String.valueOf(operationId) + "#" + String.valueOf(outputNodeId) + "#" + String.valueOf(outputProductModelId);
+    }
+
+    private ProductionBomStructure resolveOperationOutputNode(ProductionBomStructure bomStructure,
+                                                              Map<Long, ProductionBomStructure> structureById) {
         if (bomStructure == null) {
+            return null;
+        }
+        // The root node is the first output node; other rows use their direct parent as the current operation output.
+        if (bomStructure.getParentId() == null) {
+            return bomStructure;
+        }
+        ProductionBomStructure parent = structureById.get(bomStructure.getParentId());
+        return parent != null ? parent : bomStructure;
+    }
+    private Long resolveOutputProductModelId(ProductionBomStructure outputNode,
+                                             Long rootProductModelId) {
+        if (outputNode == null) {
             return rootProductModelId;
         }
-        Long parentId = bomStructure.getParentId();
-        if (parentId == null) {
-            return rootProductModelId != null ? rootProductModelId : bomStructure.getProductModelId();
-        }
-        ProductionBomStructure parent = structureById.get(parentId);
-        if (parent != null && parent.getProductModelId() != null) {
-            return parent.getProductModelId();
-        }
-        return rootProductModelId != null ? rootProductModelId : bomStructure.getProductModelId();
+        return outputNode.getProductModelId() != null ? outputNode.getProductModelId() : rootProductModelId;
     }
 
     private BigDecimal defaultDecimal(BigDecimal value) {
diff --git a/src/main/java/com/ruoyi/production/service/impl/ProductionOrderServiceImpl.java b/src/main/java/com/ruoyi/production/service/impl/ProductionOrderServiceImpl.java
index 5a8ea9c..920188e 100644
--- a/src/main/java/com/ruoyi/production/service/impl/ProductionOrderServiceImpl.java
+++ b/src/main/java/com/ruoyi/production/service/impl/ProductionOrderServiceImpl.java
@@ -245,7 +245,18 @@
                         .eq(TechnologyRoutingOperation::getTechnologyRoutingId, technologyRouting.getId())
                         .orderByDesc(TechnologyRoutingOperation::getDragSort)
                         .orderByDesc(TechnologyRoutingOperation::getId));
-        Map<String, BigDecimal> operationDemandedQuantityMap = buildOperationDemandedQuantityMap(technologyRouting, productionOrder);
+        // Build task plan quantities from order BOM snapshot demand instead of recomputing from technology BOM units.
+        Long rootProductModelId = orderBom != null && orderBom.getProductModelId() != null
+                ? orderBom.getProductModelId()
+                : productionOrder.getProductModelId();
+        List<ProductionBomStructure> orderBomStructureList = orderBom == null || orderBom.getId() == null
+                ? Collections.emptyList()
+                : productionBomStructureMapper.selectList(
+                Wrappers.<ProductionBomStructure>lambdaQuery()
+                        .eq(ProductionBomStructure::getProductionOrderBomId, orderBom.getId())
+                        .orderByAsc(ProductionBomStructure::getId));
+        Map<String, BigDecimal> operationDemandedQuantityMap =
+                buildOperationDemandedQuantityMap(orderBomStructureList, rootProductModelId);
         Map<Long, String> operationNameMap = technologyOperationMapper.selectBatchIds(
         // 閬嶅巻澶勭悊鏁版嵁骞剁粍瑁呯粨鏋�
                         routingOperations.stream()
@@ -279,7 +290,11 @@
                 ProductionOperationTask task = new ProductionOperationTask();
                 task.setProductionOrderRoutingOperationId(targetOperation.getId());
                 task.setProductionOrderId(productionOrder.getId());
-                task.setPlanQuantity(resolveTaskPlanQuantity(sourceOperation, operationDemandedQuantityMap, productionOrder));
+                task.setPlanQuantity(resolveTaskPlanQuantity(
+                        sourceOperation,
+                        operationDemandedQuantityMap,
+                        productionOrder,
+                        rootProductModelId));
                 task.setCompleteQuantity(BigDecimal.ZERO);
                 task.setWorkOrderNo(generateNextTaskNo());
                 task.setStatus(2);
@@ -314,47 +329,52 @@
         return syncedParamCount;
     }
 
-    private Map<String, BigDecimal> buildOperationDemandedQuantityMap(TechnologyRouting technologyRouting,
-                                                                      ProductionOrder productionOrder) {
-        if (technologyRouting == null || technologyRouting.getBomId() == null) {
+    private Map<String, BigDecimal> buildOperationDemandedQuantityMap(List<ProductionBomStructure> bomStructures,
+                                                                      Long rootProductModelId) {
+        if (bomStructures == null || bomStructures.isEmpty()) {
             return Collections.emptyMap();
         }
-        BigDecimal orderQuantity = defaultDecimal(productionOrder == null ? null : productionOrder.getQuantity());
-        List<TechnologyBomStructure> bomStructures = technologyBomStructureMapper.selectList(
-                Wrappers.<TechnologyBomStructure>lambdaQuery()
-                        .eq(TechnologyBomStructure::getBomId, technologyRouting.getBomId())
-                        .isNotNull(TechnologyBomStructure::getOperationId)
-                        .orderByAsc(TechnologyBomStructure::getId));
-        if (bomStructures.isEmpty()) {
-            return Collections.emptyMap();
-        }
-
-        Map<Long, TechnologyBomStructure> structureById = bomStructures.stream()
+        Map<Long, ProductionBomStructure> structureById = bomStructures.stream()
                 .filter(item -> item != null && item.getId() != null)
-                .collect(Collectors.toMap(TechnologyBomStructure::getId, item -> item, (left, right) -> left));
+                .collect(Collectors.toMap(ProductionBomStructure::getId, item -> item, (left, right) -> left));
         Map<String, BigDecimal> demandedQuantityMap = new HashMap<>();
-        for (TechnologyBomStructure bomStructure : bomStructures) {
-            if (bomStructure == null || bomStructure.getOperationId() == null) {
+        Set<String> mergedOutputNodeKeySet = new HashSet<>();
+        for (ProductionBomStructure bomStructure : bomStructures) {
+            if (bomStructure == null || bomStructure.getTechnologyOperationId() == null) {
                 continue;
             }
-            BigDecimal unitQuantity = bomStructure.getUnitQuantity();
-            if (unitQuantity == null) {
+            // The BOM row points to the producing operation; task quantity should come from that operation's output node.
+            ProductionBomStructure outputNode = resolveOperationOutputNode(bomStructure, structureById);
+            Long outputProductModelId = resolveOutputProductModelId(outputNode, rootProductModelId);
+            if (outputProductModelId == null) {
                 continue;
             }
-            Long outputProductModelId = resolveOutputProductModelId(bomStructure, structureById, technologyRouting.getProductModelId());
-            String key = buildOperationDemandedQuantityKey(bomStructure.getOperationId(), outputProductModelId);
-            demandedQuantityMap.merge(key, unitQuantity.multiply(orderQuantity), BigDecimal::add);
+            String mergedOutputNodeKey = buildOperationOutputNodeKey(
+                    bomStructure.getTechnologyOperationId(),
+                    outputNode == null ? null : outputNode.getId(),
+                    outputProductModelId);
+            if (!mergedOutputNodeKeySet.add(mergedOutputNodeKey)) {
+                continue;
+            }
+            // demandedQuantity is already the order-level required output quantity for the current output node.
+            BigDecimal demandedQuantity = defaultDecimal(outputNode == null ? null : outputNode.getDemandedQuantity());
+            String key = buildOperationDemandedQuantityKey(bomStructure.getTechnologyOperationId(), outputProductModelId);
+            demandedQuantityMap.merge(key, demandedQuantity, BigDecimal::add);
         }
         return demandedQuantityMap;
     }
 
     private BigDecimal resolveTaskPlanQuantity(TechnologyRoutingOperation sourceOperation,
                                                Map<String, BigDecimal> operationDemandedQuantityMap,
-                                               ProductionOrder productionOrder) {
+                                               ProductionOrder productionOrder,
+                                               Long rootProductModelId) {
         if (sourceOperation == null || operationDemandedQuantityMap == null || operationDemandedQuantityMap.isEmpty()) {
             return defaultDecimal(productionOrder == null ? null : productionOrder.getQuantity());
         }
-        String key = buildOperationDemandedQuantityKey(sourceOperation.getTechnologyOperationId(), sourceOperation.getProductModelId());
+        Long outputProductModelId = sourceOperation.getProductModelId() != null
+                ? sourceOperation.getProductModelId()
+                : rootProductModelId;
+        String key = buildOperationDemandedQuantityKey(sourceOperation.getTechnologyOperationId(), outputProductModelId);
         BigDecimal planQuantity = operationDemandedQuantityMap.get(key);
         return planQuantity != null ? planQuantity : defaultDecimal(productionOrder == null ? null : productionOrder.getQuantity());
     }
@@ -363,21 +383,29 @@
         return String.valueOf(operationId) + "#" + String.valueOf(outputProductModelId);
     }
 
-    private Long resolveOutputProductModelId(TechnologyBomStructure bomStructure,
-                                             Map<Long, TechnologyBomStructure> structureById,
-                                             Long routingProductModelId) {
+    private String buildOperationOutputNodeKey(Long operationId, Long outputNodeId, Long outputProductModelId) {
+        return String.valueOf(operationId) + "#" + String.valueOf(outputNodeId) + "#" + String.valueOf(outputProductModelId);
+    }
+
+    private ProductionBomStructure resolveOperationOutputNode(ProductionBomStructure bomStructure,
+                                                              Map<Long, ProductionBomStructure> structureById) {
         if (bomStructure == null) {
-            return routingProductModelId;
+            return null;
         }
-        Long parentId = bomStructure.getParentId();
-        if (parentId == null) {
-            return routingProductModelId != null ? routingProductModelId : bomStructure.getProductModelId();
+        // The root node is the first output node; child rows use their direct parent as the current operation output.
+        if (bomStructure.getParentId() == null) {
+            return bomStructure;
         }
-        TechnologyBomStructure parent = structureById.get(parentId);
-        if (parent != null && parent.getProductModelId() != null) {
-            return parent.getProductModelId();
+        ProductionBomStructure parent = structureById.get(bomStructure.getParentId());
+        return parent != null ? parent : bomStructure;
+    }
+
+    private Long resolveOutputProductModelId(ProductionBomStructure outputNode,
+                                             Long rootProductModelId) {
+        if (outputNode == null) {
+            return rootProductModelId;
         }
-        return routingProductModelId != null ? routingProductModelId : bomStructure.getProductModelId();
+        return outputNode.getProductModelId() != null ? outputNode.getProductModelId() : rootProductModelId;
     }
 
     private ProductionOrderBom syncProductionOrderBomSnapshot(ProductionOrder productionOrder, TechnologyRouting technologyRouting) {
diff --git a/src/main/java/com/ruoyi/purchase/pojo/ProductRecord.java b/src/main/java/com/ruoyi/purchase/pojo/ProductRecord.java
index fdd7503..5003107 100644
--- a/src/main/java/com/ruoyi/purchase/pojo/ProductRecord.java
+++ b/src/main/java/com/ruoyi/purchase/pojo/ProductRecord.java
@@ -5,6 +5,7 @@
 import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 
+import java.io.Serializable;
 import java.math.BigDecimal;
 import java.util.Date;
 
@@ -16,7 +17,7 @@
  */
 @Data
 @TableName("product_record")
-public class ProductRecord {
+public class ProductRecord implements Serializable {
     private static final long serialVersionUID = 1L;
 
     /**
diff --git a/src/main/java/com/ruoyi/sales/pojo/SalesQuotationProduct.java b/src/main/java/com/ruoyi/sales/pojo/SalesQuotationProduct.java
index 3e64d15..2e55e79 100644
--- a/src/main/java/com/ruoyi/sales/pojo/SalesQuotationProduct.java
+++ b/src/main/java/com/ruoyi/sales/pojo/SalesQuotationProduct.java
@@ -14,7 +14,12 @@
     private Long id;
     @Schema(description = "閿�鍞姤浠峰崟id")
     private Long salesQuotationId;
-
+    @Schema(description = "浜у搧Id")
+    @TableField(value = "product_id")
+    private Long productId;
+    @Schema(description = "浜у搧瑙勬牸Id")
+    @TableField(value = "product_model_id")
+    private Long productModelId;
     @Schema(description = "鍟嗗搧鍚嶇О")
     private String product;
     @Schema(description = "鍟嗗搧瑙勬牸")
diff --git a/src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java
index f06cad0..de86ad0 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java
@@ -13,6 +13,7 @@
 import com.ruoyi.approve.bean.vo.ApproveProcessVO;
 import com.ruoyi.basic.mapper.CustomerMapper;
 import com.ruoyi.basic.pojo.Customer;
+import com.ruoyi.common.enums.IsDeleteEnum;
 import com.ruoyi.common.utils.OrderUtils;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.bean.BeanUtils;
@@ -138,6 +139,7 @@
         // 鍒犻櫎鎶ヤ环瀹℃壒
         ApproveProcess one = approveProcessService.getOne(new LambdaQueryWrapper<ApproveProcess>()
                 .eq(ApproveProcess::getApproveType, 6)
+                .eq(ApproveProcess::getApproveDelete, IsDeleteEnum.NOT_DELETED)
                 .eq(ApproveProcess::getApproveReason, salesQuotation.getQuotationNo()));
         if(one != null){
             approveProcessService.delByIds(Collections.singletonList(one.getId()));
diff --git a/src/main/java/com/ruoyi/sales/service/impl/ShippingInfoServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/ShippingInfoServiceImpl.java
index f8bd358..8d16029 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/ShippingInfoServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/ShippingInfoServiceImpl.java
@@ -95,12 +95,6 @@
         if (CollectionUtils.isEmpty(shippingInfos)) return false;
         // 鍒犻櫎闄勪欢
         commonFileService.deleteByBusinessIds(ids, FileNameType.SHIP.getValue());
-        // 鎵e凡鍙戣揣搴撳瓨
-        for (ShippingInfo shippingInfo : shippingInfos) {
-            if ("瀹℃牳閫氳繃".equals(shippingInfo.getStatus())) {
-                stockUtils.deleteStockOutRecord(shippingInfo.getId(), StockOutQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode());
-            }
-        }
         // 鍒犻櫎鍙戣揣瀹℃壒
         if (CollectionUtils.isNotEmpty(shippingInfos)) {
             for (ShippingInfo shippingInfo : shippingInfos) {
@@ -110,6 +104,8 @@
                     List<Long> list = one.stream().map(ApproveProcess::getId).toList();
                     approveProcessService.delByIds(list);
                 }
+                // 鎵e凡鍙戣揣搴撳瓨
+                stockUtils.deleteStockOutRecord(shippingInfo.getId(), StockOutQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode());
             }
         }
         //鍒犻櫎鍙戣揣鏄庣粏
diff --git a/src/main/java/com/ruoyi/stock/controller/StockInventoryController.java b/src/main/java/com/ruoyi/stock/controller/StockInventoryController.java
index 44fe885..a0a9fa5 100644
--- a/src/main/java/com/ruoyi/stock/controller/StockInventoryController.java
+++ b/src/main/java/com/ruoyi/stock/controller/StockInventoryController.java
@@ -51,6 +51,19 @@
         return R.ok(stockInventoryDtoIPage);
     }
 
+    /**
+     * 鏌ヨ瀵瑰簲鎵瑰彿鍜屾暟閲�
+     * @param page
+     * @param stockInventoryDto
+     * @return
+     */
+    @GetMapping("/getBatchNoQty")
+    @Operation(summary = "鏌ヨ瀵瑰簲鎵瑰彿鍜屾暟閲�")
+    public R getBatchNoQty(Page page, StockInventoryDto stockInventoryDto) {
+        IPage<StockInventoryDto> stockInventoryDtoIPage = stockInventoryService.getBatchNoQty(page, stockInventoryDto);
+        return R.ok(stockInventoryDtoIPage);
+    }
+
     @PostMapping("/addstockInventory")
     @Operation(summary = "鏂板搴撳瓨")
     public R addstockInventory(@RequestBody StockInventoryDto stockInventoryDto) {
@@ -85,7 +98,7 @@
     }
 
 
-    @PostMapping("importStockInventory")
+    @PostMapping("/importStockInventory")
     @Operation(summary = "瀵煎叆搴撳瓨")
     public R importStockInventory(MultipartFile file) {
         return stockInventoryService.importStockInventory(file);
@@ -105,13 +118,13 @@
         stockInventoryService.exportStockInventory(response, stockInventoryDto);
     }
 
-    @GetMapping("stockInventoryPage")
+    @GetMapping("/stockInventoryPage")
     @Operation(summary = "搴撳瓨鎶ヨ〃鏌ヨ")
     public R stockInventoryPage(Page page, StockInventoryDto stockInventoryDto) {
         return R.ok(stockInventoryService.stockInventoryPage(stockInventoryDto,page));
     }
 
-    @GetMapping("stockInAndOutRecord")
+    @GetMapping("/stockInAndOutRecord")
     @Operation(summary = "缁熻鍚勪釜浜у搧鐨勫叆搴撳拰鍑哄簱璁板綍")
     public R stockInAndOutRecord(StockInventoryDto stockInventoryDto,Page page) {
         return R.ok(stockInventoryService.stockInAndOutRecord(stockInventoryDto,page));
@@ -128,7 +141,6 @@
     public R thawStock(@RequestBody StockInventoryDto stockInventoryDto) {
         return R.ok(stockInventoryService.thawStock(stockInventoryDto));
     }
-
 
     @GetMapping("/getByModelId")
     @Operation(summary = "鏍规嵁浜у搧瑙勬牸ID鑾峰彇鍏ュ簱璁板綍")
diff --git a/src/main/java/com/ruoyi/stock/dto/StockInventoryDto.java b/src/main/java/com/ruoyi/stock/dto/StockInventoryDto.java
index 2be6512..bc08eee 100644
--- a/src/main/java/com/ruoyi/stock/dto/StockInventoryDto.java
+++ b/src/main/java/com/ruoyi/stock/dto/StockInventoryDto.java
@@ -76,4 +76,7 @@
 
     @Schema(description = "涓嶅悎鏍煎簱瀛業D")
     private Long unQualifiedId;
+
+    @Schema(description = "浜у搧id")
+    private Long productId;
 }
diff --git a/src/main/java/com/ruoyi/stock/execl/StockInRecordExportData.java b/src/main/java/com/ruoyi/stock/execl/StockInRecordExportData.java
index d705110..a5a9642 100644
--- a/src/main/java/com/ruoyi/stock/execl/StockInRecordExportData.java
+++ b/src/main/java/com/ruoyi/stock/execl/StockInRecordExportData.java
@@ -18,11 +18,13 @@
     private String model;
     @Excel(name = "鍗曚綅")
     private String unit;
+    @Excel(name = "鎵瑰彿")
+    private String batchNo;
     @Excel(name = "鍏ュ簱鏉ユ簮")
     private String recordType;
     @Excel(name = "鍏ュ簱鏁伴噺")
     private String stockInNum;
-    @Excel(name = "鍏ュ簱鏃堕棿")
+    @Excel(name = "鍏ュ簱鏃堕棿", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private LocalDateTime createTime;
diff --git a/src/main/java/com/ruoyi/stock/execl/StockInventoryExportData.java b/src/main/java/com/ruoyi/stock/execl/StockInventoryExportData.java
index a5cec35..a608401 100644
--- a/src/main/java/com/ruoyi/stock/execl/StockInventoryExportData.java
+++ b/src/main/java/com/ruoyi/stock/execl/StockInventoryExportData.java
@@ -19,6 +19,10 @@
     @Excel(name = "鍗曚綅")
     private String unit;
 
+    @Excel(name = "鎵瑰彿")
+    private String batchNo;
+
+
     @Excel(name = "鍚堟牸搴撳瓨鏁伴噺")
     private BigDecimal qualifiedQuantity;
 
diff --git a/src/main/java/com/ruoyi/stock/execl/StockOutRecordExportData.java b/src/main/java/com/ruoyi/stock/execl/StockOutRecordExportData.java
index f120817..c0f6b25 100644
--- a/src/main/java/com/ruoyi/stock/execl/StockOutRecordExportData.java
+++ b/src/main/java/com/ruoyi/stock/execl/StockOutRecordExportData.java
@@ -17,11 +17,13 @@
     private String model;
     @Excel(name = "鍗曚綅")
     private String unit;
+    @Excel(name = "鎵瑰彿")
+    private String batchNo;
     @Excel(name = "鍑哄簱鏉ユ簮")
     private String recordType;
     @Excel(name = "鍑哄簱鏁伴噺")
-    private String stockInNum;
-    @Excel(name = "鍑哄簱鏃堕棿")
+    private String stockOutNum;
+    @Excel(name = "鍑哄簱鏃堕棿", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private LocalDateTime createTime;
diff --git a/src/main/java/com/ruoyi/stock/execl/StockUnInventoryExportData.java b/src/main/java/com/ruoyi/stock/execl/StockUnInventoryExportData.java
index 7fd6e36..6f90ec4 100644
--- a/src/main/java/com/ruoyi/stock/execl/StockUnInventoryExportData.java
+++ b/src/main/java/com/ruoyi/stock/execl/StockUnInventoryExportData.java
@@ -19,6 +19,8 @@
     @Excel(name = "鍗曚綅")
     private String unit;
 
+    @Excel(name = "鎵瑰彿")
+    private String batchNo;
     @Excel(name = "搴撳瓨鏁伴噺")
     private BigDecimal qualitity;
 
diff --git a/src/main/java/com/ruoyi/stock/mapper/StockInventoryMapper.java b/src/main/java/com/ruoyi/stock/mapper/StockInventoryMapper.java
index a31cf5b..dbc271b 100644
--- a/src/main/java/com/ruoyi/stock/mapper/StockInventoryMapper.java
+++ b/src/main/java/com/ruoyi/stock/mapper/StockInventoryMapper.java
@@ -56,4 +56,6 @@
     List<StockInventory> listSelectableBatchNoByProductModelIds(@Param("productModelIds") List<Long> productModelIds);
 
     List<StockInventory> getByModelId(@Param("productModelId") Long productModelId);
+
+    IPage<StockInventoryDto> getBatchNoQty(Page page, @Param("ew") StockInventoryDto stockInventoryDto);
 }
diff --git a/src/main/java/com/ruoyi/stock/service/StockInventoryService.java b/src/main/java/com/ruoyi/stock/service/StockInventoryService.java
index d47cc4b..5d534d5 100644
--- a/src/main/java/com/ruoyi/stock/service/StockInventoryService.java
+++ b/src/main/java/com/ruoyi/stock/service/StockInventoryService.java
@@ -47,4 +47,6 @@
     Boolean thawStock(StockInventoryDto stockInventoryDto);
 
     List<StockInventory> getByModelId(Long modelId);
+
+    IPage<StockInventoryDto> getBatchNoQty(Page page, StockInventoryDto stockInventoryDto);
 }
diff --git a/src/main/java/com/ruoyi/stock/service/impl/StockInRecordServiceImpl.java b/src/main/java/com/ruoyi/stock/service/impl/StockInRecordServiceImpl.java
index ab34aa8..7051075 100644
--- a/src/main/java/com/ruoyi/stock/service/impl/StockInRecordServiceImpl.java
+++ b/src/main/java/com/ruoyi/stock/service/impl/StockInRecordServiceImpl.java
@@ -120,7 +120,7 @@
     public void exportStockInRecord(HttpServletResponse response, StockInRecordDto stockInRecordDto) {
         List<StockInRecordExportData> list = stockInRecordMapper.listStockInRecordExportData(stockInRecordDto);
         for (StockInRecordExportData stockInRecordExportData : list) {
-            if (stockInRecordExportData.getType().equals("0")) {
+            if (!stockInRecordExportData.getType().equals("0")) {
                 stockInRecordExportData.setRecordType(EnumUtil.fromCode(StockOutQualifiedRecordTypeEnum.class, Integer.parseInt(stockInRecordExportData.getRecordType())).getValue());
             }else {
                 stockInRecordExportData.setRecordType(EnumUtil.fromCode(StockInQualifiedRecordTypeEnum.class, Integer.parseInt(stockInRecordExportData.getRecordType())).getValue());
diff --git a/src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java b/src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java
index 3808916..24605ba 100644
--- a/src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java
+++ b/src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java
@@ -29,7 +29,7 @@
 import com.ruoyi.stock.service.StockOutRecordService;
 import com.ruoyi.stock.service.StockUninventoryService;
 import jakarta.servlet.http.HttpServletResponse;
-import lombok.AllArgsConstructor;
+import lombok.RequiredArgsConstructor;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
@@ -51,15 +51,16 @@
  * @since 2026-01-21 04:16:36
  */
 @Service
-@AllArgsConstructor
+@RequiredArgsConstructor
 public class StockInventoryServiceImpl extends ServiceImpl<StockInventoryMapper, StockInventory> implements StockInventoryService {
 
-    private  StockInventoryMapper stockInventoryMapper;
-    private StockInRecordService stockInRecordService;
-    private StockOutRecordService stockOutRecordService;
-    private StockUninventoryService stockUninventoryService;
-    private SalesLedgerProductMapper salesLedgerProductMapper;
-    private ProductModelMapper productModelMapper;
+    private final StockInventoryMapper stockInventoryMapper;
+    private final StockInRecordService stockInRecordService;
+    private final StockOutRecordService stockOutRecordService;
+    private final StockUninventoryService stockUninventoryService;
+    private final SalesLedgerProductMapper salesLedgerProductMapper;
+    private final ProductModelMapper productModelMapper;
+
     @Override
     public IPage<StockInventoryDto> pagestockInventory(Page page, StockInventoryDto stockInventoryDto) {
         return stockInventoryMapper.pagestockInventory(page, stockInventoryDto);
@@ -105,8 +106,8 @@
             newStockInventory.setLockedQuantity(stockInventoryDto.getLockedQuantity());
             newStockInventory.setWarnNum(stockInventoryDto.getWarnNum());
             stockInventoryMapper.insert(newStockInventory);
-        }else {
-             stockInventoryMapper.updateAddStockInventory(stockInventoryDto);
+        } else {
+            stockInventoryMapper.updateAddStockInventory(stockInventoryDto);
         }
         return true;
     }
@@ -116,7 +117,7 @@
     @Transactional(rollbackFor = Exception.class)
     public Boolean subtractStockInventory(StockInventoryDto stockInventoryDto) {
         LambdaQueryWrapper<StockInventory> eq = new QueryWrapper<StockInventory>().lambda()
-            .eq(StockInventory::getProductModelId, stockInventoryDto.getProductModelId());
+                .eq(StockInventory::getProductModelId, stockInventoryDto.getProductModelId());
         if (StringUtils.isEmpty(stockInventoryDto.getBatchNo())) {
             eq.isNull(StockInventory::getBatchNo);
             stockInventoryDto.setBatchNo(null);
@@ -336,7 +337,7 @@
                         }
 
                         stockInventoryDto.setProductModelId(matchedProduct.getProductModelId());
-                        this.addstockInventory(stockInventoryDto);
+                        this.addStockInRecordOnly(stockInventoryDto);
                         successCount++;
                     }
 
@@ -392,28 +393,28 @@
 
         List<StockInventoryExportData> list = stockInventoryMapper.listStockInventoryExportData(stockInventoryDto);
         ExcelUtil<StockInventoryExportData> util = new ExcelUtil<>(StockInventoryExportData.class);
-        util.exportExcel(response,list, "搴撳瓨淇℃伅");
+        util.exportExcel(response, list, "搴撳瓨淇℃伅");
     }
 
     @Override
     public IPage<StockInRecordDto> stockInventoryPage(StockInventoryDto stockInventoryDto, Page page) {
-        return stockInventoryMapper.stockInventoryPage(stockInventoryDto,page);
+        return stockInventoryMapper.stockInventoryPage(stockInventoryDto, page);
     }
 
     @Override
     public IPage<StockInventoryDto> stockInAndOutRecord(StockInventoryDto stockInventoryDto, Page page) {
-        return stockInventoryMapper.stockInAndOutRecord(stockInventoryDto,page);
+        return stockInventoryMapper.stockInAndOutRecord(stockInventoryDto, page);
     }
 
     @Override
     public Boolean frozenStock(StockInventoryDto stockInventoryDto) {
         StockInventory stockInventory = stockInventoryMapper.selectById(stockInventoryDto.getId());
-        if (stockInventory.getQualitity().compareTo(stockInventoryDto.getLockedQuantity())<0) {
+        if (stockInventory.getQualitity().compareTo(stockInventoryDto.getLockedQuantity()) < 0) {
             throw new RuntimeException("鍐荤粨鏁伴噺涓嶈兘瓒呰繃搴撳瓨鏁伴噺");
         }
         if (ObjectUtils.isEmpty(stockInventory.getLockedQuantity())) {
             stockInventory.setLockedQuantity(stockInventoryDto.getLockedQuantity());
-        }else {
+        } else {
             stockInventory.setLockedQuantity(stockInventory.getLockedQuantity().add(stockInventoryDto.getLockedQuantity()));
         }
         return this.updateById(stockInventory);
@@ -422,7 +423,7 @@
     @Override
     public Boolean thawStock(StockInventoryDto stockInventoryDto) {
         StockInventory stockInventory = stockInventoryMapper.selectById(stockInventoryDto.getId());
-        if (stockInventory.getLockedQuantity().compareTo(stockInventoryDto.getLockedQuantity())<0) {
+        if (stockInventory.getLockedQuantity().compareTo(stockInventoryDto.getLockedQuantity()) < 0) {
             throw new RuntimeException("瑙e喕鏁伴噺涓嶈兘瓒呰繃鍐荤粨鏁伴噺");
         }
         stockInventory.setLockedQuantity(stockInventory.getLockedQuantity().subtract(stockInventoryDto.getLockedQuantity()));
@@ -433,4 +434,9 @@
     public List<StockInventory> getByModelId(Long modelId) {
         return stockInventoryMapper.getByModelId(modelId);
     }
+
+    @Override
+    public IPage<StockInventoryDto> getBatchNoQty(Page page, StockInventoryDto stockInventoryDto) {
+        return stockInventoryMapper.getBatchNoQty(page, stockInventoryDto);
+    }
 }
diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml
index d69a572..9bffe41 100644
--- a/src/main/resources/logback.xml
+++ b/src/main/resources/logback.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <configuration>
     <!-- 鏃ュ織瀛樻斁璺緞 -->
-	<property name="log.path" value="/home/ruoyi/logs" />
+	<property name="log.path" value="./logs" />
     <!-- 鏃ュ織杈撳嚭鏍煎紡 -->
 	<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
 
@@ -11,7 +11,7 @@
 			<pattern>${log.pattern}</pattern>
 		</encoder>
 	</appender>
-	
+
 	<!-- 绯荤粺鏃ュ織杈撳嚭 -->
 	<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
 	    <file>${log.path}/sys-info.log</file>
@@ -34,7 +34,7 @@
             <onMismatch>DENY</onMismatch>
         </filter>
 	</appender>
-	
+
 	<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
 	    <file>${log.path}/sys-error.log</file>
         <!-- 寰幆鏀跨瓥锛氬熀浜庢椂闂村垱寤烘棩蹇楁枃浠� -->
@@ -56,7 +56,7 @@
             <onMismatch>DENY</onMismatch>
         </filter>
     </appender>
-	
+
 	<!-- 鐢ㄦ埛璁块棶鏃ュ織杈撳嚭  -->
     <appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender">
 		<file>${log.path}/sys-user.log</file>
@@ -70,7 +70,7 @@
             <pattern>${log.pattern}</pattern>
         </encoder>
     </appender>
-	
+
 	<!-- 绯荤粺妯″潡鏃ュ織绾у埆鎺у埗  -->
 	<logger name="com.ruoyi" level="info" />
 	<!-- Spring鏃ュ織绾у埆鎺у埗  -->
@@ -79,15 +79,15 @@
 	<root level="info">
 		<appender-ref ref="console" />
 	</root>
-	
+
 	<!--绯荤粺鎿嶄綔鏃ュ織-->
     <root level="info">
         <appender-ref ref="file_info" />
         <appender-ref ref="file_error" />
     </root>
-	
+
 	<!--绯荤粺鐢ㄦ埛鎿嶄綔鏃ュ織-->
     <logger name="sys-user" level="info">
         <appender-ref ref="sys-user"/>
     </logger>
-</configuration> 
\ No newline at end of file
+</configuration>
diff --git a/src/main/resources/mapper/basic/CustomerMapper.xml b/src/main/resources/mapper/basic/CustomerMapper.xml
index 57dea6c..20aaefc 100644
--- a/src/main/resources/mapper/basic/CustomerMapper.xml
+++ b/src/main/resources/mapper/basic/CustomerMapper.xml
@@ -26,6 +26,7 @@
         from customer c
         left join sys_user u on c.usage_user = u.user_id
         <where>
+            and c.usage_status = 1
             <if test="c.customerName != null and c.customerName != ''">
                 and customer_name like concat('%', #{c.customerName}, '%')
             </if>
@@ -107,4 +108,4 @@
             </if>
         </where>
     </select>
-</mapper>
\ No newline at end of file
+</mapper>
diff --git a/src/main/resources/mapper/collaborativeApproval/SealApplicationManagementMapper.xml b/src/main/resources/mapper/collaborativeApproval/SealApplicationManagementMapper.xml
index 5da6dff..d8a5956 100644
--- a/src/main/resources/mapper/collaborativeApproval/SealApplicationManagementMapper.xml
+++ b/src/main/resources/mapper/collaborativeApproval/SealApplicationManagementMapper.xml
@@ -4,13 +4,27 @@
 
 
     <select id="listPage" resultType="com.ruoyi.collaborativeApproval.dto.SealApplicationManagementDTO">
-        select sam.*, su.user_name as create_user_name, d.dept_name as department,
-        su1.nick_name as approveUserName
-        from seal_application_management sam
-        left join sys_user su on sam.create_user = su.user_id
-        left join sys_user su1 on sam.approve_user_id = su1.user_id
-        left join sys_user_dept sud on su.user_id = sud.user_id
-        left join sys_dept d on sud.dept_id = d.dept_id
+        SELECT
+        sam.*,
+        su.user_name AS create_user_name,
+
+        GROUP_CONCAT(DISTINCT d.dept_name ORDER BY d.dept_id SEPARATOR ',') AS department,
+
+        su1.nick_name AS approveUserName
+
+        FROM seal_application_management sam
+
+        LEFT JOIN sys_user su
+        ON sam.create_user = su.user_id
+
+        LEFT JOIN sys_user su1
+        ON sam.approve_user_id = su1.user_id
+
+        LEFT JOIN sys_user_dept sud
+        ON su.user_id = sud.user_id
+
+        LEFT JOIN sys_dept d
+        ON sud.dept_id = d.dept_id
         <where>
             <if test="ew.applicationNum != null and ew.applicationNum != ''">
                 and sam.application_num like concat('%',#{ew.applicationNum},'%')
@@ -22,5 +36,6 @@
                 and sam.status = #{ew.status}
             </if>
         </where>
+        GROUP BY sam.id
     </select>
 </mapper>
diff --git a/src/main/resources/mapper/device/DeviceRepairMapper.xml b/src/main/resources/mapper/device/DeviceRepairMapper.xml
index 2eb1d29..713e346 100644
--- a/src/main/resources/mapper/device/DeviceRepairMapper.xml
+++ b/src/main/resources/mapper/device/DeviceRepairMapper.xml
@@ -11,10 +11,13 @@
                 dr.repair_time,
                 dr.repair_name,
                 dr.remark,
-                dr.maintenance_name,
-                dr.maintenance_time,
-                dr.maintenance_result,
-                dr.status,
+                 dr.maintenance_name,
+                 dr.maintenance_time,
+                 dr.maintenance_result,
+                 dr.acceptance_name,
+                 dr.acceptance_time,
+                 dr.acceptance_remark,
+                 dr.status,
                 dr.create_time,
                 dr.update_time,
                 dr.create_user,
@@ -60,6 +63,9 @@
                dr.maintenance_name,
                dr.maintenance_time,
                dr.maintenance_result,
+               dr.acceptance_name,
+               dr.acceptance_time,
+               dr.acceptance_remark,
                dr.status,
                dr.create_time,
                dr.update_time,
diff --git a/src/main/resources/mapper/measuringinstrumentledger/MeasuringInstrumentLedgerMapper.xml b/src/main/resources/mapper/measuringinstrumentledger/MeasuringInstrumentLedgerMapper.xml
index e4200af..65741f5 100644
--- a/src/main/resources/mapper/measuringinstrumentledger/MeasuringInstrumentLedgerMapper.xml
+++ b/src/main/resources/mapper/measuringinstrumentledger/MeasuringInstrumentLedgerMapper.xml
@@ -15,7 +15,9 @@
         next_date,
         record_date,
         CASE
-        WHEN most_date &gt;=  DATE_FORMAT(now(),'%Y-%m-%d') THEN 1
+        WHEN most_date IS NOT NULL
+        AND valid IS NOT NULL
+        AND DATE_ADD(most_date, INTERVAL valid DAY) &gt;= CURDATE() THEN 1
         ELSE 2
         END AS status,
         create_user,
@@ -40,10 +42,16 @@
             <if test="req.status != null">
                 <choose>
                     <when test="req.status == 1">
-                        AND most_date &gt;=  DATE_FORMAT(now(),'%Y-%m-%d')
+                        AND most_date IS NOT NULL
+                        AND valid IS NOT NULL
+                        AND DATE_ADD(most_date, INTERVAL valid DAY) &gt;= CURDATE()
                     </when>
                     <when test="req.status == 2">
-                        AND most_date &lt;  DATE_FORMAT(now(),'%Y-%m-%d')
+                        AND (
+                        most_date IS NULL
+                        OR valid IS NULL
+                        OR DATE_ADD(most_date, INTERVAL valid DAY) &lt; CURDATE()
+                        )
                     </when>
                 </choose>
             </if>
diff --git a/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml b/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
index ec1124a..7e352d8 100644
--- a/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
+++ b/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
@@ -63,6 +63,7 @@
         SELECT sales_ledger_product_id, IFNULL(SUM(spd.quantity), 0) as shipped_quantity
         FROM shipping_info si
         LEFT JOIN shipping_product_detail spd ON si.id = spd.shipping_info_id
+        where si.status != '瀹℃牳鎷掔粷'
         GROUP BY sales_ledger_product_id
         ) t3 ON t3.sales_ledger_product_id = T1.id
         left join product_model pm ON T1.product_model_id = pm.id
diff --git a/src/main/resources/mapper/sales/SalesQuotationMapper.xml b/src/main/resources/mapper/sales/SalesQuotationMapper.xml
index cf15b63..3c93850 100644
--- a/src/main/resources/mapper/sales/SalesQuotationMapper.xml
+++ b/src/main/resources/mapper/sales/SalesQuotationMapper.xml
@@ -20,4 +20,4 @@
             AND t1.status = #{salesQuotationDto.status}
         </if>
     </select>
-</mapper>
\ No newline at end of file
+</mapper>
diff --git a/src/main/resources/mapper/stock/StockInventoryMapper.xml b/src/main/resources/mapper/stock/StockInventoryMapper.xml
index 9612933..c71ce31 100644
--- a/src/main/resources/mapper/stock/StockInventoryMapper.xml
+++ b/src/main/resources/mapper/stock/StockInventoryMapper.xml
@@ -99,6 +99,138 @@
         INNER JOIN product_tree pt ON p.parent_id = pt.id
         )
         select
+        GROUP_CONCAT(DISTINCT batch_no ORDER BY batch_no SEPARATOR ',') as batch_no,
+        MAX(qualifiedId) as qualifiedId,
+        MAX(unQualifiedId) as unQualifiedId,
+        SUM(qualifiedQuantity) as qualifiedQuantity,
+        SUM(unQualifiedQuantity) as unQualifiedQuantity,
+        SUM(qualifiedLockedQuantity) as qualifiedLockedQuantity,
+        SUM(unQualifiedLockedQuantity) as unQualifiedLockedQuantity,
+        SUM(qualifiedQuantity - qualifiedLockedQuantity - IFNULL(qualifiedPendingOut, 0)) as qualifiedUnLockedQuantity,
+        SUM(unQualifiedQuantity - unQualifiedLockedQuantity - IFNULL(unQualifiedPendingOut, 0)) as unQualifiedUnLockedQuantity,
+        SUM(IFNULL(qualifiedPendingOut, 0)) as qualifiedPendingOutQuantity,
+        SUM(IFNULL(unQualifiedPendingOut, 0)) as unQualifiedPendingOutQuantity,
+        product_model_id,
+        MAX(create_time) as create_time,
+        MAX(update_time) as update_time,
+        MAX(warn_num) as warn_num,
+        MAX(version) as version,
+        model,
+        MAX(remark) as remark,
+        unit,
+        product_name,
+        product_id,
+        'combined' as stockType
+        from (
+        select
+        si.batch_no,
+        si.id as qualifiedId,
+        null as unQualifiedId,
+        si.qualitity as qualifiedQuantity,
+        0 as unQualifiedQuantity,
+        COALESCE(si.locked_quantity, 0) as locked_quantity,
+        COALESCE(si.locked_quantity, 0) as qualifiedLockedQuantity,
+        0 as unQualifiedLockedQuantity,
+        si.product_model_id,
+        si.create_time,
+        si.update_time,
+        COALESCE(si.warn_num, 0) as warn_num,
+        si.version,
+        (si.qualitity - COALESCE(si.locked_quantity, 0)) as un_locked_quantity,
+        pm.model,
+        si.remark,
+        pm.unit,
+        p.product_name,
+        p.id as product_id,
+        (
+        select IFNULL(SUM(sor.stock_out_num), 0)
+        from stock_out_record sor
+        where sor.product_model_id = si.product_model_id
+        and (
+        (si.batch_no is null and sor.batch_no is null)
+        or si.batch_no = sor.batch_no
+        )
+        and sor.type = '0'
+        and sor.approval_status = 0
+        ) as qualifiedPendingOut,
+        0 as unQualifiedPendingOut
+        from stock_inventory si
+        left join product_model pm on si.product_model_id = pm.id
+        left join product p on pm.product_id = p.id
+
+        union all
+
+        select
+        su.batch_no,
+        null as qualifiedId,
+        su.id as unQualifiedId,
+        0 as qualifiedQuantity,
+        su.qualitity as unQualifiedQuantity,
+        COALESCE(su.locked_quantity, 0) as locked_quantity,
+        0 as qualifiedLockedQuantity,
+        COALESCE(su.locked_quantity, 0) as unQualifiedLockedQuantity,
+        su.product_model_id,
+        su.create_time,
+        su.update_time,
+        0 as warn_num,
+        su.version,
+        (su.qualitity - COALESCE(su.locked_quantity, 0)) as un_locked_quantity,
+        pm.model,
+        su.remark,
+        pm.unit,
+        p.product_name,
+        p.id as product_id,
+        0 as qualifiedPendingOut,
+        (
+        select IFNULL(SUM(sor.stock_out_num), 0)
+        from stock_out_record sor
+        where sor.product_model_id = su.product_model_id
+        and (
+        (su.batch_no is null and sor.batch_no is null)
+        or su.batch_no = sor.batch_no
+        )
+        and sor.type = '1'
+        and sor.approval_status = 0
+        ) as unQualifiedPendingOut
+        from stock_uninventory su
+        left join product_model pm on su.product_model_id = pm.id
+        left join product p on pm.product_id = p.id
+        ) as combined
+        <where>
+            <if test="ew.productName != null and ew.productName !=''">
+                and combined.product_name in (
+                select distinct p.product_name
+                from product p
+                left join product_model pm on p.id = pm.product_id
+                where p.product_name like concat('%',#{ew.productName},'%')
+                or pm.model like concat('%',#{ew.productName},'%')
+                )
+            </if>
+            <if test="ew.topParentProductId != null and ew.topParentProductId > 0">
+                and combined.product_id in (select id from product_tree)
+            </if>
+        </where>
+        group by
+        product_model_id,
+        model,
+        unit,
+        product_name,
+        product_id
+    </select>
+
+    <select id="listStockInventoryExportData" resultType="com.ruoyi.stock.execl.StockInventoryExportData">
+        WITH RECURSIVE product_tree AS (
+        SELECT id
+        FROM product
+        WHERE id = #{ew.topParentProductId}
+
+        UNION ALL
+
+        SELECT p.id
+        FROM product p
+        INNER JOIN product_tree pt ON p.parent_id = pt.id
+        )
+        select
             batch_no,
             MAX(qualifiedId) as qualifiedId,
             MAX(unQualifiedId) as unQualifiedId,
@@ -204,84 +336,6 @@
             </if>
         </where>
         group by batch_no, product_model_id, model, unit, product_name, product_id
-    </select>
-
-    <select id="listStockInventoryExportData" resultType="com.ruoyi.stock.execl.StockInventoryExportData">
-        WITH RECURSIVE product_tree AS (
-        SELECT id
-        FROM product
-        WHERE id = #{ew.topParentProductId}
-
-        UNION ALL
-
-        SELECT p.id
-        FROM product p
-        INNER JOIN product_tree pt ON p.parent_id = pt.id
-        )
-        select
-            SUM(qualifiedQuantity) as qualifiedQuantity,
-            SUM(unQualifiedQuantity) as unQualifiedQuantity,
-            SUM(qualifiedLockedQuantity) as qualifiedLockedQuantity,
-            SUM(unQualifiedLockedQuantity) as unQualifiedLockedQuantity,
-            model,
-            unit,
-            product_name,
-            MAX(warn_num) as warn_num,
-            MAX(remark) as remark,
-            MAX(update_time) as update_time
-        from (
-            select
-            si.qualitity as qualifiedQuantity,
-            0 as unQualifiedQuantity,
-            COALESCE(si.locked_quantity, 0) as qualifiedLockedQuantity,
-            0 as unQualifiedLockedQuantity,
-            si.product_model_id,
-            si.create_time,
-            si.update_time,
-            COALESCE(si.warn_num, 0) as warn_num,
-            si.remark,
-            pm.model,
-            pm.unit,
-            p.product_name,
-            p.id as product_id
-            from stock_inventory si
-            left join product_model pm on si.product_model_id = pm.id
-            left join product p on pm.product_id = p.id
-
-            union all
-
-            select
-            0 as qualifiedQuantity,
-            su.qualitity as unQualifiedQuantity,
-            0 as qualifiedLockedQuantity,
-            COALESCE(su.locked_quantity, 0) as unQualifiedLockedQuantity,
-            su.product_model_id,
-            su.create_time,
-            su.update_time,
-            0 as warn_num,
-            su.remark,
-            pm.model,
-            pm.unit,
-            p.product_name,
-            p.id as product_id
-            from stock_uninventory su
-            left join product_model pm on su.product_model_id = pm.id
-            left join product p on pm.product_id = p.id
-        ) as combined
-        <where>
-            <if test="ew.productName != null and ew.productName !=''">
-                and combined.product_name in (
-                select distinct p.product_name
-                from product p
-                left join product_model pm on p.id = pm.product_id
-                where p.product_name like concat('%',#{ew.productName},'%') or pm.model like concat('%',#{ew.productName},'%')
-                )
-            </if>
-            <if test="ew.topParentProductId != null and ew.topParentProductId > 0">
-                and combined.product_id in (select id from product_tree)
-            </if>
-        </where>
-        group by product_model_id, model, unit, product_name
     </select>
     <select id="stockInventoryPage" resultType="com.ruoyi.stock.dto.StockInRecordDto">
         select sir.*,si.qualitity as current_stock,
@@ -471,6 +525,141 @@
                     group by spd.stock_inventory_id
                  ) as sd on sd.stock_inventory_id = si.id
         where si.product_model_id = #{productModelId}
+        and si.qualitity > IFNULL(sd.qualitity, 0)
+    </select>
+
+    <select id="getBatchNoQty" resultType="com.ruoyi.stock.dto.StockInventoryDto">
+        select
+        batch_no,
+        MAX(qualifiedId) as qualifiedId,
+        MAX(unQualifiedId) as unQualifiedId,
+
+        SUM(qualifiedQuantity) as qualifiedQuantity,
+        SUM(unQualifiedQuantity) as unQualifiedQuantity,
+
+        SUM(qualifiedLockedQuantity) as qualifiedLockedQuantity,
+        SUM(unQualifiedLockedQuantity) as unQualifiedLockedQuantity,
+
+        SUM(IFNULL(qualifiedPendingOut, 0)) as qualifiedPendingOutQuantity,
+        SUM(IFNULL(unQualifiedPendingOut, 0)) as unQualifiedPendingOutQuantity,
+
+        SUM(qualifiedQuantity - qualifiedLockedQuantity - IFNULL(qualifiedPendingOut, 0)) as qualifiedUnLockedQuantity,
+        SUM(unQualifiedQuantity - unQualifiedLockedQuantity - IFNULL(unQualifiedPendingOut, 0)) as unQualifiedUnLockedQuantity,
+
+        product_model_id,
+        model,
+        unit,
+        product_name,
+        product_id,
+
+        MAX(create_time) as create_time,
+        MAX(update_time) as update_time,
+        MAX(warn_num) as warn_num,
+        MAX(version) as version,
+        MAX(remark) as remark,
+
+        'combined' as stockType
+        from (
+        select
+        si.batch_no,
+        si.id as qualifiedId,
+        null as unQualifiedId,
+
+        si.qualitity as qualifiedQuantity,
+        0 as unQualifiedQuantity,
+
+        COALESCE(si.locked_quantity, 0) as qualifiedLockedQuantity,
+        0 as unQualifiedLockedQuantity,
+
+        si.product_model_id,
+        pm.model,
+        pm.unit,
+        p.product_name,
+        p.id as product_id,
+
+        si.create_time,
+        si.update_time,
+        COALESCE(si.warn_num, 0) as warn_num,
+        si.version,
+        si.remark,
+
+        (
+        select IFNULL(SUM(sor.stock_out_num), 0)
+        from stock_out_record sor
+        where sor.product_model_id = si.product_model_id
+        and (
+        (si.batch_no is null and sor.batch_no is null)
+        or si.batch_no = sor.batch_no
+        )
+        and sor.type = '0'
+        and sor.approval_status = 0
+        ) as qualifiedPendingOut,
+
+        0 as unQualifiedPendingOut
+        from stock_inventory si
+        left join product_model pm on si.product_model_id = pm.id
+        left join product p on pm.product_id = p.id
+
+        union all
+
+        select
+        su.batch_no,
+        null as qualifiedId,
+        su.id as unQualifiedId,
+
+        0 as qualifiedQuantity,
+        su.qualitity as unQualifiedQuantity,
+
+        0 as qualifiedLockedQuantity,
+        COALESCE(su.locked_quantity, 0) as unQualifiedLockedQuantity,
+
+        su.product_model_id,
+        pm.model,
+        pm.unit,
+        p.product_name,
+        p.id as product_id,
+
+        su.create_time,
+        su.update_time,
+        0 as warn_num,
+        su.version,
+        su.remark,
+
+        0 as qualifiedPendingOut,
+
+        (
+        select IFNULL(SUM(sor.stock_out_num), 0)
+        from stock_out_record sor
+        where sor.product_model_id = su.product_model_id
+        and (
+        (su.batch_no is null and sor.batch_no is null)
+        or su.batch_no = sor.batch_no
+        )
+        and sor.type = '1'
+        and sor.approval_status = 0
+        ) as unQualifiedPendingOut
+        from stock_uninventory su
+        left join product_model pm on su.product_model_id = pm.id
+        left join product p on pm.product_id = p.id
+        ) as combined
+        <where>
+            <if test="ew.productModelId != null and ew.productModelId > 0">
+                and combined.product_model_id = #{ew.productModelId}
+            </if>
+
+            <if test="ew.productId != null and ew.productId > 0">
+                and combined.product_id = #{ew.productId}
+            </if>
+        </where>
+        group by
+        batch_no,
+        product_model_id,
+        model,
+        unit,
+        product_name,
+        product_id
+        order by
+        batch_no
     </select>
 
 </mapper>

--
Gitblit v1.9.3