Merge branch 'dev_New_pro' into dev_pro_河南鹤壁
Co-authored-by: Cursor <cursoragent@cursor.com>
| | |
| | | .gradle
|
| | | /build/
|
| | | !gradle/wrapper/gradle-wrapper.jar
|
| | |
|
| | | claude.md
|
| | | target/
|
| | | !.mvn/wrapper/maven-wrapper.jar
|
| | |
|
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 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æ£å¸¸' AFTER `remarks`, |
| | | ADD COLUMN `abnormal_description` VARCHAR(500) NULL COMMENT 'å¼å¸¸æè¿°' AFTER `inspection_result`, |
| | | ADD COLUMN `device_repair_id` BIGINT NULL COMMENT 'å
³èç»´ä¿®åID' AFTER `abnormal_description`, |
| | | ADD COLUMN `acceptance_user_id` BIGINT NULL COMMENT 'éªæ¶äººID' 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`); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | # 设å¤å·¡æ£ä¸å®æ¶å·¡æ£å端èè°ææ¡£ï¼inspectiontaskï¼ |
| | | |
| | | > æ´æ°æ¥æï¼2026-05-15 |
| | | > éç¨æ¨¡åï¼è®¾å¤å·¡æ£ä»»å¡ `inspectiontask`ï¼`/inspectionTask`ï¼ä¸å®æ¶å·¡æ£ä»»å¡ï¼`/timingTask`ï¼ |
| | | |
| | | ## 1. æ¬æ¬¡æ¹å¨ |
| | | |
| | | 1. å·¡æ£ä»»å¡æ°å¢åæ®µï¼ |
| | | - `inspectionProject`ï¼å·¡æ£é¡¹ç®ï¼ |
| | | - `inspectionResult`ï¼å·¡æ£ç»æï¼`0`å¼å¸¸ / `1`æ£å¸¸ï¼å¿
å¡«ï¼ |
| | | - `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 | å¦ | å·¡æ£äººIDï¼æ¯æéå·åé | |
| | | | inspectionResult | string | æ¯ | `0`=å¼å¸¸ï¼`1`=æ£å¸¸ | |
| | | | abnormalDescription | string | æ¡ä»¶å¿
å¡« | å¼å¸¸æ¶å¿
å¡« | |
| | | | acceptanceUserId | long | å¦ | éªæ¶äººID | |
| | | | acceptanceName | string | å¦ | éªæ¶äººå§å | |
| | | | commonFileListDTO | array | æ¡ä»¶å¿
å¡« | éä»¶ç»1ï¼å¼å¸¸æ¶ä¸ç»è³å°ä¸ç»æå¾ï¼ | |
| | | | commonFileListAfterDTO | array | æ¡ä»¶å¿
å¡« | éä»¶ç»2ï¼å¼å¸¸æ¶ä¸ç»è³å°ä¸ç»æå¾ï¼ | |
| | | | commonFileListBeforeDTO | array | æ¡ä»¶å¿
å¡« | éä»¶ç»3ï¼å¼å¸¸æ¶ä¸ç»è³å°ä¸ç»æå¾ï¼ | |
| | | |
| | | å¼å¸¸ç¤ºä¾ï¼ |
| | | |
| | | ```json |
| | | { |
| | | "taskId": 1001, |
| | | "taskName": "ç©ºåæºA-01", |
| | | "inspectionProject": "润æ»ç³»ç»", |
| | | "inspectorId": "12", |
| | | "inspectionResult": "0", |
| | | "abnormalDescription": "çµæºå¼åï¼æ¸©ååé«", |
| | | "acceptanceUserId": 20, |
| | | "commonFileListDTO": [ |
| | | { |
| | | "id": 90001, |
| | | "application": "file" |
| | | } |
| | | ] |
| | | } |
| | | ``` |
| | | |
| | | æ£å¸¸ç¤ºä¾ï¼ |
| | | |
| | | ```json |
| | | { |
| | | "taskId": 1001, |
| | | "taskName": "ç©ºåæºA-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": "ç©ºåæºA-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. å·¡æ£è®°å½å¤æ³¨åºå®åç¼ï¼`èªå¨çæèªå®æ¶ä»»å¡ID: {id}` |
| | | 2. å½å®æ¶ä»»å¡ `remarks` é空æ¶ï¼æ¼æ¥ä¸ºï¼ |
| | | `èªå¨çæèªå®æ¶ä»»å¡ID: {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` æ¶ï¼èªå¨å·¡æ£è®°å½å¤æ³¨å¸¦ä¸è¯¥å
容ã |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | # å端èè°ææ¡£ï¼è®¾å¤æ¥ä¿® / 设å¤ä¿å
»å®æ¶ä»»å¡ / è´¢å¡ç§ç®æ»è´¦ï¼ |
| | | |
| | | ## 1. åæ´èå´ |
| | | |
| | | æ¬æ¬¡èè°æ¶å 3 个模åï¼ |
| | | |
| | | 1. è´¢å¡æ¨¡åï¼ç§ç®æ»è´¦å»æåè¯åå·ãæè¦ï¼åªè¿å 1 æ¡åè®¡æ°æ®ã |
| | | 2. 设å¤ä¿å
»å®æ¶ä»»å¡ï¼æ°å¢ `ä¿å
»äºº` åæ®µï¼å®æ¶ä»»å¡çæä¿å
»è®°å½æ¶å¸¦å
¥ã |
| | | 3. è®¾å¤æ¥ä¿®ï¼ç¡®è®¤æ¥ä¿®åæ°å¢éªæ¶å®¡æ¹ï¼éªæ¶éè¿åæç®å®ç»ã |
| | | |
| | | --- |
| | | |
| | | ## 2. æ¥å£æ¸
å |
| | | |
| | | ### 2.1 è´¢å¡-ç§ç®æ»è´¦ |
| | | |
| | | - **GET** `/financial/ledger/general` |
| | | - 说æï¼è¿åç§ç®æ»è´¦å计ï¼ä»
1 æ¡è®°å½ã |
| | | |
| | | #### 请æ±åæ°ï¼Queryï¼ |
| | | |
| | | | åæ° | ç±»å | å¿
å¡« | 说æ | |
| | | |---|---|---|---| |
| | | | `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": "æ´æ¢è½´æ¿å¹¶è¯è¿è¡æ£å¸¸", |
| | | "sparePartsUseList": [ |
| | | { |
| | | "id": 501, |
| | | "quantity": 2 |
| | | } |
| | | ] |
| | | } |
| | | ``` |
| | | |
| | | 常è§å¤±è´¥æç¤ºï¼ç¨äºå端弹çªï¼ï¼ |
| | | |
| | | - `æ¥ä¿®è®°å½ä¸åå¨` |
| | | - `该æ¥ä¿®å·²å®ç»ï¼ä¸è½éå¤ç¡®è®¤ç»´ä¿®` |
| | | - `该æ¥ä¿®å·²æäº¤éªæ¶å®¡æ¹` |
| | | - `å¤ä»¶ xxx æ°éä¸è¶³` |
| | | |
| | | #### 2.3.2 éªæ¶å®¡æ¹ï¼æ°å¢ï¼ |
| | | |
| | | - **POST** `/device/repair/acceptance` |
| | | - 说æï¼ä»
`å¾
éªæ¶(3)` å¯å®¡æ¹ï¼å®¡æ¹éè¿åç¶ææ¹ä¸º `å®ç»(1)`ã |
| | | |
| | | 请æ±åæ°ï¼Bodyï¼ï¼ |
| | | |
| | | | åæ®µ | ç±»å | å¿
å¡« | 说æ | |
| | | |---|---|---|---| |
| | | | `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 æ®éæ´æ°æ¥å£éå¶ |
| | | |
| | | - **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ï¼ç¸å
³æ¥å£ä¼åºç°å段ä¸åå¨å¼å¸¸ã |
| | | |
| | |
| | | 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; |
| | | |
| | |
| | | * åè¯æç»åå½ã |
| | | */ |
| | | private List<FinVoucherEntryDto> entries; |
| | | |
| | | private List<StorageBlobDTO> storageBlobDTOs; |
| | | } |
| | |
| | | package com.ruoyi.account.bean.vo.financial; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonInclude; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | * ç§ç®è´¦è¡æ°æ®è¿å对象ã |
| | | */ |
| | | @Data |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | public class FinLedgerRowVo { |
| | | |
| | | /** |
| | |
| | | |
| | | 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; |
| | | |
| | |
| | | * åè¯åå½å表ã |
| | | */ |
| | | private List<FinVoucherEntry> entries; |
| | | private List<StorageBlobVO> storageBlobVOList; |
| | | } |
| | |
| | | if (startMonth.isAfter(endMonth)) { |
| | | throw new ServiceException("å¼å§æä»½ä¸è½å¤§äºç»ææä»½"); |
| | | } |
| | | return buildLedgerRows(queryDto.getSubjectCode(), startMonth, endMonth, null, null); |
| | | return Collections.singletonList(buildGeneralLedgerTotalRow(queryDto.getSubjectCode(), startMonth, endMonth)); |
| | | } |
| | | |
| | | @Override |
| | |
| | | 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) { |
| | |
| | | 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; |
| | |
| | | |
| | | private final FinVoucherEntryMapper finVoucherEntryMapper; |
| | | private final AccountSubjectMapper accountSubjectMapper; |
| | | private final FileUtil fileUtil; |
| | | |
| | | @Override |
| | | public IPage<FinVoucher> pageList(Page<FinVoucher> page, FinVoucherPageDto queryDto) { |
| | |
| | | } |
| | | save(voucher); |
| | | saveEntries(voucher.getId(), validEntries); |
| | | // 5. ä¿åéå®å°è´¦éä»¶ |
| | | fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.FIN_VOUCHER, voucher.getId(), dto.getStorageBlobDTOs()); |
| | | return true; |
| | | } |
| | | |
| | |
| | | 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; |
| | | } |
| | | |
| | |
| | | FinVoucherDetailVo vo = new FinVoucherDetailVo(); |
| | | BeanUtils.copyProperties(voucher, vo); |
| | | vo.setEntries(entries); |
| | | vo.setStorageBlobVOList(fileUtil.getStorageBlobVOsByRecordTypeAndRecordId(RecordTypeEnum.FIN_VOUCHER, id)); |
| | | return vo; |
| | | } |
| | | |
| | |
| | | */ |
| | | private BigDecimal maintenancePrice; |
| | | |
| | | private List<StorageBlobDTO> storageBlobDTOList; |
| | | private List<StorageBlobDTO> storageBlobDTOS; |
| | | } |
| | |
| | | //æ´æ¹åºåºå®¡æ ¸ç¶æï¼å¾
ç¡®è®¤æ¹æå¾
å®¡æ ¸ï¼ |
| | | 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("å®¡æ ¸ä¸"); |
| | |
| | | .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) { |
| | |
| | | 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; |
| | |
| | | |
| | | 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; |
| | |
| | | public class SealApplicationManagementController { |
| | | private SealApplicationManagementService sealApplicationManagementService; |
| | | private ISysNoticeService sysNoticeService; |
| | | private FileUtil fileUtil; |
| | | |
| | | @GetMapping("/getList") |
| | | @Operation(summary = "å页æ¥è¯¢") |
| | |
| | | |
| | | @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" |
| | |
| | | |
| | | @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)); |
| | | } |
| | | |
| | |
| | | if (CollectionUtils.isEmpty(ids)) { |
| | | throw new RuntimeException("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | } |
| | | fileUtil.deleteStorageAttachmentsByApplicationAndRecordTypeAndRecordIds(ApplicationTypeEnum.FILE, |
| | | RecordTypeEnum.SEAL_APPLICATION_MANAGEMENT, |
| | | ids); |
| | | return AjaxResult.success(sealApplicationManagementService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | |
| | | 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 { |
| | |
| | | |
| | | //审æ¹äºº |
| | | private String approveUserName; |
| | | |
| | | private List<StorageBlobDTO> storageBlobDTOs; |
| | | private List<StorageBlobVO> storageBlobVOList; |
| | | |
| | | } |
| | |
| | | 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; |
| | |
| | | @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; |
| | | } |
| | | } |
| | |
| | | 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}") |
| | |
| | | @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; |
| | |
| | | @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 = "å建æ¶é´") |
| | |
| | | @Schema(description = "设å¤id") |
| | | private Long taskId; |
| | | |
| | | @Schema(description = "ä¿å
»äºº") |
| | | @Excel(name = "ä¿å
»äºº") |
| | | private String maintenancePerson; |
| | | |
| | | @Schema(description = "颿¬¡") |
| | | @Excel(name = "颿¬¡") |
| | | private String frequencyType; |
| | |
| | | |
| | | AjaxResult updateDeviceRepair(DeviceRepairDto deviceRepairDto); |
| | | |
| | | AjaxResult confirmRepair(DeviceRepairDto deviceRepairDto); |
| | | |
| | | AjaxResult approveRepairAcceptance(DeviceRepairDto deviceRepairDto); |
| | | |
| | | void export(HttpServletResponse response, Long[] ids); |
| | | |
| | | DeviceRepairVo detailById(Long id); |
| | |
| | | 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); |
| | |
| | | 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) { |
| | | // å¤çå¾çä¸ä¼ |
| | |
| | | @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<>(); |
| | |
| | | } |
| | | |
| | | @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(); |
| | |
| | | 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); |
| | |
| | | |
| | | } |
| | | |
| | | 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); |
| | |
| | | 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()); |
| | |
| | | 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
|
| | |
| | | @Excel(name = "å·¡æ£ä»»å¡åç§°") |
| | | private String taskName; |
| | | |
| | | @Schema(description = "å·¡æ£é¡¹ç®") |
| | | @Excel(name = "å·¡æ£é¡¹ç®") |
| | | private String inspectionProject; |
| | | |
| | | @Schema(description = "设å¤id") |
| | | private Integer taskId; |
| | | |
| | |
| | | @Excel(name = "夿³¨") |
| | | private String remarks; |
| | | |
| | | @Schema(description = "å·¡æ£ç»æ 0 å¼å¸¸ 1 æ£å¸¸") |
| | | private String inspectionResult; |
| | | |
| | | @Schema(description = "å¼å¸¸æè¿°") |
| | | private String abnormalDescription; |
| | | |
| | | @Schema(description = "å
³èç»´ä¿®åID") |
| | | private Long deviceRepairId; |
| | | |
| | | @Schema(description = "éªæ¶äººID") |
| | | private Long acceptanceUserId; |
| | | |
| | | @Schema(description = "éªæ¶äºº") |
| | | @Excel(name = "éªæ¶äºº") |
| | | private String acceptanceName; |
| | | |
| | | @Schema(description = "ä»»å¡ç»è®°äººID") |
| | | private Long registrantId; |
| | | |
| | |
| | | @Excel(name = "å·¡æ£ä»»å¡åç§°") |
| | | private String taskName; |
| | | |
| | | @Schema(description = "å·¡æ£é¡¹ç®") |
| | | @Excel(name = "å·¡æ£é¡¹ç®") |
| | | private String inspectionProject; |
| | | |
| | | @Schema(description = "设å¤id") |
| | | private Integer taskId; |
| | | |
| | |
| | | @Schema(description = "æ¯å¦æ¿æ´»") |
| | | private boolean isActive; |
| | | |
| | | @Schema(description = "æ¯å¦å¯ç¨ 0å¦ 1æ¯") |
| | | @Excel(name = "æ¯å¦å¯ç¨", readConverterExp = "0=å¦,1=æ¯") |
| | | private Integer isEnabled; |
| | | |
| | | @Schema(description = "夿³¨") |
| | | @Excel(name = "夿³¨") |
| | | private String remarks; |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | |
| | | 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<>(); |
| | |
| | | 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()); |
| | | //ç»è®°äººids |
| | | List<Long> registrantIds = entityPage.getRecords().stream().map(InspectionTask::getRegistrantId).collect(Collectors.toList()); |
| | | // æ¹éæ¥è¯¢ç»è®°äºº |
| | |
| | | } else { |
| | | sysUserMap = new HashMap<>(); |
| | | } |
| | | //å·¡æ£äººids |
| | | List<String> inspectorIds = entityPage.getRecords().stream().map(InspectionTask::getInspectorId).collect(Collectors.toList()); |
| | | |
| | | //è·åææä¸éå¤çç¨æ·ID |
| | | Set<Long> allUserIds = entityPage.getRecords().stream() |
| | | .map(InspectionTask::getInspectorId) // è·å"2,3"è¿æ ·çå符串 |
| | |
| | | @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-æ£å¸¸"); |
| | | } |
| | | 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) { |
| | |
| | | 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; |
| | |
| | | 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()) { |
| | |
| | | |
| | | // å¤å¶åºæ¬å±æ§ |
| | | inspectionTask.setTaskName(timingTask.getTaskName()); |
| | | inspectionTask.setInspectionProject(timingTask.getInspectionProject()); |
| | | inspectionTask.setTaskId(timingTask.getTaskId()); |
| | | inspectionTask.setInspectorId(timingTask.getInspectorIds()); |
| | | inspectionTask.setInspectionLocation(timingTask.getInspectionLocation()); |
| | | inspectionTask.setRemarks("èªå¨çæèªå®æ¶ä»»å¡ID: " + timingTask.getId()); |
| | | String remarks = "èªå¨çæèªå®æ¶ä»»å¡ID: " + 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()); |
| | |
| | | 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 |
| | |
| | | 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); |
| | | |
| | |
| | | @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. è§£æå符串为 LocalDateï¼åªå
å«å¹´ææ¥ï¼ |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | LocalDate localDate = LocalDate.now(); |
| | |
| | | // 设置å建人信æ¯åé»è®¤å¼ |
| | | 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); |
| | | } |
| | |
| | | |
| | | int result = timingTaskMapper.updateById(timingTask); |
| | | if (result > 0) { |
| | | 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; |
| | | } |
| | |
| | | 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 |
| | |
| | | |
| | | } |
| | | |
| | | //å é¤åºåºè®°å½ |
| | | public void deleteStockOutRecord(Long recordId, String recordType) { |
| | | StockOutRecord one = stockOutRecordService.getOne(new QueryWrapper<StockOutRecord>() |
| | | .lambda().eq(StockOutRecord::getRecordId, recordId) |
| | |
| | | if (taskList == null || taskList.isEmpty()) { |
| | | return; |
| | | } |
| | | |
| | | Set<Long> routingOperationIds = taskList.stream() |
| | | .map(ProductionOperationTask::getProductionOrderRoutingOperationId) |
| | | .filter(Objects::nonNull) |
| | |
| | | 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; |
| | |
| | | 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; |
| | | } |
| | |
| | | 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(); |
| | | } |
| | |
| | | .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; |
| | | } |
| | |
| | | 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) { |
| | |
| | | .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() |
| | |
| | | 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); |
| | |
| | | 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()); |
| | | } |
| | |
| | | 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; |
| | | } |
| | | return routingProductModelId != null ? routingProductModelId : bomStructure.getProductModelId(); |
| | | |
| | | private Long resolveOutputProductModelId(ProductionBomStructure outputNode, |
| | | Long rootProductModelId) { |
| | | if (outputNode == null) { |
| | | return rootProductModelId; |
| | | } |
| | | return outputNode.getProductModelId() != null ? outputNode.getProductModelId() : rootProductModelId; |
| | | } |
| | | |
| | | private ProductionOrderBom syncProductionOrderBomSnapshot(ProductionOrder productionOrder, TechnologyRouting technologyRouting) { |
| | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | |
| | | */ |
| | | @Data |
| | | @TableName("product_record") |
| | | public class ProductRecord { |
| | | public class ProductRecord implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | |
| | | 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 = "ååè§æ ¼") |
| | |
| | | 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; |
| | |
| | | // å 餿¥ä»·å®¡æ¹ |
| | | 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())); |
| | |
| | | if (CollectionUtils.isEmpty(shippingInfos)) return false; |
| | | // å é¤éä»¶ |
| | | commonFileService.deleteByBusinessIds(ids, FileNameType.SHIP.getValue()); |
| | | // æ£å·²åè´§åºå |
| | | 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) { |
| | |
| | | List<Long> list = one.stream().map(ApproveProcess::getId).toList(); |
| | | approveProcessService.delByIds(list); |
| | | } |
| | | // æ£å·²åè´§åºå |
| | | stockUtils.deleteStockOutRecord(shippingInfo.getId(), StockOutQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode()); |
| | | } |
| | | } |
| | | //å é¤åè´§æç» |
| | |
| | | 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) { |
| | |
| | | } |
| | | |
| | | |
| | | @PostMapping("importStockInventory") |
| | | @PostMapping("/importStockInventory") |
| | | @Operation(summary = "导å
¥åºå") |
| | | public R importStockInventory(MultipartFile file) { |
| | | return stockInventoryService.importStockInventory(file); |
| | |
| | | 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)); |
| | |
| | | public R thawStock(@RequestBody StockInventoryDto stockInventoryDto) { |
| | | return R.ok(stockInventoryService.thawStock(stockInventoryDto)); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/getByModelId") |
| | | @Operation(summary = "æ ¹æ®äº§åè§æ ¼IDè·åå
¥åºè®°å½") |
| | |
| | | |
| | | @Schema(description = "ä¸åæ ¼åºåID") |
| | | private Long unQualifiedId; |
| | | |
| | | @Schema(description = "产åid") |
| | | private Long productId; |
| | | } |
| | |
| | | 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; |
| | |
| | | @Excel(name = "åä½") |
| | | private String unit; |
| | | |
| | | @Excel(name = "æ¹å·") |
| | | private String batchNo; |
| | | |
| | | |
| | | @Excel(name = "åæ ¼åºåæ°é") |
| | | private BigDecimal qualifiedQuantity; |
| | | |
| | |
| | | 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; |
| | |
| | | @Excel(name = "åä½") |
| | | private String unit; |
| | | |
| | | @Excel(name = "æ¹å·") |
| | | private String batchNo; |
| | | @Excel(name = "åºåæ°é") |
| | | private BigDecimal qualitity; |
| | | |
| | |
| | | List<StockInventory> listSelectableBatchNoByProductModelIds(@Param("productModelIds") List<Long> productModelIds); |
| | | |
| | | List<StockInventory> getByModelId(@Param("productModelId") Long productModelId); |
| | | |
| | | IPage<StockInventoryDto> getBatchNoQty(Page page, @Param("ew") StockInventoryDto stockInventoryDto); |
| | | } |
| | |
| | | Boolean thawStock(StockInventoryDto stockInventoryDto); |
| | | |
| | | List<StockInventory> getByModelId(Long modelId); |
| | | |
| | | IPage<StockInventoryDto> getBatchNoQty(Page page, StockInventoryDto stockInventoryDto); |
| | | } |
| | |
| | | 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()); |
| | |
| | | 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; |
| | |
| | | * @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); |
| | |
| | | } |
| | | |
| | | stockInventoryDto.setProductModelId(matchedProduct.getProductModelId()); |
| | | this.addstockInventory(stockInventoryDto); |
| | | this.addStockInRecordOnly(stockInventoryDto); |
| | | successCount++; |
| | | } |
| | | |
| | |
| | | public List<StockInventory> getByModelId(Long modelId) { |
| | | return stockInventoryMapper.getByModelId(modelId); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<StockInventoryDto> getBatchNoQty(Page page, StockInventoryDto stockInventoryDto) { |
| | | return stockInventoryMapper.getBatchNoQty(page, stockInventoryDto); |
| | | } |
| | | } |
| | |
| | | <?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" />
|
| | |
|
| | |
| | | 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> |
| | |
| | | |
| | | |
| | | <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},'%') |
| | |
| | | and sam.status = #{ew.status} |
| | | </if> |
| | | </where> |
| | | GROUP BY sam.id |
| | | </select> |
| | | </mapper> |
| | |
| | | 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.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, |
| | |
| | | next_date, |
| | | record_date, |
| | | CASE |
| | | WHEN most_date >= 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) >= CURDATE() THEN 1 |
| | | ELSE 2 |
| | | END AS status, |
| | | create_user, |
| | |
| | | <if test="req.status != null"> |
| | | <choose> |
| | | <when test="req.status == 1"> |
| | | AND most_date >= 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) >= CURDATE() |
| | | </when> |
| | | <when test="req.status == 2"> |
| | | AND most_date < DATE_FORMAT(now(),'%Y-%m-%d') |
| | | AND ( |
| | | most_date IS NULL |
| | | OR valid IS NULL |
| | | OR DATE_ADD(most_date, INTERVAL valid DAY) < CURDATE() |
| | | ) |
| | | </when> |
| | | </choose> |
| | | </if> |
| | |
| | | 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 |
| | |
| | | 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, |
| | |
| | | </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, |
| | |
| | | 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> |